@seatlayer/js 0.103.0 → 0.104.0

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.
@@ -1 +1 @@
1
- import{t as C}from"@seatlayer/core";import{cdnAssetUrl as P}from"@seatlayer/core/core/cdnAsset";var A=/^data:image\/(?:png|jpe?g|webp|gif|avif);base64,[a-z0-9+/]+={0,2}$/i,T=/[\s"'<>`\\]/;function E(i){return i.startsWith("//")?!1:i.startsWith("/")||i.startsWith("./")||i.startsWith("../")}function S(){try{let i=typeof location>"u"?"":location.origin;return i&&i!=="null"?i:null}catch{return null}}function x(i){if(typeof i!="string"||!i||i.length>2e6||i!==i.trim())return!1;if(i.startsWith("data:"))return A.test(i);if(T.test(i))return!1;let t=S();if(E(i)){if(!t)return!1;try{let n=new URL(i,t);return n.origin===t&&!n.username&&!n.password}catch{return!1}}try{let n=new URL(i);return n.username||n.password?!1:n.protocol==="https:"||t!=null&&n.origin===t}catch{return!1}}import{SEATLAYER_MODULE_URL as se}from"@seatlayer/core/core/cdnAsset";function d(i,t){let n=C(i);return n===i?t:n}function B(){return globalThis.matchMedia?.("(pointer: coarse)").matches??!1?d("picker.dragToLookTouch","Drag to look \xB7 pinch to zoom \xB7 tap \u2715 to close"):d("picker.dragToLookMouse","Drag to look \xB7 pinch or scroll to zoom \xB7 Esc to close")}function X(){return{rotate:d("picker.dragToRotateVenue","Drag to rotate the venue"),move:d("picker.dragToMoveVenue","Drag to move the venue"),zoomIn:d("picker.zoomIn","Zoom in"),zoomOut:d("picker.zoomOut","Zoom out"),fitView:d("picker.fitWholeVenue","Show whole venue")}}function G(i,t){let n=t?i.toLocaleUpperCase(t):i.toLocaleUpperCase(),e=t?i.toLocaleLowerCase(t):i.toLocaleLowerCase();if(i!==n||n===e)return i;let o=[...e][0]??"";return(t?o.toLocaleUpperCase(t):o.toLocaleUpperCase())+e.slice(o.length)}function j(i){if(typeof i=="string"){let t=document.querySelector(i);if(!t)throw new Error(`seatmap: container "${i}" not found`);return t}if(!(i instanceof HTMLElement))throw new Error("seatmap: container must be a CSS selector or an HTMLElement");return i}function q(i){return String(i??"").replace(/[&<>"']/g,t=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[t])}function K(i,t,n){let e=t.find(s=>x(s))??null;if(i.replaceChildren(),!e)return i.textContent=n.slice(0,1).toUpperCase(),null;let o=document.createElement("img");return o.alt="",o.referrerPolicy="no-referrer",o.src=e,i.appendChild(o),e}var b=null;function Z(){if(b!==null)return b;try{if(typeof document>"u")return b=!1;b=!!document.createElement("canvas").getContext("webgl2")}catch{b=!1}return b}function y(i){return P(i)}var v=null;function _(){return v||(v=(typeof __SEATLAYER_CDN__<"u"&&__SEATLAYER_CDN__?import(y("seatlayer-view3d.mjs")):import("@seatlayer/core/view3d")).catch(t=>{throw v=null,t}),v)}function z(){(typeof navigator>"u"?void 0:navigator.connection)?.saveData||_().catch(()=>{})}async function J(){return typeof __SEATLAYER_CDN__<"u"&&__SEATLAYER_CDN__?import(y("seatlayer-panorama.mjs")):import("@seatlayer/core")}async function Q(){return typeof __SEATLAYER_CDN__<"u"&&__SEATLAYER_CDN__?import(y("seatlayer-checkout.mjs")):import("./hostedCheckout-XSQ7ISQC.js")}function ee(i){return i==="unavailable_for_event"||i==="payments_off_for_event"?i:"not_configured"}function te(i){return i.lineItems.reduce((t,n)=>t+n.quantity,0)}function M(i,t){if(i.objectType!=="ga")return i.displayLabel??i.label;let n=t.find(e=>e.id===i.objectId);return i.displayLabel??n?.displayLabel??n?.label??d("picker.generalAdmission","General admission")}function R(i,t){let n=new Map;for(let e of i){let o=e.rowLabel&&e.seatNumber?[e.sectionLabel,`${d("picker.row","Row")} ${e.rowLabel}`,`${d("picker.seat","Seat")} ${e.seatNumber}`].filter(Boolean).join(" \xB7 "):M(e,t),s=[e.categoryLabel,e.tierLabel].filter(Boolean).join(" \xB7 "),a=Math.max(1,Math.floor(e.quantity||1)),u=`${o}\0${s}`,c=n.get(u)??{label:o,detail:s,units:0,amount:0};c.units+=a,c.amount+=e.unitPrice*a,n.set(u,c)}return[...n.values()].map(e=>({label:e.units>1?`${e.label} \xD7${e.units}`:e.label,...e.detail?{detail:e.detail}:{},amount:e.amount}))}var L=(i,t,n)=>C("picker.bookingForm.guestOfCount",{label:i,index:t,total:n});function I(i,t,n=[]){let e=new Map,o=[];for(let l of i.lineItems){let r=M(l,n),f=Math.max(1,Math.floor(l.quantity)||1);if(l.objectType!=="ga"&&!(l.objectType==="table"&&f>1)){o.push({key:l.label,name:r,unitIndex:1,quantity:1});continue}for(let h=1;h<=f;h+=1){let m=(e.get(l.label)??0)+1;e.set(l.label,m),o.push({key:`${l.label}#${m}`,name:r,unitIndex:h,quantity:f})}}let s=t?.ticketKeyDetails??[],a=t?.ticketKeys??s.map(l=>l.ticketKey),u=(a.length===o.length?a:o.map(l=>l.key)).map(l=>{let r=o.find(h=>h.key===l),f=s.find(h=>h.ticketKey===l);return{key:l,name:f?.displayLabel??r?.name,unitIndex:f?.unitIndex??r?.unitIndex??1,quantity:f?.quantity??r?.quantity??1}}),c=new Map;for(let l of u)l.name&&l.quantity<=1&&c.set(l.name,(c.get(l.name)??0)+1);let p=new Map;return u.map(({key:l,name:r,unitIndex:f,quantity:h})=>{if(!r)return{key:l};if(h>1)return{key:l,title:L(r,f,h)};let m=(p.get(r)??0)+1;p.set(r,m);let g=c.get(r)??1;return{key:l,title:g>1?L(r,m,g):r}})}function ne(i,t,n,e,o=[]){let s=new Map;for(let a of i.lineItems){let u=M(a,o);s.set(u,(s.get(u)??0)+1)}return{kind:"pay",provider:t,order:{holdId:i.holdId,expiresAt:i.expiresAt,currency:i.currency,total:i.total,labels:[...s].map(([a,u])=>u>1?`${a} \xD7${u}`:a),tickets:I(i,e,o),lines:R(i.lineItems,o)},bookingForm:n?.bookingForm??null,...n?.bookingMode==="free"?{free:!0}:{}}}function ie(i){return String(i?.code).startsWith("booking_form_")}function oe(i,t,n){let e={month:"short",day:"numeric",hour:"numeric",minute:"2-digit"},o=new Date(i);if(t)try{return o.toLocaleString(n,{...e,timeZone:t})}catch{}return o.toLocaleString(n,e)}function le(i){return i.focusedSection!==null?i.deeperThanSectionFrame===!1?"venue":"section":i.atVenueFit!==void 0?i.atVenueFit?"none":"venue":i.seatsRevealed?"venue":"none"}import{pointInPolygon as D}from"@seatlayer/core";import{createMinimapTransform as H,minimapPointToWorld as O,minimapViewportPlan as V}from"@seatlayer/core/picker/minimapGeometry";function W(i){let t={inactive:0,available:1,selected:2},n=new Map;for(let o of i){let s=n.get(o.id);(!s||t[o.state]>t[s])&&n.set(o.id,o.state)}let e={selected:0,available:0,inactive:0};for(let o of n.values())e[o]+=1;return e}function N(i,t){return i.x<=t.x&&i.y<=t.y&&i.x+i.width>=t.x+t.width&&i.y+i.height>=t.y+t.height}function he(i,t){let n=new w(i);return n.build(t),n}var w=class{constructor(t){this.host=t;this.miniCanvas=null;this.miniBase=null;this.miniWrap=null;this.miniToggle=null;this.miniLabel=null;this.miniTf=null;this.miniDrag=null;this.miniSuppressClick=!1;this.userClosed=!1}dispose(){this.miniToggle?.remove(),this.miniWrap?.remove(),this.miniToggle=null,this.miniWrap=null,this.miniCanvas=null,this.miniBase=null,this.miniLabel=null,this.miniTf=null,this.miniDrag=null,this.host.root()?.removeAttribute("data-minimap-open")}build(t){if(!this.host.controller.getViewport())return;let e=document.createElement("button");e.type="button",e.className="sl-minimap-toggle",e.setAttribute("aria-label",d("picker.openVenueMap","Open venue overview map")),e.setAttribute("aria-expanded","false"),e.innerHTML='<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M3 6l5-2 8 3 5-2v13l-5 2-8-3-5 2zM8 4v13M16 7v13"/></svg>',t.appendChild(e),this.miniToggle=e;let o=document.createElement("div");o.className="sl-minimap",o.setAttribute("role","group");let s=document.createElement("div");s.className="sl-minimap-bar";let a=document.createElement("span");a.className="sl-minimap-label";let u=document.createElement("span");u.className="sl-minimap-key",u.setAttribute("aria-label",d("picker.minimapStateKey","Focused, selected, available, and inactive sections")),u.innerHTML='<i class="focused" title="Focused"></i><i class="selected" title="Selected"></i><i title="Available"></i><i class="inactive" title="Inactive"></i>';let c=document.createElement("button");c.type="button",c.className="sl-minimap-close",c.setAttribute("aria-label",d("picker.closeVenueMap","Close venue overview map")),c.textContent="\xD7",s.append(a,u,c);let p=document.createElement("canvas");p.tabIndex=0,p.setAttribute("role","application"),p.setAttribute("aria-label",d("picker.venueMapInstructions","Venue overview map. Drag the viewport, click a section, or use arrow keys to pan.")),o.append(s,p),t.appendChild(o),this.miniWrap=o,this.miniLabel=a,this.miniCanvas=p;let l=document.createElement("canvas");this.miniBase=l,e.addEventListener("click",()=>{let r=this.host.root()?.dataset.minimapOpen==="true";this.userClosed=r,this.setMinimapOpen(!r)}),c.addEventListener("click",()=>{this.userClosed=!0,this.setMinimapOpen(!1)}),p.addEventListener("click",r=>{if(this.miniSuppressClick){this.miniSuppressClick=!1;return}this.minimapJump(r)}),p.addEventListener("pointerdown",r=>this.minimapPointerDown(r)),p.addEventListener("pointermove",r=>this.minimapPointerMove(r)),p.addEventListener("pointerup",r=>this.minimapPointerUp(r)),p.addEventListener("pointercancel",r=>this.minimapPointerUp(r)),p.addEventListener("keydown",r=>this.minimapKeydown(r)),this.layoutMinimap(),this.syncMinimapLabel(),this.drawMinimapStatic(),this.drawMinimapRect()}setAutoOpen(t){if(this.miniWrap){if(!t){this.userClosed=!1,this.host.root()?.dataset.minimapOpen==="true"&&this.setMinimapOpen(!1,!1);return}this.userClosed||this.host.root()?.dataset.minimapOpen==="true"||this.setMinimapOpen(!0,!1)}}setMinimapOpen(t,n=!0){this.host.root()?.setAttribute("data-minimap-open",String(t)),this.miniToggle?.setAttribute("aria-expanded",String(t)),n&&(t?this.miniCanvas?.focus():this.miniToggle?.focus())}layoutMinimap(){let t=this.miniCanvas,n=this.miniBase,e=this.host.controller.getViewport()?.bounds;if(!t||!n||!e||!(e.width>0&&e.height>0))return;let o=196,s=146,a=6,u=e.width/Math.max(1,e.height),c=o,p=Math.round(o/u);p>s&&(p=s,c=Math.round(s*u)),c=Math.max(64,c),p=Math.max(48,p);let l=Math.min(2,window.devicePixelRatio||1);t.width=Math.round(c*l),t.height=Math.round(p*l),t.style.width=`${c}px`,t.style.height=`${p}px`,n.width=t.width,n.height=t.height,this.miniTf=H(e,t.width,t.height,l,a)}syncMinimapLabel(){if(!this.miniLabel||!this.miniWrap)return;let t=this.host.controller.getFloors(),n=this.host.controller.isFloorOverview()?d("picker.allFloors","All floors"):t.find(l=>l.id===this.host.controller.getActiveFloorId())?.name??d("picker.venueOverview","Venue overview"),e=this.host.controller.getMinimapSnapshot().sections,s=e.find(l=>l.active)?.label??this.host.focusedSectionLabel(),a=s?`${n} \xB7 ${s}`:n;this.miniLabel.textContent=a;let{selected:u,available:c,inactive:p}=W(e);this.miniWrap.setAttribute("aria-label",e.length?`${a}. ${u} selected, ${c} available, ${p} inactive sections.`:a),this.miniCanvas?.setAttribute("aria-label",e.length?`${a}. ${u} selected, ${c} available, ${p} inactive sections. ${d("picker.venueMapInstructions","The outlined region is the visible map area. Drag it, click a section, or use arrow keys to pan.")}`:`${a}. ${d("picker.venueMapInstructions","The outlined region is the visible map area. Drag it, click elsewhere, or use arrow keys to pan.")}`)}refreshMinimap(){this.miniBase&&(this.layoutMinimap(),this.syncMinimapLabel(),this.drawMinimapStatic(),this.drawMinimapRect())}drawMinimapStatic(){let t=this.miniBase,n=this.miniTf;if(!t||!n)return;let e=t.getContext("2d");if(!e)return;e.clearRect(0,0,t.width,t.height);let o=r=>r*n.scale+n.offX,s=r=>r*n.scale+n.offY,a=this.host.cssVar("--sl-line")||"rgba(139,147,167,.5)",u=this.host.cssVar("--sl-muted")||"#8b93a7",c=this.host.cssVar("--sl-accent")||"#6e7bff",p=this.host.cssVar("--sl-success")||"#22a06b",l=this.host.controller.getMinimapSnapshot();for(let r of l.sections){if(r.outline.length<3)continue;e.beginPath(),r.outline.forEach((h,m)=>m===0?e.moveTo(o(h.x),s(h.y)):e.lineTo(o(h.x),s(h.y))),e.closePath();let f=r.paint;if(e.globalAlpha=r.state==="inactive"?.5:.92,f?e.fillStyle=f.fill:(e.globalAlpha=r.state==="inactive"?.18:r.state==="selected"?.72:.34,e.fillStyle=r.state==="inactive"?u:r.state==="selected"?c:p),e.fill(),e.globalAlpha=.82,e.lineWidth=Math.max(1,n.dpr),e.strokeStyle=f?.stroke||a,e.stroke(),r.owned){e.globalAlpha=1,e.lineWidth=Math.max(2,n.dpr*1.5),e.strokeStyle=c,e.stroke();let h=r.outline.reduce((m,g)=>({x:m.x+g.x,y:m.y+g.y}),{x:0,y:0});e.beginPath(),e.arc(o(h.x/r.outline.length),s(h.y/r.outline.length),Math.max(1.5,n.dpr*1.6),0,Math.PI*2),e.fillStyle=c,e.fill(),e.beginPath(),r.outline.forEach((m,g)=>g===0?e.moveTo(o(m.x),s(m.y)):e.lineTo(o(m.x),s(m.y))),e.closePath()}r.active&&(e.globalAlpha=1,e.lineJoin="round",e.lineWidth=Math.max(4,n.dpr*3.5),e.strokeStyle=this.host.cssVar("--sl-surface")||"#fff",e.stroke(),e.lineWidth=Math.max(2,n.dpr*1.75),e.strokeStyle=c,e.stroke())}if(e.globalAlpha=1,!l.sections.length){let r=Math.max(1,n.dpr),f=new Map,h=m=>{let g=f.get(m);if(g)return g;let k=this.host.tint?.(m)||p;return f.set(m,k),k};for(let m of l.seats)e.globalAlpha=m.state==="inactive"?.22:.78,e.fillStyle=m.state==="inactive"?u:m.state==="selected"?c:h(m.categoryKey),e.beginPath(),e.arc(o(m.x),s(m.y),r,0,Math.PI*2),e.fill();e.globalAlpha=1}}drawMinimapRect(){let t=this.miniCanvas,n=this.miniBase,e=this.miniTf;if(!t||!n||!e)return;let o=t.getContext("2d");if(!o)return;o.clearRect(0,0,t.width,t.height),o.drawImage(n,0,0);let s=this.host.controller.getViewport();if(!s||N(s.visible,s.bounds))return;let a=V(s.visible,e,t.width,t.height,Math.max(2,e.dpr*2)),u=this.host.cssVar("--sl-text")||"#12151c",c=this.host.cssVar("--sl-surface")||"#fff";o.save(),o.globalAlpha=.1,o.fillStyle=u,o.fillRect(a.raw.x,a.raw.y,a.raw.width,a.raw.height),o.globalAlpha=.9,o.lineJoin="round",o.lineWidth=Math.max(4,e.dpr*3.25),o.strokeStyle=c,o.strokeRect(a.raw.x,a.raw.y,a.raw.width,a.raw.height),o.globalAlpha=1,o.lineWidth=Math.max(2,e.dpr*1.75),o.strokeStyle=u,o.strokeRect(a.raw.x,a.raw.y,a.raw.width,a.raw.height),a.clipped&&Object.values(a.clippedEdges).some(Boolean)&&(o.setLineDash([Math.max(3,e.dpr*3),Math.max(2,e.dpr*2)]),o.strokeRect(a.clipped.x,a.clipped.y,a.clipped.width,a.clipped.height)),o.restore()}minimapWorldPoint(t){let n=this.miniCanvas,e=this.miniTf;if(!n||!e)return null;let o=n.getBoundingClientRect(),s=(t.clientX-o.left)*(n.width/Math.max(1,o.width)),a=(t.clientY-o.top)*(n.height/Math.max(1,o.height));return{...O({x:s,y:a},e),px:s,py:a}}minimapPointerDown(t){let n=this.minimapWorldPoint(t),e=this.host.controller.getViewport()?.visible;!n||!e||!(n.x>=e.x&&n.x<=e.x+e.width&&n.y>=e.y&&n.y<=e.y+e.height)||(this.miniDrag={pointerId:t.pointerId,offsetX:n.x-(e.x+e.width/2),offsetY:n.y-(e.y+e.height/2),startX:t.clientX,startY:t.clientY,moved:!1},this.miniCanvas?.setPointerCapture(t.pointerId),this.miniCanvas?.classList.add("sl-dragging"),t.preventDefault())}minimapPointerMove(t){let n=this.miniDrag;if(!n||n.pointerId!==t.pointerId)return;let e=this.minimapWorldPoint(t);e&&(!n.moved&&Math.hypot(t.clientX-n.startX,t.clientY-n.startY)>2&&(n.moved=!0,this.host.controller.clearSectionFocus()),this.host.controller.panToWorld({x:e.x-n.offsetX,y:e.y-n.offsetY}),t.preventDefault())}minimapPointerUp(t){let n=this.miniDrag;!n||n.pointerId!==t.pointerId||(this.miniSuppressClick=n.moved,this.miniDrag=null,this.miniCanvas?.classList.remove("sl-dragging"),this.miniCanvas?.hasPointerCapture(t.pointerId)&&this.miniCanvas.releasePointerCapture(t.pointerId))}minimapKeydown(t){let n=this.host.controller.getViewport()?.visible;if(!n)return;if(t.key==="Home"){this.host.controller.overview(),t.preventDefault();return}let e=t.key==="ArrowLeft"?-n.width*.2:t.key==="ArrowRight"?n.width*.2:0,o=t.key==="ArrowUp"?-n.height*.2:t.key==="ArrowDown"?n.height*.2:0;!e&&!o||(this.host.controller.clearSectionFocus(),this.host.controller.panToWorld({x:n.x+n.width/2+e,y:n.y+n.height/2+o}),t.preventDefault())}minimapJump(t){let n=this.minimapWorldPoint(t);if(n){for(let e of this.host.controller.getMinimapSnapshot().sections)if(!(e.state==="inactive"||e.outline.length<3)&&D(n,e.outline)){this.host.controller.focusSection(e.id);return}this.host.controller.clearSectionFocus(),this.host.controller.panToWorld(n)}}};export{x as a,d as b,B as c,X as d,G as e,j as f,q as g,K as h,Z as i,_ as j,z as k,J as l,Q as m,ee as n,te as o,ne as p,ie as q,oe as r,le as s,he as t};
1
+ import{t as C}from"@seatlayer/core";import{cdnAssetUrl as P}from"@seatlayer/core/core/cdnAsset";var A=/^data:image\/(?:png|jpe?g|webp|gif|avif);base64,[a-z0-9+/]+={0,2}$/i,T=/[\s"'<>`\\]/;function E(i){return i.startsWith("//")?!1:i.startsWith("/")||i.startsWith("./")||i.startsWith("../")}function S(){try{let i=typeof location>"u"?"":location.origin;return i&&i!=="null"?i:null}catch{return null}}function x(i){if(typeof i!="string"||!i||i.length>2e6||i!==i.trim())return!1;if(i.startsWith("data:"))return A.test(i);if(T.test(i))return!1;let t=S();if(E(i)){if(!t)return!1;try{let n=new URL(i,t);return n.origin===t&&!n.username&&!n.password}catch{return!1}}try{let n=new URL(i);return n.username||n.password?!1:n.protocol==="https:"||t!=null&&n.origin===t}catch{return!1}}import{SEATLAYER_MODULE_URL as se}from"@seatlayer/core/core/cdnAsset";function d(i,t){let n=C(i);return n===i?t:n}function B(){return globalThis.matchMedia?.("(pointer: coarse)").matches??!1?d("picker.dragToLookTouch","Drag to look \xB7 pinch to zoom \xB7 tap \u2715 to close"):d("picker.dragToLookMouse","Drag to look \xB7 pinch or scroll to zoom \xB7 Esc to close")}function X(){return{rotate:d("picker.dragToRotateVenue","Drag to rotate the venue"),move:d("picker.dragToMoveVenue","Drag to move the venue"),zoomIn:d("picker.zoomIn","Zoom in"),zoomOut:d("picker.zoomOut","Zoom out"),fitView:d("picker.fitWholeVenue","Show whole venue")}}function G(i,t){let n=t?i.toLocaleUpperCase(t):i.toLocaleUpperCase(),e=t?i.toLocaleLowerCase(t):i.toLocaleLowerCase();if(i!==n||n===e)return i;let o=[...e][0]??"";return(t?o.toLocaleUpperCase(t):o.toLocaleUpperCase())+e.slice(o.length)}function j(i){if(typeof i=="string"){let t=document.querySelector(i);if(!t)throw new Error(`seatmap: container "${i}" not found`);return t}if(!(i instanceof HTMLElement))throw new Error("seatmap: container must be a CSS selector or an HTMLElement");return i}function q(i){return String(i??"").replace(/[&<>"']/g,t=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[t])}function K(i,t,n){let e=t.find(s=>x(s))??null;if(i.replaceChildren(),!e)return i.textContent=n.slice(0,1).toUpperCase(),null;let o=document.createElement("img");return o.alt="",o.referrerPolicy="no-referrer",o.src=e,i.appendChild(o),e}var b=null;function Z(){if(b!==null)return b;try{if(typeof document>"u")return b=!1;b=!!document.createElement("canvas").getContext("webgl2")}catch{b=!1}return b}function y(i){return P(i)}var v=null;function _(){return v||(v=(typeof __SEATLAYER_CDN__<"u"&&__SEATLAYER_CDN__?import(y("seatlayer-view3d.mjs")):import("@seatlayer/core/view3d")).catch(t=>{throw v=null,t}),v)}function z(){(typeof navigator>"u"?void 0:navigator.connection)?.saveData||_().catch(()=>{})}async function J(){return typeof __SEATLAYER_CDN__<"u"&&__SEATLAYER_CDN__?import(y("seatlayer-panorama.mjs")):import("@seatlayer/core")}async function Q(){return typeof __SEATLAYER_CDN__<"u"&&__SEATLAYER_CDN__?import(y("seatlayer-checkout.mjs")):import("./hostedCheckout-XSQ7ISQC.js")}function ee(i){return i==="unavailable_for_event"||i==="payments_off_for_event"?i:"not_configured"}function te(i){return i.lineItems.reduce((t,n)=>t+n.quantity,0)}function M(i,t){if(i.objectType!=="ga")return i.displayLabel??i.label;let n=t.find(e=>e.id===i.objectId);return i.displayLabel??n?.displayLabel??n?.label??d("picker.generalAdmission","General admission")}function R(i,t){let n=new Map;for(let e of i){let o=e.rowLabel&&e.seatNumber?[e.sectionLabel,`${d("picker.row","Row")} ${e.rowLabel}`,`${d("picker.seat","Seat")} ${e.seatNumber}`].filter(Boolean).join(" \xB7 "):M(e,t),s=[e.categoryLabel,e.tierLabel].filter(Boolean).join(" \xB7 "),u=Math.max(1,Math.floor(e.quantity||1)),a=`${o}\0${s}`,c=n.get(a)??{label:o,detail:s,units:0,amount:0};c.units+=u,c.amount+=e.unitPrice*u,n.set(a,c)}return[...n.values()].map(e=>({label:e.units>1?`${e.label} \xD7${e.units}`:e.label,...e.detail?{detail:e.detail}:{},amount:e.amount}))}var L=(i,t,n)=>C("picker.bookingForm.guestOfCount",{label:i,index:t,total:n});function I(i,t,n=[]){let e=new Map,o=[];for(let l of i.lineItems){let r=M(l,n),f=Math.max(1,Math.floor(l.quantity)||1);if(l.objectType!=="ga"&&!(l.objectType==="table"&&f>1)){o.push({key:l.label,name:r,unitIndex:1,quantity:1});continue}for(let h=1;h<=f;h+=1){let m=(e.get(l.label)??0)+1;e.set(l.label,m),o.push({key:`${l.label}#${m}`,name:r,unitIndex:h,quantity:f})}}let s=t?.ticketKeyDetails??[],u=t?.ticketKeys??s.map(l=>l.ticketKey),a=(u.length===o.length?u:o.map(l=>l.key)).map(l=>{let r=o.find(h=>h.key===l),f=s.find(h=>h.ticketKey===l);return{key:l,name:f?.displayLabel??r?.name,unitIndex:f?.unitIndex??r?.unitIndex??1,quantity:f?.quantity??r?.quantity??1}}),c=new Map;for(let l of a)l.name&&l.quantity<=1&&c.set(l.name,(c.get(l.name)??0)+1);let p=new Map;return a.map(({key:l,name:r,unitIndex:f,quantity:h})=>{if(!r)return{key:l};if(h>1)return{key:l,title:L(r,f,h)};let m=(p.get(r)??0)+1;p.set(r,m);let g=c.get(r)??1;return{key:l,title:g>1?L(r,m,g):r}})}function ne(i,t,n,e,o=[]){let s=new Map;for(let u of i.lineItems){let a=M(u,o);s.set(a,(s.get(a)??0)+1)}return{kind:"pay",provider:t,order:{holdId:i.holdId,expiresAt:i.expiresAt,currency:i.currency,total:i.total,labels:[...s].map(([u,a])=>a>1?`${u} \xD7${a}`:u),tickets:I(i,e,o),lines:R(i.lineItems,o)},bookingForm:n?.bookingForm??null,...n?.bookingMode==="free"?{free:!0}:{}}}function ie(i){return String(i?.code).startsWith("booking_form_")}function oe(i,t,n){let e={month:"short",day:"numeric",hour:"numeric",minute:"2-digit"},o=new Date(i);if(t)try{return o.toLocaleString(n,{...e,timeZone:t})}catch{}return o.toLocaleString(n,e)}function le(i){return i.focusedSection!==null?i.deeperThanSectionFrame===!1?"venue":"section":i.atVenueFit!==void 0?i.atVenueFit?"none":"venue":i.seatsRevealed?"venue":"none"}import{pointInPolygon as D}from"@seatlayer/core";import{createMinimapTransform as H,minimapPointToWorld as O,minimapViewportPlan as V}from"@seatlayer/core/picker/minimapGeometry";function W(i){let t={inactive:0,available:1,selected:2},n=new Map;for(let o of i){let s=n.get(o.id);(!s||t[o.state]>t[s])&&n.set(o.id,o.state)}let e={selected:0,available:0,inactive:0};for(let o of n.values())e[o]+=1;return e}function N(i,t){return i.x<=t.x&&i.y<=t.y&&i.x+i.width>=t.x+t.width&&i.y+i.height>=t.y+t.height}function he(i,t){let n=new w(i);return n.build(t),n}var w=class{constructor(t){this.host=t;this.miniCanvas=null;this.miniBase=null;this.miniWrap=null;this.miniToggle=null;this.miniLabel=null;this.miniTf=null;this.miniDrag=null;this.miniSuppressClick=!1;this.userClosed=!1}dispose(){this.miniToggle?.remove(),this.miniWrap?.remove(),this.miniToggle=null,this.miniWrap=null,this.miniCanvas=null,this.miniBase=null,this.miniLabel=null,this.miniTf=null,this.miniDrag=null,this.host.root()?.removeAttribute("data-minimap-open")}build(t){if(!this.host.controller.getViewport())return;let e=document.createElement("button");e.type="button",e.className="sl-minimap-toggle",e.setAttribute("aria-label",d("picker.openVenueMap","Open venue overview map")),e.setAttribute("aria-expanded","false"),e.innerHTML='<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M3 6l5-2 8 3 5-2v13l-5 2-8-3-5 2zM8 4v13M16 7v13"/></svg>',t.appendChild(e),this.miniToggle=e;let o=document.createElement("div");o.className="sl-minimap",o.setAttribute("role","group");let s=document.createElement("div");s.className="sl-minimap-bar";let u=document.createElement("span");u.className="sl-minimap-label";let a=document.createElement("span");a.className="sl-minimap-key",a.setAttribute("aria-label",d("picker.minimapStateKey","Focused, selected, available, and inactive sections")),a.innerHTML='<i class="focused" title="Focused"></i><i class="selected" title="Selected"></i><i title="Available"></i><i class="inactive" title="Inactive"></i>';let c=document.createElement("button");c.type="button",c.className="sl-minimap-close",c.setAttribute("aria-label",d("picker.closeVenueMap","Close venue overview map")),c.textContent="\xD7",s.append(u,a,c);let p=document.createElement("canvas");p.tabIndex=0,p.setAttribute("role","application"),p.setAttribute("aria-label",d("picker.venueMapInstructions","Venue overview map. Drag the viewport, click a section, or use arrow keys to pan.")),o.append(s,p),t.appendChild(o),this.miniWrap=o,this.miniLabel=u,this.miniCanvas=p;let l=document.createElement("canvas");this.miniBase=l,e.addEventListener("click",()=>{let r=this.host.root()?.dataset.minimapOpen==="true";this.userClosed=r,this.setMinimapOpen(!r)}),c.addEventListener("click",()=>{this.userClosed=!0,this.setMinimapOpen(!1)}),p.addEventListener("click",r=>{if(this.miniSuppressClick){this.miniSuppressClick=!1;return}this.minimapJump(r)}),p.addEventListener("pointerdown",r=>this.minimapPointerDown(r)),p.addEventListener("pointermove",r=>this.minimapPointerMove(r)),p.addEventListener("pointerup",r=>this.minimapPointerUp(r)),p.addEventListener("pointercancel",r=>this.minimapPointerUp(r)),p.addEventListener("keydown",r=>this.minimapKeydown(r)),this.layoutMinimap(),this.syncMinimapLabel(),this.drawMinimapStatic(),this.drawMinimapRect()}setAutoOpen(t){if(this.miniWrap){if(!t){this.userClosed=!1,this.host.root()?.dataset.minimapOpen==="true"&&this.setMinimapOpen(!1,!1);return}this.userClosed||this.host.root()?.dataset.minimapOpen==="true"||this.setMinimapOpen(!0,!1)}}setMinimapOpen(t,n=!0){this.host.root()?.setAttribute("data-minimap-open",String(t)),this.miniToggle?.setAttribute("aria-expanded",String(t)),n&&(t?this.miniCanvas?.focus():this.miniToggle?.focus())}layoutMinimap(){let t=this.miniCanvas,n=this.miniBase,e=this.host.controller.getViewport()?.bounds;if(!t||!n||!e||!(e.width>0&&e.height>0))return;let o=196,s=146,u=6,a=e.width/Math.max(1,e.height),c=o,p=Math.round(o/a);p>s&&(p=s,c=Math.round(s*a)),c=Math.max(64,c),p=Math.max(48,p);let l=Math.min(2,window.devicePixelRatio||1);t.width=Math.round(c*l),t.height=Math.round(p*l),t.style.width=`${c}px`,t.style.height=`${p}px`,n.width=t.width,n.height=t.height,this.miniTf=H(e,t.width,t.height,l,u)}syncMinimapLabel(){if(!this.miniLabel||!this.miniWrap)return;let t=this.host.controller.getFloors(),n=this.host.controller.isFloorOverview()?d("picker.allFloors","All floors"):t.find(l=>l.id===this.host.controller.getActiveFloorId())?.name??d("picker.venueOverview","Venue overview"),e=this.host.controller.getMinimapSnapshot().sections,s=e.find(l=>l.active)?.label??this.host.focusedSectionLabel(),u=s?`${n} \xB7 ${s}`:n;this.miniLabel.textContent=u;let{selected:a,available:c,inactive:p}=W(e);this.miniWrap.setAttribute("aria-label",e.length?`${u}. ${a} selected, ${c} available, ${p} inactive sections.`:u),this.miniCanvas?.setAttribute("aria-label",e.length?`${u}. ${a} selected, ${c} available, ${p} inactive sections. ${d("picker.venueMapInstructions","The outlined region is the visible map area. Drag it, click a section, or use arrow keys to pan.")}`:`${u}. ${d("picker.venueMapInstructions","The outlined region is the visible map area. Drag it, click elsewhere, or use arrow keys to pan.")}`)}refreshMinimap(){this.miniBase&&(this.layoutMinimap(),this.syncMinimapLabel(),this.drawMinimapStatic(),this.drawMinimapRect())}drawMinimapStatic(){let t=this.miniBase,n=this.miniTf;if(!t||!n)return;let e=t.getContext("2d");if(!e)return;e.clearRect(0,0,t.width,t.height);let o=r=>r*n.scale+n.offX,s=r=>r*n.scale+n.offY,u=this.host.cssVar("--sl-line")||"rgba(139,147,167,.5)",a=this.host.cssVar("--sl-muted")||"#8b93a7",c=this.host.cssVar("--sl-accent")||"#6e7bff",p=this.host.cssVar("--sl-success")||"#22a06b",l=this.host.controller.getMinimapSnapshot();for(let r of l.sections){if(r.outline.length<3)continue;e.beginPath(),r.outline.forEach((h,m)=>m===0?e.moveTo(o(h.x),s(h.y)):e.lineTo(o(h.x),s(h.y))),e.closePath();let f=r.paint;if(e.globalAlpha=r.state==="inactive"?.5:.92,f?e.fillStyle=f.fill:(e.globalAlpha=r.state==="inactive"?.18:r.state==="selected"?.72:.34,e.fillStyle=r.state==="inactive"?a:r.state==="selected"?c:p),e.fill(),e.globalAlpha=.82,e.lineWidth=Math.max(1,n.dpr),e.strokeStyle=f?.stroke||u,e.stroke(),r.owned){e.globalAlpha=1,e.lineWidth=Math.max(2,n.dpr*1.5),e.strokeStyle=c,e.stroke();let h=r.outline.reduce((m,g)=>({x:m.x+g.x,y:m.y+g.y}),{x:0,y:0});e.beginPath(),e.arc(o(h.x/r.outline.length),s(h.y/r.outline.length),Math.max(1.5,n.dpr*1.6),0,Math.PI*2),e.fillStyle=c,e.fill(),e.beginPath(),r.outline.forEach((m,g)=>g===0?e.moveTo(o(m.x),s(m.y)):e.lineTo(o(m.x),s(m.y))),e.closePath()}r.active&&(e.globalAlpha=1,e.lineJoin="round",e.lineWidth=Math.max(4,n.dpr*3.5),e.strokeStyle=this.host.cssVar("--sl-surface")||"#fff",e.stroke(),e.lineWidth=Math.max(2,n.dpr*1.75),e.strokeStyle=c,e.stroke())}if(e.globalAlpha=1,!l.sections.length){let r=Math.max(1,n.dpr),f=new Map,h=m=>{let g=f.get(m);if(g)return g;let k=this.host.tint?.(m)||p;return f.set(m,k),k};for(let m of l.seats)e.globalAlpha=m.state==="inactive"?.22:.78,e.fillStyle=m.state==="inactive"?a:m.state==="selected"?c:h(m.categoryKey),e.beginPath(),e.arc(o(m.x),s(m.y),r,0,Math.PI*2),e.fill();e.globalAlpha=1}}drawMinimapRect(){let t=this.miniCanvas,n=this.miniBase,e=this.miniTf;if(!t||!n||!e)return;let o=t.getContext("2d");if(!o)return;o.clearRect(0,0,t.width,t.height),o.drawImage(n,0,0);let s=this.host.controller.getViewport();if(!s)return;let u=N(s.visible,s.bounds);if(this.host.root()?.toggleAttribute("data-minimap-idle",u),u)return;let a=V(s.visible,e,t.width,t.height,Math.max(2,e.dpr*2)),c=this.host.cssVar("--sl-text")||"#12151c",p=this.host.cssVar("--sl-surface")||"#fff";o.save(),o.globalAlpha=.1,o.fillStyle=c,o.fillRect(a.raw.x,a.raw.y,a.raw.width,a.raw.height),o.globalAlpha=.9,o.lineJoin="round",o.lineWidth=Math.max(4,e.dpr*3.25),o.strokeStyle=p,o.strokeRect(a.raw.x,a.raw.y,a.raw.width,a.raw.height),o.globalAlpha=1,o.lineWidth=Math.max(2,e.dpr*1.75),o.strokeStyle=c,o.strokeRect(a.raw.x,a.raw.y,a.raw.width,a.raw.height),a.clipped&&Object.values(a.clippedEdges).some(Boolean)&&(o.setLineDash([Math.max(3,e.dpr*3),Math.max(2,e.dpr*2)]),o.strokeRect(a.clipped.x,a.clipped.y,a.clipped.width,a.clipped.height)),o.restore()}minimapWorldPoint(t){let n=this.miniCanvas,e=this.miniTf;if(!n||!e)return null;let o=n.getBoundingClientRect(),s=(t.clientX-o.left)*(n.width/Math.max(1,o.width)),u=(t.clientY-o.top)*(n.height/Math.max(1,o.height));return{...O({x:s,y:u},e),px:s,py:u}}minimapPointerDown(t){let n=this.minimapWorldPoint(t),e=this.host.controller.getViewport()?.visible;!n||!e||!(n.x>=e.x&&n.x<=e.x+e.width&&n.y>=e.y&&n.y<=e.y+e.height)||(this.miniDrag={pointerId:t.pointerId,offsetX:n.x-(e.x+e.width/2),offsetY:n.y-(e.y+e.height/2),startX:t.clientX,startY:t.clientY,moved:!1},this.miniCanvas?.setPointerCapture(t.pointerId),this.miniCanvas?.classList.add("sl-dragging"),t.preventDefault())}minimapPointerMove(t){let n=this.miniDrag;if(!n||n.pointerId!==t.pointerId)return;let e=this.minimapWorldPoint(t);e&&(!n.moved&&Math.hypot(t.clientX-n.startX,t.clientY-n.startY)>2&&(n.moved=!0,this.host.controller.clearSectionFocus()),this.host.controller.panToWorld({x:e.x-n.offsetX,y:e.y-n.offsetY}),t.preventDefault())}minimapPointerUp(t){let n=this.miniDrag;!n||n.pointerId!==t.pointerId||(this.miniSuppressClick=n.moved,this.miniDrag=null,this.miniCanvas?.classList.remove("sl-dragging"),this.miniCanvas?.hasPointerCapture(t.pointerId)&&this.miniCanvas.releasePointerCapture(t.pointerId))}minimapKeydown(t){let n=this.host.controller.getViewport()?.visible;if(!n)return;if(t.key==="Home"){this.host.controller.overview(),t.preventDefault();return}let e=t.key==="ArrowLeft"?-n.width*.2:t.key==="ArrowRight"?n.width*.2:0,o=t.key==="ArrowUp"?-n.height*.2:t.key==="ArrowDown"?n.height*.2:0;!e&&!o||(this.host.controller.clearSectionFocus(),this.host.controller.panToWorld({x:n.x+n.width/2+e,y:n.y+n.height/2+o}),t.preventDefault())}minimapJump(t){let n=this.minimapWorldPoint(t);if(n){for(let e of this.host.controller.getMinimapSnapshot().sections)if(!(e.state==="inactive"||e.outline.length<3)&&D(n,e.outline)){this.host.controller.focusSection(e.id);return}this.host.controller.clearSectionFocus(),this.host.controller.panToWorld(n)}}};export{x as a,d as b,B as c,X as d,G as e,j as f,q as g,K as h,Z as i,_ as j,z as k,J as l,Q as m,ee as n,te as o,ne as p,ie as q,oe as r,le as s,he as t};