@seatlayer/js 0.65.0 → 0.67.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/index.cjs CHANGED
@@ -1657,7 +1657,7 @@
1657
1657
  </div>
1658
1658
  </div>`;let s={};return i.querySelectorAll("[data-ref]").forEach(n=>{s[n.dataset.ref]=n}),{root:i,mapHost:s.map,els:s}}function Si(r){let e=(t,i)=>{for(let s of r.querySelectorAll(`[${t}]`)){let n=s.getAttribute(t);if(!n)continue;let o=(0,Pe.t)(n);o!==n&&i(s,o)}};e("data-sl-t",(t,i)=>{t.textContent=i}),e("data-sl-a",(t,i)=>{t.setAttribute("aria-label",i)}),e("data-sl-ti",(t,i)=>{t.setAttribute("title",i)})}var oe=require("@seatlayer/core/view/panoramaDelivery");function Ti(r){let{root:e,source:t,caption:i,real:s,closeLabel:n,dragHint:o,viewFromSeatLabel:a,real360Label:l,previewLabel:c,resolveAsset:h,onClose:p}=r,d=document.createElement("div");d.className="sl-view",d.setAttribute("role","dialog"),d.setAttribute("aria-label",a),d.innerHTML=`<div class="sl-view-head"><span class="sl-view-title">${a}</span><span class="sl-view-cap">${i}</span><button type="button" class="sl-view-x" aria-label="${n}"><svg viewBox="0 0 24 24"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></svg></button></div><div class="sl-view-pano"><span class="sl-view-badge">${s?l:c}</span><span class="sl-view-hint">${o}</span></div>`,e.appendChild(d);let m=d.querySelector(".sl-view-pano"),f=(0,oe.planPanoramaDelivery)(t,(0,oe.browserPanoramaConstraints)()),x=new AbortController;m.style.backgroundImage=`url("${f.initialUrl}")`;let w=()=>{};f.upgradeUrl&&(w=(0,oe.schedulePanoramaUpgrade)(()=>{h(f.upgradeUrl).then(C=>!C||x.signal.aborted?null:(0,oe.loadPanoramaImage)(C,x.signal).then(()=>C)).then(C=>{!C||!d.isConnected||x.signal.aborted||(m.style.backgroundImage=`url("${C}")`)}).catch(()=>{})}));let b=70,P=35,k=1,T=m.clientHeight||1,O=m.clientWidth||1,E=-(T*(180/b)*2/2-O/2),u=0,y=()=>{let C=m.clientHeight||1,j=C*(180/b)*k,$=Math.max(0,j-C),_e=Math.min($/2,P/180*j);u=Math.min(_e,Math.max(-_e,u)),m.style.backgroundSize=`auto ${j}px`,m.style.backgroundPosition=`${E}px ${u-$/2}px`};y();let A=!1,D=0,L=0,H=C=>{A=!0,D=C.clientX,L=C.clientY,m.classList.add("drag"),m.setPointerCapture?.(C.pointerId)},z=C=>{A&&(E+=C.clientX-D,u+=C.clientY-L,D=C.clientX,L=C.clientY,y())},q=C=>{A=!1,m.classList.remove("drag"),m.releasePointerCapture?.(C.pointerId)},ge=C=>{C.preventDefault(),k=Math.min(2.4,Math.max(1,k+(C.deltaY<0?.12:-.12))),y()};m.addEventListener("pointerdown",H),m.addEventListener("pointermove",z),m.addEventListener("pointerup",q),m.addEventListener("pointercancel",q),m.addEventListener("wheel",ge,{passive:!1});let Ie=d.querySelector(".sl-view-x");Ie.addEventListener("click",p);let $e=C=>{C.key==="Escape"&&(C.stopPropagation(),p())};return d.addEventListener("keydown",$e),Ie.focus(),{element:d,dispose(){w(),x.abort(),m.removeEventListener("pointerdown",H),m.removeEventListener("pointermove",z),m.removeEventListener("pointerup",q),m.removeEventListener("pointercancel",q),m.removeEventListener("wheel",ge),d.removeEventListener("keydown",$e),Ie.removeEventListener("click",p)}}}var ae=require("@seatlayer/core"),Di=require("@seatlayer/core/core/seatConfidence");var Mi=require("@seatlayer/core"),Hi=require("@seatlayer/core/core/cdnAsset"),$r=require("@seatlayer/core/core/cdnAsset");function g(r,e){let t=(0,Mi.t)(r);return t===r?e:t}function Ri(r){if(typeof r=="string"){let e=document.querySelector(r);if(!e)throw new Error(`seatmap: container "${r}" not found`);return e}if(!(r instanceof HTMLElement))throw new Error("seatmap: container must be a CSS selector or an HTMLElement");return r}function G(r){return String(r??"").replace(/[&<>"']/g,e=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[e])}var Ae=null;function Oi(){if(Ae!==null)return Ae;try{if(typeof document>"u")return Ae=!1;Ae=!!document.createElement("canvas").getContext("webgl2")}catch{Ae=!1}return Ae}function Et(r){return(0,Hi.cdnAssetUrl)(r)}async function Ii(){return typeof __SEATLAYER_CDN__<"u"&&__SEATLAYER_CDN__?import(Et("seatlayer-view3d.mjs")):import("@seatlayer/core/view3d")}async function $i(){return typeof __SEATLAYER_CDN__<"u"&&__SEATLAYER_CDN__?import(Et("seatlayer-panorama.mjs")):import("@seatlayer/core")}async function _i(){return typeof __SEATLAYER_CDN__<"u"&&__SEATLAYER_CDN__?import(Et("seatlayer-checkout.mjs")):Promise.resolve().then(()=>(Li(),Ai))}function Bi(r){return r==="unavailable_for_event"||r==="payments_off_for_event"?r:"not_configured"}function at(r,e,t){let i={month:"short",day:"numeric",hour:"numeric",minute:"2-digit"},s=new Date(r);if(e)try{return s.toLocaleString(t,{...i,timeZone:e})}catch{}return s.toLocaleString(t,i)}function Fi(r){return String(r??"\u2014").replace(/[&<>"]/g,e=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"})[e])}function S(r){return String(r??"").replace(/[&<>"]/g,e=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"})[e])}function me(r){return r?.restrictedView?g("picker.restrictedView","Restricted view"):r?.obstructedView?g("picker.obstructedView","Obstructed view"):""}function ji(r){if(!r)return"";let e=[];r.premium&&e.push(`<div class="sl-cx-premium"><span class="sl-cx-star" aria-hidden="true">\u2605</span>${g("picker.premiumSeat","Premium seat")}</div>`);let t=me(r);return t?e.push(`<div class="sl-cx-warn"><span class="sl-cx-glyph" aria-hidden="true">\u25D0</span><span class="sl-cx-txt"><b>${t}</b>${r.note?`<span class="sl-cx-note">${S(r.note)}</span>`:""}</span></div>`):r.note&&e.push(`<div class="sl-cx-warn"><span class="sl-cx-glyph" aria-hidden="true">\u2139</span><span class="sl-cx-txt"><span class="sl-cx-note">${S(r.note)}</span></span></div>`),e.length?`<div class="sl-cx">${e.join("")}</div>`:""}function Pt(r){let e=me(r);if(!e)return"";let t=S(r?.note?r.note:e);return`<span class="sl-cx-mark" role="img" aria-label="${t}" title="${t}">\u25D0</span>`}function Le(r){return r==="no-seat"?g("picker.emptyWheelchairSpace","Empty wheelchair space"):r==="seat-present"?g("picker.accessiblePhysicalSeat","Accessible physical seat"):""}function Ni(r){let e=Le(r);return e?`<div class="sl-cx"><div class="sl-cx-warn"><span class="sl-cx-glyph" aria-hidden="true">\u267F</span><span class="sl-cx-txt"><b>${e}</b></span></div></div>`:""}function At(r){let e=Le(r);return e?`<span class="sl-cx-mark" role="img" aria-label="${e}" title="${e}">\u267F</span>`:""}function Lt(r,e){if(!r)return"";let t=e?g("picker.viewFromThisSeat","View from this seat"):g("picker.seeItIn3d","See it in 3D");return`<button type="button" class="sl-confirm-3d" aria-label="${t}"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 2l9 5v10l-9 5-9-5V7z"/><path d="M12 12l9-5M12 12v10M12 12L3 7"/></svg><span>${t}</span></button>`}function Vi(r){if(!r)return"";let e=r.previous.label||r.previous.id,t=r.next.label||r.next.id;return`<span class="sl-seccard-nav" aria-label="${g("picker.browseSections","Browse sections")}"><button type="button" data-section-nav="${G(r.previous.id)}" aria-label="${g("picker.previousSection","Previous section")}: ${G(e)}" title="${G(e)}">\u2190</button><button type="button" data-section-nav="${G(r.next.id)}" aria-label="${g("picker.nextSection","Next section")}: ${G(t)}" title="${G(t)}">\u2192</button></span>`}function Gi(r,e){if(!e)return"";let t=e,i=t.includes(r.id),s=i?t.length>1?g("picker.openComparison","Open comparison"):g("picker.savedForComparison","Saved for comparison"):t.length?g("picker.compareWithSaved","Compare with saved"):g("picker.saveToCompare","Save to compare");return`<button type="button" class="sl-confirm-compare"${i&&t.length===1?" disabled":""}><span aria-hidden="true">\u21C4</span><span>${S(s)}</span></button>`}function qi(r,e,t){if(!t)return"";let i=(0,Di.seatConfidenceDisclosure)(r.confidenceEvidence),s=i.modeledTarget??i.reality;return`<button type="button" class="sl-confirm-confidence" aria-label="Open seat confidence passport for ${S(r.displayLabel??r.label)}"><span><em>${S(e)}</em><strong>${S(i.headline)}</strong><small>${S(s)}</small></span><b>Passport</b></button>`}function le(r){let e=r?.rowLabel,t=r?.sectionLabel;if(!e||!t)return e;for(let i of["-"," ","\xB7","/","_"]){let s=`${t}${i}`;if(e.startsWith(s)&&e.length>s.length)return e.slice(s.length)}return e}function _r(r){switch(r){case"paused":return{title:g("picker.accessPausedTitle","These seats are on hold right now"),body:g("picker.accessPausedBody","The organizer has paused this selection. Try again in a few minutes."),action:g("picker.accessRetry","Try again")};case"revoked":return{title:g("picker.accessRevokedTitle","This access link is no longer active"),body:g("picker.accessRevokedBody","Ask whoever sent you here for a new link to keep booking these seats.")};case"no_token":case"provider_failed":return{title:g("picker.accessExpiredTitle","Your access session has ended"),body:g("picker.accessExpiredBody","Sign in again, or reload the page, to keep browsing these seats. Anything you are already holding stays yours."),action:g("picker.accessRetry","Try again")};default:return{title:g("picker.accessInvalidTitle","We couldn\u2019t verify your access"),body:g("picker.accessInvalidBody","You can still book anything shown as available. Contact whoever sent you here for access to the rest.")}}}function Ui(r,e,t){let i=Fi;return[r?.sectionLabel?`<div class="sl-confirm-field"><span class="sl-confirm-key">${g("picker.section","Section")}</span><span class="sl-confirm-value">${i(r.sectionLabel)}</span></div>`:"",r?.rowLabel||r?.objectType==="booth"?`<div class="sl-confirm-field"><span class="sl-confirm-key">${i(t)}</span><span class="sl-confirm-value">${i(le(r)??r?.displayLabel??e)}</span></div>`:"",r?.objectType!=="booth"?`<div class="sl-confirm-field"><span class="sl-confirm-key">${g("picker.seat","Seat")}</span><span class="sl-confirm-value">${i(r?.seatNumber??r?.displayLabel??e)}</span></div>`:""].filter(Boolean).join("")}function zi(r){return r.buyerMessage?.trim()||(r.restriction==="companion"?g("picker.companionRequiresWheelchair","Requires the adjacent wheelchair place"):void 0)}function Ki(r,e,t){let i=Fi;if(r.length>1)return`<fieldset class="sl-confirm-tiers"><legend>${g("picker.ticketType","Ticket type")}</legend>`+r.map(o=>{let a=zi(o);return`<button type="button" class="sl-confirm-tier" data-confirm-tier="${i(o.id)}" aria-pressed="${o.id===e}"><span class="sl-confirm-tier-copy"><span class="sl-confirm-tier-name">${i(o.name)}</span>`+(a?`<small class="sl-confirm-tier-note">${i(a)}</small>`:"")+`</span><span class="sl-confirm-tier-price">${t(o)}</span></button>`}).join("")+"</fieldset>";let s=r[0],n=s?zi(s):void 0;return n?`<p class="sl-confirm-tier-note">${i(n)}</p>`:""}function Mt(r){return`<span class="sl-seccard-dot" style="background:${S(r.color)}"></span><span class="sl-seccard-name">${S(r.label)}</span><span class="sl-seccard-left">${r.leftLabel}</span>`+r.nav+r.close}function Wi(r){return`<div class="sl-seccard-head"><span class="sl-seccard-dot" style="background:${S(r.color)}"></span><span class="sl-seccard-name">${S(r.label)}</span>`+(r.showPrice?`<span class="sl-seccard-price">${r.priceLabel}</span>`:"")+r.close+`</div><div class="sl-seccard-zone">${r.zoneLabel?`${S(r.zoneLabel)} \xB7 `:""}<span class="sl-seccard-left">${r.leftLabel}</span></div>`+(r.entrance?`<div class="sl-seccard-entrance">${S(r.entrance)}</div>`:"")+(r.mix?`<div class="sl-seccard-mix">${r.mix}</div>`:"")+`<div class="sl-seccard-foot"><button type="button" class="sl-seccard-overview">\u2190 ${S(r.overviewLabel)}</button>`+r.nav+`<span class="sl-seccard-hint">${S(r.hint)}</span></div>`}function Yi(r){return`<span class="sl-seccard-mix-item${r.dim?" sl-dim":""}"><span class="sl-seccard-mix-dot" style="background:${S(r.color)}"></span>${S(r.label)} <span class="sl-seccard-mix-price">${r.rangeLabel}</span></span>`}function Qi(r){return'<div class="sl-confirm-grid">'+r.identityFields+`</div><div class="sl-confirm-cat"><span class="sl-dot" style="background:${S(r.categoryColor)}"></span><span class="sl-confirm-cat-name">${S(r.categoryLabel)}</span>`+(r.priceLabel?`<span class="sl-confirm-price">${r.priceLabel}</span>`:"")+'</div><div class="sl-confirm-body">'+r.tierChoices+r.wheelchair+r.commercial+r.thumb+r.inspect+`<div class="sl-confirm-row"><button type="button" class="sl-confirm-cancel">${S(r.cancelLabel)}</button><button type="button" class="sl-confirm-add"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M5 12.5l4 4L19 7"/></svg>${S(r.selectLabel)}</button></div></div>`}function Xi(r,e){let t=G,{variable:i}=e;return`<section class="sl-table-dialog" role="dialog" aria-modal="true" aria-labelledby="sl-table-title" aria-describedby="sl-table-copy"><div class="sl-table-head"><div class="sl-table-eyebrow">${t(i?(0,ae.t)("picker.flexiblePartyTypeWord",{typeWord:e.typeWord}):(0,ae.t)("picker.wholeTypeWord",{typeWord:e.typeWord}))}</div><h2 class="sl-table-title" id="sl-table-title">${t(r.displayLabel??r.label)}</h2><p class="sl-table-copy" id="sl-table-copy">${i?g("picker.chooseGuestsCopy","Choose how many guests will sit together. This table is held exclusively for your party."):(0,ae.t)("picker.allPlacesBookedTogether",{count:r.capacity})}</p></div><div class="sl-table-body"><div class="sl-table-summary"><span>${t(e.categoryLabel)}</span><b data-table-unit>${(0,ae.t)("picker.perGuestPrice",{price:e.unitPrice})}</b><span class="muted">${g("picker.tableCapacity","Table capacity")}</span><span>${(0,ae.t)("picker.guestsCount",{count:r.capacity})}</span><span class="muted">${g("picker.total","Total")}</span><b data-table-total></b></div>`+(i?`<label class="sl-table-qtylabel" id="sl-table-qty-label">${g("picker.numberOfGuests","Number of guests")}</label><div class="sl-table-stepper" role="group" aria-labelledby="sl-table-qty-label"><button type="button" data-table-step="-1" aria-label="${g("picker.fewerGuests","Fewer guests")}">\u2212</button><output aria-live="polite" data-table-qty>${r.quantity}</output><button type="button" data-table-step="1" aria-label="${g("picker.moreGuests","More guests")}">+</button></div><div class="sl-table-range">${(0,ae.t)("picker.chooseMinMaxGuests",{min:r.minOccupancy,max:r.maxOccupancy})}</div>`:`<input type="hidden" data-table-qty value="${r.capacity}">`)+`<div class="sl-table-actions"><button type="button" class="sl-table-cancel">${(0,ae.t)("common.cancel")}</button><button type="button" class="sl-table-confirm">${e.held?g("picker.updateTable","Update table"):i?g("picker.selectTable","Select table"):g("picker.selectWholeTable","Select whole table")}</button></div></div></section>`}function Zi(r,e){let t=_r(r),i=document.createElement("div");i.className="sl-access",i.setAttribute("role","status"),i.setAttribute("aria-live","polite");let s=document.createElement("div"),n=document.createElement("div");n.className="sl-access-title",n.textContent=t.title;let o=document.createElement("div");if(o.className="sl-access-body",o.textContent=t.body,s.append(n,o),t.action){let a=document.createElement("button");a.type="button",a.className="sl-access-act",a.textContent=t.action,a.addEventListener("click",e),s.appendChild(a)}return i.appendChild(s),i}function Ji(r){let e=document.createElement("div");e.className="sl-floors on",e.setAttribute("role","group"),e.setAttribute("aria-label",r.tf("picker.chooseLevel","Choose level"));let t=[{id:"",name:r.tf("picker.allFloors","All floors")},...r.floors.map(n=>({id:n.id,name:n.name}))];for(let n of t){let o=document.createElement("button");o.type="button",o.dataset.floor=n.id,o.textContent=n.name,o.setAttribute("aria-pressed","false"),o.addEventListener("click",()=>r.onChoose(n.id)),e.appendChild(o)}let i=document.createElement("button");i.type="button",i.className="sl-floor-info",i.textContent="i";let s=r.tf("picker.floorHelp","All floors shows the complete venue. Choose one level to inspect and select its seats.");return i.setAttribute("aria-label",s),i.title=s,e.appendChild(i),e}function es(r,e,t){if(!r)return;let i=t?"":e;r.querySelectorAll("button[data-floor]").forEach(s=>{s.setAttribute("aria-pressed",String(s.dataset.floor===i))})}var ts=require("@seatlayer/core"),Me=require("@seatlayer/core/picker/minimapGeometry");function is(r,e){let t=new Ht(r);return t.build(e),t}var Ht=class{constructor(e){this.host=e;this.miniCanvas=null;this.miniBase=null;this.miniWrap=null;this.miniToggle=null;this.miniLabel=null;this.miniTf=null;this.miniDrag=null;this.miniSuppressClick=!1;this.userClosed=!1}build(e){if(!this.host.controller.getViewport())return;let i=document.createElement("button");i.type="button",i.className="sl-minimap-toggle",i.setAttribute("aria-label",g("picker.openVenueMap","Open venue overview map")),i.setAttribute("aria-expanded","false"),i.innerHTML='<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M3 6l5-2 8 3 5-2v13l-5 2-8-3-5 2zM8 4v13M16 7v13"/></svg>',e.appendChild(i),this.miniToggle=i;let s=document.createElement("div");s.className="sl-minimap",s.setAttribute("role","group");let n=document.createElement("div");n.className="sl-minimap-bar";let o=document.createElement("span");o.className="sl-minimap-label";let a=document.createElement("span");a.className="sl-minimap-key",a.setAttribute("aria-label",g("picker.minimapStateKey","Focused, selected, available, and inactive sections")),a.innerHTML='<i class="focused" title="Focused"></i><i class="selected" title="Selected"></i><i title="Available"></i><i class="inactive" title="Inactive"></i>';let l=document.createElement("button");l.type="button",l.className="sl-minimap-close",l.setAttribute("aria-label",g("picker.closeVenueMap","Close venue overview map")),l.textContent="\xD7",n.append(o,a,l);let c=document.createElement("canvas");c.tabIndex=0,c.setAttribute("role","application"),c.setAttribute("aria-label",g("picker.venueMapInstructions","Venue overview map. Drag the viewport, click a section, or use arrow keys to pan.")),s.append(n,c),e.appendChild(s),this.miniWrap=s,this.miniLabel=o,this.miniCanvas=c;let h=document.createElement("canvas");this.miniBase=h,i.addEventListener("click",()=>{let p=this.host.root()?.dataset.minimapOpen==="true";this.userClosed=p,this.setMinimapOpen(!p)}),l.addEventListener("click",()=>{this.userClosed=!0,this.setMinimapOpen(!1)}),c.addEventListener("click",p=>{if(this.miniSuppressClick){this.miniSuppressClick=!1;return}this.minimapJump(p)}),c.addEventListener("pointerdown",p=>this.minimapPointerDown(p)),c.addEventListener("pointermove",p=>this.minimapPointerMove(p)),c.addEventListener("pointerup",p=>this.minimapPointerUp(p)),c.addEventListener("pointercancel",p=>this.minimapPointerUp(p)),c.addEventListener("keydown",p=>this.minimapKeydown(p)),this.layoutMinimap(),this.syncMinimapLabel(),this.drawMinimapStatic(),this.drawMinimapRect()}setAutoOpen(e){if(this.miniWrap){if(!e){this.userClosed=!1,this.host.root()?.dataset.minimapOpen==="true"&&this.setMinimapOpen(!1,!1);return}this.userClosed||this.host.root()?.dataset.minimapOpen==="true"||this.setMinimapOpen(!0,!1)}}setMinimapOpen(e,t=!0){this.host.root()?.setAttribute("data-minimap-open",String(e)),this.miniToggle?.setAttribute("aria-expanded",String(e)),t&&(e?this.miniCanvas?.focus():this.miniToggle?.focus())}layoutMinimap(){let e=this.miniCanvas,t=this.miniBase,i=this.host.controller.getViewport()?.bounds;if(!e||!t||!i||!(i.width>0&&i.height>0))return;let s=196,n=146,o=6,a=i.width/Math.max(1,i.height),l=s,c=Math.round(s/a);c>n&&(c=n,l=Math.round(n*a)),l=Math.max(64,l),c=Math.max(48,c);let h=Math.min(2,window.devicePixelRatio||1);e.width=Math.round(l*h),e.height=Math.round(c*h),e.style.width=`${l}px`,e.style.height=`${c}px`,t.width=e.width,t.height=e.height,this.miniTf=(0,Me.createMinimapTransform)(i,e.width,e.height,h,o)}syncMinimapLabel(){if(!this.miniLabel||!this.miniWrap)return;let e=this.host.controller.getFloors(),t=this.host.controller.isFloorOverview()?g("picker.allFloors","All floors"):e.find(h=>h.id===this.host.controller.getActiveFloorId())?.name??g("picker.venueOverview","Venue overview"),i=this.host.controller.getMinimapSnapshot().sections,n=i.find(h=>h.active)?.label??this.host.focusedSectionLabel(),o=n?`${t} \xB7 ${n}`:t;this.miniLabel.textContent=o;let a=i.filter(h=>h.state==="selected").length,l=i.filter(h=>h.state==="available").length,c=i.filter(h=>h.state==="inactive").length;this.miniWrap.setAttribute("aria-label",i.length?`${o}. ${a} selected, ${l} available, ${c} inactive sections.`:o),this.miniCanvas?.setAttribute("aria-label",i.length?`${o}. ${a} selected, ${l} available, ${c} inactive sections. ${g("picker.venueMapInstructions","The outlined region is the visible map area. Drag it, click a section, or use arrow keys to pan.")}`:`${o}. ${g("picker.venueMapInstructions","The outlined region is the visible map area. Drag it, click elsewhere, or use arrow keys to pan.")}`)}refreshMinimap(){this.miniBase&&(this.layoutMinimap(),this.syncMinimapLabel(),this.drawMinimapStatic(),this.drawMinimapRect())}drawMinimapStatic(){let e=this.miniBase,t=this.miniTf;if(!e||!t)return;let i=e.getContext("2d");if(!i)return;i.clearRect(0,0,e.width,e.height);let s=p=>p*t.scale+t.offX,n=p=>p*t.scale+t.offY,o=this.host.cssVar("--sl-line")||"rgba(139,147,167,.5)",a=this.host.cssVar("--sl-muted")||"#8b93a7",l=this.host.cssVar("--sl-accent")||"#6e7bff",c=this.host.cssVar("--sl-success")||"#22a06b",h=this.host.controller.getMinimapSnapshot();for(let p of h.sections)p.outline.length<3||(i.beginPath(),p.outline.forEach((d,m)=>m===0?i.moveTo(s(d.x),n(d.y)):i.lineTo(s(d.x),n(d.y))),i.closePath(),i.globalAlpha=p.state==="inactive"?.18:p.state==="selected"?.72:.34,i.fillStyle=p.state==="inactive"?a:p.state==="selected"?l:c,i.fill(),i.globalAlpha=.82,i.lineWidth=Math.max(1,t.dpr),i.strokeStyle=o,i.stroke(),p.active&&(i.globalAlpha=1,i.lineJoin="round",i.lineWidth=Math.max(4,t.dpr*3.5),i.strokeStyle=this.host.cssVar("--sl-surface")||"#fff",i.stroke(),i.lineWidth=Math.max(2,t.dpr*1.75),i.strokeStyle=l,i.stroke()));if(i.globalAlpha=1,!h.sections.length){let p=Math.max(1,t.dpr);for(let d of h.seats)i.globalAlpha=d.state==="inactive"?.22:.78,i.fillStyle=d.state==="inactive"?a:d.state==="selected"?l:c,i.beginPath(),i.arc(s(d.x),n(d.y),p,0,Math.PI*2),i.fill();i.globalAlpha=1}}drawMinimapRect(){let e=this.miniCanvas,t=this.miniBase,i=this.miniTf;if(!e||!t||!i)return;let s=e.getContext("2d");if(!s)return;s.clearRect(0,0,e.width,e.height),s.drawImage(t,0,0);let n=this.host.controller.getViewport();if(!n)return;let o=(0,Me.minimapViewportPlan)(n.visible,i,e.width,e.height,Math.max(2,i.dpr*2)),a=this.host.cssVar("--sl-text")||"#12151c",l=this.host.cssVar("--sl-surface")||"#fff";s.save(),s.globalAlpha=.1,s.fillStyle=a,s.fillRect(o.raw.x,o.raw.y,o.raw.width,o.raw.height),s.globalAlpha=.9,s.lineJoin="round",s.lineWidth=Math.max(4,i.dpr*3.25),s.strokeStyle=l,s.strokeRect(o.raw.x,o.raw.y,o.raw.width,o.raw.height),s.globalAlpha=1,s.lineWidth=Math.max(2,i.dpr*1.75),s.strokeStyle=a,s.strokeRect(o.raw.x,o.raw.y,o.raw.width,o.raw.height),o.clipped&&Object.values(o.clippedEdges).some(Boolean)&&(s.setLineDash([Math.max(3,i.dpr*3),Math.max(2,i.dpr*2)]),s.strokeRect(o.clipped.x,o.clipped.y,o.clipped.width,o.clipped.height)),s.restore()}minimapWorldPoint(e){let t=this.miniCanvas,i=this.miniTf;if(!t||!i)return null;let s=t.getBoundingClientRect(),n=(e.clientX-s.left)*(t.width/Math.max(1,s.width)),o=(e.clientY-s.top)*(t.height/Math.max(1,s.height));return{...(0,Me.minimapPointToWorld)({x:n,y:o},i),px:n,py:o}}minimapPointerDown(e){let t=this.minimapWorldPoint(e),i=this.host.controller.getViewport()?.visible;!t||!i||!(t.x>=i.x&&t.x<=i.x+i.width&&t.y>=i.y&&t.y<=i.y+i.height)||(this.miniDrag={pointerId:e.pointerId,offsetX:t.x-(i.x+i.width/2),offsetY:t.y-(i.y+i.height/2),startX:e.clientX,startY:e.clientY,moved:!1},this.miniCanvas?.setPointerCapture(e.pointerId),this.miniCanvas?.classList.add("sl-dragging"),e.preventDefault())}minimapPointerMove(e){let t=this.miniDrag;if(!t||t.pointerId!==e.pointerId)return;let i=this.minimapWorldPoint(e);i&&(!t.moved&&Math.hypot(e.clientX-t.startX,e.clientY-t.startY)>2&&(t.moved=!0,this.host.controller.clearSectionFocus()),this.host.controller.panToWorld({x:i.x-t.offsetX,y:i.y-t.offsetY}),e.preventDefault())}minimapPointerUp(e){let t=this.miniDrag;!t||t.pointerId!==e.pointerId||(this.miniSuppressClick=t.moved,this.miniDrag=null,this.miniCanvas?.classList.remove("sl-dragging"),this.miniCanvas?.hasPointerCapture(e.pointerId)&&this.miniCanvas.releasePointerCapture(e.pointerId))}minimapKeydown(e){let t=this.host.controller.getViewport()?.visible;if(!t)return;if(e.key==="Home"){this.host.controller.overview(),e.preventDefault();return}let i=e.key==="ArrowLeft"?-t.width*.2:e.key==="ArrowRight"?t.width*.2:0,s=e.key==="ArrowUp"?-t.height*.2:e.key==="ArrowDown"?t.height*.2:0;!i&&!s||(this.host.controller.clearSectionFocus(),this.host.controller.panToWorld({x:t.x+t.width/2+i,y:t.y+t.height/2+s}),e.preventDefault())}minimapJump(e){let t=this.minimapWorldPoint(e);if(t){for(let i of this.host.controller.getMinimapSnapshot().sections)if(!(i.state==="inactive"||i.outline.length<3)&&(0,ts.pointInPolygon)(t,i.outline)){this.host.controller.focusSection(i.id);return}this.host.controller.clearSectionFocus(),this.host.controller.panToWorld(t)}}};var lt=require("@seatlayer/core");var Br=12;function ss(r,e){let t=e.floors(),i=new Set(t.map(b=>b.label.trim().toLocaleLowerCase())),s=e.zones().filter(b=>b.seatCount>0&&!i.has(b.label.trim().toLocaleLowerCase())),n=e.sections().filter(b=>b.seatCount>0&&!i.has(b.label.trim().toLocaleLowerCase())),o=s.length>1?[]:n,a=t.length>1,l=s.length>1,c=o.length>1;if(!a&&!l&&!c)return;let h=document.createElement("div");h.className="sl-view3d-nav";let p=document.createElement("button");p.type="button",p.className="sl-view3d-nav-toggle",p.setAttribute("aria-expanded","false");let d='<svg viewBox="0 0 24 24" aria-hidden="true"><circle cx="12" cy="12" r="9"/><path d="M15.5 8.5l-2 5-5 2 2-5z"/></svg>',m=document.createElement("span");p.innerHTML=d,p.appendChild(m);let f=b=>{h.classList.toggle("is-open",b),p.setAttribute("aria-expanded",String(b)),m.textContent=b?g("picker.closeVenueNav","Close"):a&&(l||c)?g("picker.levelsAndAreas","Levels & areas"):a?g("picker.levels","Levels"):g("picker.areas","Areas")};p.addEventListener("click",()=>f(!h.classList.contains("is-open"))),h.addEventListener("keydown",b=>{b.key!=="Escape"||!h.classList.contains("is-open")||(b.preventDefault(),b.stopPropagation(),f(!1),p.focus())}),f(!1),h.appendChild(p);let x=b=>{},w=b=>{};if(a){let b=document.createElement("div");b.setAttribute("role","group"),b.setAttribute("aria-label",g("picker.levels","Levels"));let P=[];w=O=>{P.forEach(E=>{E.setAttribute("aria-pressed",String((E.dataset.floor===""?null:Number(E.dataset.floor))===O))})};let k=O=>{e.focusFloor(O)&&(w(O),x(O))},T=(O,E)=>{let u=document.createElement("button");u.type="button",u.textContent=O,u.dataset.floor=E===null?"":String(E),u.setAttribute("aria-pressed",String(E===null)),u.addEventListener("click",()=>{k(E),f(!1)}),P.push(u),b.appendChild(u)};T(g("picker.allLevels","All levels"),null);for(let O of t)T(O.label||(0,lt.t)("picker.levelNumber",{number:O.index+1}),O.index);h.appendChild(b)}if(l||c){let b=document.createElement("div");b.setAttribute("role","group"),b.setAttribute("aria-label",g("picker.areas","Areas"));let P=l?s.map(T=>({id:T.id,label:T.label||T.id,go:()=>{e.focusZone(T.id)}})):o.map(T=>({id:T.id,label:T.label||T.id,floorIndex:T.floorIndex,go:()=>{e.focusSection(T.id),Number.isFinite(T.floorIndex)&&w(T.floorIndex)}})),k=T=>{let O=l||T===null?P:P.filter(E=>E.floorIndex===void 0||E.floorIndex===T);if(b.replaceChildren(),!O.length){b.remove();return}if(b.isConnected||h.appendChild(b),!l&&O.length>Br){let E=document.createElement("select");E.setAttribute("aria-label",g("picker.jumpToSection","Jump to section"));let u=document.createElement("option");u.value="",u.textContent=g("picker.jumpToSection","Jump to section"),E.appendChild(u);for(let y of O){let A=document.createElement("option");A.value=y.id,A.textContent=y.label,E.appendChild(A)}E.addEventListener("change",()=>{O.find(y=>y.id===E.value)?.go()}),b.appendChild(E);return}for(let E of O){let u=document.createElement("button");u.type="button",u.textContent=E.label,u.addEventListener("click",()=>{E.go(),f(!1)}),b.appendChild(u)}};x=k,k(null)}r.appendChild(h)}var ct=class{constructor(e){this.host=e;this.chip=null}sync(){let e=this.host.overlay();if(!e||this.host.savedSeatIds().length===0){this.chip?.remove(),this.chip=null;return}let t=this.chip;if(!t){t=document.createElement("div"),t.className="sl-view3d-compare-saved",t.setAttribute("role","group"),t.setAttribute("aria-label",g("picker.savedSeatComparison","Saved seat comparison"));let n=document.createElement("button");n.type="button",n.className="main",n.addEventListener("click",()=>{this.host.savedSeatIds().length>1?this.host.openComparison():this.host.toast(g("picker.chooseAnotherToCompare","Choose another seat to compare."),"neutral")});let o=document.createElement("button");o.type="button",o.className="clear",o.textContent="\xD7",o.setAttribute("aria-label",g("picker.clearSavedSeatComparison","Clear saved seat comparison")),o.addEventListener("click",()=>this.host.clearComparison()),t.append(n,o),e.appendChild(t),this.chip=t}let i=this.host.savedSeatIds().length,s=t.querySelector(".main");s&&(s.textContent=i>1?(0,lt.t)("picker.compareCount",{count:i}):g("picker.oneSeatSaved","1 seat saved"),s.setAttribute("aria-label",i>1?(0,lt.t)("picker.openComparisonOfSeats",{count:i}):g("picker.oneSeatSavedChooseAnother","One seat saved; choose another to compare")))}remove(){this.chip?.remove(),this.chip=null}mainButton(){return this.chip?.querySelector(".main")??null}};var Ge=require("@seatlayer/core");function rs(r){return Array.isArray(r)?r.reduce((e,t)=>t.type==="minimumSelectedPlaces"?Math.max(e,t.minimum):e,0):0}function Rt(r,e,t=!1){let i=r.violations[0];return i==="numberOfPlacesToSelect"?r.remaining>0?(0,Ge.t)("picker.selectExactMore",{count:r.remaining}):(0,Ge.t)("picker.selectExactCount",{count:r.required}):i==="minimumSelectedPlaces"?(0,Ge.t)("picker.selectMinimumMore",{count:r.remaining}):t?e("picker.adjustSeatSelection","Adjust seat selection"):i==="consecutiveSeats"?e("picker.selectSeatsTogether","Choose seats together in the same row and ticket category."):(0,Ge.t)("picker.orphanHint")}var X=require("@seatlayer/core");function qe(r){let e=Math.max(0,r),t=Math.floor(e/6e4),i=String(Math.floor(e%6e4/1e3)).padStart(2,"0");return`${t}:${i}`}function ns(r){return(r.performanceLabel?`<div class="sl-chip-when">${G(r.performanceLabel)}</div>`:"")+zr(r)}function zr({d:r,area:e,label:t,objectType:i,quantity:s=1,identity:n}){let o=h=>String(h??"\u2014").replace(/[&<>"]/g,p=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"})[p]),a=i==="ga"?"ga":r?.objectType??i,l=n?.displayType?.trim()||r?.displayType?.trim()||e?.displayType?.trim()||(a==="table"?g("picker.table","Table"):a==="booth"?g("picker.booth","Booth"):a==="ga"?g("picker.generalAdmission","General admission"):g("picker.row","Row")),c=n?.rowLabel??n?.displayLabel??r?.rowLabel??r?.displayLabel??e?.displayLabel??e?.label??t;return a==="table"&&n?.bookingMode?`<div class="sl-chip-id"><span class="fld sec"><span class="sl-chip-eb">${o(l)}</span><span class="val">${o(c)}</span></span><span class="fld mid"><span class="sl-chip-eb">${g("picker.guests","Guests")}</span><span class="val">${s}</span></span></div>`:a==="ga"?`<div class="sl-chip-id"><span class="fld sec"><span class="sl-chip-eb">${o(l)}</span><span class="val">${o(c)}</span></span>`+(s>1?`<span class="fld mid"><span class="sl-chip-eb">${g("picker.tickets","Tickets")}</span><span class="val">${s}</span></span>`:"")+"</div>":a==="booth"?'<div class="sl-chip-id">'+(r?.sectionLabel?`<span class="fld sec"><span class="sl-chip-eb">${g("picker.section","Section")}</span><span class="val">${o(r.sectionLabel)}</span></span>`:"")+`<span class="fld mid"><span class="sl-chip-eb">${o(l)}</span><span class="val">${o(c)}</span></span></div>`:!r?.sectionLabel&&!r?.rowLabel&&!r?.seatNumber?`<div class="sl-chip-id"><span class="fld sec"><span class="sl-chip-eb">${g("picker.seat","Seat")}</span><span class="val">${o(c)}</span></span></div>`:'<div class="sl-chip-id">'+(r.sectionLabel?`<span class="fld sec"><span class="sl-chip-eb">${g("picker.section","Section")}</span><span class="val">${o(r.sectionLabel)}</span></span>`:"")+(r.rowLabel?`<span class="fld mid"><span class="sl-chip-eb">${o(l)}</span><span class="val">${o(le(r))}</span></span>`:"")+(r.seatNumber?`<span class="fld mid"><span class="sl-chip-eb">${g("picker.seat","Seat")}</span><span class="val">${o(r.seatNumber)}</span></span>`:"")+"</div>"}function os(r,e){return`<div class="sl-chip-rail"><button type="button" class="rm" aria-label="${r}"><svg viewBox="0 0 24 24"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></svg></button>`+(e?`<button type="button" class="view" data-view-label="${e}" aria-label="${(0,X.t)("picker.viewFromSeat",{label:e})}"><svg viewBox="0 0 24 24"><path d="M1 12s4-7 11-7 11 7 11 7-4 7-11 7S1 12 1 12z"/><circle cx="12" cy="12" r="3"/></svg></button>`:"")+"</div>"}function as(r){return r.salesClosed||r.hasHold||r.ctaPhase!=="idle"||r.formOpen||r.room<=0?null:Math.max(1,Math.min(r.wanted,r.room))}function ls({count:r,total:e,pendingCount:t,ctaPhase:i,hasHold:s,salesClosed:n,fromPrice:o,addMore:a,holdTime:l,money:c}){if(r&&i==="holding")return`<span>${g("picker.securingSeats","Securing your seats\u2026")}</span>`;if(r&&i==="checkout")return`<span>${(0,X.t)("picker.peekSecured",{count:r,total:c(e)})}</span>`;if(r){let h=!!s;return`<span>${(0,X.tCount)("picker.peekTicketsTotal",r,{total:c(e)})}</span>`+(a?`<button type="button" class="go ghost sl-sheet-go" data-act="best" aria-label="${g("picker.findTogetherInstead","Find seats together instead")}">\u2726 +${a}</button>`:"")+`<button type="button" class="go sl-sheet-go" data-act="${h?"checkout":"open"}">${s?t?g("picker.secureMore","Secure more"):g("picker.continue","Continue"):g("picker.review","Review")}`+(s&&l?`<span class="sl-peek-time" aria-hidden="true">${l}</span>`:"")+"</button>"}else return n?`<span>${g("picker.salesClosedPill","Sales are closed")}</span>`:(o!=null?`<span>${(0,X.t)("picker.peekFromPrice",{price:c(o)})}</span>`:`<span>${g("picker.pickYourSeats","Pick your seats")}</span>`)+`<button type="button" class="go sl-sheet-go" data-act="open">${g("picker.bestSeatsStar","\u2726 Best seats")}</button>`}function Ot(r,e=Date.now()){return(0,X.t)("picker.holdReassurance",{time:qe(r-e)})}function cs(r){return r.confirming?`<div class="sl-ba" role="alert"><div class="sl-ba-title"><span class="spark" aria-hidden="true">\u2726</span>${g("picker.replaceCurrentChoices","Replace your current choices?")}</div><div class="sl-ba-replace"><b>${(0,X.t)("picker.willFindSeatsTogether",{count:r.quantity})}</b><span>${g("picker.manualTicketsRemovedNote","Your manually selected tickets will be removed only after a new group is secured.")}</span></div><div class="sl-ba-actions"><button type="button" data-ba-cancel>${g("picker.keepMine","Keep mine")}</button><button type="button" class="replace" data-ba-replace>${g("picker.findNewSeats","Find new seats")}</button></div></div>`:`<div class="sl-ba"><div class="sl-ba-title"><span class="spark" aria-hidden="true">\u2726</span>${g("picker.findBestSeatsTogether","Find the best seats together")}</div><div class="sl-ba-copy"><span class="wide">${g("picker.willChooseClosestGroup","We\u2019ll choose the closest available group for you.")}</span><span class="narrow">${g("picker.closestGroupChosenInstantly","Closest available group, chosen instantly.")}</span></div>`+(r.offerPremium?`<button type="button" class="sl-ba-premium${r.premium?" on":""}" data-ba-premium aria-pressed="${r.premium?"true":"false"}"><span class="star" aria-hidden="true">\u2605</span>${g("picker.bestSeatsPremium","Best seats")}</button>`:"")+(r.categories.length>1?`<select aria-label="${g("picker.preferredTicketType","Preferred ticket type")}" data-ba-cat><option value="">${g("picker.anyTicketType","Any ticket type")}</option>`+r.categories.map(e=>`<option value="${e.key}"${r.selectedCategory===e.key?" selected":""}>${e.label}</option>`).join("")+"</select>":'<span aria-hidden="true"></span>')+(r.zones.length?`<select aria-label="${g("picker.preferredVenueZone","Preferred venue zone")}" data-ba-zone><option value="">${g("picker.anyVenueZone","Any venue zone")}</option>`+r.zones.map(e=>`<option value="${G(e.id)}"${r.selectedZone===e.id?" selected":""}>${G(e.label)}</option>`).join("")+"</select>":"")+`<div class="sl-ba-qty"><button type="button" data-ba="-1" aria-label="${g("picker.fewerSeats","Fewer seats")}">\u2212</button><span>${r.quantity}</span><button type="button" data-ba="1" aria-label="${g("picker.moreSeats","More seats")}">+</button></div><button type="button" class="sl-ba-go${r.busy?" sl-busy":""}"${r.busy?" disabled":""}>`+(r.busy?`<span class="sl-ba-spin" aria-hidden="true"></span>${g("picker.findingBestSeats","Finding the best seats\u2026")}`:(0,X.tCount)("picker.findBestSeatsCount",r.quantity))+"</button>"+(r.reopened?`<button type="button" class="sl-ba-back" data-ba-close>${g("picker.keepMyPicks","Keep my picks")}</button>`:"")+"</div>"}function ds(r){if(r.salesClosed&&!r.hasPicks){let e=r.whenText?`<span class="when">${G(r.whenText)}</span>`:"";return`<div class="sl-closed-note" role="status"><b>${g("picker.salesClosedPill","Sales are closed")}</b><span>${g("picker.salesClosedCopy","Ticket sales for this event have ended.")}${e}</span></div>`}return r.hasPicks?"":r.hasGaAreas?`<div class="sl-tray-hint">${r.seated?g("picker.trayHintTapOrStanding","Tap a seat on the map \u2014 or grab standing tickets below."):g("picker.gaTrayHintTapArea","Tap an area on the map to choose tickets.")}</div>`:`<div class="sl-tray-hint">${r.groupMode==="per_performance"?g("picker.groupPerPerformanceTrayHint","Choose seats for this performance, then complete every date above."):r.groupMode?g("picker.groupTrayHint","Choose seats once \u2014 the same seats will be held for every performance."):g("picker.trayHintTapOrBest","Tap a seat on the map, or let us pick the best available for you.")}</div>`}function ps(r){return{title:(0,X.t)("picker.securedCount",{count:r.secured}),copy:r.pendingCount?(0,X.t)("picker.moreSelectedCount",{count:r.pendingCount}):Ot(r.expiresAt),change:r.releasing?g("picker.releasingEllipsis","Releasing\u2026"):g("picker.change","Change")}}var hs=Symbol("seatlayer.performance-group-picker");function us(r,e){return Object.defineProperty(r,hs,{configurable:!1,enumerable:!1,value:Object.freeze({...e})}),r}function ms(r){return r[hs]??null}var fe=require("@seatlayer/core");function Dr(r,e){let t=new Set(e);return r.map(i=>({...i,free:!t.has(i.eventKey)}))}function fs(r,e){let t=[...r];if(t.length<=1)return t[0]??"";try{return new Intl.ListFormat(e,{style:"long",type:"conjunction"}).format(t)}catch{return t.join(", ")}}function Fr(r,e,t=""){if(!r.length)return"";let i=r.map(s=>{let n=s.free?e.free:e.blocked;return`<li class="sl-night${s.free?" ok":" no"}" aria-label="${S(`${s.shortDate}: ${n}`)}"><i class="sl-night-dot" aria-hidden="true"></i><span class="d">${S(s.shortDate)}</span><span class="st">${S(n)}</span></li>`}).join("");return`<div class="sl-tip-nights"><div class="sl-tip-nights-title">${S(e.title)}</div><ul class="sl-nightstrip">${i}</ul><p class="sl-tip-nights-note">${S(e.notAvailableOn)}</p>`+t+"</div>"}function jr(r){return r.switchLabel&&r.pinned?`<button type="button" class="sl-tip-switch" data-pg-switch-mode>${S(r.switchLabel)}</button>`:r.switchLabel?"":`<p class="sl-tip-advice">${S(r.advice)}</p>`}function Nr(r){return Number(r.available)+Number(r.selected)+Number(r.partial)+Number(r.unavailable)}function gs(r,e,t){if(Nr(r)<2)return"";let i=(n,o,a="")=>`<li class="sl-pg-legend-item"><i class="sl-pg-sw ${n}"${a}></i>${S(o)}</li>`,s=[];return r.available&&s.push(i("sl-pg-sw-free",e.available,` style="background:${S(t)}"`)),r.selected&&s.push(i("sl-pg-sw-sel",e.selected)),r.partial&&s.push(i("sl-pg-sw-split",e.partial,` style="--sl-pg-sw-cat:${S(t)}"`)),r.unavailable&&s.push(i("sl-pg-sw-off",e.unavailable)),`<ul class="sl-pg-legend-list" aria-label="${S(e.title)}">${s.join("")}</ul>`}function bs(r,e){if(!r.length)return"";let t=r.map(i=>{let s=i.labels.length?i.labels.join(", "):e.empty;return`<li class="sl-pg-night-row${i.labels.length?"":" empty"}${i.active?" active":""}" role="button" tabindex="0"${i.active?' aria-current="true"':""} data-event-key="${S(i.eventKey)}"><span class="n">${S(i.name)}</span><span class="s">${S(s)}</span></li>`}).join("");return`<div class="sl-pg-nights" role="group" aria-label="${S(e.title)}"><div class="sl-pg-nights-title">${S(e.title)}</div><ul class="sl-pg-nights-list">${t}</ul></div>`}function It(r,e){if(r?.kind!=="partial"||!e?.length)return null;let t=r.data?.blockedEventKeys??[],i=Dr(e,t);return{states:i,missing:i.filter(s=>!s.free).map(s=>s.shortDate)}}function vs(r,e){return r?Fr(r.states,{title:g("picker.group.partlyAvailableTitle","Free on some nights only"),free:g("picker.group.nightFree","Free"),blocked:g("picker.group.nightBlocked","Not available"),notAvailableOn:(0,fe.t)("picker.group.notAvailableOn",{dates:fs(r.missing,e.locale)})},jr({switchLabel:e.switchLabel??null,pinned:e.pinned,advice:g("picker.group.pickSeatFreeEveryNight","Pick a seat that is free every night.")})):""}function ys(r,e,t){return r?(0,fe.t)("picker.group.seatPartlyAvailable",{label:e,free:r.states.length-r.missing.length,total:r.states.length,dates:fs(r.missing,t)}):""}function xs(r,e){let t=r.map((i,s)=>{let n=i.state==="done"?e.done:i.state==="current"?e.current:e.upcoming;return`<li class="sl-pg-step-item" data-step="${S(i.id)}" data-state="${S(i.state)}"${i.state==="current"?' aria-current="step"':""}><span class="i" aria-hidden="true">${i.state==="done"?"\u2713":String(s+1)}</span><span class="l">${S(i.label)}</span><span class="sl-pg-sr">${S(n)}</span></li>`}).join("");return`<ol class="sl-pg-steps" aria-label="${S(e.label)}">${t}</ol>`}function ws(r,e){return`<ul class="sl-pg-cards">${r.map(i=>`<li class="sl-pg-card" data-event-key="${S(i.eventKey)}"><span class="n">${S(i.name)}</span><time datetime="${S(i.iso)}"><span class="d">${S(i.date)}</span><span class="t">${S(i.time)}</span></time></li>`).join("")}</ul><p class="sl-pg-included">${S(e)}</p>`}function ks(r){let e=r.rows.map(t=>`<li class="sl-pg-pane-row${t.labels.length?"":" empty"}" data-event-key="${S(t.eventKey)}"><span class="n">${S(t.name)}</span><span class="s">${S(t.labels.length?t.labels.join(", "):r.empty)}</span></li>`).join("");return`<div class="sl-pg-pane-title">${S(r.title)}</div><ul class="sl-pg-pane-list">${e}</ul>`+(r.note?`<p class="sl-pg-pane-note">${S(r.note)}</p>`:"")+(r.total?`<div class="sl-pg-pane-total"><span>${S(r.total.label)}</span><b>${S(r.total.amount)}</b></div>`:"")+(r.holdStatus?`<p class="sl-pg-hold-status" role="status">${S(r.holdStatus)}</p>`:"")}function Ss(r){let e=Math.max(0,r);return`${Math.floor(e/6e4)}:${String(Math.floor(e/1e3)%60).padStart(2,"0")}`}function Ts(r,e){if(!r||r.seats<=0)return"";if(e==="same_seat"){let t=r.perPerformance??r.seats;return(0,fe.tCount)("picker.group.seatsEveryPerformance",t)}return r.perPerformance!=null&&r.performancesChosen===r.performances?(0,fe.tCount)("picker.group.seatsPerPerformance",r.seats,{per:r.perPerformance}):(0,fe.tCount)("picker.group.performancesChosenOf",r.seats,{chosen:r.performancesChosen,total:r.performances})}function Cs(r,e){r.querySelectorAll(".sl-pg-night-row[data-event-key]").forEach(t=>{let i=()=>e(t.dataset.eventKey);t.addEventListener("click",i),t.addEventListener("keydown",s=>{s.key!=="Enter"&&s.key!==" "||(s.preventDefault(),i())})})}var $t=require("@seatlayer/core");function ce(r){return String(r??"\u2014").replace(/[&<>"]/g,e=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"})[e])}function Vr(r,e){let t=r.objectType==="table"&&!!r.bookingMode,i=r.objectType==="booth",s=t||i||!r.seatNumber,n=s?r.rowLabel??r.displayLabel??r.label:r.seatNumber,o=t?`${g("picker.guests","Guests")} ${r.bookingMode==="variable"?`${r.minOccupancy}\u2013${r.maxOccupancy}`:r.capacity}`:!i&&r.rowLabel?`${e} ${le(r)??""}`.trim():"";return`<div class="sl-tip-head"><div class="sl-tip-id"><span class="sl-tip-seat${s?" name":""}">${ce(n)}</span>`+(o?`<span class="sl-tip-row">${ce(o)}</span>`:"")+"</div>"+(r.sectionLabel?`<div class="sl-tip-sec"><span class="sl-tip-eyebrow">${g("picker.section","Section")}</span><span class="sl-tip-secname">${ce(r.sectionLabel)}</span></div>`:"")+"</div>"}function Es(r,e){let t=r.status==="not_for_sale",i=r.mark?.kind==="partial",s=r.status==="free"||i?"":`<span class="sl-tip-tag">${t?g("picker.notAvailable","Not available"):r.status==="held"?(0,$t.t)("map.statusHeld"):(0,$t.t)("map.statusTaken")}</span>`,n=t?"":e.price,o=n?`<span class="sl-tip-amt">${n}</span>`:"",a=!n&&e.priceNote?`<div class="sl-tip-note">${ce(e.priceNote)}</div>`:"",l=me(r.commercial),c=l?`<div class="sl-tip-cx"><span class="g" aria-hidden="true">\u25D0</span>${ce(l)}</div>`:"",h=Le(r.wheelchairSpaceType),p=h?`<div class="sl-tip-cx"><span class="g" aria-hidden="true">\u267F</span>${ce(h)}</div>`:"";return'<i class="sl-tip-rail" aria-hidden="true"></i>'+Vr(r,e.rowTypeWord)+`<div class="sl-tip-cat"><span class="sl-tip-dot" style="background:${ce(r.categoryColor)}"></span><span class="sl-tip-name">${ce(r.categoryLabel)}</span>`+s+o+"</div>"+a+p+c+(e.extra??"")}function Ps(r,e,t){let i=r.x+14,s=r.y-t.height-12;return i+t.width>e-8&&(i=r.x-t.width-14),s<8&&(s=r.y+18),{left:Math.max(8,i),top:Math.max(8,s)}}function Ue(r){let e=r?.displayType?.trim()||r?.rowType?.trim();return e||(r?.objectType==="table"?g("picker.table","Table"):r?.objectType==="booth"?g("picker.booth","Booth"):g("picker.row","Row"))}var Gr="https://api.seatlayer.io",qr=10,As=6e4,Ls=6e4,Ms=new Set;function Ur(r){let e=Ms.has(r);return Ms.add(r),e}var Hs="seatmap.a11y.cb";function Kr(){try{if(typeof window>"u")return null;let r=window.localStorage.getItem(Hs);return r==null?null:r==="1"}catch{return null}}function Wr(r){try{window.localStorage.setItem(Hs,r?"1":"0")}catch{}}var He=class r{constructor(e){this.realtime=null;this.accessEl=null;this.lastSelectionValidity=null;this.root=null;this.mapHost=null;this.rendered=!1;this.destroyed=!1;this.els={};this.regions={};this.ro=null;this.holdTimer=null;this.toastTimer=null;this.offerRefreshTimer=null;this.offerBoundaryTimer=null;this.offerVisibilityHandler=null;this.motionTimers=new Set;this.currency="USD";this.eventTimezone=null;this.eventWhenText=null;this.offerAvailability=null;this.channelByObject=new Map;this.pricesByChannel=new Map;this.hold=null;this.holdExpiresAt=0;this.handedOff=!1;this.bookedShown=!1;this.paymentOptions=null;this.checkoutPanel=null;this.extendEl=null;this.bookedEl=null;this.gaQty=new Map;this.gaPromptEl=null;this.gaPromptReturnFocus=null;this.gaAreasExpanded=!1;this.lastMapPoint=null;this.tipEl=null;this.tipPos={x:0,y:0};this.tipPinned=!1;this.lastPointerType="mouse";this.confirmEl=null;this.confirmSeat=null;this.tableDialogEl=null;this.tableDialog=null;this.tableDialogHeld=!1;this.tableDialogReturnFocus=null;this.srEl=null;this.baQty=2;this.baCat="";this.baZone="";this.baPremium=!1;this.baReopen=!1;this.bestAvailableConfirm=!1;this.releasingHold=!1;this.salesClosed=!1;this.soldOut=!1;this.soldoutEl=null;this.cbSafe=!1;this.rungsEl=null;this.projectionEl=null;this.buyerView="map";this.view3dEl=null;this.view3dHandle=null;this.view3dGen=0;this.view3dReturnSeat=null;this.view3dTargetSeatId=null;this.view3dCompareSeatIds=[];this.view3dCompareChip=new ct({overlay:()=>this.view3dEl,savedSeatIds:()=>this.view3dCompareSeatIds,openComparison:()=>this.openView3dComparison(),clearComparison:()=>this.clearView3dComparison(),toast:(e,t)=>this.toast(e,t)});this.view3dCompareEl=null;this.view3dCompareCleanup=null;this.view3dPassportEl=null;this.view3dPassportCleanup=null;this.floorsEl=null;this.secCardEl=null;this.viewEl=null;this.viewCleanup=null;this.seatViewGen=0;this.allSeatsCache=null;this.minimap=null;this.pickerLayoutSize={width:0,height:0};this.priceBandKeys=null;this.focusedCatKey=null;this.limitedViewFilter=!1;this.pricesExpanded=!1;this.lastSection=null;this.secCardCollapsed=!1;this.secCardShownAt=0;this.lastTrayCount=0;this.langSel=null;this.lastTrayTotal=0;this.lastTrayKeys=new Set;this.bestAvailableBusy=!1;this.releasingLabels=new Set;this.holdingLabels=new Set;this.ctaPhase="idle";this.a11yChipsEl=null;this.railEdgesBound=!1;this.fsFallback=!1;this.fsChangeHandler=null;this.fsEscHandler=null;this.eventDetailsHidden=!1;this.holdCopyPending=!1;this.sideCollapsed=!1;this.sideToggleEl=null;this.framedFs=!1;this.lastPostedHeight=0;this.cbEl=null;this.modalScrim=null;this.prevFocus=null;this.escHandler=null;this.closeModal=null;this.lastCatAvail=null;this.lastAvailFloorId="";this.availQuietUntil=0;this.liveTimer=null;this.perspectiveWarned=!1;if(!e||typeof e!="object")throw new Error("seatmap: options object is required");if(!e.event||typeof e.event!="string")throw new Error("seatmap: `event` key is required");if(!e.container)throw new Error("seatmap: `container` is required (or use SeatPicker.open())");this.performanceGroup=ms(e),this.suppressPricing=!!this.performanceGroup?.suppressPricing,this.opts={...e,confirmSelection:e.confirmSelection??!0},this.eventDetailsHidden=!!e.hideEventDetails,this.hostPricing=e.pricing,this.apiBase=(e.apiBase??Gr).replace(/\/+$/,""),this.access=e.transport?null:Te(e,{onExpired:n=>{this.opts.onAccessExpired?.(n),n.refreshed||this.showAccessPanel({reason:"no_token",retryable:!1})},onUnavailable:n=>{this.opts.onAccessUnavailable?.(n),this.showAccessPanel(n)}}),this.pubApi=e.transport?null:new ye(this.apiBase,{access:this.access??void 0,onObjectUnavailable:n=>this.opts.onSelectedObjectUnavailable?.(n)}),this.api=e.transport??this.pubApi,this.buyerAssetUrls=new it(e.event,this.api.asset?(n,o)=>this.api.asset(n,o):void 0),e.checkout==="hosted"&&!this.pubApi&&console.warn('seatlayer: checkout: "hosted" needs the widget\'s own transport \u2014 a custom `transport` owns its backend, so the picker is staying on onCheckout for this mount.'),this.checkoutMode=e.checkout==="hosted"&&this.pubApi?"hosted":"handoff";let t=e.numberOfPlacesToSelect;if(t!=null&&(!Number.isInteger(t)||t<1))throw new Error("seatmap: `numberOfPlacesToSelect` must be a positive integer");this.exactTickets=t??null;let i=rs(e.selectionValidators);if(this.exactTickets!=null&&i>this.exactTickets)throw new Error("seatmap: `minimumSelectedPlaces.minimum` cannot exceed `numberOfPlacesToSelect`");let s=Math.max(1,Math.floor(e.maxSelection??this.exactTickets??Math.max(qr,i)));if(this.exactTickets!=null&&s<this.exactTickets)throw new Error("seatmap: `maxSelection` cannot be lower than `numberOfPlacesToSelect`");if(e.maxSelection!=null&&s<i)throw new Error("seatmap: `maxSelection` cannot be lower than `minimumSelectedPlaces.minimum`");this.maxTickets=this.exactTickets??s,this.cbSafe=Kr()??!!e.colorblindSafe,this.controller=this.wireController(e)}chartHasStage(){let e=this.controller.doc;if(!e)return!1;let t=e.floors?.length?e.floors.map(i=>i.objects??[]):[e.objects??[]];for(let i of t)for(let s of i)if(s.type==="shape"&&(s.role==="stage"||s.stageKind))return!0;return!1}confirmThumbHtml(e){let t=this.controller.doc;if(!t)return"";let i=e.viewUrl??"",s=this.chartHasStage();if(!i&&!s)return"";let n=null;if(!i)try{n=(0,v.generateSeatThumb)(e,e.focalPoint??t.focalPoint).distanceM??null}catch{return""}let o=s&&n!=null?`<div class="sl-confirm-sight">${(0,v.t)("picker.sightline",{m:n})}</div>`:"";return(i?`<button type="button" class="sl-confirm-view sl-confirm-thumbwrap" aria-label="${(0,v.t)("picker.viewFromSeat",{label:e.label})}"><img class="sl-confirm-thumb" alt="" /><span class="sl-confirm-thumb-badge">\u{1F52D} ${this.tf("picker.viewFromHere","View from here")}</span></button>`:`<button type="button" class="sl-confirm-view sl-confirm-viewbtn" aria-label="${(0,v.t)("picker.viewFromSeat",{label:e.label})}"><span aria-hidden="true">\u{1F52D}</span><span>${this.tf("picker.viewFromHere","View from here")}</span></button>`)+o}isFramed(){return typeof window<"u"&&window.parent!==window}postToHost(e){if(this.isFramed())try{window.parent.postMessage(e,"*")}catch{}}measureFramedHeight(){let e=this.root;if(!e)return 0;let t=e.clientWidth||(typeof window<"u"?window.innerWidth:0)||0;if(t<=0)return 0;let i=t<640?1.2:.62;return Math.max(420,Math.round(t*i))}reportFramedHeight(){if(!this.isFramed())return;let e=this.measureFramedHeight();e<=0||e===this.lastPostedHeight||(this.lastPostedHeight=e,this.postToHost({type:"seatlayer:height",px:e}))}toggleFullscreen(){let e=this.root;if(!e)return;!!document.fullscreenElement||this.fsFallback||this.framedFs?document.fullscreenElement?document.exitFullscreen().catch(()=>{}):this.framedFs?this.setFramedFs(!1):this.setFsFallback(!1):e.requestFullscreen?e.requestFullscreen().catch(()=>this.enterFsFallback()):this.enterFsFallback()}syncFullscreenButtons(){let e=!!document.fullscreenElement||this.fsFallback||this.framedFs,t=this.eventDetailsHidden&&!e;this.root?.setAttribute("data-event-details-hidden",String(t)),this.els.zfs?.setAttribute("aria-pressed",String(e)),this.els.zfs?.setAttribute("title",e?this.tf("picker.exitFullScreen","Exit full screen"):this.tf("picker.fullScreen","Full screen"));let i=this.els.zfs?.querySelector(".sl-zfs-lbl");i&&(i.textContent=e?this.tf("picker.exitFullScreen","Exit full screen"):this.tf("picker.fullScreen","Full screen")),this.view3dEl?.querySelector(".sl-view3d-fs")?.setAttribute("aria-pressed",String(e))}enterFsFallback(){this.isFramed()?this.setFramedFs(!0):this.setFsFallback(!0)}setFramedFs(e){this.framedFs!==e&&(this.framedFs=e,this.syncFullscreenButtons(),this.postToHost({type:"seatlayer:fullscreen",on:e}),e&&!this.fsEscHandler?(this.fsEscHandler=t=>{t.key==="Escape"&&!document.fullscreenElement&&this.setFramedFs(!1)},window.addEventListener("keydown",this.fsEscHandler)):!e&&this.fsEscHandler&&(window.removeEventListener("keydown",this.fsEscHandler),this.fsEscHandler=null),requestAnimationFrame(()=>this.controller.refitCurrentView()))}setFsFallback(e){this.fsFallback!==e&&(this.fsFallback=e,this.root?.classList.toggle("sl-fs",e),this.syncFullscreenButtons(),e&&!this.fsEscHandler?(this.fsEscHandler=t=>{t.key==="Escape"&&!document.fullscreenElement&&this.setFsFallback(!1)},window.addEventListener("keydown",this.fsEscHandler)):!e&&this.fsEscHandler&&(window.removeEventListener("keydown",this.fsEscHandler),this.fsEscHandler=null),requestAnimationFrame(()=>this.controller.refitCurrentView()))}close(){this.closeModal?this.closeModal():this.destroy()}static async open(e){St();let t=document.activeElement instanceof HTMLElement?document.activeElement:null,i=document.createElement("div");i.className="sl-modal-scrim";let s=document.createElement("div");s.className="sl-modal-frame",s.setAttribute("role","dialog"),s.setAttribute("aria-modal","true"),s.setAttribute("aria-label",g("picker.seatSelection","Seat selection")),s.tabIndex=-1,i.appendChild(s),document.body.appendChild(i);let n=document.body.style.overflow;document.body.style.overflow="hidden";let o=new r({...e,container:s});o.modalScrim=i,o.prevFocus=t;let a=["a[href]","area[href]","button","input","select","textarea","iframe","object","embed","summary","audio[controls]","video[controls]",'[contenteditable]:not([contenteditable="false"])',"[tabindex]"].join(","),l=()=>{let f=[...s.querySelectorAll('[role="dialog"][aria-modal="true"]')].filter(x=>x.isConnected&&!x.closest('[hidden], [aria-hidden="true"], [inert]'));return f[f.length-1]??s},c=(f,x)=>{let w=f;for(;w;){let b=window.getComputedStyle(w);if(w.hidden||w.getAttribute("aria-hidden")==="true"||w.hasAttribute("inert")||b.display==="none"||b.visibility==="hidden"||b.visibility==="collapse")return!0;if(w===x)return!1;w=w.parentElement}return!0},h=f=>[...f.querySelectorAll(a)].filter(x=>x.tabIndex>=0&&!x.matches(":disabled")&&!c(x,f)),p=(f,x)=>{let w=h(f),b=x?w[w.length-1]:w[0];b?b.focus({preventScroll:!0}):(f.hasAttribute("tabindex")||(f.tabIndex=-1),f.focus({preventScroll:!0}))},d=!1,m=()=>{if(d)return;d=!0,document.body.style.overflow=n,o.escHandler&&document.removeEventListener("keydown",o.escHandler),i.remove(),o.modalScrim=null;let f=o.prevFocus;o.prevFocus=null,f?.isConnected&&f.focus({preventScroll:!0});let x=()=>{o.destroy(),e.onClose?.()};o.hold&&!o.handedOff?o.release().finally(x):x()};return o.closeModal=m,i.addEventListener("mousedown",f=>{f.target===i&&m()}),o.escHandler=f=>{if(f.key==="Tab"){if(f.defaultPrevented)return;let x=l(),w=h(x),b=w[0],P=w[w.length-1],k=document.activeElement;!b||!P?(f.preventDefault(),p(x,f.shiftKey)):k===x||!k||!x.contains(k)?(f.preventDefault(),(f.shiftKey?P:b).focus({preventScroll:!0})):f.shiftKey&&k===b?(f.preventDefault(),P.focus({preventScroll:!0})):!f.shiftKey&&k===P&&(f.preventDefault(),b.focus({preventScroll:!0}));return}f.key==="Escape"&&(o.tableDialog?(f.preventDefault(),o.cancelTableDialog()):o.confirmSeat?(f.preventDefault(),o.cancelConfirm()):o.bestAvailableConfirm?(f.preventDefault(),o.bestAvailableConfirm=!1,o.syncTray()):(f.preventDefault(),m()))},document.addEventListener("keydown",o.escHandler),await o.render(),o.els.close?.classList.add("on"),o.els.close?.addEventListener("click",m),p(l(),!1),o}wireController(e){return new v.PickerController({transport:this.api,eventKey:e.event,maxSelection:this.maxTickets,selectedObjects:e.selectedObjects,selectableObjects:e.selectableObjects,numberOfPlacesToSelect:e.numberOfPlacesToSelect,selectionValidators:e.selectionValidators,currency:e.currency,flashOnLiveChange:!0,colorblindSafe:this.cbSafe,mapTheme:e.theme?.map??null,onGAClick:t=>{let i=this.controller.getGAAreas().find(s=>s.id===t);i&&ft(this,i,this.lastMapPoint)},onSelectionChange:()=>{this.syncTray(),this.minimap?.refreshMinimap(),this.committedSelection().length&&this.collapseSectionCard(),this.syncSelectionTo3d()},onStatusChange:()=>{this.syncSeatMarks(),this.syncPrices(),this.scheduleOfferRefresh(!0),this.evictTakenSelections(),this.detectBooked(),this.minimap?.refreshMinimap(),this.pushAvailabilityTo3d()},onHoldExpired:()=>{this.hold=null,this.forgetHold(),this.handedOff=!1,this.bookedShown=!1,this.ctaPhase="idle",this.stopHoldTimer(),this.gaQty.clear(),this.toast((0,v.t)("picker.holdExpired",void 0)||"Your hold expired \u2014 seats released. Pick again.","warning"),this.syncTray(),this.emitHoldChange(),this.opts.onHoldExpired?.()},confirmSelection:this.opts.confirmSelection,onSelect:t=>{if(this.salesClosed){this.controller.deselect([t.id]),this.toast(this.tf("picker.salesClosedToast","Sales are closed for this event."),"warning");return}this.controller.tableSelection(t.id)||(this.flashPickedSeat(t.id),this.opts.confirmSelection&&this.showConfirm(t))},onTableSelectionRequest:t=>{if(this.salesClosed){this.controller.deselect(t.physicalSeatIds),this.toast(this.tf("picker.salesClosedToast","Sales are closed for this event."),"warning");return}this.showTableDialog(t,!1)},onDeselect:t=>{this.confirmSeat?.id===t.id&&this.dismissConfirm(),this.tableDialog?.physicalSeatIds.includes(t.id)&&this.dismissTableDialog()},onSelectionLimit:()=>{this.toast((0,v.t)("picker.maxTicketsForOrder",{count:this.maxTickets}),"warning"),this.opts.onSelectionLimit?.(this.maxTickets)},onViewChange:()=>{this.reanchorConfirm(),this.syncRung(),this.syncProjection(),this.minimap?.drawMinimapRect(),this.sectionCardOnView()},onSectionFocus:t=>this.showSectionCard(t),onDeckTap:()=>{this.showSectionCard(null),this.syncFloors(),this.syncRung(),this.minimap?.refreshMinimap()},onFocusSeat:t=>this.announceSeat(t),onSeatHover:t=>this.updateTooltip(t),onHint:t=>{t&&this.toast(t)},onSalesClosed:()=>this.setSalesClosed(!0),onError:t=>this.opts.onError?.(t)})}async render(){if(this.rendered)return this;let e=performance.now(),t={},i=u=>Math.round((performance.now()-u)*100)/100;this.rendered=!0,St();let s=performance.now();await(0,v.loadLocale)(this.opts.locale),t.loadLocale=i(s),this.opts.messages&&(0,v.setStringOverrides)(this.opts.messages),this.checkoutMode==="hosted"&&(this.paymentOptions=this.pubApi.paymentOptions(this.opts.event));let n=performance.now(),o=Ri(this.opts.container),{root:a,els:l,mapHost:c}=ki(o,(u,y)=>this.tf(u,y),this.opts.theme);this.root=a,this.els=l,this.mapHost=c,a.addEventListener("keydown",u=>{u.key==="Escape"&&(this.tipPinned?(u.preventDefault(),u.stopPropagation(),this.unpinTooltip()):this.tableDialog?(u.preventDefault(),u.stopPropagation(),this.cancelTableDialog()):this.confirmSeat?(u.preventDefault(),u.stopPropagation(),this.cancelConfirm()):this.bestAvailableConfirm&&(u.preventDefault(),u.stopPropagation(),this.bestAvailableConfirm=!1,this.syncTray()))}),this.syncFullscreenButtons(),this.wireBuyerShell(a);let h=document.createElement("div");h.style.cssText="position:absolute;inset:0",this.mapHost.appendChild(h),t.mountBuyerShell=i(n);let p=await this.loadChart(h,t,i);if(!p)return this;this.els.boot.remove();let d=performance.now();if(this.startRealtime(),this.salesClosed=!!p.salesClosed||!!this.opts.readOnly,a.dataset.eventMode=p.mode==="test"?"test":"live",!this.opts.locale&&p.locale&&await this.setLocale(p.locale),this.controller.setViewMode(this.normalizeInitialView(this.opts.initialView)),this.buildRegions(),this.regions["bottom-right"].appendChild(this.els.zoom),this.regions["bottom-center"].appendChild(this.els.toast),p.mode==="test"){let u=document.createElement("div");u.className="sl-testbadge",u.textContent=(0,v.t)("picker.testMode"),u.setAttribute("aria-label",(0,v.t)("picker.testMode")),this.regions["top-left"].appendChild(u)}let m=this.controller.doc?.theme,f=Ve(m,this.opts.theme);Object.entries(f).forEach(([u,y])=>a.style.setProperty(u,y)),this.applyMapChromeTokens(),this.currency=p.currency??this.opts.currency??"USD",this.eventTimezone=p.timezone??null;let x=this.opts.theme?.logoUrl??m?.logoUrl??p.posterUrl??null;x?this.els.logo.innerHTML=`<img src="${x}" alt="">`:this.els.logo.textContent=(this.opts.theme?.brandName??m?.brandName??p.eventName??"?").slice(0,1).toUpperCase(),this.els.name.textContent=p.eventName??"";let w=p.startsAt?at(p.startsAt,p.timezone??null,this.opts.locale):"";this.eventWhenText=w||null,this.els.meta.textContent=[p.venue,w].filter(Boolean).join(" \xB7 "),this.els.pricesHint&&(this.els.pricesHint.textContent=this.tf("picker.priceHint","Colours on the map are ticket types \u2014 tap one below to show just those seats.")),this.buildBadge(m);let b=new Set,P=!1;if(this.controller.doc)for(let u of this.controller.getExpandedSeats()){for(let y of u.accessibility??[])b.add(y);u.accessible&&!u.accessibility?.length&&b.add("wheelchair"),(u.commercial?.restrictedView||u.commercial?.obstructedView)&&(P=!0)}let k=()=>{this.rungsEl&&this.controller.getRung()!=="seats"&&(this.controller.setRung("seats"),this.collapseSectionCard(),this.syncRung())};if(b.size||P){let u=document.createElement("div");if(u.className="sl-chips",this.regions["top-left"].appendChild(u),this.a11yChipsEl=u,b.size){let y=(L,H)=>`<button type="button" class="sl-chip-f${L==="all"?" on":""}" data-a11y="1" data-f="${L}">${H}</button>`;u.insertAdjacentHTML("beforeend",y("all",this.tf("picker.allSeats","All seats"))+v.ACCESSIBILITY_TYPES.filter(({key:L})=>b.has(L)).map(({key:L,short:H,icon:z})=>y(L,`${z} ${H}`)).join(""));let A=new Set,D=()=>{u.querySelectorAll("button[data-a11y]").forEach(H=>{let z=H.dataset.f,q=z==="all"?A.size===0:A.has(z);H.classList.toggle("on",q),H.setAttribute("aria-pressed",String(q))});let L=A.size?[...A]:null;this.controller.setAccessibilityFilter(L),L&&k()};u.querySelectorAll("button[data-a11y]").forEach(L=>{L.addEventListener("click",()=>{let H=L.dataset.f;H==="all"?A.clear():A.has(H)?A.delete(H):A.add(H),D()})})}if(P){let y=document.createElement("button");y.type="button",y.className="sl-chip-f",y.setAttribute("aria-pressed","false"),y.innerHTML=`\u25D0 ${this.tf("picker.hideLimitedView","Hide limited-view seats")}`,u.appendChild(y),y.addEventListener("click",()=>{let A=!this.limitedViewFilter;this.limitedViewFilter=A,y.classList.toggle("on",A),y.setAttribute("aria-pressed",String(A)),this.controller.setCommercialLimitedFilter(A),this.pushAvailabilityTo3d(),A&&k()})}}let T=document.createElement("button");T.type="button",T.className="sl-cbbtn",this.cbEl=T,T.setAttribute("aria-label",this.tf("picker.toggleColorblindColors","Toggle colorblind-friendly colors")),T.setAttribute("aria-pressed",String(this.cbSafe)),T.innerHTML='<svg viewBox="0 0 24 24"><path d="M1 12s4-7 11-7 11 7 11 7-4 7-11 7S1 12 1 12z"/><circle cx="12" cy="12" r="3"/></svg>',this.els.zfit.parentElement.appendChild(T),T.addEventListener("click",()=>{this.setColorblindSafe(!this.cbSafe)}),this.buildLanguageSwitcher(T.parentElement),this.srEl=document.createElement("div"),this.srEl.className="sl-sr",this.srEl.setAttribute("aria-live","polite"),a.appendChild(this.srEl),this.buildArenaChrome(),this.buildMinimap(),this.buildPriceFilter(),this.buildExtendPrompt(),this.buildBookedOverlay(),this.buildSoldoutOverlay(),this.buildPanelToggle(),this.opts.panelCollapsed&&this.setPanelCollapsed(!0),this.dockLayoutChrome(),t.buildBuyerControls=i(d);let O=performance.now();if(await this.restoreRememberedHold(),t.restoreHold=i(O),this.destroyed)return this;this.salesClosed&&this.applySalesClosed(),this.syncPrices(),this.syncTray(),this.resumeHostedOrder();let E=this.controller.doc;return this.emitAnalytics("chart_rendered",{renderingTimeMillis:i(e),performanceProfile:t,seatCount:this.allSeats().length,objectCount:E?.objects.length??0,sectionCount:E?.objects.filter(u=>u.type==="section").length??0,view:this.buyerView,eventKey:this.opts.event,chartName:E?.name,floorCount:this.controller.getFloors().length,transport:this.opts.transport?"custom":"pubapi",load:Ur(this.opts.event)?"repeat":"cold"}),this}wireBuyerShell(e){this.refreshOfferAvailability(!1),this.api.availability&&(this.offerVisibilityHandler=()=>{!document.hidden&&!this.destroyed&&this.refreshOfferAvailability(!1)},document.addEventListener("visibilitychange",this.offerVisibilityHandler)),this.observeLayout(e),this.els.zin.addEventListener("click",()=>this.controller.zoomIn()),this.els.zout.addEventListener("click",()=>this.controller.zoomOut()),this.els.zfit.addEventListener("click",()=>this.controller.zoomToFit()),this.els.zfs.addEventListener("click",()=>this.toggleFullscreen()),this.fsChangeHandler=()=>{document.fullscreenElement||this.setFsFallback(!1),this.syncFullscreenButtons(),requestAnimationFrame(()=>this.controller.refitCurrentView())},document.addEventListener("fullscreenchange",this.fsChangeHandler);let t=this.els.sheetHead;if(t){let s=this.els.sheetToggle,n=c=>{e.dataset.sheet=c?"open":"peek",s?.setAttribute("aria-expanded",String(c)),s?.setAttribute("aria-label",c?this.tf("picker.collapseTicketPanel","Collapse ticket panel"):this.tf("picker.openTicketPanel","Open ticket panel"))};n(e.dataset.sheet==="open"),s?.addEventListener("click",c=>{c.stopPropagation(),n(e.dataset.sheet!=="open")}),this.els.peek?.addEventListener("click",c=>{let h=c.target.closest(".sl-sheet-go");h&&(c.stopPropagation(),h.dataset.act==="checkout"?this.handleCta():h.dataset.act==="best"?(this.baReopen=!0,this.baQty=Math.max(1,Math.min(this.baQty,this.maxTickets-this.totalTicketCount())),this.syncTray(),n(!0),this.els.tray?.querySelector(".sl-ba-go")?.focus()):n(!0))});let o=0,a=!1,l=!1;t.addEventListener("pointerdown",c=>{if(c.target.closest?.(".sl-seccard,.sl-sheet-toggle,.sl-sheet-go")){l=!1;return}l=!0,a=!1,o=c.clientY,t.setPointerCapture?.(c.pointerId)}),t.addEventListener("pointermove",c=>{if(!l||a)return;let h=c.clientY-o;h<-18?(n(!0),a=!0):h>18&&(n(!1),a=!0)}),t.addEventListener("pointerup",c=>{l&&!a&&Math.abs(c.clientY-o)<6&&n(e.dataset.sheet!=="open"),l=!1,t.releasePointerCapture?.(c.pointerId)})}let i=()=>{if(this.root?.dataset.layout!=="narrow")return;let s=this.root.getAttribute("data-prices-open")==="true";if(this.root.setAttribute("data-prices-open",String(!s)),this.els.pricesSec?.setAttribute("aria-expanded",String(!s)),!s&&this.root.dataset.sheet!=="open"){this.root.dataset.sheet="open";let n=this.els.sheetToggle;n?.setAttribute("aria-expanded","true"),n?.setAttribute("aria-label","Collapse ticket panel")}};this.els.pricesSec?.addEventListener("click",s=>{s.target.closest("select,button")||i()}),this.els.pricesSec?.addEventListener("keydown",s=>{s.key!=="Enter"&&s.key!==" "||s.target.closest("select,button")||(s.preventDefault(),i())}),this.tipEl=document.createElement("div"),this.tipEl.setAttribute("role","tooltip"),this.tipEl.className="sl-tip",this.els.map.appendChild(this.tipEl),this.els.map.addEventListener("pointerdown",s=>{this.lastMapPoint={x:s.clientX,y:s.clientY},this.lastPointerType=s.pointerType||"mouse";let n=this.els.map.getBoundingClientRect();this.tipPos={x:s.clientX-n.left,y:s.clientY-n.top},this.unpinTooltip()},!0),this.els.map.addEventListener("mousemove",s=>{let n=this.els.map.getBoundingClientRect();this.tipPos={x:s.clientX-n.left,y:s.clientY-n.top},this.tipEl&&this.tipEl.style.display!=="none"&&this.placeTooltip()}),this.els.cta.addEventListener("click",()=>{this.handleCta()}),this.els.holdChange?.addEventListener("click",()=>{this.handleChangeSeats()})}observeLayout(e){let t=()=>{let i=e.clientWidth;if(i<=0)return;let s=e.clientHeight,n=i!==this.pickerLayoutSize.width||s!==this.pickerLayoutSize.height;this.pickerLayoutSize={width:i,height:s},this.reportFramedHeight();let o=i<640?"narrow":"wide",a=s<560?"compact":"comfortable";(e.dataset.layout!==o||e.dataset.density!==a)&&(e.dataset.layout=o,e.dataset.density=a,o==="narrow"&&!e.dataset.sheet&&(e.dataset.sheet="peek"),this.dockLayoutChrome()),n&&this.minimap?.refreshMinimap()};this.ro=new ResizeObserver(t),this.ro.observe(e),t(),requestAnimationFrame(t)}async loadChart(e,t,i){let s=performance.now(),n=await this.controller.render(e);return t.loadChartAndStatuses=i(s),this.destroyed?null:n?(Object.assign(t,n.performanceProfile),n):(this.els.boot.innerHTML=`<div class="sl-boot-title">${this.tf("picker.mapDidNotLoad","The seat map didn\u2019t load")}</div><div>${this.tf("picker.checkConnection","Check your connection and try again.")}</div><button type="button" class="sl-boot-retry">${this.tf("picker.accessRetry","Try again")}</button>`,this.els.boot.querySelector("button").addEventListener("click",()=>{let o=this.opts.container,a=this.opts;this.destroy(),new r({...a,container:o}).render()}),null)}resumeHostedOrder(){if(this.checkoutMode!=="hosted"||typeof location>"u")return;let e=new URLSearchParams(location.search),t=e.get("order");if(!t)return;let i=e.get("status");e.delete("order"),e.delete("status");try{let s=e.toString();history.replaceState(history.state,"",`${location.pathname}${s?`?${s}`:""}${location.hash}`)}catch{}i==="success"&&this.openCheckoutPanel({kind:"resume",orderId:t})}buildPanelToggle(){if(!this.regions["top-right"])return;let e=document.createElement("button");e.type="button",e.className="sl-side-toggle",e.addEventListener("click",()=>this.setPanelCollapsed(!this.sideCollapsed)),this.sideToggleEl=e,this.regions["top-right"].appendChild(e),this.syncPanelToggle()}syncPanelToggle(){let e=this.sideToggleEl;if(!e)return;let t=this.sideCollapsed;e.setAttribute("aria-expanded",String(!t)),e.setAttribute("aria-label",t?this.tf("picker.showTicketPanel","Show the ticket panel"):this.tf("picker.hideTicketPanel","Hide the ticket panel")),e.title=t?this.tf("picker.showTicketPanel","Show the ticket panel"):this.tf("picker.hideTicketPanel","Hide the ticket panel"),e.innerHTML=t?`<svg viewBox="0 0 24 24"><path d="M15 6l-6 6 6 6"/></svg><span>${this.tf("picker.tickets","Tickets")}</span>`:'<svg viewBox="0 0 24 24"><path d="M9 6l6 6-6 6"/></svg>'}setPanelCollapsed(e){this.destroyed||(this.sideCollapsed=e,this.applyPanelCollapsed(),this.scheduleMotion(()=>this.controller.refitCurrentView(),340))}applyPanelCollapsed(){let e=this.root?.dataset.layout!=="narrow";this.root?.setAttribute("data-side-collapsed",String(this.sideCollapsed)),this.els.side?.toggleAttribute("inert",this.sideCollapsed&&e),this.syncPanelToggle()}dockLayoutChrome(){let e=this.root?.dataset.layout==="narrow";this.applyPanelCollapsed();let t=this.els.zfs,i=this.els.headInfo?.parentElement;t&&i&&t.parentElement!==i&&(t.classList.add("sl-fs-pill"),i.insertBefore(t,this.els.hold??null));let s=this.els.pricesSec;s&&(e?(s.setAttribute("role","button"),s.tabIndex=0,s.setAttribute("aria-expanded",String(this.root?.getAttribute("data-prices-open")==="true"))):(s.removeAttribute("role"),s.removeAttribute("aria-expanded"),s.tabIndex=-1)),this.cbEl&&this.els.zoom?.appendChild(this.cbEl),this.a11yChipsEl&&(e?this.els.rail?.insertBefore(this.a11yChipsEl,this.els.railScroll??null):this.regions["top-left"]?.appendChild(this.a11yChipsEl)),this.lastSection&&this.renderSectionCard(this.lastSection)}buildExtendPrompt(){let e=document.createElement("div");e.className="sl-extend",e.setAttribute("role","status"),e.innerHTML='<span class="sl-extend-txt" data-ref="extendTxt"></span><button type="button" class="sl-extend-btn" data-ref="extendBtn"></button>',(this.regions["bottom-center"]??this.els.map).appendChild(e),this.extendEl=e,this.els.extendTxt=e.querySelector('[data-ref="extendTxt"]'),this.els.extendBtn=e.querySelector('[data-ref="extendBtn"]'),this.els.extendBtn.textContent=this.tf("picker.addTime","Add time"),this.els.extendBtn.addEventListener("click",()=>{this.handleExtend()})}buildBookedOverlay(){let e=document.createElement("div");e.className="sl-booked",e.setAttribute("role","status"),e.setAttribute("aria-live","polite"),e.innerHTML=`<div class="sl-booked-badge"><svg viewBox="0 0 24 24"><path d="M20 6L9 17l-5-5"/></svg></div><div class="sl-booked-title">${this.tf("picker.allSetTitle","You're all set")}</div><div class="sl-booked-sub" data-ref="bookedSub"></div>`,this.root.appendChild(e),this.bookedEl=e,this.els.bookedSub=e.querySelector('[data-ref="bookedSub"]')}get onGAPromptHook(){return this.opts.onGAPrompt}tf(e,t){return g(e,t)}buildSoldoutOverlay(){if(!this.els.map)return;let e=document.createElement("div");e.className="sl-soldout",e.setAttribute("role","status");let t=(this.controller.doc?.theme?.brandName??this.opts.theme?.brandName??this.els.name?.textContent??this.tf("picker.soldOutEyebrow","This event")).toUpperCase();e.innerHTML=`<div class="sl-soldout-eyebrow">${t}</div><div class="sl-soldout-title">${this.tf("picker.soldOutTitle","Sold out")}</div><p class="sl-soldout-copy">${this.tf("picker.soldOutCopy","No reserved seats are currently available for this event.")}</p>`,this.els.map.appendChild(e),this.soldoutEl=e}syncSoldout(e,t){let i=this.controller.getGAAreas().length>0,s=this.isSoldOut(e,t,i);s!==this.soldOut&&(this.soldOut=s,this.soldoutEl?.classList.toggle("on",s))}isSoldOut(e,t,i){return!i&&e.length>0&&e.every(s=>(t[s.key]??0)===0)}setSalesClosed(e){let t=e||!!this.opts.readOnly;this.salesClosed!==t&&(this.salesClosed=t,this.applySalesClosed())}applySalesClosed(){this.salesClosed&&this.tableDialog&&!this.tableDialogHeld&&this.cancelTableDialog();let e=this.els.closedPill;if(e){e.classList.toggle("on",this.salesClosed);let t=this.els.closedPillText??e;t.textContent=this.tf("picker.salesClosedPill","Sales are closed")}this.root?.setAttribute("data-sales-closed",String(this.salesClosed)),this.salesClosed&&this.srEl&&(this.srEl.textContent=this.tf("picker.salesClosedToast","Sales are closed for this event.")),this.syncCta(),this.syncTray()}badgeHidden(e){return!!(this.opts.hideBadge||e?.hideBadge)}buildBadge(e){if(this.badgeHidden(e))return;let t=this.els.foot;if(!t)return;let i=document.createElement("a");i.className="sl-powered",i.href="https://seatlayer.io/?ref=picker",i.target="_blank",i.rel="noopener noreferrer",i.setAttribute("aria-label",this.tf("picker.poweredBy","Powered by SeatLayer")),i.innerHTML='<span class="sl-powered-mark" aria-hidden="true">'+Je+`</span><span>${this.tf("picker.poweredBy","Powered by SeatLayer")}</span>`,t.appendChild(i)}buildRegions(){if(!this.els.map)return;let e=["top-left","top-center","top-right","left-rail","bottom-left","bottom-center","bottom-right"];for(let t of e){let i=document.createElement("div");i.className="sl-anchor",i.dataset.region=t,this.els.map.appendChild(i),this.regions[t]=i}}cssVar(e){return this.root?getComputedStyle(this.root).getPropertyValue(e).trim():""}reducedMotion(){return typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches}scheduleMotion(e,t){let i=setTimeout(()=>{this.motionTimers.delete(i),this.destroyed||e()},t);this.motionTimers.add(i)}animateOnce(e,t,i=600){!e||this.reducedMotion()||(e.classList.remove(t),e.offsetWidth,e.classList.add(t),this.scheduleMotion(()=>e.classList.remove(t),i))}flashPickedSeat(e){this.reducedMotion()||this.controller.flashSeat(e,this.cssVar("--sl-accent")||"#f4b740")}flashHeldSeats(e){if(this.reducedMotion())return;(e.items??[]).filter(i=>i.objectType!=="ga").map(i=>i.label).slice(0,10).forEach((i,s)=>{let n=this.controller.seatByLabel(i);n&&this.scheduleMotion(()=>this.controller.flashSeat(n.id,this.cssVar("--sl-accent")||"#f4b740"),s*55)})}committedSelection(){let e=this.confirmSeat?.id,t=this.tableDialog&&!this.tableDialogHeld?this.tableDialog.id:null;return this.controller.getSelection().filter(i=>i.id!==e&&i.id!==t)}pendingSelectionCount(){let e=this.hold?.items??[],t=new Set(e.map(s=>s.label));return this.committedSelection().filter(s=>!t.has(s.label)).reduce((s,n)=>s+(n.quantity??1),0)+Ee(this.gaQty,this.hold?.items??[])}heldTicketCount(){return(this.hold?.items??[]).reduce((e,t)=>e+(t.quantity??1),0)}totalTicketCount(){let e=new Set((this.hold?.items??[]).map(i=>i.label)),t=this.committedSelection().filter(i=>!e.has(i.label)).reduce((i,s)=>i+(s.quantity??1),0);return this.heldTicketCount()+t+Ee(this.gaQty,this.hold?.items??[])}updateSelectionCapacity(){let e=new Set((this.hold?.items??[]).map(s=>s.label)),t=this.committedSelection().filter(s=>e.has(s.label)).reduce((s,n)=>s+(n.quantity??1),0),i=Math.max(0,this.maxTickets-this.heldTicketCount()-Ee(this.gaQty,this.hold?.items??[]));this.controller.setMaxSelection(t+i)}syncCta(e=this.lastTrayCount,t=this.pendingSelectionCount()){let i=this.els.cta;if(!i)return;if(this.salesClosed){i.disabled=!0,i.textContent=this.tf("picker.salesClosedCta","Sales closed");return}if(this.confirmSeat||this.tableDialog&&!this.tableDialogHeld){i.disabled=!0,i.textContent=this.tableDialog?this.tf("picker.confirmYourTable","Confirm your table"):this.tf("picker.confirmOrCancelSeat","Confirm or cancel this seat");return}if(this.ctaPhase==="holding"){i.disabled=!0,i.innerHTML=`<span class="sl-cta-spin" aria-hidden="true"></span>${this.tf("picker.securingSeats","Securing your seats\u2026")}`;return}if(this.ctaPhase==="checkout"){i.disabled=!0,i.innerHTML=`<span class="sl-cta-spin" aria-hidden="true"></span>${this.tf("picker.openingCheckout","Opening secure checkout\u2026")}`;return}let s=!this.hold&&this.performanceGroup?.selectionMode==="per_performance"?this.performanceGroup.submissionState?.():null;if(s&&!s.ready){i.disabled=!0,i.textContent=this.tf("picker.completeAllPerformances","Complete all performances ({complete}/{total})").replace("{complete}",String(s.complete)).replace("{total}",String(s.total));return}let n=this.controller.getSelectionValidity(e);if(n&&!n.isValid){i.disabled=!0,i.textContent=Rt(n,(o,a)=>this.tf(o,a),!0);return}i.disabled=e===0,i.textContent=this.hold?t?(0,v.t)("picker.secureMoreAndCheckout",{count:t}):this.tf("picker.continueToCheckout","Continue to checkout"):e?this.performanceGroup?this.tf("picker.holdSeatsForAllPerformances","Hold seats for all {count} performances").replace("{count}",String(this.performanceGroup.performanceCount)):this.tf("picker.holdSeatsAndCheckout","Hold seats & checkout"):this.tf("picker.selectSeats","Select seats")}setCtaPhase(e){this.ctaPhase=e,this.syncCta(),this.renderPeek(this.lastTrayCount,this.lastTrayTotal,this.pendingSelectionCount()),e==="checkout"&&this.scheduleMotion(()=>{this.ctaPhase==="checkout"&&(this.ctaPhase="idle",this.syncCta(),this.renderPeek(this.lastTrayCount,this.lastTrayTotal,this.pendingSelectionCount()))},1100)}holdStorageKey(){return`@seatlayer/hold/v1/${encodeURIComponent(this.apiBase)}/${encodeURIComponent(this.opts.event)}`}rememberedHoldId(){if(this.opts.initialHoldId)return this.opts.initialHoldId;if(this.opts.restoreHold===!1||typeof window>"u")return null;try{return window.sessionStorage.getItem(this.holdStorageKey())}catch{return null}}rememberHold(e){if(!(this.opts.restoreHold===!1||typeof window>"u"))try{window.sessionStorage.setItem(this.holdStorageKey(),e.holdId)}catch{}}forgetHold(){if(!(typeof window>"u"))try{window.sessionStorage.removeItem(this.holdStorageKey())}catch{}}async resumeHoldFromServer(e,t){try{let i=await this.controller.resumeHold(e);if(!i)return null;let s={holdId:i.holdId,expiresAt:i.expiresAt,seats:i.seats,items:i.items};return this.hold=s,this.handedOff=!0,this.bookedShown=!1,this.ctaPhase="idle",this.startHoldTimer(s.expiresAt),this.rememberHold(s),this.syncTray(),this.emitHoldChange(),this.opts.onHoldRestored?.(s,s.seats??[],this.buildHandoff(s)),t&&this.toast(this.tf("picker.heldTicketsRestored","Your held tickets have been restored."),"success"),s}catch(i){let s=i?.status;return s===404||s===409?this.forgetHold():this.opts.onError?.(i),null}}async restoreRememberedHold(){let e=this.rememberedHoldId();e&&await this.resumeHoldFromServer(e,!0)}activeFloorObjects(){let e=this.controller.doc;if(!e)return[];let t=e.floors;if(t?.length){let i=this.controller.getActiveFloorId();return(t.find(s=>s.id===i)??t[0]).objects??[]}return e.objects??[]}buildMinimap(){this.els.map&&(this.minimap=is({controller:this.controller,root:()=>this.root,cssVar:e=>this.cssVar(e),focusedSectionLabel:()=>this.lastSection?.label},this.regions["bottom-left"]??this.els.map))}catPrice(e){let t=e.tiers?.length?e.tiers[0].price:e.price;return t===void 0||!e.key?t:this.paidPrice(e.key,e.tiers?.[0]?.id??null,t)}catPriceRange(e){let t=e.tiers?.length?e.tiers.map(i=>this.paidPrice(e.key,i.id??null,i.price)):e.price==null?[]:[this.paidPrice(e.key,null,e.price)];if(e.key)for(let i of this.pricesByChannel.values())for(let s of i)s.categoryKey===e.key&&t.push(s.price);return t.length?{min:Math.min(...t),max:Math.max(...t)}:void 0}buildPriceFilter(){if(!this.els.prices||!this.els.pricesSec)return;let e=mi(this.controller.doc?.categories??[],this.legendDeps());if(e.length<2)return;let t=document.createElement("select");t.className="sl-price-select",t.setAttribute("aria-label",this.tf("picker.filterAndFocusByPrice","Filter and focus seats by price")),t.innerHTML=`<option value="all">${this.tf("picker.allPrices","All prices")}</option>`+e.map(i=>`<option value="${i.id}">${i.label}</option>`).join(""),this.els.pricesSec.appendChild(t),t.addEventListener("change",()=>{let s=e.find(n=>n.id===t.value)?.keys??null;this.focusedCatKey=null,this.priceBandKeys=s?new Set(s):null,this.controller.setCategoryFilter(s),this.controller.focusCategoryFilter(s),this.pushAvailabilityTo3d(),this.syncFloors(),this.syncRung(),this.minimap?.refreshMinimap(),this.syncPrices(),this.lastSection&&this.showSectionCard(this.lastSection)})}buildArenaChrome(){let e=this.controller.doc;if(!e||!this.els.map)return;let t=e.objects.some(i=>i.type==="section")||(e.floors??[]).some(i=>i.objects.some(s=>s.type==="section"));if(this.canOffer3d()){let i=document.createElement("div");i.className="sl-projection",i.setAttribute("role","group"),i.setAttribute("aria-label",this.tf("picker.venueView","Venue view")),i.innerHTML=`<button type="button" data-view="map" aria-pressed="true" title="${this.tf("picker.flat2dMap","Flat 2D map")}">${this.tf("picker.map","Map")}</button><button type="button" data-view="venue3d" aria-pressed="false" title="${this.tf("picker.interactive3dVenueView","Interactive 3D venue view")}">3D</button>`,i.querySelectorAll("button").forEach(s=>{s.addEventListener("click",()=>{this.setBuyerView(s.dataset.view)})}),this.regions["top-right"].appendChild(i),this.projectionEl=i,this.syncProjection()}if(t){let i=[...e.objects,...(e.floors??[]).flatMap(h=>h.objects)],s=new Set((e.zones??[]).map(h=>h.id)),o=i.some(h=>h.type==="section"&&typeof h.zone=="string"&&s.has(h.zone))?["zones","sections","seats"]:["sections","seats"],a=document.createElement("div");a.className="sl-rungs on",a.setAttribute("role","group"),a.setAttribute("aria-label",(0,v.t)("picker.zoomLevel"));let l={zones:(0,v.t)("picker.rungLabel.zones"),sections:(0,v.t)("picker.rungLabel.sections"),seats:(0,v.t)("picker.rungLabel.seats")},c={zones:(0,v.t)("picker.rungTip.zones"),sections:(0,v.t)("picker.rungTip.sections"),seats:(0,v.t)("picker.rungTip.seats")};a.innerHTML=o.map(h=>`<button type="button" data-rung="${h}" title="${c[h]}" aria-pressed="false">${l[h]}</button>`).join(""),a.querySelectorAll("button").forEach(h=>{h.addEventListener("click",()=>{let p=h.dataset.rung;this.controller.setRung(p),p==="seats"&&this.collapseSectionCard()})}),this.regions["top-center"].appendChild(a),this.rungsEl=a,this.syncRung()}if(this.controller.isMultiFloor()){let i=Ji({floors:this.controller.getFloors(),tf:(s,n)=>this.tf(s,n),onChoose:s=>{s===""?this.controller.setFloorOverview(!0):this.controller.setFloor(s),this.showSectionCard(null),this.syncFloors(),this.syncRung(),this.minimap?.refreshMinimap()}});this.regions["left-rail"].appendChild(i),this.floorsEl=i,this.syncFloors()}}syncRung(){let e=this.controller.getRung(),t=e==="seats"||!!this.controller.getFocusedSection?.();this.root&&(this.root.dataset.zoomed=String(t)),this.minimap?.setAutoOpen(!1),this.rungsEl&&this.rungsEl.querySelectorAll("button").forEach(i=>{let s=i.dataset.rung===e;i.classList.toggle("on",s),i.setAttribute("aria-pressed",String(s))})}syncProjection(){this.projectionEl&&this.projectionEl.querySelectorAll("button").forEach(e=>{let t=e.dataset.view===this.buyerView;e.classList.toggle("on",t),e.setAttribute("aria-pressed",String(t))})}canOffer3d(){return this.opts.enable3D===!1||!this.controller.doc||!Oi()?!1:this.allSeats().length<=this.max3dSeats()}max3dSeats(){let e=this.opts.max3DSeats;if(typeof e=="number"&&e>0)return e;let t=globalThis.navigator;return(t?.hardwareConcurrency??8)<=4||(t?.deviceMemory??8)<=4||(globalThis.matchMedia?.("(pointer: coarse)").matches??!1)?Ls/2:Ls}syncFloors(){es(this.floorsEl,this.controller.getActiveFloorId(),this.controller.isFloorOverview())}showSectionCard(e){if(this.lastSection=e,this.secCardEl?.remove(),this.secCardEl=null,!e){this.minimap?.refreshMinimap();return}this.secCardCollapsed=this.controller.getRung()==="seats",this.secCardShownAt=Date.now(),this.renderSectionCard(e),this.minimap?.refreshMinimap()}sectionNeighbours(e){let t=this.activeFloorObjects().filter(s=>s.type==="section"&&!this.controller.isSectionClosed(s.id)&&this.controller.getSectionSeatCount(s.id)>0);if(t.length<2)return null;let i=t.findIndex(s=>s.id===e);return i<0?null:{previous:t[(i-1+t.length)%t.length],next:t[(i+1)%t.length]}}wireSectionNavigation(e){e.querySelectorAll("[data-section-nav]").forEach(t=>{t.addEventListener("click",i=>{i.preventDefault(),i.stopPropagation();let s=t.dataset.sectionNav;s&&this.controller.focusSection(s)})})}renderSectionCard(e){if(!this.els.map)return;this.secCardEl?.remove();let t=e.categories.length?e.categories.map(d=>{let m=this.controller.doc?.categories.find(f=>f.key===d.key);return m?this.catPriceRange(m):{min:d.priceMin,max:d.priceMax}}).filter(d=>d!=null):[{min:e.priceMin,max:e.priceMax}],i=Math.min(...t.map(d=>d.min)),s=Math.max(...t.map(d=>d.max)),n=i===s?this.money(i):`${this.money(i)}\u2013${this.money(s)}`,o=(0,v.tCount)("picker.seatsLeftInSection",e.seatsLeft),a=`<button type="button" class="sl-seccard-x" aria-label="${(0,v.t)("picker.closeSectionSummary")}">\u2715</button>`,l=Vi(this.sectionNeighbours(e.id)),c=document.createElement("div"),h=this.root?.dataset.layout==="narrow",p={label:e.label,color:e.color,leftLabel:o,nav:l,close:a};if(h)c.className="sl-seccard strip on",c.setAttribute("role","status"),c.setAttribute("aria-label",(0,v.t)("picker.sectionSummaryAria",{label:e.label})),c.innerHTML=Mt(p),this.wireSectionNavigation(c),c.querySelector(".sl-seccard-x").addEventListener("click",()=>this.controller.overview()),this.els.map.appendChild(c);else if(this.secCardCollapsed)c.className="sl-seccard mini on",c.setAttribute("role","button"),c.setAttribute("aria-label",(0,v.t)("picker.sectionSummaryAria",{label:e.label})),c.innerHTML=Mt(p),this.wireSectionNavigation(c),c.addEventListener("click",d=>{d.target.closest(".sl-seccard-x")||(this.secCardCollapsed=!1,this.secCardShownAt=Date.now(),this.renderSectionCard(e))}),c.querySelector(".sl-seccard-x").addEventListener("click",()=>this.controller.overview()),(this.regions["top-center"]??this.els.map).appendChild(c);else{c.className="sl-seccard on",c.setAttribute("role","dialog"),c.setAttribute("aria-label",(0,v.t)("picker.sectionSummaryAria",{label:e.label}));let d=e.categories.map(m=>{let f=this.controller.doc?.categories.find(w=>w.key===m.key),x=f?this.catPriceRange(f):{min:m.priceMin,max:m.priceMax};return Yi({label:m.label,color:m.color,dim:this.priceBandKeys!=null&&!this.priceBandKeys.has(m.key),rangeLabel:x&&x.min!==x.max?`${this.money(x.min)}\u2013${this.money(x.max)}`:this.money(x?.min??m.price)})}).join("");c.innerHTML=Wi({...p,priceLabel:n,showPrice:e.categories.length>0,zoneLabel:e.zoneLabel,entrance:e.entrance?`${(0,v.t)("picker.entrance")} ${e.entrance}`:void 0,mix:d,overviewLabel:(0,v.t)("picker.overview"),hint:(0,v.t)("picker.tapSeatHint")}),this.wireSectionNavigation(c),c.querySelector(".sl-seccard-x").addEventListener("click",()=>this.controller.overview()),c.querySelector(".sl-seccard-overview").addEventListener("click",()=>this.controller.overview()),(this.regions["top-center"]??this.els.map).appendChild(c)}this.secCardEl=c}collapseSectionCard(){!this.secCardEl||this.secCardCollapsed||!this.lastSection||this.root?.dataset.layout!=="narrow"&&(this.secCardCollapsed=!0,this.renderSectionCard(this.lastSection))}sectionCardOnView(){if(!(!this.secCardEl||this.secCardCollapsed||!this.lastSection)&&this.root?.dataset.layout!=="narrow"){if(this.controller.getRung()==="seats"){this.collapseSectionCard();return}if(Date.now()-this.secCardShownAt<1400){this.sectionCardCoverage()>.25&&this.collapseSectionCard();return}this.collapseSectionCard()}}sectionCardCoverage(){let e=this.secCardEl,t=this.lastSection;if(!e||!t||!this.els.map)return 0;let i=this.activeFloorObjects().find(b=>b.type==="section"&&b.id===t.id)?.outline;if(!i||i.length<3)return 0;let s=i.map(b=>this.controller.worldToScreen(b)),n=s.map(b=>b.x),o=s.map(b=>b.y),a=Math.min(...n),l=Math.min(...o),c=Math.max(...n)-a,h=Math.max(...o)-l;if(c<=0||h<=0)return 0;let p=this.els.map.getBoundingClientRect(),d=e.getBoundingClientRect(),m=d.left-p.left,f=d.top-p.top,x=Math.max(0,Math.min(m+d.width,a+c)-Math.max(m,a)),w=Math.max(0,Math.min(f+d.height,l+h)-Math.max(f,l));return x*w/(c*h)}markedSeatAnnouncement(e){let t=It(this.controller.getRenderer()?.getSeatMark?.(e.id),this.performanceGroup?.nights?.());return ys(t,e.displayLabel??e.label,this.opts.locale)}announceSeat(e){if(!this.srEl)return;if(!e){this.srEl.textContent="";return}let t=this.markedSeatAnnouncement(e);if(t){this.srEl.textContent=t;return}let i=this.controller.doc?.categories.find(m=>m.key===e.categoryKey),s=this.controller.getStatus(e.id)??"free",n=s==="free"?this.tf("picker.statusAvailable","available"):s==="held"?this.tf("picker.statusOnHold","on hold"):this.tf("picker.statusTaken2","taken"),o=i?this.catPriceRange(i):void 0,a=o?o.min===o.max?this.money(o.min):`${this.money(o.min)}\u2013${this.money(o.max)}`:void 0,l=this.controller.tableSelection(e.id),c=l??this.controller.seatDetails(e.id),h=Ue(c),p=c?.rowLabel??c?.displayLabel??e.displayLabel??e.label,d=l?`${h} ${p}, ${l.bookingMode==="variable"?(0,v.t)("picker.minToMaxGuests",{min:l.minOccupancy,max:l.maxOccupancy}):(0,v.t)("picker.capacityGuests",{count:l.capacity})}`:c?.objectType==="booth"?`${h} ${p}`:c?.objectType==="table"?`${h} ${p}, ${(0,v.t)("picker.seatNumberLower",{label:c.seatNumber??e.label})}`:(0,v.t)("picker.seatLabel",{label:c?.displayLabel??e.displayLabel??e.label});this.srEl.textContent=`${d}, ${i?.label??e.categoryKey}${a?`, ${a}`:""}, ${n}`}showTableDialog(e,t,i){this.dismissTableDialog(!1),this.tableDialog={...e},this.tableDialogHeld=t,this.tableDialogReturnFocus=i??document.activeElement;let s=this.controller.doc?.categories.find(a=>a.key===e.categoryKey),n=e.bookingMode==="variable",o=document.createElement("div");o.className="sl-table-scrim",o.innerHTML=Xi(e,{variable:n,held:t,typeWord:Ue(e),categoryLabel:s?.label??e.categoryKey,unitPrice:this.money(this.paidPrice(e.categoryKey,e.tierId??null,e.price,e.label))}),this.root.appendChild(o),this.tableDialogEl=o,this.renderTableDialogState(),o.querySelectorAll("[data-table-step]").forEach(a=>{a.addEventListener("click",()=>{if(!this.tableDialog)return;let l=Math.max(this.tableDialog.minOccupancy,Math.min(this.tableDialog.maxOccupancy,this.tableDialog.quantity+Number(a.dataset.tableStep)));this.tableDialog={...this.tableDialog,quantity:l},this.renderTableDialogState()})}),o.querySelector(".sl-table-cancel").addEventListener("click",()=>this.cancelTableDialog()),o.querySelector(".sl-table-confirm").addEventListener("click",()=>{this.confirmTableDialog()}),o.addEventListener("mousedown",a=>{a.target===o&&this.cancelTableDialog()}),o.addEventListener("keydown",a=>{if(a.key!=="Tab")return;let l=[...o.querySelectorAll('button:not(:disabled),[tabindex]:not([tabindex="-1"])')];if(!l.length)return;let c=l[0],h=l[l.length-1];a.shiftKey&&document.activeElement===c?(a.preventDefault(),h.focus()):!a.shiftKey&&document.activeElement===h&&(a.preventDefault(),c.focus())}),requestAnimationFrame(()=>o.querySelector(n?'[data-table-step="-1"]':".sl-table-confirm")?.focus())}renderTableDialogState(){let e=this.tableDialog,t=this.tableDialogEl;if(!e||!t)return;let i=t.querySelector("output[data-table-qty]");i&&(i.value=String(e.quantity));let s=t.querySelector("input[data-table-qty]");s&&(s.value=String(e.quantity)),t.querySelectorAll("[data-table-step]").forEach(a=>{let l=Number(a.dataset.tableStep);a.disabled=l<0?e.quantity<=e.minOccupancy:e.quantity>=e.maxOccupancy});let n=this.paidPrice(e.categoryKey,e.tierId??null,e.price,e.label),o=t.querySelector("[data-table-total]");o&&(o.textContent=this.money(n*e.quantity))}async confirmTableDialog(){let e=this.tableDialog,t=this.tableDialogHeld;if(!e)return;let i=this.tableDialogEl?.querySelector(".sl-table-confirm");if(i&&(i.disabled=!0,i.textContent=t?this.tf("picker.updatingEllipsis","Updating\u2026"):this.tf("picker.selectingEllipsis","Selecting\u2026")),t){try{let s=await this.controller.replaceTableQuantity(e.label,e.quantity,this.opts.holdTtlMs);if(!s){this.toast(this.tf("picker.guestCountCouldNotBeSecured","That guest count could not be secured. Your current table hold is unchanged."),"warning"),this.renderTableDialogState(),i&&(i.disabled=!1,i.textContent=this.tf("picker.updateTable","Update table"));return}this.hold={holdId:s.holdId,expiresAt:s.expiresAt,seats:s.seats,items:s.items},this.startHoldTimer(s.expiresAt),this.dismissTableDialog(),this.syncTray(),this.emitHoldChange(),this.toast((0,v.t)("picker.tableUpdatedForGuests",{label:e.label,count:e.quantity}),"success")}catch(s){this.opts.onError?.(s),this.toast(this.tf("picker.guestCountNoLongerAvailable","That guest count is no longer available. Your current hold is unchanged."),"error"),i&&(i.disabled=!1,i.textContent=this.tf("picker.updateTable","Update table"))}return}if(!this.controller.setTableQuantity(e.label,e.quantity)){i&&(i.disabled=!1,i.textContent=e.bookingMode==="variable"?this.tf("picker.selectTable","Select table"):this.tf("picker.selectWholeTable","Select whole table"));return}this.dismissTableDialog(),this.collapseSectionCard(),this.syncTray()}cancelTableDialog(){let e=this.tableDialog,t=this.tableDialogHeld;this.dismissTableDialog(),e&&!t&&this.controller.deselect(e.physicalSeatIds)}dismissTableDialog(e=!0){let t=this.tableDialogReturnFocus;this.tableDialogEl?.remove(),this.tableDialogEl=null,this.tableDialog=null,this.tableDialogHeld=!1,this.tableDialogReturnFocus=null,e&&requestAnimationFrame(()=>(t?.isConnected?t:this.root)?.focus())}showConfirm(e){let t=this.confirmSeat?.id;this.confirmEl?.remove(),this.confirmEl=null,this.confirmSeat=e,this.root?.setAttribute("data-confirming","true"),this.els.side?.toggleAttribute("inert",!0),Object.values(this.regions).forEach(w=>w.toggleAttribute("inert",!0)),this.controller.setSelectionFocus(e.id),t&&t!==e.id&&this.controller.deselect([t]),this.tipEl&&(this.tipEl.style.display="none");let i=this.controller.seatDetails(e.id),s=this.controller.doc?.categories.find(w=>w.key===e.categoryKey),n=i?.price??(s?.tiers?.length?s.tiers[0].price:s?.price),o=n!=null?this.paidPrice(e.categoryKey,i?.tierId??s?.tiers?.[0]?.id??null,n,e.label):void 0,a=Ui(i,e.displayLabel??e.label,Ue(i)),l=i?.tiers??s?.tiers??[],c=i?.tierId??l[0]?.id,h=Ki(l,c,w=>this.money(this.paidPrice(e.categoryKey,w.id,w.price,e.label))),p=this.buyerView==="venue3d",d=document.createElement("div");d.className="sl-confirm",d.setAttribute("role","dialog"),d.setAttribute("aria-label",(0,v.t)("picker.confirmSeatLabel",{label:e.label}));let m=s?.color??"#6e7bff",f=Tt(m,this.cssVar("--sl-surface")||"#1a2234",.76)??m;d.style.setProperty("--sl-cat",m),d.style.setProperty("--sl-cat-ink",ne(f,"#172033","#ffffff")),d.innerHTML=Qi({identityFields:a,categoryColor:s?.color??"#6e7bff",categoryLabel:String(i?.categoryLabel??s?.label??e.categoryKey),priceLabel:o!=null?this.money(o):"",tierChoices:h,wheelchair:Ni(i?.wheelchairSpaceType),commercial:ji(e.commercial),thumb:this.seatViewEnabled()&&this.buyerView!=="venue3d"?this.confirmThumbHtml(e):"",inspect:p?`${qi(e,`${i?.displayLabel??e.displayLabel??e.label} \xB7 ${o==null?this.tf("picker.priceNotSupplied","Price not supplied"):this.money(o)}`,p)}<div class="sl-confirm-inspect-row">${Gi(e,p?this.view3dCompareSeatIds:null)}${Lt(this.canOffer3d(),p)}</div>`:Lt(this.canOffer3d(),p),cancelLabel:(0,v.t)("common.cancel"),selectLabel:this.tf("picker.select","Select")}),this.els.map.appendChild(d),this.confirmEl=d;let x=d.querySelector(".sl-confirm-thumb");if(x&&e.viewUrl){let w=e.viewMeta?.previewUrl??e.viewUrl;this.buyerAssetUrls.resolve(w).then(b=>{b&&d.isConnected&&this.confirmEl===d&&(x.src=b)}).catch(b=>this.opts.onError?.(b))}this.reanchorConfirm(),d.querySelector(".sl-confirm-view")?.addEventListener("click",()=>{this.openSeatView(e)}),d.querySelector(".sl-confirm-confidence")?.addEventListener("click",w=>{this.openSeatConfidencePassport(e,w.currentTarget instanceof HTMLElement?w.currentTarget:null)}),d.querySelector(".sl-confirm-compare")?.addEventListener("click",()=>this.saveView3dComparisonSeat(e)),d.querySelectorAll("[data-confirm-tier]").forEach(w=>{w.addEventListener("click",()=>{let b=w.dataset.confirmTier,P=l.find(T=>T.id===b);if(!P)return;this.controller.setSeatTier(e.id,P.id),d.querySelectorAll("[data-confirm-tier]").forEach(T=>{T.setAttribute("aria-pressed",String(T===w))});let k=d.querySelector(".sl-confirm-price");k&&(k.textContent=this.money(this.paidPrice(e.categoryKey,P.id,P.price,e.label))),this.reanchorConfirm()})}),d.querySelector(".sl-confirm-3d")?.addEventListener("click",()=>{this.buyerView==="venue3d"?(this.dismissConfirm(),this.view3dHandle?.flyToSeat(e.id)):(this.view3dReturnSeat=e,this.dismissConfirm(),this.enter3d(e.id))}),d.querySelector(".sl-confirm-add").addEventListener("click",()=>this.commitConfirm()),d.querySelector(".sl-confirm-cancel").addEventListener("click",()=>this.cancelConfirm()),requestAnimationFrame(()=>d.querySelector(".sl-confirm-add")?.focus())}reanchorConfirm(){if(!this.confirmEl||!this.confirmSeat||this.root?.dataset.view3d==="on")return;let e=this.controller.worldToScreen({x:this.confirmSeat.x,y:this.confirmSeat.y});if(this.root?.dataset.layout==="narrow")return;let t=this.els.map.clientWidth,i=this.els.map.clientHeight,s=this.confirmEl.offsetWidth||276,n=this.confirmEl.offsetHeight||230,o=s/2+12,a=Math.max(o,Math.min(t-o,e.x)),l=e.y+n+24<=i,c=e.y<n+24&&l;this.confirmEl.dataset.placement=c?"below":"above",this.confirmEl.style.left=`${a}px`,this.confirmEl.style.top=`${Math.max(8,Math.min(i-8,e.y))}px`}dismissConfirm(){this.confirmEl?.remove(),this.confirmEl=null,this.confirmSeat=null,this.root?.removeAttribute("data-confirming"),Object.values(this.regions).forEach(e=>e.toggleAttribute("inert",!1)),this.applyPanelCollapsed(),this.controller.setSelectionFocus(null)}commitConfirm(){this.confirmSeat&&(this.dismissConfirm(),this.collapseSectionCard(),this.syncTray(),this.syncSelectionTo3d())}cancelConfirm(){let e=this.confirmSeat;e&&(this.controller.deselect([e.id]),this.confirmSeat&&this.dismissConfirm(),this.syncSelectionTo3d(),this.root?.focus({preventScroll:!0}))}closeConfirm(){this.dismissConfirm()}seatViewEnabled(){return this.opts.seatView!==!1}allSeats(){return this.allSeatsCache||(this.allSeatsCache=[...this.controller.getExpandedSeats()]),this.allSeatsCache}async openSeatView(e){if(!this.root||!this.seatViewEnabled())return;let t=++this.seatViewGen,i=this.controller.doc,s=this.controller.getActiveFloorId(),n=e.focalPoint??i?.floors?.find(p=>p.id===s)?.focalPoint??i?.focalPoint??{x:0,y:0},o,a,l=!1;if(e.viewUrl){let p,d=null;try{let f=e.viewMeta?.previewUrl;f&&f!==e.viewUrl?(d=await this.buyerAssetUrls.resolve(f),p=e.viewUrl):p=await this.buyerAssetUrls.resolve(e.viewUrl)}catch(f){t===this.seatViewGen&&this.opts.onError?.(f);return}if(t!==this.seatViewGen||!p||e.viewMeta?.previewUrl&&e.viewMeta.previewUrl!==e.viewUrl&&!d||!this.root||!this.seatViewEnabled())return;let m={url:p,...d?{previewUrl:d}:{},...e.viewMeta?.sourceWidth!==void 0?{sourceWidth:e.viewMeta.sourceWidth}:{},...e.viewMeta?.sourceHeight!==void 0?{sourceHeight:e.viewMeta.sourceHeight}:{},...e.viewMeta?.previewWidth!==void 0?{previewWidth:e.viewMeta.previewWidth}:{},...e.viewMeta?.previewHeight!==void 0?{previewHeight:e.viewMeta.previewHeight}:{},...e.viewMeta?.coverage?{coverage:e.viewMeta.coverage}:{},...e.viewMeta?.capturedAt?{capturedAt:e.viewMeta.capturedAt}:{},...e.viewMeta?.sourceLabel?{sourceLabel:e.viewMeta.sourceLabel}:{}};o=m,a=(0,Ke.seatViewDisclosure)(m),l=(0,Ke.isAuthoredSeatView)(m)}else{let p;try{let{generateSeatPanorama:d}=await $i();p=d(e,n,this.allSeats())}catch(d){t===this.seatViewGen&&this.opts.onError?.(d);return}if(t!==this.seatViewGen||!this.root||!this.seatViewEnabled())return;o={url:p.url,generated:!0},a=(0,v.t)("picker.illustrationCaption",{m:p.distanceM})}this.closeSeatView(!1);let c=(0,v.t)("picker.viewFromSeat",{label:e.label}),h=Ti({root:this.root,source:o,caption:a,real:l,closeLabel:this.tf("picker.close","Close"),dragHint:this.tf("picker.dragToLookAround","Drag to look around \xB7 scroll to zoom"),viewFromSeatLabel:c,real360Label:(0,v.t)("picker.real360"),previewLabel:(0,v.t)("picker.preview"),resolveAsset:p=>this.buyerAssetUrls.resolve(p),onClose:()=>this.closeSeatView()});this.viewEl=h.element,this.viewCleanup=()=>h.dispose()}closeSeatView(e=!0){e&&(this.seatViewGen+=1),this.viewCleanup?.(),this.viewCleanup=null,this.viewEl?.remove(),this.viewEl=null}money(e){let t=this.opts.pricing?.formatter;if(t)return t(e,this.currency);let i=Number.isInteger(e);return(0,v.formatMoney)(e,this.currency,{locale:this.opts.locale,fallback:(s,n)=>`${s} ${n}`,...i?{minimumFractionDigits:0,maximumFractionDigits:0}:{}})}scheduleOfferBoundary(e){if(this.offerBoundaryTimer&&clearTimeout(this.offerBoundaryTimer),this.offerBoundaryTimer=null,!this.api.availability||this.destroyed)return;let t=Date.now(),i=bi(e,t);if(i==null)return;let s=6*36e5,n=Math.min(Math.max(i-t+1e3,1e3),s);this.offerBoundaryTimer=setTimeout(()=>{this.offerBoundaryTimer=null,!document.hidden&&this.refreshOfferAvailability(!1)},n)}scheduleOfferRefresh(e){!this.api.availability||this.destroyed||(this.offerRefreshTimer&&clearTimeout(this.offerRefreshTimer),this.offerRefreshTimer=setTimeout(()=>{this.offerRefreshTimer=null,this.refreshOfferAvailability(e)},e?180:0))}async refreshOfferAvailability(e){if(!(!this.api.availability||this.destroyed))try{let t=await this.api.availability(this.opts.event,e);if(this.destroyed)return;let i=st(t);if(!i)return;this.offerAvailability=i,this.applyChannelPricing(i.channelPricing),this.scheduleOfferBoundary(i);let s=rt(i),n={...this.hostPricing?.prices??{},...s},o=Object.keys(n).length>0||this.hostPricing?.formatter?{prices:n,...this.hostPricing?.formatter?{formatter:this.hostPricing.formatter}:{}}:void 0;this.setPricing(o),this.syncOffer(),this.opts.onOfferAvailabilityChange?.(i)}catch{!this.destroyed&&!this.offerBoundaryTimer&&!document.hidden&&(this.offerBoundaryTimer=setTimeout(()=>{this.offerBoundaryTimer=null,!document.hidden&&this.refreshOfferAvailability(!1)},3e4))}}offerPrice(e){return e?this.offerAvailability?.prices.find(t=>t.categoryKey===e)??null:null}applyChannelPricing(e){this.channelByObject.clear(),this.pricesByChannel.clear();for(let t of e?.channels??[])this.pricesByChannel.set(t.channelId,t.priceOverrides);for(let t of e?.objects??[])this.pricesByChannel.has(t.channelId)&&this.channelByObject.set(t.label,t.channelId)}syncOffer(){let e=this.els.offer;if(!e)return;let t=this.offerAvailability,i=t?.release??null,s=i?null:t?.upcoming??null;if(!t||t.state==="closed"||t.state==="sold-out"||!i&&!s){e.classList.remove("has"),e.replaceChildren();return}let n=i??s,o=document.createElement("div");o.className="sl-offer-main";let a=document.createElement("div");a.className="sl-offer-copy";let l=document.createElement("span");l.className="sl-offer-kicker",l.textContent=i?this.tf("picker.currentTicketOffer","Current ticket offer"):this.tf("picker.upcomingTicketOffer","Upcoming ticket offer");let c=document.createElement("strong");c.className="sl-offer-name",c.textContent=n.name||(i?this.tf("picker.currentOffer","Current offer"):this.tf("picker.scheduledOffer","Scheduled offer"));let h=document.createElement("span");h.className="sl-offer-line";let p=[];i&&t.fromPrice!=null&&p.push(this.money(t.fromPrice/100)),i&&n.remaining!=null&&p.push((0,v.t)("picker.offerRemainingAvailable",{count:n.remaining})),i&&n.endsAt!=null&&p.push((0,v.t)("picker.offerUntil",{time:at(n.endsAt,this.eventTimezone,this.opts.locale)})),s?.startsAt!=null&&p.push((0,v.t)("picker.offerStarts",{time:at(s.startsAt,this.eventTimezone,this.opts.locale)})),h.textContent=p.join(" \xB7 "),a.append(l,c,h);let d=document.createElement("details");d.className="sl-offer-info";let m=document.createElement("summary");m.setAttribute("aria-label",(0,v.t)("picker.howOfferWorks",{name:c.textContent??""})),m.textContent="i";let f=document.createElement("div");f.className="sl-offer-detail",f.textContent=i?this.tf("picker.offerDetailActive","This price applies automatically to eligible seats. Tickets in active carts temporarily reduce the available quantity; released or expired holds return it. When the offer ends, the next matching offer or normal ticket price takes over."):this.tf("picker.offerDetailUpcoming","Tickets are available at their normal price now. This scheduled offer will apply automatically to eligible seats when it starts."),d.append(m,f),o.append(a,d),e.replaceChildren(o),e.classList.add("has")}paidPrice(e,t,i,s){let n=s?this.channelByObject.get(s):void 0;if(n&&e){let a=this.pricesByChannel.get(n)?.find(l=>l.categoryKey===e&&l.tierId===(t??null));if(a)return a.price}let o=e?this.opts.pricing?.prices?.[e]:void 0;return o===void 0?i:typeof o=="number"?o:t&&o.tiers?.[t]!==void 0?o.tiers[t]:o.base??i}legendDeps(){return{colorOf:e=>this.controller.getRenderer()?.categoryDisplayColor?.(e.key)??e.color,rangeOf:e=>this.catPriceRange(e),priceOf:e=>this.catPrice(e),offerOf:e=>this.offerPrice(e),money:e=>this.money(e),esc:G}}syncPriceRail(e,t){let i=this.els.railScroll,s=e.length>1;this.els.rail?.classList.toggle("has",s||!!this.a11yChipsEl?.children.length),i&&(i.innerHTML=s?ui({...this.legendDeps(),categories:e,left:t,activeKey:this.focusedCatKey,soldOutWord:this.tf("picker.soldOut","Sold out")}):"",i.querySelectorAll(".sl-rc").forEach(n=>{n.addEventListener("click",()=>this.focusCategory(n.dataset.cat??""))}),this.railEdgesBound||(this.railEdgesBound=!0,i.addEventListener("scroll",()=>kt(i),{passive:!0})),requestAnimationFrame(()=>kt(i)))}syncPrices(){let e=this.controller.doc;if(!e||!this.els.prices)return;let t=this.controller.categoryAvailability(),i=e.categories.filter(l=>!l.notForSale);if(this.narrateAvailability(i,t),this.syncSoldout(i,t),this.suppressPricing){this.els.prices.replaceChildren(),this.els.pricesSec?.remove(),this.els.pricesHint?.remove();return}this.syncPriceRail(i,t);let s=5,n=i.length-s,o=n>1&&!this.pricesExpanded,a=o?i.slice(0,s):i;this.els.prices.classList.toggle("sl-expanded",n>1&&this.pricesExpanded),this.els.prices.innerHTML=hi({...this.legendDeps(),categories:a,left:t,collapsed:o,activeKey:this.focusedCatKey,bandKeys:this.priceBandKeys,leftCount:l=>(0,v.tCount)("picker.leftCount",l),titleFor:(l,c)=>c?this.tf("picker.showAllSeats","Show all seats"):(0,v.t)("picker.showLabelSeatsOnMap",{label:l.label}),moreLabel:n>1?o?(0,v.t)("picker.showAllTicketTypes",{count:i.length}):this.tf("picker.showFewer","Show fewer"):null,status:{legend:this.tf("picker.seatStatusLegend","Seat status legend"),held:this.tf("picker.temporarilyHeld","Temporarily held"),sold:this.tf("picker.sold","Sold")}}),this.els.prices.querySelectorAll(".sl-price-row").forEach(l=>{l.addEventListener("mouseenter",()=>this.controller.getRenderer()?.setCategoryHighlight?.(l.dataset.cat??null)),l.addEventListener("mouseleave",()=>this.controller.getRenderer()?.setCategoryHighlight?.(null));let c=()=>this.focusCategory(l.dataset.cat??"");l.addEventListener("click",c),l.addEventListener("keydown",h=>{(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),c())})}),this.els.prices.querySelector(".sl-price-more")?.addEventListener("click",()=>{this.pricesExpanded=!this.pricesExpanded,this.syncPrices()})}focusCategory(e){if(!e)return;let t=this.focusedCatKey===e?null:e;this.focusedCatKey=t,this.priceBandKeys=t?new Set([t]):null;let i=this.els.pricesSec?.querySelector(".sl-price-select");i&&(i.value="all"),this.controller.setCategoryFilter(t?[t]:null),this.controller.focusCategoryFilter(t?[t]:null),this.pushAvailabilityTo3d(),this.syncFloors(),this.syncRung(),this.minimap?.refreshMinimap(),this.syncPrices(),this.lastSection&&this.showSectionCard(this.lastSection)}narrateAvailability(e,t){let i=this.els.liveText,s=this.lastCatAvail;this.lastCatAvail={...t};let n=this.controller.getActiveFloorId();if(n!==this.lastAvailFloorId&&(this.lastAvailFloorId=n,this.availQuietUntil=performance.now()+2e3),!(!i||!s||performance.now()<this.availQuietUntil))for(let o of e){let a=s[o.key],l=t[o.key]??0;if(a===void 0||l>=a)continue;let c=a-l;i.textContent=(0,v.tCount)("picker.seatsJustTakenInCategory",c,{label:o.label,left:l}),this.els.live?.classList.remove("on"),this.els.live?.offsetWidth,this.els.live?.classList.add("on"),this.liveTimer&&clearTimeout(this.liveTimer),this.liveTimer=setTimeout(()=>this.els.live?.classList.remove("on"),8e3);return}}evictTakenSelections(){let e=new Set([...this.controller.currentHold()?.labels??[],...this.holdingLabels]),t=this.controller.getSelection().filter(i=>!e.has(i.label)&&(this.controller.getStatus(i.id)??"free")!=="free");t.length&&(this.controller.deselect(t.map(i=>i.id)),this.toast((0,v.t)("picker.seatJustTakenByAnother",{label:t[0].label}),"error"))}syncTray(){if(!this.els.tray)return;this.updateSelectionCapacity();let e=this.committedSelection(),t=this.controller.getGAAreas(),i=this.hold?.items??[],s=[],n=new Set;if(!this.salesClosed){let u=this.performanceGroup?.nightSummary?.()??[];u.length&&s.push(bs(u,{title:this.tf("picker.group.yourSeatsByNight","Your seats by night"),empty:this.tf("picker.group.noSeatsChosenYet","No seats yet")}));let y=this.performanceGroup?.selectionModeSwitch;y&&s.push(`<button type="button" class="sl-pg-switch" data-pg-switch-mode>${G(y.label)}</button>`)}s.push(ds({salesClosed:this.salesClosed,hasPicks:e.length>0||i.length>0,hasGaAreas:t.length>0,groupMode:this.performanceGroup?this.performanceGroup.selectionMode??"same_seat":null,seated:!!this.controller.doc?.objects?.some(u=>u.type!=="gaArea"),whenText:this.eventWhenText?String(this.eventWhenText):void 0}));let o=!e.length&&!i.length&&!Ee(this.gaQty,this.hold?.items??[]);if(o&&(this.baReopen=!1),!this.performanceGroup&&!this.salesClosed&&!this.hold&&(o||this.baReopen||this.bestAvailableBusy||this.bestAvailableConfirm)){let u=(this.controller.doc?.categories??[]).filter(A=>!A.notForSale),y=this.controller.getBestAvailableZones();this.baZone&&!y.some(A=>A.id===this.baZone)&&(this.baZone=""),s.push(cs({confirming:this.bestAvailableConfirm,busy:this.bestAvailableBusy,reopened:this.baReopen,quantity:this.baQty,premium:this.baPremium,offerPremium:this.controller.hasPremiumSeats(),categories:u,zones:y,selectedCategory:this.baCat,selectedZone:this.baZone}))}let a=(u,y,A,D=1,L,H)=>ns({d:u?this.controller.seatDetails(u):null,area:A==="ga"?t.find(z=>z.id===L):void 0,label:y,objectType:A,quantity:D,identity:H,performanceLabel:this.performanceGroup?.activePerformanceLabel?.()}),l=os;for(let u of ei(i)){let y=u.objectType==="ga"?`held:ga:${u.objectId}:${u.tierId??""}`:`held:${u.label}`;n.add(y);let A=this.controller.doc?.categories.find(q=>q.key===u.categoryKey),D=u.tierId?A?.tiers?.find(q=>q.id===u.tierId)?.name:void 0,L=u.objectType!=="ga"?this.controller.seatByLabel(u.label):null,H=u.objectType==="table"?this.controller.tableSelection(u.label):null,z=this.seatViewEnabled()&&!!L&&u.objectType!=="table";s.push(`<div class="sl-chip sl-held${this.lastTrayKeys.has(y)?"":" sl-enter"}" data-key="${y}" data-held="${encodeURIComponent(u.labels.join(`
