@seatlayer/core 0.63.0 → 0.63.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.js +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as Jt,b as hs,d as ei,f as ds,g as vt,i as ps,k as us}from"./chunk-UCLIUNHN.js";import{b as qi,e as gt,g as Ui,h as ue,i as te,j as Zi,k as Qi,l as bt,m as ji}from"./chunk-DFNYIQY3.js";import{a as na,b as ra}from"./chunk-LVUGIKHG.js";import{b as fs}from"./chunk-FOYQOIWG.js";import{a as de,b as $i,c as Pe,d as ut,e as ft,f as be,g as ee,m as pe,n as oe,q as Zt,r as yt,t as Yi,u as mt,v as q,w as Qt}from"./chunk-GXMGOWKB.js";import{b as xe,f as ss,g as os,m as ns,x as rs,y as as}from"./chunk-DNGP2HDT.js";import{a as Zr,b as Qr,c as jr,d as Jr,e as ea,f as dt,g as ta,h as ze,i as ia,j as Wi,k as Yt,l as sa,m as oa,n as Ki}from"./chunk-YPVY3Z5S.js";import{c as ls,e as cs}from"./chunk-T2LWVOQ3.js";import{a as Lr,b as Tr,c as Ir,d as Cr,e as $t,f as Mr,g as Pr,h as xr,i as Rr,j as Er,k as Ar,m as We,p as is}from"./chunk-VI3IZS2B.js";import{b as jt,f as Ji,h as St,i as es,k as ts}from"./chunk-UL5OIGIF.js";import{Aa as Yr,Ba as Oi,Ca as qr,Da as Gi,Ea as Hi,Fa as Ni,Ga as zi,Ha as Ur,Ia as Ne,Ja as Vi,W as Di,X as Me,Y as Br,ea as Y,fa as _i,ga as lt,ka as Fr,la as Dr,ma as _r,na as Or,oa as Gr,pa as Hr,qa as Nr,ra as zr,s as Bi,sa as Vr,ta as Wr,u as Fi,ua as Kr,va as J,w as O,wa as ct,xa as Xr,ya as $r,za as ht}from"./chunk-RZLIIQDP.js";import{B as se,h as qt,s as Ve,t as fe,u as he,v as pt,w as Ut,y as Xi}from"./chunk-CXF32VPG.js";import{Konva as _t}from"konva/lib/Core";import{Stage as Jn}from"konva/lib/Stage";import{Layer as wi}from"konva/lib/Layer";import{Group as ke}from"konva/lib/Group";import{Circle as Le}from"konva/lib/shapes/Circle";import{Rect as it}from"konva/lib/shapes/Rect";import{Line as st}from"konva/lib/shapes/Line";import{Text as Te}from"konva/lib/shapes/Text";import{Path as er}from"konva/lib/shapes/Path";import{Image as tr}from"konva/lib/shapes/Image";import{Shape as ir}from"konva/lib/Shape";var wt=1.12;function ti(i){return{x:i.width()/2,y:i.height()/2}}function ys(i,e,t){if(e.width<=0||e.height<=0)return i.scaleX();let s=Math.min(i.width()/(e.width*wt),i.height()/(e.height*wt));return O(s,t.min,t.max)}function ms(i,e,t,s){let o=O(e,s.min,s.max),n=i.scaleX();if(o===n)return!1;let r=(t.x-i.x())/n,a=(t.y-i.y())/n;return i.scale({x:o,y:o}),i.position({x:t.x-r*o,y:t.y-a*o}),!0}function gs(i,e,t,s){let o=Math.min(i.width()/(e.width*wt),i.height()/(e.height*wt)),n=O(Math.max(o,s??t.min),t.min,t.max);i.scale({x:n,y:n}),i.position({x:i.width()/2-(e.x+e.width/2)*n,y:i.height()/2-(e.y+e.height/2)*n})}var Ss;function vs(i){Ss=i}function Jo(i){return typeof i=="number"?i:i instanceof Date?i.getTime():Date.parse(i)}var bs=new Map;function en(i,e){let t=i??Ss,s=`${t??""}|${JSON.stringify(e)}`,o=bs.get(s);return o||(o=new Intl.DateTimeFormat(t,e),bs.set(s,o)),o}var tn={dateStyle:"medium",timeStyle:"short"};function ws(i,e={}){let{locale:t,...s}=e,o=Jo(i);if(!Number.isFinite(o))return"";let n=Object.keys(s).length?s:tn;return en(t,n).format(o)}var ha="USD",da=["USD","EUR","GBP","CAD","AUD","INR","AED","SGD","JPY","CHF","SEK","NZD","ZAR","MXN","BRL"],Ls;function Ts(i){Ls=i}var ks=new Map;function kt(i,e,t,s){let o=s??Ls,n=`${o??""}|${i}|${e??"auto"}|${t??"auto"}`,r=ks.get(n);return r||(r=new Intl.NumberFormat(o,{style:"currency",currency:i,minimumFractionDigits:e,maximumFractionDigits:t}),ks.set(n,r)),r}function ii(i,e="USD",t,s){if(typeof t=="object"){let n=t;try{return kt(e,n.minimumFractionDigits,n.maximumFractionDigits,n.locale).format(i)}catch(r){if(n.fallback)return n.fallback(i,e);throw r}}let o=t??(Number.isInteger(i)?0:void 0);return kt(e,o,o,s).format(i)}function sn(i="USD"){try{return kt(i,void 0,void 0).resolvedOptions().maximumFractionDigits??2}catch{return 2}}function on(i,e="USD"){return i/10**sn(e)}function pa(i,e="USD",t){return ii(on(i,e),e,void 0,t)}function ua(i="USD"){return kt(i,0,0).formatToParts(0).find(t=>t.type==="currency")?.value??i}var Ke={"common.cancel":"Cancel","common.close":"Close","common.done":"Done","common.copied":"\u2713 Copied","picker.holdExpired":"Your hold expired \u2014 the seats were released. Pick again.","picker.poweredBy":"Powered by SeatLayer","picker.testMode":"TEST MODE","picker.orphanHint":"This leaves a single seat stranded \u2014 consider shifting one seat over.","picker.companionRequiresWheelchair":"Requires the adjacent wheelchair place","picker.companionPairRequired":"Select the adjacent wheelchair place with each companion ticket.","map.aria":"Seating map. Use arrow keys to move between seats, Enter to select.","map.seatsLeft":"{count} LEFT","map.soldOut":"SOLD OUT","map.fromPrice":"FROM {price}","map.statusHeld":"On hold","map.statusTaken":"Taken","picker.floor":"Floor","picker.zoomLevel":"Zoom level","picker.rungTip.zones":"Venue overview \u2014 groups of sections such as North Stand or VIP","picker.rungTip.sections":"Section blocks \u2014 sold-out and nearly-gone sections shade to show availability at a glance","picker.rungTip.seats":"Individual seats \u2014 blocks melt into dots","picker.rungLabel.zones":"ZONES","picker.rungLabel.sections":"SECTIONS","picker.rungLabel.seats":"SEATS","picker.sectionSummaryAria":"{label} section summary","picker.closeSectionSummary":"Close section summary","picker.seatsLeftInSection.one":"{count} seat left","picker.seatsLeftInSection.other":"{count} seats left","picker.overview":"Overview","picker.entrance":"Entrance","picker.tapSeatHint":"Tap any seat to check its view","picker.ticketTierFor":"Ticket tier for {label}","picker.viewFromSeat":"View from seat {label}","picker.real360":"REAL 360\xB0","picker.preview":"PREVIEW","picker.sightline":"\u2248 {m} m to stage","picker.panorama360":"360\xB0 venue photo","picker.illustrationCaption":"illustration \xB7 \u2248 {m} m from stage","picker.restrictedView":"Restricted view","picker.obstructedView":"Obstructed view","picker.premiumSeat":"Premium seat","picker.hideLimitedView":"Hide limited-view seats","picker.bestSeatsPremium":"Best seats","picker.premiumFallbackNote":"No premium block of {count} \u2014 showing best overall","picker.loading3d":"Building the 3D venue\u2026","picker.unavailable3d":"3D could not start. The seat map is still available.","picker.jumpToSection":"Jump to section","picker.salesClosedPill":"Sales are closed","picker.salesClosedCopy":"Ticket sales for this event have ended.","picker.salesClosedCta":"Sales closed","picker.salesClosedToast":"Sales are closed for this event.","picker.holdReassurance":"Yours for {time} \u2014 you won\u2019t be charged yet.","picker.securingSeats":"Securing your seats\u2026","picker.openingCheckout":"Opening secure checkout\u2026","picker.peekSecured":"\u2713 {count} secured \xB7 {total} \u2014 you won\u2019t be charged yet","picker.priceHint":"Colours on the map are ticket types \u2014 tap one below to show just those seats.","picker.findTogetherInstead":"Find seats together instead","picker.keepMyPicks":"Keep my picks","picker.accessExpiredBody":"Sign in again, or reload the page, to keep browsing these seats. Anything you are already holding stays yours.","picker.accessExpiredTitle":"Your access session has ended","picker.accessInvalidBody":"You can still book anything shown as available. Contact whoever sent you here for access to the rest.","picker.accessInvalidTitle":"We couldn\u2019t verify your access","picker.accessPausedBody":"The organizer has paused this selection. Try again in a few minutes.","picker.accessPausedTitle":"These seats are on hold right now","picker.accessRetry":"Try again","picker.accessRevokedBody":"Ask whoever sent you here for a new link to keep booking these seats.","picker.accessRevokedTitle":"This access link is no longer active","picker.accessiblePhysicalSeat":"Accessible physical seat","picker.addTime":"Add time","picker.addingEllipsis":"Adding\u2026","picker.allLevels":"All levels","picker.allPlacesBookedTogether":"All {count} places are booked together as one exclusive table.","picker.allPrices":"All prices","picker.allSeats":"All seats","picker.allSetTitle":"You\u2019re all set","picker.anyTicketType":"Any ticket type","picker.anyVenueZone":"Any venue zone","picker.areas":"Areas","picker.available":"Available","picker.backToMap":"Back to map","picker.backToVenue":"Back to venue","picker.bestSeatsStar":"\u2726 Best seats","picker.booth":"Booth","picker.capacityGuests":"{count} guests","picker.change":"Change","picker.chartDerivedModel":"Chart-derived model","picker.chartDerivedSeatEye":"Live 3D \xB7 chart-derived seat-eye \xB7 not surveyed","picker.checkConnection":"Check your connection and try again.","picker.checkoutCouldNotBeOpened":"Checkout could not be opened. Your seats are still held \u2014 please try again.","picker.chooseAnotherToCompare":"Choose another seat to compare.","picker.chooseGuestsCopy":"Choose how many guests will sit together. This table is held exclusively for your party.","picker.chooseMinMaxGuests":"Choose {min}\u2013{max} guests","picker.clearSavedSeatComparison":"Clear saved seat comparison","picker.close":"Close","picker.closeSeatStatus":"Close seat status","picker.closestGroupChosenInstantly":"Closest available group, chosen instantly.","picker.collapseTicketPanel":"Collapse ticket panel","picker.compareCount":"Compare {count}","picker.compareWithSaved":"Compare with saved","picker.confirmOrCancelSeat":"Confirm or cancel this seat","picker.confirmSeatLabel":"Confirm seat {label}","picker.confirmYourTable":"Confirm your table","picker.confirmedAndOnWay":"confirmed. A confirmation is on its way.","picker.continue":"Continue","picker.continueToCheckout":"Continue to checkout","picker.couldNotAddMoreTime":"Couldn\u2019t add more time \u2014 please head to checkout now.","picker.couldNotFindSeatsTogether":"We couldn\u2019t find {count} seats together. Try fewer seats or another ticket type.","picker.couldNotReleaseTickets":"Couldn\u2019t release your tickets. Your hold is unchanged.","picker.couldNotRemoveLabel":"Couldn\u2019t remove {label}. Your hold is unchanged.","picker.currentOffer":"Current offer","picker.currentTicketOffer":"Current ticket offer","picker.dragToLookAround":"Drag to look around \xB7 scroll to zoom","picker.emptyWheelchairSpace":"Empty wheelchair space","picker.exitFullScreen":"Exit full screen","picker.fewer":"Fewer","picker.fewerGuests":"Fewer guests","picker.fewerSeats":"Fewer seats","picker.filterAndFocusByPrice":"Filter and focus seats by price","picker.filters":"Filters","picker.findBestSeatsCount.one":"Find {count} best seat","picker.findBestSeatsCount.other":"Find {count} best seats","picker.findBestSeatsTogether":"Find the best seats together","picker.findNewSeats":"Find new seats","picker.findingBestSeats":"Finding the best seats\u2026","picker.findingEllipsis":"Finding\u2026","picker.fitToScreen":"Fit to screen","picker.flat2dMap":"Flat 2D map","picker.flexiblePartyTypeWord":"Flexible party \xB7 {typeWord}","picker.fullScreen":"Full screen","picker.generalAdmission":"General admission","picker.guestCountCouldNotBeSecured":"That guest count could not be secured. Your current table hold is unchanged.","picker.guestCountNoLongerAvailable":"That guest count is no longer available. Your current hold is unchanged.","picker.guests":"Guests","picker.guestsCount":"{count} guests","picker.guestsCountEdit":"{count} guests \xB7 Edit","picker.held":"Held","picker.heldForYou":"Held for you","picker.heldSeatExplanation":"Another buyer is holding this seat. It may become available again.","picker.heldTicketsReleased":"Held tickets released. Choose your new seats.","picker.heldTicketsRestored":"Your held tickets have been restored.","picker.hidePanel":"Hide panel","picker.hideTicketPanel":"Hide the ticket panel","picker.holdSeatsAndCheckout":"Hold seats & checkout","picker.howOfferWorks":"How the {name} offer works","picker.interactive3dVenueView":"Interactive 3D venue view","picker.keepMine":"Keep mine","picker.labelNoLongerAvailable":"{label} is no longer available.","picker.labelRemoved":"{label} removed.","picker.labelRemovedFromHold":"{label} removed from your hold.","picker.labelRestored":"{label} restored.","picker.labelsNoLongerAvailable.one":"{labels} is no longer available. Choose another seat.","picker.labelsNoLongerAvailable.other":"{labels} are no longer available. Choose another group.","picker.leftCount.one":"{count} left","picker.leftCount.other":"{count} left","picker.levelNumber":"Level {number}","picker.levels":"Levels","picker.liveAvailability":"Live availability \u2014 seats update in real time","picker.loadingSeatMap":"Loading seat map\u2026","picker.lookAroundLive3d":"Look around in live 3D","picker.manualTicketsRemovedNote":"Your manually selected tickets will be removed only after a new group is secured.","picker.map":"Map","picker.mapDidNotLoad":"The seat map didn\u2019t load","picker.maxTicketsForOrder":"You can select up to {count} tickets for this order.","picker.selectExactMore":"Select {count} more","picker.selectExactCount":"Select exactly {count} tickets","picker.selectMinimumMore":"Select {count} more","picker.adjustSeatSelection":"Adjust seat selection","picker.selectSeatsTogether":"Choose seats together in the same row and ticket category.","picker.minToMaxGuests":"{min} to {max} guests","picker.more":"More","picker.moreGuests":"More guests","picker.moreSeats":"More seats","picker.moreSelectedCount":"{count} more selected","picker.moreTimeAdded":"More time added \u2014 your seats are still held.","picker.noAccessibilityMetadata":"No accessibility metadata supplied","picker.noAuthoredRestriction":"No organizer-authored restriction","picker.noSeatsSelected":"No seats selected","picker.notChargedYet":"You won\u2019t be charged yet.","picker.notForSale":"Not for sale","picker.notForSaleExplanation":"This seat is not included in the current sale.","picker.numberOfGuests":"Number of guests","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.","picker.offerDetailUpcoming":"Tickets are available at their normal price now. This scheduled offer will apply automatically to eligible seats when it starts.","picker.offerRemainingAvailable":"{count} available","picker.offerStarts":"starts {time}","picker.offerUntil":"until {time}","picker.oneSeatSaved":"1 seat saved","picker.oneSeatSavedChooseAnother":"One seat saved; choose another to compare","picker.openAuthored360":"Open venue 360\xB0","picker.openComparison":"Open comparison","picker.openComparisonOfSeats":"Open comparison of {count} seats","picker.openTicketPanel":"Open ticket panel","picker.peekFromPrice":"From {price}","picker.peekTicketsTotal.one":"{count} ticket \xB7 {total}","picker.peekTicketsTotal.other":"{count} tickets \xB7 {total}","picker.perGuestPrice":"{price} per guest","picker.pickYourSeats":"Pick your seats","picker.preferredTicketType":"Preferred ticket type","picker.preferredVenueZone":"Preferred venue zone","picker.priceNotSupplied":"Price not supplied","picker.releaseHeldTickets":"Release held tickets and choose different seats","picker.releasingEllipsis":"Releasing\u2026","picker.removeHeldTicketLabel":"Remove held ticket {label}","picker.removeSeatLabel":"Remove {label}","picker.removeTicketsUntilOrFewer":"Remove tickets until your order has {count} or fewer.","picker.replaceCurrentChoices":"Replace your current choices?","picker.review":"Review","picker.row":"Row","picker.rowLabel":"Row {label}","picker.saveToCompare":"Save to compare","picker.savedForComparison":"Saved for comparison","picker.savedSeatComparison":"Saved seat comparison","picker.scheduledOffer":"Scheduled offer","picker.seat":"Seat","picker.seatCount.one":"{count} seat","picker.seatCount.other":"{count} seats","picker.seatJustTakenByAnother":"Seat {label} was just taken by another buyer.","picker.seatLabel":"Seat {label}","picker.seatNoLongerAvailable":"That seat is no longer available.","picker.seatNoLongerYours":"Some seats are no longer available to you. They have been removed from your order.","picker.seatNumberLower":"seat {label}","picker.seatSalesClosedForEvent":"Seat sales have closed for this event.","picker.seatSelection":"Seat selection","picker.seatStatusLegend":"Seat status legend","picker.seatTaken":"Someone else took a seat you had picked. It has been removed from your order.","picker.seatsHeldForNeedMoreTime":"Your seats are held for <b>{time}</b>. Need more time?","picker.seatsJustTaken":"One or more seats were just taken. Please pick again.","picker.seatsJustTakenInCategory.one":"{count} seat just taken in {label} \xB7 {left} left","picker.seatsJustTakenInCategory.other":"{count} seats just taken in {label} \xB7 {left} left","picker.seatsNoLongerAvailableTryAnother":"Those seats are no longer available. Try another quantity or ticket type.","picker.seatsSecured":"Seats secured","picker.seatsSelectedCount.one":"{count} selected","picker.seatsSelectedCount.other":"{count} selected","picker.section":"Section","picker.secureMore":"Secure more","picker.secureMoreAndCheckout":"Secure {count} more & checkout","picker.securedCount":"{count} secured","picker.seeItIn3d":"See it in 3D","picker.select":"Select","picker.selectSeats":"Select seats","picker.selectTable":"Select table","picker.selectWholeTable":"Select whole table","picker.selected":"Selected","picker.selectingEllipsis":"Selecting\u2026","picker.showAllSeats":"Show all seats","picker.showAllTicketTypes":"Show all {count} ticket types","picker.showFewer":"Show fewer","picker.showLabelSeatsOnMap":"Show {label} seats on the map","picker.showTicketPanel":"Show the ticket panel","picker.sold":"Sold","picker.soldOutCopy":"No reserved seats are currently available for this event.","picker.soldOutEyebrow":"This event","picker.soldOutTitle":"Sold out","picker.soldSeatExplanation":"This seat has already been booked.","picker.statusAvailable":"available","picker.statusOnHold":"on hold","picker.statusTaken2":"taken","picker.table":"Table","picker.tableCapacity":"Table capacity","picker.tableUpdatedForGuests":"{label} updated for {count} guests.","picker.temporarilyHeld":"Temporarily held","picker.ticketPrices":"Ticket prices","picker.ticketTypeSoldOut":"That ticket type is sold out. Try another ticket type.","picker.tickets":"Tickets","picker.ticketsCount.one":"{count} ticket","picker.ticketsCount.other":"{count} tickets","picker.toggleColorblindColors":"Toggle colorblind-friendly colors","picker.total":"Total","picker.trayHintTapOrBest":"Tap a seat on the map, or let us pick the best available for you.","picker.trayHintTapOrStanding":"Tap a seat on the map \u2014 or grab standing tickets below.","picker.undo":"Undo","picker.upcomingTicketOffer":"Upcoming ticket offer","picker.updateTable":"Update table","picker.updatingEllipsis":"Updating\u2026","picker.venueView":"Venue view","picker.viewFromHere":"View from here","picker.viewFromThisSeat":"View from this seat","picker.wholeTypeWord":"Whole {typeWord}","picker.willChooseClosestGroup":"We\u2019ll choose the closest available group for you.","picker.willFindSeatsTogether":"We\u2019ll find {count} seats together.","picker.yourSeats":"Your seats","picker.zoomIn":"Zoom in","picker.zoomOut":"Zoom out","picker.closeVenueNav":"Close","picker.levelsAndAreas":"Levels & areas","picker.gaChooseTickets":"How many tickets?","picker.gaAdd.one":"Add {count} ticket \xB7 {price}","picker.gaAdd.other":"Add {count} tickets \xB7 {price}","picker.gaUpdate.one":"Update \xB7 {count} ticket","picker.gaUpdate.other":"Update \xB7 {count} tickets","picker.gaRemove":"Remove","picker.gaAreasHeading":"Areas","picker.gaTrayHintTapArea":"Tap an area on the map to choose tickets.","picker.gaAdded.one":"{count} {area} ticket added, {price}","picker.gaAdded.other":"{count} {area} tickets added, {price}","picker.gaRemoved":"{area} tickets removed","picker.gaChooseForArea":"Choose tickets for {area}"};var nn=["ar","be","bg","ca","cs","cy","da","de","el","en","es","et","fa","fi","fr","he","hr","hu","it","ja","ku","lt","lv","nl","no","pl","pt","ro","ru","sk","sl","sr","sv","tr","uk","zh-Hans","zh-Hant"],Sa={ar:"\u0627\u0644\u0639\u0631\u0628\u064A\u0629",be:"\u0411\u0435\u043B\u0430\u0440\u0443\u0441\u043A\u0430\u044F",bg:"\u0411\u044A\u043B\u0433\u0430\u0440\u0441\u043A\u0438",ca:"Catal\xE0",cs:"\u010Ce\u0161tina",cy:"Cymraeg",da:"Dansk",de:"Deutsch",el:"\u0395\u03BB\u03BB\u03B7\u03BD\u03B9\u03BA\u03AC",en:"English",es:"Espa\xF1ol",et:"Eesti",fa:"\u0641\u0627\u0631\u0633\u06CC",fi:"Suomi",fr:"Fran\xE7ais",he:"\u05E2\u05D1\u05E8\u05D9\u05EA",hr:"Hrvatski",hu:"Magyar",it:"Italiano",ja:"\u65E5\u672C\u8A9E",ku:"Kurd\xEE",lt:"Lietuvi\u0173",lv:"Latvie\u0161u",nl:"Nederlands",no:"Norsk",pl:"Polski",pt:"Portugu\xEAs",ro:"Rom\xE2n\u0103",ru:"\u0420\u0443\u0441\u0441\u043A\u0438\u0439",sk:"Sloven\u010Dina",sl:"Sloven\u0161\u010Dina",sr:"\u0421\u0440\u043F\u0441\u043A\u0438",sv:"Svenska",tr:"T\xFCrk\xE7e",uk:"\u0423\u043A\u0440\u0430\u0457\u043D\u0441\u044C\u043A\u0430","zh-Hans":"\u7B80\u4F53\u4E2D\u6587","zh-Hant":"\u7E41\u9AD4\u4E2D\u6587"},Is=["ar","be","bg","ca","cs","cy","da","de","el","en","es","et","fa","fi","fr","he","hr","hu","it","ja","ku","lt","lv","nl","no","pl","pt","ro","ru","sk","sl","sr","sv","tr","uk","zh-Hans","zh-Hant"],rn=new Set(["ar","fa","he"]),si={li:"lt",iw:"he",mo:"ro",sh:"sr",nb:"no",nn:"no",kmr:"ku",zh:"zh-Hans","zh-cn":"zh-Hans","zh-sg":"zh-Hans","zh-my":"zh-Hans","zh-tw":"zh-Hant","zh-hk":"zh-Hant","zh-mo":"zh-Hant"},oi=new Map(nn.map(i=>[i.toLowerCase(),i]));function an(i){let e=i.trim().toLowerCase().replace(/_/g,"-");if(!e)return;let t=oi.get(e)??si[e];if(t)return t;let s=e.split("-");if(s.length>=2){let o=`${s[0]}-${s[1]}`,n=oi.get(o)??si[o];if(n)return n}return oi.get(s[0])??si[s[0]]}var Se={en:Ke},Lt={},ie="en";function Cs(i,e){let t=typeof navigator<"u"?navigator.languages?.length?navigator.languages:[navigator.language]:[];for(let s of[i,e,...t]){if(!s)continue;let o=an(s);if(o)return o}return"en"}function va(){return ie}function wa(i=ie){return rn.has(i)?"rtl":"ltr"}function ka(i){return!!Se[i]}function Re(i,e){e&&(Se[i]={...Se[i],...e}),ie=Se[i]?i:"en",Ts(ie),vs(ie),typeof document<"u"&&(document.documentElement.lang=ie)}function La(i){Lt=i}var Ms=/\{(\w+)\}/g;function U(i,e){let t=Lt[i]??Se[ie]?.[i]??Ke[i]??i;return e?t.replace(Ms,(s,o)=>String(e[o]??`{${o}}`)):t}function Ta(i,e,t){let s=new Intl.PluralRules(ie).select(e);return(Lt[`${i}.${s}`]??Se[ie]?.[`${i}.${s}`]??Ke[`${i}.${s}`]??Lt[`${i}.other`]??Se[ie]?.[`${i}.other`]??Ke[`${i}.other`]??i).replace(Ms,(r,a)=>String({count:e,...t}[a]??`{${a}}`))}function Ia(i,e){return ws(i,{...e??{dateStyle:"medium",timeStyle:"short"},locale:ie})}var Xe=9,ve=.9,ne=.55*ve,re=ee/de,$e=4,Tt=14,Ps=10,xs=14,ye=.45*ve,Ee=.9*ve,Rs=Math.max(ve*1.1,Ee),we=8,Es=700,Z=2,As=ee,Ye=64,Ae=.55*ye,ni=700,Bs=2500,It=-11.5,qe=.58,Fs=320,Ct=650,Ds=1,Mt=1,_s=16,ri=12,Os=[.85,.72,.62],Pt=15,xt=12,ai="600",li="500",Ue=640;function ci(i){return Math.min(1,Math.max(.55,i/900))}var Gs=.1;import{Shape as cn}from"konva/lib/Shape";import{Circle as hn}from"konva/lib/shapes/Circle";import{Rect as dn}from"konva/lib/shapes/Rect";var ln={M:2,L:2,Q:4,C:6,Z:0},hi=new Map;function di(i){let e=hi.get(i);if(e)return e;let t=St(i);if(!t)return hi.set(i,[]),[];let s=t.match(/[MLQCZ]|-?(?:\d+(?:\.\d+)?|\.\d+)/g)??[],o=[],n=0;for(;n<s.length;){let r=s[n++],a=ln[r];if(a===void 0||n+a>s.length)throw new Error(`Invalid path data for seat glyph "${i}".`);let l=s.slice(n,n+a).map(Number);if(l.some(c=>!Number.isFinite(c)))throw new Error(`Invalid coordinate in seat glyph "${i}".`);n+=a,r==="M"||r==="L"?o.push({command:r,points:l}):r==="Q"?o.push({command:r,points:l}):r==="C"?o.push({command:r,points:l}):o.push({command:"Z",points:[]})}return hi.set(i,o),o}function Hs(i,e,t,s=0,o=0){let n=di(e),r=Ji(e).bounds;if(!n.length||!r||!(t>0))return!1;let a=es(r,t);i.save(),i.translate(s,o),i.scale(a.scale,a.scale),i.translate(-a.centreX,-a.centreY);for(let l of n)l.command==="M"?i.moveTo(l.points[0],l.points[1]):l.command==="L"?i.lineTo(l.points[0],l.points[1]):l.command==="Q"?i.quadraticCurveTo(l.points[0],l.points[1],l.points[2],l.points[3]):l.command==="C"?i.bezierCurveTo(l.points[0],l.points[1],l.points[2],l.points[3],l.points[4],l.points[5]):i.closePath();return i.restore(),!0}function Ns(i,e){i.beginPath(),i.arc(0,0,e,0,Math.PI*2,!1),i.closePath()}var Ze=class extends cn{_sceneFunc(e){let t=this.attrs.seatRadius||1,s=this.attrs.seatGlyph,o=di(s),n=this.attrs.seatGlyphDetail,r;if(n===void 0){let a=this.getAbsoluteScale(),l=Math.max(Math.abs(a.x),Math.abs(a.y)),c=Number.isFinite(l)&&l>0?l:1;r=t*2*c>=16}else r=n;if(!o.length||!r){Ns(e,t),e.fillStrokeShape(this);return}e.beginPath(),Hs(e,s,t),e.fillStrokeShape(this)}_hitFunc(e){Ns(e,this.attrs.seatRadius||1),e.fillStrokeShape(this)}getSelfRect(){let e=this.attrs.seatRadius||1;return{x:-e,y:-e,width:e*2,height:e*2}}};function pn(i,e){return i==="circle"||!St(i)?null:new Ze({x:e.x,y:e.y,seatRadius:e.radius,seatGlyph:i,...e.detail===void 0?{}:{seatGlyphDetail:e.detail},...e.fill?{fill:e.fill}:{},perfectDrawEnabled:!1,shadowForStrokeEnabled:!1,hitStrokeWidth:0})}function zs(i){let{x:e,y:t,radius:s}=i;return i.wheelchairBay?new dn({x:e,y:t,width:s*2,height:s*2,offsetX:s,offsetY:s,cornerRadius:2,...i.fill?{fill:i.fill}:{},perfectDrawEnabled:!1,shadowForStrokeEnabled:!1,hitStrokeWidth:0}):pn(i.glyph,{x:e,y:t,radius:s,detail:i.detail,fill:i.fill})??new hn({x:e,y:t,radius:s,...i.fill?{fill:i.fill}:{},perfectDrawEnabled:!1,shadowForStrokeEnabled:!1,hitStrokeWidth:0})}function un(i,e){return i*2*e>=16}function Vs(i,e,t,s){let o=un(e,t);if(o===s||!i.length)return o;for(let n of i)n.setAttr("seatGlyphDetail",o);return o}var fn="#e5e7eb",yn="#c7cbd1",mn="#595f69",gn="#d1d5db",bn="#b8bdc4",Sn="#273142",vn="#526078",wn="#f1f5f9",kn="#374151",Ln="#64748b",pi="#111827",Ws="#6b7280",Rt="#374151",Ks="#4b5563",Xs="#4b5563",$s=.4,Be=.16,Ys="rgba(244,246,248,0.06)",Et=["#E69F00","#56B4E9","#009E73","#F0E442","#0072B2","#D55E00","#CC79A7"];function ae(i){return Ve(i)?{sectionFill:fn,sectionStroke:yn,sectionInk:mn,focalFill:gn,focalStroke:bn}:{sectionFill:Sn,sectionStroke:vn,sectionInk:wn,focalFill:kn,focalStroke:Ln}}function Fe(i,e){let t=i.sectionFill,s=Xi(he(t,.2),.85);switch(e){case"closed":return he(t,.12);case"sold-out":return s;case"nearly-gone":return pt(t,s,.4);default:return t}}function Tn(i,e){return i.x<e.x+e.width&&e.x<i.x+i.width&&i.y<e.y+e.height&&e.y<i.y+i.height}var De=class{constructor(){this.cells=new Map}insert(e){for(let t of this.keys(e)){let s=this.cells.get(t);s?s.push(e):this.cells.set(t,[e])}}collisionCount(e){let t=new Set,s=0;for(let o of this.keys(e))for(let n of this.cells.get(o)??[])t.has(n)||(t.add(n),Tn(e,n)&&s++);return s}keys(e){let t=Math.floor(e.x/Ye),s=Math.floor((e.x+Math.max(0,e.width))/Ye),o=Math.floor(e.y/Ye),n=Math.floor((e.y+Math.max(0,e.height))/Ye),r=[];for(let a=o;a<=n;a++)for(let l=t;l<=s;l++)r.push(`${l}:${a}`);return r}};function V(i){let e=is(i);return e?{x:e.x,y:e.y,width:Math.max(1,e.width),height:Math.max(1,e.height)}:{x:0,y:0,width:1,height:1}}function At(i,e,t,s){let o=s*Math.PI/180,n=Math.cos(o),r=Math.sin(o);return[{x:-e/2,y:-t/2},{x:e/2,y:-t/2},{x:e/2,y:t/2},{x:-e/2,y:t/2}].map(a=>({x:i.x+a.x*n-a.y*r,y:i.y+a.x*r+a.y*n}))}function Bt(i,e,t,s,o,n){let r=s*Math.PI/180,a=Math.cos(r),l=Math.sin(r);for(let c=0;c<=4;c++)for(let h=0;h<=6;h++){let f=e*(h/6-.5),d=t*(c/4-.5),m={x:i.x+f*a-d*l,y:i.y+f*l+d*a};if(!J(m,o,n))return!1}return!0}function qs(i,e,t){let s=V(i),o=[t];for(let r=1;r<12;r+=1)for(let a=1;a<12;a+=1){let l={x:s.x+s.width*a/12,y:s.y+s.height*r/12};J(l,i,e)&&o.push(l)}let n=[i,...e];return o.map(r=>({point:r,room:Bi(r,n)})).sort((r,a)=>a.room-r.room).map(r=>r.point).filter((r,a,l)=>a===l.findIndex(c=>Math.abs(c.x-r.x)<1e-6&&Math.abs(c.y-r.y)<1e-6))}import{Group as In}from"konva/lib/Group";import{Shape as Cn}from"konva/lib/Shape";function Mn(i,e,t){let s=e.length,o={x:(e[s-1].x+e[0].x)/2,y:(e[s-1].y+e[0].y)/2};i.moveTo(o.x,o.y);for(let n=0;n<s;n+=1){let r=e[n],a=e[(n+1)%s],l=e[(n-1+s)%s],c=Math.min(Math.hypot(r.x-l.x,r.y-l.y)/2,Math.hypot(a.x-r.x,a.y-r.y)/2);i.arcTo(r.x,r.y,a.x,a.y,Math.max(0,Math.min(t,c)))}i.closePath()}function _e(i,e,t,s){let o=We(i)>0,n=t.cornerRadius&&t.cornerRadius>0?t.cornerRadius:0;return new Cn({...t,sceneFunc(r,a){r.beginPath();let l=h=>{if(h.length){if(n>0&&h.length>=3)return Mn(r,h,n);r.moveTo(h[0].x,h[0].y);for(let f=1;f<h.length;f+=1)r.lineTo(h[f].x,h[f].y);r.closePath()}};s?(h=>{r.moveTo(h.start.x,h.start.y);let f=h.start;for(let d of h.segments)d.kind==="line"?r.lineTo(d.end.x,d.end.y):d.kind==="arc"?r.arc(d.center.x,d.center.y,d.radius,Math.atan2(f.y-d.center.y,f.x-d.center.x),Math.atan2(d.end.y-d.center.y,d.end.x-d.center.x),!d.clockwise):r.bezierCurveTo(d.control1.x,d.control1.y,d.control2.x,d.control2.y,d.end.x,d.end.y),f=d.end;r.closePath()})(s):l(i);for(let h of e??[]){let f=We(h)>0;l(f===o?[...h].reverse():h)}r.fillStrokeShape(a)},perfectDrawEnabled:!1})}var Qe=class extends In{constructor(){super(...arguments);this.viewportCulled=!1}setViewportCulled(t){t!==this.viewportCulled&&(this.viewportCulled=t,t||super._clearSelfAndDescendantCache())}isViewportCulled(){return this.viewportCulled}drawScene(...t){return this.viewportCulled?this:super.drawScene(...t)}drawHit(...t){return this.viewportCulled?this:super.drawHit(...t)}_clearSelfAndDescendantCache(t){if(!this.viewportCulled){super._clearSelfAndDescendantCache(t);return}this._clearCache(t)}};var Ft=class{constructor(e){this.pointers=new Map;this.pinch=null;this.panLast=null;this.panStart=null;this.panStarted=!1;this.movedPx=0;this.lastTapAt=0;this.onPointerDown=e=>{this.host.cancelGlide();let t=this.toLocal(e);if(this.pointers.set(e.pointerId,t),this.pointers.size===1)this.movedPx=0,this.pinch=null,this.panStart=t,this.panStarted=!1,this.host.marqueeShouldStart(e)?(this.host.beginMarquee(t),this.panLast=null):this.panLast=t;else if(this.pointers.size===2){this.host.marqueeActive()&&this.host.cancelMarquee();let[s,o]=[...this.pointers.values()],n={x:(s.x+o.x)/2,y:(s.y+o.y)/2},r=this.host.stage.scaleX();this.pinch={startDist:Math.hypot(o.x-s.x,o.y-s.y),startScale:r,worldMid:{x:(n.x-this.host.stage.x())/r,y:(n.y-this.host.stage.y())/r}},this.panLast=null,this.panStart=null,this.panStarted=!0,this.movedPx=we+1}};this.onPointerMove=e=>{if(!this.pointers.has(e.pointerId))return;e.preventDefault();let t=this.toLocal(e);if(this.pointers.set(e.pointerId,t),this.pointers.size===1&&this.panStart?this.movedPx=Math.max(this.movedPx,Math.hypot(t.x-this.panStart.x,t.y-this.panStart.y)):this.pointers.size>=2&&(this.movedPx=we+1),this.host.marqueeActive()){this.host.updateMarquee(t);return}if(this.pinch&&this.pointers.size>=2){this.host.releaseSectionFocusDim();let[s,o]=[...this.pointers.values()],n=Math.hypot(o.x-s.x,o.y-s.y);if(this.pinch.startDist<1)return;let r={x:(s.x+o.x)/2,y:(s.y+o.y)/2},{min:a,max:l}=this.host.zoomBounds(),c=O(this.pinch.startScale*(n/this.pinch.startDist),a,l);this.host.stage.scale({x:c,y:c}),this.host.stage.position({x:r.x-this.pinch.worldMid.x*c,y:r.y-this.pinch.worldMid.y*c}),this.host.updateSeatGroupVisibility(),this.host.stage.batchDraw(),this.host.scheduleViewChange()}else if(this.panLast&&this.pointers.size===1){if(!this.panStarted){if(this.movedPx<=we)return;this.panStarted=!0,this.host.releaseSectionFocusDim()}this.host.stage.position({x:this.host.stage.x()+(t.x-this.panLast.x),y:this.host.stage.y()+(t.y-this.panLast.y)}),this.panLast=t,this.host.updateSeatGroupVisibility(),this.host.stage.batchDraw(),this.host.scheduleViewChange()}};this.onPointerEnd=e=>{if(this.host.marqueeActive()){this.host.finishMarquee(),this.pointers.delete(e.pointerId),this.pointers.size===0&&(this.panLast=null);return}this.pointers.delete(e.pointerId),this.pointers.size<2&&(this.pinch=null),this.pointers.size===1&&(this.panLast=[...this.pointers.values()][0],this.panStart=this.panLast,this.panStarted=!0),this.pointers.size===0&&(this.panLast=null,this.panStart=null,this.panStarted=!1,this.host.afterViewChange())};this.host=e}get moved(){return this.movedPx}attach(){let{container:e}=this.host;e.addEventListener("pointerdown",this.onPointerDown,{passive:!1}),e.addEventListener("pointermove",this.onPointerMove,{passive:!1}),e.addEventListener("pointerup",this.onPointerEnd,{passive:!1}),e.addEventListener("pointercancel",this.onPointerEnd,{passive:!1})}detach(){let{container:e}=this.host;e.removeEventListener("pointerdown",this.onPointerDown),e.removeEventListener("pointermove",this.onPointerMove),e.removeEventListener("pointerup",this.onPointerEnd),e.removeEventListener("pointercancel",this.onPointerEnd)}resetPan(){this.panLast=null,this.panStart=null,this.panStarted=!1}isGhostClick(e){return e.type==="tap"?(this.lastTapAt=performance.now(),!1):this.lastTapAt>0&&performance.now()-this.lastTapAt<Es}toLocal(e){let t=this.host.container.getBoundingClientRect();return{x:e.clientX-t.left,y:e.clientY-t.top}}};import{Circle as Pn}from"konva/lib/shapes/Circle";import{Group as xn}from"konva/lib/Group";import{Text as Rn}from"konva/lib/shapes/Text";var Us=13,En=15,An=.3,Bn=.08;function Js(i,e,t){return!!(i&&t!==i||e&&!e.has(t))}function Fn(i,e){return!e||i.available==null?`cap ${i.capacity}`:i.available<=0?U("map.soldOut"):U("map.seatsLeft",{count:i.available})}function Dn(i,e){return e&&i.available!=null&&i.available<=0}function eo(i){for(let e of i.gaById.values()){let t=i.filteredOut(e.categoryKey),s=i.overviewHidden(e),o=Dn(e,i.pickerMode),n=i.pickerMode?e.selected??0:0;e.polygon.opacity(s?0:i.dimmed(e.categoryKey)?be*Bn:o?be*An:be),e.polygon.listening(!i.exportMode&&!s&&!t&&!o),e.polygon.stroke(n>0?i.selectionColor:e.strokeColor),e.polygon.strokeWidth(n>0?3:1.5),_n(i,e,o,n,s,i.dimmed(e.categoryKey))}}function _n(i,e,t,s,o,n){if(e.capacityNode){let r=Fn(e,i.pickerMode);e.capacityNode.text()!==r&&(e.capacityNode.text(r),e.capacityNode.offsetX(e.capacityNode.width()/2)),e.capacityNode.opacity(t?.75:1)}On(i,e,o||n),s>0&&!o?Hn(i,e,s):e.chip&&e.chip.visible(!1)}var ui=9,Zs=.86;function On(i,e,t){let{labelNode:s,capacityNode:o}=e;if(!s&&!o)return;let n=Math.max(i.effScale(),1e-4);if(t){s?.visible(!1),o?.visible(!1);return}if(!i.pickerMode){s?.visible(i.labelLegible(s.fontSize())),o?.visible(i.labelLegible(o.fontSize()));return}let r=Gn(e,n),a=Qs(s,ut,r.width*Zs,n),l=Qs(o,ft,r.width*Zs,n),c=a!=null,h=l!=null&&c&&a+l+ui<=r.height;js(s,c?a:null,e.labelPoint.y-ui/n,n),js(o,h?l:null,e.labelPoint.y+ui/n,n)}function Gn(i,e){let t=1/0,s=-1/0,o=1/0,n=-1/0;for(let r of i.points)r.x<t&&(t=r.x),r.x>s&&(s=r.x),r.y<o&&(o=r.y),r.y>n&&(n=r.y);return Number.isFinite(t)?{width:(s-t)*e,height:(n-o)*e}:{width:0,height:0}}function Qs(i,e,t,s){if(!i||!i.text())return null;i.fontSize(e/s);let o=i.width()*s;if(o<=t||o<=0)return e;let n=e*(t/o);return n>=ee?n:null}function js(i,e,t,s){if(i){if(e==null){i.visible(!1);return}i.fontSize(e/s),i.offsetX(i.width()/2),i.offsetY(i.height()/2),i.y(t),i.visible(!0)}}function Hn(i,e,t){if(!e.chip){let s=new xn({x:e.labelPoint.x,y:e.labelPoint.y-Us-16,listening:!1}),o=new Pn({radius:Us,fill:i.selectionColor,listening:!1,perfectDrawEnabled:!1}),n=new Rn({text:String(t),fontSize:En,fontStyle:"800",fontFamily:i.labelFont(),fill:"#0b0d12",listening:!1,perfectDrawEnabled:!1});s.add(o),s.add(n),i.bgLayer.add(s),e.chip=s,e.chipText=n}e.chipText&&e.chipText.text()!==String(t)&&e.chipText.text(String(t)),e.chipText&&(e.chipText.offsetX(e.chipText.width()/2),e.chipText.offsetY(e.chipText.height()/2)),e.chip.visible(!0),e.chip.moveToTop()}function to(i,e){let t=!1;for(let[s,o]of Object.entries(e)){let n=i.get(s);n&&(o.available!==void 0&&n.available!==o.available&&(n.available=o.available,t=!0),o.selected!==void 0&&n.selected!==o.selected&&(n.selected=o.selected,t=!0))}return t}function io(i,e){return i===null||e===null?i===e:i.size===e.size&&[...i].every(t=>e.has(t))}function so(i,e){if(!e?.size)return!1;for(let t of i)if(e.has(t))return!1;return!0}import{Rect as oo}from"konva/lib/shapes/Rect";import{Text as Nn}from"konva/lib/shapes/Text";function no(i){let e=i.effScale(),t=i.stage.scaleX(),s={width:i.stage.width(),height:i.stage.height()},o=p=>Math.round(p*100)/100,n=i.seats.map(p=>{let u=i.circleById.get(p.id),b=i.boothLabelById.get(p.id)??i.seatLabelById.get(p.id),g=i.viewMode==="perspective"?i.perspectiveSeatScale.get(p.id)??1:1,w=(i.viewMode==="perspective"?t:e)*g,k=p.kind==="booth"?Pe:de*i.seatLabelScale(p),L=i.viewMode==="perspective"&&p.kind!=="booth"?e*g:w,S=o((b?.fontSize()??k)*L),v=i.worldToScreen(p),x=v.x<0||v.x>s.width||v.y<0||v.y>s.height,I=i.focusedSeatOpacity(p.id,u?.getAbsoluteOpacity()??0),T=i.seatSection.get(p.id),P=!!b?.isVisible()&&I>=.5&&!x,M;P||(I<.5?M="dimmed-or-unavailable":S<ee?M="below-minimum-size":x?M="outside-viewport":b?M="renderer-hidden":M="clutter-or-fit");let C=b?b.width()*t*g:0,R=b?b.height()*(i.viewMode==="perspective"&&p.kind==="booth"?t:e)*g:0,B=u instanceof oo?u.width()*t*g:i.seatR*2*w,A=u instanceof oo?u.height()*(i.viewMode==="perspective"?t:e)*g:i.seatR*2*w,W=2*(i.seatR*w+Tt),H=u?.fill(),N=b?.fill(),$=i.accessGlyphById.get(p.id),D=$?.getAbsoluteScale();return{seatId:p.id,label:p.label,kind:p.kind==="booth"?"booth":"seat",markerShape:p.kind==="booth"?"booth":p.wheelchairSpaceType==="no-seat"?"square":"circle",...p.wheelchairSpaceType?{wheelchairSpaceType:p.wheelchairSpaceType}:{},categoryKey:p.categoryKey,...T?{sectionId:T.id}:{},...T?.zone?{zoneId:T.zone}:{},status:i.statusById.get(p.id)??"free",selected:i.selection.has(p.id),visible:P,renderedFontPx:S,fill:typeof H=="string"?H:"",ink:typeof N=="string"?N:u?i.seatLabelInk(p,u):i.seatPreferredLabelInk(p),opacity:o(I),...$?{accessibilityMarker:{glyphVisible:$.isVisible(),glyphWidthPx:o(oe*Math.abs(D?.x??0)),emphasizedByFilter:i.accessGlyphFilterEmphasized(p.id)}}:{},pointerTarget:{active:!i.cached&&!i.seatViewportCulled(p.id)&&!!u?.isVisible()&&!!u?.isListening()&&i.isSelectable(p.id),directWidthPx:o(B),directHeightPx:o(A),effectiveMinimumPx:o(Math.max(Math.min(B,A),W))},screenCenter:{x:o(v.x),y:o(v.y)},...P?{screenBox:{x:o(v.x-C/2),y:o(v.y-R/2),width:o(C),height:o(R)}}:{},...M?{hiddenReason:M}:{}}}),r=n.filter(p=>p.visible).length,a=(p,u,b,g,w,k)=>{let L=At({x:g.x(),y:g.y()},g.width(),g.height(),g.rotation()),S=k&&k.liftWorld>0?i.isoLiftLocal(k.liftWorld):{x:0,y:0},v=V(L.map(C=>i.worldToScreen({x:C.x+S.x,y:C.y+S.y}))),x=o(g.opacity()),I=g.fill(),T=v.x+v.width<0||v.x>s.width||v.y+v.height<0||v.y>s.height,P=g.isVisible()&&x>.05&&!T,M=k?Bt({x:g.x(),y:g.y()},g.width(),g.height(),g.rotation(),k.outline,k.holes):void 0;return{id:p,kind:u,role:b,label:g.text(),visible:P,renderedFontPx:o(g.fontSize()*t),opacity:x,fill:w,ink:typeof I=="string"?I:"",...M==null?{}:{fitsContainer:M},...P?{screenBox:{x:o(v.x),y:o(v.y),width:o(v.width),height:o(v.height)}}:{}}},l=[...i.sections.map(p=>{let u=p.blockPoly.fill();return a(p.id,"section","name",p.nameLabel,typeof u=="string"?u:p.baseFill,p)}),...i.sections.map(p=>{let u=p.blockPoly.fill();return a(`${p.id}:availability`,"section","availability",p.subLabel,typeof u=="string"?u:p.baseFill,p)}),...i.zones.flatMap(p=>[a(p.id,"zone","name",p.label,p.background),...p.sub?[a(`${p.id}:price`,"zone","price",p.sub,p.background)]:[]])],c=[...i.gaById].map(([p,u])=>{let b=u.points.map(T=>i.worldToScreen(T)),g=Math.min(...b.map(T=>T.x)),w=Math.min(...b.map(T=>T.y)),k=Math.max(...b.map(T=>T.x)),L=Math.max(...b.map(T=>T.y)),S=k<0||g>s.width||L<0||w>s.height,v=o(u.polygon.opacity()),x=v>=.1&&!S,I=u.polygon.fill();return{areaId:p,label:u.label,capacity:u.capacity,categoryKey:u.categoryKey,...u.sectionId?{sectionId:u.sectionId}:{},visible:x,interactive:u.polygon.listening(),opacity:v,fill:typeof I=="string"?I:"",effectiveBackground:u.effectiveBackground,...x?{screenBox:{x:o(g),y:o(w),width:o(k-g),height:o(L-w)}}:{}}}),h=[...i.freeTextById].map(([p,u])=>{let{node:b,background:g,kind:w}=u,k=i.worldToScreen({x:b.x(),y:b.y()}),L=b.width()*t,S=b.height()*e,v=k.x-b.offsetX()*t,x=k.y-b.offsetY()*e,I=o(b.fontSize()*e),T=v+L<0||v>s.width||x+S<0||x>s.height,P=b.isVisible()&&!T,M=b.fill(),C=o(b.getAbsoluteOpacity()),R;return P||(I<ee?R="below-minimum-size":T?R="outside-viewport":R="renderer-hidden"),{objectId:u.objectId??p,kind:w,text:b.text(),visible:P,renderedFontPx:I,ink:typeof M=="string"?M:"",background:g,opacity:C,...P?{screenBox:{x:o(v),y:o(x),width:o(L),height:o(S)}}:{},...R?{hiddenReason:R}:{}}}),f=i.labelGroup.find(p=>p.getAttr("rowLabel")===!0).filter(p=>p instanceof Nn).map(p=>{let u=p.getClientRect({skipShadow:!0,skipStroke:!0}),b=u.x+u.width<0||u.x>s.width||u.y+u.height<0||u.y>s.height,g=p.fill();return{text:p.text(),visible:p.isVisible()&&!b,renderedFontPx:o(p.fontSize()*e),ink:typeof g=="string"?g:"",...b?{}:{screenBox:{x:o(u.x),y:o(u.y),width:o(u.width),height:o(u.height)}}}}),d=ae(i.canvasBackground),m=new Set(["normal","nearly-gone","sold-out","closed"].map(p=>Fe(d,p).toLowerCase())),y=i.sections.filter(p=>p.blockPoly.opacity()>.05);return{viewport:s,projection:i.viewMode,...i.viewMode==="perspective"?{perspective:{model:"pinhole-exact-seat-anchors",sectionSurfaceModel:"tangent-plane",exactSeatAnchorCount:i.perspectiveSeatProjected.size,depthSorted:!0}}:{},canvasBackground:i.canvasBackground,effectiveScale:o(e),rung:i.getRung(),minimumVisibleLabelPx:ee,totalLabelledBookableUnits:n.length,visibleLabels:r,hiddenLabels:n.length-r,totalBookableUnits:n.length+c.reduce((p,u)=>p+u.capacity,0),selectionRingSeatIds:i.overlayLayer.find(".selection-ring").map(p=>String(p.getAttr("seatId")??"")).filter(Boolean),selectionRingColor:i.effSelection,focusedSectionId:i.focusedSectionId,focusBackdropVisible:!!i.focusBackdrop?.isVisible(),categoryFilterKeys:i.categoryFilter?[...i.categoryFilter].sort():null,overviewStyle:{visibleSectionShells:y.length,categoryPaintedSectionShells:y.filter(p=>{let u=p.blockPoly.fill();return typeof u!="string"||!m.has(u.toLowerCase())}).length,visibleCategoryDetailOutlines:i.sections.filter(p=>p.outlinePoly.opacity()>.05).length,visibleSectionRowHints:0,visibleSectionAvailabilityLabels:i.sections.filter(p=>p.subLabel.opacity()>.05).length,visibleSectionGADetails:[...i.gaById.values()].filter(p=>p.sectionId!=null&&p.polygon.opacity()>.05).length},labels:n,gaAreas:c,hierarchyLabels:l,freeTextLabels:h,rowLabels:f}}import{Circle as zn}from"konva/lib/shapes/Circle";import{Ellipse as Vn}from"konva/lib/shapes/Ellipse";import{Line as ho}from"konva/lib/shapes/Line";import{Arrow as Wn}from"konva/lib/shapes/Arrow";import{Path as Kn}from"konva/lib/shapes/Path";import{Rect as mi}from"konva/lib/shapes/Rect";import{Text as gi}from"konva/lib/shapes/Text";import{Image as Xn}from"konva/lib/shapes/Image";function fi(i,e){return e.length===0?!!i.accessible:!!i.accessibility?.some(t=>e.includes(t))}var Dt="#0b1220",je="#ffffff",ro="#0b1220",ao="#232c40",lo="#8b93a7";function co(i,e,t="normal"){let s=i?"bold":t;return e?`italic ${s}`.trim():s}var yi="#0e1117";function po(i,e){let t=new window.Image,s=new Xn({image:t,x:e.x+e.width/2,y:e.y+e.height/2,offsetX:e.width/2,offsetY:e.height/2,width:e.width,height:e.height,rotation:e.rotation??0,opacity:O(e.opacity??1,0,1),listening:!1,perfectDrawEnabled:!1});e.layer==="foreground"?i.fgDecorGroup.add(s):i.bgLayer.add(s),i.trackAssetImage(t,e.href,`Decor image \u201C${e.label||e.id}\u201D`,()=>{let o=s.getLayer();o&&o.batchDraw()})}function uo(i,e){if(e.shape==="round")i.bgLayer.add(new zn({x:e.center.x,y:e.center.y,radius:e.radius??40,fill:"#232c40",stroke:"#2a3348",strokeWidth:1.5,listening:!1}));else{let s=e.width??80,o=e.height??50;i.bgLayer.add(new mi({x:e.center.x,y:e.center.y,width:s,height:o,offsetX:s/2,offsetY:o/2,rotation:e.rotation,fill:"#232c40",stroke:"#2a3348",strokeWidth:1.5,cornerRadius:4,listening:!1}))}let t=Je(i,i.bgLayer,e.displayLabel??e.label,e.center.x,e.center.y,"#cbd5e1",12,!0);i.freeTextById.set(e.id,{node:t,background:"#232c40",kind:"table"})}function fo(i,e){let t=e.background?.color??i.canvasBackground,s=e.color??i.theme.textColor??lo,o=e.semanticKind==="icon"?ns(e.iconKey):void 0;if(o){let c=e.fontSize/24,h=new Kn({x:e.position.x,y:e.position.y,data:o,rotation:e.rotation,scaleX:c,scaleY:c,stroke:q(t,s),strokeWidth:2,lineCap:"round",lineJoin:"round",fillEnabled:!1,listening:!1,perfectDrawEnabled:!1});i.iconNodeById.set(e.id,{node:h,fontSize:e.fontSize}),i.bgLayer.add(h);return}let n=e.background?.padding??0,r=e.opacity??1,a=new gi({x:e.position.x,y:e.position.y,text:e.text,fontSize:e.fontSize,rotation:e.rotation,fontStyle:co(e.bold,e.italic,"600"),fill:q(t,s),fontFamily:e.fontFamily??i.labelFont(),...e.width!=null?{width:e.width}:{},align:e.align??"left",lineHeight:e.lineHeight??1.2,letterSpacing:e.letterSpacing??0,textDecoration:e.underline?"underline":"",padding:n,opacity:r,wrap:"word",listening:!1,perfectDrawEnabled:!1,name:"buyer-free-text"}),l;e.background&&(l=new mi({x:e.position.x,y:e.position.y,width:a.width(),height:a.height(),rotation:e.rotation,fill:e.background.color,opacity:r*(e.background.opacity??.9),cornerRadius:e.background.cornerRadius??4,listening:!1,perfectDrawEnabled:!1,name:"buyer-text-background"}),i.bgLayer.add(l)),i.freeTextById.set(e.id,{node:a,backdrop:l,background:t,kind:"free-text"}),i.bgLayer.add(a)}function yo(i,e){let t=e.fill??i.theme.decorFill??ao,s=e.role==="stage",o=e.role==="reference-focal",n=!!e.role&&!s,r=ae(i.canvasBackground),a=o?r.focalFill:t,l=e.kind==="line"||e.kind==="polyline",c=e.stroke?.color??(s?fe(a,.28):o?r.focalStroke:l?"#9aa3b5":void 0),h=e.stroke?.width??(s?1:o||l?2:0),f=e.opacity!=null?O(e.opacity,.1,1):1,d=0,m=0;if(l&&e.points&&e.points.length>=2){d=e.points.reduce((b,g)=>b+g.x,0)/e.points.length,m=e.points.reduce((b,g)=>b+g.y,0)/e.points.length;let y=rs(e),p=as(h),u=new Wn({points:e.points.flatMap(b=>[b.x,b.y]),closed:!1,x:d,y:m,offsetX:d,offsetY:m,rotation:e.rotation??0,stroke:c,fill:c,strokeWidth:h,opacity:f,lineCap:y.lineCap,lineJoin:y.lineJoin,pointerAtBeginning:y.startEnding==="arrow",pointerAtEnding:y.endEnding==="arrow",...p,listening:!1,name:"buyer-shape-open-path"});u.setAttr("shapeObjectId",e.id),i.bgLayer.add(u)}else if(e.kind==="rect"&&e.x!=null&&e.y!=null&&e.width!=null&&e.height!=null){let y=s?{fillLinearGradientStartPoint:{x:0,y:0},fillLinearGradientEndPoint:{x:0,y:e.height},fillLinearGradientColorStops:[0,he(a,.3),1,fe(a,.12)]}:{fill:a};d=e.x+e.width/2,m=e.y+e.height/2,i.bgLayer.add(new mi({x:d,y:m,offsetX:e.width/2,offsetY:e.height/2,rotation:e.rotation??0,width:e.width,height:e.height,...y,stroke:c,strokeWidth:h,cornerRadius:O(e.cornerRadius??4,0,Math.min(e.width,e.height)/2),opacity:f,listening:!1}))}else if(e.kind==="ellipse"&&e.x!=null&&e.y!=null&&e.width!=null&&e.height!=null){d=e.x+e.width/2,m=e.y+e.height/2;let y=s?{fillLinearGradientStartPoint:{x:0,y:-e.height/2},fillLinearGradientEndPoint:{x:0,y:e.height/2},fillLinearGradientColorStops:[0,he(a,.3),1,fe(a,.12)]}:{fill:a};i.bgLayer.add(new Vn({x:d,y:m,rotation:e.rotation??0,radiusX:e.width/2,radiusY:e.height/2,...y,stroke:c,strokeWidth:h,opacity:f,listening:!1}))}else if(e.kind==="polygon"&&e.points&&e.points.length){let y=e.points.flatMap(b=>[b.x,b.y]),p=V(e.points);d=e.points.reduce((b,g)=>b+g.x,0)/e.points.length,m=e.points.reduce((b,g)=>b+g.y,0)/e.points.length;let u=s?{fillLinearGradientStartPoint:{x:0,y:p.y},fillLinearGradientEndPoint:{x:0,y:p.y+p.height},fillLinearGradientColorStops:[0,he(a,.3),1,fe(a,.12)]}:{fill:a};i.bgLayer.add(new ho({points:y,closed:!0,x:d,y:m,offsetX:d,offsetY:m,rotation:e.rotation??0,...u,stroke:c,strokeWidth:h,opacity:f,listening:!1}))}for(let y of cs(e))i.bgLayer.add(new ho({points:y.points.flatMap(p=>[p.x,p.y]),closed:y.closed,x:d,y:m,offsetX:d,offsetY:m,rotation:e.rotation??0,stroke:y.ink??ls,fill:y.fill,strokeWidth:2,opacity:f*.85,listening:!1,perfectDrawEnabled:!1,name:"buyer-stage-marking"}));if(e.label)if(s){let y=$n(i,d,m,e.label,a);i.primaryFocalLabels.set(y,22),i.freeTextById.set(e.id,{node:y,background:a,kind:"stage"})}else if(n){let y=Je(i,i.bgLayer,e.label,d,m,o?q(a,"#e6e9f0"):"#9aa3b5",o?18:12,!1);o&&i.primaryFocalLabels.set(y,18),i.freeTextById.set(e.id,{node:y,background:a,kind:"decor"})}else{let y=Je(i,i.bgLayer,e.label,d,m,"#cbd5e1",16,!0);i.freeTextById.set(e.id,{node:y,background:a,kind:"decor"})}}function $n(i,e,t,s,o){let n=q(o,"#e6e9f0"),r=new gi({x:e,y:t,text:s.toUpperCase(),fontSize:22,fontStyle:"700",letterSpacing:4,fontFamily:i.labelFont(),fill:n,listening:!1,perfectDrawEnabled:!1});return r.offsetX(r.width()/2),r.offsetY(r.height()/2),i.bgLayer.add(r),r}function mo(i,e){let t=i.catColor.get(e.categoryKey)??"#6e7bff",s=i.canvasBackground,o=Yi(t,s,be),n=i.theme.textColor??"#e6e9f0",r=q(o,n),a=_e(e.points,e.holes,{fill:t,opacity:be,stroke:t,strokeWidth:1.5,cornerRadius:e.cornerRadius});a.setAttr("gaId",e.id),a.on("click tap",d=>{i.isGhostClick(d)||i.opts.onGAClick?.(e.id)}),a.on("mouseenter",()=>{i.container.style.cursor="pointer"}),a.on("mouseleave",()=>{i.container.style.cursor="default"}),i.bgLayer.add(a);let l=ct(e.points,e.holes),c=i.sections.find(d=>J(l,d.outline,d.holes)),h=Je(i,i.bgLayer,e.displayLabel??e.label,l.x,l.y-8,r,ut,!1),f=Je(i,i.bgLayer,`cap ${e.capacity}`,l.x,l.y+10,r,ft,!1);i.freeTextById.set(`${e.id}:label`,{objectId:e.id,node:h,background:o,kind:"ga-label",categoryKey:e.categoryKey}),i.freeTextById.set(`${e.id}:capacity`,{objectId:e.id,node:f,background:o,kind:"ga-capacity",categoryKey:e.categoryKey}),i.gaById.set(e.id,{label:e.displayLabel??e.label,capacity:e.capacity,categoryKey:e.categoryKey,points:e.points,polygon:a,effectiveBackground:o,strokeColor:t,labelPoint:l,labelNode:h,capacityNode:f,...c?{sectionId:c.logicalId}:{}})}function Je(i,e,t,s,o,n,r,a){let l=new gi({x:s,y:o,text:t,fontSize:r,fontStyle:a?"700":"500",fontFamily:i.labelFont(),fill:n,listening:!1,perfectDrawEnabled:!1});return l.offsetX(l.width()/2),l.offsetY(l.height()/2),e.add(l),l}function go(i,e){let t=[],s=e.theme.background??"#0e1117",o=new Map,n=(c,h)=>{let f=o.get(c)??[];f.push(h),o.set(c,f)};for(let c of e.seats){if(c.kind==="booth")continue;let h=c.logicalRowId??c.rowId;n(h,c),h!==c.rowId&&n(c.rowId,c)}let r=c=>c.logicalSeatIndex??Number(c.id.split(":").pop()??0);for(let c of i.objects){if(c.type!=="row")continue;let h=c.segmentedRow?.repeatLabelOnComponents===!0;if(c.segmentedRow&&!h&&c.segmentedRow.componentIndex!==0)continue;let f=h?c.labelPresentation:c.segmentedRow?.labelPresentation??c.labelPresentation;if(f?.visible===!1||f?.positionPreset==="none")continue;let d=c.segmentedRow&&!h?c.segmentedRow.groupId:c.id,m=(o.get(d)??[]).slice().sort((P,M)=>r(P)-r(M));if(!m.length)continue;let y=m[0],p=m[m.length-1],u=f?.labelStyle,b=q(s,u?.color??e.theme.rowLabelColor??e.theme.textColor??"#e6e9f0",mt),g=u?.size??$i,w=f?.rotation??0,k=c.segmentedRow?.displayLabel??c.displayLabel??c.label,L=e.objectFilteredOut(c)?.15:1,S=e.seatSection.get(y.id),v=S?[...new Set([S.id,S.logicalId,S.zone].filter(P=>!!P))]:void 0,x=(P,M,C)=>t.push({text:k,x:P,y:M,rotation:w,fontSize:g,ink:b,opacity:L,...v?.length?{focusKeys:v}:{},...C?{automaticAway:C}:{}});if(f?.position){x(f.position.x,f.position.y);continue}let I=e.seatR+12,T=f?.positionPreset??"start";if(T==="start"||T==="both"){let P=c.rotation*Math.PI/180,M={x:-Math.cos(P),y:-Math.sin(P)};x(y.x+M.x*I,y.y+M.y*I,M)}if(T==="end"||T==="both"){let P=(c.rotation+c.curve)*Math.PI/180,M={x:Math.cos(P),y:Math.sin(P)};x(p.x+M.x*I,p.y+M.y*I,M)}}let a=(e.seatR+12)*2.2,l=[];for(let c of t){let h=l.find(f=>f.text===c.text&&Math.hypot(f.x-c.x,f.y-c.y)<=a);if(h){h.x=(h.x+c.x)/2,h.y=(h.y+c.y)/2;continue}l.push(c)}return l}function bi(i,e,t=Z){let s=i.rotation()*Math.PI/180,o=Math.abs(Math.cos(s)),n=Math.abs(Math.sin(s)),r=(i.width()*o+i.height()*n)/2+t,a=(i.width()*n+i.height()*o)/2+t;return{x:e.x-r,y:e.y-a,width:r*2,height:a*2}}function bo(i,e,t,s){let o={x:e.x,y:e.y},n=e.automaticAway;if(!n)return o;let r={x:-n.y,y:n.x},a=Math.max(7,Math.min(16,e.fontSize*.75)),l=[{x:0,y:0}];for(let d=1;d<=4;d++){let m=a*d;l.push({x:r.x*m,y:r.y*m},{x:-r.x*m,y:-r.y*m},{x:n.x*m,y:n.y*m},{x:(n.x+r.x)*m,y:(n.y+r.y)*m},{x:(n.x-r.x)*m,y:(n.y-r.y)*m})}let c=o,h=1/0,f=1/0;for(let d of l){let m={x:o.x+d.x,y:o.y+d.y},y=bi(i,m),u=(s?gt(s,y,{mode:"overlap"}).length:0)+t.collisionCount(y),b=Math.hypot(d.x,d.y);if((u<h||u===h&&b<f)&&(c=m,h=u,f=b),u===0)break}return c}function So(i,e){let t=i.sectionHeat.get(e.id)??i.sectionHeat.get(e.logicalId)??(e.zone?i.sectionHeat.get(e.zone):void 0);if(t==null||t<=0){e.outlinePoly.stroke(se(e.outlineTint,.5)),e.outlinePoly.fill(se(e.outlineTint,.08)),e.outlinePoly.strokeWidth(1.75),e.outlinePoly.shadowOpacity(0);return}let s=pt("#f4b740","#ef4444",t);e.outlinePoly.stroke(se(s,.72+t*.25)),e.outlinePoly.fill(se(s,.08+t*.13)),e.outlinePoly.strokeWidth(2+t*3.5),e.outlinePoly.shadowColor(s),e.outlinePoly.shadowBlur(4+t*12),e.outlinePoly.shadowOpacity(.25+t*.45)}function Si(i,e){return i.closedSections.has(e.id)||i.closedSections.has(e.logicalId)||e.zone!=null&&i.closedSections.has(e.zone)}function vi(i,e){return Si(i,e)?"closed":e.total<=0?"normal":e.free<=0?"sold-out":e.free<=e.total*Gs?"nearly-gone":"normal"}function vo(i,e){let t=vi(i,e);e.blockPoly.fill(Fe(ae(i.canvasBackground),t)),e.subLabel.text(t==="sold-out"?U("map.soldOut"):U("map.seatsLeft",{count:e.free})),e.subLabel.offsetX(e.subLabel.width()/2)}function wo(i,e){let t,s;i.reducedMotion?(t=e<=ye?1:0,s=e<=Ae?1:0):(t=O((Ee-e)/(Ee-ye),0,1),s=O((ye-e)/(ye-Ae),0,1)),(i.floorOverview||i.focusedSectionId)&&(t=0,s=0);let o=!i.floorOverview&&!i.focusedSectionId&&e<ne;o&&(t=1),i.zones.length||(s=0);let n=i.viewMode==="perspective"&&i.glideInProgress&&i.seatCount>2500;i.seatLayer.opacity(o||n?0:1-t);let r=i.stageScaleX,a=!i.glideInProgress&&(i.lodScale===0||Math.abs(e-i.lodScale)/(i.lodScale||1)>.08);a&&i.setLodScale(e);let l=i.focusedSectionId,c=ae(i.canvasBackground),h=O((t-.2)/.8,0,1);for(let d of i.sections){let m=i.hasFocusDimOverlay?1:l&&d.id!==l&&d.logicalId!==l&&d.zone!==l?Be:1,y=Math.min(m,so(d.memberCategoryKeys,i.categoryFilter)?Be:1);d.outlinePoly.opacity(o?0:(1-t)*y),d.blockPoly.opacity(Ds*t*y),d.blockPoly.stroke(c.sectionStroke),d.blockPoly.strokeWidth(Mt/Math.max(r,1e-4));let p=d.blockPoly.fill(),u=q(typeof p=="string"?p:d.baseFill,d.preferredInk);d.nameLabel.fill(u),d.subLabel.fill(u),a&&h>.01&&Un(i,d,r),d.nameLabel.opacity(d.nameLabelFits?h*(1-s)*y:0),d.subLabel.opacity(0)}let f=s*(1-i.isoT);for(let d of i.zones)d.back.opacity(f),d.label.opacity(f),d.sub&&d.sub.opacity(i.stageWidth<Ue?0:f),a&&Zn(i,d,r);if(!i.glideInProgress&&(h>.01||f>.01)){qn(i,r),Yn(i.sections);for(let d of i.zones){let m=d.label.opacity();d.back.opacity(m),d.sub&&d.sub.opacity(i.stageWidth<Ue?0:m)}}i.bgLayer.batchDraw()}function Yn(i){let e=new Map;for(let t of i)(e.get(t.logicalId)??e.set(t.logicalId,[]).get(t.logicalId)).push(t);for(let t of e.values()){if(t.length<2)continue;let s=t.filter(o=>o.nameLabel.opacity()>.05).sort((o,n)=>{let r=V(o.outline),a=V(n.outline);return a.width*a.height-r.width*r.height});for(let o of s.slice(1))o.nameLabel.opacity(0)}}function qn(i,e){let s=[],o=a=>{let l=i.worldToScreen({x:a.x(),y:a.y()}),c=V(At({x:0,y:0},a.width()*e,a.height()*e,a.rotation()));return{x:l.x-c.width/2,y:l.y-c.height/2,w:c.width,h:c.height}};for(let a of i.zones){if(a.label.opacity()<=.05)continue;let l=i.worldToScreen(a.anchor),c=a.back.width()*e,h=a.back.height()*e;s.push({node:a.label,tier:0,section:!1,box:{x:l.x-c/2,y:l.y-h/2,w:c,h}})}for(let a of i.sections)a.nameLabel.opacity()>.05&&s.push({node:a.nameLabel,tier:1,section:!0,area:a.labelArea,box:o(a.nameLabel)});if(s.length<2)return;s.sort((a,l)=>a.tier-l.tier||(l.area??0)-(a.area??0)||a.box.y-l.box.y||a.box.x-l.box.x);let n=[],r=a=>n.some(l=>a.x<l.x+l.w+4&&l.x<a.x+a.w+4&&a.y<l.y+l.h+4&&l.y<a.y+a.h+4);for(let a of s){if(!r(a.box)){n.push(a.box);continue}let l=!1;if(a.section){let c=a.node.fontSize(),h=a.node.y();for(let f of Os){let d=c*f;if(d*e<ri)break;et(a.node,d,h);let m=o(a.node);if(!r(m)){n.push(m),l=!0;break}}l||et(a.node,c,h)}l||a.node.opacity(0)}}function et(i,e,t){i.fontSize(Math.max(1,e)),i.offsetX(i.width()/2),i.offsetY(i.height()/2),i.y(t)}function Un(i,e,t){e.subLabelFits=!1;let s=ci(i.stageWidth),o=_s*e.labelScale*s,n=Math.min(ri*e.labelScale,o);for(let r=o;r>=n;r-=1)for(let a of[0,-90]){e.nameLabel.rotation(a),et(e.nameLabel,r/t,e.nameLabel.y());for(let l of e.labelAnchors){e.nameLabel.position(l);let c=8/t;if(Bt(l,e.nameLabel.width()+c,e.nameLabel.height()+c,a,e.outline,e.holes)){e.nameLabelFits=!0;return}}}e.nameLabel.position(e.centroid),e.nameLabel.rotation(0),e.nameLabelFits=!1}function Zn(i,e,t){let s=ci(i.stageWidth),o=e.sub!=null&&i.stageWidth>=Ue,n=i.stageWidth<Ue,r=(n?7:10)*s/t,a=(n?4:6)*s/t,l=o?3*s/t:0;et(e.label,Pt*s/t,e.anchor.y),o&&et(e.sub,xt*s/t,e.anchor.y);let c=Math.max(e.label.width(),o?e.sub.width():0)+r*2,h=e.label.height()+(o?l+e.sub.height():0)+a*2;e.label.y(e.anchor.y-(o?(l+e.sub.height())/2:0)),o&&e.sub.y(e.anchor.y+(e.label.height()+l)/2),e.back.position(e.anchor),e.back.size({width:c,height:h}),e.back.offset({x:c/2,y:h/2}),e.back.cornerRadius(7*s/t),e.back.strokeWidth(1/t);let f=e.back.getAbsolutePosition(),d=62+h*t/2;if(f.y<d){let m=(d-f.y)/t;e.label.y(e.label.y()+m),e.sub&&e.sub.y(e.sub.y()+m),e.back.y(e.back.y()+m)}}import{Group as Qn}from"konva/lib/Group";import{Line as ko}from"konva/lib/shapes/Line";import{Rect as jn}from"konva/lib/shapes/Rect";import{Text as Lo}from"konva/lib/shapes/Text";function To(i){let e=i.exportMode?Math.max(i.effScale(),re):i.effScale(),t=e>=re;for(let[n,r]of i.boothLabelById){let a=i.circleById.get(n);r.visible(pe(r.fontSize(),e)&&!!a?.isVisible()&&i.focusedSeatOpacity(n,a?.getAbsoluteOpacity()??1)>=.5)}i.labelGroup.destroyChildren(),i.labelLiftGroups.clear(),i.seatLabelById.clear();let s=0;if(t)for(let n of i.visibleSeatCandidates()){if(n.kind==="booth")continue;let r=i.worldToScreen(n);if(r.x<-20||r.x>i.stage.width()+20||r.y<-20||r.y>i.stage.height()+20||i.accessGlyphById.has(n.id)&&i.accessGlyphShouldShow(n.id))continue;let a=i.circleById.get(n.id);if(!a?.isVisible()||i.focusedSeatOpacity(n.id,a.getAbsoluteOpacity())<.5)continue;let l=i.statusById.get(n.id)??"free",c=i.renderedSeatPoint(n),h=i.viewMode==="perspective"?i.perspectiveSeatScale.get(n.id)??1:1;if(l==="booked"||l==="held"&&!i.ownedHold.has(n.id)&&!i.opts.manageMode){let p=new Qn({x:c.x,y:c.y,listening:!1});if(p.scale({x:h,y:h}),l==="held"?(p.add(new jn({x:-4.2,y:-.7,width:8.4,height:6.5,cornerRadius:1.3,stroke:"#ffffff",strokeWidth:1.25,listening:!1})),p.add(new ko({points:[-2.4,-.8,-2.4,-2.7,-1.2,-4,0,-4.35,1.2,-4,2.4,-2.7,2.4,-.8],stroke:"#ffffff",strokeWidth:1.2,lineCap:"round",lineJoin:"round",listening:!1}))):p.add(new ko({points:[-4.2,4.2,4.2,-4.2],stroke:"#ffffff",strokeWidth:1.8,lineCap:"round",listening:!1})),i.seatLabelContainer(n.id).add(p),++s>=ni)break;continue}let d=de*i.seatLabelScale(n),m=new Lo({x:c.x,y:c.y,text:yt(n.displayLabel??n.label),fontSize:d,fontStyle:"600",fontFamily:i.labelFont(),fill:a?i.seatLabelInk(n,a):i.seatPreferredLabelInk(n),listening:!1,perfectDrawEnabled:!1}),y=i.seatR*2-3;if(m.width()>y&&m.fontSize(Math.max($e,d*y/m.width())),m.width()>y+.01){m.destroy();continue}if(!pe(m.fontSize(),e)){m.destroy();continue}if(m.offsetX(m.width()/2),m.offsetY(m.height()/2),m.scale({x:h,y:h}),i.seatLabelContainer(n.id).add(m),i.seatLabelById.set(n.id,m),++s>=ni)break}let o=new De;for(let{node:n}of i.freeTextById.values()){if(!n.isVisible())continue;let r=n.getClientRect({relativeTo:i.bgLayer,skipShadow:!0,skipStroke:!0});o.insert({x:r.x-Z,y:r.y-Z,width:r.width+Z*2,height:r.height+Z*2})}for(let n of i.rowLabelPlan){let r=i.focusedSectionId!=null&&n.focusKeys?.includes(i.focusedSectionId),a=r?Math.max(n.fontSize,As/Math.max(e,1e-4)):n.fontSize;if(!r&&!pe(a,e))continue;let l=i.worldToScreen({x:n.x,y:n.y});if(l.x<-40||l.x>i.stage.width()+40||l.y<-40||l.y>i.stage.height()+40)continue;let c=new Lo({x:n.x,y:n.y,text:n.text,fontSize:a,fontStyle:"700",fontFamily:i.labelFont(),fill:n.ink,rotation:n.rotation,opacity:n.opacity,shadowColor:"#05070c",shadowBlur:n.ink.toLowerCase()==="#ffffff"?5:0,shadowOpacity:n.ink.toLowerCase()==="#ffffff"?.8:0,shadowForStrokeEnabled:!1,listening:!1,perfectDrawEnabled:!1});c.offsetX(c.width()/2),c.offsetY(c.height()/2);let h=i.resolveAutomaticRowLabelPosition(c,n,o);c.position(h),c.setAttr("rowLabel",!0),o.insert(i.rowLabelBox(c,h)),i.labelGroup.add(c)}i.isoT>0&&i.viewMode!=="perspective"&&i.applyUprightLabels(),i.overlayLayer.batchDraw()}function tt(i){return{th:It*Math.PI/180*i.isoT,sg:1-(1-qe)*i.isoT}}function Io(i,e){let{th:t,sg:s}=tt(e),o=e.centre,n=i.x-o.x,r=i.y-o.y,a=n*Math.cos(t)-r*Math.sin(t),l=(n*Math.sin(t)+r*Math.cos(t))*s;return{x:o.x+a,y:o.y+l}}function Co(i,e){let{th:t,sg:s}=tt(e),o=e.centre,n=i.x-o.x,a=(i.y-o.y)/s,l=n*Math.cos(t)+a*Math.sin(t),c=-n*Math.sin(t)+a*Math.cos(t);return{x:o.x+l,y:o.y+c}}function Mo(i,e){let{th:t,sg:s}=tt(e),o=i*e.isoT;return{x:-(o/s)*Math.sin(t),y:-(o/s)*Math.cos(t)}}function Po(i,e,t){let s=ji(e);i.offset(t),i.position(te(e,t)),i.rotation(s.rotationDeg),i.scale({x:s.scaleX,y:s.scaleY}),i.skewX(s.skewX),i.skewY(0)}function xo(i){i.position({x:0,y:0}),i.offset({x:0,y:0}),i.scale({x:1,y:1}),i.rotation(0),i.skewX(0),i.skewY(0)}function Ro(i,e){let t=Math.hypot(e.x-i.surfaceFocal.x,e.y-i.surfaceFocal.y),s=Math.max(0,t-i.frontDistanceWorld);return i.liftWorld+s*Math.tan(i.rakeDeg*Math.PI/180)}function Eo(i,e,t){return i.perspectiveAffine?te(i.perspectiveAffine,e):te(t,e)}function Ao(i,e){return e?te(e,i):i}function Bo(i,e){let t=0;for(let f of i.seats){let d=Math.max(0,(f.eyeHeightM??Y)-Y);t=Math.max(t,d*Me)}for(let f of i.objects)f.type==="section"&&(t=Math.max(t,lt(f,{floorBaseHeightM:i.floorBaseHeightMFor(f.id)}).height*Me));let s=Ui(i.bounds,t),o=bt(s,s.target),n=Zi(o);e.seatLocal.clear(),e.seatProjected.clear(),e.seatDepth.clear(),e.seatScale.clear();let r=1/0,a=1/0,l=-1/0,c=-1/0;for(let f of i.seats){let d=Math.max(0,(f.eyeHeightM??Y)-Y),m=ue(s,f,d*Me),y={x:m.x,y:m.y};e.seatProjected.set(f.id,y),e.seatLocal.set(f.id,te(n,y)),e.seatDepth.set(f.id,m.depth),e.seatScale.set(f.id,m.scale),r=Math.min(r,m.x),a=Math.min(a,m.y),l=Math.max(l,m.x),c=Math.max(c,m.y)}for(let f of[{x:i.bounds.x,y:i.bounds.y},{x:i.bounds.x+i.bounds.width,y:i.bounds.y},{x:i.bounds.x+i.bounds.width,y:i.bounds.y+i.bounds.height},{x:i.bounds.x,y:i.bounds.y+i.bounds.height}]){let d=ue(s,f,0);r=Math.min(r,d.x),a=Math.min(a,d.y),l=Math.max(l,d.x),c=Math.max(c,d.y)}let h=Math.max(24,i.seatR*3);return{camera:s,baseAffine:o,baseInverse:n,bounds:Number.isFinite(r)?{x:r-h,y:a-h,width:Math.max(1,l-r+h*2),height:Math.max(1,c-a+h*2)}:null}}function Fo(i,e,t){let s=t?[...t].map(o=>i.seatById.get(o)).filter(o=>!!o):e?i.seats:[...i.perspectiveAppliedSeats].map(o=>i.seatById.get(o)).filter(o=>!!o);for(let o of s){if(e&&i.perspectiveAppliedSeats.has(o.id))continue;let n=e?i.perspectiveSeatProjected.get(o.id)??o:o,r=e?i.perspectiveSeatScale.get(o.id)??1:1,a=i.circleById.get(o.id);a?.position(n),a?.scale({x:r,y:r});let l=i.accessRingById.get(o.id);l?.position(n),l?.scale({x:r,y:r});let c=i.accessGlyphById.get(o.id);if(c){let f=i.seatR*1.5/oe;c.position(n),c.scale({x:f*r,y:f*r})}let h=i.boothLabelById.get(o.id);h?.position(n),h?.scale({x:r,y:r}),e&&i.perspectiveAppliedSeats.add(o.id)}e||i.perspectiveAppliedSeats.clear()}function ki(i){return i?.getAttr?.("seatId")??void 0}var ot=class ot{constructor(e,t={}){this.labelLiftGroups=new Map;this.seats=[];this.seatById=new Map;this.seatIndex=null;this.chartDoc=null;this.activeFloorId="";this.stacked=!1;this.floorOverview=!1;this.circleById=new Map;this.glyphMarkers=[];this.seatGlyphDetail=!0;this.boothDims=new Map;this.boothLabelById=new Map;this.seatLabelById=new Map;this.accessRingById=new Map;this.accessGlyphById=new Map;this.freeTextById=new Map;this.iconNodeById=new Map;this.primaryFocalLabels=new Map;this.gaById=new Map;this.statusById=new Map;this.catColor=new Map;this.catByKey=new Map;this.theme={};this.canvasBackground=yi;this.effSelection=je;this.colorblind=!1;this.cbHueByKey=new Map;this.rowLabelPlan=[];this.catOrder=[];this.selection=new Set;this.selectionMarkers=new Map;this.ownedHold=new Set;this.selectionFocusId=null;this.hoveredId=null;this.focusedId=null;this.accessFilter=null;this.categoryHighlight=null;this.categoryFilter=null;this.commercialLimitedFilter=!1;this.sections=[];this.zones=[];this.seatSection=new Map;this.unsectionedSeatGroup=null;this.catPrice=new Map;this.dimmedSections=new Set;this.sectionHeat=new Map;this.closedSections=new Set;this.focusedSectionId=null;this.focusBackdrop=null;this.focusDimOverlay=null;this.objectFloor=new Map;this.zoneColor=new Map;this.hasSections=!1;this.hasBoothText=!1;this.isoT=0;this.isoTarget=0;this.isoRaf=0;this.viewMode="flat";this.perspectiveCamera=null;this.perspectiveBaseAffine=null;this.perspectiveBaseInverse=null;this.perspectiveSeatLocal=new Map;this.perspectiveSeatProjected=new Map;this.perspectiveSeatDepth=new Map;this.perspectiveSeatScale=new Map;this.perspectiveAppliedSeats=new Set;this.perspectiveBounds=null;this.isoCentre={x:0,y:0};this.glideRaf=0;this.glideInProgress=!1;this.destroyed=!1;this.lodScale=0;this.reducedMotion=typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;this.fitScale=1;this.seatR=Xe;this.bounds={x:0,y:0,width:1,height:1};this.cached=!1;this.dpr=Math.min(typeof window<"u"&&window.devicePixelRatio||1,2);this.assetGeneration=0;this.assetPromises=[];this.assetErrors=[];this.assetCancels=new Set;this.rafId=0;this.frames=0;this.lastFpsAt=0;this.recacheTimer=null;this.resizeObs=null;this.viewChangeRaf=0;this.marquee=null;this.marqueeCur=null;this.onKeyDown=e=>{if(this.opts.manageMode){if((e.metaKey||e.ctrlKey)&&(e.key==="a"||e.key==="A")){e.preventDefault(),this.opts.onMarquee?.(this.selectAllSelectable());return}if(e.key==="Escape"&&this.selection.size){e.preventDefault(),this.clearSelection(),this.opts.onMarquee?.([]);return}}let t=e.key==="ArrowLeft"?{x:-1,y:0}:e.key==="ArrowRight"?{x:1,y:0}:e.key==="ArrowUp"?{x:0,y:-1}:e.key==="ArrowDown"?{x:0,y:1}:null;if(t){e.preventDefault();let s=this.focusedId?this.nearestSeat(this.focusedId,t):this.seats[0]?.id??null;s&&this.focusSeat(s);return}if((e.key==="Enter"||e.key===" ")&&this.focusedId){e.preventDefault(),this.toggleSeat(this.focusedId);let s=this.seatById.get(this.focusedId);s&&this.opts.onFocusSeat?.(s)}};this.container=e,this.opts={maxSelection:10,selectableStatuses:["free"],...t},this.exportMode=t.exportMode===!0,this.currency=t.currency;let s=_t.pixelRatio;this.exportMode&&(this.dpr=1),_t.pixelRatio=this.dpr,this.stage=new Jn({container:e,width:e.clientWidth||1,height:e.clientHeight||1,draggable:!1}),this.gestures=new Ft(this.pointerHost),this.exportMode||(e.style.touchAction="none",this.gestures.attach(),e.tabIndex<0&&(e.tabIndex=0),e.setAttribute("role","application"),e.getAttribute("aria-label")||e.setAttribute("aria-label",U("map.aria")),e.addEventListener("keydown",this.onKeyDown)),this.bgLayer=new wi({listening:!this.exportMode}),this.seatLayer=new wi({listening:!this.exportMode}),this.overlayLayer=new wi({listening:!1}),this.labelGroup=new ke({listening:!1}),this.overlayLayer.add(this.labelGroup),this.fgDecorGroup=new ke({listening:!1}),this.overlayLayer.add(this.fgDecorGroup),this.hoverRing=new Le({radius:Xe+2,stroke:"#ffffff",strokeWidth:2,opacity:.85,listening:!1,visible:!1,perfectDrawEnabled:!1,shadowForStrokeEnabled:!1}),this.overlayLayer.add(this.hoverRing),this.focusRing=new Le({radius:Xe+3,stroke:"#38bdf8",strokeWidth:2.5,dash:[4,3],opacity:.95,listening:!1,visible:!1,perfectDrawEnabled:!1,shadowForStrokeEnabled:!1}),this.overlayLayer.add(this.focusRing),this.stage.add(this.bgLayer,this.seatLayer,this.overlayLayer),this.exportMode&&(_t.pixelRatio=s),this.exportMode||(this.wireInteraction(),this.startFpsLoop()),!this.exportMode&&typeof ResizeObserver<"u"&&(this.resizeObs=new ResizeObserver(()=>this.handleResize()),this.resizeObs.observe(e))}get moved(){return this.gestures.moved}isGhostClick(e){return this.gestures.isGhostClick(e)}get pointerHost(){return{container:this.container,stage:this.stage,cancelGlide:()=>this.cancelGlide(),releaseSectionFocusDim:()=>this.releaseSectionFocusDim(),updateSeatGroupVisibility:()=>this.updateSeatGroupVisibility(),scheduleViewChange:()=>this.scheduleViewChange(),afterViewChange:()=>this.afterViewChange(),zoomBounds:()=>this.zoomBounds(),marqueeActive:()=>!!this.marquee,marqueeShouldStart:e=>!!(this.opts.manageMode&&this.opts.marqueeSelect&&e.pointerType!=="touch"&&e.button===0&&this.getRung()==="seats"),beginMarquee:e=>this.beginMarquee(e),updateMarquee:e=>this.updateMarquee(e),finishMarquee:()=>this.finishMarquee(),cancelMarquee:()=>this.cancelMarquee()}}setChart(e,t){if(e!==this.chartDoc&&(this.stacked=!1,this.floorOverview=!1),this.cancelAssetLoads(),this.chartDoc=e,this.activeFloorId=t?.floorId??ht(e)[0].id,this.objectFloor.clear(),e.floors&&e.floors.length>1)for(let o of e.floors)for(let n of o.objects)this.objectFloor.set(n.id,o.id),n.type==="section"&&n.logicalSectionId&&this.objectFloor.set(n.logicalSectionId,o.id);let s=this.floorView(e);this.focusedId=null,this.focusRing.visible(!1),this.bgLayer.destroyChildren(),this.focusDimOverlay?.destroy(),this.focusDimOverlay=null,this.seatLayer.clearCache(),this.seatLayer.listening(!this.exportMode),this.seatLayer.destroyChildren(),this.unsectionedSeatGroup=null,this.labelGroup.destroyChildren(),this.labelLiftGroups.clear(),this.fgDecorGroup.destroyChildren(),this.circleById.clear(),this.glyphMarkers=[],this.boothDims.clear(),this.boothLabelById.clear(),this.seatLabelById.clear(),this.accessRingById.clear(),this.accessGlyphById.clear(),this.freeTextById.clear(),this.iconNodeById.clear(),this.primaryFocalLabels.clear(),this.gaById.clear();for(let o of this.selectionMarkers.values())o.destroy();this.selectionMarkers.clear(),this.ownedHold.clear(),this.selectionFocusId=null,this.statusById.clear(),this.selection.clear(),this.seatById.clear(),this.seatIndex=null,this.cached=!1,this.accessFilter=null,this.sections=[],this.zones=[],this.seatSection.clear(),this.focusedSectionId=null,this.focusBackdrop=null,this.catPrice.clear(),this.zoneColor.clear(),this.lodScale=0,this.hasBoothText=!1,this.isoRaf&&(cancelAnimationFrame(this.isoRaf),this.isoRaf=0),this.isoT=0,this.isoTarget=0,this.viewMode="flat",this.perspectiveCamera=null,this.perspectiveBaseAffine=null,this.perspectiveBaseInverse=null,this.perspectiveSeatLocal.clear(),this.perspectiveSeatProjected.clear(),this.perspectiveSeatDepth.clear(),this.perspectiveSeatScale.clear(),this.perspectiveAppliedSeats.clear(),this.perspectiveBounds=null,this.resetLayerTransforms(),this.hasSections=s.objects.some(o=>o.type==="section");for(let o of e.zones??[])o.color&&this.zoneColor.set(o.id,o.color);this.seatLayer.opacity(1),this.hoverRing.visible(!1),this.hoveredId=null,this.theme=e.theme??{},this.seatR=O(this.theme.seatScale??1,.7,1.6)*Xe,this.container.style.background="",this.canvasBackground=this.resolveCanvasBackground(),this.container.style.background=this.canvasBackground,this.effSelection=this.resolveSelectionColor(),this.hoverRing.stroke(this.effSelection),this.hoverRing.radius(this.seatR+2),this.catColor.clear(),this.catByKey.clear(),this.catPrice.clear(),this.catOrder=e.categories.map(o=>o.key),this.cbHueByKey.clear(),[...this.catOrder].sort().forEach((o,n)=>{this.cbHueByKey.set(o,Et[n%Et.length])});for(let o of e.categories)this.catColor.set(o.key,o.color),this.catByKey.set(o.key,o),typeof o.price=="number"&&this.catPrice.set(o.key,o.price);for(let o of s.objects)o.type==="booth"&&this.boothDims.set(o.id,{width:o.width,height:o.height,rotation:o.rotation,...o.points&&o.points.length>=3?{points:o.points.map(n=>({x:n.x,y:n.y}))}:{}});this.seats=Ne(s,{floorBaseHeightM:this.stacked||this.floorOverview?0:this.floorBaseHeightMFor()});for(let o of this.seats)this.seatById.set(o.id,o),this.statusById.set(o.id,"free");this.seatIndex=qi(this.seats,{seatRadius:this.seatR}),this.bounds=Vi(s),this.isoCentre={x:this.bounds.x+this.bounds.width/2,y:this.bounds.y+this.bounds.height/2},this.buildPerspectiveProjection(s),this.renderBackground(s),this.unsectionedSeatGroup=new ke({listening:!this.exportMode}),this.seatLayer.add(this.unsectionedSeatGroup),this.renderSeats(),this.buildRowLabelPlan(s),this.overlayLayer.add(this.labelGroup),this.overlayLayer.add(this.fgDecorGroup),this.overlayLayer.add(this.hoverRing),this.overlayLayer.add(this.focusRing),this.zoomToFit()}floorView(e){if(!e.floors||!e.floors.length)return{...e,referenceImage:void 0,backgroundImage:xe(e)};if(this.floorOverview&&e.floors.length>=2)return{...Ni(e)?zi(e):Hi(e),referenceImage:void 0,backgroundImage:xe(e)};if(this.stacked&&e.floors.length>=2)return{...Gi(e),referenceImage:void 0,backgroundImage:xe(e)};let t=e.floors.find(s=>s.id===this.activeFloorId)??e.floors[0];return{...e,objects:t.objects,focalPoint:t.focalPoint,referenceImage:void 0,backgroundImage:xe(t),floors:void 0}}floorBaseHeightMFor(e){let t=this.chartDoc?.floors;if(!t?.length)return 0;let s=this.stacked&&e?this.objectFloor.get(e)??this.activeFloorId:this.activeFloorId;return t.find(o=>o.id===s)?.baseHeightM??0}setStacked(e){!this.chartDoc||e===this.stacked||!(this.chartDoc.floors&&this.chartDoc.floors.length>=2)||(this.stacked=e,e&&(this.floorOverview=!1),this.setChart(this.chartDoc,{floorId:this.activeFloorId}))}isStacked(){return this.stacked}setFloorOverview(e){!this.chartDoc||e===this.floorOverview||!(this.chartDoc.floors&&this.chartDoc.floors.length>=2)||(this.floorOverview=e,e&&(this.stacked=!1),this.setChart(this.chartDoc,{floorId:this.activeFloorId}))}isFloorOverview(){return this.floorOverview}setActiveFloor(e){!this.chartDoc||e===this.activeFloorId&&!this.floorOverview&&!this.stacked||(this.floorOverview=!1,this.stacked=!1,this.setChart(this.chartDoc,{floorId:e}))}getFloors(){return this.chartDoc?ht(this.chartDoc).map(e=>({id:e.id,name:e.name})):[]}getActiveFloorId(){return this.activeFloorId}setStatus(e,t){let s=!1,o=this.hasSections?new Set:null;for(let n of e){if(!this.statusById.has(n))continue;let r=this.statusById.get(n);this.statusById.set(n,t);let a=this.circleById.get(n);if(a&&(this.paintSeat(a,n),s=!0),o){let l=this.seatSection.get(n);l&&(r==="free"!=(t==="free")&&(l.free+=t==="free"?1:-1),o.add(l))}}if(o&&o.size){for(let n of o)this.refreshSectionFill(n);this.bgLayer.batchDraw()}s&&(this.cached?(this.recacheTimer&&clearTimeout(this.recacheTimer),this.recacheTimer=setTimeout(()=>this.cacheSeatLayer(),150)):this.seatLayer.batchDraw(),this.effScale()>re&&this.updateLabels())}setSeatCategories(e){let t=!1,s=new Set;for(let[n,r]of Object.entries(e)){let a=this.seatById.get(n);if(!a||!this.catColor.has(r)||a.categoryKey===r)continue;a.categoryKey=r;let l=this.circleById.get(n);l&&(this.paintSeat(l,n),t=!0);let c=this.seatSection.get(n);c&&s.add(c)}if(!t)return;let o=new Map((this.chartDoc?ht(this.chartDoc):[]).flatMap(n=>n.objects).filter(n=>n.type==="section").map(n=>[n.id,n]));for(let n of s){if(!o.get(n.id)?.color){let a=new Map;for(let l of n.memberIds){let c=this.seatById.get(l)?.categoryKey;c&&a.set(c,(a.get(c)??0)+1)}n.baseFill=Ut([...a].map(([l,c])=>({hex:this.catColor.get(l)??"#6e7bff",w:c})),"#3a4358")}this.refreshSectionFill(n)}s.size&&this.bgLayer.batchDraw(),this.cached?(this.recacheTimer&&clearTimeout(this.recacheTimer),this.recacheTimer=setTimeout(()=>this.cacheSeatLayer(),150)):this.seatLayer.batchDraw(),this.effScale()>re&&this.updateLabels()}setOwnedHold(e){let t=new Set((e??[]).filter(o=>this.statusById.has(o))),s=new Set([...this.ownedHold,...t]);this.ownedHold=t;for(let o of s){let n=this.circleById.get(o);n&&this.paintSeat(n,o),this.syncSelectionMarker(o)}s.size&&(this.cached?(this.recacheTimer&&clearTimeout(this.recacheTimer),this.recacheTimer=setTimeout(()=>this.cacheSeatLayer(),150)):this.seatLayer.batchDraw(),this.effScale()>re&&this.updateLabels(),this.overlayLayer.batchDraw())}setSelectionFocus(e){let t=e&&this.selection.has(e)?e:null;if(t===this.selectionFocusId)return;let s=this.selectionFocusId;this.selectionFocusId=t;for(let o of this.seats){let n=this.circleById.get(o.id);n&&this.paintSeat(n,o.id)}s&&this.syncSelectionMarker(s),t&&this.syncSelectionMarker(t);for(let[o,n]of this.selectionMarkers)n.opacity(!t||o===t?1:.2);this.cached?(this.seatLayer.clearCache(),this.cacheSeatLayer()):this.seatLayer.batchDraw(),this.overlayLayer.batchDraw()}getStatus(e){return this.statusById.get(e)??"free"}getSelection(){let e=[];for(let t of this.selection){let s=this.seatById.get(t);s&&e.push(s)}return e}clearSelection(){let e=[...this.selection];for(let t of e)this.setSelected(t,!1,!0);this.overlayLayer.batchDraw()}setMaxSelection(e){this.opts.maxSelection=Math.max(0,Math.floor(e))}select(e){let t=[];for(let s of e){if(this.selection.has(s)||!this.isSelectable(s))continue;if(this.selection.size>=this.opts.maxSelection){this.opts.onSelectionLimit?.(this.opts.maxSelection);break}this.setSelected(s,!0,!0);let o=this.seatById.get(s);o&&t.push(o)}return t.length&&this.overlayLayer.batchDraw(),t}setManageInteraction(e){this.marquee&&this.cancelMarquee(),this.gestures.resetPan(),this.opts.manageMode=e.manageMode,this.opts.marqueeSelect=e.marqueeSelect,this.opts.selectableStatuses=[...e.selectableStatuses],e.maxSelection!=null&&(this.opts.maxSelection=e.maxSelection);let t=[...this.selection].filter(s=>!this.isSelectable(s));t.length&&this.deselect(t),!e.manageMode&&this.selection.size&&this.clearSelection(),this.container.style.cursor="default",this.overlayLayer.batchDraw()}setSectionHeat(e){this.sectionHeat.clear();for(let[t,s]of Object.entries(e??{}))Number.isFinite(s)&&this.sectionHeat.set(t,Math.max(0,Math.min(1,s)));for(let t of this.sections)this.refreshSectionHeat(t);this.bgLayer.batchDraw()}deselect(e){let t=!1;for(let s of e)this.selection.has(s)&&(this.setSelected(s,!1,!0),t=!0);t&&this.overlayLayer.batchDraw()}selectAllSelectable(){if(!this.opts.manageMode)return[];let e=[];for(let t of this.seats)this.isSelectable(t.id)&&e.push(t.id);return this.selectMany(e)}selectByLabels(e){if(!this.opts.manageMode)return[];let t=new Set(e),s=[];for(let o of this.seats)t.has(o.label)&&this.isSelectable(o.id)&&s.push(o.id);return this.selectMany(s)}setEvidenceSelection(e){return!this.seatById.has(e)||!this.isSelectable(e)?!1:(this.selection.size&&this.clearSelection(),this.setSelected(e,!0),this.overlayLayer.batchDraw(),this.selection.has(e))}getSelectableInSection(e){let t=[],s=new Set;for(let o of this.sections)if(!(o.id!==e&&o.logicalId!==e&&o.zone!==e))for(let n of o.memberIds){if(s.has(n)||(s.add(n),!this.isSelectable(n)))continue;let r=this.seatById.get(n);r&&t.push(r)}return t}selectMany(e){let t=e.filter(o=>!this.selection.has(o));if(!t.length)return this.getSelection();let s=this.selection.size+t.length<=Bs;for(let o of t)if(s)this.setSelected(o,!0,!0);else{this.selection.add(o);let n=this.circleById.get(o);n&&this.paintSeat(n,o)}return this.cached||this.seatLayer.batchDraw(),this.overlayLayer.batchDraw(),this.getSelection()}beginMarquee(e){let t=this.screenToWorld(e),s=this.stage.scaleX()||1,o=new it({x:t.x,y:t.y,width:0,height:0,stroke:this.effSelection,strokeWidth:1.5/s,dash:[5/s,4/s],fill:"rgba(110,123,255,0.10)",listening:!1,perfectDrawEnabled:!1,shadowForStrokeEnabled:!1});this.overlayLayer.add(o),this.marquee={start:t,rect:o},this.marqueeCur=t,this.overlayLayer.batchDraw()}updateMarquee(e){if(!this.marquee)return;let t=this.screenToWorld(e),{start:s,rect:o}=this.marquee;o.setAttrs({x:Math.min(s.x,t.x),y:Math.min(s.y,t.y),width:Math.abs(t.x-s.x),height:Math.abs(t.y-s.y)}),this.marqueeCur=t,this.overlayLayer.batchDraw()}cancelMarquee(){this.marquee&&(this.marquee.rect.destroy(),this.marquee=null,this.marqueeCur=null,this.overlayLayer.batchDraw())}finishMarquee(){let e=this.marquee;if(this.marquee=null,!e)return;e.rect.destroy(),this.overlayLayer.batchDraw();let t=this.marqueeCur??e.start;this.marqueeCur=null;let s=Math.min(e.start.x,t.x),o=Math.max(e.start.x,t.x),n=Math.min(e.start.y,t.y),r=Math.max(e.start.y,t.y),a=this.stage.scaleX()||1;if((o-s)*a<4&&(r-n)*a<4){this.selection.size&&(this.clearSelection(),this.opts.onMarquee?.([]));return}let l=[];for(let c of this.seats){let h=this.renderedSeatPoint(c);h.x<s||h.x>o||h.y<n||h.y>r||this.isSelectable(c.id)&&l.push(c.id)}this.selectMany(l),this.opts.onMarquee?.(this.getSelection())}flashSeat(e,t="#f43f5e"){let s=this.seatById.get(e);if(!s)return;let o=this.renderedSeatPoint(s),n=new Le({x:o.x,y:o.y,radius:this.seatR,stroke:t,strokeWidth:3,opacity:.9,listening:!1,perfectDrawEnabled:!1,shadowForStrokeEnabled:!1}),r=this.viewMode==="perspective"?this.perspectiveSeatScale.get(e)??1:1;n.scale({x:r,y:r}),this.overlayLayer.add(n);let a=performance.now(),l=620,c=h=>{if(!n.getLayer())return;let f=Math.min(1,(h-a)/l);n.radius(this.seatR*(1+f*1.8)),n.opacity(.9*(1-f)),this.overlayLayer.batchDraw(),f<1?requestAnimationFrame(c):(n.destroy(),this.overlayLayer.batchDraw())};requestAnimationFrame(c)}flashSection(e,t="#22a06b"){let s=this.sections.filter(o=>o.id===e||o.zone===e);if(s.length)for(let o of s){let n=this.viewMode==="perspective"&&o.perspectiveAffine?o.outline.map(d=>this.perspectiveLocalPoint(this.projectedSectionPoint(o,d))):o.outline.map(d=>{let m=o.liftWorld>0?this.isoLiftLocal(o.liftWorld):{x:0,y:0};return{x:d.x+m.x,y:d.y+m.y}}),r=n.reduce((d,m)=>({x:d.x+m.x,y:d.y+m.y}),{x:0,y:0});r.x/=n.length,r.y/=n.length;let a=new st({x:r.x,y:r.y,points:n.flatMap(d=>[d.x-r.x,d.y-r.y]),closed:!0,stroke:t,strokeWidth:3,strokeScaleEnabled:!1,opacity:.92,listening:!1,perfectDrawEnabled:!1,shadowForStrokeEnabled:!0,shadowColor:t,shadowBlur:14,shadowOpacity:.7});this.overlayLayer.add(a),this.overlayLayer.batchDraw();let l=()=>{a.getLayer()&&(a.destroy(),this.overlayLayer.batchDraw())};if(this.reducedMotion||typeof document<"u"&&document.hidden){setTimeout(l,520);continue}let c=performance.now(),h=820,f=d=>{if(this.destroyed||!a.getLayer())return;let m=Math.min(1,(d-c)/h),p=1+(1-Math.pow(1-m,3))*.04;a.scale({x:p,y:p}),a.opacity(.92*(1-m)),this.overlayLayer.batchDraw(),m<1?requestAnimationFrame(f):l()};requestAnimationFrame(f)}}nearestSeat(e,t){let s=this.seatById.get(e);if(!s)return null;let o=this.viewMode==="perspective"?this.perspectiveSeatProjected.get(s.id)??s:s,n=null,r=1/0;for(let a of this.seats){if(a.id===e)continue;let l=this.viewMode==="perspective"?this.perspectiveSeatProjected.get(a.id)??a:a,c=l.x-o.x,h=l.y-o.y,f=c*t.x+h*t.y;if(f<=.5)continue;let d=Math.abs(c*t.y-h*t.x),m=f+d*2.5;m<r&&(r=m,n=a.id)}return n}focusSeat(e){let t=this.seatById.get(e);if(!t)return;this.focusedId=e,this.focusRing.radius(this.seatR+3),this.focusRing.position(this.renderedSeatPoint(t));let s=this.viewMode==="perspective"?this.perspectiveSeatScale.get(e)??1:1;this.focusRing.scale({x:s,y:s}),this.focusRing.visible(!0),this.ensureVisible(t),this.overlayLayer.batchDraw(),this.opts.onFocusSeat?.(t)}ensureVisible(e){let t=this.stage.width(),s=this.stage.height(),o=Math.max(this.stage.scaleX(),ve*1.2),n=this.worldToScreen(e),r=70,a=n.x<r||n.x>t-r||n.y<r||n.y>s-r;if(this.stage.scaleX()<o||a){let l=this.renderedSeatPoint(e),c=this.viewMode==="perspective"&&this.perspectiveBaseAffine?te(this.perspectiveBaseAffine,l):this.isoT===0?l:this.isoForward(l);this.stage.scale({x:o,y:o}),this.stage.position({x:t/2-c.x*o,y:s/2-c.y*o}),this.afterViewChange(),this.stage.batchDraw()}}zoomToFit(){let e=this.stage.width(),t=this.stage.height(),s=this.viewMode==="perspective"&&this.perspectiveBounds?this.perspectiveBounds:this.bounds;if(this.fitScale=Math.min(e/s.width,t/s.height)||1,this.opts.portraitFitCrop&&!this.exportMode){let n=e/s.width<=t/s.height,r=s.height*this.fitScale;n&&r<.55*t&&(this.fitScale=Math.min(this.fitScale*1.3,.62*t/s.height))}let o=this.fitScale;this.stage.scale({x:o,y:o}),this.stage.position({x:(e-s.width*o)/2-s.x*o,y:(t-s.height*o)/2-s.y*o}),this.afterViewChange(),this.stage.batchDraw()}refitCurrentView(){if(this.focusedSectionId&&this.sectionBounds(this.focusedSectionId)){this.focusRegion(this.focusedSectionId,{animate:!1});return}this.zoomToFit()}zoomIn(){this.zoomAbout(this.stage.scaleX()*ot.ZOOM_STEP,ti(this.stage))}zoomOut(){this.zoomAbout(this.stage.scaleX()/ot.ZOOM_STEP,ti(this.stage))}zoomOutLevel(){let e=this.focusedSectionId;return e?this.sectionBounds(e)&&this.stage.scaleX()>this.sectionFrameScale(e)*1.05?(this.focusRegion(e),"section"):"venue":this.getRung()==="seats"?(this.setRung("sections"),"sections"):(this.cancelGlide(),this.zoomToFit(),"venue")}seatCount(){return this.seats.length}bookableCount(){let e=this.seats.length;for(let t of this.gaById.values())e+=t.capacity;return e}worldToScreen(e){let t=this.stage.scaleX(),s=e.id,o=typeof s=="string"?this.seatById.get(s):void 0;if(this.viewMode==="perspective"&&this.perspectiveBaseAffine){let a=o?this.perspectiveSeatProjected.get(o.id)??te(this.perspectiveBaseAffine,e):te(this.perspectiveBaseAffine,e);return{x:a.x*t+this.stage.x(),y:a.y*t+this.stage.y()}}let n=o?this.renderedSeatPoint(o):e,r=this.isoT===0?n:this.isoForward(n);return{x:r.x*t+this.stage.x(),y:r.y*t+this.stage.y()}}setAccessibleFilter(e){this.setAccessibilityFilter(e?[]:null)}setAccessibilityFilter(e){let t=e===null?null:[...e];if(!this.sameAccessFilter(t)){this.accessFilter=t,this.updateAccessGlyphs(this.effScale());for(let s of this.seats){let o=this.circleById.get(s.id);o&&this.paintSeat(o,s.id)}this.updateLabels(),this.cached?(this.seatLayer.clearCache(),this.cacheSeatLayer()):this.seatLayer.batchDraw()}}sameAccessFilter(e){let t=this.accessFilter;return t===null||e===null?t===e:t.length===e.length&&t.every((s,o)=>s===e[o])}setCommercialLimitedFilter(e){if(this.commercialLimitedFilter!==e){this.commercialLimitedFilter=e;for(let t of this.seats){let s=this.circleById.get(t.id);s&&this.paintSeat(s,t.id)}this.updateLabels(),this.cached?(this.seatLayer.clearCache(),this.cacheSeatLayer()):this.seatLayer.batchDraw()}}setCategoryFilter(e){let t=e===null?null:new Set(e);if(!io(t,this.categoryFilter)){this.categoryFilter=t;for(let s of this.seats){let o=this.circleById.get(s.id);o&&this.paintSeat(o,s.id)}this.updateLabels(),this.cached?(this.seatLayer.clearCache(),this.cacheSeatLayer()):this.seatLayer.batchDraw(),this.applyGAFilterState()}}applyGAFilterState(){this.paintGAStateForView(),this.updateFreeTextVisibility(),this.bgLayer.batchDraw()}paintGAStateForView(){eo({gaById:this.gaById,bgLayer:this.bgLayer,exportMode:this.exportMode,pickerMode:!!this.opts.gaPickerMode,selectionColor:this.effSelection,labelFont:()=>this.labelFont(),filteredOut:e=>!!(this.categoryFilter&&!this.categoryFilter.has(e)),dimmed:e=>Js(this.categoryHighlight,this.categoryFilter,e),overviewHidden:e=>!this.exportMode&&e.sectionId!=null&&this.effScale()<ne,effScale:()=>this.effScale(),labelLegible:e=>pe(e,this.effScale())})}setGAStates(e){to(this.gaById,e)&&this.applyGAFilterState()}setGAState(e,t){this.setGAStates({[e]:t})}focusCategories(e){if(!e?.length){this.focusRegion(this.bounds,{durationMs:Ct});return}let t=new Set(e),s=this.seats.filter(c=>!t.has(c.categoryKey)||this.seatInClosedSection(c.id)?!1:(this.statusById.get(c.id)??"free")==="free"||this.ownedHold.has(c.id));if(!s.length)return;let o=1/0,n=-1/0,r=1/0,a=-1/0;for(let c of s){let h=this.renderedSeatPoint(c);o=Math.min(o,h.x),n=Math.max(n,h.x),r=Math.min(r,h.y),a=Math.max(a,h.y)}let l=Math.max(24,this.seatR*3);o-=l,n+=l,r-=l,a+=l,this.focusRegion({x:o,y:r,width:Math.max(40,n-o),height:Math.max(40,a-r)},{durationMs:Ct})}setViewMode(e){if(e==="perspective"){if(this.viewMode===e){this.afterViewChange();return}let a=this.viewMode==="isometric"&&this.isoT>0;this.viewMode=e,this.isoTarget=1,this.isoT=1,this.isoRaf&&(cancelAnimationFrame(this.isoRaf),this.isoRaf=0),this.applyPerspective(a),this.zoomToFit();return}let t=e==="isometric"?1:0,s=this.viewMode==="perspective";if(this.viewMode=e,this.isoTarget=t,this.isoRaf&&(cancelAnimationFrame(this.isoRaf),this.isoRaf=0),s){this.isoT=t,this.applyIso(),this.afterViewChange();return}if(this.reducedMotion){this.isoT=t,this.applyIso(),this.afterViewChange();return}let o=this.isoT;if(o===t){this.applyIso(),this.afterViewChange();return}let n=performance.now(),r=a=>{if(this.destroyed)return;let l=Math.min(1,(a-n)/Fs),c=l<.5?4*l*l*l:1-Math.pow(-2*l+2,3)/2;this.isoT=o+(this.isoTarget-o)*c,this.applyIso(),this.scheduleViewChange(),l<1?this.isoRaf=requestAnimationFrame(r):(this.isoT=this.isoTarget,this.isoRaf=0,this.applyIso(),this.afterViewChange())};this.isoRaf=requestAnimationFrame(r)}getViewMode(){return this.viewMode}get isoState(){return{isoT:this.isoT,centre:this.isoCentre}}isoParams(){return tt(this.isoState)}effScale(){if(this.viewMode==="perspective"&&this.perspectiveBaseAffine){let e=Math.hypot(this.perspectiveBaseAffine.a,this.perspectiveBaseAffine.b),t=Math.hypot(this.perspectiveBaseAffine.c,this.perspectiveBaseAffine.d);return this.stage.scaleX()*Math.min(e,t)}return this.stage.scaleX()*(1-(1-qe)*this.isoT)}isoForward(e){return Io(e,this.isoState)}isoInverse(e){return Co(e,this.isoState)}buildPerspectiveProjection(e){let t=Bo({seats:this.seats,objects:e.objects,bounds:this.bounds,seatR:this.seatR,floorBaseHeightMFor:s=>this.floorBaseHeightMFor(s)},{seatLocal:this.perspectiveSeatLocal,seatProjected:this.perspectiveSeatProjected,seatDepth:this.perspectiveSeatDepth,seatScale:this.perspectiveSeatScale});this.perspectiveCamera=t.camera,this.perspectiveBaseAffine=t.baseAffine,this.perspectiveBaseInverse=t.baseInverse,this.perspectiveBounds=t.bounds}setContainerAffine(e,t,s){Po(e,t,s)}resetContainerTransform(e){xo(e)}sectionSurfaceHeight(e,t){return Ro(e,t)}projectedSectionPoint(e,t){return Eo(e,t,this.perspectiveBaseAffine)}perspectiveLocalPoint(e){return Ao(e,this.perspectiveBaseInverse)}isoLiftLocal(e){return Mo(e,this.isoState)}resetLayerTransforms(e=!0){let t=e?[this.bgLayer,this.seatLayer,this.overlayLayer]:[this.bgLayer,this.overlayLayer];for(let s of t)s.position({x:0,y:0}),s.offset({x:0,y:0}),s.scale({x:1,y:1}),s.rotation(0),s.skewX(0),s.skewY(0)}resetSectionProjection(e=!0){for(let t of this.sections){this.resetContainerTransform(t.rootGroupBg),this.resetContainerTransform(t.liftGroupBg),e&&this.resetContainerTransform(t.liftGroupSeat),t.rootGroupBg.zIndex(t.bgZIndex),e&&t.liftGroupSeat.zIndex(t.seatZIndex);let s=this.labelLiftGroups.get(t.id);s&&e&&this.resetContainerTransform(s),t.perspectiveAffine=void 0,t.perspectiveCorrection=void 0,t.perspectiveDepth=void 0}}get seatAnchorContext(){return{seats:this.seats,seatById:this.seatById,seatR:this.seatR,perspectiveSeatProjected:this.perspectiveSeatProjected,perspectiveSeatScale:this.perspectiveSeatScale,perspectiveAppliedSeats:this.perspectiveAppliedSeats,circleById:this.circleById,accessRingById:this.accessRingById,accessGlyphById:this.accessGlyphById,boothLabelById:this.boothLabelById}}applyExactSeatAnchors(e,t){Fo(this.seatAnchorContext,e,t)}applyPerspective(e=!0){let t=this.perspectiveCamera,s=this.perspectiveBaseAffine,o=this.perspectiveBaseInverse;if(!t||!s||!o)return;let n=this.seats.length>2500&&this.sections.length>0;this.cached&&!n&&(this.seatLayer.clearCache(),this.seatLayer.listening(!0),this.cached=!1),this.resetLayerTransforms(e),this.resetSectionProjection(e);for(let a of[this.bgLayer,this.overlayLayer])this.setContainerAffine(a,s,t.target);this.perspectiveAppliedSeats.clear(),n||this.applyExactSeatAnchors(!0);for(let a of this.sections){let l=f=>this.sectionSurfaceHeight(a,f),c=bt(t,a.centroid,l),h=Qi(o,c);a.perspectiveAffine=c,a.perspectiveCorrection=h,a.perspectiveDepth=ue(t,a.centroid,l(a.centroid)).depth,this.setContainerAffine(a.liftGroupBg,h,a.centroid);for(let f=0;f<a.sideFaces.length;f++){let d=a.outline[f],m=a.outline[(f+1)%a.outline.length],y=this.perspectiveLocalPoint(ue(t,d,0)),p=this.perspectiveLocalPoint(ue(t,m,0)),u=this.perspectiveLocalPoint(ue(t,m,l(m))),b=this.perspectiveLocalPoint(ue(t,d,l(d)));a.sideFaces[f].points([y.x,y.y,p.x,p.y,u.x,u.y,b.x,b.y]),a.sideFaces[f].opacity(.9)}}let r=[...this.sections].sort((a,l)=>(l.perspectiveDepth??0)-(a.perspectiveDepth??0));for(let a of r)a.rootGroupBg.moveToTop(),a.liftGroupSeat.moveToTop();this.unsectionedSeatGroup?.moveToTop(),this.syncSeatOverlayPositions(),n||this.updateSeatGroupVisibility(),this.bgLayer.batchDraw(),this.seatLayer.batchDraw(),this.overlayLayer.batchDraw()}applyIso(){if(this.resetSectionProjection(),this.applyExactSeatAnchors(!1),this.isoT===0)this.resetLayerTransforms();else{let{th:t,sg:s}=this.isoParams(),o=Math.cos(t),n=s*Math.sin(t),r=-Math.sin(t),a=s*Math.cos(t),l=Math.sqrt(o*o+n*n),c=o*a-n*r,h=Math.atan2(n,o)*180/Math.PI,f=l,d=c/l,m=(o*r+n*a)/c,y=this.isoCentre;for(let p of[this.bgLayer,this.seatLayer,this.overlayLayer])p.position({x:y.x,y:y.y}),p.offset({x:y.x,y:y.y}),p.rotation(h),p.scaleX(f),p.scaleY(d),p.skewX(m),p.skewY(0)}this.applyUprightLabels(),this.applyElevation(),this.updateSeatGroupVisibility(),this.bgLayer.batchDraw(),this.seatLayer.batchDraw(),this.overlayLayer.batchDraw()}applyUprightLabels(){let e=It*this.isoT,t=1/(1-(1-qe)*this.isoT),s=this.hasBoothText?[this.bgLayer,this.seatLayer,this.overlayLayer]:[this.bgLayer,this.overlayLayer];for(let o of s){let n=o.find("Text");for(let r of n){let a=r.getAttr("uprightBase");a==null&&(a=r.rotation(),r.setAttr("uprightBase",a)),r.rotation(a-e),r.scaleX(1),r.scaleY(t),r.skewX(0)}}}applyElevation(){let e=this.isoT;for(let t of this.sections){if(t.liftWorld<=0)continue;let s=this.isoLiftLocal(t.liftWorld);t.liftGroupBg?.position(s),t.liftGroupSeat.position(s),this.labelLiftGroups.get(t.id)?.position(s);let o=.9*e;for(let n=0;n<t.sideFaces.length;n++){let r=t.sideFaces[n],a=t.outline[n],l=t.outline[(n+1)%t.outline.length];r.points([a.x,a.y,l.x,l.y,l.x+s.x,l.y+s.y,a.x+s.x,a.y+s.y]),r.opacity(o)}}this.syncSeatOverlayPositions()}destroy(){this.destroyed=!0,this.cancelAssetLoads(),this.rafId&&cancelAnimationFrame(this.rafId),this.isoRaf&&cancelAnimationFrame(this.isoRaf),this.glideRaf&&cancelAnimationFrame(this.glideRaf),this.viewChangeRaf&&cancelAnimationFrame(this.viewChangeRaf),this.recacheTimer&&clearTimeout(this.recacheTimer),this.resizeObs?.disconnect(),this.gestures.detach(),this.container.removeEventListener("keydown",this.onKeyDown),this.stage.destroy()}labelFont(){return this.exportMode?this.theme.fontFamily?.toLowerCase().includes("jetbrains")?"JetBrains Mono, monospace":"Inter, sans-serif":this.theme.fontFamily||"Inter, sans-serif"}seatContainer(e){return this.seatSection.get(e)?.liftGroupSeat??this.unsectionedSeatGroup??this.seatLayer}sectionMatchesFocus(e){let t=this.focusedSectionId;return t==null||e.id===t||e.logicalId===t||e.zone===t}focusedSeatOpacity(e,t){if(!this.focusedSectionId)return t;let s=this.seatSection.get(e);return t*(s&&this.sectionMatchesFocus(s)?1:Be)}sectionScreenBounds(e){if(this.viewMode==="perspective"&&e.perspectiveAffine){let r=this.stage.scaleX(),a=this.stage.x(),l=this.stage.y();return V(e.outline.map(c=>{let h=this.projectedSectionPoint(e,c);return{x:h.x*r+a,y:h.y*r+l}}))}let t=e.liftWorld>0?this.isoLiftLocal(e.liftWorld):{x:0,y:0},s=this.stage.scaleX(),o=this.stage.x(),n=this.stage.y();return V(e.outline.map(r=>{let a={x:r.x+t.x,y:r.y+t.y},l=this.isoT===0?a:this.isoForward(a);return{x:l.x*s+o,y:l.y*s+n}}))}updateSeatGroupVisibility(){let e=this.exportMode||this.effScale()>=ne,t=this.viewMode==="perspective"&&this.glideInProgress&&this.seats.length>2500,s=96,o=this.stage.width(),n=this.stage.height();for(let r of this.sections){let a=!0;if(e){let c=this.sectionScreenBounds(r);a=c.x+c.width>=-s&&c.y+c.height>=-s&&c.x<=o+s&&c.y<=n+s,a&&this.viewMode==="perspective"&&!t&&this.applyExactSeatAnchors(!0,r.memberIds)}r.liftGroupSeat.setViewportCulled(!a),this.labelLiftGroups.get(r.id)?.setViewportCulled(!a)}this.unsectionedSeatGroup&&!this.unsectionedSeatGroup.visible()&&this.unsectionedSeatGroup.visible(!0),e&&this.viewMode==="perspective"&&!t&&this.applyExactSeatAnchors(!0,this.seats.filter(r=>!this.seatSection.has(r.id)).map(r=>r.id))}visibleSeatCandidates(){if(!this.sections.length)return this.seats;let e=[];for(let t of this.sections)if(!t.liftGroupSeat.isViewportCulled())for(let s of t.memberIds){let o=this.seatById.get(s);o&&e.push(o)}for(let t of this.seats)this.seatSection.has(t.id)||e.push(t);return e}seatViewportCulled(e){return this.seatSection.get(e)?.liftGroupSeat.isViewportCulled()??!1}renderedSeatPoint(e){if(this.viewMode==="perspective")return this.perspectiveSeatLocal.get(e.id)??e;let t=this.seatSection.get(e.id);if(!t||t.liftWorld<=0||this.isoT===0)return e;let s=this.isoLiftLocal(t.liftWorld);return{x:e.x+s.x,y:e.y+s.y}}seatLabelContainer(e){let t=this.seatSection.get(e);if(!t)return this.labelGroup;let s=this.labelLiftGroups.get(t.id);return s||(s=new Qe({listening:!1}),s.setViewportCulled(t.liftGroupSeat.isViewportCulled()),s.position(this.viewMode==="perspective"?{x:0,y:0}:this.isoLiftLocal(t.liftWorld)),this.labelGroup.add(s),this.labelLiftGroups.set(t.id,s)),s}syncSeatOverlayPositions(){if(this.hoveredId){let e=this.seatById.get(this.hoveredId);if(e){this.hoverRing.position(this.renderedSeatPoint(e));let t=this.viewMode==="perspective"?this.perspectiveSeatScale.get(e.id)??1:1;this.hoverRing.scale({x:t,y:t})}}if(this.focusedId){let e=this.seatById.get(this.focusedId);if(e){this.focusRing.position(this.renderedSeatPoint(e));let t=this.viewMode==="perspective"?this.perspectiveSeatScale.get(e.id)??1:1;this.focusRing.scale({x:t,y:t})}}for(let[e,t]of this.selectionMarkers){let s=this.seatById.get(e);if(s){t.position(this.renderedSeatPoint(s));let o=this.viewMode==="perspective"?this.perspectiveSeatScale.get(s.id)??1:1;t.scale({x:o,y:o})}}}renderSeats(){let e=[...this.seats].sort((t,s)=>(this.perspectiveSeatDepth.get(s.id)??0)-(this.perspectiveSeatDepth.get(t.id)??0));for(let t of e){if(t.kind==="booth"){this.renderBoothUnit(t);continue}let s=this.seatContainer(t.id),o=zs({x:t.x,y:t.y,radius:this.seatR,detail:this.seatGlyphDetail,glyph:ts(t.glyph,this.catByKey.get(t.categoryKey)),wheelchairBay:t.wheelchairSpaceType==="no-seat"});if(o instanceof Ze&&this.glyphMarkers.push(o),o.setAttr("seatId",t.id),this.circleById.set(t.id,o),this.paintSeat(o,t.id),s.add(o),t.accessible){if(t.wheelchairSpaceType!=="no-seat"){let n=new Le({x:t.x,y:t.y,radius:this.seatR+1.5,stroke:$t(t.accessibility),strokeWidth:2.5,listening:!1,perfectDrawEnabled:!1,shadowForStrokeEnabled:!1});this.accessRingById.set(t.id,n),s.add(n)}if(t.accessibility?.includes("wheelchair")&&Zt(t.accessibility)){let n=this.buildAccessGlyph(t,typeof o.fill()=="string"?o.fill():"");this.accessGlyphById.set(t.id,n),s.add(n)}}}}renderBoothUnit(e){let t=this.seatContainer(e.id),s=this.boothDims.get(e.rowId)??{width:40,height:30,rotation:0},o=e.x,n=e.y,r;s.points&&s.points.length>=3?(r=new st({x:e.x,y:e.y,points:s.points.flatMap(l=>[l.x,l.y]),closed:!0,perfectDrawEnabled:!1,shadowForStrokeEnabled:!1,hitStrokeWidth:0}),o=e.x+s.points.reduce((l,c)=>l+c.x,0)/s.points.length,n=e.y+s.points.reduce((l,c)=>l+c.y,0)/s.points.length):r=new it({x:e.x,y:e.y,width:s.width,height:s.height,offsetX:s.width/2,offsetY:s.height/2,rotation:s.rotation,cornerRadius:4,perfectDrawEnabled:!1,shadowForStrokeEnabled:!1,hitStrokeWidth:0}),r.setAttr("seatId",e.id),this.circleById.set(e.id,r),t.add(r);let a=new Te({x:o,y:n,text:e.displayLabel??e.label,fontSize:Pe,fontStyle:"600",fontFamily:this.labelFont(),fill:this.theme.seatLabelColor??Dt,listening:!1,perfectDrawEnabled:!1});a.offsetX(a.width()/2),a.offsetY(a.height()/2),a.visible(!1),this.hasBoothText=!0,this.boothLabelById.set(e.id,a),t.add(a),this.paintSeat(r,e.id)}buildAccessGlyph(e,t){let s=this.seatR*1.5/oe;return new er({x:e.x,y:e.y,data:Zt(e.accessibility??[])??"",offsetX:oe/2,offsetY:oe/2,scaleX:s,scaleY:s,fill:Qt(t),listening:!1,visible:!1,perfectDrawEnabled:!1,shadowForStrokeEnabled:!1})}updateAccessGlyphs(e){if(this.accessGlyphById.size)for(let[t,s]of this.accessGlyphById){let o=this.viewMode==="perspective"?this.perspectiveSeatScale.get(t)??1:1,n=this.seatR*1.5/oe*o,a=this.accessGlyphFilterEmphasized(t)?xs:Ps,l=Math.max(n,a/(oe*Math.max(e,.001)));s.scale({x:l,y:l}),s.visible(this.accessGlyphShouldShow(t))}}accessGlyphFilterEmphasized(e){let t=this.seatById.get(e),s=this.accessFilter;return!!t&&s!==null&&!!t.accessibility?.includes("wheelchair")&&(s.length===0||s.includes("wheelchair"))&&fi(t,s)}accessGlyphShouldShow(e){return this.accessGlyphById.has(e)&&this.accessGlyphEligible(e)}accessGlyphEligible(e){let t=this.statusById.get(e)??"free";return!(t==="booked"||t==="held"&&!this.ownedHold.has(e)&&!this.opts.manageMode)}categoryDisplayColor(e){return this.colorblind?this.cbHueByKey.get(e)??Et[0]:this.catColor.get(e)??"#6e7bff"}seatLabelScale(e){return(e.labelStyle?.size??18)/18}seatPreferredLabelInk(e){return e.labelStyle?.color??this.theme.seatLabelColor??Dt}seatLabelInk(e,t){let s=t.fill();return q(typeof s=="string"?s:"",this.seatPreferredLabelInk(e),mt)}paintSeat(e,t){let s=this.seatById.get(t),o=this.statusById.get(t)??"free",n=this.selection.has(t),r=this.categoryDisplayColor(s.categoryKey),a=this.boothLabelById.get(t);switch(e.dash([]),e.strokeWidth(0),e.stroke(""),e.opacity(1),o){case"free":e.fill(n&&this.effSelection===je?fe(r,.28):r);break;case"held":this.ownedHold.has(t)?(e.fill(fe(r,this.effSelection===je?.24:.1)),e.stroke(this.effSelection),e.strokeWidth(3)):e.fill(Ws);break;case"booked":this.colorblind?(e.fill("rgba(0,0,0,0)"),e.stroke(Rt),e.strokeWidth(1.5),e.opacity(.9)):(e.fill(Rt),e.opacity(.45));break;case"not_for_sale":e.fill(Rt),e.stroke(Ks),e.strokeWidth(1),e.dash([2,2]);break}if(s.wheelchairSpaceType==="no-seat"&&o==="free"&&(e.stroke($t(s.accessibility)),e.strokeWidth(n?3:2),e.dash([3,2])),a&&(a.text(o==="booked"?"SOLD":o==="held"?"HELD":s.label),a.fontSize(o==="free"?10:Math.min(10,Math.max(6,this.boothDims.get(s.rowId)?.width??40)/6)),a.fontStyle(o==="free"?"600":"800"),a.fill(o==="free"?this.theme.seatLabelColor??Dt:"#ffffff"),a.offsetX(a.width()/2),a.offsetY(a.height()/2)),this.accessFilter&&o==="free"&&!n&&!fi(s,this.accessFilter)&&e.opacity(.25),this.categoryHighlight&&o==="free"&&!n&&s.categoryKey!==this.categoryHighlight&&e.opacity(.25),this.categoryFilter&&o==="free"&&!n&&!this.categoryFilter.has(s.categoryKey)&&e.opacity(.22),this.commercialLimitedFilter&&o==="free"&&!n&&(s.commercial?.restrictedView||s.commercial?.obstructedView)&&e.opacity(.22),this.dimmedSections.size){let h=this.seatSection.get(t);(!h&&this.dimmedSections.has(Wi)||h&&(this.dimmedSections.has(h.id)||this.dimmedSections.has(h.logicalId)||h.zone!=null&&this.dimmedSections.has(h.zone)))&&e.opacity(.18)}this.closedSections.size&&this.seatInClosedSection(t)&&(e.fill(Xs),e.stroke(""),e.strokeWidth(0),e.dash([]),e.opacity($s)),this.selectionFocusId&&t!==this.selectionFocusId&&e.opacity(Math.min(e.opacity(),.16));let l=this.boothLabelById.get(t)??this.seatLabelById.get(t);l&&(l.fill(this.seatLabelInk(s,e)),l.visible(pe(l.fontSize(),this.effScale())&&e.opacity()>=.5));let c=this.accessGlyphById.get(t);if(c){let h=e.fill();c.fill(Qt(typeof h=="string"?h:"")),c.opacity(e.opacity()),c.visible(this.accessGlyphShouldShow(t))}this.accessRingById.get(t)?.opacity(e.opacity())}seatInClosedSection(e){if(!this.closedSections.size)return!1;let t=this.seatSection.get(e);return!!t&&(this.closedSections.has(t.id)||this.closedSections.has(t.logicalId)||t.zone!=null&&this.closedSections.has(t.zone))}setColorblindSafe(e){if(e!==this.colorblind){this.colorblind=e;for(let t of this.seats){let s=this.circleById.get(t.id);s&&this.paintSeat(s,t.id)}this.updateLabels(),this.cached?(this.seatLayer.clearCache(),this.cacheSeatLayer()):this.seatLayer.batchDraw()}}setDimmedSections(e){let t=new Set(e??[]);if(!(t.size===this.dimmedSections.size&&[...t].every(s=>this.dimmedSections.has(s)))){this.dimmedSections=t;for(let s of this.seats){let o=this.circleById.get(s.id);o&&this.paintSeat(o,s.id)}this.cached?(this.seatLayer.clearCache(),this.cacheSeatLayer()):this.seatLayer.batchDraw()}}setClosedSections(e){let t=new Set(e??[]);t.size===this.closedSections.size&&[...t].every(s=>this.closedSections.has(s))||(this.closedSections=t,this.repaintSectionsAndSeats())}focusSection(e){this.sections.some(t=>t.id===e||t.logicalId===e)&&(this.focusedSectionId=e,this.drawFocusBackdrop(e),this.bgLayer.batchDraw(),this.overlayLayer.batchDraw(),this.updateLOD(),this.focusRegion(e))}releaseSectionFocusDim(){!this.focusBackdrop&&!this.focusDimOverlay||(this.focusBackdrop?.destroy(),this.focusBackdrop=null,this.focusDimOverlay?.destroy(),this.focusDimOverlay=null,this.bgLayer.batchDraw(),this.overlayLayer.batchDraw())}clearSectionFocus(){this.focusedSectionId&&(this.focusedSectionId=null,this.focusBackdrop&&(this.focusBackdrop.destroy(),this.focusBackdrop=null),this.focusDimOverlay?.destroy(),this.focusDimOverlay=null,this.bgLayer.batchDraw(),this.overlayLayer.batchDraw(),this.updateLOD())}getFocusedSection(){return this.focusedSectionId}drawFocusBackdrop(e){this.focusBackdrop&&(this.focusBackdrop.destroy(),this.focusBackdrop=null);let t=this.sections.filter(o=>o.id===e||o.logicalId===e);if(!t.length)return;let s=new ke({listening:!1});for(let o of t){let n=this.viewMode==="perspective"&&o.perspectiveAffine,r=n?o.outline.map(l=>this.perspectiveLocalPoint(this.projectedSectionPoint(o,l))):o.outline,a=n?o.holes.map(l=>l.map(c=>this.perspectiveLocalPoint(this.projectedSectionPoint(o,c)))):o.holes;s.add(_e(r,a,{fill:Ys,stroke:se("#ffffff",.1),strokeWidth:1,listening:!1},n?void 0:o.outlinePath))}this.bgLayer.add(s),s.moveToTop(),this.focusBackdrop=s,this.drawFocusDimOverlay(t)}drawFocusDimOverlay(e){this.focusDimOverlay?.destroy();let s=Math.max(this.bounds.width,this.bounds.height,1)*4+1e3,o=[{x:this.bounds.x-s,y:this.bounds.y-s},{x:this.bounds.x+this.bounds.width+s,y:this.bounds.y-s},{x:this.bounds.x+this.bounds.width+s,y:this.bounds.y+this.bounds.height+s},{x:this.bounds.x-s,y:this.bounds.y+this.bounds.height+s}],n=new ir({fill:this.canvasBackground,opacity:1-Be,listening:!1,perfectDrawEnabled:!1,sceneFunc:(r,a)=>{let l=c=>{if(c.length){r.moveTo(c[0].x,c[0].y);for(let h=1;h<c.length;h++)r.lineTo(c[h].x,c[h].y);r.closePath()}};r.beginPath(),l(o);for(let c of e){let h=this.viewMode==="perspective"&&c.perspectiveAffine?c.outline.map(f=>this.perspectiveLocalPoint(this.projectedSectionPoint(c,f))):c.outline.map(f=>{let d=c.liftWorld>0?this.isoLiftLocal(c.liftWorld):{x:0,y:0};return{x:f.x+d.x,y:f.y+d.y}});l(We(h)>0?[...h].reverse():h)}r.fillStrokeShape(a)}});this.overlayLayer.add(n),n.moveToTop();for(let r of this.selectionMarkers.values())r.moveToTop();this.hoverRing.moveToTop(),this.focusRing.moveToTop(),this.focusDimOverlay=n}repaintSectionsAndSeats(){for(let e of this.seats){let t=this.circleById.get(e.id);t&&this.paintSeat(t,e.id)}for(let e of this.sections)e.blockPoly.fill(this.sectionBlockFill(e));this.cached?(this.seatLayer.clearCache(),this.cacheSeatLayer()):this.seatLayer.batchDraw(),this.bgLayer.batchDraw()}getVisibleWorldRect(){let e=this.screenToWorld({x:0,y:0}),t=this.screenToWorld({x:this.stage.width(),y:this.stage.height()});return{x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),width:Math.abs(t.x-e.x),height:Math.abs(t.y-e.y)}}getWorldBounds(){let e=1/0,t=1/0,s=-1/0,o=-1/0,n=(r,a)=>{r<e&&(e=r),a<t&&(t=a),r>s&&(s=r),a>o&&(o=a)};for(let r of this.seats)n(r.x,r.y);for(let r of this.sections)for(let a of r.outline)n(a.x,a.y);for(let r of this.gaById.values())for(let a of r.points)n(a.x,a.y);return Number.isFinite(e)?{x:e,y:t,width:Math.max(1,s-e),height:Math.max(1,o-t)}:{x:0,y:0,width:1,height:1}}getMinimapSnapshot(){let e=this.sections.map(t=>{let s=this.isSectionClosed(t)||t.free<=0,o=t.memberIds.some(r=>this.selection.has(r)),n=this.focusedSectionId===t.id||this.focusedSectionId===t.logicalId;return{id:t.logicalId,label:t.label,outline:t.outline.map(r=>({...r})),...this.objectFloor.get(t.id)?{floorId:this.objectFloor.get(t.id)}:{},state:o?"selected":s?"inactive":"available",active:n}});return{sections:e,seats:e.length?[]:this.seats.map(t=>({x:t.x,y:t.y,categoryKey:t.categoryKey,state:this.selection.has(t.id)?"selected":this.statusById.get(t.id)==="free"?"available":"inactive"}))}}panToWorld(e){this.cancelGlide();let t=this.worldToScreen(e);this.stage.position({x:this.stage.x()+this.stage.width()/2-t.x,y:this.stage.y()+this.stage.height()/2-t.y}),this.afterViewChange(),this.stage.batchDraw()}setCategoryHighlight(e){if(this.categoryHighlight!==e){this.categoryHighlight=e;for(let t of this.seats){let s=this.circleById.get(t.id);s&&this.paintSeat(s,t.id)}this.updateLabels(),this.cached?(this.seatLayer.clearCache(),this.cacheSeatLayer()):this.seatLayer.batchDraw(),this.applyGAFilterState()}}renderBackground(e){let t=xe(e);t&&this.renderBackgroundImage(t);for(let s of e.objects)s.type==="decorImage"&&this.renderDecorImage(s);for(let s of e.objects)s.type==="section"&&this.renderSection(s);this.renderZones(e);for(let s of e.objects)s.type==="shape"?this.renderShape(s):s.type==="gaArea"?this.renderGA(s):s.type==="table"?this.renderTable(s):s.type==="text"&&this.renderText(s)}trackAssetImage(e,t,s,o){let n=this.assetGeneration;/^https?:\/\//i.test(t)&&(e.crossOrigin="anonymous");let r=new Promise(a=>{let l=!1,c=()=>{l||(l=!0,this.assetCancels.delete(h),a())},h=()=>{e.onload=null,e.onerror=null;try{e.removeAttribute("src"),e.src=""}catch{}c()};this.assetCancels.add(h),e.onload=()=>{if(!this.exportMode){n===this.assetGeneration&&o(),c();return}(typeof e.decode=="function"?e.decode():Promise.resolve()).then(()=>{n===this.assetGeneration&&o()}).catch(()=>{n===this.assetGeneration&&this.assetErrors.push(`${s} could not be decoded.`)}).finally(c)},e.onerror=()=>{n===this.assetGeneration&&this.assetErrors.push(`${s} could not be loaded.`),c()},e.src=t});this.assetPromises.push(r)}cancelAssetLoads(){this.assetGeneration++;for(let e of[...this.assetCancels])e();this.assetCancels.clear(),this.assetPromises=[],this.assetErrors=[]}renderBackgroundImage(e){if(!e.url||e.visible===!1)return;let t=new window.Image;this.trackAssetImage(t,e.url,"Buyer background image",()=>{let s=t.naturalWidth||4,o=t.naturalHeight||3,n=e.crop??{x:0,y:0,width:1,height:1},r=Math.max(0,Math.min(.99,n.x)),a=Math.max(0,Math.min(.99,n.y)),l={x:r,y:a,width:Math.max(.01,Math.min(1-r,n.width)),height:Math.max(.01,Math.min(1-a,n.height))},c=e.width,h=c*(o*l.height/(s*l.width)),f=new tr({image:t,x:e.center.x,y:e.center.y,offsetX:c/2,offsetY:h/2,width:c,height:h,rotation:e.rotation??0,crop:{x:l.x*s,y:l.y*o,width:l.width*s,height:l.height*o},opacity:e.opacity,listening:!1});this.bgLayer.add(f),f.moveToBottom(),this.bgLayer.batchDraw()})}get objectDrawContext(){return{bgLayer:this.bgLayer,fgDecorGroup:this.fgDecorGroup,container:this.container,opts:this.opts,theme:this.theme,canvasBackground:this.canvasBackground,catColor:this.catColor,sections:this.sections,freeTextById:this.freeTextById,gaById:this.gaById,iconNodeById:this.iconNodeById,primaryFocalLabels:this.primaryFocalLabels,labelFont:()=>this.labelFont(),trackAssetImage:(e,t,s,o)=>this.trackAssetImage(e,t,s,o),isGhostClick:e=>this.isGhostClick(e)}}renderDecorImage(e){po(this.objectDrawContext,e)}renderTable(e){uo(this.objectDrawContext,e)}renderText(e){fo(this.objectDrawContext,e)}renderShape(e){yo(this.objectDrawContext,e)}renderGA(e){mo(this.objectDrawContext,e)}renderSection(e){let t=ct(e.outline,e.holes),s=ae(this.canvasBackground),o=[],n=new Map,r=0,a=V(e.outline),l=this.seatIndex?gt(this.seatIndex,a).map(C=>this.seatById.get(C)).filter(C=>!!C):this.seats;for(let C of l)this.seatSection.has(C.id)||J(C,e.outline,e.holes)&&(o.push(C.id),n.set(C.categoryKey,(n.get(C.categoryKey)??0)+1),(this.statusById.get(C.id)??"free")==="free"&&r++);let c=e.color??Ut([...n].map(([C,R])=>({hex:this.catColor.get(C)??"#6e7bff",w:R})),"#3a4358"),h=_i(e.elevation),f=lt(e,{floorBaseHeightM:this.floorBaseHeightMFor(e.id)}),d=f.height*Me,m=new ke({listening:!1});this.bgLayer.add(m);let y=new ke({listening:!1});m.add(y);let p=new Qe({listening:!0});this.seatLayer.add(p);let u=[];if(d>0){let C=he(this.zoneColor.get(e.zone??"")??c,.42);for(let R=0;R<e.outline.length;R++){let B=new st({points:[],closed:!0,fill:C,stroke:se("#000000",.25),strokeWidth:1,opacity:0,listening:!1,perfectDrawEnabled:!1});u.push(B),m.add(B)}}y.moveToTop();let b=y,g=e.color??this.zoneColor.get(e.zone??"")??"#3a4358",w=_e(e.outline,e.holes,{stroke:se(g,.5),strokeWidth:1,fill:se(g,.08),listening:!1},e.outlinePath);b.add(w);let k=_e(e.outline,e.holes,{fill:s.sectionFill,stroke:s.sectionStroke,strokeWidth:Mt,opacity:0,listening:!1},e.outlinePath);b.add(k);let L=e.labelPresentation?.labelStyle,S=L?.color??s.sectionInk,v=(L?.size??18)/18,x=new Te({x:e.labelPresentation?.position?.x??t.x,y:e.labelPresentation?.position?.y??t.y,text:e.displayLabel??e.label,rotation:e.labelPresentation?.rotation??0,visible:e.labelPresentation?.visible!==!1,fontSize:18*v,fontStyle:ai,fontFamily:this.labelFont(),fill:q(s.sectionFill,S),listening:!1,perfectDrawEnabled:!1});x.offsetX(x.width()/2),x.offsetY(x.height()/2),b.add(x);let I=new Te({x:t.x,y:t.y,text:U("map.seatsLeft",{count:r}),fontSize:12,fontStyle:li,fontFamily:"JetBrains Mono, ui-monospace, monospace",fill:s.sectionInk,opacity:0,listening:!1,perfectDrawEnabled:!1});I.offsetX(I.width()/2),b.add(I);let T={id:e.id,logicalId:e.logicalSectionId??e.id,label:e.displayLabel??e.label,outline:e.outline,...e.outlinePath?{outlinePath:e.outlinePath}:{},holes:e.holes??[],centroid:t,labelAnchors:qs(e.outline,e.holes??[],t),memberCategoryKeys:new Set(o.map(C=>this.seatById.get(C)?.categoryKey).filter(Boolean)),labelArea:Fi(e.outline,e.holes),zone:e.zone,memberIds:o,total:o.length,free:r,baseFill:c,outlineTint:g,outlinePoly:w,blockPoly:k,nameLabel:x,subLabel:I,preferredInk:S,labelScale:v,nameLabelFits:!1,subLabelFits:!0,elevation:h,liftWorld:d,rakeDeg:f.rake,surfaceFocal:o.length?{...this.seatById.get(o[0])?.focalPoint??this.isoCentre}:{...this.chartDoc?.focalPoint??this.isoCentre},frontDistanceWorld:0,rootGroupBg:m,bgZIndex:m.zIndex(),seatZIndex:p.zIndex(),liftGroupBg:y,liftGroupSeat:p,sideFaces:u},P=o.map(C=>this.seatById.get(C)).filter(C=>!!C),M=P.length?P:e.outline;T.frontDistanceWorld=Math.min(...M.map(C=>Math.hypot(C.x-T.surfaceFocal.x,C.y-T.surfaceFocal.y)));for(let C of o)this.seatSection.set(C,T);this.refreshSectionFill(T),this.refreshSectionHeat(T),this.sections.push(T)}refreshSectionHeat(e){So(this.sectionLodPaintContext,e)}refreshSectionFill(e){vo(this.sectionLodPaintContext,e)}isSectionClosed(e){return Si(this.sectionLodPaintContext,e)}sectionAvailabilityState(e){return vi(this.sectionLodPaintContext,e)}sectionBlockFill(e){return Fe(ae(this.canvasBackground),this.sectionAvailabilityState(e))}get sectionLodPaintContext(){return{sections:this.sections,zones:this.zones,sectionHeat:this.sectionHeat,closedSections:this.closedSections,canvasBackground:this.canvasBackground,bgLayer:this.bgLayer,seatLayer:this.seatLayer,stageScaleX:this.stage.scaleX(),stageWidth:this.stage.width(),floorOverview:this.floorOverview,focusedSectionId:this.focusedSectionId,categoryFilter:this.categoryFilter,hasFocusDimOverlay:!!this.focusDimOverlay,viewMode:this.viewMode,glideInProgress:this.glideInProgress,reducedMotion:this.reducedMotion,isoT:this.isoT,seatCount:this.seats.length,lodScale:this.lodScale,setLodScale:e=>{this.lodScale=e},worldToScreen:e=>this.worldToScreen(e)}}renderZones(e){if(!e.zones?.length||!this.sections.length)return;let t=new Map;for(let s of this.sections)s.zone&&(t.get(s.zone)??t.set(s.zone,[]).get(s.zone)).push(s);for(let s of e.zones){let o=t.get(s.id);if(!o||!o.length)continue;let n=o[0];for(let d of o)d.centroid.y<n.centroid.y&&(n=d);let r=n.centroid.x,a=n.centroid.y,l=1/0;for(let d of o)for(let m of d.memberIds){let y=this.seatById.get(m),p=y&&this.catPrice.get(y.categoryKey);typeof p=="number"&&p<l&&(l=p)}let c=new it({x:r,y:a,width:1,height:1,offsetX:.5,offsetY:.5,cornerRadius:1,fill:pi,stroke:s.color??n.outlineTint,strokeWidth:1,opacity:0,listening:!1,perfectDrawEnabled:!1});this.bgLayer.add(c);let h=new Te({x:r,y:a,text:s.label.toUpperCase(),fontSize:Pt,fontStyle:ai,letterSpacing:.5,fontFamily:this.labelFont(),fill:"#f4f6fb",opacity:0,listening:!1,perfectDrawEnabled:!1});h.offsetX(h.width()/2),h.offsetY(h.height()/2),this.bgLayer.add(h);let f=null;isFinite(l)&&(f=new Te({x:r,y:a,text:U("map.fromPrice",{price:ii(l,this.currency)}),fontSize:xt,fontStyle:li,fontFamily:"JetBrains Mono, ui-monospace, monospace",fill:"#cbd5e1",opacity:0,listening:!1,perfectDrawEnabled:!1}),f.offsetX(f.width()/2),this.bgLayer.add(f)),this.zones.push({id:s.id,anchor:{x:r,y:a},back:c,background:pi,label:h,sub:f})}}screenToWorld(e){let t=this.stage.scaleX(),s={x:(e.x-this.stage.x())/t,y:(e.y-this.stage.y())/t};return this.viewMode==="perspective"&&this.perspectiveBaseInverse?te(this.perspectiveBaseInverse,s):this.isoT===0?s:this.isoInverse(s)}sectionAt(e){if(!this.sections.length)return null;let t=this.screenToWorld(e),s=this.sections.find(o=>{if(this.viewMode==="perspective"&&o.perspectiveAffine)return J(t,o.outline.map(r=>this.perspectiveLocalPoint(this.projectedSectionPoint(o,r))),o.holes.map(r=>r.map(a=>this.perspectiveLocalPoint(this.projectedSectionPoint(o,a)))));let n=o.liftWorld>0?this.isoLiftLocal(o.liftWorld):{x:0,y:0};return J({x:t.x-n.x,y:t.y-n.y},o.outline,o.holes)});return s?s.logicalId:null}sectionMembers(e){return[...new Set(this.sections.filter(t=>t.id===e||t.logicalId===e||t.zone===e).flatMap(t=>t.memberIds))]}isSelectable(e){return this.seatInClosedSection(e)?!1:(this.opts.selectableStatuses??["free"]).includes(this.statusById.get(e)??"free")}toggleSeat(e){if(this.selection.has(e)){this.setSelected(e,!1);let t=this.seatById.get(e);t&&this.opts.onDeselect?.(t)}else{if(!this.isSelectable(e))return;if(this.selection.size>=this.opts.maxSelection){this.opts.onSelectionLimit?.(this.opts.maxSelection);return}this.setSelected(e,!0);let t=this.seatById.get(e);t&&this.opts.onSelect?.(t)}this.overlayLayer.batchDraw()}resolveCanvasBackground(){let e=this.theme.background?qt(this.theme.background):null;if(e)return e;if(typeof getComputedStyle=="function"){let t=this.container;for(;t;){let s=qt(getComputedStyle(t).backgroundColor);if(s)return s;t=t.parentElement}}return yi}resolveSelectionColor(){return this.theme.selectionColor?this.theme.selectionColor:Ve(this.canvasBackground)?ro:je}setSelected(e,t,s=!1){let o=this.circleById.get(e);t?this.selection.add(e):(this.selectionFocusId===e&&this.setSelectionFocus(null),this.selection.delete(e)),this.syncSelectionMarker(e),o&&(this.paintSeat(o,e),!s&&!this.cached&&this.seatLayer.batchDraw())}syncSelectionMarker(e){if(this.selectionMarkers.get(e)?.destroy(),this.selectionMarkers.delete(e),!this.selection.has(e)&&!this.ownedHold.has(e))return;let t=this.seatById.get(e);if(!t)return;let s=this.selectionFocusId===e,o=this.boothDims.get(t.rowId),n=this.renderedSeatPoint(t),r=new ke({name:"selection-ring",x:n.x,y:n.y,rotation:o?.rotation??0,listening:!1,perfectDrawEnabled:!1,opacity:this.selectionFocusId&&!s?.2:1});if(this.viewMode==="perspective"){let l=this.perspectiveSeatScale.get(e)??1;r.scale({x:l,y:l})}r.setAttr("seatId",e);let a={stroke:this.effSelection,listening:!1,perfectDrawEnabled:!1,shadowForStrokeEnabled:!1};if(o)if(r.add(new it({...a,width:o.width,height:o.height,offsetX:o.width/2,offsetY:o.height/2,cornerRadius:4,strokeWidth:s?4:3})),s)r.add(new it({...a,width:o.width+10,height:o.height+10,offsetX:(o.width+10)/2,offsetY:(o.height+10)/2,cornerRadius:7,strokeWidth:2,opacity:.55}));else{let l=Math.max(0,o.width/2-14),c=-Math.max(0,o.height/2-14);r.add(new Le({x:l,y:c,radius:10,fill:this.effSelection,listening:!1})),r.add(new st({x:l,y:c,points:[-4.5,0,-1,3.5,5.5,-4.5],stroke:Ve(this.effSelection)?"#0b1220":"#ffffff",strokeWidth:2.4,lineCap:"round",lineJoin:"round",listening:!1}))}else r.add(new Le({...a,radius:Math.max(1,this.seatR-1.25),strokeWidth:Math.min(2.5,Math.max(1.8,this.seatR*.22))})),s?r.add(new Le({...a,radius:this.seatR+2,strokeWidth:2,opacity:.55})):r.add(new st({points:[-this.seatR*.52,0,-this.seatR*.12,this.seatR*.4,this.seatR*.6,-this.seatR*.46],stroke:"#ffffff",strokeWidth:Math.max(2.6,this.seatR*.34),lineCap:"round",lineJoin:"round",shadowColor:"#0b1220",shadowBlur:1.5,shadowOpacity:.55,listening:!1}));this.selectionMarkers.set(e,r),this.overlayLayer.add(r)}sectionBounds(e){let t=this.sections.filter(y=>y.id===e||y.logicalId===e),s=t.map(y=>{if(this.viewMode==="perspective"&&y.perspectiveAffine)return V(y.outline.map(b=>this.projectedSectionPoint(y,b)));let p=y.liftWorld>0?this.isoLiftLocal(y.liftWorld):{x:0,y:0},u=y.outline.map(b=>{let g={x:b.x+p.x,y:b.y+p.y};return this.isoT===0?g:this.isoForward(g)});return V(u)});if(!s.length)return null;let o=Math.min(...s.map(y=>y.x)),n=Math.min(...s.map(y=>y.y)),r=Math.max(...s.map(y=>y.x+y.width)),a=Math.max(...s.map(y=>y.y+y.height)),l=new Set(t.flatMap(y=>y.memberIds));for(let y of l){let p=this.seatById.get(y);if(!p)continue;let u=this.renderedSeatPoint(p);o=Math.min(o,u.x-this.seatR),n=Math.min(n,u.y-this.seatR),r=Math.max(r,u.x+this.seatR),a=Math.max(a,u.y+this.seatR)}let c=y=>{[y.x,y.y,y.width,y.height].every(Number.isFinite)&&(o=Math.min(o,y.x),n=Math.min(n,y.y),r=Math.max(r,y.x+y.width),a=Math.max(a,y.y+y.height))},h=y=>{let p={x:y.x+y.width/2,y:y.y+y.height/2};return t.some(u=>J(p,u.outline,u.holes))};for(let{node:y,backdrop:p}of this.freeTextById.values()){let u=y.getClientRect({relativeTo:this.bgLayer,skipShadow:!0});h(u)&&(c(u),p&&c(p.getClientRect({relativeTo:this.bgLayer,skipShadow:!0})))}for(let{node:y}of this.iconNodeById.values()){let p=y.getClientRect({relativeTo:this.bgLayer,skipShadow:!0});h(p)&&c(p)}let f=new De;for(let{node:y}of this.freeTextById.values()){let p=y.getClientRect({relativeTo:this.bgLayer,skipShadow:!0,skipStroke:!0});f.insert({x:p.x-Z,y:p.y-Z,width:p.width+Z*2,height:p.height+Z*2})}for(let y of this.rowLabelPlan){let p=(y.focusKeys??[]).some(w=>w===e||t.some(k=>w===k.id||w===k.logicalId)),u=new Te({text:y.text,fontSize:y.fontSize,fontStyle:"700",fontFamily:this.labelFont(),rotation:y.rotation,listening:!1});u.offsetX(u.width()/2),u.offsetY(u.height()/2);let b=this.resolveAutomaticRowLabelPosition(u,y,f),g=this.rowLabelBox(u,b);p&&c(g),f.insert(g),u.destroy()}let d=Math.max(r-o,a-n),m=Math.max(this.seatR*2,Math.min(24,d*.025));return{x:o-m,y:n-m,width:Math.max(1,r-o+m*2),height:Math.max(1,a-n+m*2)}}sectionFrameScale(e){let t=this.sectionBounds(e);return t?ys(this.stage,t,this.zoomBounds()):this.stage.scaleX()}handleSeatTap(e){if((this.stacked||this.floorOverview)&&this.opts.onDeckTap){let t=this.objectFloor.get(this.seatById.get(e)?.rowId??"");if(t){this.opts.onDeckTap(t);return}}if(this.effScale()<re&&this.sections.length){let t=this.seatSection.get(e);if(t){let s=this.focusedSectionId===t.logicalId,o=this.sectionFrameScale(t.logicalId)>this.stage.scaleX()*1.02;if(!s&&o){this.opts.onSectionTap?this.opts.onSectionTap(t.logicalId):this.focusSection(t.logicalId);return}}}this.toggleSeat(e)}nearestSeatToScreen(e,t){let s=null,o=1/0,n=this.stage.scaleX()||1;for(let r of this.seats){if(!this.selection.has(r.id)&&!this.isSelectable(r.id))continue;let a=this.worldToScreen(r),l=this.viewMode==="perspective"?this.perspectiveSeatScale.get(r.id)??1:1,c=this.seatR*n*l+t,h=Math.hypot(a.x-e.x,a.y-e.y);h<=c&&h<o&&(o=h,s=r.id)}return s}wireInteraction(){this.seatLayer.on("click tap",e=>{if(this.moved>we||this.isGhostClick(e))return;let t=ki(e.target);t&&this.handleSeatTap(t)}),this.seatLayer.on("mouseover",e=>{let t=ki(e.target);if(!t)return;let s=this.seatById.get(t);if(!s)return;this.hoveredId=t,this.hoverRing.position(this.renderedSeatPoint(s));let o=this.viewMode==="perspective"?this.perspectiveSeatScale.get(t)??1:1;this.hoverRing.scale({x:o,y:o}),this.hoverRing.visible(!0),this.overlayLayer.batchDraw(),this.container.style.cursor="pointer",this.opts.onHover?.(s)}),this.seatLayer.on("mouseout",()=>{this.hoveredId=null,this.hoverRing.visible(!1),this.overlayLayer.batchDraw(),this.container.style.cursor="default",this.opts.onHover?.(null)}),this.stage.on("wheel",e=>{e.evt.preventDefault(),this.releaseSectionFocusDim();let t=this.container.getBoundingClientRect(),s={x:e.evt.clientX-t.left,y:e.evt.clientY-t.top},o=Math.exp(-e.evt.deltaY*.002);this.zoomAbout(this.stage.scaleX()*O(o,.5,2),s)}),this.stage.on("click tap",e=>{if(this.moved>we||this.isGhostClick(e))return;let t=this.stage.getPointerPosition();if(!t)return;if(!this.cached){if(ki(e.target))return;let o=this.nearestSeatToScreen(t,Tt);o&&this.handleSeatTap(o);return}if((this.stacked||this.floorOverview)&&this.opts.onDeckTap){let o=this.floorOverview?this.sectionAt(t):null,n=(o?this.objectFloor.get(o):null)??this.deckFloorAt();if(n){this.opts.onDeckTap(n);return}}if(this.sections.length){let o=this.sectionAt(t);if(o){this.opts.onSectionTap?this.opts.onSectionTap(o):this.focusRegion(o);return}}let s=Math.max(ve*1.2,this.stage.scaleX()*2.5);this.zoomAbout(s,t)})}deckFloorAt(){if(!this.objectFloor.size)return null;let e=this.stage.getPointerPosition();if(!e)return null;let t=this.screenToWorld(e),s=null,o=1/0;for(let n of this.seats){let r=this.renderedSeatPoint(n),a=r.x-t.x,l=r.y-t.y,c=a*a+l*l;c<o&&(o=c,s=n.rowId)}return s?this.objectFloor.get(s)??null:null}zoomBounds(){let e=.5*this.fitScale;return this.zones.length&&(e=Math.min(e,Ae*.9)),{min:e,max:Math.max(10*this.fitScale,4)}}zoomAbout(e,t){ms(this.stage,e,t,this.zoomBounds())&&(this.afterViewChange(),this.stage.batchDraw())}zoomToBounds(e,t){gs(this.stage,e,this.zoomBounds(),t),this.afterViewChange(),this.stage.batchDraw()}focusRegion(e,t){let s=typeof e=="string"?this.sectionBounds(e):e;if(!s)return;if(this.cancelGlide(),t?.animate===!1||this.reducedMotion){this.zoomToBounds(s,t?.minScale);return}let o=this.stage.width(),n=this.stage.height(),{min:r,max:a}=this.zoomBounds(),l=1.12,c=Math.min(o/(s.width*l),n/(s.height*l)),h=O(Math.max(c,t?.minScale??r),r,a),f=o/2-(s.x+s.width/2)*h,d=n/2-(s.y+s.height/2)*h,m=this.stage.scaleX(),y=this.stage.x(),p=this.stage.y();if(Math.abs(h-m)<1e-4&&Math.abs(f-y)<.5&&Math.abs(d-p)<.5){this.afterViewChange();return}let u=performance.now(),b=Math.max(180,Math.min(1200,t?.durationMs??Ct));this.glideInProgress=!0;let g=w=>{if(this.destroyed){this.glideRaf=0,this.glideInProgress=!1;return}let k=Math.min(1,(w-u)/b),L=k<.5?4*k*k*k:1-Math.pow(-2*k+2,3)/2,S=m+(h-m)*L;this.stage.scale({x:S,y:S}),this.stage.position({x:y+(f-y)*L,y:p+(d-p)*L}),this.updateSeatGroupVisibility(),this.updateLOD(),this.scheduleViewChange(),this.stage.batchDraw(),k<1?this.glideRaf=requestAnimationFrame(g):(this.glideRaf=0,this.glideInProgress=!1,this.afterViewChange())};this.glideRaf=requestAnimationFrame(g)}cancelGlide(){this.glideRaf&&(cancelAnimationFrame(this.glideRaf),this.glideRaf=0),this.glideInProgress=!1}getRung(){let e=this.effScale();return e>=ne?"seats":this.zones.length&&e<Ae?"zones":"sections"}get renderedQualityContext(){return{stage:this.stage,overlayLayer:this.overlayLayer,labelGroup:this.labelGroup,viewMode:this.viewMode,cached:this.cached,effScale:()=>this.effScale(),getRung:()=>this.getRung(),worldToScreen:e=>this.worldToScreen(e),isoLiftLocal:e=>this.isoLiftLocal(e),seats:this.seats,sections:this.sections,zones:this.zones,seatSection:this.seatSection,statusById:this.statusById,selection:this.selection,circleById:this.circleById,seatLabelById:this.seatLabelById,boothLabelById:this.boothLabelById,accessGlyphById:this.accessGlyphById,freeTextById:this.freeTextById,gaById:this.gaById,perspectiveSeatProjected:this.perspectiveSeatProjected,perspectiveSeatScale:this.perspectiveSeatScale,seatR:this.seatR,canvasBackground:this.canvasBackground,effSelection:this.effSelection,categoryFilter:this.categoryFilter,focusedSectionId:this.focusedSectionId,focusBackdrop:this.focusBackdrop,isSelectable:e=>this.isSelectable(e),seatViewportCulled:e=>this.seatViewportCulled(e),focusedSeatOpacity:(e,t)=>this.focusedSeatOpacity(e,t),accessGlyphFilterEmphasized:e=>this.accessGlyphFilterEmphasized(e),seatLabelScale:e=>this.seatLabelScale(e),seatLabelInk:(e,t)=>this.seatLabelInk(e,t),seatPreferredLabelInk:e=>this.seatPreferredLabelInk(e)}}getRenderedQualityEvidence(){return no(this.renderedQualityContext)}setRung(e){if(e==="zones"){this.cancelGlide(),this.zoomToFit();return}let t=e==="sections"?(ye+ne)/2:Math.max(this.seatLabelTargetScale()*1.05,Rs,ne*1.3),s=this.stage.width(),o=this.stage.height(),n=this.getVisibleWorldRect(),r={x:n.x+n.width/2,y:n.y+n.height/2},a=r.x,l=r.y;if(e==="sections"&&this.sections.length>0){let d=this.sections.map(u=>{let b=V(u.outline);return{x:b.x+b.width/2,y:b.y+b.height/2}}),m=s/(t*2),y=o/(t*2);if(!d.some(u=>Math.abs(u.x-r.x)<=m&&Math.abs(u.y-r.y)<=y)){let u=d.reduce((b,g)=>{let w=(g.x-r.x)**2+(g.y-r.y)**2;return w<b.distance?{point:g,distance:w}:b},{point:d[0],distance:1/0});a=u.point.x,l=u.point.y}}let c=e==="seats"?this.seats.filter(d=>d.kind!=="booth"):[];if(c.length>0){let d=c[0],m=1/0;for(let y of c){let p=y.x-r.x,u=y.y-r.y,b=p*p+u*u;b<m&&(d=y,m=b)}a=d.x,l=d.y}let h=s/(t*1.12),f=o/(t*1.12);this.focusRegion({x:a-h/2,y:l-f/2,width:h,height:f})}seatLabelTargetScale(){let e=Pe,t=new Te({fontSize:de,fontStyle:"600",fontFamily:this.labelFont(),listening:!1}),s=this.seatR*2-3;for(let o of this.seats){if(o.kind==="booth"){e=Math.min(e,Pe);continue}let n=de*this.seatLabelScale(o);t.fontSize(n),t.text(yt(o.displayLabel??o.label));let r=t.width()>s?Math.max($e,n*s/t.width()):n;e=Math.min(e,r)}return t.destroy(),ee/Math.max($e,e)}afterViewChange(){this.updateSeatGroupVisibility(),this.updateLOD(),this.updateFreeTextVisibility(),this.updateLabels(),this.scheduleViewChange()}scheduleViewChange(){this.exportMode||this.viewChangeRaf||(this.viewChangeRaf=requestAnimationFrame(()=>{this.viewChangeRaf=0,this.opts.onViewChange?.()}))}sizeLabel(e,t,s){e.fontSize(Math.max(1,t)),e.offsetX(e.width()/2),e.offsetY(e.height()/2),e.y(s)}updateLOD(){let e=this.exportMode?Math.max(this.effScale(),Ee+.01,re):this.effScale(),t=Math.max(e,1e-4);for(let[n,r]of this.primaryFocalLabels)this.sizeLabel(n,r/t,n.y());this.hasSections?wo(this.sectionLodPaintContext,e):this.primaryFocalLabels.size&&this.bgLayer.batchDraw(),this.paintGAStateForView(),this.updateAccessGlyphs(e),this.seatGlyphDetail=Vs(this.glyphMarkers,this.seatR,e,this.seatGlyphDetail);let s=!this.exportMode&&e<ne;if(this.viewMode==="perspective"&&this.hasSections&&this.seats.length>2500&&s){this.seatLayer.listening(!1);return}s&&!this.cached?this.cacheSeatLayer():!s&&(this.cached||!this.seatLayer.listening())&&(this.cached&&this.releaseSeatLayerBitmap(),this.seatLayer.listening(!this.exportMode),this.cached=!1,this.seatLayer.batchDraw())}rebuildSeatCache(){this.updateSeatGroupVisibility();let e=O(this.stage.scaleX()*this.dpr,.15,2);this.seatLayer.clearCache(),this.seatLayer.cache({pixelRatio:e}),this.seatLayer.listening(!1),this.cached=!0}cacheSeatLayer(){this.rebuildSeatCache(),this.seatLayer.batchDraw()}releaseSeatLayerBitmap(){let e=this.seatLayer,t=e._cache.get("canvas");t&&(_t.Util.releaseCanvas(t.scene._canvas,t.filter._canvas,t.hit._canvas),e._cache.delete("canvas"))}forceDraw(){this.recacheTimer&&(clearTimeout(this.recacheTimer),this.recacheTimer=null,this.effScale()<ne?this.rebuildSeatCache():this.cached&&(this.releaseSeatLayerBitmap(),this.seatLayer.listening(!0),this.cached=!1)),this.bgLayer.draw(),this.seatLayer.draw(),this.overlayLayer.draw()}async ready(){let e=this.assetGeneration,t=typeof document<"u"&&"fonts"in document?document.fonts:null;if(await Promise.all([...this.assetPromises.slice(),...t?[t.ready.then(()=>{}),t.load("700 24px Inter").then(()=>{}),t.load('600 12px "JetBrains Mono"').then(()=>{})]:[]]),e!==this.assetGeneration)throw new Error("The chart changed while its export assets were loading.");if(this.assetErrors.length)throw new Error(`Export stopped because ${this.assetErrors.join(" ")}`);this.exportMode&&(this.fitExportContent(),this.forceDraw())}exportSceneBounds(){let e=[this.bgLayer,this.seatLayer,this.overlayLayer].map(r=>r.getClientRect({relativeTo:this.stage})).filter(r=>r.width>0&&r.height>0);if(!e.length)return this.bounds;let t=Math.min(...e.map(r=>r.x)),s=Math.min(...e.map(r=>r.y)),o=Math.max(...e.map(r=>r.x+r.width)),n=Math.max(...e.map(r=>r.y+r.height));return{x:t,y:s,width:Math.max(1,o-t),height:Math.max(1,n-s)}}fitExportContent(){if(!this.exportMode)return;let e=this.stage.width(),t=this.stage.height(),s=Math.max(12,Math.min(36,Math.min(e,t)*.025)),o=()=>{let n=this.exportSceneBounds(),r=Math.max(1,e-s*2),a=Math.max(1,t-s*2),l=Math.min(r/n.width,a/n.height)||1;this.fitScale=l,this.stage.scale({x:l,y:l}),this.stage.position({x:(e-n.width*l)/2-n.x*l,y:(t-n.height*l)/2-n.y*l}),this.afterViewChange()};o(),o()}captureCanvas(){if(!this.exportMode)throw new Error("captureCanvas() is available only on a renderer created with exportMode.");this.forceDraw();let e;try{e=this.stage.toCanvas({pixelRatio:1,imageSmoothingEnabled:!0})}catch(o){let n=o instanceof Error?o.message:String(o);throw new Error(`The chart canvas could not be captured. A buyer-visible image may block export. ${n}`)}let t=document.createElement("canvas");t.width=this.stage.width(),t.height=this.stage.height();let s=t.getContext("2d");if(!s)throw new Error("Canvas 2D is unavailable; this browser cannot create an export.");s.fillStyle=this.canvasBackground,s.fillRect(0,0,t.width,t.height);try{s.drawImage(e,0,0)}finally{e.width=1,e.height=1}return t}updateFreeTextVisibility(){let e=this.exportMode?Math.max(this.effScale(),re):this.effScale();for(let{node:t,backdrop:s,kind:o}of this.freeTextById.values()){if(o==="ga-label"||o==="ga-capacity")continue;let r=o==="free-text"&&this.nodeBelongsToFocusedSection(t)||pe(t.fontSize(),e);t.visible(r),s?.visible(r)}for(let{node:t,fontSize:s}of this.iconNodeById.values())t.visible(this.nodeBelongsToFocusedSection(t)||pe(s,e))}nodeBelongsToFocusedSection(e){let t=this.focusedSectionId;if(!t)return!1;let s=this.sections.filter(r=>r.id===t||r.logicalId===t||r.zone===t);if(!s.length)return!1;let o=e.getClientRect({relativeTo:this.bgLayer,skipShadow:!0}),n={x:o.x+o.width/2,y:o.y+o.height/2};return s.some(r=>J(n,r.outline,r.holes))}buildRowLabelPlan(e){this.rowLabelPlan=go(e,{theme:this.theme,seats:this.seats,seatSection:this.seatSection,seatR:this.seatR,objectFilteredOut:t=>this.objectFilteredOut(t)})}rowLabelBox(e,t,s=Z){return bi(e,t,s)}resolveAutomaticRowLabelPosition(e,t,s){return bo(e,t,s,this.seatIndex)}objectFilteredOut(e){let t=e.categoryKey;return t?!!(this.categoryHighlight&&t!==this.categoryHighlight||this.categoryFilter&&!this.categoryFilter.has(t)):!1}updateLabels(){To(this.viewportLabelContext)}get viewportLabelContext(){return{exportMode:this.exportMode,effScale:()=>this.effScale(),boothLabelById:this.boothLabelById,circleById:this.circleById,focusedSeatOpacity:(e,t)=>this.focusedSeatOpacity(e,t),labelGroup:this.labelGroup,labelLiftGroups:this.labelLiftGroups,seatLabelById:this.seatLabelById,visibleSeatCandidates:()=>this.visibleSeatCandidates(),worldToScreen:e=>this.worldToScreen(e),stage:this.stage,accessGlyphById:this.accessGlyphById,accessGlyphShouldShow:e=>this.accessGlyphShouldShow(e),statusById:this.statusById,renderedSeatPoint:e=>this.renderedSeatPoint(e),viewMode:this.viewMode,perspectiveSeatScale:this.perspectiveSeatScale,ownedHold:this.ownedHold,opts:this.opts,seatLabelContainer:e=>this.seatLabelContainer(e),seatLabelScale:e=>this.seatLabelScale(e),labelFont:()=>this.labelFont(),seatLabelInk:(e,t)=>this.seatLabelInk(e,t),seatPreferredLabelInk:e=>this.seatPreferredLabelInk(e),seatR:this.seatR,freeTextById:this.freeTextById,bgLayer:this.bgLayer,rowLabelPlan:this.rowLabelPlan,focusedSectionId:this.focusedSectionId,resolveAutomaticRowLabelPosition:(e,t,s)=>this.resolveAutomaticRowLabelPosition(e,t,s),rowLabelBox:(e,t)=>this.rowLabelBox(e,t),isoT:this.isoT,applyUprightLabels:()=>this.applyUprightLabels(),overlayLayer:this.overlayLayer}}handleResize(){let e=this.container.clientWidth||1,t=this.container.clientHeight||1;e===this.stage.width()&&t===this.stage.height()||(this.stage.size({width:e,height:t}),this.refitCurrentView())}startFpsLoop(){let e=t=>{this.lastFpsAt||(this.lastFpsAt=t),this.frames++;let s=t-this.lastFpsAt;s>=1e3&&(this.opts.onFps?.(Math.round(this.frames*1e3/s)),this.frames=0,this.lastFpsAt=t),this.rafId=requestAnimationFrame(e)};this.rafId=requestAnimationFrame(e)}};ot.ZOOM_STEP=1.4;var Li=ot;function Do(i,e){return new Li(i,e)}function _o(i,e={}){let{baseMs:t=1e3,factor:s=2,maxMs:o=1/0,jitter:n=0,random:r=Math.random}=e,a=Math.min(t*s**Math.max(0,i),o);if(n<=0)return a;let l=Math.min(1,n);return a*(1-l+l*r())}function Oo(i,e,t){return ze(i).map(s=>{let o=i.categories.find(n=>n.key===s.categoryKey);return{id:s.id,label:s.label,...s.displayLabel?{displayLabel:s.displayLabel}:{},...s.displayType?{displayType:s.displayType}:{},capacity:Math.max(0,Math.floor(s.capacity)),available:dt(s).filter(n=>t(n)==="free").length,categoryKey:s.categoryKey,tiers:o?.tiers,price:o?.tiers?.[0]?.price??o?.price??0,currency:e}})}function Go(i,e){let t={};for(let s of i)t[s.id]=e?{available:s.available,selected:e.get(s.id)??0}:{available:s.available};return t}function Ho(i){let e={};for(let[t,s]of i.seatById)i.groupedTableBySeatId.has(t)||i.closedMembers.has(t)||(i.statusOf(t)??"free")==="free"&&(e[s.categoryKey]=(e[s.categoryKey]??0)+1);for(let t of i.groupedTablesByLabel.values()){if(t.chairs.some(o=>i.closedMembers.has(o.id)))continue;let s=t.chairs[0];s&&(i.statusOf(s.id)??"free")==="free"&&(e[t.categoryKey]=(e[t.categoryKey]??0)+t.maxOccupancy)}for(let t of i.gaAreas??[])e[t.categoryKey]=(e[t.categoryKey]??0)+t.available;return e}var Ti=["background","rowLabelColor","textColor","selectionColor"];function No(i,e){return!i||!e?!i&&!e:Ti.every(t=>i[t]===e[t])}function nt(i){let e=i??{};return{status:e.status,conflicts:e.conflicts,reason:e.reason}}function Ot(i){return i==="blocked"?"not_for_sale":i==="held"||i==="booked"||i==="free"||i==="not_for_sale"?i:"free"}var me=class extends Error{constructor(t){super(t.message);this.status=422;this.name="PickerSelectionError",this.reason=t.code,this.labels=t.labels}};function zo(i){if(i!=null&&(!Number.isInteger(i)||i<1))throw new Error("picker: `numberOfPlacesToSelect` must be a positive integer");return i??null}function Vo(i,e,t,s){if(t!=null&&!Array.isArray(t))throw new TypeError("picker: `selectionValidators` must be an array");let o=[],n=0,r=!1,a=!1;for(let c of t??[])if(c?.type==="minimumSelectedPlaces"){if(!Number.isInteger(c.minimum)||Number(c.minimum)<1)throw new TypeError("picker: `minimumSelectedPlaces.minimum` must be a positive integer");n=Math.max(n,Number(c.minimum))}else if(c?.type==="consecutiveSeats")r=!0;else if(c?.type==="noOrphanSeats")a=!0;else throw new TypeError(`picker: unsupported selection validator "${String(c?.type??"")}"`);if(n&&o.push({type:"minimumSelectedPlaces",minimum:n}),r&&o.push({type:"consecutiveSeats"}),a&&o.push({type:"noOrphanSeats"}),i!=null&&n>i)throw new Error("picker: `minimumSelectedPlaces.minimum` cannot exceed `numberOfPlacesToSelect`");let l=Math.max(0,Math.floor(e??i??Math.max(s,n)));if(i!=null&&l<i)throw new Error("picker: `maxSelection` cannot be lower than `numberOfPlacesToSelect`");if(e!=null&&l<n)throw new Error("picker: `maxSelection` cannot be lower than `minimumSelectedPlaces.minimum`");return{validators:o,maxSelection:i??l}}function sr(i){let e=Number(i.slice(i.lastIndexOf(":")+1));return Number.isInteger(e)?e:-1}function or(i){if(i.length<=1)return!1;let e=i[0]?.objectId,t=i[0]?.categoryKey;if(!e||i.some(o=>o.objectId!==e||o.categoryKey!==t))return!0;let s=i.map(o=>sr(o.id)).sort((o,n)=>o-n);return s.some((o,n)=>o<0||n>0&&o!==s[n-1]+1)}function Wo(i,e,t,s,o){let n=s.find(l=>l.type==="minimumSelectedPlaces")?.minimum??0,r=t??n,a=[];return t!=null&&e!==t&&a.push("numberOfPlacesToSelect"),n&&e<n&&a.push("minimumSelectedPlaces"),s.some(l=>l.type==="consecutiveSeats")&&or(i)&&a.push("consecutiveSeats"),s.some(l=>l.type==="noOrphanSeats")&&o()&&a.push("noOrphanSeats"),{isValid:a.length===0,count:e,required:r,remaining:Math.max(0,r-e),seats:i,violations:a}}var nr=10,rr=15e3,Ko=class{constructor(e){this.selectableSeatIds=null;this.lastSelectionValidity=null;this.renderer=null;this.gaSelected=null;this._doc=null;this.hidden=new Set;this.mapTheme=null;this.closedSections=new Set;this.labelToId=new Map;this.labelToSeat=new Map;this.expandedSeats=[];this.seatTiers=new Map;this.seatById=new Map;this.seatContext=new Map;this.allIds=[];this.groupedTablesByObject=new Map;this.groupedTablesByLabel=new Map;this.groupedTableBySeatId=new Map;this.tableQuantities=new Map;this.confirmedVariableTables=new Set;this.groupedSelectionOverhead=0;this.ws=null;this.realtime=null;this.reconnectTimer=null;this.attempt=0;this.closed=!1;this.onVisibilityChange=null;this.hold_=null;this.liveStatuses=new Map;this.liveDefault="free";this.currency="USD";this.expiryTimer=null;this.hintShown=!1;this.opts=e,this.api=e.transport,this.key=e.eventKey,this.numberOfPlacesToSelect=zo(e.numberOfPlacesToSelect);let t=Vo(this.numberOfPlacesToSelect,e.maxSelection,e.selectionValidators,nr);this.selectionValidators=t.validators,this.maxSelection=t.maxSelection,this.selectableObjectRefs=e.selectableObjects==null?null:[...new Set(e.selectableObjects.filter(s=>typeof s=="string"&&!!s))],this.mapTheme=e.mapTheme??null}get doc(){return this._doc}visibleDoc(){if(!this._doc)return{objects:[]};let e=Ki(this._doc,this.hidden);if(!this.mapTheme)return e;let t={...e.theme??{}};for(let s of Ti){let o=this.mapTheme[s];o&&(t[s]=o)}return{...e,theme:t}}setMapTheme(e){return No(this.mapTheme,e??null)?!1:(this.mapTheme=e??null,this.rebuildPreservingState(),!0)}rebuildPreservingState(){let e=this.renderer;if(!e)return!1;let t=e.getSelection().map(n=>n.id),s=this.getActiveFloorId(),o=e.isFloorOverview?.()??!1;return e.setChart(this.visibleDoc(),s?{floorId:s}:void 0),o&&e.setFloorOverview?.(!0),this.opts.colorblindSafe&&e.setColorblindSafe?.(!0),this.closedSections.size&&e.setClosedSections?.([...this.closedSections]),this.applySeatsMap(Object.fromEntries(this.liveStatuses),this.liveDefault),t.length&&e.select?.(t),!0}refreshMapCopy(){this.rebuildPreservingState()&&this.renderer?.forceDraw()}syncHidden(e){let t=e.filter(o=>typeof o=="string");if(t.length===this.hidden.size&&t.every(o=>this.hidden.has(o)))return!1;this.hidden=new Set(t);let s=this.renderer?.isFloorOverview?.()??!1;return this.renderer?.setChart(this.visibleDoc()),s&&this.renderer?.setFloorOverview?.(!0),!0}syncClosed(e){let t=(e??[]).filter(s=>typeof s=="string");return t.length===this.closedSections.size&&t.every(s=>this.closedSections.has(s))?!1:(this.closedSections=new Set(t),this.renderer?.setClosedSections?.(t),!0)}isSectionClosed(e){return this.closedSections.has(e)}currentHold(){return this.hold_}getRenderer(){return this.renderer}seatByLabel(e){return this.labelToSeat.get(e)}getExpandedSeats(){return this.expandedSeats}idForLabel(e){return this.labelToId.get(e)}idsForLabel(e){let t=this.groupedTablesByLabel.get(e);if(t)return t.chairs.map(o=>o.id);let s=this.labelToId.get(e);return s?[s]:[]}idsForLabels(e){return[...new Set([...e].flatMap(t=>this.idsForLabel(t)))]}tableSelection(e){let t=this.groupedTableBySeatId.get(e)??this.groupedTablesByLabel.get(e);return t?this.toTableSeat(t):null}lineItemDisplay(e){if(e.objectType==="ga"){let o=this.visibleDoc(),n=ze(o).find(r=>r.id===e.objectId);return{...n?.displayLabel?{displayLabel:n.displayLabel}:{},...n?.displayType?{displayType:n.displayType}:{}}}if(e.objectType==="table"){let o=this.groupedTablesByLabel.get(e.label);return{...o?.displayLabel&&o.displayLabel!==o.label?{displayLabel:o.displayLabel}:{},...o?.displayType?{displayType:o.displayType}:{}}}let t=this.labelToSeat.get(e.label),s=t?this.seatContext.get(t.id):void 0;return{...t?.displayLabel?{displayLabel:t.displayLabel}:{},...s?.displayType?{displayType:s.displayType}:{}}}async render(e){if(this.renderer)return null;let t=performance.now(),s={},o=S=>Math.round((performance.now()-S)*100)/100;this.closed=!1;let n,r=performance.now();try{n=await this.api.chart(this.key)}catch(S){return this.emitError(S),null}if(s.loadChart=o(r),this.closed)return null;this._doc=n.doc;let a=performance.now();try{let S=us(n.doc,n.event.inventoryModelVersion===2?2:1);this.groupedTablesByObject=new Map(S.map(v=>[v.objectId,v])),this.groupedTablesByLabel=new Map(S.map(v=>[v.label,v])),this.groupedTableBySeatId=new Map(S.flatMap(v=>v.chairs.map(x=>[x.id,v]))),this.tableQuantities=new Map(S.map(v=>[v.label,v.mode==="whole"?v.capacity:v.minOccupancy])),this.confirmedVariableTables=new Set,this.groupedSelectionOverhead=S.reduce((v,x)=>v+Math.max(0,x.chairs.length-1),0)}catch(S){return this.emitError(S),null}this.labelToId=new Map,this.labelToSeat=new Map,this.seatById=new Map,this.seatContext=new Map,this.allIds=[];let l=new Map(Oi(n.doc).map(S=>[S.id,S])),c=Yt(n.doc),h=new Map([...c.sections,...c.ungrouped?[c.ungrouped]:[]].map(S=>[S.id,S.label]));this.expandedSeats=Ne(n.doc);for(let S of this.expandedSeats){this.labelToId.set(S.label,S.id),this.labelToSeat.set(S.label,S),this.seatById.set(S.id,S),this.allIds.push(S.id);let v=l.get(S.rowId),x=v&&"label"in v&&typeof v.label=="string"?v.label:void 0,I=v?.type==="row"?v.segmentedRow:void 0,T=I?.displayLabel??(v&&"displayLabel"in v&&typeof v.displayLabel=="string"&&v.displayLabel?v.displayLabel:x),P=this.groupedTablesByObject.get(S.rowId),M=v?.type==="table"?"table":v?.type==="booth"?"booth":"seat",C=T,R=I?.displayType?.trim()||(v&&"displayType"in v&&typeof v.displayType=="string"&&v.displayType.trim()?v.displayType.trim():void 0),B=S.displayLabel??S.label,A=B.split("-"),W=P||S.kind==="booth"?void 0:T&&B.startsWith(`${T}-`)?B.slice(T.length+1):A[A.length-1]??B;this.seatContext.set(S.id,{objectId:S.rowId,objectType:M,sectionLabel:h.get(c.objectToSection.get(S.rowId)??""),rowLabel:C,seatNumber:W,...R?{displayType:R,rowType:R}:{}})}for(let S of this.groupedTablesByLabel.values()){let v=S.chairs[0];v&&(this.labelToId.set(S.label,v.id),this.labelToSeat.set(S.label,v))}s.normalizeBuyerModel=o(a);let f=n.event.currency??this.opts.currency;this.currency=f??"USD";let d=performance.now(),m=Do(e,{maxSelection:this.rendererSelectionCap(),confirmSelection:this.opts.confirmSelection,portraitFitCrop:!1,gaPickerMode:!0,currency:f,onSelect:S=>{this.handleRendererSelect(S)},onDeselect:S=>{this.handleRendererDeselect(S)},onSelectionLimit:this.opts.onSelectionLimit,onHover:S=>{this.opts.onHover?.(S),this.opts.onSeatHover&&this.opts.onSeatHover(S?this.describeSeat(S):null)},onFocusSeat:this.opts.onFocusSeat,onViewChange:this.opts.onViewChange,onGAClick:this.opts.onGAClick,onSectionTap:S=>this.handleSectionTap(S),onDeckTap:S=>this.handleDeckTap(S),onFps:this.opts.onFps});if(s.createRenderer=o(d),this.closed)return m.destroy(),null;this.renderer=m;let y=null,p="free",u=[],b=performance.now();try{let S=await this.api.objects(this.key);this.hidden=new Set(S.hidden??[]),u=(S.closed??[]).filter(v=>typeof v=="string"),y=S.seats,p=S.default??"free"}catch{}if(s.loadStatuses=o(b),this.closed)return m.destroy(),this.renderer=null,null;let g=performance.now();m.setChart(this.visibleDoc()),(n.doc.floors?.length??0)>1&&m.setFloorOverview?.(!0),this.opts.colorblindSafe&&m.setColorblindSafe?.(!0),s.buildScene=o(g),this.closedSections=new Set(u);let w=performance.now();u.length&&m.setClosedSections?.(u),y&&this.applySeatsMap(y,p),this.rebuildSelectableSeatIds(),this.opts.selectedObjects?.length?this.select(this.opts.selectedObjects):this.emitSelectionValidity(),this.pushGAState(),s.applyInitialState=o(w);let k=performance.now();m.forceDraw(),s.firstPaint=o(k);let L=performance.now();return this.attachVisibilityListener(),this.connect(),s.startRealtime=o(L),s.controllerTotal=o(t),{doc:n.doc,salesClosed:!!n.event.salesClosed,eventName:n.event.name,venue:n.event.venue,startsAt:n.event.startsAt,timezone:n.event.timezone??null,currency:f,mode:n.event.mode??"live",locale:n.event.locale??null,posterUrl:n.event.posterUrl??null,performanceProfile:s}}getSelection(){if(!this.renderer)return[];let e=[],t=new Set;for(let s of this.renderer.getSelection()){let o=this.groupedTableBySeatId.get(s.id);o?t.has(o.label)||(t.add(o.label),e.push(this.toTableSeat(o))):e.push(this.toSeat(s))}return e}seatDetails(e){let t=this.seatById.get(e);return t?this.describeSeat(t):null}clearSelection(){this.renderer?.clearSelection(),this.resetUnheldTableQuantities(),this.emitSelectionChange()}deselect(e){let t=new Set;for(let s of e){let o=this.groupedTableBySeatId.get(s)??this.groupedTablesByLabel.get(s);if(o)o.chairs.forEach(n=>t.add(n.id)),this.hold_?.labels.includes(o.label)||(this.tableQuantities.set(o.label,o.mode==="whole"?o.capacity:o.minOccupancy),o.mode==="variable"&&this.confirmedVariableTables.delete(o.label));else{let n=this.seatById.has(s)?s:this.labelToId.get(s);n&&t.add(n)}}this.renderer?.deselect([...t]),this.emitSelectionChange()}setMaxSelection(e){this.maxSelection=Math.max(0,Math.floor(e)),this.renderer?.setMaxSelection?.(this.rendererSelectionCap())}select(e){let t=new Set(this.getSelection().map(r=>r.label)),s=new Set,o=[];for(let r of e){let a=this.groupedTableBySeatId.get(r)??this.groupedTablesByLabel.get(r);if(a)this.tableTierResolution(a).kind==="invalid"?o.push(a.label):a.chairs.forEach(c=>{this.isSelectableByPolicy(c.id)&&s.add(c.id)});else{let l=this.seatById.has(r)?r:this.labelToId.get(r);if(!l||!this.isSelectableByPolicy(l))continue;let c=this.seatById.get(l);c&&this.seatTierResolution(c).kind==="invalid"?o.push(c.label):s.add(l)}}if(o.length&&this.emitError(new me(ei(o))),!s.size)return[];if(this.renderer?.select?.([...s]),this.selectionGuestCount()>this.maxSelection)return this.renderer?.deselect([...s]),this.opts.onSelectionLimit?.(this.maxSelection),[];let n=this.getSelection().filter(r=>!t.has(r.label));return n.length&&this.emitSelectionChange(),n}selectCategories(e){let t=new Set(e);return this.select([...this.seatById.values()].filter(s=>t.has(s.categoryKey)).map(s=>s.id))}deselectCategories(e){let t=new Set(e);this.deselect(this.getSelection().filter(s=>t.has(s.categoryKey)).map(s=>s.id))}setSelectableObjects(e){this.selectableObjectRefs=e==null?null:[...new Set(e.filter(s=>typeof s=="string"&&!!s))],this.rebuildSelectableSeatIds();let t=this.renderer?.getSelection().filter(s=>!this.isSelectableByPolicy(s.id)).map(s=>s.id)??[];t.length&&this.deselect(t)}getSelectionValidity(e){if(this.numberOfPlacesToSelect==null&&!this.selectionValidators.length)return null;let t=this.getSelection(),s=e??t.reduce((o,n)=>o+(n.quantity??1),0);return Wo(t,s,this.numberOfPlacesToSelect,this.selectionValidators,()=>this.hasOrphanedSelection())}hasOrphanedSelection(){let e=this.renderer;if(!e)return!1;let t=new Set(e.getSelection().map(s=>s.id));return t.size>0&&Jt(this.seatById.values(),s=>e.getStatus(s),t).length>0}rebuildSelectableSeatIds(){if(this.selectableObjectRefs==null){this.selectableSeatIds=null;return}let e=new Set;for(let t of this.selectableObjectRefs){let s=this.groupedTableBySeatId.get(t)??this.groupedTablesByLabel.get(t);if(s){s.chairs.forEach(n=>e.add(n.id));continue}let o=this.seatById.has(t)?t:this.labelToId.get(t);o&&e.add(o)}this.selectableSeatIds=e}isSelectableByPolicy(e){return this.selectableSeatIds==null||this.selectableSeatIds.has(e)}setTableQuantity(e,t){let s=this.groupedTablesByLabel.get(e);if(!s)return!1;let o=s.mode==="whole"?s.capacity:Math.floor(t);if(!Number.isInteger(o)||o<s.minOccupancy||o>s.maxOccupancy)return!1;let n=this.tableQuantities.get(e)??s.minOccupancy;return this.tableQuantities.set(e,o),this.selectionGuestCount()>this.maxSelection?(this.tableQuantities.set(e,n),this.opts.onSelectionLimit?.(this.maxSelection),!1):(s.mode==="variable"&&this.confirmedVariableTables.add(e),this.emitSelectionChange(),!0)}async replaceTableQuantity(e,t,s){let o=this.groupedTablesByLabel.get(e),n=this.hold_;if(!o||o.mode!=="variable"||!n?.labels.includes(e))return null;let r=Math.floor(t);if(!Number.isInteger(r)||r<o.minOccupancy||r>o.maxOccupancy)return null;if((n.items??[]).filter(h=>h.label!==e).reduce((h,f)=>h+(f.quantity??1),0)+r>this.maxSelection)return this.opts.onSelectionLimit?.(this.maxSelection),null;let l=(n.items??[]).map(h=>({label:h.label,tierId:h.tierId,quantity:h.label===e?r:h.quantity}));if(!l.some(h=>h.label===e))return null;let c=await this.api.hold(this.key,l,s,n.holdId);return this.tableQuantities.set(e,r),this.setHold({holdId:c.holdId,labels:l.map(h=>h.label),expiresAt:c.expiresAt,items:c.items}),this.hold_}rendererSelectionCap(){return this.maxSelection+this.groupedSelectionOverhead}selectionGuestCount(){return this.getSelection().reduce((e,t)=>e+(t.quantity??1),0)}handleRendererSelect(e){let t=this.groupedTableBySeatId.get(e.id);if(!this.isSelectableByPolicy(e.id)){this.renderer?.deselect(t?t.chairs.map(o=>o.id):[e.id]),this.emitSelectionChange();return}if((t?this.tableTierResolution(t):this.seatTierResolution(e)).kind==="invalid"){this.renderer?.deselect(t?t.chairs.map(o=>o.id):[e.id]),this.emitError(new me(ei([t?.label??e.label]))),this.emitSelectionChange();return}if(t){if(this.selectionGuestCount()>this.maxSelection){this.renderer?.deselect(t.chairs.map(o=>o.id)),this.opts.onSelectionLimit?.(this.maxSelection),this.emitSelectionChange();return}this.renderer?.select?.(t.chairs.map(o=>o.id)),this.opts.onSelect?.(t.chairs[0]??e),this.opts.onTableSelectionRequest?.(this.toTableSeat(t)),this.emitSelectionChange();return}if(this.selectionGuestCount()>this.maxSelection){this.renderer?.deselect([e.id]),this.opts.onSelectionLimit?.(this.maxSelection),this.emitSelectionChange();return}this.opts.onSelect?.(e),this.emitSelectionChange()}handleRendererDeselect(e){let t=this.groupedTableBySeatId.get(e.id);t?(this.renderer?.deselect(t.chairs.map(s=>s.id)),this.hold_?.labels.includes(t.label)||(this.tableQuantities.set(t.label,t.mode==="whole"?t.capacity:t.minOccupancy),t.mode==="variable"&&this.confirmedVariableTables.delete(t.label)),this.opts.onDeselect?.(t.chairs[0]??e)):this.opts.onDeselect?.(e),this.emitSelectionChange()}resetUnheldTableQuantities(){for(let e of this.groupedTablesByLabel.values())this.hold_?.labels.includes(e.label)||(this.tableQuantities.set(e.label,e.mode==="whole"?e.capacity:e.minOccupancy),e.mode==="variable"&&this.confirmedVariableTables.delete(e.label))}resetTableQuantitiesForLabels(e){for(let t of e){let s=this.groupedTablesByLabel.get(t);s&&(this.tableQuantities.set(t,s.mode==="whole"?s.capacity:s.minOccupancy),s.mode==="variable"&&this.confirmedVariableTables.delete(t))}}tableQuantityRequest(e){if(e?.objectType!=="table")return{};if(e.bookingMode==="variable"&&!this.confirmedVariableTables.has(e.label))throw new Error("picker: confirm a variable table guest quantity before holding");return{quantity:e.quantity}}async hold(e,t){if(!this.renderer)return null;let o=e??this.getSelection().map(l=>l.label),n=(this.hold_?.items??[]).filter(l=>l.objectType==="ga"),r=[...new Set([...n.map(l=>l.label),...o])];if(!r.length)return null;let a=this.ticketIssue(r);if(a)throw new me(a);if(this.hold_&&this.holdCovers(r))return this.hold_;try{let l=r.map(h=>{let f=n.find(y=>y.label===h);if(f)return{label:h,tierId:f.tierId,quantity:f.quantity};let d=this.labelToSeat.get(h),m=d?this.toSeat(d):null;return{label:h,...m?.tierId?{tierId:m.tierId}:{},...this.tableQuantityRequest(m)}}),c=await this.api.hold(this.key,l,t,this.hold_?.holdId);return this.setHold({holdId:c.holdId,labels:r,expiresAt:c.expiresAt,items:c.items}),this.hold_}catch(l){throw this.handle409Conflicts(l),l}}async resumeHold(e){if(this.closed||!e||!this.api.resume)return null;let t=await this.api.resume(this.key,e);if(this.closed)return null;let s=[...new Set(t.items.map(o=>o.label))];return s.length?(this.setHold({holdId:t.holdId,labels:s,expiresAt:t.expiresAt,items:t.items},"restored"),this.hold_):null}async extendHold(e){let t=this.hold_;if(!t||!this.api.extend)return null;try{let s=await this.api.extend(this.key,t.holdId,e);return this.hold_?.holdId!==t.holdId?this.hold_:(this.setHold({holdId:t.holdId,labels:t.labels,expiresAt:s.expiresAt,items:t.items}),this.hold_)}catch{return null}}categoryAvailability(){return Ho({seatById:this.seatById,groupedTableBySeatId:this.groupedTableBySeatId,groupedTablesByLabel:this.groupedTablesByLabel,closedMembers:this.closedMemberIds(),statusOf:e=>this.getStatus(e),gaAreas:this.getGAAreas()})}closedMemberIds(){let e=new Set,t=this.renderer;if(!t||!this.closedSections.size)return e;for(let s of this.closedSections)for(let o of t.sectionMembers?.(s)??[])e.add(o);return e}getGAAreas(){let e=this.visibleDoc();return e?Oo(e,this.currency,t=>this.statusOf(t)):[]}setGASelection(e){this.gaSelected=e?new Map(e):null,this.pushGAState()}pushGAState(){this.renderer?.setGAStates?.(Go(this.getGAAreas(),this.gaSelected))}async holdGA(e,t,s={}){let o=this.visibleDoc();if(!o||!Number.isFinite(t)||t<1)return null;let n=ze(o).find(h=>h.id===e);if(!n)return null;let r=dt(n).filter(h=>!this.hold_?.labels.includes(h)&&this.statusOf(h)==="free").slice(0,Math.floor(t));if(r.length!==Math.floor(t))return null;let a=new Map;for(let h of this.hold_?.items??[])a.set(h.label,{label:h.label,tierId:h.tierId,quantity:h.quantity});if(this.hold_&&!this.hold_?.items?.length)for(let h of this.hold_.seats)a.set(h.label,{label:h.label,...h.tierId?{tierId:h.tierId}:{}});for(let h of this.getSelection())a.set(h.label,{label:h.label,...h.tierId?{tierId:h.tierId}:{},...this.tableQuantityRequest(h)});for(let h of r)a.set(h,{label:h,...s.tierId?{tierId:s.tierId}:{}});let l=[...a.values()],c=await this.api.hold(this.key,l,s.ttlMs,this.hold_?.holdId);return this.setHold({holdId:c.holdId,labels:l.map(h=>h.label),expiresAt:c.expiresAt,items:c.items}),this.hold_}hasPremiumSeats(){for(let e of this.labelToSeat.values())if(e.commercial?.premium)return!0;return!1}getBestAvailableZones(){let e=this.visibleDoc();if(!e?.zones?.length)return[];let t=new Set(Yt(e).sections.filter(s=>s.seatCount>0&&!!s.zone).map(s=>s.zone));return e.zones.filter(s=>t.has(s.id)).map(s=>({id:s.id,label:s.label}))}pickPremiumBlock(e,t,s){let o=this.visibleDoc();if(!o?.objects?.length)return null;let n=o.focalPoint??{x:0,y:0},r=new Set(this.groupedTablesByObject.keys()),a=Ne(o).filter(d=>!r.has(d.rowId)),l=new Set(this.hold_?.labels??[]),c=new Set;for(let d of a){if(l.has(d.label)||this.seatTierResolution(d).kind==="invalid")continue;let m=this.labelToId.get(d.label);((m?this.getStatus(m):void 0)??"free")==="free"&&c.add(d.label)}let h=hs(a,c,{qty:e,categoryKey:t,zoneId:s,focal:n,preferPremium:!0});return h.labels.length!==e?null:h.labels.every(d=>this.labelToSeat.get(d)?.commercial?.premium)?[...h.labels]:null}async bestAvailable(e,t,s={}){let o=this.renderer;if(!o)return null;if(s.preferPremium){let n=this.pickPremiumBlock(e,t,s.zoneId);if(n){if(this.hold_&&!await this.release())return null;try{let r=n.map(h=>{let f=this.labelToSeat.get(h),d=f?this.toSeat(f):null;return{label:h,...d?.tierId?{tierId:d.tierId}:{}}}),a=await this.api.hold(this.key,r,s.ttlMs);o.clearSelection();let l=this.idsForLabels(n);l.length&&o.setStatus(l,"held"),this.setHold({holdId:a.holdId,labels:[...n],expiresAt:a.expiresAt,items:a.items});let c=n.map(h=>this.labelToSeat.get(h)).filter(h=>!!h).map(h=>this.toSeat(h));return this.opts.onSelectionChange?.(c),this.hold_}catch(r){let{status:a,reason:l}=nt(r);if(a===409&&l==="event_closed")throw this.opts.onSalesClosed?.(),r}}}if(this.hold_&&!await this.release())return null;try{let n=await this.api.bestAvailable(this.key,e,t,s.zoneId,s.ttlMs);o.clearSelection();let r=this.idsForLabels(n.labels);r.length&&o.setStatus(r,"held"),this.setHold({holdId:n.holdId,labels:[...n.labels],expiresAt:n.expiresAt,items:n.items});let a=n.labels.map(l=>this.labelToSeat.get(l)).filter(l=>!!l).map(l=>this.toSeat(l));return this.opts.onSelectionChange?.(a),this.hold_}catch(n){let{status:r,reason:a}=nt(n);throw r===409&&a==="event_closed"&&this.opts.onSalesClosed?.(),n}}async book(e,t,s){let o=this.renderer;if(!o)return null;if(!this.api.book)throw new Error("picker: transport has no book() \u2014 hold-only mode");let n=t??this.getSelection().map(c=>c.label);if(!n.length)return null;let r=this.ticketIssue(n);if(r)throw new me(r);let a;try{if(this.hold_&&this.holdCovers(n))a=this.hold_.holdId;else{let c=this.hold_?.holdId,h=await this.api.hold(this.key,n.map(f=>{let d=this.labelToSeat.get(f),m=d?this.toSeat(d):null;return{label:f,...m?.tierId?{tierId:m.tierId}:{},...this.tableQuantityRequest(m)}}),s,c);a=h.holdId,this.setHold({holdId:a,labels:[...n],expiresAt:h.expiresAt,items:h.items})}await this.api.book(this.key,n,a,e)}catch(c){let{status:h,conflicts:f,reason:d}=nt(c);if(this.clearHold(),h===409&&d==="event_closed")this.opts.onSalesClosed?.();else if(h===409&&f?.length){let m=new Set(f.map(u=>u.label)),y=this.idsForLabels(m);y.length&&(o.setStatus(y,"booked"),o.deselect(y),this.resetTableQuantitiesForLabels(m));let p=n.filter(u=>!m.has(u));p.length&&a&&this.api.release(this.key,p,a).catch(()=>{}),this.emitSelectionChange()}else a&&this.api.release(this.key,n,a).catch(()=>{});throw c}let l=this.idsForLabels(n);return l.length&&(o.setStatus(l,"booked"),o.deselect(l)),this.clearHold(),this.resetTableQuantitiesForLabels(n),this.emitSelectionChange(),this.opts.onBook?.(e),n}async release(){let e=this.hold_;if(!e)return!0;try{let s=await this.api.release(this.key,e.labels,e.holdId);if(!this.releaseConfirmed(s,e.labels))return await this.resnapshot(),!1}catch(s){return this.emitError(s),!1}if(this.hold_?.holdId!==e.holdId)return!0;this.clearHold(),this.resetTableQuantitiesForLabels(e.labels);let t=this.idsForLabels(e.labels);return t.length&&(this.renderer?.deselect(t),this.renderer?.setStatus(t,"free")),!0}async releaseLabels(e){let t=this.hold_;if(!t)return!0;let s=e.filter(a=>t.labels.includes(a));if(!s.length)return!0;try{let a=await this.api.release(this.key,s,t.holdId);if(!this.releaseConfirmed(a,s))return await this.resnapshot(),!1}catch(a){return this.emitError(a),!1}if(this.hold_?.holdId!==t.holdId)return!0;let o=t.labels.filter(a=>!s.includes(a)),n=t.items?.filter(a=>!s.includes(a.label));o.length?this.setHold({...t,labels:o,items:n}):this.clearHold(),this.resetTableQuantitiesForLabels(s);let r=this.idsForLabels(s);return r.length&&(this.renderer?.deselect(r),this.renderer?.setStatus(r,"free")),!0}releaseConfirmed(e,t){let s=e?.released;return!Array.isArray(s)||t.every(o=>s.includes(o))}setStatus(e,t){this.renderer?.setStatus(e,t)}getStatus(e){return this.renderer?.getStatus(e)}notForSaleCategorySeatIds(){let e=this.doc;if(!e)return[];let t=new Set(e.categories.filter(o=>o.notForSale).map(o=>o.key));if(!t.size)return[];let s=[];for(let[o,n]of this.seatById)t.has(n.categoryKey)&&s.push(o);return s}flashSeat(e,t){this.renderer?.flashSeat(e,t)}zoomIn(){this.renderer?.zoomIn()}zoomOut(){let e=this.renderer;if(!e?.zoomOutLevel)return void e?.zoomOut();let t=!!e.getFocusedSection?.();e.zoomOutLevel()==="venue"&&t&&this.overview()}zoomToFit(){this.renderer?.zoomToFit()}refitCurrentView(){this.renderer?.refitCurrentView?this.renderer.refitCurrentView():this.renderer?.zoomToFit()}worldToScreen(e){return this.renderer?.worldToScreen(e)??{x:0,y:0}}setSelectionFocus(e){this.renderer?.setSelectionFocus?.(e)}setAccessibilityFilter(e){this.renderer?.setAccessibilityFilter?.(e)}setCommercialLimitedFilter(e){this.renderer?.setCommercialLimitedFilter?.(e)}getFloors(){return this.renderer?.getFloors?.()??[]}getActiveFloorId(){return this.renderer?.getActiveFloorId?.()??""}setFloor(e){let t=this.renderer;!t?.setActiveFloor||e===t.getActiveFloorId?.()&&!t.isFloorOverview?.()||(t.setFloorOverview?.(!1),t.setStacked?.(!1),t.setActiveFloor(e),this.resnapshot(),this.emitSelectionChange())}setStacked(e){let t=this.renderer;!t?.setStacked||e===t.isStacked?.()||(t.setStacked(e),this.resnapshot())}isMultiFloor(){return(this._doc?.floors?.length??0)>1}setFloorOverview(e){let t=this.renderer;!t?.setFloorOverview||e===t.isFloorOverview?.()||(t.setFloorOverview(e),this.resnapshot(),this.emitSelectionChange())}isFloorOverview(){return this.renderer?.isFloorOverview?.()??!1}handleDeckTap(e){let t=this.renderer;t&&(t.setViewMode?.("flat"),t.setFloorOverview?.(!1),t.setStacked?.(!1),t.setActiveFloor?.(e),this.resnapshot(),this.emitSelectionChange(),this.opts.onDeckTap?.(e))}setViewMode(e){this.renderer?.setViewMode?.(e)}getViewMode(){return this.renderer?.getViewMode?.()??"flat"}getRung(){return this.renderer?.getRung?.()??"seats"}getFocusedSection(){return this.renderer?.getFocusedSection?.()??null}setRung(e){if(e==="zones"){this.overview();return}this.renderer?.setRung?.(e)}setCategoryFilter(e){this.renderer?.setCategoryFilter?.(e)}focusCategoryFilter(e){let t=this.renderer;if(t){if(t.clearSectionFocus?.(),this.opts.onSectionFocus?.(null),e?.length){let s=this.floorForCategories(e);s&&this.setFloor(s)}t.focusCategories?t.focusCategories(e):t.zoomToFit()}}floorForCategories(e){let t=this._doc;if(!t?.floors||t.floors.length<2)return null;let s=new Set(e),o=a=>a.some(l=>l.type==="row"&&(s.has(l.categoryKey)||(l.overrides??[]).some(c=>c.categoryKey!=null&&s.has(c.categoryKey)))||l.type==="gaArea"&&s.has(l.categoryKey)),n=this.getActiveFloorId(),r=t.floors.find(a=>a.id===n);return r&&o(r.objects)?null:t.floors.find(a=>o(a.objects))?.id??null}getViewport(){let e=this.renderer;return!e?.getVisibleWorldRect||!e.getWorldBounds?null:{visible:e.getVisibleWorldRect(),bounds:e.getWorldBounds()}}getMinimapSnapshot(){return this.renderer?.getMinimapSnapshot?.()??{sections:[],seats:[]}}panToWorld(e){this.renderer?.panToWorld?.(e)}clearSectionFocus(){this.renderer?.clearSectionFocus?.(),this.opts.onSectionFocus?.(null)}getRenderedQualityEvidence(){return this.renderer?.getRenderedQualityEvidence()??null}focusSection(e){this.handleSectionTap(e)}getSectionSeatCount(e){return this.renderer?.sectionMembers?.(e)?.length??0}overview(){this.renderer?.clearSectionFocus?.(),this.renderer?.zoomToFit(),this.opts.onSectionFocus?.(null)}handleSectionTap(e){let t=this.renderer;if(t){if(t.focusSection?t.focusSection(e):t.focusRegion?.(e),this.isSectionClosed(e)){this.opts.onSectionFocus?.(null);return}this.opts.onSectionFocus?.(this.sectionSummary(e))}}sectionSummary(e){let t=this.renderer,s=this._doc;if(!t||!s)return null;let o=s.objects.find(y=>y.type==="section"&&y.id===e);if(!o)return null;let n=t.sectionMembers?.(e)??[],r=new Map,a=new Set,l=0;for(let y of n){let p=this.seatById.get(y);if(!p)continue;let u=this.groupedTableBySeatId.get(y);if(u){if(a.has(u.label))continue;a.add(u.label),r.set(u.categoryKey,(r.get(u.categoryKey)??0)+u.maxOccupancy),t.getStatus(u.chairs[0]?.id??y)==="free"&&(l+=u.maxOccupancy)}else r.set(p.categoryKey,(r.get(p.categoryKey)??0)+1),t.getStatus(y)==="free"&&l++}let c=[...r.entries()].map(([y,p])=>{let u=s.categories.find(k=>k.key===y),b=u?.tiers?.length?u.tiers.map(k=>k.price):[u?.price??0],g=Math.min(...b),w=Math.max(...b);return{key:y,count:p,label:u?.label??y,color:u?.color??"#6e7bff",price:g,priceMin:g,priceMax:w}}).sort((y,p)=>y.price-p.price),h=c.map(y=>y.priceMin),f=c.map(y=>y.priceMax),d=o.zone?s.zones?.find(y=>y.id===o.zone):void 0,m=o.color??d?.color??c[0]?.color??"#6e7bff";return{id:e,label:o.displayLabel??o.label,zoneLabel:d?.label??"",...o.entrance&&o.entrance.trim()?{entrance:o.entrance.trim()}:{},color:m,seatsLeft:l,priceMin:h.length?Math.min(...h):0,priceMax:f.length?Math.max(...f):0,categories:c}}destroy(){if(this.closed=!0,this.detachVisibilityListener(),this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.expiryTimer&&(clearTimeout(this.expiryTimer),this.expiryTimer=null),this.realtime){try{this.realtime.stop()}catch{}this.realtime=null}if(this.ws){try{this.ws.close()}catch{}this.ws=null}this.renderer?.destroy(),this.renderer=null}toSeat(e){let t=this.groupedTableBySeatId.get(e.id);if(t)return this.toTableSeat(t);let s=e.commercial?{commercial:e.commercial}:void 0,o=e.displayLabel?{displayLabel:e.displayLabel}:void 0,n=e.accessibility?.length?{accessibility:e.accessibility}:void 0,r=e.wheelchairSpaceType?{wheelchairSpaceType:e.wheelchairSpaceType}:void 0,a=this.seatContext.get(e.id),l=this.tiersForSeat(e),c=this.seatTierResolution(e);if(c.kind!=="resolved"||!l)return{id:e.id,label:e.label,...o,...a,categoryKey:e.categoryKey,price:this.priceFor(e.categoryKey),currency:this.currency,...s,...n,...r};let h=c.tier;return{id:e.id,label:e.label,...o,...a,categoryKey:e.categoryKey,price:h.price,currency:this.currency,tiers:l,tierId:h.id,...s,...n,...r}}toTableSeat(e){let t=e.chairs[0],s=this.tiersFor(e.categoryKey)?.filter(r=>vt(this._doc,this.tableTierSeat(e),r.id).kind==="resolved"),o=this.tableTierResolution(e),n=o.kind==="resolved"?o.tier:void 0;return{id:t?.id??e.objectId,label:e.label,displayLabel:e.displayLabel??e.label,...e.displayType?{displayType:e.displayType,rowType:e.displayType}:{},objectId:e.objectId,sectionLabel:t?this.seatContext.get(t.id)?.sectionLabel:void 0,rowLabel:e.displayLabel??e.label,categoryKey:e.categoryKey,price:n?.price??this.priceFor(e.categoryKey),currency:this.currency,...s?{tiers:s,tierId:n?.id}:{},objectType:"table",bookingMode:e.mode,quantity:this.tableQuantities.get(e.label)??(e.mode==="whole"?e.capacity:e.minOccupancy),capacity:e.capacity,minOccupancy:e.minOccupancy,maxOccupancy:e.maxOccupancy,physicalSeatIds:e.chairs.map(r=>r.id)}}describeSeat(e){let t=this._doc?.categories.find(s=>s.key===e.categoryKey);return{...this.toSeat(e),categoryLabel:t?.label??e.categoryKey,categoryColor:t?.color??"#6e7bff",status:this.renderer?.getStatus(e.id)??"free",currency:this.currency,...this.seatContext.get(e.id)}}priceFor(e){return this._doc?.categories.find(t=>t.key===e)?.price??0}tiersFor(e){let t=this._doc?.categories.find(s=>s.key===e)?.tiers;return t&&t.length?t:void 0}tiersForSeat(e){if(!this._doc)return;let t=ds(this._doc,e);return t.length?t:void 0}seatTierResolution(e){return this._doc?vt(this._doc,e,this.seatTiers.get(e.id)):{kind:"none"}}tableTierSeat(e){return{label:e.label,categoryKey:e.categoryKey,accessibility:e.chairs.flatMap(t=>t.accessibility??[])}}tableTierResolution(e){if(!this._doc)return{kind:"none"};let t=e.chairs[0]?.id??"";return vt(this._doc,this.tableTierSeat(e),this.seatTiers.get(t))}setSeatTier(e,t){let s=this.seatById.get(e);if(!s)return;let o=this.tiersForSeat(s);if(o){if(t==null)this.seatTiers.delete(e);else if(o.some(n=>n.id===t))this.seatTiers.set(e,t);else return;this.emitSelectionChange(),this.hold_&&(this.hold_={...this.hold_,seats:this.seatsForLabels(this.hold_.labels)})}}seatsForLabels(e){let t=[];for(let s of e){let o=this.labelToSeat.get(s);o&&t.push(this.toSeat(o))}return t}emitSelectionChange(){let e=this.getSelection();this.opts.onSelectionChange?.(e),this.emitSelectionValidity(),this.emitOrphanHint()}emitSelectionValidity(){let e=this.getSelectionValidity();e&&(this.opts.onSelectionValidityChange?.(e),e.isValid?this.lastSelectionValidity!==!0&&this.opts.onSelectionValid?.(e.seats):this.lastSelectionValidity!==!1&&this.opts.onSelectionInvalid?.(e),this.lastSelectionValidity=e.isValid)}ticketIssue(e){if(!this._doc)return null;let t=e?this.seatsForLabels(e):this.getSelection();return ps(this._doc,t.map(s=>({label:s.label,...s.tierId?{tierId:s.tierId}:{}})))}emitOrphanHint(){if(!this.opts.onHint)return;let e=this.renderer;if(!e)return;let t=this.ticketIssue();if(t){this.hintShown=!0,this.opts.onHint(t.code==="companion_pair_required"?U("picker.companionPairRequired"):"That ticket choice is not available for the selected seat.");return}let s=new Set(e.getSelection().map(n=>n.id));(s.size?Jt(this.seatById.values(),n=>e.getStatus(n),s):[]).length>0?(this.hintShown=!0,this.opts.onHint(U("picker.orphanHint"))):this.hintShown&&(this.hintShown=!1,this.opts.onHint(null))}setColorblindSafe(e){this.renderer?.setColorblindSafe?.(e)}emitError(e){this.opts.onError?this.opts.onError(e):console.error("[picker]",e)}holdCovers(e){let t=this.hold_;if(!t||t.labels.length!==e.length||!e.every(n=>t.labels.includes(n)))return!1;let s=new Map((t.items??[]).map(n=>[n.label,n.tierId])),o=new Map((t.items??[]).map(n=>[n.label,n.quantity??1]));return e.every(n=>{let r=this.labelToSeat.get(n),a=r?this.toSeat(r):null,l=a?.tierId??null;return(a?.objectType!=="table"||(a.bookingMode!=="variable"||this.confirmedVariableTables.has(n))&&(!o.has(n)||o.get(n)===a.quantity))&&(!s.has(n)||s.get(n)===l)})}handle409Conflicts(e){let{status:t,conflicts:s}=nt(e);if(t!==409||!s?.length)return;let o=this.renderer;if(!o)return;let n=this.idsForLabels(s.map(r=>r.label));n.length&&(o.deselect(n),o.setStatus(n,"held"),this.resetTableQuantitiesForLabels(s.map(r=>r.label))),this.emitSelectionChange()}setHold(e,t="created"){for(let n of e.items??[])this.groupedTablesByLabel.has(n.label)&&n.quantity!=null&&(this.tableQuantities.set(n.label,n.quantity),this.groupedTablesByLabel.get(n.label)?.mode==="variable"&&this.confirmedVariableTables.add(n.label));let s={...e,seats:this.seatsForLabels(e.labels)};this.hold_=s,this.renderer?.setOwnedHold?.(this.idsForLabels(s.labels)),this.expiryTimer&&clearTimeout(this.expiryTimer);let o=Math.max(0,s.expiresAt-Date.now());this.expiryTimer=setTimeout(()=>{this.expireActiveHold()},o),t==="restored"?this.opts.onHoldRestored?.(s):this.opts.onHold?.(s)}clearHold(){this.hold_=null,this.renderer?.setOwnedHold?.(null),this.expiryTimer&&(clearTimeout(this.expiryTimer),this.expiryTimer=null)}async expireActiveHold(){let e=this.hold_;if(e){try{let t=await this.api.objects(this.key);if(this.hold_?.holdId!==e.holdId)return;this.applySeatsMap(t.seats,t.default??"free")}catch{this.hold_?.holdId===e.holdId&&(this.expiryTimer=setTimeout(()=>{this.expireActiveHold()},2e3));return}if(this.hold_?.holdId===e.holdId){if(e.labels.some(t=>this.statusOf(t)==="held")){this.expiryTimer=setTimeout(()=>{this.expireActiveHold()},1e3);return}this.clearHold(),this.opts.onHoldExpired?.()}}}applySeatsMap(e,t="free"){let s=this.renderer;if(!s)return;this.liveStatuses=new Map(Object.entries(e)),this.liveDefault=t;let o=Ot(t);this.allIds.length&&s.setStatus(this.allIds,o),s.setOwnedHold?.(this.idsForLabels(this.hold_?.labels??[]));let n={free:[],held:[],booked:[],not_for_sale:[]};for(let[a,l]of Object.entries(e))n[Ot(l)].push(...this.idsForLabel(a));["free","held","booked","not_for_sale"].forEach(a=>{a!==o&&n[a].length&&s.setStatus(n[a],a)});let r=this.notForSaleCategorySeatIds();r.length&&s.setStatus(r,"not_for_sale"),this.clearBookedHoldIfSettled(),this.opts.onStatusChange?.()}statusOf(e){return this.liveStatuses.get(e)??this.liveDefault}clearBookedHoldIfSettled(){let e=this.hold_;e?.labels.every(t=>this.statusOf(t)==="booked")&&(this.clearHold(),this.resetTableQuantitiesForLabels(e.labels))}async resnapshot(){try{let e=await this.api.objects(this.key);this.applySeatsMap(e.seats,e.default??"free")}catch{}}async refresh(){await this.resnapshot()}attachVisibilityListener(){if(this.onVisibilityChange||typeof document>"u"||typeof document.addEventListener!="function")return;let e=()=>{this.closed||document.visibilityState==="visible"&&this.resnapshot().then(()=>{this.closed||this.renderer?.forceDraw()})};this.onVisibilityChange=e,document.addEventListener("visibilitychange",e)}detachVisibilityListener(){this.onVisibilityChange&&(typeof document<"u"&&typeof document.removeEventListener=="function"&&document.removeEventListener("visibilitychange",this.onVisibilityChange),this.onVisibilityChange=null)}realtimeSink(){return{applyStatuses:e=>this.applyStatusChanges(e),applyProjection:e=>this.applySeatsMap(e.exceptions,e.default),resync:()=>this.resnapshot(),onSections:(e,t)=>{let s=this.syncHidden(e),o=this.syncClosed(t);s&&this.resnapshot(),(s||o)&&this.opts.onStatusChange?.()}}}applyStatusChanges(e){let t=this.renderer;if(t){for(let s of e){this.liveStatuses.set(s.label,s.status);let o=this.idsForLabel(s.label);if(!o.length)continue;let n=Ot(s.status);this.opts.flashOnLiveChange&&n!=="free"&&o.some(r=>t.getStatus(r)==="free")&&!this.hold_?.labels.includes(s.label)&&o.forEach(r=>t.flashSeat(r,n==="held"?"#f4b740":"#f43f5e")),t.setStatus(o,n)}this.opts.keepLiveWhileHidden&&typeof document<"u"&&document.visibilityState==="hidden"&&t.forceDraw(),this.pushGAState(),this.clearBookedHoldIfSettled(),this.opts.onStatusChange?.()}}connect(){if(this.closed)return;let e=this.api.socketUrl(this.key);if(!e)return;if(!this.realtime&&this.api.createRealtime){let s=null;try{s=this.api.createRealtime(this.key,this.realtimeSink())}catch{s=null}if(s){this.realtime=s,s.start();return}}if(this.realtime)return;let t;try{let s=this.api.socketProtocols?.(this.key);t=s&&s.length?new WebSocket(e,s):new WebSocket(e)}catch{this.scheduleReconnect();return}this.ws=t,t.onopen=()=>{this.attempt=0,this.resnapshot()},t.onmessage=s=>{let o;try{o=JSON.parse(typeof s.data=="string"?s.data:"")}catch{return}if(!this.renderer||!o||typeof o!="object")return;let r=o;Array.isArray(r.hidden)&&this.syncHidden(r.hidden)&&(this.resnapshot(),this.opts.onStatusChange?.()),Array.isArray(r.closed)&&this.syncClosed(r.closed)&&this.opts.onStatusChange?.(),r.type!=="hidden"&&(r.seats&&typeof r.seats=="object"?this.applySeatsMap(r.seats):Array.isArray(r.changes)&&this.applyStatusChanges(r.changes))},t.onclose=()=>{this.ws===t&&(this.ws=null),this.scheduleReconnect()},t.onerror=()=>{try{t.close()}catch{}}}scheduleReconnect(){if(this.closed||this.reconnectTimer)return;let e=Math.min(this.attempt++,5),t=_o(e,{baseMs:1e3,maxMs:rr,jitter:1});this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.connect()},t)}};var ar=5,lr=-1.1,Ii=35;function Ci(i,e){let t=i-Y,s=Math.atan2(ar-t,e)*180/Math.PI,o=Math.atan2(lr-t,e)*180/Math.PI;return o<-Ii&&(s+=-Ii-o,o=-Ii),{topPitch:s,basePitch:o}}var K=2048,le=1024,at=Di,E=Math.PI*2,cr=le/180,Ge=i=>(i+180)/360*K,G=i=>(90-i)/180*le;function Uo(i){let e=2166136261;for(let t=0;t<i.length;t++)e^=i.charCodeAt(t),e=Math.imul(e,16777619);return e>>>0}function Zo(i){let e=i>>>0;return()=>{e|=0,e=e+1831565813|0;let t=Math.imul(e^e>>>15,1|e);return t=t+Math.imul(t^t>>>7,61|t)^t,((t^t>>>14)>>>0)/4294967296}}var Gt=96,xi=360/Gt,hr=.6,Mi=[17,23,42];function Pi(i,e,t=1){let s=Math.max(0,Math.min(.58,e)),o=Math.round(i[0]+(Mi[0]-i[0])*s),n=Math.round(i[1]+(Mi[1]-i[1])*s),r=Math.round(i[2]+(Mi[2]-i[2])*s);return`rgba(${o},${n},${r},${t})`}function Xo(i,e,t){return[Math.round(i[0]+(e[0]-i[0])*t),Math.round(i[1]+(e[1]-i[1])*t),Math.round(i[2]+(e[2]-i[2])*t)]}function Q(i,e,t){let s=(1-Math.abs(2*t-1))*e,o=(i%360+360)%360/60,n=s*(1-Math.abs(o%2-1)),r=0,a=0,l=0;o<1?[r,a,l]=[s,n,0]:o<2?[r,a,l]=[n,s,0]:o<3?[r,a,l]=[0,s,n]:o<4?[r,a,l]=[0,n,s]:o<5?[r,a,l]=[n,0,s]:[r,a,l]=[s,0,n];let c=t-s/2;return[Math.round((r+c)*255),Math.round((a+c)*255),Math.round((l+c)*255)]}var $o=new Map;function Yo(i){if(!i)return null;let e=$o.get(i);if(e)return e;let t=2166136261;for(let n=0;n<i.length;n++)t^=i.charCodeAt(n),t=Math.imul(t,16777619);let s=(t>>>0)%360,o=Q(s,.3,.42);return $o.set(i,o),o}function dr(i,e,t,s){let o=new Array(Gt).fill(null),n=0,r=i.sectionId;for(let a of e){if(a.id===i.id)continue;let l=a.sectionId;if(!l||r&&l===r)continue;let c=a.x-i.x,h=a.y-i.y,f=Math.hypot(c,h)*at;if(f<1.5||f>95)continue;let d=a.eyeHeightM??Y,m=d-s;Math.abs(m)>n&&(n=Math.abs(m));let y=Math.atan2(m,f)*180/Math.PI,p=Math.atan2(d-Y-s,f)*180/Math.PI,b=((Math.atan2(c,-h)-t)*180/Math.PI+540)%360-180,g=Math.min(Gt-1,Math.max(0,Math.floor((b+180)/xi))),w=y>34&&f<16,k=o[g];k?(y>k.top&&(k.top=y),p<k.base&&(k.base=p),f<k.nearM&&(k.nearM=f,k.tint=Yo(a.categoryKey)),k.overhead=k.overhead||w):o[g]={top:y,base:p,nearM:f,overhead:w,tint:Yo(a.categoryKey)}}return{bins:o,maxDelta:n}}function pr(i,e,t,s){for(let o=0;o<Gt;o++){let n=e[o];if(!n)continue;let r=-180+o*xi,a=t(r),l=t(r+xi);if(!(l>a))continue;let c=Math.min(72,n.top),h=Math.min(n.base,-4),f=s(c),d=s(h);if(d<=f)continue;let m=n.nearM/95,y=n.tint,p=y?Xo([44,54,80],y,.34):[44,54,80],u=y?Xo([24,30,48],y,.28):[24,30,48],b=i.createLinearGradient(0,f,0,d);b.addColorStop(0,Pi(p,m)),b.addColorStop(.24,Pi(u,m)),b.addColorStop(1,Pi([10,13,22],m)),i.fillStyle=b,i.fillRect(a,f,l-a+1,d-f),i.fillStyle=`rgba(150,165,205,${.35*(1-m*.55)})`,i.fillRect(a,f,l-a+1,1.5);let w=Math.min(d,s(0))-f;if(w>8){let L=1-m*.4;for(let S=1;S<6;S++){let v=f+w*S/6;i.fillStyle=`rgba(0,0,0,${.16*L})`,i.fillRect(a,v,l-a+1,1.5),i.fillStyle=`rgba(120,134,170,${.1*L})`,i.fillRect(a,v+1.5,l-a+1,1.2)}}if(n.overhead){let k=s(Math.min(86,c+12)),L=i.createLinearGradient(0,k,0,f);L.addColorStop(0,"rgba(3,4,8,0.9)"),L.addColorStop(1,"rgba(3,4,8,0)"),i.fillStyle=L,i.fillRect(a,k,l-a+1,f-k),i.fillStyle="rgba(120,130,160,0.14)",i.fillRect(a,f-1.5,l-a+1,1.5)}}}function ur(i,e,t){let o=new Array(72).fill(!1),n=new Array(72).fill(1/0),r=new Set,a=0;for(let b of t){a++,b.sectionId&&r.add(b.sectionId);let g=b.x-e.x,w=b.y-e.y,k=Math.hypot(g,w)*at;if(k<.5)continue;let L=Math.atan2(g,-w),S=Math.floor((L+Math.PI)/E*72);S<0?S=0:S>=72&&(S=71),o[S]=!0,k<n[S]&&(n[S]=k)}let l=0,c=[];for(let b=0;b<72;b++)o[b]&&(l++,c.push(n[b]));let h=l/72*360;c.sort((b,g)=>b-g);let f=c.length?c[c.length>>1]:0,d=c.length?c[Math.floor(c.length*.15)]??f:0,m=c.length?c[Math.floor(c.length*.85)]??f:0,y=d>.5?m/d:1,p=Uo(`${a}|${[...r].sort().join(",")}|${Math.round(e.x)},${Math.round(e.y)}`),u;return h>=300&&f>11&&y>1.35?u="sport":h>=285?u="arena":u="proscenium",{mode:u,seed:p,voidRadiusM:f,aspect:y}}var fr=5;function yr(i,e,t){switch(t){case 1:i.beginPath(),i.ellipse(0,-e*.14,e*1.16,e*1.16,0,0,E),i.fill();break;case 2:i.beginPath(),i.ellipse(0,-e*1.02,e*.42,e*.42,0,0,E),i.fill(),i.beginPath(),i.ellipse(0,-e*.2,e*.98,e*1.02,0,0,E),i.fill();break;case 3:i.beginPath(),i.ellipse(0,-e*.36,e*1.04,e*.6,0,Math.PI,E),i.fill(),i.beginPath(),i.ellipse(0,-e*.52,e*1.22,e*.24,0,0,E),i.fill();break;case 4:i.beginPath(),i.ellipse(-e*.66,e*.5,e*.5,e*1.35,0,0,E),i.fill(),i.beginPath(),i.ellipse(e*.66,e*.5,e*.5,e*1.35,0,0,E),i.fill(),i.beginPath(),i.ellipse(0,-e*.08,e*1.06,e*1.08,0,0,E),i.fill();break;default:break}}function mr(i,e,t,s,o){let n=s*.44,r=s*o.shoulderK,a=s*.66,l=s*1.68,c=s*5.4,h=`rgba(${o.clothing[0]},${o.clothing[1]},${o.clothing[2]},${o.alpha})`,f=`rgba(${o.tone[0]},${o.tone[1]},${o.tone[2]},${o.alpha})`;i.save(),i.translate(e,t);let d=o.lean*s;i.fillStyle=h,i.beginPath(),i.moveTo(-n,a),i.quadraticCurveTo(-n*1.18,l-d-s*.6,-r,l-d),i.quadraticCurveTo(-r*1.05,l+s*1.2,-r*.94,c),i.lineTo(r*.94,c),i.quadraticCurveTo(r*1.05,l+s*1.2,r,l+d),i.quadraticCurveTo(n*1.18,l+d-s*.6,n,a),i.closePath(),i.fill(),i.fillStyle=f,i.fillRect(-n*.82,s*.5,n*1.64,s*.9),i.save(),i.rotate(o.tilt),i.translate(o.turn*s,0),i.fillStyle=f,s>=18?(i.beginPath(),i.moveTo(-s*.9,-s*.15),i.quadraticCurveTo(-s*.96,-s*1.12,0,-s*1.06),i.quadraticCurveTo(s*.96,-s*1.12,s*.9,-s*.15),i.quadraticCurveTo(s*.86,s*.55,s*.36,s*.98),i.quadraticCurveTo(0,s*1.14,-s*.36,s*.98),i.quadraticCurveTo(-s*.86,s*.55,-s*.9,-s*.15),i.closePath(),i.fill(),s>=22&&(i.beginPath(),i.ellipse(-s*.9,s*.18,s*.13,s*.22,0,0,E),i.ellipse(s*.9,s*.18,s*.13,s*.22,0,0,E),i.fill())):(i.beginPath(),i.ellipse(0,0,s*.9,s*1.06,0,0,E),i.fill()),yr(i,s,o.hair),o.rim>.01&&(i.strokeStyle=`rgba(245,205,150,${(.5*o.rim).toFixed(3)})`,i.lineWidth=Math.max(1,s*.14),i.beginPath(),i.ellipse(0,-s*.06,s*.86,s*1,0,Math.PI*1.12,Math.PI*1.9),i.stroke()),i.restore(),o.rim>.01&&(i.strokeStyle=`rgba(240,200,150,${(.28*o.rim).toFixed(3)})`,i.lineWidth=Math.max(1,s*.12),i.beginPath(),i.moveTo(-r*.8,l-s*.05),i.quadraticCurveTo(-n,l-s*.75,0,l-s*.82),i.quadraticCurveTo(n,l-s*.75,r*.8,l-s*.05),i.stroke()),i.restore()}function gr(i,e,t,s,o,n,r){i.fillStyle=`rgba(${o[0]},${o[1]},${o[2]},${r})`,i.beginPath(),i.moveTo(e-s*1.72,t+s*4),i.quadraticCurveTo(e-s*1.78,t+s*1.55,e-s*.46,t+s*1.02),i.lineTo(e-s*.4,t+s*.62),i.lineTo(e+s*.4,t+s*.62),i.lineTo(e+s*.46,t+s*1.02),i.quadraticCurveTo(e+s*1.78,t+s*1.55,e+s*1.72,t+s*4),i.closePath(),i.fill(),i.fillStyle=`rgba(${n[0]},${n[1]},${n[2]},${r})`,i.beginPath(),i.ellipse(e,t,s*.9,s*1.05,0,0,E),i.fill()}function Ei(i,e,t,s,o){let n=s*.1,r=t-s*.9,a=t-s*.74,l=t-s*.46,c=s*.13,h=s*.09,f=`rgba(${o.tone[0]},${o.tone[1]},${o.tone[2]},${o.alpha})`,d=i.createRadialGradient(e,t,1,e,t,s*.24);d.addColorStop(0,"rgba(0,0,0,0.4)"),d.addColorStop(1,"rgba(0,0,0,0)"),i.save(),i.scale(1,.28),i.fillStyle=d,i.beginPath(),i.ellipse(e,t/.28,s*.24,s*.24,0,0,E),i.fill(),i.restore(),i.fillStyle=f,i.beginPath(),i.moveTo(e-h,l),i.lineTo(e-h*.7,t),i.lineTo(e-h*.1,t),i.lineTo(e-h*.1,l+s*.02),i.lineTo(e+h*.1,l+s*.02),i.lineTo(e+h*.1,t),i.lineTo(e+h*.7,t),i.lineTo(e+h,l),i.closePath(),i.fill(),i.beginPath(),i.moveTo(e-c,a),i.quadraticCurveTo(e-c*.9,l-s*.12,e-h,l),i.lineTo(e+h,l),i.quadraticCurveTo(e+c*.9,l-s*.12,e+c,a),i.quadraticCurveTo(e,a-s*.05,e-c,a),i.closePath(),i.fill(),i.lineCap="round",i.lineJoin="round",i.strokeStyle=f,i.lineWidth=s*.055;let m=a+s*.02;o.pose===1?(i.beginPath(),i.moveTo(e-c*.8,m),i.lineTo(e-c*1.5,t-s*1.02),i.moveTo(e+c*.8,m),i.lineTo(e+c*1.5,t-s*1.02),i.stroke()):o.pose===2?(i.beginPath(),i.moveTo(e-c*.8,m),i.lineTo(e+h*1.4,l-s*.02),i.moveTo(e+c*.8,m),i.lineTo(e-h*.4,l-s*.06),i.stroke(),i.fillStyle=f,i.beginPath(),i.ellipse(e+h*1.5,l-s*.04,s*.07,s*.09,-.5,0,E),i.fill()):o.pose===3?(i.beginPath(),i.moveTo(e-c*.8,m),i.lineTo(e-c*.2,r+n*.6),i.moveTo(e+c*.8,m),i.lineTo(e+c*1.1,l),i.stroke(),i.lineWidth=s*.02,i.beginPath(),i.moveTo(e-c*.2,r+n*.9),i.lineTo(e-c*.2,t-s*.02),i.stroke()):(i.beginPath(),i.moveTo(e-c*.85,m),i.lineTo(e-c*.95,l+s*.02),i.moveTo(e+c*.85,m),i.lineTo(e+c*.95,l+s*.02),i.stroke()),i.fillStyle=f,i.fillRect(e-n*.34,r+n*.6,n*.68,n*.9),i.beginPath(),i.ellipse(e,r,n*.86,n*1.05,0,0,E),i.fill(),o.rimStrength>.01&&(i.strokeStyle=`rgba(${o.rim[0]},${o.rim[1]},${o.rim[2]},${(.6*o.rimStrength).toFixed(3)})`,i.lineWidth=Math.max(1,s*.02),i.beginPath(),i.moveTo(e-c,a),i.lineTo(e-n*.6,r+n*.4),i.moveTo(e-n*.7,r),i.ellipse(e,r,n*.84,n*1.02,0,Math.PI*1.05,Math.PI*1.55),i.stroke())}function Ht(i,e,t,s,o,n,r,a,l){i.save(),i.globalCompositeOperation="lighter";let c=i.createLinearGradient(0,t,0,o);c.addColorStop(0,`rgba(${a},${l})`),c.addColorStop(.5,`rgba(${a},${(l*.4).toFixed(3)})`),c.addColorStop(1,`rgba(${a},0)`),i.fillStyle=c,i.beginPath(),i.moveTo(e-n,t),i.lineTo(s-r,o),i.lineTo(s+r,o),i.lineTo(e+n,t),i.closePath(),i.fill(),i.restore()}function Ai(i,e,t,s,o){let n=i.createRadialGradient(e,t,0,e,t,s*3);n.addColorStop(0,`rgba(${o},0.9)`),n.addColorStop(.4,`rgba(${o},0.35)`),n.addColorStop(1,`rgba(${o},0)`),i.fillStyle=n,i.beginPath(),i.arc(e,t,s*3,0,E),i.fill(),i.fillStyle=`rgba(${o},1)`,i.beginPath(),i.arc(e,t,s,0,E),i.fill()}function kh(i,e,t){let s=document.createElement("canvas");s.width=K,s.height=le;let o=s.getContext("2d"),n=e.x-i.x,r=e.y-i.y,a=Math.hypot(n,r),l=Math.max(2,a*at),c=i.eyeHeightM??Y,h=ur(i,e,t),f=Zo(h.seed),d=210+f()*150,m=Q(220+(f()-.5)*60,.55,.82),y=`${m[0]},${m[1]},${m[2]}`,p=o.createLinearGradient(0,0,0,le);p.addColorStop(0,"#080b12"),p.addColorStop(.42,"#12182c"),p.addColorStop(.5,"#1c2440"),p.addColorStop(.56,"#151b2c"),p.addColorStop(.78,"#171e30"),p.addColorStop(1,"#131829"),o.fillStyle=p,o.fillRect(0,0,K,le);let u=o.createLinearGradient(0,G(-6),0,le);u.addColorStop(0,"rgba(30, 37, 56, 0)"),u.addColorStop(.55,"rgba(30, 37, 56, 0.22)"),u.addColorStop(1,"rgba(22, 28, 44, 0.12)"),o.fillStyle=u,o.fillRect(0,G(-6),K,le-G(-6));let b=Math.atan2(n,-r),g=dr(i,t,b,c),w=g.maxDelta>=hr;w&&pr(o,g.bins,Ge,G);let k=Math.max(.3,Math.min(1,1-(l-6)/60)),L=Ci(c,l),S=Math.min(80,Math.atan2(4,l)*180/Math.PI),v=Math.min(45,L.topPitch),x=L.basePitch;h.mode==="sport"?vr(o,l,c,h,k,d,y,f):h.mode==="arena"?Sr(o,l,c,h,k,y,f):br(o,S,v,x,k,d,y,f);let I=h.mode==="sport"?34:24+Math.floor(f()*8);o.fillStyle=`rgba(${y},0.8)`;for(let P=0;P<I;P++){let M=(P+.5)/I*K,C=G(h.mode==="sport"?58:54+P*7%3*6);o.beginPath(),o.arc(M,C,h.mode==="sport"?2.6:3.2,0,E),o.fill()}wr(o,i,t,e,b,c,n,r,w,h);let T=o.createLinearGradient(0,0,0,le);return T.addColorStop(0,"rgba(0,0,0,0.85)"),T.addColorStop(.12,"rgba(0,0,0,0)"),T.addColorStop(.9,"rgba(0,0,0,0)"),T.addColorStop(1,"rgba(0,0,0,0.55)"),o.fillStyle=T,o.fillRect(0,0,K,le),{url:s.toDataURL("image/jpeg",.82),distanceM:Math.round(l)}}function br(i,e,t,s,o,n,r,a){let l=Ge(-e),c=Ge(e),h=G(t),f=G(s),d=c-l,m=f-h,y=G(Math.min(50,t+10)),p=d*(1.1+(1-o)*.5),u=i.createRadialGradient(K/2,(h+f)/2,8,K/2,(h+f)/2,p);u.addColorStop(0,"rgba(255, 214, 150, 0.34)"),u.addColorStop(.28,"rgba(150, 150, 230, 0.3)"),u.addColorStop(.6,"rgba(99, 102, 241, 0.12)"),u.addColorStop(1,"rgba(99, 102, 241, 0)"),i.fillStyle=u,i.fillRect(l-d*.6,h-m*1.2,d*2.2,m*3.4);let b=Q(n,.62,.55),g=Q(n+40,.7,.5),w=Q(n+70,.78,.52);i.save(),i.beginPath(),i.rect(l,h,d,m),i.clip();let k=i.createLinearGradient(0,h,0,f);k.addColorStop(0,`rgb(${b[0]},${b[1]},${b[2]})`),k.addColorStop(.5,`rgb(${g[0]},${g[1]},${g[2]})`),k.addColorStop(1,`rgb(${w[0]},${w[1]},${w[2]})`),i.globalAlpha=.8,i.fillStyle=k,i.fillRect(l,h,d,m),i.globalAlpha=1;let L=i.createRadialGradient(K/2,(h+f)/2,d*.12,K/2,(h+f)/2,d*.62);L.addColorStop(0,"rgba(6,8,14,0)"),L.addColorStop(.7,"rgba(6,8,14,0.15)"),L.addColorStop(1,"rgba(5,6,11,0.92)"),i.fillStyle=L,i.fillRect(l,h,d,m),i.restore();let S=3+Math.floor(a()*3),v=m*.46,x=f-m*.08;for(let A=0;A<S;A++){let W=(A+1)/(S+1),H=l+d*(.22+W*.56+(a()-.5)*.06);Ei(i,H,x,v*(.9+a()*.24),{tone:[8,10,16],alpha:.9,pose:Math.floor(a()*4),rim:Q(n+20,.5,.7),rimStrength:.7})}i.fillStyle="#05070d",i.fillRect(l-d*.5,y,d*.5,f-y),i.fillRect(c,y,d*.5,f-y);let I=d*.055+3,T=I*1.35;i.fillStyle="#03050a",i.beginPath(),i.moveTo(l,f),i.lineTo(l-I,f),i.lineTo(l-T,y),i.lineTo(l+d*.012,y),i.closePath(),i.fill(),i.beginPath(),i.moveTo(c,f),i.lineTo(c+I,f),i.lineTo(c+T,y),i.lineTo(c-d*.012,y),i.closePath(),i.fill(),i.fillRect(l-T,y,d+T*2,(f-y)*.12);let P=m*.14,M=y+(f-y)*.12;i.fillStyle="rgba(4,6,12,0.96)";let C=7;i.beginPath(),i.moveTo(l-T,M);for(let A=0;A<=C;A++){let W=l-T+(d+T*2)*A/C;i.quadraticCurveTo(W-(d+T*2)/C/2,M+P,W,M)}i.lineTo(c+T,M),i.lineTo(c+T,y),i.lineTo(l-T,y),i.closePath(),i.fill(),i.fillStyle=`rgba(${r},0.12)`,i.fillRect(l-1.5,M,1.5,f-M),i.fillRect(c,M,1.5,f-M),i.fillStyle="#0b0f18",i.fillRect(l-I,f-m*.05,d+I*2,m*.05+3);let R=i.createLinearGradient(0,f-m*.05,0,f+m*.12);R.addColorStop(0,`rgba(255,206,140,${(.5*o).toFixed(3)})`),R.addColorStop(1,"rgba(255,206,140,0)"),i.fillStyle=R,i.fillRect(l-I,f-m*.05,d+I*2,m*.2);let B=3+Math.floor(a()*2);for(let A=0;A<B;A++){let W=(A+1)/(B+1),H=l+d*(W+(a()-.5)*.08),N=G(Math.min(62,t+26)),$=(a()-.5)*d*.16;Ht(i,H,N,H+$,f,4,d*.09,r,.16*(.7+o*.5)),Ai(i,H,N,2.4,r)}}function Sr(i,e,t,s,o,n,r){let a=Math.min(e*.6,Math.max(3,s.voidRadiusM)),l=Math.min(55,Math.atan2(a,e)*180/Math.PI),c=K/2,h=1.2,f=Math.max(e*.45,e-a),d=e+a,m=Math.atan2(h-t,f)*180/Math.PI,y=Math.atan2(h-t,d)*180/Math.PI,p=Math.atan2(-t,f)*180/Math.PI,u=G(m),b=G(y),g=G(p),w=Ge(l)-c,k=Math.max(6,(u-b)/2),L=(u+b)/2,S=i.createRadialGradient(c,g,4,c,g,w*2.6);S.addColorStop(0,`rgba(255,206,150,${(.2*o).toFixed(3)})`),S.addColorStop(.5,"rgba(150,140,190,0.08)"),S.addColorStop(1,"rgba(40,44,60,0)"),i.save(),i.globalCompositeOperation="lighter",i.fillStyle=S,i.fillRect(c-w*2.6,b-k,w*5.2,g-b+k+40),i.restore(),i.fillStyle="#0c1019",i.beginPath(),i.moveTo(c-w,L),i.ellipse(c,L,w,k,0,Math.PI,0,!1),i.lineTo(c+w,g),i.ellipse(c,g,w,k,0,0,Math.PI,!1),i.closePath(),i.fill();let v=i.createLinearGradient(0,L,0,g);v.addColorStop(0,`rgba(${n},0.14)`),v.addColorStop(1,"rgba(0,0,0,0)"),i.fillStyle=v,i.fillRect(c-w,L,w*2,g-L);let x=[[{u:-.24,v:.4,lead:!0,pose:3},{u:.34,v:-.04,pose:2},{u:-.52,v:-.38,pose:0}],[{u:.2,v:.34,lead:!0,pose:3},{u:-.3,v:-.08,pose:2}],[{u:-.1,v:.28,lead:!0,pose:1},{u:.44,v:-.2,pose:2},{u:-.46,v:-.14,pose:2},{u:.08,v:-.46,pose:0}]],I=x[Math.floor(r()*x.length)],T=r()<.5?-1:1,P=F=>c+F.u*T*w*.84,M=F=>L+F.v*k*.8,C=I.find(F=>F.lead)??I[0],R=P(C),B=i.createLinearGradient(0,L-k,0,L+k);B.addColorStop(0,"#3d4a72"),B.addColorStop(1,"#232b47"),i.fillStyle=B,i.beginPath(),i.ellipse(c,L,w,k,0,0,E),i.fill();let A=i.createRadialGradient(R,L,2,R,L,w);A.addColorStop(0,`rgba(255,214,160,${(.5*o).toFixed(3)})`),A.addColorStop(1,"rgba(255,214,160,0)"),i.save(),i.globalCompositeOperation="lighter",i.fillStyle=A,i.beginPath(),i.ellipse(c,L,w,k,0,0,E),i.fill(),i.restore(),i.strokeStyle=`rgba(${n},0.7)`,i.lineWidth=2,i.beginPath(),i.ellipse(c,L,w,k,0,0,E),i.stroke();let W=Math.max(24,(g-b)*1.3),H=I.length>=3?3:2;for(let F=0;F<H;F++){let ce=(-.62+F*.52+(r()-.5)*.12)*-T,ge=c+ce*w*.7,He=L-k*(.45+r()*.18),Ce=w*(.07+r()*.04),Xt=W*(.26+r()*.12);i.fillStyle="#0a0e18",i.fillRect(ge-Ce/2,He-Xt,Ce,Xt),i.fillStyle=`rgba(${n},0.3)`,i.fillRect(ge-Ce/2,He-Xt,Ce,1.5)}if(I.length>=3){let F=c-C.u*T*w*.4;i.fillStyle="#0b0f1a",i.beginPath(),i.ellipse(F,L-k*.34,w*.08,k*.1,0,0,E),i.fill(),i.strokeStyle=`rgba(${n},0.35)`,i.lineWidth=1,i.stroke()}for(let F of[...I].sort((ce,ge)=>ce.v-ge.v)){let ce=.82+(F.v+1)*.14;Ei(i,P(F),M(F),W*ce*(F.lead?1.06:.92),{tone:[18,21,34],alpha:.95,pose:F.pose,rim:Q(40,.72,.8),rimStrength:F.lead?1.4:.9})}let N=G(Math.min(60,y+34)),$=k*1.1+6;i.strokeStyle="rgba(60,68,92,0.85)",i.lineWidth=3,i.beginPath(),i.ellipse(c,N,w*1.15,$,0,0,E),i.stroke();let D=4+Math.floor(r()*3);for(let F=0;F<D;F++){let ce=F/D*E,ge=c+Math.cos(ce)*w*1.15,He=N+Math.sin(ce)*$;if(Math.sin(ce)>-.2){let Ce=c+(r()-.5)*w*.8;Ht(i,ge,He,Ce,L,3,w*.32,n,.2*(.7+o*.4))}Ai(i,ge,He,3,n)}let z=G(Math.min(52,y+24)),_=Math.max(60,w*.4),X=Math.max(24,_*.34);i.strokeStyle="rgba(70,78,102,0.6)",i.lineWidth=1.5,i.beginPath(),i.moveTo(c-_*.3,z-X/2),i.lineTo(c-_*.16,z-X*2.2),i.moveTo(c+_*.3,z-X/2),i.lineTo(c+_*.16,z-X*2.2),i.stroke(),i.fillStyle="#0d1220",i.fillRect(c-_/2,z-X/2,_,X);let zt=i.createLinearGradient(0,z-X*.3,0,z+X*.42);zt.addColorStop(0,`rgba(${n},0.5)`),zt.addColorStop(1,"rgba(255,214,160,0.32)"),i.fillStyle=zt,i.fillRect(c-_*.42,z-X*.3,_*.84,X*.72),i.fillStyle="rgba(255,214,160,0.55)",i.fillRect(c-_/2,z+X/2-2,_,2);let Vt=i.createRadialGradient(c,z,4,c,z,_*1.1);Vt.addColorStop(0,`rgba(${n},0.2)`),Vt.addColorStop(1,"rgba(0,0,0,0)"),i.save(),i.globalCompositeOperation="lighter",i.fillStyle=Vt,i.fillRect(c-_*1.1,z-_*.8,_*2.2,_*1.6);let Wt=i.createRadialGradient(c,(N+L)/2,6,c,(N+L)/2,w*1.5);Wt.addColorStop(0,`rgba(${n},${(.1*(.6+o*.5)).toFixed(3)})`),Wt.addColorStop(1,"rgba(0,0,0,0)"),i.fillStyle=Wt,i.fillRect(c-w*1.5,N-40,w*3,L-N+80),i.restore();let jo=c+Math.sign(R-c||1)*w*.5;Ht(i,jo,N-$*.4,R,M(C),2.5,w*.16,"255,224,178",.42*(.7+o*.4));let Kt=i.createRadialGradient(R,M(C),1,R,M(C),w*.2);Kt.addColorStop(0,`rgba(255,228,185,${(.4*o).toFixed(3)})`),Kt.addColorStop(1,"rgba(255,228,185,0)"),i.save(),i.globalCompositeOperation="lighter",i.fillStyle=Kt,i.beginPath(),i.ellipse(R,M(C),w*.2,k*.24,0,0,E),i.fill(),i.restore()}function vr(i,e,t,s,o,n,r,a){let l=K/2,c=Math.max(10,s.voidRadiusM),h=Math.max(2,e-c),f=e+c,d=Math.min(78,Math.atan2(c*1.15,e)*180/Math.PI),m=Math.atan2(-t,h)*180/Math.PI,y=Math.atan2(-t,f)*180/Math.PI,p=G(m),u=G(y),b=Ge(d)-l,g=(p+u)/2,w=Math.max(10,(p-u)/2),k=i.createRadialGradient(l,g,4,l,g,b);k.addColorStop(0,"#e8f0fb"),k.addColorStop(.7,"#b9c9e2"),k.addColorStop(1,"#8fa3c4"),i.save(),i.beginPath(),i.ellipse(l,g,b,w,0,0,E),i.clip(),i.fillStyle=k,i.fillRect(l-b,g-w,b*2,w*2),i.strokeStyle="rgba(90,120,170,0.5)",i.lineWidth=3,i.beginPath(),i.moveTo(l,g-w),i.lineTo(l,g+w),i.moveTo(l-b*.5,g-w),i.lineTo(l-b*.5,g+w),i.moveTo(l+b*.5,g-w),i.lineTo(l+b*.5,g+w),i.stroke(),i.strokeStyle="rgba(180,90,110,0.45)",i.beginPath(),i.ellipse(l,g,w*.9,w*.5,0,0,E),i.stroke(),i.restore(),i.strokeStyle="rgba(210,225,245,0.6)",i.lineWidth=2.5,i.beginPath(),i.ellipse(l,g,b,w,0,0,E),i.stroke(),i.fillStyle="rgba(20,26,40,0.8)";for(let P=0;P<5;P++){let M=l+(a()-.5)*b*1.4,C=g+(a()-.5)*w*1.1,R=Math.max(2,w*.06);i.beginPath(),i.ellipse(M,C,R*.6,R,0,0,E),i.fill()}let L=i.createRadialGradient(l,g,4,l,g,b*1.4);L.addColorStop(0,"rgba(200,220,255,0.12)"),L.addColorStop(1,"rgba(200,220,255,0)"),i.save(),i.globalCompositeOperation="lighter",i.fillStyle=L,i.fillRect(l-b*1.4,u-w,b*2.8,p-u+w*2),i.restore();let S=G(Math.min(66,y+60)),v=Math.max(80,b*.7),x=v*.5,I=i.createRadialGradient(l,S,4,l,S,v*1.6);I.addColorStop(0,`rgba(${r},0.3)`),I.addColorStop(1,`rgba(${r},0)`),i.save(),i.globalCompositeOperation="lighter",i.fillStyle=I,i.fillRect(l-v*1.6,S-v*1.2,v*3.2,v*2.4),i.restore(),i.fillStyle="#080b12",i.beginPath(),i.moveTo(l-v/2,S-x/2),i.lineTo(l+v/2,S-x/2),i.lineTo(l+v*.6,S),i.lineTo(l+v/2,S+x/2),i.lineTo(l-v/2,S+x/2),i.lineTo(l-v*.6,S),i.closePath(),i.fill();let T=n;for(let P=0;P<3;P++){let M=Q(T+P*30,.5,.5);i.fillStyle=`rgba(${M[0]},${M[1]},${M[2]},0.75)`;let C=v*.26;i.fillRect(l-v*.42+P*(C+v*.06),S-x*.32,C,x*.64)}i.fillStyle=`rgba(${r},0.9)`;for(let P=0;P<8;P++){let M=l-v*.6+v*1.2*P/7;i.beginPath(),i.arc(M,S+x*.62,2.4,0,E),i.fill()}}function wr(i,e,t,s,o,n,r,a,l,c){let h=e.sectionId,f=!1,d=[];for(let p of t){if(p.id===e.id)continue;let u=p.x-e.x,b=p.y-e.y,g=Math.hypot(u,b)*at;if(h&&p.sectionId===h&&g<3&&u*r+b*a>0&&(f=!0),g<.3||g>32)continue;let k=((Math.atan2(u,-b)-o)*180/Math.PI+540)%360-180,L=l?(p.eyeHeightM??Y)-n:0,S=Math.atan2(L-.28,g)*180/Math.PI;if(S>10&&g>5)continue;let v=0;for(let T=0;T<p.id.length;T++)v=v*31+p.id.charCodeAt(T)&65535;let x=.9+(v&15)/40,I=Math.min(78,Math.atan2(.16,g)*180/Math.PI*cr*x);I<1.2||d.push({hx:Ge(k),hy:G(S),r:I,d:g,hash:v})}d.sort((p,u)=>u.d-p.d);let m=[];{let p=[...d].sort((g,w)=>g.hy-w.hy),u=[],b=()=>{if(!u.length)return;let g=u.reduce((L,S)=>L+S.d,0)/u.length,w=u.reduce((L,S)=>L+S.hy,0)/u.length,k=u.reduce((L,S)=>L+S.r,0)/u.length;m.push({figs:u.sort((L,S)=>S.d-L.d),d:g,hy:w,r:k}),u=[]};for(let g of p){let w=u[u.length-1];w&&Math.abs(g.hy-w.hy)>Math.max(5,(w.r+g.r)/2*1.7)&&b(),u.push(g)}b()}m.sort((p,u)=>u.d-p.d);let y=[[22,26,40],[28,27,42],[24,31,46],[31,30,47],[20,24,36]];for(let p of m){if(p.figs.length>=3&&p.r>=1.6&&p.r<26){let u=[],b=[...p.figs].sort((k,L)=>k.hx-L.hx),g=[];for(let k of b){let L=g[g.length-1];L&&k.hx-L.hx>Math.max(14,k.r*7)&&(g.length>=3&&u.push(g),g=[]),g.push(k)}g.length>=3&&u.push(g);let w=Math.min(.42,.5*(1-p.d/42));if(w>.05){i.fillStyle=`rgba(15, 19, 31, ${w.toFixed(3)})`;for(let k of u){let L=k[0].hx-p.r*1.6,S=k[k.length-1].hx+p.r*1.6;i.beginPath(),i.roundRect(L,p.hy+p.r*.8,S-L,p.r*2.4,p.r*.8),i.fill()}}}for(let u of p.figs){let b=u.d<12?.95:u.d<17?Math.max(.66,.95-(u.d-12)/18):Math.max(.3,.68-(u.d-17)/34),g=Math.round((1-Math.min(1,u.d/16))*10),w=[14+(u.hash>>4&6)+g,17+(u.hash>>4&6)+g,25+(u.hash>>4&6)+g],k=y[u.hash%y.length],L=[k[0]+g,k[1]+g,k[2]+g];if(u.r>=13){let S=u.d<9?.16*(1-u.d/9)+(c.mode==="proscenium"?.06:0):0;mr(i,u.hx,u.hy,u.r,{tone:w,clothing:L,alpha:b,tilt:((u.hash>>2&7)-3.5)*.018,shoulderK:1.72+(u.hash>>5&7)/22,hair:u.hash%fr,rim:S,turn:((u.hash>>8&7)-3.5)*.034,lean:((u.hash>>10&3)-1.5)*.09})}else u.r>=5.5?gr(i,u.hx,u.hy,u.r,L,w,b):(i.fillStyle=`rgba(${w[0]},${w[1]},${w[2]},${b.toFixed(3)})`,i.beginPath(),i.arc(u.hx,u.hy,u.r,0,E),i.fill(),i.beginPath(),i.ellipse(u.hx,u.hy+u.r*1.4,u.r*1.85,u.r*.95,0,Math.PI,0,!0),i.fill())}}if(f){let p=G(-34);i.fillStyle="rgba(6, 8, 14, 0.92)",i.fillRect(0,p,K,le-p),i.fillStyle="rgba(24, 30, 46, 0.9)";let u=16;for(let b=0;b<u;b++){let g=(b+.5)/u*K;i.beginPath(),i.ellipse(g,p+6,K/u*.42,22,0,Math.PI,0,!0),i.fill()}}}var j=480,Oe=270,Ri=50,Ie=30,qo=i=>(i+Ri)/(2*Ri)*j,rt=i=>(Ie-i)/(2*Ie)*Oe;function Lh(i,e,t){let s=document.createElement("canvas");s.width=j,s.height=Oe;let o=s.getContext("2d"),n=e.x-i.x,r=e.y-i.y,a=Math.max(2,Math.hypot(n,r)*at),l=Zo(Uo(`${i.id}|${Math.round(e.x)},${Math.round(e.y)}`)),c=210+l()*150,h=Q(220+(l()-.5)*60,.55,.82),f=`${h[0]},${h[1]},${h[2]}`,d=o.createLinearGradient(0,0,0,Oe);d.addColorStop(0,"#080b12"),d.addColorStop(.44,"#151c32"),d.addColorStop(.5,"#1d2644"),d.addColorStop(.58,"#161c2e"),d.addColorStop(1,"#131829"),o.fillStyle=d,o.fillRect(0,0,j,Oe);let m=i.eyeHeightM??Y,y=Ci(m,a),p=Math.min(Ri-2,Math.atan2(4,a)*180/Math.PI),u=Math.min(Ie-2,y.topPitch),b=Math.max(-Ie+2,y.basePitch),g=qo(-p),w=qo(p),k=rt(u),L=rt(b),S=w-g,v=L-k,x=Math.max(.35,Math.min(1,1-(a-6)/60)),I=rt(Math.min(Ie-1,u+8)),T=o.createRadialGradient(j/2,(k+L)/2,4,j/2,(k+L)/2,S*1.15);T.addColorStop(0,"rgba(255,214,150,0.34)"),T.addColorStop(.28,"rgba(150,150,230,0.3)"),T.addColorStop(.6,"rgba(99,102,241,0.12)"),T.addColorStop(1,"rgba(99,102,241,0)"),o.fillStyle=T,o.fillRect(g-S*.6,k-v*1.2,S*2.2,v*3.4);let P=Q(c,.62,.55),M=Q(c+40,.7,.5),C=Q(c+70,.78,.52);o.save(),o.beginPath(),o.rect(g,k,S,v),o.clip();let R=o.createLinearGradient(0,k,0,L);R.addColorStop(0,`rgb(${P[0]},${P[1]},${P[2]})`),R.addColorStop(.5,`rgb(${M[0]},${M[1]},${M[2]})`),R.addColorStop(1,`rgb(${C[0]},${C[1]},${C[2]})`),o.globalAlpha=.8,o.fillStyle=R,o.fillRect(g,k,S,v),o.globalAlpha=1;let B=o.createRadialGradient(j/2,(k+L)/2,S*.12,j/2,(k+L)/2,S*.6);B.addColorStop(0,"rgba(6,8,14,0)"),B.addColorStop(.7,"rgba(6,8,14,0.15)"),B.addColorStop(1,"rgba(5,6,11,0.9)"),o.fillStyle=B,o.fillRect(g,k,S,v),o.restore();let A=3,W=L-v*.08;for(let D=0;D<A;D++){let z=(D+1)/(A+1);Ei(o,g+S*(.24+z*.52),W,v*.46*(.9+l()*.24),{tone:[8,10,16],alpha:.9,pose:Math.floor(l()*4),rim:Q(c+20,.5,.7),rimStrength:.7})}o.fillStyle="#05070d",o.fillRect(g-S*.5,I,S*.5,L-I),o.fillRect(w,I,S*.5,L-I);let H=S*.05+2,N=H*1.35;o.fillStyle="#03050a",o.beginPath(),o.moveTo(g,L),o.lineTo(g-H,L),o.lineTo(g-N,I),o.lineTo(g+S*.012,I),o.closePath(),o.fill(),o.beginPath(),o.moveTo(w,L),o.lineTo(w+H,L),o.lineTo(w+N,I),o.lineTo(w-S*.012,I),o.closePath(),o.fill(),o.fillRect(g-N,I,S+N*2,(L-I)*.13),o.fillStyle=`rgba(${f},0.12)`,o.fillRect(g-1.2,I,1.2,L-I),o.fillRect(w,I,1.2,L-I),o.fillStyle="#0b0f18",o.fillRect(g-H,L-v*.05,S+H*2,v*.05+2);let $=o.createLinearGradient(0,L-v*.05,0,L+v*.14);$.addColorStop(0,`rgba(255,206,140,${(.5*x).toFixed(3)})`),$.addColorStop(1,"rgba(255,206,140,0)"),o.fillStyle=$,o.fillRect(g-H,L-v*.05,S+H*2,v*.22);for(let D=0;D<3;D++){let z=(D+1)/4,_=g+S*z,X=rt(Math.min(Ie-1,u+20));Ht(o,_,X,_+(l()-.5)*S*.14,L,3,S*.09,f,.17*x),Ai(o,_,X,1.8,f)}o.fillStyle=`rgba(${f},0.75)`;for(let D=0;D<8;D++)o.beginPath(),o.arc((D+.5)/8*j,rt(Ie-4-D%2*3),2.2,0,E),o.fill();o.fillStyle="rgba(10,13,20,0.9)",o.fillRect(0,Oe-26,j,26),o.fillStyle="rgba(30,37,54,0.9)";for(let D=0;D<9;D++){let z=D*(j/9)+j/18;o.beginPath(),o.ellipse(z,Oe-22,j/9*.4,15,0,Math.PI,0,!0),o.fill()}return{url:s.toDataURL("image/jpeg",.8),distanceM:Math.round(a)}}var Qo=new Set(["en"]),Nt=new Map;async function kr(i){if(typeof __SEATLAYER_CDN__<"u"&&__SEATLAYER_CDN__)return(await import(fs(`i18n/${i}.mjs`))).default??null;let{LOADERS:e}=await import("./localeLoaders-KUIWB7O3.js"),t=e[i];return t?await t():null}async function Mh(i,e){let t=Cs(i,e);if(t==="en"||Qo.has(t))return Re(t),t;if(!Is.includes(t))return Re("en"),"en";try{let s=Nt.get(t);s||(s=kr(t),Nt.set(t,s));let o=await s;return Nt.delete(t),o?(Re(t,o),Qo.add(t),t):(Re("en"),"en")}catch{return Nt.delete(t),Re("en"),"en"}}export{Cr as ACCESSIBILITY_RING_COLOR,Tr as ACCESSIBILITY_TYPES,Lr as CHART_STORAGE_KEY,da as CURRENCY_CHOICES,ha as DEFAULT_CURRENCY,Rr as LABEL_STYLE_MAX_SIZE,xr as LABEL_STYLE_MIN_SIZE,Sa as LOCALE_NAMES,Qr as MAX_EVENT_INVENTORY,Zr as MAX_GA_CAPACITY,Ko as PickerController,me as PickerSelectionError,na as RENDERED_QUALITY_REPORT_VERSION,Mr as SEAT_COMMERCIAL_MARKS,nn as SUPPORTED_LOCALES,Er as SURROUNDINGS_SHAPE_ROLES,Li as SeatmapRenderer,Fr as TABLE_SEAT_OFFSET,Br as TIER_HEIGHT_M,Is as TRANSLATED_LOCALES,Wi as UNGROUPED_ID,Ir as accessibilityMeta,$t as accessibilityRingColor,Oi as allObjects,Ki as applyHidden,Vi as chartBounds,Yt as computeSections,Do as createRenderer,sn as currencyExponent,ua as currencySymbol,Wr as expandBooth,Ne as expandChart,Gr as expandRow,Or as expandRowSlots,Vr as expandTable,Nr as expandTableSlots,Yr as floorObjects,Ur as floorOverviewTranslations,ht as floorsOf,Ni as floorsShareFootprint,Ia as formatDate,pa as formatMinor,ii as formatMoney,on as fromMinorUnits,ze as gaAreasOf,ea as gaInventorySegments,jr as gaUnitLabel,dt as gaUnitLabels,kh as generateSeatPanorama,Lh as generateSeatThumb,va as getLocale,ta as growJoinedGAInventory,oa as hiddenObjectIds,ra as inspectRenderedQualityEvidence,ia as isGaUnitLabel,ka as isLocaleLoaded,sa as isSectionHidden,Ar as layerOf,Hi as layoutFloorOverview,zi as layoutFloorRings,Mh as loadLocale,wa as localeDirection,Xr as objectCenter,$r as owningSectionForObject,Kr as pointInPolygon,J as pointInPolygonWithHoles,ct as polygonLabelPoint,Cs as resolveLocale,_r as rowInventoryCount,Dr as rowSeatPositions,Pr as seatCommercialMeta,lt as sectionGeometry,Re as setLocale,Ts as setMoneyLocale,La as setStringOverrides,Gi as stackFloors,U as t,Ta as tCount,zr as tableInventoryCount,Hr as tableSeatCountsBySide,qr as translateObject,Jr as validGAInventorySegments};
|
|
1
|
+
import{a as Jt,b as hs,d as ei,f as ds,g as vt,i as ps,k as us}from"./chunk-UCLIUNHN.js";import{a as na,b as ra}from"./chunk-LVUGIKHG.js";import{b as qi,e as gt,g as Ui,h as ue,i as te,j as Zi,k as Qi,l as bt,m as ji}from"./chunk-DFNYIQY3.js";import{b as fs}from"./chunk-FOYQOIWG.js";import{a as de,b as $i,c as Pe,d as ut,e as ft,f as be,g as ee,m as pe,n as oe,q as Zt,r as yt,t as Yi,u as mt,v as q,w as Qt}from"./chunk-GXMGOWKB.js";import{b as xe,f as ss,g as os,m as ns,x as rs,y as as}from"./chunk-DNGP2HDT.js";import{a as Zr,b as Qr,c as jr,d as Jr,e as ea,f as dt,g as ta,h as ze,i as ia,j as Wi,k as Yt,l as sa,m as oa,n as Ki}from"./chunk-YPVY3Z5S.js";import{c as ls,e as cs}from"./chunk-T2LWVOQ3.js";import{a as Lr,b as Tr,c as Ir,d as Cr,e as $t,f as Mr,g as Pr,h as xr,i as Rr,j as Er,k as Ar,m as We,p as is}from"./chunk-VI3IZS2B.js";import{b as jt,f as Ji,h as St,i as es,k as ts}from"./chunk-UL5OIGIF.js";import{Aa as Yr,Ba as Oi,Ca as qr,Da as Gi,Ea as Hi,Fa as Ni,Ga as zi,Ha as Ur,Ia as Ne,Ja as Vi,W as Di,X as Me,Y as Br,ea as Y,fa as _i,ga as lt,ka as Fr,la as Dr,ma as _r,na as Or,oa as Gr,pa as Hr,qa as Nr,ra as zr,s as Bi,sa as Vr,ta as Wr,u as Fi,ua as Kr,va as J,w as O,wa as ct,xa as Xr,ya as $r,za as ht}from"./chunk-RZLIIQDP.js";import{B as se,h as qt,s as Ve,t as fe,u as he,v as pt,w as Ut,y as Xi}from"./chunk-CXF32VPG.js";import{Konva as _t}from"konva/lib/Core";import{Stage as Jn}from"konva/lib/Stage";import{Layer as wi}from"konva/lib/Layer";import{Group as ke}from"konva/lib/Group";import{Circle as Le}from"konva/lib/shapes/Circle";import{Rect as it}from"konva/lib/shapes/Rect";import{Line as st}from"konva/lib/shapes/Line";import{Text as Te}from"konva/lib/shapes/Text";import{Path as er}from"konva/lib/shapes/Path";import{Image as tr}from"konva/lib/shapes/Image";import{Shape as ir}from"konva/lib/Shape";var wt=1.12;function ti(i){return{x:i.width()/2,y:i.height()/2}}function ys(i,e,t){if(e.width<=0||e.height<=0)return i.scaleX();let s=Math.min(i.width()/(e.width*wt),i.height()/(e.height*wt));return O(s,t.min,t.max)}function ms(i,e,t,s){let o=O(e,s.min,s.max),n=i.scaleX();if(o===n)return!1;let r=(t.x-i.x())/n,a=(t.y-i.y())/n;return i.scale({x:o,y:o}),i.position({x:t.x-r*o,y:t.y-a*o}),!0}function gs(i,e,t,s){let o=Math.min(i.width()/(e.width*wt),i.height()/(e.height*wt)),n=O(Math.max(o,s??t.min),t.min,t.max);i.scale({x:n,y:n}),i.position({x:i.width()/2-(e.x+e.width/2)*n,y:i.height()/2-(e.y+e.height/2)*n})}var Ss;function vs(i){Ss=i}function Jo(i){return typeof i=="number"?i:i instanceof Date?i.getTime():Date.parse(i)}var bs=new Map;function en(i,e){let t=i??Ss,s=`${t??""}|${JSON.stringify(e)}`,o=bs.get(s);return o||(o=new Intl.DateTimeFormat(t,e),bs.set(s,o)),o}var tn={dateStyle:"medium",timeStyle:"short"};function ws(i,e={}){let{locale:t,...s}=e,o=Jo(i);if(!Number.isFinite(o))return"";let n=Object.keys(s).length?s:tn;return en(t,n).format(o)}var ha="USD",da=["USD","EUR","GBP","CAD","AUD","INR","AED","SGD","JPY","CHF","SEK","NZD","ZAR","MXN","BRL"],Ls;function Ts(i){Ls=i}var ks=new Map;function kt(i,e,t,s){let o=s??Ls,n=`${o??""}|${i}|${e??"auto"}|${t??"auto"}`,r=ks.get(n);return r||(r=new Intl.NumberFormat(o,{style:"currency",currency:i,minimumFractionDigits:e,maximumFractionDigits:t}),ks.set(n,r)),r}function ii(i,e="USD",t,s){if(typeof t=="object"){let n=t;try{return kt(e,n.minimumFractionDigits,n.maximumFractionDigits,n.locale).format(i)}catch(r){if(n.fallback)return n.fallback(i,e);throw r}}let o=t??(Number.isInteger(i)?0:void 0);return kt(e,o,o,s).format(i)}function sn(i="USD"){try{return kt(i,void 0,void 0).resolvedOptions().maximumFractionDigits??2}catch{return 2}}function on(i,e="USD"){return i/10**sn(e)}function pa(i,e="USD",t){return ii(on(i,e),e,void 0,t)}function ua(i="USD"){return kt(i,0,0).formatToParts(0).find(t=>t.type==="currency")?.value??i}var Ke={"common.cancel":"Cancel","common.close":"Close","common.done":"Done","common.copied":"\u2713 Copied","picker.holdExpired":"Your hold expired \u2014 the seats were released. Pick again.","picker.poweredBy":"Powered by SeatLayer","picker.testMode":"TEST MODE","picker.orphanHint":"This leaves a single seat stranded \u2014 consider shifting one seat over.","picker.companionRequiresWheelchair":"Requires the adjacent wheelchair place","picker.companionPairRequired":"Select the adjacent wheelchair place with each companion ticket.","map.aria":"Seating map. Use arrow keys to move between seats, Enter to select.","map.seatsLeft":"{count} LEFT","map.soldOut":"SOLD OUT","map.fromPrice":"FROM {price}","map.statusHeld":"On hold","map.statusTaken":"Taken","picker.floor":"Floor","picker.zoomLevel":"Zoom level","picker.rungTip.zones":"Venue overview \u2014 groups of sections such as North Stand or VIP","picker.rungTip.sections":"Section blocks \u2014 sold-out and nearly-gone sections shade to show availability at a glance","picker.rungTip.seats":"Individual seats \u2014 blocks melt into dots","picker.rungLabel.zones":"ZONES","picker.rungLabel.sections":"SECTIONS","picker.rungLabel.seats":"SEATS","picker.sectionSummaryAria":"{label} section summary","picker.closeSectionSummary":"Close section summary","picker.seatsLeftInSection.one":"{count} seat left","picker.seatsLeftInSection.other":"{count} seats left","picker.overview":"Overview","picker.entrance":"Entrance","picker.tapSeatHint":"Tap any seat to check its view","picker.ticketTierFor":"Ticket tier for {label}","picker.viewFromSeat":"View from seat {label}","picker.real360":"REAL 360\xB0","picker.preview":"PREVIEW","picker.sightline":"\u2248 {m} m to stage","picker.panorama360":"360\xB0 venue photo","picker.illustrationCaption":"illustration \xB7 \u2248 {m} m from stage","picker.restrictedView":"Restricted view","picker.obstructedView":"Obstructed view","picker.premiumSeat":"Premium seat","picker.hideLimitedView":"Hide limited-view seats","picker.bestSeatsPremium":"Best seats","picker.premiumFallbackNote":"No premium block of {count} \u2014 showing best overall","picker.loading3d":"Building the 3D venue\u2026","picker.unavailable3d":"3D could not start. The seat map is still available.","picker.jumpToSection":"Jump to section","picker.salesClosedPill":"Sales are closed","picker.salesClosedCopy":"Ticket sales for this event have ended.","picker.salesClosedCta":"Sales closed","picker.salesClosedToast":"Sales are closed for this event.","picker.holdReassurance":"Yours for {time} \u2014 you won\u2019t be charged yet.","picker.securingSeats":"Securing your seats\u2026","picker.openingCheckout":"Opening secure checkout\u2026","picker.peekSecured":"\u2713 {count} secured \xB7 {total} \u2014 you won\u2019t be charged yet","picker.priceHint":"Colours on the map are ticket types \u2014 tap one below to show just those seats.","picker.findTogetherInstead":"Find seats together instead","picker.keepMyPicks":"Keep my picks","picker.accessExpiredBody":"Sign in again, or reload the page, to keep browsing these seats. Anything you are already holding stays yours.","picker.accessExpiredTitle":"Your access session has ended","picker.accessInvalidBody":"You can still book anything shown as available. Contact whoever sent you here for access to the rest.","picker.accessInvalidTitle":"We couldn\u2019t verify your access","picker.accessPausedBody":"The organizer has paused this selection. Try again in a few minutes.","picker.accessPausedTitle":"These seats are on hold right now","picker.accessRetry":"Try again","picker.accessRevokedBody":"Ask whoever sent you here for a new link to keep booking these seats.","picker.accessRevokedTitle":"This access link is no longer active","picker.accessiblePhysicalSeat":"Accessible physical seat","picker.addTime":"Add time","picker.addingEllipsis":"Adding\u2026","picker.allLevels":"All levels","picker.allPlacesBookedTogether":"All {count} places are booked together as one exclusive table.","picker.allPrices":"All prices","picker.allSeats":"All seats","picker.allSetTitle":"You\u2019re all set","picker.anyTicketType":"Any ticket type","picker.anyVenueZone":"Any venue zone","picker.areas":"Areas","picker.available":"Available","picker.backToMap":"Back to map","picker.backToVenue":"Back to venue","picker.bestSeatsStar":"\u2726 Best seats","picker.booth":"Booth","picker.capacityGuests":"{count} guests","picker.change":"Change","picker.chartDerivedModel":"Chart-derived model","picker.chartDerivedSeatEye":"Live 3D \xB7 chart-derived seat-eye \xB7 not surveyed","picker.checkConnection":"Check your connection and try again.","picker.checkoutCouldNotBeOpened":"Checkout could not be opened. Your seats are still held \u2014 please try again.","picker.chooseAnotherToCompare":"Choose another seat to compare.","picker.chooseGuestsCopy":"Choose how many guests will sit together. This table is held exclusively for your party.","picker.chooseMinMaxGuests":"Choose {min}\u2013{max} guests","picker.clearSavedSeatComparison":"Clear saved seat comparison","picker.close":"Close","picker.closeSeatStatus":"Close seat status","picker.closestGroupChosenInstantly":"Closest available group, chosen instantly.","picker.collapseTicketPanel":"Collapse ticket panel","picker.compareCount":"Compare {count}","picker.compareWithSaved":"Compare with saved","picker.confirmOrCancelSeat":"Confirm or cancel this seat","picker.confirmSeatLabel":"Confirm seat {label}","picker.confirmYourTable":"Confirm your table","picker.confirmedAndOnWay":"confirmed. A confirmation is on its way.","picker.continue":"Continue","picker.continueToCheckout":"Continue to checkout","picker.couldNotAddMoreTime":"Couldn\u2019t add more time \u2014 please head to checkout now.","picker.couldNotFindSeatsTogether":"We couldn\u2019t find {count} seats together. Try fewer seats or another ticket type.","picker.couldNotReleaseTickets":"Couldn\u2019t release your tickets. Your hold is unchanged.","picker.couldNotRemoveLabel":"Couldn\u2019t remove {label}. Your hold is unchanged.","picker.currentOffer":"Current offer","picker.currentTicketOffer":"Current ticket offer","picker.dragToLookAround":"Drag to look around \xB7 scroll to zoom","picker.emptyWheelchairSpace":"Empty wheelchair space","picker.exitFullScreen":"Exit full screen","picker.fewer":"Fewer","picker.fewerGuests":"Fewer guests","picker.fewerSeats":"Fewer seats","picker.filterAndFocusByPrice":"Filter and focus seats by price","picker.filters":"Filters","picker.findBestSeatsCount.one":"Find {count} best seat","picker.findBestSeatsCount.other":"Find {count} best seats","picker.findBestSeatsTogether":"Find the best seats together","picker.findNewSeats":"Find new seats","picker.findingBestSeats":"Finding the best seats\u2026","picker.findingEllipsis":"Finding\u2026","picker.fitToScreen":"Fit to screen","picker.flat2dMap":"Flat 2D map","picker.flexiblePartyTypeWord":"Flexible party \xB7 {typeWord}","picker.fullScreen":"Full screen","picker.generalAdmission":"General admission","picker.guestCountCouldNotBeSecured":"That guest count could not be secured. Your current table hold is unchanged.","picker.guestCountNoLongerAvailable":"That guest count is no longer available. Your current hold is unchanged.","picker.guests":"Guests","picker.guestsCount":"{count} guests","picker.guestsCountEdit":"{count} guests \xB7 Edit","picker.held":"Held","picker.heldForYou":"Held for you","picker.heldSeatExplanation":"Another buyer is holding this seat. It may become available again.","picker.heldTicketsReleased":"Held tickets released. Choose your new seats.","picker.heldTicketsRestored":"Your held tickets have been restored.","picker.hidePanel":"Hide panel","picker.hideTicketPanel":"Hide the ticket panel","picker.holdSeatsAndCheckout":"Hold seats & checkout","picker.howOfferWorks":"How the {name} offer works","picker.interactive3dVenueView":"Interactive 3D venue view","picker.keepMine":"Keep mine","picker.labelNoLongerAvailable":"{label} is no longer available.","picker.labelRemoved":"{label} removed.","picker.labelRemovedFromHold":"{label} removed from your hold.","picker.labelRestored":"{label} restored.","picker.labelsNoLongerAvailable.one":"{labels} is no longer available. Choose another seat.","picker.labelsNoLongerAvailable.other":"{labels} are no longer available. Choose another group.","picker.leftCount.one":"{count} left","picker.leftCount.other":"{count} left","picker.levelNumber":"Level {number}","picker.levels":"Levels","picker.liveAvailability":"Live availability \u2014 seats update in real time","picker.loadingSeatMap":"Loading seat map\u2026","picker.lookAroundLive3d":"Look around in live 3D","picker.manualTicketsRemovedNote":"Your manually selected tickets will be removed only after a new group is secured.","picker.map":"Map","picker.mapDidNotLoad":"The seat map didn\u2019t load","picker.maxTicketsForOrder":"You can select up to {count} tickets for this order.","picker.selectExactMore":"Select {count} more","picker.selectExactCount":"Select exactly {count} tickets","picker.selectMinimumMore":"Select {count} more","picker.adjustSeatSelection":"Adjust seat selection","picker.selectSeatsTogether":"Choose seats together in the same row and ticket category.","picker.minToMaxGuests":"{min} to {max} guests","picker.more":"More","picker.moreGuests":"More guests","picker.moreSeats":"More seats","picker.moreSelectedCount":"{count} more selected","picker.moreTimeAdded":"More time added \u2014 your seats are still held.","picker.noAccessibilityMetadata":"No accessibility metadata supplied","picker.noAuthoredRestriction":"No organizer-authored restriction","picker.noSeatsSelected":"No seats selected","picker.notChargedYet":"You won\u2019t be charged yet.","picker.notForSale":"Not for sale","picker.notForSaleExplanation":"This seat is not included in the current sale.","picker.numberOfGuests":"Number of guests","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.","picker.offerDetailUpcoming":"Tickets are available at their normal price now. This scheduled offer will apply automatically to eligible seats when it starts.","picker.offerRemainingAvailable":"{count} available","picker.offerStarts":"starts {time}","picker.offerUntil":"until {time}","picker.oneSeatSaved":"1 seat saved","picker.oneSeatSavedChooseAnother":"One seat saved; choose another to compare","picker.openAuthored360":"Open venue 360\xB0","picker.openComparison":"Open comparison","picker.openComparisonOfSeats":"Open comparison of {count} seats","picker.openTicketPanel":"Open ticket panel","picker.peekFromPrice":"From {price}","picker.peekTicketsTotal.one":"{count} ticket \xB7 {total}","picker.peekTicketsTotal.other":"{count} tickets \xB7 {total}","picker.perGuestPrice":"{price} per guest","picker.pickYourSeats":"Pick your seats","picker.preferredTicketType":"Preferred ticket type","picker.preferredVenueZone":"Preferred venue zone","picker.priceNotSupplied":"Price not supplied","picker.releaseHeldTickets":"Release held tickets and choose different seats","picker.releasingEllipsis":"Releasing\u2026","picker.removeHeldTicketLabel":"Remove held ticket {label}","picker.removeSeatLabel":"Remove {label}","picker.removeTicketsUntilOrFewer":"Remove tickets until your order has {count} or fewer.","picker.replaceCurrentChoices":"Replace your current choices?","picker.review":"Review","picker.row":"Row","picker.rowLabel":"Row {label}","picker.saveToCompare":"Save to compare","picker.savedForComparison":"Saved for comparison","picker.savedSeatComparison":"Saved seat comparison","picker.scheduledOffer":"Scheduled offer","picker.seat":"Seat","picker.seatCount.one":"{count} seat","picker.seatCount.other":"{count} seats","picker.seatJustTakenByAnother":"Seat {label} was just taken by another buyer.","picker.seatLabel":"Seat {label}","picker.seatNoLongerAvailable":"That seat is no longer available.","picker.seatNoLongerYours":"Some seats are no longer available to you. They have been removed from your order.","picker.seatNumberLower":"seat {label}","picker.seatSalesClosedForEvent":"Seat sales have closed for this event.","picker.seatSelection":"Seat selection","picker.seatStatusLegend":"Seat status legend","picker.seatTaken":"Someone else took a seat you had picked. It has been removed from your order.","picker.seatsHeldForNeedMoreTime":"Your seats are held for <b>{time}</b>. Need more time?","picker.seatsJustTaken":"One or more seats were just taken. Please pick again.","picker.seatsJustTakenInCategory.one":"{count} seat just taken in {label} \xB7 {left} left","picker.seatsJustTakenInCategory.other":"{count} seats just taken in {label} \xB7 {left} left","picker.seatsNoLongerAvailableTryAnother":"Those seats are no longer available. Try another quantity or ticket type.","picker.seatsSecured":"Seats secured","picker.seatsSelectedCount.one":"{count} selected","picker.seatsSelectedCount.other":"{count} selected","picker.section":"Section","picker.secureMore":"Secure more","picker.secureMoreAndCheckout":"Secure {count} more & checkout","picker.securedCount":"{count} secured","picker.seeItIn3d":"See it in 3D","picker.select":"Select","picker.selectSeats":"Select seats","picker.selectTable":"Select table","picker.selectWholeTable":"Select whole table","picker.selected":"Selected","picker.selectingEllipsis":"Selecting\u2026","picker.showAllSeats":"Show all seats","picker.showAllTicketTypes":"Show all {count} ticket types","picker.showFewer":"Show fewer","picker.showLabelSeatsOnMap":"Show {label} seats on the map","picker.showTicketPanel":"Show the ticket panel","picker.sold":"Sold","picker.soldOutCopy":"No reserved seats are currently available for this event.","picker.soldOutEyebrow":"This event","picker.soldOutTitle":"Sold out","picker.soldSeatExplanation":"This seat has already been booked.","picker.statusAvailable":"available","picker.statusOnHold":"on hold","picker.statusTaken2":"taken","picker.table":"Table","picker.tableCapacity":"Table capacity","picker.tableUpdatedForGuests":"{label} updated for {count} guests.","picker.temporarilyHeld":"Temporarily held","picker.ticketPrices":"Ticket prices","picker.ticketTypeSoldOut":"That ticket type is sold out. Try another ticket type.","picker.tickets":"Tickets","picker.ticketsCount.one":"{count} ticket","picker.ticketsCount.other":"{count} tickets","picker.toggleColorblindColors":"Toggle colorblind-friendly colors","picker.total":"Total","picker.trayHintTapOrBest":"Tap a seat on the map, or let us pick the best available for you.","picker.trayHintTapOrStanding":"Tap a seat on the map \u2014 or grab standing tickets below.","picker.undo":"Undo","picker.upcomingTicketOffer":"Upcoming ticket offer","picker.updateTable":"Update table","picker.updatingEllipsis":"Updating\u2026","picker.venueView":"Venue view","picker.viewFromHere":"View from here","picker.viewFromThisSeat":"View from this seat","picker.wholeTypeWord":"Whole {typeWord}","picker.willChooseClosestGroup":"We\u2019ll choose the closest available group for you.","picker.willFindSeatsTogether":"We\u2019ll find {count} seats together.","picker.yourSeats":"Your seats","picker.zoomIn":"Zoom in","picker.zoomOut":"Zoom out","picker.closeVenueNav":"Close","picker.levelsAndAreas":"Levels & areas","picker.gaChooseTickets":"How many tickets?","picker.gaAdd.one":"Add {count} ticket \xB7 {price}","picker.gaAdd.other":"Add {count} tickets \xB7 {price}","picker.gaUpdate.one":"Update \xB7 {count} ticket","picker.gaUpdate.other":"Update \xB7 {count} tickets","picker.gaRemove":"Remove","picker.gaAreasHeading":"Areas","picker.gaTrayHintTapArea":"Tap an area on the map to choose tickets.","picker.gaAdded.one":"{count} {area} ticket added, {price}","picker.gaAdded.other":"{count} {area} tickets added, {price}","picker.gaRemoved":"{area} tickets removed","picker.gaChooseForArea":"Choose tickets for {area}"};var nn=["ar","be","bg","ca","cs","cy","da","de","el","en","es","et","fa","fi","fr","he","hr","hu","it","ja","ku","lt","lv","nl","no","pl","pt","ro","ru","sk","sl","sr","sv","tr","uk","zh-Hans","zh-Hant"],Sa={ar:"\u0627\u0644\u0639\u0631\u0628\u064A\u0629",be:"\u0411\u0435\u043B\u0430\u0440\u0443\u0441\u043A\u0430\u044F",bg:"\u0411\u044A\u043B\u0433\u0430\u0440\u0441\u043A\u0438",ca:"Catal\xE0",cs:"\u010Ce\u0161tina",cy:"Cymraeg",da:"Dansk",de:"Deutsch",el:"\u0395\u03BB\u03BB\u03B7\u03BD\u03B9\u03BA\u03AC",en:"English",es:"Espa\xF1ol",et:"Eesti",fa:"\u0641\u0627\u0631\u0633\u06CC",fi:"Suomi",fr:"Fran\xE7ais",he:"\u05E2\u05D1\u05E8\u05D9\u05EA",hr:"Hrvatski",hu:"Magyar",it:"Italiano",ja:"\u65E5\u672C\u8A9E",ku:"Kurd\xEE",lt:"Lietuvi\u0173",lv:"Latvie\u0161u",nl:"Nederlands",no:"Norsk",pl:"Polski",pt:"Portugu\xEAs",ro:"Rom\xE2n\u0103",ru:"\u0420\u0443\u0441\u0441\u043A\u0438\u0439",sk:"Sloven\u010Dina",sl:"Sloven\u0161\u010Dina",sr:"\u0421\u0440\u043F\u0441\u043A\u0438",sv:"Svenska",tr:"T\xFCrk\xE7e",uk:"\u0423\u043A\u0440\u0430\u0457\u043D\u0441\u044C\u043A\u0430","zh-Hans":"\u7B80\u4F53\u4E2D\u6587","zh-Hant":"\u7E41\u9AD4\u4E2D\u6587"},Is=["ar","be","bg","ca","cs","cy","da","de","el","en","es","et","fa","fi","fr","he","hr","hu","it","ja","ku","lt","lv","nl","no","pl","pt","ro","ru","sk","sl","sr","sv","tr","uk","zh-Hans","zh-Hant"],rn=new Set(["ar","fa","he"]),si={li:"lt",iw:"he",mo:"ro",sh:"sr",nb:"no",nn:"no",kmr:"ku",zh:"zh-Hans","zh-cn":"zh-Hans","zh-sg":"zh-Hans","zh-my":"zh-Hans","zh-tw":"zh-Hant","zh-hk":"zh-Hant","zh-mo":"zh-Hant"},oi=new Map(nn.map(i=>[i.toLowerCase(),i]));function an(i){let e=i.trim().toLowerCase().replace(/_/g,"-");if(!e)return;let t=oi.get(e)??si[e];if(t)return t;let s=e.split("-");if(s.length>=2){let o=`${s[0]}-${s[1]}`,n=oi.get(o)??si[o];if(n)return n}return oi.get(s[0])??si[s[0]]}var Se={en:Ke},Lt={},ie="en";function Cs(i,e){let t=typeof navigator<"u"?navigator.languages?.length?navigator.languages:[navigator.language]:[];for(let s of[i,e,...t]){if(!s)continue;let o=an(s);if(o)return o}return"en"}function va(){return ie}function wa(i=ie){return rn.has(i)?"rtl":"ltr"}function ka(i){return!!Se[i]}function Re(i,e){e&&(Se[i]={...Se[i],...e}),ie=Se[i]?i:"en",Ts(ie),vs(ie),typeof document<"u"&&(document.documentElement.lang=ie)}function La(i){Lt=i}var Ms=/\{(\w+)\}/g;function U(i,e){let t=Lt[i]??Se[ie]?.[i]??Ke[i]??i;return e?t.replace(Ms,(s,o)=>String(e[o]??`{${o}}`)):t}function Ta(i,e,t){let s=new Intl.PluralRules(ie).select(e);return(Lt[`${i}.${s}`]??Se[ie]?.[`${i}.${s}`]??Ke[`${i}.${s}`]??Lt[`${i}.other`]??Se[ie]?.[`${i}.other`]??Ke[`${i}.other`]??i).replace(Ms,(r,a)=>String({count:e,...t}[a]??`{${a}}`))}function Ia(i,e){return ws(i,{...e??{dateStyle:"medium",timeStyle:"short"},locale:ie})}var Xe=9,ve=.9,ne=.55*ve,re=ee/de,$e=4,Tt=14,Ps=10,xs=14,ye=.45*ve,Ee=.9*ve,Rs=Math.max(ve*1.1,Ee),we=8,Es=700,Z=2,As=ee,Ye=64,Ae=.55*ye,ni=700,Bs=2500,It=-11.5,qe=.58,Fs=320,Ct=650,Ds=1,Mt=1,_s=16,ri=12,Os=[.85,.72,.62],Pt=15,xt=12,ai="600",li="500",Ue=640;function ci(i){return Math.min(1,Math.max(.55,i/900))}var Gs=.1;import{Shape as cn}from"konva/lib/Shape";import{Circle as hn}from"konva/lib/shapes/Circle";import{Rect as dn}from"konva/lib/shapes/Rect";var ln={M:2,L:2,Q:4,C:6,Z:0},hi=new Map;function di(i){let e=hi.get(i);if(e)return e;let t=St(i);if(!t)return hi.set(i,[]),[];let s=t.match(/[MLQCZ]|-?(?:\d+(?:\.\d+)?|\.\d+)/g)??[],o=[],n=0;for(;n<s.length;){let r=s[n++],a=ln[r];if(a===void 0||n+a>s.length)throw new Error(`Invalid path data for seat glyph "${i}".`);let l=s.slice(n,n+a).map(Number);if(l.some(c=>!Number.isFinite(c)))throw new Error(`Invalid coordinate in seat glyph "${i}".`);n+=a,r==="M"||r==="L"?o.push({command:r,points:l}):r==="Q"?o.push({command:r,points:l}):r==="C"?o.push({command:r,points:l}):o.push({command:"Z",points:[]})}return hi.set(i,o),o}function Hs(i,e,t,s=0,o=0){let n=di(e),r=Ji(e).bounds;if(!n.length||!r||!(t>0))return!1;let a=es(r,t);i.save(),i.translate(s,o),i.scale(a.scale,a.scale),i.translate(-a.centreX,-a.centreY);for(let l of n)l.command==="M"?i.moveTo(l.points[0],l.points[1]):l.command==="L"?i.lineTo(l.points[0],l.points[1]):l.command==="Q"?i.quadraticCurveTo(l.points[0],l.points[1],l.points[2],l.points[3]):l.command==="C"?i.bezierCurveTo(l.points[0],l.points[1],l.points[2],l.points[3],l.points[4],l.points[5]):i.closePath();return i.restore(),!0}function Ns(i,e){i.beginPath(),i.arc(0,0,e,0,Math.PI*2,!1),i.closePath()}var Ze=class extends cn{_sceneFunc(e){let t=this.attrs.seatRadius||1,s=this.attrs.seatGlyph,o=di(s),n=this.attrs.seatGlyphDetail,r;if(n===void 0){let a=this.getAbsoluteScale(),l=Math.max(Math.abs(a.x),Math.abs(a.y)),c=Number.isFinite(l)&&l>0?l:1;r=t*2*c>=16}else r=n;if(!o.length||!r){Ns(e,t),e.fillStrokeShape(this);return}e.beginPath(),Hs(e,s,t),e.fillStrokeShape(this)}_hitFunc(e){Ns(e,this.attrs.seatRadius||1),e.fillStrokeShape(this)}getSelfRect(){let e=this.attrs.seatRadius||1;return{x:-e,y:-e,width:e*2,height:e*2}}};function pn(i,e){return i==="circle"||!St(i)?null:new Ze({x:e.x,y:e.y,seatRadius:e.radius,seatGlyph:i,...e.detail===void 0?{}:{seatGlyphDetail:e.detail},...e.fill?{fill:e.fill}:{},perfectDrawEnabled:!1,shadowForStrokeEnabled:!1,hitStrokeWidth:0})}function zs(i){let{x:e,y:t,radius:s}=i;return i.wheelchairBay?new dn({x:e,y:t,width:s*2,height:s*2,offsetX:s,offsetY:s,cornerRadius:2,...i.fill?{fill:i.fill}:{},perfectDrawEnabled:!1,shadowForStrokeEnabled:!1,hitStrokeWidth:0}):pn(i.glyph,{x:e,y:t,radius:s,detail:i.detail,fill:i.fill})??new hn({x:e,y:t,radius:s,...i.fill?{fill:i.fill}:{},perfectDrawEnabled:!1,shadowForStrokeEnabled:!1,hitStrokeWidth:0})}function un(i,e){return i*2*e>=16}function Vs(i,e,t,s){let o=un(e,t);if(o===s||!i.length)return o;for(let n of i)n.setAttr("seatGlyphDetail",o);return o}var fn="#e5e7eb",yn="#c7cbd1",mn="#595f69",gn="#d1d5db",bn="#b8bdc4",Sn="#273142",vn="#526078",wn="#f1f5f9",kn="#374151",Ln="#64748b",pi="#111827",Ws="#6b7280",Rt="#374151",Ks="#4b5563",Xs="#4b5563",$s=.4,Be=.16,Ys="rgba(244,246,248,0.06)",Et=["#E69F00","#56B4E9","#009E73","#F0E442","#0072B2","#D55E00","#CC79A7"];function ae(i){return Ve(i)?{sectionFill:fn,sectionStroke:yn,sectionInk:mn,focalFill:gn,focalStroke:bn}:{sectionFill:Sn,sectionStroke:vn,sectionInk:wn,focalFill:kn,focalStroke:Ln}}function Fe(i,e){let t=i.sectionFill,s=Xi(he(t,.2),.85);switch(e){case"closed":return he(t,.12);case"sold-out":return s;case"nearly-gone":return pt(t,s,.4);default:return t}}function Tn(i,e){return i.x<e.x+e.width&&e.x<i.x+i.width&&i.y<e.y+e.height&&e.y<i.y+i.height}var De=class{constructor(){this.cells=new Map}insert(e){for(let t of this.keys(e)){let s=this.cells.get(t);s?s.push(e):this.cells.set(t,[e])}}collisionCount(e){let t=new Set,s=0;for(let o of this.keys(e))for(let n of this.cells.get(o)??[])t.has(n)||(t.add(n),Tn(e,n)&&s++);return s}keys(e){let t=Math.floor(e.x/Ye),s=Math.floor((e.x+Math.max(0,e.width))/Ye),o=Math.floor(e.y/Ye),n=Math.floor((e.y+Math.max(0,e.height))/Ye),r=[];for(let a=o;a<=n;a++)for(let l=t;l<=s;l++)r.push(`${l}:${a}`);return r}};function V(i){let e=is(i);return e?{x:e.x,y:e.y,width:Math.max(1,e.width),height:Math.max(1,e.height)}:{x:0,y:0,width:1,height:1}}function At(i,e,t,s){let o=s*Math.PI/180,n=Math.cos(o),r=Math.sin(o);return[{x:-e/2,y:-t/2},{x:e/2,y:-t/2},{x:e/2,y:t/2},{x:-e/2,y:t/2}].map(a=>({x:i.x+a.x*n-a.y*r,y:i.y+a.x*r+a.y*n}))}function Bt(i,e,t,s,o,n){let r=s*Math.PI/180,a=Math.cos(r),l=Math.sin(r);for(let c=0;c<=4;c++)for(let h=0;h<=6;h++){let f=e*(h/6-.5),d=t*(c/4-.5),m={x:i.x+f*a-d*l,y:i.y+f*l+d*a};if(!J(m,o,n))return!1}return!0}function qs(i,e,t){let s=V(i),o=[t];for(let r=1;r<12;r+=1)for(let a=1;a<12;a+=1){let l={x:s.x+s.width*a/12,y:s.y+s.height*r/12};J(l,i,e)&&o.push(l)}let n=[i,...e];return o.map(r=>({point:r,room:Bi(r,n)})).sort((r,a)=>a.room-r.room).map(r=>r.point).filter((r,a,l)=>a===l.findIndex(c=>Math.abs(c.x-r.x)<1e-6&&Math.abs(c.y-r.y)<1e-6))}import{Group as In}from"konva/lib/Group";import{Shape as Cn}from"konva/lib/Shape";function Mn(i,e,t){let s=e.length,o={x:(e[s-1].x+e[0].x)/2,y:(e[s-1].y+e[0].y)/2};i.moveTo(o.x,o.y);for(let n=0;n<s;n+=1){let r=e[n],a=e[(n+1)%s],l=e[(n-1+s)%s],c=Math.min(Math.hypot(r.x-l.x,r.y-l.y)/2,Math.hypot(a.x-r.x,a.y-r.y)/2);i.arcTo(r.x,r.y,a.x,a.y,Math.max(0,Math.min(t,c)))}i.closePath()}function _e(i,e,t,s){let o=We(i)>0,n=t.cornerRadius&&t.cornerRadius>0?t.cornerRadius:0;return new Cn({...t,sceneFunc(r,a){r.beginPath();let l=h=>{if(h.length){if(n>0&&h.length>=3)return Mn(r,h,n);r.moveTo(h[0].x,h[0].y);for(let f=1;f<h.length;f+=1)r.lineTo(h[f].x,h[f].y);r.closePath()}};s?(h=>{r.moveTo(h.start.x,h.start.y);let f=h.start;for(let d of h.segments)d.kind==="line"?r.lineTo(d.end.x,d.end.y):d.kind==="arc"?r.arc(d.center.x,d.center.y,d.radius,Math.atan2(f.y-d.center.y,f.x-d.center.x),Math.atan2(d.end.y-d.center.y,d.end.x-d.center.x),!d.clockwise):r.bezierCurveTo(d.control1.x,d.control1.y,d.control2.x,d.control2.y,d.end.x,d.end.y),f=d.end;r.closePath()})(s):l(i);for(let h of e??[]){let f=We(h)>0;l(f===o?[...h].reverse():h)}r.fillStrokeShape(a)},perfectDrawEnabled:!1})}var Qe=class extends In{constructor(){super(...arguments);this.viewportCulled=!1}setViewportCulled(t){t!==this.viewportCulled&&(this.viewportCulled=t,t||super._clearSelfAndDescendantCache())}isViewportCulled(){return this.viewportCulled}drawScene(...t){return this.viewportCulled?this:super.drawScene(...t)}drawHit(...t){return this.viewportCulled?this:super.drawHit(...t)}_clearSelfAndDescendantCache(t){if(!this.viewportCulled){super._clearSelfAndDescendantCache(t);return}this._clearCache(t)}};var Ft=class{constructor(e){this.pointers=new Map;this.pinch=null;this.panLast=null;this.panStart=null;this.panStarted=!1;this.movedPx=0;this.lastTapAt=0;this.onPointerDown=e=>{this.host.cancelGlide();let t=this.toLocal(e);if(this.pointers.set(e.pointerId,t),this.pointers.size===1)this.movedPx=0,this.pinch=null,this.panStart=t,this.panStarted=!1,this.host.marqueeShouldStart(e)?(this.host.beginMarquee(t),this.panLast=null):this.panLast=t;else if(this.pointers.size===2){this.host.marqueeActive()&&this.host.cancelMarquee();let[s,o]=[...this.pointers.values()],n={x:(s.x+o.x)/2,y:(s.y+o.y)/2},r=this.host.stage.scaleX();this.pinch={startDist:Math.hypot(o.x-s.x,o.y-s.y),startScale:r,worldMid:{x:(n.x-this.host.stage.x())/r,y:(n.y-this.host.stage.y())/r}},this.panLast=null,this.panStart=null,this.panStarted=!0,this.movedPx=we+1}};this.onPointerMove=e=>{if(!this.pointers.has(e.pointerId))return;e.preventDefault();let t=this.toLocal(e);if(this.pointers.set(e.pointerId,t),this.pointers.size===1&&this.panStart?this.movedPx=Math.max(this.movedPx,Math.hypot(t.x-this.panStart.x,t.y-this.panStart.y)):this.pointers.size>=2&&(this.movedPx=we+1),this.host.marqueeActive()){this.host.updateMarquee(t);return}if(this.pinch&&this.pointers.size>=2){this.host.releaseSectionFocusDim();let[s,o]=[...this.pointers.values()],n=Math.hypot(o.x-s.x,o.y-s.y);if(this.pinch.startDist<1)return;let r={x:(s.x+o.x)/2,y:(s.y+o.y)/2},{min:a,max:l}=this.host.zoomBounds(),c=O(this.pinch.startScale*(n/this.pinch.startDist),a,l);this.host.stage.scale({x:c,y:c}),this.host.stage.position({x:r.x-this.pinch.worldMid.x*c,y:r.y-this.pinch.worldMid.y*c}),this.host.updateSeatGroupVisibility(),this.host.stage.batchDraw(),this.host.scheduleViewChange()}else if(this.panLast&&this.pointers.size===1){if(!this.panStarted){if(this.movedPx<=we)return;this.panStarted=!0,this.host.releaseSectionFocusDim()}this.host.stage.position({x:this.host.stage.x()+(t.x-this.panLast.x),y:this.host.stage.y()+(t.y-this.panLast.y)}),this.panLast=t,this.host.updateSeatGroupVisibility(),this.host.stage.batchDraw(),this.host.scheduleViewChange()}};this.onPointerEnd=e=>{if(this.host.marqueeActive()){this.host.finishMarquee(),this.pointers.delete(e.pointerId),this.pointers.size===0&&(this.panLast=null);return}this.pointers.delete(e.pointerId),this.pointers.size<2&&(this.pinch=null),this.pointers.size===1&&(this.panLast=[...this.pointers.values()][0],this.panStart=this.panLast,this.panStarted=!0),this.pointers.size===0&&(this.panLast=null,this.panStart=null,this.panStarted=!1,this.host.afterViewChange())};this.host=e}get moved(){return this.movedPx}attach(){let{container:e}=this.host;e.addEventListener("pointerdown",this.onPointerDown,{passive:!1}),e.addEventListener("pointermove",this.onPointerMove,{passive:!1}),e.addEventListener("pointerup",this.onPointerEnd,{passive:!1}),e.addEventListener("pointercancel",this.onPointerEnd,{passive:!1})}detach(){let{container:e}=this.host;e.removeEventListener("pointerdown",this.onPointerDown),e.removeEventListener("pointermove",this.onPointerMove),e.removeEventListener("pointerup",this.onPointerEnd),e.removeEventListener("pointercancel",this.onPointerEnd)}resetPan(){this.panLast=null,this.panStart=null,this.panStarted=!1}isGhostClick(e){return e.type==="tap"?(this.lastTapAt=performance.now(),!1):this.lastTapAt>0&&performance.now()-this.lastTapAt<Es}toLocal(e){let t=this.host.container.getBoundingClientRect();return{x:e.clientX-t.left,y:e.clientY-t.top}}};import{Circle as Pn}from"konva/lib/shapes/Circle";import{Group as xn}from"konva/lib/Group";import{Text as Rn}from"konva/lib/shapes/Text";var Us=13,En=15,An=.3,Bn=.08;function Js(i,e,t){return!!(i&&t!==i||e&&!e.has(t))}function Fn(i,e){return!e||i.available==null?`cap ${i.capacity}`:i.available<=0?U("map.soldOut"):U("map.seatsLeft",{count:i.available})}function Dn(i,e){return e&&i.available!=null&&i.available<=0}function eo(i){for(let e of i.gaById.values()){let t=i.filteredOut(e.categoryKey),s=i.overviewHidden(e),o=Dn(e,i.pickerMode),n=i.pickerMode?e.selected??0:0;e.polygon.opacity(s?0:i.dimmed(e.categoryKey)?be*Bn:o?be*An:be),e.polygon.listening(!i.exportMode&&!s&&!t&&!o),e.polygon.stroke(n>0?i.selectionColor:e.strokeColor),e.polygon.strokeWidth(n>0?3:1.5),_n(i,e,o,n,s,i.dimmed(e.categoryKey))}}function _n(i,e,t,s,o,n){if(e.capacityNode){let r=Fn(e,i.pickerMode);e.capacityNode.text()!==r&&(e.capacityNode.text(r),e.capacityNode.offsetX(e.capacityNode.width()/2)),e.capacityNode.opacity(t?.75:1)}On(i,e,o||n),s>0&&!o?Hn(i,e,s):e.chip&&e.chip.visible(!1)}var ui=9,Zs=.86;function On(i,e,t){let{labelNode:s,capacityNode:o}=e;if(!s&&!o)return;let n=Math.max(i.effScale(),1e-4);if(t){s?.visible(!1),o?.visible(!1);return}if(!i.pickerMode){s?.visible(i.labelLegible(s.fontSize())),o?.visible(i.labelLegible(o.fontSize()));return}let r=Gn(e,n),a=Qs(s,ut,r.width*Zs,n),l=Qs(o,ft,r.width*Zs,n),c=a!=null,h=l!=null&&c&&a+l+ui<=r.height;js(s,c?a:null,e.labelPoint.y-ui/n,n),js(o,h?l:null,e.labelPoint.y+ui/n,n)}function Gn(i,e){let t=1/0,s=-1/0,o=1/0,n=-1/0;for(let r of i.points)r.x<t&&(t=r.x),r.x>s&&(s=r.x),r.y<o&&(o=r.y),r.y>n&&(n=r.y);return Number.isFinite(t)?{width:(s-t)*e,height:(n-o)*e}:{width:0,height:0}}function Qs(i,e,t,s){if(!i||!i.text())return null;i.fontSize(e/s);let o=i.width()*s;if(o<=t||o<=0)return e;let n=e*(t/o);return n>=ee?n:null}function js(i,e,t,s){if(i){if(e==null){i.visible(!1);return}i.fontSize(e/s),i.offsetX(i.width()/2),i.offsetY(i.height()/2),i.y(t),i.visible(!0)}}function Hn(i,e,t){if(!e.chip){let s=new xn({x:e.labelPoint.x,y:e.labelPoint.y-Us-16,listening:!1}),o=new Pn({radius:Us,fill:i.selectionColor,listening:!1,perfectDrawEnabled:!1}),n=new Rn({text:String(t),fontSize:En,fontStyle:"800",fontFamily:i.labelFont(),fill:"#0b0d12",listening:!1,perfectDrawEnabled:!1});s.add(o),s.add(n),i.bgLayer.add(s),e.chip=s,e.chipText=n}e.chipText&&e.chipText.text()!==String(t)&&e.chipText.text(String(t)),e.chipText&&(e.chipText.offsetX(e.chipText.width()/2),e.chipText.offsetY(e.chipText.height()/2)),e.chip.visible(!0),e.chip.moveToTop()}function to(i,e){let t=!1;for(let[s,o]of Object.entries(e)){let n=i.get(s);n&&(o.available!==void 0&&n.available!==o.available&&(n.available=o.available,t=!0),o.selected!==void 0&&n.selected!==o.selected&&(n.selected=o.selected,t=!0))}return t}function io(i,e){return i===null||e===null?i===e:i.size===e.size&&[...i].every(t=>e.has(t))}function so(i,e){if(!e?.size)return!1;for(let t of i)if(e.has(t))return!1;return!0}import{Rect as oo}from"konva/lib/shapes/Rect";import{Text as Nn}from"konva/lib/shapes/Text";function no(i){let e=i.effScale(),t=i.stage.scaleX(),s={width:i.stage.width(),height:i.stage.height()},o=p=>Math.round(p*100)/100,n=i.seats.map(p=>{let u=i.circleById.get(p.id),b=i.boothLabelById.get(p.id)??i.seatLabelById.get(p.id),g=i.viewMode==="perspective"?i.perspectiveSeatScale.get(p.id)??1:1,w=(i.viewMode==="perspective"?t:e)*g,k=p.kind==="booth"?Pe:de*i.seatLabelScale(p),L=i.viewMode==="perspective"&&p.kind!=="booth"?e*g:w,S=o((b?.fontSize()??k)*L),v=i.worldToScreen(p),x=v.x<0||v.x>s.width||v.y<0||v.y>s.height,I=i.focusedSeatOpacity(p.id,u?.getAbsoluteOpacity()??0),T=i.seatSection.get(p.id),P=!!b?.isVisible()&&I>=.5&&!x,M;P||(I<.5?M="dimmed-or-unavailable":S<ee?M="below-minimum-size":x?M="outside-viewport":b?M="renderer-hidden":M="clutter-or-fit");let C=b?b.width()*t*g:0,R=b?b.height()*(i.viewMode==="perspective"&&p.kind==="booth"?t:e)*g:0,B=u instanceof oo?u.width()*t*g:i.seatR*2*w,A=u instanceof oo?u.height()*(i.viewMode==="perspective"?t:e)*g:i.seatR*2*w,W=2*(i.seatR*w+Tt),H=u?.fill(),N=b?.fill(),$=i.accessGlyphById.get(p.id),D=$?.getAbsoluteScale();return{seatId:p.id,label:p.label,kind:p.kind==="booth"?"booth":"seat",markerShape:p.kind==="booth"?"booth":p.wheelchairSpaceType==="no-seat"?"square":"circle",...p.wheelchairSpaceType?{wheelchairSpaceType:p.wheelchairSpaceType}:{},categoryKey:p.categoryKey,...T?{sectionId:T.id}:{},...T?.zone?{zoneId:T.zone}:{},status:i.statusById.get(p.id)??"free",selected:i.selection.has(p.id),visible:P,renderedFontPx:S,fill:typeof H=="string"?H:"",ink:typeof N=="string"?N:u?i.seatLabelInk(p,u):i.seatPreferredLabelInk(p),opacity:o(I),...$?{accessibilityMarker:{glyphVisible:$.isVisible(),glyphWidthPx:o(oe*Math.abs(D?.x??0)),emphasizedByFilter:i.accessGlyphFilterEmphasized(p.id)}}:{},pointerTarget:{active:!i.cached&&!i.seatViewportCulled(p.id)&&!!u?.isVisible()&&!!u?.isListening()&&i.isSelectable(p.id),directWidthPx:o(B),directHeightPx:o(A),effectiveMinimumPx:o(Math.max(Math.min(B,A),W))},screenCenter:{x:o(v.x),y:o(v.y)},...P?{screenBox:{x:o(v.x-C/2),y:o(v.y-R/2),width:o(C),height:o(R)}}:{},...M?{hiddenReason:M}:{}}}),r=n.filter(p=>p.visible).length,a=(p,u,b,g,w,k)=>{let L=At({x:g.x(),y:g.y()},g.width(),g.height(),g.rotation()),S=k&&k.liftWorld>0?i.isoLiftLocal(k.liftWorld):{x:0,y:0},v=V(L.map(C=>i.worldToScreen({x:C.x+S.x,y:C.y+S.y}))),x=o(g.opacity()),I=g.fill(),T=v.x+v.width<0||v.x>s.width||v.y+v.height<0||v.y>s.height,P=g.isVisible()&&x>.05&&!T,M=k?Bt({x:g.x(),y:g.y()},g.width(),g.height(),g.rotation(),k.outline,k.holes):void 0;return{id:p,kind:u,role:b,label:g.text(),visible:P,renderedFontPx:o(g.fontSize()*t),opacity:x,fill:w,ink:typeof I=="string"?I:"",...M==null?{}:{fitsContainer:M},...P?{screenBox:{x:o(v.x),y:o(v.y),width:o(v.width),height:o(v.height)}}:{}}},l=[...i.sections.map(p=>{let u=p.blockPoly.fill();return a(p.id,"section","name",p.nameLabel,typeof u=="string"?u:p.baseFill,p)}),...i.sections.map(p=>{let u=p.blockPoly.fill();return a(`${p.id}:availability`,"section","availability",p.subLabel,typeof u=="string"?u:p.baseFill,p)}),...i.zones.flatMap(p=>[a(p.id,"zone","name",p.label,p.background),...p.sub?[a(`${p.id}:price`,"zone","price",p.sub,p.background)]:[]])],c=[...i.gaById].map(([p,u])=>{let b=u.points.map(T=>i.worldToScreen(T)),g=Math.min(...b.map(T=>T.x)),w=Math.min(...b.map(T=>T.y)),k=Math.max(...b.map(T=>T.x)),L=Math.max(...b.map(T=>T.y)),S=k<0||g>s.width||L<0||w>s.height,v=o(u.polygon.opacity()),x=v>=.1&&!S,I=u.polygon.fill();return{areaId:p,label:u.label,capacity:u.capacity,categoryKey:u.categoryKey,...u.sectionId?{sectionId:u.sectionId}:{},visible:x,interactive:u.polygon.listening(),opacity:v,fill:typeof I=="string"?I:"",effectiveBackground:u.effectiveBackground,...x?{screenBox:{x:o(g),y:o(w),width:o(k-g),height:o(L-w)}}:{}}}),h=[...i.freeTextById].map(([p,u])=>{let{node:b,background:g,kind:w}=u,k=i.worldToScreen({x:b.x(),y:b.y()}),L=b.width()*t,S=b.height()*e,v=k.x-b.offsetX()*t,x=k.y-b.offsetY()*e,I=o(b.fontSize()*e),T=v+L<0||v>s.width||x+S<0||x>s.height,P=b.isVisible()&&!T,M=b.fill(),C=o(b.getAbsoluteOpacity()),R;return P||(I<ee?R="below-minimum-size":T?R="outside-viewport":R="renderer-hidden"),{objectId:u.objectId??p,kind:w,text:b.text(),visible:P,renderedFontPx:I,ink:typeof M=="string"?M:"",background:g,opacity:C,...P?{screenBox:{x:o(v),y:o(x),width:o(L),height:o(S)}}:{},...R?{hiddenReason:R}:{}}}),f=i.labelGroup.find(p=>p.getAttr("rowLabel")===!0).filter(p=>p instanceof Nn).map(p=>{let u=p.getClientRect({skipShadow:!0,skipStroke:!0}),b=u.x+u.width<0||u.x>s.width||u.y+u.height<0||u.y>s.height,g=p.fill();return{text:p.text(),visible:p.isVisible()&&!b,renderedFontPx:o(p.fontSize()*e),ink:typeof g=="string"?g:"",...b?{}:{screenBox:{x:o(u.x),y:o(u.y),width:o(u.width),height:o(u.height)}}}}),d=ae(i.canvasBackground),m=new Set(["normal","nearly-gone","sold-out","closed"].map(p=>Fe(d,p).toLowerCase())),y=i.sections.filter(p=>p.blockPoly.opacity()>.05);return{viewport:s,projection:i.viewMode,...i.viewMode==="perspective"?{perspective:{model:"pinhole-exact-seat-anchors",sectionSurfaceModel:"tangent-plane",exactSeatAnchorCount:i.perspectiveSeatProjected.size,depthSorted:!0}}:{},canvasBackground:i.canvasBackground,effectiveScale:o(e),rung:i.getRung(),minimumVisibleLabelPx:ee,totalLabelledBookableUnits:n.length,visibleLabels:r,hiddenLabels:n.length-r,totalBookableUnits:n.length+c.reduce((p,u)=>p+u.capacity,0),selectionRingSeatIds:i.overlayLayer.find(".selection-ring").map(p=>String(p.getAttr("seatId")??"")).filter(Boolean),selectionRingColor:i.effSelection,focusedSectionId:i.focusedSectionId,focusBackdropVisible:!!i.focusBackdrop?.isVisible(),categoryFilterKeys:i.categoryFilter?[...i.categoryFilter].sort():null,overviewStyle:{visibleSectionShells:y.length,categoryPaintedSectionShells:y.filter(p=>{let u=p.blockPoly.fill();return typeof u!="string"||!m.has(u.toLowerCase())}).length,visibleCategoryDetailOutlines:i.sections.filter(p=>p.outlinePoly.opacity()>.05).length,visibleSectionRowHints:0,visibleSectionAvailabilityLabels:i.sections.filter(p=>p.subLabel.opacity()>.05).length,visibleSectionGADetails:[...i.gaById.values()].filter(p=>p.sectionId!=null&&p.polygon.opacity()>.05).length},labels:n,gaAreas:c,hierarchyLabels:l,freeTextLabels:h,rowLabels:f}}import{Circle as zn}from"konva/lib/shapes/Circle";import{Ellipse as Vn}from"konva/lib/shapes/Ellipse";import{Line as ho}from"konva/lib/shapes/Line";import{Arrow as Wn}from"konva/lib/shapes/Arrow";import{Path as Kn}from"konva/lib/shapes/Path";import{Rect as mi}from"konva/lib/shapes/Rect";import{Text as gi}from"konva/lib/shapes/Text";import{Image as Xn}from"konva/lib/shapes/Image";function fi(i,e){return e.length===0?!!i.accessible:!!i.accessibility?.some(t=>e.includes(t))}var Dt="#0b1220",je="#ffffff",ro="#0b1220",ao="#232c40",lo="#8b93a7";function co(i,e,t="normal"){let s=i?"bold":t;return e?`italic ${s}`.trim():s}var yi="#0e1117";function po(i,e){let t=new window.Image,s=new Xn({image:t,x:e.x+e.width/2,y:e.y+e.height/2,offsetX:e.width/2,offsetY:e.height/2,width:e.width,height:e.height,rotation:e.rotation??0,opacity:O(e.opacity??1,0,1),listening:!1,perfectDrawEnabled:!1});e.layer==="foreground"?i.fgDecorGroup.add(s):i.bgLayer.add(s),i.trackAssetImage(t,e.href,`Decor image \u201C${e.label||e.id}\u201D`,()=>{let o=s.getLayer();o&&o.batchDraw()})}function uo(i,e){if(e.shape==="round")i.bgLayer.add(new zn({x:e.center.x,y:e.center.y,radius:e.radius??40,fill:"#232c40",stroke:"#2a3348",strokeWidth:1.5,listening:!1}));else{let s=e.width??80,o=e.height??50;i.bgLayer.add(new mi({x:e.center.x,y:e.center.y,width:s,height:o,offsetX:s/2,offsetY:o/2,rotation:e.rotation,fill:"#232c40",stroke:"#2a3348",strokeWidth:1.5,cornerRadius:4,listening:!1}))}let t=Je(i,i.bgLayer,e.displayLabel??e.label,e.center.x,e.center.y,"#cbd5e1",12,!0);i.freeTextById.set(e.id,{node:t,background:"#232c40",kind:"table"})}function fo(i,e){let t=e.background?.color??i.canvasBackground,s=e.color??i.theme.textColor??lo,o=e.semanticKind==="icon"?ns(e.iconKey):void 0;if(o){let c=e.fontSize/24,h=new Kn({x:e.position.x,y:e.position.y,data:o,rotation:e.rotation,scaleX:c,scaleY:c,stroke:q(t,s),strokeWidth:2,lineCap:"round",lineJoin:"round",fillEnabled:!1,listening:!1,perfectDrawEnabled:!1});i.iconNodeById.set(e.id,{node:h,fontSize:e.fontSize}),i.bgLayer.add(h);return}let n=e.background?.padding??0,r=e.opacity??1,a=new gi({x:e.position.x,y:e.position.y,text:e.text,fontSize:e.fontSize,rotation:e.rotation,fontStyle:co(e.bold,e.italic,"600"),fill:q(t,s),fontFamily:e.fontFamily??i.labelFont(),...e.width!=null?{width:e.width}:{},align:e.align??"left",lineHeight:e.lineHeight??1.2,letterSpacing:e.letterSpacing??0,textDecoration:e.underline?"underline":"",padding:n,opacity:r,wrap:"word",listening:!1,perfectDrawEnabled:!1,name:"buyer-free-text"}),l;e.background&&(l=new mi({x:e.position.x,y:e.position.y,width:a.width(),height:a.height(),rotation:e.rotation,fill:e.background.color,opacity:r*(e.background.opacity??.9),cornerRadius:e.background.cornerRadius??4,listening:!1,perfectDrawEnabled:!1,name:"buyer-text-background"}),i.bgLayer.add(l)),i.freeTextById.set(e.id,{node:a,backdrop:l,background:t,kind:"free-text"}),i.bgLayer.add(a)}function yo(i,e){let t=e.fill??i.theme.decorFill??ao,s=e.role==="stage",o=e.role==="reference-focal",n=!!e.role&&!s,r=ae(i.canvasBackground),a=o?r.focalFill:t,l=e.kind==="line"||e.kind==="polyline",c=e.stroke?.color??(s?fe(a,.28):o?r.focalStroke:l?"#9aa3b5":void 0),h=e.stroke?.width??(s?1:o||l?2:0),f=e.opacity!=null?O(e.opacity,.1,1):1,d=0,m=0;if(l&&e.points&&e.points.length>=2){d=e.points.reduce((b,g)=>b+g.x,0)/e.points.length,m=e.points.reduce((b,g)=>b+g.y,0)/e.points.length;let y=rs(e),p=as(h),u=new Wn({points:e.points.flatMap(b=>[b.x,b.y]),closed:!1,x:d,y:m,offsetX:d,offsetY:m,rotation:e.rotation??0,stroke:c,fill:c,strokeWidth:h,opacity:f,lineCap:y.lineCap,lineJoin:y.lineJoin,pointerAtBeginning:y.startEnding==="arrow",pointerAtEnding:y.endEnding==="arrow",...p,listening:!1,name:"buyer-shape-open-path"});u.setAttr("shapeObjectId",e.id),i.bgLayer.add(u)}else if(e.kind==="rect"&&e.x!=null&&e.y!=null&&e.width!=null&&e.height!=null){let y=s?{fillLinearGradientStartPoint:{x:0,y:0},fillLinearGradientEndPoint:{x:0,y:e.height},fillLinearGradientColorStops:[0,he(a,.3),1,fe(a,.12)]}:{fill:a};d=e.x+e.width/2,m=e.y+e.height/2,i.bgLayer.add(new mi({x:d,y:m,offsetX:e.width/2,offsetY:e.height/2,rotation:e.rotation??0,width:e.width,height:e.height,...y,stroke:c,strokeWidth:h,cornerRadius:O(e.cornerRadius??4,0,Math.min(e.width,e.height)/2),opacity:f,listening:!1}))}else if(e.kind==="ellipse"&&e.x!=null&&e.y!=null&&e.width!=null&&e.height!=null){d=e.x+e.width/2,m=e.y+e.height/2;let y=s?{fillLinearGradientStartPoint:{x:0,y:-e.height/2},fillLinearGradientEndPoint:{x:0,y:e.height/2},fillLinearGradientColorStops:[0,he(a,.3),1,fe(a,.12)]}:{fill:a};i.bgLayer.add(new Vn({x:d,y:m,rotation:e.rotation??0,radiusX:e.width/2,radiusY:e.height/2,...y,stroke:c,strokeWidth:h,opacity:f,listening:!1}))}else if(e.kind==="polygon"&&e.points&&e.points.length){let y=e.points.flatMap(b=>[b.x,b.y]),p=V(e.points);d=e.points.reduce((b,g)=>b+g.x,0)/e.points.length,m=e.points.reduce((b,g)=>b+g.y,0)/e.points.length;let u=s?{fillLinearGradientStartPoint:{x:0,y:p.y},fillLinearGradientEndPoint:{x:0,y:p.y+p.height},fillLinearGradientColorStops:[0,he(a,.3),1,fe(a,.12)]}:{fill:a};i.bgLayer.add(new ho({points:y,closed:!0,x:d,y:m,offsetX:d,offsetY:m,rotation:e.rotation??0,...u,stroke:c,strokeWidth:h,opacity:f,listening:!1}))}for(let y of cs(e))i.bgLayer.add(new ho({points:y.points.flatMap(p=>[p.x,p.y]),closed:y.closed,x:d,y:m,offsetX:d,offsetY:m,rotation:e.rotation??0,stroke:y.ink??ls,fill:y.fill,strokeWidth:2,opacity:f*.85,listening:!1,perfectDrawEnabled:!1,name:"buyer-stage-marking"}));if(e.label)if(s){let y=$n(i,d,m,e.label,a);i.primaryFocalLabels.set(y,22),i.freeTextById.set(e.id,{node:y,background:a,kind:"stage"})}else if(n){let y=Je(i,i.bgLayer,e.label,d,m,o?q(a,"#e6e9f0"):"#9aa3b5",o?18:12,!1);o&&i.primaryFocalLabels.set(y,18),i.freeTextById.set(e.id,{node:y,background:a,kind:"decor"})}else{let y=Je(i,i.bgLayer,e.label,d,m,"#cbd5e1",16,!0);i.freeTextById.set(e.id,{node:y,background:a,kind:"decor"})}}function $n(i,e,t,s,o){let n=q(o,"#e6e9f0"),r=new gi({x:e,y:t,text:s.toUpperCase(),fontSize:22,fontStyle:"700",letterSpacing:4,fontFamily:i.labelFont(),fill:n,listening:!1,perfectDrawEnabled:!1});return r.offsetX(r.width()/2),r.offsetY(r.height()/2),i.bgLayer.add(r),r}function mo(i,e){let t=i.catColor.get(e.categoryKey)??"#6e7bff",s=i.canvasBackground,o=Yi(t,s,be),n=i.theme.textColor??"#e6e9f0",r=q(o,n),a=_e(e.points,e.holes,{fill:t,opacity:be,stroke:t,strokeWidth:1.5,cornerRadius:e.cornerRadius});a.setAttr("gaId",e.id),a.on("click tap",d=>{i.isGhostClick(d)||i.opts.onGAClick?.(e.id)}),a.on("mouseenter",()=>{i.container.style.cursor="pointer"}),a.on("mouseleave",()=>{i.container.style.cursor="default"}),i.bgLayer.add(a);let l=ct(e.points,e.holes),c=i.sections.find(d=>J(l,d.outline,d.holes)),h=Je(i,i.bgLayer,e.displayLabel??e.label,l.x,l.y-8,r,ut,!1),f=Je(i,i.bgLayer,`cap ${e.capacity}`,l.x,l.y+10,r,ft,!1);i.freeTextById.set(`${e.id}:label`,{objectId:e.id,node:h,background:o,kind:"ga-label",categoryKey:e.categoryKey}),i.freeTextById.set(`${e.id}:capacity`,{objectId:e.id,node:f,background:o,kind:"ga-capacity",categoryKey:e.categoryKey}),i.gaById.set(e.id,{label:e.displayLabel??e.label,capacity:e.capacity,categoryKey:e.categoryKey,points:e.points,polygon:a,effectiveBackground:o,strokeColor:t,labelPoint:l,labelNode:h,capacityNode:f,...c?{sectionId:c.logicalId}:{}})}function Je(i,e,t,s,o,n,r,a){let l=new gi({x:s,y:o,text:t,fontSize:r,fontStyle:a?"700":"500",fontFamily:i.labelFont(),fill:n,listening:!1,perfectDrawEnabled:!1});return l.offsetX(l.width()/2),l.offsetY(l.height()/2),e.add(l),l}function go(i,e){let t=[],s=e.theme.background??"#0e1117",o=new Map,n=(c,h)=>{let f=o.get(c)??[];f.push(h),o.set(c,f)};for(let c of e.seats){if(c.kind==="booth")continue;let h=c.logicalRowId??c.rowId;n(h,c),h!==c.rowId&&n(c.rowId,c)}let r=c=>c.logicalSeatIndex??Number(c.id.split(":").pop()??0);for(let c of i.objects){if(c.type!=="row")continue;let h=c.segmentedRow?.repeatLabelOnComponents===!0;if(c.segmentedRow&&!h&&c.segmentedRow.componentIndex!==0)continue;let f=h?c.labelPresentation:c.segmentedRow?.labelPresentation??c.labelPresentation;if(f?.visible===!1||f?.positionPreset==="none")continue;let d=c.segmentedRow&&!h?c.segmentedRow.groupId:c.id,m=(o.get(d)??[]).slice().sort((P,M)=>r(P)-r(M));if(!m.length)continue;let y=m[0],p=m[m.length-1],u=f?.labelStyle,b=q(s,u?.color??e.theme.rowLabelColor??e.theme.textColor??"#e6e9f0",mt),g=u?.size??$i,w=f?.rotation??0,k=c.segmentedRow?.displayLabel??c.displayLabel??c.label,L=e.objectFilteredOut(c)?.15:1,S=e.seatSection.get(y.id),v=S?[...new Set([S.id,S.logicalId,S.zone].filter(P=>!!P))]:void 0,x=(P,M,C)=>t.push({text:k,x:P,y:M,rotation:w,fontSize:g,ink:b,opacity:L,...v?.length?{focusKeys:v}:{},...C?{automaticAway:C}:{}});if(f?.position){x(f.position.x,f.position.y);continue}let I=e.seatR+12,T=f?.positionPreset??"start";if(T==="start"||T==="both"){let P=c.rotation*Math.PI/180,M={x:-Math.cos(P),y:-Math.sin(P)};x(y.x+M.x*I,y.y+M.y*I,M)}if(T==="end"||T==="both"){let P=(c.rotation+c.curve)*Math.PI/180,M={x:Math.cos(P),y:Math.sin(P)};x(p.x+M.x*I,p.y+M.y*I,M)}}let a=(e.seatR+12)*2.2,l=[];for(let c of t){let h=l.find(f=>f.text===c.text&&Math.hypot(f.x-c.x,f.y-c.y)<=a);if(h){h.x=(h.x+c.x)/2,h.y=(h.y+c.y)/2;continue}l.push(c)}return l}function bi(i,e,t=Z){let s=i.rotation()*Math.PI/180,o=Math.abs(Math.cos(s)),n=Math.abs(Math.sin(s)),r=(i.width()*o+i.height()*n)/2+t,a=(i.width()*n+i.height()*o)/2+t;return{x:e.x-r,y:e.y-a,width:r*2,height:a*2}}function bo(i,e,t,s){let o={x:e.x,y:e.y},n=e.automaticAway;if(!n)return o;let r={x:-n.y,y:n.x},a=Math.max(7,Math.min(16,e.fontSize*.75)),l=[{x:0,y:0}];for(let d=1;d<=4;d++){let m=a*d;l.push({x:r.x*m,y:r.y*m},{x:-r.x*m,y:-r.y*m},{x:n.x*m,y:n.y*m},{x:(n.x+r.x)*m,y:(n.y+r.y)*m},{x:(n.x-r.x)*m,y:(n.y-r.y)*m})}let c=o,h=1/0,f=1/0;for(let d of l){let m={x:o.x+d.x,y:o.y+d.y},y=bi(i,m),u=(s?gt(s,y,{mode:"overlap"}).length:0)+t.collisionCount(y),b=Math.hypot(d.x,d.y);if((u<h||u===h&&b<f)&&(c=m,h=u,f=b),u===0)break}return c}function So(i,e){let t=i.sectionHeat.get(e.id)??i.sectionHeat.get(e.logicalId)??(e.zone?i.sectionHeat.get(e.zone):void 0);if(t==null||t<=0){e.outlinePoly.stroke(se(e.outlineTint,.5)),e.outlinePoly.fill(se(e.outlineTint,.08)),e.outlinePoly.strokeWidth(1.75),e.outlinePoly.shadowOpacity(0);return}let s=pt("#f4b740","#ef4444",t);e.outlinePoly.stroke(se(s,.72+t*.25)),e.outlinePoly.fill(se(s,.08+t*.13)),e.outlinePoly.strokeWidth(2+t*3.5),e.outlinePoly.shadowColor(s),e.outlinePoly.shadowBlur(4+t*12),e.outlinePoly.shadowOpacity(.25+t*.45)}function Si(i,e){return i.closedSections.has(e.id)||i.closedSections.has(e.logicalId)||e.zone!=null&&i.closedSections.has(e.zone)}function vi(i,e){return Si(i,e)?"closed":e.total<=0?"normal":e.free<=0?"sold-out":e.free<=e.total*Gs?"nearly-gone":"normal"}function vo(i,e){let t=vi(i,e);e.blockPoly.fill(Fe(ae(i.canvasBackground),t)),e.subLabel.text(t==="sold-out"?U("map.soldOut"):U("map.seatsLeft",{count:e.free})),e.subLabel.offsetX(e.subLabel.width()/2)}function wo(i,e){let t,s;i.reducedMotion?(t=e<=ye?1:0,s=e<=Ae?1:0):(t=O((Ee-e)/(Ee-ye),0,1),s=O((ye-e)/(ye-Ae),0,1)),(i.floorOverview||i.focusedSectionId)&&(t=0,s=0);let o=!i.floorOverview&&!i.focusedSectionId&&e<ne;o&&(t=1),i.zones.length||(s=0);let n=i.viewMode==="perspective"&&i.glideInProgress&&i.seatCount>2500;i.seatLayer.opacity(o||n?0:1-t);let r=i.stageScaleX,a=!i.glideInProgress&&(i.lodScale===0||Math.abs(e-i.lodScale)/(i.lodScale||1)>.08);a&&i.setLodScale(e);let l=i.focusedSectionId,c=ae(i.canvasBackground),h=O((t-.2)/.8,0,1);for(let d of i.sections){let m=i.hasFocusDimOverlay?1:l&&d.id!==l&&d.logicalId!==l&&d.zone!==l?Be:1,y=Math.min(m,so(d.memberCategoryKeys,i.categoryFilter)?Be:1);d.outlinePoly.opacity(o?0:(1-t)*y),d.blockPoly.opacity(Ds*t*y),d.blockPoly.stroke(c.sectionStroke),d.blockPoly.strokeWidth(Mt/Math.max(r,1e-4));let p=d.blockPoly.fill(),u=q(typeof p=="string"?p:d.baseFill,d.preferredInk);d.nameLabel.fill(u),d.subLabel.fill(u),a&&h>.01&&Un(i,d,r),d.nameLabel.opacity(d.nameLabelFits?h*(1-s)*y:0),d.subLabel.opacity(0)}let f=s*(1-i.isoT);for(let d of i.zones)d.back.opacity(f),d.label.opacity(f),d.sub&&d.sub.opacity(i.stageWidth<Ue?0:f),a&&Zn(i,d,r);if(!i.glideInProgress&&(h>.01||f>.01)){qn(i,r),Yn(i.sections);for(let d of i.zones){let m=d.label.opacity();d.back.opacity(m),d.sub&&d.sub.opacity(i.stageWidth<Ue?0:m)}}i.bgLayer.batchDraw()}function Yn(i){let e=new Map;for(let t of i)(e.get(t.logicalId)??e.set(t.logicalId,[]).get(t.logicalId)).push(t);for(let t of e.values()){if(t.length<2)continue;let s=t.filter(o=>o.nameLabel.opacity()>.05).sort((o,n)=>{let r=V(o.outline),a=V(n.outline);return a.width*a.height-r.width*r.height});for(let o of s.slice(1))o.nameLabel.opacity(0)}}function qn(i,e){let s=[],o=a=>{let l=i.worldToScreen({x:a.x(),y:a.y()}),c=V(At({x:0,y:0},a.width()*e,a.height()*e,a.rotation()));return{x:l.x-c.width/2,y:l.y-c.height/2,w:c.width,h:c.height}};for(let a of i.zones){if(a.label.opacity()<=.05)continue;let l=i.worldToScreen(a.anchor),c=a.back.width()*e,h=a.back.height()*e;s.push({node:a.label,tier:0,section:!1,box:{x:l.x-c/2,y:l.y-h/2,w:c,h}})}for(let a of i.sections)a.nameLabel.opacity()>.05&&s.push({node:a.nameLabel,tier:1,section:!0,area:a.labelArea,box:o(a.nameLabel)});if(s.length<2)return;s.sort((a,l)=>a.tier-l.tier||(l.area??0)-(a.area??0)||a.box.y-l.box.y||a.box.x-l.box.x);let n=[],r=a=>n.some(l=>a.x<l.x+l.w+4&&l.x<a.x+a.w+4&&a.y<l.y+l.h+4&&l.y<a.y+a.h+4);for(let a of s){if(!r(a.box)){n.push(a.box);continue}let l=!1;if(a.section){let c=a.node.fontSize(),h=a.node.y();for(let f of Os){let d=c*f;if(d*e<ri)break;et(a.node,d,h);let m=o(a.node);if(!r(m)){n.push(m),l=!0;break}}l||et(a.node,c,h)}l||a.node.opacity(0)}}function et(i,e,t){i.fontSize(Math.max(1,e)),i.offsetX(i.width()/2),i.offsetY(i.height()/2),i.y(t)}function Un(i,e,t){e.subLabelFits=!1;let s=ci(i.stageWidth),o=_s*e.labelScale*s,n=Math.min(ri*e.labelScale,o);for(let r=o;r>=n;r-=1)for(let a of[0,-90]){e.nameLabel.rotation(a),et(e.nameLabel,r/t,e.nameLabel.y());for(let l of e.labelAnchors){e.nameLabel.position(l);let c=8/t;if(Bt(l,e.nameLabel.width()+c,e.nameLabel.height()+c,a,e.outline,e.holes)){e.nameLabelFits=!0;return}}}e.nameLabel.position(e.centroid),e.nameLabel.rotation(0),e.nameLabelFits=!1}function Zn(i,e,t){let s=ci(i.stageWidth),o=e.sub!=null&&i.stageWidth>=Ue,n=i.stageWidth<Ue,r=(n?7:10)*s/t,a=(n?4:6)*s/t,l=o?3*s/t:0;et(e.label,Pt*s/t,e.anchor.y),o&&et(e.sub,xt*s/t,e.anchor.y);let c=Math.max(e.label.width(),o?e.sub.width():0)+r*2,h=e.label.height()+(o?l+e.sub.height():0)+a*2;e.label.y(e.anchor.y-(o?(l+e.sub.height())/2:0)),o&&e.sub.y(e.anchor.y+(e.label.height()+l)/2),e.back.position(e.anchor),e.back.size({width:c,height:h}),e.back.offset({x:c/2,y:h/2}),e.back.cornerRadius(7*s/t),e.back.strokeWidth(1/t);let f=e.back.getAbsolutePosition(),d=62+h*t/2;if(f.y<d){let m=(d-f.y)/t;e.label.y(e.label.y()+m),e.sub&&e.sub.y(e.sub.y()+m),e.back.y(e.back.y()+m)}}import{Group as Qn}from"konva/lib/Group";import{Line as ko}from"konva/lib/shapes/Line";import{Rect as jn}from"konva/lib/shapes/Rect";import{Text as Lo}from"konva/lib/shapes/Text";function To(i){let e=i.exportMode?Math.max(i.effScale(),re):i.effScale(),t=e>=re;for(let[n,r]of i.boothLabelById){let a=i.circleById.get(n);r.visible(pe(r.fontSize(),e)&&!!a?.isVisible()&&i.focusedSeatOpacity(n,a?.getAbsoluteOpacity()??1)>=.5)}i.labelGroup.destroyChildren(),i.labelLiftGroups.clear(),i.seatLabelById.clear();let s=0;if(t)for(let n of i.visibleSeatCandidates()){if(n.kind==="booth")continue;let r=i.worldToScreen(n);if(r.x<-20||r.x>i.stage.width()+20||r.y<-20||r.y>i.stage.height()+20||i.accessGlyphById.has(n.id)&&i.accessGlyphShouldShow(n.id))continue;let a=i.circleById.get(n.id);if(!a?.isVisible()||i.focusedSeatOpacity(n.id,a.getAbsoluteOpacity())<.5)continue;let l=i.statusById.get(n.id)??"free",c=i.renderedSeatPoint(n),h=i.viewMode==="perspective"?i.perspectiveSeatScale.get(n.id)??1:1;if(l==="booked"||l==="held"&&!i.ownedHold.has(n.id)&&!i.opts.manageMode){let p=new Qn({x:c.x,y:c.y,listening:!1});if(p.scale({x:h,y:h}),l==="held"?(p.add(new jn({x:-4.2,y:-.7,width:8.4,height:6.5,cornerRadius:1.3,stroke:"#ffffff",strokeWidth:1.25,listening:!1})),p.add(new ko({points:[-2.4,-.8,-2.4,-2.7,-1.2,-4,0,-4.35,1.2,-4,2.4,-2.7,2.4,-.8],stroke:"#ffffff",strokeWidth:1.2,lineCap:"round",lineJoin:"round",listening:!1}))):p.add(new ko({points:[-4.2,4.2,4.2,-4.2],stroke:"#ffffff",strokeWidth:1.8,lineCap:"round",listening:!1})),i.seatLabelContainer(n.id).add(p),++s>=ni)break;continue}let d=de*i.seatLabelScale(n),m=new Lo({x:c.x,y:c.y,text:yt(n.displayLabel??n.label),fontSize:d,fontStyle:"600",fontFamily:i.labelFont(),fill:a?i.seatLabelInk(n,a):i.seatPreferredLabelInk(n),listening:!1,perfectDrawEnabled:!1}),y=i.seatR*2-3;if(m.width()>y&&m.fontSize(Math.max($e,d*y/m.width())),m.width()>y+.01){m.destroy();continue}if(!pe(m.fontSize(),e)){m.destroy();continue}if(m.offsetX(m.width()/2),m.offsetY(m.height()/2),m.scale({x:h,y:h}),i.seatLabelContainer(n.id).add(m),i.seatLabelById.set(n.id,m),++s>=ni)break}let o=new De;for(let{node:n}of i.freeTextById.values()){if(!n.isVisible())continue;let r=n.getClientRect({relativeTo:i.bgLayer,skipShadow:!0,skipStroke:!0});o.insert({x:r.x-Z,y:r.y-Z,width:r.width+Z*2,height:r.height+Z*2})}for(let n of i.rowLabelPlan){let r=i.focusedSectionId!=null&&n.focusKeys?.includes(i.focusedSectionId),a=r?Math.max(n.fontSize,As/Math.max(e,1e-4)):n.fontSize;if(!r&&!pe(a,e))continue;let l=i.worldToScreen({x:n.x,y:n.y});if(l.x<-40||l.x>i.stage.width()+40||l.y<-40||l.y>i.stage.height()+40)continue;let c=new Lo({x:n.x,y:n.y,text:n.text,fontSize:a,fontStyle:"700",fontFamily:i.labelFont(),fill:n.ink,rotation:n.rotation,opacity:n.opacity,shadowColor:"#05070c",shadowBlur:n.ink.toLowerCase()==="#ffffff"?5:0,shadowOpacity:n.ink.toLowerCase()==="#ffffff"?.8:0,shadowForStrokeEnabled:!1,listening:!1,perfectDrawEnabled:!1});c.offsetX(c.width()/2),c.offsetY(c.height()/2);let h=i.resolveAutomaticRowLabelPosition(c,n,o);c.position(h),c.setAttr("rowLabel",!0),o.insert(i.rowLabelBox(c,h)),i.labelGroup.add(c)}i.isoT>0&&i.viewMode!=="perspective"&&i.applyUprightLabels(),i.overlayLayer.batchDraw()}function tt(i){return{th:It*Math.PI/180*i.isoT,sg:1-(1-qe)*i.isoT}}function Io(i,e){let{th:t,sg:s}=tt(e),o=e.centre,n=i.x-o.x,r=i.y-o.y,a=n*Math.cos(t)-r*Math.sin(t),l=(n*Math.sin(t)+r*Math.cos(t))*s;return{x:o.x+a,y:o.y+l}}function Co(i,e){let{th:t,sg:s}=tt(e),o=e.centre,n=i.x-o.x,a=(i.y-o.y)/s,l=n*Math.cos(t)+a*Math.sin(t),c=-n*Math.sin(t)+a*Math.cos(t);return{x:o.x+l,y:o.y+c}}function Mo(i,e){let{th:t,sg:s}=tt(e),o=i*e.isoT;return{x:-(o/s)*Math.sin(t),y:-(o/s)*Math.cos(t)}}function Po(i,e,t){let s=ji(e);i.offset(t),i.position(te(e,t)),i.rotation(s.rotationDeg),i.scale({x:s.scaleX,y:s.scaleY}),i.skewX(s.skewX),i.skewY(0)}function xo(i){i.position({x:0,y:0}),i.offset({x:0,y:0}),i.scale({x:1,y:1}),i.rotation(0),i.skewX(0),i.skewY(0)}function Ro(i,e){let t=Math.hypot(e.x-i.surfaceFocal.x,e.y-i.surfaceFocal.y),s=Math.max(0,t-i.frontDistanceWorld);return i.liftWorld+s*Math.tan(i.rakeDeg*Math.PI/180)}function Eo(i,e,t){return i.perspectiveAffine?te(i.perspectiveAffine,e):te(t,e)}function Ao(i,e){return e?te(e,i):i}function Bo(i,e){let t=0;for(let f of i.seats){let d=Math.max(0,(f.eyeHeightM??Y)-Y);t=Math.max(t,d*Me)}for(let f of i.objects)f.type==="section"&&(t=Math.max(t,lt(f,{floorBaseHeightM:i.floorBaseHeightMFor(f.id)}).height*Me));let s=Ui(i.bounds,t),o=bt(s,s.target),n=Zi(o);e.seatLocal.clear(),e.seatProjected.clear(),e.seatDepth.clear(),e.seatScale.clear();let r=1/0,a=1/0,l=-1/0,c=-1/0;for(let f of i.seats){let d=Math.max(0,(f.eyeHeightM??Y)-Y),m=ue(s,f,d*Me),y={x:m.x,y:m.y};e.seatProjected.set(f.id,y),e.seatLocal.set(f.id,te(n,y)),e.seatDepth.set(f.id,m.depth),e.seatScale.set(f.id,m.scale),r=Math.min(r,m.x),a=Math.min(a,m.y),l=Math.max(l,m.x),c=Math.max(c,m.y)}for(let f of[{x:i.bounds.x,y:i.bounds.y},{x:i.bounds.x+i.bounds.width,y:i.bounds.y},{x:i.bounds.x+i.bounds.width,y:i.bounds.y+i.bounds.height},{x:i.bounds.x,y:i.bounds.y+i.bounds.height}]){let d=ue(s,f,0);r=Math.min(r,d.x),a=Math.min(a,d.y),l=Math.max(l,d.x),c=Math.max(c,d.y)}let h=Math.max(24,i.seatR*3);return{camera:s,baseAffine:o,baseInverse:n,bounds:Number.isFinite(r)?{x:r-h,y:a-h,width:Math.max(1,l-r+h*2),height:Math.max(1,c-a+h*2)}:null}}function Fo(i,e,t){let s=t?[...t].map(o=>i.seatById.get(o)).filter(o=>!!o):e?i.seats:[...i.perspectiveAppliedSeats].map(o=>i.seatById.get(o)).filter(o=>!!o);for(let o of s){if(e&&i.perspectiveAppliedSeats.has(o.id))continue;let n=e?i.perspectiveSeatProjected.get(o.id)??o:o,r=e?i.perspectiveSeatScale.get(o.id)??1:1,a=i.circleById.get(o.id);a?.position(n),a?.scale({x:r,y:r});let l=i.accessRingById.get(o.id);l?.position(n),l?.scale({x:r,y:r});let c=i.accessGlyphById.get(o.id);if(c){let f=i.seatR*1.5/oe;c.position(n),c.scale({x:f*r,y:f*r})}let h=i.boothLabelById.get(o.id);h?.position(n),h?.scale({x:r,y:r}),e&&i.perspectiveAppliedSeats.add(o.id)}e||i.perspectiveAppliedSeats.clear()}function ki(i){return i?.getAttr?.("seatId")??void 0}var ot=class ot{constructor(e,t={}){this.labelLiftGroups=new Map;this.seats=[];this.seatById=new Map;this.seatIndex=null;this.chartDoc=null;this.activeFloorId="";this.stacked=!1;this.floorOverview=!1;this.circleById=new Map;this.glyphMarkers=[];this.seatGlyphDetail=!0;this.boothDims=new Map;this.boothLabelById=new Map;this.seatLabelById=new Map;this.accessRingById=new Map;this.accessGlyphById=new Map;this.freeTextById=new Map;this.iconNodeById=new Map;this.primaryFocalLabels=new Map;this.gaById=new Map;this.statusById=new Map;this.catColor=new Map;this.catByKey=new Map;this.theme={};this.canvasBackground=yi;this.effSelection=je;this.colorblind=!1;this.cbHueByKey=new Map;this.rowLabelPlan=[];this.catOrder=[];this.selection=new Set;this.selectionMarkers=new Map;this.ownedHold=new Set;this.selectionFocusId=null;this.hoveredId=null;this.focusedId=null;this.accessFilter=null;this.categoryHighlight=null;this.categoryFilter=null;this.commercialLimitedFilter=!1;this.sections=[];this.zones=[];this.seatSection=new Map;this.unsectionedSeatGroup=null;this.catPrice=new Map;this.dimmedSections=new Set;this.sectionHeat=new Map;this.closedSections=new Set;this.focusedSectionId=null;this.focusBackdrop=null;this.focusDimOverlay=null;this.objectFloor=new Map;this.zoneColor=new Map;this.hasSections=!1;this.hasBoothText=!1;this.isoT=0;this.isoTarget=0;this.isoRaf=0;this.viewMode="flat";this.perspectiveCamera=null;this.perspectiveBaseAffine=null;this.perspectiveBaseInverse=null;this.perspectiveSeatLocal=new Map;this.perspectiveSeatProjected=new Map;this.perspectiveSeatDepth=new Map;this.perspectiveSeatScale=new Map;this.perspectiveAppliedSeats=new Set;this.perspectiveBounds=null;this.isoCentre={x:0,y:0};this.glideRaf=0;this.glideInProgress=!1;this.destroyed=!1;this.lodScale=0;this.reducedMotion=typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;this.fitScale=1;this.seatR=Xe;this.bounds={x:0,y:0,width:1,height:1};this.cached=!1;this.dpr=Math.min(typeof window<"u"&&window.devicePixelRatio||1,2);this.assetGeneration=0;this.assetPromises=[];this.assetErrors=[];this.assetCancels=new Set;this.rafId=0;this.frames=0;this.lastFpsAt=0;this.recacheTimer=null;this.resizeObs=null;this.viewChangeRaf=0;this.marquee=null;this.marqueeCur=null;this.onKeyDown=e=>{if(this.opts.manageMode){if((e.metaKey||e.ctrlKey)&&(e.key==="a"||e.key==="A")){e.preventDefault(),this.opts.onMarquee?.(this.selectAllSelectable());return}if(e.key==="Escape"&&this.selection.size){e.preventDefault(),this.clearSelection(),this.opts.onMarquee?.([]);return}}let t=e.key==="ArrowLeft"?{x:-1,y:0}:e.key==="ArrowRight"?{x:1,y:0}:e.key==="ArrowUp"?{x:0,y:-1}:e.key==="ArrowDown"?{x:0,y:1}:null;if(t){e.preventDefault();let s=this.focusedId?this.nearestSeat(this.focusedId,t):this.seats[0]?.id??null;s&&this.focusSeat(s);return}if((e.key==="Enter"||e.key===" ")&&this.focusedId){e.preventDefault(),this.toggleSeat(this.focusedId);let s=this.seatById.get(this.focusedId);s&&this.opts.onFocusSeat?.(s)}};this.container=e,this.opts={maxSelection:10,selectableStatuses:["free"],...t},this.exportMode=t.exportMode===!0,this.currency=t.currency;let s=_t.pixelRatio;this.exportMode&&(this.dpr=1),_t.pixelRatio=this.dpr,this.stage=new Jn({container:e,width:e.clientWidth||1,height:e.clientHeight||1,draggable:!1}),this.gestures=new Ft(this.pointerHost),this.exportMode||(e.style.touchAction="none",this.gestures.attach(),e.tabIndex<0&&(e.tabIndex=0),e.setAttribute("role","application"),e.getAttribute("aria-label")||e.setAttribute("aria-label",U("map.aria")),e.addEventListener("keydown",this.onKeyDown)),this.bgLayer=new wi({listening:!this.exportMode}),this.seatLayer=new wi({listening:!this.exportMode}),this.overlayLayer=new wi({listening:!1}),this.labelGroup=new ke({listening:!1}),this.overlayLayer.add(this.labelGroup),this.fgDecorGroup=new ke({listening:!1}),this.overlayLayer.add(this.fgDecorGroup),this.hoverRing=new Le({radius:Xe+2,stroke:"#ffffff",strokeWidth:2,opacity:.85,listening:!1,visible:!1,perfectDrawEnabled:!1,shadowForStrokeEnabled:!1}),this.overlayLayer.add(this.hoverRing),this.focusRing=new Le({radius:Xe+3,stroke:"#38bdf8",strokeWidth:2.5,dash:[4,3],opacity:.95,listening:!1,visible:!1,perfectDrawEnabled:!1,shadowForStrokeEnabled:!1}),this.overlayLayer.add(this.focusRing),this.stage.add(this.bgLayer,this.seatLayer,this.overlayLayer),this.exportMode&&(_t.pixelRatio=s),this.exportMode||(this.wireInteraction(),this.startFpsLoop()),!this.exportMode&&typeof ResizeObserver<"u"&&(this.resizeObs=new ResizeObserver(()=>this.handleResize()),this.resizeObs.observe(e))}get moved(){return this.gestures.moved}isGhostClick(e){return this.gestures.isGhostClick(e)}get pointerHost(){return{container:this.container,stage:this.stage,cancelGlide:()=>this.cancelGlide(),releaseSectionFocusDim:()=>this.releaseSectionFocusDim(),updateSeatGroupVisibility:()=>this.updateSeatGroupVisibility(),scheduleViewChange:()=>this.scheduleViewChange(),afterViewChange:()=>this.afterViewChange(),zoomBounds:()=>this.zoomBounds(),marqueeActive:()=>!!this.marquee,marqueeShouldStart:e=>!!(this.opts.manageMode&&this.opts.marqueeSelect&&e.pointerType!=="touch"&&e.button===0&&this.getRung()==="seats"),beginMarquee:e=>this.beginMarquee(e),updateMarquee:e=>this.updateMarquee(e),finishMarquee:()=>this.finishMarquee(),cancelMarquee:()=>this.cancelMarquee()}}setChart(e,t){if(e!==this.chartDoc&&(this.stacked=!1,this.floorOverview=!1),this.cancelAssetLoads(),this.chartDoc=e,this.activeFloorId=t?.floorId??ht(e)[0].id,this.objectFloor.clear(),e.floors&&e.floors.length>1)for(let o of e.floors)for(let n of o.objects)this.objectFloor.set(n.id,o.id),n.type==="section"&&n.logicalSectionId&&this.objectFloor.set(n.logicalSectionId,o.id);let s=this.floorView(e);this.focusedId=null,this.focusRing.visible(!1),this.bgLayer.destroyChildren(),this.focusDimOverlay?.destroy(),this.focusDimOverlay=null,this.seatLayer.clearCache(),this.seatLayer.listening(!this.exportMode),this.seatLayer.destroyChildren(),this.unsectionedSeatGroup=null,this.labelGroup.destroyChildren(),this.labelLiftGroups.clear(),this.fgDecorGroup.destroyChildren(),this.circleById.clear(),this.glyphMarkers=[],this.boothDims.clear(),this.boothLabelById.clear(),this.seatLabelById.clear(),this.accessRingById.clear(),this.accessGlyphById.clear(),this.freeTextById.clear(),this.iconNodeById.clear(),this.primaryFocalLabels.clear(),this.gaById.clear();for(let o of this.selectionMarkers.values())o.destroy();this.selectionMarkers.clear(),this.ownedHold.clear(),this.selectionFocusId=null,this.statusById.clear(),this.selection.clear(),this.seatById.clear(),this.seatIndex=null,this.cached=!1,this.accessFilter=null,this.sections=[],this.zones=[],this.seatSection.clear(),this.focusedSectionId=null,this.focusBackdrop=null,this.catPrice.clear(),this.zoneColor.clear(),this.lodScale=0,this.hasBoothText=!1,this.isoRaf&&(cancelAnimationFrame(this.isoRaf),this.isoRaf=0),this.isoT=0,this.isoTarget=0,this.viewMode="flat",this.perspectiveCamera=null,this.perspectiveBaseAffine=null,this.perspectiveBaseInverse=null,this.perspectiveSeatLocal.clear(),this.perspectiveSeatProjected.clear(),this.perspectiveSeatDepth.clear(),this.perspectiveSeatScale.clear(),this.perspectiveAppliedSeats.clear(),this.perspectiveBounds=null,this.resetLayerTransforms(),this.hasSections=s.objects.some(o=>o.type==="section");for(let o of e.zones??[])o.color&&this.zoneColor.set(o.id,o.color);this.seatLayer.opacity(1),this.hoverRing.visible(!1),this.hoveredId=null,this.theme=e.theme??{},this.seatR=O(this.theme.seatScale??1,.7,1.6)*Xe,this.container.style.background="",this.canvasBackground=this.resolveCanvasBackground(),this.container.style.background=this.canvasBackground,this.effSelection=this.resolveSelectionColor(),this.hoverRing.stroke(this.effSelection),this.hoverRing.radius(this.seatR+2),this.catColor.clear(),this.catByKey.clear(),this.catPrice.clear(),this.catOrder=e.categories.map(o=>o.key),this.cbHueByKey.clear(),[...this.catOrder].sort().forEach((o,n)=>{this.cbHueByKey.set(o,Et[n%Et.length])});for(let o of e.categories)this.catColor.set(o.key,o.color),this.catByKey.set(o.key,o),typeof o.price=="number"&&this.catPrice.set(o.key,o.price);for(let o of s.objects)o.type==="booth"&&this.boothDims.set(o.id,{width:o.width,height:o.height,rotation:o.rotation,...o.points&&o.points.length>=3?{points:o.points.map(n=>({x:n.x,y:n.y}))}:{}});this.seats=Ne(s,{floorBaseHeightM:this.stacked||this.floorOverview?0:this.floorBaseHeightMFor()});for(let o of this.seats)this.seatById.set(o.id,o),this.statusById.set(o.id,"free");this.seatIndex=qi(this.seats,{seatRadius:this.seatR}),this.bounds=Vi(s),this.isoCentre={x:this.bounds.x+this.bounds.width/2,y:this.bounds.y+this.bounds.height/2},this.buildPerspectiveProjection(s),this.renderBackground(s),this.unsectionedSeatGroup=new ke({listening:!this.exportMode}),this.seatLayer.add(this.unsectionedSeatGroup),this.renderSeats(),this.buildRowLabelPlan(s),this.overlayLayer.add(this.labelGroup),this.overlayLayer.add(this.fgDecorGroup),this.overlayLayer.add(this.hoverRing),this.overlayLayer.add(this.focusRing),this.zoomToFit()}floorView(e){if(!e.floors||!e.floors.length)return{...e,referenceImage:void 0,backgroundImage:xe(e)};if(this.floorOverview&&e.floors.length>=2)return{...Ni(e)?zi(e):Hi(e),referenceImage:void 0,backgroundImage:xe(e)};if(this.stacked&&e.floors.length>=2)return{...Gi(e),referenceImage:void 0,backgroundImage:xe(e)};let t=e.floors.find(s=>s.id===this.activeFloorId)??e.floors[0];return{...e,objects:t.objects,focalPoint:t.focalPoint,referenceImage:void 0,backgroundImage:xe(t),floors:void 0}}floorBaseHeightMFor(e){let t=this.chartDoc?.floors;if(!t?.length)return 0;let s=this.stacked&&e?this.objectFloor.get(e)??this.activeFloorId:this.activeFloorId;return t.find(o=>o.id===s)?.baseHeightM??0}setStacked(e){!this.chartDoc||e===this.stacked||!(this.chartDoc.floors&&this.chartDoc.floors.length>=2)||(this.stacked=e,e&&(this.floorOverview=!1),this.setChart(this.chartDoc,{floorId:this.activeFloorId}))}isStacked(){return this.stacked}setFloorOverview(e){!this.chartDoc||e===this.floorOverview||!(this.chartDoc.floors&&this.chartDoc.floors.length>=2)||(this.floorOverview=e,e&&(this.stacked=!1),this.setChart(this.chartDoc,{floorId:this.activeFloorId}))}isFloorOverview(){return this.floorOverview}setActiveFloor(e){!this.chartDoc||e===this.activeFloorId&&!this.floorOverview&&!this.stacked||(this.floorOverview=!1,this.stacked=!1,this.setChart(this.chartDoc,{floorId:e}))}getFloors(){return this.chartDoc?ht(this.chartDoc).map(e=>({id:e.id,name:e.name})):[]}getActiveFloorId(){return this.activeFloorId}setStatus(e,t){let s=!1,o=this.hasSections?new Set:null;for(let n of e){if(!this.statusById.has(n))continue;let r=this.statusById.get(n);this.statusById.set(n,t);let a=this.circleById.get(n);if(a&&(this.paintSeat(a,n),s=!0),o){let l=this.seatSection.get(n);l&&(r==="free"!=(t==="free")&&(l.free+=t==="free"?1:-1),o.add(l))}}if(o&&o.size){for(let n of o)this.refreshSectionFill(n);this.bgLayer.batchDraw()}s&&(this.cached?(this.recacheTimer&&clearTimeout(this.recacheTimer),this.recacheTimer=setTimeout(()=>this.cacheSeatLayer(),150)):this.seatLayer.batchDraw(),this.effScale()>re&&this.updateLabels())}setSeatCategories(e){let t=!1,s=new Set;for(let[n,r]of Object.entries(e)){let a=this.seatById.get(n);if(!a||!this.catColor.has(r)||a.categoryKey===r)continue;a.categoryKey=r;let l=this.circleById.get(n);l&&(this.paintSeat(l,n),t=!0);let c=this.seatSection.get(n);c&&s.add(c)}if(!t)return;let o=new Map((this.chartDoc?ht(this.chartDoc):[]).flatMap(n=>n.objects).filter(n=>n.type==="section").map(n=>[n.id,n]));for(let n of s){if(!o.get(n.id)?.color){let a=new Map;for(let l of n.memberIds){let c=this.seatById.get(l)?.categoryKey;c&&a.set(c,(a.get(c)??0)+1)}n.baseFill=Ut([...a].map(([l,c])=>({hex:this.catColor.get(l)??"#6e7bff",w:c})),"#3a4358")}this.refreshSectionFill(n)}s.size&&this.bgLayer.batchDraw(),this.cached?(this.recacheTimer&&clearTimeout(this.recacheTimer),this.recacheTimer=setTimeout(()=>this.cacheSeatLayer(),150)):this.seatLayer.batchDraw(),this.effScale()>re&&this.updateLabels()}setOwnedHold(e){let t=new Set((e??[]).filter(o=>this.statusById.has(o))),s=new Set([...this.ownedHold,...t]);this.ownedHold=t;for(let o of s){let n=this.circleById.get(o);n&&this.paintSeat(n,o),this.syncSelectionMarker(o)}s.size&&(this.cached?(this.recacheTimer&&clearTimeout(this.recacheTimer),this.recacheTimer=setTimeout(()=>this.cacheSeatLayer(),150)):this.seatLayer.batchDraw(),this.effScale()>re&&this.updateLabels(),this.overlayLayer.batchDraw())}setSelectionFocus(e){let t=e&&this.selection.has(e)?e:null;if(t===this.selectionFocusId)return;let s=this.selectionFocusId;this.selectionFocusId=t;for(let o of this.seats){let n=this.circleById.get(o.id);n&&this.paintSeat(n,o.id)}s&&this.syncSelectionMarker(s),t&&this.syncSelectionMarker(t);for(let[o,n]of this.selectionMarkers)n.opacity(!t||o===t?1:.2);this.cached?(this.seatLayer.clearCache(),this.cacheSeatLayer()):this.seatLayer.batchDraw(),this.overlayLayer.batchDraw()}getStatus(e){return this.statusById.get(e)??"free"}getSelection(){let e=[];for(let t of this.selection){let s=this.seatById.get(t);s&&e.push(s)}return e}clearSelection(){let e=[...this.selection];for(let t of e)this.setSelected(t,!1,!0);this.overlayLayer.batchDraw()}setMaxSelection(e){this.opts.maxSelection=Math.max(0,Math.floor(e))}select(e){let t=[];for(let s of e){if(this.selection.has(s)||!this.isSelectable(s))continue;if(this.selection.size>=this.opts.maxSelection){this.opts.onSelectionLimit?.(this.opts.maxSelection);break}this.setSelected(s,!0,!0);let o=this.seatById.get(s);o&&t.push(o)}return t.length&&this.overlayLayer.batchDraw(),t}setManageInteraction(e){this.marquee&&this.cancelMarquee(),this.gestures.resetPan(),this.opts.manageMode=e.manageMode,this.opts.marqueeSelect=e.marqueeSelect,this.opts.selectableStatuses=[...e.selectableStatuses],e.maxSelection!=null&&(this.opts.maxSelection=e.maxSelection);let t=[...this.selection].filter(s=>!this.isSelectable(s));t.length&&this.deselect(t),!e.manageMode&&this.selection.size&&this.clearSelection(),this.container.style.cursor="default",this.overlayLayer.batchDraw()}setSectionHeat(e){this.sectionHeat.clear();for(let[t,s]of Object.entries(e??{}))Number.isFinite(s)&&this.sectionHeat.set(t,Math.max(0,Math.min(1,s)));for(let t of this.sections)this.refreshSectionHeat(t);this.bgLayer.batchDraw()}deselect(e){let t=!1;for(let s of e)this.selection.has(s)&&(this.setSelected(s,!1,!0),t=!0);t&&this.overlayLayer.batchDraw()}selectAllSelectable(){if(!this.opts.manageMode)return[];let e=[];for(let t of this.seats)this.isSelectable(t.id)&&e.push(t.id);return this.selectMany(e)}selectByLabels(e){if(!this.opts.manageMode)return[];let t=new Set(e),s=[];for(let o of this.seats)t.has(o.label)&&this.isSelectable(o.id)&&s.push(o.id);return this.selectMany(s)}setEvidenceSelection(e){return!this.seatById.has(e)||!this.isSelectable(e)?!1:(this.selection.size&&this.clearSelection(),this.setSelected(e,!0),this.overlayLayer.batchDraw(),this.selection.has(e))}getSelectableInSection(e){let t=[],s=new Set;for(let o of this.sections)if(!(o.id!==e&&o.logicalId!==e&&o.zone!==e))for(let n of o.memberIds){if(s.has(n)||(s.add(n),!this.isSelectable(n)))continue;let r=this.seatById.get(n);r&&t.push(r)}return t}selectMany(e){let t=e.filter(o=>!this.selection.has(o));if(!t.length)return this.getSelection();let s=this.selection.size+t.length<=Bs;for(let o of t)if(s)this.setSelected(o,!0,!0);else{this.selection.add(o);let n=this.circleById.get(o);n&&this.paintSeat(n,o)}return this.cached||this.seatLayer.batchDraw(),this.overlayLayer.batchDraw(),this.getSelection()}beginMarquee(e){let t=this.screenToWorld(e),s=this.stage.scaleX()||1,o=new it({x:t.x,y:t.y,width:0,height:0,stroke:this.effSelection,strokeWidth:1.5/s,dash:[5/s,4/s],fill:"rgba(110,123,255,0.10)",listening:!1,perfectDrawEnabled:!1,shadowForStrokeEnabled:!1});this.overlayLayer.add(o),this.marquee={start:t,rect:o},this.marqueeCur=t,this.overlayLayer.batchDraw()}updateMarquee(e){if(!this.marquee)return;let t=this.screenToWorld(e),{start:s,rect:o}=this.marquee;o.setAttrs({x:Math.min(s.x,t.x),y:Math.min(s.y,t.y),width:Math.abs(t.x-s.x),height:Math.abs(t.y-s.y)}),this.marqueeCur=t,this.overlayLayer.batchDraw()}cancelMarquee(){this.marquee&&(this.marquee.rect.destroy(),this.marquee=null,this.marqueeCur=null,this.overlayLayer.batchDraw())}finishMarquee(){let e=this.marquee;if(this.marquee=null,!e)return;e.rect.destroy(),this.overlayLayer.batchDraw();let t=this.marqueeCur??e.start;this.marqueeCur=null;let s=Math.min(e.start.x,t.x),o=Math.max(e.start.x,t.x),n=Math.min(e.start.y,t.y),r=Math.max(e.start.y,t.y),a=this.stage.scaleX()||1;if((o-s)*a<4&&(r-n)*a<4){this.selection.size&&(this.clearSelection(),this.opts.onMarquee?.([]));return}let l=[];for(let c of this.seats){let h=this.renderedSeatPoint(c);h.x<s||h.x>o||h.y<n||h.y>r||this.isSelectable(c.id)&&l.push(c.id)}this.selectMany(l),this.opts.onMarquee?.(this.getSelection())}flashSeat(e,t="#f43f5e"){let s=this.seatById.get(e);if(!s)return;let o=this.renderedSeatPoint(s),n=new Le({x:o.x,y:o.y,radius:this.seatR,stroke:t,strokeWidth:3,opacity:.9,listening:!1,perfectDrawEnabled:!1,shadowForStrokeEnabled:!1}),r=this.viewMode==="perspective"?this.perspectiveSeatScale.get(e)??1:1;n.scale({x:r,y:r}),this.overlayLayer.add(n);let a=performance.now(),l=620,c=h=>{if(!n.getLayer())return;let f=Math.min(1,(h-a)/l);n.radius(this.seatR*(1+f*1.8)),n.opacity(.9*(1-f)),this.overlayLayer.batchDraw(),f<1?requestAnimationFrame(c):(n.destroy(),this.overlayLayer.batchDraw())};requestAnimationFrame(c)}flashSection(e,t="#22a06b"){let s=this.sections.filter(o=>o.id===e||o.zone===e);if(s.length)for(let o of s){let n=this.viewMode==="perspective"&&o.perspectiveAffine?o.outline.map(d=>this.perspectiveLocalPoint(this.projectedSectionPoint(o,d))):o.outline.map(d=>{let m=o.liftWorld>0?this.isoLiftLocal(o.liftWorld):{x:0,y:0};return{x:d.x+m.x,y:d.y+m.y}}),r=n.reduce((d,m)=>({x:d.x+m.x,y:d.y+m.y}),{x:0,y:0});r.x/=n.length,r.y/=n.length;let a=new st({x:r.x,y:r.y,points:n.flatMap(d=>[d.x-r.x,d.y-r.y]),closed:!0,stroke:t,strokeWidth:3,strokeScaleEnabled:!1,opacity:.92,listening:!1,perfectDrawEnabled:!1,shadowForStrokeEnabled:!0,shadowColor:t,shadowBlur:14,shadowOpacity:.7});this.overlayLayer.add(a),this.overlayLayer.batchDraw();let l=()=>{a.getLayer()&&(a.destroy(),this.overlayLayer.batchDraw())};if(this.reducedMotion||typeof document<"u"&&document.hidden){setTimeout(l,520);continue}let c=performance.now(),h=820,f=d=>{if(this.destroyed||!a.getLayer())return;let m=Math.min(1,(d-c)/h),p=1+(1-Math.pow(1-m,3))*.04;a.scale({x:p,y:p}),a.opacity(.92*(1-m)),this.overlayLayer.batchDraw(),m<1?requestAnimationFrame(f):l()};requestAnimationFrame(f)}}nearestSeat(e,t){let s=this.seatById.get(e);if(!s)return null;let o=this.viewMode==="perspective"?this.perspectiveSeatProjected.get(s.id)??s:s,n=null,r=1/0;for(let a of this.seats){if(a.id===e)continue;let l=this.viewMode==="perspective"?this.perspectiveSeatProjected.get(a.id)??a:a,c=l.x-o.x,h=l.y-o.y,f=c*t.x+h*t.y;if(f<=.5)continue;let d=Math.abs(c*t.y-h*t.x),m=f+d*2.5;m<r&&(r=m,n=a.id)}return n}focusSeat(e){let t=this.seatById.get(e);if(!t)return;this.focusedId=e,this.focusRing.radius(this.seatR+3),this.focusRing.position(this.renderedSeatPoint(t));let s=this.viewMode==="perspective"?this.perspectiveSeatScale.get(e)??1:1;this.focusRing.scale({x:s,y:s}),this.focusRing.visible(!0),this.ensureVisible(t),this.overlayLayer.batchDraw(),this.opts.onFocusSeat?.(t)}ensureVisible(e){let t=this.stage.width(),s=this.stage.height(),o=Math.max(this.stage.scaleX(),ve*1.2),n=this.worldToScreen(e),r=70,a=n.x<r||n.x>t-r||n.y<r||n.y>s-r;if(this.stage.scaleX()<o||a){let l=this.renderedSeatPoint(e),c=this.viewMode==="perspective"&&this.perspectiveBaseAffine?te(this.perspectiveBaseAffine,l):this.isoT===0?l:this.isoForward(l);this.stage.scale({x:o,y:o}),this.stage.position({x:t/2-c.x*o,y:s/2-c.y*o}),this.afterViewChange(),this.stage.batchDraw()}}zoomToFit(){let e=this.stage.width(),t=this.stage.height(),s=this.viewMode==="perspective"&&this.perspectiveBounds?this.perspectiveBounds:this.bounds;if(this.fitScale=Math.min(e/s.width,t/s.height)||1,this.opts.portraitFitCrop&&!this.exportMode){let n=e/s.width<=t/s.height,r=s.height*this.fitScale;n&&r<.55*t&&(this.fitScale=Math.min(this.fitScale*1.3,.62*t/s.height))}let o=this.fitScale;this.stage.scale({x:o,y:o}),this.stage.position({x:(e-s.width*o)/2-s.x*o,y:(t-s.height*o)/2-s.y*o}),this.afterViewChange(),this.stage.batchDraw()}refitCurrentView(){if(this.focusedSectionId&&this.sectionBounds(this.focusedSectionId)){this.focusRegion(this.focusedSectionId,{animate:!1});return}this.zoomToFit()}zoomIn(){this.zoomAbout(this.stage.scaleX()*ot.ZOOM_STEP,ti(this.stage))}zoomOut(){this.zoomAbout(this.stage.scaleX()/ot.ZOOM_STEP,ti(this.stage))}zoomOutLevel(){let e=this.focusedSectionId;return e?this.sectionBounds(e)&&this.stage.scaleX()>this.sectionFrameScale(e)*1.05?(this.focusRegion(e),"section"):"venue":this.getRung()==="seats"?(this.setRung("sections"),"sections"):(this.cancelGlide(),this.zoomToFit(),"venue")}seatCount(){return this.seats.length}bookableCount(){let e=this.seats.length;for(let t of this.gaById.values())e+=t.capacity;return e}worldToScreen(e){let t=this.stage.scaleX(),s=e.id,o=typeof s=="string"?this.seatById.get(s):void 0;if(this.viewMode==="perspective"&&this.perspectiveBaseAffine){let a=o?this.perspectiveSeatProjected.get(o.id)??te(this.perspectiveBaseAffine,e):te(this.perspectiveBaseAffine,e);return{x:a.x*t+this.stage.x(),y:a.y*t+this.stage.y()}}let n=o?this.renderedSeatPoint(o):e,r=this.isoT===0?n:this.isoForward(n);return{x:r.x*t+this.stage.x(),y:r.y*t+this.stage.y()}}setAccessibleFilter(e){this.setAccessibilityFilter(e?[]:null)}setAccessibilityFilter(e){let t=e===null?null:[...e];if(!this.sameAccessFilter(t)){this.accessFilter=t,this.updateAccessGlyphs(this.effScale());for(let s of this.seats){let o=this.circleById.get(s.id);o&&this.paintSeat(o,s.id)}this.updateLabels(),this.cached?(this.seatLayer.clearCache(),this.cacheSeatLayer()):this.seatLayer.batchDraw()}}sameAccessFilter(e){let t=this.accessFilter;return t===null||e===null?t===e:t.length===e.length&&t.every((s,o)=>s===e[o])}setCommercialLimitedFilter(e){if(this.commercialLimitedFilter!==e){this.commercialLimitedFilter=e;for(let t of this.seats){let s=this.circleById.get(t.id);s&&this.paintSeat(s,t.id)}this.updateLabels(),this.cached?(this.seatLayer.clearCache(),this.cacheSeatLayer()):this.seatLayer.batchDraw()}}setCategoryFilter(e){let t=e===null?null:new Set(e);if(!io(t,this.categoryFilter)){this.categoryFilter=t;for(let s of this.seats){let o=this.circleById.get(s.id);o&&this.paintSeat(o,s.id)}this.updateLabels(),this.cached?(this.seatLayer.clearCache(),this.cacheSeatLayer()):this.seatLayer.batchDraw(),this.applyGAFilterState()}}applyGAFilterState(){this.paintGAStateForView(),this.updateFreeTextVisibility(),this.bgLayer.batchDraw()}paintGAStateForView(){eo({gaById:this.gaById,bgLayer:this.bgLayer,exportMode:this.exportMode,pickerMode:!!this.opts.gaPickerMode,selectionColor:this.effSelection,labelFont:()=>this.labelFont(),filteredOut:e=>!!(this.categoryFilter&&!this.categoryFilter.has(e)),dimmed:e=>Js(this.categoryHighlight,this.categoryFilter,e),overviewHidden:e=>!this.exportMode&&e.sectionId!=null&&this.effScale()<ne,effScale:()=>this.effScale(),labelLegible:e=>pe(e,this.effScale())})}setGAStates(e){to(this.gaById,e)&&this.applyGAFilterState()}setGAState(e,t){this.setGAStates({[e]:t})}focusCategories(e){if(!e?.length){this.focusRegion(this.bounds,{durationMs:Ct});return}let t=new Set(e),s=this.seats.filter(c=>!t.has(c.categoryKey)||this.seatInClosedSection(c.id)?!1:(this.statusById.get(c.id)??"free")==="free"||this.ownedHold.has(c.id));if(!s.length)return;let o=1/0,n=-1/0,r=1/0,a=-1/0;for(let c of s){let h=this.renderedSeatPoint(c);o=Math.min(o,h.x),n=Math.max(n,h.x),r=Math.min(r,h.y),a=Math.max(a,h.y)}let l=Math.max(24,this.seatR*3);o-=l,n+=l,r-=l,a+=l,this.focusRegion({x:o,y:r,width:Math.max(40,n-o),height:Math.max(40,a-r)},{durationMs:Ct})}setViewMode(e){if(e==="perspective"){if(this.viewMode===e){this.afterViewChange();return}let a=this.viewMode==="isometric"&&this.isoT>0;this.viewMode=e,this.isoTarget=1,this.isoT=1,this.isoRaf&&(cancelAnimationFrame(this.isoRaf),this.isoRaf=0),this.applyPerspective(a),this.zoomToFit();return}let t=e==="isometric"?1:0,s=this.viewMode==="perspective";if(this.viewMode=e,this.isoTarget=t,this.isoRaf&&(cancelAnimationFrame(this.isoRaf),this.isoRaf=0),s){this.isoT=t,this.applyIso(),this.afterViewChange();return}if(this.reducedMotion){this.isoT=t,this.applyIso(),this.afterViewChange();return}let o=this.isoT;if(o===t){this.applyIso(),this.afterViewChange();return}let n=performance.now(),r=a=>{if(this.destroyed)return;let l=Math.min(1,(a-n)/Fs),c=l<.5?4*l*l*l:1-Math.pow(-2*l+2,3)/2;this.isoT=o+(this.isoTarget-o)*c,this.applyIso(),this.scheduleViewChange(),l<1?this.isoRaf=requestAnimationFrame(r):(this.isoT=this.isoTarget,this.isoRaf=0,this.applyIso(),this.afterViewChange())};this.isoRaf=requestAnimationFrame(r)}getViewMode(){return this.viewMode}get isoState(){return{isoT:this.isoT,centre:this.isoCentre}}isoParams(){return tt(this.isoState)}effScale(){if(this.viewMode==="perspective"&&this.perspectiveBaseAffine){let e=Math.hypot(this.perspectiveBaseAffine.a,this.perspectiveBaseAffine.b),t=Math.hypot(this.perspectiveBaseAffine.c,this.perspectiveBaseAffine.d);return this.stage.scaleX()*Math.min(e,t)}return this.stage.scaleX()*(1-(1-qe)*this.isoT)}isoForward(e){return Io(e,this.isoState)}isoInverse(e){return Co(e,this.isoState)}buildPerspectiveProjection(e){let t=Bo({seats:this.seats,objects:e.objects,bounds:this.bounds,seatR:this.seatR,floorBaseHeightMFor:s=>this.floorBaseHeightMFor(s)},{seatLocal:this.perspectiveSeatLocal,seatProjected:this.perspectiveSeatProjected,seatDepth:this.perspectiveSeatDepth,seatScale:this.perspectiveSeatScale});this.perspectiveCamera=t.camera,this.perspectiveBaseAffine=t.baseAffine,this.perspectiveBaseInverse=t.baseInverse,this.perspectiveBounds=t.bounds}setContainerAffine(e,t,s){Po(e,t,s)}resetContainerTransform(e){xo(e)}sectionSurfaceHeight(e,t){return Ro(e,t)}projectedSectionPoint(e,t){return Eo(e,t,this.perspectiveBaseAffine)}perspectiveLocalPoint(e){return Ao(e,this.perspectiveBaseInverse)}isoLiftLocal(e){return Mo(e,this.isoState)}resetLayerTransforms(e=!0){let t=e?[this.bgLayer,this.seatLayer,this.overlayLayer]:[this.bgLayer,this.overlayLayer];for(let s of t)s.position({x:0,y:0}),s.offset({x:0,y:0}),s.scale({x:1,y:1}),s.rotation(0),s.skewX(0),s.skewY(0)}resetSectionProjection(e=!0){for(let t of this.sections){this.resetContainerTransform(t.rootGroupBg),this.resetContainerTransform(t.liftGroupBg),e&&this.resetContainerTransform(t.liftGroupSeat),t.rootGroupBg.zIndex(t.bgZIndex),e&&t.liftGroupSeat.zIndex(t.seatZIndex);let s=this.labelLiftGroups.get(t.id);s&&e&&this.resetContainerTransform(s),t.perspectiveAffine=void 0,t.perspectiveCorrection=void 0,t.perspectiveDepth=void 0}}get seatAnchorContext(){return{seats:this.seats,seatById:this.seatById,seatR:this.seatR,perspectiveSeatProjected:this.perspectiveSeatProjected,perspectiveSeatScale:this.perspectiveSeatScale,perspectiveAppliedSeats:this.perspectiveAppliedSeats,circleById:this.circleById,accessRingById:this.accessRingById,accessGlyphById:this.accessGlyphById,boothLabelById:this.boothLabelById}}applyExactSeatAnchors(e,t){Fo(this.seatAnchorContext,e,t)}applyPerspective(e=!0){let t=this.perspectiveCamera,s=this.perspectiveBaseAffine,o=this.perspectiveBaseInverse;if(!t||!s||!o)return;let n=this.seats.length>2500&&this.sections.length>0;this.cached&&!n&&(this.seatLayer.clearCache(),this.seatLayer.listening(!0),this.cached=!1),this.resetLayerTransforms(e),this.resetSectionProjection(e);for(let a of[this.bgLayer,this.overlayLayer])this.setContainerAffine(a,s,t.target);this.perspectiveAppliedSeats.clear(),n||this.applyExactSeatAnchors(!0);for(let a of this.sections){let l=f=>this.sectionSurfaceHeight(a,f),c=bt(t,a.centroid,l),h=Qi(o,c);a.perspectiveAffine=c,a.perspectiveCorrection=h,a.perspectiveDepth=ue(t,a.centroid,l(a.centroid)).depth,this.setContainerAffine(a.liftGroupBg,h,a.centroid);for(let f=0;f<a.sideFaces.length;f++){let d=a.outline[f],m=a.outline[(f+1)%a.outline.length],y=this.perspectiveLocalPoint(ue(t,d,0)),p=this.perspectiveLocalPoint(ue(t,m,0)),u=this.perspectiveLocalPoint(ue(t,m,l(m))),b=this.perspectiveLocalPoint(ue(t,d,l(d)));a.sideFaces[f].points([y.x,y.y,p.x,p.y,u.x,u.y,b.x,b.y]),a.sideFaces[f].opacity(.9)}}let r=[...this.sections].sort((a,l)=>(l.perspectiveDepth??0)-(a.perspectiveDepth??0));for(let a of r)a.rootGroupBg.moveToTop(),a.liftGroupSeat.moveToTop();this.unsectionedSeatGroup?.moveToTop(),this.syncSeatOverlayPositions(),n||this.updateSeatGroupVisibility(),this.bgLayer.batchDraw(),this.seatLayer.batchDraw(),this.overlayLayer.batchDraw()}applyIso(){if(this.resetSectionProjection(),this.applyExactSeatAnchors(!1),this.isoT===0)this.resetLayerTransforms();else{let{th:t,sg:s}=this.isoParams(),o=Math.cos(t),n=s*Math.sin(t),r=-Math.sin(t),a=s*Math.cos(t),l=Math.sqrt(o*o+n*n),c=o*a-n*r,h=Math.atan2(n,o)*180/Math.PI,f=l,d=c/l,m=(o*r+n*a)/c,y=this.isoCentre;for(let p of[this.bgLayer,this.seatLayer,this.overlayLayer])p.position({x:y.x,y:y.y}),p.offset({x:y.x,y:y.y}),p.rotation(h),p.scaleX(f),p.scaleY(d),p.skewX(m),p.skewY(0)}this.applyUprightLabels(),this.applyElevation(),this.updateSeatGroupVisibility(),this.bgLayer.batchDraw(),this.seatLayer.batchDraw(),this.overlayLayer.batchDraw()}applyUprightLabels(){let e=It*this.isoT,t=1/(1-(1-qe)*this.isoT),s=this.hasBoothText?[this.bgLayer,this.seatLayer,this.overlayLayer]:[this.bgLayer,this.overlayLayer];for(let o of s){let n=o.find("Text");for(let r of n){let a=r.getAttr("uprightBase");a==null&&(a=r.rotation(),r.setAttr("uprightBase",a)),r.rotation(a-e),r.scaleX(1),r.scaleY(t),r.skewX(0)}}}applyElevation(){let e=this.isoT;for(let t of this.sections){if(t.liftWorld<=0)continue;let s=this.isoLiftLocal(t.liftWorld);t.liftGroupBg?.position(s),t.liftGroupSeat.position(s),this.labelLiftGroups.get(t.id)?.position(s);let o=.9*e;for(let n=0;n<t.sideFaces.length;n++){let r=t.sideFaces[n],a=t.outline[n],l=t.outline[(n+1)%t.outline.length];r.points([a.x,a.y,l.x,l.y,l.x+s.x,l.y+s.y,a.x+s.x,a.y+s.y]),r.opacity(o)}}this.syncSeatOverlayPositions()}destroy(){this.destroyed=!0,this.cancelAssetLoads(),this.rafId&&cancelAnimationFrame(this.rafId),this.isoRaf&&cancelAnimationFrame(this.isoRaf),this.glideRaf&&cancelAnimationFrame(this.glideRaf),this.viewChangeRaf&&cancelAnimationFrame(this.viewChangeRaf),this.recacheTimer&&clearTimeout(this.recacheTimer),this.resizeObs?.disconnect(),this.gestures.detach(),this.container.removeEventListener("keydown",this.onKeyDown),this.stage.destroy()}labelFont(){return this.exportMode?this.theme.fontFamily?.toLowerCase().includes("jetbrains")?"JetBrains Mono, monospace":"Inter, sans-serif":this.theme.fontFamily||"Inter, sans-serif"}seatContainer(e){return this.seatSection.get(e)?.liftGroupSeat??this.unsectionedSeatGroup??this.seatLayer}sectionMatchesFocus(e){let t=this.focusedSectionId;return t==null||e.id===t||e.logicalId===t||e.zone===t}focusedSeatOpacity(e,t){if(!this.focusedSectionId)return t;let s=this.seatSection.get(e);return t*(s&&this.sectionMatchesFocus(s)?1:Be)}sectionScreenBounds(e){if(this.viewMode==="perspective"&&e.perspectiveAffine){let r=this.stage.scaleX(),a=this.stage.x(),l=this.stage.y();return V(e.outline.map(c=>{let h=this.projectedSectionPoint(e,c);return{x:h.x*r+a,y:h.y*r+l}}))}let t=e.liftWorld>0?this.isoLiftLocal(e.liftWorld):{x:0,y:0},s=this.stage.scaleX(),o=this.stage.x(),n=this.stage.y();return V(e.outline.map(r=>{let a={x:r.x+t.x,y:r.y+t.y},l=this.isoT===0?a:this.isoForward(a);return{x:l.x*s+o,y:l.y*s+n}}))}updateSeatGroupVisibility(){let e=this.exportMode||this.effScale()>=ne,t=this.viewMode==="perspective"&&this.glideInProgress&&this.seats.length>2500,s=96,o=this.stage.width(),n=this.stage.height();for(let r of this.sections){let a=!0;if(e){let c=this.sectionScreenBounds(r);a=c.x+c.width>=-s&&c.y+c.height>=-s&&c.x<=o+s&&c.y<=n+s,a&&this.viewMode==="perspective"&&!t&&this.applyExactSeatAnchors(!0,r.memberIds)}r.liftGroupSeat.setViewportCulled(!a),this.labelLiftGroups.get(r.id)?.setViewportCulled(!a)}this.unsectionedSeatGroup&&!this.unsectionedSeatGroup.visible()&&this.unsectionedSeatGroup.visible(!0),e&&this.viewMode==="perspective"&&!t&&this.applyExactSeatAnchors(!0,this.seats.filter(r=>!this.seatSection.has(r.id)).map(r=>r.id))}visibleSeatCandidates(){if(!this.sections.length)return this.seats;let e=[];for(let t of this.sections)if(!t.liftGroupSeat.isViewportCulled())for(let s of t.memberIds){let o=this.seatById.get(s);o&&e.push(o)}for(let t of this.seats)this.seatSection.has(t.id)||e.push(t);return e}seatViewportCulled(e){return this.seatSection.get(e)?.liftGroupSeat.isViewportCulled()??!1}renderedSeatPoint(e){if(this.viewMode==="perspective")return this.perspectiveSeatLocal.get(e.id)??e;let t=this.seatSection.get(e.id);if(!t||t.liftWorld<=0||this.isoT===0)return e;let s=this.isoLiftLocal(t.liftWorld);return{x:e.x+s.x,y:e.y+s.y}}seatLabelContainer(e){let t=this.seatSection.get(e);if(!t)return this.labelGroup;let s=this.labelLiftGroups.get(t.id);return s||(s=new Qe({listening:!1}),s.setViewportCulled(t.liftGroupSeat.isViewportCulled()),s.position(this.viewMode==="perspective"?{x:0,y:0}:this.isoLiftLocal(t.liftWorld)),this.labelGroup.add(s),this.labelLiftGroups.set(t.id,s)),s}syncSeatOverlayPositions(){if(this.hoveredId){let e=this.seatById.get(this.hoveredId);if(e){this.hoverRing.position(this.renderedSeatPoint(e));let t=this.viewMode==="perspective"?this.perspectiveSeatScale.get(e.id)??1:1;this.hoverRing.scale({x:t,y:t})}}if(this.focusedId){let e=this.seatById.get(this.focusedId);if(e){this.focusRing.position(this.renderedSeatPoint(e));let t=this.viewMode==="perspective"?this.perspectiveSeatScale.get(e.id)??1:1;this.focusRing.scale({x:t,y:t})}}for(let[e,t]of this.selectionMarkers){let s=this.seatById.get(e);if(s){t.position(this.renderedSeatPoint(s));let o=this.viewMode==="perspective"?this.perspectiveSeatScale.get(s.id)??1:1;t.scale({x:o,y:o})}}}renderSeats(){let e=[...this.seats].sort((t,s)=>(this.perspectiveSeatDepth.get(s.id)??0)-(this.perspectiveSeatDepth.get(t.id)??0));for(let t of e){if(t.kind==="booth"){this.renderBoothUnit(t);continue}let s=this.seatContainer(t.id),o=zs({x:t.x,y:t.y,radius:this.seatR,detail:this.seatGlyphDetail,glyph:ts(t.glyph,this.catByKey.get(t.categoryKey)),wheelchairBay:t.wheelchairSpaceType==="no-seat"});if(o instanceof Ze&&this.glyphMarkers.push(o),o.setAttr("seatId",t.id),this.circleById.set(t.id,o),this.paintSeat(o,t.id),s.add(o),t.accessible){if(t.wheelchairSpaceType!=="no-seat"){let n=new Le({x:t.x,y:t.y,radius:this.seatR+1.5,stroke:$t(t.accessibility),strokeWidth:2.5,listening:!1,perfectDrawEnabled:!1,shadowForStrokeEnabled:!1});this.accessRingById.set(t.id,n),s.add(n)}if(t.accessibility?.includes("wheelchair")&&Zt(t.accessibility)){let n=this.buildAccessGlyph(t,typeof o.fill()=="string"?o.fill():"");this.accessGlyphById.set(t.id,n),s.add(n)}}}}renderBoothUnit(e){let t=this.seatContainer(e.id),s=this.boothDims.get(e.rowId)??{width:40,height:30,rotation:0},o=e.x,n=e.y,r;s.points&&s.points.length>=3?(r=new st({x:e.x,y:e.y,points:s.points.flatMap(l=>[l.x,l.y]),closed:!0,perfectDrawEnabled:!1,shadowForStrokeEnabled:!1,hitStrokeWidth:0}),o=e.x+s.points.reduce((l,c)=>l+c.x,0)/s.points.length,n=e.y+s.points.reduce((l,c)=>l+c.y,0)/s.points.length):r=new it({x:e.x,y:e.y,width:s.width,height:s.height,offsetX:s.width/2,offsetY:s.height/2,rotation:s.rotation,cornerRadius:4,perfectDrawEnabled:!1,shadowForStrokeEnabled:!1,hitStrokeWidth:0}),r.setAttr("seatId",e.id),this.circleById.set(e.id,r),t.add(r);let a=new Te({x:o,y:n,text:e.displayLabel??e.label,fontSize:Pe,fontStyle:"600",fontFamily:this.labelFont(),fill:this.theme.seatLabelColor??Dt,listening:!1,perfectDrawEnabled:!1});a.offsetX(a.width()/2),a.offsetY(a.height()/2),a.visible(!1),this.hasBoothText=!0,this.boothLabelById.set(e.id,a),t.add(a),this.paintSeat(r,e.id)}buildAccessGlyph(e,t){let s=this.seatR*1.5/oe;return new er({x:e.x,y:e.y,data:Zt(e.accessibility??[])??"",offsetX:oe/2,offsetY:oe/2,scaleX:s,scaleY:s,fill:Qt(t),listening:!1,visible:!1,perfectDrawEnabled:!1,shadowForStrokeEnabled:!1})}updateAccessGlyphs(e){if(this.accessGlyphById.size)for(let[t,s]of this.accessGlyphById){let o=this.viewMode==="perspective"?this.perspectiveSeatScale.get(t)??1:1,n=this.seatR*1.5/oe*o,a=this.accessGlyphFilterEmphasized(t)?xs:Ps,l=Math.max(n,a/(oe*Math.max(e,.001)));s.scale({x:l,y:l}),s.visible(this.accessGlyphShouldShow(t))}}accessGlyphFilterEmphasized(e){let t=this.seatById.get(e),s=this.accessFilter;return!!t&&s!==null&&!!t.accessibility?.includes("wheelchair")&&(s.length===0||s.includes("wheelchair"))&&fi(t,s)}accessGlyphShouldShow(e){return this.accessGlyphById.has(e)&&this.accessGlyphEligible(e)}accessGlyphEligible(e){let t=this.statusById.get(e)??"free";return!(t==="booked"||t==="held"&&!this.ownedHold.has(e)&&!this.opts.manageMode)}categoryDisplayColor(e){return this.colorblind?this.cbHueByKey.get(e)??Et[0]:this.catColor.get(e)??"#6e7bff"}seatLabelScale(e){return(e.labelStyle?.size??18)/18}seatPreferredLabelInk(e){return e.labelStyle?.color??this.theme.seatLabelColor??Dt}seatLabelInk(e,t){let s=t.fill();return q(typeof s=="string"?s:"",this.seatPreferredLabelInk(e),mt)}paintSeat(e,t){let s=this.seatById.get(t),o=this.statusById.get(t)??"free",n=this.selection.has(t),r=this.categoryDisplayColor(s.categoryKey),a=this.boothLabelById.get(t);switch(e.dash([]),e.strokeWidth(0),e.stroke(""),e.opacity(1),o){case"free":e.fill(n&&this.effSelection===je?fe(r,.28):r);break;case"held":this.ownedHold.has(t)?(e.fill(fe(r,this.effSelection===je?.24:.1)),e.stroke(this.effSelection),e.strokeWidth(3)):e.fill(Ws);break;case"booked":this.colorblind?(e.fill("rgba(0,0,0,0)"),e.stroke(Rt),e.strokeWidth(1.5),e.opacity(.9)):(e.fill(Rt),e.opacity(.45));break;case"not_for_sale":e.fill(Rt),e.stroke(Ks),e.strokeWidth(1),e.dash([2,2]);break}if(s.wheelchairSpaceType==="no-seat"&&o==="free"&&(e.stroke($t(s.accessibility)),e.strokeWidth(n?3:2),e.dash([3,2])),a&&(a.text(o==="booked"?"SOLD":o==="held"?"HELD":s.label),a.fontSize(o==="free"?10:Math.min(10,Math.max(6,this.boothDims.get(s.rowId)?.width??40)/6)),a.fontStyle(o==="free"?"600":"800"),a.fill(o==="free"?this.theme.seatLabelColor??Dt:"#ffffff"),a.offsetX(a.width()/2),a.offsetY(a.height()/2)),this.accessFilter&&o==="free"&&!n&&!fi(s,this.accessFilter)&&e.opacity(.25),this.categoryHighlight&&o==="free"&&!n&&s.categoryKey!==this.categoryHighlight&&e.opacity(.25),this.categoryFilter&&o==="free"&&!n&&!this.categoryFilter.has(s.categoryKey)&&e.opacity(.22),this.commercialLimitedFilter&&o==="free"&&!n&&(s.commercial?.restrictedView||s.commercial?.obstructedView)&&e.opacity(.22),this.dimmedSections.size){let h=this.seatSection.get(t);(!h&&this.dimmedSections.has(Wi)||h&&(this.dimmedSections.has(h.id)||this.dimmedSections.has(h.logicalId)||h.zone!=null&&this.dimmedSections.has(h.zone)))&&e.opacity(.18)}this.closedSections.size&&this.seatInClosedSection(t)&&(e.fill(Xs),e.stroke(""),e.strokeWidth(0),e.dash([]),e.opacity($s)),this.selectionFocusId&&t!==this.selectionFocusId&&e.opacity(Math.min(e.opacity(),.16));let l=this.boothLabelById.get(t)??this.seatLabelById.get(t);l&&(l.fill(this.seatLabelInk(s,e)),l.visible(pe(l.fontSize(),this.effScale())&&e.opacity()>=.5));let c=this.accessGlyphById.get(t);if(c){let h=e.fill();c.fill(Qt(typeof h=="string"?h:"")),c.opacity(e.opacity()),c.visible(this.accessGlyphShouldShow(t))}this.accessRingById.get(t)?.opacity(e.opacity())}seatInClosedSection(e){if(!this.closedSections.size)return!1;let t=this.seatSection.get(e);return!!t&&(this.closedSections.has(t.id)||this.closedSections.has(t.logicalId)||t.zone!=null&&this.closedSections.has(t.zone))}setColorblindSafe(e){if(e!==this.colorblind){this.colorblind=e;for(let t of this.seats){let s=this.circleById.get(t.id);s&&this.paintSeat(s,t.id)}this.updateLabels(),this.cached?(this.seatLayer.clearCache(),this.cacheSeatLayer()):this.seatLayer.batchDraw()}}setDimmedSections(e){let t=new Set(e??[]);if(!(t.size===this.dimmedSections.size&&[...t].every(s=>this.dimmedSections.has(s)))){this.dimmedSections=t;for(let s of this.seats){let o=this.circleById.get(s.id);o&&this.paintSeat(o,s.id)}this.cached?(this.seatLayer.clearCache(),this.cacheSeatLayer()):this.seatLayer.batchDraw()}}setClosedSections(e){let t=new Set(e??[]);t.size===this.closedSections.size&&[...t].every(s=>this.closedSections.has(s))||(this.closedSections=t,this.repaintSectionsAndSeats())}focusSection(e){this.sections.some(t=>t.id===e||t.logicalId===e)&&(this.focusedSectionId=e,this.drawFocusBackdrop(e),this.bgLayer.batchDraw(),this.overlayLayer.batchDraw(),this.updateLOD(),this.focusRegion(e))}releaseSectionFocusDim(){!this.focusBackdrop&&!this.focusDimOverlay||(this.focusBackdrop?.destroy(),this.focusBackdrop=null,this.focusDimOverlay?.destroy(),this.focusDimOverlay=null,this.bgLayer.batchDraw(),this.overlayLayer.batchDraw())}clearSectionFocus(){this.focusedSectionId&&(this.focusedSectionId=null,this.focusBackdrop&&(this.focusBackdrop.destroy(),this.focusBackdrop=null),this.focusDimOverlay?.destroy(),this.focusDimOverlay=null,this.bgLayer.batchDraw(),this.overlayLayer.batchDraw(),this.updateLOD())}getFocusedSection(){return this.focusedSectionId}drawFocusBackdrop(e){this.focusBackdrop&&(this.focusBackdrop.destroy(),this.focusBackdrop=null);let t=this.sections.filter(o=>o.id===e||o.logicalId===e);if(!t.length)return;let s=new ke({listening:!1});for(let o of t){let n=this.viewMode==="perspective"&&o.perspectiveAffine,r=n?o.outline.map(l=>this.perspectiveLocalPoint(this.projectedSectionPoint(o,l))):o.outline,a=n?o.holes.map(l=>l.map(c=>this.perspectiveLocalPoint(this.projectedSectionPoint(o,c)))):o.holes;s.add(_e(r,a,{fill:Ys,stroke:se("#ffffff",.1),strokeWidth:1,listening:!1},n?void 0:o.outlinePath))}this.bgLayer.add(s),s.moveToTop(),this.focusBackdrop=s,this.drawFocusDimOverlay(t)}drawFocusDimOverlay(e){this.focusDimOverlay?.destroy();let s=Math.max(this.bounds.width,this.bounds.height,1)*4+1e3,o=[{x:this.bounds.x-s,y:this.bounds.y-s},{x:this.bounds.x+this.bounds.width+s,y:this.bounds.y-s},{x:this.bounds.x+this.bounds.width+s,y:this.bounds.y+this.bounds.height+s},{x:this.bounds.x-s,y:this.bounds.y+this.bounds.height+s}],n=new ir({fill:this.canvasBackground,opacity:1-Be,listening:!1,perfectDrawEnabled:!1,sceneFunc:(r,a)=>{let l=c=>{if(c.length){r.moveTo(c[0].x,c[0].y);for(let h=1;h<c.length;h++)r.lineTo(c[h].x,c[h].y);r.closePath()}};r.beginPath(),l(o);for(let c of e){let h=this.viewMode==="perspective"&&c.perspectiveAffine?c.outline.map(f=>this.perspectiveLocalPoint(this.projectedSectionPoint(c,f))):c.outline.map(f=>{let d=c.liftWorld>0?this.isoLiftLocal(c.liftWorld):{x:0,y:0};return{x:f.x+d.x,y:f.y+d.y}});l(We(h)>0?[...h].reverse():h)}r.fillStrokeShape(a)}});this.overlayLayer.add(n),n.moveToTop();for(let r of this.selectionMarkers.values())r.moveToTop();this.hoverRing.moveToTop(),this.focusRing.moveToTop(),this.focusDimOverlay=n}repaintSectionsAndSeats(){for(let e of this.seats){let t=this.circleById.get(e.id);t&&this.paintSeat(t,e.id)}for(let e of this.sections)e.blockPoly.fill(this.sectionBlockFill(e));this.cached?(this.seatLayer.clearCache(),this.cacheSeatLayer()):this.seatLayer.batchDraw(),this.bgLayer.batchDraw()}getVisibleWorldRect(){let e=this.screenToWorld({x:0,y:0}),t=this.screenToWorld({x:this.stage.width(),y:this.stage.height()});return{x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),width:Math.abs(t.x-e.x),height:Math.abs(t.y-e.y)}}getWorldBounds(){let e=1/0,t=1/0,s=-1/0,o=-1/0,n=(r,a)=>{r<e&&(e=r),a<t&&(t=a),r>s&&(s=r),a>o&&(o=a)};for(let r of this.seats)n(r.x,r.y);for(let r of this.sections)for(let a of r.outline)n(a.x,a.y);for(let r of this.gaById.values())for(let a of r.points)n(a.x,a.y);return Number.isFinite(e)?{x:e,y:t,width:Math.max(1,s-e),height:Math.max(1,o-t)}:{x:0,y:0,width:1,height:1}}getMinimapSnapshot(){let e=this.sections.map(t=>{let s=this.isSectionClosed(t)||t.free<=0,o=t.memberIds.some(r=>this.selection.has(r)),n=this.focusedSectionId===t.id||this.focusedSectionId===t.logicalId;return{id:t.logicalId,label:t.label,outline:t.outline.map(r=>({...r})),...this.objectFloor.get(t.id)?{floorId:this.objectFloor.get(t.id)}:{},state:o?"selected":s?"inactive":"available",active:n}});return{sections:e,seats:e.length?[]:this.seats.map(t=>({x:t.x,y:t.y,categoryKey:t.categoryKey,state:this.selection.has(t.id)?"selected":this.statusById.get(t.id)==="free"?"available":"inactive"}))}}panToWorld(e){this.cancelGlide();let t=this.worldToScreen(e);this.stage.position({x:this.stage.x()+this.stage.width()/2-t.x,y:this.stage.y()+this.stage.height()/2-t.y}),this.afterViewChange(),this.stage.batchDraw()}setCategoryHighlight(e){if(this.categoryHighlight!==e){this.categoryHighlight=e;for(let t of this.seats){let s=this.circleById.get(t.id);s&&this.paintSeat(s,t.id)}this.updateLabels(),this.cached?(this.seatLayer.clearCache(),this.cacheSeatLayer()):this.seatLayer.batchDraw(),this.applyGAFilterState()}}renderBackground(e){let t=xe(e);t&&this.renderBackgroundImage(t);for(let s of e.objects)s.type==="decorImage"&&this.renderDecorImage(s);for(let s of e.objects)s.type==="section"&&this.renderSection(s);this.renderZones(e);for(let s of e.objects)s.type==="shape"?this.renderShape(s):s.type==="gaArea"?this.renderGA(s):s.type==="table"?this.renderTable(s):s.type==="text"&&this.renderText(s)}trackAssetImage(e,t,s,o){let n=this.assetGeneration;/^https?:\/\//i.test(t)&&(e.crossOrigin="anonymous");let r=new Promise(a=>{let l=!1,c=()=>{l||(l=!0,this.assetCancels.delete(h),a())},h=()=>{e.onload=null,e.onerror=null;try{e.removeAttribute("src"),e.src=""}catch{}c()};this.assetCancels.add(h),e.onload=()=>{if(!this.exportMode){n===this.assetGeneration&&o(),c();return}(typeof e.decode=="function"?e.decode():Promise.resolve()).then(()=>{n===this.assetGeneration&&o()}).catch(()=>{n===this.assetGeneration&&this.assetErrors.push(`${s} could not be decoded.`)}).finally(c)},e.onerror=()=>{n===this.assetGeneration&&this.assetErrors.push(`${s} could not be loaded.`),c()},e.src=t});this.assetPromises.push(r)}cancelAssetLoads(){this.assetGeneration++;for(let e of[...this.assetCancels])e();this.assetCancels.clear(),this.assetPromises=[],this.assetErrors=[]}renderBackgroundImage(e){if(!e.url||e.visible===!1)return;let t=new window.Image;this.trackAssetImage(t,e.url,"Buyer background image",()=>{let s=t.naturalWidth||4,o=t.naturalHeight||3,n=e.crop??{x:0,y:0,width:1,height:1},r=Math.max(0,Math.min(.99,n.x)),a=Math.max(0,Math.min(.99,n.y)),l={x:r,y:a,width:Math.max(.01,Math.min(1-r,n.width)),height:Math.max(.01,Math.min(1-a,n.height))},c=e.width,h=c*(o*l.height/(s*l.width)),f=new tr({image:t,x:e.center.x,y:e.center.y,offsetX:c/2,offsetY:h/2,width:c,height:h,rotation:e.rotation??0,crop:{x:l.x*s,y:l.y*o,width:l.width*s,height:l.height*o},opacity:e.opacity,listening:!1});this.bgLayer.add(f),f.moveToBottom(),this.bgLayer.batchDraw()})}get objectDrawContext(){return{bgLayer:this.bgLayer,fgDecorGroup:this.fgDecorGroup,container:this.container,opts:this.opts,theme:this.theme,canvasBackground:this.canvasBackground,catColor:this.catColor,sections:this.sections,freeTextById:this.freeTextById,gaById:this.gaById,iconNodeById:this.iconNodeById,primaryFocalLabels:this.primaryFocalLabels,labelFont:()=>this.labelFont(),trackAssetImage:(e,t,s,o)=>this.trackAssetImage(e,t,s,o),isGhostClick:e=>this.isGhostClick(e)}}renderDecorImage(e){po(this.objectDrawContext,e)}renderTable(e){uo(this.objectDrawContext,e)}renderText(e){fo(this.objectDrawContext,e)}renderShape(e){yo(this.objectDrawContext,e)}renderGA(e){mo(this.objectDrawContext,e)}renderSection(e){let t=ct(e.outline,e.holes),s=ae(this.canvasBackground),o=[],n=new Map,r=0,a=V(e.outline),l=this.seatIndex?gt(this.seatIndex,a).map(C=>this.seatById.get(C)).filter(C=>!!C):this.seats;for(let C of l)this.seatSection.has(C.id)||J(C,e.outline,e.holes)&&(o.push(C.id),n.set(C.categoryKey,(n.get(C.categoryKey)??0)+1),(this.statusById.get(C.id)??"free")==="free"&&r++);let c=e.color??Ut([...n].map(([C,R])=>({hex:this.catColor.get(C)??"#6e7bff",w:R})),"#3a4358"),h=_i(e.elevation),f=lt(e,{floorBaseHeightM:this.floorBaseHeightMFor(e.id)}),d=f.height*Me,m=new ke({listening:!1});this.bgLayer.add(m);let y=new ke({listening:!1});m.add(y);let p=new Qe({listening:!0});this.seatLayer.add(p);let u=[];if(d>0){let C=he(this.zoneColor.get(e.zone??"")??c,.42);for(let R=0;R<e.outline.length;R++){let B=new st({points:[],closed:!0,fill:C,stroke:se("#000000",.25),strokeWidth:1,opacity:0,listening:!1,perfectDrawEnabled:!1});u.push(B),m.add(B)}}y.moveToTop();let b=y,g=e.color??this.zoneColor.get(e.zone??"")??"#3a4358",w=_e(e.outline,e.holes,{stroke:se(g,.5),strokeWidth:1,fill:se(g,.08),listening:!1},e.outlinePath);b.add(w);let k=_e(e.outline,e.holes,{fill:s.sectionFill,stroke:s.sectionStroke,strokeWidth:Mt,opacity:0,listening:!1},e.outlinePath);b.add(k);let L=e.labelPresentation?.labelStyle,S=L?.color??s.sectionInk,v=(L?.size??18)/18,x=new Te({x:e.labelPresentation?.position?.x??t.x,y:e.labelPresentation?.position?.y??t.y,text:e.displayLabel??e.label,rotation:e.labelPresentation?.rotation??0,visible:e.labelPresentation?.visible!==!1,fontSize:18*v,fontStyle:ai,fontFamily:this.labelFont(),fill:q(s.sectionFill,S),listening:!1,perfectDrawEnabled:!1});x.offsetX(x.width()/2),x.offsetY(x.height()/2),b.add(x);let I=new Te({x:t.x,y:t.y,text:U("map.seatsLeft",{count:r}),fontSize:12,fontStyle:li,fontFamily:"JetBrains Mono, ui-monospace, monospace",fill:s.sectionInk,opacity:0,listening:!1,perfectDrawEnabled:!1});I.offsetX(I.width()/2),b.add(I);let T={id:e.id,logicalId:e.logicalSectionId??e.id,label:e.displayLabel??e.label,outline:e.outline,...e.outlinePath?{outlinePath:e.outlinePath}:{},holes:e.holes??[],centroid:t,labelAnchors:qs(e.outline,e.holes??[],t),memberCategoryKeys:new Set(o.map(C=>this.seatById.get(C)?.categoryKey).filter(Boolean)),labelArea:Fi(e.outline,e.holes),zone:e.zone,memberIds:o,total:o.length,free:r,baseFill:c,outlineTint:g,outlinePoly:w,blockPoly:k,nameLabel:x,subLabel:I,preferredInk:S,labelScale:v,nameLabelFits:!1,subLabelFits:!0,elevation:h,liftWorld:d,rakeDeg:f.rake,surfaceFocal:o.length?{...this.seatById.get(o[0])?.focalPoint??this.isoCentre}:{...this.chartDoc?.focalPoint??this.isoCentre},frontDistanceWorld:0,rootGroupBg:m,bgZIndex:m.zIndex(),seatZIndex:p.zIndex(),liftGroupBg:y,liftGroupSeat:p,sideFaces:u},P=o.map(C=>this.seatById.get(C)).filter(C=>!!C),M=P.length?P:e.outline;T.frontDistanceWorld=Math.min(...M.map(C=>Math.hypot(C.x-T.surfaceFocal.x,C.y-T.surfaceFocal.y)));for(let C of o)this.seatSection.set(C,T);this.refreshSectionFill(T),this.refreshSectionHeat(T),this.sections.push(T)}refreshSectionHeat(e){So(this.sectionLodPaintContext,e)}refreshSectionFill(e){vo(this.sectionLodPaintContext,e)}isSectionClosed(e){return Si(this.sectionLodPaintContext,e)}sectionAvailabilityState(e){return vi(this.sectionLodPaintContext,e)}sectionBlockFill(e){return Fe(ae(this.canvasBackground),this.sectionAvailabilityState(e))}get sectionLodPaintContext(){return{sections:this.sections,zones:this.zones,sectionHeat:this.sectionHeat,closedSections:this.closedSections,canvasBackground:this.canvasBackground,bgLayer:this.bgLayer,seatLayer:this.seatLayer,stageScaleX:this.stage.scaleX(),stageWidth:this.stage.width(),floorOverview:this.floorOverview,focusedSectionId:this.focusedSectionId,categoryFilter:this.categoryFilter,hasFocusDimOverlay:!!this.focusDimOverlay,viewMode:this.viewMode,glideInProgress:this.glideInProgress,reducedMotion:this.reducedMotion,isoT:this.isoT,seatCount:this.seats.length,lodScale:this.lodScale,setLodScale:e=>{this.lodScale=e},worldToScreen:e=>this.worldToScreen(e)}}renderZones(e){if(!e.zones?.length||!this.sections.length)return;let t=new Map;for(let s of this.sections)s.zone&&(t.get(s.zone)??t.set(s.zone,[]).get(s.zone)).push(s);for(let s of e.zones){let o=t.get(s.id);if(!o||!o.length)continue;let n=o[0];for(let d of o)d.centroid.y<n.centroid.y&&(n=d);let r=n.centroid.x,a=n.centroid.y,l=1/0;for(let d of o)for(let m of d.memberIds){let y=this.seatById.get(m),p=y&&this.catPrice.get(y.categoryKey);typeof p=="number"&&p<l&&(l=p)}let c=new it({x:r,y:a,width:1,height:1,offsetX:.5,offsetY:.5,cornerRadius:1,fill:pi,stroke:s.color??n.outlineTint,strokeWidth:1,opacity:0,listening:!1,perfectDrawEnabled:!1});this.bgLayer.add(c);let h=new Te({x:r,y:a,text:s.label.toUpperCase(),fontSize:Pt,fontStyle:ai,letterSpacing:.5,fontFamily:this.labelFont(),fill:"#f4f6fb",opacity:0,listening:!1,perfectDrawEnabled:!1});h.offsetX(h.width()/2),h.offsetY(h.height()/2),this.bgLayer.add(h);let f=null;isFinite(l)&&(f=new Te({x:r,y:a,text:U("map.fromPrice",{price:ii(l,this.currency)}),fontSize:xt,fontStyle:li,fontFamily:"JetBrains Mono, ui-monospace, monospace",fill:"#cbd5e1",opacity:0,listening:!1,perfectDrawEnabled:!1}),f.offsetX(f.width()/2),this.bgLayer.add(f)),this.zones.push({id:s.id,anchor:{x:r,y:a},back:c,background:pi,label:h,sub:f})}}screenToWorld(e){let t=this.stage.scaleX(),s={x:(e.x-this.stage.x())/t,y:(e.y-this.stage.y())/t};return this.viewMode==="perspective"&&this.perspectiveBaseInverse?te(this.perspectiveBaseInverse,s):this.isoT===0?s:this.isoInverse(s)}sectionAt(e){if(!this.sections.length)return null;let t=this.screenToWorld(e),s=this.sections.find(o=>{if(this.viewMode==="perspective"&&o.perspectiveAffine)return J(t,o.outline.map(r=>this.perspectiveLocalPoint(this.projectedSectionPoint(o,r))),o.holes.map(r=>r.map(a=>this.perspectiveLocalPoint(this.projectedSectionPoint(o,a)))));let n=o.liftWorld>0?this.isoLiftLocal(o.liftWorld):{x:0,y:0};return J({x:t.x-n.x,y:t.y-n.y},o.outline,o.holes)});return s?s.logicalId:null}sectionMembers(e){return[...new Set(this.sections.filter(t=>t.id===e||t.logicalId===e||t.zone===e).flatMap(t=>t.memberIds))]}isSelectable(e){return this.seatInClosedSection(e)?!1:(this.opts.selectableStatuses??["free"]).includes(this.statusById.get(e)??"free")}toggleSeat(e){if(this.selection.has(e)){this.setSelected(e,!1);let t=this.seatById.get(e);t&&this.opts.onDeselect?.(t)}else{if(!this.isSelectable(e))return;if(this.selection.size>=this.opts.maxSelection){this.opts.onSelectionLimit?.(this.opts.maxSelection);return}this.setSelected(e,!0);let t=this.seatById.get(e);t&&this.opts.onSelect?.(t)}this.overlayLayer.batchDraw()}resolveCanvasBackground(){let e=this.theme.background?qt(this.theme.background):null;if(e)return e;if(typeof getComputedStyle=="function"){let t=this.container;for(;t;){let s=qt(getComputedStyle(t).backgroundColor);if(s)return s;t=t.parentElement}}return yi}resolveSelectionColor(){return this.theme.selectionColor?this.theme.selectionColor:Ve(this.canvasBackground)?ro:je}setSelected(e,t,s=!1){let o=this.circleById.get(e);t?this.selection.add(e):(this.selectionFocusId===e&&this.setSelectionFocus(null),this.selection.delete(e)),this.syncSelectionMarker(e),o&&(this.paintSeat(o,e),!s&&!this.cached&&this.seatLayer.batchDraw())}syncSelectionMarker(e){if(this.selectionMarkers.get(e)?.destroy(),this.selectionMarkers.delete(e),!this.selection.has(e)&&!this.ownedHold.has(e))return;let t=this.seatById.get(e);if(!t)return;let s=this.selectionFocusId===e,o=this.boothDims.get(t.rowId),n=this.renderedSeatPoint(t),r=new ke({name:"selection-ring",x:n.x,y:n.y,rotation:o?.rotation??0,listening:!1,perfectDrawEnabled:!1,opacity:this.selectionFocusId&&!s?.2:1});if(this.viewMode==="perspective"){let l=this.perspectiveSeatScale.get(e)??1;r.scale({x:l,y:l})}r.setAttr("seatId",e);let a={stroke:this.effSelection,listening:!1,perfectDrawEnabled:!1,shadowForStrokeEnabled:!1};if(o)if(r.add(new it({...a,width:o.width,height:o.height,offsetX:o.width/2,offsetY:o.height/2,cornerRadius:4,strokeWidth:s?4:3})),s)r.add(new it({...a,width:o.width+10,height:o.height+10,offsetX:(o.width+10)/2,offsetY:(o.height+10)/2,cornerRadius:7,strokeWidth:2,opacity:.55}));else{let l=Math.max(0,o.width/2-14),c=-Math.max(0,o.height/2-14);r.add(new Le({x:l,y:c,radius:10,fill:this.effSelection,listening:!1})),r.add(new st({x:l,y:c,points:[-4.5,0,-1,3.5,5.5,-4.5],stroke:Ve(this.effSelection)?"#0b1220":"#ffffff",strokeWidth:2.4,lineCap:"round",lineJoin:"round",listening:!1}))}else r.add(new Le({...a,radius:Math.max(1,this.seatR-1.25),strokeWidth:Math.min(2.5,Math.max(1.8,this.seatR*.22))})),s?r.add(new Le({...a,radius:this.seatR+2,strokeWidth:2,opacity:.55})):r.add(new st({points:[-this.seatR*.52,0,-this.seatR*.12,this.seatR*.4,this.seatR*.6,-this.seatR*.46],stroke:"#ffffff",strokeWidth:Math.max(2.6,this.seatR*.34),lineCap:"round",lineJoin:"round",shadowColor:"#0b1220",shadowBlur:1.5,shadowOpacity:.55,listening:!1}));this.selectionMarkers.set(e,r),this.overlayLayer.add(r)}sectionBounds(e){let t=this.sections.filter(y=>y.id===e||y.logicalId===e),s=t.map(y=>{if(this.viewMode==="perspective"&&y.perspectiveAffine)return V(y.outline.map(b=>this.projectedSectionPoint(y,b)));let p=y.liftWorld>0?this.isoLiftLocal(y.liftWorld):{x:0,y:0},u=y.outline.map(b=>{let g={x:b.x+p.x,y:b.y+p.y};return this.isoT===0?g:this.isoForward(g)});return V(u)});if(!s.length)return null;let o=Math.min(...s.map(y=>y.x)),n=Math.min(...s.map(y=>y.y)),r=Math.max(...s.map(y=>y.x+y.width)),a=Math.max(...s.map(y=>y.y+y.height)),l=new Set(t.flatMap(y=>y.memberIds));for(let y of l){let p=this.seatById.get(y);if(!p)continue;let u=this.renderedSeatPoint(p);o=Math.min(o,u.x-this.seatR),n=Math.min(n,u.y-this.seatR),r=Math.max(r,u.x+this.seatR),a=Math.max(a,u.y+this.seatR)}let c=y=>{[y.x,y.y,y.width,y.height].every(Number.isFinite)&&(o=Math.min(o,y.x),n=Math.min(n,y.y),r=Math.max(r,y.x+y.width),a=Math.max(a,y.y+y.height))},h=y=>{let p={x:y.x+y.width/2,y:y.y+y.height/2};return t.some(u=>J(p,u.outline,u.holes))};for(let{node:y,backdrop:p}of this.freeTextById.values()){let u=y.getClientRect({relativeTo:this.bgLayer,skipShadow:!0});h(u)&&(c(u),p&&c(p.getClientRect({relativeTo:this.bgLayer,skipShadow:!0})))}for(let{node:y}of this.iconNodeById.values()){let p=y.getClientRect({relativeTo:this.bgLayer,skipShadow:!0});h(p)&&c(p)}let f=new De;for(let{node:y}of this.freeTextById.values()){let p=y.getClientRect({relativeTo:this.bgLayer,skipShadow:!0,skipStroke:!0});f.insert({x:p.x-Z,y:p.y-Z,width:p.width+Z*2,height:p.height+Z*2})}for(let y of this.rowLabelPlan){let p=(y.focusKeys??[]).some(w=>w===e||t.some(k=>w===k.id||w===k.logicalId)),u=new Te({text:y.text,fontSize:y.fontSize,fontStyle:"700",fontFamily:this.labelFont(),rotation:y.rotation,listening:!1});u.offsetX(u.width()/2),u.offsetY(u.height()/2);let b=this.resolveAutomaticRowLabelPosition(u,y,f),g=this.rowLabelBox(u,b);p&&c(g),f.insert(g),u.destroy()}let d=Math.max(r-o,a-n),m=Math.max(this.seatR*2,Math.min(24,d*.025));return{x:o-m,y:n-m,width:Math.max(1,r-o+m*2),height:Math.max(1,a-n+m*2)}}sectionFrameScale(e){let t=this.sectionBounds(e);return t?ys(this.stage,t,this.zoomBounds()):this.stage.scaleX()}handleSeatTap(e){if((this.stacked||this.floorOverview)&&this.opts.onDeckTap){let t=this.objectFloor.get(this.seatById.get(e)?.rowId??"");if(t){this.opts.onDeckTap(t);return}}if(this.effScale()<re&&this.sections.length){let t=this.seatSection.get(e);if(t){let s=this.focusedSectionId===t.logicalId,o=this.sectionFrameScale(t.logicalId)>this.stage.scaleX()*1.02;if(!s&&o){this.opts.onSectionTap?this.opts.onSectionTap(t.logicalId):this.focusSection(t.logicalId);return}}}this.toggleSeat(e)}nearestSeatToScreen(e,t){let s=null,o=1/0,n=this.stage.scaleX()||1;for(let r of this.seats){if(!this.selection.has(r.id)&&!this.isSelectable(r.id))continue;let a=this.worldToScreen(r),l=this.viewMode==="perspective"?this.perspectiveSeatScale.get(r.id)??1:1,c=this.seatR*n*l+t,h=Math.hypot(a.x-e.x,a.y-e.y);h<=c&&h<o&&(o=h,s=r.id)}return s}wireInteraction(){this.seatLayer.on("click tap",e=>{if(this.moved>we||this.isGhostClick(e))return;let t=ki(e.target);t&&this.handleSeatTap(t)}),this.seatLayer.on("mouseover",e=>{let t=ki(e.target);if(!t)return;let s=this.seatById.get(t);if(!s)return;this.hoveredId=t,this.hoverRing.position(this.renderedSeatPoint(s));let o=this.viewMode==="perspective"?this.perspectiveSeatScale.get(t)??1:1;this.hoverRing.scale({x:o,y:o}),this.hoverRing.visible(!0),this.overlayLayer.batchDraw(),this.container.style.cursor="pointer",this.opts.onHover?.(s)}),this.seatLayer.on("mouseout",()=>{this.hoveredId=null,this.hoverRing.visible(!1),this.overlayLayer.batchDraw(),this.container.style.cursor="default",this.opts.onHover?.(null)}),this.stage.on("wheel",e=>{e.evt.preventDefault(),this.releaseSectionFocusDim();let t=this.container.getBoundingClientRect(),s={x:e.evt.clientX-t.left,y:e.evt.clientY-t.top},o=Math.exp(-e.evt.deltaY*.002);this.zoomAbout(this.stage.scaleX()*O(o,.5,2),s)}),this.stage.on("click tap",e=>{if(this.moved>we||this.isGhostClick(e))return;let t=this.stage.getPointerPosition();if(!t)return;if(!this.cached){if(ki(e.target))return;let o=this.nearestSeatToScreen(t,Tt);o&&this.handleSeatTap(o);return}if((this.stacked||this.floorOverview)&&this.opts.onDeckTap){let o=this.floorOverview?this.sectionAt(t):null,n=(o?this.objectFloor.get(o):null)??this.deckFloorAt();if(n){this.opts.onDeckTap(n);return}}if(this.sections.length){let o=this.sectionAt(t);if(o){this.opts.onSectionTap?this.opts.onSectionTap(o):this.focusRegion(o);return}}let s=Math.max(ve*1.2,this.stage.scaleX()*2.5);this.zoomAbout(s,t)})}deckFloorAt(){if(!this.objectFloor.size)return null;let e=this.stage.getPointerPosition();if(!e)return null;let t=this.screenToWorld(e),s=null,o=1/0;for(let n of this.seats){let r=this.renderedSeatPoint(n),a=r.x-t.x,l=r.y-t.y,c=a*a+l*l;c<o&&(o=c,s=n.rowId)}return s?this.objectFloor.get(s)??null:null}zoomBounds(){let e=.5*this.fitScale;return this.zones.length&&(e=Math.min(e,Ae*.9)),{min:e,max:Math.max(10*this.fitScale,4)}}zoomAbout(e,t){ms(this.stage,e,t,this.zoomBounds())&&(this.afterViewChange(),this.stage.batchDraw())}zoomToBounds(e,t){gs(this.stage,e,this.zoomBounds(),t),this.afterViewChange(),this.stage.batchDraw()}focusRegion(e,t){let s=typeof e=="string"?this.sectionBounds(e):e;if(!s)return;if(this.cancelGlide(),t?.animate===!1||this.reducedMotion){this.zoomToBounds(s,t?.minScale);return}let o=this.stage.width(),n=this.stage.height(),{min:r,max:a}=this.zoomBounds(),l=1.12,c=Math.min(o/(s.width*l),n/(s.height*l)),h=O(Math.max(c,t?.minScale??r),r,a),f=o/2-(s.x+s.width/2)*h,d=n/2-(s.y+s.height/2)*h,m=this.stage.scaleX(),y=this.stage.x(),p=this.stage.y();if(Math.abs(h-m)<1e-4&&Math.abs(f-y)<.5&&Math.abs(d-p)<.5){this.afterViewChange();return}let u=performance.now(),b=Math.max(180,Math.min(1200,t?.durationMs??Ct));this.glideInProgress=!0;let g=w=>{if(this.destroyed){this.glideRaf=0,this.glideInProgress=!1;return}let k=Math.min(1,(w-u)/b),L=k<.5?4*k*k*k:1-Math.pow(-2*k+2,3)/2,S=m+(h-m)*L;this.stage.scale({x:S,y:S}),this.stage.position({x:y+(f-y)*L,y:p+(d-p)*L}),this.updateSeatGroupVisibility(),this.updateLOD(),this.scheduleViewChange(),this.stage.batchDraw(),k<1?this.glideRaf=requestAnimationFrame(g):(this.glideRaf=0,this.glideInProgress=!1,this.afterViewChange())};this.glideRaf=requestAnimationFrame(g)}cancelGlide(){this.glideRaf&&(cancelAnimationFrame(this.glideRaf),this.glideRaf=0),this.glideInProgress=!1}getRung(){let e=this.effScale();return e>=ne?"seats":this.zones.length&&e<Ae?"zones":"sections"}get renderedQualityContext(){return{stage:this.stage,overlayLayer:this.overlayLayer,labelGroup:this.labelGroup,viewMode:this.viewMode,cached:this.cached,effScale:()=>this.effScale(),getRung:()=>this.getRung(),worldToScreen:e=>this.worldToScreen(e),isoLiftLocal:e=>this.isoLiftLocal(e),seats:this.seats,sections:this.sections,zones:this.zones,seatSection:this.seatSection,statusById:this.statusById,selection:this.selection,circleById:this.circleById,seatLabelById:this.seatLabelById,boothLabelById:this.boothLabelById,accessGlyphById:this.accessGlyphById,freeTextById:this.freeTextById,gaById:this.gaById,perspectiveSeatProjected:this.perspectiveSeatProjected,perspectiveSeatScale:this.perspectiveSeatScale,seatR:this.seatR,canvasBackground:this.canvasBackground,effSelection:this.effSelection,categoryFilter:this.categoryFilter,focusedSectionId:this.focusedSectionId,focusBackdrop:this.focusBackdrop,isSelectable:e=>this.isSelectable(e),seatViewportCulled:e=>this.seatViewportCulled(e),focusedSeatOpacity:(e,t)=>this.focusedSeatOpacity(e,t),accessGlyphFilterEmphasized:e=>this.accessGlyphFilterEmphasized(e),seatLabelScale:e=>this.seatLabelScale(e),seatLabelInk:(e,t)=>this.seatLabelInk(e,t),seatPreferredLabelInk:e=>this.seatPreferredLabelInk(e)}}getRenderedQualityEvidence(){return no(this.renderedQualityContext)}setRung(e){if(e==="zones"){this.cancelGlide(),this.zoomToFit();return}let t=e==="sections"?(ye+ne)/2:Math.max(this.seatLabelTargetScale()*1.05,Rs,ne*1.3),s=this.stage.width(),o=this.stage.height(),n=this.getVisibleWorldRect(),r={x:n.x+n.width/2,y:n.y+n.height/2},a=r.x,l=r.y;if(e==="sections"&&this.sections.length>0){let d=this.sections.map(u=>{let b=V(u.outline);return{x:b.x+b.width/2,y:b.y+b.height/2}}),m=s/(t*2),y=o/(t*2);if(!d.some(u=>Math.abs(u.x-r.x)<=m&&Math.abs(u.y-r.y)<=y)){let u=d.reduce((b,g)=>{let w=(g.x-r.x)**2+(g.y-r.y)**2;return w<b.distance?{point:g,distance:w}:b},{point:d[0],distance:1/0});a=u.point.x,l=u.point.y}}let c=e==="seats"?this.seats.filter(d=>d.kind!=="booth"):[];if(c.length>0){let d=c[0],m=1/0;for(let y of c){let p=y.x-r.x,u=y.y-r.y,b=p*p+u*u;b<m&&(d=y,m=b)}a=d.x,l=d.y}let h=s/(t*1.12),f=o/(t*1.12);this.focusRegion({x:a-h/2,y:l-f/2,width:h,height:f})}seatLabelTargetScale(){let e=Pe,t=new Te({fontSize:de,fontStyle:"600",fontFamily:this.labelFont(),listening:!1}),s=this.seatR*2-3;for(let o of this.seats){if(o.kind==="booth"){e=Math.min(e,Pe);continue}let n=de*this.seatLabelScale(o);t.fontSize(n),t.text(yt(o.displayLabel??o.label));let r=t.width()>s?Math.max($e,n*s/t.width()):n;e=Math.min(e,r)}return t.destroy(),ee/Math.max($e,e)}afterViewChange(){this.updateSeatGroupVisibility(),this.updateLOD(),this.updateFreeTextVisibility(),this.updateLabels(),this.scheduleViewChange()}scheduleViewChange(){this.exportMode||this.viewChangeRaf||(this.viewChangeRaf=requestAnimationFrame(()=>{this.viewChangeRaf=0,this.opts.onViewChange?.()}))}sizeLabel(e,t,s){e.fontSize(Math.max(1,t)),e.offsetX(e.width()/2),e.offsetY(e.height()/2),e.y(s)}updateLOD(){let e=this.exportMode?Math.max(this.effScale(),Ee+.01,re):this.effScale(),t=Math.max(e,1e-4);for(let[n,r]of this.primaryFocalLabels)this.sizeLabel(n,r/t,n.y());this.hasSections?wo(this.sectionLodPaintContext,e):this.primaryFocalLabels.size&&this.bgLayer.batchDraw(),this.paintGAStateForView(),this.updateAccessGlyphs(e),this.seatGlyphDetail=Vs(this.glyphMarkers,this.seatR,e,this.seatGlyphDetail);let s=!this.exportMode&&e<ne;if(this.viewMode==="perspective"&&this.hasSections&&this.seats.length>2500&&s){this.seatLayer.listening(!1);return}s&&!this.cached?this.cacheSeatLayer():!s&&(this.cached||!this.seatLayer.listening())&&(this.cached&&this.releaseSeatLayerBitmap(),this.seatLayer.listening(!this.exportMode),this.cached=!1,this.seatLayer.batchDraw())}rebuildSeatCache(){this.updateSeatGroupVisibility();let e=O(this.stage.scaleX()*this.dpr,.15,2);this.seatLayer.clearCache(),this.seatLayer.cache({pixelRatio:e}),this.seatLayer.listening(!1),this.cached=!0}cacheSeatLayer(){this.rebuildSeatCache(),this.seatLayer.batchDraw()}releaseSeatLayerBitmap(){let e=this.seatLayer,t=e._cache.get("canvas");t&&(_t.Util.releaseCanvas(t.scene._canvas,t.filter._canvas,t.hit._canvas),e._cache.delete("canvas"))}forceDraw(){this.recacheTimer&&(clearTimeout(this.recacheTimer),this.recacheTimer=null,this.effScale()<ne?this.rebuildSeatCache():this.cached&&(this.releaseSeatLayerBitmap(),this.seatLayer.listening(!0),this.cached=!1)),this.bgLayer.draw(),this.seatLayer.draw(),this.overlayLayer.draw()}async ready(){let e=this.assetGeneration,t=typeof document<"u"&&"fonts"in document?document.fonts:null;if(await Promise.all([...this.assetPromises.slice(),...t?[t.ready.then(()=>{}),t.load("700 24px Inter").then(()=>{}),t.load('600 12px "JetBrains Mono"').then(()=>{})]:[]]),e!==this.assetGeneration)throw new Error("The chart changed while its export assets were loading.");if(this.assetErrors.length)throw new Error(`Export stopped because ${this.assetErrors.join(" ")}`);this.exportMode&&(this.fitExportContent(),this.forceDraw())}exportSceneBounds(){let e=[this.bgLayer,this.seatLayer,this.overlayLayer].map(r=>r.getClientRect({relativeTo:this.stage})).filter(r=>r.width>0&&r.height>0);if(!e.length)return this.bounds;let t=Math.min(...e.map(r=>r.x)),s=Math.min(...e.map(r=>r.y)),o=Math.max(...e.map(r=>r.x+r.width)),n=Math.max(...e.map(r=>r.y+r.height));return{x:t,y:s,width:Math.max(1,o-t),height:Math.max(1,n-s)}}fitExportContent(){if(!this.exportMode)return;let e=this.stage.width(),t=this.stage.height(),s=Math.max(12,Math.min(36,Math.min(e,t)*.025)),o=()=>{let n=this.exportSceneBounds(),r=Math.max(1,e-s*2),a=Math.max(1,t-s*2),l=Math.min(r/n.width,a/n.height)||1;this.fitScale=l,this.stage.scale({x:l,y:l}),this.stage.position({x:(e-n.width*l)/2-n.x*l,y:(t-n.height*l)/2-n.y*l}),this.afterViewChange()};o(),o()}captureCanvas(){if(!this.exportMode)throw new Error("captureCanvas() is available only on a renderer created with exportMode.");this.forceDraw();let e;try{e=this.stage.toCanvas({pixelRatio:1,imageSmoothingEnabled:!0})}catch(o){let n=o instanceof Error?o.message:String(o);throw new Error(`The chart canvas could not be captured. A buyer-visible image may block export. ${n}`)}let t=document.createElement("canvas");t.width=this.stage.width(),t.height=this.stage.height();let s=t.getContext("2d");if(!s)throw new Error("Canvas 2D is unavailable; this browser cannot create an export.");s.fillStyle=this.canvasBackground,s.fillRect(0,0,t.width,t.height);try{s.drawImage(e,0,0)}finally{e.width=1,e.height=1}return t}updateFreeTextVisibility(){let e=this.exportMode?Math.max(this.effScale(),re):this.effScale();for(let{node:t,backdrop:s,kind:o}of this.freeTextById.values()){if(o==="ga-label"||o==="ga-capacity")continue;let r=o==="free-text"&&this.nodeBelongsToFocusedSection(t)||pe(t.fontSize(),e);t.visible(r),s?.visible(r)}for(let{node:t,fontSize:s}of this.iconNodeById.values())t.visible(this.nodeBelongsToFocusedSection(t)||pe(s,e))}nodeBelongsToFocusedSection(e){let t=this.focusedSectionId;if(!t)return!1;let s=this.sections.filter(r=>r.id===t||r.logicalId===t||r.zone===t);if(!s.length)return!1;let o=e.getClientRect({relativeTo:this.bgLayer,skipShadow:!0}),n={x:o.x+o.width/2,y:o.y+o.height/2};return s.some(r=>J(n,r.outline,r.holes))}buildRowLabelPlan(e){this.rowLabelPlan=go(e,{theme:this.theme,seats:this.seats,seatSection:this.seatSection,seatR:this.seatR,objectFilteredOut:t=>this.objectFilteredOut(t)})}rowLabelBox(e,t,s=Z){return bi(e,t,s)}resolveAutomaticRowLabelPosition(e,t,s){return bo(e,t,s,this.seatIndex)}objectFilteredOut(e){let t=e.categoryKey;return t?!!(this.categoryHighlight&&t!==this.categoryHighlight||this.categoryFilter&&!this.categoryFilter.has(t)):!1}updateLabels(){To(this.viewportLabelContext)}get viewportLabelContext(){return{exportMode:this.exportMode,effScale:()=>this.effScale(),boothLabelById:this.boothLabelById,circleById:this.circleById,focusedSeatOpacity:(e,t)=>this.focusedSeatOpacity(e,t),labelGroup:this.labelGroup,labelLiftGroups:this.labelLiftGroups,seatLabelById:this.seatLabelById,visibleSeatCandidates:()=>this.visibleSeatCandidates(),worldToScreen:e=>this.worldToScreen(e),stage:this.stage,accessGlyphById:this.accessGlyphById,accessGlyphShouldShow:e=>this.accessGlyphShouldShow(e),statusById:this.statusById,renderedSeatPoint:e=>this.renderedSeatPoint(e),viewMode:this.viewMode,perspectiveSeatScale:this.perspectiveSeatScale,ownedHold:this.ownedHold,opts:this.opts,seatLabelContainer:e=>this.seatLabelContainer(e),seatLabelScale:e=>this.seatLabelScale(e),labelFont:()=>this.labelFont(),seatLabelInk:(e,t)=>this.seatLabelInk(e,t),seatPreferredLabelInk:e=>this.seatPreferredLabelInk(e),seatR:this.seatR,freeTextById:this.freeTextById,bgLayer:this.bgLayer,rowLabelPlan:this.rowLabelPlan,focusedSectionId:this.focusedSectionId,resolveAutomaticRowLabelPosition:(e,t,s)=>this.resolveAutomaticRowLabelPosition(e,t,s),rowLabelBox:(e,t)=>this.rowLabelBox(e,t),isoT:this.isoT,applyUprightLabels:()=>this.applyUprightLabels(),overlayLayer:this.overlayLayer}}handleResize(){let e=this.container.clientWidth||1,t=this.container.clientHeight||1;e===this.stage.width()&&t===this.stage.height()||(this.stage.size({width:e,height:t}),this.refitCurrentView())}startFpsLoop(){let e=t=>{this.lastFpsAt||(this.lastFpsAt=t),this.frames++;let s=t-this.lastFpsAt;s>=1e3&&(this.opts.onFps?.(Math.round(this.frames*1e3/s)),this.frames=0,this.lastFpsAt=t),this.rafId=requestAnimationFrame(e)};this.rafId=requestAnimationFrame(e)}};ot.ZOOM_STEP=1.4;var Li=ot;function Do(i,e){return new Li(i,e)}function _o(i,e={}){let{baseMs:t=1e3,factor:s=2,maxMs:o=1/0,jitter:n=0,random:r=Math.random}=e,a=Math.min(t*s**Math.max(0,i),o);if(n<=0)return a;let l=Math.min(1,n);return a*(1-l+l*r())}function Oo(i,e,t){return ze(i).map(s=>{let o=i.categories.find(n=>n.key===s.categoryKey);return{id:s.id,label:s.label,...s.displayLabel?{displayLabel:s.displayLabel}:{},...s.displayType?{displayType:s.displayType}:{},capacity:Math.max(0,Math.floor(s.capacity)),available:dt(s).filter(n=>t(n)==="free").length,categoryKey:s.categoryKey,tiers:o?.tiers,price:o?.tiers?.[0]?.price??o?.price??0,currency:e}})}function Go(i,e){let t={};for(let s of i)t[s.id]=e?{available:s.available,selected:e.get(s.id)??0}:{available:s.available};return t}function Ho(i){let e={};for(let[t,s]of i.seatById)i.groupedTableBySeatId.has(t)||i.closedMembers.has(t)||(i.statusOf(t)??"free")==="free"&&(e[s.categoryKey]=(e[s.categoryKey]??0)+1);for(let t of i.groupedTablesByLabel.values()){if(t.chairs.some(o=>i.closedMembers.has(o.id)))continue;let s=t.chairs[0];s&&(i.statusOf(s.id)??"free")==="free"&&(e[t.categoryKey]=(e[t.categoryKey]??0)+t.maxOccupancy)}for(let t of i.gaAreas??[])e[t.categoryKey]=(e[t.categoryKey]??0)+t.available;return e}var Ti=["background","rowLabelColor","textColor","selectionColor"];function No(i,e){return!i||!e?!i&&!e:Ti.every(t=>i[t]===e[t])}function nt(i){let e=i??{};return{status:e.status,conflicts:e.conflicts,reason:e.reason}}function Ot(i){return i==="blocked"?"not_for_sale":i==="held"||i==="booked"||i==="free"||i==="not_for_sale"?i:"free"}var me=class extends Error{constructor(t){super(t.message);this.status=422;this.name="PickerSelectionError",this.reason=t.code,this.labels=t.labels}};function zo(i){if(i!=null&&(!Number.isInteger(i)||i<1))throw new Error("picker: `numberOfPlacesToSelect` must be a positive integer");return i??null}function Vo(i,e,t,s){if(t!=null&&!Array.isArray(t))throw new TypeError("picker: `selectionValidators` must be an array");let o=[],n=0,r=!1,a=!1;for(let c of t??[])if(c?.type==="minimumSelectedPlaces"){if(!Number.isInteger(c.minimum)||Number(c.minimum)<1)throw new TypeError("picker: `minimumSelectedPlaces.minimum` must be a positive integer");n=Math.max(n,Number(c.minimum))}else if(c?.type==="consecutiveSeats")r=!0;else if(c?.type==="noOrphanSeats")a=!0;else throw new TypeError(`picker: unsupported selection validator "${String(c?.type??"")}"`);if(n&&o.push({type:"minimumSelectedPlaces",minimum:n}),r&&o.push({type:"consecutiveSeats"}),a&&o.push({type:"noOrphanSeats"}),i!=null&&n>i)throw new Error("picker: `minimumSelectedPlaces.minimum` cannot exceed `numberOfPlacesToSelect`");let l=Math.max(0,Math.floor(e??i??Math.max(s,n)));if(i!=null&&l<i)throw new Error("picker: `maxSelection` cannot be lower than `numberOfPlacesToSelect`");if(e!=null&&l<n)throw new Error("picker: `maxSelection` cannot be lower than `minimumSelectedPlaces.minimum`");return{validators:o,maxSelection:i??l}}function sr(i){let e=Number(i.slice(i.lastIndexOf(":")+1));return Number.isInteger(e)?e:-1}function or(i){if(i.length<=1)return!1;let e=i[0]?.objectId,t=i[0]?.categoryKey;if(!e||i.some(o=>o.objectId!==e||o.categoryKey!==t))return!0;let s=i.map(o=>sr(o.id)).sort((o,n)=>o-n);return s.some((o,n)=>o<0||n>0&&o!==s[n-1]+1)}function Wo(i,e,t,s,o){let n=s.find(l=>l.type==="minimumSelectedPlaces")?.minimum??0,r=t??n,a=[];return t!=null&&e!==t&&a.push("numberOfPlacesToSelect"),n&&e<n&&a.push("minimumSelectedPlaces"),s.some(l=>l.type==="consecutiveSeats")&&or(i)&&a.push("consecutiveSeats"),s.some(l=>l.type==="noOrphanSeats")&&o()&&a.push("noOrphanSeats"),{isValid:a.length===0,count:e,required:r,remaining:Math.max(0,r-e),seats:i,violations:a}}var nr=10,rr=15e3,Ko=class{constructor(e){this.selectableSeatIds=null;this.lastSelectionValidity=null;this.renderer=null;this.gaSelected=null;this._doc=null;this.hidden=new Set;this.mapTheme=null;this.closedSections=new Set;this.labelToId=new Map;this.labelToSeat=new Map;this.expandedSeats=[];this.seatTiers=new Map;this.seatById=new Map;this.seatContext=new Map;this.allIds=[];this.groupedTablesByObject=new Map;this.groupedTablesByLabel=new Map;this.groupedTableBySeatId=new Map;this.tableQuantities=new Map;this.confirmedVariableTables=new Set;this.groupedSelectionOverhead=0;this.ws=null;this.realtime=null;this.reconnectTimer=null;this.attempt=0;this.closed=!1;this.onVisibilityChange=null;this.hold_=null;this.liveStatuses=new Map;this.liveDefault="free";this.currency="USD";this.expiryTimer=null;this.hintShown=!1;this.opts=e,this.api=e.transport,this.key=e.eventKey,this.numberOfPlacesToSelect=zo(e.numberOfPlacesToSelect);let t=Vo(this.numberOfPlacesToSelect,e.maxSelection,e.selectionValidators,nr);this.selectionValidators=t.validators,this.maxSelection=t.maxSelection,this.selectableObjectRefs=e.selectableObjects==null?null:[...new Set(e.selectableObjects.filter(s=>typeof s=="string"&&!!s))],this.mapTheme=e.mapTheme??null}get doc(){return this._doc}visibleDoc(){if(!this._doc)return{objects:[]};let e=Ki(this._doc,this.hidden);if(!this.mapTheme)return e;let t={...e.theme??{}};for(let s of Ti){let o=this.mapTheme[s];o&&(t[s]=o)}return{...e,theme:t}}setMapTheme(e){return No(this.mapTheme,e??null)?!1:(this.mapTheme=e??null,this.rebuildPreservingState(),!0)}rebuildPreservingState(){let e=this.renderer;if(!e)return!1;let t=e.getSelection().map(n=>n.id),s=this.getActiveFloorId(),o=e.isFloorOverview?.()??!1;return e.setChart(this.visibleDoc(),s?{floorId:s}:void 0),o&&e.setFloorOverview?.(!0),this.opts.colorblindSafe&&e.setColorblindSafe?.(!0),this.closedSections.size&&e.setClosedSections?.([...this.closedSections]),this.applySeatsMap(Object.fromEntries(this.liveStatuses),this.liveDefault),t.length&&e.select?.(t),!0}refreshMapCopy(){this.rebuildPreservingState()&&this.renderer?.forceDraw()}syncHidden(e){let t=e.filter(o=>typeof o=="string");if(t.length===this.hidden.size&&t.every(o=>this.hidden.has(o)))return!1;this.hidden=new Set(t);let s=this.renderer?.isFloorOverview?.()??!1;return this.renderer?.setChart(this.visibleDoc()),s&&this.renderer?.setFloorOverview?.(!0),!0}syncClosed(e){let t=(e??[]).filter(s=>typeof s=="string");return t.length===this.closedSections.size&&t.every(s=>this.closedSections.has(s))?!1:(this.closedSections=new Set(t),this.renderer?.setClosedSections?.(t),!0)}isSectionClosed(e){return this.closedSections.has(e)}currentHold(){return this.hold_}getRenderer(){return this.renderer}seatByLabel(e){return this.labelToSeat.get(e)}getExpandedSeats(){return this.expandedSeats}idForLabel(e){return this.labelToId.get(e)}idsForLabel(e){let t=this.groupedTablesByLabel.get(e);if(t)return t.chairs.map(o=>o.id);let s=this.labelToId.get(e);return s?[s]:[]}idsForLabels(e){return[...new Set([...e].flatMap(t=>this.idsForLabel(t)))]}tableSelection(e){let t=this.groupedTableBySeatId.get(e)??this.groupedTablesByLabel.get(e);return t?this.toTableSeat(t):null}lineItemDisplay(e){if(e.objectType==="ga"){let o=this.visibleDoc(),n=ze(o).find(r=>r.id===e.objectId);return{...n?.displayLabel?{displayLabel:n.displayLabel}:{},...n?.displayType?{displayType:n.displayType}:{}}}if(e.objectType==="table"){let o=this.groupedTablesByLabel.get(e.label);return{...o?.displayLabel&&o.displayLabel!==o.label?{displayLabel:o.displayLabel}:{},...o?.displayType?{displayType:o.displayType}:{}}}let t=this.labelToSeat.get(e.label),s=t?this.seatContext.get(t.id):void 0;return{...t?.displayLabel?{displayLabel:t.displayLabel}:{},...s?.displayType?{displayType:s.displayType}:{}}}async render(e){if(this.renderer)return null;let t=performance.now(),s={},o=S=>Math.round((performance.now()-S)*100)/100;this.closed=!1;let n,r=performance.now();try{n=await this.api.chart(this.key)}catch(S){return this.emitError(S),null}if(s.loadChart=o(r),this.closed)return null;this._doc=n.doc;let a=performance.now();try{let S=us(n.doc,n.event.inventoryModelVersion===2?2:1);this.groupedTablesByObject=new Map(S.map(v=>[v.objectId,v])),this.groupedTablesByLabel=new Map(S.map(v=>[v.label,v])),this.groupedTableBySeatId=new Map(S.flatMap(v=>v.chairs.map(x=>[x.id,v]))),this.tableQuantities=new Map(S.map(v=>[v.label,v.mode==="whole"?v.capacity:v.minOccupancy])),this.confirmedVariableTables=new Set,this.groupedSelectionOverhead=S.reduce((v,x)=>v+Math.max(0,x.chairs.length-1),0)}catch(S){return this.emitError(S),null}this.labelToId=new Map,this.labelToSeat=new Map,this.seatById=new Map,this.seatContext=new Map,this.allIds=[];let l=new Map(Oi(n.doc).map(S=>[S.id,S])),c=Yt(n.doc),h=new Map([...c.sections,...c.ungrouped?[c.ungrouped]:[]].map(S=>[S.id,S.label]));this.expandedSeats=Ne(n.doc);for(let S of this.expandedSeats){this.labelToId.set(S.label,S.id),this.labelToSeat.set(S.label,S),this.seatById.set(S.id,S),this.allIds.push(S.id);let v=l.get(S.rowId),x=v&&"label"in v&&typeof v.label=="string"?v.label:void 0,I=v?.type==="row"?v.segmentedRow:void 0,T=I?.displayLabel??(v&&"displayLabel"in v&&typeof v.displayLabel=="string"&&v.displayLabel?v.displayLabel:x),P=this.groupedTablesByObject.get(S.rowId),M=v?.type==="table"?"table":v?.type==="booth"?"booth":"seat",C=T,R=I?.displayType?.trim()||(v&&"displayType"in v&&typeof v.displayType=="string"&&v.displayType.trim()?v.displayType.trim():void 0),B=S.displayLabel??S.label,A=B.split("-"),W=P||S.kind==="booth"?void 0:T&&B.startsWith(`${T}-`)?B.slice(T.length+1):A[A.length-1]??B;this.seatContext.set(S.id,{objectId:S.rowId,objectType:M,sectionLabel:h.get(c.objectToSection.get(S.rowId)??""),rowLabel:C,seatNumber:W,...R?{displayType:R,rowType:R}:{}})}for(let S of this.groupedTablesByLabel.values()){let v=S.chairs[0];v&&(this.labelToId.set(S.label,v.id),this.labelToSeat.set(S.label,v))}s.normalizeBuyerModel=o(a);let f=n.event.currency??this.opts.currency;this.currency=f??"USD";let d=performance.now(),m=Do(e,{maxSelection:this.rendererSelectionCap(),confirmSelection:this.opts.confirmSelection,portraitFitCrop:!1,gaPickerMode:!0,currency:f,onSelect:S=>{this.handleRendererSelect(S)},onDeselect:S=>{this.handleRendererDeselect(S)},onSelectionLimit:this.opts.onSelectionLimit,onHover:S=>{this.opts.onHover?.(S),this.opts.onSeatHover&&this.opts.onSeatHover(S?this.describeSeat(S):null)},onFocusSeat:this.opts.onFocusSeat,onViewChange:this.opts.onViewChange,onGAClick:this.opts.onGAClick,onSectionTap:S=>this.handleSectionTap(S),onDeckTap:S=>this.handleDeckTap(S),onFps:this.opts.onFps});if(s.createRenderer=o(d),this.closed)return m.destroy(),null;this.renderer=m;let y=null,p="free",u=[],b=performance.now();try{let S=await this.api.objects(this.key);this.hidden=new Set(S.hidden??[]),u=(S.closed??[]).filter(v=>typeof v=="string"),y=S.seats,p=S.default??"free"}catch{}if(s.loadStatuses=o(b),this.closed)return m.destroy(),this.renderer=null,null;let g=performance.now();m.setChart(this.visibleDoc()),(n.doc.floors?.length??0)>1&&m.setFloorOverview?.(!0),this.opts.colorblindSafe&&m.setColorblindSafe?.(!0),s.buildScene=o(g),this.closedSections=new Set(u);let w=performance.now();u.length&&m.setClosedSections?.(u),y&&this.applySeatsMap(y,p),this.rebuildSelectableSeatIds(),this.opts.selectedObjects?.length?this.select(this.opts.selectedObjects):this.emitSelectionValidity(),this.pushGAState(),s.applyInitialState=o(w);let k=performance.now();m.forceDraw(),s.firstPaint=o(k);let L=performance.now();return this.attachVisibilityListener(),this.connect(),s.startRealtime=o(L),s.controllerTotal=o(t),{doc:n.doc,salesClosed:!!n.event.salesClosed,eventName:n.event.name,venue:n.event.venue,startsAt:n.event.startsAt,timezone:n.event.timezone??null,currency:f,mode:n.event.mode??"live",locale:n.event.locale??null,posterUrl:n.event.posterUrl??null,performanceProfile:s}}getSelection(){if(!this.renderer)return[];let e=[],t=new Set;for(let s of this.renderer.getSelection()){let o=this.groupedTableBySeatId.get(s.id);o?t.has(o.label)||(t.add(o.label),e.push(this.toTableSeat(o))):e.push(this.toSeat(s))}return e}seatDetails(e){let t=this.seatById.get(e);return t?this.describeSeat(t):null}clearSelection(){this.renderer?.clearSelection(),this.resetUnheldTableQuantities(),this.emitSelectionChange()}deselect(e){let t=new Set;for(let s of e){let o=this.groupedTableBySeatId.get(s)??this.groupedTablesByLabel.get(s);if(o)o.chairs.forEach(n=>t.add(n.id)),this.hold_?.labels.includes(o.label)||(this.tableQuantities.set(o.label,o.mode==="whole"?o.capacity:o.minOccupancy),o.mode==="variable"&&this.confirmedVariableTables.delete(o.label));else{let n=this.seatById.has(s)?s:this.labelToId.get(s);n&&t.add(n)}}this.renderer?.deselect([...t]),this.emitSelectionChange()}setMaxSelection(e){this.maxSelection=Math.max(0,Math.floor(e)),this.renderer?.setMaxSelection?.(this.rendererSelectionCap())}select(e){let t=new Set(this.getSelection().map(r=>r.label)),s=new Set,o=[];for(let r of e){let a=this.groupedTableBySeatId.get(r)??this.groupedTablesByLabel.get(r);if(a)this.tableTierResolution(a).kind==="invalid"?o.push(a.label):a.chairs.forEach(c=>{this.isSelectableByPolicy(c.id)&&s.add(c.id)});else{let l=this.seatById.has(r)?r:this.labelToId.get(r);if(!l||!this.isSelectableByPolicy(l))continue;let c=this.seatById.get(l);c&&this.seatTierResolution(c).kind==="invalid"?o.push(c.label):s.add(l)}}if(o.length&&this.emitError(new me(ei(o))),!s.size)return[];if(this.renderer?.select?.([...s]),this.selectionGuestCount()>this.maxSelection)return this.renderer?.deselect([...s]),this.opts.onSelectionLimit?.(this.maxSelection),[];let n=this.getSelection().filter(r=>!t.has(r.label));return n.length&&this.emitSelectionChange(),n}selectCategories(e){let t=new Set(e);return this.select([...this.seatById.values()].filter(s=>t.has(s.categoryKey)).map(s=>s.id))}deselectCategories(e){let t=new Set(e);this.deselect(this.getSelection().filter(s=>t.has(s.categoryKey)).map(s=>s.id))}setSelectableObjects(e){this.selectableObjectRefs=e==null?null:[...new Set(e.filter(s=>typeof s=="string"&&!!s))],this.rebuildSelectableSeatIds();let t=this.renderer?.getSelection().filter(s=>!this.isSelectableByPolicy(s.id)).map(s=>s.id)??[];t.length&&this.deselect(t)}getSelectionValidity(e){if(this.numberOfPlacesToSelect==null&&!this.selectionValidators.length)return null;let t=this.getSelection(),s=e??t.reduce((o,n)=>o+(n.quantity??1),0);return Wo(t,s,this.numberOfPlacesToSelect,this.selectionValidators,()=>this.hasOrphanedSelection())}hasOrphanedSelection(){let e=this.renderer;if(!e)return!1;let t=new Set(e.getSelection().map(s=>s.id));return t.size>0&&Jt(this.seatById.values(),s=>e.getStatus(s),t).length>0}rebuildSelectableSeatIds(){if(this.selectableObjectRefs==null){this.selectableSeatIds=null;return}let e=new Set;for(let t of this.selectableObjectRefs){let s=this.groupedTableBySeatId.get(t)??this.groupedTablesByLabel.get(t);if(s){s.chairs.forEach(n=>e.add(n.id));continue}let o=this.seatById.has(t)?t:this.labelToId.get(t);o&&e.add(o)}this.selectableSeatIds=e}isSelectableByPolicy(e){return this.selectableSeatIds==null||this.selectableSeatIds.has(e)}setTableQuantity(e,t){let s=this.groupedTablesByLabel.get(e);if(!s)return!1;let o=s.mode==="whole"?s.capacity:Math.floor(t);if(!Number.isInteger(o)||o<s.minOccupancy||o>s.maxOccupancy)return!1;let n=this.tableQuantities.get(e)??s.minOccupancy;return this.tableQuantities.set(e,o),this.selectionGuestCount()>this.maxSelection?(this.tableQuantities.set(e,n),this.opts.onSelectionLimit?.(this.maxSelection),!1):(s.mode==="variable"&&this.confirmedVariableTables.add(e),this.emitSelectionChange(),!0)}async replaceTableQuantity(e,t,s){let o=this.groupedTablesByLabel.get(e),n=this.hold_;if(!o||o.mode!=="variable"||!n?.labels.includes(e))return null;let r=Math.floor(t);if(!Number.isInteger(r)||r<o.minOccupancy||r>o.maxOccupancy)return null;if((n.items??[]).filter(h=>h.label!==e).reduce((h,f)=>h+(f.quantity??1),0)+r>this.maxSelection)return this.opts.onSelectionLimit?.(this.maxSelection),null;let l=(n.items??[]).map(h=>({label:h.label,tierId:h.tierId,quantity:h.label===e?r:h.quantity}));if(!l.some(h=>h.label===e))return null;let c=await this.api.hold(this.key,l,s,n.holdId);return this.tableQuantities.set(e,r),this.setHold({holdId:c.holdId,labels:l.map(h=>h.label),expiresAt:c.expiresAt,items:c.items}),this.hold_}rendererSelectionCap(){return this.maxSelection+this.groupedSelectionOverhead}selectionGuestCount(){return this.getSelection().reduce((e,t)=>e+(t.quantity??1),0)}handleRendererSelect(e){let t=this.groupedTableBySeatId.get(e.id);if(!this.isSelectableByPolicy(e.id)){this.renderer?.deselect(t?t.chairs.map(o=>o.id):[e.id]),this.emitSelectionChange();return}if((t?this.tableTierResolution(t):this.seatTierResolution(e)).kind==="invalid"){this.renderer?.deselect(t?t.chairs.map(o=>o.id):[e.id]),this.emitError(new me(ei([t?.label??e.label]))),this.emitSelectionChange();return}if(t){if(this.selectionGuestCount()>this.maxSelection){this.renderer?.deselect(t.chairs.map(o=>o.id)),this.opts.onSelectionLimit?.(this.maxSelection),this.emitSelectionChange();return}this.renderer?.select?.(t.chairs.map(o=>o.id)),this.opts.onSelect?.(t.chairs[0]??e),this.opts.onTableSelectionRequest?.(this.toTableSeat(t)),this.emitSelectionChange();return}if(this.selectionGuestCount()>this.maxSelection){this.renderer?.deselect([e.id]),this.opts.onSelectionLimit?.(this.maxSelection),this.emitSelectionChange();return}this.opts.onSelect?.(e),this.emitSelectionChange()}handleRendererDeselect(e){let t=this.groupedTableBySeatId.get(e.id);t?(this.renderer?.deselect(t.chairs.map(s=>s.id)),this.hold_?.labels.includes(t.label)||(this.tableQuantities.set(t.label,t.mode==="whole"?t.capacity:t.minOccupancy),t.mode==="variable"&&this.confirmedVariableTables.delete(t.label)),this.opts.onDeselect?.(t.chairs[0]??e)):this.opts.onDeselect?.(e),this.emitSelectionChange()}resetUnheldTableQuantities(){for(let e of this.groupedTablesByLabel.values())this.hold_?.labels.includes(e.label)||(this.tableQuantities.set(e.label,e.mode==="whole"?e.capacity:e.minOccupancy),e.mode==="variable"&&this.confirmedVariableTables.delete(e.label))}resetTableQuantitiesForLabels(e){for(let t of e){let s=this.groupedTablesByLabel.get(t);s&&(this.tableQuantities.set(t,s.mode==="whole"?s.capacity:s.minOccupancy),s.mode==="variable"&&this.confirmedVariableTables.delete(t))}}tableQuantityRequest(e){if(e?.objectType!=="table")return{};if(e.bookingMode==="variable"&&!this.confirmedVariableTables.has(e.label))throw new Error("picker: confirm a variable table guest quantity before holding");return{quantity:e.quantity}}async hold(e,t){if(!this.renderer)return null;let o=e??this.getSelection().map(l=>l.label),n=(this.hold_?.items??[]).filter(l=>l.objectType==="ga"),r=[...new Set([...n.map(l=>l.label),...o])];if(!r.length)return null;let a=this.ticketIssue(r);if(a)throw new me(a);if(this.hold_&&this.holdCovers(r))return this.hold_;try{let l=r.map(h=>{let f=n.find(y=>y.label===h);if(f)return{label:h,tierId:f.tierId,quantity:f.quantity};let d=this.labelToSeat.get(h),m=d?this.toSeat(d):null;return{label:h,...m?.tierId?{tierId:m.tierId}:{},...this.tableQuantityRequest(m)}}),c=await this.api.hold(this.key,l,t,this.hold_?.holdId);return this.setHold({holdId:c.holdId,labels:r,expiresAt:c.expiresAt,items:c.items}),this.hold_}catch(l){throw this.handle409Conflicts(l),l}}async resumeHold(e){if(this.closed||!e||!this.api.resume)return null;let t=await this.api.resume(this.key,e);if(this.closed)return null;let s=[...new Set(t.items.map(o=>o.label))];return s.length?(this.setHold({holdId:t.holdId,labels:s,expiresAt:t.expiresAt,items:t.items},"restored"),this.hold_):null}async extendHold(e){let t=this.hold_;if(!t||!this.api.extend)return null;try{let s=await this.api.extend(this.key,t.holdId,e);return this.hold_?.holdId!==t.holdId?this.hold_:(this.setHold({holdId:t.holdId,labels:t.labels,expiresAt:s.expiresAt,items:t.items}),this.hold_)}catch{return null}}categoryAvailability(){return Ho({seatById:this.seatById,groupedTableBySeatId:this.groupedTableBySeatId,groupedTablesByLabel:this.groupedTablesByLabel,closedMembers:this.closedMemberIds(),statusOf:e=>this.getStatus(e),gaAreas:this.getGAAreas()})}closedMemberIds(){let e=new Set,t=this.renderer;if(!t||!this.closedSections.size)return e;for(let s of this.closedSections)for(let o of t.sectionMembers?.(s)??[])e.add(o);return e}getGAAreas(){let e=this.visibleDoc();return e?Oo(e,this.currency,t=>this.statusOf(t)):[]}setGASelection(e){this.gaSelected=e?new Map(e):null,this.pushGAState()}pushGAState(){this.renderer?.setGAStates?.(Go(this.getGAAreas(),this.gaSelected))}async holdGA(e,t,s={}){let o=this.visibleDoc();if(!o||!Number.isFinite(t)||t<1)return null;let n=ze(o).find(h=>h.id===e);if(!n)return null;let r=dt(n).filter(h=>!this.hold_?.labels.includes(h)&&this.statusOf(h)==="free").slice(0,Math.floor(t));if(r.length!==Math.floor(t))return null;let a=new Map;for(let h of this.hold_?.items??[])a.set(h.label,{label:h.label,tierId:h.tierId,quantity:h.quantity});if(this.hold_&&!this.hold_?.items?.length)for(let h of this.hold_.seats)a.set(h.label,{label:h.label,...h.tierId?{tierId:h.tierId}:{}});for(let h of this.getSelection())a.set(h.label,{label:h.label,...h.tierId?{tierId:h.tierId}:{},...this.tableQuantityRequest(h)});for(let h of r)a.set(h,{label:h,...s.tierId?{tierId:s.tierId}:{}});let l=[...a.values()],c=await this.api.hold(this.key,l,s.ttlMs,this.hold_?.holdId);return this.setHold({holdId:c.holdId,labels:l.map(h=>h.label),expiresAt:c.expiresAt,items:c.items}),this.hold_}hasPremiumSeats(){for(let e of this.labelToSeat.values())if(e.commercial?.premium)return!0;return!1}getBestAvailableZones(){let e=this.visibleDoc();if(!e?.zones?.length)return[];let t=new Set(Yt(e).sections.filter(s=>s.seatCount>0&&!!s.zone).map(s=>s.zone));return e.zones.filter(s=>t.has(s.id)).map(s=>({id:s.id,label:s.label}))}pickPremiumBlock(e,t,s){let o=this.visibleDoc();if(!o?.objects?.length)return null;let n=o.focalPoint??{x:0,y:0},r=new Set(this.groupedTablesByObject.keys()),a=Ne(o).filter(d=>!r.has(d.rowId)),l=new Set(this.hold_?.labels??[]),c=new Set;for(let d of a){if(l.has(d.label)||this.seatTierResolution(d).kind==="invalid")continue;let m=this.labelToId.get(d.label);((m?this.getStatus(m):void 0)??"free")==="free"&&c.add(d.label)}let h=hs(a,c,{qty:e,categoryKey:t,zoneId:s,focal:n,preferPremium:!0});return h.labels.length!==e?null:h.labels.every(d=>this.labelToSeat.get(d)?.commercial?.premium)?[...h.labels]:null}async bestAvailable(e,t,s={}){let o=this.renderer;if(!o)return null;if(s.preferPremium){let n=this.pickPremiumBlock(e,t,s.zoneId);if(n){if(this.hold_&&!await this.release())return null;try{let r=n.map(h=>{let f=this.labelToSeat.get(h),d=f?this.toSeat(f):null;return{label:h,...d?.tierId?{tierId:d.tierId}:{}}}),a=await this.api.hold(this.key,r,s.ttlMs);o.clearSelection();let l=this.idsForLabels(n);l.length&&o.setStatus(l,"held"),this.setHold({holdId:a.holdId,labels:[...n],expiresAt:a.expiresAt,items:a.items});let c=n.map(h=>this.labelToSeat.get(h)).filter(h=>!!h).map(h=>this.toSeat(h));return this.opts.onSelectionChange?.(c),this.hold_}catch(r){let{status:a,reason:l}=nt(r);if(a===409&&l==="event_closed")throw this.opts.onSalesClosed?.(),r}}}if(this.hold_&&!await this.release())return null;try{let n=await this.api.bestAvailable(this.key,e,t,s.zoneId,s.ttlMs);o.clearSelection();let r=this.idsForLabels(n.labels);r.length&&o.setStatus(r,"held"),this.setHold({holdId:n.holdId,labels:[...n.labels],expiresAt:n.expiresAt,items:n.items});let a=n.labels.map(l=>this.labelToSeat.get(l)).filter(l=>!!l).map(l=>this.toSeat(l));return this.opts.onSelectionChange?.(a),this.hold_}catch(n){let{status:r,reason:a}=nt(n);throw r===409&&a==="event_closed"&&this.opts.onSalesClosed?.(),n}}async book(e,t,s){let o=this.renderer;if(!o)return null;if(!this.api.book)throw new Error("picker: transport has no book() \u2014 hold-only mode");let n=t??this.getSelection().map(c=>c.label);if(!n.length)return null;let r=this.ticketIssue(n);if(r)throw new me(r);let a;try{if(this.hold_&&this.holdCovers(n))a=this.hold_.holdId;else{let c=this.hold_?.holdId,h=await this.api.hold(this.key,n.map(f=>{let d=this.labelToSeat.get(f),m=d?this.toSeat(d):null;return{label:f,...m?.tierId?{tierId:m.tierId}:{},...this.tableQuantityRequest(m)}}),s,c);a=h.holdId,this.setHold({holdId:a,labels:[...n],expiresAt:h.expiresAt,items:h.items})}await this.api.book(this.key,n,a,e)}catch(c){let{status:h,conflicts:f,reason:d}=nt(c);if(this.clearHold(),h===409&&d==="event_closed")this.opts.onSalesClosed?.();else if(h===409&&f?.length){let m=new Set(f.map(u=>u.label)),y=this.idsForLabels(m);y.length&&(o.setStatus(y,"booked"),o.deselect(y),this.resetTableQuantitiesForLabels(m));let p=n.filter(u=>!m.has(u));p.length&&a&&this.api.release(this.key,p,a).catch(()=>{}),this.emitSelectionChange()}else a&&this.api.release(this.key,n,a).catch(()=>{});throw c}let l=this.idsForLabels(n);return l.length&&(o.setStatus(l,"booked"),o.deselect(l)),this.clearHold(),this.resetTableQuantitiesForLabels(n),this.emitSelectionChange(),this.opts.onBook?.(e),n}async release(){let e=this.hold_;if(!e)return!0;try{let s=await this.api.release(this.key,e.labels,e.holdId);if(!this.releaseConfirmed(s,e.labels))return await this.resnapshot(),!1}catch(s){return this.emitError(s),!1}if(this.hold_?.holdId!==e.holdId)return!0;this.clearHold(),this.resetTableQuantitiesForLabels(e.labels);let t=this.idsForLabels(e.labels);return t.length&&(this.renderer?.deselect(t),this.renderer?.setStatus(t,"free")),!0}async releaseLabels(e){let t=this.hold_;if(!t)return!0;let s=e.filter(a=>t.labels.includes(a));if(!s.length)return!0;try{let a=await this.api.release(this.key,s,t.holdId);if(!this.releaseConfirmed(a,s))return await this.resnapshot(),!1}catch(a){return this.emitError(a),!1}if(this.hold_?.holdId!==t.holdId)return!0;let o=t.labels.filter(a=>!s.includes(a)),n=t.items?.filter(a=>!s.includes(a.label));o.length?this.setHold({...t,labels:o,items:n}):this.clearHold(),this.resetTableQuantitiesForLabels(s);let r=this.idsForLabels(s);return r.length&&(this.renderer?.deselect(r),this.renderer?.setStatus(r,"free")),!0}releaseConfirmed(e,t){let s=e?.released;return!Array.isArray(s)||t.every(o=>s.includes(o))}setStatus(e,t){this.renderer?.setStatus(e,t)}getStatus(e){return this.renderer?.getStatus(e)}notForSaleCategorySeatIds(){let e=this.doc;if(!e)return[];let t=new Set(e.categories.filter(o=>o.notForSale).map(o=>o.key));if(!t.size)return[];let s=[];for(let[o,n]of this.seatById)t.has(n.categoryKey)&&s.push(o);return s}flashSeat(e,t){this.renderer?.flashSeat(e,t)}zoomIn(){this.renderer?.zoomIn()}zoomOut(){let e=this.renderer;if(!e?.zoomOutLevel)return void e?.zoomOut();let t=!!e.getFocusedSection?.();e.zoomOutLevel()==="venue"&&t&&this.overview()}zoomToFit(){this.renderer?.zoomToFit()}refitCurrentView(){this.renderer?.refitCurrentView?this.renderer.refitCurrentView():this.renderer?.zoomToFit()}worldToScreen(e){return this.renderer?.worldToScreen(e)??{x:0,y:0}}setSelectionFocus(e){this.renderer?.setSelectionFocus?.(e)}setAccessibilityFilter(e){this.renderer?.setAccessibilityFilter?.(e)}setCommercialLimitedFilter(e){this.renderer?.setCommercialLimitedFilter?.(e)}getFloors(){return this.renderer?.getFloors?.()??[]}getActiveFloorId(){return this.renderer?.getActiveFloorId?.()??""}setFloor(e){let t=this.renderer;!t?.setActiveFloor||e===t.getActiveFloorId?.()&&!t.isFloorOverview?.()||(t.setFloorOverview?.(!1),t.setStacked?.(!1),t.setActiveFloor(e),this.resnapshot(),this.emitSelectionChange())}setStacked(e){let t=this.renderer;!t?.setStacked||e===t.isStacked?.()||(t.setStacked(e),this.resnapshot())}isMultiFloor(){return(this._doc?.floors?.length??0)>1}setFloorOverview(e){let t=this.renderer;!t?.setFloorOverview||e===t.isFloorOverview?.()||(t.setFloorOverview(e),this.resnapshot(),this.emitSelectionChange())}isFloorOverview(){return this.renderer?.isFloorOverview?.()??!1}handleDeckTap(e){let t=this.renderer;t&&(t.setViewMode?.("flat"),t.setFloorOverview?.(!1),t.setStacked?.(!1),t.setActiveFloor?.(e),this.resnapshot(),this.emitSelectionChange(),this.opts.onDeckTap?.(e))}setViewMode(e){this.renderer?.setViewMode?.(e)}getViewMode(){return this.renderer?.getViewMode?.()??"flat"}getRung(){return this.renderer?.getRung?.()??"seats"}getFocusedSection(){return this.renderer?.getFocusedSection?.()??null}setRung(e){if(e==="zones"){this.overview();return}this.renderer?.setRung?.(e)}setCategoryFilter(e){this.renderer?.setCategoryFilter?.(e)}focusCategoryFilter(e){let t=this.renderer;if(t){if(t.clearSectionFocus?.(),this.opts.onSectionFocus?.(null),e?.length){let s=this.floorForCategories(e);s&&this.setFloor(s)}t.focusCategories?t.focusCategories(e):t.zoomToFit()}}floorForCategories(e){let t=this._doc;if(!t?.floors||t.floors.length<2)return null;let s=new Set(e),o=a=>a.some(l=>l.type==="row"&&(s.has(l.categoryKey)||(l.overrides??[]).some(c=>c.categoryKey!=null&&s.has(c.categoryKey)))||l.type==="gaArea"&&s.has(l.categoryKey)),n=this.getActiveFloorId(),r=t.floors.find(a=>a.id===n);return r&&o(r.objects)?null:t.floors.find(a=>o(a.objects))?.id??null}getViewport(){let e=this.renderer;return!e?.getVisibleWorldRect||!e.getWorldBounds?null:{visible:e.getVisibleWorldRect(),bounds:e.getWorldBounds()}}getMinimapSnapshot(){return this.renderer?.getMinimapSnapshot?.()??{sections:[],seats:[]}}panToWorld(e){this.renderer?.panToWorld?.(e)}clearSectionFocus(){this.renderer?.clearSectionFocus?.(),this.opts.onSectionFocus?.(null)}getRenderedQualityEvidence(){return this.renderer?.getRenderedQualityEvidence()??null}focusSection(e){this.handleSectionTap(e)}getSectionSeatCount(e){return this.renderer?.sectionMembers?.(e)?.length??0}overview(){this.renderer?.clearSectionFocus?.(),this.renderer?.zoomToFit(),this.opts.onSectionFocus?.(null)}handleSectionTap(e){let t=this.renderer;if(t){if(t.focusSection?t.focusSection(e):t.focusRegion?.(e),this.isSectionClosed(e)){this.opts.onSectionFocus?.(null);return}this.opts.onSectionFocus?.(this.sectionSummary(e))}}sectionSummary(e){let t=this.renderer,s=this._doc;if(!t||!s)return null;let o=s.objects.find(y=>y.type==="section"&&y.id===e);if(!o)return null;let n=t.sectionMembers?.(e)??[],r=new Map,a=new Set,l=0;for(let y of n){let p=this.seatById.get(y);if(!p)continue;let u=this.groupedTableBySeatId.get(y);if(u){if(a.has(u.label))continue;a.add(u.label),r.set(u.categoryKey,(r.get(u.categoryKey)??0)+u.maxOccupancy),t.getStatus(u.chairs[0]?.id??y)==="free"&&(l+=u.maxOccupancy)}else r.set(p.categoryKey,(r.get(p.categoryKey)??0)+1),t.getStatus(y)==="free"&&l++}let c=[...r.entries()].map(([y,p])=>{let u=s.categories.find(k=>k.key===y),b=u?.tiers?.length?u.tiers.map(k=>k.price):[u?.price??0],g=Math.min(...b),w=Math.max(...b);return{key:y,count:p,label:u?.label??y,color:u?.color??"#6e7bff",price:g,priceMin:g,priceMax:w}}).sort((y,p)=>y.price-p.price),h=c.map(y=>y.priceMin),f=c.map(y=>y.priceMax),d=o.zone?s.zones?.find(y=>y.id===o.zone):void 0,m=o.color??d?.color??c[0]?.color??"#6e7bff";return{id:e,label:o.displayLabel??o.label,zoneLabel:d?.label??"",...o.entrance&&o.entrance.trim()?{entrance:o.entrance.trim()}:{},color:m,seatsLeft:l,priceMin:h.length?Math.min(...h):0,priceMax:f.length?Math.max(...f):0,categories:c}}destroy(){if(this.closed=!0,this.detachVisibilityListener(),this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.expiryTimer&&(clearTimeout(this.expiryTimer),this.expiryTimer=null),this.realtime){try{this.realtime.stop()}catch{}this.realtime=null}if(this.ws){try{this.ws.close()}catch{}this.ws=null}this.renderer?.destroy(),this.renderer=null}toSeat(e){let t=this.groupedTableBySeatId.get(e.id);if(t)return this.toTableSeat(t);let s=e.commercial?{commercial:e.commercial}:void 0,o=e.displayLabel?{displayLabel:e.displayLabel}:void 0,n=e.accessibility?.length?{accessibility:e.accessibility}:void 0,r=e.wheelchairSpaceType?{wheelchairSpaceType:e.wheelchairSpaceType}:void 0,a=this.seatContext.get(e.id),l=this.tiersForSeat(e),c=this.seatTierResolution(e);if(c.kind!=="resolved"||!l)return{id:e.id,label:e.label,...o,...a,categoryKey:e.categoryKey,price:this.priceFor(e.categoryKey),currency:this.currency,...s,...n,...r};let h=c.tier;return{id:e.id,label:e.label,...o,...a,categoryKey:e.categoryKey,price:h.price,currency:this.currency,tiers:l,tierId:h.id,...s,...n,...r}}toTableSeat(e){let t=e.chairs[0],s=this.tiersFor(e.categoryKey)?.filter(r=>vt(this._doc,this.tableTierSeat(e),r.id).kind==="resolved"),o=this.tableTierResolution(e),n=o.kind==="resolved"?o.tier:void 0;return{id:t?.id??e.objectId,label:e.label,displayLabel:e.displayLabel??e.label,...e.displayType?{displayType:e.displayType,rowType:e.displayType}:{},objectId:e.objectId,sectionLabel:t?this.seatContext.get(t.id)?.sectionLabel:void 0,rowLabel:e.displayLabel??e.label,categoryKey:e.categoryKey,price:n?.price??this.priceFor(e.categoryKey),currency:this.currency,...s?{tiers:s,tierId:n?.id}:{},objectType:"table",bookingMode:e.mode,quantity:this.tableQuantities.get(e.label)??(e.mode==="whole"?e.capacity:e.minOccupancy),capacity:e.capacity,minOccupancy:e.minOccupancy,maxOccupancy:e.maxOccupancy,physicalSeatIds:e.chairs.map(r=>r.id)}}describeSeat(e){let t=this._doc?.categories.find(s=>s.key===e.categoryKey);return{...this.toSeat(e),categoryLabel:t?.label??e.categoryKey,categoryColor:t?.color??"#6e7bff",status:this.renderer?.getStatus(e.id)??"free",currency:this.currency,...this.seatContext.get(e.id)}}priceFor(e){return this._doc?.categories.find(t=>t.key===e)?.price??0}tiersFor(e){let t=this._doc?.categories.find(s=>s.key===e)?.tiers;return t&&t.length?t:void 0}tiersForSeat(e){if(!this._doc)return;let t=ds(this._doc,e);return t.length?t:void 0}seatTierResolution(e){return this._doc?vt(this._doc,e,this.seatTiers.get(e.id)):{kind:"none"}}tableTierSeat(e){return{label:e.label,categoryKey:e.categoryKey,accessibility:e.chairs.flatMap(t=>t.accessibility??[])}}tableTierResolution(e){if(!this._doc)return{kind:"none"};let t=e.chairs[0]?.id??"";return vt(this._doc,this.tableTierSeat(e),this.seatTiers.get(t))}setSeatTier(e,t){let s=this.seatById.get(e);if(!s)return;let o=this.tiersForSeat(s);if(o){if(t==null)this.seatTiers.delete(e);else if(o.some(n=>n.id===t))this.seatTiers.set(e,t);else return;this.emitSelectionChange(),this.hold_&&(this.hold_={...this.hold_,seats:this.seatsForLabels(this.hold_.labels)})}}seatsForLabels(e){let t=[];for(let s of e){let o=this.labelToSeat.get(s);o&&t.push(this.toSeat(o))}return t}emitSelectionChange(){let e=this.getSelection();this.opts.onSelectionChange?.(e),this.emitSelectionValidity(),this.emitOrphanHint()}emitSelectionValidity(){let e=this.getSelectionValidity();e&&(this.opts.onSelectionValidityChange?.(e),e.isValid?this.lastSelectionValidity!==!0&&this.opts.onSelectionValid?.(e.seats):this.lastSelectionValidity!==!1&&this.opts.onSelectionInvalid?.(e),this.lastSelectionValidity=e.isValid)}ticketIssue(e){if(!this._doc)return null;let t=e?this.seatsForLabels(e):this.getSelection();return ps(this._doc,t.map(s=>({label:s.label,...s.tierId?{tierId:s.tierId}:{}})))}emitOrphanHint(){if(!this.opts.onHint)return;let e=this.renderer;if(!e)return;let t=this.ticketIssue();if(t){this.hintShown=!0,this.opts.onHint(t.code==="companion_pair_required"?U("picker.companionPairRequired"):"That ticket choice is not available for the selected seat.");return}let s=new Set(e.getSelection().map(n=>n.id));(s.size?Jt(this.seatById.values(),n=>e.getStatus(n),s):[]).length>0?(this.hintShown=!0,this.opts.onHint(U("picker.orphanHint"))):this.hintShown&&(this.hintShown=!1,this.opts.onHint(null))}setColorblindSafe(e){this.renderer?.setColorblindSafe?.(e)}emitError(e){this.opts.onError?this.opts.onError(e):console.error("[picker]",e)}holdCovers(e){let t=this.hold_;if(!t||t.labels.length!==e.length||!e.every(n=>t.labels.includes(n)))return!1;let s=new Map((t.items??[]).map(n=>[n.label,n.tierId])),o=new Map((t.items??[]).map(n=>[n.label,n.quantity??1]));return e.every(n=>{let r=this.labelToSeat.get(n),a=r?this.toSeat(r):null,l=a?.tierId??null;return(a?.objectType!=="table"||(a.bookingMode!=="variable"||this.confirmedVariableTables.has(n))&&(!o.has(n)||o.get(n)===a.quantity))&&(!s.has(n)||s.get(n)===l)})}handle409Conflicts(e){let{status:t,conflicts:s}=nt(e);if(t!==409||!s?.length)return;let o=this.renderer;if(!o)return;let n=this.idsForLabels(s.map(r=>r.label));n.length&&(o.deselect(n),o.setStatus(n,"held"),this.resetTableQuantitiesForLabels(s.map(r=>r.label))),this.emitSelectionChange()}setHold(e,t="created"){for(let n of e.items??[])this.groupedTablesByLabel.has(n.label)&&n.quantity!=null&&(this.tableQuantities.set(n.label,n.quantity),this.groupedTablesByLabel.get(n.label)?.mode==="variable"&&this.confirmedVariableTables.add(n.label));let s={...e,seats:this.seatsForLabels(e.labels)};this.hold_=s,this.renderer?.setOwnedHold?.(this.idsForLabels(s.labels)),this.expiryTimer&&clearTimeout(this.expiryTimer);let o=Math.max(0,s.expiresAt-Date.now());this.expiryTimer=setTimeout(()=>{this.expireActiveHold()},o),t==="restored"?this.opts.onHoldRestored?.(s):this.opts.onHold?.(s)}clearHold(){this.hold_=null,this.renderer?.setOwnedHold?.(null),this.expiryTimer&&(clearTimeout(this.expiryTimer),this.expiryTimer=null)}async expireActiveHold(){let e=this.hold_;if(e){try{let t=await this.api.objects(this.key);if(this.hold_?.holdId!==e.holdId)return;this.applySeatsMap(t.seats,t.default??"free")}catch{this.hold_?.holdId===e.holdId&&(this.expiryTimer=setTimeout(()=>{this.expireActiveHold()},2e3));return}if(this.hold_?.holdId===e.holdId){if(e.labels.some(t=>this.statusOf(t)==="held")){this.expiryTimer=setTimeout(()=>{this.expireActiveHold()},1e3);return}this.clearHold(),this.opts.onHoldExpired?.()}}}applySeatsMap(e,t="free"){let s=this.renderer;if(!s)return;this.liveStatuses=new Map(Object.entries(e)),this.liveDefault=t;let o=Ot(t);this.allIds.length&&s.setStatus(this.allIds,o),s.setOwnedHold?.(this.idsForLabels(this.hold_?.labels??[]));let n={free:[],held:[],booked:[],not_for_sale:[]};for(let[a,l]of Object.entries(e))n[Ot(l)].push(...this.idsForLabel(a));["free","held","booked","not_for_sale"].forEach(a=>{a!==o&&n[a].length&&s.setStatus(n[a],a)});let r=this.notForSaleCategorySeatIds();r.length&&s.setStatus(r,"not_for_sale"),this.clearBookedHoldIfSettled(),this.opts.onStatusChange?.()}statusOf(e){return this.liveStatuses.get(e)??this.liveDefault}clearBookedHoldIfSettled(){let e=this.hold_;e?.labels.every(t=>this.statusOf(t)==="booked")&&(this.clearHold(),this.resetTableQuantitiesForLabels(e.labels))}async resnapshot(){try{let e=await this.api.objects(this.key);this.applySeatsMap(e.seats,e.default??"free")}catch{}}async refresh(){await this.resnapshot()}attachVisibilityListener(){if(this.onVisibilityChange||typeof document>"u"||typeof document.addEventListener!="function")return;let e=()=>{this.closed||document.visibilityState==="visible"&&this.resnapshot().then(()=>{this.closed||this.renderer?.forceDraw()})};this.onVisibilityChange=e,document.addEventListener("visibilitychange",e)}detachVisibilityListener(){this.onVisibilityChange&&(typeof document<"u"&&typeof document.removeEventListener=="function"&&document.removeEventListener("visibilitychange",this.onVisibilityChange),this.onVisibilityChange=null)}realtimeSink(){return{applyStatuses:e=>this.applyStatusChanges(e),applyProjection:e=>this.applySeatsMap(e.exceptions,e.default),resync:()=>this.resnapshot(),onSections:(e,t)=>{let s=this.syncHidden(e),o=this.syncClosed(t);s&&this.resnapshot(),(s||o)&&this.opts.onStatusChange?.()}}}applyStatusChanges(e){let t=this.renderer;if(t){for(let s of e){this.liveStatuses.set(s.label,s.status);let o=this.idsForLabel(s.label);if(!o.length)continue;let n=Ot(s.status);this.opts.flashOnLiveChange&&n!=="free"&&o.some(r=>t.getStatus(r)==="free")&&!this.hold_?.labels.includes(s.label)&&o.forEach(r=>t.flashSeat(r,n==="held"?"#f4b740":"#f43f5e")),t.setStatus(o,n)}this.opts.keepLiveWhileHidden&&typeof document<"u"&&document.visibilityState==="hidden"&&t.forceDraw(),this.pushGAState(),this.clearBookedHoldIfSettled(),this.opts.onStatusChange?.()}}connect(){if(this.closed)return;let e=this.api.socketUrl(this.key);if(!e)return;if(!this.realtime&&this.api.createRealtime){let s=null;try{s=this.api.createRealtime(this.key,this.realtimeSink())}catch{s=null}if(s){this.realtime=s,s.start();return}}if(this.realtime)return;let t;try{let s=this.api.socketProtocols?.(this.key);t=s&&s.length?new WebSocket(e,s):new WebSocket(e)}catch{this.scheduleReconnect();return}this.ws=t,t.onopen=()=>{this.attempt=0,this.resnapshot()},t.onmessage=s=>{let o;try{o=JSON.parse(typeof s.data=="string"?s.data:"")}catch{return}if(!this.renderer||!o||typeof o!="object")return;let r=o;Array.isArray(r.hidden)&&this.syncHidden(r.hidden)&&(this.resnapshot(),this.opts.onStatusChange?.()),Array.isArray(r.closed)&&this.syncClosed(r.closed)&&this.opts.onStatusChange?.(),r.type!=="hidden"&&(r.seats&&typeof r.seats=="object"?this.applySeatsMap(r.seats):Array.isArray(r.changes)&&this.applyStatusChanges(r.changes))},t.onclose=()=>{this.ws===t&&(this.ws=null),this.scheduleReconnect()},t.onerror=()=>{try{t.close()}catch{}}}scheduleReconnect(){if(this.closed||this.reconnectTimer)return;let e=Math.min(this.attempt++,5),t=_o(e,{baseMs:1e3,maxMs:rr,jitter:1});this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.connect()},t)}};var ar=5,lr=-1.1,Ii=35;function Ci(i,e){let t=i-Y,s=Math.atan2(ar-t,e)*180/Math.PI,o=Math.atan2(lr-t,e)*180/Math.PI;return o<-Ii&&(s+=-Ii-o,o=-Ii),{topPitch:s,basePitch:o}}var K=2048,le=1024,at=Di,E=Math.PI*2,cr=le/180,Ge=i=>(i+180)/360*K,G=i=>(90-i)/180*le;function Uo(i){let e=2166136261;for(let t=0;t<i.length;t++)e^=i.charCodeAt(t),e=Math.imul(e,16777619);return e>>>0}function Zo(i){let e=i>>>0;return()=>{e|=0,e=e+1831565813|0;let t=Math.imul(e^e>>>15,1|e);return t=t+Math.imul(t^t>>>7,61|t)^t,((t^t>>>14)>>>0)/4294967296}}var Gt=96,xi=360/Gt,hr=.6,Mi=[17,23,42];function Pi(i,e,t=1){let s=Math.max(0,Math.min(.58,e)),o=Math.round(i[0]+(Mi[0]-i[0])*s),n=Math.round(i[1]+(Mi[1]-i[1])*s),r=Math.round(i[2]+(Mi[2]-i[2])*s);return`rgba(${o},${n},${r},${t})`}function Xo(i,e,t){return[Math.round(i[0]+(e[0]-i[0])*t),Math.round(i[1]+(e[1]-i[1])*t),Math.round(i[2]+(e[2]-i[2])*t)]}function Q(i,e,t){let s=(1-Math.abs(2*t-1))*e,o=(i%360+360)%360/60,n=s*(1-Math.abs(o%2-1)),r=0,a=0,l=0;o<1?[r,a,l]=[s,n,0]:o<2?[r,a,l]=[n,s,0]:o<3?[r,a,l]=[0,s,n]:o<4?[r,a,l]=[0,n,s]:o<5?[r,a,l]=[n,0,s]:[r,a,l]=[s,0,n];let c=t-s/2;return[Math.round((r+c)*255),Math.round((a+c)*255),Math.round((l+c)*255)]}var $o=new Map;function Yo(i){if(!i)return null;let e=$o.get(i);if(e)return e;let t=2166136261;for(let n=0;n<i.length;n++)t^=i.charCodeAt(n),t=Math.imul(t,16777619);let s=(t>>>0)%360,o=Q(s,.3,.42);return $o.set(i,o),o}function dr(i,e,t,s){let o=new Array(Gt).fill(null),n=0,r=i.sectionId;for(let a of e){if(a.id===i.id)continue;let l=a.sectionId;if(!l||r&&l===r)continue;let c=a.x-i.x,h=a.y-i.y,f=Math.hypot(c,h)*at;if(f<1.5||f>95)continue;let d=a.eyeHeightM??Y,m=d-s;Math.abs(m)>n&&(n=Math.abs(m));let y=Math.atan2(m,f)*180/Math.PI,p=Math.atan2(d-Y-s,f)*180/Math.PI,b=((Math.atan2(c,-h)-t)*180/Math.PI+540)%360-180,g=Math.min(Gt-1,Math.max(0,Math.floor((b+180)/xi))),w=y>34&&f<16,k=o[g];k?(y>k.top&&(k.top=y),p<k.base&&(k.base=p),f<k.nearM&&(k.nearM=f,k.tint=Yo(a.categoryKey)),k.overhead=k.overhead||w):o[g]={top:y,base:p,nearM:f,overhead:w,tint:Yo(a.categoryKey)}}return{bins:o,maxDelta:n}}function pr(i,e,t,s){for(let o=0;o<Gt;o++){let n=e[o];if(!n)continue;let r=-180+o*xi,a=t(r),l=t(r+xi);if(!(l>a))continue;let c=Math.min(72,n.top),h=Math.min(n.base,-4),f=s(c),d=s(h);if(d<=f)continue;let m=n.nearM/95,y=n.tint,p=y?Xo([44,54,80],y,.34):[44,54,80],u=y?Xo([24,30,48],y,.28):[24,30,48],b=i.createLinearGradient(0,f,0,d);b.addColorStop(0,Pi(p,m)),b.addColorStop(.24,Pi(u,m)),b.addColorStop(1,Pi([10,13,22],m)),i.fillStyle=b,i.fillRect(a,f,l-a+1,d-f),i.fillStyle=`rgba(150,165,205,${.35*(1-m*.55)})`,i.fillRect(a,f,l-a+1,1.5);let w=Math.min(d,s(0))-f;if(w>8){let L=1-m*.4;for(let S=1;S<6;S++){let v=f+w*S/6;i.fillStyle=`rgba(0,0,0,${.16*L})`,i.fillRect(a,v,l-a+1,1.5),i.fillStyle=`rgba(120,134,170,${.1*L})`,i.fillRect(a,v+1.5,l-a+1,1.2)}}if(n.overhead){let k=s(Math.min(86,c+12)),L=i.createLinearGradient(0,k,0,f);L.addColorStop(0,"rgba(3,4,8,0.9)"),L.addColorStop(1,"rgba(3,4,8,0)"),i.fillStyle=L,i.fillRect(a,k,l-a+1,f-k),i.fillStyle="rgba(120,130,160,0.14)",i.fillRect(a,f-1.5,l-a+1,1.5)}}}function ur(i,e,t){let o=new Array(72).fill(!1),n=new Array(72).fill(1/0),r=new Set,a=0;for(let b of t){a++,b.sectionId&&r.add(b.sectionId);let g=b.x-e.x,w=b.y-e.y,k=Math.hypot(g,w)*at;if(k<.5)continue;let L=Math.atan2(g,-w),S=Math.floor((L+Math.PI)/E*72);S<0?S=0:S>=72&&(S=71),o[S]=!0,k<n[S]&&(n[S]=k)}let l=0,c=[];for(let b=0;b<72;b++)o[b]&&(l++,c.push(n[b]));let h=l/72*360;c.sort((b,g)=>b-g);let f=c.length?c[c.length>>1]:0,d=c.length?c[Math.floor(c.length*.15)]??f:0,m=c.length?c[Math.floor(c.length*.85)]??f:0,y=d>.5?m/d:1,p=Uo(`${a}|${[...r].sort().join(",")}|${Math.round(e.x)},${Math.round(e.y)}`),u;return h>=300&&f>11&&y>1.35?u="sport":h>=285?u="arena":u="proscenium",{mode:u,seed:p,voidRadiusM:f,aspect:y}}var fr=5;function yr(i,e,t){switch(t){case 1:i.beginPath(),i.ellipse(0,-e*.14,e*1.16,e*1.16,0,0,E),i.fill();break;case 2:i.beginPath(),i.ellipse(0,-e*1.02,e*.42,e*.42,0,0,E),i.fill(),i.beginPath(),i.ellipse(0,-e*.2,e*.98,e*1.02,0,0,E),i.fill();break;case 3:i.beginPath(),i.ellipse(0,-e*.36,e*1.04,e*.6,0,Math.PI,E),i.fill(),i.beginPath(),i.ellipse(0,-e*.52,e*1.22,e*.24,0,0,E),i.fill();break;case 4:i.beginPath(),i.ellipse(-e*.66,e*.5,e*.5,e*1.35,0,0,E),i.fill(),i.beginPath(),i.ellipse(e*.66,e*.5,e*.5,e*1.35,0,0,E),i.fill(),i.beginPath(),i.ellipse(0,-e*.08,e*1.06,e*1.08,0,0,E),i.fill();break;default:break}}function mr(i,e,t,s,o){let n=s*.44,r=s*o.shoulderK,a=s*.66,l=s*1.68,c=s*5.4,h=`rgba(${o.clothing[0]},${o.clothing[1]},${o.clothing[2]},${o.alpha})`,f=`rgba(${o.tone[0]},${o.tone[1]},${o.tone[2]},${o.alpha})`;i.save(),i.translate(e,t);let d=o.lean*s;i.fillStyle=h,i.beginPath(),i.moveTo(-n,a),i.quadraticCurveTo(-n*1.18,l-d-s*.6,-r,l-d),i.quadraticCurveTo(-r*1.05,l+s*1.2,-r*.94,c),i.lineTo(r*.94,c),i.quadraticCurveTo(r*1.05,l+s*1.2,r,l+d),i.quadraticCurveTo(n*1.18,l+d-s*.6,n,a),i.closePath(),i.fill(),i.fillStyle=f,i.fillRect(-n*.82,s*.5,n*1.64,s*.9),i.save(),i.rotate(o.tilt),i.translate(o.turn*s,0),i.fillStyle=f,s>=18?(i.beginPath(),i.moveTo(-s*.9,-s*.15),i.quadraticCurveTo(-s*.96,-s*1.12,0,-s*1.06),i.quadraticCurveTo(s*.96,-s*1.12,s*.9,-s*.15),i.quadraticCurveTo(s*.86,s*.55,s*.36,s*.98),i.quadraticCurveTo(0,s*1.14,-s*.36,s*.98),i.quadraticCurveTo(-s*.86,s*.55,-s*.9,-s*.15),i.closePath(),i.fill(),s>=22&&(i.beginPath(),i.ellipse(-s*.9,s*.18,s*.13,s*.22,0,0,E),i.ellipse(s*.9,s*.18,s*.13,s*.22,0,0,E),i.fill())):(i.beginPath(),i.ellipse(0,0,s*.9,s*1.06,0,0,E),i.fill()),yr(i,s,o.hair),o.rim>.01&&(i.strokeStyle=`rgba(245,205,150,${(.5*o.rim).toFixed(3)})`,i.lineWidth=Math.max(1,s*.14),i.beginPath(),i.ellipse(0,-s*.06,s*.86,s*1,0,Math.PI*1.12,Math.PI*1.9),i.stroke()),i.restore(),o.rim>.01&&(i.strokeStyle=`rgba(240,200,150,${(.28*o.rim).toFixed(3)})`,i.lineWidth=Math.max(1,s*.12),i.beginPath(),i.moveTo(-r*.8,l-s*.05),i.quadraticCurveTo(-n,l-s*.75,0,l-s*.82),i.quadraticCurveTo(n,l-s*.75,r*.8,l-s*.05),i.stroke()),i.restore()}function gr(i,e,t,s,o,n,r){i.fillStyle=`rgba(${o[0]},${o[1]},${o[2]},${r})`,i.beginPath(),i.moveTo(e-s*1.72,t+s*4),i.quadraticCurveTo(e-s*1.78,t+s*1.55,e-s*.46,t+s*1.02),i.lineTo(e-s*.4,t+s*.62),i.lineTo(e+s*.4,t+s*.62),i.lineTo(e+s*.46,t+s*1.02),i.quadraticCurveTo(e+s*1.78,t+s*1.55,e+s*1.72,t+s*4),i.closePath(),i.fill(),i.fillStyle=`rgba(${n[0]},${n[1]},${n[2]},${r})`,i.beginPath(),i.ellipse(e,t,s*.9,s*1.05,0,0,E),i.fill()}function Ei(i,e,t,s,o){let n=s*.1,r=t-s*.9,a=t-s*.74,l=t-s*.46,c=s*.13,h=s*.09,f=`rgba(${o.tone[0]},${o.tone[1]},${o.tone[2]},${o.alpha})`,d=i.createRadialGradient(e,t,1,e,t,s*.24);d.addColorStop(0,"rgba(0,0,0,0.4)"),d.addColorStop(1,"rgba(0,0,0,0)"),i.save(),i.scale(1,.28),i.fillStyle=d,i.beginPath(),i.ellipse(e,t/.28,s*.24,s*.24,0,0,E),i.fill(),i.restore(),i.fillStyle=f,i.beginPath(),i.moveTo(e-h,l),i.lineTo(e-h*.7,t),i.lineTo(e-h*.1,t),i.lineTo(e-h*.1,l+s*.02),i.lineTo(e+h*.1,l+s*.02),i.lineTo(e+h*.1,t),i.lineTo(e+h*.7,t),i.lineTo(e+h,l),i.closePath(),i.fill(),i.beginPath(),i.moveTo(e-c,a),i.quadraticCurveTo(e-c*.9,l-s*.12,e-h,l),i.lineTo(e+h,l),i.quadraticCurveTo(e+c*.9,l-s*.12,e+c,a),i.quadraticCurveTo(e,a-s*.05,e-c,a),i.closePath(),i.fill(),i.lineCap="round",i.lineJoin="round",i.strokeStyle=f,i.lineWidth=s*.055;let m=a+s*.02;o.pose===1?(i.beginPath(),i.moveTo(e-c*.8,m),i.lineTo(e-c*1.5,t-s*1.02),i.moveTo(e+c*.8,m),i.lineTo(e+c*1.5,t-s*1.02),i.stroke()):o.pose===2?(i.beginPath(),i.moveTo(e-c*.8,m),i.lineTo(e+h*1.4,l-s*.02),i.moveTo(e+c*.8,m),i.lineTo(e-h*.4,l-s*.06),i.stroke(),i.fillStyle=f,i.beginPath(),i.ellipse(e+h*1.5,l-s*.04,s*.07,s*.09,-.5,0,E),i.fill()):o.pose===3?(i.beginPath(),i.moveTo(e-c*.8,m),i.lineTo(e-c*.2,r+n*.6),i.moveTo(e+c*.8,m),i.lineTo(e+c*1.1,l),i.stroke(),i.lineWidth=s*.02,i.beginPath(),i.moveTo(e-c*.2,r+n*.9),i.lineTo(e-c*.2,t-s*.02),i.stroke()):(i.beginPath(),i.moveTo(e-c*.85,m),i.lineTo(e-c*.95,l+s*.02),i.moveTo(e+c*.85,m),i.lineTo(e+c*.95,l+s*.02),i.stroke()),i.fillStyle=f,i.fillRect(e-n*.34,r+n*.6,n*.68,n*.9),i.beginPath(),i.ellipse(e,r,n*.86,n*1.05,0,0,E),i.fill(),o.rimStrength>.01&&(i.strokeStyle=`rgba(${o.rim[0]},${o.rim[1]},${o.rim[2]},${(.6*o.rimStrength).toFixed(3)})`,i.lineWidth=Math.max(1,s*.02),i.beginPath(),i.moveTo(e-c,a),i.lineTo(e-n*.6,r+n*.4),i.moveTo(e-n*.7,r),i.ellipse(e,r,n*.84,n*1.02,0,Math.PI*1.05,Math.PI*1.55),i.stroke())}function Ht(i,e,t,s,o,n,r,a,l){i.save(),i.globalCompositeOperation="lighter";let c=i.createLinearGradient(0,t,0,o);c.addColorStop(0,`rgba(${a},${l})`),c.addColorStop(.5,`rgba(${a},${(l*.4).toFixed(3)})`),c.addColorStop(1,`rgba(${a},0)`),i.fillStyle=c,i.beginPath(),i.moveTo(e-n,t),i.lineTo(s-r,o),i.lineTo(s+r,o),i.lineTo(e+n,t),i.closePath(),i.fill(),i.restore()}function Ai(i,e,t,s,o){let n=i.createRadialGradient(e,t,0,e,t,s*3);n.addColorStop(0,`rgba(${o},0.9)`),n.addColorStop(.4,`rgba(${o},0.35)`),n.addColorStop(1,`rgba(${o},0)`),i.fillStyle=n,i.beginPath(),i.arc(e,t,s*3,0,E),i.fill(),i.fillStyle=`rgba(${o},1)`,i.beginPath(),i.arc(e,t,s,0,E),i.fill()}function kh(i,e,t){let s=document.createElement("canvas");s.width=K,s.height=le;let o=s.getContext("2d"),n=e.x-i.x,r=e.y-i.y,a=Math.hypot(n,r),l=Math.max(2,a*at),c=i.eyeHeightM??Y,h=ur(i,e,t),f=Zo(h.seed),d=210+f()*150,m=Q(220+(f()-.5)*60,.55,.82),y=`${m[0]},${m[1]},${m[2]}`,p=o.createLinearGradient(0,0,0,le);p.addColorStop(0,"#080b12"),p.addColorStop(.42,"#12182c"),p.addColorStop(.5,"#1c2440"),p.addColorStop(.56,"#151b2c"),p.addColorStop(.78,"#171e30"),p.addColorStop(1,"#131829"),o.fillStyle=p,o.fillRect(0,0,K,le);let u=o.createLinearGradient(0,G(-6),0,le);u.addColorStop(0,"rgba(30, 37, 56, 0)"),u.addColorStop(.55,"rgba(30, 37, 56, 0.22)"),u.addColorStop(1,"rgba(22, 28, 44, 0.12)"),o.fillStyle=u,o.fillRect(0,G(-6),K,le-G(-6));let b=Math.atan2(n,-r),g=dr(i,t,b,c),w=g.maxDelta>=hr;w&&pr(o,g.bins,Ge,G);let k=Math.max(.3,Math.min(1,1-(l-6)/60)),L=Ci(c,l),S=Math.min(80,Math.atan2(4,l)*180/Math.PI),v=Math.min(45,L.topPitch),x=L.basePitch;h.mode==="sport"?vr(o,l,c,h,k,d,y,f):h.mode==="arena"?Sr(o,l,c,h,k,y,f):br(o,S,v,x,k,d,y,f);let I=h.mode==="sport"?34:24+Math.floor(f()*8);o.fillStyle=`rgba(${y},0.8)`;for(let P=0;P<I;P++){let M=(P+.5)/I*K,C=G(h.mode==="sport"?58:54+P*7%3*6);o.beginPath(),o.arc(M,C,h.mode==="sport"?2.6:3.2,0,E),o.fill()}wr(o,i,t,e,b,c,n,r,w,h);let T=o.createLinearGradient(0,0,0,le);return T.addColorStop(0,"rgba(0,0,0,0.85)"),T.addColorStop(.12,"rgba(0,0,0,0)"),T.addColorStop(.9,"rgba(0,0,0,0)"),T.addColorStop(1,"rgba(0,0,0,0.55)"),o.fillStyle=T,o.fillRect(0,0,K,le),{url:s.toDataURL("image/jpeg",.82),distanceM:Math.round(l)}}function br(i,e,t,s,o,n,r,a){let l=Ge(-e),c=Ge(e),h=G(t),f=G(s),d=c-l,m=f-h,y=G(Math.min(50,t+10)),p=d*(1.1+(1-o)*.5),u=i.createRadialGradient(K/2,(h+f)/2,8,K/2,(h+f)/2,p);u.addColorStop(0,"rgba(255, 214, 150, 0.34)"),u.addColorStop(.28,"rgba(150, 150, 230, 0.3)"),u.addColorStop(.6,"rgba(99, 102, 241, 0.12)"),u.addColorStop(1,"rgba(99, 102, 241, 0)"),i.fillStyle=u,i.fillRect(l-d*.6,h-m*1.2,d*2.2,m*3.4);let b=Q(n,.62,.55),g=Q(n+40,.7,.5),w=Q(n+70,.78,.52);i.save(),i.beginPath(),i.rect(l,h,d,m),i.clip();let k=i.createLinearGradient(0,h,0,f);k.addColorStop(0,`rgb(${b[0]},${b[1]},${b[2]})`),k.addColorStop(.5,`rgb(${g[0]},${g[1]},${g[2]})`),k.addColorStop(1,`rgb(${w[0]},${w[1]},${w[2]})`),i.globalAlpha=.8,i.fillStyle=k,i.fillRect(l,h,d,m),i.globalAlpha=1;let L=i.createRadialGradient(K/2,(h+f)/2,d*.12,K/2,(h+f)/2,d*.62);L.addColorStop(0,"rgba(6,8,14,0)"),L.addColorStop(.7,"rgba(6,8,14,0.15)"),L.addColorStop(1,"rgba(5,6,11,0.92)"),i.fillStyle=L,i.fillRect(l,h,d,m),i.restore();let S=3+Math.floor(a()*3),v=m*.46,x=f-m*.08;for(let A=0;A<S;A++){let W=(A+1)/(S+1),H=l+d*(.22+W*.56+(a()-.5)*.06);Ei(i,H,x,v*(.9+a()*.24),{tone:[8,10,16],alpha:.9,pose:Math.floor(a()*4),rim:Q(n+20,.5,.7),rimStrength:.7})}i.fillStyle="#05070d",i.fillRect(l-d*.5,y,d*.5,f-y),i.fillRect(c,y,d*.5,f-y);let I=d*.055+3,T=I*1.35;i.fillStyle="#03050a",i.beginPath(),i.moveTo(l,f),i.lineTo(l-I,f),i.lineTo(l-T,y),i.lineTo(l+d*.012,y),i.closePath(),i.fill(),i.beginPath(),i.moveTo(c,f),i.lineTo(c+I,f),i.lineTo(c+T,y),i.lineTo(c-d*.012,y),i.closePath(),i.fill(),i.fillRect(l-T,y,d+T*2,(f-y)*.12);let P=m*.14,M=y+(f-y)*.12;i.fillStyle="rgba(4,6,12,0.96)";let C=7;i.beginPath(),i.moveTo(l-T,M);for(let A=0;A<=C;A++){let W=l-T+(d+T*2)*A/C;i.quadraticCurveTo(W-(d+T*2)/C/2,M+P,W,M)}i.lineTo(c+T,M),i.lineTo(c+T,y),i.lineTo(l-T,y),i.closePath(),i.fill(),i.fillStyle=`rgba(${r},0.12)`,i.fillRect(l-1.5,M,1.5,f-M),i.fillRect(c,M,1.5,f-M),i.fillStyle="#0b0f18",i.fillRect(l-I,f-m*.05,d+I*2,m*.05+3);let R=i.createLinearGradient(0,f-m*.05,0,f+m*.12);R.addColorStop(0,`rgba(255,206,140,${(.5*o).toFixed(3)})`),R.addColorStop(1,"rgba(255,206,140,0)"),i.fillStyle=R,i.fillRect(l-I,f-m*.05,d+I*2,m*.2);let B=3+Math.floor(a()*2);for(let A=0;A<B;A++){let W=(A+1)/(B+1),H=l+d*(W+(a()-.5)*.08),N=G(Math.min(62,t+26)),$=(a()-.5)*d*.16;Ht(i,H,N,H+$,f,4,d*.09,r,.16*(.7+o*.5)),Ai(i,H,N,2.4,r)}}function Sr(i,e,t,s,o,n,r){let a=Math.min(e*.6,Math.max(3,s.voidRadiusM)),l=Math.min(55,Math.atan2(a,e)*180/Math.PI),c=K/2,h=1.2,f=Math.max(e*.45,e-a),d=e+a,m=Math.atan2(h-t,f)*180/Math.PI,y=Math.atan2(h-t,d)*180/Math.PI,p=Math.atan2(-t,f)*180/Math.PI,u=G(m),b=G(y),g=G(p),w=Ge(l)-c,k=Math.max(6,(u-b)/2),L=(u+b)/2,S=i.createRadialGradient(c,g,4,c,g,w*2.6);S.addColorStop(0,`rgba(255,206,150,${(.2*o).toFixed(3)})`),S.addColorStop(.5,"rgba(150,140,190,0.08)"),S.addColorStop(1,"rgba(40,44,60,0)"),i.save(),i.globalCompositeOperation="lighter",i.fillStyle=S,i.fillRect(c-w*2.6,b-k,w*5.2,g-b+k+40),i.restore(),i.fillStyle="#0c1019",i.beginPath(),i.moveTo(c-w,L),i.ellipse(c,L,w,k,0,Math.PI,0,!1),i.lineTo(c+w,g),i.ellipse(c,g,w,k,0,0,Math.PI,!1),i.closePath(),i.fill();let v=i.createLinearGradient(0,L,0,g);v.addColorStop(0,`rgba(${n},0.14)`),v.addColorStop(1,"rgba(0,0,0,0)"),i.fillStyle=v,i.fillRect(c-w,L,w*2,g-L);let x=[[{u:-.24,v:.4,lead:!0,pose:3},{u:.34,v:-.04,pose:2},{u:-.52,v:-.38,pose:0}],[{u:.2,v:.34,lead:!0,pose:3},{u:-.3,v:-.08,pose:2}],[{u:-.1,v:.28,lead:!0,pose:1},{u:.44,v:-.2,pose:2},{u:-.46,v:-.14,pose:2},{u:.08,v:-.46,pose:0}]],I=x[Math.floor(r()*x.length)],T=r()<.5?-1:1,P=F=>c+F.u*T*w*.84,M=F=>L+F.v*k*.8,C=I.find(F=>F.lead)??I[0],R=P(C),B=i.createLinearGradient(0,L-k,0,L+k);B.addColorStop(0,"#3d4a72"),B.addColorStop(1,"#232b47"),i.fillStyle=B,i.beginPath(),i.ellipse(c,L,w,k,0,0,E),i.fill();let A=i.createRadialGradient(R,L,2,R,L,w);A.addColorStop(0,`rgba(255,214,160,${(.5*o).toFixed(3)})`),A.addColorStop(1,"rgba(255,214,160,0)"),i.save(),i.globalCompositeOperation="lighter",i.fillStyle=A,i.beginPath(),i.ellipse(c,L,w,k,0,0,E),i.fill(),i.restore(),i.strokeStyle=`rgba(${n},0.7)`,i.lineWidth=2,i.beginPath(),i.ellipse(c,L,w,k,0,0,E),i.stroke();let W=Math.max(24,(g-b)*1.3),H=I.length>=3?3:2;for(let F=0;F<H;F++){let ce=(-.62+F*.52+(r()-.5)*.12)*-T,ge=c+ce*w*.7,He=L-k*(.45+r()*.18),Ce=w*(.07+r()*.04),Xt=W*(.26+r()*.12);i.fillStyle="#0a0e18",i.fillRect(ge-Ce/2,He-Xt,Ce,Xt),i.fillStyle=`rgba(${n},0.3)`,i.fillRect(ge-Ce/2,He-Xt,Ce,1.5)}if(I.length>=3){let F=c-C.u*T*w*.4;i.fillStyle="#0b0f1a",i.beginPath(),i.ellipse(F,L-k*.34,w*.08,k*.1,0,0,E),i.fill(),i.strokeStyle=`rgba(${n},0.35)`,i.lineWidth=1,i.stroke()}for(let F of[...I].sort((ce,ge)=>ce.v-ge.v)){let ce=.82+(F.v+1)*.14;Ei(i,P(F),M(F),W*ce*(F.lead?1.06:.92),{tone:[18,21,34],alpha:.95,pose:F.pose,rim:Q(40,.72,.8),rimStrength:F.lead?1.4:.9})}let N=G(Math.min(60,y+34)),$=k*1.1+6;i.strokeStyle="rgba(60,68,92,0.85)",i.lineWidth=3,i.beginPath(),i.ellipse(c,N,w*1.15,$,0,0,E),i.stroke();let D=4+Math.floor(r()*3);for(let F=0;F<D;F++){let ce=F/D*E,ge=c+Math.cos(ce)*w*1.15,He=N+Math.sin(ce)*$;if(Math.sin(ce)>-.2){let Ce=c+(r()-.5)*w*.8;Ht(i,ge,He,Ce,L,3,w*.32,n,.2*(.7+o*.4))}Ai(i,ge,He,3,n)}let z=G(Math.min(52,y+24)),_=Math.max(60,w*.4),X=Math.max(24,_*.34);i.strokeStyle="rgba(70,78,102,0.6)",i.lineWidth=1.5,i.beginPath(),i.moveTo(c-_*.3,z-X/2),i.lineTo(c-_*.16,z-X*2.2),i.moveTo(c+_*.3,z-X/2),i.lineTo(c+_*.16,z-X*2.2),i.stroke(),i.fillStyle="#0d1220",i.fillRect(c-_/2,z-X/2,_,X);let zt=i.createLinearGradient(0,z-X*.3,0,z+X*.42);zt.addColorStop(0,`rgba(${n},0.5)`),zt.addColorStop(1,"rgba(255,214,160,0.32)"),i.fillStyle=zt,i.fillRect(c-_*.42,z-X*.3,_*.84,X*.72),i.fillStyle="rgba(255,214,160,0.55)",i.fillRect(c-_/2,z+X/2-2,_,2);let Vt=i.createRadialGradient(c,z,4,c,z,_*1.1);Vt.addColorStop(0,`rgba(${n},0.2)`),Vt.addColorStop(1,"rgba(0,0,0,0)"),i.save(),i.globalCompositeOperation="lighter",i.fillStyle=Vt,i.fillRect(c-_*1.1,z-_*.8,_*2.2,_*1.6);let Wt=i.createRadialGradient(c,(N+L)/2,6,c,(N+L)/2,w*1.5);Wt.addColorStop(0,`rgba(${n},${(.1*(.6+o*.5)).toFixed(3)})`),Wt.addColorStop(1,"rgba(0,0,0,0)"),i.fillStyle=Wt,i.fillRect(c-w*1.5,N-40,w*3,L-N+80),i.restore();let jo=c+Math.sign(R-c||1)*w*.5;Ht(i,jo,N-$*.4,R,M(C),2.5,w*.16,"255,224,178",.42*(.7+o*.4));let Kt=i.createRadialGradient(R,M(C),1,R,M(C),w*.2);Kt.addColorStop(0,`rgba(255,228,185,${(.4*o).toFixed(3)})`),Kt.addColorStop(1,"rgba(255,228,185,0)"),i.save(),i.globalCompositeOperation="lighter",i.fillStyle=Kt,i.beginPath(),i.ellipse(R,M(C),w*.2,k*.24,0,0,E),i.fill(),i.restore()}function vr(i,e,t,s,o,n,r,a){let l=K/2,c=Math.max(10,s.voidRadiusM),h=Math.max(2,e-c),f=e+c,d=Math.min(78,Math.atan2(c*1.15,e)*180/Math.PI),m=Math.atan2(-t,h)*180/Math.PI,y=Math.atan2(-t,f)*180/Math.PI,p=G(m),u=G(y),b=Ge(d)-l,g=(p+u)/2,w=Math.max(10,(p-u)/2),k=i.createRadialGradient(l,g,4,l,g,b);k.addColorStop(0,"#e8f0fb"),k.addColorStop(.7,"#b9c9e2"),k.addColorStop(1,"#8fa3c4"),i.save(),i.beginPath(),i.ellipse(l,g,b,w,0,0,E),i.clip(),i.fillStyle=k,i.fillRect(l-b,g-w,b*2,w*2),i.strokeStyle="rgba(90,120,170,0.5)",i.lineWidth=3,i.beginPath(),i.moveTo(l,g-w),i.lineTo(l,g+w),i.moveTo(l-b*.5,g-w),i.lineTo(l-b*.5,g+w),i.moveTo(l+b*.5,g-w),i.lineTo(l+b*.5,g+w),i.stroke(),i.strokeStyle="rgba(180,90,110,0.45)",i.beginPath(),i.ellipse(l,g,w*.9,w*.5,0,0,E),i.stroke(),i.restore(),i.strokeStyle="rgba(210,225,245,0.6)",i.lineWidth=2.5,i.beginPath(),i.ellipse(l,g,b,w,0,0,E),i.stroke(),i.fillStyle="rgba(20,26,40,0.8)";for(let P=0;P<5;P++){let M=l+(a()-.5)*b*1.4,C=g+(a()-.5)*w*1.1,R=Math.max(2,w*.06);i.beginPath(),i.ellipse(M,C,R*.6,R,0,0,E),i.fill()}let L=i.createRadialGradient(l,g,4,l,g,b*1.4);L.addColorStop(0,"rgba(200,220,255,0.12)"),L.addColorStop(1,"rgba(200,220,255,0)"),i.save(),i.globalCompositeOperation="lighter",i.fillStyle=L,i.fillRect(l-b*1.4,u-w,b*2.8,p-u+w*2),i.restore();let S=G(Math.min(66,y+60)),v=Math.max(80,b*.7),x=v*.5,I=i.createRadialGradient(l,S,4,l,S,v*1.6);I.addColorStop(0,`rgba(${r},0.3)`),I.addColorStop(1,`rgba(${r},0)`),i.save(),i.globalCompositeOperation="lighter",i.fillStyle=I,i.fillRect(l-v*1.6,S-v*1.2,v*3.2,v*2.4),i.restore(),i.fillStyle="#080b12",i.beginPath(),i.moveTo(l-v/2,S-x/2),i.lineTo(l+v/2,S-x/2),i.lineTo(l+v*.6,S),i.lineTo(l+v/2,S+x/2),i.lineTo(l-v/2,S+x/2),i.lineTo(l-v*.6,S),i.closePath(),i.fill();let T=n;for(let P=0;P<3;P++){let M=Q(T+P*30,.5,.5);i.fillStyle=`rgba(${M[0]},${M[1]},${M[2]},0.75)`;let C=v*.26;i.fillRect(l-v*.42+P*(C+v*.06),S-x*.32,C,x*.64)}i.fillStyle=`rgba(${r},0.9)`;for(let P=0;P<8;P++){let M=l-v*.6+v*1.2*P/7;i.beginPath(),i.arc(M,S+x*.62,2.4,0,E),i.fill()}}function wr(i,e,t,s,o,n,r,a,l,c){let h=e.sectionId,f=!1,d=[];for(let p of t){if(p.id===e.id)continue;let u=p.x-e.x,b=p.y-e.y,g=Math.hypot(u,b)*at;if(h&&p.sectionId===h&&g<3&&u*r+b*a>0&&(f=!0),g<.3||g>32)continue;let k=((Math.atan2(u,-b)-o)*180/Math.PI+540)%360-180,L=l?(p.eyeHeightM??Y)-n:0,S=Math.atan2(L-.28,g)*180/Math.PI;if(S>10&&g>5)continue;let v=0;for(let T=0;T<p.id.length;T++)v=v*31+p.id.charCodeAt(T)&65535;let x=.9+(v&15)/40,I=Math.min(78,Math.atan2(.16,g)*180/Math.PI*cr*x);I<1.2||d.push({hx:Ge(k),hy:G(S),r:I,d:g,hash:v})}d.sort((p,u)=>u.d-p.d);let m=[];{let p=[...d].sort((g,w)=>g.hy-w.hy),u=[],b=()=>{if(!u.length)return;let g=u.reduce((L,S)=>L+S.d,0)/u.length,w=u.reduce((L,S)=>L+S.hy,0)/u.length,k=u.reduce((L,S)=>L+S.r,0)/u.length;m.push({figs:u.sort((L,S)=>S.d-L.d),d:g,hy:w,r:k}),u=[]};for(let g of p){let w=u[u.length-1];w&&Math.abs(g.hy-w.hy)>Math.max(5,(w.r+g.r)/2*1.7)&&b(),u.push(g)}b()}m.sort((p,u)=>u.d-p.d);let y=[[22,26,40],[28,27,42],[24,31,46],[31,30,47],[20,24,36]];for(let p of m){if(p.figs.length>=3&&p.r>=1.6&&p.r<26){let u=[],b=[...p.figs].sort((k,L)=>k.hx-L.hx),g=[];for(let k of b){let L=g[g.length-1];L&&k.hx-L.hx>Math.max(14,k.r*7)&&(g.length>=3&&u.push(g),g=[]),g.push(k)}g.length>=3&&u.push(g);let w=Math.min(.42,.5*(1-p.d/42));if(w>.05){i.fillStyle=`rgba(15, 19, 31, ${w.toFixed(3)})`;for(let k of u){let L=k[0].hx-p.r*1.6,S=k[k.length-1].hx+p.r*1.6;i.beginPath(),i.roundRect(L,p.hy+p.r*.8,S-L,p.r*2.4,p.r*.8),i.fill()}}}for(let u of p.figs){let b=u.d<12?.95:u.d<17?Math.max(.66,.95-(u.d-12)/18):Math.max(.3,.68-(u.d-17)/34),g=Math.round((1-Math.min(1,u.d/16))*10),w=[14+(u.hash>>4&6)+g,17+(u.hash>>4&6)+g,25+(u.hash>>4&6)+g],k=y[u.hash%y.length],L=[k[0]+g,k[1]+g,k[2]+g];if(u.r>=13){let S=u.d<9?.16*(1-u.d/9)+(c.mode==="proscenium"?.06:0):0;mr(i,u.hx,u.hy,u.r,{tone:w,clothing:L,alpha:b,tilt:((u.hash>>2&7)-3.5)*.018,shoulderK:1.72+(u.hash>>5&7)/22,hair:u.hash%fr,rim:S,turn:((u.hash>>8&7)-3.5)*.034,lean:((u.hash>>10&3)-1.5)*.09})}else u.r>=5.5?gr(i,u.hx,u.hy,u.r,L,w,b):(i.fillStyle=`rgba(${w[0]},${w[1]},${w[2]},${b.toFixed(3)})`,i.beginPath(),i.arc(u.hx,u.hy,u.r,0,E),i.fill(),i.beginPath(),i.ellipse(u.hx,u.hy+u.r*1.4,u.r*1.85,u.r*.95,0,Math.PI,0,!0),i.fill())}}if(f){let p=G(-34);i.fillStyle="rgba(6, 8, 14, 0.92)",i.fillRect(0,p,K,le-p),i.fillStyle="rgba(24, 30, 46, 0.9)";let u=16;for(let b=0;b<u;b++){let g=(b+.5)/u*K;i.beginPath(),i.ellipse(g,p+6,K/u*.42,22,0,Math.PI,0,!0),i.fill()}}}var j=480,Oe=270,Ri=50,Ie=30,qo=i=>(i+Ri)/(2*Ri)*j,rt=i=>(Ie-i)/(2*Ie)*Oe;function Lh(i,e,t){let s=document.createElement("canvas");s.width=j,s.height=Oe;let o=s.getContext("2d"),n=e.x-i.x,r=e.y-i.y,a=Math.max(2,Math.hypot(n,r)*at),l=Zo(Uo(`${i.id}|${Math.round(e.x)},${Math.round(e.y)}`)),c=210+l()*150,h=Q(220+(l()-.5)*60,.55,.82),f=`${h[0]},${h[1]},${h[2]}`,d=o.createLinearGradient(0,0,0,Oe);d.addColorStop(0,"#080b12"),d.addColorStop(.44,"#151c32"),d.addColorStop(.5,"#1d2644"),d.addColorStop(.58,"#161c2e"),d.addColorStop(1,"#131829"),o.fillStyle=d,o.fillRect(0,0,j,Oe);let m=i.eyeHeightM??Y,y=Ci(m,a),p=Math.min(Ri-2,Math.atan2(4,a)*180/Math.PI),u=Math.min(Ie-2,y.topPitch),b=Math.max(-Ie+2,y.basePitch),g=qo(-p),w=qo(p),k=rt(u),L=rt(b),S=w-g,v=L-k,x=Math.max(.35,Math.min(1,1-(a-6)/60)),I=rt(Math.min(Ie-1,u+8)),T=o.createRadialGradient(j/2,(k+L)/2,4,j/2,(k+L)/2,S*1.15);T.addColorStop(0,"rgba(255,214,150,0.34)"),T.addColorStop(.28,"rgba(150,150,230,0.3)"),T.addColorStop(.6,"rgba(99,102,241,0.12)"),T.addColorStop(1,"rgba(99,102,241,0)"),o.fillStyle=T,o.fillRect(g-S*.6,k-v*1.2,S*2.2,v*3.4);let P=Q(c,.62,.55),M=Q(c+40,.7,.5),C=Q(c+70,.78,.52);o.save(),o.beginPath(),o.rect(g,k,S,v),o.clip();let R=o.createLinearGradient(0,k,0,L);R.addColorStop(0,`rgb(${P[0]},${P[1]},${P[2]})`),R.addColorStop(.5,`rgb(${M[0]},${M[1]},${M[2]})`),R.addColorStop(1,`rgb(${C[0]},${C[1]},${C[2]})`),o.globalAlpha=.8,o.fillStyle=R,o.fillRect(g,k,S,v),o.globalAlpha=1;let B=o.createRadialGradient(j/2,(k+L)/2,S*.12,j/2,(k+L)/2,S*.6);B.addColorStop(0,"rgba(6,8,14,0)"),B.addColorStop(.7,"rgba(6,8,14,0.15)"),B.addColorStop(1,"rgba(5,6,11,0.9)"),o.fillStyle=B,o.fillRect(g,k,S,v),o.restore();let A=3,W=L-v*.08;for(let D=0;D<A;D++){let z=(D+1)/(A+1);Ei(o,g+S*(.24+z*.52),W,v*.46*(.9+l()*.24),{tone:[8,10,16],alpha:.9,pose:Math.floor(l()*4),rim:Q(c+20,.5,.7),rimStrength:.7})}o.fillStyle="#05070d",o.fillRect(g-S*.5,I,S*.5,L-I),o.fillRect(w,I,S*.5,L-I);let H=S*.05+2,N=H*1.35;o.fillStyle="#03050a",o.beginPath(),o.moveTo(g,L),o.lineTo(g-H,L),o.lineTo(g-N,I),o.lineTo(g+S*.012,I),o.closePath(),o.fill(),o.beginPath(),o.moveTo(w,L),o.lineTo(w+H,L),o.lineTo(w+N,I),o.lineTo(w-S*.012,I),o.closePath(),o.fill(),o.fillRect(g-N,I,S+N*2,(L-I)*.13),o.fillStyle=`rgba(${f},0.12)`,o.fillRect(g-1.2,I,1.2,L-I),o.fillRect(w,I,1.2,L-I),o.fillStyle="#0b0f18",o.fillRect(g-H,L-v*.05,S+H*2,v*.05+2);let $=o.createLinearGradient(0,L-v*.05,0,L+v*.14);$.addColorStop(0,`rgba(255,206,140,${(.5*x).toFixed(3)})`),$.addColorStop(1,"rgba(255,206,140,0)"),o.fillStyle=$,o.fillRect(g-H,L-v*.05,S+H*2,v*.22);for(let D=0;D<3;D++){let z=(D+1)/4,_=g+S*z,X=rt(Math.min(Ie-1,u+20));Ht(o,_,X,_+(l()-.5)*S*.14,L,3,S*.09,f,.17*x),Ai(o,_,X,1.8,f)}o.fillStyle=`rgba(${f},0.75)`;for(let D=0;D<8;D++)o.beginPath(),o.arc((D+.5)/8*j,rt(Ie-4-D%2*3),2.2,0,E),o.fill();o.fillStyle="rgba(10,13,20,0.9)",o.fillRect(0,Oe-26,j,26),o.fillStyle="rgba(30,37,54,0.9)";for(let D=0;D<9;D++){let z=D*(j/9)+j/18;o.beginPath(),o.ellipse(z,Oe-22,j/9*.4,15,0,Math.PI,0,!0),o.fill()}return{url:s.toDataURL("image/jpeg",.8),distanceM:Math.round(a)}}var Qo=new Set(["en"]),Nt=new Map;async function kr(i){if(typeof __SEATLAYER_CDN__<"u"&&__SEATLAYER_CDN__)return(await import(fs(`i18n/${i}.mjs`))).default??null;let{LOADERS:e}=await import("./localeLoaders-KUIWB7O3.js"),t=e[i];return t?await t():null}async function Mh(i,e){let t=Cs(i,e);if(t==="en"||Qo.has(t))return Re(t),t;if(!Is.includes(t))return Re("en"),"en";try{let s=Nt.get(t);s||(s=kr(t),Nt.set(t,s));let o=await s;return Nt.delete(t),o?(Re(t,o),Qo.add(t),t):(Re("en"),"en")}catch{return Nt.delete(t),Re("en"),"en"}}export{Cr as ACCESSIBILITY_RING_COLOR,Tr as ACCESSIBILITY_TYPES,Lr as CHART_STORAGE_KEY,da as CURRENCY_CHOICES,ha as DEFAULT_CURRENCY,Rr as LABEL_STYLE_MAX_SIZE,xr as LABEL_STYLE_MIN_SIZE,Sa as LOCALE_NAMES,Qr as MAX_EVENT_INVENTORY,Zr as MAX_GA_CAPACITY,Ko as PickerController,me as PickerSelectionError,na as RENDERED_QUALITY_REPORT_VERSION,Mr as SEAT_COMMERCIAL_MARKS,nn as SUPPORTED_LOCALES,Er as SURROUNDINGS_SHAPE_ROLES,Li as SeatmapRenderer,Fr as TABLE_SEAT_OFFSET,Br as TIER_HEIGHT_M,Is as TRANSLATED_LOCALES,Wi as UNGROUPED_ID,Ir as accessibilityMeta,$t as accessibilityRingColor,Oi as allObjects,Ki as applyHidden,Vi as chartBounds,Yt as computeSections,Do as createRenderer,sn as currencyExponent,ua as currencySymbol,Wr as expandBooth,Ne as expandChart,Gr as expandRow,Or as expandRowSlots,Vr as expandTable,Nr as expandTableSlots,Yr as floorObjects,Ur as floorOverviewTranslations,ht as floorsOf,Ni as floorsShareFootprint,Ia as formatDate,pa as formatMinor,ii as formatMoney,on as fromMinorUnits,ze as gaAreasOf,ea as gaInventorySegments,jr as gaUnitLabel,dt as gaUnitLabels,kh as generateSeatPanorama,Lh as generateSeatThumb,va as getLocale,ta as growJoinedGAInventory,oa as hiddenObjectIds,ra as inspectRenderedQualityEvidence,ia as isGaUnitLabel,ka as isLocaleLoaded,sa as isSectionHidden,Ar as layerOf,Hi as layoutFloorOverview,zi as layoutFloorRings,Mh as loadLocale,wa as localeDirection,Xr as objectCenter,$r as owningSectionForObject,Kr as pointInPolygon,J as pointInPolygonWithHoles,ct as polygonLabelPoint,Cs as resolveLocale,_r as rowInventoryCount,Dr as rowSeatPositions,Pr as seatCommercialMeta,lt as sectionGeometry,Re as setLocale,Ts as setMoneyLocale,La as setStringOverrides,Gi as stackFloors,U as t,Ta as tCount,zr as tableInventoryCount,Hr as tableSeatCountsBySide,qr as translateObject,Jr as validGAInventorySegments};
|