@seatlayer/js 0.104.1 → 0.105.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/dist/manager.js CHANGED
@@ -1,15 +1,11 @@
1
- import{s as _,t as K}from"./chunk-X7FRGMS2.js";import{A as De,B as Ve,C as je,D as qe,E as Ne,F as _e,G as Ke,H as Ue,I as We,J as Ge,K as Ze,L as Ye,M as Xe,N as Qe,O as Je,P as et,Q as tt,R as st,S as it,T as ot,V as at,a as L,b as U,c as k,d as O,e as W,f as G,g as Z,h as Y,i as F,j as M,k as x,l as X,m as Q,n as J,o as ee,p as te,q as T,r as m,s as P,t as se,u as D,v as ze,w as Ie,x as Oe,y as Fe,z as Pe}from"./chunk-LLK5GY5O.js";import{d as I,f as N}from"./chunk-UBFNMA7U.js";import"./chunk-OSZ7DOEH.js";var ie={hold:"Held",release:"Released",expire:"Expired",book:"Booked",unbook:"Cancelled",block:"Blocked",unblock:"Unblocked"},C=class{constructor(e,t){this.host=e;this.fetchPage=t;this.closed=!1;this.busy=!1;this.generation=0;this.entries=[];this.next=null;this.summary=document.createElement("div");this.list=document.createElement("div");this.message=document.createElement("div");this.older=document.createElement("button");this.latest=document.createElement("button");e.className="slm-seat-history",this.summary.className="slm-history-counts",this.list.className="slm-history-list",this.list.setAttribute("role","region"),this.list.setAttribute("aria-label","Seat history"),this.list.tabIndex=0,this.message.className="slm-note",this.message.setAttribute("role","status"),this.older.className=this.latest.className="slm-btn ghost",this.older.textContent="Load older",this.older.hidden=!0,this.latest.textContent="New activity \xB7 Show latest",this.latest.hidden=!0,this.older.onclick=()=>{this.load(!0)},this.latest.onclick=()=>{this.list.scrollTop=0,this.latest.hidden=!0,this.load()},e.append(this.summary,this.latest,this.list,this.message,this.older),this.load()}destroy(){this.closed=!0,this.generation++}refresh(){this.busy||this.load(!1,!0)}async load(e=!1,t=!1){if(this.closed||this.busy||e&&!this.next)return;this.busy=!0,this.older.disabled=!0;let s=this.generation;t||(this.message.textContent="Loading history\u2026");try{let i=await this.fetchPage(e?this.next:void 0,this.action);if(this.closed||s!==this.generation)return;if(this.paintCounts(i),t&&this.entries.length&&i.entries[0]?.id!==this.entries[0]?.id&&this.list.scrollTop>24){this.latest.hidden=!1;return}let o=!t||i.entries[0]?.id!==this.entries[0]?.id;e?(this.entries=[...this.entries,...i.entries.filter(a=>!this.entries.some(l=>l.id===a.id))],this.next=i.nextBefore):o&&(this.entries=i.entries,this.next=i.nextBefore),o&&this.paintRows(),this.older.hidden=this.next===null,this.message.textContent=this.entries.length?"":"No recorded activity for this seat."}catch{if(!this.closed){this.message.textContent="History could not be loaded. ";let i=document.createElement("button");i.className="slm-btn ghost",i.textContent="Retry",i.onclick=()=>{this.load(e)},this.message.append(i)}}finally{this.busy=!1,this.older.disabled=!1}}paintCounts(e){let t=[{action:"",count:e.total},...e.counts];this.summary.replaceChildren(...t.map(({action:s,count:i})=>{let o=document.createElement("button");return o.type="button",o.textContent=s?`${ie[s]??s} ${i}`:`${i} changes`,o.setAttribute("aria-pressed",String((this.action??"")===s)),o.onclick=()=>{this.busy||(this.action=s||void 0,this.entries=[],this.next=null,this.list.scrollTop=0,this.latest.hidden=!0,this.load())},o}))}paintRows(){let e=this.list.scrollTop;this.list.replaceChildren(...this.entries.map(t=>{let s=document.createElement("div");s.className="slm-history-row",s.dataset.action=t.action;let i=document.createElement("time");i.dateTime=new Date(t.at).toISOString(),i.textContent=new Date(t.at).toLocaleString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit"}),i.title=new Date(t.at).toString();let o=document.createElement("strong");return o.textContent=ie[t.action]??t.action,s.append(i,o),s})),this.list.scrollTop=e}};var lt={held:"HOLD",booked:"BOOK",expired:"EXPIRE",released:"RELEASE",cancelled:"CANCEL",blocked:"BLOCK",unblocked:"ON SALE",available:"FREE"},oe={held:"Held",booked:"Booked",expired:"Hold expired",released:"Hold released",cancelled:"Booking cancelled",blocked:"Blocked",unblocked:"Back on sale",available:"Available again"},E=class{constructor(e,t,s){this.host=e;this.locate=s;this.items=[];this.shown=new Set;this.paused=!1;this.limit=100;this.signature="unrendered";this.abort=new AbortController;e.innerHTML='<button class="slm-new-activity" hidden></button><div class="slm-activity-list" role="region" aria-label="Recent activity" tabindex="0"></div><button class="slm-more-activity" hidden>Show more activity</button>',this.list=e.querySelector(".slm-activity-list"),this.newer=e.querySelector(".slm-new-activity"),this.more=e.querySelector(".slm-more-activity");let i={signal:this.abort.signal},o=()=>{this.paused=!1,this.signature="unrendered",this.list.scrollTop=0,this.render()};this.list.addEventListener("scroll",()=>{this.list.scrollTop>24&&(this.paused=!0)},i),this.list.addEventListener("focusin",()=>{this.paused=!0},i),this.list.addEventListener("toggle",a=>{a.target.open&&(this.paused=!0)},{...i,capture:!0}),this.newer.addEventListener("click",o,i),this.more.addEventListener("click",()=>{this.limit=200,this.signature="unrendered",this.render(!0)},i)}update(e){this.items=e,this.render()}render(e=!1){let t=this.items,s=t.filter(a=>!this.shown.has(a.id)).length;if(this.newer.hidden=!this.paused,this.newer.textContent=s?`${s} new activit${s===1?"y":"ies"} \xB7 Back to live`:"Reading earlier activity \xB7 Back to live",this.paused&&!e)return;let i=t.slice(0,this.limit),o=i.map(a=>`${a.id}:${a.verb}`).join("|");if(o!==this.signature){if(this.signature=o,this.shown=new Set(t.map(a=>a.id)),this.list.replaceChildren(),!i.length){let a=document.createElement("p");a.className="slm-activity-empty",a.textContent=this.items.length?"No activity matches these filters.":"Waiting for activity. Holds, bookings and releases will appear here.",this.list.append(a)}for(let a of i){let l=document.createElement("article");l.className="slm-activity-entry",l.dataset.status=a.status;let r=document.createElement("button");r.type="button",r.className="slm-activity-row";let c=`${oe[a.verb]??a.verb} \xB7 ${a.count} seat${a.count===1?"":"s"} \xB7 ${a.sectionLabels?.join(", ")||"Event inventory"} \xB7 ${a.labels.join(", ")} \xB7 ${new Date(a.at).toLocaleString()}`;r.title=`${c} \u2014 click to show seats on the map`,r.setAttribute("aria-label",`Show seats on map: ${c}`),r.addEventListener("click",()=>this.locate(a.id));let d=document.createElement("time");d.dateTime=new Date(a.at).toISOString(),d.textContent=new Date(a.at).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"});let h=document.createElement("strong");h.textContent=lt[a.verb]??a.verb,h.title=oe[a.verb]??a.verb;let p=document.createElement("span");if(p.className="slm-activity-seats",p.textContent=a.labels.join(", "),r.append(d,h,p),l.append(r),a.count>1){let u=document.createElement("details");u.className="slm-activity-details";let g=document.createElement("summary");g.textContent="\u22EF",g.setAttribute("aria-label",`Show all ${a.count} seats`);let f=document.createElement("p");f.textContent=c,u.append(g,f),l.append(u)}this.list.append(l)}this.more.hidden=t.length<=this.limit}}destroy(){this.abort.abort()}};var R=class{constructor(e){this.host=e;this.moving=!1;this.space=!1;this.monitor=!1;this.selected=0;this.abort=new AbortController;let t=document.createElement("div");t.className="slm-navigation";let s=b=>`<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${b}</svg>`,i=s('<path d="M8 13V6a2 2 0 0 1 4 0v6-8a2 2 0 0 1 4 0v8-6a2 2 0 0 1 4 0v10c0 4-3 6-7 6-3 0-5-2-7-5l-3-4a2 2 0 0 1 3-2l2 2Z"/>'),o=s('<path d="m5 3 14 10-7 1-3 7-4-18Z"/>'),a=s('<circle cx="10.5" cy="10.5" r="6.5"/><path d="m16 16 5 5"/>'),l=s('<path d="M7 6h10M12 1v10M7 18h10"/>'),r=s('<rect x="3" y="4" width="18" height="16" rx="2"/><path d="M15 4v16"/>');t.innerHTML=`<div class="slm-navigation-tools" role="group" aria-label="Map navigation">
2
- <button type="button" data-nav="move" aria-label="Move" aria-pressed="false" title="Drag to move the map; hold Space temporarily">${i}</button>
3
- <button type="button" data-nav="select" aria-label="Select" aria-pressed="true" title="Drag to select seats \xB7 drag empty floor to move">${o}</button>
4
- <button type="button" data-nav="search" aria-label="Search" title="Search seats, rows or sections" aria-expanded="false">${a}</button>
5
- <button type="button" data-nav="zoom" aria-label="Zoom" title="Zoom controls" aria-expanded="false">${l}</button>
6
- <button type="button" hidden data-nav="out" aria-label="Zoom out">\u2212</button>
7
- <button type="button" hidden data-nav="in" aria-label="Zoom in">+</button>
8
- <span class="slm-navigation-count" role="status" aria-live="polite">0 selected</span>
9
- <button type="button" class="slm-navigation-clear" data-nav="clear" hidden title="Clear the selection">Clear</button>
10
- <button type="button" data-nav="rail" aria-label="Hide details" title="Hide details" aria-expanded="true">${r}</button>
11
- </div><div class="slm-navigation-search" hidden><input type="search" aria-label="Find section, row or seat" placeholder="Find section, row or seat"><div class="slm-navigation-results" hidden></div></div>`,e.map.after(t),this.bar=t,this.move=t.querySelector('[data-nav="move"]'),this.select=t.querySelector('[data-nav="select"]'),this.search=t.querySelector("input"),this.count=t.querySelector(".slm-navigation-count"),this.clear=t.querySelector('[data-nav="clear"]'),this.results=t.querySelector(".slm-navigation-results"),this.location=document.createElement("div"),this.location.className="slm-location",this.location.hidden=!0,this.location.setAttribute("role","status"),e.map.after(this.location);let c={signal:this.abort.signal},d=t.querySelector('[data-nav="search"]'),h=t.querySelector(".slm-navigation-search"),p=()=>{h.hidden=!0,this.results.hidden=!0,d.setAttribute("aria-expanded","false"),d.focus()};d.addEventListener("click",()=>{let b=h.hidden;h.hidden=!b,d.setAttribute("aria-expanded",String(b)),b&&this.search.focus()},c);let u=t.querySelector('[data-nav="zoom"]');u.addEventListener("click",()=>{let b=u.getAttribute("aria-expanded")!=="true";u.setAttribute("aria-expanded",String(b));for(let y of["in","out"])t.querySelector(`[data-nav="${y}"]`).hidden=!b},c),this.search.addEventListener("keydown",b=>{b.key==="Escape"&&p()},c),this.move.addEventListener("click",()=>this.setMoving(!0),c),this.select.addEventListener("click",()=>this.setMoving(!1),c),this.clear.addEventListener("click",()=>this.host.clearSelection(),c),t.querySelector('[data-nav="in"]').addEventListener("click",()=>{this.location.hidden=!0,e.pauseFollow(),e.zoomIn()},c),t.querySelector('[data-nav="out"]').addEventListener("click",()=>{this.location.hidden=!0,e.pauseFollow(),e.zoomOut()},c);let g=t.querySelector('[data-nav="rail"]');g.addEventListener("click",()=>{let b=e.root.classList.toggle("details-hidden");g.setAttribute("aria-expanded",String(!b)),g.setAttribute("aria-label",b?"Show details":"Hide details"),g.title=b?"Show details":"Hide details"},c),this.search.addEventListener("input",()=>this.find(),c),this.search.addEventListener("keydown",b=>{b.key==="Escape"&&(this.results.hidden=!0),b.key==="ArrowDown"&&(b.preventDefault(),this.results.querySelector("button")?.focus())},c),e.map.addEventListener("pointerdown",()=>{this.location.hidden=!0,e.pauseFollow(),e.root.focus({preventScroll:!0}),this.results.hidden=!0},{...c,capture:!0}),e.root.querySelector(".slm-rail")?.addEventListener("pointerdown",()=>e.pauseFollow(),{...c,capture:!0}),e.map.addEventListener("wheel",()=>{this.location.hidden=!0,e.pauseFollow()},{...c,passive:!0,capture:!0}),e.root.addEventListener("keydown",b=>{b.target?.closest('input,textarea,select,button,[contenteditable="true"]')||b.code!=="Space"||b.ctrlKey||b.metaKey||b.altKey||(b.preventDefault(),this.space||(this.space=!0,e.pauseFollow(),e.setMoving(!0)))},c);let f=()=>{this.space&&(this.space=!1,e.setMoving(this.moving))};window.addEventListener("keyup",b=>{b.code==="Space"&&f()},c),window.addEventListener("blur",f,c),window.addEventListener("resize",()=>{this.location.hidden=!0},c),e.root.querySelector('[data-ref="zfit"]')?.addEventListener("click",()=>{this.location.hidden=!0},c),e.root.addEventListener("focusout",b=>{e.root.contains(b.relatedTarget)||f()},c)}setMoving(e){this.moving=e,this.host.pauseFollow(),this.host.setMoving(e||this.space),this.move.setAttribute("aria-pressed",String(e)),this.select.setAttribute("aria-pressed",String(!e))}update(e,t=!1){this.monitor=t,this.count.hidden=t,this.paintClear(),this.move.hidden=!e,this.select.hidden=!e}selectionChanged(e){this.selected=e,this.count.textContent=`${e.toLocaleString()} selected`,this.paintClear()}paintClear(){this.clear.hidden=this.monitor||this.selected<1}find(){let e=this.search.value.trim();if(this.results.replaceChildren(),this.results.hidden=!e,!e)return;let t=this.host.targets(e);for(let s of t){let i=document.createElement("button");i.type="button",i.textContent=`${s.label} \xB7 ${s.detail}`,i.addEventListener("click",()=>{this.host.pauseFollow(),s.locate(),this.location.textContent=`${s.label} \xB7 ${s.detail}`,this.location.hidden=!1,this.results.hidden=!0,this.host.root.focus({preventScroll:!0})}),this.results.append(i)}t.length||(this.results.textContent="No matching section, row or seat.")}destroy(){this.abort.abort(),this.bar.remove(),this.location.remove()}};import{SeatmapRenderer as gt,applyOrganizerSeatGlyph as ft,clearOrganizerSeatGlyph as vt,isOrganizerGlyphPainted as yt,expandChart as xt,allObjects as wt,computeSections as kt,floorsOf as Ee,gaAreasOf as Re,gaUnitLabels as St,UNGROUPED_ID as v}from"@seatlayer/core";var nt=/^[a-zA-Z0-9._-]+$/;function rt(n){let e;try{e=new URL(n,"https://seatlayer.invalid")}catch{return null}if(e.search||e.hash)return null;let t=/^\/v1\/events\/([^/]+)\/assets\/([^/]+)$/.exec(e.pathname);if(!t)return null;try{let s=decodeURIComponent(t[1]),i=decodeURIComponent(t[2]);return!s||!nt.test(i)?null:{eventKey:s,asset:i}}catch{return null}}function ct(n){try{return/^\/v1\/events\/[^/]+\/assets(?:\/|$)/.test(new URL(n,"https://seatlayer.invalid").pathname)}catch{return!1}}var A=class{constructor(e,t){this.eventKey=e;this.load=t;this.pending=new Map;this.created=new Set;this.disposed=!1}resolve(e){let t=rt(e);if(!t)return Promise.resolve(ct(e)?null:e);if(t.eventKey!==this.eventKey||this.disposed)return Promise.resolve(null);let s=`${t.eventKey}/${t.asset}`,i=this.pending.get(s);if(i)return i;let o=this.load(t.eventKey,t.asset).then(a=>{let l=URL.createObjectURL(a);return this.disposed?(URL.revokeObjectURL(l),null):(this.created.add(l),l)}).catch(a=>{throw this.pending.delete(s),a});return this.pending.set(s,o),o}async prepareRendererChart(e){let t=async o=>{if(!o?.url)return;let a=await this.resolve(o.url);if(!a)throw new Error("organizer_event_asset_scope_mismatch");o.url=a},s=async o=>{for(let a of o){if(a.type!=="decorImage")continue;let l=a,r=await this.resolve(l.href);if(!r)throw new Error("organizer_event_asset_scope_mismatch");l.href=r}},i=async o=>{await t(o.backgroundImage),await s(o.objects)};await i(e);for(let o of e.floors??[])await i(o);return e}dispose(){if(!this.disposed){this.disposed=!0;for(let e of this.created)URL.revokeObjectURL(e);this.created.clear(),this.pending.clear()}}};function ae(n,e,t,s={}){let i=s.previous?null:document.activeElement??null;s.previous?.scrim.remove();let o=document.createElement("div");o.className="slm-ch-scrim",o.innerHTML=`<div class="slm-ch-dialog" role="dialog" aria-modal="true"
12
- aria-labelledby="slm-ch-dlg-title" tabindex="-1">${e}</div>`,n.appendChild(o);let a=o.firstElementChild,l=!1,r={scrim:o,dialog:a,close:({restoreFocus:d=!0}={})=>{l||(l=!0,o.remove(),d&&i?.focus?.(),s.onClose?.())}};return a.querySelectorAll("[data-ch-close]").forEach(d=>{d.addEventListener("click",()=>r.close())}),o.addEventListener("keydown",d=>{if(d.key==="Escape"){d.stopPropagation(),r.close();return}if(d.key!=="Tab")return;let h=[...a.querySelectorAll('summary,button:not([disabled]),select:not([hidden]),input,textarea,a[href],[tabindex]:not([tabindex="-1"])')];if(!h.length)return;let p=h[0],u=h[h.length-1];d.shiftKey&&document.activeElement===p?(d.preventDefault(),u.focus()):!d.shiftKey&&document.activeElement===u&&(d.preventDefault(),p.focus())}),t(a),L(a),(a.querySelector("input,summary,button")??a).focus(),r}var le=`
1
+ import{s as Se,t as Le}from"./chunk-X7FRGMS2.js";import{A as Vt,B as Nt,C as Kt,D as _t,E as Wt,F as Ut,G as Gt,H as Yt,I as Zt,J as Xt,K as Jt,L as Qt,M as es,N as ts,O as ss,P as is,Q as os,S as ns,a as K,b as Te,c as x,d as W,e as $,f as z,g as U,h as ce,i as G,j as D,k as $e,l as M,m as Y,n as P,o as H,p as de,q as He,r as Ie,s as It,t as Ot,u as zt,v as Pt,w as Ft,x as Dt,y as jt,z as qt}from"./chunk-K6JOQ4VE.js";import{a as Me,b as w,c as _,d as Oe}from"./chunk-LLQUHT5Q.js";import{a as le,b as Ce,c as Ee,d as re,e as B,f as E,g as Re,h as Ae,i as Be,j as A,k as f}from"./chunk-QB6PA3C6.js";import{d as ae,f as we}from"./chunk-UBFNMA7U.js";import"./chunk-OSZ7DOEH.js";var Pe={held:["clock","#d99a0b","in a cart"],booked:["bolt","#22a06b","booked"],expired:["x","#94a3b8","cart expired"],released:["x","#94a3b8","left a cart"],cancelled:["undo","#d64545","booking cancelled"],blocked:["ban","#d64545","blocked"],unblocked:["check","#64748b","back on sale"],available:["check","#22a06b","free again"],reserved:["bookmark","#c026d3","reserved"],unreserved:["check","#64748b","back on sale"]};function Fe(r){return Pe[r]?.[2]??r}function ze(r,e=[],t){let s=new Map,i=[];for(let u of r){let b=t?.(u);b?s.set(b,(s.get(b)??0)+1):i.push(u)}let n=[...s].map(([u,b])=>b>1?`${u} \xD7 ${b.toLocaleString()}`:u),o=e.length===1&&!s.has(e[0])?e[0]:"",a=i.map(u=>o&&(u.startsWith(`${o} `)||u.startsWith(`${o}-`))?u.slice(o.length+1):u),l=u=>{let b=u.lastIndexOf("-");return b>0?[u.slice(0,b),u.slice(b+1)]:[u,""]},[c]=l(a[0]??""),d=a.map(u=>l(u)).filter(([u,b])=>u===c&&/^\d+$/.test(b)).map(([,u])=>Number(u)),p=a.length>2&&d.length===a.length&&d.every((u,b)=>b===0||u===d[b-1]+1)?`${a[0]} to ${a[a.length-1]}`:a.length>3?`${a.slice(0,2).join(", ")} and ${a.length-2} more`:a.join(", ");return[o||(e.length>1?`${e.length} sections`:""),[p,...n].filter(Boolean).join(", ")].filter(Boolean).join(" \xB7 ")}var as={held:"In a cart",booked:"Booked",expired:"Hold expired",released:"Hold released",cancelled:"Booking cancelled",blocked:"Blocked",unblocked:"Back on sale",available:"Available again",reserved:"Reserved",unreserved:"Back on sale"},Z=class{constructor(e,t,s,i=()=>{}){this.host=e;this.locate=s;this.name=i;this.items=[];this.shown=new Set;this.paused=!1;this.limit=100;this.signature="unrendered";this.abort=new AbortController;this.verbs=null;e.innerHTML='<button class="slm-new-activity" hidden></button><div class="slm-activity-list" role="region" aria-label="Recent activity" tabindex="0"></div><button class="slm-more-activity" hidden>Show more activity</button>',this.list=e.querySelector(".slm-activity-list"),this.newer=e.querySelector(".slm-new-activity"),this.more=e.querySelector(".slm-more-activity");let n={signal:this.abort.signal},o=()=>{this.paused=!1,this.signature="unrendered",this.list.scrollTop=0,this.render()};this.list.addEventListener("scroll",()=>{this.list.scrollTop>24&&(this.paused=!0)},n),this.list.addEventListener("focusin",()=>{this.paused=!0},n),this.list.addEventListener("toggle",a=>{a.target.open&&(this.paused=!0)},{...n,capture:!0}),this.newer.addEventListener("click",o,n),this.more.addEventListener("click",()=>{this.limit=200,this.signature="unrendered",this.render(!0)},n)}update(e){this.items=e,this.render()}setFilter(e){String(e)!==String(this.verbs)&&(this.verbs=e,this.signature="unrendered",this.render(!0))}render(e=!1){let t=this.verbs?this.items.filter(o=>this.verbs.includes(o.verb)):this.items,s=t.filter(o=>!this.shown.has(o.id)).length;if(this.newer.hidden=!this.paused,this.newer.textContent=s?`${s} new activit${s===1?"y":"ies"} \xB7 Back to live`:"Reading earlier activity \xB7 Back to live",this.paused&&!e)return;let i=t.slice(0,this.limit),n=i.map(o=>`${o.id}:${o.verb}`).join("|");if(n!==this.signature){if(this.signature=n,this.shown=new Set(t.map(o=>o.id)),this.list.replaceChildren(),!i.length){let o=document.createElement("p");o.className="slm-activity-empty",this.items.length?o.textContent=this.verbs?.includes("booked")?"No sales in the feed yet.":this.verbs?"No carts in the feed yet.":"No activity matches these filters.":o.innerHTML=`${x("bolt","#22a06b",36)}<b>Quiet so far</b>Bookings, carts and changes appear here as they happen.`,this.list.append(o)}for(let o of i){let a=document.createElement("article");a.className="slm-activity-entry",a.dataset.status=o.status;let l=document.createElement("button");l.type="button",l.className="slm-activity-row";let c=`${as[o.verb]??o.verb} \xB7 ${o.count} seat${o.count===1?"":"s"} \xB7 ${o.sectionLabels?.join(", ")||"Event inventory"} \xB7 ${ze(o.labels,[],this.name)} \xB7 ${w(o.at,{dateStyle:"medium",timeStyle:"short"})}`;l.title=`${c} \u2014 click to show seats on the map`,l.setAttribute("aria-label",`Show seats on map: ${c}`),l.addEventListener("click",()=>this.locate(o.id));let d=document.createElement("time");d.dateTime=new Date(o.at).toISOString(),d.textContent=w(o.at,{hour:"2-digit",minute:"2-digit"},[]);let[h,p,m]=Pe[o.verb]??["info","#64748b",o.verb],u=document.createElement("span");u.className="slm-activity-text";let b=document.createElement("b");b.textContent=`${o.count.toLocaleString()} ${o.count===1?"seat":"seats"} ${m}`;let T=document.createElement("span");T.className="slm-activity-seats",T.textContent=ze(o.labels,o.sectionLabels,this.name),u.append(b,T),l.insertAdjacentHTML("afterbegin",x(h,p,24)),l.append(u,d),a.append(l),this.list.append(a)}this.more.hidden=t.length<=this.limit}}destroy(){this.abort.abort()}};var ls=typeof navigator<"u"&&/Mac|iPhone|iPad/.test(navigator.platform||navigator.userAgent)?"\u2318Z":"Ctrl Z",X=class{constructor(e){this.host=e;this.moving=!1;this.tool="select";this.space=!1;this.abort=new AbortController;let t=document.createElement("div");t.className="slm-navigation";let s=(o,a,l,c,d)=>`<button type="button" data-nav="${o}" aria-label="${l}" aria-pressed="${o==="select"}" title="${c}" aria-keyshortcuts="${d}">${$(a,"currentColor",18)}</button>`;t.innerHTML=`<div class="slm-navigation-tools" role="group" aria-label="Map tools">
2
+ ${s("select","cursor","Select","Select \xB7 click a seat or drag a box (V)","V")}
3
+ ${s("lasso","lasso","Lasso","Lasso \xB7 draw a loop around seats (L)","L")}
4
+ ${s("move","hand","Move the map","Move the map \xB7 or hold Space","Space")}
5
+ <span class="slm-navigation-rule" aria-hidden="true"></span>
6
+ <button type="button" data-nav="undo" aria-label="Undo selection" title="Undo the last change to the selection (${ls}) \xB7 redo with Shift" aria-keyshortcuts="Meta+Z Control+Z" disabled>${$("undo","currentColor",18)}</button>
7
+ </div>`,e.map.after(t),this.bar=t,this.undo=t.querySelector('[data-nav="undo"]'),this.location=document.createElement("div"),this.location.className="slm-location",this.location.hidden=!0,this.location.setAttribute("role","status"),e.map.after(this.location);let i={signal:this.abort.signal};t.addEventListener("click",o=>{let a=o.target.closest("[data-nav]")?.dataset.nav;a==="undo"?e.stepSelection(-1):a&&this.choose(a)},i),e.map.addEventListener("pointerdown",()=>{this.location.hidden=!0,e.pauseFollow(),e.root.focus({preventScroll:!0})},{...i,capture:!0}),e.root.querySelector(".slm-rail")?.addEventListener("pointerdown",()=>e.pauseFollow(),{...i,capture:!0}),e.map.addEventListener("wheel",()=>{this.location.hidden=!0,e.pauseFollow()},{...i,passive:!0,capture:!0}),e.root.addEventListener("keydown",o=>{o.target?.closest('input,textarea,select,button,[contenteditable="true"]')||o.code!=="Space"||o.ctrlKey||o.metaKey||o.altKey||(o.preventDefault(),this.space||(this.space=!0,e.pauseFollow(),e.setMoving(!0)))},i);let n=()=>{this.space&&(this.space=!1,e.setMoving(this.moving))};window.addEventListener("keyup",o=>{o.code==="Space"&&n()},i),window.addEventListener("blur",n,i),window.addEventListener("resize",()=>{this.location.hidden=!0},i),e.root.querySelector(".slm-mapchrome")?.addEventListener("click",()=>{this.location.hidden=!0},i),e.root.addEventListener("focusout",o=>{e.root.contains(o.relatedTarget)||n()},i)}choose(e){this.tool=e,this.moving=e==="move",this.host.pauseFollow(),e!=="move"&&this.host.setShape(e==="lasso"?"lasso":"box"),this.host.setMoving(this.moving||this.space),this.bar.querySelectorAll("[aria-pressed]").forEach(t=>t.setAttribute("aria-pressed",String(t.dataset.nav===e)))}resetTool(){this.tool==="move"&&(this.tool="select",this.moving=!1,this.host.setShape("box"),this.host.setMoving(this.space),this.bar.querySelectorAll("[aria-pressed]").forEach(e=>e.setAttribute("aria-pressed",String(e.dataset.nav==="select"))))}update(e){this.bar.querySelector(".slm-navigation-tools").hidden=!e,!e&&this.tool==="move"&&this.choose("select")}historyChanged(e,t){this.undo.disabled=!e}destroy(){this.abort.abort(),this.bar.remove(),this.location.remove()}};function he(r,e,t){let s=r.findIndex(n=>n.label===e),i=r.findIndex(n=>n.label===t);return s<0||i<0?[]:r.slice(Math.min(s,i),Math.max(s,i)+1).map(n=>n.label)}function rs(r,e){let t=1/0;for(let s=0;s<e.length;s++){let i=e[s],n=e[(s+1)%e.length],o=n.x-i.x,a=n.y-i.y,l=o||a?Math.max(0,Math.min(1,((r.x-i.x)*o+(r.y-i.y)*a)/(o*o+a*a))):0;t=Math.min(t,Math.hypot(r.x-(i.x+l*o),r.y-(i.y+l*a)))}return t}function De(r,e,t,s=6){let i=null;for(let n of e){if(n.state==="inactive"||n.outline.length<3)continue;let o=rs(r,n.outline.map(t));o<=s&&(!i||o<i.d)&&(i={id:n.id,d:o})}return i?.id??null}import{SeatmapRenderer as ws,applyOrganizerSeatGlyph as Ss,clearOrganizerSeatGlyph as Mt,isOrganizerGlyphPainted as Ls,expandChart as Ts,allObjects as Ms,computeSections as Cs,floorsOf as Es,gaAreasOf as Ct,gaUnitLabels as Rs,UNGROUPED_ID as k}from"@seatlayer/core";var cs=/^[a-zA-Z0-9._-]+$/;function ds(r){let e;try{e=new URL(r,"https://seatlayer.invalid")}catch{return null}if(e.search||e.hash)return null;let t=/^\/v1\/events\/([^/]+)\/assets\/([^/]+)$/.exec(e.pathname);if(!t)return null;try{let s=decodeURIComponent(t[1]),i=decodeURIComponent(t[2]);return!s||!cs.test(i)?null:{eventKey:s,asset:i}}catch{return null}}function hs(r){try{return/^\/v1\/events\/[^/]+\/assets(?:\/|$)/.test(new URL(r,"https://seatlayer.invalid").pathname)}catch{return!1}}var J=class{constructor(e,t){this.eventKey=e;this.load=t;this.pending=new Map;this.created=new Set;this.disposed=!1}resolve(e){let t=ds(e);if(!t)return Promise.resolve(hs(e)?null:e);if(t.eventKey!==this.eventKey||this.disposed)return Promise.resolve(null);let s=`${t.eventKey}/${t.asset}`,i=this.pending.get(s);if(i)return i;let n=this.load(t.eventKey,t.asset).then(o=>{let a=URL.createObjectURL(o);return this.disposed?(URL.revokeObjectURL(a),null):(this.created.add(a),a)}).catch(o=>{throw this.pending.delete(s),o});return this.pending.set(s,n),n}async prepareRendererChart(e){let t=async n=>{if(!n?.url)return;let o=await this.resolve(n.url);if(!o)throw new Error("organizer_event_asset_scope_mismatch");n.url=o},s=async n=>{for(let o of n){if(o.type!=="decorImage")continue;let a=o,l=await this.resolve(a.href);if(!l)throw new Error("organizer_event_asset_scope_mismatch");a.href=l}},i=async n=>{await t(n.backgroundImage),await s(n.objects)};await i(e);for(let n of e.floors??[])await i(n);return e}dispose(){if(!this.disposed){this.disposed=!0;for(let e of this.created)URL.revokeObjectURL(e);this.created.clear(),this.pending.clear()}}};function je(r,e,t,s={}){let i=s.previous?null:document.activeElement??null;s.previous?.scrim.remove();let n=document.createElement("div");n.className="slm-ch-scrim",n.innerHTML=`<div class="slm-ch-dialog" role="dialog" aria-modal="true"
8
+ aria-labelledby="slm-ch-dlg-title" tabindex="-1">${e}</div>`,r.appendChild(n);let o=n.firstElementChild,a=!1,l={scrim:n,dialog:o,close:({restoreFocus:d=!0}={})=>{a||(a=!0,n.remove(),d&&(i?.isConnected&&r.contains(i)?i:r).focus?.({preventScroll:!0}),s.onClose?.())}};return o.querySelectorAll("[data-ch-close]").forEach(d=>{d.addEventListener("click",()=>l.close())}),n.addEventListener("keydown",d=>{if(d.key==="Escape"){d.stopPropagation(),l.close();return}if(d.key!=="Tab")return;let h=[...o.querySelectorAll('summary,button:not([disabled]),select:not([hidden]),input,textarea,a[href],[tabindex]:not([tabindex="-1"])')];if(!h.length)return;let p=h[0],m=h[h.length-1];d.shiftKey&&document.activeElement===p?(d.preventDefault(),m.focus()):!d.shiftKey&&document.activeElement===m&&(d.preventDefault(),p.focus())}),t(o),K(o),(o.querySelector("input,summary,button")??o).focus(),l}var qe=`
13
9
  .slm{--slm-ch-scrim:rgba(0,0,0,.58)}
14
10
  .slm[data-theme=light]{--slm-ch-scrim:rgba(23,32,51,.42)}
15
11
  .slm-ch-scrim{position:absolute;inset:0;z-index:12;background:var(--slm-ch-scrim);display:grid;place-items:center;
@@ -40,47 +36,40 @@ import{s as _,t as K}from"./chunk-X7FRGMS2.js";import{A as De,B as Ve,C as je,D
40
36
  .slm-ch-seatitem .meta{margin-left:auto;color:var(--slm-muted);font-size:10.5px}
41
37
  .slm-ch-seatitem:disabled{opacity:.55;cursor:not-allowed}
42
38
  .slm-ch-seatitem .dot{width:9px;height:9px;border-radius:999px;flex:none}
43
- /* Seat list as the map reads: section \u2192 row line \u2192 seat chips tinted by status. */
44
- /* The seat list gets a wider plate than the pickers: rows of chips need air. */
45
- .slm-ch-dialog:has(.slm-ch-seatlist.grid){width:min(560px,100%);padding:22px 22px 20px}
46
- .slm-ch-dialog:has(.slm-ch-seatlist.grid) .sub{margin-bottom:18px}
47
- .slm-ch-seatlist-tools{display:flex;align-items:center;gap:14px;margin:0 0 14px}
48
- .slm-ch-seatlist-tools .slm-find{flex:1;margin:0}
49
- .slm-ch-seatlist-tools .slm-find .slm-input{min-height:34px}
50
- .slm-ch-seatlegend{flex:none;display:flex;align-items:center;gap:4px 6px;flex-wrap:wrap;font-size:10.5px;color:var(--slm-muted);font-weight:700}
51
- .slm-ch-seatlegend i{display:inline-block;width:10px;height:10px;border-radius:3px;margin-right:1px;vertical-align:-1px}
39
+ .slm-ch-seatlegend{flex:none;display:flex;align-items:center;gap:4px 12px;flex-wrap:wrap;font-size:11.5px;color:var(--slm-muted);font-weight:500}
40
+ .slm-ch-seatlegend span{display:inline-flex;align-items:center;gap:5px}
41
+ .slm-ch-seatlegend i{display:inline-block;width:10px;height:10px;border-radius:3px;border:1.5px solid}
52
42
  .slm-ch-seatlist.grid{max-height:52vh;margin-top:0}
53
- .slm-ch-seatlist.grid .slm-ch-seatgroup{padding:10px 18px;letter-spacing:.06em;text-transform:uppercase;font-size:10.5px;background:var(--slm-tint)}
54
- .slm-ch-seatlist.grid .slm-ch-seatgroup button{text-transform:none;letter-spacing:0}
55
- .slm-ch-seatrow{display:grid;grid-template-columns:112px minmax(0,1fr);align-items:start;gap:16px;padding:12px 18px;border-bottom:1px solid var(--slm-line)}
56
- .slm-ch-seatrow.loose{grid-template-columns:minmax(0,1fr)}
57
- .slm-ch-seatrow:last-child{border-bottom:0}
58
43
  .slm-ch-rowcheck{display:flex;align-items:center;gap:8px;min-height:32px;padding:4px 6px;margin-left:-6px;border-radius:7px;font-size:12px;font-weight:800;color:var(--slm-text);text-align:left}
59
44
  .slm-ch-rowcheck:hover{background:var(--slm-tint)}
60
45
  .slm-ch-rowcheck .box{width:15px;height:15px;flex:none;display:grid;place-items:center;border:1.5px solid var(--slm-muted);border-radius:4px;color:transparent;font-size:9px;font-weight:900;box-sizing:border-box}
61
46
  .slm-ch-rowcheck[aria-checked="true"] .box{border-color:var(--slm-accent);background:var(--slm-accent);color:var(--slm-accent-ink)}
62
47
  .slm-ch-rowcheck[aria-checked="mixed"] .box{border-color:var(--slm-accent);background:linear-gradient(var(--slm-accent),var(--slm-accent)) center/7px 2px no-repeat}
63
- .slm-ch-rowcheck .name{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
48
+ .slm-ch-rowcheck .name{min-width:0}
64
49
  .slm-ch-rowcheck .meta{margin-left:auto;padding-left:8px;color:var(--slm-muted);font-size:10.5px;font-weight:700;font-variant-numeric:tabular-nums}
65
50
  .slm-ch-seatchips{display:flex;flex-wrap:wrap;gap:7px;padding:1px 0}
66
- .slm .slm-ch-seatchip{min-width:34px;height:34px;padding:0 9px;border-radius:9px;border:1.5px solid var(--slm-line);background:var(--slm-surface);color:var(--slm-text);
67
- font-size:11.5px;font-weight:800;font-variant-numeric:tabular-nums;box-sizing:border-box;line-height:1;position:relative}
51
+ .slm .slm-ch-seatchip{min-width:30px;height:30px;padding:0 8px;border-radius:8px;border:1.5px solid var(--slm-line);background:transparent;color:var(--slm-text);
52
+ font-size:11.5px;font-weight:600;font-variant-numeric:tabular-nums;box-sizing:border-box;line-height:1;position:relative}
68
53
  .slm-ch-seatchip:hover{border-color:var(--slm-muted)}
69
54
  .slm-ch-seatchip:focus-visible{outline:2px solid var(--slm-accent);outline-offset:1px}
70
- .slm .slm-ch-seatchip.is-free,.slm-ch-seatlegend .is-free{border:1.5px solid;border-color:color-mix(in srgb,var(--slm-accent) 45%,var(--slm-line));background:color-mix(in srgb,var(--slm-accent) 10%,var(--slm-surface))}
71
- .slm .slm-ch-seatchip.is-held,.slm-ch-seatlegend .is-held{border:1.5px solid;border-color:#f4b740;background:color-mix(in srgb,#f4b740 22%,var(--slm-surface))}
72
- .slm .slm-ch-seatchip.is-booked,.slm-ch-seatlegend .is-booked{border:1.5px solid transparent;background:color-mix(in srgb,var(--slm-muted) 35%,var(--slm-surface));color:var(--slm-muted)}
73
- .slm .slm-ch-seatchip.is-blocked,.slm-ch-seatlegend .is-blocked{border:1.5px dashed;border-color:var(--slm-muted);color:var(--slm-muted);background:transparent}
74
- .slm .slm-ch-seatchip[aria-checked="true"]{border:1.5px solid var(--slm-accent);background:var(--slm-accent);color:var(--slm-accent-ink);box-shadow:0 0 0 2px color-mix(in srgb,var(--slm-accent) 30%,transparent)}
75
- .slm-ch-seatfoot{align-items:center;gap:10px;margin-top:18px;padding-top:16px;border-top:1px solid var(--slm-line)}
76
- .slm-ch-seatfoot .slm-ch-seatcount{flex:1;min-width:0;font-size:12px;font-weight:700;color:var(--slm-muted);font-variant-numeric:tabular-nums}
77
- .slm-ch-seatfoot .slm-btn{flex:none;min-width:110px}
78
- .slm-ch-seatfoot .quiet:disabled{opacity:.45}
79
- .slm-ch-scopebar{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:end;gap:10px;margin-top:12px}
80
- .slm-ch-scopebar label{display:grid;gap:5px;color:var(--slm-muted);font-size:10.5px;font-weight:800}
81
- .slm-ch-scopebar input{width:100%;min-height:40px;padding:8px 10px;border:1px solid var(--slm-line);border-radius:8px;
82
- background:var(--slm-surface);color:var(--slm-text);font:inherit}
83
- .slm-ch-scopesummary{padding-bottom:10px;color:var(--slm-muted);font-size:11px;font-variant-numeric:tabular-nums;white-space:nowrap}
55
+ /* Status has its own colours, never the host's accent or a ticket type's: a
56
+ gold accent made every free seat read as "in a cart" (audit m24). Free is an
57
+ open green ring; the rest are tinted and muted; picked is the accent. */
58
+ .slm .slm-ch-seatchip.is-free,.slm-ch-seatlegend .is-free{border-color:#22a06b;background:transparent}
59
+ .slm .slm-ch-seatchip.is-held,.slm-ch-seatlegend .is-held{border-color:#d99a0b;background:color-mix(in srgb,#d99a0b 18%,transparent);color:var(--slm-muted)}
60
+ .slm .slm-ch-seatchip.is-booked,.slm-ch-seatlegend .is-booked{border-color:color-mix(in srgb,var(--slm-muted) 60%,var(--slm-surface));background:color-mix(in srgb,var(--slm-muted) 18%,transparent);color:var(--slm-muted)}
61
+ .slm .slm-ch-seatchip.is-blocked,.slm-ch-seatlegend .is-blocked{border-color:color-mix(in srgb,var(--slm-muted) 85%,var(--slm-surface));background:color-mix(in srgb,var(--slm-muted) 12%,transparent);color:var(--slm-muted)}
62
+ .slm-ch-seatlegend i[class]{background:transparent}
63
+ .slm .slm-ch-seatchip[aria-checked="true"]{border-color:var(--slm-accent);background:color-mix(in srgb,var(--slm-accent) 16%,var(--slm-surface));color:var(--slm-text)}
64
+ /* The count on the left; Clear and Done small and together on the right (CR20). */
65
+ .slm-ch-seatfoot{align-items:center;gap:10px;margin-top:16px;padding-top:12px;border-top:1px solid var(--slm-line)}
66
+ .slm-ch-seatfoot [data-sl-foot]{flex:1;min-width:0;display:flex;align-items:center;gap:10px}
67
+ .slm-ch-seatfoot .slm-ch-seatcount{flex:1;min-width:0;font-size:12.5px;font-weight:600;color:var(--slm-text);font-variant-numeric:tabular-nums}
68
+ .slm-ch-seatfoot .slm-ch-footsum.warn{flex:1}
69
+ .slm .slm-ch-dialog .slm-ch-seatfoot.foot .slm-btn{flex:none;min-width:0;height:28px;padding:0 10px;border-radius:9px;font-size:12px;font-weight:600}
70
+ .slm .slm-ch-seatfoot .slm-btn.ghost{background:var(--slm-surface);color:var(--slm-text);border:1px solid var(--slm-line)}
71
+ .slm .slm-ch-seatfoot .slm-btn:disabled{opacity:.5}
72
+ @media (pointer:coarse){.slm .slm-ch-dialog .slm-ch-seatfoot.foot .slm-btn{height:auto;min-height:40px;padding:0 14px}.slm .slm-ch-seatchip{min-width:36px;height:36px}}
84
73
  .slm-ch-scopegroup{position:sticky;top:0;z-index:1;display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;
85
74
  gap:6px;padding:6px 8px;border-bottom:1px solid var(--slm-line);background:var(--slm-surface)}
86
75
  .slm-ch-groupcheck{display:flex;min-width:0;align-items:center;gap:8px;padding:5px 2px;text-align:left;font-size:11px;font-weight:800}
@@ -89,12 +78,122 @@ import{s as _,t as K}from"./chunk-X7FRGMS2.js";import{A as De,B as Ve,C as je,D
89
78
  .slm-ch-groupcheck[aria-checked="true"] .box,.slm-ch-groupcheck[aria-checked="mixed"] .box{border-color:var(--slm-accent);
90
79
  background:var(--slm-accent);color:var(--slm-accent-ink)}
91
80
  .slm-ch-groupcheck .meta{min-width:0;margin-left:auto;color:var(--slm-muted);font-size:10.5px;font-weight:600;white-space:nowrap}
92
- .slm-ch-grouptoggle{min-height:32px;padding:5px 8px;color:var(--slm-accent);font-size:11px;font-weight:800}
93
- .slm-ch-scopehint{padding:8px 10px;color:var(--slm-muted);font-size:10.5px;border-bottom:1px solid var(--slm-line)}
94
- .slm-ch-scope-empty{padding:18px 12px;color:var(--slm-muted);font-size:11.5px;text-align:center}
95
- @media(max-width:560px){.slm-ch-scopebar{grid-template-columns:1fr}.slm-ch-scopesummary{padding-bottom:0}}
81
+ /* Board CR20: pickers whose footer says what will be added; names wrap, never cut. */
82
+ .slm-ch-dialog .foot .slm-ch-footsum{flex:1;min-width:0;align-self:center;font-size:12.5px;font-weight:600;color:var(--slm-text)}
83
+ .slm-ch-dialog .foot .slm-ch-footsum.warn{color:color-mix(in srgb,#b45309 75%,var(--slm-text))}
84
+ .slm-ch-dialog:has(.slm-ch-footsum) .foot .slm-btn{flex:none;min-width:110px}
85
+ .slm-ch-findbox{margin:0 0 10px}.slm-ch-findbox .slm-input{width:100%;min-height:38px}
86
+ .slm-ch-seatitem .name{flex:1;min-width:0}.slm-ch-seatitem .meta{white-space:nowrap}
87
+ .slm-ch-seatitem .box.mixed,.slm-ch-groupcheck .box.mixed{border-color:var(--slm-accent);background:var(--slm-accent);color:var(--slm-accent-ink)}
88
+ .slm-ch-groupcheck .name{font-size:13px;font-weight:600}
89
+ .slm-ch-grouptoggle{display:grid;place-items:center;width:32px;min-height:32px;color:var(--slm-muted)}
90
+ .slm-ch-grouptoggle svg{transition:transform var(--slm-mo-quick) var(--slm-mo-out)}.slm-ch-grouptoggle.open svg{transform:rotate(90deg)}
91
+ .slm-ch-scoperows .slm-ch-seatitem{padding-left:34px}
92
+ .slm-ch-scope-empty{padding:18px 12px;color:var(--slm-muted);font-size:12.5px;line-height:1.5;text-align:center}
93
+ .slm-ch-scope-empty b{display:block;margin-bottom:4px;color:var(--slm-text);font-size:14px}
94
+ .slm-ch-secmenu{position:absolute;left:0;top:calc(100% + 6px);z-index:40;width:280px;max-height:360px;overflow:auto;padding:6px;border-radius:14px;
95
+ border:1px solid var(--slm-line);background:var(--slm-surface);box-shadow:0 12px 32px rgba(12,18,32,.18)}
96
+ .slm-ch-menuhead{margin:0;padding:6px 10px;font-size:10.5px;font-weight:700;letter-spacing:.06em;text-transform:uppercase;color:var(--slm-muted)}
97
+ .slm .slm-ch-secmenu button{display:flex;align-items:flex-start;gap:9px;width:100%;padding:8px 10px;border-radius:9px;text-align:left}
98
+ .slm .slm-ch-secmenu button:hover,.slm .slm-ch-secmenu button:focus-visible{background:var(--slm-tint);outline:none}
99
+ .slm-ch-secmenu button:disabled{opacity:.5;cursor:not-allowed}
100
+ .slm-ch-secmenu .dot,.slm-sl-section .dot{width:9px;height:9px;border-radius:50%;margin-top:4px;flex:none}
101
+ .slm-ch-secmenu b,.slm-sl-section b{display:block;font-size:13px;font-weight:600}
102
+ .slm-ch-secmenu small,.slm-sl-section small{display:block;font-size:11.5px;color:var(--slm-muted)}
103
+ .slm-ch-menuerr{margin:4px 10px;font-size:11.5px;color:color-mix(in srgb,#b45309 75%,var(--slm-text))}
104
+ /* A column whose list gives way, so in a short room the count, Clear and Done
105
+ stay in view and the list scrolls, rather than the whole dialog. */
106
+ .slm-ch-dialog:has(.slm-sl-grid){width:min(640px,100%);display:flex;flex-direction:column}
107
+ .slm-ch-dialog:has(.slm-sl-grid)>*{flex:none}
108
+ .slm .slm-ch-dialog>.slm-sl-grid{flex:0 1 auto;min-height:150px}
109
+ .slm-sl-grid{display:grid;grid-template-columns:220px minmax(0,1fr);height:min(52vh,440px);border:1px solid var(--slm-line);border-radius:10px;overflow:hidden}
110
+ .slm-sl-sections{overflow:auto;padding:6px;border-right:1px solid var(--slm-line)}
111
+ .slm .slm-sl-section{display:flex;align-items:flex-start;gap:9px;width:100%;padding:9px 10px;border-radius:10px;text-align:left}
112
+ .slm .slm-sl-section.on{background:color-mix(in srgb,var(--slm-accent) 14%,transparent)}
113
+ .slm-sl-section svg{margin-left:auto;align-self:center;color:var(--slm-muted);flex:none}
114
+ .slm-sl-rows{display:flex;flex-direction:column;min-height:0;padding:12px 18px 0}
115
+ .slm-sl-head{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:6px}.slm-sl-head b{flex:1;min-width:0;font-size:14px;font-weight:700;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
116
+ .slm .slm-sl-head .slm-btn{flex:none;min-width:0;padding:6px 11px;font-size:12px}
117
+ .slm-sl-rows .slm-ch-seatlegend{margin-bottom:6px}
118
+ .slm-sl-rows .slm-ch-seatlist.grid{flex:1;max-height:none;border:0;border-radius:0;margin:0;overflow:auto}
119
+ .slm-sl-row{padding:10px 0;border-top:1px solid var(--slm-line)}
120
+ .slm-sl-row .slm-ch-seatchips{padding-left:27px;margin-top:8px;gap:5px}
121
+ .slm-sl-note{margin:0 0 6px;font-size:12px;color:var(--slm-muted)}
122
+ .slm .slm-ch-seatchip:disabled{opacity:.55;cursor:not-allowed}
123
+ @media(max-width:620px){.slm-sl-grid{grid-template-columns:1fr;grid-template-rows:minmax(0,2fr) minmax(0,3fr);height:auto}.slm-sl-sections{border-right:0;border-bottom:1px solid var(--slm-line)}}
96
124
  @media (prefers-reduced-motion:reduce){.slm-ch-scrim,.slm-ch-dialog{animation:none!important}}
97
- `;var ne="seatlayer-manager-style",re="seatlayer-manager-channels-style",dt=`${le}
125
+ `;function pe(){return'<div class="slm-opening" data-ref="opening" role="status"><span class="slm-opening-spin" aria-hidden="true"></span><b>Opening the Control room\u2026</b><span>Loading the seats and their live state</span></div>'}function me(){let r=(e,t=12)=>`<span class="slm-skel" style="width:${e}px;height:${t}px"></span>`;return`<div class="slm-railskel" aria-hidden="true">${r(140,16)}${r(280)}${r(240)}<span class="slm-skel" style="width:100%;height:120px;border-radius:14px"></span>${r(200)}${r(280)}${r(260)}</div>`}var ps={offline:{glyph:"alert",hue:"#d64545",title:"The Control room couldn't open",body:"We could not reach SeatLayer. Check the connection; nothing about the event has changed.",action:"Try again"},access:{glyph:"lock",hue:"#3b82f6",title:"You don't have access to this room",body:'Your role can see the event but not its Control room. Ask an admin for "View the Control room".',action:null},missing:{glyph:"alert",hue:"#d64545",title:"This event is not here",body:"It may have been removed, or the link points at another event. Nothing was changed.",action:null},signedout:{glyph:"user",hue:"#0ea5a5",title:"You were signed out",body:"For your security the session ended. Sign in again and the room comes back as it was.",action:"Sign in again"}};function Ve(r,e){let t=ps[r],s=r==="access"&&e?.trim()?t.body.replace("Your role can",`Your role in ${e.trim()} can`):t.body;return`<div class="slm-roomcard" data-ref="roomcard" data-kind="${r}"><div role="alertdialog" aria-labelledby="slm-roomcard-title">${x(t.glyph,t.hue,44)}<b id="slm-roomcard-title">${t.title}</b><p>${f(s)}</p>${t.action?`<button type="button" class="slm-btn" data-roomcard-act>${t.action}</button>`:""}</div></div>`}function Ne(r){return r==="live"?"":r==="paused"?'<div class="slm-connbanner warn" role="status"><span>Live updates paused. Reconnecting\u2026 The map and numbers may be up to 30 s old. Anything you change is kept.</span></div>':`<div class="slm-connbanner err" role="alert"><span>Couldn't reconnect for 2 minutes. The map may be out of date; changes can't be saved until it's back.</span><button type="button" data-conn-retry>Try now</button></div>`}function Ke(r,e,t){return`<b>${f(r)}${e?` \xB7 ${f(e)}`:""}</b>`+(t?`<span class="slm-fsline-counts">${t.booked.toLocaleString()} sold \xB7 ${t.held.toLocaleString()} in carts \xB7 ${t.free.toLocaleString()} free</span>`:"")+'<span class="slm-fsline-gap"></span><button type="button" class="slm-btn ghost" data-fs-exit>Exit full screen</button><kbd>esc</kbd>'}function _e(r){return`<div class="slm-nosales">${x("bolt","#22a06b",40)}<b>No sales yet</b><p>The first booking shows here the moment it happens.</p></div>`+(r?`<p class="slm-nosales-viewers">${r.toLocaleString()} ${r===1?"person is":"people are"} looking at the seat map right now.</p>`:"")}var We=`
126
+ .slm-opening{position:absolute;inset:0;z-index:6;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;background:var(--slm-bg);text-align:center}
127
+ .slm-opening b{margin-top:10px;font-size:14px;font-weight:600;color:var(--slm-text)}.slm-opening span:last-child{font-size:12.5px;color:var(--slm-muted)}
128
+ .slm-opening-spin{width:32px;height:32px;border-radius:50%;border:3px solid var(--slm-line);border-top-color:var(--slm-accent);animation:slm-open-spin calc(var(--slm-mo-slow) * 3) linear infinite}
129
+ @keyframes slm-open-spin{to{transform:rotate(360deg)}}
130
+ .slm-railskel{display:flex;flex-direction:column;gap:12px;padding:4px 0}
131
+ .slm-skel{display:block;max-width:100%;border-radius:6px;background:color-mix(in srgb,var(--slm-text) 9%,transparent)}
132
+ .slm-roomcard{position:absolute;inset:0;z-index:20;display:flex;align-items:center;justify-content:center;padding:16px;background:color-mix(in srgb,var(--slm-bg) 72%,transparent)}
133
+ .slm-roomcard>div{width:min(440px,100%);padding:24px;border-radius:18px;border:1px solid var(--slm-line);background:var(--slm-surface);box-shadow:0 30px 80px rgba(12,18,32,.25);text-align:center}
134
+ .slm-roomcard .slm-plate{margin:0 auto}
135
+ .slm-roomcard b{display:block;margin-top:12px;font-size:18px;font-weight:700;color:var(--slm-text)}
136
+ .slm-roomcard p{margin:8px 0 16px;font-size:13.5px;line-height:1.55;color:var(--slm-muted)}
137
+ .slm-roomcard .slm-btn{flex:none;min-width:0;margin:0 auto;display:inline-flex}
138
+ .slm-roomcard[data-busy="true"] .slm-btn{opacity:.6;pointer-events:none}
139
+ .slm-connbanner{display:flex;align-items:center;gap:10px;padding:8px 16px;font-size:12.5px;font-weight:500;border-bottom:1px solid var(--slm-line)}
140
+ .slm-connbanner span{flex:1}
141
+ .slm-connbanner.warn{background:color-mix(in srgb,#d99a0b 14%,var(--slm-surface));color:color-mix(in srgb,#b45309 70%,var(--slm-text))}
142
+ .slm-connbanner.err{background:color-mix(in srgb,#d64545 12%,var(--slm-surface));color:color-mix(in srgb,#d64545 70%,var(--slm-text))}
143
+ .slm-connbanner button{border:0;background:transparent;color:inherit;font:inherit;font-weight:700;text-decoration:underline;cursor:pointer}
144
+ .slm.paused .slm-live{color:#b45309}.slm.paused .slm-live-dot{background:#d99a0b}
145
+ .slm.offline .slm-live{color:#d64545}.slm.offline .slm-live-dot{background:#d64545}
146
+ .slm-fsline{display:none;align-items:center;gap:12px;padding:10px 16px;border-bottom:1px solid var(--slm-line);background:var(--slm-surface)}
147
+ .slm:fullscreen .slm-fsline{display:flex}
148
+ .slm-fsline b{font-size:15px;font-weight:700}
149
+ .slm-fsline-counts{font-size:12px;font-weight:500;color:var(--slm-muted)}
150
+ .slm-fsline-gap{flex:1}.slm-fsline .slm-btn{flex:none;min-width:0;padding:6px 11px;font-size:12px}
151
+ .slm-fsline kbd{font:600 11px/1 var(--slm-mono,ui-monospace,monospace);padding:4px 6px;border-radius:6px;border:1px solid var(--slm-line);color:var(--slm-muted)}
152
+ .slm-viewonly{flex:none;align-self:center;height:22px;display:inline-flex;align-items:center;padding:0 9px;border-radius:999px;font-size:11px;font-weight:600;
153
+ color:color-mix(in srgb,#3b82f6 75%,var(--slm-text));background:color-mix(in srgb,#3b82f6 14%,transparent)}
154
+ .slm-nosales{margin-top:4px;padding:14px;border-radius:14px;border:1px dashed var(--slm-line);background:color-mix(in srgb,var(--slm-text) 3%,var(--slm-surface));text-align:center}
155
+ .slm-nosales .slm-plate{margin:0 auto}
156
+ .slm-nosales b{display:block;margin-top:10px;font-size:14px}
157
+ .slm-nosales p{margin:6px 0 0;font-size:12.5px;line-height:1.5;color:var(--slm-muted)}
158
+ .slm-nosales-viewers{margin:14px 0 0;font-size:12.5px;line-height:1.5;color:var(--slm-muted)}
159
+ `;var j={view:{glyph:"eye",hue:"#3b82f6"},inspect:{glyph:"eye",hue:"#3b82f6"},block:{glyph:"ban",hue:"#d64545"},reserve:{glyph:"bookmark",hue:"#c026d3"},sections:{glyph:"layers",hue:"#0ea5a5"},categories:{glyph:"tag",hue:"#8b5cf6"},tables:{glyph:"table",hue:"#65a30d"},channels:{glyph:"route",hue:"#ea7a1e"},select:{glyph:"cursor",hue:"#d99a0b"},filterSections:{glyph:"search",hue:"#4c6fff"}},ms='<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M6 9l6 6 6-6"/></svg>',Q=r=>j[r]??j.view;function Ue(r,e,t){let s=`<button type="button" class="slm-taskpick-btn" data-taskpick aria-haspopup="menu" aria-expanded="${t}">${x(Q(r.mode).glyph,Q(r.mode).hue,26)}<span>${f(r.label)}</span>${ms}</button>`;if(!t)return s;let i=e.map(n=>n.tools.map(o=>`<button type="button" role="menuitemradio" aria-checked="${o.mode===r.mode}" data-taskpick-mode="${f(o.mode)}">${x(Q(o.mode).glyph,Q(o.mode).hue,26)}<span>${f(o.label)}</span></button>`).join("")).join("<hr>");return`${s}<div class="slm-taskmenu" role="menu" aria-label="Tasks">${i}</div>`}var Ge=`
160
+ .slm-taskpick{display:none;position:relative}
161
+ .slm .slm-taskpick-btn{display:inline-flex;align-items:center;gap:8px;height:44px;padding:0 12px 0 8px;border-radius:10px;border:1px solid var(--slm-line);
162
+ background:var(--slm-surface);color:var(--slm-text);font:inherit;font-size:13.5px;font-weight:600;white-space:nowrap;cursor:pointer}
163
+ .slm .slm-taskpick-btn svg:last-child{color:var(--slm-muted)}
164
+ .slm-taskmenu{position:absolute;left:0;top:50px;z-index:30;width:240px;padding:6px;border-radius:14px;border:1px solid var(--slm-line);background:var(--slm-surface);box-shadow:0 12px 32px rgba(12,18,32,.18)}
165
+ .slm-taskmenu button{display:flex;align-items:center;gap:10px;width:100%;height:44px;padding:0 10px;border:0;border-radius:10px;background:transparent;color:var(--slm-text);font:inherit;font-size:13.5px;font-weight:600;text-align:left;cursor:pointer}
166
+ .slm-taskmenu button[aria-checked="true"],.slm-taskmenu button:hover,.slm-taskmenu button:focus-visible{background:color-mix(in srgb,var(--slm-accent) 14%,transparent);outline:none}
167
+ .slm-taskmenu hr{border:0;border-top:1px solid var(--slm-line);margin:4px 6px}
168
+ .slm-grab{display:none}
169
+ .slm.compact .slm-bar{display:flex;align-items:center;gap:8px;padding:8px 12px}
170
+ .slm.compact .slm-modes,.slm.compact .slm-tools,.slm.compact .slm-kpis,.slm.compact [data-ref="follow"],.slm.compact .slm-fullscreen{display:none!important}
171
+ .slm.compact .slm-taskpick{display:block}
172
+ .slm.compact .slm-live{order:-1;margin-right:auto}
173
+ .slm.compact .slm-bar-actions{display:flex;flex:1;gap:6px}
174
+ .slm.compact .slm-findbar{flex:none;min-width:0;max-width:none}
175
+ .slm.compact .slm-findtrigger{width:44px;min-width:0;height:44px;padding:0;justify-content:center}
176
+ .slm.compact .slm-findtrigger span,.slm.compact .slm-findtrigger kbd{display:none}
177
+ .slm.compact .slm-view-summary{width:44px;height:44px;padding:0;display:flex;align-items:center;justify-content:center}
178
+ .slm.compact .slm-view-text,.slm.compact .slm-view-caret{display:none}
179
+ .slm.compact .slm-view-eye{display:inline-flex}
180
+ .slm.compact:not(.ch-sheet) .slm-body{position:relative;flex-direction:column}
181
+ .slm.compact:not(.ch-sheet) .slm-map{flex:1}
182
+ .slm.compact:not(.ch-sheet) .slm-rail{position:absolute;left:0;right:0;bottom:0;z-index:12;width:auto;height:50%;display:flex;flex-direction:column;
183
+ border:0;border-top:1px solid var(--slm-line);border-radius:18px 18px 0 0;background:var(--slm-surface);box-shadow:0 -12px 30px rgba(12,18,32,.14);
184
+ transition:height var(--slm-mo-base) var(--slm-mo-out)}
185
+ .slm.compact:not(.ch-sheet)[data-detent="peek"] .slm-rail{height:96px}
186
+ .slm.compact:not(.ch-sheet)[data-detent="full"] .slm-rail{height:calc(100% - 40px)}
187
+ .slm.compact:not(.ch-sheet)[data-detent="peek"] .slm-railscroll{overflow:hidden}
188
+ .slm.compact:not(.ch-sheet)[data-detent="full"] .slm-map::after{content:"";position:absolute;inset:0;z-index:10;background:rgba(12,18,32,.25)}
189
+ .slm.compact:not(.ch-sheet)[data-detent="full"] .slm-map-host{pointer-events:none}
190
+ .slm.compact:not(.ch-sheet) .slm-grab{display:flex;flex:none;flex-direction:column;align-items:center;gap:6px;width:100%;min-height:44px;padding:8px 16px 6px;border:0;background:transparent;
191
+ color:var(--slm-muted);font:inherit;font-size:12.5px;font-weight:600;cursor:grab;touch-action:none}
192
+ .slm-grab-bar{width:40px;height:5px;border-radius:9px;background:var(--slm-line)}
193
+ .slm.compact .slm-railscroll{flex:1;min-height:0}
194
+ .slm.compact .slm-view-item,.slm.compact .slm-rail .slm-btn,.slm.compact .slm-chips button,.slm.compact .slm-monitor-tabs button,.slm.compact .slm-rail .slm-linkbtn{min-height:44px}
195
+ .slm.compact .slm-rail{font-size:max(12px,1em)}
196
+ `;var Ye="seatlayer-manager-style",Ze="seatlayer-manager-channels-style",us=`
98
197
  /* The floor was 480px, which trapped the cockpit in any host shorter than that:
99
198
  every ancestor here is overflow:hidden, so the bottom of the rail (Create
100
199
  channel, Show archived) was rendered but clipped away by the host and could
@@ -113,39 +212,32 @@ import{s as _,t as K}from"./chunk-X7FRGMS2.js";import{A as De,B as Ve,C as je,D
113
212
  .slm *{box-sizing:border-box;margin:0;padding:0}
114
213
  .slm button{font:inherit;color:inherit;background:none;border:0;cursor:pointer}
115
214
  .slm input{font:inherit}
215
+ /* The dialogs come AFTER the reset: their one-class rules tie with .slm *,
216
+ and ahead of it they lost every padding and margin they set (audit m23). */
217
+ ${qe}
116
218
 
117
219
  .slm .slm-btn:not(.ghost):not(.danger){background:var(--slm-accent);color:var(--slm-accent-ink);border:1px solid var(--slm-accent)}
118
220
  /* Navigation remains available without changing the inventory tool. */
119
- .slm-navigation{position:absolute;top:10px;left:10px;display:flex;flex-direction:column;align-items:flex-start;gap:6px;max-width:calc(100% - 20px);z-index:6;pointer-events:none}
221
+ .slm-navigation{position:absolute;top:14px;left:14px;display:flex;flex-direction:column;align-items:flex-start;gap:10px;max-width:calc(100% - 28px);z-index:6;pointer-events:none}
120
222
  .slm-navigation>*{pointer-events:auto}
121
- .slm .slm-navigation-tools button{display:inline-flex;align-items:center;justify-content:center;width:34px;height:34px;min-width:34px;padding:0}
223
+ /* Map tools (CR04): one column under Colour by \u2014 Select, Lasso, Move, then Undo. */
224
+ .slm-navigation-tools{display:flex;flex-direction:column;gap:2px;padding:4px;border:1px solid var(--slm-line);border-radius:12px;background:var(--slm-surface);box-shadow:0 1px 2px rgba(12,18,32,.06),0 6px 18px rgba(12,18,32,.08)}
225
+ .slm-navigation-tools[hidden]{display:none}
226
+ .slm .slm-navigation-tools button{display:flex;align-items:center;justify-content:center;width:36px;height:36px;padding:0;border-radius:9px;color:var(--slm-muted)}
227
+ .slm .slm-navigation-tools button:hover:not(:disabled){background:var(--slm-tint);color:var(--slm-text)}
228
+ .slm .slm-navigation-tools button[aria-pressed=true]{background:rgba(217,154,11,.16);color:#b77f06}
229
+ .slm .slm-navigation-tools button[data-nav=move][aria-pressed=true]{background:rgba(59,130,246,.14);color:#3b82f6}
230
+ .slm[data-theme="dark"] .slm-navigation-tools button[aria-pressed=true]{color:#f4b740}
231
+ .slm .slm-navigation-tools button[data-nav=undo]{color:var(--slm-text)}
232
+ .slm .slm-navigation-tools button:disabled{opacity:.4;cursor:default}
122
233
  .slm-navigation-tools svg{pointer-events:none;flex:none}
123
- .slm-navigation-tools{padding:3px;border:1px solid var(--slm-line);border-radius:8px;background:var(--slm-bg);box-shadow:0 1px 3px #00000012}
124
- .slm-navigation-tools{display:flex;gap:2px;align-items:center;flex-wrap:wrap}
125
- .slm-navigation-count{font-size:12px;color:var(--slm-muted);padding:0 6px;white-space:nowrap}
126
- .slm .slm-navigation button{min-height:36px;padding:7px 10px;border:1px solid var(--slm-line);border-radius:7px;background:var(--slm-surface);color:var(--slm-text);font-size:12px}
127
- .slm .slm-navigation button[aria-pressed="true"]{background:var(--slm-accent);color:var(--slm-accent-ink)}
128
- /* Toolbar controls are flat; search result buttons retain their own layout. */
129
- .slm .slm-navigation .slm-navigation-tools button{width:32px;height:32px;min-width:32px;min-height:32px;padding:0;border:0;border-radius:5px;background:transparent;box-shadow:none;color:var(--slm-muted);cursor:pointer}
130
- .slm .slm-navigation .slm-navigation-tools button:hover{background:var(--slm-tint);color:var(--slm-text)}
131
- .slm .slm-navigation .slm-navigation-tools button[aria-pressed=true],.slm .slm-navigation .slm-navigation-tools button[data-nav=search][aria-expanded=true],.slm .slm-navigation .slm-navigation-tools button[data-nav=zoom][aria-expanded=true]{background:var(--slm-accent);color:var(--slm-accent-ink)}
132
- /* the count's companion \u2014 a word, not a 32px icon well */
133
- .slm .slm-navigation .slm-navigation-tools button.slm-navigation-clear{width:auto;min-width:0;height:26px;min-height:26px;
134
- padding:0 9px;border-radius:999px;font-size:11.5px;font-weight:800;color:var(--slm-accent);background:var(--slm-tint)}
135
- .slm .slm-navigation .slm-navigation-tools button[data-nav=rail]{margin-left:4px;position:relative}
136
- .slm .slm-navigation .slm-navigation-tools button[data-nav=rail]::before{content:'';position:absolute;left:-4px;top:7px;bottom:7px;width:1px;background:var(--slm-line)}
137
- .slm .slm-navigation .slm-navigation-tools button:focus-visible{outline:2px solid var(--slm-accent);outline-offset:1px}
138
- .slm-navigation button[hidden]{display:none}
139
- .slm-navigation-search{position:relative;width:300px;max-width:100%;min-width:0;box-shadow:0 2px 8px #0002}
140
- .slm-navigation input{width:100%;min-height:36px;padding:7px 10px;border:1px solid var(--slm-line);border-radius:7px;background:var(--slm-surface);color:var(--slm-text);font-size:13px}
141
- .slm-navigation-results{position:absolute;top:100%;left:0;right:0;max-height:240px;overflow:auto;padding:6px;background:var(--slm-surface);border:1px solid var(--slm-line);border-radius:8px;box-shadow:0 8px 24px #0003}
142
- .slm-navigation-results button{display:block;width:100%;text-align:left;margin-bottom:3px}
234
+ .slm-navigation-rule{height:1px;margin:3px 4px;background:var(--slm-line)}
143
235
  .slm.details-hidden .slm-rail{display:none}
144
236
  .slm.slm-minimal .slm-bar,.slm.slm-minimal .slm-rail,.slm.slm-minimal .slm-railhead,.slm.slm-minimal .slm-navigation-tools,.slm.slm-minimal .slm-blocklegend,.slm.slm-minimal .slm-minimap-mount,.slm.slm-minimal .slm-hint,.slm.slm-minimal .slm-eyebrow,.slm.slm-minimal .slm-note{display:none}
145
237
  .slm button:focus-visible,.slm input:focus-visible{outline:2px solid var(--slm-accent);outline-offset:2px}
146
238
  .slm[data-theme="light"] .slm-scope.read{color:#465169}
147
- .slm[data-theme="light"] .slm-scope.event,.slm[data-theme="light"] .slm-tablelock,.slm[data-theme="light"] .slm-kpidelta.down{color:#805500!important}
148
- .slm[data-theme="light"] .slm-barbtn.follow.on,.slm[data-theme="light"] .slm-kpidelta{color:#17663f!important}
239
+ .slm[data-theme="light"] .slm-scope.event,.slm[data-theme="light"] .slm-kpidelta.down{color:#805500!important}
240
+ .slm[data-theme="light"] .slm-kpidelta{color:#17663f!important}
149
241
 
150
242
 
151
243
  .slm [hidden]{display:none!important}
@@ -168,23 +260,14 @@ import{s as _,t as K}from"./chunk-X7FRGMS2.js";import{A as De,B as Ve,C as je,D
168
260
  .slm-activity-list{overflow:auto;flex:1;min-height:0;scrollbar-gutter:stable}
169
261
 
170
262
  .slm-activity-entry{position:relative;border-bottom:1px solid var(--slm-line);display:flex;align-items:flex-start;min-width:0}
171
- .slm .slm-activity-row{display:grid;grid-template-columns:58px 62px minmax(0,1fr);align-items:center;gap:7px;width:100%;min-width:0;height:29px;padding:0 2px;text-align:left;font-size:12px;line-height:1.2;border-radius:3px}
172
- .slm .slm-activity-row:hover{background:var(--slm-surface)}
173
- .slm-activity-row time{font-size:10px;color:var(--slm-muted);font-variant-numeric:tabular-nums;white-space:nowrap}
174
- .slm-activity-row strong{display:block;text-align:center;font-size:10px;font-weight:700;padding:3px 2px;border-radius:4px;background:var(--slm-surface);color:var(--slm-muted);white-space:nowrap}
175
- .slm-activity-entry[data-status="held"] strong{background:#b780171a;color:#946000}
176
- .slm-activity-entry[data-status="booked"] strong{background:#1681531a;color:#14764d}
177
- .slm[data-theme="dark"] .slm-activity-entry[data-status="held"] strong{background:#f2b44020;color:#f2bd59}
178
- .slm[data-theme="dark"] .slm-activity-entry[data-status="booked"] strong{background:#2dc88d20;color:#6ed9ab}
179
- .slm-activity-seats{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--slm-text);min-width:0}
180
- .slm-activity-details{flex:none;font-size:11px}
181
- .slm-activity-details summary{cursor:pointer;list-style:none;padding:6px 3px;color:var(--slm-muted)}
182
- .slm-activity-details summary::-webkit-details-marker{display:none}
183
- .slm-activity-details[open]{padding-bottom:68px}
184
- .slm-activity-details p{position:absolute;left:0;right:0;top:29px;max-height:64px;overflow:auto;overflow-wrap:anywhere;background:var(--slm-surface);padding:6px;line-height:1.5;z-index:1}
263
+ .slm .slm-activity-row{display:flex;align-items:center;gap:10px;width:100%;min-width:0;padding:8px 2px;text-align:left;font-size:12.5px;line-height:1.3;border-radius:6px}
264
+ .slm .slm-activity-row:hover{background:var(--slm-tint)}
265
+ .slm-activity-text{display:flex;flex:1;flex-direction:column;min-width:0}.slm-activity-text b{font-weight:600}
266
+ .slm-activity-row time{flex:none;font:500 11.5px/1 ui-monospace,SFMono-Regular,Menlo,monospace;color:var(--slm-muted);white-space:nowrap}
267
+ .slm-activity-seats{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-size:11.5px;color:var(--slm-muted);min-width:0}
185
268
  .slm .slm-new-activity,.slm .slm-more-activity{width:100%;padding:9px;border-radius:7px;font-size:12px;margin:5px 0;background:var(--slm-surface);border:1px solid var(--slm-line);color:var(--slm-text)}
186
269
  .slm .slm-new-activity{background:var(--slm-accent);color:var(--slm-accent-ink)}
187
- .slm-activity-empty{padding:22px 4px;color:var(--slm-muted);font-size:13px;line-height:1.6}
270
+ .slm-activity-empty{display:flex;flex-direction:column;align-items:center;gap:6px;padding:22px 12px;color:var(--slm-muted);font-size:12.5px;line-height:1.5;text-align:center}
188
271
  /* top bar */
189
272
  /* FOUR columns, because the bar has four children: modes, the tools
190
273
  select, the live badge, and the actions. With three, the actions had no
@@ -194,26 +277,26 @@ import{s as _,t as K}from"./chunk-X7FRGMS2.js";import{A as De,B as Ve,C as je,D
194
277
  actions sit hard right and the live badge hugs its own text instead of
195
278
  stretching across the free space.
196
279
 
197
- .slm.compact still spans the actions full-width on its own row below;
198
- that wrap is deliberate and is why this looked intermittent \u2014 the same
199
- broken layout had one designed cause and one accidental one. */
200
- .slm-bar{display:grid;grid-template-columns:auto auto auto minmax(0,1fr);align-items:center;column-gap:14px;row-gap:10px;
201
- padding:10px 16px;border-bottom:1px solid var(--slm-line);flex:none}
202
- .slm-modes{display:inline-flex;flex-wrap:wrap;row-gap:4px;background:var(--slm-surface);border:1px solid var(--slm-line);border-radius:999px;padding:3px}
203
- .slm-modegroup{display:inline-flex;align-items:center;gap:1px;padding:0 4px 0 6px}
204
- .slm-modegroup[hidden]{display:none}
205
- .slm-modegroup+.slm-modegroup{border-left:1px solid var(--slm-line);margin-left:2px}
206
- .slm-modegroup-label{padding:0 8px 0 4px;font-size:9.5px;font-weight:800;letter-spacing:.12em;text-transform:uppercase;color:var(--slm-muted);opacity:.8;white-space:nowrap}
280
+ Below 1,000 px the bar is a different, flex row (managerCompact.ts):
281
+ one task picker, the live badge, and icon actions. */
282
+ .slm-bar{display:flex;flex-wrap:wrap;align-items:center;gap:10px 12px;padding:10px 16px;border-bottom:1px solid var(--slm-line);flex:none}
283
+ /* One task row (CR04): each task with its colour and icon, the open one lifted. */
284
+ .slm-modes{display:inline-flex;flex:none;gap:2px;padding:3px;border-radius:12px;background:var(--slm-tint)}
285
+ .slm-modegroup{display:inline-flex;align-items:center;gap:2px}
286
+ .slm-modegroup[hidden],.slm-modegroup-label{display:none}
207
287
  .slm-tools{display:none}
208
- .slm-mode{padding:6px 13px;border-radius:999px;font-weight:700;font-size:13px;color:var(--slm-muted);white-space:nowrap}
288
+ .slm .slm-mode{display:inline-flex;align-items:center;gap:7px;height:34px;padding:0 12px 0 6px;border-radius:9px;font-weight:500;font-size:13px;color:var(--slm-muted);white-space:nowrap}
289
+ .slm .slm-mode:hover{color:var(--slm-text)}
209
290
  .slm-mode[hidden]{display:none}
210
- .slm-mode.on{background:var(--slm-accent);color:var(--slm-accent-ink)}
211
- .slm-live{display:inline-flex;align-items:center;gap:6px;font-size:11px;letter-spacing:.12em;font-weight:800;color:var(--slm-muted)}
291
+ .slm .slm-mode.on{background:var(--slm-surface);color:var(--slm-text);font-weight:600;box-shadow:0 1px 2px rgba(0,0,0,.12),inset 0 0 0 1px var(--slm-line)}
292
+ .slm-live{display:inline-flex;flex:none;align-items:center;gap:6px;font-size:11px;letter-spacing:.06em;font-weight:700;color:var(--slm-muted)}
293
+ .slm.live .slm-live{color:#17663f}.slm[data-theme="dark"].live .slm-live{color:#5bd39b}
212
294
  .slm-live-dot{width:8px;height:8px;border-radius:50%;background:#8b94ac}
213
295
  .slm.live .slm-live-dot{background:#22a06b;box-shadow:0 0 0 0 rgba(34,160,107,.55);
214
296
  animation:slm-pulse var(--slm-mo-ambient) infinite}
215
297
  @keyframes slm-pulse{0%{box-shadow:0 0 0 0 rgba(34,160,107,.5)}70%{box-shadow:0 0 0 7px rgba(34,160,107,0)}100%{box-shadow:0 0 0 0 rgba(34,160,107,0)}}
216
- .slm-kpis{grid-column:1/-1;display:grid;grid-template-columns:repeat(8,minmax(0,1fr));width:100%;padding-top:10px;
298
+ .slm.no-kpis .slm-kpis{display:none}
299
+ .slm-kpis{flex-basis:100%;display:grid;grid-template-columns:repeat(8,minmax(0,1fr));width:100%;padding-top:10px;
217
300
  border-top:1px solid var(--slm-line)}
218
301
  .slm-kpi{position:relative;display:flex;min-width:0;flex-direction:column;align-items:center;padding:0 5px;line-height:1.15;text-align:center}
219
302
  .slm-kpi b{display:flex;min-width:0;align-items:baseline;justify-content:center;font-size:17px;font-weight:800;
@@ -232,17 +315,22 @@ import{s as _,t as K}from"./chunk-X7FRGMS2.js";import{A as De,B as Ve,C as je,D
232
315
  @keyframes slm-kpi-bump{0%,100%{transform:none}35%{transform:translateY(-2px) scale(1.08);text-shadow:0 0 18px rgba(255,255,255,.24)}}
233
316
  @keyframes slm-kpi-delta{0%{opacity:0;transform:translateY(5px)}18%,72%{opacity:1;transform:none}100%{opacity:0;transform:translateY(-5px)}}
234
317
  .slm-barbtn{padding:7px 13px;border-radius:9px;border:1px solid var(--slm-line);color:var(--slm-text);font-weight:700;font-size:12.5px}
318
+ .slm .slm-helpbtn{width:34px;height:34px;padding:0;text-align:center;font-size:14px}
319
+ .slm.tighterbar .slm-findbar{flex:none;min-width:0}.slm.tighterbar .slm-findtrigger{width:34px;min-width:0;padding:0;justify-content:center}.slm.tighterbar .slm-findtrigger span,.slm.tighterbar .slm-findtrigger kbd{display:none}
320
+ .slm.tightbar .slm-barbtn.follow span,.slm.tightbar .slm-view-text,.slm.tightbar .slm-view-caret{display:none}
321
+ .slm.tighterbar .slm-bar{column-gap:8px}.slm.tighterbar .slm-bar-actions{gap:6px}
322
+ .slm .slm-howlink{margin-left:2px;padding:0;font:inherit;font-weight:600;color:var(--slm-accent);white-space:nowrap}
235
323
  .slm-barbtn:hover{border-color:var(--slm-muted)}
236
- .slm .slm-barbtn.follow,.slm .slm-barbtn.heat{display:inline-flex;align-items:center;gap:6px;flex:none;white-space:nowrap;border:0;border-radius:6px;padding:5px 7px;min-height:30px;font-size:12px;background:transparent;color:var(--slm-text)}
324
+ .slm .slm-barbtn.follow,.slm .slm-barbtn.heat{display:inline-flex;align-items:center;gap:8px;flex:none;white-space:nowrap;border:0;border-radius:6px;padding:5px 7px;min-height:30px;font-size:12px;background:transparent;color:var(--slm-text)}
325
+ .slm .slm-barbtn.follow{height:34px;padding:0 10px;border:1px solid var(--slm-line);border-radius:9px;background:var(--slm-surface);font-size:12.5px;font-weight:500}
237
326
  .slm .slm-barbtn.follow::before,.slm .slm-barbtn.heat::before{content:'';flex:none;width:26px;height:15px;border-radius:12px;background:radial-gradient(circle at 7.5px 7.5px,var(--slm-bg) 5px,transparent 5.5px),var(--slm-muted)}
238
327
  .slm .slm-barbtn.follow.on::before,.slm .slm-barbtn.heat.on::before{background:radial-gradient(circle at 18.5px 7.5px,var(--slm-accent-ink) 5px,transparent 5.5px),var(--slm-accent)}
239
328
  .slm-follow-status,.slm-heat-status{position:absolute;bottom:14px;right:12px;max-width:calc(100% - 120px);padding:6px 9px;border:1px solid var(--slm-line);border-radius:8px;background:var(--slm-bg);color:var(--slm-text);font-size:11px;z-index:5;pointer-events:none}
240
329
  .slm-heat-status{bottom:48px}
241
- .slm-barbtn.follow.on{background:rgba(34,160,107,.13);border-color:#22a06b;color:#5bd39b}
242
330
  /* Full screen wears the View summary's box. It is a real <button>, so the
243
331
  ".slm button" reset outranks the plain .slm-barbtn border \u2014 hence the
244
332
  extra .slm here. Label hidden on the compact bar; the name is aria-label. */
245
- .slm .slm-barbtn.slm-fullscreen{display:inline-flex;align-items:center;gap:6px;flex:none;white-space:nowrap;min-height:30px;padding:5px 10px;
333
+ .slm .slm-barbtn.slm-fullscreen{display:inline-flex;align-items:center;justify-content:center;flex:none;width:34px;height:34px;padding:0;
246
334
  border:1px solid var(--slm-line);border-radius:8px;font-size:12px}
247
335
  .slm .slm-barbtn.slm-fullscreen:hover{border-color:var(--slm-muted)}
248
336
  .slm-fullscreen-icon{display:inline-flex}
@@ -252,31 +340,49 @@ import{s as _,t as K}from"./chunk-X7FRGMS2.js";import{A as De,B as Ve,C as je,D
252
340
  .slm-map{position:relative;flex:1;min-width:0}
253
341
  .slm-map-host{position:absolute;inset:0}
254
342
  .slm-hud{position:absolute;left:12px;bottom:12px;display:flex;gap:8px}
255
- /* Map chrome (plan item 7): crumb \xB7 zoom pills \xB7 minimap, one corner, bottom-right. */
256
- .slm-mapchrome{position:absolute;right:12px;bottom:12px;z-index:5;display:flex;flex-direction:column;align-items:flex-end;gap:10px;pointer-events:none}
343
+ /* Map chrome (plan item 7): zoom pills \xB7 minimap, one corner, bottom-right. */
344
+ .slm-mapchrome{position:absolute;right:14px;bottom:14px;z-index:5;display:flex;align-items:flex-end;gap:10px;pointer-events:none}
257
345
  .slm-mapchrome>*{pointer-events:auto}
258
- .slm-crumb{max-width:260px;padding:6px 11px;border-radius:999px;font-size:11.5px;font-weight:700;color:var(--slm-text);
346
+ .slm-crumb{max-width:min(360px,100%);padding:8px 11px;border-radius:9px;font-size:11.5px;font-weight:700;color:var(--slm-text);
259
347
  background:color-mix(in srgb,var(--slm-surface) 88%,transparent);border:1px solid var(--slm-line);backdrop-filter:blur(8px);
260
348
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-variant-numeric:tabular-nums}
261
- .slm-blocklegend{display:flex;gap:10px;padding:5px 10px;border-radius:999px;font-size:10.5px;font-weight:700;color:var(--slm-muted);
262
- background:color-mix(in srgb,var(--slm-surface) 88%,transparent);border:1px solid var(--slm-line);backdrop-filter:blur(8px);white-space:nowrap}
263
- .slm-blocklegend span{display:inline-flex;align-items:center;gap:5px}
349
+ .slm-blocklegend{position:relative;display:flex;align-items:center;flex-wrap:wrap;gap:6px 12px;max-width:100%;padding:4px 12px 4px 4px;border-radius:12px;font-size:12px;font-weight:500;color:var(--slm-text);
350
+ background:color-mix(in srgb,var(--slm-surface) 92%,transparent);border:1px solid var(--slm-line);backdrop-filter:blur(8px);box-shadow:0 1px 2px rgba(12,18,32,.06),0 6px 18px rgba(12,18,32,.08);pointer-events:auto;z-index:2}
351
+ .slm-blocklegend span{display:inline-flex;align-items:center;gap:6px;white-space:nowrap}
352
+ .slm .slm-legendchip{display:inline-flex;align-items:center;gap:6px;margin:-3px -6px;padding:3px 6px;border-radius:7px;white-space:nowrap;color:var(--slm-text);font-weight:500}.slm .slm-legendchip:hover{background:var(--slm-tint)}.slm .slm-legendchip[aria-pressed=true]{background:color-mix(in srgb,var(--slm-accent) 16%,transparent);box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--slm-accent) 55%,transparent)}.slm-legendchip em{font-style:normal;color:var(--slm-muted);margin-left:2px}.slm-blocklegend .slm-litnote{padding:3px 9px;border-radius:999px;background:var(--slm-text);color:var(--slm-bg);font-size:11.5px;font-weight:600}
264
353
  .slm-blocklegend i{width:9px;height:9px;border-radius:3px;display:inline-block}
265
- /* Bottom-left of the map, clear of the zoom column and minimap on the right. */
266
- .slm-blocklegend{position:absolute;left:12px;bottom:12px;z-index:5;align-items:center;flex-wrap:wrap;justify-content:flex-start;max-width:calc(100% - 250px);white-space:normal;row-gap:6px}
267
- .slm.compact .slm-blocklegend{left:8px;bottom:8px;max-width:calc(100% - 96px)}
268
354
  .slm-blocklegend i.seat{border-radius:50%}
269
- .slm-legend-items{display:inline-flex;flex-wrap:wrap;align-items:center;gap:6px 10px}
270
- .slm-colourby{display:inline-flex;padding:2px;border-radius:999px;background:var(--slm-line);gap:2px}
271
- .slm .slm-colourby button{border:0;border-radius:999px;padding:3px 9px;font:inherit;font-size:10.5px;font-weight:700;color:var(--slm-muted);background:transparent;cursor:pointer}
272
- .slm .slm-colourby button.on{color:var(--slm-text);background:var(--slm-surface);box-shadow:0 1px 2px rgba(0,0,0,.12)}
273
- .slm .slm-colourby button:focus-visible{outline:2px solid var(--slm-accent,#6e7bff);outline-offset:1px}
355
+ .slm-blocklegend i.blocked{box-shadow:inset 0 0 0 1.4px #98a2b5;background:linear-gradient(45deg,transparent 44%,#98a2b5 44% 56%,transparent 56%) !important}
356
+ .slm .slm-chips{display:flex;flex-wrap:wrap;gap:6px;margin-top:6px}
357
+ .slm .slm-chips button{border:1px solid var(--slm-line);background:var(--slm-surface);color:var(--slm-text);border-radius:999px;padding:5px 11px;font:inherit;font-size:12.5px;cursor:pointer}
358
+ .slm .slm-chips button[aria-pressed="true"]{border-color:var(--slm-accent);background:color-mix(in srgb,var(--slm-accent) 16%,transparent);font-weight:600}
359
+ .slm .slm-chips button:disabled{opacity:.5;cursor:not-allowed;text-decoration:line-through}
360
+ .slm-blocklegend i.reserved{box-shadow:inset 0 0 0 1.6px #c026d3;background:radial-gradient(#c026d3 28%,transparent 32%) !important}
361
+ .slm-blocklegend b{font-weight:600;color:var(--slm-muted);font-variant-numeric:tabular-nums}
362
+ .slm-legend-items{display:inline-flex;flex-wrap:wrap;align-items:center;gap:6px 14px}
363
+ .slm .slm-colourby{display:inline-flex;align-items:center;gap:7px;min-height:32px;padding:0 10px 0 7px;border:1px solid var(--slm-line);border-radius:9px;background:var(--slm-surface);color:var(--slm-text);font:inherit;font-weight:600;cursor:pointer}
364
+ .slm .slm-colourby span{color:var(--slm-muted);font-weight:500}
365
+ .slm .slm-colourby b{color:var(--slm-text)}
366
+ .slm .slm-colourby i{font-style:normal;color:var(--slm-muted);font-size:10px}
367
+ .slm .slm-colourby:focus-visible,.slm .slm-colourmenu button:focus-visible{outline:2px solid var(--slm-accent);outline-offset:1px}
368
+ .slm-colourmenu{position:absolute;left:0;top:calc(100% + 6px);z-index:8;width:300px;padding:6px;border-radius:14px;background:var(--slm-surface);border:1px solid var(--slm-line);box-shadow:0 12px 32px rgba(12,18,32,.18)}
369
+ .slm-colourmenu[hidden]{display:none}
370
+ .slm .slm-colourmenu button{display:grid;grid-template-columns:44px 1fr 14px;align-items:center;column-gap:10px;width:100%;padding:9px 11px;border:0;border-radius:10px;background:transparent;color:var(--slm-text);font:inherit;text-align:left;cursor:pointer}
371
+ .slm .slm-colourmenu button:hover{background:var(--slm-tint)}
372
+ .slm .slm-colourmenu button.on{background:color-mix(in srgb,var(--slm-accent) 16%,transparent)}
373
+ .slm .slm-colourmenu button:disabled{opacity:.5;cursor:default}
374
+ .slm-colourmenu button em{display:flex;gap:3px}
375
+ .slm-colourmenu button em i{width:8px;height:8px;border-radius:50%}
376
+ .slm-colourmenu button span{display:flex;flex-direction:column;align-items:flex-start;gap:2px;font-size:12px;color:var(--slm-muted)}
377
+ .slm-colourmenu button b{font-size:13px;font-weight:600;color:var(--slm-text)}
378
+ .slm-colourmenu button.on::after{content:'\u2713';color:var(--slm-text);font-weight:700}
379
+ .slm-colourmenu p{margin:6px 4px 2px;padding:8px 8px 2px;border-top:1px solid var(--slm-line);font-size:12px;color:var(--slm-muted)}
380
+ .slm.compact .slm-legend-items{display:none}
381
+ .slm.compact .slm-blocklegend{padding:4px}
274
382
  .slm-blocklegend[hidden]{display:none}
275
- .slm-zoom{display:flex;flex-direction:column;gap:5px;align-items:flex-end}
276
- .slm .slm-zoombtn{width:34px;height:34px;padding:0;border-radius:10px;border:1px solid var(--slm-line);background:color-mix(in srgb,var(--slm-surface) 88%,transparent);
277
- backdrop-filter:blur(8px);color:var(--slm-text);font-size:17px;font-weight:700;line-height:1;box-shadow:0 8px 24px -14px rgba(0,0,0,.6);display:grid;place-items:center}
278
- .slm .slm-zoombtn.slm-zoombtn-venue{width:auto;padding:0 11px;font-size:11.5px;font-weight:800;letter-spacing:.02em}
279
- .slm .slm-zoombtn:hover:not(:disabled){border-color:var(--slm-muted)}
383
+ .slm-zoom{display:flex;border-radius:10px;border:1px solid var(--slm-line);background:var(--slm-surface);box-shadow:0 1px 2px rgba(12,18,32,.06),0 6px 18px rgba(12,18,32,.08)}
384
+ .slm .slm-zoombtn{width:34px;height:34px;padding:0;border-radius:9px;color:var(--slm-text);font-size:18px;font-weight:600;line-height:1;display:grid;place-items:center}
385
+ .slm .slm-zoombtn:hover:not(:disabled){background:var(--slm-tint)}
280
386
  .slm .slm-zoombtn:focus-visible{outline:2px solid var(--slm-accent);outline-offset:1px}
281
387
  .slm .slm-zoombtn:disabled{opacity:.42;cursor:default}
282
388
  .slm-minimap-mount{line-height:0}
@@ -303,19 +409,16 @@ import{s as _,t as K}from"./chunk-X7FRGMS2.js";import{A as De,B as Ve,C as je,D
303
409
  showing at once sat on top of each other and the block-mode nudge only
304
410
  moved the collision. They stack here instead, in whatever combination is
305
411
  actually on screen. */
306
- .slm-lane{position:absolute;left:50%;top:14px;transform:translateX(-50%);z-index:6;display:flex;flex-direction:column;
307
- align-items:center;gap:8px;max-width:min(560px,calc(100% - 32px));pointer-events:none}
412
+ /* Bottom, centred in the room left of the zoom pills and minimap (their width is
413
+ measured into --slm-chrome-w); a map too narrow for that lifts it above them (m16). */
414
+ .slm-lane{position:absolute;left:calc((100% - var(--slm-chrome-w,0px) - 14px) / 2);bottom:16px;transform:translateX(-50%);z-index:6;display:flex;flex-direction:column-reverse;
415
+ align-items:center;gap:8px;max-width:min(520px,calc(100% - var(--slm-chrome-w,0px) - 42px));pointer-events:none}
416
+ .slm-map.slm-lane-above .slm-lane{left:50%;bottom:calc(var(--slm-chrome-h,0px) + 24px);max-width:calc(100% - 32px)}
308
417
  /* Only what is SHOWING takes a slot: a faded-out pill left in the flow would
309
418
  push the others down by its own height plus the gap. Taken out of flow
310
419
  rather than display:none'd, so the fade in and out still runs. */
311
- .slm-lane>:not(.on){position:absolute;top:0;pointer-events:none}
420
+ .slm-lane>:not(.on):not(.slm-crumb){position:absolute;bottom:0;left:50%;translate:-50% 0;width:max-content;max-width:520px;pointer-events:none}
312
421
  /* The session-ended card: the map stays painted under it; one way back. */
313
- .slm-ended{display:flex;flex-direction:column;gap:8px;width:360px;max-width:calc(100vw - 48px);box-sizing:border-box;padding:16px 18px;border-radius:12px;pointer-events:auto;
314
- background:var(--slm-surface);border:1px solid var(--slm-line);box-shadow:0 18px 48px rgba(0,0,0,.3);color:var(--slm-text);text-align:left}
315
- .slm-ended strong{font-size:14px;font-weight:800}
316
- .slm-ended span{font-size:12.5px;line-height:1.5;color:var(--slm-muted)}
317
- .slm-ended .slm-btn{align-self:flex-start;min-width:0;flex:none;margin-top:4px}
318
- .slm-ended[data-busy="true"] .slm-btn{opacity:.6;pointer-events:none}
319
422
  .slm-zoomhint{padding:6px 13px;border-radius:999px;
320
423
  background:color-mix(in srgb,var(--slm-surface) 92%,transparent);color:var(--slm-text);
321
424
  border:1px solid var(--slm-line);font-size:12px;font-weight:700;pointer-events:none;opacity:0;
@@ -344,15 +447,8 @@ import{s as _,t as K}from"./chunk-X7FRGMS2.js";import{A as De,B as Ve,C as je,D
344
447
  .slm-stepnum{display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;border-radius:50%;background:var(--slm-accent);color:var(--slm-accent-ink);font-size:9.5px;letter-spacing:0}
345
448
 
346
449
  /* legend rows */
347
- .slm-legend{display:flex;flex-direction:column;gap:2px;margin-bottom:16px}
348
- .slm-legrow{display:flex;align-items:center;gap:9px;padding:7px 2px;border-bottom:1px solid var(--slm-line)}
349
- .slm-legdot{width:10px;height:10px;border-radius:50%;flex:none}
350
450
  /* The status key inside a note line: a swatch, and blocked's light disc with
351
451
  its cross \u2014 the same two marks the map paints. */
352
- .slm-legmark{display:inline-block;width:9px;height:9px;border-radius:50%;vertical-align:middle}
353
- .slm-legcross{display:inline-block;width:12px;height:12px;line-height:12px;text-align:center;border-radius:50%;background:#f1f4f9;font-size:9px;font-weight:800;vertical-align:middle}
354
- .slm-leglabel{flex:1;font-size:13px;font-weight:600}
355
- .slm-legcount{font-size:13px;font-weight:800;font-variant-numeric:tabular-nums}
356
452
 
357
453
  /* activity feed */
358
454
  .slm-feed{display:flex;flex-direction:column;gap:0}
@@ -415,25 +511,10 @@ import{s as _,t as K}from"./chunk-X7FRGMS2.js";import{A as De,B as Ve,C as je,D
415
511
  .slm-find-count{display:block;min-height:16px;margin-top:4px;font-size:11px;color:var(--slm-muted);font-variant-numeric:tabular-nums}
416
512
  .slm-find-count:empty{display:none}
417
513
  /* Reading aids in the bar (plan item 5, slice D): the bar's Find and the View menu. */
418
- .slm-findbar{flex:0 1 250px;min-width:120px;max-width:250px}
419
- /* The bar's box draws the frame, and the count sits inside it at the end of
420
- the input \u2014 in the layout, so it never covers the controls or KPIs below.
421
- The count may take the box's room but never demands it: clamped to one
422
- line (not nowrap), its narrowest size is a word, so a crowded bar shrinks
423
- it to "\u2026" rather than overflowing. Its title carries the whole sentence. */
424
- .slm-findbar .slm-find{margin:0;display:flex;align-items:center;gap:6px;box-sizing:border-box;min-height:30px;padding:0 6px 0 0;
425
- border:1px solid var(--slm-line);border-radius:8px;background:var(--slm-surface)}
426
- .slm-findbar .slm-find:focus-within{outline:2px solid var(--slm-accent);outline-offset:1px;border-color:var(--slm-accent)}
427
- .slm-findbar .slm-find .slm-input{flex:1 1 0;width:0;min-width:56px;min-height:28px;padding:4px 4px 4px 30px;border:0;border-radius:8px;
428
- background:transparent;font-size:12px}
429
- .slm-findbar .slm-find .slm-input:focus-visible{outline:none}
430
- .slm-findbar .slm-find::before{left:10px;width:12px;height:12px}
431
- .slm-findbar .slm-find-count{flex:0 1 auto;min-width:0;max-width:70%;min-height:0;margin:0;padding:2px 7px;border-radius:6px;
432
- overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1;line-clamp:1;overflow-wrap:anywhere;
433
- line-height:16px;background:var(--slm-tint);color:var(--slm-text);font-size:11px}
434
- .slm-findbar .slm-find-count:empty{display:none}
514
+ .slm-findbar{flex:1 1 260px;min-width:200px}
435
515
  .slm-view{position:relative;flex:none}
436
- .slm-view > summary{list-style:none;cursor:pointer;display:inline-flex;align-items:center;gap:5px;min-height:30px;padding:5px 10px;border-radius:8px;font-size:12px;user-select:none}
516
+ .slm-view > summary{list-style:none;cursor:pointer;display:inline-flex;align-items:center;gap:6px;height:34px;padding:0 10px 0 9px;border-radius:9px;background:var(--slm-surface);font-size:12.5px;font-weight:600;user-select:none}
517
+ .slm-view-eye{display:inline-flex}
437
518
  .slm-view > summary::-webkit-details-marker{display:none}
438
519
  .slm-view > summary.away::after{content:"";width:6px;height:6px;border-radius:50%;background:var(--slm-accent)}
439
520
  .slm-view[open] > summary{border-color:var(--slm-muted);background:var(--slm-tint)}
@@ -452,7 +533,6 @@ import{s as _,t as K}from"./chunk-X7FRGMS2.js";import{A as De,B as Ve,C as je,D
452
533
  .slm-view-label{flex:1;min-width:0}
453
534
  .slm-view-kbd{flex:none;font:600 10.5px/1 var(--slm-mono,ui-monospace,monospace);color:var(--slm-muted);padding:3px 5px;border:1px solid var(--slm-line);border-radius:5px}
454
535
  .slm-view-note{margin:4px 3px 2px;padding:6px 8px 2px;border-top:1px solid var(--slm-line);font-size:11px;line-height:1.4;color:var(--slm-muted)}
455
- .slm.compact .slm-findbar{flex:1 1 100%;min-width:0;max-width:none}
456
536
  .slm-selnum{font-size:26px;font-weight:800;font-variant-numeric:tabular-nums}
457
537
  .slm-sellabel{font-size:12px;color:var(--slm-muted);font-weight:600}
458
538
  .slm-row{display:flex;gap:8px;flex-wrap:wrap;margin-bottom:10px}
@@ -481,52 +561,24 @@ import{s as _,t as K}from"./chunk-X7FRGMS2.js";import{A as De,B as Ve,C as je,D
481
561
  .slm-input,.slm-select{width:100%;padding:8px 10px;border-radius:9px;border:1px solid var(--slm-line);
482
562
  background:var(--slm-surface);color:var(--slm-text)}
483
563
  .slm-note{font-size:11.5px;color:var(--slm-muted);margin-top:5px}
484
- .slm-blocked{margin-top:17px;padding-top:15px;border-top:1px solid var(--slm-line)}
485
- .slm-blockedhead{display:flex;align-items:baseline;justify-content:space-between;gap:10px;margin-bottom:8px}
486
- .slm-blockedhead .slm-eyebrow{margin-bottom:0}.slm-blockedtotal{font-size:11px;color:var(--slm-muted)}
487
- .slm-blockedtotal b{color:var(--slm-text);font-variant-numeric:tabular-nums}
488
- .slm-blockedtools{display:grid;grid-template-columns:minmax(0,1fr);gap:7px}
489
- .slm-blockedsummary{display:flex;align-items:center;justify-content:space-between;gap:8px;margin:9px 0 6px;
490
- color:var(--slm-muted);font-size:10.5px}
491
564
  .slm-linkbtn{font-size:11px!important;font-weight:800!important;color:var(--slm-accent)!important;text-align:right}
492
565
  .slm-linkbtn:disabled{opacity:.45;cursor:not-allowed}
493
- .slm .slm-blockedsummary .slm-linkbtn{color:var(--slm-text)}
494
- .slm-block-seatline{display:flex;align-items:center}
495
- .slm .slm-block-seatline>button:last-child{color:var(--slm-text);font-size:11px;padding:7px;background:transparent;border:0;cursor:pointer}
496
- .slm-block-group{border-bottom:1px solid var(--slm-line);padding:7px}
497
- .slm-block-grouphead{display:flex;align-items:center;justify-content:space-between;gap:8px}
498
- .slm .slm-block-grouphead button{color:var(--slm-text);font-size:11px;text-align:left;padding:4px;background:transparent;border:0;cursor:pointer}
499
- .slm-block-grouphead small{display:block;color:var(--slm-muted);font-size:10px;margin-top:3px}
500
- .slm-block-group summary{font-size:11px;color:var(--slm-muted);cursor:pointer;padding:5px}
501
- .slm-blockedlist{max-height:none;overflow:auto;overscroll-behavior:contain;border:1px solid var(--slm-line);
502
- border-radius:10px;background:var(--slm-surface)}
503
- .slm-blockeditem{display:grid!important;grid-template-columns:18px minmax(0,1fr);width:100%;gap:8px;padding:8px 9px!important;
504
- border-bottom:1px solid var(--slm-line)!important;text-align:left!important}
505
- .slm-blockeditem:last-child{border-bottom:0!important}.slm-blockeditem:hover{background:var(--slm-tint)!important}
506
- .slm-blockeditem.on{background:color-mix(in srgb,var(--slm-accent) 13%,var(--slm-surface))!important}
507
- .slm-blockedcheck{display:flex;align-items:center;justify-content:center;width:16px;height:16px;margin-top:1px;border-radius:4px;
508
- border:1px solid var(--slm-muted);color:transparent;font-size:10px;font-weight:900}
509
- .slm-blockeditem.on .slm-blockedcheck{border-color:var(--slm-accent);background:var(--slm-accent);color:var(--slm-accent-ink)}
510
- .slm-blockedcopy{min-width:0}.slm-blockedlabel{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
511
- font-size:12px;font-weight:800}.slm-blockedmeta{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
512
- margin-top:2px;color:var(--slm-muted);font-size:10px}
513
- .slm-blockedmore{width:100%;padding:9px!important;color:var(--slm-accent)!important;font-size:11px!important;font-weight:800!important}
514
- .slm-blockedempty{padding:12px;color:var(--slm-muted);font-size:11.5px;line-height:1.45}
515
- .slm-allnote{margin-top:-4px;margin-bottom:10px}
516
566
 
517
567
  /* toast */
518
568
  .slm-toast{position:absolute;left:50%;bottom:16px;transform:translateX(-50%);padding:10px 16px;border-radius:10px;
519
569
  font-size:13px;font-weight:700;box-shadow:0 8px 24px rgba(0,0,0,.28);opacity:0;pointer-events:none;
520
570
  transition:opacity var(--slm-mo-base) var(--slm-mo-out);
521
571
  background:var(--slm-surface);color:var(--slm-text);border:1px solid var(--slm-line);z-index:5}
522
- .slm-toast.on{opacity:1}
572
+ .slm-toast.on{opacity:1}.slm-toast.on:has(button){pointer-events:auto}
573
+ .slm-toast button{margin-left:6px;font-weight:800;text-decoration:underline}
574
+ .slm-chooser .slm-btn[aria-busy=true]{opacity:.6;cursor:progress}
523
575
  .slm-toast.err{background:#c0392b;color:#fff;border-color:#c0392b}
524
576
  /* err/ok keep their semantic grounds, and state an ink that reads on both of
525
577
  them \u2014 these are states, not chrome, so they do not follow the theme. */
526
578
  .slm-toast.ok{background:#1f7a4d;color:#fff;border-color:#1f7a4d}
527
579
 
528
580
  /* control-room actions + insights */
529
- .slm-bar-actions{display:flex;align-items:center;justify-self:end;gap:5px}
581
+ .slm-bar-actions{display:flex;flex:1;min-width:0;align-items:center;gap:10px}
530
582
  .slm-barbtn.on{background:rgba(244,183,64,.13);border-color:#f4b740;color:var(--slm-text)}
531
583
  .slm-sectionlist{display:flex;flex-direction:column;gap:8px;margin-top:4px}
532
584
  .slm-sectionlist + .slm-eyebrow{margin-top:18px}
@@ -542,21 +594,25 @@ import{s as _,t as K}from"./chunk-X7FRGMS2.js";import{A as De,B as Ve,C as je,D
542
594
  .slm-health{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-bottom:16px}
543
595
  .slm-healthitem{padding:10px;border:1px solid var(--slm-line);border-radius:10px;background:var(--slm-surface)}
544
596
  .slm-healthitem b{display:block;font-size:17px;font-variant-numeric:tabular-nums}.slm-healthitem span{display:block;margin-top:2px;color:var(--slm-muted);font-size:10px;text-transform:uppercase;letter-spacing:.08em}
545
- .slm-seat-heading{display:flex;align-items:center;justify-content:space-between;gap:8px}
546
- .slm-seat-heading h2{font-size:18px;margin:0}
597
+ .slm-seat-heading{display:flex;align-items:center;gap:10px}.slm-seat-heading>span:not(.slm-plate){flex:1;min-width:0}.slm-seat-heading small{display:block;margin-top:2px;font-size:11.5px;color:var(--slm-muted)}
598
+ .slm .slm-watchclose{display:flex;align-self:flex-start;padding:4px;border-radius:7px;color:var(--slm-muted)}.slm .slm-watchclose:hover{background:var(--slm-tint);color:var(--slm-text)}
599
+ .slm-watchhint{display:flex;align-items:center;gap:10px;margin:10px 0;padding:12px 14px;border:1px dashed var(--slm-line);border-radius:12px;background:var(--slm-surface);font-size:12.5px;line-height:1.45;color:var(--slm-muted)}
600
+ .slm-watchhint kbd{font:inherit;font-size:11px;padding:1px 5px;border:1px solid var(--slm-line);border-radius:5px}
601
+ .slm-watchcard{margin:10px 0;padding:14px;border:1px solid var(--slm-line);border-radius:14px;background:var(--slm-surface)}
602
+ .slm-watchcard.reserved{border-color:color-mix(in srgb,#c026d3 45%,var(--slm-line))}
603
+ .slm-watchcard dl{margin:10px 0 0;display:grid;gap:0}.slm-watchcard dl div{display:flex;justify-content:space-between;gap:10px;padding:6px 0;border-top:1px solid var(--slm-line);font-size:12.5px}
604
+ .slm-watchcard dt{color:var(--slm-muted)}.slm-watchcard dd{margin:0;font-weight:600;text-align:right}
605
+ .slm-watchacts{display:flex;gap:6px;flex-wrap:wrap;margin-top:10px}.slm .slm-watchacts .slm-btn{display:inline-flex;align-items:center;justify-content:center;gap:6px;flex:none;min-width:0;min-height:32px;padding:0 10px;border-radius:9px;font-size:12.5px;font-weight:600;white-space:nowrap}.slm .slm-watchacts .slm-btn:first-child:not(:last-child){flex:1}
606
+ .slm-feedfilter{display:flex;align-items:center;justify-content:space-between;gap:8px;margin:12px 0 6px}
607
+ .slm-feedfilter>b{font-size:11px;font-weight:700;letter-spacing:.06em;text-transform:uppercase;color:var(--slm-muted);white-space:nowrap}
608
+ .slm-feedfilter>span{display:inline-flex;gap:4px}
609
+ .slm .slm-feedfilter button{height:24px;padding:0 9px;border-radius:999px;font-size:11px;font-weight:500;color:var(--slm-muted)}
610
+ .slm .slm-feedfilter button[aria-pressed="true"]{background:color-mix(in srgb,var(--slm-text) 8%,transparent);color:var(--slm-text);font-weight:700}
611
+ .slm-sectionstate{font-size:11px;font-weight:700;padding:2px 8px;border-radius:999px;background:rgba(34,160,107,.14);color:#1a7f52}
612
+ .slm-sectionstate.soldout{background:rgba(138,148,166,.18);color:var(--slm-muted)}.slm-sectionstate.blocked{background:rgba(214,69,69,.12);color:#b42318}
613
+ .slm-activity-empty b{display:block;margin-top:2px;color:var(--slm-text);font-weight:600}
614
+ .slm-seat-heading h2{font-size:15px;font-weight:700;margin:0}
547
615
  .slm-seat-heading [data-seat-status]{font-size:12px;text-transform:capitalize}
548
- .slm-seat-history{display:flex;flex-direction:column;min-height:0;flex:1;gap:6px}
549
- .slm-history-counts{display:flex;flex-wrap:wrap;gap:4px;margin:5px 0}
550
- .slm-history-counts button{font:inherit;font-size:11px;padding:3px 6px;border:1px solid var(--slm-line);border-radius:5px;background:var(--slm-bg);color:var(--slm-muted);cursor:pointer}
551
- .slm-history-counts button[aria-pressed=true]{color:var(--slm-text);border-color:var(--slm-accent)}
552
- .slm-history-list{min-height:0;overflow:auto;flex:1}
553
- .slm-history-row{display:flex;align-items:center;justify-content:space-between;gap:8px;min-height:30px;border-bottom:1px solid var(--slm-line);font-size:11px}
554
- .slm-history-row time{color:var(--slm-muted);font-variant-numeric:tabular-nums}
555
- .slm-history-row strong{font-size:10px;text-transform:uppercase;border-radius:4px;padding:3px 6px;background:var(--slm-surface);color:var(--slm-text)}
556
- .slm-history-row[data-action=hold] strong{color:#a66c00;background:#e9ad2220}
557
- .slm-history-row[data-action=book] strong{color:#168251;background:#20976520}
558
- .slm[data-theme=dark] .slm-history-row[data-action=hold] strong{color:#f6c65c}
559
- .slm[data-theme=dark] .slm-history-row[data-action=book] strong{color:#63d6a0}
560
616
  .slm-sectionhead{display:flex;align-items:flex-start;justify-content:space-between;gap:10px;margin-top:18px}
561
617
  .slm-windows{display:flex;gap:3px;padding:2px;border:1px solid var(--slm-line);border-radius:8px;background:var(--slm-surface)}
562
618
  .slm-window{padding:4px 6px;border-radius:6px;font-size:10px;font-weight:800;color:var(--slm-muted)}.slm-window.on{background:var(--slm-accent);color:var(--slm-accent-ink)}
@@ -564,14 +620,6 @@ import{s as _,t as K}from"./chunk-X7FRGMS2.js";import{A as De,B as Ve,C as je,D
564
620
  .slm-momentumhelp[hidden]{display:none}.slm-momentumscale{display:flex;align-items:center;gap:7px;color:var(--slm-muted);font-size:10px;font-weight:750;text-transform:uppercase;letter-spacing:.07em}
565
621
  .slm-momentumgradient{height:6px;min-width:64px;flex:1;border-radius:999px;background:linear-gradient(90deg,#f4b740,#ef4444)}
566
622
  .slm-momentumcopy{margin-top:7px;color:var(--slm-muted);font-size:11px;line-height:1.45}
567
- /* sections: availability windows */
568
- .slm-availlist{display:flex;flex-direction:column;gap:8px;margin:2px 0 12px}
569
- .slm-availrow{padding:10px;border:1px solid var(--slm-line);border-radius:10px;background:var(--slm-surface);
570
- transition:border-color var(--slm-mo-quick) var(--slm-mo-out),opacity var(--slm-mo-quick) var(--slm-mo-out)}
571
- /* Mixed toward the INK rather than toward black: on a light ground a black
572
- mix is the only thing on the surface that reads as dark. */
573
- .slm-availrow.zone{background:color-mix(in srgb,var(--slm-surface) 82%,var(--slm-text))}
574
- .slm-availrow.hidden,.slm-availrow.closed{opacity:1}
575
623
  .slm-themed-picker{min-width:0;width:100%}
576
624
  .slm-themed-picker summary{display:flex;align-items:center;justify-content:space-between;gap:12px;text-align:left;list-style:none;padding:8px 10px;border:1px solid var(--slm-line);border-radius:7px;background:var(--slm-surface);color:var(--slm-text);font-size:12px;cursor:pointer}
577
625
  .slm-themed-picker summary::-webkit-details-marker{display:none}
@@ -582,51 +630,52 @@ import{s as _,t as K}from"./chunk-X7FRGMS2.js";import{A as De,B as Ve,C as je,D
582
630
  .slm .slm-themed-options button{text-align:left;padding:8px;border:0;border-radius:5px;background:transparent;color:var(--slm-text);font-size:12px;cursor:pointer}
583
631
  .slm .slm-themed-options button:hover,.slm .slm-themed-options button[aria-pressed=true]{background:var(--slm-tint-strong)}
584
632
  .slm-themed-options button[aria-pressed=true]::after{content:' \u2713';float:right}
585
- .slm-availpicker{margin-top:7px}
586
- .slm-availpicker summary{display:flex;align-items:center;justify-content:space-between;list-style:none;cursor:pointer;border:1px solid var(--slm-line);border-radius:7px;padding:7px 9px;font-size:12px;font-weight:600;color:var(--slm-text);background:var(--slm-bg)}
587
- .slm-availpicker summary::-webkit-details-marker{display:none}
588
- .slm-availpicker summary:focus-visible,.slm-availchoices button:focus-visible{outline:2px solid var(--slm-accent);outline-offset:2px}
589
- .slm-availpicker[open] summary{border-color:var(--slm-accent)}
590
- .slm-availpicker summary[aria-disabled=true]{opacity:.55;cursor:wait}
591
- .slm-availchoices{margin-top:5px;padding:4px;border:1px solid var(--slm-line);border-radius:9px;background:var(--slm-bg);box-shadow:0 4px 14px #0001}
592
- .slm-availchoices button{display:flex;align-items:center;justify-content:space-between;gap:6px;width:100%;text-align:left;padding:7px 8px;border:0;border-radius:5px;cursor:pointer;color:var(--slm-text);background:transparent}
593
- .slm-availchoices button:hover,.slm-availchoices button[aria-pressed=true]{background:var(--slm-tint-strong)}
594
- .slm-availchoices b{display:block;font-size:12px;font-weight:600}
595
- .slm-availchoices small{display:block;margin-top:2px;font-size:10px;color:var(--slm-muted)}
596
- .slm-availhead{display:flex;align-items:center;gap:8px}
597
- .slm-availlabel{display:flex;align-items:center;gap:5px;flex:1;min-width:0;font-size:12.5px;font-weight:800;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
598
- .slm-availcaret{flex:none;color:var(--slm-muted);font-size:10px}
599
- .slm-availcount{flex:none;font-size:11px;font-weight:700;color:var(--slm-muted);font-variant-numeric:tabular-nums}
600
- .slm-availbadge{flex:none;font-size:9px;font-weight:800;letter-spacing:.04em;text-transform:uppercase;padding:2px 6px;border-radius:999px}
601
- .slm-availbadge.hidden{background:rgba(139,148,172,.18);color:var(--slm-text)}
602
- .slm-availbadge.closed{background:rgba(244,183,64,.16);color:var(--slm-text)}
603
- .slm-availselwrap{position:relative;flex:none;display:inline-flex}
604
- .slm-availmode{width:auto;max-width:190px;padding:6px 8px;font-size:11.5px;font-weight:700;cursor:pointer}
605
- .slm-availmode.on{border-color:var(--slm-accent);color:var(--slm-text)}
606
- .slm-availmode:disabled{opacity:.55;cursor:progress}
607
- .slm-availfollows{flex:none;padding:5px 10px;border:1px solid var(--slm-line);border-radius:7px;background:var(--slm-surface);color:var(--slm-muted);font-size:11px;font-weight:600;white-space:nowrap}
608
- .slm-availdetail{display:flex;align-items:center;gap:8px;margin-top:9px}
609
- .slm-availdetail .slm-input{flex:1}
610
- .slm-availpct{max-width:74px;flex:none!important}
611
- .slm-availpctlabel{font-size:11px;color:var(--slm-muted);font-weight:600;white-space:nowrap}
612
- .slm-availsummary{display:flex;align-items:center;gap:8px;padding:10px 12px;border:1px solid var(--slm-line);border-radius:9px;color:var(--slm-muted);font-size:12.5px}
613
- .slm-availdot{width:9px;height:9px;border-radius:50%;flex:none;background:#22a06b}.slm-availdot.warn{background:#f4b740}
614
- .slm-availcallout{display:flex;align-items:flex-start;gap:8px;margin-top:10px;padding:10px 12px;border:1px solid rgba(244,183,64,.45);border-radius:9px;background:rgba(244,183,64,.1)}
615
- .slm-availstar{flex:none;margin-top:1px;color:#f4b740;font-size:13px;line-height:1}
616
- .slm-availcallout p{font-size:11.5px;line-height:1.55;color:var(--slm-text)}.slm-availcallout b{color:inherit;font-weight:800}
617
633
  .slm-inspect-card{padding:16px;border:1px solid var(--slm-line);border-radius:12px;background:var(--slm-surface)}
618
634
  .slm-inspect-label{font-size:24px;font-weight:850;letter-spacing:-.02em;line-height:1.1}
619
635
  .slm-inspect-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px 20px;margin-top:18px}
620
636
  .slm-inspect-grid>div{min-width:0}.slm-inspect-grid span{display:block;color:var(--slm-muted);font-size:10px;
621
637
  text-transform:uppercase;letter-spacing:.08em}.slm-inspect-grid b{display:block;margin-top:4px;font-size:13px;line-height:1.35;overflow-wrap:anywhere}
638
+ .slm-plate{display:inline-flex;align-items:center;justify-content:center;flex:none;border-radius:9px}
639
+ .slm-taskhead{justify-content:flex-start;gap:10px}.slm .slm-taskhead .slm-eyebrow{flex:1;font-size:16px;font-weight:800;letter-spacing:0;text-transform:none;color:var(--slm-text)}
640
+ .slm-selcard{position:sticky;top:-16px;z-index:3;margin:10px -4px 12px;padding:12px 14px;border-radius:14px;border:1px solid color-mix(in srgb,var(--slm-accent) 55%,transparent);
641
+ background:color-mix(in srgb,var(--slm-accent) 9%,var(--slm-surface));box-shadow:0 6px 14px -8px rgba(12,18,32,.25)}
642
+ .slm-selcard.empty{border:1px dashed var(--slm-line);background:var(--slm-surface);box-shadow:none}
643
+ .slm-selcount{display:flex;align-items:baseline;gap:7px;font-size:13px;font-weight:600}.slm-selcount b{font-size:24px;font-weight:800;font-variant-numeric:tabular-nums}
644
+ .slm-selcard.empty .slm-selcount b{color:var(--slm-muted)}.slm-selcount .slm-linkbtn{margin-left:auto}
645
+ .slm-selwhere{margin:4px 0 0;font-size:12.5px;color:var(--slm-muted)}
646
+ .slm-selparts{display:flex;flex-wrap:wrap;gap:6px;margin-top:8px}.slm-selparts span{display:inline-flex;align-items:center;gap:5px;padding:3px 8px;border-radius:999px;font-size:11.5px;font-weight:600;background:var(--slm-tint)}
647
+ .slm-selparts .tone-ok{color:#11704c;background:rgba(34,160,107,.14)}.slm-selparts .tone-warn{color:#8a5206;background:rgba(244,183,64,.2)}.slm-selparts .tone-danger{color:#b4232a;background:rgba(214,69,69,.13)}
648
+ .slm[data-theme="dark"] .slm-selparts .tone-ok{color:#5fd3a1}.slm[data-theme="dark"] .slm-selparts .tone-warn{color:#f5c267}.slm[data-theme="dark"] .slm-selparts .tone-danger{color:#ff8a8f}
649
+ .slm-selparts .type{background:transparent;padding:3px 2px;font-weight:500}.slm-selparts i{width:8px;height:8px;border-radius:50%}
650
+ .slm-selstale,.slm-panelalert{display:flex;gap:9px;align-items:flex-start;margin:10px 0 0;padding:9px 10px;border-radius:10px;font-size:12px;line-height:1.45;background:rgba(244,183,64,.16)}
651
+ .slm-panelalert{margin:10px 0}.slm-panelalert.error{background:rgba(214,69,69,.12)}.slm-panelalert.ok{background:rgba(34,160,107,.12)}.slm-panelalert.info{background:rgba(59,130,246,.12)}.slm-panelalert b{display:block}
652
+ .slm-ways{display:flex;flex-direction:column;gap:9px;margin-top:10px}.slm-ways>span{display:flex;align-items:center;gap:10px;font-size:11.5px;color:var(--slm-muted)}
653
+ .slm-ways b{display:block;font-size:12.5px;color:var(--slm-text)}
654
+ .slm-selbtns{position:relative;display:flex;gap:6px;margin-top:10px}.slm-simwrap{display:flex;flex:1;min-width:0}
655
+ .slm .slm-selbtns .slm-btn{display:inline-flex;align-items:center;justify-content:center;gap:5px;flex:none;min-width:0;min-height:32px;padding:0 9px;white-space:nowrap;overflow:hidden;border-radius:9px;font-size:12.5px;font-weight:600}
656
+ .slm .slm-selbtns .slm-simwrap .slm-btn{flex:1}.slm .slm-selbtns .slm-btn:disabled{opacity:.45;cursor:default}
657
+ .slm .slm-savedrow{display:flex;align-items:center;gap:10px;width:100%;padding:9px 0 0;border-top:1px dashed var(--slm-line);text-align:left;font-size:11.5px;color:var(--slm-muted)}
658
+ .slm-savedrow>span:nth-child(2){flex:1}.slm-savedrow b{display:block;font-size:12.5px;color:var(--slm-text)}
659
+ /* A panel's Undo, pinned under its list (Sections, Tables, Channels). */
660
+ .slm-undobar{position:sticky;bottom:0;display:flex;align-items:center;justify-content:space-between;gap:8px;margin:12px -16px -16px;padding:10px 16px;border-top:1px solid var(--slm-line);background:var(--slm-surface);font-size:12px;color:var(--slm-muted)}
661
+ .slm-railfoot{position:sticky;bottom:-16px;z-index:3;margin:16px -16px -16px;padding:12px 16px 14px;background:var(--slm-surface);border-top:1px solid var(--slm-line);box-shadow:0 -8px 18px -10px rgba(12,18,32,.25)}
662
+ .slm .slm-railfoot .slm-btn{width:100%;min-height:42px;border-radius:11px;font-size:14px;font-weight:700}
663
+ .slm .slm-railfoot .slm-btn.danger{background:#d64545;border-color:#d64545;color:#fff}.slm .slm-railfoot .slm-btn:disabled{opacity:.55;cursor:default}
664
+ .slm .slm-railfoot .slm-btn.busy::before{content:'';display:inline-block;width:13px;height:13px;margin-right:8px;vertical-align:-2px;border-radius:50%;border:2px solid currentColor;border-right-color:transparent;animation:slm-spin calc(var(--slm-mo-slow) * 2.5) linear infinite}
665
+ @keyframes slm-spin{to{transform:rotate(360deg)}}
666
+ .slm-railfoot .slm-linkbtn{display:block;margin:8px auto 0;text-align:center}.slm-railfoot .slm-note{margin:7px 2px 0}
667
+ .slm-muted{color:var(--slm-muted);font-weight:500}
668
+ .slm .slm-findtrigger{display:flex;align-items:center;gap:9px;width:100%;min-width:0;height:36px;padding:0 8px 0 10px;border:1px solid var(--slm-line);border-radius:9px;background:var(--slm-surface);color:var(--slm-muted);font:inherit;font-size:12.5px;cursor:pointer;text-align:left}
669
+ .slm .slm-findtrigger span{flex:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.slm .slm-findtrigger kbd{padding:1px 5px;border:1px solid var(--slm-line);border-bottom-width:2px;border-radius:5px;font-size:10.5px}
670
+ .slm .slm-findtrigger:hover{border-color:var(--slm-muted)}.slm .slm-findtrigger:focus-visible{outline:2px solid var(--slm-accent);outline-offset:1px}
671
+ .slm-addby>summary{cursor:pointer;list-style:none}.slm-addby>summary::after{content:' \u25B8'}.slm-addby[open]>summary::after{content:' \u25BE'}.slm-addby>summary::-webkit-details-marker{display:none}
672
+ .slm-categoryrow.on{border-color:var(--slm-accent)!important;background:color-mix(in srgb,var(--slm-accent) 14%,var(--slm-surface))!important;box-shadow:inset 0 0 0 1px var(--slm-accent)}
622
673
  .slm-categoryassign{display:flex;flex-direction:column;gap:6px}
623
674
  .slm-categoryrow{display:grid!important;width:100%;grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:10px;
624
675
  padding:9px 10px!important;border:1px solid var(--slm-line)!important;border-radius:10px;background:var(--slm-surface)!important;
625
676
  text-align:left!important;transition:border-color var(--slm-mo-quick) var(--slm-mo-out),background var(--slm-mo-quick) var(--slm-mo-out)}
626
677
  .slm-categoryrow:not(:disabled):hover{border-color:var(--slm-accent)!important;background:color-mix(in srgb,var(--slm-accent) 10%,var(--slm-surface))!important}
627
678
  .slm-categoryrow:disabled{cursor:not-allowed}
628
- .slm-categoryrow:disabled:not(.current){opacity:.55}
629
- .slm-categoryrow.current{border-style:dashed!important}
630
679
  .slm-categoryrow>.dot{width:10px;height:10px;border-radius:50%;flex:none}
631
680
  .slm-categorycopy{display:flex;min-width:0;flex-direction:column;gap:2px}
632
681
  .slm-categorycopy b{font-size:12.5px;font-weight:800;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
@@ -634,32 +683,10 @@ import{s as _,t as K}from"./chunk-X7FRGMS2.js";import{A as De,B as Ve,C as je,D
634
683
  .slm-categoryact{flex:none;font-size:11px;font-weight:800;color:var(--slm-accent);white-space:nowrap}
635
684
  .slm-categoryrow:disabled .slm-categoryact{color:var(--slm-muted)}
636
685
  .slm-categoryrow.current .slm-categoryact{color:var(--slm-muted)}
637
- .slm-tablesummary{display:flex;align-items:baseline;gap:8px;padding:9px 12px;border:1px solid var(--slm-line);border-radius:9px;background:var(--slm-surface);font-size:12px;color:var(--slm-muted)}
638
- .slm-tablesummary b{color:var(--slm-text);font-variant-numeric:tabular-nums}
639
- .slm-tablelist{display:flex;flex-direction:column;gap:8px;margin-top:4px}
640
- .slm-tablerow{display:grid;grid-template-columns:minmax(0,1fr) minmax(128px,auto);align-items:center;gap:10px;
641
- padding:10px;border:1px solid var(--slm-line);border-radius:10px;background:var(--slm-surface)}
642
- .slm-tablerow.locked{border-style:dashed}
643
- .slm-tablecopy{display:flex;min-width:0;flex-direction:column;gap:2px}.slm-tablecopy b{font-size:12px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
644
- .slm-tablecopy small{font-size:10px;color:var(--slm-muted)}.slm-tablerow .slm-select{min-width:128px}
645
- .slm-tablelock{color:#f7ca6b;font-weight:700}
646
686
  .slm-select:disabled{opacity:.55;cursor:not-allowed}
647
687
  .slm:fullscreen{border-radius:0;min-height:100vh;background:var(--slm-bg)}
648
688
  .slm:fullscreen .slm-bar{padding:14px 22px}.slm:fullscreen .slm-kpi b{font-size:21px}.slm:fullscreen .slm-rail{width:360px}
649
689
 
650
- .slm.compact .slm-rail{width:100%;border-left:0;border-top:1px solid var(--slm-line);height:44%}
651
- .slm.compact .slm-body{flex-direction:column}
652
- .slm.compact.monitor-view{min-height:760px}
653
- .slm.compact.monitor-view .slm-rail{height:55%;min-height:260px}
654
- .slm.compact .slm-bar{grid-template-columns:minmax(0,1fr) auto;gap:8px;padding:8px}
655
- .slm.compact .slm-modes{display:none}
656
- .slm.compact .slm-tools{display:block;width:100%;padding:9px 13px;min-height:44px;border:1px solid var(--slm-line);
657
- border-radius:10px;background:var(--slm-surface);color:var(--slm-text);font-size:13px;font-weight:800}
658
- .slm.compact .slm-live{justify-self:end}.slm.compact .slm-bar-actions{grid-column:1/-1;justify-self:stretch;flex-wrap:wrap}
659
- .slm.compact .slm-barbtn{flex:1;padding:6px 9px}
660
- .slm.compact .slm-barbtn.slm-fullscreen{flex:none;justify-content:center;min-width:34px}.slm.compact .slm-fullscreen-label{display:none}.slm.compact .slm-kpis{grid-template-columns:repeat(4,minmax(0,1fr));gap:8px}
661
- .slm.compact .slm-kpi[data-kpi="viewing-map"],.slm.compact .slm-kpi[data-kpi="active-holds"],
662
- .slm.compact .slm-kpi[data-kpi="booked-pct"],.slm.compact .slm-kpi[data-kpi="booked-value"]{display:none}
663
690
  /* Reduced motion, as a BLANKET over the cockpit subtree rather than a list of
664
691
  selectors. The list this replaces named four animations and two transitions,
665
692
  and had silently fallen behind the stylesheet: the zoom hint, the toast and
@@ -677,105 +704,91 @@ import{s as _,t as K}from"./chunk-X7FRGMS2.js";import{A as De,B as Ve,C as je,D
677
704
  transition:none!important;
678
705
  scroll-behavior:auto!important}
679
706
  }
680
- `;function ce(){if(typeof document>"u"||document.getElementById(ne))return;let n=document.createElement("style");n.id=ne,n.textContent=dt,document.head.appendChild(n)}function de(n){if(typeof document>"u"||document.getElementById(re))return;let e=document.createElement("style");e.id=re,e.textContent=n,document.head.appendChild(e)}function he(n){return n.total==null||n.free==null?n.label:n.free<=0?`${n.label} \xB7 sold out`:`${n.label} \xB7 ${n.free.toLocaleString()} of ${n.total.toLocaleString()} free`}function me(n){let t=_({focusedSection:n.focused?n.focused.label:null,seatsRevealed:n.seatsRevealed,atVenueFit:n.atVenueFit})==="none";return{crumb:n.focused?n.floor?`${n.floor} \xB7 ${he(n.focused)}`:he(n.focused):n.floor??"Venue",crumbShown:!!n.focused||!!n.floor,zoomInEnabled:!n.atCeiling,zoomOutEnabled:!t,venueEnabled:!t}}function pe(n={}){return`
707
+ ${We}${Ge}`;function Je(){if(typeof document>"u"||document.getElementById(Ye))return;let r=document.createElement("style");r.id=Ye,r.textContent=us,document.head.appendChild(r)}function Qe(r){if(typeof document>"u"||document.getElementById(Ze))return;let e=document.createElement("style");e.id=Ze,e.textContent=r,document.head.appendChild(e)}var Xe="seatlayer-manager-extras-style";function et(r){if(typeof document>"u"||document.getElementById(Xe))return;let e=document.createElement("style");e.id=Xe,e.textContent=r,document.head.appendChild(e)}import{importCdnAsset as As}from"@seatlayer/core/core/cdnAsset";var bs={blocked:"all blocked",reserved:"all reserved",both:"all blocked or reserved"};function tt(r){return r.total==null||r.free==null?r.label:r.free<=0?`${r.label} \xB7 ${r.allBlocked?bs[r.allBlocked===!0?"blocked":r.allBlocked]:"sold out"}`:`${r.label} \xB7 ${r.free.toLocaleString()} of ${r.total.toLocaleString()} free`}function st(r){let t=Se({focusedSection:r.focused?r.focused.label:null,seatsRevealed:r.seatsRevealed,atVenueFit:r.atVenueFit})==="none";return{crumb:r.focused?r.floor?`${r.floor} \xB7 ${tt(r.focused)}`:tt(r.focused):r.floor??"Venue",crumbShown:!!r.focused||!!r.floor,zoomInEnabled:!r.atCeiling,zoomOutEnabled:!t,venueEnabled:!t}}function it(r={}){return`
681
708
  <div class="slm-mapchrome" data-ref="mapchrome">
682
- ${n.legend??""}
683
- <div class="slm-crumb" data-ref="crumb" role="status" hidden></div>
709
+ ${r.legend??""}
684
710
  <div class="slm-zoom" role="group" aria-label="Zoom">
685
- <button type="button" class="slm-zoombtn" data-ref="zin" aria-label="Zoom in" title="Zoom in">+</button>
686
711
  <button type="button" class="slm-zoombtn" data-ref="zout" aria-label="Zoom out one step" title="Zoom out one step (section, then venue)">\u2212</button>
687
- <button type="button" class="slm-zoombtn slm-zoombtn-venue" data-ref="zfit" title="Whole venue">Venue</button>
712
+ <button type="button" class="slm-zoombtn" data-ref="zin" aria-label="Zoom in" title="Zoom in">+</button>
713
+ <button type="button" class="slm-zoombtn slm-zoombtn-venue" data-ref="zfit" aria-label="Show the whole venue" title="Show the whole venue"><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 9V4h5M15 4h5v5M20 15v5h-5M9 20H4v-5"/></svg></button>
688
714
  </div>
689
715
  <div class="slm-minimap-mount" data-ref="minimap"></div>
690
- </div>`}function ue(n,e){n.crumb&&(n.crumb.textContent=e.crumb,n.crumb.hidden=!e.crumbShown);let t=(s,i)=>{s&&(s.disabled=!i,s.setAttribute("aria-disabled",String(!i)))};t(n.zin,e.zoomInEnabled),t(n.zout,e.zoomOutEnabled),t(n.zfit,e.venueEnabled)}var w={plenty:{min:.5,color:"#22a06b",label:"Plenty left",detail:"over half"},tight:{min:.15,color:"#f4b740",label:"Filling up",detail:"under half"},gone:{min:0,color:"#d9534f",label:"Nearly gone",detail:"under 15%"}},S={free:"#5b6db0",held:"#f4b740",sold:"#9ca3af"};function ht(n,e){let t=e>0?n/e:0;return t>=w.plenty.min?"plenty":t>=w.tight.min?"tight":"gone"}function mt(n,e,t,s=Date.now()){return n?.mode==="closed"||t?"Closed":n?.mode==="timed"&&n.revealAt&&n.revealAt>s?`Hidden until ${pt(n.revealAt,s)}`:n?.mode==="threshold"&&e?`Hidden until ${n.thresholdPct??0}% sold`:n?.mode==="hidden"||e?"Hidden":null}function pt(n,e){let t=new Date(n),s=t.toLocaleTimeString(void 0,{hour:"numeric",minute:t.getMinutes()?"2-digit":void 0}),i=(n-e)/864e5;return i<1&&t.getDate()===new Date(e).getDate()?s:i<6?`${t.toLocaleDateString(void 0,{weekday:"short"})} ${s}`:t.toLocaleDateString(void 0,{day:"numeric",month:"short"})}function be(n,e){let t=n.state==="sold-out"?"Sold out":mt(e.rule,e.hiddenNow,e.closedNow);return{tint:t==="Closed"||t==="Sold out"?null:e.colourBy==="type"?e.typeTint??null:w[ht(n.free,n.total)].color,stateWord:t}}function ge(){return`<div class="slm-blocklegend" data-ref="blocklegend" role="group" aria-label="Map colours">
691
- <span class="slm-colourby" role="radiogroup" aria-label="Colour by">
692
- <button type="button" role="radio" data-colour-by="full" aria-checked="true">How full</button>
693
- <button type="button" role="radio" data-colour-by="type" aria-checked="false">Ticket type</button>
694
- </span>
695
- <span class="slm-legend-items" data-ref="legenditems"></span>
696
- </div>`}function ut(n){let e=n.seats;return n.colourBy==="full"&&!e?[...Object.keys(w).map(t=>({label:`${w[t].label} \xB7 ${w[t].detail}`,color:w[t].color,seat:!1})),{label:"Sold out",color:S.sold,seat:!1}]:n.colourBy==="full"?[{label:"Free",color:S.free,seat:!0},{label:"Held",color:S.held,seat:!0},{label:"Sold",color:S.sold,seat:!0}]:[...n.types.map(t=>({label:t.label,color:t.color,seat:e})),...e?[{label:"Held",color:S.held,seat:!0}]:[],{label:e?"Sold":"Sold out",color:S.sold,seat:e}]}function fe(n,e){n.querySelectorAll("[data-colour-by]").forEach(s=>{let i=s.dataset.colourBy===e.colourBy;s.setAttribute("aria-checked",String(i)),s.classList.toggle("on",i)});let t=n.querySelector('[data-ref="legenditems"]');t&&t.replaceChildren(...ut(e).map(s=>{let i=document.createElement("span"),o=document.createElement("i");return o.style.background=s.color,s.seat&&o.classList.add("seat"),i.append(o,document.createTextNode(s.label)),i}))}var ve=[{key:"seatLabels",label:"Seat labels",letter:"S",hint:"Seat numbers where the zoom can carry them"},{key:"rowLabels",label:"Row labels",letter:"R",hint:"Row letters beside each row"},{key:"channelColours",label:"Channel colours",letter:"H",hint:"Channel flags and tints \u2014 the Channels tool\u2019s overlay"},{key:"momentum",label:"Booking momentum",letter:"M",hint:"Warm the sections booking fastest in the selected window"}],ye="seatlayer.controlRoom.mapView";function $(){return{seatLabels:!0,rowLabels:!0,categoryColours:!1,channelColours:!0,momentum:!1}}function xe(n){return n==="g"?"categoryColours":ve.find(t=>t.letter.toLowerCase()===n)?.key??null}function we(n=Se()){let e=$();if(!n)return e;try{let t=n.getItem(ye);if(!t)return e;let s=JSON.parse(t),i={...e};for(let o of Object.keys(e))typeof s[o]=="boolean"&&(i[o]=s[o]);return i}catch{return e}}function ke(n,e=Se()){if(e)try{e.setItem(ye,JSON.stringify(n))}catch{}}function Se(){try{return typeof localStorage>"u"?null:localStorage}catch{return null}}function Le(n,e){e.renderer?.setLabelLayers?.({seatLabels:n.seatLabels,rowLabels:n.rowLabels}),e.renderer?.setCategoryColours?.(n.categoryColours),e.channelsOverlay(n.channelColours)}function Me(){return`
716
+ </div>`}function ot(r,e){r.crumb&&(r.crumb.textContent=e.crumb,r.crumb.hidden=!e.crumbShown);let t=(s,i)=>{s&&(s.disabled=!i,s.setAttribute("aria-disabled",String(!i)))};t(r.zin,e.zoomInEnabled),t(r.zout,e.zoomOutEnabled),t(r.zfit,e.venueEnabled)}var I={plenty:{min:.5,color:"#1f9d6b",label:"Plenty left",detail:"over half"},tight:{min:.15,color:"#6cc39c",label:"Filling up",detail:"under half"},gone:{min:0,color:"#b9e2cf",label:"Nearly gone",detail:"under 15%"}},ue=[{key:"status",label:"Status",hint:"What a buyer can buy right now",dots:["#1f9d6b","#f4b740","#9ca3af"]},{key:"type",label:"Ticket type",hint:"Which ticket type each seat sells as",dots:["#bc800b","#e8456b","#2f9d46","#5b7bff"]},{key:"channel",label:"Channel",hint:"Who can sell each seat",dots:["#c9d0dc","#e8782a","#7c5cff"]}],F={free:"#1f9d6b",held:"#f4b740",sold:"#9ca3af",blocked:"#ffffff"};function fs(r,e){let t=e>0?r/e:0;return t>=I.plenty.min?"plenty":t>=I.tight.min?"tight":"gone"}function gs(r,e,t,s=Date.now()){return r?.mode==="closed"||t?"Closed":r?.mode==="timed"&&r.revealAt&&r.revealAt>s?`Hidden until ${vs(r.revealAt,s)}`:r?.mode==="threshold"&&e?`Hidden until ${r.thresholdPct??0}% sold`:r?.mode==="hidden"||e?"Hidden":null}function vs(r,e){let t=w(r,{hour:"numeric",minute:_(r).minute?"2-digit":void 0}),s=(r-e)/864e5;return s<1&&_(r).day===_(e).day?t:s<6?`${w(r,{weekday:"short"})} ${t}`:w(r,{day:"numeric",month:"short"})}function lt(r,e){let t=r.state==="sold-out"?e.allBlocked==="reserved"?"All reserved":e.allBlocked?"All blocked":"Sold out":gs(e.rule,e.hiddenNow,e.closedNow);return{tint:t==="All blocked"||t==="All reserved"?F.blocked:t==="Closed"||t==="Sold out"||e.colourBy==="channel"?null:e.colourBy==="type"?e.typeTint??null:I[fs(r.free,r.total)].color,stateWord:t}}var ys='<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="#8b5cf6" stroke-width="2" aria-hidden="true"><circle cx="12" cy="12" r="8.5"/><circle cx="8.5" cy="11" r="1"/><circle cx="12" cy="7.5" r="1"/><circle cx="15.5" cy="11" r="1"/></svg>';function rt(){let r=ue.map(e=>`<button type="button" role="option" data-colour-by="${e.key}" aria-selected="false"><em>${e.dots.map(t=>`<i style="background:${t}"></i>`).join("")}</em><span><b>${e.label}</b>${e.hint}</span></button>`).join("");return`<div class="slm-blocklegend" data-ref="blocklegend" role="group" aria-label="Map colours"><button type="button" class="slm-colourby" data-ref="colourby" aria-haspopup="listbox" aria-expanded="false">${ys}<span>Colour by</span> <b data-ref="colourname">Status</b><i aria-hidden="true">\u25BE</i></button><span class="slm-legend-items" data-ref="legenditems"></span><div class="slm-colourmenu" role="listbox" aria-label="Colour by" hidden>${r}<p>Each tool remembers its own choice. <button type="button" class="slm-howlink" data-how="colours">How colours work \u203A</button></p></div></div>`}var xs={free:"Free: buyers can pick them now.",held:"In a cart: in buyers\u2019 carts right now.",booked:"Sold: booked by buyers.",reserved:"Reserved: kept aside under a name.",blocked:"Blocked: off sale for this event.",shown:"Shown from the page around the room."};function nt(r){let e=r.shown;return e?[...at(r),{label:e.name,color:"transparent",seat:!0,reserved:!0,count:e.count,key:"shown"}]:at(r)}function at(r){let e=r.seats,t=r.counts,s={label:e?"Sold":"Sold out",color:F.sold,seat:e,count:e?t?.booked:void 0,...e?{key:"booked"}:{}},i=t?.reserved??0,n=i?[{label:"Reserved",color:"transparent",seat:!0,reserved:!0,count:i,key:"reserved"}]:[],o={label:"Blocked",color:F.blocked,seat:!0,blocked:!0,count:t?t.blocked-i:void 0,key:"blocked"};if(r.colourBy==="status"&&!e)return[...Object.keys(I).map(c=>({label:`${I[c].label} \xB7 ${I[c].detail}`,color:I[c].color,seat:!1})),s];if(r.colourBy==="status")return[{label:"Free",color:F.free,seat:!0,count:t?.free,key:"free"},{label:"In a cart",color:F.held,seat:!0,count:t?.held,key:"held"},s,...n,...!t||(o.count??0)>0||r.lit==="blocked"?[o]:[]];let a=e?[{label:"In a cart",color:F.held,seat:!0,count:t?.held,key:"held"}]:[];return[...(r.colourBy==="channel"?r.channels??[]:r.types).map(c=>({label:c.label,color:c.color,seat:e,count:c.free,soldOut:c.free===0,...e&&"key"in c&&c.key?{key:`type:${c.key}`}:{}})),...a,s,...e?n:[]]}function ct(r,e){let t=ue.find(o=>o.key===e.colourBy)??ue[0],s=r.querySelector('[data-ref="colourname"]');s&&(s.textContent=t.label),r.querySelectorAll("[data-colour-by]").forEach(o=>{let a=o.dataset.colourBy===e.colourBy;o.setAttribute("aria-selected",String(a)),o.classList.toggle("on",a),o.dataset.colourBy==="channel"&&(o.disabled=!e.channelAvailable,o.title=e.channelAvailable?"":"Open the Channels tool to colour by channel")});let i=r.querySelector('[data-ref="legenditems"]');if(!i)return;i.replaceChildren(...nt(e).map(o=>{let a=document.createElement(o.key?"button":"span");if(o.key){let c=e.lit===o.key;Object.assign(a,{type:"button",className:"slm-legendchip",title:`${xs[o.key]??`${o.label}: seats that sell as ${o.label}.`}
717
+ Click to light them up \xB7 \u21E7 click to select them.`}),a.dataset.legend=o.key,a.setAttribute("aria-pressed",String(c))}let l=document.createElement("i");if(l.style.background=o.color,o.seat&&l.classList.add("seat"),o.blocked&&l.classList.add("blocked"),o.reserved&&l.classList.add("reserved"),a.append(l,document.createTextNode(o.label)),o.count!==void 0){let c=document.createElement("b");c.textContent=o.soldOut?"sold out":o.count.toLocaleString(),a.append(c)}return o.key&&e.lit===o.key&&a.insertAdjacentHTML("beforeend",'<em aria-hidden="true">\xD7</em>'),a}));let n=nt(e).find(o=>o.key&&o.key===e.lit);if(n){let o=document.createElement("span");o.className="slm-litnote",o.setAttribute("role","status"),o.textContent=`Lighting up ${n.label}${n.count!==void 0?` \xB7 ${n.count.toLocaleString()}`:""} \xB7 Esc or \xD7 to clear`,i.append(o)}}var dt="#c026d3";function ht(r){let e=this;e._sceneFunc(r);let t=e.attrs.reservedRadius||1,s=e.getStage(),i=Math.abs((s?s.scaleX():1)*(e.scaleX()||1))||1;if(t*1.2*i<6)return;let n=t*.34,o=-t*.44,a=t*.44;r.save(),r.setAttr("strokeStyle",dt),r.setAttr("lineWidth",Math.max(t*.16,.75)),r.beginPath(),r.arc(0,0,t*.9,0,Math.PI*2,!1),r.stroke(),r.setAttr("fillStyle",dt),r.beginPath(),r.moveTo(-n,o),r.lineTo(n,o),r.lineTo(n,a),r.lineTo(0,a-n*.9),r.lineTo(-n,a),r.closePath(),r.fill(),r.restore()}function ee(r){return r.attrs.sceneFunc===ht}function be(r){ee(r)&&r.setAttr("sceneFunc",void 0)}function pt(r,e){r.attrs.reservedRadius=e>0?e:1,ee(r)||r.setAttr("sceneFunc",ht)}var mt=r=>r.attrs?.seatId;var ut=[{key:"seatLabels",label:"Seat labels",letter:"S",hint:"Seat numbers where the zoom can carry them"},{key:"rowLabels",label:"Row labels",letter:"R",hint:"Row letters beside each row"},{key:"momentum",label:"Booking momentum",letter:"M",hint:"Warm the sections booking fastest in the selected window"}],bt="seatlayer.controlRoom.mapView",ft="seatlayer.controlRoom.colourBy";function gt(r){return r==="categories"?"type":r==="channels"?"channel":"status"}function vt(r=se()){try{let e=JSON.parse(r?.getItem(ft)??"{}"),t={};for(let[s,i]of Object.entries(e??{}))(i==="status"||i==="type"||i==="channel")&&(t[s]=i);return t}catch{return{}}}function yt(r,e=se()){try{e?.setItem(ft,JSON.stringify(r))}catch{}}function te(){return{seatLabels:!0,rowLabels:!0,categoryColours:!1,channelColours:!0,momentum:!1}}function xt(r){return r==="g"?"categoryColours":r==="h"?"channelColours":ut.find(t=>t.letter.toLowerCase()===r)?.key??null}function kt(r=se()){let e=te();if(!r)return e;try{let t=r.getItem(bt);if(!t)return e;let s=JSON.parse(t),i={...e};for(let n of Object.keys(e))typeof s[n]=="boolean"&&(i[n]=s[n]);return i}catch{return e}}function wt(r,e=se()){if(e)try{e.setItem(bt,JSON.stringify(r))}catch{}}function se(){try{return typeof localStorage>"u"?null:localStorage}catch{return null}}function St(r,e){e.renderer?.setLabelLayers?.({seatLabels:r.seatLabels,rowLabels:r.rowLabels}),e.renderer?.setCategoryColours?.(r.categoryColours),e.channelsOverlay(r.channelColours)}function Lt(){return`
697
718
  <details class="slm-view" data-ref="view">
698
- <summary class="slm-barbtn slm-view-summary" aria-haspopup="menu" title="How the map reads: labels, colours, momentum">View <span class="slm-view-caret" aria-hidden="true">\u25BE</span></summary>
699
- <div class="slm-view-menu" role="menu" aria-label="Map view">${ve.map(e=>`
719
+ <summary class="slm-barbtn slm-view-summary" aria-haspopup="menu" aria-label="View" title="How the map reads: labels, colours, momentum"><span class="slm-view-eye" aria-hidden="true"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="#3b82f6" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round"><path d="M2.5 12s3.5-6.5 9.5-6.5 9.5 6.5 9.5 6.5-3.5 6.5-9.5 6.5S2.5 12 2.5 12z"/><circle cx="12" cy="12" r="3"/></svg></span><span class="slm-view-text">View</span> <span class="slm-view-caret" aria-hidden="true">\u25BE</span></summary>
720
+ <div class="slm-view-menu" role="menu" aria-label="Map view">${ut.map(e=>`
700
721
  <button type="button" class="slm-view-item" role="menuitemcheckbox" data-view="${e.key}" aria-checked="false" title="${e.hint}">
701
722
  <span class="slm-view-check" aria-hidden="true"></span>
702
723
  <span class="slm-view-label">${e.label}</span>
703
724
  <kbd class="slm-view-kbd" aria-hidden="true">\u21E7${e.letter}</kbd>
704
725
  </button>`).join("")}
726
+ <button type="button" class="slm-view-item on" role="menuitemcheckbox" data-panel-toggle aria-checked="true" title="Show or hide the task panel beside the map">
727
+ <span class="slm-view-check" aria-hidden="true"></span>
728
+ <span class="slm-view-label">Task panel</span>
729
+ </button>
705
730
  <div class="slm-view-note" data-ref="viewnote" hidden></div>
706
731
  </div>
707
- </details>`}function Te(n,e,t){let s=$(),i=!1;n.querySelectorAll("[data-view]").forEach(l=>{let r=l.dataset.view,c=e[r];l.setAttribute("aria-checked",String(c)),l.classList.toggle("on",c);let d=r==="channelColours"&&!t.channelColoursAvailable;l.disabled=d,l.setAttribute("aria-disabled",String(d)),!d&&c!==s[r]&&(i=!0)}),n.querySelector("summary")?.classList.toggle("away",i);let a=n.querySelector('[data-ref="viewnote"]');if(a){let l=[];t.channelColoursAvailable||l.push("Channel colours: open the Channels tool."),t.momentumLoading&&l.push("Booking momentum: loading the first snapshot\u2026"),a.hidden=!l.length,a.textContent=l.join(" ")}}import{UNGROUPED_ID as bt}from"@seatlayer/core";function V(n){return Object.entries(n).filter(([,e])=>e.mode==="closed").map(([e])=>e)}function H(n){let e=n.sectionsBase;if(!e)return{rows:[],hiddenSections:0,closedSections:0};let t=n.doc?.zones??[],s=new Map,i=[];for(let c of e.sections)if(c.zone&&t.some(d=>d.id===c.zone)){let d=s.get(c.zone)??[];d.push(c),s.set(c.zone,d)}else i.push(c);let o=[],a=0,l=0,r=(c,d,h,p=!1)=>{let u=n.availabilityRules[d.id]??null,g=n.effectiveClosed.has(d.id)||p,f=n.effectiveHidden.has(d.id)||h&&!g;c==="section"&&f&&(a+=1),c==="section"&&g&&(l+=1),o.push({kind:c,id:d.id,label:d.label,seatCount:d.seatCount,seatLabels:d.seatLabels,rule:u,hidden:f,closed:g,followsZone:c==="section"&&h})};for(let c of t){let d=s.get(c.id);if(!d||!d.length)continue;let h={id:c.id,label:c.label||"Zone",seatCount:d.reduce((g,f)=>g+f.seatCount,0),seatLabels:d.flatMap(g=>g.seatLabels)},p=!!n.availabilityRules[c.id],u=n.availabilityRules[c.id]?.mode==="closed";r("zone",h,!1);for(let g of d)r("section",g,p,u)}for(let c of i)r("section",c,!1);if(e.ungrouped){let c=e.ungrouped;r("section",{id:bt,label:c.label,seatCount:c.seatCount,seatLabels:c.seatLabels},!1)}return{rows:o,hiddenSections:a,closedSections:l}}function Ce(n,e){let t=W(n.rule),s=`slm-availrow${n.kind==="zone"?" zone":""}${n.hidden?" hidden":""}${n.closed?" closed":""}`,i=e?" disabled":"",o=[["open","Open","Available to buy"],["closed","Closed","Visible on the map, unavailable to buy"],["hidden","Hidden","Removed from the buyer map"],["timed","Scheduled reveal","Open at a specific date and time"],["threshold","Demand-based reveal","Open when sales reach a percentage"]],a=n.followsZone?'<span class="slm-availfollows">Follows zone</span>':`<details class="slm-availpicker" data-avail-picker>
708
- <summary aria-label="Availability for ${m(n.label)}" ${e?'aria-disabled="true"':""}>${o.find(d=>d[0]===t)[1]}<span aria-hidden="true">\u2304</span></summary>
709
- <div class="slm-availchoices" aria-label="Availability options for ${m(n.label)}">
710
- ${o.map(([d,h,p])=>`<button type="button" data-avail-id="${m(n.id)}" data-avail-value="${d}" aria-pressed="${t===d}"${i}><span><b>${h}</b><small>${p}</small></span><span aria-hidden="true">${t===d?"\u2713":""}</span></button>`).join("")}
711
- </div>
712
- </details>`,l="";if(!n.followsZone&&t==="timed"){let d=n.rule?.revealAt?m(Z(n.rule.revealAt)):"";l=`<div class="slm-availdetail">
713
- <input type="datetime-local" class="slm-input" data-avail-reveal="${m(n.id)}" value="${d}"${i} aria-label="Reveal time for ${m(n.label)}" />
714
- </div>`}else if(!n.followsZone&&t==="threshold"){let d=n.rule?.thresholdPct??80;l=`<div class="slm-availdetail">
715
- <span class="slm-availpctlabel">Reveal at</span>
716
- <input type="number" min="1" max="100" class="slm-input slm-availpct" data-avail-pct="${m(n.id)}" value="${m(d)}"${i} aria-label="Percent sold to reveal ${m(n.label)}" />
717
- <span class="slm-availpctlabel">% sold</span>
718
- </div>`}let r=n.closed?'<span class="slm-availbadge closed">Closed</span>':n.hidden?'<span class="slm-availbadge hidden">Hidden</span>':"",c=n.kind==="zone"?`<span class="slm-availcaret" aria-hidden="true">${n.hidden?"\u25B8":"\u25BE"}</span>`:"";return`<div class="${s}">
719
- <div class="slm-availhead">
720
- <span class="slm-availlabel">${c}${m(n.label)}</span>
721
- ${r}
722
- <span class="slm-availcount">${n.seatCount.toLocaleString()}</span>
723
- </div>
724
- ${a}
725
- ${l}
726
- </div>`}var Lt="https://api.seatlayer.io",B=200,Ae=16,$e=4,Be=[{key:"watch",label:"Watch",tools:[{mode:"view",label:"Monitor",shortcut:"M",title:"Live board \u2014 inventory, activity and booking momentum. Read-only."},{mode:"inspect",label:"Inspect",shortcut:"I",title:"Click one seat to read its live status and booking context. Read-only."}]},{key:"manage",label:"Manage",tools:[{mode:"block",label:"Block",shortcut:"B",title:"Take seats off sale for this event, or put them back."},{mode:"sections",label:"Sections",shortcut:"S",title:"Open, close or hide sections for this event, on a schedule or on demand."},{mode:"categories",label:"Categories",shortcut:"G",title:"Move seats to a different price category for this event only."},{mode:"tables",label:"Tables",shortcut:"T",title:"Sell each table per chair or as one whole-table booking."},{mode:"channels",label:"Channels",shortcut:"C",title:"Allocate inventory to sales channels and share their links."}]},{key:"host",label:"Host tools",tools:[{mode:"select",label:"Select",shortcut:"X",title:"Select seats for your own back-office operation. The selection is handed to your app; nothing changes here."},{mode:"filterSections",label:"Filter",shortcut:"L",title:"Filter the map to one section for your own reporting."}]}],Mt=3;function Tt(n){let e=n?.status;return e===401||e===403}var He=n=>`<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">${n}</svg>`,j={enter:He('<path d="M4 9V4h5M15 4h5v5M20 15v5h-5M9 20H4v-5"/>'),exit:He('<path d="M9 4v5H4M20 9h-5V4M15 20v-5h5M4 15h5v5"/>')},Ct=Object.fromEntries(Be.flatMap(n=>n.tools.map(e=>[e.shortcut.toLowerCase(),e.mode]))),q=class{constructor(e){this.els={};this.renderer=null;this.doc=null;this.selectObserver=null;this.seatHistoryPanel=null;this.activityPanel=null;this.navigation=null;this.movingMap=!1;this.marqueeShape="box";this.socketSnapshotSeen=!1;this.monitorRefreshTimer=null;this.themeMode=null;this.colorSchemeStop=null;this.inventoryModelVersion=1;this.selectableObjectLabels=new Set;this.unavailableLabels=new Set;this.lastSelectionLabels=new Set;this.selectionWasValid=null;this.initialSelectionApplied=!1;this.labelToId=new Map;this.labelToSeat=new Map;this.allIds=[];this.gaUnitLabelSet=new Set;this.tableChairIds=new Map;this.status=new Map;this.counts={held:0,booked:0,blocked:0};this.modelVersion=0;this.currency="USD";this.authoritativeCurrency=null;this.authoritativeGrossRevenue=0;this.revenueStatus="loading";this.revenueRequest=0;this.controlRoomSnapshot=null;this.serverBaseline=null;this.livePresence=null;this.liveGross=null;this.paintHandle=null;this.trendWindowMinutes=15;this.heatEnabled=!1;this.mapView=$();this.barFind=null;this.minimap=null;this.lastKpiValues=new Map;this.activeKpiDeltas=new Map;this.ws=null;this.reconnectTimer=null;this.attempt=0;this.closed=!1;this.connectionStatus="reconnecting";this.lastMessageAt=null;this.ready=!1;this.feed=[];this.feedTimer=null;this.toastTimer=null;this.liveEventTimer=null;this.kpiCleanupTimer=null;this.followLiveTimer=null;this.followSeatTimer=null;this.releaseAt=null;this.layoutObserver=null;this.chromeClearance=-1;this.chromeClearanceWidth=-1;this.tokenExpiresAt=null;this.tokenRefreshTimer=null;this.tokenRefreshInFlight=!1;this.tokenRefreshFailures=0;this.sessionEnded=!1;this.sectionByObject=new Map;this.sectionLabelById=new Map;this.sectionsBase=null;this.filteredSectionLabel=null;this.availabilityRules={};this.effectiveHidden=new Set;this.effectiveClosed=new Set;this.availabilitySaving=!1;this.lastSyncedAt=null;this.blockBrowse=!1;this.blockedQuery="";this.blockedSection="";this.blockedResultLimit=100;this.unblockAllConfirmTimer=null;this.channels=null;this.chooser=null;this.chooserDialog=null;this.categoryDifferences=null;this.channelCaps={view:!1,manage:!1};this.categoryCanManage=!1;this.tableCanManage=!1;this.tableBookingSaving=!1;this.channelCapabilityResolution=0;this.channelsLoading=null;this.onFullscreenChange=()=>{this.paintFullscreenButton(),this.updateContainerLayout(),this.renderer?.forceDraw()};this.onKeyDown=e=>{if(e.metaKey||e.ctrlKey||e.altKey||e.target?.matches('input,select,textarea,[contenteditable="true"]'))return;let s=e.key.toLowerCase(),i=e.shiftKey?xe(s):null;if(i){this.toggleMapView(i),e.preventDefault();return}if(s==="/"){let a=this.els.findbar?.querySelector("[data-ch-find-input]");a&&(a.focus(),a.select(),e.preventDefault());return}let o=Ct[s];if(o){if(!this.toolAvailable(o))return;this.setMode(o)}else if(s==="f")this.toggleFullscreen();else if(s==="escape"){let a=this.els.view;if(a?.open)a.open=!1,a.querySelector("summary")?.focus();else if(!this.channels?.handleBack())if(this.getSelection().length)this.clearSelection();else return}else return;e.preventDefault()};this.onRailClick=e=>{let t=e.target,s=t?.closest("[data-section-focus]");if(s?.dataset.sectionFocus){this.locateSection(s.dataset.sectionFocus);return}let i=t?.closest("[data-feed-id]");i?.dataset.feedId&&this.locateActivity(i.dataset.feedId)};this.typeKeyBySection=null;this.typeKeyBase=null;this.sectionOptions=[];F(e.token),this.assertSelectionOptions(e.maxSelectedObjects,e.numberOfPlacesToSelect),this.opts=e,this.key=e.eventKey,this.mode=e.mode??"view",this.selectableObjectLabels=new Set(e.selectableObjects??[]),this.unavailableLabels=new Set(e.unavailableObjects??[]),this.categoryCanManage=new Set(e.capabilities??[]).has("event:categories:manage"),this.tableCanManage=new Set(e.capabilities??[]).has("event:tables:manage"),this.keepLive=e.keepLiveWhileHidden??!0,this.themeMode=e.themeMode??null,this.followLive=e.followLive??!1,this.currency=e.currency??"USD",this.tokenExpiresAt=e.tokenExpiresAt??null,this.api=new O(e.apiBase??Lt,e.token),this.organizerAssetUrls=new A(this.key,(t,s)=>this.withAuthRetry(()=>this.api.asset(t,s))),this.host=Y(e.container)}assertSelectionOptions(e,t){let s=i=>i===void 0||Number.isInteger(i)&&i>0;if(!s(e))throw new TypeError("maxSelectedObjects must be a positive integer");if(!s(t))throw new TypeError("numberOfPlacesToSelect must be a positive integer");if(e!==void 0&&t!==void 0&&e<t)throw new TypeError("maxSelectedObjects cannot be lower than numberOfPlacesToSelect")}async render(){ce(),this.buildChrome();try{let e=await this.withAuthRetry(()=>this.api.chart(this.key));this.inventoryModelVersion=e.event.inventoryModelVersion===2?2:1,this.doc=await this.organizerAssetUrls.prepareRendererChart(e.doc),this.authoritativeCurrency=e.event.currency??null,this.currency=this.authoritativeCurrency??this.opts.currency??this.currency,this.buildUnitUniverse(this.doc),this.buildRenderer(),this.buildSectionOptions(),this.settleMode();let[,t]=await Promise.all([this.resnapshot(),this.refreshControlRoom().catch(s=>this.opts.onError?.(s)),this.refreshAvailability()]);t?.activity?this.seedFeed(t.activity):this.api.log(this.key,{limit:24}).then(s=>this.seedFeed(s.entries)).catch(()=>{}),this.connect(),this.startFeedClock(),this.ready=!0,await this.resolveChannelCapabilities(),this.setMode(this.mode),this.applyInitialSelection(),this.scheduleTokenRefresh(),this.opts.onReady?.()}catch(e){this.fail(e)}return this}setMode(e){this.toolAvailable(e)||(e="view"),e==="channels"&&!this.channels&&this.ensureChannels();let t=e!==this.mode,s=this.mode==="channels",i=this.mode==="filterSections";this.mode=e,t&&e!=="view"&&this.setFollowLive(!1),!this.renderer&&this.doc?this.buildRenderer():this.updateRendererInteraction(),t&&(this.renderer?.clearSelection(),this.syncSelection()),s&&e!=="channels"&&this.channels?.leave(),t&&(this.highlightLabels(null),this.wireBarFind()),this.paintModeTabs(),this.paintRail(),this.paintMapViewMenu(),this.applyMapView(),this.applySectionCanvasTreatment(),i&&e!=="filterSections"&&this.renderer?.zoomToFit(),e==="channels"&&this.channels?.enter(),e==="select"&&this.applyInitialSelection(),t&&this.opts.onModeChange?.(e)}async resolveChannelCapabilities(){let e=++this.channelCapabilityResolution,t=this.opts.capabilities,s;if(t){let i=new Set(t);s={view:i.has("event:channels:view"),manage:i.has("event:channels:view")&&i.has("event:channels:manage")}}else s={view:!1,manage:!1};if(!s.view&&!t)try{await this.api.channels(this.key),s={view:!0,manage:!1}}catch{s={view:!1,manage:!1}}if(e===this.channelCapabilityResolution){if(this.channelCaps=s,!this.channelCaps.view){this.channels?.destroy(),this.channels=null,this.mode==="channels"?this.setMode("view"):this.paintModeTabs();return}this.channels?.setCapabilities(this.channelCaps),this.paintModeTabs()}}ensureChannels(){if(this.channelsLoading)return this.channelsLoading;if(this.channels)return Promise.resolve();let e=(async()=>{try{let t=await import("./channelsMode-YLBLFLZZ.js");if(this.closed||!this.channelCaps.view||(this.channels||(de(t.CHANNELS_CSS),this.channels=new t.ChannelsMode(this.buildChannelsHost(),this.channelCaps),this.channels.onInteractionChange=()=>this.updateRendererInteraction()),this.mode!=="channels"))return;this.updateRendererInteraction(),this.paintRail(),this.channels.enter(),this.applyMapView(),this.paintMapViewMenu()}catch(t){if(this.closed)return;this.channelsLoading=null,this.mode==="channels"&&this.paintRail(),this.opts.onError?.(t)}})();return this.channelsLoading=e,e}buildChooserHost(){let e=s=>{let i=this.labelToSeat.get(s);return i?this.mode==="block"?this.isBlockSelectable(s):this.mode==="select"?this.canSelectObject(i):!0:!1};return{selectionLabels:()=>this.selectionLabels(),selectByLabels:s=>{this.selectByLabels(s)},clearSelection:()=>this.clearSelection(),selectSection:s=>{this.selectSection(s)},sections:()=>this.sectionOptions,labelsInSection:s=>(this.renderer?.getSelectableInSection(s)??[]).map(i=>i.label).filter(e),rows:()=>{let s=new Map((this.doc?.objects??[]).map(o=>[o.id,o])),i=new Map;for(let o of this.labelToSeat.values()){if(!e(o.label))continue;let a=s.get(o.rowId);if(!a||a.type!=="row"&&a.type!=="table")continue;let l=o.logicalRowId??o.rowId,r=this.sectionByObject.get(o.rowId)??v,c=i.get(l)??{id:l,label:a.type==="row"?a.segmentedRow?.displayLabel??a.displayLabel??a.label:a.displayLabel??a.label,sectionId:r,sectionLabel:this.sectionLabelById.get(r)??"Other seats",labels:[]};c.labels.push(o.label),i.set(l,c)}return[...i.values()].sort((o,a)=>o.sectionLabel.localeCompare(a.sectionLabel,void 0,{numeric:!0,sensitivity:"base"})||o.label.localeCompare(a.label,void 0,{numeric:!0,sensitivity:"base"}))},categories:()=>(this.doc?.categories??[]).map(s=>({key:s.key,label:s.label??s.key,color:s.color})),labelsInCategory:s=>[...this.labelToSeat.values()].filter(i=>i.categoryKey===s&&e(i.label)).map(i=>i.label),seats:()=>[...this.labelToSeat.values()].filter(s=>e(s.label)).map(s=>({label:s.label})),statusOf:s=>this.status.get(s)??(this.labelToSeat.has(s)?"free":void 0),sectionOfLabel:s=>{let i=this.labelToSeat.get(s);if(!i)return null;let o=this.sectionByObject.get(i.rowId)??v;return{id:o,label:this.sectionLabelById.get(o)??"Other seats"}},openDialog:(s,i)=>{this.chooserDialog=ae(this.root,s,i,{previous:this.chooserDialog,onClose:()=>{this.chooserDialog=null}})},closeDialog:()=>this.chooserDialog?.close(),highlight:s=>this.highlightLabels(s),...this.mode==="select"?{cap:this.selectionCap()}:{}}}wireBarFind(){let e=this.els.findbar;e&&(e.innerHTML=P({compact:!0}),this.barFind=new D({...this.buildChooserHost(),seats:()=>[...this.labelToSeat.values()].map(t=>({label:t.label})),frame:t=>this.frameLabels(t)}),this.barFind.wireFind(e,{enter:this.isChoosingTool()?"select":"frame"}))}isChoosingTool(){return this.isBulkSelectMode()||this.mode==="select"}frameLabels(e){let t=e.map(s=>this.labelToSeat.get(s)?.id).filter(s=>!!s);t.length&&(this.setFollowLive(!1),this.renderer?.focusSeats?.(t,{animate:!0}))}highlightLabels(e){if(!e){this.renderer?.setSeatHighlight?.(null);return}this.renderer?.setSeatHighlight?.(e.map(t=>this.labelToSeat.get(t)?.id).filter(t=>!!t))}toolChooser(){return this.chooserDialog?.close({restoreFocus:!1}),this.chooser=new D(this.buildChooserHost()),this.chooser}toolSelectionBar(e,t,s,i){return se({count:0,noun:"selected",breakdown:`<span class="slm-selactions"><button type="button" class="slm-linkbtn" data-ref="${i}">Select all</button></span>`,clearAttr:`data-ref="${s}"`}).replace('class="slm-selnum"',`class="slm-selnum" data-ref="${e}"`).replace('class="slm-sellabel"',`class="slm-sellabel" data-ref="${t}"`)}buildChannelsHost(){return{eventKey:this.key,api:this.api,rail:this.els.rail,mapLayer:this.root.querySelector(".slm-map"),pillLane:this.els.lane,root:this.root,seats:()=>[...this.labelToSeat.values()].map(e=>({id:e.id,label:e.label,x:e.x,y:e.y})),statusOf:e=>this.status.get(e)??(this.labelToSeat.has(e)?"free":void 0),selectionLabels:()=>this.selectionLabels(),selectByLabels:e=>{this.selectByLabels(e)},clearSelection:()=>this.clearSelection(),selectSection:e=>{this.selectSection(e)},sections:()=>this.sectionOptions,labelsInSection:e=>this.renderer?.getSelectableInSection(e).map(t=>t.label)??[],rows:()=>{let e=new Map((this.doc?.objects??[]).map(s=>[s.id,s])),t=new Map;for(let s of this.labelToSeat.values()){let i=e.get(s.rowId);if(!i||i.type!=="row"&&i.type!=="table")continue;let o=s.logicalRowId??s.rowId,a=this.sectionByObject.get(s.rowId)??v,l=t.get(o)??{id:o,label:i.type==="row"?i.segmentedRow?.displayLabel??i.displayLabel??i.label:i.displayLabel??i.label,sectionId:a,sectionLabel:this.sectionLabelById.get(a)??"Other seats",labels:[]};l.labels.push(s.label),t.set(o,l)}return[...t.values()].sort((s,i)=>s.sectionLabel.localeCompare(i.sectionLabel,void 0,{numeric:!0,sensitivity:"base"})||s.label.localeCompare(i.label,void 0,{numeric:!0,sensitivity:"base"}))},categories:()=>(this.doc?.categories??[]).map(e=>({key:e.key,label:e.label??e.key,color:e.color,price:e.price,tiers:e.tiers?.map(t=>({id:t.id,name:t.name,price:t.price}))})),labelsInCategory:e=>[...this.labelToSeat.entries()].filter(([,t])=>t.categoryKey===e).map(([t])=>t),sectionOfLabel:e=>{let t=this.labelToSeat.get(e);if(!t)return null;let s=this.sectionByObject.get(t.rowId)??v;return{id:s,label:this.sectionLabelById.get(s)??"Other seats"}},worldToScreen:e=>this.renderer?.worldToScreen(e)??null,seatPixelSize:()=>this.seatPixelSize(),isSeatDetail:()=>this.renderer?.getRung?.()==="seats",showSectionOverview:()=>{this.renderer?.clearSectionFocus(),this.renderer?.setRung?.("sections")},focusSection:e=>this.renderer?.focusSection(e),isCompact:()=>!!this.root?.classList.contains("compact"),setMapInert:e=>{this.mapHost.toggleAttribute("inert",e),this.mapHost.setAttribute("aria-hidden",String(e))},toast:(e,t)=>this.toast(e,t),onError:e=>this.opts.onError?.(e)}}seatPixelSize(){let e=this.renderer?.getVisibleWorldRect?.(),t=this.mapHost?.clientWidth??0;return!e?.width||!t?6:Math.max(3,t/e.width*18)}setHeatOverlay(e){this.heatEnabled=e,this.mapView.momentum!==e&&this.setMapView({momentum:e}),this.applyHeatOverlay(),this.paintHeatButton()}setMapView(e){let t={...this.mapView,...e};if(!Object.keys(t).some(o=>t[o]!==this.mapView[o]))return;let i=t.categoryColours!==this.mapView.categoryColours;this.mapView=t,ke(t),t.momentum!==this.heatEnabled&&this.setHeatOverlay(t.momentum),this.applyMapView(),this.paintMapViewMenu(),i&&(this.refreshBlockPaint(),this.paintMapChrome())}getColourBy(){return this.mapView.categoryColours?"type":"full"}setColourBy(e){this.setMapView({categoryColours:e==="type"})}getMapView(){return{...this.mapView}}toggleMapView(e){e==="channelColours"&&!this.channelColoursAvailable()||this.setMapView({[e]:!this.mapView[e]})}channelColoursAvailable(){return this.mode==="channels"&&this.channels!=null}applyMapView(){Le(this.mapView,{renderer:this.renderer,channelsOverlay:e=>this.channels?.setOverlayVisible(e)})}paintMapViewMenu(){let e=this.els.view;e&&Te(e,this.mapView,{channelColoursAvailable:this.channelColoursAvailable(),momentumLoading:this.mapView.momentum&&!this.controlRoomSnapshot})}setFollowLive(e){let t=this.followLive!==e;this.followLive=e,e||(this.followLiveTimer&&clearTimeout(this.followLiveTimer),this.followSeatTimer&&clearTimeout(this.followSeatTimer),this.followLiveTimer=null,this.followSeatTimer=null),this.paintFollowLiveButton(),t&&this.opts.onFollowLiveChange?.(e)}setKeepLiveWhileHidden(e){this.keepLive=e??!0,this.opts.keepLiveWhileHidden=e}setCurrency(e){this.opts.currency=e,!this.authoritativeCurrency&&(this.currency=e??"USD",this.ready&&this.recomputeTallies())}setTheme(e){this.opts.theme=e,this.applyThemeVars()}applyThemeVars(){if(!this.root)return;let e=I(this.themeMode);for(let[t,s]of Object.entries(J(this.opts.theme,e)))this.root.style.setProperty(t,s);e?this.root.dataset.theme=e:delete this.root.dataset.theme}watchThemeMode(){this.colorSchemeStop?.(),this.colorSchemeStop=null,this.themeMode==="auto"&&(this.colorSchemeStop=N(()=>{this.closed||this.repaintForThemeMode()}))}repaintForThemeMode(){this.applyThemeVars();let e=this.renderer;if(!e||!this.doc)return;let t=e.getSelection().map(o=>o.id),s=e.getCameraPose(),i=e.getFocusedSection();e.setChart(this.themedDoc()),this.repaintAll(),this.applyHeatOverlay(),t.length&&e.select(t),i&&e.focusSection(i),e.setCameraPose(s),this.updateZoomHint()}setThemeMode(e){let t=e??null;this.closed||t===this.themeMode||(this.themeMode=t,this.opts.themeMode=t??void 0,this.watchThemeMode(),this.repaintForThemeMode())}getThemeMode(){return this.themeMode}themedDoc(){let e=this.doc,t=ee(I(this.themeMode));return t?{...e,theme:{...e.theme??{},background:t}}:e}setCapabilities(e){this.opts.capabilities=e,this.categoryCanManage=new Set(e??[]).has("event:categories:manage"),this.tableCanManage=new Set(e??[]).has("event:tables:manage"),!this.categoryCanManage&&this.mode==="categories"||!this.tableCanManage&&this.mode==="tables"?this.setMode("view"):this.paintModeTabs(),this.ready&&this.resolveChannelCapabilities()}setTokenRefresh(e){this.opts.onTokenRefresh=e,this.scheduleTokenRefresh()}setTrendWindow(e){let t=Number.isFinite(e)?Math.floor(e):15;return this.trendWindowMinutes=Math.max(5,Math.min(60,t)),this.paintTrendWindow(),this.refreshControlRoom()}async enterFullscreen(){!this.root?.requestFullscreen||this.isFullscreen()||(await this.root.requestFullscreen(),this.root.focus({preventScroll:!0}))}async exitFullscreen(){typeof document>"u"||!this.isFullscreen()||await document.exitFullscreen()}isFullscreen(){return typeof document<"u"&&document.fullscreenElement===this.root}toggleFullscreen(){(this.isFullscreen()?this.exitFullscreen():this.enterFullscreen()).catch(t=>this.opts.onError?.(t))}setToken(e,t){F(e),this.api.setToken(e),this.opts.token=e,this.opts.tokenExpiresAt=t,this.tokenExpiresAt=t??null,this.scheduleTokenRefresh(),this.ready&&this.resolveChannelCapabilities()}scheduleTokenRefresh(){this.tokenRefreshTimer&&clearTimeout(this.tokenRefreshTimer),this.tokenRefreshTimer=null;let e=this.opts.onTokenRefresh,t=this.tokenExpiresAt;if(this.closed||!e||!t||!Number.isFinite(t))return;let s=t-Date.now(),i=Math.min(12e4,Math.max(3e4,s*.2)),o=Math.max(0,s-i);this.tokenRefreshTimer=setTimeout(()=>{this.tokenRefreshTimer=null,this.rotateToken()},o)}async rotateToken(){if(!(this.closed||this.sessionEnded||this.tokenRefreshInFlight||!this.opts.onTokenRefresh)){this.tokenRefreshInFlight=!0;try{let e=await this.opts.onTokenRefresh();if(!e?.token||!Number.isFinite(e.expiresAt))throw new Error("invalid_token_refresh_result");this.tokenRefreshFailures=0,this.setToken(e.token,e.expiresAt)}catch(e){this.opts.onError?.(e),this.tokenRefreshFailures+=1,!this.closed&&(this.tokenRefreshFailures>=Mt||Tt(e))?this.endSession():this.closed||(this.tokenRefreshTimer=setTimeout(()=>{this.tokenRefreshTimer=null,this.rotateToken()},3e4))}finally{this.tokenRefreshInFlight=!1}}}endSession(){if(this.sessionEnded)return;this.sessionEnded=!0,this.tokenRefreshTimer&&clearTimeout(this.tokenRefreshTimer),this.tokenRefreshTimer=null,this.reconnectTimer&&clearTimeout(this.reconnectTimer),this.reconnectTimer=null,this.monitorRefreshTimer&&clearTimeout(this.monitorRefreshTimer),this.monitorRefreshTimer=null;let e=this.ws;if(this.ws=null,e){e.onclose=null;try{e.close()}catch{}}this.setLive(!1),this.paintSessionEnded()}async retrySession(){if(this.closed||!this.sessionEnded)return!this.sessionEnded;if(!this.opts.onTokenRefresh)return!1;this.sessionEnded=!1,this.tokenRefreshFailures=0;let e=this.root?.querySelector('[data-ref="ended"]');return e?.setAttribute("data-busy","true"),await this.rotateToken(),this.sessionEnded?(e?.removeAttribute("data-busy"),!1):(e?.remove(),this.attempt=0,this.connect(),!0)}paintSessionEnded(){let e=this.els.lane;if(!e||e.querySelector('[data-ref="ended"]'))return;let t=document.createElement("div");t.className="slm-ended",t.setAttribute("data-ref","ended"),t.setAttribute("role","alertdialog"),t.setAttribute("aria-labelledby","slm-ended-title"),t.innerHTML=`
727
- <strong id="slm-ended-title">This session ended</strong>
728
- <span>The map is as it was when the connection stopped. Sign in again, then try again to pick the live stream back up.</span>
729
- <button type="button" class="slm-btn" data-ref="ended-retry">Try again</button>`,t.querySelector('[data-ref="ended-retry"]').addEventListener("click",()=>{this.retrySession()}),e.appendChild(t)}async block(e,t={}){let s=(e??this.selectionLabels()).filter(o=>this.status.get(o)==="free");if(!s.length)return;let i=t.releaseAt??this.releaseAt??void 0;this.setSeatsLocal(s,"blocked");try{await this.api.block(this.key,s,{...t,releaseAt:i}),this.clearSelection(),this.done("block",s,i?`Blocked ${s.length} \u2014 auto-release ${new Date(i).toLocaleString()}.`:`Blocked ${s.length} seat${s.length===1?"":"s"}.`)}catch(o){this.setSeatsLocal(s,"free"),this.toastErr(o instanceof k&&o.status===409?"Some seats were just taken. Try again.":"Couldn't block those seats."),this.opts.onError?.(o)}}async unblock(e){let t=(e??this.selectionLabels()).filter(s=>this.status.get(s)==="blocked");if(t.length){this.setSeatsLocal(t,"free");try{await this.api.unblock(this.key,t),this.clearSelection(),this.done("unblock",t,`Unblocked ${t.length} seat${t.length===1?"":"s"}.`)}catch(s){this.setSeatsLocal(t,"blocked"),this.toastErr("Couldn't unblock those seats."),this.opts.onError?.(s)}}}async unblockAll(){let e=[...this.status.entries()].filter(([,t])=>t==="blocked").map(([t])=>t);if(e.length){this.setSeatsLocal(e,"free");try{let t=await this.api.unblockAll(this.key);this.clearSelection(),this.done("unblockAll",e,`Unblocked ${t.freed} seat${t.freed===1?"":"s"}.`)}catch(t){await this.resnapshot(),this.toastErr("Couldn't mark everything for sale."),this.opts.onError?.(t)}}}async cancelBooking(e,t){let s=e.filter(i=>this.status.get(i)==="booked");if(!(!s.length||!t)){this.setSeatsLocal(s,"free");try{await this.api.unbook(this.key,s,t),this.clearSelection(),this.done("cancelBooking",s,`Released ${s.length} booked unit${s.length===1?"":"s"}.`)}catch(i){this.setSeatsLocal(s,"booked"),this.toastErr("Couldn't release that booked inventory. Check the booking reference."),this.opts.onError?.(i)}}}async setCategory(e,t){let s=this.doc?.categories.find(o=>o.key===e),i=[...new Set(t??this.selectionLabels())].filter(o=>this.labelToSeat.has(o));if(!(!s||!i.length))try{let o=await this.withAuthRetry(()=>this.api.setCategory(this.key,i,e)),a={};for(let l of o.labels){let r=this.labelToSeat.get(l),c=this.labelToId.get(l);r&&(r.categoryKey=e),c&&(a[c]=e)}this.renderer?.setSeatCategories?.(a),this.clearSelection(),this.mode==="categories"&&this.loadCategoryDifferences(),this.done("setCategory",o.labels,`Assigned ${o.labels.length.toLocaleString()} object${o.labels.length===1?"":"s"} to ${s.label??s.key}.`)}catch(o){this.toastErr("Couldn't update those event categories."),this.opts.onError?.(o)}}async setTableBooking(e,t,s={}){let i=[...new Set(e)].filter(Boolean);if(!(!i.length||this.tableBookingSaving)){if(this.inventoryModelVersion!==2){this.toastErr("Table booking controls require inventory model 2 for this event.");return}this.tableBookingSaving=!0,this.mode==="tables"&&this.renderTablesRail();try{let o=await this.withAuthRetry(()=>this.api.setTableBooking(this.key,i,t,s));await this.reloadEventChart(),this.done("setTableBooking",o.tableIds,`Updated ${o.tableIds.length.toLocaleString()} table${o.tableIds.length===1?"":"s"} to ${t==="individual"?"per-chair":t==="whole"?"whole-table":"flexible-group"} booking.`)}catch(o){let a=o instanceof k&&o.code==="table_inventory_in_use";this.toastErr(a?"Release held, booked, or blocked table inventory before changing its booking mode.":"Couldn't update table booking. No table mode was changed."),this.opts.onError?.(o)}finally{this.tableBookingSaving=!1,this.mode==="tables"&&this.renderTablesRail()}}}async reloadEventChart(){let e=await this.withAuthRetry(()=>this.api.chart(this.key));this.inventoryModelVersion=e.event.inventoryModelVersion===2?2:1;let t=await this.organizerAssetUrls.prepareRendererChart(e.doc);this.renderer?.destroy(),this.renderer=null,this.doc=t,this.labelToId.clear(),this.labelToSeat.clear(),this.allIds=[],this.gaUnitLabelSet.clear(),this.tableChairIds.clear(),this.status.clear(),this.counts={held:0,booked:0,blocked:0},this.serverBaseline=null,this.lastSelectionLabels.clear(),this.buildUnitUniverse(t),this.buildRenderer(),this.buildSectionOptions(),this.settleMode(),await Promise.all([this.resnapshot(),this.refreshAvailability()]),this.paintRail()}selectAll(){if(this.mode==="select")return this.selectByLabels([...this.labelToSeat.values()].filter(t=>this.canSelectObject(t)).map(t=>t.label));let e=this.renderer?.selectAllSelectable()??[];return this.syncSelection(),e}selectSection(e){if(!this.renderer)return[];let t=this.renderer.getSelectableInSection(e);return this.renderer.selectByLabels(t.map(s=>s.label)),this.syncSelection(),this.renderer.getSelection()}setFilteredSection(e){let t=e.trim(),s=this.filterableSections().filter(a=>a.label===t);if(!s.length)throw new Error(`Unknown event section: ${e}`);let i=t!==this.filteredSectionLabel;this.filteredSectionLabel=t,this.mode==="filterSections"&&(this.applyFilteredSectionCanvas(s),this.renderFilterSectionsRail());let o=s.map(({id:a,label:l,seatCount:r,zone:c})=>({id:a,label:l,seatCount:r,...c?{zone:c}:{}}));return i&&this.opts.onFilteredSectionChange?.(o),o}focusSection(e){let t=e.trim(),s=this.filterableSections().filter(i=>i.label===t);return!this.renderer||!s.length?[]:(this.frameSections(s),s.map(({id:i,label:o,seatCount:a,zone:l})=>({id:i,label:o,seatCount:a,...l?{zone:l}:{}})))}clearFilteredSection(){let e=this.filteredSectionLabel!==null;this.filteredSectionLabel=null,this.renderer?.setDimmedSections(null),this.renderer?.clearSectionFocus(),this.renderer?.zoomToFit(),this.mode==="filterSections"&&this.renderFilterSectionsRail(),e&&this.opts.onFilteredSectionChange?.([])}getFilteredSections(){return this.filteredSectionLabel?this.filterableSections().filter(e=>e.label===this.filteredSectionLabel).map(({id:e,label:t,seatCount:s,zone:i})=>({id:e,label:t,seatCount:s,...i?{zone:i}:{}})):[]}selectByLabels(e){let t=e;if(this.mode==="select"){let s=new Set(this.selectionLabels()),i=this.selectionCap(),o=[...new Set(e)].filter(l=>!s.has(l)).map(l=>this.labelToSeat.get(l)).filter(l=>!!l&&this.canSelectObject(l)),a=Math.max(0,i-s.size);o.length>a&&this.opts.onSelectionLimit?.(i),t=o.slice(0,a).map(l=>l.label)}return this.renderer?.selectByLabels(t),this.syncSelection(),this.getSelection()}selectObjects(e){return this.selectByLabels(e)}deselectObjects(e){let t=e.map(s=>this.labelToId.get(s)).filter(s=>!!s);return this.renderer?.deselect(t),this.syncSelection(),this.getSelection()}selectCategories(e){let t=new Set(e);return this.selectByLabels([...this.labelToSeat.values()].filter(s=>t.has(s.categoryKey)).map(s=>s.label))}deselectCategories(e){let t=new Set(e);return this.deselectObjects(this.getSelection().filter(s=>t.has(s.categoryKey)).map(s=>s.label))}setSelectableObjects(e){this.opts.selectableObjects=[...e],this.selectableObjectLabels=new Set(e),this.reconcileSelectPolicy()}setUnavailableObjects(e,t){this.opts.unavailableObjectsReason=t;let s=new Set(e),i=[...s].filter(a=>!this.unavailableLabels.has(a)).concat([...this.unavailableLabels].filter(a=>!s.has(a)));if(!i.length)return;if(this.opts.unavailableObjects=[...s],this.unavailableLabels=s,this.renderer){let a=new Map;for(let l of i){let r=this.paintIds(l);if(!r.length)continue;let c=this.renderStatusOf(l,this.status.get(l)??"free");a.set(c,[...a.get(c)??[],...r])}for(let[l,r]of a)this.renderer.setStatus(r,l);this.afterPaint()}let o=this.getSelection().filter(a=>this.isHostUnavailable(a.label));o.length&&(this.renderer?.deselect(o.map(a=>a.id)),this.syncSelection())}setCategoryPrices(e){this.opts.categoryPrices=e,this.renderer?.setCategoryPriceRanges(this.hoverPriceRanges())}hoverPriceRanges(){let e=this.opts.categoryPrices;return e==null?e:Object.fromEntries(Object.entries(e).map(([t,s])=>[t,typeof s=="number"?{min:s,max:s}:{min:s.min,max:s.max}]))}setUnavailableObjectsSelectable(e){this.opts.unavailableObjectsSelectable=e,this.reconcileSelectPolicy()}setObjectSelectable(e){this.opts.isObjectSelectable=e,this.reconcileSelectPolicy()}setMaxSelectedObjects(e){this.assertSelectionOptions(e,this.opts.numberOfPlacesToSelect),this.opts.maxSelectedObjects=e,this.trimSelectionToCap(),this.updateRendererInteraction(),this.syncSelection()}setNumberOfPlacesToSelect(e){this.assertSelectionOptions(this.opts.maxSelectedObjects,e),this.opts.numberOfPlacesToSelect=e,this.selectionWasValid=null,this.trimSelectionToCap(),this.updateRendererInteraction(),this.syncSelection()}getSelectionValidity(){let e=this.opts.numberOfPlacesToSelect;if(e===void 0)return null;let t=this.getSelection(),s=t.length;return{isValid:s===e,count:s,required:e,remaining:Math.max(0,e-s),objects:t}}clearSelection(){this.renderer?.clearSelection(),this.syncSelection()}getSelection(){return this.renderer?.getSelection()??[]}getReport(){return this.api.report(this.key).then(e=>(this.applyReportRevenue(e),e))}getControlRoomSnapshot(e=this.trendWindowMinutes){return this.setTrendWindow(e)}getConnection(){return{status:this.connectionStatus,lastMessageAt:this.lastMessageAt}}getLog(e={}){return this.api.log(this.key,e)}async setHoldTtl(e){try{await this.api.setHoldTtl(this.key,e),this.done("setHoldTtl",[],e?`Hold window set to ${Math.round(e/6e4)} min.`:"Hold window reset.")}catch(t){this.toastErr("Couldn't update the hold window."),this.opts.onError?.(t)}}zoomToFit(){if(this.mode==="filterSections"&&this.filteredSectionLabel){this.clearFilteredSection();return}this.renderer?.clearSectionFocus(),this.renderer?.zoomToFit()}zoomOutStep(){let e=this.renderer;if(!e)return;if(!e.zoomOutLevel)return void e.zoomOut();let t=!!e.getFocusedSection?.();e.zoomOutLevel()==="venue"&&t&&e.clearSectionFocus()}paintMapChrome(){let e=this.renderer;if(!e||!this.els.crumb)return;let t=e.getFocusedSection?.()??null,s=t?e.getMinimapSnapshot?.().sections.find(l=>l.id===t)??null:null,i=e.getFloors?.()??[],o=i.length>1?e.isFloorOverview?.()?"All floors":i.find(l=>l.id===e.getActiveFloorId?.())?.name??null:null,a=this.els.blocklegend;a&&fe(a,{colourBy:this.getColourBy(),seats:e.getRung?.()==="seats",types:this.legendTypes()}),ue(this.els,me({focused:s?{label:s.label,free:s.free,total:s.total}:null,floor:o,seatsRevealed:e.seatsRevealed?.()??!0,atVenueFit:e.atVenueFit?.(),atCeiling:e.canZoomIn?.()===!1||e.seatsPickable?.()===!0}))}sectionTypeKeys(){if(this.typeKeyBySection&&this.typeKeyBase===this.sectionsBase)return this.typeKeyBySection;let e=new Map;for(let t of this.filterableSections()){let s=new Map;for(let o of t.seatLabels){let a=this.labelToSeat.get(o)?.categoryKey;a&&s.set(a,(s.get(a)??0)+1)}let i=null;for(let[o,a]of s)(!i||a>s.get(i))&&(i=o);i&&e.set(t.id,i)}return this.typeKeyBySection=e,this.typeKeyBase=this.sectionsBase,e}sectionTypeTint(e){let t=this.sectionTypeKeys().get(e);return t?this.renderer?.categoryDisplayColor?.(t)??null:null}legendTypes(){let e=new Set;for(let t of this.labelToSeat.values())e.add(t.categoryKey);return(this.doc?.categories??[]).filter(t=>e.has(t.key)).map(t=>({label:t.label,color:this.renderer?.categoryDisplayColor?.(t.key)??t.color}))}refreshBlockPaint(){this.renderer?.refreshBlockPaint?.(),this.minimap?.refreshMinimap()}mapCamera(){return{getViewport:()=>{let e=this.renderer;return!e?.getVisibleWorldRect||!e.getWorldBounds?null:{visible:e.getVisibleWorldRect(),bounds:e.getWorldBounds()}},getMinimapSnapshot:()=>this.renderer?.getMinimapSnapshot?.()??{sections:[],seats:[]},panToWorld:e=>{this.setFollowLive(!1),this.renderer?.panToWorld?.(e)},clearSectionFocus:()=>this.renderer?.clearSectionFocus?.(),focusSection:e=>{this.setFollowLive(!1),this.renderer?.focusSection(e),this.channels?.handleSectionFocus(e)},overview:()=>{this.setFollowLive(!1),this.zoomToFit()},getFloors:()=>this.renderer?.getFloors?.()??[],getActiveFloorId:()=>this.renderer?.getActiveFloorId?.()??"",isFloorOverview:()=>this.renderer?.isFloorOverview?.()??!1,getRenderer:()=>this.renderer}}syncMinimap(){let e=this.els.minimapMount,t=!!this.root?.classList.contains("compact");if(!e||!this.renderer||t){this.minimap?.dispose(),this.minimap=null;return}if(this.minimap){this.minimap.refreshMinimap();return}this.minimap=K({controller:this.mapCamera(),root:()=>this.root,cssVar:s=>this.cssVar(s.replace(/^--sl-/,"--slm-")),focusedSectionLabel:()=>{},tint:s=>this.renderer?.categoryDisplayColor?.(s)||void 0},e),this.minimap.refreshMinimap()}cssVar(e){return this.root?getComputedStyle(this.root).getPropertyValue(e).trim():""}destroy(){if(this.selectObserver?.disconnect(),this.closed=!0,this.minimap?.dispose(),this.minimap=null,this.monitorRefreshTimer&&clearTimeout(this.monitorRefreshTimer),this.monitorRefreshTimer=null,this.reconnectTimer&&clearTimeout(this.reconnectTimer),this.feedTimer&&clearInterval(this.feedTimer),this.toastTimer&&clearTimeout(this.toastTimer),this.liveEventTimer&&clearTimeout(this.liveEventTimer),this.kpiCleanupTimer&&clearTimeout(this.kpiCleanupTimer),this.followLiveTimer&&clearTimeout(this.followLiveTimer),this.followSeatTimer&&clearTimeout(this.followSeatTimer),this.unblockAllConfirmTimer&&clearTimeout(this.unblockAllConfirmTimer),this.paintHandle!==null&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(this.paintHandle),this.paintHandle=null,this.channels?.destroy(),this.channels=null,this.channelsLoading=null,this.tokenRefreshTimer&&clearTimeout(this.tokenRefreshTimer),this.layoutObserver?.disconnect(),this.layoutObserver=null,this.colorSchemeStop?.(),this.colorSchemeStop=null,this.root?.removeEventListener("keydown",this.onKeyDown),this.els.rail?.removeEventListener("click",this.onRailClick),typeof document<"u"&&document.removeEventListener("fullscreenchange",this.onFullscreenChange),this.ws){try{this.ws.close()}catch{}this.ws=null}this.seatHistoryPanel?.destroy(),this.seatHistoryPanel=null,this.activityPanel?.destroy(),this.activityPanel=null,this.navigation?.destroy(),this.navigation=null,this.renderer?.destroy(),this.renderer=null,this.organizerAssetUrls.dispose(),this.root&&this.root.parentNode===this.host&&this.host.removeChild(this.root)}buildRenderer(){if(!this.doc)return;let e=this.isBulkSelectMode();this.renderer=new gt(this.mapHost,{manageMode:!0,organizerGlyph:{apply:ft,clear:vt,isPainted:yt},marqueeSelect:e&&!this.movingMap,marqueeShape:this.marqueeShape,rowLabelSelect:this.rowLabelSelectable(),maxSelection:this.selectionCap(),selectableStatuses:this.selectableStatuses(),currency:this.currency,onSelect:t=>this.handleSeatSelect(t),onDeselect:()=>this.syncSelection(),onSelectionLimit:t=>this.opts.onSelectionLimit?.(t),onMarquee:()=>this.mode==="select"?this.reconcileSelectPolicy():this.syncSelection(),onGAClick:t=>{if(this.mode!=="select"||!this.opts.onAreaClick||!this.doc)return;let s=Re(this.doc).find(i=>i.id===t);s&&this.opts.onAreaClick({id:s.id,label:s.label,name:s.displayLabel?.trim()||s.label})},onSectionTap:t=>{if(this.mode==="filterSections"){let s=this.filterableSections().find(i=>i.id===t);s&&this.setFilteredSection(s.label);return}this.renderer?.focusSection(t),this.channels?.handleSectionFocus(t)},onViewChange:()=>{this.updateZoomHint(),this.paintMapChrome(),this.minimap?.drawMinimapRect(),this.channels?.handleViewChange()},onFocusedSectionChange:()=>{this.paintMapChrome(),this.minimap?.refreshMinimap()},hoverFacts:t=>this.hoverFactsFor(t),blockPaint:t=>be(t,{rule:this.availabilityRules[t.id],hiddenNow:this.effectiveHidden.has(t.id),closedNow:this.effectiveClosed.has(t.id),colourBy:this.getColourBy(),typeTint:this.sectionTypeTint(t.id)}),openAtSectionsWhenDense:!0}),this.renderer.setCategoryPriceRanges(this.hoverPriceRanges()),this.renderer.setChart(this.themedDoc()),this.chromeClearance=-1,this.applyChromeClearance(),this.repaintAll(),this.applyHeatOverlay(),this.applyMapView(),this.updateZoomHint(),this.minimap?.dispose(),this.minimap=null,this.syncMinimap(),this.paintMapChrome()}hoverFactsFor(e){let t=[...this.labelToSeat.values()].find(p=>p.id===e);if(!t)return null;let s=this.status.get(t.label)??"free",i={free:"Free",held:"Held",booked:"Booked",blocked:"Blocked"},o=s==="free"&&this.isHostUnavailable(t.label),l=[{caption:"Status",value:o?this.opts.unavailableObjectsReason?.trim()||"Unavailable":i[s]}],r=this.channels?.channelNameForLabel(t.label)??null;r&&l.push({caption:"Channel",value:r});let c=this.sectionByObject.get(t.rowId)??v,d=this.doc?.categories.find(p=>p.key===t.categoryKey),h=s==="free"&&!o&&!this.effectiveHidden.has(c)&&!this.effectiveClosed.has(c)&&d?.notForSale!==!0;return l.push({caption:"For sale",value:h?"Yes":s==="free"&&!o?"No":"\u2014"}),l}rowLabelSelectable(){return this.isBulkSelectMode()||this.mode==="select"}marqueeShapeChipsHtml(){let e=(t,s)=>`<button type="button" class="slm-btn${this.marqueeShape===t?"":" ghost"}" data-ref="shape-${t}"
730
- aria-pressed="${this.marqueeShape===t}" title="${t==="box"?"Drag a rectangle over seats":"Draw a loop around seats"}">${s}</button>`;return`${e("box","Drag box")}${e("lasso","Lasso")}`}wireMarqueeShapeChips(){this.els.rail.querySelectorAll('[data-ref^="shape-"]').forEach(e=>{e.addEventListener("click",()=>{let t=e.dataset.ref==="shape-lasso"?"lasso":"box";t!==this.marqueeShape&&(this.marqueeShape=t,this.updateRendererInteraction(),this.els.rail.querySelectorAll('[data-ref^="shape-"]').forEach(s=>{let i=s.dataset.ref===`shape-${t}`;s.classList.toggle("ghost",!i),s.setAttribute("aria-pressed",String(i))}))})})}isBulkSelectMode(){return this.mode==="block"||this.mode==="categories"||this.mode==="channels"&&this.channels?.usesMarqueeSelection()===!0}selectableStatuses(){return this.mode==="block"?["free","not_for_sale"]:this.mode==="select"||this.mode==="categories"||this.mode==="inspect"||this.isBulkSelectMode()||this.mode==="channels"&&this.channels?.canSelect()===!0?["free","held","booked","not_for_sale"]:[]}updateRendererInteraction(){let e=this.isBulkSelectMode();this.renderer?.setManageInteraction({manageMode:!0,organizerStatus:this.mode!=="channels",marqueeSelect:e&&!this.movingMap,marqueeShape:this.marqueeShape,rowLabelSelect:this.rowLabelSelectable(),maxSelection:this.selectionCap(),selectableStatuses:this.selectableStatuses()}),this.navigation?.update(e,this.mode==="view"),this.updateZoomHint()}handleSeatSelect(e){if(this.mode==="select"&&!this.canSelectObject(e)){this.renderer?.deselect([e.id]),this.syncSelection();return}if(this.mode==="inspect"){let t=this.getSelection().filter(s=>s.id!==e.id).map(s=>s.id);t.length&&this.renderer?.deselect(t)}this.syncSelection()}buildUnitUniverse(e){let t=new Map;for(let i of wt(e))i.type==="table"&&t.set(i.id,i.label);let s=new Map;for(let i of xt(e))if(this.labelToId.set(i.label,i.id),this.labelToSeat.set(i.label,i),this.allIds.push(i.id),t.has(i.rowId)){let o=s.get(i.rowId)??[];o.push(i.id),s.set(i.rowId,o)}for(let[i,o]of s){let a=t.get(i);this.labelToId.has(a)||this.tableChairIds.set(a,o)}for(let i of Re(e))for(let o of St(i))this.labelToId.has(o)||this.gaUnitLabelSet.add(o)}unitTotal(){return this.allIds.length+this.gaUnitLabelSet.size}paintIds(e){let t=this.labelToId.get(e);return t?[t]:this.tableChairIds.get(e)??[]}knownLabels(){return[...this.labelToId.keys(),...this.gaUnitLabelSet]}repaintAll(){let e=this.renderer;if(!e)return;this.allIds.length&&e.setStatus(this.allIds,"free");let t={free:[],held:[],booked:[],not_for_sale:[]};for(let[s,i]of this.status.entries())t[this.renderStatusOf(s,i)].push(...this.paintIds(s));for(let s of this.unavailableLabels)this.status.has(s)||t.held.push(...this.paintIds(s));["held","booked","not_for_sale"].forEach(s=>{t[s].length&&e.setStatus(t[s],s)})}async connect(){if(this.closed||this.sessionEnded)return;let e;try{if(e=(await this.withAuthRetry(()=>this.api.subscribeTicket(this.key))).protocols,!e.length)throw new Error("manage_subscribe_ticket_missing")}catch(s){this.setLive(!1),this.opts.onError?.(s),this.scheduleReconnect();return}if(this.closed)return;let t;try{t=new WebSocket(this.api.socketUrl(this.key),e)}catch(s){this.opts.onError?.(s),this.scheduleReconnect();return}this.ws=t,this.socketSnapshotSeen=!1,t.onopen=()=>{this.attempt=0,this.setLive(!0),this.resnapshot().then(()=>this.refreshControlRoom()).catch(s=>this.opts.onError?.(s)),this.refreshAvailability()},t.onmessage=s=>this.onMessage(s),t.onclose=()=>{this.ws===t&&(this.ws=null),this.setLive(!1),this.scheduleReconnect()},t.onerror=()=>{try{t.close()}catch{}}}scheduleReconnect(){if(this.closed||this.sessionEnded||this.reconnectTimer)return;let e=Math.min(1e3*2**Math.min(this.attempt++,5),15e3);this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.connect()},e)}onMessage(e){let t;try{t=JSON.parse(typeof e.data=="string"?e.data:"")}catch{return}if(!t||typeof t!="object")return;this.lastMessageAt=Date.now();let s=t;if((Array.isArray(s.hidden)||Array.isArray(s.closed))&&this.updateEffectiveAvailability(s.hidden,s.closed),s.type==="presence"){typeof s.shoppingSessions=="number"&&typeof s.activeHolds=="number"&&(this.livePresence={at:Date.now(),value:{shoppingSessions:s.shoppingSessions,activeHolds:s.activeHolds}},this.controlRoomSnapshot&&(this.controlRoomSnapshot={...this.controlRoomSnapshot,presence:this.livePresence.value},this.opts.onControlRoom?.(this.controlRoomSnapshot)),this.lastSyncedAt=Date.now(),this.recomputeTallies(),this.paintMonitorInsights());return}if(s.type!=="hidden"){if(s.seats&&typeof s.seats=="object")this.applySocketSnapshot(s.seats,typeof s.default=="string"?s.default:void 0);else if(Array.isArray(s.changes)){let i=[],o=new Map;for(let l of s.changes){let r=["free","held","booked","blocked"].includes(l.status)?l.status:"free",c=this.status.get(l.label)??"free";if(c===r)continue;this.setStatusLabel(l.label,r,c);let d=this.paintIds(l.label);d.length&&(this.renderer?.setStatus(d,this.renderStatusOf(l.label,r)),i.push(...d));let h=this.verbFor(c,r),p=`${h}:${r}`,u=o.get(p)??{labels:[],verb:h,status:r};u.labels.push(l.label),o.set(p,u)}for(let l of o.values()){let r=this.pushActivity(l.labels,l.verb,l.status);r&&this.paintSpatialActivity(r)}o.size&&this.scheduleMonitorRefresh(),i.length&&(this.lastSyncedAt=Date.now(),this.afterPaint());let a=typeof s.bookedValue?.gross=="number"?s.bookedValue.gross:s.revenue?.gross;typeof a=="number"&&Number.isFinite(a)&&this.applyLiveGross(a),this.recomputeTallies()}}}applyLiveGross(e){if(this.liveGross={at:Date.now(),value:e},this.authoritativeGrossRevenue=e,this.revenueStatus="current",this.controlRoomSnapshot){let s={...this.controlRoomSnapshot.bookedValue??this.controlRoomSnapshot.revenue,gross:e};this.controlRoomSnapshot={...this.controlRoomSnapshot,bookedValue:s,revenue:s},this.opts.onControlRoom?.(this.controlRoomSnapshot)}}setStatusLabel(e,t,s=this.status.get(e)??"free"){this.status.set(e,t),s!==t&&(s!=="free"&&(this.counts[s]-=1),t!=="free"&&(this.counts[t]+=1))}applySocketSnapshot(e,t){let s=this.socketSnapshotSeen?this.status:null;if(this.applySnapshot(e,t),this.socketSnapshotSeen=!0,!s)return;let i=new Map;for(let o of new Set([...s.keys(),...this.status.keys()])){let a=s.get(o)??"free",l=this.status.get(o)??"free";if(a===l)continue;let r=this.verbFor(a,l),c=`${r}:${l}`,d=i.get(c)??{labels:[],verb:r,status:l};d.labels.push(o),i.set(c,d)}for(let o of i.values()){let a=this.pushActivity(o.labels,o.verb,o.status);a&&this.paintSpatialActivity(a)}i.size&&this.scheduleMonitorRefresh()}scheduleMonitorRefresh(){this.monitorRefreshTimer||(this.monitorRefreshTimer=setTimeout(()=>{this.monitorRefreshTimer=null,this.closed||this.refreshControlRoom().catch(e=>this.opts.onError?.(e))},150))}async resnapshot(){try{let e=await this.api.objects(this.key);this.applySnapshot(e.seats),this.updateEffectiveAvailability(e.hidden,e.closed),this.lastMessageAt=Date.now()}catch{}}applySnapshot(e,t){let s=o=>["free","held","booked","blocked"].includes(o)?o:"free",i=new Map;if(t!==void 0){let o=s(t);for(let a of this.knownLabels())i.set(a,o)}for(let[o,a]of Object.entries(e))i.set(o,s(a));this.status=i,this.modelVersion+=1,this.recountAll(),this.lastSyncedAt=Date.now(),this.repaintAll(),this.afterPaint(),this.recomputeTallies()}recountAll(){let e={held:0,booked:0,blocked:0};for(let t of this.status.values())t!=="free"&&(e[t]+=1);this.counts=e}setSeatsLocal(e,t){let s=[],i=[];for(let o of e)this.setStatusLabel(o,t),(this.renderStatusOf(o,t)===M(t)?s:i).push(...this.paintIds(o));s.length&&this.renderer?.setStatus(s,M(t)),i.length&&this.renderer?.setStatus(i,"held"),this.afterPaint(),this.recomputeTallies()}afterPaint(){this.keepLive&&typeof document<"u"&&document.hidden&&this.renderer?.forceDraw()}activityColor(e){return e==="held"?x.held:e==="booked"?x.booked:e==="blocked"?x.blocked:x.free}sectionsForLabels(e){let t=new Set;for(let i of e){let o=this.labelToSeat.get(i);if(!o)continue;let a=this.sectionByObject.get(o.rowId);a&&a!==v&&t.add(a)}let s=[...t];return{ids:s,labels:s.map(i=>this.sectionLabelById.get(i)??i)}}pulseSeatLabels(e,t){let s=this.activityColor(t);for(let i of e.slice(0,Ae)){let o=this.labelToId.get(i);o&&this.renderer?.flashSeat(o,s)}}paintSpatialActivity(e){let t=e.sectionIds??this.sectionsForLabels(e.labels).ids,s=this.renderer?.getFocusedSection()??null;if(this.followLive&&t.length===1&&(e.status==="held"||e.status==="booked")){let o=this.root?.querySelector('[data-ref="followstatus"]');o&&(o.textContent=`Following ${e.labels.length===1?e.labels[0]:`${e.labels.length} seats`} \xB7 ${e.status}`),this.followLiveTimer&&clearTimeout(this.followLiveTimer),this.followSeatTimer&&clearTimeout(this.followSeatTimer),this.followLiveTimer=setTimeout(()=>{this.followLiveTimer=null,this.focusActivitySeats(e.labels,t[0]),this.followSeatTimer=setTimeout(()=>{this.followSeatTimer=null,this.pulseSeatLabels(e.labels,e.status)},520)},220);return}if(!s&&t.length){let o=this.activityColor(e.status);for(let a of t.slice(0,$e))this.renderer?.flashSection(a,o);return}(!t.length||s&&t.includes(s))&&this.pulseSeatLabels(e.labels,e.status)}locateSection(e){this.renderer?.focusSection(e)}focusActivitySeats(e,t){this.renderer?.focusSection(t);let s=e.slice(0,Ae).map(r=>this.labelToSeat.get(r)).filter(r=>!!r);if(!s.length)return;let i=s.map(r=>r.x),o=s.map(r=>r.y),a=Math.min(...i),l=Math.min(...o);this.renderer?.focusRegion({x:a-150,y:l-100,width:Math.max(...i)-a+300,height:Math.max(...o)-l+200})}locateActivity(e){let t=this.feed.find(i=>i.id===e);if(!t)return;let s=t.sectionIds??this.sectionsForLabels(t.labels).ids;if(this.followSeatTimer&&clearTimeout(this.followSeatTimer),s.length===1){this.focusActivitySeats(t.labels,s[0]),this.followSeatTimer=setTimeout(()=>{this.followSeatTimer=null,this.pulseSeatLabels(t.labels,t.status)},520);return}this.zoomToFit(),this.followSeatTimer=setTimeout(()=>{if(this.followSeatTimer=null,s.length){let i=this.activityColor(t.status);for(let o of s.slice(0,$e))this.renderer?.flashSection(o,i)}else this.pulseSeatLabels(t.labels,t.status)},280)}showLiveEvent(e){let t=this.els.liveevent;if(!t)return;let s=e.sectionLabels??[],i=s.length===1?s[0]:s.length>1?`${s.length} sections`:e.label,o=e.count===1?"seat":"seats";t.innerHTML=`<span class="slm-liveeventdot" style="background:${this.activityColor(e.status)}"></span>
731
- <span class="slm-liveeventcopy">${m(i)} \xB7 ${e.count.toLocaleString()} ${o} ${m(e.verb)}</span>
732
- <span class="slm-liveeventhint">Live</span>`,t.classList.add("on"),this.liveEventTimer&&clearTimeout(this.liveEventTimer),this.liveEventTimer=setTimeout(()=>{this.liveEventTimer=null,t.classList.remove("on"),t.innerHTML=""},2800)}applyReportRevenue(e){this.authoritativeGrossRevenue=e.report.byCategory.reduce((t,s)=>{let i=Number.isFinite(s.bookedValue)?s.bookedValue:s.bookedRevenue;return t+(Number.isFinite(i)?i:0)},0),this.revenueStatus="current",this.recomputeTallies()}async refreshControlRoom(){let e=++this.revenueRequest,t=Date.now();try{let s=await this.api.controlRoom(this.key,this.trendWindowMinutes),i=s.bookedValue??s.revenue??{gross:0,bySection:[]},o=(i.bySection??[]).map(r=>{let c=Number.isFinite(r.bookedValue)?r.bookedValue:r.bookedRevenue;return{...r,bookedValue:c??0,bookedRevenue:c??0}}),a={...i,bySection:o},l={...s,bookedValue:a,revenue:a};if(e===this.revenueRequest){if(this.livePresence&&this.livePresence.at>=t?l={...l,presence:this.livePresence.value}:this.livePresence=null,this.liveGross&&this.liveGross.at>=t){let d={...l.bookedValue,gross:this.liveGross.value};l={...l,bookedValue:d,revenue:d}}else this.liveGross=null;this.controlRoomSnapshot=l,l.activity&&this.seedFeed(l.activity),this.rebaseServerTotals(l),this.lastSyncedAt=Date.now(),this.authoritativeGrossRevenue=l.bookedValue.gross,this.authoritativeCurrency=l.currency,this.currency=l.currency,this.revenueStatus="current",this.recomputeTallies(),this.applyHeatOverlay(),this.paintMonitorInsights(),this.seatHistoryPanel?.refresh();let r=this.getSelection().slice(-1)[0],c=this.els.rail?.querySelector("[data-seat-status]");r&&c&&(c.textContent=this.status.get(r.label)??"free"),this.opts.onControlRoom?.(l)}return l}catch(s){throw e===this.revenueRequest&&(this.revenueStatus="stale",this.recomputeTallies()),s}}rebaseServerTotals(e){let t=e.totals;if(!t||["free","held","booked","blocked"].some(s=>!Number.isFinite(t[s]))){this.serverBaseline=null;return}this.serverBaseline={model:this.modelVersion,server:{free:t.free,held:t.held,booked:t.booked,blocked:t.blocked},client:this.clientTallies()}}clientTallies(){let{held:e,booked:t,blocked:s}=this.counts;return{held:e,booked:t,blocked:s,free:Math.max(0,this.unitTotal()-e-t-s)}}buildTallies(){let e=this.clientTallies(),t=this.serverBaseline?.model===this.modelVersion?this.serverBaseline:null,s=l=>t?Math.max(0,t.server[l]+(e[l]-t.client[l])):e[l],i=this.controlRoomSnapshot?.event?.seatTotal,o={free:s("free"),held:s("held"),booked:s("booked"),blocked:s("blocked"),total:Number.isFinite(i)?i:this.unitTotal(),capacityPct:0,sellThroughPct:0,bookedValue:this.authoritativeGrossRevenue,grossRevenue:this.authoritativeGrossRevenue,bookedValueStatus:this.revenueStatus,revenueStatus:this.revenueStatus,currency:this.currency};o.capacityPct=o.total?Math.round(o.booked/o.total*100):0;let a=o.total-o.blocked;return o.sellThroughPct=a>0?Math.round(o.booked/a*100):0,o}recomputeTallies(){if(!this.closed){if(typeof requestAnimationFrame!="function"){this.flushTallies();return}this.paintHandle===null&&(this.paintHandle=requestAnimationFrame(()=>{this.paintHandle=null,this.flushTallies()}))}}flushTallies(){if(this.closed)return;let e=this.buildTallies();this.paintKpis(e),this.minimap?.refreshMinimap(),this.mode==="view"?(this.paintLegend(e),this.paintMonitorInsights()):this.mode==="inspect"?this.renderInspectRail(this.getSelection()):this.mode==="block"?this.paintSelBar(this.getSelection()):this.mode==="channels"&&this.channels?.handleSelectionChange(),this.opts.onTallies?.(e)}verbFor(e,t){return t==="held"?"held":t==="booked"?"booked":t==="blocked"?"blocked":t==="free"?e==="blocked"?"unblocked":e==="booked"?"cancelled":"available":t}pushActivity(e,t,s,i=Date.now()){let o=e[0];if(!o)return null;let a=this.sectionsForLabels(e),l={id:`${o}:${i}:${Math.random().toString(36).slice(2,6)}`,at:i,label:o,labels:[...e],count:e.length,verb:t,status:s,sectionIds:a.ids,sectionLabels:a.labels};return this.controlRoomSnapshot?.activity||this.feed.unshift(l),this.feed.length>B&&(this.feed.length=B),this.mode==="view"&&this.paintFeed(),this.showLiveEvent(l),this.opts.onActivity?.(l),l}seedFeed(e){this.controlRoomSnapshot?.activity&&(this.feed=this.feed.filter(i=>i.id.startsWith("log:")));let t={hold:"held",book:"booked",release:"released",expire:"expired",block:"blocked",unblock:"unblocked",unbook:"cancelled"},s={hold:"held",book:"booked",release:"free",expire:"free",block:"blocked",unblock:"free",unbook:"free"};for(let i of e){if(this.feed.some(r=>r.id===`log:${i.id}`))continue;let o=i.labels[0];if(!o)continue;let a=this.sectionsForLabels(i.labels),l={id:`log:${i.id}`,at:i.at,label:o,labels:[...i.labels],count:i.labels.length,verb:t[i.action]??i.action,status:s[i.action]??"free",sectionIds:a.ids,sectionLabels:a.labels};this.feed.push(l),this.opts.onActivity?.(l)}this.feed.sort((i,o)=>o.at-i.at),this.feed.length>B&&(this.feed.length=B),this.mode==="view"&&this.paintFeed()}startFeedClock(){this.feedTimer=setInterval(()=>{this.mode==="view"&&(this.paintFeed(),this.paintMonitorInsights())},1e4)}selectionCap(){return this.mode!=="select"?1e6:this.opts.numberOfPlacesToSelect??this.opts.maxSelectedObjects??1e6}isHostUnavailable(e){return this.unavailableLabels.has(e)}renderStatusOf(e,t){return t==="free"&&this.unavailableLabels.has(e)?"held":M(t)}canSelectObject(e){if(this.isHostUnavailable(e.label))return!1;let t=this.status.get(e.label)??"free",s=this.opts.unavailableObjectsSelectable??!0,i=t==="free"||s||this.selectableObjectLabels.has(e.label);if(!this.opts.isObjectSelectable)return i;try{return this.opts.isObjectSelectable(e,i)===!0}catch(o){return this.opts.onError?.(o),!1}}applyInitialSelection(){this.initialSelectionApplied||this.mode!=="select"||!this.renderer||(this.initialSelectionApplied=!0,this.selectByLabels(this.opts.selectedObjects??[]))}trimSelectionToCap(){if(this.mode!=="select")return;let e=this.getSelection(),t=this.selectionCap();e.length<=t||this.renderer?.deselect(e.slice(t).map(s=>s.id))}reconcileSelectPolicy(){if(this.mode!=="select")return;let e=this.getSelection().filter(t=>!this.canSelectObject(t));e.length&&this.renderer?.deselect(e.map(t=>t.id)),this.trimSelectionToCap(),this.syncSelection()}selectionLabels(){return this.getSelection().map(e=>e.label)}syncSelection(){let e=this.getSelection();this.mode==="block"?this.paintSelBar(e):this.mode==="inspect"?this.renderInspectRail(e):this.mode==="select"?this.paintSelectSelection(e):this.mode==="categories"?this.paintCategorySelection(e):this.mode==="channels"&&this.channels?.handleSelectionChange();let t=new Map(e.map(s=>[s.label,s]));if(this.mode==="select"){for(let[i,o]of t)this.lastSelectionLabels.has(i)||this.opts.onObjectSelected?.(o);for(let i of this.lastSelectionLabels)if(!t.has(i)){let o=this.labelToSeat.get(i);o&&this.opts.onObjectDeselected?.(o)}let s=this.getSelectionValidity();s&&(this.opts.onSelectionValidityChange?.(s),this.selectionWasValid!==s.isValid&&(s.isValid?this.opts.onSelectionValid?.(s):this.opts.onSelectionInvalid?.(s)),this.selectionWasValid=s.isValid)}this.lastSelectionLabels=new Set(t.keys()),this.navigation?.selectionChanged(e.length),this.opts.onSelectionChange?.(e)}buildChrome(){let e=document.createElement("div"),t=this.opts.chrome==="minimal";e.className=t?"slm slm-minimal":"slm",e.tabIndex=0,e.setAttribute("role","region"),e.setAttribute("aria-label",t?"Seat map":"SeatLayer live control room"),e.innerHTML=`
732
+ </details>`}function Tt(r,e,t){let s=te(),i=!1;r.querySelectorAll("[data-view]").forEach(o=>{let a=o.dataset.view,l=e[a];o.setAttribute("aria-checked",String(l)),o.classList.toggle("on",l),l!==s[a]&&(i=!0)}),r.querySelector("summary")?.classList.toggle("away",i);let n=r.querySelector('[data-ref="viewnote"]');n&&(n.hidden=!t.momentumLoading,n.textContent=t.momentumLoading?"Booking momentum: loading the first snapshot\u2026":"")}import{UNGROUPED_ID as ks}from"@seatlayer/core";function fe(r){return Object.entries(r).filter(([,e])=>e.mode==="closed").map(([e])=>e)}function ge(r){let e=r.sectionsBase;if(!e)return{rows:[],hiddenSections:0,closedSections:0};let t=r.doc?.zones??[],s=new Map,i=[];for(let c of e.sections)if(c.zone&&t.some(d=>d.id===c.zone)){let d=s.get(c.zone)??[];d.push(c),s.set(c.zone,d)}else i.push(c);let n=[],o=0,a=0,l=(c,d,h,p=!1,m)=>{let u=r.availabilityRules[d.id]??null,b=r.effectiveClosed.has(d.id)||p,T=r.effectiveHidden.has(d.id)||h&&!b;c==="section"&&T&&(o+=1),c==="section"&&b&&(a+=1),n.push({kind:c,id:d.id,label:d.label,seatCount:d.seatCount,seatLabels:d.seatLabels,rule:u,hidden:T,closed:b,followsZone:c==="section"&&h,...m?{zoneId:m}:{}})};for(let c of t){let d=s.get(c.id);if(!d||!d.length)continue;let h={id:c.id,label:c.label||"Zone",seatCount:d.reduce((u,b)=>u+b.seatCount,0),seatLabels:d.flatMap(u=>u.seatLabels)},p=!!r.availabilityRules[c.id],m=r.availabilityRules[c.id]?.mode==="closed";l("zone",h,!1);for(let u of d)l("section",u,p,m,c.id)}for(let c of i)l("section",c,!1);if(e.ungrouped){let c=e.ungrouped;l("section",{id:ks,label:c.label,seatCount:c.seatCount,seatLabels:c.seatLabels},!1)}return{rows:n,hiddenSections:o,closedSections:a}}var Bs="https://api.seatlayer.io",ie=200,Et=16,Rt=4,Bt=[{key:"watch",label:"Watch",tools:[{mode:"view",label:"Watch",shortcut:"M",title:"See what is selling, where buyers are, and answer questions about any seat."}]},{key:"manage",label:"Manage",tools:[{mode:"reserve",label:"Reserve",shortcut:"R",title:"Keep seats aside under a name (guests, press, comps) until you release them or the time runs out."},{mode:"block",label:"Block",shortcut:"B",title:"Take seats off sale for this event, or put them back."},{mode:"categories",label:"Ticket types",shortcut:"G",title:"Change which ticket type seats sell as, for this event only."},{mode:"sections",label:"Sections",shortcut:"S",title:"Open, close or hide sections for this event, on a schedule or on demand."},{mode:"tables",label:"Tables",shortcut:"T",title:"Sell each table per chair or as one whole-table booking."},{mode:"channels",label:"Channels",shortcut:"C",title:"Allocate inventory to sales channels and share their links."}]},{key:"host",label:"Host tools",tools:[{mode:"select",label:"Select",shortcut:"X",title:"Select seats for your own back-office operation. The selection is handed to your app; nothing changes here."},{mode:"filterSections",label:"Filter",shortcut:"L",title:"Filter the map to one section for your own reporting."}]}],$s=3;function ve(r){return r==="resale"?"booked":r==="held"||r==="booked"||r==="blocked"?r:"free"}function Hs(r){let e=r?.status;return e===401||e===403}var At=r=>`<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">${r}</svg>`,ye={enter:At('<path d="M4 9V4h5M15 4h5v5M20 15v5h-5M9 20H4v-5"/>'),exit:At('<path d="M9 4v5H4M20 9h-5V4M15 20v-5h5M4 15h5v5"/>')},Is=Object.fromEntries(Bt.flatMap(r=>r.tools.map(e=>[e.shortcut.toLowerCase(),e.mode]))),S=r=>`${r.toLocaleString()} ${r===1?"seat":"seats"}`,q=r=>w(r,{weekday:"short",day:"numeric",month:"short",hour:"2-digit",minute:"2-digit"}),xe=class{constructor(e){this.els={};this.renderer=null;this.doc=null;this.selectObserver=null;this.seatHistoryPanel=null;this.changes=null;this.changesLoading=null;this.feedFilter="all";this.saved=null;this.savedCount=null;this.savedApplied=null;this.arrival=[];this.activityPanel=null;this.navigation=null;this.movingMap=!1;this.marqueeShape="box";this.socketSnapshotSeen=!1;this.monitorRefreshTimer=null;this.themeMode=null;this.colorSchemeStop=null;this.inventoryModelVersion=1;this.selectableObjectLabels=new Set;this.unavailableLabels=new Set;this.lastSelectionLabels=new Set;this.selBack=[];this.selAhead=[];this.selRestoring=!1;this.selectionWasValid=null;this.initialSelectionApplied=!1;this.labelToId=new Map;this.labelToSeat=new Map;this.allIds=[];this.gaUnitLabelSet=new Set;this.tableChairIds=new Map;this.labelNames=new Map;this.status=new Map;this.counts={held:0,booked:0,blocked:0};this.modelSynced=!1;this.controlRoomSettled=!1;this.currency="USD";this.authoritativeCurrency=null;this.authoritativeGrossRevenue=0;this.revenueStatus="loading";this.revenueRequest=0;this.controlRoomSnapshot=null;this.serverBaseline=null;this.reservationsLoaded=!1;this.livePresence=null;this.liveGross=null;this.paintHandle=null;this.trendWindowMinutes=15;this.heatEnabled=!1;this.mapView=te();this.categoryChoice=null;this.lastSectionTap=null;this.press=null;this.lastPick=null;this.categoryBusy=!1;this.blockBusy=!1;this.panelAlert=null;this.categoryTotalsCache=null;this.rowLabelCache=null;this.colourChoices={};this.extras=null;this.reserve=null;this.alerts=null;this.sectionsPanel=null;this.tablesPanel=null;this.findBlocked=null;this.reservedBy=new Map;this.reserving=new Set;this.reservedIds=new Set;this.reservationsTimer=null;this.blockGroups=null;this.eventStartsAt=null;this.search=null;this.searchSeatList=null;this.minimap=null;this.lastKpiValues=new Map;this.activeKpiDeltas=new Map;this.ws=null;this.reconnectTimer=null;this.pingTimer=null;this.pongTimer=null;this.attempt=0;this.closed=!1;this.connectionStatus="reconnecting";this.lastMessageAt=null;this.ready=!1;this.feed=[];this.feedTimer=null;this.toastTimer=null;this.liveEventTimer=null;this.kpiCleanupTimer=null;this.followLiveTimer=null;this.followSeatTimer=null;this.releaseAt=null;this.blockEnd="never";this.blockDone=null;this.blockFailedNow=!1;this.layoutObserver=null;this.chromeClearance=-1;this.chromeClearanceWidth=-1;this.legendInset="";this.tokenExpiresAt=null;this.tokenRefreshTimer=null;this.tokenRefreshInFlight=!1;this.tokenRefreshFailures=0;this.sessionEnded=!1;this.taskGroups=[];this.taskMenuOpen=!1;this.detents=new Map;this.linkState="live";this.linkTimers=null;this.everLive=!1;this.announcedRoomState=null;this.sectionByObject=new Map;this.sectionLabelById=new Map;this.sectionsBase=null;this.filteredSectionLabel=null;this.availabilityRules={};this.effectiveHidden=new Set;this.effectiveClosed=new Set;this.lastSyncedAt=null;this.blockBrowse=!1;this.channels=null;this.chooser=null;this.chooserDialog=null;this.extrasReady=null;this.categoryDifferences=null;this.channelCaps={view:!1,manage:!1};this.categoryCanManage=!1;this.tableCanManage=!1;this.tableBookingSaving=!1;this.channelCapabilityResolution=0;this.channelsLoading=null;this.onFullscreenChange=()=>{this.paintFullscreenButton(),this.paintFullscreenLine(),this.updateContainerLayout(),this.renderer?.forceDraw()};this.onKeyDown=e=>{if((e.metaKey||e.ctrlKey)&&!e.altKey&&e.key.toLowerCase()==="k"){e.preventDefault(),this.openSearch();return}let s=!!e.target?.closest('input,select,textarea,[contenteditable="true"]');if((e.metaKey||e.ctrlKey)&&!e.altKey&&e.key.toLowerCase()==="z"){!s&&this.stepSelection(e.shiftKey?1:-1)&&e.preventDefault();return}if(e.metaKey||e.ctrlKey||e.altKey||s)return;let i=e.key.toLowerCase();if(/^[1-9]$/.test(i)){let a=this.taskGroups.flatMap(l=>l.tools)[Number(i)-1];a&&(this.setMode(a.mode),e.preventDefault());return}if((i==="l"||i==="v")&&!e.shiftKey&&this.isBulkSelectMode()){this.navigation?.choose(i==="l"?"lasso":"select"),e.preventDefault();return}let n=e.shiftKey?xt(i):null;if(n){this.toggleMapView(n),e.preventDefault();return}if(i==="/"){e.preventDefault(),this.openSearch();return}let o=Is[i];if(o){if(!this.toolAvailable(o))return;this.setMode(o)}else if(i==="f")this.toggleFullscreen();else if(i==="escape"){let a=this.els.view;if(a?.open)a.open=!1,a.querySelector("summary")?.focus();else if(this.litChip)this.onLegendChip(this.litChip,!1);else if(this.taskMenuOpen)this.taskMenuOpen=!1,this.paintTaskPicker(),this.els.taskpick?.querySelector("[data-taskpick]")?.focus();else if(!this.channels?.handleBack())if(this.isSheet()&&this.sheetDetent()==="full")this.setDetent("half");else if(this.getSelection().length)this.clearSelection();else return}else return;e.preventDefault()};this.onSelectAllKey=e=>{!(e.metaKey||e.ctrlKey)||e.altKey||e.shiftKey||e.key.toLowerCase()!=="a"||e.target?.closest('input,select,textarea,[contenteditable="true"]')||(e.preventDefault(),e.stopPropagation(),this.isBulkSelectMode()?this.selectInView():this.mode==="select"&&this.selectAll())};this.onHowClick=e=>{let t=e.target?.closest("[data-how]")?.dataset.how;if(!t)return;let i=t==="current"?{view:"watch",reserve:"reserve",block:"block",categories:"types",sections:"sections",tables:"tables",channels:"channels"}[this.mode]??"watch":t;this.loadExtras().then(n=>{this.closed||!this.root||n.openExplainer({root:this.root,plate:x,touch:G(),guideUrl:"https://docs.seatlayer.io/platform/embedded-control-room/#operator-modes",tryIt:o=>{let a={watch:"view",reserve:"reserve",block:"block",types:"categories",sections:"sections",tables:"tables",channels:"channels"};o==="search"?this.openSearch():o==="colours"?this.root?.querySelector('[data-ref="colourby"]')?.click():a[o]&&a[o]!==this.mode&&this.toolAvailable(a[o])&&this.setMode(a[o])}},i)}).catch(n=>this.opts.onError?.(n))};this.onRailClick=e=>{let t=e.target,s=t?.closest("[data-section-focus]");if(s?.dataset.sectionFocus){this.locateSection(s.dataset.sectionFocus);return}let i=t?.closest("[data-feed-id]");i?.dataset.feedId&&this.locateActivity(i.dataset.feedId),t?.closest("[data-sel-clear]")&&this.clearSelection(),t?.closest("[data-sel-all]")&&this.selectAll(),t?.closest("[data-sel-undo]")&&this.stepSelection(-1),t?.closest("[data-sel-save]")&&this.ensureSaved().then(o=>o?.openSave());let n=t?.closest("[data-sel-similar]");n&&this.openSimilar(n),t?.closest("[data-saved-list], [data-saved-open]")&&this.ensureSaved().then(o=>o?.openList())};this.bandIndex=null;this.typeKeyBySection=null;this.typeKeyBase=null;this.legendSeats=null;this.litChip=null;this.shownObjects=null;this.barNeed=[0,0,0];this.sectionOptions=[];this.addByPinned=!1;re(e.token),this.assertSelectionOptions(e.maxSelectedObjects,e.numberOfPlacesToSelect),this.opts=e,this.key=e.eventKey,this.mode=e.mode??"view",this.selectableObjectLabels=new Set(e.selectableObjects??[]),this.unavailableLabels=new Set(e.unavailableObjects??[]),this.categoryCanManage=new Set(e.capabilities??[]).has("event:categories:manage"),this.tableCanManage=new Set(e.capabilities??[]).has("event:tables:manage"),this.keepLive=e.keepLiveWhileHidden??!0,Me(e.timeZone),this.themeMode=e.themeMode??null,this.followLive=e.followLive??!1,this.currency=e.currency??"USD",this.tokenExpiresAt=e.tokenExpiresAt??null,this.api=new de(e.apiBase??Bs,e.token),this.organizerAssetUrls=new J(this.key,(t,s)=>this.withAuthRetry(()=>this.api.asset(t,s))),this.host=Ee(e.container)}selectInView(){let e=this.renderer?.getVisibleWorldRect?.();if(!e)return;let t=[...this.labelToSeat.values()].filter(s=>s.x>=e.x&&s.x<=e.x+e.width&&s.y>=e.y&&s.y<=e.y+e.height);this.renderer?.selectByLabels(t.map(s=>s.label)),this.syncSelection()}assertSelectionOptions(e,t){let s=i=>i===void 0||Number.isInteger(i)&&i>0;if(!s(e))throw new TypeError("maxSelectedObjects must be a positive integer");if(!s(t))throw new TypeError("numberOfPlacesToSelect must be a positive integer");if(e!==void 0&&t!==void 0&&e<t)throw new TypeError("maxSelectedObjects cannot be lower than numberOfPlacesToSelect")}async render(){return Je(),this.buildChrome(),await this.load(),this}async load(){try{let e=await this.withAuthRetry(()=>this.api.chart(this.key));this.inventoryModelVersion=e.event.inventoryModelVersion===2?2:1,this.eventStartsAt=e.event.startsAt??null,this.doc=await this.organizerAssetUrls.prepareRendererChart(e.doc),this.authoritativeCurrency=e.event.currency??null,this.currency=this.authoritativeCurrency??this.opts.currency??this.currency,this.buildUnitUniverse(this.doc),this.buildRenderer(),this.buildSectionOptions(),this.settleMode();let[,t]=await Promise.all([this.resnapshot(),this.refreshControlRoom().catch(s=>this.opts.onError?.(s)),this.refreshAvailability()]);t?.activity?this.seedFeed(t.activity):this.api.log(this.key,{limit:24}).then(s=>{this.adoptLabelNames(s.displayLabels),this.seedFeed(s.entries)}).catch(()=>{}),this.connect(),this.startFeedClock(),this.ready=!0,await this.resolveChannelCapabilities(),this.setMode(this.mode),this.root?.querySelector('[data-ref="opening"]')?.remove(),this.applyInitialSelection(),this.scheduleTokenRefresh(),this.opts.onReady?.(),this.mountAlerts(),this.ensureSaved().then(s=>s?.refresh()),this.withExtras(()=>{}),(this.opts.focusSection||this.opts.focusSeat||this.opts.focusSeats?.length||this.opts.focusCategory||this.opts.arrivedFrom||this.opts.onOpenTrend&&this.opts.kpis!==!1)&&this.mountArrival()}catch(e){this.fail(e)}}setMode(e){e==="inspect"&&(e="view"),this.toolAvailable(e)||(e="view"),e==="channels"&&!this.channels&&this.ensureChannels();let t=e!==this.mode,s=this.mode==="channels",i=this.mode==="filterSections";this.mode=e,t&&e!=="view"&&this.setFollowLive(!1),t&&this.navigation?.resetTool(),!this.renderer&&this.doc?this.buildRenderer():this.updateRendererInteraction(),t&&(this.renderer?.clearSelection(),this.syncSelection(),this.selBack=[],this.selAhead=[],this.navigation?.historyChanged(!1,!1)),s&&e!=="channels"&&this.channels?.leave(),t&&(this.litChip=null,this.highlightLabels(null),this.wireBarFind()),this.paintModeTabs();let n=!t&&(e==="tables"?this.tablesPanel:e==="sections"?this.sectionsPanel:null);n?n.update():this.paintRail(),this.applyDetent(),t&&this.setColourBy(this.colourChoices[e]??this.startingColourBy(e),!1),this.paintMapViewMenu(),this.applyMapView(),this.applySectionCanvasTreatment(),i&&e!=="filterSections"&&this.renderer?.zoomToFit(),e==="channels"&&this.channels?.enter(),e==="select"&&this.applyInitialSelection(),t&&this.opts.onModeChange?.(e)}async resolveChannelCapabilities(){let e=++this.channelCapabilityResolution,t=this.opts.capabilities,s;if(t){let i=new Set(t);s={view:i.has("event:channels:view"),manage:i.has("event:channels:view")&&i.has("event:channels:manage")}}else s={view:!1,manage:!1};if(!s.view&&!t)try{await this.api.channels(this.key),s={view:!0,manage:!1}}catch{s={view:!1,manage:!1}}if(e===this.channelCapabilityResolution){if(this.channelCaps=s,!this.channelCaps.view){this.channels?.destroy(),this.channels=null,this.mode==="channels"?this.setMode("view"):this.paintModeTabs();return}this.channels?.setCapabilities(this.channelCaps),this.paintModeTabs()}}ensureChannels(){if(this.channelsLoading)return this.channelsLoading;if(this.channels)return Promise.resolve();let e=(async()=>{try{let t=await import("./channelsMode-GTGKGXZ3.js");if(this.closed||!this.channelCaps.view||(this.channels||(Qe(t.CHANNELS_CSS),this.channels=new t.ChannelsMode(this.buildChannelsHost(),this.channelCaps),this.channels.onInteractionChange=()=>this.updateRendererInteraction()),this.mode!=="channels"))return;this.updateRendererInteraction(),this.paintRail(),this.channels.enter(),this.setColourBy(this.colourChoices.channels??this.startingColourBy("channels"),!1)}catch(t){if(this.closed)return;this.channelsLoading=null,this.mode==="channels"&&this.paintRail(),this.opts.onError?.(t)}})();return this.channelsLoading=e,e}buildChooserHost(){let e=s=>{let i=this.labelToSeat.get(s);return i?this.mode==="block"?this.isBlockSelectable(s):this.mode==="reserve"?this.isReserveSelectable(s):this.mode==="select"?this.canSelectObject(i):!0:!1};return{selectionLabels:()=>this.selectionLabels(),selectByLabels:s=>{this.selectByLabels(s)},clearSelection:()=>this.clearSelection(),selectSection:s=>{this.selectSection(s)},sections:()=>this.sectionOptions,sectionInfo:s=>{let i=this.filterableSections().find(o=>o.id===s),n=this.sectionTypeKeys().get(s);return{total:i?.seatCount??0,color:this.doc?.categories.find(o=>o.key===n)?.color}},labelsInSection:s=>(this.renderer?.getSelectableInSection(s)??[]).map(i=>i.label).filter(e),rows:()=>{let s=new Map((this.doc?.objects??[]).map(n=>[n.id,n])),i=new Map;for(let n of this.labelToSeat.values()){let o=s.get(n.rowId);if(!o||o.type!=="row"&&o.type!=="table")continue;let a=n.logicalRowId??n.rowId,l=this.sectionByObject.get(n.rowId)??k,c=i.get(a)??{id:a,label:o.type==="row"?o.segmentedRow?.displayLabel??o.displayLabel??o.label:o.displayLabel??o.label,sectionId:l,sectionLabel:this.sectionLabelById.get(l)??"Other seats",labels:[],all:[]};c.all.push(n.label),e(n.label)&&c.labels.push(n.label),i.set(a,c)}return[...i.values()].sort((n,o)=>n.sectionLabel.localeCompare(o.sectionLabel,void 0,{numeric:!0,sensitivity:"base"})||n.label.localeCompare(o.label,void 0,{numeric:!0,sensitivity:"base"}))},categories:()=>(this.doc?.categories??[]).map(s=>({key:s.key,label:s.label??s.key,color:s.color,total:this.categoryTotals().get(s.key)??0})),labelsInCategory:s=>[...this.labelToSeat.values()].filter(i=>i.categoryKey===s&&e(i.label)).map(i=>i.label),seats:()=>[...this.labelToSeat.values()].filter(s=>e(s.label)).map(s=>({label:s.label})),statusOf:s=>this.status.get(s)??(this.labelToSeat.has(s)?"free":void 0),sectionOfLabel:s=>{let i=this.labelToSeat.get(s);if(!i)return null;let n=this.sectionByObject.get(i.rowId)??k;return{id:n,label:this.sectionLabelById.get(n)??"Other seats"}},openDialog:(s,i)=>{this.chooserDialog=je(this.root,s,i,{previous:this.chooserDialog,onClose:()=>{this.chooserDialog=null}})},closeDialog:()=>this.chooserDialog?.close(),enhanceDialog:s=>this.withExtras(i=>i.pickerKeys(s)),pickers:()=>this.extrasReady??this.loadExtras().then(s=>this.extrasReady=s),pickerFailed:s=>this.pickerFailed(s),highlight:s=>this.highlightLabels(s),...this.mode==="select"?{cap:this.selectionCap()}:{}}}wireBarFind(){let e=this.els.findbar;!e||e.dataset.wired||(e.dataset.wired="1",e.innerHTML=`<button type="button" class="slm-findtrigger" aria-keyshortcuts="Meta+K Control+K"><svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="#4c6fff" stroke-width="2" stroke-linecap="round" aria-hidden="true"><circle cx="11" cy="11" r="6.5"/><path d="M16 16l4.5 4.5"/></svg><span>Seat, row, section or booking</span><kbd>${ce()}</kbd></button>`,e.querySelector("button").addEventListener("click",()=>{this.openSearch()}))}async loadExtras(){if(!this.extras){let t=typeof __SEATLAYER_CDN__<"u"&&__SEATLAYER_CDN__?As("seatlayer-manager-extras.mjs"):import("./managerExtras-BP2MLTS5.js");this.extras=t.catch(s=>{throw this.extras=null,s})}let e=await this.extras;return et(e.EXTRAS_CSS),e}withExtras(e){this.loadExtras().then(t=>{this.extrasReady=t,this.closed||e(t)},()=>{})}pickerFailed(e){this.toast("Couldn't open that list. Check the connection.","err",{label:"Try again",run:e})}async openSearch(e=""){try{let t=await this.loadExtras();if(this.closed||!this.root)return;this.search?.close(),this.search=t.openEventSearch({root:this.root,seats:()=>this.searchSeats(),statusOf:s=>this.status.get(s)??"free",describe:s=>{let i=this.doc?.categories.find(n=>n.key===this.labelToSeat.get(s)?.categoryKey);return i?`${i.label}${typeof i.price=="number"?` ${A(i.price,this.currency)}`:""}`:""},canSelect:()=>this.isChoosingTool(),show:s=>this.showLabels(s),select:s=>{this.selectByLabels(s)},lookupOrders:this.canReadOrders()?s=>this.api.lookupOrders(this.key,s):void 0,openOrder:this.opts.onOpenOrder?s=>this.opts.onOpenOrder(s):void 0,blockReasons:()=>this.blockGroups?new Set(this.blockGroups.groups.map(s=>s.reason??"")).size:null,blockedBy:s=>{let i=s.trim().toLowerCase();return i.length<3?[]:(this.blockGroups?.groups??[]).filter(n=>n.reason&&n.reason.toLowerCase().includes(i)).map(n=>({reason:n.reason,labels:n.labels}))},saved:()=>this.saved?.rows()??null,useSaved:(s,i)=>{this.saved?.use(s,i)},reserved:()=>{!this.blockGroups&&this.toolAvailable("block")&&this.loadBlockGroups().catch(()=>{});let s=[...this.reservedBy.keys()].filter(i=>this.status.get(i)==="blocked");return{labels:s,count:new Set(s.map(i=>this.reservedBy.get(i).id)).size}},recents:{read:()=>{try{return JSON.parse(localStorage.getItem(`seatlayer.controlRoom.search.${this.key}`)??"[]")}catch{return[]}},write:s=>{try{localStorage.setItem(`seatlayer.controlRoom.search.${this.key}`,JSON.stringify(s))}catch{}}}},e)}catch(t){this.toastErr("Search could not load. Check the connection and try again."),this.opts.onError?.(t)}}canReadOrders(){return this.opts.capabilities?.includes("event:orders:read")===!0}searchSeats(){if(this.searchSeatList?.base===this.sectionsBase)return this.searchSeatList.seats;let e=new Map;for(let s of this.doc?.objects??[])s.type==="row"?e.set(s.id,s.segmentedRow?.displayLabel??s.displayLabel):s.type==="table"&&e.set(s.id,s.displayLabel);let t=[];for(let s of this.labelToSeat.values()){let i=this.sectionByObject.get(s.rowId)??k;t.push({label:s.label,sectionId:i,sectionLabel:this.sectionLabelById.get(i)??"Other seats",rowKey:s.logicalRowId??s.rowId,rowDisplay:e.get(s.rowId)})}return this.searchSeatList={base:this.sectionsBase,seats:t},t}isChoosingTool(){return this.isBulkSelectMode()||this.mode==="select"}frameLabels(e){let t=e.map(s=>this.labelToSeat.get(s)?.id).filter(s=>!!s);t.length&&(this.setFollowLive(!1),this.renderer?.focusSeats?.(t,{animate:!0}))}highlightLabels(e){if(!e){this.renderer?.setSeatHighlight?.(null);return}this.renderer?.setSeatHighlight?.(e.map(t=>this.labelToSeat.get(t)?.id).filter(t=>!!t))}toolChooser(){return this.chooserDialog?.close({restoreFocus:!1}),this.chooser=new Ie(this.buildChooserHost()),this.chooser}toolSelectionBar(e,t,s,i){return He({count:0,noun:"selected",breakdown:`<span class="slm-selactions"><button type="button" class="slm-linkbtn" data-ref="${i}">Select all</button></span>`,clearAttr:`data-ref="${s}"`}).replace('class="slm-selnum"',`class="slm-selnum" data-ref="${e}"`).replace('class="slm-sellabel"',`class="slm-sellabel" data-ref="${t}"`)}buildChannelsHost(){return{moved:e=>this.recordChange({kind:"channel",...e}),channelsChanged:()=>{this.getColourBy()==="channel"&&this.paintColourLegend()},eventKey:this.key,api:this.api,rail:this.els.rail,pickers:()=>this.extrasReady??this.loadExtras().then(e=>this.extrasReady=e),pickerFailed:e=>this.pickerFailed(e),enhanceDialog:e=>this.withExtras(t=>t.pickerKeys(e)),mapLayer:this.root.querySelector(".slm-map"),pillLane:this.els.lane,root:this.root,seats:()=>[...this.labelToSeat.values()].map(e=>({id:e.id,label:e.label,x:e.x,y:e.y})),statusOf:e=>this.status.get(e)??(this.labelToSeat.has(e)?"free":void 0),selectionLabels:()=>this.selectionLabels(),selectByLabels:e=>{this.selectByLabels(e)},clearSelection:()=>this.clearSelection(),selectSection:e=>{this.selectSection(e)},sections:()=>this.sectionOptions,labelsInSection:e=>this.renderer?.getSelectableInSection(e).map(t=>t.label)??[],rows:()=>{let e=new Map((this.doc?.objects??[]).map(s=>[s.id,s])),t=new Map;for(let s of this.labelToSeat.values()){let i=e.get(s.rowId);if(!i||i.type!=="row"&&i.type!=="table")continue;let n=s.logicalRowId??s.rowId,o=this.sectionByObject.get(s.rowId)??k,a=t.get(n)??{id:n,label:i.type==="row"?i.segmentedRow?.displayLabel??i.displayLabel??i.label:i.displayLabel??i.label,sectionId:o,sectionLabel:this.sectionLabelById.get(o)??"Other seats",labels:[]};a.labels.push(s.label),t.set(n,a)}return[...t.values()].sort((s,i)=>s.sectionLabel.localeCompare(i.sectionLabel,void 0,{numeric:!0,sensitivity:"base"})||s.label.localeCompare(i.label,void 0,{numeric:!0,sensitivity:"base"}))},categories:()=>(this.doc?.categories??[]).map(e=>({key:e.key,label:e.label??e.key,color:e.color,price:e.price,tiers:e.tiers?.map(t=>({id:t.id,name:t.name,price:t.price}))})),labelsInCategory:e=>[...this.labelToSeat.entries()].filter(([,t])=>t.categoryKey===e).map(([t])=>t),sectionOfLabel:e=>{let t=this.labelToSeat.get(e);if(!t)return null;let s=this.sectionByObject.get(t.rowId)??k;return{id:s,label:this.sectionLabelById.get(s)??"Other seats"}},worldToScreen:e=>this.renderer?.worldToScreen(e)??null,seatPixelSize:()=>this.seatPixelSize(),isSeatDetail:()=>this.renderer?.getRung?.()==="seats",showSectionOverview:()=>{this.renderer?.clearSectionFocus(),this.renderer?.setRung?.("sections")},focusSection:e=>this.renderer?.focusSection(e),isCompact:()=>!!this.root?.classList.contains("compact"),setMapInert:e=>{this.mapHost.toggleAttribute("inert",e),this.mapHost.setAttribute("aria-hidden",String(e))},toast:(e,t)=>this.toast(e,t),onError:e=>this.opts.onError?.(e)}}seatPixelSize(){let e=this.renderer?.getVisibleWorldRect?.(),t=this.mapHost?.clientWidth??0;return!e?.width||!t?6:Math.max(3,t/e.width*18)}setHeatOverlay(e){this.heatEnabled=e,this.mapView.momentum!==e&&this.setMapView({momentum:e}),this.applyHeatOverlay(),this.paintHeatButton()}setMapView(e){let t={...this.mapView,...e};if(!Object.keys(t).some(n=>t[n]!==this.mapView[n]))return;let i=t.categoryColours!==this.mapView.categoryColours||t.channelColours!==this.mapView.channelColours;this.mapView=t,wt(t),t.momentum!==this.heatEnabled&&this.setHeatOverlay(t.momentum),this.applyMapView(),this.paintMapViewMenu(),i&&(this.refreshBlockPaint(),this.paintMapChrome())}getColourBy(){return this.mapView.channelColours&&this.channelColoursAvailable()?"channel":this.mapView.categoryColours?"type":"status"}setColourBy(e,t=!0){let s=e==="full"||e==="channel"&&!this.channelColoursAvailable()?"status":e;t&&(this.colourChoices={...this.colourChoices,[this.mode]:s},yt(this.colourChoices)),this.litChip&&s!==this.getColourBy()&&(this.litChip=null,this.highlightLabels(null)),this.setMapView({categoryColours:s==="type",channelColours:s==="channel"}),this.paintColourLegend()}startingColourBy(e){let t=this.opts.colourBy;return t&&e!=="channels"?t==="full"?"status":t:gt(e)}getMapView(){return{...this.mapView}}toggleMapView(e){if(e==="categoryColours"||e==="channelColours"){let t=e==="categoryColours"?"type":"channel";this.setColourBy(this.getColourBy()===t?"status":t);return}this.setMapView({[e]:!this.mapView[e]})}channelColoursAvailable(){return this.mode==="channels"&&this.channels!=null}applyMapView(){St(this.mapView,{renderer:this.renderer,channelsOverlay:e=>this.channels?.setOverlayVisible(e)})}paintMapViewMenu(){let e=this.els.view;e&&Tt(e,this.mapView,{momentumLoading:this.mapView.momentum&&!this.controlRoomSnapshot})}setFollowLive(e){let t=this.followLive!==e;this.followLive=e,e||(this.followLiveTimer&&clearTimeout(this.followLiveTimer),this.followSeatTimer&&clearTimeout(this.followSeatTimer),this.followLiveTimer=null,this.followSeatTimer=null),this.paintFollowLiveButton(),t&&this.opts.onFollowLiveChange?.(e)}setKeepLiveWhileHidden(e){this.keepLive=e??!0,this.opts.keepLiveWhileHidden=e}setCurrency(e){this.opts.currency=e,!this.authoritativeCurrency&&(this.currency=e??"USD",this.ready&&this.recomputeTallies())}setSale(e){this.opts.sale=e,this.paintFullscreenLine(),this.paintMonitorInsights()}setTheme(e){this.opts.theme=e,this.applyThemeVars()}applyThemeVars(){if(!this.root)return;let e=ae(this.themeMode);for(let[t,s]of Object.entries(Re(this.opts.theme,e)))this.root.style.setProperty(t,s);e?this.root.dataset.theme=e:delete this.root.dataset.theme}watchThemeMode(){this.colorSchemeStop?.(),this.colorSchemeStop=null,this.themeMode==="auto"&&(this.colorSchemeStop=we(()=>{this.closed||this.repaintForThemeMode()}))}repaintForThemeMode(){this.applyThemeVars();let e=this.renderer;if(!e||!this.doc)return;let t=e.getSelection().map(n=>n.id),s=e.getCameraPose(),i=e.getFocusedSection();e.setChart(this.themedDoc()),this.repaintAll(),this.applyHeatOverlay(),t.length&&e.select(t),i&&e.focusSection(i),e.setCameraPose(s),this.updateZoomHint()}setThemeMode(e){let t=e??null;this.closed||t===this.themeMode||(this.themeMode=t,this.opts.themeMode=t??void 0,this.watchThemeMode(),this.repaintForThemeMode())}getThemeMode(){return this.themeMode}themedDoc(){let e=this.doc,t=Ae(ae(this.themeMode));return t?{...e,theme:{...e.theme??{},background:t}}:e}setCapabilities(e){this.opts.capabilities=e,this.categoryCanManage=new Set(e??[]).has("event:categories:manage"),this.tableCanManage=new Set(e??[]).has("event:tables:manage"),!this.categoryCanManage&&this.mode==="categories"||!this.tableCanManage&&this.mode==="tables"?this.setMode("view"):this.paintModeTabs(),this.ready&&this.resolveChannelCapabilities()}setTokenRefresh(e){this.opts.onTokenRefresh=e,this.scheduleTokenRefresh()}setTrendWindow(e){let t=Number.isFinite(e)?Math.floor(e):15;return this.trendWindowMinutes=Math.max(5,Math.min(60,t)),this.paintTrendWindow(),this.refreshControlRoom()}async enterFullscreen(){!this.root?.requestFullscreen||this.isFullscreen()||(await this.root.requestFullscreen(),this.root.focus({preventScroll:!0}))}async exitFullscreen(){typeof document>"u"||!this.isFullscreen()||await document.exitFullscreen()}isFullscreen(){return typeof document<"u"&&document.fullscreenElement===this.root}toggleFullscreen(){(this.isFullscreen()?this.exitFullscreen():this.enterFullscreen()).catch(t=>this.opts.onError?.(t))}setToken(e,t){re(e),this.api.setToken(e),this.opts.token=e,this.opts.tokenExpiresAt=t,this.tokenExpiresAt=t??null,this.scheduleTokenRefresh(),this.ready&&this.resolveChannelCapabilities()}scheduleTokenRefresh(){this.tokenRefreshTimer&&clearTimeout(this.tokenRefreshTimer),this.tokenRefreshTimer=null;let e=this.opts.onTokenRefresh,t=this.tokenExpiresAt;if(this.closed||!e||!t||!Number.isFinite(t))return;let s=t-Date.now(),i=Math.min(12e4,Math.max(3e4,s*.2)),n=Math.max(0,s-i);this.tokenRefreshTimer=setTimeout(()=>{this.tokenRefreshTimer=null,this.rotateToken()},n)}async rotateToken(){if(!(this.closed||this.sessionEnded||this.tokenRefreshInFlight||!this.opts.onTokenRefresh)){this.tokenRefreshInFlight=!0;try{let e=await this.opts.onTokenRefresh();if(!e?.token||!Number.isFinite(e.expiresAt))throw new Error("invalid_token_refresh_result");this.tokenRefreshFailures=0,this.setToken(e.token,e.expiresAt)}catch(e){this.opts.onError?.(e),this.tokenRefreshFailures+=1,!this.closed&&(this.tokenRefreshFailures>=$s||Hs(e))?this.endSession():this.closed||(this.tokenRefreshTimer=setTimeout(()=>{this.tokenRefreshTimer=null,this.rotateToken()},3e4))}finally{this.tokenRefreshInFlight=!1}}}endSession(){if(this.sessionEnded)return;this.sessionEnded=!0,this.tokenRefreshTimer&&clearTimeout(this.tokenRefreshTimer),this.tokenRefreshTimer=null,this.reconnectTimer&&clearTimeout(this.reconnectTimer),this.reconnectTimer=null,this.monitorRefreshTimer&&clearTimeout(this.monitorRefreshTimer),this.monitorRefreshTimer=null;let e=this.ws;if(this.ws=null,e){e.onclose=null;try{e.close()}catch{}}this.stopKeepalive(),this.setLive(!1),this.paintSessionEnded()}async retrySession(){if(this.closed||!this.sessionEnded)return!this.sessionEnded;if(!this.opts.onTokenRefresh)return!1;this.sessionEnded=!1,this.tokenRefreshFailures=0;let e=this.root?.querySelector('[data-ref="roomcard"]');return e?.setAttribute("data-busy","true"),await this.rotateToken(),this.sessionEnded?(e?.removeAttribute("data-busy"),!1):(e?.remove(),this.attempt=0,this.connect(),!0)}paintSessionEnded(){if(this.root?.querySelector('[data-ref="roomcard"][data-kind="signedout"]'))return;this.showRoomCard("signedout");let e=this.root?.querySelector('[data-ref="roomcard"] p'),t=this.mode==="view"?null:this.taskGroups.flatMap(i=>i.tools).find(i=>i.mode===this.mode)?.label??null,s=this.getSelection().length;e&&this.withExtras(i=>i.nameWorkInHand(e,t,s,this.els.rail??null))}async block(e,t={}){let s=(e??this.selectionLabels()).filter(l=>this.status.get(l)==="free");if(!s.length||this.blockBusy)return;let i=t.releaseAt??this.releaseAt??void 0,n=`${S(s.length)}`;this.setSeatsLocal(s,"blocked"),this.blockBusy=!0,this.panelAlert=null,this.paintSelBar(this.getSelection());let o=this.selectionSummary(s.flatMap(l=>this.labelToSeat.get(l)??[])).where,a=i?`They go back on sale ${q(i)}.`:"They stay off sale until you put them back.";try{await this.api.block(this.key,s,{...t,releaseAt:i}),this.blockBusy=!1,this.blockFailedNow=!1,this.clearSelection(),this.blockDone={labels:s,until:Date.now()+3e4},setTimeout(()=>{!this.closed&&this.mode==="block"&&this.paintSelBar(this.getSelection())},30100),this.panelAlert=M("ok",`${n} blocked${t.reason?` \xB7 ${t.reason}`:""}`,` ${o}. ${a}`),this.paintSelBar(this.getSelection()),this.doneQuietly("block",s,`${n} blocked${t.reason?` \xB7 ${t.reason}`:""}.`),this.recordChange({kind:"block",labels:s,reason:t.reason??null,releaseAt:i??null})}catch(l){this.blockBusy=!1,this.setSeatsLocal(s,"free");let c=l instanceof H&&l.status===409?(l.conflicts??[]).map(h=>h.label).filter(h=>s.includes(h)):[],d=s.filter(h=>!c.includes(h));if(c.length&&d.length){this.renderer?.deselect(c.map(h=>this.labelToId.get(h)).filter(h=>!!h)),this.syncSelection();try{this.setSeatsLocal(d,"blocked"),await this.api.block(this.key,d,{...t,releaseAt:i}),this.clearSelection(),this.blockDone={labels:d,until:Date.now()+3e4,partial:!0},this.panelAlert=M("warn",`${c.length.toLocaleString()} ${c.length===1?"seat was":"seats were"} sold while you chose`,` ${S(d.length)} blocked. ${Oe(c)} ${c.length===1?"is":"are"} sold and stay${c.length===1?"s":""} with ${c.length===1?"its buyer":"their buyers"}.`),this.paintSelBar(this.getSelection()),this.paintSelBar(this.getSelection()),this.doneQuietly("block",d,`${d.length.toLocaleString()} blocked.`),this.recordChange({kind:"block",labels:d,reason:t.reason??null,releaseAt:i??null});return}catch(h){this.setSeatsLocal(d,"free"),l=h}}this.blockFailedNow=!c.length,this.blockFailed(c.length?["Those seats were just taken"," Nothing was blocked. They are sold or in a cart now."]:["Couldn\u2019t block the seats"," The connection dropped before the change was saved. Buyers can still pick them."]),this.opts.onError?.(l)}}async unblock(e){let t=(e??this.selectionLabels()).filter(i=>this.status.get(i)==="blocked");if(!t.length||this.blockBusy)return;let s=this.blockGroups?.groups.find(i=>i.labels.includes(t[0]));this.setSeatsLocal(t,"free"),this.blockBusy=!0,this.panelAlert=null,this.paintSelBar(this.getSelection());try{await this.api.unblock(this.key,t),this.blockBusy=!1,this.clearSelection(),this.doneQuietly("unblock",t,`${t.length.toLocaleString()} ${t.length===1?"seat is":"seats are"} back on sale.`),this.recordChange({kind:"unblock",labels:t,reason:s?.reason??null,releaseAt:s?.releaseAt??null})}catch(i){this.blockBusy=!1,this.setSeatsLocal(t,"blocked"),this.blockFailed(["Couldn\u2019t put the seats back on sale"," They are still blocked. Your selection is kept; try again."]),this.opts.onError?.(i)}}blockFailed([e,t]){this.mode==="block"&&this.els.rail?.querySelector('[data-ref="blockfoot"]')?(this.panelAlert=M("error",e,t),this.paintSelBar(this.getSelection())):this.toastErr(`${e}.${t}`)}async unblockAll(){let e=[...this.status.entries()].filter(([t,s])=>s==="blocked"&&!this.reservedBy.has(t)).map(([t])=>t);if(e.length){this.setSeatsLocal(e,"free");try{let t=await this.api.unblockAll(this.key);this.clearSelection(),this.doneQuietly("unblockAll",e,`Unblocked ${t.freed} seat${t.freed===1?"":"s"}.`),this.recordChange({kind:"unblock",labels:e})}catch(t){await this.resnapshot(),this.toastErr("Couldn't mark everything for sale."),this.opts.onError?.(t)}}}async cancelBooking(e,t){let s=e.filter(i=>this.status.get(i)==="booked");if(!(!s.length||!t)){this.setSeatsLocal(s,"free");try{await this.api.unbook(this.key,s,t),this.clearSelection(),this.doneQuietly("cancelBooking",s,`Released ${s.length} booked unit${s.length===1?"":"s"}.`)}catch(i){this.setSeatsLocal(s,"booked"),this.toastErr("Couldn't release that booked inventory. Check the booking reference."),this.opts.onError?.(i)}}}async setCategory(e,t){let s=this.doc?.categories.find(o=>o.key===e),i=[...new Set(t??this.selectionLabels())].filter(o=>this.labelToSeat.has(o));if(!s||!i.length||this.categoryBusy)return;let n=s.label??s.key;this.categoryBusy=!0,this.panelAlert=null,this.paintCategorySelection(this.getSelection());try{let o=await this.withAuthRetry(()=>this.api.setCategory(this.key,i,e)),a={};for(let c of o.labels){let d=this.labelToSeat.get(c),h=this.labelToId.get(c);d&&(d.categoryKey=e),h&&(a[h]=e)}this.categoryTotalsCache=null,this.renderer?.setSeatCategories?.(a);let l=i.length-o.labels.length;l>0&&(this.panelAlert=M("warn",`${S(l)} could not move`,` They changed while you chose. The other ${o.labels.length.toLocaleString()} now sell as ${n}.`)),this.categoryBusy=!1,this.clearSelection(),this.mode==="categories"&&this.loadCategoryDifferences(),this.done("setCategory",o.labels,`${o.labels.length.toLocaleString()} ${o.labels.length===1?"seat now sells":"seats now sell"} as ${n}.`),this.recordChange({kind:"types",labels:o.labels,title:`Changed ${S(o.labels.length)} to ${n}`})}catch(o){this.categoryBusy=!1,this.mode==="categories"?(this.panelAlert=M("error","Couldn\u2019t move the seats"," Nothing changed for buyers. Your selection is kept; try again."),this.paintCategorySelection(this.getSelection())):this.toastErr("Couldn\u2019t move the seats. Nothing changed for buyers."),this.opts.onError?.(o)}}async setTableBooking(e,t,s={}){if(this.inventoryModelVersion!==2){this.toastErr("Table booking controls require inventory model 2 for this event.");return}let i=await this.saveTableBooking(e,t,s);i==="conflict"?this.toastErr("Release table seats that are in a cart, booked or blocked before changing its booking mode."):i==="failed"&&this.toastErr("Couldn't update table booking. No table mode was changed.")}async saveTableBooking(e,t,s={}){let i=[...new Set(e)].filter(Boolean);if(!i.length||this.tableBookingSaving||this.inventoryModelVersion!==2)return"skipped";this.tableBookingSaving=!0;try{let n=await this.withAuthRetry(()=>this.api.setTableBooking(this.key,i,t,s));return await this.reloadEventChart(),this.doneQuietly("setTableBooking",n.tableIds,`Updated ${n.tableIds.length.toLocaleString()} table${n.tableIds.length===1?"":"s"} to ${t==="individual"?"per-chair":t==="whole"?"whole-table":"flexible-group"} booking.`),this.recordChange({kind:"tables",labels:n.tableIds.map(o=>this.tableInfos().find(a=>a.id===o)?.label??o),title:`${n.tableIds.length===1?"A table now books":`${n.tableIds.length.toLocaleString()} tables now book`} ${t==="individual"?"by the chair":t==="whole"?"as a whole":"as a group"}`}),"ok"}catch(n){return this.opts.onError?.(n),n instanceof H&&n.code==="table_inventory_in_use"?"conflict":"failed"}finally{this.tableBookingSaving=!1}}async reloadEventChart(){let e=await this.withAuthRetry(()=>this.api.chart(this.key));this.inventoryModelVersion=e.event.inventoryModelVersion===2?2:1;let t=await this.organizerAssetUrls.prepareRendererChart(e.doc);this.renderer?.destroy(),this.renderer=null,this.doc=t,this.labelToId.clear(),this.labelToSeat.clear(),this.allIds=[],this.gaUnitLabelSet.clear(),this.tableChairIds.clear(),this.labelNames.clear(),this.status.clear(),this.counts={held:0,booked:0,blocked:0},this.serverBaseline=null,this.modelSynced=!1,this.controlRoomSettled=!1,this.lastSelectionLabels.clear(),this.selBack=[],this.selAhead=[],this.buildUnitUniverse(t),this.buildRenderer(),this.buildSectionOptions(),this.settleMode(),await Promise.all([this.resnapshot(),this.refreshControlRoom().catch(s=>this.opts.onError?.(s)),this.refreshAvailability()]),this.mode==="tables"&&this.tablesPanel?this.tablesPanel.update():this.paintRail()}selectAll(){if(this.mode==="select")return this.selectByLabels([...this.labelToSeat.values()].filter(t=>this.canSelectObject(t)).map(t=>t.label));let e=this.renderer?.selectAllSelectable()??[];return this.syncSelection(),e}applyBand(e,t,s){let i=this.renderer;if(!i?.getSelectableInSection||i.getRung?.()==="seats")return!1;if(this.bandIndex?.base!==this.sectionsBase){let a=new Map,l=new Map;for(let[d,h]of this.labelToSeat){let p=this.sectionByObject.get(h.rowId),m=this.labelToId.get(d);if(!p||!m)continue;a.set(m,p);let u=l.get(p)??{x:0,y:0,n:0};u.x+=h.x,u.y+=h.y,u.n+=1,l.set(p,u)}let c=new Map([...l].map(([d,h])=>[d,{x:h.x/h.n,y:h.y/h.n}]));this.bandIndex={base:this.sectionsBase,sectionOf:a,centre:c}}let n=new Set;for(let a of e){let l=this.bandIndex.sectionOf.get(a);l&&n.add(l)}for(let[a,l]of this.bandIndex.centre)t(l)&&n.add(a);let o=[...n].flatMap(a=>i.getSelectableInSection(a));return s?i.deselect(o.map(a=>a.id)):i.selectByLabels?.(o.map(a=>a.label)),!0}handleSeatDeselect(e){let t=this.press;t&&(t.answered=!0);let s=this.lastPick;t?.shift&&s&&s.rowId===e.rowId&&s.label!==e.label&&this.isBulkSelectMode()?(this.lastPick={label:e.label,rowId:e.rowId,at:Date.now()},this.renderer?.selectByLabels(he(this.rowSeats(e.rowId),s.label,e.label))):t&&(this.lastPick={label:e.label,rowId:e.rowId,at:Date.now()}),this.syncSelection()}rowSeats(e){return[...this.labelToSeat.values()].filter(t=>t.rowId===e)}wireGestures(e){e.addEventListener("pointerdown",t=>{this.press={shift:t.shiftKey,x:t.clientX,y:t.clientY,answered:!1}},!0),e.addEventListener("click",t=>{let s=this.press;if(!s||s.answered||!this.isBulkSelectMode()||this.renderer?.getRung?.()==="seats"||Math.hypot(t.clientX-s.x,t.clientY-s.y)>5)return;let i=this.renderer,n=e.getBoundingClientRect(),o={x:t.clientX-n.left,y:t.clientY-n.top};if(!i||i.sectionAt?.(o))return;let a=De(o,i.getMinimapSnapshot?.().sections??[],l=>i.worldToScreen(l));a&&this.handleSectionTap(a)}),e.addEventListener("dblclick",()=>{let t=this.lastPick;!t||Date.now()-t.at>700||(this.isBulkSelectMode()?(this.renderer?.selectByLabels(this.rowSeats(t.rowId).map(s=>s.label)),this.syncSelection()):this.mode==="view"&&this.showLabels([t.label]))})}handleSectionTap(e){if(this.press&&(this.press.answered=!0),this.mode==="filterSections"){let t=this.filterableSections().find(s=>s.id===e);t&&this.setFilteredSection(t.label);return}if(this.isBulkSelectMode()&&this.renderer?.getRung?.()!=="seats"){let t=Date.now(),s=this.lastSectionTap?.id===e&&t-this.lastSectionTap.at<450;this.lastSectionTap=s?null:{id:e,at:t},s||this.selectSection(e);return}this.renderer?.focusSection(e),this.channels?.handleSectionFocus(e),this.sectionsPanel?.pick(e)}selectSection(e){if(!this.renderer)return[];let t=this.renderer.getSelectableInSection(e);return this.renderer.selectByLabels(t.map(s=>s.label)),this.syncSelection(),this.renderer.getSelection()}setFilteredSection(e){let t=e.trim(),s=this.filterableSections().filter(o=>o.label===t);if(!s.length)throw new Error(`Unknown event section: ${e}`);let i=t!==this.filteredSectionLabel;this.filteredSectionLabel=t,this.mode==="filterSections"&&(this.applyFilteredSectionCanvas(s),this.renderFilterSectionsRail());let n=s.map(({id:o,label:a,seatCount:l,zone:c})=>({id:o,label:a,seatCount:l,...c?{zone:c}:{}}));return i&&this.opts.onFilteredSectionChange?.(n),n}focusSection(e){let t=e.trim(),s=this.filterableSections().filter(i=>i.label===t);return!this.renderer||!s.length?[]:(this.frameSections(s),s.map(({id:i,label:n,seatCount:o,zone:a})=>({id:i,label:n,seatCount:o,...a?{zone:a}:{}})))}clearFilteredSection(){let e=this.filteredSectionLabel!==null;this.filteredSectionLabel=null,this.renderer?.setDimmedSections(null),this.renderer?.clearSectionFocus(),this.renderer?.zoomToFit(),this.mode==="filterSections"&&this.renderFilterSectionsRail(),e&&this.opts.onFilteredSectionChange?.([])}getFilteredSections(){return this.filteredSectionLabel?this.filterableSections().filter(e=>e.label===this.filteredSectionLabel).map(({id:e,label:t,seatCount:s,zone:i})=>({id:e,label:t,seatCount:s,...i?{zone:i}:{}})):[]}selectByLabels(e){let t=e;if(this.mode==="select"){let s=new Set(this.selectionLabels()),i=this.selectionCap(),n=[...new Set(e)].filter(a=>!s.has(a)).map(a=>this.labelToSeat.get(a)).filter(a=>!!a&&this.canSelectObject(a)),o=Math.max(0,i-s.size);n.length>o&&this.opts.onSelectionLimit?.(i),t=n.slice(0,o).map(a=>a.label)}return this.renderer?.selectByLabels(t),this.syncSelection(),this.getSelection()}selectObjects(e){return this.selectByLabels(e)}deselectObjects(e){let t=e.map(s=>this.labelToId.get(s)).filter(s=>!!s);return this.renderer?.deselect(t),this.syncSelection(),this.getSelection()}selectCategories(e){let t=new Set(e);return this.selectByLabels([...this.labelToSeat.values()].filter(s=>t.has(s.categoryKey)).map(s=>s.label))}deselectCategories(e){let t=new Set(e);return this.deselectObjects(this.getSelection().filter(s=>t.has(s.categoryKey)).map(s=>s.label))}setSelectableObjects(e){this.opts.selectableObjects=[...e],this.selectableObjectLabels=new Set(e),this.reconcileSelectPolicy()}setUnavailableObjects(e,t){this.opts.unavailableObjectsReason=t;let s=new Set(e),i=[...s].filter(o=>!this.unavailableLabels.has(o)).concat([...this.unavailableLabels].filter(o=>!s.has(o)));if(!i.length)return;if(this.opts.unavailableObjects=[...s],this.unavailableLabels=s,this.renderer){let o=new Map;for(let a of i){let l=this.paintIds(a);if(!l.length)continue;let c=this.renderStatusOf(a,this.status.get(a)??"free");o.set(c,[...o.get(c)??[],...l])}for(let[a,l]of o)this.renderer.setStatus(l,a);this.afterPaint()}let n=this.getSelection().filter(o=>this.isHostUnavailable(o.label));n.length&&(this.renderer?.deselect(n.map(o=>o.id)),this.syncSelection())}setCategoryPrices(e){this.opts.categoryPrices=e,this.renderer?.setCategoryPriceRanges(this.hoverPriceRanges())}hoverPriceRanges(){let e=this.opts.categoryPrices;return e==null?e:Object.fromEntries(Object.entries(e).map(([t,s])=>[t,typeof s=="number"?{min:s,max:s}:{min:s.min,max:s.max}]))}setUnavailableObjectsSelectable(e){this.opts.unavailableObjectsSelectable=e,this.reconcileSelectPolicy()}setObjectSelectable(e){this.opts.isObjectSelectable=e,this.reconcileSelectPolicy()}setMaxSelectedObjects(e){this.assertSelectionOptions(e,this.opts.numberOfPlacesToSelect),this.opts.maxSelectedObjects=e,this.trimSelectionToCap(),this.updateRendererInteraction(),this.syncSelection()}setNumberOfPlacesToSelect(e){this.assertSelectionOptions(this.opts.maxSelectedObjects,e),this.opts.numberOfPlacesToSelect=e,this.selectionWasValid=null,this.trimSelectionToCap(),this.updateRendererInteraction(),this.syncSelection()}getSelectionValidity(){let e=this.opts.numberOfPlacesToSelect;if(e===void 0)return null;let t=this.getSelection(),s=t.length;return{isValid:s===e,count:s,required:e,remaining:Math.max(0,e-s),objects:t}}clearSelection(){this.renderer?.clearSelection(),this.syncSelection()}stepSelection(e){let s=(e<0?this.selBack:this.selAhead).pop();if(!s||!this.renderer)return!1;(e<0?this.selAhead:this.selBack).push([...this.lastSelectionLabels]),this.selRestoring=!0;try{this.renderer.clearSelection();let i=s.filter(n=>this.labelToSeat.has(n));i.length&&this.renderer.selectByLabels(i),this.syncSelection()}finally{this.selRestoring=!1}return!0}getSelection(){return this.renderer?.getSelection?.()??[]}getReport(){return this.api.report(this.key).then(e=>(this.applyReportRevenue(e),e))}getControlRoomSnapshot(e=this.trendWindowMinutes){return this.setTrendWindow(e)}getConnection(){return{status:this.connectionStatus,lastMessageAt:this.lastMessageAt,room:this.roomState()}}getLog(e={}){return this.api.log(this.key,e)}async setHoldTtl(e){try{await this.api.setHoldTtl(this.key,e),this.done("setHoldTtl",[],e?`Hold window set to ${Math.round(e/6e4)} min.`:"Hold window reset.")}catch(t){this.toastErr("Couldn't update the hold window."),this.opts.onError?.(t)}}zoomToFit(){if(this.mode==="filterSections"&&this.filteredSectionLabel){this.clearFilteredSection();return}this.renderer?.clearSectionFocus(),this.renderer?.zoomToFit()}zoomOutStep(){let e=this.renderer;if(!e)return;if(!e.zoomOutLevel)return void e.zoomOut();let t=!!e.getFocusedSection?.();e.zoomOutLevel()==="venue"&&t&&e.clearSectionFocus()}paintMapChrome(){let e=this.renderer;if(!e||!this.els.crumb)return;let t=e.getFocusedSection?.()??null,s=t?e.getMinimapSnapshot?.().sections.find(a=>a.id===t)??null:null,i=e.getFloors?.()??[],n=i.length>1?e.isFloorOverview?.()?"All floors":i.find(a=>a.id===e.getActiveFloorId?.())?.name??null:null,o=e.getRung?.()==="seats";o!==this.legendSeats&&(this.legendSeats=o,this.paintColourLegend()),ot(this.els,st({focused:s?{label:s.label,free:s.free,total:s.total,allBlocked:s.free?void 0:this.sectionKeptAside(s.id)}:null,floor:n,seatsRevealed:e.seatsRevealed?.()??!0,atVenueFit:e.atVenueFit?.(),atCeiling:e.canZoomIn?.()===!1||e.seatsPickable?.()===!0}))}sectionKeptAside(e){let t=this.filterableSections().find(n=>n.id===e);if(!t)return;let s=0,i=0;for(let n of t.seatLabels){let o=this.status.get(n)??"free";if(o==="free"||o==="held")return;o==="blocked"&&(this.reservedBy.has(n)?i++:s++)}return s&&i?"both":i?"reserved":s?"blocked":void 0}sectionTypeKeys(){if(this.typeKeyBySection&&this.typeKeyBase===this.sectionsBase)return this.typeKeyBySection;let e=new Map;for(let t of this.filterableSections()){let s=new Map;for(let n of t.seatLabels){let o=this.labelToSeat.get(n)?.categoryKey;o&&s.set(o,(s.get(o)??0)+1)}let i=null;for(let[n,o]of s)(!i||o>s.get(i))&&(i=n);i&&e.set(t.id,i)}return this.typeKeyBySection=e,this.typeKeyBase=this.sectionsBase,e}sectionTypeTint(e){let t=this.sectionTypeKeys().get(e);return t?this.renderer?.categoryDisplayColor?.(t)??null:null}scheduleReservations(e=400){this.closed||this.reservationsTimer||(this.reservationsTimer=setTimeout(()=>{this.reservationsTimer=null,this.refreshReservations()},e))}async refreshReservations(){if(!(this.closed||!this.toolAvailable("reserve")))try{let e=await this.withAuthRetry(()=>this.api.eventRequest(this.key,"reservations"));this.closed||this.setReservations(e.reservations??[]),this.blockGroups=null,this.findBlocked?.refresh()}catch{}}setReservations(e){let t=new Map;for(let o of e){let a=o.createdByYou?"you":o.createdByName??"",l=o.createdAt?w(o.createdAt,{day:"numeric",month:"short"}):"",c=[a,l].filter(Boolean).join(" \xB7 ")||void 0;for(let d of o.labels)t.set(d,{id:o.id,name:o.name,releaseAt:o.releaseAt,count:o.labels.length,by:c})}let s=new Set;for(let o of t.keys())this.reservedBy.has(o)||s.add(o);for(let o of this.reservedBy.keys())t.has(o)||s.add(o);this.reservedBy=t,this.reservationsLoaded=!0;let i=this.serverBaseline?.client;i&&i.reserved===null&&(i.reserved=this.reservedBlockedCount());for(let o of t.keys())this.reserving.delete(o);this.reservedIds=new Set([...t.keys()].flatMap(o=>this.paintIds(o)));let n=[...s].filter(o=>this.status.get(o)==="blocked").flatMap(o=>this.paintIds(o));n.length&&this.renderer&&(this.renderer.setStatus(n,B("booked")),this.renderer.setStatus(n,B("blocked"))),this.paintColourLegend(),this.paintMapChrome()}async loadBlockGroups(){if(this.blockGroups&&Date.now()-this.blockGroups.at<3e4)return this.blockGroups.groups;let e=await this.withAuthRetry(()=>this.api.eventRequest(this.key,"blocks"));return this.blockGroups={at:Date.now(),groups:e.groups??[]},this.blockGroups.groups}reservedBlockedCount(){let e=0;for(let t of this.reservedBy.keys())this.status.get(t)==="blocked"&&(e+=this.seatWeight(t));return e}reservedTally(e){let t=this.reservedBlockedCount(),s=this.serverBaseline,i=s?.server.reserved,n=s?.client?.reserved,o=i===void 0?t:i+(n==null?0:t-n);return Math.min(e,Math.max(0,o))}paintColourLegend(){let e=this.els.blocklegend;if(!e||!this.renderer)return;let t=this.getColourBy(),s=this.buildTallies();ct(e,{colourBy:t,seats:this.legendSeats??this.renderer.getRung?.()==="seats",types:t==="type"?this.legendTypes():[],counts:{free:s.free,held:s.held,booked:s.booked,blocked:s.blocked,reserved:this.reservedTally(s.blocked)},lit:this.litChip,shown:this.litChip==="shown"&&this.shownObjects?{name:this.shownObjects.name,count:this.shownObjects.labels.length}:null,channels:t==="channel"?this.channels?.legendChannels()??[]:[],channelAvailable:this.channelColoursAvailable()})}showObjects(e,t="Seats"){let s=(e??[]).filter(i=>this.labelToSeat.has(i));this.shownObjects=s.length?{name:t,labels:s}:null,this.litChip=this.shownObjects?"shown":this.litChip==="shown"?null:this.litChip,this.highlightLabels(this.litChip?this.chipLabels(this.litChip):null),this.shownObjects&&this.frameLabels(s),this.paintColourLegend()}chipLabels(e){if(e==="shown")return this.shownObjects?.labels??[];let t=[...this.labelToSeat.keys()];if(e.startsWith("type:")){let s=e.slice(5);return t.filter(i=>this.labelToSeat.get(i).categoryKey===s)}return e==="reserved"?t.filter(s=>this.reservedBy.has(s)):t.filter(s=>(this.status.get(s)??"free")===e&&(e!=="blocked"||!this.reservedBy.has(s)))}onLegendChip(e,t){let s=this.chipLabels(e);if(t&&(this.isBulkSelectMode()||this.mode==="select")){let i=this.getSelection().length;this.selectByLabels(s);let n=this.getSelection().length-i,o=s.length-n-i;o>0&&this.toast(`${n.toLocaleString()} picked. ${o.toLocaleString()} skipped: this task can\u2019t change them.`,"ok");return}this.litChip=this.litChip===e?null:e,this.highlightLabels(this.litChip?s:null),this.paintColourLegend()}legendTypes(){let e=new Map;for(let t of this.labelToSeat.values())e.set(t.categoryKey,(e.get(t.categoryKey)??0)+1);for(let[t,s]of this.status){if(s==="free")continue;let i=this.labelToSeat.get(t)?.categoryKey;i&&e.has(i)&&e.set(i,e.get(i)-1)}return(this.doc?.categories??[]).filter(t=>e.has(t.key)).map(t=>({key:t.key,label:t.label,color:this.renderer?.categoryDisplayColor?.(t.key)??t.color,free:Math.max(0,e.get(t.key))}))}refreshBlockPaint(){this.renderer?.refreshBlockPaint?.(),this.minimap?.refreshMinimap()}mapCamera(){return{getViewport:()=>{let e=this.renderer;return!e?.getVisibleWorldRect||!e.getWorldBounds?null:{visible:e.getVisibleWorldRect(),bounds:e.getWorldBounds()}},getMinimapSnapshot:()=>this.renderer?.getMinimapSnapshot?.()??{sections:[],seats:[]},panToWorld:e=>{this.setFollowLive(!1),this.renderer?.panToWorld?.(e)},clearSectionFocus:()=>this.renderer?.clearSectionFocus?.(),focusSection:e=>{this.setFollowLive(!1),this.renderer?.focusSection(e),this.channels?.handleSectionFocus(e)},overview:()=>{this.setFollowLive(!1),this.zoomToFit()},getFloors:()=>this.renderer?.getFloors?.()??[],getActiveFloorId:()=>this.renderer?.getActiveFloorId?.()??"",isFloorOverview:()=>this.renderer?.isFloorOverview?.()??!1,getRenderer:()=>this.renderer}}syncMinimap(){let e=this.els.minimapMount,t=!!this.root?.classList.contains("compact");if(!e||!this.renderer||t){this.minimap?.dispose(),this.minimap=null;return}if(this.minimap){this.minimap.refreshMinimap();return}this.minimap=Le({controller:this.mapCamera(),root:()=>this.root,cssVar:s=>this.cssVar(s.replace(/^--sl-/,"--slm-")),focusedSectionLabel:()=>{},tint:s=>this.renderer?.categoryDisplayColor?.(s)||void 0},e),this.minimap.refreshMinimap()}cssVar(e){return this.root?getComputedStyle(this.root).getPropertyValue(e).trim():""}destroy(){if(this.selectObserver?.disconnect(),this.closed=!0,this.minimap?.dispose(),this.minimap=null,this.monitorRefreshTimer&&clearTimeout(this.monitorRefreshTimer),this.monitorRefreshTimer=null,this.reconnectTimer&&clearTimeout(this.reconnectTimer),this.stopKeepalive(),this.alerts?.destroy(),this.alerts=null,this.linkTimers&&this.linkTimers.forEach(e=>clearTimeout(e)),this.feedTimer&&clearInterval(this.feedTimer),this.toastTimer&&clearTimeout(this.toastTimer),this.liveEventTimer&&clearTimeout(this.liveEventTimer),this.reservationsTimer&&clearTimeout(this.reservationsTimer),this.kpiCleanupTimer&&clearTimeout(this.kpiCleanupTimer),this.followLiveTimer&&clearTimeout(this.followLiveTimer),this.followSeatTimer&&clearTimeout(this.followSeatTimer),this.paintHandle!==null&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(this.paintHandle),this.paintHandle=null,this.channels?.destroy(),this.channels=null,this.channelsLoading=null,this.tokenRefreshTimer&&clearTimeout(this.tokenRefreshTimer),this.layoutObserver?.disconnect(),this.layoutObserver=null,this.colorSchemeStop?.(),this.colorSchemeStop=null,this.root?.removeEventListener("keydown",this.onKeyDown),this.els.rail?.removeEventListener("click",this.onRailClick),this.root?.removeEventListener("click",this.onHowClick),typeof document<"u"&&document.removeEventListener("fullscreenchange",this.onFullscreenChange),this.ws){try{this.ws.close()}catch{}this.ws=null}this.reserve?.destroy(),this.reserve=null,this.seatHistoryPanel?.destroy(),this.seatHistoryPanel=null,this.changes?.destroy(),this.changes=null,this.saved?.destroy(),this.saved=null;for(let e of this.arrival)e.destroy();this.arrival=[],this.activityPanel?.destroy(),this.activityPanel=null,this.navigation?.destroy(),this.navigation=null,this.renderer?.destroy(),this.renderer=null,this.organizerAssetUrls.dispose(),this.root&&this.root.parentNode===this.host&&this.host.removeChild(this.root)}buildRenderer(){if(!this.doc)return;let e=this.isBulkSelectMode();this.renderer=new ws(this.mapHost,{manageMode:!0,organizerGlyph:{apply:(t,s,i,n)=>{let o=s==="cross"?mt(t):void 0;if(o&&this.reservedIds.has(o)){Mt(t),pt(t,n);return}be(t),Ss(t,s,i,n)},clear:t=>{be(t),Mt(t)},isPainted:t=>Ls(t)||ee(t)},marqueeSelect:e&&!this.movingMap,marqueeShape:this.marqueeShape,rowLabelSelect:this.rowLabelSelectable(),maxSelection:this.selectionCap(),selectableStatuses:this.selectableStatuses(),currency:this.currency,onSelect:t=>this.handleSeatSelect(t),onDeselect:t=>this.handleSeatDeselect(t),onSelectionLimit:t=>this.opts.onSelectionLimit?.(t),onMarquee:()=>this.mode==="select"?this.reconcileSelectPolicy():this.syncSelection(),onBand:(t,s,i)=>this.applyBand(t,s,i),onGAClick:t=>{if(this.mode!=="select"||!this.opts.onAreaClick||!this.doc)return;let s=Ct(this.doc).find(i=>i.id===t);s&&this.opts.onAreaClick({id:s.id,label:s.label,name:s.displayLabel?.trim()||s.label})},onSectionTap:t=>this.handleSectionTap(t),onViewChange:()=>{this.updateZoomHint(),this.paintMapChrome(),this.minimap?.drawMinimapRect(),this.channels?.handleViewChange()},onFocusedSectionChange:()=>{this.paintMapChrome(),this.minimap?.refreshMinimap()},hoverFacts:t=>this.hoverFactsFor(t),blockPaint:t=>lt(t,{rule:this.availabilityRules[t.id],hiddenNow:this.effectiveHidden.has(t.id),closedNow:this.effectiveClosed.has(t.id),colourBy:this.getColourBy(),typeTint:this.sectionTypeTint(t.id),allBlocked:t.state==="sold-out"?this.sectionKeptAside(t.id):void 0}),openAtSectionsWhenDense:!0}),this.renderer.setCategoryPriceRanges(this.hoverPriceRanges()),this.renderer.setChart(this.themedDoc()),this.chromeClearance=-1,this.applyChromeClearance(),this.legendInset="",this.applyLegendInset(),this.repaintAll(),this.applyHeatOverlay(),this.applyMapView(),this.updateZoomHint(),this.minimap?.dispose(),this.minimap=null,this.syncMinimap(),this.paintMapChrome()}hoverFactsFor(e){let t=[...this.labelToSeat.values()].find(m=>m.id===e);if(!t)return null;let s=this.status.get(t.label)??"free",i={free:"Free",held:"In a cart",booked:"Booked",blocked:"Blocked"},n=s==="free"&&this.isHostUnavailable(t.label),o=n?this.opts.unavailableObjectsReason?.trim()||"Unavailable":i[s],a=s==="blocked"?this.reservedBy.get(t.label):void 0;if(a){let m=a.releaseAt==null?"No end":w(a.releaseAt,{weekday:"short",day:"numeric",month:"short",hour:"2-digit",minute:"2-digit"});return[{caption:"Reserved for",value:a.name},{caption:"Until",value:m},{caption:"Reservation",value:`${S(a.count)}`}]}let l=[{caption:"Status",value:o}],c=this.channels?.channelNameForLabel(t.label)??null;c&&l.push({caption:"Channel",value:c});let d=this.sectionByObject.get(t.rowId)??k,h=this.doc?.categories.find(m=>m.key===t.categoryKey),p=s==="free"&&!n&&!this.effectiveHidden.has(d)&&!this.effectiveClosed.has(d)&&h?.notForSale!==!0;return l.push({caption:"For sale",value:p?"Yes":s==="free"&&!n?"No":"\u2014"}),l}rowLabelSelectable(){return this.isBulkSelectMode()||this.mode==="select"}isBulkSelectMode(){return this.mode==="block"||this.mode==="reserve"||this.mode==="categories"||this.mode==="channels"&&this.channels?.usesMarqueeSelection()===!0}selectableStatuses(){return this.mode==="block"?["free","not_for_sale"]:this.mode==="reserve"?["free"]:this.mode==="select"||this.mode==="categories"||this.mode==="inspect"||this.mode==="view"||this.isBulkSelectMode()||this.mode==="channels"&&this.channels?.canSelect()===!0?["free","held","booked","not_for_sale"]:[]}updateRendererInteraction(){let e=this.isBulkSelectMode();this.renderer?.setManageInteraction({manageMode:!0,organizerStatus:this.mode!=="channels",marqueeSelect:e&&!this.movingMap,marqueeShape:this.marqueeShape,rowLabelSelect:this.rowLabelSelectable(),maxSelection:this.selectionCap(),selectableStatuses:this.selectableStatuses()}),this.navigation?.update(e),this.updateZoomHint()}handleSeatSelect(e){let t=this.press;t&&(t.answered=!0);let s=this.lastPick;if(this.lastPick={label:e.label,rowId:e.rowId,at:Date.now()},t?.shift&&s&&s.rowId===e.rowId&&s.label!==e.label&&this.isBulkSelectMode()&&this.renderer?.selectByLabels(he(this.rowSeats(e.rowId),s.label,e.label)),this.mode==="select"&&!this.canSelectObject(e)){this.renderer?.deselect([e.id]),this.syncSelection();return}if(this.mode==="inspect"||this.mode==="view"){let i=this.getSelection().filter(n=>n.id!==e.id).map(n=>n.id);i.length&&this.renderer?.deselect(i)}this.syncSelection()}buildUnitUniverse(e){this.categoryTotalsCache=null;let t=new Map;for(let i of Ms(e))i.type==="table"&&t.set(i.id,i.label);let s=new Map;for(let i of Ts(e))if(this.labelToId.set(i.label,i.id),this.labelToSeat.set(i.label,i),this.allIds.push(i.id),t.has(i.rowId)){let n=s.get(i.rowId)??[];n.push(i.id),s.set(i.rowId,n)}for(let[i,n]of s){let o=t.get(i);this.labelToId.has(o)||this.tableChairIds.set(o,n)}for(let i of Ct(e)){let n=i.displayLabel||i.label;for(let o of Rs(i))this.labelToId.has(o)||(this.gaUnitLabelSet.add(o),this.labelNames.set(o,n))}}unitTotal(){return this.allIds.length+this.gaUnitLabelSet.size}paintIds(e){let t=this.labelToId.get(e);return t?[t]:this.tableChairIds.get(e)??[]}knownLabels(){return[...this.labelToId.keys(),...this.gaUnitLabelSet]}repaintAll(){let e=this.renderer;if(!e)return;this.allIds.length&&e.setStatus(this.allIds,"free");let t={free:[],held:[],booked:[],not_for_sale:[]};for(let[s,i]of this.status.entries())t[this.renderStatusOf(s,i)].push(...this.paintIds(s));for(let s of this.unavailableLabels)this.status.has(s)||t.held.push(...this.paintIds(s));["held","booked","not_for_sale"].forEach(s=>{t[s].length&&e.setStatus(t[s],s)})}async connect(){if(this.closed||this.sessionEnded)return;let e;try{if(e=(await this.withAuthRetry(()=>this.api.subscribeTicket(this.key))).protocols,!e.length)throw new Error("manage_subscribe_ticket_missing")}catch(s){this.setLive(!1),this.opts.onError?.(s),this.scheduleReconnect();return}if(this.closed)return;let t;try{t=new WebSocket(this.api.socketUrl(this.key),e)}catch(s){this.opts.onError?.(s),this.scheduleReconnect();return}this.ws=t,this.socketSnapshotSeen=!1,t.onopen=()=>{this.attempt=0,this.setLive(!0),this.startKeepalive(t),this.resnapshot().then(()=>this.refreshControlRoom()).catch(s=>this.opts.onError?.(s)),this.refreshAvailability()},t.onmessage=s=>this.onMessage(s),t.onclose=()=>{this.ws===t&&(this.ws=null),this.stopKeepalive(),this.setLive(!1),this.scheduleReconnect()},t.onerror=()=>{try{t.close()}catch{}}}startKeepalive(e){this.stopKeepalive(),this.pingTimer=setInterval(()=>{if(this.ws===e){try{e.send(JSON.stringify({type:"ping"}))}catch{return}this.pongTimer||(this.pongTimer=setTimeout(()=>{if(this.pongTimer=null,this.ws===e){e.onclose=null,e.onmessage=null;try{e.close()}catch{}this.ws=null,this.stopKeepalive(),this.setLive(!1),this.paintLink("paused"),this.scheduleReconnect()}},5e3))}},1e4)}stopKeepalive(){this.pingTimer&&clearInterval(this.pingTimer),this.pongTimer&&clearTimeout(this.pongTimer),this.pingTimer=null,this.pongTimer=null}scheduleReconnect(){if(this.closed||this.sessionEnded||this.reconnectTimer)return;let e=Math.min(1e3*2**Math.min(this.attempt++,5),15e3);this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.connect()},e)}onMessage(e){let t;try{t=JSON.parse(typeof e.data=="string"?e.data:"")}catch{return}if(!t||typeof t!="object"||(this.pongTimer&&(clearTimeout(this.pongTimer),this.pongTimer=null),t.type==="pong"))return;this.lastMessageAt=Date.now();let s=t;if((Array.isArray(s.hidden)||Array.isArray(s.closed))&&this.updateEffectiveAvailability(s.hidden,s.closed),s.type==="presence"){typeof s.shoppingSessions=="number"&&typeof s.activeHolds=="number"&&(this.livePresence={at:Date.now(),value:{shoppingSessions:s.shoppingSessions,activeHolds:s.activeHolds}},this.controlRoomSnapshot&&(this.controlRoomSnapshot={...this.controlRoomSnapshot,presence:this.livePresence.value},this.opts.onControlRoom?.(this.controlRoomSnapshot)),this.lastSyncedAt=Date.now(),this.recomputeTallies(),this.paintMonitorInsights());return}if(s.type!=="hidden"){if(s.seats&&typeof s.seats=="object")this.applySocketSnapshot(s.seats,typeof s.default=="string"?s.default:void 0);else if(Array.isArray(s.changes)){let i=[],n=new Map;for(let a of s.changes){let l=ve(a.status),c=this.status.get(a.label)??"free";if(c===l)continue;(c==="blocked"||l==="blocked")&&this.scheduleReservations(),this.setStatusLabel(a.label,l,c);let d=this.paintIds(a.label);d.length&&(this.renderer?.setStatus(d,this.renderStatusOf(a.label,l)),i.push(...d));let h=this.verbFor(c,l,a.label),p=`${h}:${l}`,m=n.get(p)??{labels:[],verb:h,status:l};m.labels.push(a.label),n.set(p,m)}for(let a of n.values()){let l=this.pushActivity(a.labels,a.verb,a.status);l&&this.paintSpatialActivity(l)}n.size&&this.scheduleMonitorRefresh(),i.length&&(this.lastSyncedAt=Date.now(),this.afterPaint()),this.reconcileSelectionWithStatus([...n.values()].flatMap(a=>a.labels));let o=typeof s.bookedValue?.gross=="number"?s.bookedValue.gross:s.revenue?.gross;typeof o=="number"&&Number.isFinite(o)&&this.applyLiveGross(o),this.recomputeTallies()}}}applyLiveGross(e){if(this.liveGross={at:Date.now(),value:e},this.authoritativeGrossRevenue=e,this.revenueStatus="current",this.controlRoomSnapshot){let s={...this.controlRoomSnapshot.bookedValue??this.controlRoomSnapshot.revenue,gross:e};this.controlRoomSnapshot={...this.controlRoomSnapshot,bookedValue:s,revenue:s},this.opts.onControlRoom?.(this.controlRoomSnapshot)}}setStatusLabel(e,t,s=this.status.get(e)??"free"){if(this.status.set(e,t),s===t)return;let i=this.seatWeight(e);if(s!=="free"&&(this.counts[s]-=i),t!=="free"&&(this.counts[t]+=i),this.alerts){let n=this.labelToSeat.get(e);this.alerts.seatChanged(n?this.sectionByObject.get(n.rowId)??null:null,s,t)}}applySocketSnapshot(e,t){let s=this.socketSnapshotSeen?this.status:null;if(this.applySnapshot(e,t),this.socketSnapshotSeen=!0,!s)return;let i=new Map;for(let n of new Set([...s.keys(),...this.status.keys()])){let o=s.get(n)??"free",a=this.status.get(n)??"free";if(o===a)continue;let l=this.verbFor(o,a,n),c=`${l}:${a}`,d=i.get(c)??{labels:[],verb:l,status:a};d.labels.push(n),i.set(c,d)}for(let n of i.values()){let o=this.pushActivity(n.labels,n.verb,n.status);o&&this.paintSpatialActivity(o)}i.size&&this.scheduleMonitorRefresh()}scheduleMonitorRefresh(){this.monitorRefreshTimer||(this.monitorRefreshTimer=setTimeout(()=>{this.monitorRefreshTimer=null,!this.closed&&(this.refreshControlRoom().catch(e=>this.opts.onError?.(e)),this.paintFullscreenLine(),this.tablesPanel?.update(),this.sectionsPanel?.update())},150))}async resnapshot(){try{let e=await this.api.objects(this.key);this.applySnapshot(e.seats),this.updateEffectiveAvailability(e.hidden,e.closed),this.lastMessageAt=Date.now()}catch{}}applySnapshot(e,t){let s=new Map;if(t!==void 0){let i=ve(t);for(let n of this.knownLabels())s.set(n,i)}for(let[i,n]of Object.entries(e))s.set(i,ve(n));this.status=s,this.recountAll(),this.serverBaseline&&!this.serverBaseline.client&&(this.serverBaseline.client=this.pairedClient()),this.modelSynced=!0,this.scheduleReservations(),this.lastSyncedAt=Date.now(),this.repaintAll(),this.afterPaint(),this.recomputeTallies(),this.reconcileSelectionWithStatus(null)}reconcileSelectionWithStatus(e){if(!this.renderer)return;let t=this.getSelection();if(!t.length)return;if(e){let n=new Set(e);if(!t.some(o=>n.has(o.label)))return}if(this.mode==="select"){this.reconcileSelectPolicy();return}let s=new Set(this.selectableStatuses()),i=t.filter(n=>!s.has(this.renderStatusOf(n.label,this.status.get(n.label)??"free")));i.length&&this.renderer.deselect(i.map(n=>n.id)),this.syncSelection()}recountAll(){let e={held:0,booked:0,blocked:0};for(let[t,s]of this.status)s!=="free"&&(e[s]+=this.seatWeight(t));this.counts=e}seatWeight(e){return this.tableChairIds.get(e)?.length??1}setSeatsLocal(e,t){let s=[],i=[];for(let n of e)this.setStatusLabel(n,t),(this.renderStatusOf(n,t)===B(t)?s:i).push(...this.paintIds(n));s.length&&this.renderer?.setStatus(s,B(t)),i.length&&this.renderer?.setStatus(i,"held"),this.afterPaint(),this.recomputeTallies()}afterPaint(){this.keepLive&&typeof document<"u"&&document.hidden&&this.renderer?.forceDraw()}activityColor(e){return e==="held"?E.held:e==="booked"?E.booked:e==="blocked"?E.blocked:E.free}sectionsForLabels(e){let t=new Set;for(let i of e){let n=this.labelToSeat.get(i);if(!n)continue;let o=this.sectionByObject.get(n.rowId);o&&o!==k&&t.add(o)}let s=[...t];return{ids:s,labels:s.map(i=>this.sectionLabelById.get(i)??i)}}pulseSeatLabels(e,t){let s=this.activityColor(t);for(let i of e.slice(0,Et)){let n=this.labelToId.get(i);n&&this.renderer?.flashSeat(n,s)}}paintSpatialActivity(e){let t=e.sectionIds??this.sectionsForLabels(e.labels).ids,s=this.renderer?.getFocusedSection()??null;if(this.followLive&&t.length===1&&(e.status==="held"||e.status==="booked")){let n=this.root?.querySelector('[data-ref="followstatus"]');n&&(n.textContent=`Following ${e.labels.length===1?this.labelNames.get(e.labels[0])??e.labels[0]:`${e.labels.length} seats`} \xB7 ${e.status}`),this.followLiveTimer&&clearTimeout(this.followLiveTimer),this.followSeatTimer&&clearTimeout(this.followSeatTimer),this.followLiveTimer=setTimeout(()=>{this.followLiveTimer=null,this.focusActivitySeats(e.labels,t[0]),this.followSeatTimer=setTimeout(()=>{this.followSeatTimer=null,this.pulseSeatLabels(e.labels,e.status)},520)},220);return}if(!s&&t.length){let n=this.activityColor(e.status);for(let o of t.slice(0,Rt))this.renderer?.flashSection(o,n);return}(!t.length||s&&t.includes(s))&&this.pulseSeatLabels(e.labels,e.status)}locateSection(e){this.renderer?.focusSection(e)}focusActivitySeats(e,t){this.renderer?.focusSection(t);let s=e.slice(0,Et).map(l=>this.labelToSeat.get(l)).filter(l=>!!l);if(!s.length)return;let i=s.map(l=>l.x),n=s.map(l=>l.y),o=Math.min(...i),a=Math.min(...n);this.renderer?.focusRegion({x:o-150,y:a-100,width:Math.max(...i)-o+300,height:Math.max(...n)-a+200})}locateActivity(e){let t=this.feed.find(i=>i.id===e);if(!t)return;let s=t.sectionIds??this.sectionsForLabels(t.labels).ids;if(this.followSeatTimer&&clearTimeout(this.followSeatTimer),s.length===1){this.focusActivitySeats(t.labels,s[0]),this.followSeatTimer=setTimeout(()=>{this.followSeatTimer=null,this.pulseSeatLabels(t.labels,t.status)},520);return}this.zoomToFit(),this.followSeatTimer=setTimeout(()=>{if(this.followSeatTimer=null,s.length){let i=this.activityColor(t.status);for(let n of s.slice(0,Rt))this.renderer?.flashSection(n,i)}else this.pulseSeatLabels(t.labels,t.status)},280)}showLiveEvent(e){let t=this.els.liveevent;if(!t)return;let s=e.sectionLabels??[],i=s.length===1?s[0]:s.length>1?`${s.length} sections`:this.labelNames.get(e.label)??e.label,n=e.count===1?"seat":"seats";t.innerHTML=`<span class="slm-liveeventdot" style="background:${this.activityColor(e.status)}"></span>
733
+ <span class="slm-liveeventcopy">${f(i)} \xB7 ${e.count.toLocaleString()} ${n} ${f(Fe(e.verb))}</span>
734
+ <span class="slm-liveeventhint">Live</span>`,t.classList.add("on"),this.liveEventTimer&&clearTimeout(this.liveEventTimer),this.liveEventTimer=setTimeout(()=>{this.liveEventTimer=null,t.classList.remove("on"),t.innerHTML=""},2800)}applyReportRevenue(e){this.authoritativeGrossRevenue=e.report.byCategory.reduce((t,s)=>{let i=Number.isFinite(s.bookedValue)?s.bookedValue:s.bookedRevenue;return t+(Number.isFinite(i)?i:0)},0),this.revenueStatus="current",this.recomputeTallies()}async refreshControlRoom(){let e=++this.revenueRequest,t=Date.now();try{let s=await this.api.controlRoom(this.key,this.trendWindowMinutes),i=s.bookedValue??s.revenue??{gross:0,bySection:[]},n=(i.bySection??[]).map(l=>{let c=Number.isFinite(l.bookedValue)?l.bookedValue:l.bookedRevenue;return{...l,bookedValue:c??0,bookedRevenue:c??0}}),o={...i,bySection:n},a={...s,bookedValue:o,revenue:o};if(e===this.revenueRequest){if(this.livePresence&&this.livePresence.at>=t?a={...a,presence:this.livePresence.value}:this.livePresence=null,this.liveGross&&this.liveGross.at>=t){let d={...a.bookedValue,gross:this.liveGross.value};a={...a,bookedValue:d,revenue:d}}else this.liveGross=null;this.controlRoomSnapshot=a,this.adoptLabelNames(a.displayLabels),a.activity&&this.seedFeed(a.activity),this.rebaseServerTotals(a),this.controlRoomSettled=!0,this.lastSyncedAt=Date.now(),this.authoritativeGrossRevenue=a.bookedValue.gross,this.authoritativeCurrency=a.currency,this.currency=a.currency,this.revenueStatus="current",this.recomputeTallies(),this.applyHeatOverlay(),this.paintMonitorInsights(),this.seatHistoryPanel?.refresh();let l=this.getSelection().slice(-1)[0],c=this.els.rail?.querySelector("[data-seat-status]");l&&c&&(c.textContent=this.status.get(l.label)??"free"),this.opts.onControlRoom?.(a)}return a}catch(s){throw e===this.revenueRequest&&(this.revenueStatus="stale",this.controlRoomSettled=!0,this.recomputeTallies()),s}}rebaseServerTotals(e){let t=o=>!!o&&["free","held","booked","blocked"].every(a=>Number.isFinite(o[a])),s=t(e.seatTotals)?e.seatTotals:null,i=s??e.totals;if(!t(i)){this.serverBaseline=null;return}let n=s?.reserved;this.serverBaseline={server:{free:i.free,held:i.held,booked:i.booked,blocked:i.blocked,...Number.isFinite(n)?{reserved:n}:{}},client:this.modelSynced?this.pairedClient():null}}pairedClient(){return{...this.clientTallies(),reserved:this.reservationsLoaded?this.reservedBlockedCount():null}}clientTallies(){let{held:e,booked:t,blocked:s}=this.counts;return{held:e,booked:t,blocked:s,free:Math.max(0,this.unitTotal()-e-t-s)}}buildTallies(){let e=this.clientTallies(),t=this.serverBaseline,s=a=>t?Math.max(0,t.server[a]+(t.client?e[a]-t.client[a]:0)):e[a],i=this.controlRoomSnapshot?.event?.seatTotal,n={free:s("free"),held:s("held"),booked:s("booked"),blocked:s("blocked"),total:Number.isFinite(i)?i:this.unitTotal(),capacityPct:0,sellThroughPct:0,bookedValue:this.authoritativeGrossRevenue,grossRevenue:this.authoritativeGrossRevenue,bookedValueStatus:this.revenueStatus,revenueStatus:this.revenueStatus,currency:this.currency};n.capacityPct=n.total?Math.round(n.booked/n.total*100):0;let o=n.total-n.blocked;return n.sellThroughPct=o>0?Math.round(n.booked/o*100):0,n}recomputeTallies(){if(!this.closed){if(typeof requestAnimationFrame!="function"){this.flushTallies();return}this.paintHandle===null&&(this.paintHandle=requestAnimationFrame(()=>{this.paintHandle=null,this.flushTallies()}))}}talliesReady(){return this.serverBaseline!==null||this.controlRoomSettled&&this.modelSynced}flushTallies(){if(this.closed)return;let e=this.buildTallies(),t=this.talliesReady();this.paintKpis(e,t),this.paintColourLegend(),this.minimap?.refreshMinimap(),this.paintMapChrome(),this.mode==="view"?(this.paintMonitorInsights(),this.paintWatchSeat(this.getSelection())):this.mode==="block"?this.paintSelBar(this.getSelection()):this.mode==="reserve"?this.paintReserveSelection(this.getSelection()):this.mode==="channels"&&this.channels?.handleSelectionChange(),t&&this.opts.onTallies?.(e)}verbFor(e,t,s){return t==="held"?"held":t==="booked"?"booked":t==="blocked"?s&&(this.reserving.has(s)||this.reservedBy.has(s))?"reserved":"blocked":t==="free"?e==="blocked"?s&&this.reservedBy.has(s)?"unreserved":"unblocked":e==="booked"?"cancelled":"available":t}pushActivity(e,t,s,i=Date.now()){let n=e[0];if(!n)return null;let o=this.sectionsForLabels(e),a={id:`${n}:${i}:${Math.random().toString(36).slice(2,6)}`,at:i,label:n,labels:[...e],count:e.length,verb:t,status:s,sectionIds:o.ids,sectionLabels:o.labels};return this.controlRoomSnapshot?.activity||this.feed.unshift(a),this.feed.length>ie&&(this.feed.length=ie),this.mode==="view"&&this.paintFeed(),this.showLiveEvent(a),this.opts.onActivity?.(a),a}adoptLabelNames(e){for(let[t,s]of Object.entries(e??{}))typeof s=="string"&&s&&this.labelNames.set(t,s)}seedFeed(e){this.controlRoomSnapshot?.activity&&(this.feed=this.feed.filter(i=>i.id.startsWith("log:")));let t={hold:"held",book:"booked",release:"released",expire:"expired",block:"blocked",unblock:"unblocked",unbook:"cancelled",reserve:"reserved",unreserve:"unreserved","reservation.end":"unreserved"},s={hold:"held",book:"booked",release:"free",expire:"free",block:"blocked",unblock:"free",unbook:"free",reserve:"blocked",unreserve:"free","reservation.end":"free"};for(let i of e){if(this.feed.some(l=>l.id===`log:${i.id}`))continue;let n=i.labels[0];if(!n)continue;let o=this.sectionsForLabels(i.labels),a={id:`log:${i.id}`,at:i.at,label:n,labels:[...i.labels],count:i.labels.length,verb:t[i.action]??i.action,status:s[i.action]??"free",sectionIds:o.ids,sectionLabels:o.labels};this.feed.push(a),this.opts.onActivity?.(a)}this.feed.sort((i,n)=>n.at-i.at),this.feed.length>ie&&(this.feed.length=ie),this.mode==="view"&&this.paintFeed()}startFeedClock(){this.feedTimer=setInterval(()=>{this.mode==="view"&&(this.paintFeed(),this.paintMonitorInsights())},1e4)}selectionCap(){return this.mode!=="select"?1e6:this.opts.numberOfPlacesToSelect??this.opts.maxSelectedObjects??1e6}isHostUnavailable(e){return this.unavailableLabels.has(e)}renderStatusOf(e,t){return t==="free"&&this.unavailableLabels.has(e)?"held":B(t)}canSelectObject(e){if(this.isHostUnavailable(e.label))return!1;let t=this.status.get(e.label)??"free",s=this.opts.unavailableObjectsSelectable??!0,i=t==="free"||s||this.selectableObjectLabels.has(e.label);if(!this.opts.isObjectSelectable)return i;try{return this.opts.isObjectSelectable(e,i)===!0}catch(n){return this.opts.onError?.(n),!1}}applyInitialSelection(){this.initialSelectionApplied||this.mode!=="select"||!this.renderer||(this.initialSelectionApplied=!0,this.selectByLabels(this.opts.selectedObjects??[]))}trimSelectionToCap(){if(this.mode!=="select")return;let e=this.getSelection(),t=this.selectionCap();e.length<=t||this.renderer?.deselect(e.slice(t).map(s=>s.id))}reconcileSelectPolicy(){if(this.mode!=="select")return;let e=this.getSelection().filter(t=>!this.canSelectObject(t));e.length&&this.renderer?.deselect(e.map(t=>t.id)),this.trimSelectionToCap(),this.syncSelection()}selectionLabels(){return this.getSelection().map(e=>e.label)}paintTaskPicker(){let e=this.els.taskpick;if(!e)return;let t=this.taskGroups.flatMap(s=>s.tools).find(s=>s.mode===this.mode)??{mode:this.mode,label:this.mode==="view"?"Watch":this.mode};e.innerHTML=Ue(t,this.taskGroups,this.taskMenuOpen),this.taskMenuOpen&&e.querySelector('[aria-checked="true"]')?.focus()}isSheet(){return!!this.root?.classList.contains("compact")&&this.mode!=="channels"}sheetDetent(){return this.detents.get(this.mode)??"half"}setDetent(e){this.detents.set(this.mode,e),this.applyDetent()}applyDetent(){let e=this.root;e&&(this.isSheet()?e.dataset.detent=this.sheetDetent():delete e.dataset.detent,this.paintPeek())}paintPeek(){let e=this.els.peek;if(!e)return;let t=this.taskGroups.flatMap(i=>i.tools).find(i=>i.mode===this.mode)?.label??"",s=this.renderer?this.getSelection().length:0;e.textContent=s?`${S(s)} selected \xB7 ${t}`:t}wireSheet(){let e=this.els.grab;if(!e)return;let t=["peek","half","full"],s=null,i=!1;e.addEventListener("pointerdown",o=>{s=o.clientY,i=!1}),e.addEventListener("pointerup",o=>{if(s==null)return;let a=o.clientY-s;if(s=null,Math.abs(a)<40)return;i=!0;let l=t.indexOf(this.sheetDetent());this.setDetent(t[Math.max(0,Math.min(2,l+(a>0?-1:1)))])}),e.addEventListener("click",()=>{if(i){i=!1;return}let o=this.sheetDetent();this.setDetent(o==="peek"?"half":o==="half"?"full":"half")});let n=this.els.taskpick;n?.addEventListener("click",o=>{let a=o.target,l=a.closest("[data-taskpick-mode]")?.dataset.taskpickMode;if(l){this.taskMenuOpen=!1,this.setMode(l);return}a.closest("[data-taskpick]")&&(this.taskMenuOpen=!this.taskMenuOpen,this.paintTaskPicker())}),this.root?.addEventListener("click",o=>{this.taskMenuOpen&&n&&!o.composedPath().includes(n)&&(this.taskMenuOpen=!1,this.paintTaskPicker())})}syncSelection(){let e=this.getSelection(),t=this.lastSelectionLabels;!this.selRestoring&&(e.length!==t.size||e.some(i=>!t.has(i.label)))&&(this.selBack.push([...t]),this.selBack.length>50&&this.selBack.shift(),this.selAhead=[]),this.savedApplied&&(e.length!==this.savedApplied.labels.size||e.some(i=>!this.savedApplied.labels.has(i.label)))&&(this.savedApplied=null,this.root?.querySelector(".slm-savedpill")?.remove()),e.length&&!this.categoryBusy&&!this.blockBusy&&(this.panelAlert=null),this.mode==="block"?this.paintSelBar(e):this.mode==="reserve"?this.paintReserveSelection(e):this.mode==="view"?this.paintWatchSeat(e):this.mode==="select"?this.paintSelectSelection(e):this.mode==="categories"?this.paintCategorySelection(e):this.mode==="channels"&&this.channels?.handleSelectionChange(),this.paintPeek();let s=new Map(e.map(i=>[i.label,i]));if(this.mode==="select"){for(let[n,o]of s)this.lastSelectionLabels.has(n)||this.opts.onObjectSelected?.(o);for(let n of this.lastSelectionLabels)if(!s.has(n)){let o=this.labelToSeat.get(n);o&&this.opts.onObjectDeselected?.(o)}let i=this.getSelectionValidity();i&&(this.opts.onSelectionValidityChange?.(i),this.selectionWasValid!==i.isValid&&(i.isValid?this.opts.onSelectionValid?.(i):this.opts.onSelectionInvalid?.(i)),this.selectionWasValid=i.isValid)}this.lastSelectionLabels=new Set(s.keys()),this.navigation?.historyChanged(this.selBack.length>0,this.selAhead.length>0),this.opts.onSelectionChange?.(e)}buildChrome(){let e=document.createElement("div"),t=this.opts.chrome==="minimal";e.className=`${t?"slm slm-minimal":"slm"}${this.opts.kpis===!1?" no-kpis":""}`,e.tabIndex=0,e.setAttribute("role","region"),e.setAttribute("aria-label",t?"Seat map":"SeatLayer live control room"),e.innerHTML=`
735
+ <div class="slm-fsline" data-ref="fsline"></div>
733
736
  <div class="slm-bar">
734
737
  <div class="slm-modes" data-ref="modes" role="tablist" aria-label="Control room tools">
735
- ${Be.map(o=>`<div class="slm-modegroup" data-group="${o.key}" role="presentation" hidden>
736
- <span class="slm-modegroup-label" aria-hidden="true">${m(o.label)}</span>
738
+ ${Bt.map(o=>`<div class="slm-modegroup" data-group="${o.key}" role="presentation" hidden>
739
+ <span class="slm-modegroup-label" aria-hidden="true">${f(o.label)}</span>
737
740
  ${o.tools.map(a=>`<button class="slm-mode" role="tab" data-mode="${a.mode}"
738
- title="${m(a.title)} (${a.shortcut})" aria-keyshortcuts="${a.shortcut}" hidden>${m(a.label)}</button>`).join("")}
741
+ title="${f(a.title)} (${a.shortcut})" aria-keyshortcuts="${a.shortcut}" hidden>${x(j[a.mode].glyph,j[a.mode].hue,22)}<span>${f(a.label)}</span></button>`).join("")}
739
742
  </div>`).join("")}
740
743
  </div>
744
+ <div class="slm-taskpick" data-ref="taskpick"></div>
741
745
  <select class="slm-tools" data-ref="tools" aria-label="Control room tools"></select>
742
- <span class="slm-live"><span class="slm-live-dot"></span><span data-ref="livetext">CONNECTING</span></span>
746
+ <span class="slm-viewonly" data-ref="viewonly" hidden>View only</span>
743
747
  <div class="slm-bar-actions">
748
+ <div data-ref="findbar" class="slm-findbar"></div>
749
+ <span class="slm-live"><span class="slm-live-dot"></span><span data-ref="livetext">CONNECTING</span></span>
744
750
  <button class="slm-barbtn follow" data-ref="follow" aria-label="Follow live" aria-pressed="false"
745
- title="Stay on the current map view unless enabled">Auto-follow</button>
746
- <div data-ref="findbar" class="slm-findbar">${P({compact:!0})}</div>
747
- ${Me()}
751
+ title="Stay on the current map view unless enabled"><span>Follow live</span></button>
752
+ <span data-ref="bell"></span>
753
+ <button type="button" class="slm-barbtn slm-helpbtn" data-how="current" aria-label="How this task works" title="How it works">?</button>
754
+ ${Lt()}
748
755
  <button type="button" class="slm-barbtn slm-fullscreen" data-ref="fullscreen" title="Full screen (F)" aria-label="Full screen"
749
- aria-keyshortcuts="F"><span class="slm-fullscreen-icon" aria-hidden="true">${j.enter}</span><span class="slm-fullscreen-label">Full screen</span></button>
756
+ aria-keyshortcuts="F"><span class="slm-fullscreen-icon" aria-hidden="true">${ye.enter}</span></button>
750
757
  </div>
751
758
  <div class="slm-kpis" data-ref="kpis"></div>
752
759
  </div>
760
+ <div data-ref="connbanner"></div>
761
+ <div data-ref="awaybanner"></div>
753
762
  <div class="slm-body">
754
763
  <div class="slm-map">
755
764
  <div class="slm-map-host" data-ref="maphost"></div>
765
+ ${pe()}
756
766
  <div class="slm-lane" data-ref="lane">
757
- <div class="slm-zoomhint" data-ref="zoomhint">Zoom in to select seats</div>
767
+ <div class="slm-zoomhint" data-ref="zoomhint">${G()?"Tap a section to take it \xB7 press and hold, then drag, to draw a box":"Click a section to take it \xB7 drag anywhere to add seats \xB7 Alt removes"}</div>
758
768
  <div class="slm-liveevent" data-ref="liveevent" role="status" aria-live="polite"></div>
769
+ <div class="slm-crumb" data-ref="crumb" role="status" hidden></div>
759
770
  </div>
760
771
  <div class="slm-heat-status" data-ref="heatstatus" role="status" hidden></div>
761
772
  <div class="slm-follow-status" data-ref="followstatus" role="status" hidden></div>
762
- ${pe()}
763
- ${ge()}
773
+ ${it()}
774
+ ${rt()}
764
775
  </div>
765
- <aside class="slm-rail"><div class="slm-railscroll" data-ref="rail"></div></aside>
776
+ <aside class="slm-rail"><button type="button" class="slm-grab" data-ref="grab" aria-label="Panel height"><span class="slm-grab-bar" aria-hidden="true"></span><span data-ref="peek"></span></button><div class="slm-railscroll" data-ref="rail">${me()}</div></aside>
766
777
  </div>
767
778
  <div class="slm-toast" data-ref="toast"></div>
768
- `,this.host.appendChild(e),this.root=e,this.selectObserver=new MutationObserver(()=>{let o=e.querySelector(".slm-rail");o&&(L(o),U(o))});let s=e.querySelector(".slm-rail");s&&this.selectObserver.observe(s,{childList:!0,subtree:!0}),this.applyThemeVars(),this.watchThemeMode(),this.updateContainerLayout(),typeof ResizeObserver<"u"&&(this.layoutObserver=new ResizeObserver(()=>this.updateContainerLayout()),this.layoutObserver.observe(e));let i=o=>e.querySelector(`[data-ref="${o}"]`);this.mapHost=i("maphost"),this.els={modes:i("modes"),tools:i("tools"),livetext:i("livetext"),kpis:i("kpis"),follow:i("follow"),view:i("view"),findbar:i("findbar"),fullscreen:i("fullscreen"),lane:i("lane"),zoomhint:i("zoomhint"),liveevent:i("liveevent"),rail:i("rail"),toast:i("toast"),mapchrome:i("mapchrome"),crumb:i("crumb"),zin:i("zin"),zout:i("zout"),zfit:i("zfit"),minimapMount:i("minimap"),blocklegend:i("blocklegend")},this.els.modes.querySelectorAll("[data-mode]").forEach(o=>o.addEventListener("click",()=>this.setMode(o.dataset.mode))),this.els.tools.addEventListener("change",()=>this.setMode(this.els.tools.value)),this.els.zfit.addEventListener("click",()=>{this.setFollowLive(!1),this.zoomToFit()}),this.els.zin.addEventListener("click",()=>{this.setFollowLive(!1),this.renderer?.zoomIn()}),this.els.zout.addEventListener("click",()=>{this.setFollowLive(!1),this.zoomOutStep()}),this.els.follow.addEventListener("click",()=>this.setFollowLive(!this.followLive)),this.els.blocklegend?.addEventListener("click",o=>{let a=o.target?.closest("[data-colour-by]");a?.dataset.colourBy&&this.setColourBy(a.dataset.colourBy)}),this.els.view.addEventListener("click",o=>{let a=o.target?.closest("[data-view]");a?.dataset.view&&this.toggleMapView(a.dataset.view)}),e.addEventListener("pointerdown",o=>{let a=this.els.view;a.open&&!a.contains(o.target)&&(a.open=!1)}),this.mapView=we(),this.opts.colourBy&&(this.mapView={...this.mapView,categoryColours:this.opts.colourBy==="type"}),this.heatEnabled=this.mapView.momentum,this.applyMapView(),this.wireBarFind(),this.els.fullscreen.addEventListener("click",()=>this.toggleFullscreen()),e.addEventListener("keydown",this.onKeyDown),this.els.rail.addEventListener("click",this.onRailClick),document.addEventListener("fullscreenchange",this.onFullscreenChange),this.paintModeTabs(),this.paintFollowLiveButton(),this.paintHeatButton(),this.paintMapViewMenu(),this.paintFullscreenButton(),this.navigation=new R({root:e,map:this.mapHost,setMoving:o=>{this.movingMap=o,this.updateRendererInteraction()},pauseFollow:()=>{this.followLive&&this.setFollowLive(!1)},clearSelection:()=>this.clearSelection(),zoomIn:()=>this.renderer?.zoomIn(),zoomOut:()=>this.renderer?.zoomOut(),targets:o=>this.navigationTargets(o)}),this.navigation.update(this.isBulkSelectMode(),this.mode==="view")}navigationTargets(e){let t=e.toLocaleLowerCase(),s=[];for(let o of this.sectionOptions)if(o.label.toLocaleLowerCase().includes(t)&&s.push({label:o.label,detail:"Section",locate:()=>this.locateSection(o.id)}),s.length>=20)return s;let i=new Map;for(let o of this.labelToSeat.values()){let a=i.get(o.rowId)??{minX:o.x,minY:o.y,maxX:o.x,maxY:o.y};a.minX=Math.min(a.minX,o.x),a.minY=Math.min(a.minY,o.y),a.maxX=Math.max(a.maxX,o.x),a.maxY=Math.max(a.maxY,o.y),i.set(o.rowId,a)}for(let o of this.doc?Ee(this.doc).flatMap(a=>a.objects):[]){if(o.type!=="row"||!(o.displayLabel??o.label).toLocaleLowerCase().includes(t))continue;let a=i.get(o.id);if(!a)continue;let{minX:l,minY:r,maxX:c,maxY:d}=a;if(s.push({label:o.displayLabel??o.label,detail:"Row",locate:()=>{let h=this.sectionByObject.get(o.id);h&&this.renderer?.focusSection(h),this.renderer?.focusRegion({x:l-30,y:r-30,width:c-l+60,height:d-r+60},{minScale:1.2,animate:!1})}}),s.length>=20)return s}for(let o of this.labelToSeat.values())if(o.label.toLocaleLowerCase().includes(t)&&(s.push({label:o.label,detail:"Seat",locate:()=>{let a=this.sectionByObject.get(o.rowId);a&&this.renderer?.focusSection(a),this.renderer?.focusRegion({x:o.x-180,y:o.y-120,width:360,height:240},{animate:!1,minScale:1.5}),this.renderer?.flashSeat(o.id,this.activityColor(this.status.get(o.label)??"free"))}}),s.length>=20))break;return s}applyChromeClearance(){if(this.opts.chrome!=="minimal"||!this.renderer)return;let e=this.els.mapchrome,t=e?.parentElement;if(!e||!t)return;let s=e.getBoundingClientRect(),i=t.getBoundingClientRect(),o=e.offsetHeight>0&&i.bottom>s.top,a=o?Math.ceil(i.bottom-s.top)+8:0,l=o?Math.ceil(i.right-s.left)+8:0;a===this.chromeClearance&&l===this.chromeClearanceWidth||(this.chromeClearance=a,this.chromeClearanceWidth=l,this.renderer.setFitClearance(a,l))}updateContainerLayout(){let e=this.root?.getBoundingClientRect().width||this.host.clientWidth;this.root?.classList.toggle("compact",e>0&&e<800),this.applyChromeClearance(),this.channels?.handleLayoutChange(),this.syncMinimap()}filterableSections(){return this.sectionsBase?[...this.sectionsBase.sections,...this.sectionsBase.ungrouped?[this.sectionsBase.ungrouped]:[]]:[]}applyFilteredSectionCanvas(e=this.filterableSections().filter(t=>t.label===this.filteredSectionLabel)){if(!this.renderer||this.mode!=="filterSections"||!e.length)return;let t=new Set(e.map(i=>i.id)),s=this.filterableSections().filter(i=>!t.has(i.id)).map(i=>i.id);this.renderer.clearSectionFocus(),this.renderer.setClosedSections(null),this.renderer.setDimmedSections(s),this.frameSections(e)}frameSections(e){if(!this.renderer||!e.length)return;let t=e.flatMap(r=>r.seatLabels).map(r=>this.labelToSeat.get(r)).filter(r=>!!r&&Number.isFinite(r.x)&&Number.isFinite(r.y));if(!t.length){this.renderer.focusRegion(e[0].id);return}let s=Math.min(...t.map(r=>r.x)),i=Math.min(...t.map(r=>r.y)),o=Math.max(...t.map(r=>r.x)),a=Math.max(...t.map(r=>r.y)),l=Math.max(40,Math.max(o-s,a-i)*.08);this.renderer.focusRegion({x:s-l,y:i-l,width:Math.max(1,o-s)+l*2,height:Math.max(1,a-i)+l*2})}buildSectionOptions(){if(this.doc)try{let e=kt(this.doc);this.sectionsBase=e,this.sectionOptions=[],this.sectionByObject=new Map(e.objectToSection),this.sectionLabelById.clear();for(let t of e.sections)this.sectionOptions.push({id:t.id,label:t.label}),this.sectionLabelById.set(t.id,t.label);e.ungrouped&&(this.sectionOptions.push({id:v,label:e.ungrouped.label}),this.sectionLabelById.set(v,e.ungrouped.label))}catch{}}toolAvailable(e){return e==="view"?!0:e==="channels"&&!this.channelCaps.view||e==="categories"&&!this.categoryCanManage||e==="tables"&&(!this.tableCanManage||!this.tables().length)?!1:!this.opts.tools||this.opts.tools.includes(e)}settleMode(){this.toolAvailable(this.mode)?this.paintModeTabs():this.setMode("view")}tables(){return(this.doc?Ee(this.doc):[]).flatMap(e=>e.objects).filter(e=>e.type==="table")}paintModeTabs(){let e=[];this.els.modes?.querySelectorAll(".slm-modegroup").forEach(s=>{let i=[];s.querySelectorAll("[data-mode]").forEach(o=>{let a=o.dataset.mode,l=this.toolAvailable(a);if(o.hidden=!l,!l)return;i.push({mode:a,label:o.textContent??a});let r=a===this.mode;o.classList.toggle("on",r),o.setAttribute("aria-selected",String(r)),o.tabIndex=r?0:-1}),s.hidden=i.length===0,i.length&&e.push({label:s.querySelector(".slm-modegroup-label")?.textContent??"",tools:i})});let t=this.els.tools;t&&(t.innerHTML=e.map(s=>`<optgroup label="${m(s.label)}">${s.tools.map(i=>`<option value="${i.mode}"${i.mode===this.mode?" selected":""}>${m(i.label)}</option>`).join("")}</optgroup>`).join(""),t.value=this.mode),this.root?.classList.toggle("block-mode",this.mode==="block")}railHeader(e,t,s){let i=t==="read"?"Read-only":t==="event"?"This event only":"Your app";return`<div class="slm-railhead"><p class="slm-eyebrow">${m(e)}</p><span class="slm-scope ${t}">${i}</span></div>
769
- <p class="slm-hint">${s}</p>`}paintFollowLiveButton(){let e=this.els.follow;if(!e)return;e.classList.toggle("on",this.followLive),e.setAttribute("aria-pressed",String(this.followLive)),e.textContent="Auto-follow";let t=this.root?.querySelector('[data-ref="followstatus"]');t&&(t.hidden=!this.followLive,t.textContent="Waiting for new holds or bookings"),e.setAttribute("title",this.followLive?"Following new holds and bookings. Turn off to keep the current view.":"Stay on the current map view. Enable to follow new holds and bookings.")}paintHeatButton(){this.paintMapViewMenu(),this.paintMomentumHelp()}paintMomentumHelp(){let e=this.root?.querySelector('[data-ref="heatstatus"]');if(e){e.hidden=!this.heatEnabled;let o=this.controlRoomSnapshot?.velocity.bySection.some(a=>a.netBooked>0);e.textContent=this.controlRoomSnapshot?o?`Booking heatmap \xB7 last ${this.trendWindowMinutes}m \xB7 warmer = higher net booking rate`:`No positive net bookings in the last ${this.trendWindowMinutes}m`:"Loading booking heatmap\u2026"}let t=this.els.rail?.querySelector('[data-ref="momentumhelp"]');if(!t)return;t.hidden=!this.heatEnabled;let s=t.querySelector('[data-ref="momentumcopy"]');if(!s)return;let i=this.controlRoomSnapshot?.velocity.bySection.some(o=>o.netBooked>0);s.textContent=i?"Warmer sections have more completed bookings, adjusted for section size. Holds and viewers are not counted.":`No completed bookings in the last ${this.trendWindowMinutes} minutes.`}paintFullscreenButton(){let e=this.els.fullscreen;if(!e)return;let t=this.isFullscreen(),s=t?"Exit full screen":"Full screen";e.setAttribute("aria-label",s),e.title=`${s} (F)`;let i=e.querySelector(".slm-fullscreen-label");i&&(i.textContent=s);let o=e.querySelector(".slm-fullscreen-icon");o&&(o.innerHTML=t?j.exit:j.enter)}paintTrendWindow(){this.els.rail?.querySelectorAll("[data-window]").forEach(e=>{let t=Number(e.dataset.window);e.classList.toggle("on",t===this.trendWindowMinutes)})}setLive(e){this.root?.classList.toggle("live",e),this.els.livetext&&(this.els.livetext.textContent=e?"LIVE":"RECONNECTING"),this.paintMonitorInsights();let t=e?"live":this.sessionEnded?"ended":"reconnecting";if(this.els.livetext&&!e&&this.sessionEnded&&(this.els.livetext.textContent="ENDED"),t!==this.connectionStatus){this.connectionStatus=t;try{this.opts.onConnectionChange?.(this.getConnection())}catch(s){this.opts.onError?.(s)}}}updateZoomHint(){let e=this.els.zoomhint;if(!e)return;let t=this.isBulkSelectMode()&&!this.movingMap&&this.renderer?.getRung?.()!=="seats";e.classList.toggle("on",!!t)}formatKpiDelta(e,t,s){let i=t>0?"+":"\u2212",o=Math.abs(t);return e==="booked-value"?`${i}${T(o,s)}`:e==="booked-pct"?`${i}${o.toLocaleString()}pt`:`${i}${o.toLocaleString()}`}paintKpis(e){if(!this.els.kpis)return;let t=e.bookedValueStatus==="current"?T(e.bookedValue,e.currency):"\u2014",s=this.presenceCounts(),i=[{key:"booked-inventory",raw:e.booked,n:e.booked.toLocaleString(),l:"Booked inventory",dot:x.booked,title:"Inventory units booked"},{key:"held-seats",raw:e.held,n:e.held.toLocaleString(),l:"Held inventory",dot:x.held,title:"Inventory currently held"},{key:"free-seats",raw:e.free,n:e.free.toLocaleString(),l:"Available",dot:x.free,title:"Inventory available to book"},{key:"blocked",raw:e.blocked,n:e.blocked.toLocaleString(),l:"Blocked",dot:x.blocked,title:"Inventory withheld from booking"},{key:"viewing-map",raw:s?.shoppingSessions??null,n:s?s.shoppingSessions.toLocaleString():"\u2014",l:"Viewing map",title:"Active map sessions right now"},{key:"active-holds",raw:s?.activeHolds??null,n:s?s.activeHolds.toLocaleString():"\u2014",l:"Active holds",title:"Sessions currently holding inventory"},{key:"booked-pct",raw:e.capacityPct,n:`${e.capacityPct}%`,l:"Booked",title:"Booked inventory as a share of the whole event"},{key:"booked-value",raw:e.bookedValueStatus==="current"?e.bookedValue:null,n:t,l:"Booked value",title:"Configured value attached to booked inventory"}],o=!1;this.els.kpis.innerHTML=i.map(a=>{let l=this.lastKpiValues.get(a.key),r=a.raw!=null&&l!=null&&a.raw!==l,c=r?a.raw-l:0;r&&(o=!0,this.activeKpiDeltas.set(a.key,{text:this.formatKpiDelta(a.key,c,e.currency),down:c<0})),a.raw!=null&&this.lastKpiValues.set(a.key,a.raw);let d=this.activeKpiDeltas.get(a.key);return`<div class="slm-kpi${d?" changed":""}" data-kpi="${a.key}" title="${m(a.title)}">
770
- <b>${a.dot?`<span class="dot" style="background:${a.dot}"></span>`:""}${a.n}</b><span>${a.l}</span>
771
- ${d?`<span class="slm-kpidelta${d.down?" down":""}">${d.text}</span>`:""}
772
- </div>`}).join(""),o&&(this.kpiCleanupTimer&&clearTimeout(this.kpiCleanupTimer),this.kpiCleanupTimer=setTimeout(()=>{this.kpiCleanupTimer=null,this.activeKpiDeltas.clear(),this.els.kpis?.querySelectorAll(".slm-kpidelta").forEach(a=>a.remove()),this.els.kpis?.querySelectorAll(".slm-kpi.changed").forEach(a=>a.classList.remove("changed"))},1500))}paintRail(){this.root?.classList.toggle("monitor-view",this.mode==="view"||this.mode==="inspect"),this.seatHistoryPanel?.destroy(),this.seatHistoryPanel=null,this.activityPanel?.destroy(),this.activityPanel=null,this.mode==="view"?this.renderViewRail():this.mode==="inspect"?this.renderInspectRail(this.getSelection()):this.mode==="select"?this.renderSelectRail():this.mode==="filterSections"?this.renderFilterSectionsRail():this.mode==="sections"?this.renderSectionsRail():this.mode==="categories"?this.renderCategoriesRail():this.mode==="tables"?this.renderTablesRail():this.mode==="channels"?this.channels?this.channels.paintRail():this.channelsLoading?this.els.rail.innerHTML='<div class="slm-empty" role="status">Loading sales channels\u2026</div>':this.els.rail.innerHTML='<div class="slm-empty" role="alert">Sales channels could not be loaded. Switch away and back to try again.</div>':this.renderBlockRail(),this.updateZoomHint()}renderViewRail(){this.els.rail.innerHTML=`
773
- <div class="slm-monitor-head"><h2>Live activity</h2><span data-ref="presence" class="slm-monitor-connection"></span></div>
774
- <div class="slm-monitor-tabs" role="tablist" aria-label="Monitor details">
775
- <button role="tab" aria-selected="true" data-monitor-tab="activity">Activity</button>
776
- <button role="tab" aria-selected="false" data-monitor-tab="sections">Section inventory</button>
779
+ `,this.host.appendChild(e),this.root=e,this.selectObserver=new MutationObserver(()=>{let o=e.querySelector(".slm-rail");o&&(K(o),Te(o))});let s=e.querySelector(".slm-rail");if(s&&this.selectObserver.observe(s,{childList:!0,subtree:!0}),this.applyThemeVars(),this.watchThemeMode(),this.updateContainerLayout(),typeof ResizeObserver<"u"){this.layoutObserver=new ResizeObserver(()=>this.updateContainerLayout()),this.layoutObserver.observe(e);let o=e.querySelector(".slm-bar-actions");o&&this.layoutObserver.observe(o)}let i=o=>e.querySelector(`[data-ref="${o}"]`);this.mapHost=i("maphost"),this.els={modes:i("modes"),tools:i("tools"),livetext:i("livetext"),kpis:i("kpis"),follow:i("follow"),view:i("view"),findbar:i("findbar"),fullscreen:i("fullscreen"),lane:i("lane"),zoomhint:i("zoomhint"),liveevent:i("liveevent"),rail:i("rail"),toast:i("toast"),mapchrome:i("mapchrome"),crumb:i("crumb"),zin:i("zin"),zout:i("zout"),zfit:i("zfit"),minimapMount:i("minimap"),blocklegend:i("blocklegend"),connbanner:i("connbanner"),fsline:i("fsline"),viewonly:i("viewonly"),taskpick:i("taskpick"),grab:i("grab"),peek:i("peek"),bell:i("bell"),awaybanner:i("awaybanner")},this.wireSheet(),this.els.modes.querySelectorAll("[data-mode]").forEach(o=>o.addEventListener("click",()=>this.setMode(o.dataset.mode))),this.els.tools.addEventListener("change",()=>this.setMode(this.els.tools.value)),this.els.zfit.addEventListener("click",()=>{this.setFollowLive(!1),this.zoomToFit()}),this.els.zin.addEventListener("click",()=>{this.setFollowLive(!1),this.renderer?.zoomIn()}),this.els.zout.addEventListener("click",()=>{this.setFollowLive(!1),this.zoomOutStep()}),this.els.mapchrome&&this.layoutObserver?.observe(this.els.mapchrome),this.applyLaneRoom(),this.els.follow.addEventListener("click",()=>this.setFollowLive(!this.followLive)),this.wireColourMenu(e),this.els.view.addEventListener("click",o=>{let a=o.target?.closest("[data-view], [data-panel-toggle]");if(a?.dataset.view)this.toggleMapView(a.dataset.view);else if(a){let l=!e.classList.toggle("details-hidden");a.setAttribute("aria-checked",String(l)),a.classList.toggle("on",l)}}),e.addEventListener("pointerdown",o=>{let a=this.els.view;a.open&&!a.contains(o.target)&&(a.open=!1)}),this.mapView=kt(),this.colourChoices=vt();let n=this.colourChoices[this.mode]??this.startingColourBy(this.mode);this.mapView={...this.mapView,categoryColours:n==="type",channelColours:n==="channel"},this.heatEnabled=this.mapView.momentum,this.applyMapView(),this.wireBarFind(),this.els.fullscreen.addEventListener("click",()=>this.toggleFullscreen()),e.addEventListener("keydown",this.onKeyDown),e.addEventListener("keydown",this.onSelectAllKey,!0),this.els.rail.addEventListener("click",this.onRailClick),this.root.addEventListener("click",this.onHowClick),document.addEventListener("fullscreenchange",this.onFullscreenChange),this.paintModeTabs(),this.paintFollowLiveButton(),this.paintHeatButton(),this.paintMapViewMenu(),this.paintFullscreenButton(),this.navigation=new X({root:e,map:this.mapHost,setMoving:o=>{this.movingMap=o,this.updateRendererInteraction()},setShape:o=>{this.marqueeShape=o,this.updateRendererInteraction()},pauseFollow:()=>{this.followLive&&this.setFollowLive(!1)},stepSelection:o=>{this.stepSelection(o)}}),this.navigation.update(this.isBulkSelectMode()),this.wireGestures(this.mapHost),this.els.blocklegend&&e.querySelector(".slm-navigation")?.prepend(this.els.blocklegend)}wireColourMenu(e){let t=this.els.blocklegend,s=t?.querySelector('[data-ref="colourby"]'),i=t?.querySelector('[role="listbox"]');if(!t||!s||!i)return;this.paintColourLegend();let n=o=>{i.hidden=!o,s.setAttribute("aria-expanded",String(o))};t.querySelector('[data-ref="legenditems"]')?.addEventListener("click",o=>{let a=o.target.closest("[data-legend]");a?.dataset.legend&&this.onLegendChip(a.dataset.legend,o.shiftKey)}),s.addEventListener("click",()=>{i.hidden&&this.paintColourLegend(),n(i.hidden),i.hidden||i.querySelector('[aria-selected="true"]')?.focus()}),i.addEventListener("click",o=>{let a=o.target?.closest("[data-colour-by]");!a||a.disabled||(this.setColourBy(a.dataset.colourBy),n(!1),s.focus())}),i.addEventListener("keydown",o=>{o.key==="Escape"&&(n(!1),s.focus(),o.stopPropagation())}),e.addEventListener("pointerdown",o=>{!i.hidden&&!t.contains(o.target)&&n(!1)})}showLabels(e){this.setFollowLive(!1);let t=e.length===1?this.labelToSeat.get(e[0]):null;if(!t){this.frameLabels(e);return}let s=this.sectionByObject.get(t.rowId);s&&this.renderer?.focusSection(s),this.renderer?.focusRegion({x:t.x-180,y:t.y-120,width:360,height:240},{animate:!1,minScale:1.5}),this.renderer?.flashSeat(t.id,this.activityColor(this.status.get(t.label)??"free"))}applyChromeClearance(){if(this.opts.chrome!=="minimal"||!this.renderer)return;let e=this.els.mapchrome,t=e?.parentElement;if(!e||!t)return;let s=e.getBoundingClientRect(),i=t.getBoundingClientRect(),n=e.offsetHeight>0&&i.bottom>s.top,o=n?Math.ceil(i.bottom-s.top)+8:0,a=n?Math.ceil(i.right-s.left)+8:0;o===this.chromeClearance&&a===this.chromeClearanceWidth||(this.chromeClearance=o,this.chromeClearanceWidth=a,this.renderer.setFitClearance(o,a))}applyLaneRoom(){let e=this.els.mapchrome,t=e?.parentElement;if(!e||!t)return;let s=e.offsetWidth;t.style.setProperty("--slm-chrome-w",`${s}px`),t.style.setProperty("--slm-chrome-h",`${e.offsetHeight}px`),t.classList.toggle("slm-lane-above",t.clientWidth-s-42<240)}applyLegendInset(){let e=this.opts.mapInsets;if(this.opts.chrome==="minimal"&&!e||!this.renderer?.setViewportInsets)return;let t=this.opts.chrome==="minimal"?null:this.els.blocklegend,s=t&&t.offsetHeight?Math.max(0,Math.ceil(t.getBoundingClientRect().bottom-this.mapHost.getBoundingClientRect().top)+8):0,i=l=>Number.isFinite(l)&&l>0?Math.ceil(l):0,n={top:Math.max(s,i(e?.top)),right:i(e?.right),bottom:i(e?.bottom),left:i(e?.left)},o=`${n.top},${n.right},${n.bottom},${n.left}`;if(o===this.legendInset)return;this.legendInset=o;let a=Object.fromEntries(Object.entries(n).filter(([,l])=>l>0));this.renderer.setViewportInsets(Object.keys(a).length?a:null)}setMapInsets(e){this.opts.mapInsets=e??void 0,this.applyLegendInset()}fitBar(e,t){let s=this.root;if(!s)return;let i=["tightbar","tighterbar"];if(t){s.classList.remove(...i);return}let n=i.filter(l=>s.classList.contains(l)).length;for(;n>0&&e>=this.barNeed[n];)s.classList.remove(i[--n]);let o=()=>{let l=s.querySelector(".slm-bar")?.getBoundingClientRect(),c=s.querySelector(".slm-bar-actions > :last-child")?.getBoundingClientRect(),d=parseFloat(getComputedStyle(s.querySelector(".slm-bar")).paddingRight)||0;return l&&c&&l.width?Math.ceil(c.right-(l.right-d)):0},a=o();for(;a>0&&n<i.length;)this.barNeed[n+1]=e+a+12,s.classList.add(i[n++]),a=o()}updateContainerLayout(){let e=this.root?.getBoundingClientRect().width||this.host.clientWidth,t=e>0&&e<1e3;t!==this.root?.classList.contains("compact")&&(this.root?.classList.toggle("compact",t),this.applyDetent()),this.fitBar(e,t),this.applyChromeClearance(),this.applyLaneRoom(),this.applyLegendInset(),this.channels?.handleLayoutChange(),this.syncMinimap()}filterableSections(){return this.sectionsBase?[...this.sectionsBase.sections,...this.sectionsBase.ungrouped?[this.sectionsBase.ungrouped]:[]]:[]}applyFilteredSectionCanvas(e=this.filterableSections().filter(t=>t.label===this.filteredSectionLabel)){if(!this.renderer||this.mode!=="filterSections"||!e.length)return;let t=new Set(e.map(i=>i.id)),s=this.filterableSections().filter(i=>!t.has(i.id)).map(i=>i.id);this.renderer.clearSectionFocus(),this.renderer.setClosedSections(null),this.renderer.setDimmedSections(s),this.frameSections(e)}frameSections(e){if(!this.renderer||!e.length)return;let t=e.flatMap(l=>l.seatLabels).map(l=>this.labelToSeat.get(l)).filter(l=>!!l&&Number.isFinite(l.x)&&Number.isFinite(l.y));if(!t.length){this.renderer.focusRegion(e[0].id);return}let s=Math.min(...t.map(l=>l.x)),i=Math.min(...t.map(l=>l.y)),n=Math.max(...t.map(l=>l.x)),o=Math.max(...t.map(l=>l.y)),a=Math.max(40,Math.max(n-s,o-i)*.08);this.renderer.focusRegion({x:s-a,y:i-a,width:Math.max(1,n-s)+a*2,height:Math.max(1,o-i)+a*2})}buildSectionOptions(){if(this.doc)try{let e=Cs(this.doc);this.sectionsBase=e,this.sectionOptions=[],this.sectionByObject=new Map(e.objectToSection),this.sectionLabelById.clear();for(let t of e.sections)this.sectionOptions.push({id:t.id,label:t.label}),this.sectionLabelById.set(t.id,t.label);e.ungrouped&&(this.sectionOptions.push({id:k,label:e.ungrouped.label}),this.sectionLabelById.set(k,e.ungrouped.label))}catch{}}toolAvailable(e){return e==="view"?!0:e==="channels"&&!this.channelCaps.view||e==="categories"&&!this.categoryCanManage||(e==="block"||e==="reserve"||e==="sections")&&!this.canBlock()||e==="tables"&&(!this.tableCanManage||!this.tables().length)?!1:!this.opts.tools||this.opts.tools.includes(e)}settleMode(){this.toolAvailable(this.mode)?this.paintModeTabs():this.setMode("view")}tables(){return(this.doc?Es(this.doc):[]).flatMap(e=>e.objects).filter(e=>e.type==="table")}paintModeTabs(){let e=[];this.els.modes?.querySelectorAll(".slm-modegroup").forEach(i=>{let n=[];i.querySelectorAll("[data-mode]").forEach(o=>{let a=o.dataset.mode,l=this.toolAvailable(a);if(o.hidden=!l,!l)return;n.push({mode:a,label:o.textContent??a});let c=a===this.mode;o.classList.toggle("on",c),o.setAttribute("aria-selected",String(c)),o.tabIndex=c?0:-1}),i.hidden=n.length===0,n.length&&e.push({label:i.querySelector(".slm-modegroup-label")?.textContent??"",tools:n})});let t=this.els.tools;t&&(t.innerHTML=e.map(i=>`<optgroup label="${f(i.label)}">${i.tools.map(n=>`<option value="${n.mode}"${n.mode===this.mode?" selected":""}>${f(n.label)}</option>`).join("")}</optgroup>`).join(""),t.value=this.mode),this.root?.classList.toggle("block-mode",this.mode==="block"),this.taskGroups=e,this.paintTaskPicker();let s=i=>i!=="view"&&i!=="inspect"&&i!=="select"&&i!=="filterSections";this.els.viewonly&&(this.els.viewonly.hidden=e.some(i=>i.tools.some(n=>s(n.mode))))}canBlock(){let e=this.opts.capabilities;return!e||e.includes("event:block")}railHeader(e,t,s){let i=t==="read"?"Read-only":t==="event"?"This event only":"Your app";return`<div class="slm-railhead"><p class="slm-eyebrow">${f(e)}</p><span class="slm-scope ${t}">${i}</span></div>
780
+ <p class="slm-hint">${s}</p>`}paintFollowLiveButton(){let e=this.els.follow;if(!e)return;e.classList.toggle("on",this.followLive),e.setAttribute("aria-pressed",String(this.followLive));let t=this.root?.querySelector('[data-ref="followstatus"]');t&&(t.hidden=!this.followLive,t.textContent="Waiting for new holds or bookings"),e.setAttribute("title",this.followLive?"Following new holds and bookings. Turn off to keep the current view.":"Stay on the current map view. Enable to follow new holds and bookings.")}paintHeatButton(){this.paintMapViewMenu(),this.paintMomentumHelp()}paintMomentumHelp(){let e=this.root?.querySelector('[data-ref="heatstatus"]');if(e){e.hidden=!this.heatEnabled;let n=this.controlRoomSnapshot?.velocity.bySection.some(o=>o.netBooked>0);e.textContent=this.controlRoomSnapshot?n?`Booking heatmap \xB7 last ${this.trendWindowMinutes}m \xB7 warmer = higher net booking rate`:`No positive net bookings in the last ${this.trendWindowMinutes}m`:"Loading booking heatmap\u2026"}let t=this.els.rail?.querySelector('[data-ref="momentumhelp"]');if(!t)return;t.hidden=!this.heatEnabled;let s=t.querySelector('[data-ref="momentumcopy"]');if(!s)return;let i=this.controlRoomSnapshot?.velocity.bySection.some(n=>n.netBooked>0);s.textContent=i?"Warmer sections have more completed bookings, adjusted for section size. Holds and viewers are not counted.":`No completed bookings in the last ${this.trendWindowMinutes} minutes.`}paintFullscreenButton(){let e=this.els.fullscreen;if(!e)return;let t=this.isFullscreen(),s=t?"Exit full screen":"Full screen";e.setAttribute("aria-label",s),e.title=`${s} (F)`;let i=e.querySelector(".slm-fullscreen-icon");i&&(i.innerHTML=t?ye.exit:ye.enter)}paintTrendWindow(){this.els.rail?.querySelectorAll("[data-window]").forEach(e=>{let t=Number(e.dataset.window);e.classList.toggle("on",t===this.trendWindowMinutes)})}setLive(e){this.root?.classList.toggle("live",e),this.trackLink(e),this.paintMonitorInsights();let t=e?"live":this.sessionEnded?"ended":"reconnecting";if(t!==this.connectionStatus){this.connectionStatus=t;try{this.opts.onConnectionChange?.(this.getConnection())}catch(s){this.opts.onError?.(s)}}}trackLink(e){let t=()=>{this.linkTimers&&this.linkTimers.forEach(s=>clearTimeout(s)),this.linkTimers=null};if(e){t(),this.everLive=!0,this.paintLink("live");return}if(this.sessionEnded){t(),this.paintLink("live"),this.els.livetext&&(this.els.livetext.textContent="ENDED"),this.announceRoomState();return}this.linkTimers||(!this.everLive&&this.els.livetext&&(this.els.livetext.textContent="CONNECTING"),this.linkTimers=[...this.everLive?[setTimeout(()=>{this.closed||this.paintLink("paused")},5e3)]:[],setTimeout(()=>{this.closed||this.paintLink("offline")},12e4)])}roomState(){return this.sessionEnded?"ended":this.everLive?this.linkState:this.linkState==="offline"?"offline":"connecting"}announceRoomState(){let e=this.roomState();if(e!==this.announcedRoomState){this.announcedRoomState=e;try{this.opts.onRoomStateChange?.(e)}catch(t){this.opts.onError?.(t)}}}paintLink(e){this.linkState=e,this.announceRoomState(),this.root?.classList.toggle("paused",e==="paused"),this.root?.classList.toggle("offline",e==="offline"),this.els.livetext&&(this.els.livetext.textContent=e==="paused"?"PAUSED":e==="offline"?"OFFLINE":"LIVE");let t=this.els.connbanner;t&&(t.innerHTML=Ne(e),t.querySelector("[data-conn-retry]")?.addEventListener("click",()=>{this.reconnectTimer&&clearTimeout(this.reconnectTimer),this.reconnectTimer=null,this.attempt=0,this.connect()}))}paintFullscreenLine(){let e=this.els.fsline;if(!e||!this.isFullscreen())return;let t=this.controlRoomSnapshot?.event?.name??"",s=this.eventStartsAt?w(this.eventStartsAt,{month:"short",day:"numeric"}):null;e.innerHTML=Ke(t,s,this.talliesReady()?this.buildTallies():null),this.opts.sale?.status&&this.withExtras(i=>i.addSalePill(e,this.opts.sale)),e.querySelector("[data-fs-exit]")?.addEventListener("click",()=>{this.exitFullscreen()})}updateZoomHint(){let e=this.els.zoomhint;if(!e)return;let t=this.isBulkSelectMode()&&!this.movingMap&&this.renderer?.getRung?.()!=="seats";e.classList.toggle("on",!!t)}formatKpiDelta(e,t,s){let i=t>0?"+":"\u2212",n=Math.abs(t);return e==="booked-value"?`${i}${A(n,s)}`:e==="booked-pct"?`${i}${n.toLocaleString()}pt`:`${i}${n.toLocaleString()}`}paintKpis(e,t=!0){if(!this.els.kpis)return;let s=l=>t?{raw:l,n:l.toLocaleString()}:{raw:null,n:"\u2014"},i=e.bookedValueStatus==="current"?A(e.bookedValue,e.currency):"\u2014",n=this.presenceCounts(),o=[{key:"booked-inventory",...s(e.booked),l:"Booked inventory",dot:E.booked,title:"Inventory units booked"},{key:"held-seats",...s(e.held),l:"In a cart",dot:E.held,title:"Inventory in buyers\u2019 carts now"},{key:"free-seats",...s(e.free),l:"Available",dot:E.free,title:"Inventory available to book"},{key:"blocked",...s(e.blocked),l:"Blocked",dot:E.blocked,title:"Inventory withheld from booking"},{key:"viewing-map",raw:n?.shoppingSessions??null,n:n?n.shoppingSessions.toLocaleString():"\u2014",l:"Viewing map",title:"Active map sessions right now"},{key:"active-holds",raw:n?.activeHolds??null,n:n?n.activeHolds.toLocaleString():"\u2014",l:"Active holds",title:"Sessions currently holding inventory"},{key:"booked-pct",...t?{raw:e.capacityPct,n:`${e.capacityPct}%`}:{raw:null,n:"\u2014"},l:"Booked",title:"Booked inventory as a share of the whole event"},{key:"booked-value",raw:e.bookedValueStatus==="current"?e.bookedValue:null,n:i,l:"Booked value",title:"Configured value attached to booked inventory"}],a=!1;this.els.kpis.innerHTML=o.map(l=>{let c=this.lastKpiValues.get(l.key),d=l.raw!=null&&c!=null&&l.raw!==c,h=d?l.raw-c:0;d&&(a=!0,this.activeKpiDeltas.set(l.key,{text:this.formatKpiDelta(l.key,h,e.currency),down:h<0})),l.raw!=null&&this.lastKpiValues.set(l.key,l.raw);let p=this.activeKpiDeltas.get(l.key),m=this.opts.onOpenTrend&&(l.key==="booked-inventory"||l.key==="booked-pct"||l.key==="booked-value");return`<div class="slm-kpi${p?" changed":""}" data-kpi="${l.key}"${m?' tabindex="0"':` title="${f(l.title)}"`}>
781
+ <b>${l.dot?`<span class="dot" style="background:${l.dot}"></span>`:""}${l.n}</b><span>${l.l}</span>
782
+ ${p?`<span class="slm-kpidelta${p.down?" down":""}">${p.text}</span>`:""}
783
+ </div>`}).join(""),a&&(this.kpiCleanupTimer&&clearTimeout(this.kpiCleanupTimer),this.kpiCleanupTimer=setTimeout(()=>{this.kpiCleanupTimer=null,this.activeKpiDeltas.clear(),this.els.kpis?.querySelectorAll(".slm-kpidelta").forEach(l=>l.remove()),this.els.kpis?.querySelectorAll(".slm-kpi.changed").forEach(l=>l.classList.remove("changed"))},1500))}paintRail(){this.root?.classList.toggle("monitor-view",this.mode==="view"||this.mode==="inspect"),this.reserve?.destroy(),this.reserve=null,this.findBlocked?.destroy(),this.findBlocked=null,this.sectionsPanel?.destroy(),this.sectionsPanel=null,this.tablesPanel?.destroy(),this.tablesPanel=null,this.els.rail?.classList.remove("slm-blk-listing"),this.seatHistoryPanel?.destroy(),this.seatHistoryPanel=null,this.activityPanel?.destroy(),this.activityPanel=null,this.mode==="view"?this.renderViewRail():this.mode==="select"?this.renderSelectRail():this.mode==="filterSections"?this.renderFilterSectionsRail():this.mode==="sections"?this.renderSectionsRail():this.mode==="categories"?this.renderCategoriesRail():this.mode==="reserve"?this.renderReserveRail():this.mode==="tables"?this.renderTablesRail():this.mode==="channels"?this.channels?this.channels.paintRail():this.channelsLoading?this.els.rail.innerHTML='<div class="slm-empty" role="status">Loading sales channels\u2026</div>':this.els.rail.innerHTML='<div class="slm-empty" role="alert">Sales channels could not be loaded. Switch away and back to try again.</div>':this.renderBlockRail(),this.updateZoomHint()}renderViewRail(){this.els.rail.innerHTML=`
784
+ ${z({glyph:"eye",hue:"#3b82f6",title:"Watch",purpose:"See what is selling, where buyers are, and answer questions about any seat.",how:"watch"})}
785
+ <div data-ref="watchseat"></div>
786
+ <div class="slm-monitor-head"><span data-ref="presence" class="slm-monitor-connection"></span></div>
787
+ <div class="slm-monitor-tabs" role="tablist" aria-label="Watch details">
788
+ <button role="tab" aria-selected="true" data-monitor-tab="activity">Live activity</button>
789
+ <button role="tab" aria-selected="false" data-monitor-tab="sections">Sections</button>
777
790
  </div>
778
- <div data-monitor-panel="activity" class="slm-monitor-activity"><div data-ref="feed"></div></div>
791
+ <div data-monitor-panel="activity" class="slm-monitor-activity"><div class="slm-feedfilter" data-ref="feedfilter"></div><div data-ref="alertfeed"></div><div data-ref="nosales"></div><div data-ref="feed"></div><div data-ref="yours" hidden></div></div>
779
792
  <div data-monitor-panel="sections" hidden>
780
793
  <div class="slm-sectionhead">
781
794
  <div class="slm-windows" aria-label="Booking momentum window">
@@ -788,10 +801,10 @@ import{s as _,t as K}from"./chunk-X7FRGMS2.js";import{A as De,B as Ve,C as je,D
788
801
  </div>
789
802
  <div class="slm-sectionlist" data-ref="sections"></div>
790
803
  </div>
791
- `,this.els.presence=this.els.rail.querySelector('[data-ref="presence"]'),this.els.legend=this.els.rail.querySelector('[data-ref="legend"]'),this.els.sections=this.els.rail.querySelector('[data-ref="sections"]'),this.els.feed=this.els.rail.querySelector('[data-ref="feed"]'),this.activityPanel=new E(this.els.feed,this.sectionOptions,e=>{this.setFollowLive(!1),this.locateActivity(e)}),this.els.rail.querySelectorAll("[data-monitor-tab]").forEach(e=>e.addEventListener("click",()=>{let t=e.dataset.monitorTab;this.els.rail.querySelectorAll("[data-monitor-tab]").forEach(s=>s.setAttribute("aria-selected",String(s.dataset.monitorTab===t))),this.els.rail.querySelectorAll("[data-monitor-panel]").forEach(s=>{s.hidden=s.dataset.monitorPanel!==t})})),this.els.rail.querySelectorAll("[data-window]").forEach(e=>e.addEventListener("click",()=>{let t=Number(e.dataset.window);this.setTrendWindow(t).catch(s=>this.opts.onError?.(s))})),this.recomputeTallies(),this.paintMonitorInsights(),this.paintTrendWindow(),this.paintMomentumHelp(),this.paintFeed()}presenceCounts(){return this.livePresence?.value??this.controlRoomSnapshot?.presence??null}paintMonitorInsights(){if(this.mode!=="view")return;let e=this.controlRoomSnapshot;if(this.els.presence){let i=this.root?.classList.contains("live"),o=this.lastSyncedAt?te(this.lastSyncedAt,Date.now()):"waiting";this.els.presence.textContent=i?"\u25CF Live":"Reconnecting",this.els.presence.title=`Last data received: ${o}`}if(!this.els.sections)return;if(!e){this.els.sections.innerHTML='<div class="slm-empty">Loading authoritative section metrics\u2026</div>';return}let t=new Map(e.velocity.bySection.map(i=>[i.sectionId,i])),s=[...e.bookedValue.bySection].sort((i,o)=>{let a=t.get(i.sectionId)?.netBooked??0;return(t.get(o.sectionId)?.netBooked??0)-a||o.bookedValue-i.bookedValue});this.els.sections.innerHTML=s.length?s.map(i=>{let o=t.get(i.sectionId),a=o?.netBooked??0,l=`${a>0?"+":""}${a}`,r=o?.trend==="rising"||o?.trend==="cooling"?o.trend:"steady";return`<button type="button" class="slm-sectionrow" data-section-focus="${m(i.sectionId)}" title="Focus ${m(i.sectionLabel)} on the map">
792
- <span class="slm-sectiontop"><span>${m(i.sectionLabel)}</span><span title="Configured value of currently booked inventory">${T(i.bookedValue,e.currency)}</span></span>
793
- <span class="slm-sectionmeta"><span>${i.booked.toLocaleString()}/${i.total.toLocaleString()} booked \xB7 ${l} net in ${e.velocity.windowMinutes}m</span><span class="slm-trend ${r}">${r}</span><span class="slm-sectionlocate">Locate</span></span>
794
- </button>`}).join(""):'<div class="slm-empty">No section metrics are available for this chart.</div>',this.paintTrendWindow(),this.paintMomentumHelp()}applyHeatOverlay(){let e=this.controlRoomSnapshot;if(!this.heatEnabled||!e){this.renderer?.setSectionHeat(null);return}let t=new Map(e.bookedValue.bySection.map(a=>[a.sectionId,Math.max(1,a.total)])),s=e.velocity.bySection.map(a=>({sectionId:a.sectionId,rate:Math.max(0,a.netBooked)/(t.get(a.sectionId)??1)/e.velocity.windowMinutes})),i=Math.max(0,...s.map(a=>a.rate)),o={};for(let a of s)o[a.sectionId]=i>0?Math.sqrt(a.rate/i):0;this.renderer?.setSectionHeat(o)}renderSelectRail(){let e=this.opts.numberOfPlacesToSelect,t=this.selectionCap(),s=this.toolChooser();this.els.rail.innerHTML=`
804
+ `,this.els.presence=this.els.rail.querySelector('[data-ref="presence"]'),this.els.sections=this.els.rail.querySelector('[data-ref="sections"]'),this.els.feed=this.els.rail.querySelector('[data-ref="feed"]'),this.activityPanel=new Z(this.els.feed,this.sectionOptions,e=>{this.setFollowLive(!1),this.locateActivity(e)},e=>this.labelNames.get(e)),this.alerts?.paintFeed(),this.paintFeedFilter(),this.els.rail.querySelector('[data-ref="feedfilter"]').addEventListener("click",e=>{let t=e.target.closest("[data-feed-filter]")?.dataset.feedFilter;t&&t!==this.feedFilter&&(this.feedFilter=t,this.paintFeedFilter())}),this.els.rail.querySelectorAll("[data-monitor-tab]").forEach(e=>e.addEventListener("click",()=>{let t=e.dataset.monitorTab;this.els.rail.querySelectorAll("[data-monitor-tab]").forEach(s=>s.setAttribute("aria-selected",String(s.dataset.monitorTab===t))),this.els.rail.querySelectorAll("[data-monitor-panel]").forEach(s=>{s.hidden=s.dataset.monitorPanel!==t})})),this.els.rail.querySelectorAll("[data-window]").forEach(e=>e.addEventListener("click",()=>{let t=Number(e.dataset.window);this.setTrendWindow(t).catch(s=>this.opts.onError?.(s))})),this.recomputeTallies(),this.paintMonitorInsights(),this.paintTrendWindow(),this.paintMomentumHelp(),this.paintFeed(),this.paintWatchSeat(this.getSelection())}presenceCounts(){return this.livePresence?.value??this.controlRoomSnapshot?.presence??null}paintMonitorInsights(){if(this.mode!=="view")return;let e=this.controlRoomSnapshot,t=this.els.rail?.querySelector('[data-ref="nosales"]');t&&(t.innerHTML=this.counts.booked===0&&this.labelToSeat.size?_e(e?.presence?.shoppingSessions??null):"");let s=t?.querySelector(".slm-nosales");if(s&&(this.opts.sale?.openedAt||this.opts.sale?.pageUrl)&&this.withExtras(a=>a.enrichNoSales(s,this.opts.sale)),this.els.presence){let a=this.root?.classList.contains("live"),l=this.lastSyncedAt?Be(this.lastSyncedAt,Date.now()):"waiting";this.els.presence.textContent=a?"\u25CF Live":this.linkState==="offline"?"Offline":"Paused",this.els.presence.title=`Last data received: ${l}`}if(!this.els.sections)return;if(!e){this.els.sections.innerHTML='<div class="slm-empty">Loading authoritative section metrics\u2026</div>';return}let i=new Map(e.velocity.bySection.map(a=>[a.sectionId,a])),n=[...e.bookedValue.bySection].sort((a,l)=>{let c=i.get(a.sectionId)?.netBooked??0;return(i.get(l.sectionId)?.netBooked??0)-c||l.bookedValue-a.bookedValue}),o=new Map;for(let[a,l]of this.labelToSeat){let c=this.sectionByObject.get(l.rowId)??k,d=o.get(c)??{free:0,blocked:0},h=this.status.get(a)??"free";h==="free"?d.free+=1:h==="blocked"&&(d.blocked+=1),o.set(c,d)}this.els.sections.innerHTML=n.length?n.map(a=>{let c=i.get(a.sectionId)?.netBooked??0,d=`${c>0?"+":""}${c}`,h=o.get(a.sectionId)??{free:0,blocked:0},p=h.free?`${h.free.toLocaleString()} free`:h.blocked>=a.total-a.booked&&h.blocked?"All blocked":"Sold out",m=h.free?"free":p==="All blocked"?"blocked":"soldout";return`<button type="button" class="slm-sectionrow" data-section-focus="${f(a.sectionId)}" title="Focus ${f(a.sectionLabel)} on the map">
805
+ <span class="slm-sectiontop"><span>${f(a.sectionLabel)}</span><span class="slm-sectionstate ${m}">${p}</span></span>
806
+ <span class="slm-sectionmeta"><span>${a.booked.toLocaleString()} of ${a.total.toLocaleString()} sold \xB7 ${d} in ${e.velocity.windowMinutes} min \xB7 ${A(a.bookedValue,e.currency)}</span><span class="slm-sectionlocate">Locate</span></span>
807
+ </button>`}).join(""):'<div class="slm-empty">No section metrics are available for this chart.</div>',this.paintTrendWindow(),this.paintMomentumHelp()}applyHeatOverlay(){let e=this.controlRoomSnapshot;if(!this.heatEnabled||!e){this.renderer?.setSectionHeat(null);return}let t=new Map(e.bookedValue.bySection.map(o=>[o.sectionId,Math.max(1,o.total)])),s=e.velocity.bySection.map(o=>({sectionId:o.sectionId,rate:Math.max(0,o.netBooked)/(t.get(o.sectionId)??1)/e.velocity.windowMinutes})),i=Math.max(0,...s.map(o=>o.rate)),n={};for(let o of s)n[o.sectionId]=i>0?Math.sqrt(o.rate/i):0;this.renderer?.setSectionHeat(n)}renderSelectRail(){let e=this.opts.numberOfPlacesToSelect,t=this.selectionCap(),s=this.toolChooser();this.els.rail.innerHTML=`
795
808
  ${this.railHeader("Select","host","Pick seats for your own back-office operation \u2014 the selection is handed to your app. This tool is read-only inside the control room: it never books, releases or blocks seats by itself.")}
796
809
  <p class="slm-eyebrow slm-step"><span class="slm-stepnum">1</span>Choose seats</p>
797
810
  <p class="slm-selecthelp">Tap seats on the map, tap a row label for the whole row, press \u2318A for all, or pick a category, section or rows below.</p>
@@ -799,109 +812,62 @@ import{s as _,t as K}from"./chunk-X7FRGMS2.js";import{A as De,B as Ve,C as je,D
799
812
  ${this.toolSelectionBar("selectnum","selectmeta","selectclear","selectall")}
800
813
  <p class="slm-note" data-ref="selectvalidity">${e?`Select exactly ${e.toLocaleString()} object${e===1?"":"s"}.`:`Up to ${t.toLocaleString()} objects may be selected.`}</p>`,this.els.selectnum=this.els.rail.querySelector('[data-ref="selectnum"]'),this.els.selectmeta=this.els.rail.querySelector('[data-ref="selectmeta"]'),this.els.selectvalidity=this.els.rail.querySelector('[data-ref="selectvalidity"]'),this.els.selectclear=this.els.rail.querySelector('[data-ref="selectclear"]'),this.els.rail.querySelector('[data-ref="selectall"]')?.addEventListener("click",()=>this.selectAll()),this.els.selectclear.addEventListener("click",()=>this.clearSelection()),s.wire(this.els.rail),this.paintSelectSelection(this.getSelection())}paintSelectSelection(e){if(!this.els.selectnum||!this.els.selectmeta)return;let t=e.length;this.els.selectnum.textContent=t.toLocaleString(),this.els.selectmeta.textContent=t===1?"object selected":"objects selected",this.els.selectclear.disabled=t===0;let s=this.getSelectionValidity();this.els.selectvalidity&&(this.els.selectvalidity.textContent=s?s.isValid?`Ready \u2014 exactly ${s.required.toLocaleString()} selected.`:`Select ${s.remaining.toLocaleString()} more to continue.`:`${Math.max(0,this.selectionCap()-t).toLocaleString()} selections remaining.`)}renderFilterSectionsRail(){let e=new Map;for(let t of this.filterableSections())e.set(t.label,[...e.get(t.label)??[],t]);this.els.rail.innerHTML=`
801
814
  ${this.railHeader("Filter sections","host","Narrow the map to one section for your own reporting. Sections sharing a label stay together and the map frames their combined inventory. Nothing changes for buyers.")}
802
- ${e.size?`<div class="slm-sectionlist">${[...e].map(([t,s])=>{let i=t===this.filteredSectionLabel,o=s.reduce((a,l)=>a+l.seatCount,0);return`<button type="button" class="slm-sectionrow${i?" on":""}" data-filter-section="${m(t)}" aria-pressed="${i}">
803
- <span class="slm-sectiontop"><span>${m(t)}</span><span>${o.toLocaleString()}</span></span>
815
+ ${e.size?`<div class="slm-sectionlist">${[...e].map(([t,s])=>{let i=t===this.filteredSectionLabel,n=s.reduce((o,a)=>o+a.seatCount,0);return`<button type="button" class="slm-sectionrow${i?" on":""}" data-filter-section="${f(t)}" aria-pressed="${i}">
816
+ <span class="slm-sectiontop"><span>${f(t)}</span><span>${n.toLocaleString()}</span></span>
804
817
  <span class="slm-sectionmeta"><span>${s.length===1?"One section":`${s.length.toLocaleString()} matching sections`}</span><span class="slm-sectionlocate">${i?"Filtered":"Filter"}</span></span>
805
818
  </button>`}).join("")}</div>
806
- <button type="button" class="slm-btn ghost" data-clear-filter ${this.filteredSectionLabel?"":"disabled"}>Clear filter</button>`:'<div class="slm-empty">This chart has no filterable sections.</div>'}`,this.els.rail.querySelectorAll("[data-filter-section]").forEach(t=>{t.addEventListener("click",()=>this.setFilteredSection(t.dataset.filterSection))}),this.els.rail.querySelector("[data-clear-filter]")?.addEventListener("click",()=>this.clearFilteredSection())}categorySeats(e){return[...this.labelToSeat.values()].filter(t=>t.categoryKey===e&&this.canSelectObject(t))}renderCategoriesRail(){let e=this.doc?.categories??[],t=this.toolChooser();this.els.rail.innerHTML=`
807
- ${this.railHeader("Categories","event","Move seats to a different price category for this event only. The reusable chart keeps its design, and seats already held or booked keep the price they were sold at.")}
808
- <p class="slm-eyebrow slm-step"><span class="slm-stepnum">1</span>Choose seats</p>
809
- <p class="slm-selecthelp">Click seats, drag a box or draw a lasso on the map, tap a row label for the whole row, press \u2318A for all, or pick below.</p>
810
- ${t.chipsHtml({intents:this.marqueeShapeChipsHtml()})}
811
- ${this.toolSelectionBar("categorynum","categorymeta","categoryclear","categoryall")}
819
+ <button type="button" class="slm-btn ghost" data-clear-filter ${this.filteredSectionLabel?"":"disabled"}>Clear filter</button>`:'<div class="slm-empty">This chart has no filterable sections.</div>'}`,this.els.rail.querySelectorAll("[data-filter-section]").forEach(t=>{t.addEventListener("click",()=>this.setFilteredSection(t.dataset.filterSection))}),this.els.rail.querySelector("[data-clear-filter]")?.addEventListener("click",()=>this.clearFilteredSection())}categorySeats(e){return[...this.labelToSeat.values()].filter(t=>t.categoryKey===e&&this.canSelectObject(t))}renderCategoriesRail(){let e=this.doc?.categories??[],t=this.toolChooser(),s=this.hoverPriceRanges();this.els.rail.innerHTML=`
820
+ ${z({glyph:"tag",hue:"#8b5cf6",title:"Ticket types",badge:"This event only",purpose:"Change which ticket type a seat sells as, for this event only. The chart keeps its design.",how:"types"})}
821
+ <div data-ref="panelalert"></div>
822
+ ${U()}
823
+ ${this.addByHtml(t.chipsHtml({saved:!0}))}
812
824
  <p class="slm-eyebrow slm-step" style="margin-top:14px"><span class="slm-stepnum">2</span>Move them to</p>
813
- <p class="slm-selecthelp" data-ref="categoryhelp">Select seats first \u2014 then pick the category they should sell under.</p>
814
- <div class="slm-categoryassign">${e.length?e.map(i=>`
815
- <button type="button" class="slm-categoryrow" data-assign-category="${m(i.key)}" disabled>
816
- <span class="dot" style="background:${m(i.color??"#6e7bff")}"></span>
817
- <span class="slm-categorycopy"><b>${m(i.label??i.key)}</b><small data-cat-current>0 seats now</small></span>
818
- <span class="slm-categoryact" data-cat-action>Move here</span>
819
- </button>`).join(""):'<span class="slm-empty">This chart has no categories.</span>'}</div>
825
+ <div class="slm-categoryassign" role="radiogroup" aria-label="Ticket type">${e.length?e.map(n=>{let o=s?.[n.key];return`<button type="button" class="slm-categoryrow" role="radio" aria-checked="false" data-assign-category="${f(n.key)}">
826
+ <span class="dot" style="background:${f(this.renderer?.categoryDisplayColor?.(n.key)??n.color??"#6e7bff")}"></span>
827
+ <span class="slm-categorycopy"><b>${f(n.label??n.key)}</b><small data-cat-current></small></span>
828
+ <span class="slm-categoryact">${o?f(A(o.min,this.currency)):""}</span>
829
+ </button>`}).join(""):'<span class="slm-empty">This chart has no ticket types.</span>'}</div>
820
830
  <div class="slm-catreset">
821
831
  <button type="button" class="slm-btn ghost" data-ref="categoryreset" disabled>Reset to chart defaults</button>
822
832
  <p class="slm-note" data-ref="categoryresetnote">Checking what differs from the chart\u2026</p>
823
- </div>`;let s=i=>this.els.rail.querySelector(`[data-ref="${i}"]`);this.els.categorynum=s("categorynum"),this.els.categorymeta=s("categorymeta"),this.els.categoryhelp=s("categoryhelp"),this.els.categoryclear=s("categoryclear"),s("categoryall").addEventListener("click",()=>this.selectAll()),this.els.categoryclear.addEventListener("click",()=>this.clearSelection()),this.els.rail.querySelectorAll("[data-assign-category]").forEach(i=>{i.addEventListener("click",()=>{this.setCategory(i.dataset.assignCategory)})}),s("categoryreset").addEventListener("click",()=>{this.resetCategoriesToChart()}),t.wire(this.els.rail),this.wireMarqueeShapeChips(),this.paintCategorySelection(this.getSelection()),this.loadCategoryDifferences()}async loadCategoryDifferences(){let e=this.els.rail;if(!e||this.closed)return;let t=e.querySelector('[data-ref="categoryreset"]'),s=e.querySelector('[data-ref="categoryresetnote"]');if(!(!t||!s))try{let i=await this.withAuthRetry(()=>this.api.categoryDifferences(this.key));if(!t.isConnected)return;this.categoryDifferences=i.differing,this.paintCategoryReset()}catch(i){if(!t.isConnected)return;s.textContent="Could not check the chart\u2019s defaults. Reset is unavailable until it can.",this.opts.onError?.(i)}}paintCategoryReset(){let e=this.els.rail;if(!e)return;let t=e.querySelector('[data-ref="categoryreset"]'),s=e.querySelector('[data-ref="categoryresetnote"]');if(!t||!s)return;let i=this.categoryDifferences;i!=null&&(t.disabled=i===0,t.textContent=i?`Reset to chart defaults \xB7 ${i.toLocaleString()} seat${i===1?"":"s"}`:"Reset to chart defaults",s.textContent=i?"Puts every seat this event moved back in its chart category. Held and booked seats keep the price they were sold at.":"Every seat sells under its chart category.")}async resetCategoriesToChart(){let e=this.els.rail.querySelector('[data-ref="categoryreset"]');e&&(e.disabled=!0,e.textContent="Resetting\u2026");try{let t=await this.withAuthRetry(()=>this.api.resetCategoriesToChart(this.key));t.changed&&await this.reloadEventChart(),this.categoryDifferences=0,this.clearSelection(),this.mode==="categories"&&this.paintRail(),this.paintCategoryReset(),this.done("resetCategories",t.labels,t.changed?`Put ${t.labels.length.toLocaleString()} seat${t.labels.length===1?"":"s"} back on the chart\u2019s categories.`:"Every seat already sells under its chart category.")}catch(t){this.paintCategoryReset(),this.toastErr("Couldn\u2019t reset those categories. Nothing changed."),this.opts.onError?.(t)}}paintCategorySelection(e){if(!this.els.categorynum)return;let t=e.length;this.els.categorynum.textContent=t.toLocaleString(),this.els.categoryclear.disabled=t===0;let s=new Map;for(let o of e)s.set(o.categoryKey,(s.get(o.categoryKey)??0)+1);let i=o=>this.doc?.categories.find(a=>a.key===o)?.label??o;this.els.categorymeta&&(this.els.categorymeta.textContent=t===0?"selected":`${t===1?"seat":"seats"} selected \xB7 ${[...s].map(([o,a])=>`${a.toLocaleString()} ${i(o)}`).join(", ")}`),this.els.categoryhelp&&(this.els.categoryhelp.textContent=t===0?"Select seats first \u2014 then pick the category they should sell under.":`Choose the category the ${t===1?"selected seat":`${t.toLocaleString()} selected seats`} should sell under. Applies immediately.`),this.els.rail?.querySelectorAll("[data-assign-category]").forEach(o=>{let a=o.dataset.assignCategory,l=[...this.labelToSeat.values()].filter(p=>p.categoryKey===a).length,r=s.get(a)??0,c=t>0&&r===t;o.disabled=t===0||c,o.classList.toggle("current",c);let d=o.querySelector("[data-cat-current]");d&&(d.textContent=`${l.toLocaleString()} ${l===1?"seat":"seats"} now`);let h=o.querySelector("[data-cat-action]");h&&(h.textContent=t===0?"Move here":c?"Already here":`Move ${(t-r).toLocaleString()} here`)})}renderTablesRail(){let e=this.tables(),t="Decide how each table sells for this event: every chair on its own, or the whole table as one booking. A table with held, booked, or blocked chairs is locked until that inventory is released, and channel allocations are kept.";if(this.inventoryModelVersion!==2){this.els.rail.innerHTML=`
824
- ${this.railHeader("Tables","event",t)}
825
- <div class="slm-empty">This event still uses the older inventory model, which cannot switch tables between per-chair and whole-table selling. Upgrade the event's inventory model to unlock this tool.</div>`;return}if(!e.length){this.els.rail.innerHTML=`
826
- ${this.railHeader("Tables","event",t)}
827
- <div class="slm-empty">This chart has no tables. Add tables in the designer and they will appear here.</div>`;return}let s=h=>h.variableOccupancy?"variable":h.bookAsWhole?"whole":"individual",i=h=>{let p=0,u=0,g=0;for(let[b,y]of this.labelToSeat){if(y.rowId!==h.id)continue;let z=this.status.get(b);z==="held"?p++:z==="booked"?u++:z==="blocked"&&g++}let f=[u&&`${u} booked`,p&&`${p} held`,g&&`${g} blocked`].filter(Boolean);return f.length?f.join(" \xB7 "):null},o=e.map(h=>({table:h,current:s(h),locked:i(h)})),a=o.filter(h=>h.current==="individual").length,l=o.filter(h=>h.current==="whole").length,r=o.length-a-l,c=[`${a.toLocaleString()} per chair`,`${l.toLocaleString()} whole table`,r?`${r.toLocaleString()} flexible group`:""].filter(Boolean).join(" \xB7 "),d=this.tableBookingSaving;this.els.rail.innerHTML=`
828
- ${this.railHeader("Tables","event",t)}
829
- <div class="slm-tablesummary"><b>${o.length.toLocaleString()} ${o.length===1?"table":"tables"}</b><span>${m(c)}</span></div>
830
- <p class="slm-eyebrow" style="margin-top:12px">Set every table at once</p>
831
- <div class="slm-row">
832
- <button class="slm-btn ghost" data-table-all="individual"${d?" disabled":""} title="Sell every chair on its own">All per chair</button>
833
- <button class="slm-btn ghost" data-table-all="whole"${d?" disabled":""} title="Sell every table as one booking">All whole table</button>
834
833
  </div>
835
- <p class="slm-eyebrow" style="margin-top:12px">Or one table at a time</p>
836
- <div class="slm-tablelist">${o.map(({table:h,current:p,locked:u})=>`<div class="slm-tablerow${u?" locked":""}">
837
- <span class="slm-tablecopy"><b>${m(h.displayLabel??h.label)}</b><small>${h.seatCount.toLocaleString()} chairs${u?` \xB7 <span class="slm-tablelock">Locked: ${m(u)}</span>`:""}</small></span>
838
- <select class="slm-select" data-table-mode="${m(h.id)}" aria-label="Booking mode for ${m(h.displayLabel??h.label)}"
839
- ${d||u?"disabled":""} ${u?`title="Release the ${m(u)} chairs before changing how this table sells"`:""}>
840
- <option value="individual"${p==="individual"?" selected":""}>Per chair</option>
841
- <option value="whole"${p==="whole"?" selected":""}>Whole table</option>
842
- ${p==="variable"?'<option value="variable" selected>Flexible group</option>':""}
843
- </select>
844
- </div>`).join("")}</div>
845
- <p class="slm-note">Changes apply immediately to this event. Flexible group sizes (minimum and maximum guests) are set through the API, never guessed here.</p>`,this.els.rail.querySelectorAll("[data-table-all]").forEach(h=>{h.addEventListener("click",()=>{this.setTableBooking(o.filter(p=>!p.locked).map(p=>p.table.id),h.dataset.tableAll)})}),this.els.rail.querySelectorAll("[data-table-mode]").forEach(h=>{h.addEventListener("change",()=>{this.setTableBooking([h.dataset.tableMode],h.value)})})}renderInspectRail(e){let t=e[e.length-1];if(!t){this.els.rail.innerHTML=`
846
- ${this.railHeader("Inspect","read","Click one seat on the map to read its live status, category, section and booking context. Nothing changes in this view.")}
847
- <div class="slm-empty">Select a seat on the map.</div>`;return}let s=this.status.get(t.label)??"free",i={free:"Free",held:"Held",booked:"Booked",blocked:"Blocked"},o=this.sectionByObject.get(t.rowId)??v,a=this.sectionLabelById.get(o)??"Other seats",l=this.doc?.categories.find(c=>c.key===t.categoryKey);this.els.rail.innerHTML=`
848
- <div class="slm-seat-heading"><h2>${m(t.label)}</h2><span data-seat-status>${i[s]}</span></div>
849
- <p class="slm-note">${m(a)} \xB7 ${m(l?.label??t.categoryKey)}</p>
850
- <div data-ref="seat-history"></div>`;let r=this.els.rail.querySelector('[data-ref="seat-history"]');this.seatHistoryPanel=new C(r,(c,d)=>this.withAuthRetry(()=>this.api.seatHistory(this.key,t.label,c,d)))}async refreshAvailability(){try{let e=await this.withAuthRetry(()=>this.api.availability(this.key));this.availabilityRules=e.rules??{},this.effectiveClosed=new Set(V(this.availabilityRules)),this.mode==="sections"&&this.renderSectionsRail(),this.applySectionCanvasTreatment()}catch(e){this.opts.onError?.(e)}}async withAuthRetry(e){try{return await e()}catch(t){if(t instanceof k&&t.status===401&&this.opts.onTokenRefresh&&!this.tokenRefreshInFlight){if(await this.rotateToken(),this.sessionEnded)throw t;return e()}throw t instanceof k&&t.status===401&&!this.opts.onTokenRefresh&&this.endSession(),t}}updateEffectiveAvailability(e,t){let s=!1;Array.isArray(e)&&(this.effectiveHidden=new Set(e.filter(i=>typeof i=="string")),s=!0),Array.isArray(t)&&(this.effectiveClosed=new Set(t.filter(i=>typeof i=="string")),s=!0),s&&(this.mode==="sections"&&this.renderSectionsRail(),this.applySectionCanvasTreatment())}applySectionCanvasTreatment(){this.renderer&&(this.refreshBlockPaint(),this.mode==="sections"?(this.renderer.setDimmedSections([...this.effectiveHidden]),this.renderer.setClosedSections([...this.effectiveClosed])):this.mode==="filterSections"&&this.filteredSectionLabel?this.applyFilteredSectionCanvas():(this.renderer.setDimmedSections(null),this.renderer.setClosedSections(null)))}sectionRowsInput(){return{sectionsBase:this.sectionsBase,doc:this.doc,availabilityRules:this.availabilityRules,effectiveHidden:this.effectiveHidden,effectiveClosed:this.effectiveClosed}}renderSectionsRail(){let{rows:e,hiddenSections:t,closedSections:s}=H(this.sectionRowsInput());if(!e.length){this.els.rail.innerHTML=`
851
- ${this.railHeader("Sections","event","Draw sections or zones in the designer to schedule availability per area. This chart has none yet.")}
852
- <div class="slm-empty">No sections on this chart.</div>`;return}let i=[];t&&i.push(`${t} hidden`),s&&i.push(`${s} closed`);let o=i.length?i.join(" \xB7 "):"All sections open and on sale",a=t>0||s>0;this.els.rail.innerHTML=`
853
- ${this.railHeader("Sections","event","Decide when each zone or section goes on sale for this event. Keep it hidden, reveal it at a set time, or <b>auto-reveal once the rest sells past a threshold</b>. Hidden seats vanish for buyers; closed seats stay on the map (flat grey) but can't be bought.")}
854
- <div class="slm-availlist" data-ref="availlist">${e.map(l=>Ce(l,this.availabilitySaving)).join("")}</div>
855
- <div class="slm-availsummary">
856
- <span class="slm-availdot${a?" warn":""}"></span>
857
- <span>${m(o)}</span>
858
- </div>
859
- <div class="slm-availcallout">
860
- <span class="slm-availstar" aria-hidden="true">\u2726</span>
861
- <p><b>Auto-reveal at % sold</b> is demand-triggered release: the balcony opens itself the moment the stalls cross the threshold \u2014 no one has to be watching.</p>
862
- </div>`,this.wireSectionRail(),this.applySectionCanvasTreatment()}wireSectionRail(){let e=this.els.rail;e&&(e.querySelectorAll("[data-avail-id]").forEach(t=>{t.addEventListener("click",()=>this.setSectionMode(t.dataset.availId,t.dataset.availValue))}),e.querySelectorAll("[data-avail-picker]").forEach(t=>{t.querySelector("summary").addEventListener("click",s=>{this.availabilitySaving&&s.preventDefault(),e.querySelectorAll("[data-avail-picker]").forEach(i=>{i!==t&&(i.open=!1)})}),t.addEventListener("focusout",s=>{t.contains(s.relatedTarget)||(t.open=!1)}),t.addEventListener("keydown",s=>{if(s.key==="Escape"&&(t.open=!1,t.querySelector("summary").focus(),s.preventDefault()),s.key==="ArrowDown"||s.key==="ArrowUp"){if(this.availabilitySaving)return;s.preventDefault(),t.open=!0;let i=[...t.querySelectorAll("button")],o=i.indexOf(document.activeElement);i[(o+(s.key==="ArrowDown"?1:i.length-1)+i.length)%i.length]?.focus()}})}),e.querySelectorAll("[data-avail-reveal]").forEach(t=>{t.addEventListener("change",()=>{let s=new Date(t.value).getTime();Number.isFinite(s)&&this.setSectionRulePatch(t.dataset.availReveal,{revealAt:s})})}),e.querySelectorAll("[data-avail-pct]").forEach(t=>{t.addEventListener("change",()=>{let s=Math.max(1,Math.min(100,Number(t.value)||0));this.setSectionRulePatch(t.dataset.availPct,{thresholdPct:s})})}))}setSectionMode(e,t){let s=H(this.sectionRowsInput()).rows.find(l=>l.id===e),i=s?.seatLabels??this.availabilityRules[e]?.labels??[],o={...this.availabilityRules},a=G(t,i,this.availabilityRules[e]);if(a?o[e]=a:delete o[e],s?.kind==="zone"&&this.sectionsBase)for(let l of this.sectionsBase.sections)l.zone===e&&delete o[l.id];this.persistAvailability(o)}setSectionRulePatch(e,t){let s=this.availabilityRules[e];if(!s)return;let o=H(this.sectionRowsInput()).rows.find(a=>a.id===e)?.seatLabels??s.labels??[];this.persistAvailability({...this.availabilityRules,[e]:{...s,...t,labels:o}})}async persistAvailability(e){let t=this.availabilityRules;this.availabilityRules=e,this.availabilitySaving=!0,this.mode==="sections"&&this.renderSectionsRail();try{let s=await this.withAuthRetry(()=>this.api.setAvailability(this.key,e));this.availabilityRules=s.rules,this.effectiveHidden=new Set(s.hidden),this.effectiveClosed=new Set(V(s.rules)),this.availabilitySaving=!1,this.mode==="sections"&&this.renderSectionsRail(),this.applySectionCanvasTreatment()}catch(s){this.availabilityRules=t,this.availabilitySaving=!1,this.mode==="sections"&&this.renderSectionsRail(),this.toastErr("Couldn't update availability. Try again."),this.opts.onError?.(s)}}paintLegend(e){this.els.legend&&(this.els.legend.innerHTML=Q.map(t=>`<div class="slm-legrow"><span class="slm-legdot" style="background:${t.color}"></span>
863
- <span class="slm-leglabel">${t.label}</span><span class="slm-legcount">${e[t.key].toLocaleString()}</span></div>`).join(""))}paintFeed(){this.activityPanel?.update(this.feed)}renderBlockRail(){let e=this.toolChooser(),t=this.sectionOptions.map(l=>`<option value="${m(l.id)}">${m(l.label)}</option>`).join("");this.els.rail.innerHTML=`
864
- <div class="slm-monitor-tabs" role="tablist" aria-label="Blocking tools"><button role="tab" data-block-tab="edit" aria-selected="${!this.blockBrowse}">Block seats</button><button role="tab" data-block-tab="browse" aria-selected="${this.blockBrowse}">Find blocked</button></div>
865
- <p class="slm-note">${X}</p>
834
+ ${Y("catfoot")}`;let i=n=>this.els.rail.querySelector(`[data-ref="${n}"]`);this.els.rail.querySelectorAll("[data-assign-category]").forEach(n=>{n.addEventListener("click",()=>{this.categoryChoice=n.dataset.assignCategory,this.paintCategorySelection(this.getSelection())})}),i("catfoot").querySelector("[data-foot-action]").addEventListener("click",()=>{this.categoryChoice&&this.setCategory(this.categoryChoice)}),i("categoryreset").addEventListener("click",()=>{this.resetCategoriesToChart()}),t.wire(this.els.rail),this.paintCategorySelection(this.getSelection()),this.loadCategoryDifferences()}async loadCategoryDifferences(){let e=this.els.rail;if(!e||this.closed)return;let t=e.querySelector('[data-ref="categoryreset"]'),s=e.querySelector('[data-ref="categoryresetnote"]');if(!(!t||!s))try{let i=await this.withAuthRetry(()=>this.api.categoryDifferences(this.key));if(!t.isConnected)return;this.categoryDifferences=i.differing,this.paintCategoryReset()}catch(i){if(!t.isConnected)return;s.textContent="Could not check the chart\u2019s defaults. Reset is unavailable until it can.",this.opts.onError?.(i)}}paintCategoryReset(){let e=this.els.rail;if(!e)return;let t=e.querySelector('[data-ref="categoryreset"]'),s=e.querySelector('[data-ref="categoryresetnote"]');if(!t||!s)return;let i=this.categoryDifferences;i!=null&&(t.disabled=i===0,t.textContent=i?`Reset to chart defaults \xB7 ${i.toLocaleString()} seat${i===1?"":"s"}`:"Reset to chart defaults",s.textContent=i?"Puts every seat this event moved back in its chart category. Held and booked seats keep the price they were sold at.":"Every seat sells under its chart category.")}async resetCategoriesToChart(){let e=this.els.rail.querySelector('[data-ref="categoryreset"]');e&&(e.disabled=!0,e.textContent="Resetting\u2026");try{let t=await this.withAuthRetry(()=>this.api.resetCategoriesToChart(this.key));t.changed&&await this.reloadEventChart(),this.categoryDifferences=0,this.clearSelection(),this.mode==="categories"&&this.paintRail(),this.paintCategoryReset(),this.done("resetCategories",t.labels,t.changed?`Put ${t.labels.length.toLocaleString()} seat${t.labels.length===1?"":"s"} back on the chart\u2019s categories.`:"Every seat already sells under its chart category.")}catch(t){this.paintCategoryReset(),this.toastErr("Couldn\u2019t reset those categories. Nothing changed."),this.opts.onError?.(t)}}paintCategorySelection(e){let t=this.els.rail,s=t?.querySelector('[data-ref="selcard"]'),i=t?.querySelector('[data-ref="catfoot"]');if(!s||!i)return;let n=this.selectionSummary(e,!0);D(s,n),this.paintAddBy(e.length);let o=t.querySelector('[data-ref="panelalert"]');o&&(o.innerHTML=this.panelAlert??"");let a=e.length,l=this.categoryTotals(),c=e.filter(m=>m.categoryKey===this.categoryChoice).length;t.querySelectorAll("[data-assign-category]").forEach(m=>{let u=m.dataset.assignCategory,b=u===this.categoryChoice;m.setAttribute("aria-checked",String(b)),m.classList.toggle("on",b),m.disabled=this.categoryBusy;let T=a>0&&n.types.length===1&&e[0].categoryKey===u,V=m.querySelector("[data-cat-current]");if(V){let oe=l.get(u)??0;V.textContent=T?"All selected seats are here now":`${S(oe)}`}});let d=this.doc?.categories.find(m=>m.key===this.categoryChoice)?.label??this.categoryChoice??"",h=a-c,p=n.parts.filter(m=>m.tone==="muted"||m.tone==="warn").map(m=>m.label);P(i,this.categoryBusy?{label:`Moving ${S(h)}\u2026`,busy:!0,note:"Buyers see the new ticket type as soon as this finishes."}:a?this.categoryChoice?h?{label:`Move ${S(h)} to ${d}`,note:p.length?`The ${p.join(" and ")} seats keep the price they were sold at.`:void 0}:{label:`Already ${d}`,disabled:!0,note:"Every selected seat already sells as this ticket type."}:{label:"Pick a ticket type",disabled:!0,note:`Choose where the ${a===1?"seat":`${a.toLocaleString()} seats`} should sell.`}:{label:"Select seats first",disabled:!0,note:"Pick seats on the map, then a ticket type."})}addByHtml(e){return`<details class="slm-addby" data-ref="addby" open><summary class="slm-eyebrow">Add seats by</summary>${e}</details>`}paintAddBy(e){let t=this.els.rail?.querySelector('[data-ref="addby"]');if(!t)return;e||(this.addByPinned=!1),t.dataset.wired||(t.dataset.wired="1",t.addEventListener("toggle",()=>{this.getSelection().length&&(this.addByPinned=t.open)}));let s=!e||this.addByPinned;t.open!==s&&(t.open=s)}categoryTotals(){if(this.categoryTotalsCache)return this.categoryTotalsCache;let e=new Map;for(let t of this.labelToSeat.values())e.set(t.categoryKey,(e.get(t.categoryKey)??0)+1);return this.categoryTotalsCache=e,e}selectionSummary(e,t=!1){let s={free:0,booked:0,held:0,blocked:0},i=new Map,n=new Map,o=this.rowLabels();for(let p of e){s[this.status.get(p.label)??"free"]+=1,n.set(p.categoryKey,(n.get(p.categoryKey)??0)+1);let m=this.sectionByObject.get(p.rowId)??k,u=i.get(m)??{label:this.sectionLabelById.get(m)??"Other seats",rows:new Map},b=o.get(p.rowId);b&&u.rows.set(b.startsWith(`${u.label} `)?b.slice(u.label.length+1):b,!0),i.set(m,u)}let a=(p,m)=>p.localeCompare(m,void 0,{numeric:!0,sensitivity:"base"}),l=[];s.free&&l.push({label:`${s.free.toLocaleString()} free`,tone:"ok"}),s.booked&&l.push({label:`${s.booked.toLocaleString()} sold`,tone:"muted"}),s.held&&l.push({label:`${s.held.toLocaleString()} in a cart`,tone:"warn"}),s.blocked&&l.push({label:`${s.blocked.toLocaleString()} blocked`,tone:"danger"});let c=t&&this.savedApplied&&this.savedApplied.labels.size===e.length&&e.every(p=>this.savedApplied.labels.has(p.label))?this.savedApplied:null,d=c?c.sold+c.taken:0,h=c&&[d?`${d.toLocaleString()} of the ${(e.length+d+c.missing).toLocaleString()} ${c.taken?`${c.sold?"were sold or are":"are"} in a cart or blocked`:`${d===1?"was":"were"} sold`} since it was saved, so ${e.length.toLocaleString()} ${e.length===1?"is":"are"} picked.`:"",c.missing?`${c.missing.toLocaleString()} saved ${c.missing===1?"seat is":"seats are"} no longer on this chart.${d?"":` The other ${e.length.toLocaleString()} are picked.`}`:""].filter(Boolean).join(" ")||null;return{count:e.length,where:c?`${c.name} \xB7 saved selection`:$e([...i.values()].map(p=>({label:p.label,rows:[...p.rows.keys()].sort(a)}))),stale:h,canSave:t&&this.canBlock(),canSimilar:t&&e.length>0&&this.isChoosingTool(),canUndo:this.selBack.length>0,saved:t?this.savedCount:null,parts:l,types:[...n].map(([p,m])=>{let u=this.doc?.categories.find(b=>b.key===p);return{label:u?.label??p,color:this.renderer?.categoryDisplayColor?.(p)??u?.color??"#6e7bff",count:m}})}}rowLabels(){if(this.rowLabelCache?.doc===this.doc)return this.rowLabelCache.labels;let e=new Map;for(let t of this.doc?.objects??[])t.type==="row"?e.set(t.id,t.segmentedRow?.displayLabel??t.displayLabel??t.label):t.type==="table"&&e.set(t.id,t.displayLabel??t.label);return this.rowLabelCache={doc:this.doc,labels:e},e}renderTablesRail(){let e=this.mountTask("table","#65a30d","Tables","Sell each table per chair, or as one whole-table booking.");this.loadExtras().then(t=>{this.closed||this.mode!=="tables"||!e.isConnected||(this.tablesPanel=t.mountTables({mount:e,...this.panelKit(),oldModel:this.inventoryModelVersion!==2,tables:()=>this.tableInfos(),save:async(s,i)=>{let n=await this.saveTableBooking(s,i);return n==="skipped"?"failed":n},show:s=>this.frameLabels([...this.labelToSeat.values()].filter(i=>i.rowId===s).map(i=>i.label))}))}).catch(t=>this.extrasFailed(e,t))}mountTask(e,t,s,i){let n=s==="Sections"?"sections":s==="Tables"?"tables":void 0;return this.els.rail.innerHTML=`${z({glyph:e,hue:t,title:s,badge:"This event only",purpose:i,how:n})}
835
+ <div data-ref="panelalert"></div><div data-ref="taskmount"><div class="slm-empty" role="status">Loading\u2026</div></div>`,this.els.rail.querySelector('[data-ref="taskmount"]')}panelKit(){let e=this.els.rail;return{alert:t=>{let s=e.querySelector('[data-ref="panelalert"]');s&&(s.innerHTML=t??"")},alertHtml:M,plate:x}}extrasFailed(e,t){e.isConnected&&(e.innerHTML='<div class="slm-empty" role="alert">This tool could not load. Switch tools and back to try again.</div>'),this.opts.onError?.(t)}tableInfos(){return this.tables().map(e=>{let t=0,s=0,i=0;for(let[o,a]of this.labelToSeat){if(a.rowId!==e.id)continue;let l=this.status.get(o);l==="held"?t++:l==="booked"?s++:l==="blocked"&&i++}let n=[s&&`${s} booked`,t&&`${t} in a cart`,i&&`${i} blocked`].filter(Boolean).join(" \xB7 ");return{id:e.id,label:e.displayLabel??e.label,chairs:e.seatCount,mode:e.variableOccupancy?"variable":e.bookAsWhole?"whole":"individual",locked:n||null,held:t}})}paintWatchSeat(e){let t=this.els.rail?.querySelector('[data-ref="watchseat"]');if(!t)return;let s=e[e.length-1];if(this.seatHistoryPanel?.destroy(),this.seatHistoryPanel=null,e.length>1){t.innerHTML='<div class="slm-selcard" aria-live="polite"></div>',D(t.firstElementChild,this.selectionSummary(e,!0));return}if(!s){t.innerHTML=`<div class="slm-watchhint">${x("cursor","#3b82f6",28)}<span>${G()?"Tap any seat to read it, or search a seat or booking.":`Click any seat to read it, or press <kbd>${ce()}</kbd> and type a seat or booking.`}</span></div>`;return}let i=this.status.get(s.label)??"free",n=this.sectionByObject.get(s.rowId)??k,o=this.sectionLabelById.get(n)??"Other seats",a=s.label.startsWith(`${o} `)?s.label.slice(o.length+1):s.label,[l,c]=a.includes("-")?[a.slice(0,a.lastIndexOf("-")),a.slice(a.lastIndexOf("-")+1)]:["",a],d=this.doc?.categories.find(y=>y.key===s.categoryKey),h=d?`${d.label}${typeof d.price=="number"?` \xB7 ${A(d.price,this.currency)}`:""}`:s.categoryKey,p=i==="blocked"?this.reservedBy.get(s.label):void 0,m=this.channels?.channelNameForLabel(s.label)??"Public sale",u=p?[["Status","Reserved"],["For",p.name],...p.by?[["Reserved by",p.by]]:[],["Until",p.releaseAt==null?"No end":q(p.releaseAt)]]:i==="booked"?[["Status","Sold"],["Ticket type",h],["Booking","\u2026"],["Buyer","\u2026"],["Channel",m]]:i==="held"?[["Status","In a cart"],["Ticket type",h],["Where","\u2026"],["Cart","\u2026"]]:i==="blocked"?[["Status","Blocked"],["Reason","\u2026"],["Blocked by","\u2026"],["Back on sale","\u2026"]]:[["Status","Free"],["Ticket type",h],["Channel",m]],b=(y,g,v,L)=>`<button type="button" class="slm-btn ghost" data-watch="${y}">${$(v,L,15)}${g}</button>`,T=p?b("reserve","Open in Reserve","bookmark","#c026d3"):i==="blocked"?b("unblock","Put back on sale","undo",W.free[1]):i==="free"?`${this.toolAvailable("block")?b("block","Block","ban","#d64545"):""}${this.toolAvailable("reserve")?b("reserve-seat","Reserve","bookmark","#c026d3"):""}`:"",[V,oe]=W[p?"reserved":i]??W.free;t.innerHTML=`<div class="slm-watchcard${p?" reserved":""}">
836
+ <div class="slm-seat-heading">${x(V,oe,30)}<span><h2>${f(o)} \xB7 ${f(a)}</h2>${l?`<small>Row ${f(l)}, seat ${f(c)}</small>`:""}</span>
837
+ <button type="button" class="slm-watchclose" data-watch="close" aria-label="Close the seat card">${$("x","currentColor",15)}</button></div>
838
+ <dl>${u.map(([y,g])=>`<div><dt>${f(y)}</dt><dd>${f(g)}</dd></div>`).join("")}</dl>
839
+ <div class="slm-watchacts">${T}${b("history","Seat history","history","#64748b")}</div>
840
+ <div data-ref="seat-history" hidden></div>
841
+ </div>`,i==="blocked"&&!p&&this.toolAvailable("block")&&this.loadBlockGroups().then(y=>{let g=y.find(L=>L.labels.includes(s.label)),v=t.querySelectorAll(".slm-watchcard dd");!v.length||!t.isConnected||(v[1].textContent=g?.reason??"No reason given",v[2].textContent=g&&[g.byYou?"you":g.byName,g.at?w(g.at,{day:"numeric",month:"short",hour:"2-digit",minute:"2-digit"}):null].filter(Boolean).join(" \xB7 ")||"\u2014",v[3].textContent=g?.releaseAt?q(g.releaseAt):"When you put it back")}).catch(()=>{});let ne=(y,g)=>this.withAuthRetry(()=>this.api.seatStory(this.key,s.label,y,g)),O=null,R=y=>[...t.querySelectorAll(".slm-watchcard dl > div")].find(g=>g.querySelector("dt")?.textContent===y);i==="held"&&(O=ne(),O.then(y=>{if(!t.isConnected||t.querySelector(".slm-watchcard h2")?.textContent!==`${o} \xB7 ${a}`)return;let g=y.cart;if(!g){R("Where")?.remove(),R("Cart")?.remove();return}let v=Math.max(0,Math.ceil((g.expiresAt-Date.now())/6e4));R("Status").querySelector("dd").textContent=`In a cart \xB7 ${v<=1?"under a minute":`${v} min`} left`,g.where?R("Where").querySelector("dd").textContent=g.where:R("Where")?.remove(),R("Cart").querySelector("dd").textContent=`${S(g.seats)}`}).catch(()=>{R("Where")?.remove(),R("Cart")?.remove()})),i==="booked"&&(O=ne(),O.then(y=>{if(!t.isConnected||t.querySelector(".slm-watchcard h2")?.textContent!==`${o} \xB7 ${a}`)return;let g=[...t.querySelectorAll(".slm-watchcard dl > div")],v=$t=>g.find(Ht=>Ht.querySelector("dt")?.textContent===$t),L=y.booking;if(L===void 0){v("Booking")?.remove(),v("Buyer")?.remove();return}let C=L?.order??null,N=v("Booking")?.querySelector("dd");N&&(N.textContent=L?.displayRef??C?.displayRef??L?.ref??"\u2014");let ke=C?[C.buyerName,C.buyerEmailDomain].filter(Boolean).join(" \xB7 "):"";ke?v("Buyer").querySelector("dd").textContent=ke:v("Buyer")?.remove(),C&&this.opts.onOpenOrder&&!t.querySelector('[data-watch="order"]')&&(t.querySelector(".slm-watchacts")?.insertAdjacentHTML("afterbegin",`<button type="button" class="slm-btn ghost" data-watch="order">${$("ticket","#8b5cf6",15)}Open order</button>`),t.querySelector('[data-watch="order"]').addEventListener("click",()=>this.opts.onOpenOrder({id:C.id,displayRef:C.displayRef})))}).catch(()=>{for(let y of t.querySelectorAll(".slm-watchcard dl > div")){let g=y.querySelector("dt")?.textContent;(g==="Booking"||g==="Buyer")&&(y.querySelector("dd").textContent="\u2014")}})),t.querySelectorAll("[data-watch]").forEach(y=>y.addEventListener("click",()=>{let g=y.dataset.watch;if(g==="history"){let v=t.querySelector('[data-ref="seat-history"]');v.hidden=!v.hidden,y.setAttribute("aria-expanded",String(!v.hidden)),!v.hidden&&!this.seatHistoryPanel&&this.loadExtras().then(async L=>{if(v.hidden||!v.isConnected||this.seatHistoryPanel)return;let C=O?await O.catch(()=>null):null;v.hidden||!v.isConnected||this.seatHistoryPanel||(this.seatHistoryPanel=L.mountSeatHistory({mount:v,free:i==="free",fetchPage:ne,first:C,openOrder:this.opts.onOpenOrder?N=>this.opts.onOpenOrder(N):null}))}).catch(L=>this.extrasFailed(v,L))}else g==="close"?this.clearSelection():g==="unblock"?this.unblock([s.label]):g==="reserve"?this.setMode("reserve"):(this.setMode(g==="block"?"block":"reserve"),this.selectByLabels([s.label]))}))}async refreshAvailability(){try{let e=await this.withAuthRetry(()=>this.api.availability(this.key));this.availabilityRules=e.rules??{},this.effectiveClosed=new Set(fe(this.availabilityRules)),this.sectionsPanel?.update(),this.applySectionCanvasTreatment()}catch(e){this.opts.onError?.(e)}}async withAuthRetry(e){try{return await e()}catch(t){if(t instanceof H&&t.status===401&&this.opts.onTokenRefresh&&!this.tokenRefreshInFlight){if(await this.rotateToken(),this.sessionEnded)throw t;return e()}throw t instanceof H&&t.status===401&&!this.opts.onTokenRefresh&&this.endSession(),t}}updateEffectiveAvailability(e,t){let s=!1;if(Array.isArray(e)){let i=new Set(e.filter(n=>typeof n=="string"));for(let n of this.effectiveHidden){let o=this.availabilityRules[n];i.has(n)||o?.mode!=="timed"&&o?.mode!=="threshold"||(delete this.availabilityRules[n],this.sectionsPanel?.fired(n,o.mode,Date.now()))}this.effectiveHidden=i,s=!0}Array.isArray(t)&&(this.effectiveClosed=new Set(t.filter(i=>typeof i=="string")),s=!0),s&&(this.sectionsPanel?.update(),this.applySectionCanvasTreatment())}applySectionCanvasTreatment(){this.renderer&&(this.refreshBlockPaint(),this.mode==="sections"?(this.renderer.setDimmedSections([...this.effectiveHidden]),this.renderer.setClosedSections([...this.effectiveClosed])):this.mode==="filterSections"&&this.filteredSectionLabel?this.applyFilteredSectionCanvas():(this.renderer.setDimmedSections(null),this.renderer.setClosedSections(null)))}sectionRowsInput(){return{sectionsBase:this.sectionsBase,doc:this.doc,availabilityRules:this.availabilityRules,effectiveHidden:this.effectiveHidden,effectiveClosed:this.effectiveClosed}}renderSectionsRail(){let e=this.mountTask("layers","#0ea5a5","Sections","Decide which sections buyers can see and buy, now or at a set time.");this.applySectionCanvasTreatment(),this.loadExtras().then(t=>{if(this.closed||this.mode!=="sections"||!e.isConnected)return;let s=this.opts.capabilities;this.sectionsPanel=t.mountSections({mount:e,...this.panelKit(),readOnly:!!s&&!s.includes("event:block"),organizationName:this.opts.organizationName,rows:()=>ge(this.sectionRowsInput()).rows,soldNow:()=>this.soldShareRest(),heldIn:i=>i.reduce((n,o)=>n+(this.status.get(o)==="held"?1:0),0),change:(i,n)=>this.changeSection(i,n),restore:async i=>{let n=i,o=await this.persistAvailability({...this.availabilityRules,...n});return o&&this.recordChange({kind:"section",restores:!0,sectionId:Object.keys(n)[0],labels:[]}),o},frame:i=>{let n=this.filterableSections().find(a=>a.id===i),o=n?[n]:this.filterableSections().filter(a=>a.zone===i);this.frameSections(o)}})}).catch(t=>this.extrasFailed(e,t))}async changeSection(e,t){let s=ge(this.sectionRowsInput()).rows.find(h=>h.id===e),i=s?.seatLabels??this.availabilityRules[e]?.labels??[],n={[e]:this.availabilityRules[e]??null},o={...this.availabilityRules},a=Ce(t.mode,i,this.availabilityRules[e]);if(a&&t.revealAt!=null&&(a.revealAt=t.revealAt),a&&t.thresholdPct!=null&&(a.thresholdPct=t.thresholdPct),a?o[e]=a:delete o[e],s?.kind==="zone"&&this.sectionsBase)for(let h of this.sectionsBase.sections)h.zone===e&&o[h.id]&&(n[h.id]=o[h.id],delete o[h.id]);if(!await this.persistAvailability(o))return null;let l=le(n[e]),c={open:"Opened",closed:"Closed",hidden:"Hid",timed:"Scheduled",threshold:"Set a threshold on"}[t.mode],d={open:"open again",closed:"closed again",hidden:"hidden again",timed:"on its schedule again",threshold:"waiting on its threshold again"}[l];return this.recordChange({kind:"section",sectionId:e,sectionLabel:s?.label??e,labels:i,before:n,after:this.availabilityRules[e]??null,verb:c,again:d}),n}soldShareRest(){let e=new Set;for(let i of Object.values(this.availabilityRules))for(let n of i.labels??[])e.add(n);let t=0,s=0;for(let i of this.labelToSeat.keys())e.has(i)||(t++,this.status.get(i)==="booked"&&s++);return t?Math.floor(s*100/t):0}async persistAvailability(e){let t=Object.fromEntries(Object.entries(e).filter(i=>!!i[1])),s=this.availabilityRules;this.availabilityRules=t;try{let i=await this.withAuthRetry(()=>this.api.setAvailability(this.key,t));return this.availabilityRules=i.rules,this.effectiveHidden=new Set(i.hidden),this.effectiveClosed=new Set(fe(i.rules)),this.applySectionCanvasTreatment(),!0}catch(i){return this.availabilityRules=s,this.opts.onError?.(i),!1}finally{this.sectionsPanel?.update()}}paintFeed(){this.activityPanel?.update(this.feed)}renderBlockRail(){let e=this.toolChooser();this.els.rail.innerHTML=`
842
+ ${z({glyph:"ban",hue:"#d64545",title:"Block",purpose:"Take seats off sale, for a camera, a broken seat or a sight-line. Sold seats and seats in a cart are never touched.",how:"block"})}
843
+ <div class="slm-monitor-tabs" role="tablist" aria-label="Blocking tools"><button role="tab" data-block-tab="edit" aria-selected="${!this.blockBrowse}">Block seats</button><button role="tab" data-block-tab="browse" aria-selected="${this.blockBrowse}" data-ref="blockedtab">Find blocked</button></div>
844
+ <div data-ref="panelalert"></div>
845
+ ${U()}
866
846
  <div data-block-editor ${this.blockBrowse?"hidden":""}>
867
- <p class="slm-eyebrow slm-step"><span class="slm-stepnum">1</span>Choose seats</p>
868
- <p class="slm-selecthelp">Zoom into a section, then drag a box or draw a lasso on the map, tap a row label for the whole row, press \u2318A for all of it, or pick below.</p>
869
- ${e.chipsHtml({intents:this.marqueeShapeChipsHtml()})}
870
- </div>
871
- ${this.toolSelectionBar("selnum","selmeta","clearsel","selall")}
872
- <p class="slm-eyebrow slm-step" data-block-editor-step ${this.blockBrowse?"hidden":""}><span class="slm-stepnum">2</span>Then</p>
873
- <div class="slm-row">
874
- <button class="slm-btn" data-ref="doblock" disabled>Block</button>
875
- <button class="slm-btn ghost" data-ref="dounblock" disabled>Put back on sale</button>
847
+ ${this.addByHtml(e.chipsHtml({saved:!0}))}
848
+ <p class="slm-eyebrow slm-step" style="margin-top:14px"><span class="slm-stepnum">2</span>Block them</p>
849
+ <div class="slm-field">
850
+ <label for="slm-block-reason">Reason <span class="slm-muted">(shown in History)</span></label>
851
+ <input id="slm-block-reason" class="slm-input" data-ref="blockreason" maxlength="80" placeholder="Camera platform, broken seat\u2026" />
876
852
  </div>
877
- <div data-block-editor ${this.blockBrowse?"hidden":""}>
878
853
  <div class="slm-field">
879
- <label>Auto-release blocks at (optional)</label>
880
- <input type="datetime-local" class="slm-input" data-ref="release" />
881
- <p class="slm-note" data-ref="releasenote">Leave empty to block permanently.</p>
854
+ <label>Put back on sale</label>
855
+ <div class="slm-chips" role="group" aria-label="When they go back on sale">
856
+ <button type="button" data-block-end="never">Never</button>
857
+ <button type="button" data-block-end="start" ${this.eventStartsAt&&this.eventStartsAt>Date.now()?"":'disabled title="Set the event date to use this"'}>At the start</button>
858
+ <button type="button" data-block-end="pick">Pick a time\u2026</button>
859
+ </div>
860
+ <input id="slm-block-release" type="datetime-local" class="slm-input" data-ref="release" hidden style="margin-top:8px" aria-label="When they go back on sale" />
861
+ <p class="slm-note" data-ref="releasenote"></p>
882
862
  </div>
883
863
  </div>
884
- <section ${this.blockBrowse?"":"hidden"} class="slm-blocked" aria-labelledby="slm-blocked-title">
885
- <div class="slm-blockedhead">
886
- <p class="slm-eyebrow" id="slm-blocked-title">Blocked inventory</p>
887
- <span class="slm-blockedtotal"><b data-ref="blockedcount">0</b> out of sale</span>
888
- </div>
889
- <p class="slm-selecthelp">Find blocked seats, select only the ones you need, then use \u201CPut back on sale\u201D.</p>
890
- <div class="slm-blockedtools">
891
- <input type="search" class="slm-input" data-ref="blockedsearch" placeholder="Find seat, row or category" aria-label="Search blocked seats" />
892
- <select class="slm-select" data-ref="blockedsection" aria-label="Filter blocked seats by section">
893
- <option value="">All sections</option>${t}
894
- </select>
895
- </div>
896
- <div class="slm-blockedsummary">
897
- <span data-ref="blockedshowing">No blocked seats</span>
898
- <button type="button" class="slm-linkbtn" data-ref="selblocked" disabled>Select results</button>
899
- </div>
900
- <div class="slm-blockedlist" data-ref="blockedlist"></div>
901
- </section>
902
- <details ${this.blockBrowse?"":"hidden"}><summary>More actions</summary><div class="slm-field">
903
- <button class="slm-btn ghost" data-ref="markall" style="width:100%" disabled>Put all blocked seats on sale</button>
904
- <p class="slm-note slm-allnote" data-ref="markallnote">For a full reset only. You will be asked to confirm.</p>
905
- </div></details>
906
- `,this.els.rail.querySelectorAll("[data-block-tab]").forEach(l=>l.addEventListener("click",()=>{this.blockBrowse=l.dataset.blockTab==="browse",this.renderBlockRail()}));let s=l=>this.els.rail.querySelector(`[data-ref="${l}"]`);this.els.selnum=s("selnum"),this.els.doblock=s("doblock"),this.els.dounblock=s("dounblock"),this.els.selmeta=s("selmeta"),this.els.blockedcount=s("blockedcount"),this.els.blockedshowing=s("blockedshowing"),this.els.blockedlist=s("blockedlist"),this.els.selblocked=s("selblocked"),this.els.markall=s("markall"),this.els.markallnote=s("markallnote"),s("doblock").addEventListener("click",()=>{this.block()}),s("dounblock").addEventListener("click",()=>{this.unblock()}),s("selall").addEventListener("click",()=>this.selectAll()),s("clearsel").addEventListener("click",()=>this.clearSelection()),s("markall").addEventListener("click",()=>this.confirmUnblockAll()),e.wire(this.els.rail),this.wireMarqueeShapeChips();let i=s("blockedsearch"),o=s("blockedsection");i.value=this.blockedQuery,o.value=this.blockedSection,i.addEventListener("input",()=>{this.blockedQuery=i.value,this.blockedResultLimit=100,this.paintBlockedInventory()}),o.addEventListener("change",()=>{this.blockedSection=o.value,this.blockedResultLimit=100,this.paintBlockedInventory()}),s("selblocked").addEventListener("click",()=>{this.toggleLabels(this.filteredBlockedSeats().map(l=>l.label))}),s("blockedlist").addEventListener("click",l=>{let r=l.target,c=r.closest("[data-block-seat-find]");if(c?.dataset.blockSeatFind){let u=this.labelToSeat.get(c.dataset.blockSeatFind);u&&(this.setFollowLive(!1),this.focusActivitySeats([u.label],this.sectionByObject.get(u.rowId)??v));return}let d=r.closest("[data-block-locate]"),h=r.closest("[data-block-group]");if(d||h){let u=d?.dataset.blockLocate??h?.dataset.blockGroup,g=this.filteredBlockedSeats().filter(f=>f.rowId===u);d&&g.length&&(this.setFollowLive(!1),this.focusActivitySeats(g.map(f=>f.label),this.sectionByObject.get(g[0].rowId)??v)),h&&this.toggleLabels(g.map(f=>f.label));return}let p=r.closest("[data-blocked-label]");p?.dataset.blockedLabel?this.toggleLabels([p.dataset.blockedLabel]):r.closest("[data-blocked-more]")&&(this.blockedResultLimit+=100,this.paintBlockedInventory())});let a=s("release");a.addEventListener("change",()=>{let l=a.value?new Date(a.value).getTime():NaN;this.releaseAt=Number.isFinite(l)&&l>Date.now()?l:null;let r=s("releasenote");r.textContent=this.releaseAt?`New blocks auto-release ${new Date(this.releaseAt).toLocaleString()}.`:a.value?"Pick a time in the future.":"Leave empty to block permanently."}),this.paintSelBar(this.getSelection())}toggleLabels(e){if(!this.renderer)return;let t=e.filter(o=>this.labelToSeat.has(o)&&this.isBlockSelectable(o));if(!t.length)return;let s=new Set(this.selectionLabels());if(t.every(o=>s.has(o))){let o=t.map(a=>this.labelToId.get(a)).filter(a=>!!a);this.renderer.deselect(o)}else this.renderer.selectByLabels(t);this.syncSelection()}isBlockSelectable(e){if(this.isHostUnavailable(e))return!1;let t=this.status.get(e)??"free";return t==="free"||t==="blocked"}paintSelBar(e){if(!this.els.selnum)return;this.els.selnum.textContent=e.length.toLocaleString();let t=e.filter(a=>(this.status.get(a.label)??"free")==="free").length,s=e.filter(a=>this.status.get(a.label)==="blocked").length;this.els.selmeta.textContent=e.length?`${t.toLocaleString()} available \xB7 ${s.toLocaleString()} blocked`:"selected";let i=this.els.doblock,o=this.els.dounblock;i.disabled=t===0,o.disabled=s===0,i.textContent=t?`Block ${t.toLocaleString()}`:"Block selected",o.textContent=s?`Put ${s.toLocaleString()} on sale`:"Put back on sale",this.paintBlockedInventory()}filteredBlockedSeats(){let e=this.blockedQuery.trim().toLocaleLowerCase(),t=[];for(let[s,i]of this.labelToSeat.entries()){if(this.status.get(s)!=="blocked")continue;let o=this.sectionByObject.get(i.rowId)??v;if(!(this.blockedSection&&o!==this.blockedSection)){if(e){let a=this.doc?.categories.find(h=>h.key===i.categoryKey)?.label??i.categoryKey,l=this.sectionLabelById.get(o)??"Other seats",r=this.doc?.objects.find(h=>h.id===i.rowId),c=r?.type==="row"||r?.type==="table"?r.label:"";if(!`${s} ${a} ${l} ${c}`.toLocaleLowerCase().includes(e))continue}t.push(i)}}return t.sort((s,i)=>s.label.localeCompare(i.label,void 0,{numeric:!0,sensitivity:"base"}))}paintBlockedInventory(){if(!this.els.blockedlist)return;let e=[...this.status.entries()].filter(([,h])=>h==="blocked").length,t=this.filteredBlockedSeats(),s=t.slice(0,this.blockedResultLimit),i=new Set(this.selectionLabels()),o=t.filter(h=>i.has(h.label)).length,a=t.length>0&&o===t.length;this.els.blockedcount.textContent=e.toLocaleString(),this.els.blockedshowing.textContent=t.length?`Showing ${s.length.toLocaleString()} of ${t.length.toLocaleString()}`:e?"No matches":"No blocked seats";let l=this.els.selblocked;l.disabled=t.length===0,l.textContent=a?`Remove ${t.length.toLocaleString()} results`:`Select ${t.length.toLocaleString()} results`;let r=new Map;for(let h of t){let p=r.get(h.rowId)??[];p.push(h),r.set(h.rowId,p)}this.els.blockedshowing.textContent=`${t.length.toLocaleString()} seats \xB7 ${r.size} rows`,this.els.blockedlist.innerHTML=[...r.entries()].slice(0,this.blockedResultLimit).map(([h,p])=>{let u=this.sectionByObject.get(h)??v,g=this.sectionLabelById.get(u)??"Other seats",f=this.doc?.objects.find(y=>y.id===h),b=f&&"label"in f?f.label:p[0].label;return`<div class="slm-block-group"><div class="slm-block-grouphead"><button type="button" data-block-locate="${m(h)}" title="Show this row and nearby seats on the map"><b>${m(b)}</b><small>${m(g)} \xB7 ${p.length} blocked</small></button><button type="button" data-block-group="${m(h)}">Select row</button></div>
907
- <details><summary>Choose seats</summary>${p.map(y=>`<div class="slm-block-seatline"><button type="button" class="slm-blockeditem${i.has(y.label)?" on":""}" data-blocked-label="${m(y.label)}" aria-pressed="${i.has(y.label)}"><span class="slm-blockedcheck" aria-hidden="true">\u2713</span><span>${m(y.label)}</span></button><button type="button" data-block-seat-find="${m(y.label)}" aria-label="Show ${m(y.label)} and nearby seats">Show</button></div>`).join("")}</details></div>`}).join("")||'<div class="slm-blockedempty">No blocked seats match.</div>',r.size>this.blockedResultLimit&&(this.els.blockedlist.innerHTML+="<button data-blocked-more>Show more rows</button>");let c=this.els.markall,d=c.dataset.confirm==="true";c.disabled=e===0,c.textContent=d?`Confirm: put all ${e.toLocaleString()} on sale`:`Put all ${e.toLocaleString()} blocked seats on sale`}confirmUnblockAll(){let e=this.els.markall;if(!(!e||e.disabled)){if(e.dataset.confirm==="true"){this.resetUnblockAllConfirm(),this.unblockAll();return}e.dataset.confirm="true",e.classList.add("danger"),this.els.markallnote.textContent="This changes every blocked seat. Click the red button again to confirm.",this.paintBlockedInventory(),this.unblockAllConfirmTimer&&clearTimeout(this.unblockAllConfirmTimer),this.unblockAllConfirmTimer=setTimeout(()=>this.resetUnblockAllConfirm(),6e3)}}resetUnblockAllConfirm(){this.unblockAllConfirmTimer&&clearTimeout(this.unblockAllConfirmTimer),this.unblockAllConfirmTimer=null;let e=this.els.markall;e&&(delete e.dataset.confirm,e.classList.remove("danger"),this.els.markallnote&&(this.els.markallnote.textContent="For a full reset only. You will be asked to confirm."),this.paintBlockedInventory())}done(e,t,s){if(this.toastOk(s),t.length){let i=e==="block"?this.pushActivity(t,"blocked","blocked"):e==="unblock"||e==="unblockAll"?this.pushActivity(t,"unblocked","free"):e==="cancelBooking"?this.pushActivity(t,"cancelled","free"):null;i&&this.paintSpatialActivity(i)}e!=="setHoldTtl"&&this.refreshControlRoom().catch(i=>this.opts.onError?.(i)),this.opts.onActionComplete?.({action:e,labels:t,count:t.length})}toastOk(e){this.toast(e,"ok")}toastErr(e){this.toast(e,"err")}toast(e,t){let s=this.els.toast;s&&(s.textContent=e,s.className=`slm-toast on ${t}`,this.toastTimer&&clearTimeout(this.toastTimer),this.toastTimer=setTimeout(()=>{s.className="slm-toast"},3200))}fail(e){this.opts.onError?.(e),this.els.rail&&(this.els.rail.innerHTML=`<div class="slm-empty">Couldn't load this event. Check the event key and token.</div>`)}};export{Xe as ACCESS_LINK_DEFAULTS,at as ChannelsMode,O as ManageApi,k as ManageApiError,ze as PUBLIC_CHANNEL_ID,Ie as PUBLIC_CHANNEL_NAME,q as SeatManager,Ge as accessIntentDescription,We as accessIntentLabel,Ue as accessLine,Qe as accessLinkBadge,tt as accessLinkErrorCopy,Je as accessLinkIsLive,et as accessLinkPolicyLines,_e as bucketRows,ot as bucketRowsHtml,st as dropReviewRows,Ze as intentForbidsCopy,Ye as intentSwitchBlockedCopy,Oe as isPublicChannelId,Fe as markerLetter,De as markerOf,qe as mutationCount,Ne as needsMoveConfirmation,je as planAssignment,Ke as retryAfterCopy,Ve as selectionSources,it as stateBadge,Pe as suggestMarker};
864
+ <div data-ref="findblocked" ${this.blockBrowse?"":"hidden"}><div class="slm-empty" role="status">Loading\u2026</div></div>
865
+ ${Y("blockfoot")}
866
+ `,this.els.rail.querySelectorAll("[data-block-tab]").forEach(o=>o.addEventListener("click",()=>{this.blockBrowse=o.dataset.blockTab==="browse",this.renderBlockRail()}));let t=o=>this.els.rail.querySelector(`[data-ref="${o}"]`),s=t("blockfoot");this.findBlocked?.destroy(),this.findBlocked=null,this.els.rail.classList.toggle("slm-blk-listing",this.blockBrowse),this.blockBrowse&&this.mountFindBlocked(t("findblocked"),s),s.querySelector("[data-foot-action]").addEventListener("click",()=>{let o=t("blockreason")?.value.trim();if(!this.blockBrowse){if(this.blockDone?.partial){this.blockDone=null,this.panelAlert=null,this.paintSelBar(this.getSelection());return}this.selectionFree()?this.block(void 0,o?{reason:o}:{}):this.unblock()}}),s.querySelector("[data-foot-secondary]").addEventListener("click",()=>{if(this.blockBrowse)return;let o=this.blockDone&&this.blockDone.until>Date.now()?this.blockDone:null;o?(this.blockDone=null,this.panelAlert=null,this.unblock(o.labels)):this.unblock()}),e.wire(this.els.rail);let i=t("release"),n=()=>{if(this.blockEnd==="never")this.releaseAt=null;else if(this.blockEnd==="start")this.releaseAt=this.eventStartsAt&&this.eventStartsAt>Date.now()?this.eventStartsAt:null;else{let o=i.value?new Date(i.value).getTime():NaN;this.releaseAt=Number.isFinite(o)&&o>Date.now()?o:null}this.els.rail.querySelectorAll("[data-block-end]").forEach(o=>o.setAttribute("aria-pressed",String(o.dataset.blockEnd===this.blockEnd))),i.hidden=this.blockEnd!=="pick",t("releasenote").textContent=this.releaseAt?`Back on sale ${q(this.releaseAt)}. The seats return by themselves.`:this.blockEnd==="pick"?"Pick a time in the future.":"Stays off sale until you put it back.",this.paintSelBar(this.getSelection())};this.els.rail.querySelectorAll("[data-block-end]").forEach(o=>o.addEventListener("click",()=>{this.blockEnd=o.dataset.blockEnd,n(),this.blockEnd==="pick"&&i.focus()})),i.addEventListener("change",n),n()}toggleLabels(e){if(!this.renderer)return;let t=e.filter(n=>this.labelToSeat.has(n)&&this.isBlockSelectable(n));if(!t.length)return;let s=new Set(this.selectionLabels());if(t.every(n=>s.has(n))){let n=t.map(o=>this.labelToId.get(o)).filter(o=>!!o);this.renderer.deselect(n)}else this.renderer.selectByLabels(t);this.syncSelection()}isReserveSelectable(e){return!this.isHostUnavailable(e)&&(this.status.get(e)??"free")==="free"}renderReserveRail(){let e=this.toolChooser();this.els.rail.innerHTML=`
867
+ ${z({glyph:"bookmark",hue:"#c026d3",title:"Reserve",purpose:"Keep seats aside for guests, press or comps. Reserved seats leave sale until you release them or their time runs out.",how:"reserve"})}
868
+ <div data-ref="reservetabs"></div>
869
+ <div data-ref="panelalert"></div>
870
+ ${U()}
871
+ ${this.addByHtml(e.chipsHtml({saved:!0}))}
872
+ <div data-ref="reservemount"><div class="slm-empty" role="status">Loading\u2026</div></div>
873
+ ${Y("reservefoot")}`,e.wire(this.els.rail);let t=this.els.rail.querySelector('[data-ref="reservemount"]'),s=this.els.rail.querySelector('[data-ref="reservefoot"]'),i=this.els.rail;P(s,{label:"Select seats first",disabled:!0}),this.paintReserveSelection(this.getSelection()),this.loadExtras().then(n=>{this.closed||this.mode!=="reserve"||!t.isConnected||(this.reserve=n.mountReserve({rail:i,mount:t,foot:s,paintFoot:P,tabs:i.querySelector('[data-ref="reservetabs"]'),alert:o=>{let a=i.querySelector('[data-ref="panelalert"]');a&&(a.innerHTML=o??"")},alertHtml:M,selectedFree:()=>this.getSelection().filter(o=>this.isReserveSelectable(o.label)).map(o=>o.label),whereOf:o=>this.selectionSummary(o.flatMap(a=>this.labelToSeat.get(a)??[])).where,startsAt:this.eventStartsAt,request:(o,a)=>this.reserveRequest(o,a),show:o=>this.showLabels(o),select:o=>{this.selectByLabels(o)},deselect:o=>{this.renderer?.deselect(o.map(a=>this.labelToId.get(a)).filter(a=>!!a)),this.syncSelection()},clearSelection:()=>{this.renderer?.clearSelection(),this.syncSelection()},toast:(o,a)=>this.toast(o,a),changed:()=>{this.refreshReservations()}}))}).catch(n=>{t.isConnected&&(t.innerHTML='<div class="slm-empty" role="alert">Reservations could not load. Switch tools and back to try again.</div>'),this.opts.onError?.(n)})}async reserveRequest(e,t){let s=t?.method==="POST"&&(/^reservations\/[^/]+\/release$/.test(e)||e==="reservations/release-all"),i=new Map;if(s)for(let[o,a]of this.reservedBy){let l=i.get(a.id)??{name:a.name,releaseAt:a.releaseAt,labels:[]};l.labels.push(o),i.set(a.id,l)}let n=await this.withAuthRetry(()=>this.api.eventRequest(this.key,e,t));if(t?.method==="POST"&&e==="reservations"){let o=n.reservation;o&&this.recordChange({kind:"reserve",reservationId:o.id,name:o.name,labels:o.labels,releaseAt:o.releaseAt})}else if(s){let o=new Set(n.released??[]),a=e==="reservations/release-all"?null:decodeURIComponent(e.split("/")[1]);for(let[l,c]of i){if(a&&l!==a)continue;let d=c.labels.filter(h=>o.has(h));d.length&&this.recordChange({kind:"release",reservationId:l,name:c.name,releaseAt:c.releaseAt,labels:d})}}return n}async mountArrival(){try{let e=await this.loadExtras();if(this.closed)return;let t=this.opts;(t.focusSection||t.focusSeat||t.focusSeats?.length||t.focusCategory||t.arrivedFrom)&&this.arrival.push(e.mountArrival({mapLayer:this.root.querySelector(".slm-map"),plate:x,focusSeats:s=>{let i=s.flatMap(n=>(this.labelToSeat.has(n)?n:[...this.labelToSeat.keys()].find(o=>o.localeCompare(n,void 0,{sensitivity:"accent"})===0))??[]);return i.length?(this.showLabels(i),(this.mode==="view"||this.isChoosingTool())&&(this.clearSelection(),this.selectByLabels(i)),i):[]},focusCategory:s=>{let i=this.doc?.categories.find(n=>n.key===s||(n.label??"").localeCompare(s,void 0,{sensitivity:"accent"})===0);return i?(this.showLabels([...this.labelToSeat.values()].filter(n=>n.categoryKey===i.key).map(n=>n.label)),i.label??i.key):null},sections:()=>this.sectionOptions,stateOf:s=>{if(this.effectiveHidden.has(s))return{kind:"hidden"};let i=this.availabilityRules[s],n=le(i);return n==="timed"?{kind:"timed",until:i?.revealAt??null}:n==="threshold"?{kind:"threshold",pct:i?.thresholdPct??null}:n==="closed"?{kind:"closed"}:{kind:"open"}},frame:s=>{let i=this.filterableSections().find(n=>n.id===s);i&&this.frameSections([i]),this.renderer?.flashSection(s,"#3b82f6")},openSections:this.toolAvailable("sections")?()=>this.setMode("sections"):null},{section:t.focusSection,seats:t.focusSeats?.length?t.focusSeats:t.focusSeat?[t.focusSeat]:void 0,category:t.focusCategory,from:t.arrivedFrom?.from,where:t.arrivedFrom?.where,why:t.arrivedFrom?.why,back:t.arrivedFrom?.back})),t.onOpenTrend&&t.kpis!==!1&&this.els.kpis&&this.arrival.push(e.mountTrendCards({kpis:this.els.kpis,card:s=>{if(!["booked-inventory","booked-pct","booked-value"].includes(s))return null;let i=this.buildTallies(),n=this.controlRoomSnapshot?.velocity,o=n?.bySection.reduce((p,m)=>p+m.netBooked,0)??0,a=n?.bySection.slice().sort((p,m)=>m.netBooked-p.netBooked)[0],l=a&&a.netBooked>0?this.sectionLabelById.get(a.sectionId)??null:null,c=n?.windowMinutes??15,d=s==="booked-value"&&i.bookedValueStatus==="current"?`${A(i.bookedValue,i.currency)} booked value`:`${i.booked.toLocaleString()} sold \xB7 ${i.capacityPct}%`,h=o>0?`+${o.toLocaleString()} in the last ${c} minutes${l?`, most in ${l}`:""}. The room shows where; Performance shows how it got here.`:`Nothing sold in the last ${c} minutes. Performance shows how it got here.`;return{title:d,line:h,sectionId:l?a.sectionId:void 0}},open:(s,i)=>t.onOpenTrend({kpi:s,...i?{sectionId:i}:{}})}))}catch(e){this.opts.onError?.(e)}}async openSimilar(e){try{let t=await this.loadExtras();if(this.closed||!e.isConnected)return;let s=this.rowLabels(),i=new Set(this.selectableStatuses());t.openSimilar({anchor:e,plate:x,seats:()=>[...this.labelToSeat.values()].map(n=>{let o=this.sectionByObject.get(n.rowId)??k,a=this.sectionLabelById.get(o)??"Other seats",l=this.doc?.categories.find(h=>h.key===n.categoryKey),c=s.get(n.rowId)??"",d=n.label.startsWith(`${a} `)?n.label.slice(a.length+1):n.label;return{label:n.label,row:n.logicalRowId??n.rowId,rowLabel:c.startsWith(`${a} `)?c.slice(a.length+1):c,section:o,sectionLabel:a,type:n.categoryKey,typeLabel:l?.label??n.categoryKey,status:this.status.get(n.label)??"free",number:d.includes("-")?d.slice(d.lastIndexOf("-")+1):d,x:n.x,y:n.y}}),selected:()=>new Set(this.selectionLabels()),pickable:n=>i.has(B(n.status))&&!this.isHostUnavailable(n.label),view:()=>this.renderer?.getVisibleWorldRect?.()??null,add:n=>{this.selectByLabels(n)}})}catch(t){this.opts.onError?.(t)}}ensureSaved(){return this.saved?Promise.resolve(this.saved):this.loadExtras().then(e=>this.closed?null:(this.saved??=e.mountSaved({mapLayer:this.root.querySelector(".slm-map"),plate:x,request:(t,s)=>this.withAuthRetry(()=>this.api.eventRequest(this.key,t,s)),canSave:this.canBlock(),picks:()=>this.isChoosingTool(),selection:()=>this.selectionLabels(),describe:t=>{let s=t.flatMap(o=>this.labelToSeat.get(o)??[]),i=this.selectionSummary(s),n=[...new Set(t.flatMap(o=>{let a=this.reservedBy.get(o)?.name,l=this.blockGroups?.groups.find(c=>c.labels.includes(o))?.reason;return[a,l].filter(c=>!!c)}))];return{where:i.where,line:[`${S(s.length)}`,i.where.replace(" \xB7 ",", "),i.parts.map(o=>o.label).join(", ")].filter(Boolean).join(" \xB7 "),suggestions:[i.where,...n].filter((o,a,l)=>o&&l.indexOf(o)===a)}},apply:(t,s)=>this.applySaved(t,s),toast:(t,s)=>this.toast(t,s),changed:t=>{this.savedCount=t,this.getSelection().length||this.syncSelection()}}),this.saved))}applySaved(e,t){let s=e.filter(o=>this.labelToSeat.has(o)),i=s.length;if(this.isChoosingTool()){t.add||this.clearSelection();let o=new Set(this.selectionLabels());this.selectByLabels(s);let a=new Set(this.selectionLabels()),l=s.filter(d=>!a.has(d)&&!o.has(d));i=s.length-l.length;let c=l.filter(d=>this.status.get(d)==="booked").length;this.savedApplied=t.add?null:{name:t.name,labels:a,missing:e.length-s.length,sold:c,taken:l.length-c},this.syncSelection()}else this.showLabels(s);this.root?.querySelector(".slm-savedpill")?.remove();let n=i===e.length?`${S(i)}`:`${i.toLocaleString()} of ${e.length.toLocaleString()} seats`;this.root?.querySelector(".slm-map")?.insertAdjacentHTML("beforeend",`<div class="slm-savedpill" role="status">${x("star","#d99a0b",20)}<span><b>${f(t.name)}</b> \xB7 saved selection \xB7 ${n}</span></div>`),this.isChoosingTool()||setTimeout(()=>this.root?.querySelector(".slm-savedpill")?.remove(),8e3)}recordChange(e){this.ensureChanges().then(t=>t?.record(e)).catch(t=>this.opts.onError?.(t))}ensureChanges(){return this.changes?Promise.resolve(this.changes):(this.changesLoading??=this.loadExtras().then(e=>{if(this.closed)return null;let t=(i,n)=>this.withAuthRetry(()=>this.api.eventRequest(this.key,i,n)),s=async(i,n)=>{try{return await this.withAuthRetry(i),n?.(),!0}catch(o){return this.opts.onError?.(o),!1}};return this.changes=e.mountChanges({eventKey:this.key,startsAt:this.eventStartsAt,mapLayer:this.root.querySelector(".slm-map"),plate:x,whereOf:i=>this.selectionSummary(i.flatMap(n=>this.labelToSeat.get(n)??[])).where,seats:async()=>{let i=await this.withAuthRetry(()=>this.api.objects(this.key)),n=i.default??"free",o=new Map;for(let a of this.labelToSeat.keys())o.set(a,i.seats[a]??n);return o},reservations:async()=>{let i=await t("reservations");return this.closed||this.setReservations(i.reservations??[]),i.reservations??[]},rules:async()=>{let i=await this.withAuthRetry(()=>this.api.availability(this.key));return this.availabilityRules=i.rules??{},this.availabilityRules},block:(i,n,o)=>s(()=>this.api.block(this.key,i,{...n?{reason:n}:{},...o?{releaseAt:o}:{}}),()=>{this.setSeatsLocal(i,"blocked"),this.blockGroups=null}),unblock:i=>s(()=>this.api.unblock(this.key,i),()=>{this.setSeatsLocal(i,"free"),this.blockGroups=null}),reserve:(i,n,o)=>{for(let a of i)this.reserving.add(a);return s(()=>t("reservations",{method:"POST",body:{labels:i,name:n,releaseAt:o}}),()=>{this.refreshReservations()}).finally(()=>{for(let a of i)(this.reservedBy.has(a)||this.status.get(a)!=="blocked")&&this.reserving.delete(a)})},release:i=>s(()=>t(`reservations/${encodeURIComponent(i)}/release`,{method:"POST"}),()=>{this.refreshReservations()}),restoreRules:i=>this.persistAvailability({...this.availabilityRules,...i}),channelBack:async i=>(await this.ensureChannels(),this.channels?this.channels.sendBack(i):{moved:0,failed:!0}),show:i=>this.showLabels(i),openTask:i=>this.setMode(i==="types"?"categories":"tables"),changed:()=>{this.feedFilter==="you"&&this.paintFeedFilter()}}),this.changes}).finally(()=>{this.changesLoading=null}),this.changesLoading)}paintFeedFilter(){let e=this.els.rail,t=e?.querySelector('[data-ref="feedfilter"]');if(!e||!t||this.mode!=="view")return;let s=this.feedFilter,i={all:"All",sales:"Sales",carts:"Carts",you:"You"};t.innerHTML=`<b>${s==="you"?"Your changes":"Live activity"}</b><span role="group" aria-label="Show in the feed">${Object.keys(i).map(o=>`<button type="button" data-feed-filter="${o}" aria-pressed="${o===s}">${i[o]}</button>`).join("")}</span>`;let n=e.querySelector('[data-ref="yours"]');for(let o of["feed","alertfeed","nosales"]){let a=e.querySelector(`[data-ref="${o}"]`);a&&(a.hidden=s==="you")}n&&(n.hidden=s!=="you"),this.activityPanel?.setFilter(s==="sales"?["booked","cancelled"]:s==="carts"?["held","expired","released"]:null),s==="you"&&n&&(this.changes||(n.innerHTML='<div class="slm-empty" role="status">Loading\u2026</div>'),this.ensureChanges().then(o=>{o&&n.isConnected&&this.feedFilter==="you"&&o.paintList(n)}).catch(o=>{n.isConnected&&this.extrasFailed(n,o)}))}async mountAlerts(){if(!(this.alerts||this.closed||!this.els.bell))try{let e=await this.loadExtras();if(this.closed||this.alerts)return;let t=(s,i)=>this.withAuthRetry(()=>this.api.eventRequest(this.key,s,i));this.alerts=e.mountAlerts({mapLayer:this.root.querySelector(".slm-map"),bellMount:this.els.bell,bannerMount:this.els.awaybanner,alertHtml:M,plate:x,sections:()=>this.sectionOptions,sectionCounts:s=>{let i=this.filterableSections().find(a=>a.id===s)?.seatLabels??[],n=0,o=0;for(let a of i){let l=this.status.get(a)??"free";l==="free"?n++:l==="booked"&&o++}return{total:i.length,free:n,booked:o}},reservations:()=>{let s=new Map;for(let[i,n]of this.reservedBy){let o=s.get(n.id)??{id:n.id,name:n.name,releaseAt:n.releaseAt,labels:[]};o.labels.push(i),s.set(n.id,o)}return[...s.values()]},where:s=>this.selectionSummary(s.flatMap(i=>this.labelToSeat.get(i)??[])).where,canManage:this.canBlock(),show:(s,i)=>{if(s.sectionId){let n=this.filterableSections().find(o=>o.id===s.sectionId);n&&this.frameSections([n]),this.renderer?.flashSection(s.sectionId,"#d99a0b")}else s.labels?.length&&this.showLabels(s.labels);this.showWhy(i)},extend:async(s,i)=>{let n=[...this.reservedBy.values()].find(o=>o.id===s)?.releaseAt;if(n==null)return!1;try{return await t(`reservations/${encodeURIComponent(s)}`,{method:"PATCH",body:{releaseAt:n+i}}),this.refreshReservations(),!0}catch{return!1}},release:async s=>{try{return await this.reserveRequest(`reservations/${encodeURIComponent(s)}/release`,{method:"POST"}),this.refreshReservations(),!0}catch{return!1}},reserveAgain:s=>{this.setMode("reserve"),this.selectByLabels(s)},ring:(s,i)=>this.renderer?.flashSection(s,i),feedSlot:()=>this.mode==="view"?this.els.rail?.querySelector('[data-ref="alertfeed"]')??null:null,store:e.eventAlertStore(this.key,t)})}catch(e){this.opts.onError?.(e)}}showWhy(e){let t=this.els.liveevent;t&&(t.innerHTML=`<span class="slm-liveeventdot" style="background:#e8782a"></span><span class="slm-liveeventcopy">${f(e)}</span>`,t.classList.add("on"),this.liveEventTimer&&clearTimeout(this.liveEventTimer),this.liveEventTimer=setTimeout(()=>{this.liveEventTimer=null,t.classList.remove("on"),t.innerHTML=""},4e3))}mountFindBlocked(e,t){let s=this.els.rail;this.loadExtras().then(i=>{this.closed||this.mode!=="block"||!this.blockBrowse||!e.isConnected||(this.findBlocked=i.mountFindBlocked({mount:e,foot:t,paintFoot:P,alertHtml:M,alert:n=>{let o=s.querySelector('[data-ref="panelalert"]');o&&(o.innerHTML=n??"")},request:n=>this.withAuthRetry(()=>this.api.eventRequest(this.key,n)),whereOf:n=>this.selectionSummary(n.flatMap(o=>this.labelToSeat.get(o)??[])).where,sections:this.sectionOptions,sectionOf:n=>{let o=this.labelToSeat.get(n);return o?this.sectionByObject.get(o.rowId)??k:null},selectedBlocked:()=>this.getSelection().filter(n=>this.status.get(n.label)==="blocked"&&!this.reservedBy.has(n.label)).map(n=>n.label),show:n=>this.showLabels(n),select:n=>{this.renderer?.clearSelection(),this.selectByLabels(n)},unblock:async n=>(await this.unblock(n),n.every(o=>this.status.get(o)!=="blocked")),block:async(n,o,a)=>(await this.block(n,{...o?{reason:o}:{},...a?{releaseAt:a}:{}}),n.every(l=>this.status.get(l)==="blocked")),unblockAll:()=>this.unblockAll(),openReserve:()=>this.setMode("reserve")}))}).catch(i=>{e.isConnected&&(e.innerHTML='<div class="slm-empty" role="alert">Blocked seats could not load. Switch tabs and back to try again.</div>'),this.opts.onError?.(i)})}paintReserveSelection(e){let t=this.els.rail?.querySelector('[data-ref="selcard"]');t&&(D(t,this.selectionSummary(e,!0)),this.paintAddBy(e.length),this.reserve?.paint())}isBlockSelectable(e){if(this.isHostUnavailable(e))return!1;let t=this.status.get(e)??"free";return t==="free"||t==="blocked"}paintSelBar(e){let t=this.els.rail,s=t?.querySelector('[data-ref="selcard"]'),i=t?.querySelector('[data-ref="blockfoot"]');if(!s||!i)return;D(s,this.selectionSummary(e,!0)),this.paintAddBy(e.length);let n=t.querySelector('[data-ref="panelalert"]');n&&(!this.blockBrowse||this.panelAlert)&&(n.innerHTML=this.panelAlert??"");let o=e.filter(u=>(this.status.get(u.label)??"free")==="free").length,a=e.filter(u=>this.status.get(u.label)==="blocked").length,l=S,c=t.querySelector('[data-ref="blockedtab"]'),{blocked:d}=this.buildTallies(),h=d-this.reservedTally(d);if(c&&(c.textContent=h>0?`Find blocked \xB7 ${h.toLocaleString()}`:"Find blocked"),this.blockBrowse){this.findBlocked?.paint();return}let p=this.blockDone&&(this.blockDone.partial||this.blockDone.until>Date.now())?this.blockDone:null,m=this.releaseAt?q(this.releaseAt):null;P(i,this.blockBusy?{label:`Blocking ${l(this.getSelection().length)}\u2026`,busy:!0,note:"Buyers already cannot pick these seats."}:p?.partial&&!o?{label:"Done",secondary:`Undo the ${p.labels.length.toLocaleString()}`}:this.blockBrowse||!o&&a?{label:a?`Put ${l(a)} back on sale`:"Put back on sale",disabled:!a,note:a?"Buyers can pick them again right away.":"Select blocked seats in the list or on the map."}:o?this.blockFailedNow?{label:"Try again",danger:!0,note:"Your selection and reason are kept."}:{label:m?`Block ${l(o)} until ${m}`:`Block ${l(o)}`,danger:!0,secondary:a?`Put the ${a.toLocaleString()} blocked back on sale`:null,note:a?`The ${a.toLocaleString()} already blocked keep their reason.`:m?"Buyers can\u2019t pick them until then.":"Buyers can\u2019t pick them. Sold seats and seats in a cart are never blocked."}:{label:"Select seats first",disabled:!0,note:p?"Blocked just now":"Pick free seats on the map. Sold seats and seats in a cart are never blocked.",secondary:p?"Undo":null})}selectionFree(){return this.getSelection().filter(e=>(this.status.get(e.label)??"free")==="free").length}doneQuietly(e,t,s){try{this.done(e,t,s)}catch(i){this.opts.onError?.(i)}}done(e,t,s){if(!this.tablesPanel&&(this.mode!=="block"||!this.els.rail?.querySelector('[data-ref="blockfoot"]'))&&this.toastOk(s),t.length){let i=e==="block"?this.pushActivity(t,"blocked","blocked"):e==="unblock"||e==="unblockAll"?this.pushActivity(t,"unblocked","free"):e==="cancelBooking"?this.pushActivity(t,"cancelled","free"):null;i&&this.paintSpatialActivity(i)}e!=="setHoldTtl"&&this.refreshControlRoom().catch(i=>this.opts.onError?.(i)),this.opts.onActionComplete?.({action:e,labels:t,count:t.length})}toastOk(e){this.toast(e,"ok")}toastErr(e){this.toast(e,"err")}toast(e,t,s){let i=this.els.toast;if(i){if(i.textContent=e,i.className=`slm-toast on ${t}`,s){let n=document.createElement("button");n.type="button",n.textContent=s.label,n.addEventListener("click",()=>{i.className="slm-toast",s.run()}),i.append(" ",n)}this.toastTimer&&clearTimeout(this.toastTimer),this.toastTimer=setTimeout(()=>{i.className="slm-toast"},s?8e3:3200)}}fail(e){this.opts.onError?.(e);let t=e instanceof H?e.status:0;this.showRoomCard(t===401||t===403?"access":t===404?"missing":"offline"),this.els.rail&&(this.els.rail.innerHTML="")}showRoomCard(e){let t=this.root;if(!t)return;t.querySelector('[data-ref="opening"]')?.remove(),t.querySelector('[data-ref="roomcard"]')?.remove(),t.insertAdjacentHTML("beforeend",Ve(e,this.opts.organizationName)),t.querySelector('[data-ref="roomcard"]').querySelector("[data-roomcard-act]")?.addEventListener("click",()=>{e==="signedout"?this.retrySession():this.reopen()})}async reopen(){let e=this.root;!e||this.closed||(e.querySelector('[data-ref="roomcard"]')?.remove(),this.renderer?.destroy(),this.renderer=null,e.querySelector(".slm-map")?.insertAdjacentHTML("beforeend",pe()),this.els.rail&&(this.els.rail.innerHTML=me()),await this.load())}};export{Xt as ACCESS_LINK_DEFAULTS,ns as ChannelsMode,de as ManageApi,H as ManageApiError,It as PUBLIC_CHANNEL_ID,Ot as PUBLIC_CHANNEL_NAME,xe as SeatManager,Gt as accessIntentDescription,Ut as accessIntentLabel,Wt as accessLine,Jt as accessLinkBadge,ts as accessLinkErrorCopy,Qt as accessLinkIsLive,es as accessLinkPolicyLines,Kt as bucketRows,os as bucketRowsHtml,ss as dropReviewRows,Yt as intentForbidsCopy,Zt as intentSwitchBlockedCopy,zt as isPublicChannelId,Pt as markerLetter,Dt as markerOf,Vt as mutationCount,Nt as needsMoveConfirmation,qt as planAssignment,_t as retryAfterCopy,jt as selectionSources,is as stateBadge,Ft as suggestMarker};