1659
1659
  `))}"${L?` data-locate="${L.id}"`:""}><div class="sl-chip-main">`+a(L?.id??null,u.label,u.objectType,u.quantity??1,u.objectId,H??void 0)+`<div class="sl-chip-sub"><span class="sl-ticket-state held" aria-label="${this.tf("picker.heldForYou","Held for you")}" title="${this.tf("picker.heldForYou","Held for you")}"><svg viewBox="0 0 24 24"><rect x="5" y="10" width="14" height="10" rx="2"/><path d="M8 10V7a4 4 0 0 1 8 0v3"/></svg></span><span class="cat">${A?.label??u.categoryKey}${D?` \xB7 ${D}`:""}</span>`+(H?.bookingMode==="variable"?`<button type="button" class="sl-table-edit" data-table-edit="${encodeURIComponent(u.label)}">${(0,v.t)("picker.guestsCountEdit",{count:u.quantity??1})}</button>`:"")+At(L?.wheelchairSpaceType)+Pt(L?.commercial)+(this.suppressPricing?"":`<span class="amt">${this.money(this.paidPrice(u.categoryKey,u.tierId,u.unitPrice,u.label)*(u.quantity??1))}</span>`)+"</div></div>"+(this.performanceGroup?"":l((0,v.t)("picker.removeHeldTicketLabel",{label:ii(u,t)}),z?u.label:null))+"</div>")}let c=new Set(i.map(u=>u.label)),h=this.seatViewEnabled();for(let u of e.filter(y=>!c.has(y.label))){let y=`seat:${u.id}`;n.add(y);let A=this.controller.doc?.categories.find(z=>z.key===u.categoryKey),D=u.tiers&&u.tiers.length&&!this.suppressPricing?`<select class="tier" data-tier="${u.id}" aria-label="${(0,v.t)("picker.ticketTierFor",{label:u.label})}">`+u.tiers.map(z=>`<option value="${z.id}"${z.id===u.tierId?" selected":""}>${z.name} \xB7 ${this.money(this.paidPrice(u.categoryKey,z.id,z.price,u.label))}</option>`).join("")+"</select>":"",L=u.tiers?.find(z=>z.id===u.tierId)??u.tiers?.[0],H=L?.buyerMessage?.trim()||(L?.restriction==="companion"?this.tf("picker.companionRequiresWheelchair","Requires the adjacent wheelchair place"):"");s.push(`<div class="sl-chip${this.lastTrayKeys.has(y)?"":" sl-enter"}" data-key="${y}" data-seat="${u.id}" data-locate="${u.id}"><div class="sl-chip-main">`+a(u.id,u.label,u.objectType,u.quantity??1,u.objectId,u)+`<div class="sl-chip-sub"><span class="sl-ticket-state" aria-label="${this.tf("picker.selected","Selected")}" title="${this.tf("picker.selected","Selected")}"><svg viewBox="0 0 24 24"><path d="M5 12l4 4L19 6"/></svg></span><span class="cat">${A?.label??u.categoryKey}</span>`+(u.objectType==="table"&&u.bookingMode==="variable"?`<button type="button" class="sl-table-edit" data-table-edit="${encodeURIComponent(u.label)}">${(0,v.t)("picker.guestsCountEdit",{count:u.quantity??1})}</button>`:"")+`${At(u.wheelchairSpaceType)}${Pt(u.commercial)}${D}`+(this.suppressPricing?"":`<span class="amt">${this.money(this.paidPrice(u.categoryKey,u.tierId??null,u.price,u.label)*(u.quantity??1))}</span>`)+"</div>"+(H?`<small class="sl-tier-note">${G(H)}</small>`:"")+"</div>"+l((0,v.t)("picker.removeSeatLabel",{label:u.label}),h&&u.objectType!=="table"?u.label:null)+"</div>")}t.length&&s.push(oi(this,t,i)),!this.performanceGroup&&!this.salesClosed&&!this.hold&&!o&&!this.baReopen&&!this.bestAvailableBusy&&!this.bestAvailableConfirm&&s.push(`<button type="button" class="sl-ba-reopen" data-ba-reopen><span aria-hidden="true">\u2726</span>${this.tf("picker.findTogetherInstead","Find seats together instead")}</button>`),this.els.tray.innerHTML=s.join(""),this.lastTrayKeys=n,this.els.tray.querySelector("[data-pg-switch-mode]")?.addEventListener("click",()=>this.performanceGroup?.selectionModeSwitch?.activate());let p=this.performanceGroup?.selectNight;p&&Cs(this.els.tray,u=>p(u)),this.els.tray.querySelectorAll("[data-ba]").forEach(u=>{u.addEventListener("click",()=>{this.baQty=Math.max(1,Math.min(this.maxTickets,this.baQty+Number(u.dataset.ba))),this.syncTray()})}),this.els.tray.querySelector("[data-ba-cat]")?.addEventListener("change",u=>{this.baCat=u.target.value}),this.els.tray.querySelector("[data-ba-zone]")?.addEventListener("change",u=>{this.baZone=u.target.value}),this.els.tray.querySelector("[data-ba-premium]")?.addEventListener("click",()=>{this.baPremium=!this.baPremium,this.syncTray()}),this.els.tray.querySelector(".sl-ba-go")?.addEventListener("click",()=>{if(this.pendingSelectionCount()>0){this.bestAvailableConfirm=!0,this.syncTray(),this.els.tray.querySelector("[data-ba-replace]")?.focus();return}this.bestAvailable(this.baQty,this.baCat||void 0,{preferPremium:this.baPremium,zoneId:this.baZone||void 0})}),this.els.tray.querySelector("[data-ba-cancel]")?.addEventListener("click",()=>{this.bestAvailableConfirm=!1,this.syncTray(),this.els.tray.querySelector(".sl-ba-go")?.focus()}),this.els.tray.querySelector("[data-ba-reopen]")?.addEventListener("click",()=>{this.baReopen=!0,this.syncTray(),this.els.tray.querySelector(".sl-ba-go")?.focus()}),this.els.tray.querySelector("[data-ba-close]")?.addEventListener("click",()=>{this.baReopen=!1,this.syncTray(),this.els.tray.querySelector("[data-ba-reopen]")?.focus()}),this.els.tray.querySelector("[data-ba-replace]")?.addEventListener("click",()=>{this.bestAvailableConfirm=!1,this.bestAvailable(this.baQty,this.baCat||void 0,{preferPremium:this.baPremium,zoneId:this.baZone||void 0})}),this.els.tray.querySelectorAll(".sl-chip .rm").forEach(u=>{u.addEventListener("click",()=>{let y=u.closest(".sl-chip");if(y.dataset.held){this.removeHeldLabels(decodeURIComponent(y.dataset.held).split(`
1660
- `),y);return}let A=y.dataset.seat,D=this.controller.getSelection().find(H=>H.id===A)?.label??this.tf("picker.seat","Seat"),L=()=>{this.controller.deselect([A]),this.toast((0,v.t)("picker.labelRemoved",{label:D}),"neutral",{label:this.tf("picker.undo","Undo"),onClick:()=>{let H=this.controller.select([A]);this.toast(H.length?(0,v.t)("picker.labelRestored",{label:D}):(0,v.t)("picker.labelNoLongerAvailable",{label:D}),H.length?"success":"warning")}})};if(this.reducedMotion()){L();return}y.classList.add("sl-leave"),this.scheduleMotion(L,150)})}),this.els.tray.querySelectorAll("[data-table-edit]").forEach(u=>{u.addEventListener("click",y=>{y.stopPropagation();let A=decodeURIComponent(u.dataset.tableEdit??""),D=this.controller.tableSelection(A);if(!D)return;let L=i.find(H=>H.label===A&&H.objectType==="table");this.showTableDialog({...D,quantity:L?.quantity??D.quantity},!!L,u)})}),this.els.tray.querySelectorAll(".sl-chip .tier").forEach(u=>{u.addEventListener("change",()=>this.controller.setSeatTier(u.dataset.tier,u.value||null))}),this.els.tray.querySelectorAll(".sl-chip .view[data-view-label]").forEach(u=>{u.addEventListener("click",()=>{let y=this.controller.seatByLabel(u.dataset.viewLabel);y&&this.openSeatView(y)})}),this.els.tray.querySelectorAll(".sl-chip[data-locate]").forEach(u=>{let y=()=>this.controller.flashSeat(u.dataset.locate,this.cssVar("--sl-accent")||"#f4b740");u.addEventListener("mouseenter",y),u.addEventListener("focusin",y)}),ai(this,this.els.tray,t),this.controller.setGASelection(Xt(this.gaQty)),this.salesClosed&&this.els.tray.querySelectorAll(".sl-ba-go,[data-ba],[data-ba-cat],[data-ba-zone],[data-ba-replace],.sl-ga button").forEach(u=>{u.disabled=!0});let d=Jt(this,t,this.hold?.items??[]),m=Ee(this.gaQty,this.hold?.items??[]),f=i.reduce((u,y)=>u+this.paidPrice(y.categoryKey,y.tierId,y.unitPrice,y.label)*(y.quantity??1),0),x=i.reduce((u,y)=>u+(y.quantity??1),0),w=e.filter(u=>!c.has(u.label)),b=w.reduce((u,y)=>u+this.paidPrice(y.categoryKey,y.tierId??null,y.price,y.label)*(y.quantity??1),0)+d+f,P=w.reduce((u,y)=>u+(y.quantity??1),0)+m+x,k=this.pendingSelectionCount(),T=this.lastTrayCount,O=this.lastTrayTotal,E=Ts(this.performanceGroup?.groupSelectionSummary?.(),this.performanceGroup?.selectionMode??"same_seat");if(this.els.count.textContent=E||(P?(0,v.tCount)("picker.ticketsCount",P):this.tf("picker.noSeatsSelected","No seats selected")),this.els.total.textContent=P&&!this.suppressPricing?this.money(b):"",this.root?.setAttribute("data-has-selection",String(P>0)),this.root?.setAttribute("data-ba-active",String(this.bestAvailableConfirm||this.bestAvailableBusy||this.baReopen)),this.els.foot?.classList.toggle("empty",P===0),this.els.seatSummary&&(this.els.seatSummary.textContent=E||(P?(0,v.tCount)("picker.seatsSelectedCount",P):"")),this.syncCta(P,k),this.hold){this.holdCopyPending=k>0;let u=ps({secured:x||this.hold.seats?.length||0,pendingCount:k,expiresAt:this.holdExpiresAt,releasing:this.releasingHold});this.els.holdTitle&&(this.els.holdTitle.textContent=u.title),this.els.holdCopy&&(this.els.holdCopy.textContent=u.copy);let y=this.els.holdChange;y&&(y.disabled=this.releasingHold,y.textContent=u.change)}P!==T&&this.animateOnce(this.els.count,"sl-value-pop",380),b!==O&&this.animateOnce(this.els.total,"sl-value-pop",380),T===0&&P>0&&(this.animateOnce(this.els.cta,"sl-ready",520),this.sideCollapsed&&this.root?.dataset.layout!=="narrow"&&this.setPanelCollapsed(!1)),this.renderPeek(P,b,k),this.lastTrayCount=P,this.lastTrayTotal=b,this.opts.onSelectionChange?.(e),this.emitSelectionValidity(P,e)}emitSelectionValidity(e,t){let i=this.controller.getSelectionValidity(e);i&&(i.seats=t,this.opts.onSelectionValidityChange?.(i),i.isValid?this.lastSelectionValidity!==!0&&this.opts.onSelectionValid?.(t):this.lastSelectionValidity!==!1&&this.opts.onSelectionInvalid?.(i),this.lastSelectionValidity=i.isValid)}renderPeek(e,t,i){if(!this.els.peek)return;let s=(this.controller.doc?.categories??[]).map(n=>this.catPrice(n)).filter(n=>n!=null);this.els.peek.innerHTML=ls({count:e,total:t,pendingCount:i,ctaPhase:this.ctaPhase,hasHold:!!this.hold,salesClosed:this.salesClosed,fromPrice:s.length?Math.min(...s):null,addMore:as({salesClosed:this.salesClosed,hasHold:!!this.hold,ctaPhase:this.ctaPhase,formOpen:this.baReopen||this.bestAvailableBusy||this.bestAvailableConfirm,room:this.maxTickets-this.totalTicketCount(),wanted:this.baQty}),holdTime:this.hold&&this.holdTimer?qe(Math.max(0,this.holdExpiresAt-Date.now())):null,money:n=>this.money(n)}),this.root&&(this.root.dataset.peekClock=String(!!this.els.peek.querySelector(".sl-peek-time")))}async removeHeldLabels(e,t){let i=e.filter(o=>o&&!this.releasingLabels.has(o));if(!i.length)return!1;let s=i[0];i.forEach(o=>this.releasingLabels.add(o)),t?.setAttribute("aria-busy","true");let n=t?.querySelector(".rm");n&&(n.disabled=!0);try{let o=this.handedOff;if(!await this.controller.releaseLabels(i))return this.toast((0,v.t)("picker.couldNotRemoveLabel",{label:s}),"error"),!1;ti(this.gaQty,this.hold?.items??[],i);let l=this.controller.currentHold();return this.hold=l?{holdId:l.holdId,expiresAt:l.expiresAt,seats:l.seats,items:l.items}:null,this.handedOff=!!this.hold&&o,this.bookedShown=!1,this.ctaPhase="idle",this.hold?this.startHoldTimer(this.hold.expiresAt):(this.stopHoldTimer(),this.forgetHold()),this.syncTray(),this.emitHoldChange(),this.toast((0,v.t)("picker.labelRemovedFromHold",{label:s}),"success"),!0}finally{i.forEach(o=>this.releasingLabels.delete(o)),t?.removeAttribute("aria-busy"),n?.isConnected&&(n.disabled=!1)}}async handleChangeSeats(){if(!this.hold||this.releasingHold)return;this.releasingHold=!0;let e=this.els.holdChange;e&&(e.disabled=!0,e.textContent=this.tf("picker.releasingEllipsis","Releasing\u2026"));try{await this.release(),this.hold||this.toast(this.tf("picker.heldTicketsReleased","Held tickets released. Choose your new seats."),"success")}finally{this.releasingHold=!1,e?.isConnected&&(e.disabled=!1,e.textContent=this.tf("picker.change","Change"))}}async handleCta(){if(this.salesClosed)return;let e=this.controller.getSelectionValidity(this.totalTicketCount());if(e&&!e.isValid){this.toast(Rt(e,(i,s)=>this.tf(i,s)),"warning");return}if(this.totalTicketCount()>this.maxTickets){this.toast((0,v.t)("picker.removeTicketsUntilOrFewer",{count:this.maxTickets}),"warning");return}let t=this.committedSelection();if(this.hold&&!t.some(i=>!(this.hold.items??[]).some(s=>s.label===i.label))){let i=this.hold.seats??t;this.handedOff=!0,this.setCtaPhase("checkout"),this.checkoutHandoff(this.hold,i);return}this.holdingLabels=new Set(t.map(i=>i.label)),this.setCtaPhase("holding");try{let i=null,s=Qt(this.gaQty),n=this.committedSelection();if(n.length){let o=await this.controller.hold(void 0,this.opts.holdTtlMs);i=o?{holdId:o.holdId,expiresAt:o.expiresAt,seats:o.seats,items:o.items}:null}for(let{areaId:o,tierId:a,qty:l}of s){let c=await this.controller.holdGA(o,l,{tierId:a,ttlMs:this.opts.holdTtlMs});i=c?{holdId:c.holdId,expiresAt:c.expiresAt,seats:c.seats,items:c.items}:i}if(!i){this.toast(this.tf("picker.seatsJustTaken","One or more seats were just taken. Please pick again."),"error"),this.setCtaPhase("idle"),this.syncTray();return}this.hold=i,this.handedOff=!this.performanceGroup,this.startHoldTimer(i.expiresAt),this.flashHeldSeats(i),this.setCtaPhase(this.performanceGroup?"idle":"checkout"),this.emitHoldChange(),this.performanceGroup||this.checkoutHandoff(i,i.seats??n)}catch(i){this.opts.onError?.(i);let s=i,n=(s.conflicts??[]).map(a=>a.label).filter(Boolean).slice(0,3);s.reason==="event_closed"&&this.setSalesClosed(!0);let o=s.reason==="event_closed"?this.tf("picker.seatSalesClosedForEvent","Seat sales have closed for this event."):s.reason==="companion_pair_required"?this.tf("picker.companionPairRequired","Select the adjacent wheelchair place with each companion ticket."):s.reason==="ticket_option_not_applicable"?this.tf("picker.ticketOptionNotApplicable","That ticket choice is not available for the selected seat."):n.length?n.length===1?(0,v.t)("picker.labelsNoLongerAvailable.one",{labels:n.join(", ")}):(0,v.t)("picker.labelsNoLongerAvailable.other",{labels:n.join(", ")}):this.tf("picker.seatsJustTaken","One or more seats were just taken. Please pick again.");this.toast(o,"error"),this.setCtaPhase("idle")}finally{this.holdingLabels.clear(),this.ctaPhase==="holding"&&(this.ctaPhase="idle"),this.syncTray()}}startHoldTimer(e){this.stopHoldTimer(),this.holdExpiresAt=e,this.hold&&this.rememberHold(this.hold);let t=this.els.hold;t.innerHTML=`<span class="sl-hold-dot" aria-hidden="true"></span><span>${this.tf("picker.held","Held")}</span><span class="sl-hold-time" data-ref="holdTime"></span>`;let i=t.querySelector('[data-ref="holdTime"]');this.els.holdNote?.classList.add("on");let s=()=>{let n=Math.max(0,this.holdExpiresAt-Date.now());i&&(i.textContent=qe(n));let o=this.els.peek?.querySelector(".sl-peek-time");o&&(o.textContent=qe(n)),!this.holdCopyPending&&this.els.holdCopy&&(this.els.holdCopy.textContent=Ot(this.holdExpiresAt)),t.classList.add("on"),t.classList.toggle("is-expiring",n>0&&n<=As),this.setExtendPrompt(n>0&&n<=As,n),n<=0&&this.stopHoldTimer()};s(),this.holdTimer=setInterval(s,500)}stopHoldTimer(){this.holdTimer&&clearInterval(this.holdTimer),this.holdTimer=null,this.els.hold?.classList.remove("on","is-expiring"),this.els.holdNote?.classList.remove("on"),this.root&&delete this.root.dataset.peekClock,this.setExtendPrompt(!1,0)}setExtendPrompt(e,t){if(this.extendEl)if(e&&this.controller.currentHold()&&!this.bookedShown){let i=Math.ceil(t/1e3),s=Math.floor(i/60),n=String(i%60).padStart(2,"0");this.els.extendTxt.innerHTML=(0,v.t)("picker.seatsHeldForNeedMoreTime",{time:`${s}:${n}`}),this.extendEl.classList.add("on")}else this.extendEl.classList.remove("on")}async handleExtend(){let e=this.els.extendBtn;e.disabled=!0;let t=e.textContent;e.textContent=this.tf("picker.addingEllipsis","Adding\u2026");try{let i=await this.controller.extendHold(this.opts.holdTtlMs);i?(this.hold={holdId:i.holdId,expiresAt:i.expiresAt,seats:i.seats,items:i.items},this.holdExpiresAt=i.expiresAt,this.extendEl?.classList.remove("on"),this.rememberHold(this.hold),this.emitHoldChange(),this.toast(this.tf("picker.moreTimeAdded","More time added \u2014 your seats are still held."),"success")):this.toast(this.tf("picker.couldNotAddMoreTime","Couldn't add more time \u2014 please head to checkout now."),"warning")}catch(i){this.opts.onError?.(i),this.toast(this.tf("picker.couldNotAddMoreTime","Couldn't add more time \u2014 please head to checkout now."),"warning")}finally{e.disabled=!1,e.textContent=t}}detectBooked(){this.bookedShown||!this.handedOff||!this.hold||this.controller.currentHold()===null&&this.showBooked()}showBooked(){if(this.bookedShown||!this.hold)return;this.bookedShown=!0;let e=this.buildHandoff(this.hold);this.stopHoldTimer(),this.forgetHold();let t=e.lineItems.reduce((s,n)=>s+n.quantity,0),i=this.performanceGroup?.groupSelectionSummary?.();this.els.bookedSub&&(this.els.bookedSub.innerHTML=i?.seats?`<span class="sl-booked-seats">${(0,v.tCount)("picker.group.ticketsConfirmedAcross",i.seats,{performances:i.performances})}</span>`:`<span class="sl-booked-seats">${(0,v.tCount)("picker.ticketsCount",t)}</span> ${this.tf("picker.confirmedAndOnWay","confirmed. A confirmation is on its way.")}`),this.bookedEl?.classList.add("on"),this.opts.onBooked?.(e)}notifyGroupSettled(e){e==="booked"?this.showBooked():this.dismissConfirm(),this.hold=null,this.handedOff=!1,this.ctaPhase="idle",this.stopHoldTimer(),this.forgetHold(),this.syncTray(),this.syncCta()}checkoutHandoff(e,t){if(this.checkoutMode==="hosted"){this.startHostedCheckout(e,t);return}this.opts.onCheckout?.(e,t,this.buildHandoff(e))}async startHostedCheckout(e,t){let i=this.buildHandoff(e),s=null;try{s=await(this.paymentOptions??=this.pubApi.paymentOptions(this.opts.event))}catch(o){this.opts.onError?.(o)}if(this.destroyed)return;let n=s?.providers?.[0];if(!n){let o=Bi(s?.reason),a=!!this.opts.onCheckoutUnavailable||!!this.opts.onCheckout;this.opts.onCheckoutUnavailable?.({reason:o,handoff:i}),this.opts.onCheckout?.(e,t,i),a||this.openCheckoutPanel({kind:"unavailable",reason:o,seatCount:i.lineItems.reduce((l,c)=>l+c.quantity,0)});return}await this.openCheckoutPanel({kind:"pay",provider:n,order:{holdId:i.holdId,expiresAt:i.expiresAt,currency:i.currency,total:i.total,labels:i.lineItems.map(o=>o.displayLabel??o.label)}})}async openCheckoutPanel(e){let t;try{({mountCheckout:t}=await _i())}catch(i){this.opts.onError?.(i),this.toast(this.tf("picker.checkoutCouldNotBeOpened","Checkout could not be opened. Your seats are still held \u2014 please try again."),"error"),this.setCtaPhase("idle");return}this.destroyed||!this.root||(this.closeCheckoutPanel(),this.checkoutPanel=t({root:this.root,state:e,formatMoney:i=>this.money(i),startSession:i=>this.pubApi.startCheckout(this.opts.event,{...i,...this.opts.returnUrl?{returnUrl:this.opts.returnUrl}:{}}),orderStatus:i=>this.pubApi.orderStatus(i),onCancel:()=>{this.checkoutPanel=null,this.hold||this.setCtaPhase("idle")},onConfirmed:i=>{this.opts.onOrderConfirmed?.(i),this.controller.refresh()},onError:i=>this.opts.onError?.(i)}))}closeCheckoutPanel(){this.checkoutPanel?.destroy(),this.checkoutPanel=null}buildHandoff(e){let i=(e.items??[]).map(o=>{let a=this.controller.lineItemDisplay(o);return{label:o.label,...a.displayLabel?{displayLabel:a.displayLabel}:{},...a.displayType?{displayType:a.displayType}:{},objectId:o.objectId,objectType:o.objectType,categoryKey:o.categoryKey,tierId:o.tierId,unitPrice:this.paidPrice(o.categoryKey,o.tierId,o.unitPrice,o.label),currency:o.currency??this.currency,quantity:o.quantity??1}}),s=i[0]?.currency??this.currency,n=i.reduce((o,a)=>o+a.unitPrice*a.quantity,0);return{holdId:e.holdId,expiresAt:e.expiresAt,currency:s,lineItems:i,total:n}}emitHoldChange(){let e=this.hold;this.scheduleOfferRefresh(!0),this.opts.onHoldChange?.(e,e?.seats??[],e?this.buildHandoff(e):null)}toast(e,t="neutral",i){let s=this.els.toast;if(!s)return;s.replaceChildren();let n=document.createElement("span");if(n.textContent=e,s.appendChild(n),s.classList.toggle("has-action",!!i),i){let o=document.createElement("button");o.type="button",o.className="sl-toast-action",o.textContent=i.label,o.addEventListener("click",i.onClick,{once:!0}),s.appendChild(o)}s.dataset.tone=t,s.classList.add("on"),this.toastTimer&&clearTimeout(this.toastTimer),this.toastTimer=setTimeout(()=>{s.classList.remove("on"),s.classList.remove("has-action"),s.dataset.tone="neutral"},4200)}placeTooltip(){if(!this.tipEl)return;let e=Ps(this.tipPos,this.els.map.clientWidth,{width:this.tipEl.offsetWidth,height:this.tipEl.offsetHeight});this.tipEl.style.left=`${e.left}px`,this.tipEl.style.top=`${e.top}px`}nightStripFor(e,t){let i=this.performanceGroup;return vs(It(e.mark,i?.nights?.()),{locale:this.opts.locale,switchLabel:i?.selectionModeSwitch?.label??null,pinned:t})}unpinTooltip(){this.tipPinned&&(this.tipPinned=!1,this.tipEl?.classList.remove("sl-tip-pinned"),this.tipEl&&(this.tipEl.style.display="none"))}updateTooltip(e){if(!this.tipEl)return;if(!e){this.tipPinned||(this.tipEl.style.display="none");return}let t=e.mark?.kind==="partial"&&this.lastPointerType!=="mouse",i=this.nightStripFor(e,t);this.tipEl.style.setProperty("--sl-cat",e.categoryColor),this.tipEl.innerHTML=Es(e,{price:this.suppressPricing?"":this.money(this.paidPrice(e.categoryKey,e.tierId??null,e.price,e.label)),priceNote:this.suppressPricing?this.tf("picker.group.pricesPerPerformance","Prices shown per performance"):"",rowTypeWord:Ue(e),extra:i+(t?`<button type="button" class="sl-tip-close" data-pg-tip-close aria-label="${this.tf("picker.group.closeSeatDetails","Close seat details")}">\xD7</button>`:"")}),this.tipPinned=t,this.tipEl.classList.toggle("sl-tip-pinned",t),this.tipEl.querySelector("[data-pg-tip-close]")?.addEventListener("click",()=>this.unpinTooltip()),this.tipEl.querySelector("[data-pg-switch-mode]")?.addEventListener("click",()=>{this.unpinTooltip(),this.performanceGroup?.selectionModeSwitch?.activate()}),this.tipEl.style.display="block",this.placeTooltip()}syncSeatMarks(){let e=this.performanceGroup?.seatMarks,t=this.controller.getRenderer();if(!e||!t?.setSeatMarks)return;let i={};for(let[s,n]of Object.entries(e())){let o=this.controller.idForLabel(s);o&&(i[o]=n)}Object.keys(i).length&&t.setSeatMarks(i)}getSelection(){return this.committedSelection()}selectObjects(e){return this.controller.select(e)}deselectObjects(e){this.controller.deselect(e)}clearSelection(){this.dismissConfirm(),this.dismissTableDialog(),this.controller.clearSelection()}categoryLegendColor(){let e=(this.controller.doc?.categories??[]).find(t=>!t.notForSale);return(e?this.controller.getRenderer()?.categoryDisplayColor?.(e.key):null)||e?.color||"#2563eb"}async refreshAvailability(){await this.controller.refresh(),this.syncSeatMarks(),this.syncTray()}refreshPerformanceGroupComposition(){this.syncTray()}async adoptRestoredHold(e){!e||this.hold||await this.resumeHoldFromServer(e,!1)}selectCategories(e){return this.controller.selectCategories(e)}deselectCategories(e){this.controller.deselectCategories(e)}setSelectableObjects(e){this.controller.setSelectableObjects(e)}setMaxSelection(e){this.maxTickets=Math.max(this.exactTickets??1,Math.floor(e)),this.controller.setMaxSelection(this.maxTickets),this.updateSelectionCapacity(),this.syncTray()}getSelectionValidity(){let e=this.controller.getSelectionValidity(this.totalTicketCount());return e&&(e.seats=this.committedSelection()),e}setMapTheme(e){this.destroyed||(this.opts.theme={...this.opts.theme??{},map:e??void 0},this.controller.setMapTheme(e),this.applyMapChromeTokens())}applyMapChromeTokens(){let e=this.els.map?.parentElement;if(!e||!this.root)return;let t=Ve(this.controller.doc?.theme,this.opts.theme),i=this.opts.theme?.map?.background??this.controller.doc?.theme?.background??void 0,s=wi(t,i);for(let n of["--sl-bg","--sl-surface","--sl-text","--sl-muted","--sl-line","--sl-accent-text"])s?e.style.setProperty(n,s[n]):e.style.removeProperty(n)}setEventDetailsHidden(e){this.eventDetailsHidden=e,this.syncFullscreenButtons()}setPricing(e){let t=JSON.stringify(this.opts.pricing??null),i=JSON.stringify(e??null);t!==i&&(this.opts.pricing=e,!(this.destroyed||!this.els.prices)&&(this.els.pricesSec?.querySelector(".sl-price-select")?.remove(),this.buildPriceFilter(),this.syncPrices(),this.syncTray(),this.lastSection&&this.showSectionCard(this.lastSection)))}buildLanguageSwitcher(e){if(!e)return;let t=(this.opts.languages??[]).map(s=>(0,v.resolveLocale)(s)).filter((s,n,o)=>o.indexOf(s)===n);if(t.length<2)return;let i=document.createElement("select");i.className="sl-langsel",i.setAttribute("aria-label",this.tf("picker.preferredTicketType","Language"));for(let s of t){let n=document.createElement("option");n.value=s,n.textContent=v.LOCALE_NAMES[s]??s,n.selected=s===(0,v.getLocale)(),i.appendChild(n)}i.addEventListener("change",()=>{this.setLocale(i.value)}),this.langSel=i,e.appendChild(i)}async setLocale(e){let t=(0,v.getLocale)(),i=await(0,v.loadLocale)(e);if(this.opts.messages&&(0,v.setStringOverrides)(this.opts.messages),i===t)return i;let s=this.root;if(!s)return i;s.lang=i,s.dir=(0,v.localeDirection)(),Si(s);try{this.syncTray()}catch{}try{this.syncPrices()}catch{}try{this.syncOffer()}catch{}try{this.syncRung()}catch{}try{this.syncFloors()}catch{}try{this.syncPanelToggle()}catch{}try{this.syncFullscreenButtons()}catch{}return this.controller.refreshMapCopy(),this.langSel&&this.langSel.value!==i&&(this.langSel.value=i),i}isColorblindSafe(){return this.cbSafe}setColorblindSafe(e){e!==this.cbSafe&&(this.cbSafe=e,this.cbEl?.setAttribute("aria-pressed",String(e)),this.controller.setColorblindSafe(e),this.syncPrices(),Wr(e))}setViewMode(e){this.controller.setViewMode(this.normalizeInitialView(e)),this.syncProjection(),this.dismissConfirm()}getViewMode(){return this.controller.getViewMode()}normalizeInitialView(e){return e==="perspective"?(this.perspectiveWarned||(this.perspectiveWarned=!0,console.warn("[seatlayer] initialView:'perspective' (2.5D) is deprecated for the buyer picker and was coerced to 'flat'. Use the Map | 3D control for the immersive view.")),"flat"):e??"flat"}getBuyerView(){return this.buyerView}setBuyerView(e,t){if(e==="map"){this.exit3d();return}let i=t?.flyToSeatId;if(this.buyerView==="venue3d"){i?(this.opts.onBuyerViewChange?.({view:"venue3d",seatId:i}),this.view3dHandle?.flyToSeat(i)):t?.resetView&&this.view3dHandle?.focusOverview();return}this.enter3d(i)}seatState3dFor(e){switch(this.controller.getStatus(e.id)){case"held":return"held";case"booked":return"sold";case"not_for_sale":return"dimmed";default:break}return this.priceBandKeys!=null&&!this.priceBandKeys.has(e.categoryKey)||this.limitedViewFilter&&(e.commercial?.restrictedView||e.commercial?.obstructedView)?"dimmed":"available"}pushAvailabilityTo3d(){if(!this.view3dHandle)return;let e=this.allSeats().map(t=>({seatId:t.id,state:this.seatState3dFor(t)}));this.view3dHandle.setAvailability(e)}syncSelectionTo3d(){this.view3dHandle&&this.view3dHandle.setSelection(this.controller.getSelection().map(e=>e.id))}async seatViewFor3d(e){let t=this.allSeats().find(i=>i.id===e);if(!t)return null;if(t.viewUrl)try{let i=t.viewMeta?.previewUrl,s=!!i&&i!==t.viewUrl,n=s?await this.buyerAssetUrls.resolve(i):null,o=s?t.viewUrl:await this.buyerAssetUrls.resolve(t.viewUrl);return!o||s&&!n?null:{url:o,...n?{previewUrl:n}:{},...s?{resolveUrl:a=>this.buyerAssetUrls.resolve(a)}:{},...t.viewMeta?.sourceWidth!==void 0?{sourceWidth:t.viewMeta.sourceWidth}:{},...t.viewMeta?.sourceHeight!==void 0?{sourceHeight:t.viewMeta.sourceHeight}:{},...t.viewMeta?.previewWidth!==void 0?{previewWidth:t.viewMeta.previewWidth}:{},...t.viewMeta?.previewHeight!==void 0?{previewHeight:t.viewMeta.previewHeight}:{},...t.viewMeta?.initialBearingDeg!==void 0?{initialBearingDeg:t.viewMeta.initialBearingDeg}:{},...t.viewMeta?.initialPitchDeg!==void 0?{initialPitchDeg:t.viewMeta.initialPitchDeg}:{},...t.viewMeta?.coverage?{coverage:t.viewMeta.coverage}:{},...t.viewMeta?.capturedAt?{capturedAt:t.viewMeta.capturedAt}:{},...t.viewMeta?.sourceLabel?{sourceLabel:t.viewMeta.sourceLabel}:{}}}catch(i){return this.opts.onError?.(i),null}return{url:"",generated:!0,mediaKind:"model",coverage:"exact-seat",sourceLabel:this.tf("picker.chartDerivedModel","Chart-derived model")}}emitAnalytics(e,t){try{this.opts.onAnalytics?.(e,{...t,surface:"buyer"})}catch{}}emit3dAnalytics(e,t){this.emitAnalytics(e,t)}onView3dSeatPick(e){if(this.salesClosed){this.toast(this.tf("picker.salesClosedToast","Sales are closed for this event."),"warning"),this.syncSelectionTo3d();return}let t=this.allSeats().find(a=>a.id===e);if(!t)return;let i=this.controller.tableSelection(e);if(this.committedSelection().some(a=>i?a.label===i.label:a.id===e)){this.controller.deselect([e]),this.dismissConfirm(),this.syncSelectionTo3d();return}let n=this.controller.getStatus(t.id);if(n==="held"||n==="booked"||n==="not_for_sale"){this.showUnavailable3dSeat(t,this.seatState3dFor(t),n),this.syncSelectionTo3d();return}if(this.dismissUnavailable3dSeat(),!this.controller.select([e]).length){this.syncSelectionTo3d(),this.dismissConfirm();return}if(this.opts.onBuyerViewChange?.({view:"venue3d",seatId:e}),this.flashPickedSeat(e),i){this.showTableDialog(i,!1),this.syncSelectionTo3d();return}this.opts.confirmSelection!==!1?this.showConfirm(t):this.syncTray(),this.syncSelectionTo3d()}showUnavailable3dSeat(e,t,i){let s=this.view3dEl;if(!s)return;this.dismissUnavailable3dSeat();let n=this.controller.seatDetails(e.id),o=n?.displayLabel??e.displayLabel??e.label,a=n?.sectionLabel,l=le(n),c=[a,l?(0,v.t)("picker.rowLabel",{label:l}):null,o].filter(Boolean).join(" \xB7 "),h=i==="held"?{title:this.tf("picker.temporarilyHeld","Temporarily held"),message:this.tf("picker.heldSeatExplanation","Another buyer is holding this seat. It may become available again.")}:i==="booked"?{title:this.tf("picker.sold","Sold"),message:this.tf("picker.soldSeatExplanation","This seat has already been booked.")}:{title:this.tf("picker.notForSale","Not for sale"),message:this.tf("picker.notForSaleExplanation","This seat is not included in the current sale.")},p=document.createElement("div");p.className="sl-view3d-unavailable",p.dataset.state=t,p.setAttribute("role","status"),p.setAttribute("aria-live","polite");let d=document.createElement("span");d.className="sl-view3d-unavailable-eyebrow",d.textContent=c||o;let m=document.createElement("strong");m.textContent=h.title;let f=document.createElement("div");f.className="sl-view3d-unavailable-copy",f.append(d,m);let x=document.createElement("button");x.type="button",x.setAttribute("aria-label",this.tf("picker.closeSeatStatus","Close seat status")),x.textContent="\xD7";let w=document.createElement("p");w.textContent=h.message,p.append(f,x,w),x.addEventListener("click",()=>p.remove()),s.appendChild(p),this.announceSeat(e)}dismissUnavailable3dSeat(){this.view3dEl?.querySelector(".sl-view3d-unavailable")?.remove()}saveView3dComparisonSeat(e){if(this.buyerView!=="venue3d")return;let t=this.view3dCompareSeatIds;t.includes(e.id)||(this.view3dCompareSeatIds=t.length===0?[e.id]:[t[0],e.id]),this.confirmSeat?.id===e.id&&(this.controller.deselect([e.id]),this.dismissConfirm(),this.syncSelectionTo3d(),this.syncTray()),this.view3dCompareChip.sync(),this.emit3dAnalytics("3d_comparison_saved",{seatId:e.id,count:this.view3dCompareSeatIds.length}),this.view3dCompareSeatIds.length>1?this.openView3dComparison():this.toast(this.tf("picker.chooseAnotherToCompare","Seat saved. Choose another seat to compare."),"success")}clearView3dComparison(){this.closeView3dComparison(!1),this.view3dCompareSeatIds=[],this.view3dCompareChip.remove(),this.emit3dAnalytics("3d_comparison_cleared")}view3dComparisonSnapshot(e){let t=this.allSeats().find(m=>m.id===e);if(!t)return null;let i=this.controller.seatDetails(t.id),s=this.controller.doc?.categories.find(m=>m.key===t.categoryKey),n=i?.price??(s?.tiers?.length?s.tiers[0].price:s?.price),o=n!=null?this.paidPrice(t.categoryKey,i?.tierId??s?.tiers?.[0]?.id??null,n,t.label):void 0,a=this.controller.getStatus(t.id),l=a==="held"?this.tf("picker.temporarilyHeld","Temporarily held"):a==="booked"?this.tf("picker.sold","Sold"):a==="not_for_sale"?this.tf("picker.notForSale","Not for sale"):this.tf("picker.available","Available"),c=t.viewUrl?(0,Ke.seatViewDisclosure)({url:t.viewUrl,...t.viewMeta?.coverage?{coverage:t.viewMeta.coverage}:{},...t.viewMeta?.capturedAt?{capturedAt:t.viewMeta.capturedAt}:{},...t.viewMeta?.sourceLabel?{sourceLabel:t.viewMeta.sourceLabel}:{}}):this.tf("picker.chartDerivedSeatEye","Live 3D \xB7 chart-derived seat-eye \xB7 not surveyed"),h=me(t.commercial)||this.tf("picker.noAuthoredRestriction","No organizer-authored restriction"),p=i?.wheelchairSpaceType?`${Le(i.wheelchairSpaceType)} \xB7 metadata, not access certification`:this.tf("picker.noAccessibilityMetadata","No accessibility metadata supplied"),d=(0,_t.seatConfidenceDisclosure)(t.confidenceEvidence);return{seat:t,label:i?.displayLabel??t.displayLabel??t.label,section:i?.sectionLabel??t.sectionId??"\u2014",row:le(i)??i?.rowLabel??"\u2014",category:i?.categoryLabel??s?.label??t.categoryKey,price:o==null?this.tf("picker.priceNotSupplied","Not supplied"):this.money(o),availability:l,selectable:a==null||a==="free",viewSource:c,limited:h,accessibility:p,confidence:d}}openSeatConfidencePassport(e,t=null){let i=this.view3dEl;if(!i)return;this.closeSeatConfidencePassport(!1);let s=(0,_t.seatConfidenceDisclosure)(e.confidenceEvidence),n=e.confidenceEvidence,o=this.controller.seatDetails(e.id),a=k=>S(k),l=s.limitations.length?`<h4>Known limits</h4><ul>${s.limitations.map(k=>`<li>${a(k)}</li>`).join("")}</ul>`:"",c=s.modeledTarget?`<div><dt>Modeled target</dt><dd>${a(s.modeledTarget)}</dd></div>`:"",h=n?`<div><dt>Evidence ID</dt><dd>${a(n.evidenceId)}</dd></div><div><dt>Model version</dt><dd>${a(n.modelVersion)}</dd></div><div><dt>Event configuration</dt><dd>${a(n.eventConfigurationId??"Not configuration-specific")}</dd></div><div><dt>Approval</dt><dd>${a(n.approvedByRole??"No external approval supplied")}</dd></div>`+(n.validUntil?`<div><dt>Valid until</dt><dd>${a(n.validUntil.slice(0,10))}</dd></div>`:""):"<div><dt>Evidence ID</dt><dd>None supplied</dd></div>",p=me(e.commercial)||this.tf("picker.noAuthoredRestriction","No organizer-authored restriction"),d=`<div><dt>View restriction</dt><dd>${a(p)}</dd></div>`+(e.commercial?.note?`<div><dt>Organizer note</dt><dd>${a(e.commercial.note)}</dd></div>`:""),m=document.createElement("div");m.className="sl-view3d-passport-shell",m.innerHTML=`<div class="sl-view3d-passport-scrim" aria-hidden="true"></div><section class="sl-view3d-passport" role="dialog" aria-modal="true" aria-labelledby="sl-view3d-passport-title"><header><div><span>Seat confidence passport</span><strong id="sl-view3d-passport-title">${a(o?.displayLabel??e.displayLabel??e.label)}</strong></div><button type="button" data-close aria-label="Close seat confidence passport">\xD7</button></header><div class="sl-view3d-passport-summary"><strong>${a(s.headline)}</strong><span>${a(s.coverage)} \xB7 ${a(s.freshness)}</span></div><dl><div><dt>Model status</dt><dd>${a(s.model)}</dd></div><div><dt>Reality evidence</dt><dd>${a(s.reality)}</dd></div><div><dt>Source</dt><dd>${a(s.provenance)}</dd></div>`+d+c+h+`</dl>${l}<p class="sl-view3d-passport-note">This passport describes supplied evidence and known limits. It does not guarantee that every temporary obstruction or real-world condition is knowable before the event build.</p></section>`;let f=[...new Set([...i.children,...[...this.els.map.children].filter(k=>k!==i)])].filter(k=>k instanceof HTMLElement),x=f.map(k=>({element:k,inert:k.inert,ariaHidden:k.getAttribute("aria-hidden")}));for(let k of f)k.inert=!0,k.setAttribute("aria-hidden","true");i.appendChild(m),i.classList.add("has-passport"),this.view3dPassportEl=m;let w=m.querySelector(".sl-view3d-passport"),b=()=>[...w.querySelectorAll('button:not(:disabled),[href],[tabindex]:not([tabindex="-1"])')],P=k=>{if(k.key==="Escape"){k.preventDefault(),k.stopPropagation(),k.stopImmediatePropagation(),this.closeSeatConfidencePassport();return}if(k.key!=="Tab")return;let T=b();if(!T.length)return;let O=T[0],E=T[T.length-1];k.shiftKey&&document.activeElement===O?(k.preventDefault(),E.focus()):!k.shiftKey&&document.activeElement===E&&(k.preventDefault(),O.focus())};window.addEventListener("keydown",P,!0),this.view3dPassportCleanup=()=>{window.removeEventListener("keydown",P,!0);for(let E of x)E.element.inert=E.inert,E.ariaHidden===null?E.element.removeAttribute("aria-hidden"):E.element.setAttribute("aria-hidden",E.ariaHidden);let k=t?.isConnected?t:this.confirmEl?.querySelector(".sl-confirm-confidence")??this.view3dCompareEl?.querySelector("[data-passport-seat]")??null,T=k?.closest(".sl-confirm,.sl-view3d-compare");T?.isConnected&&(T.inert=!1,T.removeAttribute("aria-hidden")),m.remove(),i.classList.remove("has-passport"),this.view3dPassportEl===m&&(this.view3dPassportEl=null);let O=k??this.view3dCompareEl?.querySelector("[data-passport-seat]")??this.confirmEl?.querySelector(".sl-confirm-confidence")??this.view3dCompareChip.mainButton();(t?.isConnected?t:O)?.focus()},m.addEventListener("click",k=>{let T=k.target instanceof HTMLElement?k.target:null;(T?.closest("[data-close]")||T?.classList.contains("sl-view3d-passport-scrim"))&&this.closeSeatConfidencePassport()}),requestAnimationFrame(()=>b()[0]?.focus()),this.emit3dAnalytics("3d_confidence_passport_opened",{seatId:e.id,evidenceId:n?.evidenceId??null,eventConfigurationId:n?.eventConfigurationId??null,modelLevel:n?.modelLevel??"unverified",realityLevel:n?.realityLevel??"none"})}closeSeatConfidencePassport(e=!0){let t=this.view3dPassportCleanup;if(this.view3dPassportCleanup=null,!t){this.view3dPassportEl?.remove(),this.view3dPassportEl=null,this.view3dEl?.classList.remove("has-passport");return}e||(document.activeElement instanceof HTMLElement?document.activeElement:null)?.blur(),t(),e||this.root?.focus({preventScroll:!0})}openView3dComparison(){let e=this.view3dEl;if(!e||this.view3dCompareSeatIds.length<2)return;this.closeView3dComparison(!1);let t=this.view3dCompareSeatIds.map(d=>this.view3dComparisonSnapshot(d)).filter(d=>!!d);if(t.length<2){this.clearView3dComparison();return}let i=d=>S(d),s=document.createElement("div");s.className="sl-view3d-compare-shell";let n=t.map((d,m)=>`<article><span>Seat ${m===0?"A":"B"}</span><strong>${i(d.label)}</strong><small>Section ${i(d.section)} \xB7 Row ${i(d.row)}</small><dl><div><dt>Current price</dt><dd>${i(d.price)}</dd></div><div><dt>Ticket type</dt><dd>${i(d.category)}</dd></div><div><dt>Availability</dt><dd>${i(d.availability)}</dd></div><div><dt>View source</dt><dd>${i(d.viewSource)}</dd></div><div><dt>View restriction</dt><dd>${i(d.limited)}</dd></div><div><dt>Seat confidence</dt><dd>${i(d.confidence.headline)}</dd></div><div><dt>Reality check</dt><dd>${i(d.confidence.reality)}</dd></div><div><dt>Accessibility</dt><dd>${i(d.accessibility)}</dd></div></dl><div class="sl-view3d-compare-actions"><button type="button" data-passport-seat="${i(d.seat.id)}">Passport</button><button type="button" data-view-seat="${i(d.seat.id)}">View seat</button><button type="button" class="select" data-select-seat="${i(d.seat.id)}"${d.selectable?"":" disabled"}>Select seat</button></div></article>`).join("");s.innerHTML=`<div class="sl-view3d-compare-scrim" aria-hidden="true"></div><section class="sl-view3d-compare" role="dialog" aria-modal="true" aria-labelledby="sl-view3d-compare-title"><header><div><span>Seat inspection</span><strong id="sl-view3d-compare-title">Compare disclosed attributes</strong></div><button type="button" data-close aria-label="Close seat comparison">\xD7</button></header><p class="sl-view3d-compare-note">Current price and availability come from this picker. Modeled views are chart-derived unless organizer media is labeled; SeatLayer does not invent why a seat has its price.</p><div class="sl-view3d-compare-grid">${n}</div></section>`;let o=document.activeElement instanceof HTMLElement?document.activeElement:null,a=[...e.children].filter(d=>d instanceof HTMLElement),l=a.map(d=>({element:d,inert:d.inert,ariaHidden:d.getAttribute("aria-hidden")}));for(let d of a)d.inert=!0,d.setAttribute("aria-hidden","true");e.appendChild(s),e.classList.add("has-comparison"),this.view3dCompareEl=s;let c=s.querySelector(".sl-view3d-compare"),h=()=>[...c.querySelectorAll('button:not(:disabled),[href],[tabindex]:not([tabindex="-1"])')],p=d=>{if(d.key==="Escape"){d.preventDefault(),this.closeView3dComparison();return}if(d.key!=="Tab")return;let m=h();if(!m.length)return;let f=m[0],x=m[m.length-1];d.shiftKey&&document.activeElement===f?(d.preventDefault(),x.focus()):!d.shiftKey&&document.activeElement===x&&(d.preventDefault(),f.focus())};window.addEventListener("keydown",p),this.view3dCompareCleanup=()=>{window.removeEventListener("keydown",p);for(let d of l)d.element.inert=d.inert,d.ariaHidden===null?d.element.removeAttribute("aria-hidden"):d.element.setAttribute("aria-hidden",d.ariaHidden);s.remove(),e.classList.remove("has-comparison"),this.view3dCompareEl===s&&(this.view3dCompareEl=null),o?.isConnected?o.focus():this.view3dCompareChip.mainButton()?.focus()},s.querySelector("[data-close]")?.addEventListener("click",()=>this.closeView3dComparison()),s.querySelectorAll("[data-passport-seat]").forEach(d=>d.addEventListener("click",()=>{let m=d.dataset.passportSeat,f=m?this.allSeats().find(x=>x.id===m):void 0;f&&this.openSeatConfidencePassport(f,d)})),s.querySelectorAll("[data-view-seat]").forEach(d=>d.addEventListener("click",()=>{let m=d.dataset.viewSeat;this.closeView3dComparison(!1),m&&this.view3dHandle?.flyToSeat(m)})),s.querySelectorAll("[data-select-seat]").forEach(d=>d.addEventListener("click",()=>{let m=d.dataset.selectSeat;m&&this.selectComparedSeat(m)})),requestAnimationFrame(()=>h()[0]?.focus()),this.emit3dAnalytics("3d_comparison_opened",{seatIds:this.view3dCompareSeatIds.slice()})}closeView3dComparison(e=!0){let t=this.view3dCompareCleanup;if(this.view3dCompareCleanup=null,!t){this.view3dCompareEl?.remove(),this.view3dCompareEl=null,this.view3dEl?.classList.remove("has-comparison");return}e||(document.activeElement instanceof HTMLElement?document.activeElement:null)?.blur(),t(),e||this.root?.focus({preventScroll:!0})}selectComparedSeat(e){if(this.salesClosed){this.toast(this.tf("picker.salesClosedToast","Sales are closed for this event."),"warning");return}let t=this.allSeats().find(s=>s.id===e);if(!t)return;if(this.closeView3dComparison(!1),!this.controller.select([e]).length){this.syncSelectionTo3d(),this.toast(this.tf("picker.seatNoLongerAvailable","That seat is no longer available."),"warning");return}this.syncSelectionTo3d(),this.showConfirm(t),this.emit3dAnalytics("3d_comparison_selected",{seatId:e})}async enter3d(e){if(this.view3dEl||!this.canOffer3d()||!this.els.map)return;let t=this.controller.doc;if(!t)return;this.buyerView="venue3d",this.view3dTargetSeatId=null,this.opts.onBuyerViewChange?.({view:"venue3d",...e?{seatId:e}:{}}),this.root?.setAttribute("data-view3d","on"),this.dismissConfirm(),this.syncProjection();let i=document.createElement("div");i.className="sl-view3d",i.setAttribute("role","group"),i.setAttribute("aria-label",this.tf("picker.interactive3dVenueView","Interactive 3D venue view"));let s=document.createElement("button");s.type="button",s.className="sl-view3d-back",s.innerHTML=`<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M15 18l-6-6 6-6"/></svg><span>${this.tf("picker.backToMap","Back to map")}</span>`;let n=s.querySelector("span"),o=h=>{this.view3dTargetSeatId=h;let p=!!h;i.classList.toggle("is-seat-focused",p);let d=p?this.tf("picker.backToVenue","Back to venue"):this.tf("picker.backToMap","Back to map");n&&(n.textContent=d),s.setAttribute("aria-label",d)};s.addEventListener("click",()=>{if(this.view3dTargetSeatId&&this.view3dHandle){this.view3dHandle.focusOverview();return}this.exit3d()}),i.appendChild(s);let a=document.createElement("button");a.type="button",a.className="sl-view3d-fs",a.textContent="\u26F6",a.setAttribute("aria-label",this.tf("picker.fullScreen","Full screen")),a.setAttribute("aria-pressed",String(!!document.fullscreenElement||this.fsFallback||this.framedFs)),a.addEventListener("click",()=>this.toggleFullscreen()),i.appendChild(a);let l=document.createElement("div");l.className="sl-view3d-loading",l.setAttribute("role","status"),l.setAttribute("aria-live","polite"),l.textContent=this.tf("picker.loading3d","Building the 3D venue\u2026"),i.appendChild(l),this.els.map.appendChild(i),this.view3dEl=i,this.view3dCompareChip.sync(),requestAnimationFrame(()=>{i.style.opacity="1"});let c=++this.view3dGen;try{let h=(0,v.expandChart)(t),p=await Ii();if(c!==this.view3dGen||this.buyerView!=="venue3d"||this.view3dEl!==i)return;let d=await p.prepareVenue3D({doc:t,seats:h});if(c!==this.view3dGen||this.buyerView!=="venue3d"||this.view3dEl!==i)return;let m=p.mountVenue3D(i,{doc:t,seats:h,prepared:d},{portraitOverviewCrop:!0,arriveAtSeatEye:!0,seatViewActionLabel:f=>this.allSeats().find(x=>x.id===f)?.viewUrl?this.tf("picker.openAuthored360","Open venue 360\xB0"):this.tf("picker.lookAroundLive3d","Look around in live 3D"),onSeatPick:f=>this.onView3dSeatPick(f),onSeatInspect:f=>this.onView3dSeatPick(f),onSectionFocusChange:f=>{let x=i.querySelector('select[data-locator="section"]'),w=f??"";!x||x.value===w||(x.value=w,x.dispatchEvent(new Event("change")))},onViewTargetChange:f=>{i.querySelector(".sl-view3d-nav")?.classList.toggle("is-seat-focused",!!f),o(f),this.opts.onBuyerViewChange?.({view:"venue3d",...f?{seatId:f}:{}})},getSeatView:f=>new Promise((x,w)=>{let b=()=>{this.seatViewFor3d(f).then(k=>{k?x(k):w(new Error("seat_view_unavailable"))})},P=globalThis.requestIdleCallback;typeof P=="function"?P(b,{timeout:1500}):setTimeout(b,50)}),onAnalytics:(f,x)=>this.emit3dAnalytics(f,x)});this.view3dHandle=m,l.remove(),this.pushAvailabilityTo3d(),this.syncSelectionTo3d(),ss(i,m),e&&m.flyToSeat(e)}catch(h){if(c!==this.view3dGen||this.buyerView!=="venue3d"||this.view3dEl!==i)return;this.opts.onError?.(h),this.toast(this.tf("picker.unavailable3d","3D could not start. The seat map is still available."),"warning"),this.exit3d()}}exit3d(){if(this.buyerView!=="venue3d"&&!this.view3dEl)return;this.view3dGen++,this.buyerView="map",this.view3dTargetSeatId=null,this.opts.onBuyerViewChange?.({view:"map"}),this.root?.removeAttribute("data-view3d"),this.closeSeatConfidencePassport(!1),this.closeView3dComparison(!1),this.view3dCompareChip.remove();try{this.view3dHandle?.dispose()}catch{}this.view3dHandle=null;let e=this.view3dEl;this.view3dEl=null,e&&(e.style.opacity="0",setTimeout(()=>e.remove(),320)),this.syncProjection();let t=this.view3dReturnSeat;this.view3dReturnSeat=null,t&&this.committedSelection().some(i=>i.id===t.id)&&this.opts.confirmSelection!==!1&&this.showConfirm(t)}getCurrentHold(){return this.hold}async resumeHold(e){return this.resumeHoldFromServer(e,!1)}async removeHeldTicket(e){return this.removeHeldLabels([e])}async bestAvailable(e,t,i={}){if(this.salesClosed||this.bestAvailableBusy)return null;e=Math.max(1,Math.min(this.maxTickets,Math.floor(e))),this.confirmSeat&&this.cancelConfirm(),this.bestAvailableConfirm=!1,this.bestAvailableBusy=!0;let s=this.els.tray?.querySelector(".sl-ba-go");s&&(s.disabled=!0,s.classList.add("sl-busy"),s.innerHTML=`<span class="sl-ba-spin" aria-hidden="true"></span>${this.tf("picker.findingEllipsis","Finding\u2026")}`);try{let n=await this.controller.bestAvailable(e,t,{...i,ttlMs:this.opts.holdTtlMs});return n?(this.hold={holdId:n.holdId,expiresAt:n.expiresAt,seats:n.seats,items:n.items},this.handedOff=!1,this.bookedShown=!1,this.gaQty.clear(),this.startHoldTimer(n.expiresAt),this.flashHeldSeats(this.hold),this.syncTray(),this.emitHoldChange(),i.preferPremium&&n.seats.length&&!n.seats.every(o=>o.commercial?.premium)&&this.toast((0,v.t)("picker.premiumFallbackNote",{count:e}),"neutral"),this.hold):null}catch(n){this.opts.onError?.(n);let o=n?.reason,a=o==="not_enough_together"?(0,v.t)("picker.couldNotFindSeatsTogether",{count:e}):o==="companion_pair_required"?this.tf("picker.companionPairRequired","Select the adjacent wheelchair place with each companion ticket."):o==="ticket_option_not_applicable"?this.tf("picker.ticketOptionNotApplicable","That ticket choice is not available for the selected seat."):o==="sold_out"?this.tf("picker.ticketTypeSoldOut","That ticket type is sold out. Try another ticket type."):o==="event_closed"?this.tf("picker.seatSalesClosedForEvent","Seat sales have closed for this event."):this.tf("picker.seatsNoLongerAvailableTryAnother","Those seats are no longer available. Try another quantity or ticket type.");return this.toast(a,"error"),null}finally{this.bestAvailableBusy=!1,this.syncTray()}}async release(){let e=this.hold,t=this.controller.currentHold(),i=!0;if(t)i=await this.controller.release();else if(e){let s=[...new Set([...(e.items??[]).map(n=>n.label),...(e.seats??[]).map(n=>n.label)])];if(s.length)try{await this.api.release(this.opts.event,s,e.holdId)}catch(n){this.opts.onError?.(n),i=!1}}if(!i){this.toast(this.tf("picker.couldNotReleaseTickets","Couldn't release your tickets. Your hold is unchanged."),"error");return}this.hold=null,this.forgetHold(),this.handedOff=!1,this.bookedShown=!1,this.ctaPhase="idle",this.stopHoldTimer(),this.gaQty.clear(),this.syncTray(),this.emitHoldChange()}startRealtime(){if(!this.access?.configured||!this.pubApi||this.realtime)return;let e=this.opts.event;this.realtime=new Z({url:this.pubApi.subscribeUrl(e),mintTicket:()=>this.pubApi.subscribeTicket(e),onAccessUnavailable:t=>{this.opts.onAccessUnavailable?.(t),this.showAccessPanel(t)},sink:ve(this.controller,{flashOnLiveChange:!0,onStatusChange:()=>{this.syncPrices(),this.scheduleOfferRefresh(!0),this.detectBooked(),this.minimap?.refreshMinimap(),this.pushAvailabilityTo3d()},onSelectedObjectUnavailable:(t,i)=>{this.opts.onSelectedObjectUnavailable?.({labels:t,reason:i}),this.syncTray(),this.toast(i==="ineligible"?this.tf("picker.seatNoLongerYours","Some seats are no longer available to you. They have been removed from your order."):this.tf("picker.seatTaken","Someone else took a seat you had picked. It has been removed from your order."),"warning")}})}),this.realtime.start()}async refreshAccess(){return!this.access?.configured||!await this.access.refresh("manual")?!1:(this.dismissAccessPanel(),await this.controller.refresh(),this.realtime?this.realtime.restart():this.startRealtime(),!0)}showAccessPanel(e){if(this.destroyed||!this.root)return;this.dismissAccessPanel();let t=Zi(e.reason,()=>{this.refreshAccess()});(this.regions?.["bottom-center"]??this.root).appendChild(t),this.accessEl=t}dismissAccessPanel(){this.accessEl?.remove(),this.accessEl=null}destroy(){this.destroyed=!0,this.realtime?.stop(),this.realtime=null,this.dismissAccessPanel(),this.access?.clear(),this.hold&&!this.handedOff&&this.controller.release(),this.closeConfirm(),this.dismissTableDialog(!1),te(this,!1),this.closeSeatView(),this.closeCheckoutPanel(),this.exit3d(),this.buyerAssetUrls.dispose(),this.stopHoldTimer(),this.toastTimer&&clearTimeout(this.toastTimer),this.liveTimer&&clearTimeout(this.liveTimer),this.offerRefreshTimer&&clearTimeout(this.offerRefreshTimer),this.offerBoundaryTimer&&clearTimeout(this.offerBoundaryTimer),this.offerRefreshTimer=null,this.offerBoundaryTimer=null,this.offerVisibilityHandler&&(document.removeEventListener("visibilitychange",this.offerVisibilityHandler),this.offerVisibilityHandler=null);for(let e of this.motionTimers)clearTimeout(e);this.motionTimers.clear(),this.ro?.disconnect(),this.ro=null,this.framedFs&&this.setFramedFs(!1),this.escHandler&&document.removeEventListener("keydown",this.escHandler),this.fsChangeHandler&&document.removeEventListener("fullscreenchange",this.fsChangeHandler),this.fsEscHandler&&window.removeEventListener("keydown",this.fsEscHandler),this.controller.destroy(),this.projectionEl=null,this.root?.remove(),this.root=null,this.modalScrim&&(this.modalScrim.remove(),this.modalScrim=null,this.prevFocus?.isConnected&&this.prevFocus.focus({preventScroll:!0}),this.prevFocus=null)}};var de=require("@seatlayer/core");var Yr="https://api.seatlayer.io",Qr=6e4,Xr=2e3,Zr=1e3,Jr=36e5,en=5e3,tn=5e3,sn=15e3,rn=12e4,nn=new Set(["preparing","commit_pending","abort_pending","expire_pending"]),N=class extends Error{constructor(){super("performance_group_destroyed"),this.name="PerformanceGroupDestroyedError"}};function on(r){return new Promise(e=>setTimeout(e,r))}function Bt(r){let e=Number(r.headers.get("Retry-After")??"1");return Number.isFinite(e)?Math.max(50,Math.min(en,e*1e3)):1e3}function Re(r,e){return`/pub/performance-groups/${encodeURIComponent(r)}/operations/${encodeURIComponent(e)}`}function Oe(r){return r.replace(/^pghop_/,"").replace(/-/g,"").slice(-8).toUpperCase()}var zt=class{constructor(e,t,i){this.api=e;this.sink=t;this.intervalMs=i;this.stopped=!0;this.timer=null;this.prior=new Map}start(){this.stopped&&(this.stopped=!1,this.tick())}stop(){this.stopped=!0,this.timer&&clearTimeout(this.timer),this.timer=null}async tick(){try{let e=await this.api.objects(this.api.groupKey);if(this.stopped)return;let t=new Map(Object.entries(e.seats)),s=[...new Set([...this.prior.keys(),...t.keys()])].filter(n=>this.prior.get(n)!==t.get(n)).map(n=>({label:n,status:t.get(n)??"blocked"}));this.prior=t,s.length&&this.sink.applyStatuses(s),this.sink.onSections?.(e.hidden??[],e.closed??[])}catch(e){if(e instanceof N){this.stop();return}this.stopped||await this.sink.resync()}finally{this.stopped||(this.timer=setTimeout(()=>{this.tick()},this.intervalMs))}}},dt=class{constructor(e,t){this.descriptorCache=null;this.objectsCache=null;this.activePerformanceKey=null;this.selectionsByEvent=new Map;this.allocationsByHold=new Map;this.pendingOperationId=null;this.operationByHold=new Map;this.knownRevision=null;this.destroyed=!1;this.aborter=new AbortController;this.adoptFailure=null;this.settleTimer=null;this.settleOperationId=null;this.settleStartedAt=0;this.settleState=null;this.settleVisibility=null;this.lastRecovery={kind:"idle"};if(!e)throw new Error("seatlayer: `performanceGroup` key is required");this.groupKey=e,this.base=(t.apiBase??Yr).replace(/\/+$/,""),this.access=t.access,this.fetcher=t.fetch??globalThis.fetch.bind(globalThis),this.recoveryTimeoutMs=t.recoveryTimeoutMs??Qr,this.realtimePollMs=Math.max(500,t.realtimePollMs??Xr),this.selectionMode=t.selectionMode??"same_seat",this.partySize=t.partySize??null,this.onOperationState=t.onOperationState,this.onRecoveryState=t.onRecoveryState,this.onAvailability=t.onAvailability,this.access.onRenewed(s=>this.adoptSession(s));let i=this.readOperationRecord();i&&this.storedIsUndecided(i)&&(this.pendingOperationId=i.operationId)}get pendingOperation(){return this.pendingOperationId}get holdBlocked(){return!!this.adoptFailure||!!this.pendingOperationId&&this.lastRecovery.kind!=="idle"}async descriptor(){let e=await this.json(`/pub/performance-groups/${encodeURIComponent(this.groupKey)}/descriptor`);return this.descriptorCache=e.performanceGroup,e.performanceGroup.revision&&(this.knownRevision=e.performanceGroup.revision),this.activePerformanceKey??=e.performanceGroup.performances[0]?.eventKey??null,e.performanceGroup}async chart(e){let[t,i]=await Promise.all([this.descriptorCache?Promise.resolve(this.descriptorCache):this.descriptor(),this.json(`/pub/performance-groups/${encodeURIComponent(this.groupKey)}/chart`)]);return{doc:i,event:{key:t.key,name:t.name,salesClosed:t.state!=="active",venue:t.venue,startsAt:t.performances[0]?.startsAt??null,timezone:t.timezone,currency:t.currency,mode:t.mode,inventoryModelVersion:2}}}asset(e,t){return/^[a-zA-Z0-9._-]+$/.test(t)?this.blob(`/pub/performance-groups/${encodeURIComponent(this.groupKey)}/assets/${encodeURIComponent(t)}`):Promise.reject(new F(404,"not_found","not_found"))}async objects(e){let t=`/pub/performance-groups/${encodeURIComponent(this.groupKey)}/objects`+(this.selectionMode==="per_performance"?"?view=per-performance":""),i=await this.authorized(t,this.objectsCache?.revision?{headers:{"If-None-Match":`"${this.objectsCache.revision}"`}}:{});if(i.status!==304){if(!i.ok)return this.throwResponse(i);this.objectsCache=await this.responseJson(i)}if(!this.objectsCache)throw new F(502,"group_projection_unavailable","group_projection_unavailable");if(this.selectionMode==="same_seat"){let o=this.objectsCache;return this.noteAvailability(o,o.salesClosed,o),o}let s=this.objectsCache,n=s.performances.find(o=>o.eventKey===this.activePerformanceKey);if(!n)throw new F(409,"group_performance_unavailable","group_performance_unavailable");return this.noteAvailability(s,s.salesClosed||s.performances.some(o=>o.salesClosed),n),n}setSelectionMode(e,t){if(this.pendingOperationId||this.holdBlocked)throw new F(409,"group_operation_pending","group_operation_pending");e!==this.selectionMode&&(this.selectionMode=e,t!=null&&(this.partySize=t),this.objectsCache=null,this.selectionsByEvent.clear(),this.activePerformanceKey=this.descriptorCache?.performances[0]?.eventKey??this.activePerformanceKey)}setActivePerformance(e){if(this.descriptorCache&&!this.descriptorCache.performances.some(t=>t.eventKey===e))throw new F(404,"group_performance_not_found","group_performance_not_found");this.activePerformanceKey=e}setPerformanceSelections(e,t){this.selectionsByEvent.set(e,t.map(i=>({...i})))}allocationsForHold(e){return(this.allocationsByHold.get(e)??[]).map(t=>({eventKey:t.eventKey,items:t.items.map(i=>({...i}))}))}async hold(e,t,i,s){if(this.assertUsable(),s)throw new F(409,"group_hold_replace_unsupported","group_hold_replace_unsupported");let n=t.map(c=>c.label),o={labels:n};if(this.selectionMode==="per_performance"){if(!this.activePerformanceKey||!this.descriptorCache||!this.partySize)throw new F(409,"group_selection_incomplete","group_selection_incomplete");this.setPerformanceSelections(this.activePerformanceKey,t);let c=this.descriptorCache.performances.map(h=>({eventKey:h.eventKey,selections:this.selectionsByEvent.get(h.eventKey)??[]}));if(c.some(h=>h.selections.length!==this.partySize))throw new F(409,"group_selection_incomplete","group_selection_incomplete");o={selectionMode:"per_performance",allocations:c}}let a=this.pendingOperationId??`pghop_${crypto.randomUUID()}`;this.beginOperation(a),this.onOperationState?.({operationId:a,state:"preparing",decision:null});let l;try{l=await this.authorized(`/pub/performance-groups/${encodeURIComponent(this.groupKey)}/hold`,{method:"POST",body:JSON.stringify({operationId:a,...o,...i?{ttlMs:i}:{}})})}catch(c){if(c instanceof N)throw c;if(c instanceof ee)throw this.failOperation(a),c;return this.recover(a,n,Date.now()+this.recoveryTimeoutMs)}if(l.status===201||l.status===202||l.status===504){let c=await this.responseJson(l);return this.emit(c.operation),l.status===201?this.complete(c.operation):this.recover(a,n,Date.now()+this.recoveryTimeoutMs,Bt(l))}if(l.status===503){let c=await l.clone().json().catch(()=>null);if((c?.code??c?.error)==="performance_group_abort_pending"){let h=c?.operation?.operationId??a;return this.beginOperation(h),c?.operation&&this.emit(c.operation),this.recover(h,n,Date.now()+this.recoveryTimeoutMs,Bt(l))}}try{return await this.throwResponse(l,n)}catch(c){throw this.failOperation(a),c}}async release(e,t,i){this.assertUsable();let s=this.operationForHold(i),n=await this.json(`${Re(this.groupKey,s)}/release`,{method:"POST",body:"{}"});return this.operationByHold.delete(i),this.allocationsByHold.delete(i),this.clearOperationRecord(),n}async resume(e,t){this.assertUsable();let i=this.operationForHold(t),s=await this.json(Re(this.groupKey,i));return this.complete(s.operation)}async extend(e,t,i=12e4){this.assertUsable();let s=this.operationForHold(t),n=Math.max(Zr,Math.min(Jr,Math.round(i))),o=await this.json(`${Re(this.groupKey,s)}/extend`,{method:"POST",body:JSON.stringify({ttlMs:n})}),a=this.complete(o.operation);return{holdId:a.holdId,expiresAt:a.expiresAt}}bestAvailable(){return Promise.reject(new F(400,"group_best_available_unsupported","group_best_available_unsupported"))}socketUrl(){return""}createRealtime(e,t){return new zt(this,t,this.realtimePollMs)}operationIdForHold(e){return this.operationByHold.get(e)??this.readMapping(e)}rememberOperation(e,t){!e||!t||(this.operationByHold.set(e,t),this.writeMapping(e,t))}async restoreOperation(){let e=this.readOperationRecord();if(!e)return null;if(!this.storedIsUndecided(e)&&e.state!=="committed"&&e.state!=="booked")return this.clearOperationRecord(),null;this.pendingOperationId=e.operationId,this.emitRecovery({kind:"pending",operationId:e.operationId,phase:e.state==="undecided"?"unknown":e.state,longRunning:!1,reference:Oe(e.operationId)});let t;try{t=await this.authorized(Re(this.groupKey,e.operationId))}catch(n){return n instanceof N||this.recoveryFailed(e.operationId,"request_failed"),null}if(t.status===404)return this.failOperation(e.operationId),null;if(!t.ok)return this.recoveryFailed(e.operationId,"request_failed"),null;let i=await this.responseJson(t);this.emit(i.operation);let s=i.operation.state;return s==="committed"||s==="booked"?(this.emitRecovery({kind:"idle"}),this.complete(i.operation)):s==="aborted"||s==="expired"?(this.failOperation(e.operationId),null):this.recover(e.operationId,[],Date.now()+this.recoveryTimeoutMs)}async retryRecovery(){this.assertUsable();let e=this.pendingOperationId??this.readOperationRecord()?.operationId??null;return e?(this.pendingOperationId=e,this.recover(e,[],Date.now()+this.recoveryTimeoutMs)):null}watchSettlement(e){if(this.destroyed)return;let t=this.operationIdForHold(e);!t||t===this.settleOperationId||(this.stopSettlementWatch(),this.settleOperationId=t,this.settleStartedAt=Date.now(),this.settleState="committed",typeof document<"u"&&(this.settleVisibility=()=>{document.hidden||!this.settleOperationId||this.pollSettlement()},document.addEventListener("visibilitychange",this.settleVisibility)),this.scheduleSettlementPoll())}stopSettlementWatch(){this.settleTimer&&clearTimeout(this.settleTimer),this.settleTimer=null,this.settleOperationId=null,this.settleState=null,this.settleVisibility&&typeof document<"u"&&document.removeEventListener("visibilitychange",this.settleVisibility),this.settleVisibility=null}scheduleSettlementPoll(){if(this.destroyed||!this.settleOperationId)return;if(this.settleTimer&&clearTimeout(this.settleTimer),typeof document<"u"&&document.hidden){this.settleTimer=null;return}let t=Date.now()-this.settleStartedAt>=rn?sn:tn;this.settleTimer=setTimeout(()=>{this.pollSettlement()},t)}settled(e){return e==="booked"||e==="expired"||e==="aborted"}async pollSettlement(){let e=this.settleOperationId;if(this.destroyed||!e)return;if(typeof document<"u"&&document.hidden){this.settleTimer&&clearTimeout(this.settleTimer),this.settleTimer=null;return}let t;try{let s=await this.authorized(Re(this.groupKey,e));if(!s.ok)return this.scheduleSettlementPoll();t=(await this.responseJson(s)).operation}catch(s){return s instanceof N?this.stopSettlementWatch():this.scheduleSettlementPoll()}if(this.destroyed||this.settleOperationId!==e)return;let i=t.state!==this.settleState;if(this.settleState=t.state,i&&this.noteOperationState(e,t.state),this.settled(t.state)){this.stopSettlementWatch(),t.state!=="booked"&&this.clearOperationRecord(),this.emit(t);return}i&&this.emit(t),this.scheduleSettlementPoll()}destroy(){if(!this.destroyed){this.destroyed=!0,this.stopSettlementWatch(),this.access.onRenewed(void 0);try{this.aborter.abort()}catch{}}}operationRecordKey(){return`@seatlayer/performance-group-operation/v1/${encodeURIComponent(this.base)}/${encodeURIComponent(this.groupKey)}`}readOperationRecord(){try{let e=window.sessionStorage.getItem(this.operationRecordKey());if(!e)return null;let t=JSON.parse(e);return!t?.operationId||t.groupKey!==this.groupKey?null:t}catch{return null}}storedIsUndecided(e){return e.state==="undecided"||nn.has(e.state)}writeOperationRecord(e){try{window.sessionStorage.setItem(this.operationRecordKey(),JSON.stringify(e))}catch{}}clearOperationRecord(){try{window.sessionStorage.removeItem(this.operationRecordKey())}catch{}}beginOperation(e){this.pendingOperationId=e;let t=this.readOperationRecord();this.writeOperationRecord({operationId:e,groupKey:this.groupKey,state:"undecided",createdAt:t?.operationId===e?t.createdAt:Date.now()})}noteOperationState(e,t){let i=this.readOperationRecord();!i||i.operationId!==e||this.writeOperationRecord({...i,state:t})}failOperation(e){this.pendingOperationId=null,this.clearOperationRecord(),this.emitRecovery({kind:"idle"}),this.onOperationState?.({operationId:e,state:"aborted",decision:"abort"})}async adoptSession(e){if(this.destroyed)return;let t=`/pub/performance-groups/${encodeURIComponent(this.groupKey)}/session/adopt`;for(let s=0;s<2;s++){if(this.destroyed)return;try{if((await this.fetcher(`${this.base}${t}`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e.token}`},body:JSON.stringify({previousToken:e.previousToken}),credentials:"omit",signal:this.aborter.signal})).ok){this.adoptFailure=null;return}}catch{}}if(this.destroyed)return;this.adoptFailure=new F(409,"performance_group_session_adopt_failed","performance_group_session_adopt_failed");let i=this.pendingOperationId??"";throw this.emitRecovery({kind:"failed",operationId:i,reference:i?Oe(i):"",reason:"session_adopt_failed",retryable:!1}),this.adoptFailure}async recover(e,t,i,s=100){let n=s,o=Date.now()+Math.min(8e3,Math.max(500,this.recoveryTimeoutMs/2)),a="unknown";for(;Date.now()<=i;){if(this.destroyed)throw new N;if(this.emitRecovery({kind:"pending",operationId:e,phase:a,longRunning:Date.now()>=o,reference:Oe(e)}),await on(n),this.destroyed)throw new N;let l;try{l=await this.authorized(Re(this.groupKey,e))}catch(p){if(p instanceof N)throw p;if(p instanceof ee)throw this.recoveryFailed(e,"request_failed"),p;n=Math.min(2e3,Math.max(100,n*2));continue}if(l.status===404){n=Math.min(1e3,Math.max(100,n*2));continue}if(!l.ok){this.recoveryFailed(e,"request_failed");try{return await this.throwResponse(l,t)}finally{this.pendingOperationId=null,this.clearOperationRecord()}}let h=(await this.responseJson(l)).operation;if(a=h.state,this.noteOperationState(e,h.state),this.emit(h),h.state==="committed"||h.state==="booked")return this.emitRecovery({kind:"idle"}),this.complete(h);if(h.state==="aborted"||h.state==="expired")throw this.failOperation(e),new F(409,"conflict","conflict",t.map(p=>({label:p,status:"held"})));n=Bt(l)}throw this.recoveryFailed(e,"deadline"),new F(504,"performance_group_outcome_unknown","performance_group_outcome_unknown")}recoveryFailed(e,t){this.emitRecovery({kind:"failed",operationId:e,reference:Oe(e),reason:t,retryable:!0})}emitRecovery(e){if(this.destroyed)return;let t=this.lastRecovery.kind===e.kind&&JSON.stringify(this.lastRecovery)===JSON.stringify(e);this.lastRecovery=e,t||this.onRecoveryState?.(e)}noteAvailability(e,t,i){if(this.destroyed||!this.onAvailability)return;let s=e.state??this.descriptorCache?.state??"active",n=e.revision??null,o=!!n&&!!this.knownRevision&&n!==this.knownRevision;n&&!this.knownRevision&&(this.knownRevision=n);let a=i?.partial??{},l=Object.values(i?.seats??{});this.onAvailability({partial:a,freeCount:l.filter(c=>c==="free").length,blockedCount:Object.keys(i?.seats??{}).filter(c=>i.seats[c]!=="free"&&!(c in a)).length,state:s,salesClosed:!!t||s!=="active",revision:n,revisionChanged:o})}acceptRevision(e){this.knownRevision=e}complete(e){if(!e.hold||e.hold.expiresAt==null)throw new F(409,"group_hold_not_active","group_hold_not_active");this.pendingOperationId=null,this.noteOperationState(e.operationId,e.state),this.operationByHold.set(e.hold.id,e.operationId),this.writeMapping(e.hold.id,e.operationId);let t=e.hold.allocations??[];this.allocationsByHold.set(e.hold.id,t);let i=t.find(s=>s.eventKey===this.activePerformanceKey)?.items;return{holdId:e.hold.id,expiresAt:e.hold.expiresAt,items:i??e.hold.items??[]}}emit(e){this.destroyed||this.onOperationState?.({operationId:e.operationId,state:e.state,decision:e.decision})}operationForHold(e){let t=this.operationIdForHold(e);if(!t)throw new F(404,"group_hold_not_found","group_hold_not_found");return t}mappingKey(e){return`@seatlayer/performance-group-hold/v1/${encodeURIComponent(this.base)}/${encodeURIComponent(this.groupKey)}/${encodeURIComponent(e)}`}readMapping(e){try{return window.sessionStorage.getItem(this.mappingKey(e))}catch{return null}}writeMapping(e,t){try{window.sessionStorage.setItem(this.mappingKey(e),t)}catch{}}assertUsable(){if(this.destroyed)throw new N;if(this.adoptFailure)throw this.adoptFailure}async authorized(e,t={},i=!1){if(this.destroyed)throw new N;if(this.adoptFailure)throw this.adoptFailure;let s={...t.headers};t.body!==void 0&&(s["Content-Type"]="application/json");let n=await this.access.authorization(i?"unauthorized":"initial");if(this.destroyed)throw new N;if(this.adoptFailure)throw this.adoptFailure;if(!n)throw new Error("performance_group_buyer_access_required");s.Authorization=n;let o=await this.fetcher(`${this.base}${e}`,{method:t.method??"GET",headers:s,body:t.body,credentials:"omit",signal:this.aborter.signal});if(!i&&(o.status===401||o.status===403||o.status===422)){let a=await o.clone().json().catch(()=>null);if(await this.access.handleFailure(o.status,a?.code??a?.error))return this.authorized(e,t,!0)}return o}async json(e,t={}){let i=await this.authorized(e,t);return i.ok?this.responseJson(i):this.throwResponse(i)}async blob(e){let t=await this.authorized(e);return t.ok?t.blob():this.throwResponse(t)}async responseJson(e){return e.json()}async throwResponse(e,t=[]){let s=await e.json().catch(()=>null)??{},n=s.code??s.error??`request_failed_${e.status}`;throw e.status===409&&!s.conflicts?.length&&t.length&&(s.conflicts=t.map(o=>({label:o,status:"held"}))),new F(e.status,s.error??n,n,s.conflicts)}};var Rs="seatlayer-performance-group-picker-style";function an(){if(document.getElementById(Rs))return;let r=document.createElement("style");r.id=Rs,r.textContent=`
1660
+ `),y);return}let A=y.dataset.seat,D=this.controller.getSelection().find(H=>H.id===A)?.label??this.tf("picker.seat","Seat"),L=()=>{this.controller.deselect([A]),this.toast((0,v.t)("picker.labelRemoved",{label:D}),"neutral",{label:this.tf("picker.undo","Undo"),onClick:()=>{let H=this.controller.select([A]);this.toast(H.length?(0,v.t)("picker.labelRestored",{label:D}):(0,v.t)("picker.labelNoLongerAvailable",{label:D}),H.length?"success":"warning")}})};if(this.reducedMotion()){L();return}y.classList.add("sl-leave"),this.scheduleMotion(L,150)})}),this.els.tray.querySelectorAll("[data-table-edit]").forEach(u=>{u.addEventListener("click",y=>{y.stopPropagation();let A=decodeURIComponent(u.dataset.tableEdit??""),D=this.controller.tableSelection(A);if(!D)return;let L=i.find(H=>H.label===A&&H.objectType==="table");this.showTableDialog({...D,quantity:L?.quantity??D.quantity},!!L,u)})}),this.els.tray.querySelectorAll(".sl-chip .tier").forEach(u=>{u.addEventListener("change",()=>this.controller.setSeatTier(u.dataset.tier,u.value||null))}),this.els.tray.querySelectorAll(".sl-chip .view[data-view-label]").forEach(u=>{u.addEventListener("click",()=>{let y=this.controller.seatByLabel(u.dataset.viewLabel);y&&this.openSeatView(y)})}),this.els.tray.querySelectorAll(".sl-chip[data-locate]").forEach(u=>{let y=()=>this.controller.flashSeat(u.dataset.locate,this.cssVar("--sl-accent")||"#f4b740");u.addEventListener("mouseenter",y),u.addEventListener("focusin",y)}),ai(this,this.els.tray,t),this.controller.setGASelection(Xt(this.gaQty)),this.salesClosed&&this.els.tray.querySelectorAll(".sl-ba-go,[data-ba],[data-ba-cat],[data-ba-zone],[data-ba-replace],.sl-ga button").forEach(u=>{u.disabled=!0});let d=Jt(this,t,this.hold?.items??[]),m=Ee(this.gaQty,this.hold?.items??[]),f=i.reduce((u,y)=>u+this.paidPrice(y.categoryKey,y.tierId,y.unitPrice,y.label)*(y.quantity??1),0),x=i.reduce((u,y)=>u+(y.quantity??1),0),w=e.filter(u=>!c.has(u.label)),b=w.reduce((u,y)=>u+this.paidPrice(y.categoryKey,y.tierId??null,y.price,y.label)*(y.quantity??1),0)+d+f,P=w.reduce((u,y)=>u+(y.quantity??1),0)+m+x,k=this.pendingSelectionCount(),T=this.lastTrayCount,O=this.lastTrayTotal,E=Ts(this.performanceGroup?.groupSelectionSummary?.(),this.performanceGroup?.selectionMode??"same_seat");if(this.els.count.textContent=E||(P?(0,v.tCount)("picker.ticketsCount",P):this.tf("picker.noSeatsSelected","No seats selected")),this.els.total.textContent=P&&!this.suppressPricing?this.money(b):"",this.root?.setAttribute("data-has-selection",String(P>0)),this.root?.setAttribute("data-ba-active",String(this.bestAvailableConfirm||this.bestAvailableBusy||this.baReopen)),this.els.foot?.classList.toggle("empty",P===0),this.els.seatSummary&&(this.els.seatSummary.textContent=E||(P?(0,v.tCount)("picker.seatsSelectedCount",P):"")),this.syncCta(P,k),this.hold){this.holdCopyPending=k>0;let u=ps({secured:x||this.hold.seats?.length||0,pendingCount:k,expiresAt:this.holdExpiresAt,releasing:this.releasingHold});this.els.holdTitle&&(this.els.holdTitle.textContent=u.title),this.els.holdCopy&&(this.els.holdCopy.textContent=u.copy);let y=this.els.holdChange;y&&(y.disabled=this.releasingHold,y.textContent=u.change)}P!==T&&this.animateOnce(this.els.count,"sl-value-pop",380),b!==O&&this.animateOnce(this.els.total,"sl-value-pop",380),T===0&&P>0&&(this.animateOnce(this.els.cta,"sl-ready",520),this.sideCollapsed&&this.root?.dataset.layout!=="narrow"&&this.setPanelCollapsed(!1)),this.renderPeek(P,b,k),this.lastTrayCount=P,this.lastTrayTotal=b,this.opts.onSelectionChange?.(e),this.emitSelectionValidity(P,e)}emitSelectionValidity(e,t){let i=this.controller.getSelectionValidity(e);i&&(i.seats=t,this.opts.onSelectionValidityChange?.(i),i.isValid?this.lastSelectionValidity!==!0&&this.opts.onSelectionValid?.(t):this.lastSelectionValidity!==!1&&this.opts.onSelectionInvalid?.(i),this.lastSelectionValidity=i.isValid)}renderPeek(e,t,i){if(!this.els.peek)return;let s=(this.controller.doc?.categories??[]).map(n=>this.catPrice(n)).filter(n=>n!=null);this.els.peek.innerHTML=ls({count:e,total:t,pendingCount:i,ctaPhase:this.ctaPhase,hasHold:!!this.hold,salesClosed:this.salesClosed,fromPrice:s.length?Math.min(...s):null,addMore:as({salesClosed:this.salesClosed,hasHold:!!this.hold,ctaPhase:this.ctaPhase,formOpen:this.baReopen||this.bestAvailableBusy||this.bestAvailableConfirm,room:this.maxTickets-this.totalTicketCount(),wanted:this.baQty}),holdTime:this.hold&&this.holdTimer?qe(Math.max(0,this.holdExpiresAt-Date.now())):null,money:n=>this.money(n)}),this.root&&(this.root.dataset.peekClock=String(!!this.els.peek.querySelector(".sl-peek-time")))}async removeHeldLabels(e,t){let i=e.filter(o=>o&&!this.releasingLabels.has(o));if(!i.length)return!1;let s=i[0];i.forEach(o=>this.releasingLabels.add(o)),t?.setAttribute("aria-busy","true");let n=t?.querySelector(".rm");n&&(n.disabled=!0);try{let o=this.handedOff;if(!await this.controller.releaseLabels(i))return this.toast((0,v.t)("picker.couldNotRemoveLabel",{label:s}),"error"),!1;ti(this.gaQty,this.hold?.items??[],i);let l=this.controller.currentHold();return this.hold=l?{holdId:l.holdId,expiresAt:l.expiresAt,seats:l.seats,items:l.items}:null,this.handedOff=!!this.hold&&o,this.bookedShown=!1,this.ctaPhase="idle",this.hold?this.startHoldTimer(this.hold.expiresAt):(this.stopHoldTimer(),this.forgetHold()),this.syncTray(),this.emitHoldChange(),this.toast((0,v.t)("picker.labelRemovedFromHold",{label:s}),"success"),!0}finally{i.forEach(o=>this.releasingLabels.delete(o)),t?.removeAttribute("aria-busy"),n?.isConnected&&(n.disabled=!1)}}async handleChangeSeats(){if(!this.hold||this.releasingHold)return;this.releasingHold=!0;let e=this.els.holdChange;e&&(e.disabled=!0,e.textContent=this.tf("picker.releasingEllipsis","Releasing\u2026"));try{await this.release(),this.hold||this.toast(this.tf("picker.heldTicketsReleased","Held tickets released. Choose your new seats."),"success")}finally{this.releasingHold=!1,e?.isConnected&&(e.disabled=!1,e.textContent=this.tf("picker.change","Change"))}}async handleCta(){if(this.salesClosed)return;let e=this.controller.getSelectionValidity(this.totalTicketCount());if(e&&!e.isValid){this.toast(Rt(e,(i,s)=>this.tf(i,s)),"warning");return}if(this.totalTicketCount()>this.maxTickets){this.toast((0,v.t)("picker.removeTicketsUntilOrFewer",{count:this.maxTickets}),"warning");return}let t=this.committedSelection();if(this.hold&&!t.some(i=>!(this.hold.items??[]).some(s=>s.label===i.label))){let i=this.hold.seats??t;this.handedOff=!0,this.setCtaPhase("checkout"),this.checkoutHandoff(this.hold,i);return}this.holdingLabels=new Set(t.map(i=>i.label)),this.setCtaPhase("holding");try{let i=null,s=Qt(this.gaQty),n=this.committedSelection();if(n.length){let o=await this.controller.hold(void 0,this.opts.holdTtlMs);i=o?{holdId:o.holdId,expiresAt:o.expiresAt,seats:o.seats,items:o.items}:null}for(let{areaId:o,tierId:a,qty:l}of s){let c=await this.controller.holdGA(o,l,{tierId:a,ttlMs:this.opts.holdTtlMs});i=c?{holdId:c.holdId,expiresAt:c.expiresAt,seats:c.seats,items:c.items}:i}if(!i){this.toast(this.tf("picker.seatsJustTaken","One or more seats were just taken. Please pick again."),"error"),this.setCtaPhase("idle"),this.syncTray();return}this.hold=i,this.handedOff=!this.performanceGroup,this.startHoldTimer(i.expiresAt),this.flashHeldSeats(i),this.setCtaPhase(this.performanceGroup?"idle":"checkout"),this.emitHoldChange(),this.performanceGroup||this.checkoutHandoff(i,i.seats??n)}catch(i){this.opts.onError?.(i);let s=i,n=(s.conflicts??[]).map(a=>a.label).filter(Boolean).slice(0,3);s.reason==="event_closed"&&this.setSalesClosed(!0);let o=s.reason==="event_closed"?this.tf("picker.seatSalesClosedForEvent","Seat sales have closed for this event."):s.reason==="companion_pair_required"?this.tf("picker.companionPairRequired","Select the adjacent wheelchair place with each companion ticket."):s.reason==="ticket_option_not_applicable"?this.tf("picker.ticketOptionNotApplicable","That ticket choice is not available for the selected seat."):n.length?n.length===1?(0,v.t)("picker.labelsNoLongerAvailable.one",{labels:n.join(", ")}):(0,v.t)("picker.labelsNoLongerAvailable.other",{labels:n.join(", ")}):this.tf("picker.seatsJustTaken","One or more seats were just taken. Please pick again.");this.toast(o,"error"),this.setCtaPhase("idle")}finally{this.holdingLabels.clear(),this.ctaPhase==="holding"&&(this.ctaPhase="idle"),this.syncTray()}}startHoldTimer(e){this.stopHoldTimer(),this.holdExpiresAt=e,this.hold&&this.rememberHold(this.hold);let t=this.els.hold;t.innerHTML=`<span class="sl-hold-dot" aria-hidden="true"></span><span>${this.tf("picker.held","Held")}</span><span class="sl-hold-time" data-ref="holdTime"></span>`;let i=t.querySelector('[data-ref="holdTime"]');this.els.holdNote?.classList.add("on");let s=()=>{let n=Math.max(0,this.holdExpiresAt-Date.now());i&&(i.textContent=qe(n));let o=this.els.peek?.querySelector(".sl-peek-time");o&&(o.textContent=qe(n)),!this.holdCopyPending&&this.els.holdCopy&&(this.els.holdCopy.textContent=Ot(this.holdExpiresAt)),t.classList.add("on"),t.classList.toggle("is-expiring",n>0&&n<=As),this.setExtendPrompt(n>0&&n<=As,n),n<=0&&this.stopHoldTimer()};s(),this.holdTimer=setInterval(s,500)}stopHoldTimer(){this.holdTimer&&clearInterval(this.holdTimer),this.holdTimer=null,this.els.hold?.classList.remove("on","is-expiring"),this.els.holdNote?.classList.remove("on"),this.root&&delete this.root.dataset.peekClock,this.setExtendPrompt(!1,0)}setExtendPrompt(e,t){if(this.extendEl)if(e&&this.controller.currentHold()&&!this.bookedShown){let i=Math.ceil(t/1e3),s=Math.floor(i/60),n=String(i%60).padStart(2,"0");this.els.extendTxt.innerHTML=(0,v.t)("picker.seatsHeldForNeedMoreTime",{time:`${s}:${n}`}),this.extendEl.classList.add("on")}else this.extendEl.classList.remove("on")}async handleExtend(){let e=this.els.extendBtn;e.disabled=!0;let t=e.textContent;e.textContent=this.tf("picker.addingEllipsis","Adding\u2026");try{let i=await this.controller.extendHold(this.opts.holdTtlMs);i?(this.hold={holdId:i.holdId,expiresAt:i.expiresAt,seats:i.seats,items:i.items},this.holdExpiresAt=i.expiresAt,this.extendEl?.classList.remove("on"),this.rememberHold(this.hold),this.emitHoldChange(),this.toast(this.tf("picker.moreTimeAdded","More time added \u2014 your seats are still held."),"success")):this.toast(this.tf("picker.couldNotAddMoreTime","Couldn't add more time \u2014 please head to checkout now."),"warning")}catch(i){this.opts.onError?.(i),this.toast(this.tf("picker.couldNotAddMoreTime","Couldn't add more time \u2014 please head to checkout now."),"warning")}finally{e.disabled=!1,e.textContent=t}}detectBooked(){this.bookedShown||!this.handedOff||!this.hold||this.controller.currentHold()===null&&this.showBooked()}showBooked(){if(this.bookedShown||!this.hold)return;this.bookedShown=!0;let e=this.buildHandoff(this.hold);this.stopHoldTimer(),this.forgetHold();let t=e.lineItems.reduce((s,n)=>s+n.quantity,0),i=this.performanceGroup?.groupSelectionSummary?.();this.els.bookedSub&&(this.els.bookedSub.innerHTML=i?.seats?`<span class="sl-booked-seats">${(0,v.tCount)("picker.group.ticketsConfirmedAcross",i.seats,{performances:i.performances})}</span>`:`<span class="sl-booked-seats">${(0,v.tCount)("picker.ticketsCount",t)}</span> ${this.tf("picker.confirmedAndOnWay","confirmed. A confirmation is on its way.")}`),this.bookedEl?.classList.add("on"),this.opts.onBooked?.(e)}notifyGroupSettled(e){e==="booked"?this.showBooked():this.dismissConfirm(),this.hold=null,this.handedOff=!1,this.ctaPhase="idle",this.stopHoldTimer(),this.forgetHold(),this.syncTray(),this.syncCta()}checkoutHandoff(e,t){if(this.checkoutMode==="hosted"){this.startHostedCheckout(e,t);return}this.opts.onCheckout?.(e,t,this.buildHandoff(e))}async startHostedCheckout(e,t){let i=this.buildHandoff(e),s=null;try{s=await(this.paymentOptions??=this.pubApi.paymentOptions(this.opts.event))}catch(o){this.opts.onError?.(o)}if(this.destroyed)return;let n=s?.providers?.[0];if(!n){let o=Bi(s?.reason),a=!!this.opts.onCheckoutUnavailable||!!this.opts.onCheckout;this.opts.onCheckoutUnavailable?.({reason:o,handoff:i}),this.opts.onCheckout?.(e,t,i),a||this.openCheckoutPanel({kind:"unavailable",reason:o,seatCount:i.lineItems.reduce((l,c)=>l+c.quantity,0)});return}await this.openCheckoutPanel({kind:"pay",provider:n,order:{holdId:i.holdId,expiresAt:i.expiresAt,currency:i.currency,total:i.total,labels:i.lineItems.map(o=>o.displayLabel??o.label)}})}async openCheckoutPanel(e){let t;try{({mountCheckout:t}=await _i())}catch(i){this.opts.onError?.(i),this.toast(this.tf("picker.checkoutCouldNotBeOpened","Checkout could not be opened. Your seats are still held \u2014 please try again."),"error"),this.setCtaPhase("idle");return}this.destroyed||!this.root||(this.closeCheckoutPanel(),this.checkoutPanel=t({root:this.root,state:e,formatMoney:i=>this.money(i),startSession:i=>this.pubApi.startCheckout(this.opts.event,{...i,...this.opts.returnUrl?{returnUrl:this.opts.returnUrl}:{}}),orderStatus:i=>this.pubApi.orderStatus(i),onCancel:()=>{this.checkoutPanel=null,this.hold||this.setCtaPhase("idle")},onConfirmed:i=>{this.opts.onOrderConfirmed?.(i),this.controller.refresh()},onError:i=>this.opts.onError?.(i)}))}closeCheckoutPanel(){this.checkoutPanel?.destroy(),this.checkoutPanel=null}buildHandoff(e){let i=(e.items??[]).map(o=>{let a=this.controller.lineItemDisplay(o);return{label:o.label,...a.displayLabel?{displayLabel:a.displayLabel}:{},...a.displayType?{displayType:a.displayType}:{},objectId:o.objectId,objectType:o.objectType,categoryKey:o.categoryKey,tierId:o.tierId,unitPrice:this.paidPrice(o.categoryKey,o.tierId,o.unitPrice,o.label),currency:o.currency??this.currency,quantity:o.quantity??1}}),s=i[0]?.currency??this.currency,n=i.reduce((o,a)=>o+a.unitPrice*a.quantity,0);return{holdId:e.holdId,expiresAt:e.expiresAt,currency:s,lineItems:i,total:n}}emitHoldChange(){let e=this.hold;this.scheduleOfferRefresh(!0),this.opts.onHoldChange?.(e,e?.seats??[],e?this.buildHandoff(e):null)}toast(e,t="neutral",i){let s=this.els.toast;if(!s)return;s.replaceChildren();let n=document.createElement("span");if(n.textContent=e,s.appendChild(n),s.classList.toggle("has-action",!!i),i){let o=document.createElement("button");o.type="button",o.className="sl-toast-action",o.textContent=i.label,o.addEventListener("click",i.onClick,{once:!0}),s.appendChild(o)}s.dataset.tone=t,s.classList.add("on"),this.toastTimer&&clearTimeout(this.toastTimer),this.toastTimer=setTimeout(()=>{s.classList.remove("on"),s.classList.remove("has-action"),s.dataset.tone="neutral"},4200)}placeTooltip(){if(!this.tipEl)return;let e=Ps(this.tipPos,this.els.map.clientWidth,{width:this.tipEl.offsetWidth,height:this.tipEl.offsetHeight});this.tipEl.style.left=`${e.left}px`,this.tipEl.style.top=`${e.top}px`}nightStripFor(e,t){let i=this.performanceGroup;return vs(It(e.mark,i?.nights?.()),{locale:this.opts.locale,switchLabel:i?.selectionModeSwitch?.label??null,pinned:t})}unpinTooltip(){this.tipPinned&&(this.tipPinned=!1,this.tipEl?.classList.remove("sl-tip-pinned"),this.tipEl&&(this.tipEl.style.display="none"))}updateTooltip(e){if(!this.tipEl)return;if(!e){this.tipPinned||(this.tipEl.style.display="none");return}let t=e.mark?.kind==="partial"&&this.lastPointerType!=="mouse",i=this.nightStripFor(e,t);this.tipEl.style.setProperty("--sl-cat",e.categoryColor),this.tipEl.innerHTML=Es(e,{price:this.suppressPricing?"":this.money(this.paidPrice(e.categoryKey,e.tierId??null,e.price,e.label)),priceNote:this.suppressPricing?this.tf("picker.group.pricesPerPerformance","Prices shown per performance"):"",rowTypeWord:Ue(e),extra:i+(t?`<button type="button" class="sl-tip-close" data-pg-tip-close aria-label="${this.tf("picker.group.closeSeatDetails","Close seat details")}">\xD7</button>`:"")}),this.tipPinned=t,this.tipEl.classList.toggle("sl-tip-pinned",t),this.tipEl.querySelector("[data-pg-tip-close]")?.addEventListener("click",()=>this.unpinTooltip()),this.tipEl.querySelector("[data-pg-switch-mode]")?.addEventListener("click",()=>{this.unpinTooltip(),this.performanceGroup?.selectionModeSwitch?.activate()}),this.tipEl.style.display="block",this.placeTooltip()}syncSeatMarks(){let e=this.performanceGroup?.seatMarks,t=this.controller.getRenderer();if(!e||!t?.setSeatMarks)return;let i={};for(let[s,n]of Object.entries(e())){let o=this.controller.idForLabel(s);o&&(i[o]=n)}Object.keys(i).length&&t.setSeatMarks(i)}getSelection(){return this.committedSelection()}selectObjects(e){return this.controller.select(e)}deselectObjects(e){this.controller.deselect(e)}clearSelection(){this.dismissConfirm(),this.dismissTableDialog(),this.controller.clearSelection()}categoryLegendColor(){let e=(this.controller.doc?.categories??[]).find(t=>!t.notForSale);return(e?this.controller.getRenderer()?.categoryDisplayColor?.(e.key):null)||e?.color||"#2563eb"}async refreshAvailability(){await this.controller.refresh(),this.syncSeatMarks(),this.syncTray()}refreshPerformanceGroupComposition(){this.syncTray()}async adoptRestoredHold(e){!e||this.hold||await this.resumeHoldFromServer(e,!1)}selectCategories(e){return this.controller.selectCategories(e)}deselectCategories(e){this.controller.deselectCategories(e)}setSelectableObjects(e){this.controller.setSelectableObjects(e)}setMaxSelection(e){this.maxTickets=Math.max(this.exactTickets??1,Math.floor(e)),this.controller.setMaxSelection(this.maxTickets),this.updateSelectionCapacity(),this.syncTray()}getSelectionValidity(){let e=this.controller.getSelectionValidity(this.totalTicketCount());return e&&(e.seats=this.committedSelection()),e}setMapTheme(e){this.destroyed||(this.opts.theme={...this.opts.theme??{},map:e??void 0},this.controller.setMapTheme(e),this.applyMapChromeTokens())}applyMapChromeTokens(){let e=this.els.map?.parentElement;if(!e||!this.root)return;let t=Ve(this.controller.doc?.theme,this.opts.theme),i=this.opts.theme?.map?.background??this.controller.doc?.theme?.background??void 0,s=wi(t,i);for(let n of["--sl-bg","--sl-surface","--sl-text","--sl-muted","--sl-line","--sl-accent-text"])s?e.style.setProperty(n,s[n]):e.style.removeProperty(n)}setEventDetailsHidden(e){this.eventDetailsHidden=e,this.syncFullscreenButtons()}setPricing(e){let t=JSON.stringify(this.opts.pricing??null),i=JSON.stringify(e??null);t!==i&&(this.opts.pricing=e,!(this.destroyed||!this.els.prices)&&(this.els.pricesSec?.querySelector(".sl-price-select")?.remove(),this.buildPriceFilter(),this.syncPrices(),this.syncTray(),this.lastSection&&this.showSectionCard(this.lastSection)))}buildLanguageSwitcher(e){if(!e)return;let t=(this.opts.languages??[]).map(s=>(0,v.resolveLocale)(s)).filter((s,n,o)=>o.indexOf(s)===n);if(t.length<2)return;let i=document.createElement("select");i.className="sl-langsel",i.setAttribute("aria-label",this.tf("picker.preferredTicketType","Language"));for(let s of t){let n=document.createElement("option");n.value=s,n.textContent=v.LOCALE_NAMES[s]??s,n.selected=s===(0,v.getLocale)(),i.appendChild(n)}i.addEventListener("change",()=>{this.setLocale(i.value)}),this.langSel=i,e.appendChild(i)}async setLocale(e){let t=(0,v.getLocale)(),i=await(0,v.loadLocale)(e);if(this.opts.messages&&(0,v.setStringOverrides)(this.opts.messages),i===t)return i;let s=this.root;if(!s)return i;s.lang=i,s.dir=(0,v.localeDirection)(),Si(s);try{this.syncTray()}catch{}try{this.syncPrices()}catch{}try{this.syncOffer()}catch{}try{this.syncRung()}catch{}try{this.syncFloors()}catch{}try{this.syncPanelToggle()}catch{}try{this.syncFullscreenButtons()}catch{}return this.controller.refreshMapCopy(),this.langSel&&this.langSel.value!==i&&(this.langSel.value=i),i}isColorblindSafe(){return this.cbSafe}setColorblindSafe(e){e!==this.cbSafe&&(this.cbSafe=e,this.cbEl?.setAttribute("aria-pressed",String(e)),this.controller.setColorblindSafe(e),this.syncPrices(),Wr(e))}setViewMode(e){this.controller.setViewMode(this.normalizeInitialView(e)),this.syncProjection(),this.dismissConfirm()}getViewMode(){return this.controller.getViewMode()}normalizeInitialView(e){return e==="perspective"?(this.perspectiveWarned||(this.perspectiveWarned=!0,console.warn("[seatlayer] initialView:'perspective' (2.5D) is deprecated for the buyer picker and was coerced to 'flat'. Use the Map | 3D control for the immersive view.")),"flat"):e??"flat"}getBuyerView(){return this.buyerView}setBuyerView(e,t){if(e==="map"){this.exit3d();return}let i=t?.flyToSeatId;if(this.buyerView==="venue3d"){i?(this.opts.onBuyerViewChange?.({view:"venue3d",seatId:i}),this.view3dHandle?.flyToSeat(i)):t?.resetView&&this.view3dHandle?.focusOverview();return}this.enter3d(i)}seatState3dFor(e){switch(this.controller.getStatus(e.id)){case"held":return"held";case"booked":return"sold";case"not_for_sale":return"dimmed";default:break}return this.priceBandKeys!=null&&!this.priceBandKeys.has(e.categoryKey)||this.limitedViewFilter&&(e.commercial?.restrictedView||e.commercial?.obstructedView)?"dimmed":"available"}pushAvailabilityTo3d(){if(!this.view3dHandle)return;let e=this.allSeats().map(t=>({seatId:t.id,state:this.seatState3dFor(t)}));this.view3dHandle.setAvailability(e)}syncSelectionTo3d(){this.view3dHandle&&this.view3dHandle.setSelection(this.controller.getSelection().map(e=>e.id))}async seatViewFor3d(e){let t=this.allSeats().find(i=>i.id===e);if(!t)return null;if(t.viewUrl)try{let i=t.viewMeta?.previewUrl,s=!!i&&i!==t.viewUrl,n=s?await this.buyerAssetUrls.resolve(i):null,o=s?t.viewUrl:await this.buyerAssetUrls.resolve(t.viewUrl);return!o||s&&!n?null:{url:o,...n?{previewUrl:n}:{},...s?{resolveUrl:a=>this.buyerAssetUrls.resolve(a)}:{},...t.viewMeta?.sourceWidth!==void 0?{sourceWidth:t.viewMeta.sourceWidth}:{},...t.viewMeta?.sourceHeight!==void 0?{sourceHeight:t.viewMeta.sourceHeight}:{},...t.viewMeta?.previewWidth!==void 0?{previewWidth:t.viewMeta.previewWidth}:{},...t.viewMeta?.previewHeight!==void 0?{previewHeight:t.viewMeta.previewHeight}:{},...t.viewMeta?.initialBearingDeg!==void 0?{initialBearingDeg:t.viewMeta.initialBearingDeg}:{},...t.viewMeta?.initialPitchDeg!==void 0?{initialPitchDeg:t.viewMeta.initialPitchDeg}:{},...t.viewMeta?.coverage?{coverage:t.viewMeta.coverage}:{},...t.viewMeta?.capturedAt?{capturedAt:t.viewMeta.capturedAt}:{},...t.viewMeta?.sourceLabel?{sourceLabel:t.viewMeta.sourceLabel}:{}}}catch(i){return this.opts.onError?.(i),null}return{url:"",generated:!0,mediaKind:"model",coverage:"exact-seat",sourceLabel:this.tf("picker.chartDerivedModel","Chart-derived model")}}emitAnalytics(e,t){try{this.opts.onAnalytics?.(e,{...t,surface:"buyer"})}catch{}}emit3dAnalytics(e,t){this.emitAnalytics(e,t)}onView3dSeatPick(e){if(this.salesClosed){this.toast(this.tf("picker.salesClosedToast","Sales are closed for this event."),"warning"),this.syncSelectionTo3d();return}let t=this.allSeats().find(a=>a.id===e);if(!t)return;let i=this.controller.tableSelection(e);if(this.committedSelection().some(a=>i?a.label===i.label:a.id===e)){this.controller.deselect([e]),this.dismissConfirm(),this.syncSelectionTo3d();return}let n=this.controller.getStatus(t.id);if(n==="held"||n==="booked"||n==="not_for_sale"){this.showUnavailable3dSeat(t,this.seatState3dFor(t),n),this.syncSelectionTo3d();return}if(this.dismissUnavailable3dSeat(),!this.controller.select([e]).length){this.syncSelectionTo3d(),this.dismissConfirm();return}if(this.opts.onBuyerViewChange?.({view:"venue3d",seatId:e}),this.flashPickedSeat(e),i){this.showTableDialog(i,!1),this.syncSelectionTo3d();return}this.opts.confirmSelection!==!1?this.showConfirm(t):this.syncTray(),this.syncSelectionTo3d()}showUnavailable3dSeat(e,t,i){let s=this.view3dEl;if(!s)return;this.dismissUnavailable3dSeat();let n=this.controller.seatDetails(e.id),o=n?.displayLabel??e.displayLabel??e.label,a=n?.sectionLabel,l=le(n),c=[a,l?(0,v.t)("picker.rowLabel",{label:l}):null,o].filter(Boolean).join(" \xB7 "),h=i==="held"?{title:this.tf("picker.temporarilyHeld","Temporarily held"),message:this.tf("picker.heldSeatExplanation","Another buyer is holding this seat. It may become available again.")}:i==="booked"?{title:this.tf("picker.sold","Sold"),message:this.tf("picker.soldSeatExplanation","This seat has already been booked.")}:{title:this.tf("picker.notForSale","Not for sale"),message:this.tf("picker.notForSaleExplanation","This seat is not included in the current sale.")},p=document.createElement("div");p.className="sl-view3d-unavailable",p.dataset.state=t,p.setAttribute("role","status"),p.setAttribute("aria-live","polite");let d=document.createElement("span");d.className="sl-view3d-unavailable-eyebrow",d.textContent=c||o;let m=document.createElement("strong");m.textContent=h.title;let f=document.createElement("div");f.className="sl-view3d-unavailable-copy",f.append(d,m);let x=document.createElement("button");x.type="button",x.setAttribute("aria-label",this.tf("picker.closeSeatStatus","Close seat status")),x.textContent="\xD7";let w=document.createElement("p");w.textContent=h.message,p.append(f,x,w),x.addEventListener("click",()=>p.remove()),s.appendChild(p),this.announceSeat(e)}dismissUnavailable3dSeat(){this.view3dEl?.querySelector(".sl-view3d-unavailable")?.remove()}saveView3dComparisonSeat(e){if(this.buyerView!=="venue3d")return;let t=this.view3dCompareSeatIds;t.includes(e.id)||(this.view3dCompareSeatIds=t.length===0?[e.id]:[t[0],e.id]),this.confirmSeat?.id===e.id&&(this.controller.deselect([e.id]),this.dismissConfirm(),this.syncSelectionTo3d(),this.syncTray()),this.view3dCompareChip.sync(),this.emit3dAnalytics("3d_comparison_saved",{seatId:e.id,count:this.view3dCompareSeatIds.length}),this.view3dCompareSeatIds.length>1?this.openView3dComparison():this.toast(this.tf("picker.chooseAnotherToCompare","Seat saved. Choose another seat to compare."),"success")}clearView3dComparison(){this.closeView3dComparison(!1),this.view3dCompareSeatIds=[],this.view3dCompareChip.remove(),this.emit3dAnalytics("3d_comparison_cleared")}view3dComparisonSnapshot(e){let t=this.allSeats().find(m=>m.id===e);if(!t)return null;let i=this.controller.seatDetails(t.id),s=this.controller.doc?.categories.find(m=>m.key===t.categoryKey),n=i?.price??(s?.tiers?.length?s.tiers[0].price:s?.price),o=n!=null?this.paidPrice(t.categoryKey,i?.tierId??s?.tiers?.[0]?.id??null,n,t.label):void 0,a=this.controller.getStatus(t.id),l=a==="held"?this.tf("picker.temporarilyHeld","Temporarily held"):a==="booked"?this.tf("picker.sold","Sold"):a==="not_for_sale"?this.tf("picker.notForSale","Not for sale"):this.tf("picker.available","Available"),c=t.viewUrl?(0,Ke.seatViewDisclosure)({url:t.viewUrl,...t.viewMeta?.coverage?{coverage:t.viewMeta.coverage}:{},...t.viewMeta?.capturedAt?{capturedAt:t.viewMeta.capturedAt}:{},...t.viewMeta?.sourceLabel?{sourceLabel:t.viewMeta.sourceLabel}:{}}):this.tf("picker.chartDerivedSeatEye","Live 3D \xB7 chart-derived seat-eye \xB7 not surveyed"),h=me(t.commercial)||this.tf("picker.noAuthoredRestriction","No organizer-authored restriction"),p=i?.wheelchairSpaceType?`${Le(i.wheelchairSpaceType)} \xB7 metadata, not access certification`:this.tf("picker.noAccessibilityMetadata","No accessibility metadata supplied"),d=(0,_t.seatConfidenceDisclosure)(t.confidenceEvidence);return{seat:t,label:i?.displayLabel??t.displayLabel??t.label,section:i?.sectionLabel??t.sectionId??"\u2014",row:le(i)??i?.rowLabel??"\u2014",category:i?.categoryLabel??s?.label??t.categoryKey,price:o==null?this.tf("picker.priceNotSupplied","Not supplied"):this.money(o),availability:l,selectable:a==null||a==="free",viewSource:c,limited:h,accessibility:p,confidence:d}}openSeatConfidencePassport(e,t=null){let i=this.view3dEl;if(!i)return;this.closeSeatConfidencePassport(!1);let s=(0,_t.seatConfidenceDisclosure)(e.confidenceEvidence),n=e.confidenceEvidence,o=this.controller.seatDetails(e.id),a=k=>S(k),l=s.limitations.length?`<h4>Known limits</h4><ul>${s.limitations.map(k=>`<li>${a(k)}</li>`).join("")}</ul>`:"",c=s.modeledTarget?`<div><dt>Modeled target</dt><dd>${a(s.modeledTarget)}</dd></div>`:"",h=n?`<div><dt>Evidence ID</dt><dd>${a(n.evidenceId)}</dd></div><div><dt>Model version</dt><dd>${a(n.modelVersion)}</dd></div><div><dt>Event configuration</dt><dd>${a(n.eventConfigurationId??"Not configuration-specific")}</dd></div><div><dt>Approval</dt><dd>${a(n.approvedByRole??"No external approval supplied")}</dd></div>`+(n.validUntil?`<div><dt>Valid until</dt><dd>${a(n.validUntil.slice(0,10))}</dd></div>`:""):"<div><dt>Evidence ID</dt><dd>None supplied</dd></div>",p=me(e.commercial)||this.tf("picker.noAuthoredRestriction","No organizer-authored restriction"),d=`<div><dt>View restriction</dt><dd>${a(p)}</dd></div>`+(e.commercial?.note?`<div><dt>Organizer note</dt><dd>${a(e.commercial.note)}</dd></div>`:""),m=document.createElement("div");m.className="sl-view3d-passport-shell",m.innerHTML=`<div class="sl-view3d-passport-scrim" aria-hidden="true"></div><section class="sl-view3d-passport" role="dialog" aria-modal="true" aria-labelledby="sl-view3d-passport-title"><header><div><span>Seat confidence passport</span><strong id="sl-view3d-passport-title">${a(o?.displayLabel??e.displayLabel??e.label)}</strong></div><button type="button" data-close aria-label="Close seat confidence passport">\xD7</button></header><div class="sl-view3d-passport-summary"><strong>${a(s.headline)}</strong><span>${a(s.coverage)} \xB7 ${a(s.freshness)}</span></div><dl><div><dt>Model status</dt><dd>${a(s.model)}</dd></div><div><dt>Reality evidence</dt><dd>${a(s.reality)}</dd></div><div><dt>Source</dt><dd>${a(s.provenance)}</dd></div>`+d+c+h+`</dl>${l}<p class="sl-view3d-passport-note">This passport describes supplied evidence and known limits. It does not guarantee that every temporary obstruction or real-world condition is knowable before the event build.</p></section>`;let f=[...new Set([...i.children,...[...this.els.map.children].filter(k=>k!==i)])].filter(k=>k instanceof HTMLElement),x=f.map(k=>({element:k,inert:k.inert,ariaHidden:k.getAttribute("aria-hidden")}));for(let k of f)k.inert=!0,k.setAttribute("aria-hidden","true");i.appendChild(m),i.classList.add("has-passport"),this.view3dPassportEl=m;let w=m.querySelector(".sl-view3d-passport"),b=()=>[...w.querySelectorAll('button:not(:disabled),[href],[tabindex]:not([tabindex="-1"])')],P=k=>{if(k.key==="Escape"){k.preventDefault(),k.stopPropagation(),k.stopImmediatePropagation(),this.closeSeatConfidencePassport();return}if(k.key!=="Tab")return;let T=b();if(!T.length)return;let O=T[0],E=T[T.length-1];k.shiftKey&&document.activeElement===O?(k.preventDefault(),E.focus()):!k.shiftKey&&document.activeElement===E&&(k.preventDefault(),O.focus())};window.addEventListener("keydown",P,!0),this.view3dPassportCleanup=()=>{window.removeEventListener("keydown",P,!0);for(let E of x)E.element.inert=E.inert,E.ariaHidden===null?E.element.removeAttribute("aria-hidden"):E.element.setAttribute("aria-hidden",E.ariaHidden);let k=t?.isConnected?t:this.confirmEl?.querySelector(".sl-confirm-confidence")??this.view3dCompareEl?.querySelector("[data-passport-seat]")??null,T=k?.closest(".sl-confirm,.sl-view3d-compare");T?.isConnected&&(T.inert=!1,T.removeAttribute("aria-hidden")),m.remove(),i.classList.remove("has-passport"),this.view3dPassportEl===m&&(this.view3dPassportEl=null);let O=k??this.view3dCompareEl?.querySelector("[data-passport-seat]")??this.confirmEl?.querySelector(".sl-confirm-confidence")??this.view3dCompareChip.mainButton();(t?.isConnected?t:O)?.focus()},m.addEventListener("click",k=>{let T=k.target instanceof HTMLElement?k.target:null;(T?.closest("[data-close]")||T?.classList.contains("sl-view3d-passport-scrim"))&&this.closeSeatConfidencePassport()}),requestAnimationFrame(()=>b()[0]?.focus()),this.emit3dAnalytics("3d_confidence_passport_opened",{seatId:e.id,evidenceId:n?.evidenceId??null,eventConfigurationId:n?.eventConfigurationId??null,modelLevel:n?.modelLevel??"unverified",realityLevel:n?.realityLevel??"none"})}closeSeatConfidencePassport(e=!0){let t=this.view3dPassportCleanup;if(this.view3dPassportCleanup=null,!t){this.view3dPassportEl?.remove(),this.view3dPassportEl=null,this.view3dEl?.classList.remove("has-passport");return}e||(document.activeElement instanceof HTMLElement?document.activeElement:null)?.blur(),t(),e||this.root?.focus({preventScroll:!0})}openView3dComparison(){let e=this.view3dEl;if(!e||this.view3dCompareSeatIds.length<2)return;this.closeView3dComparison(!1);let t=this.view3dCompareSeatIds.map(d=>this.view3dComparisonSnapshot(d)).filter(d=>!!d);if(t.length<2){this.clearView3dComparison();return}let i=d=>S(d),s=document.createElement("div");s.className="sl-view3d-compare-shell";let n=t.map((d,m)=>`<article><span>Seat ${m===0?"A":"B"}</span><strong>${i(d.label)}</strong><small>Section ${i(d.section)} \xB7 Row ${i(d.row)}</small><dl><div><dt>Current price</dt><dd>${i(d.price)}</dd></div><div><dt>Ticket type</dt><dd>${i(d.category)}</dd></div><div><dt>Availability</dt><dd>${i(d.availability)}</dd></div><div><dt>View source</dt><dd>${i(d.viewSource)}</dd></div><div><dt>View restriction</dt><dd>${i(d.limited)}</dd></div><div><dt>Seat confidence</dt><dd>${i(d.confidence.headline)}</dd></div><div><dt>Reality check</dt><dd>${i(d.confidence.reality)}</dd></div><div><dt>Accessibility</dt><dd>${i(d.accessibility)}</dd></div></dl><div class="sl-view3d-compare-actions"><button type="button" data-passport-seat="${i(d.seat.id)}">Passport</button><button type="button" data-view-seat="${i(d.seat.id)}">View seat</button><button type="button" class="select" data-select-seat="${i(d.seat.id)}"${d.selectable?"":" disabled"}>Select seat</button></div></article>`).join("");s.innerHTML=`<div class="sl-view3d-compare-scrim" aria-hidden="true"></div><section class="sl-view3d-compare" role="dialog" aria-modal="true" aria-labelledby="sl-view3d-compare-title"><header><div><span>Seat inspection</span><strong id="sl-view3d-compare-title">Compare disclosed attributes</strong></div><button type="button" data-close aria-label="Close seat comparison">\xD7</button></header><p class="sl-view3d-compare-note">Current price and availability come from this picker. Modeled views are chart-derived unless organizer media is labeled; SeatLayer does not invent why a seat has its price.</p><div class="sl-view3d-compare-grid">${n}</div></section>`;let o=document.activeElement instanceof HTMLElement?document.activeElement:null,a=[...e.children].filter(d=>d instanceof HTMLElement),l=a.map(d=>({element:d,inert:d.inert,ariaHidden:d.getAttribute("aria-hidden")}));for(let d of a)d.inert=!0,d.setAttribute("aria-hidden","true");e.appendChild(s),e.classList.add("has-comparison"),this.view3dCompareEl=s;let c=s.querySelector(".sl-view3d-compare"),h=()=>[...c.querySelectorAll('button:not(:disabled),[href],[tabindex]:not([tabindex="-1"])')],p=d=>{if(d.key==="Escape"){d.preventDefault(),this.closeView3dComparison();return}if(d.key!=="Tab")return;let m=h();if(!m.length)return;let f=m[0],x=m[m.length-1];d.shiftKey&&document.activeElement===f?(d.preventDefault(),x.focus()):!d.shiftKey&&document.activeElement===x&&(d.preventDefault(),f.focus())};window.addEventListener("keydown",p),this.view3dCompareCleanup=()=>{window.removeEventListener("keydown",p);for(let d of l)d.element.inert=d.inert,d.ariaHidden===null?d.element.removeAttribute("aria-hidden"):d.element.setAttribute("aria-hidden",d.ariaHidden);s.remove(),e.classList.remove("has-comparison"),this.view3dCompareEl===s&&(this.view3dCompareEl=null),o?.isConnected?o.focus():this.view3dCompareChip.mainButton()?.focus()},s.querySelector("[data-close]")?.addEventListener("click",()=>this.closeView3dComparison()),s.querySelectorAll("[data-passport-seat]").forEach(d=>d.addEventListener("click",()=>{let m=d.dataset.passportSeat,f=m?this.allSeats().find(x=>x.id===m):void 0;f&&this.openSeatConfidencePassport(f,d)})),s.querySelectorAll("[data-view-seat]").forEach(d=>d.addEventListener("click",()=>{let m=d.dataset.viewSeat;this.closeView3dComparison(!1),m&&this.view3dHandle?.flyToSeat(m)})),s.querySelectorAll("[data-select-seat]").forEach(d=>d.addEventListener("click",()=>{let m=d.dataset.selectSeat;m&&this.selectComparedSeat(m)})),requestAnimationFrame(()=>h()[0]?.focus()),this.emit3dAnalytics("3d_comparison_opened",{seatIds:this.view3dCompareSeatIds.slice()})}closeView3dComparison(e=!0){let t=this.view3dCompareCleanup;if(this.view3dCompareCleanup=null,!t){this.view3dCompareEl?.remove(),this.view3dCompareEl=null,this.view3dEl?.classList.remove("has-comparison");return}e||(document.activeElement instanceof HTMLElement?document.activeElement:null)?.blur(),t(),e||this.root?.focus({preventScroll:!0})}selectComparedSeat(e){if(this.salesClosed){this.toast(this.tf("picker.salesClosedToast","Sales are closed for this event."),"warning");return}let t=this.allSeats().find(s=>s.id===e);if(!t)return;if(this.closeView3dComparison(!1),!this.controller.select([e]).length){this.syncSelectionTo3d(),this.toast(this.tf("picker.seatNoLongerAvailable","That seat is no longer available."),"warning");return}this.syncSelectionTo3d(),this.showConfirm(t),this.emit3dAnalytics("3d_comparison_selected",{seatId:e})}async enter3d(e){if(this.view3dEl||!this.canOffer3d()||!this.els.map)return;let t=this.controller.doc;if(!t)return;this.buyerView="venue3d",this.view3dTargetSeatId=null,this.opts.onBuyerViewChange?.({view:"venue3d",...e?{seatId:e}:{}}),this.root?.setAttribute("data-view3d","on"),this.dismissConfirm(),this.syncProjection();let i=document.createElement("div");i.className="sl-view3d",i.setAttribute("role","group"),i.setAttribute("aria-label",this.tf("picker.interactive3dVenueView","Interactive 3D venue view"));let s=document.createElement("button");s.type="button",s.className="sl-view3d-back",s.innerHTML=`<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M15 18l-6-6 6-6"/></svg><span>${this.tf("picker.backToMap","Back to map")}</span>`;let n=s.querySelector("span"),o=h=>{this.view3dTargetSeatId=h;let p=!!h;i.classList.toggle("is-seat-focused",p);let d=p?this.tf("picker.backToVenue","Back to venue"):this.tf("picker.backToMap","Back to map");n&&(n.textContent=d),s.setAttribute("aria-label",d)};s.addEventListener("click",()=>{if(this.view3dTargetSeatId&&this.view3dHandle){this.view3dHandle.focusOverview();return}this.exit3d()}),i.appendChild(s);let a=document.createElement("button");a.type="button",a.className="sl-view3d-fs",a.textContent="\u26F6",a.setAttribute("aria-label",this.tf("picker.fullScreen","Full screen")),a.setAttribute("aria-pressed",String(!!document.fullscreenElement||this.fsFallback||this.framedFs)),a.addEventListener("click",()=>this.toggleFullscreen()),i.appendChild(a);let l=document.createElement("div");l.className="sl-view3d-loading",l.setAttribute("role","status"),l.setAttribute("aria-live","polite"),l.textContent=this.tf("picker.loading3d","Building the 3D venue\u2026"),i.appendChild(l),this.els.map.appendChild(i),this.view3dEl=i,this.view3dCompareChip.sync(),requestAnimationFrame(()=>{i.style.opacity="1"});let c=++this.view3dGen;try{let h=(0,v.expandChart)(t),p=await Ii();if(c!==this.view3dGen||this.buyerView!=="venue3d"||this.view3dEl!==i)return;let d=await p.prepareVenue3D({doc:t,seats:h});if(c!==this.view3dGen||this.buyerView!=="venue3d"||this.view3dEl!==i)return;let m=p.mountVenue3D(i,{doc:t,seats:h,prepared:d},{portraitOverviewCrop:!0,arriveAtSeatEye:!0,seatViewActionLabel:f=>this.allSeats().find(x=>x.id===f)?.viewUrl?this.tf("picker.openAuthored360","Open venue 360\xB0"):this.tf("picker.lookAroundLive3d","Look around in live 3D"),onSeatPick:f=>this.onView3dSeatPick(f),onSeatInspect:f=>this.onView3dSeatPick(f),onSectionFocusChange:f=>{let x=i.querySelector('select[data-locator="section"]'),w=f??"";!x||x.value===w||(x.value=w,x.dispatchEvent(new Event("change")))},onViewTargetChange:f=>{i.querySelector(".sl-view3d-nav")?.classList.toggle("is-seat-focused",!!f),o(f),this.opts.onBuyerViewChange?.({view:"venue3d",...f?{seatId:f}:{}})},...this.seatViewEnabled()?{getSeatView:f=>new Promise((x,w)=>{let b=()=>{this.seatViewFor3d(f).then(k=>{k?x(k):w(new Error("seat_view_unavailable"))})},P=globalThis.requestIdleCallback;typeof P=="function"?P(b,{timeout:1500}):setTimeout(b,50)})}:{},onAnalytics:(f,x)=>this.emit3dAnalytics(f,x)});this.view3dHandle=m,l.remove(),this.pushAvailabilityTo3d(),this.syncSelectionTo3d(),ss(i,m),e&&m.flyToSeat(e)}catch(h){if(c!==this.view3dGen||this.buyerView!=="venue3d"||this.view3dEl!==i)return;this.opts.onError?.(h),this.toast(this.tf("picker.unavailable3d","3D could not start. The seat map is still available."),"warning"),this.exit3d()}}exit3d(){if(this.buyerView!=="venue3d"&&!this.view3dEl)return;this.view3dGen++,this.buyerView="map",this.view3dTargetSeatId=null,this.opts.onBuyerViewChange?.({view:"map"}),this.root?.removeAttribute("data-view3d"),this.closeSeatConfidencePassport(!1),this.closeView3dComparison(!1),this.view3dCompareChip.remove();try{this.view3dHandle?.dispose()}catch{}this.view3dHandle=null;let e=this.view3dEl;this.view3dEl=null,e&&(e.style.opacity="0",setTimeout(()=>e.remove(),320)),this.syncProjection();let t=this.view3dReturnSeat;this.view3dReturnSeat=null,t&&this.committedSelection().some(i=>i.id===t.id)&&this.opts.confirmSelection!==!1&&this.showConfirm(t)}getCurrentHold(){return this.hold}async resumeHold(e){return this.resumeHoldFromServer(e,!1)}async removeHeldTicket(e){return this.removeHeldLabels([e])}async bestAvailable(e,t,i={}){if(this.salesClosed||this.bestAvailableBusy)return null;e=Math.max(1,Math.min(this.maxTickets,Math.floor(e))),this.confirmSeat&&this.cancelConfirm(),this.bestAvailableConfirm=!1,this.bestAvailableBusy=!0;let s=this.els.tray?.querySelector(".sl-ba-go");s&&(s.disabled=!0,s.classList.add("sl-busy"),s.innerHTML=`<span class="sl-ba-spin" aria-hidden="true"></span>${this.tf("picker.findingEllipsis","Finding\u2026")}`);try{let n=await this.controller.bestAvailable(e,t,{...i,ttlMs:this.opts.holdTtlMs});return n?(this.hold={holdId:n.holdId,expiresAt:n.expiresAt,seats:n.seats,items:n.items},this.handedOff=!1,this.bookedShown=!1,this.gaQty.clear(),this.startHoldTimer(n.expiresAt),this.flashHeldSeats(this.hold),this.syncTray(),this.emitHoldChange(),i.preferPremium&&n.seats.length&&!n.seats.every(o=>o.commercial?.premium)&&this.toast((0,v.t)("picker.premiumFallbackNote",{count:e}),"neutral"),this.hold):null}catch(n){this.opts.onError?.(n);let o=n?.reason,a=o==="not_enough_together"?(0,v.t)("picker.couldNotFindSeatsTogether",{count:e}):o==="companion_pair_required"?this.tf("picker.companionPairRequired","Select the adjacent wheelchair place with each companion ticket."):o==="ticket_option_not_applicable"?this.tf("picker.ticketOptionNotApplicable","That ticket choice is not available for the selected seat."):o==="sold_out"?this.tf("picker.ticketTypeSoldOut","That ticket type is sold out. Try another ticket type."):o==="event_closed"?this.tf("picker.seatSalesClosedForEvent","Seat sales have closed for this event."):this.tf("picker.seatsNoLongerAvailableTryAnother","Those seats are no longer available. Try another quantity or ticket type.");return this.toast(a,"error"),null}finally{this.bestAvailableBusy=!1,this.syncTray()}}async release(){let e=this.hold,t=this.controller.currentHold(),i=!0;if(t)i=await this.controller.release();else if(e){let s=[...new Set([...(e.items??[]).map(n=>n.label),...(e.seats??[]).map(n=>n.label)])];if(s.length)try{await this.api.release(this.opts.event,s,e.holdId)}catch(n){this.opts.onError?.(n),i=!1}}if(!i){this.toast(this.tf("picker.couldNotReleaseTickets","Couldn't release your tickets. Your hold is unchanged."),"error");return}this.hold=null,this.forgetHold(),this.handedOff=!1,this.bookedShown=!1,this.ctaPhase="idle",this.stopHoldTimer(),this.gaQty.clear(),this.syncTray(),this.emitHoldChange()}startRealtime(){if(!this.access?.configured||!this.pubApi||this.realtime)return;let e=this.opts.event;this.realtime=new Z({url:this.pubApi.subscribeUrl(e),mintTicket:()=>this.pubApi.subscribeTicket(e),onAccessUnavailable:t=>{this.opts.onAccessUnavailable?.(t),this.showAccessPanel(t)},sink:ve(this.controller,{flashOnLiveChange:!0,onStatusChange:()=>{this.syncPrices(),this.scheduleOfferRefresh(!0),this.detectBooked(),this.minimap?.refreshMinimap(),this.pushAvailabilityTo3d()},onSelectedObjectUnavailable:(t,i)=>{this.opts.onSelectedObjectUnavailable?.({labels:t,reason:i}),this.syncTray(),this.toast(i==="ineligible"?this.tf("picker.seatNoLongerYours","Some seats are no longer available to you. They have been removed from your order."):this.tf("picker.seatTaken","Someone else took a seat you had picked. It has been removed from your order."),"warning")}})}),this.realtime.start()}async refreshAccess(){return!this.access?.configured||!await this.access.refresh("manual")?!1:(this.dismissAccessPanel(),await this.controller.refresh(),this.realtime?this.realtime.restart():this.startRealtime(),!0)}showAccessPanel(e){if(this.destroyed||!this.root)return;this.dismissAccessPanel();let t=Zi(e.reason,()=>{this.refreshAccess()});(this.regions?.["bottom-center"]??this.root).appendChild(t),this.accessEl=t}dismissAccessPanel(){this.accessEl?.remove(),this.accessEl=null}destroy(){this.destroyed=!0,this.realtime?.stop(),this.realtime=null,this.dismissAccessPanel(),this.access?.clear(),this.hold&&!this.handedOff&&this.controller.release(),this.closeConfirm(),this.dismissTableDialog(!1),te(this,!1),this.closeSeatView(),this.closeCheckoutPanel(),this.exit3d(),this.buyerAssetUrls.dispose(),this.stopHoldTimer(),this.toastTimer&&clearTimeout(this.toastTimer),this.liveTimer&&clearTimeout(this.liveTimer),this.offerRefreshTimer&&clearTimeout(this.offerRefreshTimer),this.offerBoundaryTimer&&clearTimeout(this.offerBoundaryTimer),this.offerRefreshTimer=null,this.offerBoundaryTimer=null,this.offerVisibilityHandler&&(document.removeEventListener("visibilitychange",this.offerVisibilityHandler),this.offerVisibilityHandler=null);for(let e of this.motionTimers)clearTimeout(e);this.motionTimers.clear(),this.ro?.disconnect(),this.ro=null,this.framedFs&&this.setFramedFs(!1),this.escHandler&&document.removeEventListener("keydown",this.escHandler),this.fsChangeHandler&&document.removeEventListener("fullscreenchange",this.fsChangeHandler),this.fsEscHandler&&window.removeEventListener("keydown",this.fsEscHandler),this.controller.destroy(),this.projectionEl=null,this.root?.remove(),this.root=null,this.modalScrim&&(this.modalScrim.remove(),this.modalScrim=null,this.prevFocus?.isConnected&&this.prevFocus.focus({preventScroll:!0}),this.prevFocus=null)}};var de=require("@seatlayer/core");var Yr="https://api.seatlayer.io",Qr=6e4,Xr=2e3,Zr=1e3,Jr=36e5,en=5e3,tn=5e3,sn=15e3,rn=12e4,nn=new Set(["preparing","commit_pending","abort_pending","expire_pending"]),N=class extends Error{constructor(){super("performance_group_destroyed"),this.name="PerformanceGroupDestroyedError"}};function on(r){return new Promise(e=>setTimeout(e,r))}function Bt(r){let e=Number(r.headers.get("Retry-After")??"1");return Number.isFinite(e)?Math.max(50,Math.min(en,e*1e3)):1e3}function Re(r,e){return`/pub/performance-groups/${encodeURIComponent(r)}/operations/${encodeURIComponent(e)}`}function Oe(r){return r.replace(/^pghop_/,"").replace(/-/g,"").slice(-8).toUpperCase()}var zt=class{constructor(e,t,i){this.api=e;this.sink=t;this.intervalMs=i;this.stopped=!0;this.timer=null;this.prior=new Map}start(){this.stopped&&(this.stopped=!1,this.tick())}stop(){this.stopped=!0,this.timer&&clearTimeout(this.timer),this.timer=null}async tick(){try{let e=await this.api.objects(this.api.groupKey);if(this.stopped)return;let t=new Map(Object.entries(e.seats)),s=[...new Set([...this.prior.keys(),...t.keys()])].filter(n=>this.prior.get(n)!==t.get(n)).map(n=>({label:n,status:t.get(n)??"blocked"}));this.prior=t,s.length&&this.sink.applyStatuses(s),this.sink.onSections?.(e.hidden??[],e.closed??[])}catch(e){if(e instanceof N){this.stop();return}this.stopped||await this.sink.resync()}finally{this.stopped||(this.timer=setTimeout(()=>{this.tick()},this.intervalMs))}}},dt=class{constructor(e,t){this.descriptorCache=null;this.objectsCache=null;this.activePerformanceKey=null;this.selectionsByEvent=new Map;this.allocationsByHold=new Map;this.pendingOperationId=null;this.operationByHold=new Map;this.knownRevision=null;this.destroyed=!1;this.aborter=new AbortController;this.adoptFailure=null;this.settleTimer=null;this.settleOperationId=null;this.settleStartedAt=0;this.settleState=null;this.settleVisibility=null;this.lastRecovery={kind:"idle"};if(!e)throw new Error("seatlayer: `performanceGroup` key is required");this.groupKey=e,this.base=(t.apiBase??Yr).replace(/\/+$/,""),this.access=t.access,this.fetcher=t.fetch??globalThis.fetch.bind(globalThis),this.recoveryTimeoutMs=t.recoveryTimeoutMs??Qr,this.realtimePollMs=Math.max(500,t.realtimePollMs??Xr),this.selectionMode=t.selectionMode??"same_seat",this.partySize=t.partySize??null,this.onOperationState=t.onOperationState,this.onRecoveryState=t.onRecoveryState,this.onAvailability=t.onAvailability,this.access.onRenewed(s=>this.adoptSession(s));let i=this.readOperationRecord();i&&this.storedIsUndecided(i)&&(this.pendingOperationId=i.operationId)}get pendingOperation(){return this.pendingOperationId}get holdBlocked(){return!!this.adoptFailure||!!this.pendingOperationId&&this.lastRecovery.kind!=="idle"}async descriptor(){let e=await this.json(`/pub/performance-groups/${encodeURIComponent(this.groupKey)}/descriptor`);return this.descriptorCache=e.performanceGroup,e.performanceGroup.revision&&(this.knownRevision=e.performanceGroup.revision),this.activePerformanceKey??=e.performanceGroup.performances[0]?.eventKey??null,e.performanceGroup}async chart(e){let[t,i]=await Promise.all([this.descriptorCache?Promise.resolve(this.descriptorCache):this.descriptor(),this.json(`/pub/performance-groups/${encodeURIComponent(this.groupKey)}/chart`)]);return{doc:i,event:{key:t.key,name:t.name,salesClosed:t.state!=="active",venue:t.venue,startsAt:t.performances[0]?.startsAt??null,timezone:t.timezone,currency:t.currency,mode:t.mode,inventoryModelVersion:2}}}asset(e,t){return/^[a-zA-Z0-9._-]+$/.test(t)?this.blob(`/pub/performance-groups/${encodeURIComponent(this.groupKey)}/assets/${encodeURIComponent(t)}`):Promise.reject(new F(404,"not_found","not_found"))}async objects(e){let t=`/pub/performance-groups/${encodeURIComponent(this.groupKey)}/objects`+(this.selectionMode==="per_performance"?"?view=per-performance":""),i=await this.authorized(t,this.objectsCache?.revision?{headers:{"If-None-Match":`"${this.objectsCache.revision}"`}}:{});if(i.status!==304){if(!i.ok)return this.throwResponse(i);this.objectsCache=await this.responseJson(i)}if(!this.objectsCache)throw new F(502,"group_projection_unavailable","group_projection_unavailable");if(this.selectionMode==="same_seat"){let o=this.objectsCache;return this.noteAvailability(o,o.salesClosed,o),o}let s=this.objectsCache,n=s.performances.find(o=>o.eventKey===this.activePerformanceKey);if(!n)throw new F(409,"group_performance_unavailable","group_performance_unavailable");return this.noteAvailability(s,s.salesClosed||s.performances.some(o=>o.salesClosed),n),n}setSelectionMode(e,t){if(this.pendingOperationId||this.holdBlocked)throw new F(409,"group_operation_pending","group_operation_pending");e!==this.selectionMode&&(this.selectionMode=e,t!=null&&(this.partySize=t),this.objectsCache=null,this.selectionsByEvent.clear(),this.activePerformanceKey=this.descriptorCache?.performances[0]?.eventKey??this.activePerformanceKey)}setActivePerformance(e){if(this.descriptorCache&&!this.descriptorCache.performances.some(t=>t.eventKey===e))throw new F(404,"group_performance_not_found","group_performance_not_found");this.activePerformanceKey=e}setPerformanceSelections(e,t){this.selectionsByEvent.set(e,t.map(i=>({...i})))}allocationsForHold(e){return(this.allocationsByHold.get(e)??[]).map(t=>({eventKey:t.eventKey,items:t.items.map(i=>({...i}))}))}async hold(e,t,i,s){if(this.assertUsable(),s)throw new F(409,"group_hold_replace_unsupported","group_hold_replace_unsupported");let n=t.map(c=>c.label),o={labels:n};if(this.selectionMode==="per_performance"){if(!this.activePerformanceKey||!this.descriptorCache||!this.partySize)throw new F(409,"group_selection_incomplete","group_selection_incomplete");this.setPerformanceSelections(this.activePerformanceKey,t);let c=this.descriptorCache.performances.map(h=>({eventKey:h.eventKey,selections:this.selectionsByEvent.get(h.eventKey)??[]}));if(c.some(h=>h.selections.length!==this.partySize))throw new F(409,"group_selection_incomplete","group_selection_incomplete");o={selectionMode:"per_performance",allocations:c}}let a=this.pendingOperationId??`pghop_${crypto.randomUUID()}`;this.beginOperation(a),this.onOperationState?.({operationId:a,state:"preparing",decision:null});let l;try{l=await this.authorized(`/pub/performance-groups/${encodeURIComponent(this.groupKey)}/hold`,{method:"POST",body:JSON.stringify({operationId:a,...o,...i?{ttlMs:i}:{}})})}catch(c){if(c instanceof N)throw c;if(c instanceof ee)throw this.failOperation(a),c;return this.recover(a,n,Date.now()+this.recoveryTimeoutMs)}if(l.status===201||l.status===202||l.status===504){let c=await this.responseJson(l);return this.emit(c.operation),l.status===201?this.complete(c.operation):this.recover(a,n,Date.now()+this.recoveryTimeoutMs,Bt(l))}if(l.status===503){let c=await l.clone().json().catch(()=>null);if((c?.code??c?.error)==="performance_group_abort_pending"){let h=c?.operation?.operationId??a;return this.beginOperation(h),c?.operation&&this.emit(c.operation),this.recover(h,n,Date.now()+this.recoveryTimeoutMs,Bt(l))}}try{return await this.throwResponse(l,n)}catch(c){throw this.failOperation(a),c}}async release(e,t,i){this.assertUsable();let s=this.operationForHold(i),n=await this.json(`${Re(this.groupKey,s)}/release`,{method:"POST",body:"{}"});return this.operationByHold.delete(i),this.allocationsByHold.delete(i),this.clearOperationRecord(),n}async resume(e,t){this.assertUsable();let i=this.operationForHold(t),s=await this.json(Re(this.groupKey,i));return this.complete(s.operation)}async extend(e,t,i=12e4){this.assertUsable();let s=this.operationForHold(t),n=Math.max(Zr,Math.min(Jr,Math.round(i))),o=await this.json(`${Re(this.groupKey,s)}/extend`,{method:"POST",body:JSON.stringify({ttlMs:n})}),a=this.complete(o.operation);return{holdId:a.holdId,expiresAt:a.expiresAt}}bestAvailable(){return Promise.reject(new F(400,"group_best_available_unsupported","group_best_available_unsupported"))}socketUrl(){return""}createRealtime(e,t){return new zt(this,t,this.realtimePollMs)}operationIdForHold(e){return this.operationByHold.get(e)??this.readMapping(e)}rememberOperation(e,t){!e||!t||(this.operationByHold.set(e,t),this.writeMapping(e,t))}async restoreOperation(){let e=this.readOperationRecord();if(!e)return null;if(!this.storedIsUndecided(e)&&e.state!=="committed"&&e.state!=="booked")return this.clearOperationRecord(),null;this.pendingOperationId=e.operationId,this.emitRecovery({kind:"pending",operationId:e.operationId,phase:e.state==="undecided"?"unknown":e.state,longRunning:!1,reference:Oe(e.operationId)});let t;try{t=await this.authorized(Re(this.groupKey,e.operationId))}catch(n){return n instanceof N||this.recoveryFailed(e.operationId,"request_failed"),null}if(t.status===404)return this.failOperation(e.operationId),null;if(!t.ok)return this.recoveryFailed(e.operationId,"request_failed"),null;let i=await this.responseJson(t);this.emit(i.operation);let s=i.operation.state;return s==="committed"||s==="booked"?(this.emitRecovery({kind:"idle"}),this.complete(i.operation)):s==="aborted"||s==="expired"?(this.failOperation(e.operationId),null):this.recover(e.operationId,[],Date.now()+this.recoveryTimeoutMs)}async retryRecovery(){this.assertUsable();let e=this.pendingOperationId??this.readOperationRecord()?.operationId??null;return e?(this.pendingOperationId=e,this.recover(e,[],Date.now()+this.recoveryTimeoutMs)):null}watchSettlement(e){if(this.destroyed)return;let t=this.operationIdForHold(e);!t||t===this.settleOperationId||(this.stopSettlementWatch(),this.settleOperationId=t,this.settleStartedAt=Date.now(),this.settleState="committed",typeof document<"u"&&(this.settleVisibility=()=>{document.hidden||!this.settleOperationId||this.pollSettlement()},document.addEventListener("visibilitychange",this.settleVisibility)),this.scheduleSettlementPoll())}stopSettlementWatch(){this.settleTimer&&clearTimeout(this.settleTimer),this.settleTimer=null,this.settleOperationId=null,this.settleState=null,this.settleVisibility&&typeof document<"u"&&document.removeEventListener("visibilitychange",this.settleVisibility),this.settleVisibility=null}scheduleSettlementPoll(){if(this.destroyed||!this.settleOperationId)return;if(this.settleTimer&&clearTimeout(this.settleTimer),typeof document<"u"&&document.hidden){this.settleTimer=null;return}let t=Date.now()-this.settleStartedAt>=rn?sn:tn;this.settleTimer=setTimeout(()=>{this.pollSettlement()},t)}settled(e){return e==="booked"||e==="expired"||e==="aborted"}async pollSettlement(){let e=this.settleOperationId;if(this.destroyed||!e)return;if(typeof document<"u"&&document.hidden){this.settleTimer&&clearTimeout(this.settleTimer),this.settleTimer=null;return}let t;try{let s=await this.authorized(Re(this.groupKey,e));if(!s.ok)return this.scheduleSettlementPoll();t=(await this.responseJson(s)).operation}catch(s){return s instanceof N?this.stopSettlementWatch():this.scheduleSettlementPoll()}if(this.destroyed||this.settleOperationId!==e)return;let i=t.state!==this.settleState;if(this.settleState=t.state,i&&this.noteOperationState(e,t.state),this.settled(t.state)){this.stopSettlementWatch(),t.state!=="booked"&&this.clearOperationRecord(),this.emit(t);return}i&&this.emit(t),this.scheduleSettlementPoll()}destroy(){if(!this.destroyed){this.destroyed=!0,this.stopSettlementWatch(),this.access.onRenewed(void 0);try{this.aborter.abort()}catch{}}}operationRecordKey(){return`@seatlayer/performance-group-operation/v1/${encodeURIComponent(this.base)}/${encodeURIComponent(this.groupKey)}`}readOperationRecord(){try{let e=window.sessionStorage.getItem(this.operationRecordKey());if(!e)return null;let t=JSON.parse(e);return!t?.operationId||t.groupKey!==this.groupKey?null:t}catch{return null}}storedIsUndecided(e){return e.state==="undecided"||nn.has(e.state)}writeOperationRecord(e){try{window.sessionStorage.setItem(this.operationRecordKey(),JSON.stringify(e))}catch{}}clearOperationRecord(){try{window.sessionStorage.removeItem(this.operationRecordKey())}catch{}}beginOperation(e){this.pendingOperationId=e;let t=this.readOperationRecord();this.writeOperationRecord({operationId:e,groupKey:this.groupKey,state:"undecided",createdAt:t?.operationId===e?t.createdAt:Date.now()})}noteOperationState(e,t){let i=this.readOperationRecord();!i||i.operationId!==e||this.writeOperationRecord({...i,state:t})}failOperation(e){this.pendingOperationId=null,this.clearOperationRecord(),this.emitRecovery({kind:"idle"}),this.onOperationState?.({operationId:e,state:"aborted",decision:"abort"})}async adoptSession(e){if(this.destroyed)return;let t=`/pub/performance-groups/${encodeURIComponent(this.groupKey)}/session/adopt`;for(let s=0;s<2;s++){if(this.destroyed)return;try{if((await this.fetcher(`${this.base}${t}`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e.token}`},body:JSON.stringify({previousToken:e.previousToken}),credentials:"omit",signal:this.aborter.signal})).ok){this.adoptFailure=null;return}}catch{}}if(this.destroyed)return;this.adoptFailure=new F(409,"performance_group_session_adopt_failed","performance_group_session_adopt_failed");let i=this.pendingOperationId??"";throw this.emitRecovery({kind:"failed",operationId:i,reference:i?Oe(i):"",reason:"session_adopt_failed",retryable:!1}),this.adoptFailure}async recover(e,t,i,s=100){let n=s,o=Date.now()+Math.min(8e3,Math.max(500,this.recoveryTimeoutMs/2)),a="unknown";for(;Date.now()<=i;){if(this.destroyed)throw new N;if(this.emitRecovery({kind:"pending",operationId:e,phase:a,longRunning:Date.now()>=o,reference:Oe(e)}),await on(n),this.destroyed)throw new N;let l;try{l=await this.authorized(Re(this.groupKey,e))}catch(p){if(p instanceof N)throw p;if(p instanceof ee)throw this.recoveryFailed(e,"request_failed"),p;n=Math.min(2e3,Math.max(100,n*2));continue}if(l.status===404){n=Math.min(1e3,Math.max(100,n*2));continue}if(!l.ok){this.recoveryFailed(e,"request_failed");try{return await this.throwResponse(l,t)}finally{this.pendingOperationId=null,this.clearOperationRecord()}}let h=(await this.responseJson(l)).operation;if(a=h.state,this.noteOperationState(e,h.state),this.emit(h),h.state==="committed"||h.state==="booked")return this.emitRecovery({kind:"idle"}),this.complete(h);if(h.state==="aborted"||h.state==="expired")throw this.failOperation(e),new F(409,"conflict","conflict",t.map(p=>({label:p,status:"held"})));n=Bt(l)}throw this.recoveryFailed(e,"deadline"),new F(504,"performance_group_outcome_unknown","performance_group_outcome_unknown")}recoveryFailed(e,t){this.emitRecovery({kind:"failed",operationId:e,reference:Oe(e),reason:t,retryable:!0})}emitRecovery(e){if(this.destroyed)return;let t=this.lastRecovery.kind===e.kind&&JSON.stringify(this.lastRecovery)===JSON.stringify(e);this.lastRecovery=e,t||this.onRecoveryState?.(e)}noteAvailability(e,t,i){if(this.destroyed||!this.onAvailability)return;let s=e.state??this.descriptorCache?.state??"active",n=e.revision??null,o=!!n&&!!this.knownRevision&&n!==this.knownRevision;n&&!this.knownRevision&&(this.knownRevision=n);let a=i?.partial??{},l=Object.values(i?.seats??{});this.onAvailability({partial:a,freeCount:l.filter(c=>c==="free").length,blockedCount:Object.keys(i?.seats??{}).filter(c=>i.seats[c]!=="free"&&!(c in a)).length,state:s,salesClosed:!!t||s!=="active",revision:n,revisionChanged:o})}acceptRevision(e){this.knownRevision=e}complete(e){if(!e.hold||e.hold.expiresAt==null)throw new F(409,"group_hold_not_active","group_hold_not_active");this.pendingOperationId=null,this.noteOperationState(e.operationId,e.state),this.operationByHold.set(e.hold.id,e.operationId),this.writeMapping(e.hold.id,e.operationId);let t=e.hold.allocations??[];this.allocationsByHold.set(e.hold.id,t);let i=t.find(s=>s.eventKey===this.activePerformanceKey)?.items;return{holdId:e.hold.id,expiresAt:e.hold.expiresAt,items:i??e.hold.items??[]}}emit(e){this.destroyed||this.onOperationState?.({operationId:e.operationId,state:e.state,decision:e.decision})}operationForHold(e){let t=this.operationIdForHold(e);if(!t)throw new F(404,"group_hold_not_found","group_hold_not_found");return t}mappingKey(e){return`@seatlayer/performance-group-hold/v1/${encodeURIComponent(this.base)}/${encodeURIComponent(this.groupKey)}/${encodeURIComponent(e)}`}readMapping(e){try{return window.sessionStorage.getItem(this.mappingKey(e))}catch{return null}}writeMapping(e,t){try{window.sessionStorage.setItem(this.mappingKey(e),t)}catch{}}assertUsable(){if(this.destroyed)throw new N;if(this.adoptFailure)throw this.adoptFailure}async authorized(e,t={},i=!1){if(this.destroyed)throw new N;if(this.adoptFailure)throw this.adoptFailure;let s={...t.headers};t.body!==void 0&&(s["Content-Type"]="application/json");let n=await this.access.authorization(i?"unauthorized":"initial");if(this.destroyed)throw new N;if(this.adoptFailure)throw this.adoptFailure;if(!n)throw new Error("performance_group_buyer_access_required");s.Authorization=n;let o=await this.fetcher(`${this.base}${e}`,{method:t.method??"GET",headers:s,body:t.body,credentials:"omit",signal:this.aborter.signal});if(!i&&(o.status===401||o.status===403||o.status===422)){let a=await o.clone().json().catch(()=>null);if(await this.access.handleFailure(o.status,a?.code??a?.error))return this.authorized(e,t,!0)}return o}async json(e,t={}){let i=await this.authorized(e,t);return i.ok?this.responseJson(i):this.throwResponse(i)}async blob(e){let t=await this.authorized(e);return t.ok?t.blob():this.throwResponse(t)}async responseJson(e){return e.json()}async throwResponse(e,t=[]){let s=await e.json().catch(()=>null)??{},n=s.code??s.error??`request_failed_${e.status}`;throw e.status===409&&!s.conflicts?.length&&t.length&&(s.conflicts=t.map(o=>({label:o,status:"held"}))),new F(e.status,s.error??n,n,s.conflicts)}};var Rs="seatlayer-performance-group-picker-style";function an(){if(document.getElementById(Rs))return;let r=document.createElement("style");r.id=Rs,r.textContent=`
1661
1661
  .sl-pg-root{display:grid;gap:12px;min-width:0;color:var(--sl-text,#18202b);font-family:var(--sl-font,Inter,system-ui,sans-serif)}
1662
1662
  .sl-pg-head{display:grid;gap:8px;padding:16px 18px;border:1px solid var(--sl-line,#dde3ea);border-radius:14px;background:var(--sl-surface,#fff)}
1663
1663
  .sl-pg-head h2{font:700 20px/1.25 inherit;margin:0}.sl-pg-summary{margin:0;color:var(--sl-muted,#627081);font-size:14px}