@seatlayer/js 0.86.8 → 0.86.9
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/{channelsMode-goczEzyt.d.cts → channelsMode-CP2yegbE.d.cts} +29 -1
- package/dist/{channelsMode-goczEzyt.d.ts → channelsMode-CP2yegbE.d.ts} +29 -1
- package/dist/{channelsMode-M44RRKNM.js → channelsMode-JQPW2SVE.js} +1 -1
- package/dist/{chunk-Z3G64HUG.js → chunk-H7F4LMNV.js} +74 -79
- package/dist/index.cjs +17 -17
- package/dist/index.d.cts +14 -3
- package/dist/index.d.ts +14 -3
- package/dist/index.js +11 -11
- package/dist/manager.cjs +374 -268
- package/dist/manager.d.cts +2 -2
- package/dist/manager.d.ts +2 -2
- package/dist/manager.js +212 -101
- package/package.json +2 -2
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
var $="public",E="Public sale";function M(i){return i==null||i===""||i===$}var K=["#a78bfa","#2dd4bf","#fb923c","#60a5fa","#f472b6","#a3e635","#f87171","#38bdf8","#c084fc","#facc15"],He="#f4b740",ce="ABCDEFGHJKLMNPQRSTUVWXYZ";function _(i,e){let t=(i??"").trim();return((/\p{L}/u.exec(t)?.[0]??t[0]??"")||e).toUpperCase().slice(0,1)}function ee(i,e){let t=new Set([...e].map(r=>_(r,"")).filter(Boolean)),n=_(i,"");return{letter:ce.includes(n)&&!t.has(n)?n:[...ce].find(r=>!t.has(r))??(n||"X"),color:K[t.size%K.length]}}function de(i,e=0){return M(i.id)?{letter:_(i.marker,"P"),color:i.color||He}:{letter:_(i.marker||i.name,"?"),color:i.color||K[e%K.length]}}function ue(i,e,t){let n=new Map;for(let o of i){let a=J(e.get(o));n.set(a,(n.get(a)??0)+1)}let s=[{id:$,name:t?.publicSale?.name??E},...(t?.channels??[]).map(o=>({id:o.id,name:o.name}))],r=[];for(let o of s){let a=n.get(o.id);a&&r.push({channelId:o.id,name:o.name,count:a}),n.delete(o.id)}for(let[o,a]of n)r.push({channelId:o,name:M(o)?E:"Another channel",count:a});return r}function J(i){return M(i)?$:i}var he=12;function Q(i){return{count:i.length,labels:i.slice(0,he),truncated:i.length>he}}function pe(i){let{labels:e,allocation:t,statusOf:n,nameOf:s}=i,r=J(i.targetChannelId),o=new Set,a=0,l=0,h=new Map,d=[],u=[],w=[];for(let v of e){if(o.has(v))continue;o.add(v);let p=n(v);if(!p){w.push(v);continue}let m=J(t.get(v));if(m===r){l+=1;continue}if(p==="held"){d.push(v);continue}if(p==="booked"){u.push(v);continue}m===$?a+=1:h.set(m,(h.get(m)??0)+1)}let x=[...h.entries()].map(([v,p])=>({channelId:v,name:s(v),count:p}));return{changedFromPublic:{count:a},movedFromOtherChannel:{count:x.reduce((v,p)=>v+p.count,0),channels:x},alreadyInTarget:{count:l},skippedHeld:Q(d),skippedBooked:Q(u),notFound:Q(w)}}function X(i){return i.changedFromPublic.count+i.movedFromOtherChannel.count}function me(i){return i.movedFromOtherChannel.count>0}function ge(i,e){let t=[];i.changedFromPublic.count&&t.push({kind:"add",icon:"+",count:i.changedFromPublic.count,text:`${i.changedFromPublic.count.toLocaleString()} from ${E}`});for(let n of i.movedFromOtherChannel.channels)t.push({kind:"move",icon:"\u21C4",count:n.count,text:`${n.count.toLocaleString()} moved out of ${n.name??"another channel"}`,why:"needs this confirmation"});return i.alreadyInTarget.count&&t.push({kind:"same",icon:"=",count:i.alreadyInTarget.count,text:`${i.alreadyInTarget.count.toLocaleString()} already in ${e}`,why:"unchanged"}),i.skippedHeld.count&&t.push({kind:"skip",icon:"\u23F8",count:i.skippedHeld.count,text:`${i.skippedHeld.count.toLocaleString()} in a buyer's checkout`,why:"can't move while held",peek:Y(i.skippedHeld)}),i.skippedBooked.count&&t.push({kind:"skip",icon:"\u{1F512}",count:i.skippedBooked.count,text:`${i.skippedBooked.count.toLocaleString()} already sold`,why:"sales are never rewritten",peek:Y(i.skippedBooked)}),i.notFound.count&&t.push({kind:"skip",icon:"?",count:i.notFound.count,text:`${i.notFound.count.toLocaleString()} not on this map`,why:"these seats are no longer part of the event",peek:Y(i.notFound)}),t}function Y(i){if(!i.labels.length)return;let e=i.labels.slice(0,4).join(", ");return i.truncated||i.labels.length>4?`${e}\u2026`:e}function be(i){let e=i?.retryAfterMs??(i?.latestHoldExpiresAt?Math.max(0,i.latestHoldExpiresAt-Date.now()):0);if(!e)return"in a moment";let t=Math.ceil(e/6e4);return t<=1?"in about a minute":`in about ${t} minutes`}function ve(i){if(!i||!i.intent)return"\u2014";let e=i.intent==="server"?"Website integration":i.intent==="hosted_link"?"Buyer link":i.intent==="internal"?"Your staff sell these":"Protected reserve",t=i.hasActiveGrants?"in use now":i.lastMintAt?`last used ${new Date(i.lastMintAt).toLocaleDateString()}`:null,n=i.detail??t;return n?`${e} \xB7 ${n}`:e}function q(i){return i==="internal"?"Sell through your own staff":i==="server"?"Integrate a website or app":i==="hosted_link"?"Sell with a buyer link":"Keep as protected reserve"}function fe(i){switch(i){case"internal":return"Only your own box office can sell these seats, through your secret key. Buyer links and website integrations are refused.";case"server":return"Your website's backend mints each buyer a short-lived session for these seats. Buyer links are refused; the code lives on the Embed page.";case"hosted_link":return"SeatLayer makes a link you send to a named group. They open it and buy only these seats. No other route can sell them.";default:return"Nobody can buy these seats. Every way of letting a buyer in \u2014 a buyer link, your website, even your own staff \u2014 is refused while this is the route. The seats stay out of public sale."}}function Be(i){return i==="hosted_link"?"hosted_link":i==="server"?"server":i==="staff"?"internal":null}function G(i){let e=Z(i?.accessIntent),t=Be(i?.route),n=`This channel is set to "${q(e)}"`;return t?`${n}, so it cannot do that. Switch it to "${q(t)}" first.`:`${n}, so it cannot do that. Choose a different route for this channel first.`}function Z(i){return i==="internal"||i==="server"||i==="hosted_link"||i==="none"?i:"none"}function F(i,e,t){return`${i.toLocaleString()} ${i===1?e:t}`}function ye(i){let e=Math.max(0,i?.liveAccessLinks??0),t=Math.max(0,i?.activeSessions??0),n=Z(i?.from),s=Z(i?.to),o=`${[e?F(e,"buyer link is live","buyer links are live"):null,t?F(t,"buyer is in a checkout","buyers are in a checkout"):null].filter(Boolean).join(", and ")||"Buyers are inside this channel"} on "${q(n)}". Moving it to "${q(s)}" changes what happens to them.`,a=[];return e&&a.push(`${F(e,"buyer link closes","buyer links close")} immediately. Anyone who has not opened it yet never will \u2014 send a new link if you still need one.`),t&&a.push(`${F(t,"buyer who is already in a checkout keeps","buyers who are already in a checkout keep")} their seats and can finish paying. Nobody is thrown out. No new buyers come in this way, so the old route empties on its own within 12 hours.`),{headline:o,consequences:a}}var te={maxRedemptions:100,maxQuantity:4};function ke(i){switch(i.status??i.state){case"active":return{text:"Active",kind:"active"};case"expired":return{text:"Expired",kind:"archived"};case"exhausted":return{text:"All used",kind:"paused"};case"rotated":return{text:"Replaced",kind:"archived"};default:return{text:"Revoked",kind:"archived"}}}function ne(i){return i.state==="active"&&i.status==="active"}function _e(i){return Number.isFinite(i)?new Date(i).toLocaleString(void 0,{day:"numeric",month:"short",year:"numeric",hour:"numeric",minute:"2-digit"}):"\u2014"}function se(i){return[{k:"Expires",v:_e(i.expiresAt)},{k:"Redemptions",v:`${i.redemptions.toLocaleString()} of ${i.maxRedemptions.toLocaleString()} used`},{k:"Seats per buyer",v:`${i.maxQuantity.toLocaleString()} seat${i.maxQuantity===1?"":"s"} maximum`},{k:"Covers",v:i.includePublic?"This channel's allocation and Public sale seats":"This channel's allocation only"}]}function j(i){let e=i?.serverMessage?.trim();switch(i?.code){case"invalid_expiry":case"invalid_max_redemptions":case"invalid_max_quantity":case"invalid_session_ttl":case"invalid_label":return e||"That setting is outside what a hosted link allows. Adjust it and try again.";case"too_many_access_links":return e||"This channel already has as many live links as it can hold. Revoke one before creating another.";case"access_link_not_active":return"That link is no longer active, so it cannot be rotated or revoked.";case"channel_unavailable":return"This channel is paused or archived, so it cannot let new buyers in. Resume it first.";case"channel_access_intent_forbids":return G(i?.details);case"end_active_sessions_required":return"Choose what happens to the buyers who already came in through this link.";case"not_found":return"That link is no longer here. Refresh and try again.";default:return i?.status===403?"Hosted access links need channel-management permission.":e||"That did not go through. Try again."}}function Ze(i){return(i?.channels??[]).map(e=>({kind:"skip",icon:"\u26A0",count:e.count,text:`${e.count.toLocaleString()} would leave ${e.name??"a channel"}`,why:"the new chart no longer has these seats",peek:e.labels?.length?Y({count:e.count,labels:e.labels,truncated:e.truncated??!1}):void 0}))}function we(i){return i==="builtin"?"Built-in":i==="active"?"Active":i==="paused"?"Paused":"Archived"}var b=class extends Error{constructor(e,t,n,s,r,o){super(t),this.name="ManageApiError",this.status=e,this.code=n,this.conflicts=s,this.details=r,this.serverMessage=o}};async function xe(i){let t=(i.headers.get("content-type")??"").includes("application/json")?await i.json().catch(()=>null):null;if(!i.ok){let n=t;throw new b(i.status,n?.error??`request_failed_${i.status}`,n?.code,n?.conflicts,n?.details,typeof n?.message=="string"?n.message:void 0)}return t}function C(i){return i&&typeof i=="object"?i:{}}function W(i,e,t=0){return typeof i=="number"&&Number.isFinite(i)?i:typeof e=="number"&&Number.isFinite(e)?e:t}function Se(i,e){return i===null?null:typeof i=="number"&&Number.isFinite(i)?i:i!==void 0?null:typeof e=="number"&&Number.isFinite(e)?e:null}function $e(i){let e=C(i),t=W(e.bookedValue,e.bookedRevenue);return{...e,bookedValue:t,bookedRevenue:t}}function qe(i){let e=C(i),t=C(e.report),n=Array.isArray(t.byCategory)?t.byCategory.map(r=>{let o=C(r),a=W(o.bookedValue,o.bookedRevenue);return{...o,bookedValue:a,bookedRevenue:a}}):[],s=Array.isArray(t.bySection)?t.bySection.map($e):void 0;return{...e,report:{...t,byCategory:n,...s?{bySection:s}:{}}}}function Oe(i){let e=C(i),t=C(e.bookedValue),n=C(e.revenue),s=Object.keys(t).length?t:n,r=Array.isArray(t.bySection)?t.bySection:Array.isArray(n.bySection)?n.bySection:[],o={...s,gross:W(t.gross,n.gross),bySection:r.map($e)},a=C(e.velocity),l=Array.isArray(a.bySection)?a.bySection.map(h=>{let d=C(h),u=W(d.bookedValue,d.grossRevenue);return{...d,bookedValue:u,grossRevenue:u}}):[];return{...e,bookedValue:o,revenue:o,velocity:{...a,bySection:l}}}function ze(i){let e=C(i),t=C(e.report),n=typeof t.includesBookedValue=="boolean"?t.includesBookedValue:t.includesRevenue===!0,s=Array.isArray(t.rows)?t.rows.map(a=>{let l=C(a),h=C(l.attribution),d=Se(h.bookedValue,h.revenue);return{...l,attribution:{...h,bookedValue:d,revenue:d}}}):[],r=C(t.totals),o=Se(r.bookedValue,r.revenue);return{...e,report:{...t,includesBookedValue:n,includesRevenue:n,rows:s,totals:{...r,bookedValue:o,revenue:o}}}}function ie(i){let e=C(i),t=typeof e.includesBookedValue=="boolean"?e.includesBookedValue:e.includesRevenue===!0;return{...e,includesBookedValue:t,includesRevenue:t}}var Ce=class{constructor(e,t){this.base=e.replace(/\/+$/,""),this.token=t}setToken(e){this.token=e}auth(e,t={}){let n=t.method??"GET",s={Authorization:`Bearer ${this.token}`},r;return t.body!==void 0&&(s["Content-Type"]="application/json",r=JSON.stringify(t.body)),fetch(`${this.base}${e}`,{method:n,headers:s,body:r,credentials:"omit"}).then(o=>xe(o))}async authBlob(e){let t=await fetch(`${this.base}${e}`,{method:"GET",headers:{Authorization:`Bearer ${this.token}`},credentials:"omit"});return t.ok||await xe(t),t.blob()}chart(e){return this.auth(`/v1/events/${encodeURIComponent(e)}/chart`)}asset(e,t){return/^[a-zA-Z0-9._-]+$/.test(t)?this.authBlob(`/v1/events/${encodeURIComponent(e)}/assets/${encodeURIComponent(t)}`):Promise.reject(new b(404,"not_found","not_found"))}objects(e){return this.auth(`/v1/events/${encodeURIComponent(e)}/objects`)}subscribeTicket(e){return this.auth(`/v1/events/${encodeURIComponent(e)}/subscribe-tickets`,{method:"POST"})}socketUrl(e){return`${this.base.replace(/^http/,"ws")}/pub/events/${encodeURIComponent(e)}/subscribe?surface=manager`}block(e,t,n={}){let s={labels:t};return typeof n.releaseAt=="number"&&(s.releaseAt=n.releaseAt),n.reason&&(s.reason=n.reason),this.auth(`/v1/events/${encodeURIComponent(e)}/block`,{method:"POST",body:s})}unblock(e,t){return this.auth(`/v1/events/${encodeURIComponent(e)}/unblock`,{method:"POST",body:{labels:t}})}unblockAll(e){return this.auth(`/v1/events/${encodeURIComponent(e)}/unblock-all`,{method:"POST"})}unbook(e,t,n){return this.auth(`/v1/events/${encodeURIComponent(e)}/unbook`,{method:"POST",body:{labels:t,bookingRef:n}})}setHoldTtl(e,t){return this.auth(`/v1/events/${encodeURIComponent(e)}/hold-ttl`,{method:"POST",body:{holdTtlMs:t}})}setCategory(e,t,n){return this.auth(`/v1/events/${encodeURIComponent(e)}/category-assignments`,{method:"POST",body:{labels:t,categoryKey:n}})}setTableBooking(e,t,n,s={}){return this.auth(`/v1/events/${encodeURIComponent(e)}/table-booking`,{method:"POST",body:{tableIds:t,mode:n,...s}})}bookings(e,t={}){let n=new URLSearchParams;t.q&&n.set("q",t.q),t.state&&n.set("state",t.state),t.cursor&&n.set("cursor",t.cursor),t.limit!=null&&n.set("limit",String(t.limit));let s=n.toString();return this.auth(`/v1/events/${encodeURIComponent(e)}/bookings${s?`?${s}`:""}`)}booking(e,t){return this.auth(`/v1/events/${encodeURIComponent(e)}/bookings/${encodeURIComponent(t)}`)}listBookings(e,t={}){return this.bookings(e,t)}retrieveBooking(e,t){return this.booking(e,t)}availability(e){return this.auth(`/v1/events/${encodeURIComponent(e)}/availability`)}setAvailability(e,t){return this.auth(`/v1/events/${encodeURIComponent(e)}/availability`,{method:"POST",body:{rules:t}})}channels(e,t={}){let n=t.includeArchived?"?includeArchived=1":"";return this.auth(`/v1/events/${encodeURIComponent(e)}/channels${n}`)}channelAllocation(e,t={}){let n=new URLSearchParams;t.afterLabel&&n.set("afterLabel",t.afterLabel),t.limit!=null&&n.set("limit",String(t.limit));let s=n.toString();return this.auth(`/v1/events/${encodeURIComponent(e)}/channels/allocation${s?`?${s}`:""}`)}channelAudit(e,t={}){let n=new URLSearchParams;t.limit!=null&&n.set("limit",String(t.limit)),t.before!=null&&n.set("before",String(t.before));let s=n.toString();return this.auth(`/v1/events/${encodeURIComponent(e)}/channels/audit${s?`?${s}`:""}`)}createChannel(e,t){return this.auth(`/v1/events/${encodeURIComponent(e)}/channels`,{method:"POST",body:t})}renameChannel(e,t,n){return this.auth(`/v1/events/${encodeURIComponent(e)}/channels/${encodeURIComponent(t)}`,{method:"PATCH",body:{name:n}})}updateChannelPricing(e,t,n,s){return this.auth(`/v1/events/${encodeURIComponent(e)}/channels/${encodeURIComponent(t)}`,{method:"PATCH",body:{priceOverrides:n,expectedPricingVersion:s}})}setChannelPaused(e,t,n){let s=n?"pause":"unpause";return this.auth(`/v1/events/${encodeURIComponent(e)}/channels/${encodeURIComponent(t)}/${s}`,{method:"POST",body:{}})}archiveChannel(e,t,n){return this.auth(`/v1/events/${encodeURIComponent(e)}/channels/${encodeURIComponent(t)}/archive`,{method:"POST",body:{destination:n}})}applyChannelAssignment(e,t){return this.auth(`/v1/events/${encodeURIComponent(e)}/channels/assignments`,{method:"POST",body:{targetChannelId:t.targetChannelId||null,labels:t.labels,assignmentVersion:t.assignmentVersion}})}channelPreview(e,t,n={}){let s=new URLSearchParams;t.length&&s.set("channelIds",t.join(",")),n.includePublic!=null&&s.set("includePublic",n.includePublic?"1":"0");let r=s.toString();return this.auth(`/v1/events/${encodeURIComponent(e)}/channels/preview${r?`?${r}`:""}`)}setChannelAccessIntent(e,t,n,s={}){return this.auth(`/v1/events/${encodeURIComponent(e)}/channels/${encodeURIComponent(t)}`,{method:"PATCH",body:{accessIntent:n,...s.acknowledgeLiveAccess?{acknowledgeLiveAccess:!0}:{},...s.reason?{reason:s.reason}:{}}})}createAccessLink(e,t,n={}){return this.auth(`/v1/events/${encodeURIComponent(e)}/channels/${encodeURIComponent(t)}/access-links`,{method:"POST",body:n})}accessLinks(e,t){return this.auth(`/v1/events/${encodeURIComponent(e)}/channels/${encodeURIComponent(t)}/access-links`)}rotateAccessLink(e,t,n,s){return this.auth(`/v1/events/${encodeURIComponent(e)}/channels/${encodeURIComponent(t)}/access-links/${encodeURIComponent(n)}/rotate`,{method:"POST",body:{endActiveSessions:s}})}revokeAccessLink(e,t,n,s=!1){let r=s?"?endActiveSessions=1":"";return this.auth(`/v1/events/${encodeURIComponent(e)}/channels/${encodeURIComponent(t)}/access-links/${encodeURIComponent(n)}${r}`,{method:"DELETE"})}report(e){return this.auth(`/v1/events/${encodeURIComponent(e)}/report`).then(qe)}controlRoom(e,t=15){return this.auth(`/v1/events/${encodeURIComponent(e)}/control-room?window=${t}`).then(Oe)}channelReport(e){return this.auth(`/v1/events/${encodeURIComponent(e)}/channels/report`).then(ze)}createChannelReportLink(e,t,n={}){return this.auth(`/v1/events/${encodeURIComponent(e)}/channels/${encodeURIComponent(t)}/report-links`,{method:"POST",body:n}).then(s=>{let r=C(s);return{...r,link:ie(r.link)}})}channelReportLinks(e,t){return this.auth(`/v1/events/${encodeURIComponent(e)}/channels/${encodeURIComponent(t)}/report-links`).then(n=>{let s=C(n);return{links:Array.isArray(s.links)?s.links.map(ie):[]}})}revokeChannelReportLink(e,t,n){return this.auth(`/v1/events/${encodeURIComponent(e)}/channels/${encodeURIComponent(t)}/report-links/${encodeURIComponent(n)}`,{method:"DELETE"}).then(s=>{let r=C(s);return{...r,link:ie(r.link)}})}log(e,t={}){let n=new URLSearchParams;t.limit!=null&&n.set("limit",String(t.limit)),t.before!=null&&n.set("before",String(t.before));let s=n.toString();return this.auth(`/v1/events/${encodeURIComponent(e)}/log${s?`?${s}`:""}`)}async reportCsv(e){let t=await fetch(`${this.base}/v1/events/${encodeURIComponent(e)}/report.csv`,{headers:{Authorization:`Bearer ${this.token}`},credentials:"omit"});if(!t.ok)throw new b(t.status,`request_failed_${t.status}`);return t.blob()}};function ae(i){return i.map((e,t)=>`
|
|
1
|
+
function ce(i){i.querySelectorAll("select:not([data-themed])").forEach(e=>{e.dataset.themed="true";let t=document.createElement("details");t.className="slm-themed-picker";let n=document.createElement("summary"),s=document.createElement("div");s.className="slm-themed-options";let r=e.getAttribute("aria-label")||Array.from(e.labels??[]).map(a=>a.textContent).join(" ")||"Choose option";n.setAttribute("aria-label",r.trim()),t.append(n,s),e.after(t),e.hidden=!0;let o=()=>{n.textContent=e.selectedOptions[0]?.textContent??"Choose\u2026",n.setAttribute("aria-disabled",String(e.disabled)),s.replaceChildren(...Array.from(e.options).map(a=>{let l=document.createElement("button");return l.type="button",l.textContent=a.textContent,l.setAttribute("aria-label",a.textContent??""),l.disabled=e.disabled||a.disabled,l.setAttribute("aria-pressed",String(a.selected)),l.onclick=()=>{e.value=a.value,t.open=!1,o(),n.focus(),e.dispatchEvent(new Event("change",{bubbles:!0})),o()},l}))};o(),e.addEventListener("change",o),n.onclick=a=>{if(e.disabled){a.preventDefault();return}o(),i.querySelectorAll(".slm-themed-picker").forEach(l=>{l!==t&&(l.open=!1)})},t.addEventListener("focusout",a=>{t.contains(a.relatedTarget)||(t.open=!1)}),t.addEventListener("keydown",a=>{if(a.key==="Escape"&&(a.preventDefault(),a.stopPropagation(),t.open=!1,n.focus()),a.key==="ArrowDown"||a.key==="ArrowUp"){if(e.disabled)return;a.preventDefault(),t.open=!0;let l=Array.from(s.querySelectorAll("button:not(:disabled)")),d=l.indexOf(document.activeElement);l[(d+(a.key==="ArrowDown"?1:l.length-1)+l.length)%l.length]?.focus()}})})}var $="public",E="Public sale";function M(i){return i==null||i===""||i===$}var K=["#a78bfa","#2dd4bf","#fb923c","#60a5fa","#f472b6","#a3e635","#f87171","#38bdf8","#c084fc","#facc15"],Be="#f4b740",de="ABCDEFGHJKLMNPQRSTUVWXYZ";function q(i,e){let t=(i??"").trim();return((/\p{L}/u.exec(t)?.[0]??t[0]??"")||e).toUpperCase().slice(0,1)}function ee(i,e){let t=new Set([...e].map(r=>q(r,"")).filter(Boolean)),n=q(i,"");return{letter:de.includes(n)&&!t.has(n)?n:[...de].find(r=>!t.has(r))??(n||"X"),color:K[t.size%K.length]}}function ue(i,e=0){return M(i.id)?{letter:q(i.marker,"P"),color:i.color||Be}:{letter:q(i.marker||i.name,"?"),color:i.color||K[e%K.length]}}function pe(i,e,t){let n=new Map;for(let o of i){let a=J(e.get(o));n.set(a,(n.get(a)??0)+1)}let s=[{id:$,name:t?.publicSale?.name??E},...(t?.channels??[]).map(o=>({id:o.id,name:o.name}))],r=[];for(let o of s){let a=n.get(o.id);a&&r.push({channelId:o.id,name:o.name,count:a}),n.delete(o.id)}for(let[o,a]of n)r.push({channelId:o,name:M(o)?E:"Another channel",count:a});return r}function J(i){return M(i)?$:i}var he=12;function Q(i){return{count:i.length,labels:i.slice(0,he),truncated:i.length>he}}function me(i){let{labels:e,allocation:t,statusOf:n,nameOf:s}=i,r=J(i.targetChannelId),o=new Set,a=0,l=0,d=new Map,h=[],u=[],w=[];for(let v of e){if(o.has(v))continue;o.add(v);let p=n(v);if(!p){w.push(v);continue}let m=J(t.get(v));if(m===r){l+=1;continue}if(p==="held"){h.push(v);continue}if(p==="booked"){u.push(v);continue}m===$?a+=1:d.set(m,(d.get(m)??0)+1)}let x=[...d.entries()].map(([v,p])=>({channelId:v,name:s(v),count:p}));return{changedFromPublic:{count:a},movedFromOtherChannel:{count:x.reduce((v,p)=>v+p.count,0),channels:x},alreadyInTarget:{count:l},skippedHeld:Q(h),skippedBooked:Q(u),notFound:Q(w)}}function X(i){return i.changedFromPublic.count+i.movedFromOtherChannel.count}function ge(i){return i.movedFromOtherChannel.count>0}function be(i,e){let t=[];i.changedFromPublic.count&&t.push({kind:"add",icon:"+",count:i.changedFromPublic.count,text:`${i.changedFromPublic.count.toLocaleString()} from ${E}`});for(let n of i.movedFromOtherChannel.channels)t.push({kind:"move",icon:"\u21C4",count:n.count,text:`${n.count.toLocaleString()} moved out of ${n.name??"another channel"}`,why:"needs this confirmation"});return i.alreadyInTarget.count&&t.push({kind:"same",icon:"=",count:i.alreadyInTarget.count,text:`${i.alreadyInTarget.count.toLocaleString()} already in ${e}`,why:"unchanged"}),i.skippedHeld.count&&t.push({kind:"skip",icon:"\u23F8",count:i.skippedHeld.count,text:`${i.skippedHeld.count.toLocaleString()} in a buyer's checkout`,why:"can't move while held",peek:Y(i.skippedHeld)}),i.skippedBooked.count&&t.push({kind:"skip",icon:"\u{1F512}",count:i.skippedBooked.count,text:`${i.skippedBooked.count.toLocaleString()} already sold`,why:"sales are never rewritten",peek:Y(i.skippedBooked)}),i.notFound.count&&t.push({kind:"skip",icon:"?",count:i.notFound.count,text:`${i.notFound.count.toLocaleString()} not on this map`,why:"these seats are no longer part of the event",peek:Y(i.notFound)}),t}function Y(i){if(!i.labels.length)return;let e=i.labels.slice(0,4).join(", ");return i.truncated||i.labels.length>4?`${e}\u2026`:e}function ve(i){let e=i?.retryAfterMs??(i?.latestHoldExpiresAt?Math.max(0,i.latestHoldExpiresAt-Date.now()):0);if(!e)return"in a moment";let t=Math.ceil(e/6e4);return t<=1?"in about a minute":`in about ${t} minutes`}function fe(i){if(!i||!i.intent)return"\u2014";let e=i.intent==="server"?"Website integration":i.intent==="hosted_link"?"Buyer link":i.intent==="internal"?"Your staff sell these":"Protected reserve",t=i.hasActiveGrants?"in use now":i.lastMintAt?`last used ${new Date(i.lastMintAt).toLocaleDateString()}`:null,n=i.detail??t;return n?`${e} \xB7 ${n}`:e}function _(i){return i==="internal"?"Sell through your own staff":i==="server"?"Integrate a website or app":i==="hosted_link"?"Sell with a buyer link":"Keep as protected reserve"}function ye(i){switch(i){case"internal":return"Only your own box office can sell these seats, through your secret key. Buyer links and website integrations are refused.";case"server":return"Your website's backend mints each buyer a short-lived session for these seats. Buyer links are refused; the code lives on the Embed page.";case"hosted_link":return"SeatLayer makes a link you send to a named group. They open it and buy only these seats. No other route can sell them.";default:return"Nobody can buy these seats. Every way of letting a buyer in \u2014 a buyer link, your website, even your own staff \u2014 is refused while this is the route. The seats stay out of public sale."}}function qe(i){return i==="hosted_link"?"hosted_link":i==="server"?"server":i==="staff"?"internal":null}function G(i){let e=Z(i?.accessIntent),t=qe(i?.route),n=`This channel is set to "${_(e)}"`;return t?`${n}, so it cannot do that. Switch it to "${_(t)}" first.`:`${n}, so it cannot do that. Choose a different route for this channel first.`}function Z(i){return i==="internal"||i==="server"||i==="hosted_link"||i==="none"?i:"none"}function F(i,e,t){return`${i.toLocaleString()} ${i===1?e:t}`}function ke(i){let e=Math.max(0,i?.liveAccessLinks??0),t=Math.max(0,i?.activeSessions??0),n=Z(i?.from),s=Z(i?.to),o=`${[e?F(e,"buyer link is live","buyer links are live"):null,t?F(t,"buyer is in a checkout","buyers are in a checkout"):null].filter(Boolean).join(", and ")||"Buyers are inside this channel"} on "${_(n)}". Moving it to "${_(s)}" changes what happens to them.`,a=[];return e&&a.push(`${F(e,"buyer link closes","buyer links close")} immediately. Anyone who has not opened it yet never will \u2014 send a new link if you still need one.`),t&&a.push(`${F(t,"buyer who is already in a checkout keeps","buyers who are already in a checkout keep")} their seats and can finish paying. Nobody is thrown out. No new buyers come in this way, so the old route empties on its own within 12 hours.`),{headline:o,consequences:a}}var te={maxRedemptions:100,maxQuantity:4};function we(i){switch(i.status??i.state){case"active":return{text:"Active",kind:"active"};case"expired":return{text:"Expired",kind:"archived"};case"exhausted":return{text:"All used",kind:"paused"};case"rotated":return{text:"Replaced",kind:"archived"};default:return{text:"Revoked",kind:"archived"}}}function ne(i){return i.state==="active"&&i.status==="active"}function _e(i){return Number.isFinite(i)?new Date(i).toLocaleString(void 0,{day:"numeric",month:"short",year:"numeric",hour:"numeric",minute:"2-digit"}):"\u2014"}function se(i){return[{k:"Expires",v:_e(i.expiresAt)},{k:"Redemptions",v:`${i.redemptions.toLocaleString()} of ${i.maxRedemptions.toLocaleString()} used`},{k:"Seats per buyer",v:`${i.maxQuantity.toLocaleString()} seat${i.maxQuantity===1?"":"s"} maximum`},{k:"Covers",v:i.includePublic?"This channel's allocation and Public sale seats":"This channel's allocation only"}]}function j(i){let e=i?.serverMessage?.trim();switch(i?.code){case"invalid_expiry":case"invalid_max_redemptions":case"invalid_max_quantity":case"invalid_session_ttl":case"invalid_label":return e||"That setting is outside what a hosted link allows. Adjust it and try again.";case"too_many_access_links":return e||"This channel already has as many live links as it can hold. Revoke one before creating another.";case"access_link_not_active":return"That link is no longer active, so it cannot be rotated or revoked.";case"channel_unavailable":return"This channel is paused or archived, so it cannot let new buyers in. Resume it first.";case"channel_access_intent_forbids":return G(i?.details);case"end_active_sessions_required":return"Choose what happens to the buyers who already came in through this link.";case"not_found":return"That link is no longer here. Refresh and try again.";default:return i?.status===403?"Hosted access links need channel-management permission.":e||"That did not go through. Try again."}}function tt(i){return(i?.channels??[]).map(e=>({kind:"skip",icon:"\u26A0",count:e.count,text:`${e.count.toLocaleString()} would leave ${e.name??"a channel"}`,why:"the new chart no longer has these seats",peek:e.labels?.length?Y({count:e.count,labels:e.labels,truncated:e.truncated??!1}):void 0}))}function xe(i){return i==="builtin"?"Built-in":i==="active"?"Active":i==="paused"?"Paused":"Archived"}var b=class extends Error{constructor(e,t,n,s,r,o){super(t),this.name="ManageApiError",this.status=e,this.code=n,this.conflicts=s,this.details=r,this.serverMessage=o}};async function Se(i){let t=(i.headers.get("content-type")??"").includes("application/json")?await i.json().catch(()=>null):null;if(!i.ok){let n=t;throw new b(i.status,n?.error??`request_failed_${i.status}`,n?.code,n?.conflicts,n?.details,typeof n?.message=="string"?n.message:void 0)}return t}function C(i){return i&&typeof i=="object"?i:{}}function W(i,e,t=0){return typeof i=="number"&&Number.isFinite(i)?i:typeof e=="number"&&Number.isFinite(e)?e:t}function Ce(i,e){return i===null?null:typeof i=="number"&&Number.isFinite(i)?i:i!==void 0?null:typeof e=="number"&&Number.isFinite(e)?e:null}function Le(i){let e=C(i),t=W(e.bookedValue,e.bookedRevenue);return{...e,bookedValue:t,bookedRevenue:t}}function Oe(i){let e=C(i),t=C(e.report),n=Array.isArray(t.byCategory)?t.byCategory.map(r=>{let o=C(r),a=W(o.bookedValue,o.bookedRevenue);return{...o,bookedValue:a,bookedRevenue:a}}):[],s=Array.isArray(t.bySection)?t.bySection.map(Le):void 0;return{...e,report:{...t,byCategory:n,...s?{bySection:s}:{}}}}function ze(i){let e=C(i),t=C(e.bookedValue),n=C(e.revenue),s=Object.keys(t).length?t:n,r=Array.isArray(t.bySection)?t.bySection:Array.isArray(n.bySection)?n.bySection:[],o={...s,gross:W(t.gross,n.gross),bySection:r.map(Le)},a=C(e.velocity),l=Array.isArray(a.bySection)?a.bySection.map(d=>{let h=C(d),u=W(h.bookedValue,h.grossRevenue);return{...h,bookedValue:u,grossRevenue:u}}):[];return{...e,bookedValue:o,revenue:o,velocity:{...a,bySection:l}}}function Ue(i){let e=C(i),t=C(e.report),n=typeof t.includesBookedValue=="boolean"?t.includesBookedValue:t.includesRevenue===!0,s=Array.isArray(t.rows)?t.rows.map(a=>{let l=C(a),d=C(l.attribution),h=Ce(d.bookedValue,d.revenue);return{...l,attribution:{...d,bookedValue:h,revenue:h}}}):[],r=C(t.totals),o=Ce(r.bookedValue,r.revenue);return{...e,report:{...t,includesBookedValue:n,includesRevenue:n,rows:s,totals:{...r,bookedValue:o,revenue:o}}}}function ie(i){let e=C(i),t=typeof e.includesBookedValue=="boolean"?e.includesBookedValue:e.includesRevenue===!0;return{...e,includesBookedValue:t,includesRevenue:t}}var $e=class{constructor(e,t){this.base=e.replace(/\/+$/,""),this.token=t}setToken(e){this.token=e}auth(e,t={}){let n=t.method??"GET",s={Authorization:`Bearer ${this.token}`},r;return t.body!==void 0&&(s["Content-Type"]="application/json",r=JSON.stringify(t.body)),fetch(`${this.base}${e}`,{method:n,headers:s,body:r,credentials:"omit"}).then(o=>Se(o))}async authBlob(e){let t=await fetch(`${this.base}${e}`,{method:"GET",headers:{Authorization:`Bearer ${this.token}`},credentials:"omit"});return t.ok||await Se(t),t.blob()}chart(e){return this.auth(`/v1/events/${encodeURIComponent(e)}/chart`)}asset(e,t){return/^[a-zA-Z0-9._-]+$/.test(t)?this.authBlob(`/v1/events/${encodeURIComponent(e)}/assets/${encodeURIComponent(t)}`):Promise.reject(new b(404,"not_found","not_found"))}objects(e){return this.auth(`/v1/events/${encodeURIComponent(e)}/objects`)}subscribeTicket(e){return this.auth(`/v1/events/${encodeURIComponent(e)}/subscribe-tickets`,{method:"POST"})}socketUrl(e){return`${this.base.replace(/^http/,"ws")}/pub/events/${encodeURIComponent(e)}/subscribe?surface=manager`}block(e,t,n={}){let s={labels:t};return typeof n.releaseAt=="number"&&(s.releaseAt=n.releaseAt),n.reason&&(s.reason=n.reason),this.auth(`/v1/events/${encodeURIComponent(e)}/block`,{method:"POST",body:s})}unblock(e,t){return this.auth(`/v1/events/${encodeURIComponent(e)}/unblock`,{method:"POST",body:{labels:t}})}unblockAll(e){return this.auth(`/v1/events/${encodeURIComponent(e)}/unblock-all`,{method:"POST"})}unbook(e,t,n){return this.auth(`/v1/events/${encodeURIComponent(e)}/unbook`,{method:"POST",body:{labels:t,bookingRef:n}})}setHoldTtl(e,t){return this.auth(`/v1/events/${encodeURIComponent(e)}/hold-ttl`,{method:"POST",body:{holdTtlMs:t}})}setCategory(e,t,n){return this.auth(`/v1/events/${encodeURIComponent(e)}/category-assignments`,{method:"POST",body:{labels:t,categoryKey:n}})}setTableBooking(e,t,n,s={}){return this.auth(`/v1/events/${encodeURIComponent(e)}/table-booking`,{method:"POST",body:{tableIds:t,mode:n,...s}})}bookings(e,t={}){let n=new URLSearchParams;t.q&&n.set("q",t.q),t.state&&n.set("state",t.state),t.cursor&&n.set("cursor",t.cursor),t.limit!=null&&n.set("limit",String(t.limit));let s=n.toString();return this.auth(`/v1/events/${encodeURIComponent(e)}/bookings${s?`?${s}`:""}`)}booking(e,t){return this.auth(`/v1/events/${encodeURIComponent(e)}/bookings/${encodeURIComponent(t)}`)}listBookings(e,t={}){return this.bookings(e,t)}retrieveBooking(e,t){return this.booking(e,t)}availability(e){return this.auth(`/v1/events/${encodeURIComponent(e)}/availability`)}setAvailability(e,t){return this.auth(`/v1/events/${encodeURIComponent(e)}/availability`,{method:"POST",body:{rules:t}})}channels(e,t={}){let n=t.includeArchived?"?includeArchived=1":"";return this.auth(`/v1/events/${encodeURIComponent(e)}/channels${n}`)}channelAllocation(e,t={}){let n=new URLSearchParams;t.afterLabel&&n.set("afterLabel",t.afterLabel),t.limit!=null&&n.set("limit",String(t.limit));let s=n.toString();return this.auth(`/v1/events/${encodeURIComponent(e)}/channels/allocation${s?`?${s}`:""}`)}channelAudit(e,t={}){let n=new URLSearchParams;t.limit!=null&&n.set("limit",String(t.limit)),t.before!=null&&n.set("before",String(t.before));let s=n.toString();return this.auth(`/v1/events/${encodeURIComponent(e)}/channels/audit${s?`?${s}`:""}`)}createChannel(e,t){return this.auth(`/v1/events/${encodeURIComponent(e)}/channels`,{method:"POST",body:t})}renameChannel(e,t,n){return this.auth(`/v1/events/${encodeURIComponent(e)}/channels/${encodeURIComponent(t)}`,{method:"PATCH",body:{name:n}})}updateChannelPricing(e,t,n,s){return this.auth(`/v1/events/${encodeURIComponent(e)}/channels/${encodeURIComponent(t)}`,{method:"PATCH",body:{priceOverrides:n,expectedPricingVersion:s}})}setChannelPaused(e,t,n){let s=n?"pause":"unpause";return this.auth(`/v1/events/${encodeURIComponent(e)}/channels/${encodeURIComponent(t)}/${s}`,{method:"POST",body:{}})}archiveChannel(e,t,n){return this.auth(`/v1/events/${encodeURIComponent(e)}/channels/${encodeURIComponent(t)}/archive`,{method:"POST",body:{destination:n}})}applyChannelAssignment(e,t){return this.auth(`/v1/events/${encodeURIComponent(e)}/channels/assignments`,{method:"POST",body:{targetChannelId:t.targetChannelId||null,labels:t.labels,assignmentVersion:t.assignmentVersion}})}channelPreview(e,t,n={}){let s=new URLSearchParams;t.length&&s.set("channelIds",t.join(",")),n.includePublic!=null&&s.set("includePublic",n.includePublic?"1":"0");let r=s.toString();return this.auth(`/v1/events/${encodeURIComponent(e)}/channels/preview${r?`?${r}`:""}`)}setChannelAccessIntent(e,t,n,s={}){return this.auth(`/v1/events/${encodeURIComponent(e)}/channels/${encodeURIComponent(t)}`,{method:"PATCH",body:{accessIntent:n,...s.acknowledgeLiveAccess?{acknowledgeLiveAccess:!0}:{},...s.reason?{reason:s.reason}:{}}})}createAccessLink(e,t,n={}){return this.auth(`/v1/events/${encodeURIComponent(e)}/channels/${encodeURIComponent(t)}/access-links`,{method:"POST",body:n})}accessLinks(e,t){return this.auth(`/v1/events/${encodeURIComponent(e)}/channels/${encodeURIComponent(t)}/access-links`)}rotateAccessLink(e,t,n,s){return this.auth(`/v1/events/${encodeURIComponent(e)}/channels/${encodeURIComponent(t)}/access-links/${encodeURIComponent(n)}/rotate`,{method:"POST",body:{endActiveSessions:s}})}revokeAccessLink(e,t,n,s=!1){let r=s?"?endActiveSessions=1":"";return this.auth(`/v1/events/${encodeURIComponent(e)}/channels/${encodeURIComponent(t)}/access-links/${encodeURIComponent(n)}${r}`,{method:"DELETE"})}report(e){return this.auth(`/v1/events/${encodeURIComponent(e)}/report`).then(Oe)}seatHistory(e,t,n,s){let r=new URLSearchParams({label:t});return n&&r.set("before",String(n)),s&&r.set("action",s),this.auth(`/v1/events/${encodeURIComponent(e)}/seat-history?${r}`)}controlRoom(e,t=15){return this.auth(`/v1/events/${encodeURIComponent(e)}/control-room?window=${t}`).then(ze)}channelReport(e){return this.auth(`/v1/events/${encodeURIComponent(e)}/channels/report`).then(Ue)}createChannelReportLink(e,t,n={}){return this.auth(`/v1/events/${encodeURIComponent(e)}/channels/${encodeURIComponent(t)}/report-links`,{method:"POST",body:n}).then(s=>{let r=C(s);return{...r,link:ie(r.link)}})}channelReportLinks(e,t){return this.auth(`/v1/events/${encodeURIComponent(e)}/channels/${encodeURIComponent(t)}/report-links`).then(n=>{let s=C(n);return{links:Array.isArray(s.links)?s.links.map(ie):[]}})}revokeChannelReportLink(e,t,n){return this.auth(`/v1/events/${encodeURIComponent(e)}/channels/${encodeURIComponent(t)}/report-links/${encodeURIComponent(n)}`,{method:"DELETE"}).then(s=>{let r=C(s);return{...r,link:ie(r.link)}})}log(e,t={}){let n=new URLSearchParams;t.limit!=null&&n.set("limit",String(t.limit)),t.before!=null&&n.set("before",String(t.before));let s=n.toString();return this.auth(`/v1/events/${encodeURIComponent(e)}/log${s?`?${s}`:""}`)}async reportCsv(e){let t=await fetch(`${this.base}/v1/events/${encodeURIComponent(e)}/report.csv`,{headers:{Authorization:`Bearer ${this.token}`},credentials:"omit"});if(!t.ok)throw new b(t.status,`request_failed_${t.status}`);return t.blob()}};function ae(i){return i.map((e,t)=>`
|
|
2
2
|
<div class="slm-ch-bucket" style="animation-delay:${Math.min(t,4)*30}ms">
|
|
3
3
|
<span class="ico ${e.kind}" aria-hidden="true">${c(e.icon)}</span>
|
|
4
4
|
<span><b>${e.count.toLocaleString()}</b> ${c(e.text.replace(/^[\d,.\s]+/,""))}
|
|
5
5
|
${e.why?`<span class="why">\u2014 ${c(e.why)}</span>`:""}</span>
|
|
6
6
|
${e.peek?`<span class="peek">${c(e.peek)}</span>`:"<span></span>"}
|
|
7
|
-
</div>`).join("")}var
|
|
7
|
+
</div>`).join("")}var Re=`
|
|
8
8
|
<p class="slm-eyebrow" style="margin-top:18px">On your website</p>
|
|
9
9
|
<p class="slm-hint">There is nothing more to set up on this screen. Your own server mints a short-lived buyer
|
|
10
10
|
access session for this channel with the SeatLayer server SDK and hands it to the widget. A channel name
|
|
11
11
|
on its own never grants access.</p>
|
|
12
12
|
<p class="slm-note"><a class="slm-linkbtn" href="https://docs.seatlayer.io/server-api/channels"
|
|
13
|
-
target="_blank" rel="noreferrer noopener">Read the website integration guide \u2192</a></p>`;function c(i){return String(i??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function
|
|
13
|
+
target="_blank" rel="noreferrer noopener">Read the website integration guide \u2192</a></p>`;function c(i){return String(i??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function Ae(i){return new Date(i-new Date(i).getTimezoneOffset()*6e4).toISOString().slice(0,16)}function oe(i,e){let t=i.querySelector(e)?.value.trim()??"",n=Number(t);return t!==""&&Number.isInteger(n)?n:null}function re(i){let e=i.querySelector("[data-ch-lk-url]");if(e)try{let t=document.createRange();t.selectNodeContents(e);let n=window.getSelection();n?.removeAllRanges(),n?.addRange(t)}catch{}}var Ne=8,Ve="#6e7bff",je="#b9c0ff",Fe="#303846",Ye="#4b5669",Ke="#101723";function Ie(i){let e=i.canvas,t=i.layer;if(!e||!t)return;let n=i.host.mapLayer.getBoundingClientRect(),s=Math.max(1,Math.round(n.width)),r=Math.max(1,Math.round(n.height)),o=typeof devicePixelRatio=="number"?Math.min(3,Math.max(1,devicePixelRatio)):1;(e.width!==s*o||e.height!==r*o)&&(e.width=s*o,e.height=r*o);let a=i.resolveCtx();if(!a)return;a.setTransform(o,0,0,o,0,0),a.clearRect(0,0,s,r);let l=i.host.isSeatDetail(),d=Math.max(3,i.host.seatPixelSize()),h=d/2,u=i.view==="preview"?i.previewProjection:null,w=u?new Set(u.available===!1?[]:u.eligible??[]):null,x=new Map,v=!l&&i.host.sections().length>1?new Map:null,p=i.view==="preview"&&l&&d<=15?new Map:null;for(let m of i.host.seats()){let T=i.host.statusOf(m.label)??"free",H=i.allocation.get(m.label)??$;if(H!==$){let y=x.get(H)??{x:0,y:0,n:0};y.x+=m.x,y.y+=m.y,y.n+=1,x.set(H,y)}if(!l){let y=i.host.sectionOfLabel(m.label),f=y?i.host.worldToScreen({x:m.x,y:m.y}):null;if(v&&y&&f){let g=v.get(y.id)??{label:y.label,minX:f.x,minY:f.y,maxX:f.x,maxY:f.y};g.minX=Math.min(g.minX,f.x),g.minY=Math.min(g.minY,f.y),g.maxX=Math.max(g.maxX,f.x),g.maxY=Math.max(g.maxY,f.y),v.set(y.id,g)}continue}if(T!=="free")continue;let B=null,R=null;if(i.view==="preview"?w?.has(m.label)?(B=Ve,R=je):(B=Fe,R=Ye):H!==$&&(B=i.markerFor(H).color,R=Ke),!B)continue;let k=i.host.worldToScreen({x:m.x,y:m.y});if(k&&!(k.x<-d||k.y<-d||k.x>s+d||k.y>r+d)){if(p){let y=i.host.sectionOfLabel(m.label);if(y){let f=p.get(y.id)??{label:y.label,minX:k.x,minY:k.y,maxX:k.x,maxY:k.y};f.minX=Math.min(f.minX,k.x),f.minY=Math.min(f.minY,k.y),f.maxX=Math.max(f.maxX,k.x),f.maxY=Math.max(f.maxY,k.y),p.set(y.id,f)}}if(a.fillStyle=B,i.view==="preview"||H!==$){let y=Math.max(2,h+Math.min(1.5,h*.06));a.globalAlpha=1,a.beginPath(),a.arc(k.x,k.y,y,0,Math.PI*2),a.fill(),a.strokeStyle=R??B,a.lineWidth=i.view==="preview"?Math.max(1,Math.min(1.75,d*.13)):Math.max(1,Math.min(1.5,d*.1)),a.stroke(),i.view==="preview"&&w?.has(m.label)&&d>=22&&Xe(a,m.label,k.x,k.y,y)}else a.globalAlpha=.85,a.fillRect(k.x-h,k.y-h,d,d)}}a.globalAlpha=1,p&&We(a,p),Ge(v,i),Qe(x,i,a)}function Xe(i,e,t,n,s){let r=s*1.55,o=Math.min(13,Math.max(7,s*.55)),a=6;for(;o>=a&&(i.font=`800 ${o}px var(--slm-font, system-ui, sans-serif)`,!(i.measureText(e).width<=r));)o-=.5;o<a||(i.fillStyle="#ffffff",i.textAlign="center",i.textBaseline="middle",i.fillText(e,t,n))}function Ge(i,e){let t=e.layer;if(t&&(t.querySelectorAll(".slm-ch-section-target").forEach(n=>n.remove()),!!i))for(let[n,s]of i){let r=s.maxX-s.minX,o=s.maxY-s.minY;if(r<20||o<20)continue;let a=document.createElement("button");a.type="button",a.className="slm-ch-section-target",a.style.left=`${s.minX-8}px`,a.style.top=`${s.minY-8}px`,a.style.width=`${r+16}px`,a.style.height=`${o+16}px`,a.setAttribute("aria-label",`Open ${s.label} seats`),a.addEventListener("click",()=>e.onSectionTargetClick(n)),t.appendChild(a)}}function We(i,e){for(let t of e.values()){let n=t.maxX-t.minX,s=t.maxY-t.minY;if(n<52||s<26)continue;let r=(t.minX+t.maxX)/2,o=(t.minY+t.maxY)/2,a=Math.max(11,Math.min(15,s*.16));i.font=`800 ${a}px var(--slm-font, system-ui, sans-serif)`;let l=Math.min(n-8,i.measureText(t.label).width+18),d=a+10;i.fillStyle="rgba(11, 16, 28, .88)",i.fillRect(r-l/2,o-d/2,l,d),i.fillStyle="#f8fafc",i.textAlign="center",i.textBaseline="middle",i.fillText(t.label,r,o)}}function Qe(i,e,t){let n=e.layer;if(!n||(n.querySelectorAll(".slm-ch-flag").forEach(r=>r.remove()),e.view==="preview"))return;let s=[...i.entries()].sort((r,o)=>o[1].n-r[1].n).slice(0,Ne);for(let[r,o]of s){let a=e.list?.channels.find(u=>u.id===r);if(!a)continue;let l=e.host.worldToScreen({x:o.x/o.n,y:o.y/o.n});if(!l)continue;let d=e.markerFor(r),h=document.createElement("span");h.className="slm-ch-flag",h.style.left=`${l.x}px`,h.style.top=`${l.y}px`,h.innerHTML=`<span class="mk" style="background:${c(d.color)}">${c(d.letter)}</span>${c(a.name)}${a.state==="paused"?" \xB7 Paused":""}`,n.appendChild(h)}}var Je=`
|
|
14
14
|
.slm{--slm-mo-instant:80ms;--slm-mo-quick:140ms;--slm-mo-base:200ms;--slm-mo-slow:320ms;--slm-mo-ambient:2000ms;
|
|
15
15
|
--slm-mo-out:cubic-bezier(.2,.8,.2,1);--slm-mo-in-out:cubic-bezier(.4,0,.2,1);--slm-mo-exit:cubic-bezier(.4,0,1,1);
|
|
16
16
|
--slm-mo-spring:cubic-bezier(.34,1.3,.64,1)}
|
|
17
17
|
|
|
18
18
|
/* map overlay: ONE layer, faded in as a whole (never per seat) */
|
|
19
|
-
.slm-ch-layer{position:absolute;inset:0;pointer-events:none;opacity:0;transition:opacity var(--slm-mo-base) var(--slm-mo-out)}
|
|
19
|
+
.slm-ch-layer{position:absolute;inset:0;overflow:hidden;pointer-events:none;opacity:0;transition:opacity var(--slm-mo-base) var(--slm-mo-out)}
|
|
20
20
|
.slm-ch-layer.on{opacity:1}
|
|
21
21
|
.slm-ch-canvas{position:absolute;inset:0;width:100%;height:100%}
|
|
22
22
|
.slm-ch-flag{position:absolute;display:flex;align-items:center;gap:5px;padding:3px 8px;border-radius:999px;
|
|
@@ -68,7 +68,13 @@ var $="public",E="Public sale";function M(i){return i==null||i===""||i===$}var K
|
|
|
68
68
|
.slm-ch-mapnav .slm-ch-viewseg{margin:8px 0 5px}
|
|
69
69
|
.slm-ch-mapnav p{margin:0;font-size:11px;line-height:1.45;color:var(--slm-muted)}
|
|
70
70
|
.slm-ch-list{display:flex;flex-direction:column;gap:8px;margin-bottom:12px}
|
|
71
|
-
.slm-ch-
|
|
71
|
+
.slm-ch-listhead{display:flex;align-items:center;justify-content:space-between;gap:8px;margin:8px 0}
|
|
72
|
+
.slm-ch-listhead h2{margin:0;font-size:14px}
|
|
73
|
+
.slm .slm-ch-listhead .slm-linkbtn{font-size:11px;color:var(--slm-text)}
|
|
74
|
+
.slm[data-theme=light] .slm-ch-badge.active,.slm[data-theme=light] .slm-ch-counts .free b{color:#137047}
|
|
75
|
+
.slm[data-theme=light] .slm-ch-badge.paused,.slm[data-theme=light] .slm-ch-badge.builtin{color:#815705}
|
|
76
|
+
.slm[data-theme=light] .slm-ch-badge.archived{color:var(--slm-muted)}
|
|
77
|
+
.slm-ch-row{padding:8px 9px;border:1px solid var(--slm-line);border-radius:10px;background:var(--slm-surface);
|
|
72
78
|
text-align:left;width:100%;display:block;transition:border-color var(--slm-mo-quick) var(--slm-mo-out)}
|
|
73
79
|
.slm-ch-row:hover{border-color:var(--slm-muted)}
|
|
74
80
|
.slm-ch-row.on{border-color:var(--slm-accent);box-shadow:0 0 0 1px color-mix(in srgb,var(--slm-accent) 40%,transparent)}
|
|
@@ -83,7 +89,7 @@ var $="public",E="Public sale";function M(i){return i==null||i===""||i===$}var K
|
|
|
83
89
|
.slm-ch-badge.active{background:rgba(34,160,107,.16);color:#5bd39b}
|
|
84
90
|
.slm-ch-badge.paused,.slm-ch-badge.builtin{background:rgba(244,183,64,.15);color:#f7ca6b}
|
|
85
91
|
.slm-ch-badge.archived{background:rgba(139,148,172,.18);color:#c2c9d8}
|
|
86
|
-
.slm-ch-counts{display:flex;gap:10px;flex-wrap:wrap;margin-top:
|
|
92
|
+
.slm-ch-counts{display:flex;gap:10px;flex-wrap:wrap;margin-top:5px;font-size:11px;color:var(--slm-muted);
|
|
87
93
|
font-variant-numeric:tabular-nums}
|
|
88
94
|
.slm-ch-counts b{color:var(--slm-text);font-weight:800}
|
|
89
95
|
.slm-ch-counts .free b{color:#5bd39b}
|
|
@@ -132,11 +138,11 @@ var $="public",E="Public sale";function M(i){return i==null||i===""||i===$}var K
|
|
|
132
138
|
.slm-ch-dist .slm-btn{width:100%;margin-top:2px}
|
|
133
139
|
.slm-ch-alert{display:flex;align-items:flex-start;gap:9px;padding:11px 13px;border-radius:10px;font-size:12.5px;
|
|
134
140
|
line-height:1.5;margin-bottom:12px}
|
|
135
|
-
.slm-ch-alert.warn{background:rgba(244,183,64,.1);border:1px solid rgba(244,183,64,.4);color
|
|
136
|
-
.slm-ch-alert.info{background:rgba(110,123,255,.12);border:1px solid rgba(110,123,255,.44);color
|
|
137
|
-
.slm-ch-alert.err{background:rgba(229,72,77,.1);border:1px solid rgba(229,72,77,.45);color
|
|
138
|
-
.slm-ch-alert b{color
|
|
139
|
-
.slm-ch-alert button{display:block;margin-top:6px;color
|
|
141
|
+
.slm-ch-alert.warn{background:rgba(244,183,64,.1);border:1px solid rgba(244,183,64,.4);color:var(--slm-text)}
|
|
142
|
+
.slm-ch-alert.info{background:rgba(110,123,255,.12);border:1px solid rgba(110,123,255,.44);color:var(--slm-text)}
|
|
143
|
+
.slm-ch-alert.err{background:rgba(229,72,77,.1);border:1px solid rgba(229,72,77,.45);color:var(--slm-text)}
|
|
144
|
+
.slm-ch-alert b{color:inherit}
|
|
145
|
+
.slm-ch-alert button{display:block;margin-top:6px;color:var(--slm-text);font-weight:800;min-height:36px}
|
|
140
146
|
.slm-ch-legend{display:flex;flex-direction:column;gap:6px;margin-top:10px}
|
|
141
147
|
.slm-ch-legend .r{display:flex;align-items:center;gap:9px;font-size:12px;color:var(--slm-muted)}
|
|
142
148
|
.slm-ch-legend .sw{width:13px;height:13px;border-radius:3.5px;flex:none}
|
|
@@ -170,7 +176,7 @@ var $="public",E="Public sale";function M(i){return i==null||i===""||i===$}var K
|
|
|
170
176
|
.slm-ch-secret{display:flex;align-items:center;gap:8px;padding:10px 12px;border:1px dashed rgba(244,183,64,.55);
|
|
171
177
|
border-radius:10px;background:rgba(244,183,64,.06);font-family:ui-monospace,Menlo,monospace;font-size:11px;
|
|
172
178
|
overflow:hidden;white-space:nowrap;text-overflow:ellipsis}
|
|
173
|
-
.slm-ch-err{color
|
|
179
|
+
.slm-ch-err{color:var(--slm-text);font-size:11.5px;margin-top:6px}
|
|
174
180
|
.slm-ch-price-list{display:flex;flex-direction:column;gap:7px}
|
|
175
181
|
.slm-ch-price-row{display:grid;grid-template-columns:minmax(0,1fr) minmax(100px,132px);align-items:center;gap:12px;
|
|
176
182
|
padding:9px 0;border-bottom:1px solid var(--slm-line)}
|
|
@@ -253,11 +259,11 @@ var $="public",E="Public sale";function M(i){return i==null||i===""||i===$}var K
|
|
|
253
259
|
.slm-ch-staged.shake{outline:2px solid #e5484d;outline-offset:2px}
|
|
254
260
|
.slm-ch-staged.done{outline:2px solid #5bd39b;outline-offset:2px}
|
|
255
261
|
}
|
|
256
|
-
`;var
|
|
262
|
+
`;var Ze=3e4,Ee=300,L=5e3,Te=class{constructor(e,t){this.active=!1;this.list=null;this.allocation=new Map;this.assignmentVersion=0;this.loadError=null;this.loading=!0;this.view="inspect";this.mapIntent="pan";this.focusedSectionId=null;this.showArchived=!1;this.detailChannelId=null;this.assignOpen=!1;this.targetChannelId="";this.conflict=!1;this.dialog=null;this.detent="medium";this.seatListLimit=Ee;this.links=[];this.linksChannelId=null;this.linksState="idle";this.listSeq=0;this.linksSeq=0;this.previewAudience=[];this.previewIncludePublic=!1;this.previewProjection=null;this.previewState="idle";this.pollTimer=null;this.layer=null;this.canvas=null;this.ctx=void 0;this.bannerEl=null;this.stagedEl=null;this.liveEl=null;this.scrimEl=null;this.lastFocus=null;this.stagedDoneTimer=null;this.lastSelectionCount=0;this.lastCounts=new Map;this.assignmentRowsCache=null;this.railHtml=null;this.allocationVersion=null;this.onVisibility=null;this.host=e,this.caps=t}enter(){this.active||(this.active=!0,this.mapIntent="pan",this.assignOpen=!1,this.focusedSectionId=null,this.assignmentRowsCache=null,this.railHtml=null,this.ensureLayer(),this.host.root.classList.add("ch-mode"),this.applySheetClasses(),this.host.sections().length>1&&this.host.showSectionOverview(),this.paintRail(),this.onInteractionChange?.(),this.refresh(),this.pollTimer=setInterval(()=>{typeof document<"u"&&document.hidden||this.refresh({quiet:!0})},Ze),typeof document<"u"&&typeof document.addEventListener=="function"&&(this.onVisibility=()=>{this.active&&!document.hidden&&this.refresh({quiet:!0})},document.addEventListener("visibilitychange",this.onVisibility)))}leave(){this.active&&(this.active=!1,this.pollTimer&&clearInterval(this.pollTimer),this.pollTimer=null,this.onVisibility&&typeof document<"u"&&document.removeEventListener("visibilitychange",this.onVisibility),this.onVisibility=null,this.railHtml=null,this.closeDialog({restoreFocus:!1}),this.links=[],this.linksChannelId=null,this.linksState="idle",this.layer?.classList.remove("on"),this.host.root.classList.remove("ch-mode","ch-preview","ch-sheet","detent-collapsed","detent-medium","detent-full"),this.setBanner(!1),this.setStaged(null))}destroy(){this.leave(),this.stagedDoneTimer&&clearTimeout(this.stagedDoneTimer),this.layer?.remove(),this.layer=null}setCapabilities(e){this.caps=e,this.active&&this.paintRail()}isActive(){return this.active}canSelect(){return this.caps.manage&&this.view==="inspect"}usesMarqueeSelection(){return this.canSelect()&&this.mapIntent==="assign"}handleSectionFocus(e){this.active&&(this.focusedSectionId=e,this.paintRail())}applyRealtimeHint(){this.active&&this.refresh({quiet:!0})}handleSelectionChange(){this.active&&(this.paintSelection(),this.paintStagedBar())}handleViewChange(){this.active&&this.paintOverlay()}handleLayoutChange(){this.active&&(this.applySheetClasses(),this.paintOverlay())}async refresh(e={}){if(!this.caps.view)return;let t=++this.listSeq,n=()=>t!==this.listSeq;try{let s=await this.host.api.channels(this.host.eventKey,{includeArchived:this.showArchived});if(n())return;if(this.list=s,this.assignmentVersion=s.assignmentVersion,this.loadError=null,this.targetChannelId||(this.targetChannelId=s.channels.find(r=>r.state==="active")?.id??$),this.allocationVersion!==s.assignmentVersion){if(await this.loadAllocation(t),n())return;this.allocationVersion=s.assignmentVersion}if(this.detailChannelId&&await this.loadLinks(this.detailChannelId),n())return;this.loading=!1,this.active&&(this.paintRail(),this.paintOverlay())}catch(s){if(n())return;this.loading=!1,s instanceof b&&s.status===403&&(this.caps={view:!1,manage:!1}),this.loadError=s,e.quiet||this.host.onError(s),this.active&&this.paintRail()}}async loadAllocation(e){let t=new Map,n;for(let s=0;s<200;s+=1){if(e!==void 0&&e!==this.listSeq)return;let r=await this.host.api.channelAllocation(this.host.eventKey,{afterLabel:n,limit:1e3});for(let o of r.allocations)M(o.channelId)||t.set(o.label,o.channelId);if(this.assignmentVersion=r.assignmentVersion,!r.nextAfterLabel)break;n=r.nextAfterLabel}e!==void 0&&e!==this.listSeq||(this.allocation=t)}channelById(e){if(M(e))return{id:$,name:this.list?.publicSale?.name??E,marker:"P",color:null};let t=this.list?.channels.find(n=>n.id===e);return t?{id:e,name:t.name,marker:t.marker,color:t.color}:null}nameOf(e){return this.channelById(e)?.name??null}markerFor(e){let t=Math.max(0,this.list?.channels.findIndex(s=>s.id===e)??0),n=this.channelById(e);return ue(n??{id:e,name:"?",marker:null,color:null},t)}assignableChannels(){return[{id:$,name:this.list?.publicSale.name??E},...(this.list?.channels??[]).filter(e=>e.state!=="archived").map(e=>({id:e.id,name:e.name}))]}currentPlan(){let e=this.host.selectionLabels(),t=me({labels:e,targetChannelId:this.targetChannelId,allocation:this.allocation,statusOf:n=>this.host.statusOf(n),nameOf:n=>this.nameOf(n)});return{labels:e,buckets:t,target:this.targetChannelId}}ensureLayer(){if(this.layer)return;let e=document.createElement("div");e.className="slm-ch-layer",e.innerHTML=`
|
|
257
263
|
<canvas class="slm-ch-canvas" data-ch="canvas" aria-hidden="true"></canvas>
|
|
258
264
|
<div class="slm-ch-banner" data-ch="banner" role="status"></div>
|
|
259
265
|
<div class="slm-ch-staged" data-ch="staged" role="group" aria-label="Staged channel changes"></div>
|
|
260
|
-
<div class="slm-ch-live" data-ch="live" role="status" aria-live="polite"></div>`,this.host.mapLayer.appendChild(e),this.layer=e,this.canvas=e.querySelector('[data-ch="canvas"]'),this.bannerEl=e.querySelector('[data-ch="banner"]'),this.stagedEl=e.querySelector('[data-ch="staged"]'),this.liveEl=e.querySelector('[data-ch="live"]'),requestAnimationFrame(()=>e.classList.add("on"))}announce(e){this.liveEl&&(this.liveEl.textContent=e)}paintOverlay(){let e=this.canvas,t=this.layer;!e||!t||
|
|
266
|
+
<div class="slm-ch-live" data-ch="live" role="status" aria-live="polite"></div>`,this.host.mapLayer.appendChild(e),this.layer=e,this.canvas=e.querySelector('[data-ch="canvas"]'),this.bannerEl=e.querySelector('[data-ch="banner"]'),this.stagedEl=e.querySelector('[data-ch="staged"]'),this.liveEl=e.querySelector('[data-ch="live"]'),requestAnimationFrame(()=>e.classList.add("on"))}announce(e){this.liveEl&&(this.liveEl.textContent=e)}paintOverlay(){let e=this.canvas,t=this.layer;!e||!t||Ie({layer:t,canvas:e,resolveCtx:()=>{if(this.ctx===void 0)try{this.ctx=e.getContext("2d")}catch{this.ctx=null}return this.ctx},host:this.host,view:this.view,previewProjection:this.previewProjection,allocation:this.allocation,focusedSectionId:this.focusedSectionId,list:this.list,markerFor:n=>this.markerFor(n),onSectionTargetClick:n=>{this.focusedSectionId=n,this.host.focusSection(n),this.paintRail()}})}setStaged(e,t=""){let n=this.stagedEl;if(n){if(!e){n.classList.remove("on","done","shake"),n.innerHTML="";return}n.innerHTML=e,n.className=`slm-ch-staged on${t?` ${t}`:""}`}}paintStagedBar(){if(!this.active||this.view==="preview"||!this.caps.manage){this.setStaged(null);return}let{labels:e,buckets:t}=this.currentPlan();if(this.host.onStagedChange?.(X(t)),!e.length){this.setStaged(null);return}let n=this.nameOf(this.targetChannelId)??E,s=X(t),r=e.length>L,o=t.skippedHeld.count+t.skippedBooked.count,a=[`<b>${e.length.toLocaleString()}</b> selected`,`<b>+${s.toLocaleString()}</b> to ${c(n)}`];t.alreadyInTarget.count&&a.push(`<b>${t.alreadyInTarget.count.toLocaleString()}</b> already in`),o&&a.push(`<b>${o.toLocaleString()}</b> can't move now`),this.setStaged(`
|
|
261
267
|
<span>${a.join(" \xB7 ")}</span>
|
|
262
268
|
<span class="grow"></span>
|
|
263
269
|
<button type="button" class="drop" data-ch-act="discard">Discard</button>
|
|
@@ -273,49 +279,38 @@ var $="public",E="Public sale";function M(i){return i==null||i===""||i===$}var K
|
|
|
273
279
|
Everything else on this event still works.
|
|
274
280
|
<button type="button" data-ch-act="retry">Try again</button></span></div>`)&&e.querySelector('[data-ch-act="retry"]')?.addEventListener("click",()=>{this.refresh()});return}let t=this.host.selectionLabels(),n=this.host.isCompact()?'<div class="slm-ch-grab"><span class="slm-ch-grabbar"></span></div>':"",s=this.viewSegmentHtml(),r=this.view==="preview"?this.previewRailHtml():this.detailChannelId?this.detailRailHtml(this.detailChannelId):t.length&&this.caps.manage?this.selectionRailHtml(t):this.listRailHtml();this.setRailHtml(`${n}${s}${r}`)&&this.wireRail(),this.paintStagedBar()}viewSegmentHtml(){let e=this.view==="inspect"?" on":"",t=this.view==="preview"?" on":"";return`<div class="slm-ch-viewseg" role="group" aria-label="Channels view">
|
|
275
281
|
<button type="button" class="${e.trim()}" data-ch-view="inspect"
|
|
276
|
-
aria-pressed="${this.view==="inspect"}">
|
|
282
|
+
aria-pressed="${this.view==="inspect"}">Allocation</button>
|
|
277
283
|
<button type="button" class="${t.trim()}" data-ch-view="preview"
|
|
278
|
-
aria-pressed="${this.view==="preview"}">
|
|
279
|
-
</div>${this.mapNavigationHtml()}`}mapNavigationHtml(){if(this.host.sections().length<2)return"";let e=this.focusedSectionId?this.host.sections().find(
|
|
280
|
-
|
|
281
|
-
<button type="button" class="${n.trim()}" data-ch-map="assign" aria-pressed="${this.mapIntent==="assign"}">Assign seats</button>
|
|
282
|
-
</div>
|
|
283
|
-
<p>${this.mapIntent==="pan"?"Drag to explore. Click a section to open its seats.":"Drag across seats to select them for allocation."}</p>`:"<p>Drag to explore. Click a section to open its seats.</p>";return`<div class="slm-ch-mapnav">
|
|
284
|
-
<div class="slm-ch-mapnav-head"><span>${e?`Viewing ${c(e)}`:"Section overview"}</span>
|
|
285
|
-
<button type="button" data-ch-act="sections">All sections</button></div>
|
|
286
|
-
${s}
|
|
287
|
-
</div>`}countsHtml(e,t){let n=(s,r,o,a="")=>{let l=this.lastCounts.get(`${t}:${s}`),h=l!=null&&l!==r?" bump":"";return this.lastCounts.set(`${t}:${s}`,r),`<span class="${a}"><b class="${h.trim()}">${r.toLocaleString()}</b> ${o}</span>`};return`<span class="slm-ch-counts">
|
|
284
|
+
aria-pressed="${this.view==="preview"}">Buyer preview</button>
|
|
285
|
+
</div>${this.mapNavigationHtml()}`}mapNavigationHtml(){if(this.host.sections().length<2)return"";let e=this.focusedSectionId?this.host.sections().find(t=>t.id===this.focusedSectionId)?.label??"section":null;return e?`<div class="slm-ch-mapnav-head"><span>${c(e)}</span>
|
|
286
|
+
<button type="button" data-ch-act="sections">All sections</button></div>`:""}countsHtml(e,t){let n=(s,r,o,a="")=>{let l=this.lastCounts.get(`${t}:${s}`),d=l!=null&&l!==r?" bump":"";return this.lastCounts.set(`${t}:${s}`,r),`<span class="${a}"><b class="${d.trim()}">${r.toLocaleString()}</b> ${o}</span>`};return`<span class="slm-ch-counts">
|
|
288
287
|
${n("allocated",e.allocated,"allocated")}
|
|
289
288
|
${n("free",e.free,"free","free")}
|
|
290
289
|
${n("booked",e.booked,"sold")}
|
|
291
290
|
${e.held?n("held",e.held,"held"):""}
|
|
292
291
|
</span>`}channelRowHtml(e,t={}){let n=this.markerFor(e.id),s=t.builtin?"builtin":e.state,r=e.state==="paused"||e.state==="archived"?" dim":"",o=!t.builtin&&this.caps.manage&&this.detailChannelId!==e.id,a=`slm-ch-row${t.builtin?" public":""}${e.state==="archived"?" archived":""}${this.detailChannelId===e.id?" on":""}${o?" open":""}`,l=!t.builtin&&this.caps.manage?`<button type="button" class="slm-ch-more" data-ch-menu="${c(e.id)}"
|
|
293
|
-
aria-label="More actions for ${c(e.name)}" aria-haspopup="dialog">\u22EF</button>`:"",
|
|
294
|
-
aria-label="Open ${c(e.name)}"`:"";return`<div class="${a}"${
|
|
292
|
+
aria-label="More actions for ${c(e.name)}" aria-haspopup="dialog">\u22EF</button>`:"",d=o?` role="button" tabindex="0" data-ch-open="${c(e.id)}"
|
|
293
|
+
aria-label="Open ${c(e.name)}"`:"";return`<div class="${a}"${d}>
|
|
295
294
|
<span class="slm-ch-head">
|
|
296
295
|
<span class="slm-ch-mk${r}" style="background:${c(n.color)}" aria-hidden="true">${c(n.letter)}</span>
|
|
297
296
|
<span class="slm-ch-name">${c(e.name)}</span>
|
|
298
|
-
<span class="slm-ch-badge ${s}">${c(
|
|
297
|
+
<span class="slm-ch-badge ${s}">${c(xe(t.builtin?"builtin":e.state))}</span>
|
|
299
298
|
${l}
|
|
300
299
|
</span>
|
|
301
300
|
${this.countsHtml(e.counts,e.id||"public")}
|
|
302
|
-
${t.builtin?"":`<span class="slm-ch-access">${c(
|
|
303
|
-
</div>`}listRailHtml(){let e=this.list,t=e.channels.filter(l=>l.state==="archived").length,n=e.channels.filter(l=>this.showArchived||l.state!=="archived"),s=[this.channelRowHtml(e.publicSale,{builtin:!0}),...n.map((l,
|
|
304
|
-
<
|
|
305
|
-
<p class="slm-hint">Channel colours and names are only visible to organizers, never to buyers.</p>
|
|
301
|
+
${t.builtin?"":`<span class="slm-ch-access">${c(fe(e.access))}</span>`}
|
|
302
|
+
</div>`}listRailHtml(){let e=this.list,t=e.channels.filter(l=>l.state==="archived").length,n=e.channels.filter(l=>this.showArchived||l.state!=="archived"),s=[this.channelRowHtml(e.publicSale,{builtin:!0}),...n.map((l,d)=>this.channelRowHtml(l,{index:d}))].join(""),r=n.length?"":`<p class="slm-note" data-ch-state="list-empty">${t&&!this.showArchived?`No open channels \u2014 every seat is on public sale. ${t.toLocaleString()} archived channel${t===1?" is":"s are"} hidden below.`:"No private channels yet \u2014 every seat is on public sale."}</p>`,o=this.caps.manage?'<button type="button" class="slm-linkbtn" data-ch-act="create">+ New channel</button>':"",a=this.caps.manage?"":'<p class="slm-note">You can see how inventory is allocated. Changing it needs channel-management permission.</p>';return`
|
|
303
|
+
<div class="slm-ch-listhead"><h2>Sales channels</h2>${o}</div>
|
|
306
304
|
<div class="slm-ch-list">${s}</div>
|
|
307
305
|
${r}
|
|
308
|
-
${o}
|
|
309
306
|
${a}
|
|
310
307
|
${this.assignEntryHtml()}
|
|
311
|
-
<p class="slm-note" style="margin-top:10px">
|
|
308
|
+
<p class="slm-note" style="margin-top:10px" ${t||this.showArchived?"":"hidden"}>
|
|
312
309
|
<button type="button" class="slm-linkbtn" data-ch-act="toggle-archived" aria-pressed="${this.showArchived}"
|
|
313
310
|
style="text-align:left">${this.showArchived?"Hide":"Show"} archived${t?` (${t})`:""}</button>
|
|
314
311
|
</p>`}assignEntryHtml(){return this.caps.manage?this.assignOpen?`<div style="margin-top:8px">${this.assignmentToolsHtml({collapsible:!0})}</div>`:`
|
|
315
|
-
<button type="button" class="slm-btn
|
|
316
|
-
data-ch-act="assign-open" aria-expanded="false">Assign seats
|
|
317
|
-
<p class="slm-note">Move whole sections, rows, a dragged area or single seats out of public sale
|
|
318
|
-
and into a channel. Nothing moves until you review and apply.</p>`:""}assignmentToolsHtml(e={}){let t=this.assignableChannels().map(a=>`<option value="${c(a.id)}"${a.id===this.targetChannelId?" selected":""}>${c(a.name)}</option>`).join(""),n=this.host.sections().length?'<button type="button" class="slm-btn ghost" data-ch-act="pick-sections">Sections</button>':"",s=this.assignmentRows().length?'<button type="button" class="slm-btn ghost" data-ch-act="pick-rows">Rows</button>':"",r=this.mapIntent==="assign"?"slm-btn":"slm-btn ghost";return`
|
|
312
|
+
<button type="button" class="slm-btn" style="width:100%;margin-top:8px"
|
|
313
|
+
data-ch-act="assign-open" aria-expanded="false">Assign seats</button>`:""}assignmentToolsHtml(e={}){let t=this.assignableChannels().map(a=>`<option value="${c(a.id)}"${a.id===this.targetChannelId?" selected":""}>${c(a.name)}</option>`).join(""),n=this.host.sections().length?'<button type="button" class="slm-btn ghost" data-ch-act="pick-sections">Sections</button>':"",s=this.assignmentRows().length?'<button type="button" class="slm-btn ghost" data-ch-act="pick-rows">Rows</button>':"",r=this.mapIntent==="assign"?"slm-btn":"slm-btn ghost";return`
|
|
319
314
|
<p class="slm-eyebrow">${e.collapsible?`<button type="button" class="slm-linkbtn" data-ch-act="assign-close"
|
|
320
315
|
aria-expanded="true" style="float:right;font-weight:800">Done</button>`:""}Assign inventory</p>
|
|
321
316
|
<div class="slm-field">
|
|
@@ -332,7 +327,7 @@ var $="public",E="Public sale";function M(i){return i==null||i===""||i===$}var K
|
|
|
332
327
|
<button type="button" class="slm-btn ghost" data-ch-act="seatlist">Seat list \u2328</button>
|
|
333
328
|
</div>
|
|
334
329
|
<p class="slm-note" style="margin-bottom:18px">Choose a destination, then add whole sections,
|
|
335
|
-
multiple rows, a dragged area, or individual seats.</p>`}selectionRailHtml(e){let t=
|
|
330
|
+
multiple rows, a dragged area, or individual seats.</p>`}selectionRailHtml(e){let t=pe(e,this.allocation,this.list),n=this.conflict?`<div class="slm-ch-alert err" role="alert"><span>\u26A0</span>
|
|
336
331
|
<span><b>Assignments changed while you were editing.</b> Nothing was applied.
|
|
337
332
|
Your ${e.length.toLocaleString()}-seat selection is kept.
|
|
338
333
|
<button type="button" data-ch-act="refresh-review">Refresh and review \u2192</button></span></div>`:"",s=e.length!==this.lastSelectionCount?" bump":"";this.lastSelectionCount=e.length;let r=e.length>L,o=t.map(a=>{let l=this.markerFor(a.channelId);return`<div class="slm-ch-selsrc-row">
|
|
@@ -376,11 +371,11 @@ var $="public",E="Public sale";function M(i){return i==null||i===""||i===$}var K
|
|
|
376
371
|
<div class="slm-ch-list">${this.channelRowHtml(n)}</div>
|
|
377
372
|
${a}
|
|
378
373
|
${r}
|
|
379
|
-
${s}`}distributeHtml(e){let t=e.access?.intent??"none",n=e.access?.hasActiveGrants===!0,s=this.linksState!=="unsupported",r=this.links.some(ne),o=t==="none"?"Protected reserve \u2014 no route can sell these seats. Every buyer path is refused.":t==="internal"?"Your staff sell these seats. No buyer-facing route is open.":n?t==="server"?"Your website is letting buyers in. Only they can buy these seats.":"A buyer link is live. Only people with that link can buy these seats.":t==="server"?"Set up for your website \u2014 no buyer has come through yet. Seats stay reserved.":"Set up for buyer links \u2014 no buyer has come through yet. Seats stay reserved.",a=(l,h,
|
|
380
|
-
<b>${c(
|
|
381
|
-
<span class="why">${c(
|
|
382
|
-
${w&&!
|
|
383
|
-
data-ch-act="${c(
|
|
374
|
+
${s}`}distributeHtml(e){let t=e.access?.intent??"none",n=e.access?.hasActiveGrants===!0,s=this.linksState!=="unsupported",r=this.links.some(ne),o=t==="none"?"Protected reserve \u2014 no route can sell these seats. Every buyer path is refused.":t==="internal"?"Your staff sell these seats. No buyer-facing route is open.":n?t==="server"?"Your website is letting buyers in. Only they can buy these seats.":"A buyer link is live. Only people with that link can buy these seats.":t==="server"?"Set up for your website \u2014 no buyer has come through yet. Seats stay reserved.":"Set up for buyer links \u2014 no buyer has come through yet. Seats stay reserved.",a=(l,d,h,u)=>{let w=l===t;return`<div class="slm-ch-dist${w?" on":""}" data-ch-route="${c(l)}">
|
|
375
|
+
<b>${c(_(l))}${w?'<span class="cur">Current route</span>':""}</b>
|
|
376
|
+
<span class="why">${c(ye(l))}</span>
|
|
377
|
+
${w&&!h?"":`<button type="button" class="slm-btn${u&&!w?"":" ghost"}"
|
|
378
|
+
data-ch-act="${c(d)}">${c(h)}</button>`}
|
|
384
379
|
</div>`};return`
|
|
385
380
|
<p class="slm-eyebrow" style="margin-top:14px">Distribute</p>
|
|
386
381
|
<p class="slm-hint">${c(o)}</p>
|
|
@@ -389,14 +384,14 @@ var $="public",E="Public sale";function M(i){return i==null||i===""||i===$}var K
|
|
|
389
384
|
${a("internal","route-internal",t==="internal"?"":"Hand to your staff",!1)}
|
|
390
385
|
${a("none","route-none",t==="none"?"":"Keep as reserve",!1)}
|
|
391
386
|
${this.hostedLinksHtml()}
|
|
392
|
-
${t==="server"?
|
|
387
|
+
${t==="server"?Re:""}`}async loadLinks(e){if(!this.caps.view)return;let t=++this.linksSeq,n=()=>t!==this.linksSeq||this.linksChannelId!==e;this.linksChannelId!==e&&(this.links=[],this.linksChannelId=e,this.linksState="loading");try{let s=await this.host.api.accessLinks(this.host.eventKey,e);if(n())return;this.links=s.links??[],this.linksState="ready"}catch(s){if(n())return;let r=s instanceof b?s.status:0;this.links=[],this.linksState=r===404||r===405||r===501?"unsupported":"error",this.linksState==="error"&&this.host.onError(s)}}hostedLinksHtml(){let e='<p class="slm-eyebrow" style="margin-top:18px">Buyer links</p>';return this.linksState==="unsupported"?`${e}<div class="slm-ch-alert warn" data-ch-state="links-unsupported"><span>\u2139</span>
|
|
393
388
|
<span><b>Buyer links need a newer server.</b> Everything else on this channel works normally.</span></div>`:this.linksState==="error"?`${e}<div class="slm-ch-alert err" role="alert" data-ch-state="links-error"><span>\u26A0</span>
|
|
394
389
|
<span><b>Couldn't load this channel's links.</b> This is a failed read, not an empty list \u2014
|
|
395
390
|
any live link is still working.
|
|
396
391
|
<button type="button" data-ch-act="link-reload">Try again</button></span></div>`:this.linksState==="idle"||this.linksState==="loading"&&!this.links.length?`${e}<div class="slm-ch-busy" role="status" data-ch-state="links-loading">Loading buyer links\u2026</div>`:this.links.length?`${e}
|
|
397
392
|
${this.links.map(t=>this.linkCardHtml(t)).join("")}
|
|
398
393
|
<p class="slm-note">A link is shown once, when you create it. SeatLayer keeps only a fingerprint of it, so it
|
|
399
|
-
can never be shown again \u2014 if a link is lost, rotate it and send the fresh one.</p>`:""}linkCardHtml(e){let t=
|
|
394
|
+
can never be shown again \u2014 if a link is lost, rotate it and send the fresh one.</p>`:""}linkCardHtml(e){let t=we(e),n=e.maxRedemptions>0?Math.min(100,Math.round(e.redemptions/e.maxRedemptions*100)):0,s=se(e).map(l=>`<div class="slm-ch-lkrow"><span class="k">${c(l.k)}</span>
|
|
400
395
|
<span class="v">${c(l.v)}</span></div>`).join(""),r=e.activeSessions?`<div class="slm-ch-lkrow"><span class="k">Buyers inside now</span>
|
|
401
396
|
<span class="v">${e.activeSessions.toLocaleString()}</span></div>`:"",o=e.lastRedeemedAt?`<div class="slm-ch-lkrow"><span class="k">Last opened</span>
|
|
402
397
|
<span class="v">${c(new Date(e.lastRedeemedAt).toLocaleString())}</span></div>`:"",a=this.caps.manage&&ne(e)?`<div class="slm-ch-row2">
|
|
@@ -421,8 +416,8 @@ var $="public",E="Public sale";function M(i){return i==null||i===""||i===$}var K
|
|
|
421
416
|
the simulation itself failed to load.
|
|
422
417
|
<button type="button" data-ch-act="preview-retry">Try again</button></span></div>`:"",a=this.previewProjection?.available===!1?`<div class="slm-ch-alert warn" role="status"><span>\u23F8</span>
|
|
423
418
|
<span><b>This private sale is not available.</b> ${c((this.previewProjection.unavailable??[]).map(u=>`${this.nameOf(u.channelId)??"This channel"} is ${u.state}`).join("; ")||"The audience cannot buy right now")}.
|
|
424
|
-
A buyer arriving with this access sees this message, not these seats.</span></div>`:"",l=this.previewProjection?.counts?.eligible??this.previewProjection?.eligible?.length,
|
|
425
|
-
This is the exact buyer-visible allocation.${this.previewProjection?.includePublic===!1?" Public sale seats are <b>not</b> included in this access.":""}</span></div>`:"",
|
|
419
|
+
A buyer arriving with this access sees this message, not these seats.</span></div>`:"",l=this.previewProjection?.counts?.eligible??this.previewProjection?.eligible?.length,d=l!=null&&this.previewProjection?.available!==!1?`<div class="slm-ch-alert info"><span>\u2713</span><span><b>${l.toLocaleString()} ${l===1?"seat is":"seats are"} available now.</b>
|
|
420
|
+
This is the exact buyer-visible allocation.${this.previewProjection?.includePublic===!1?" Public sale seats are <b>not</b> included in this access.":""}</span></div>`:"",h=M(t)?"":`
|
|
426
421
|
<label class="slm-note" style="display:flex;gap:8px;align-items:center;margin:10px 0">
|
|
427
422
|
<input type="checkbox" data-ch-includepublic ${this.previewIncludePublic?"checked":""} />
|
|
428
423
|
Also include Public sale seats in this grant
|
|
@@ -432,7 +427,7 @@ var $="public",E="Public sale";function M(i){return i==null||i===""||i===$}var K
|
|
|
432
427
|
<label for="slm-ch-audience">Audience</label>
|
|
433
428
|
<select class="slm-select" id="slm-ch-audience" data-ch-audience>${n}</select>
|
|
434
429
|
</div>
|
|
435
|
-
${
|
|
430
|
+
${h}
|
|
436
431
|
<p class="slm-hint">This is the same projection the buyer SDK receives for this audience \u2014 not a local
|
|
437
432
|
approximation. It is read-only: clicks open seat details, and no holds are created.</p>
|
|
438
433
|
${r}${o}${s}${a}
|
|
@@ -441,7 +436,7 @@ var $="public",E="Public sale";function M(i){return i==null||i===""||i===$}var K
|
|
|
441
436
|
<div class="r"><span class="sw" style="background:#3a4051"></span> Unavailable to this audience (one neutral state)</div>
|
|
442
437
|
<div class="r"><span class="sw" style="background:#22a06b"></span> Sold \u2014 same as any buyer sees</div>
|
|
443
438
|
</div>
|
|
444
|
-
${
|
|
439
|
+
${d}`}paintSelection(){this.caps.manage&&this.host.selectionLabels().length&&(this.assignOpen=!0),this.view==="inspect"&&!this.detailChannelId&&this.paintRail()}wireRail(){let e=this.host.rail;e.querySelectorAll("[data-ch-view]").forEach(o=>{o.addEventListener("click",()=>this.setView(o.dataset.chView))}),e.querySelectorAll("[data-ch-map]").forEach(o=>{o.addEventListener("click",()=>{this.mapIntent=o.dataset.chMap==="assign"?"assign":"pan",this.mapIntent==="assign"&&(this.assignOpen=!0),this.paintRail(),this.onInteractionChange?.()})}),e.querySelectorAll("[data-ch-open]").forEach(o=>{let a=()=>this.openChannel(o.dataset.chOpen);o.addEventListener("click",a),o.addEventListener("keydown",l=>{l.key!=="Enter"&&l.key!==" "&&l.key!=="Spacebar"||(l.preventDefault(),a())})}),e.querySelectorAll("[data-ch-menu]").forEach(o=>{o.addEventListener("click",a=>{a.stopPropagation(),this.openDialog({kind:"menu",channelId:o.dataset.chMenu})}),o.addEventListener("keydown",a=>{a.stopPropagation()})}),e.querySelectorAll("[data-ch-rotate]").forEach(o=>{o.addEventListener("click",()=>this.openDialog({kind:"linkRotate",channelId:this.detailChannelId,linkId:o.dataset.chRotate}))}),e.querySelectorAll("[data-ch-revoke]").forEach(o=>{o.addEventListener("click",()=>this.openDialog({kind:"linkRevoke",channelId:this.detailChannelId,linkId:o.dataset.chRevoke}))});let t=e.querySelector("[data-ch-target]");t?.addEventListener("change",()=>{this.targetChannelId=t.value,this.conflict=!1,this.paintRail()});let n=e.querySelector("[data-ch-audience]");n?.addEventListener("change",()=>{this.previewAudience=[n.value],this.loadPreview()});let s=e.querySelector("[data-ch-includepublic]");s?.addEventListener("change",()=>{this.previewIncludePublic=s.checked,this.loadPreview()}),e.querySelector(".slm-ch-grab")?.addEventListener("click",()=>this.cycleDetent()),e.querySelectorAll("[data-ch-act]").forEach(o=>{o.addEventListener("click",()=>this.railAction(o.dataset.chAct))})}openChannel(e){this.detailChannelId=e,this.paintRail(),this.loadLinks(e).then(()=>this.paintRail())}railAction(e){switch(e){case"sections":this.focusedSectionId=null,this.host.showSectionOverview(),this.paintRail();break;case"create":this.openDialog({kind:"create"});break;case"review":this.openDialog({kind:"review"});break;case"rename":this.openDialog({kind:"rename",channelId:this.detailChannelId});break;case"pricing":this.openDialog({kind:"pricing",channelId:this.detailChannelId});break;case"archive":this.openDialog({kind:"archive",channelId:this.detailChannelId});break;case"seatlist":this.openDialog({kind:"seatlist"});break;case"pause":this.togglePause();break;case"discard":this.host.clearSelection();break;case"back":this.detailChannelId=null,this.linksChannelId=null,this.links=[],this.linksState="idle",this.paintRail();break;case"link-create":this.openDialog({kind:"linkCreate",channelId:this.detailChannelId});break;case"embed-code":this.chooseWebsiteIntegration();break;case"route-internal":this.setAccessIntent("internal");break;case"route-none":this.setAccessIntent("none");break;case"link-reload":this.detailChannelId&&this.reloadLinks();break;case"retry":this.refresh();break;case"toggle-archived":this.showArchived=!this.showArchived,this.refresh();break;case"refresh-review":this.conflict=!1,this.refresh().then(()=>this.openDialog({kind:"review"}));break;case"pick-sections":this.openDialog({kind:"scope",scope:"sections"});break;case"pick-rows":this.openDialog({kind:"scope",scope:"rows"});break;case"drag-select":this.mapIntent="assign",this.paintRail(),this.onInteractionChange?.();break;case"pick-category":this.pickCategory();break;case"assign-open":this.assignOpen=!0,this.mapIntent="assign",this.paintRail(),this.onInteractionChange?.();break;case"assign-close":this.assignOpen=!1,this.mapIntent="pan",this.paintRail(),this.onInteractionChange?.();break;case"preview-retry":this.loadPreview();break;default:break}}assignmentRows(){return this.assignmentRowsCache||(this.assignmentRowsCache=this.host.rows()),this.assignmentRowsCache}pickCategory(){let e=this.host.categories();e.length&&this.promptChoice("Select a whole category",e.map(t=>({value:t.key,label:t.label})),t=>{this.host.selectByLabels(this.host.labelsInCategory(t))})}promptChoice(e,t,n){this.renderScrim(`
|
|
445
440
|
<h3 id="slm-ch-dlg-title">${c(e)}</h3>
|
|
446
441
|
<div class="slm-field">
|
|
447
442
|
<label for="slm-ch-choice">Choose one</label>
|
|
@@ -465,26 +460,26 @@ var $="public",E="Public sale";function M(i){return i==null||i===""||i===$}var K
|
|
|
465
460
|
<div class="foot">
|
|
466
461
|
<button type="button" class="quiet" data-ch-close>Cancel</button>
|
|
467
462
|
<button type="button" class="slm-btn" data-ch-add-scope disabled>Add seats</button>
|
|
468
|
-
</div>`,l=>{let
|
|
463
|
+
</div>`,l=>{let d=new Map(s.map(g=>[g.id,g])),h=new Set,u=new Set,w=new Set(this.host.selectionLabels()),x=l.querySelector("[data-ch-add-scope]"),v=l.querySelector("[data-ch-error]"),p=l.querySelector("[data-ch-scope-list]"),m=l.querySelector("[data-ch-scope-search]"),T=l.querySelector("[data-ch-scope-summary]"),H=l.querySelector("[data-ch-scope-filter]"),B=200,R="",k=()=>{let g=new Set(w);for(let P of h)for(let D of d.get(P)?.labels??[])g.add(D);return g},y=()=>{let g=k(),P=g.size-w.size,D=g.size>L;x.disabled=P===0||D,x.textContent=D?`Maximum ${L.toLocaleString()} seats`:`Add ${P.toLocaleString()} seat${P===1?"":"s"}`,v.hidden=!D,v.textContent=D?`That would make ${g.size.toLocaleString()} selected seats. Choose fewer rows or sections.`:"",T.textContent=`${h.size.toLocaleString()} row${h.size===1?"":"s"} \xB7 ${P.toLocaleString()} seat${P===1?"":"s"} added`},f=()=>{let g=[],P=0,D=0;a.forEach(([A,S],U)=>{let O=A.toLocaleLowerCase(),z=R?S.filter(I=>`${O} ${I.label.toLocaleLowerCase()}`.includes(R)):S;if(R&&!z.length)return;P+=z.length;let le=S.every(I=>h.has(I.id)),Pe=!le&&S.some(I=>h.has(I.id)),N=!!R||u.has(U),De=Math.max(0,B-D),V=N?z.slice(0,De):[];D+=V.length;let Me=S.reduce((I,He)=>I+He.labels.length,0);g.push(`<div class="slm-ch-scopegroup">
|
|
469
464
|
<button type="button" class="slm-ch-groupcheck" role="checkbox" aria-checked="${le?"true":Pe?"mixed":"false"}"
|
|
470
465
|
aria-label="Select all ${S.length.toLocaleString()} rows in ${c(A)}" data-ch-scope-group="${U}">
|
|
471
466
|
<span class="box" aria-hidden="true">\u2713</span><span>${c(A)}</span>
|
|
472
|
-
<span class="meta">${S.length.toLocaleString()} rows \xB7 ${
|
|
467
|
+
<span class="meta">${S.length.toLocaleString()} rows \xB7 ${Me.toLocaleString()} seats</span>
|
|
473
468
|
</button>
|
|
474
|
-
<button type="button" class="slm-ch-grouptoggle" aria-expanded="${
|
|
475
|
-
data-ch-scope-toggle="${U}">${
|
|
476
|
-
</div>`),g.push(...
|
|
477
|
-
aria-checked="${
|
|
469
|
+
<button type="button" class="slm-ch-grouptoggle" aria-expanded="${N}" aria-label="${N?"Hide":"Show"} rows in ${c(A)}"
|
|
470
|
+
data-ch-scope-toggle="${U}">${N?"Hide":"Show"}</button>
|
|
471
|
+
</div>`),g.push(...V.map(I=>`<button type="button" class="slm-ch-seatitem" role="checkbox"
|
|
472
|
+
aria-checked="${h.has(I.id)}" data-ch-scope-id="${c(I.id)}">
|
|
478
473
|
<span class="box" aria-hidden="true">\u2713</span><span>${c(I.label)}</span>
|
|
479
474
|
<span class="meta">${I.labels.length.toLocaleString()} seat${I.labels.length===1?"":"s"}</span>
|
|
480
|
-
</button>`)),
|
|
481
|
-
Use Drag box or the seat list instead.</div>`),H.textContent=R?`Showing ${D.toLocaleString()} of ${
|
|
475
|
+
</button>`)),N&&z.length>V.length&&g.push(`<p class="slm-ch-scopehint">${(z.length-V.length).toLocaleString()} more row${z.length-V.length===1?"":"s"}. Search to narrow the list.</p>`)}),p.innerHTML=g.join("")||(R?`<div class="slm-ch-scope-empty" data-ch-state="scope-nomatch">No sections or rows match \u201C${c(R)}\u201D.</div>`:`<div class="slm-ch-scope-empty" data-ch-state="scope-empty">This chart has no rows with selectable seats.
|
|
476
|
+
Use Drag box or the seat list instead.</div>`),H.textContent=R?`Showing ${D.toLocaleString()} of ${P.toLocaleString()} matching rows. Section checkboxes still select every row in that section.`:"Showing section groups. Expand one or search to see rows.",p.querySelectorAll("[data-ch-scope-group]").forEach(A=>A.addEventListener("click",()=>{let S=a[Number(A.dataset.chScopeGroup)]?.[1]??[],U=S.every(O=>h.has(O.id));for(let O of S)U?h.delete(O.id):h.add(O.id);f(),y()})),p.querySelectorAll("[data-ch-scope-toggle]").forEach(A=>A.addEventListener("click",()=>{let S=Number(A.dataset.chScopeToggle);u.has(S)?u.delete(S):u.add(S),f()})),p.querySelectorAll("[data-ch-scope-id]").forEach(A=>A.addEventListener("click",()=>{let S=A.dataset.chScopeId;h.has(S)?h.delete(S):h.add(S),f(),y()}))};m.addEventListener("input",()=>{R=m.value.trim().toLocaleLowerCase(),f(),y()}),x.addEventListener("click",()=>{let g=[...k()];!h.size||g.length>L||(this.closeDialog(),this.host.selectByLabels(g))}),f(),y()});return}let o=[...r.entries()].map(([a,l])=>`
|
|
482
477
|
<div class="slm-ch-seatgroup"><span>${c(a)}</span></div>
|
|
483
|
-
${l.map(
|
|
484
|
-
aria-checked="false" data-ch-scope-id="${c(
|
|
478
|
+
${l.map(d=>`<button type="button" class="slm-ch-seatitem" role="checkbox"
|
|
479
|
+
aria-checked="false" data-ch-scope-id="${c(d.id)}">
|
|
485
480
|
<span class="box" aria-hidden="true">\u2713</span>
|
|
486
|
-
<span>${c(
|
|
487
|
-
<span class="meta">${
|
|
481
|
+
<span>${c(d.label)}</span>
|
|
482
|
+
<span class="meta">${d.labels.length.toLocaleString()} seat${d.labels.length===1?"":"s"}</span>
|
|
488
483
|
</button>`).join("")}`).join("");this.renderScrim(`
|
|
489
484
|
<h3 id="slm-ch-dlg-title">Add whole sections</h3>
|
|
490
485
|
<p class="sub">Choose one or more. They are added to the seats already selected on the map.</p>
|
|
@@ -494,7 +489,7 @@ var $="public",E="Public sale";function M(i){return i==null||i===""||i===$}var K
|
|
|
494
489
|
<div class="foot">
|
|
495
490
|
<button type="button" class="quiet" data-ch-close>Cancel</button>
|
|
496
491
|
<button type="button" class="slm-btn" data-ch-add-scope disabled>Add seats</button>
|
|
497
|
-
</div>`,a=>{let l=new Map(s.map(p=>[p.id,p])),
|
|
492
|
+
</div>`,a=>{let l=new Map(s.map(p=>[p.id,p])),d=new Set,h=new Set(this.host.selectionLabels()),u=a.querySelector("[data-ch-add-scope]"),w=a.querySelector("[data-ch-error]"),x=()=>{let p=new Set(h);for(let m of d)for(let T of l.get(m)?.labels??[])p.add(T);return p},v=()=>{let p=x(),m=p.size-h.size,T=p.size>L;u.disabled=m===0||T,u.textContent=T?`Maximum ${L.toLocaleString()} seats`:`Add ${m.toLocaleString()} seat${m===1?"":"s"}`,w.hidden=!T,w.textContent=T?`That would make ${p.size.toLocaleString()} selected seats. Choose fewer rows or sections.`:""};a.querySelectorAll("[data-ch-scope-id]").forEach(p=>{p.addEventListener("click",()=>{let m=p.dataset.chScopeId;d.has(m)?d.delete(m):d.add(m),p.setAttribute("aria-checked",String(d.has(m))),v()})}),u.addEventListener("click",()=>{let p=[...x()];!d.size||p.length>L||(this.closeDialog(),this.host.selectByLabels(p))}),v()})}openDialog(e){this.dialog=e,this.renderDialog()}renderDialog(){let e=this.dialog;e&&(e.kind==="create"?this.renderCreateDialog(e):e.kind==="review"?this.renderReviewDialog(e):e.kind==="scope"?this.renderScopeDialog(e):e.kind==="archive"?this.renderArchiveDialog(e):e.kind==="rename"?this.renderRenameDialog(e):e.kind==="pricing"?this.renderPricingDialog(e):e.kind==="seatlist"?this.renderSeatListDialog():e.kind==="menu"?this.renderMenuDialog(e):e.kind==="linkCreate"?this.renderLinkCreateDialog(e):e.kind==="linkRotate"?this.renderLinkRotateDialog(e):e.kind==="linkRevoke"?this.renderLinkRevokeDialog(e):e.kind==="intentSwitch"&&this.renderIntentSwitchDialog(e))}renderIntentSwitchDialog(e){let t=this.list?.channels.find(o=>o.id===e.channelId),n=e.intentTo;if(!t||!n||!this.caps.manage){this.closeDialog();return}let{headline:s,consequences:r}=ke(e.switchBlocked);this.renderScrim(`
|
|
498
493
|
<h3 id="slm-ch-dlg-title">Change how ${c(t.name)} reaches buyers?</h3>
|
|
499
494
|
<p class="sub">${c(s)}</p>
|
|
500
495
|
<div class="slm-ch-alert warn" role="alert"><span>\u26A0</span><span>
|
|
@@ -506,9 +501,9 @@ var $="public",E="Public sale";function M(i){return i==null||i===""||i===$}var K
|
|
|
506
501
|
<div class="foot">
|
|
507
502
|
<button type="button" class="quiet" data-ch-close>Leave it as it is</button>
|
|
508
503
|
<button type="button" class="slm-btn" data-ch-intent-ack${e.busy?" disabled":""}>
|
|
509
|
-
${e.busy?"Changing\u2026":`Change to "${c(
|
|
504
|
+
${e.busy?"Changing\u2026":`Change to "${c(_(n))}"`}</button>
|
|
510
505
|
</div>`,o=>{o.querySelector("[data-ch-intent-ack]")?.addEventListener("click",()=>{this.acknowledgeIntentSwitch(n,e.pendingLink??null)})})}async acknowledgeIntentSwitch(e,t){let n=this.detailChannelId;if(!n){this.closeDialog();return}if(this.dialog&&(this.dialog.busy=!0,this.renderDialog()),!await this.setAccessIntent(e,{acknowledgeLiveAccess:!0})){this.dialog?.kind==="intentSwitch"&&(this.dialog.busy=!1,this.renderDialog());return}if(!t){this.closeDialog();return}this.dialog?.kind==="intentSwitch"&&(this.dialog.busy=!1,this.renderDialog()),await this.mintLink(n,t)}renderScrim(e,t){let n=this.scrimEl;n||(this.lastFocus=document.activeElement??null),n?.remove();let s=document.createElement("div");s.className="slm-ch-scrim",s.innerHTML=`<div class="slm-ch-dialog" role="dialog" aria-modal="true"
|
|
511
|
-
aria-labelledby="slm-ch-dlg-title" tabindex="-1">${e}</div>`,this.host.root.appendChild(s),this.scrimEl=s;let r=s.firstElementChild;r.querySelectorAll("[data-ch-close]").forEach(a=>{a.addEventListener("click",()=>this.closeDialog())}),s.addEventListener("keydown",a=>{if(a.key==="Escape"){a.stopPropagation(),this.closeDialog();return}if(a.key!=="Tab")return;let l=[...r.querySelectorAll('button:not([disabled]),select,input,textarea,a[href],[tabindex]:not([tabindex="-1"])')];if(!l.length)return;let
|
|
506
|
+
aria-labelledby="slm-ch-dlg-title" tabindex="-1">${e}</div>`,this.host.root.appendChild(s),this.scrimEl=s;let r=s.firstElementChild;r.querySelectorAll("[data-ch-close]").forEach(a=>{a.addEventListener("click",()=>this.closeDialog())}),s.addEventListener("keydown",a=>{if(a.key==="Escape"){a.stopPropagation(),this.closeDialog();return}if(a.key!=="Tab")return;let l=[...r.querySelectorAll('summary,button:not([disabled]),select:not([hidden]),input,textarea,a[href],[tabindex]:not([tabindex="-1"])')];if(!l.length)return;let d=l[0],h=l[l.length-1];a.shiftKey&&document.activeElement===d?(a.preventDefault(),h.focus()):!a.shiftKey&&document.activeElement===h&&(a.preventDefault(),d.focus())}),t(r),ce(r),(r.querySelector("input,summary,button")??r).focus()}closeDialog(e={}){this.dialog=null,this.scrimEl?.remove(),this.scrimEl=null,e.restoreFocus!==!1&&this.lastFocus?.focus?.(),this.lastFocus=null}renderCreateDialog(e){let t=(this.list?.channels??[]).map(s=>q(s.marker||s.name,"")),n=ee("",t);this.renderScrim(`
|
|
512
507
|
<h3 id="slm-ch-dlg-title">Create channel</h3>
|
|
513
508
|
<p class="sub">A named allocation only the right audience can buy from. You'll pick the seats next.</p>
|
|
514
509
|
<div class="slm-field">
|
|
@@ -533,13 +528,13 @@ var $="public",E="Public sale";function M(i){return i==null||i===""||i===$}var K
|
|
|
533
528
|
<button type="button" class="quiet" data-ch-close>Cancel</button>
|
|
534
529
|
<button type="button" class="slm-btn ghost" data-ch-create="plain">Create without allocating</button>
|
|
535
530
|
<button type="button" class="slm-btn" data-ch-create="allocate">Create and allocate seats</button>
|
|
536
|
-
</div>`,s=>{let r=s.querySelector("#slm-ch-name"),o=s.querySelector("[data-ch-marker]");r.addEventListener("input",()=>{let a=ee(r.value,t);o.textContent=a.letter,o.style.background=a.color}),s.querySelectorAll("[data-ch-create]").forEach(a=>{a.addEventListener("click",()=>{let l=a.dataset.chCreate==="allocate";this.createChannel(r.value,o.textContent??"",o.style.background,s.querySelector("#slm-ch-ref")?.value??"",l)})})})}async createChannel(e,t,n,s,r){let o=e.trim();if(!o){this.showDialogError("Give the channel a name your team will recognise.");return}try{let a=await this.host.api.createChannel(this.host.eventKey,{name:o,marker:
|
|
531
|
+
</div>`,s=>{let r=s.querySelector("#slm-ch-name"),o=s.querySelector("[data-ch-marker]");r.addEventListener("input",()=>{let a=ee(r.value,t);o.textContent=a.letter,o.style.background=a.color}),s.querySelectorAll("[data-ch-create]").forEach(a=>{a.addEventListener("click",()=>{let l=a.dataset.chCreate==="allocate";this.createChannel(r.value,o.textContent??"",o.style.background,s.querySelector("#slm-ch-ref")?.value??"",l)})})})}async createChannel(e,t,n,s,r){let o=e.trim();if(!o){this.showDialogError("Give the channel a name your team will recognise.");return}try{let a=await this.host.api.createChannel(this.host.eventKey,{name:o,marker:q(t,"")||null,color:n||null,externalRef:s.trim()||null});this.closeDialog(),await this.refresh(),this.targetChannelId=a.channel.id,this.detailChannelId=r?null:a.channel.id,this.announce(`Channel ${o} created with 0 seats allocated.`),this.host.toast(r?`${o} created. Select seats on the map to allocate them.`:`${o} created.`,"ok"),this.paintRail()}catch(a){let l=a instanceof b?a.code:void 0;this.showDialogError(l==="channel_name_taken"?"That name is already used on this event. Pick another.":"Couldn't create the channel. Try again."),this.host.onError(a)}}showDialogError(e){let t=this.scrimEl?.querySelector("[data-ch-error]");t&&(t.textContent=e,t.hidden=!1)}renderReviewDialog(e){let{labels:t,buckets:n}=this.currentPlan(),s=e.applied,r=s?s.buckets:n,o=this.nameOf(s?.targetChannelId??this.targetChannelId)??E,a=be(r,o),l=s?s.applied:X(n),d=!s&&t.length>0&&l===0,h=!s&&t.length>L,u=ae(a),w=s?'<div class="foot"><button type="button" class="slm-btn" data-ch-close>Done</button></div>':`<div class="foot">
|
|
537
532
|
<button type="button" class="quiet" data-ch-close>Back</button>
|
|
538
|
-
<button type="button" class="slm-btn" data-ch-apply ${h||
|
|
533
|
+
<button type="button" class="slm-btn" data-ch-apply ${d||h||e.busy?"disabled":""}>
|
|
539
534
|
${e.busy?"Applying\u2026":`Apply ${l.toLocaleString()} change${l===1?"":"s"}`}
|
|
540
535
|
</button>
|
|
541
|
-
</div>`,x=!s&&
|
|
542
|
-
every seat is in a buyer's checkout, already sold, or already in ${c(o)}.</span></div>`:"",p=
|
|
536
|
+
</div>`,x=!s&&ge(n)?'<p class="slm-note">Applying moves inventory out of another private channel. That is the line marked above.</p>':"",v=d?`<div class="slm-ch-alert warn"><span>\u2139</span><span>Nothing in this selection can move right now \u2014
|
|
537
|
+
every seat is in a buyer's checkout, already sold, or already in ${c(o)}.</span></div>`:"",p=h?`<div class="slm-ch-alert warn" role="alert"><span>\u2139</span><span><b>Choose fewer seats.</b>
|
|
543
538
|
One Apply can cover at most ${L.toLocaleString()} seats.</span></div>`:"";this.renderScrim(`
|
|
544
539
|
<h3 id="slm-ch-dlg-title">${s?`Moved ${s.applied.toLocaleString()} seat${s.applied===1?"":"s"} to ${c(o)}`:`Move ${t.length.toLocaleString()} selected seat${t.length===1?"":"s"} to ${c(o)}`}</h3>
|
|
545
540
|
<p class="sub">${s?"These are the exact counts the server applied.":"Every selected seat is in exactly one line below."}</p>
|
|
@@ -576,11 +571,11 @@ var $="public",E="Public sale";function M(i){return i==null||i===""||i===$}var K
|
|
|
576
571
|
<div class="foot">
|
|
577
572
|
<button type="button" class="quiet" data-ch-close>Cancel</button>
|
|
578
573
|
<button type="button" class="slm-btn" data-ch-rename>Save name</button>
|
|
579
|
-
</div>`,n=>{n.querySelector("[data-ch-rename]")?.addEventListener("click",()=>{let s=n.querySelector("#slm-ch-newname")?.value??"";if(!s.trim()){this.showDialogError("A channel needs a name.");return}this.host.api.renameChannel(this.host.eventKey,t.id,s.trim()).then(()=>(this.closeDialog(),this.refresh())).catch(r=>{this.showDialogError(r instanceof b&&r.code==="channel_name_taken"?"That name is already used on this event.":"Couldn't rename the channel."),this.host.onError(r)})})})}renderPricingDialog(e){let t=this.list?.channels.find(o=>o.id===e.channelId),n=this.host.api.updateChannelPricing;if(!t||!n||!this.caps.manage){this.closeDialog();return}let s=new Map((t.priceOverrides??[]).map(o=>[`${o.categoryKey}\0${o.tierId??""}`,o.price])),r=this.host.categories().flatMap(o=>(o.tiers?.length?o.tiers:[null]).map(l=>{let
|
|
574
|
+
</div>`,n=>{n.querySelector("[data-ch-rename]")?.addEventListener("click",()=>{let s=n.querySelector("#slm-ch-newname")?.value??"";if(!s.trim()){this.showDialogError("A channel needs a name.");return}this.host.api.renameChannel(this.host.eventKey,t.id,s.trim()).then(()=>(this.closeDialog(),this.refresh())).catch(r=>{this.showDialogError(r instanceof b&&r.code==="channel_name_taken"?"That name is already used on this event.":"Couldn't rename the channel."),this.host.onError(r)})})})}renderPricingDialog(e){let t=this.list?.channels.find(o=>o.id===e.channelId),n=this.host.api.updateChannelPricing;if(!t||!n||!this.caps.manage){this.closeDialog();return}let s=new Map((t.priceOverrides??[]).map(o=>[`${o.categoryKey}\0${o.tierId??""}`,o.price])),r=this.host.categories().flatMap(o=>(o.tiers?.length?o.tiers:[null]).map(l=>{let d=l?.id??null,h=`${o.key}\0${d??""}`,u=l?.price??o.price??0,w=s.get(h),x=l?`${o.label} \xB7 ${l.name}`:o.label;return`<label class="slm-ch-price-row">
|
|
580
575
|
<span><b>${c(x)}</b><small>Event price ${c(String(u))}</small></span>
|
|
581
576
|
<input class="slm-input" type="number" min="0" max="1000000" step="0.01"
|
|
582
577
|
inputmode="decimal" aria-label="Custom price for ${c(x)}"
|
|
583
|
-
data-ch-price-category="${c(o.key)}" data-ch-price-tier="${c(
|
|
578
|
+
data-ch-price-category="${c(o.key)}" data-ch-price-tier="${c(d??"")}"
|
|
584
579
|
placeholder="${c(String(u))}" value="${w===void 0?"":c(String(w))}"
|
|
585
580
|
${e.busy?"disabled":""} />
|
|
586
581
|
</label>`})).join("");this.renderScrim(`
|
|
@@ -593,9 +588,9 @@ var $="public",E="Public sale";function M(i){return i==null||i===""||i===$}var K
|
|
|
593
588
|
<button type="button" class="slm-btn" data-ch-price-save ${e.busy||!r?"disabled":""}>
|
|
594
589
|
${e.busy?"Saving\u2026":"Save prices"}
|
|
595
590
|
</button>
|
|
596
|
-
</div>`,o=>{o.querySelector("[data-ch-price-save]")?.addEventListener("click",()=>{let a=[];for(let l of o.querySelectorAll("[data-ch-price-category]")){let
|
|
591
|
+
</div>`,o=>{o.querySelector("[data-ch-price-save]")?.addEventListener("click",()=>{let a=[];for(let l of o.querySelectorAll("[data-ch-price-category]")){let d=l.value.trim();if(!d)continue;let h=Number(d);if(!Number.isFinite(h)||h<0||h>1e6){l.focus(),this.showDialogError("Enter a price from 0 to 1,000,000, or leave the field blank.");return}a.push({categoryKey:l.dataset.chPriceCategory,tierId:l.dataset.chPriceTier||null,price:h})}this.saveChannelPricing(t,a)})})}async saveChannelPricing(e,t){let n=this.host.api.updateChannelPricing;if(!(!n||!this.dialog||this.dialog.kind!=="pricing")){this.dialog={...this.dialog,busy:!0,error:null},this.renderDialog();try{await n.call(this.host.api,this.host.eventKey,e.id,t,e.pricingVersion??0),this.closeDialog(),await this.refresh(),this.host.toast(t.length?`Custom prices saved for ${e.name}.`:`${e.name} now uses event prices.`,"ok")}catch(s){if(s instanceof b&&s.code==="channel_pricing_conflict"){await this.refresh({quiet:!0}),this.dialog={kind:"pricing",channelId:e.id,error:"Prices changed in another window. Latest values are shown \u2014 review and save again."},this.renderDialog();return}this.dialog={kind:"pricing",channelId:e.id,error:s instanceof b&&s.serverMessage?s.serverMessage:"Couldn't save these prices. Try again."},this.renderDialog(),this.host.onError(s)}}}async chooseWebsiteIntegration(){this.detailChannelId&&await this.setAccessIntent("server")}async setAccessIntent(e,t={}){let n=this.detailChannelId;if(!n||!this.caps.manage)return!1;try{let s=await this.host.api.setChannelAccessIntent(this.host.eventKey,n,e,t);return await this.refresh(),this.host.toast(this.intentSavedCopy(e,s?.intentSwitch),"ok"),!0}catch(s){return s instanceof b&&s.code==="channel_intent_switch_blocked"?(this.openDialog({kind:"intentSwitch",channelId:n,intentTo:e,switchBlocked:s.details}),!1):s instanceof b&&s.code==="channel_access_intent_forbids"?(this.host.toast(G(s.details),"err"),!1):(this.host.toast("Couldn't change how this channel reaches buyers.","err"),this.host.onError(s),!1)}}intentSavedCopy(e,t){let n=e==="server"?"Set to your website or app. The embed code is on the Embed page.":e==="internal"?"Only your own staff can sell this channel now.":e==="hosted_link"?"Set to buyer links. Create one to let buyers in.":"Kept as a protected reserve. No route can sell these seats.";if(!t)return n;let s=t.closedLinks?` ${t.closedLinks.toLocaleString()} buyer link${t.closedLinks===1?"":"s"} closed.`:"",r=t.keptSessions?` ${t.keptSessions.toLocaleString()} buyer${t.keptSessions===1?"":"s"} already in a checkout can still finish.`:"";return`${n}${s}${r}`}async togglePause(e=this.detailChannelId){let t=this.list?.channels.find(s=>s.id===e);if(!t||!this.caps.manage)return;let n=t.state!=="paused";try{await this.host.api.setChannelPaused(this.host.eventKey,t.id,n),await this.refresh(),this.host.toast(n?`${t.name} paused. Existing checkouts can finish; no new buyer access is issued.`:`${t.name} resumed.`,"ok")}catch(s){this.host.toast("Couldn't change that channel.","err"),this.host.onError(s)}}renderArchiveDialog(e){let t=this.list?.channels.find(a=>a.id===e.channelId);if(!t){this.closeDialog();return}let n=e.archiveBlocked??null,s=!n&&t.counts.held>0,r=this.assignableChannels().filter(a=>a.id!==t.id),o=n?`<div class="slm-ch-alert warn" role="alert"><span>\u23F3</span>
|
|
597
592
|
<span><b>${(n.heldUnits??n.activeHolds??0).toLocaleString()} seats are in a buyer's checkout right now.</b>
|
|
598
|
-
Archive is unavailable while seats are held \u2014 try again ${c(
|
|
593
|
+
Archive is unavailable while seats are held \u2014 try again ${c(ve(n))}.</span></div>`:s?`<div class="slm-ch-alert warn"><span>\u23F3</span>
|
|
599
594
|
<span>${t.counts.held.toLocaleString()} seats are in a buyer's checkout right now.
|
|
600
595
|
Archive is refused while any seat is held \u2014 you can try, and we'll tell you when to come back.</span></div>`:"";this.renderScrim(`
|
|
601
596
|
<h3 id="slm-ch-dlg-title">Archive ${c(t.name)}</h3>
|
|
@@ -620,17 +615,17 @@ var $="public",E="Public sale";function M(i){return i==null||i===""||i===$}var K
|
|
|
620
615
|
<span>${c(o.label)}</span>
|
|
621
616
|
${r?`<button type="button" data-ch-section="${c(r)}">Select section</button>`:""}
|
|
622
617
|
</div>
|
|
623
|
-
${o.seats.map(a=>{let l=this.allocation.get(a.label)??$,
|
|
618
|
+
${o.seats.map(a=>{let l=this.allocation.get(a.label)??$,d=this.nameOf(l)??E;return`<button type="button" class="slm-ch-seatitem" role="checkbox"
|
|
624
619
|
aria-checked="${e.has(a.label)}" data-ch-seat="${c(a.label)}">
|
|
625
620
|
<span class="box" aria-hidden="true">\u2713</span>
|
|
626
621
|
<span>${c(a.label)}</span>
|
|
627
|
-
<span class="meta">${c(
|
|
622
|
+
<span class="meta">${c(d)} \xB7 ${c(a.status)}</span>
|
|
628
623
|
</button>`}).join("")}`).join("");this.renderScrim(`
|
|
629
624
|
<h3 id="slm-ch-dlg-title">Seat list</h3>
|
|
630
625
|
<p class="sub">The same selection as the map, with checkboxes. Space or Enter toggles a seat.</p>
|
|
631
626
|
<div class="slm-ch-seatlist">${s||'<div class="slm-empty">No seats on this chart.</div>'}</div>
|
|
632
627
|
${n>this.seatListLimit?'<div class="foot"><button type="button" class="slm-btn ghost" data-ch-more>Show more seats</button></div>':""}
|
|
633
|
-
<div class="foot"><button type="button" class="slm-btn" data-ch-close>Done</button></div>`,r=>{r.querySelectorAll("[data-ch-seat]").forEach(o=>{o.addEventListener("click",()=>{let a=o.dataset.chSeat,l=new Set(this.host.selectionLabels());l.has(a)?l.delete(a):l.add(a),this.host.clearSelection(),l.size&&this.host.selectByLabels([...l]),this.renderSeatListDialog()})}),r.querySelectorAll("[data-ch-section]").forEach(o=>{o.addEventListener("click",()=>{this.host.selectSection(o.dataset.chSection),this.renderSeatListDialog()})}),r.querySelector("[data-ch-more]")?.addEventListener("click",()=>{this.seatListLimit+=
|
|
628
|
+
<div class="foot"><button type="button" class="slm-btn" data-ch-close>Done</button></div>`,r=>{r.querySelectorAll("[data-ch-seat]").forEach(o=>{o.addEventListener("click",()=>{let a=o.dataset.chSeat,l=new Set(this.host.selectionLabels());l.has(a)?l.delete(a):l.add(a),this.host.clearSelection(),l.size&&this.host.selectByLabels([...l]),this.renderSeatListDialog()})}),r.querySelectorAll("[data-ch-section]").forEach(o=>{o.addEventListener("click",()=>{this.host.selectSection(o.dataset.chSection),this.renderSeatListDialog()})}),r.querySelector("[data-ch-more]")?.addEventListener("click",()=>{this.seatListLimit+=Ee,this.renderSeatListDialog()})})}async reloadLinks(){let e=this.detailChannelId;e&&(this.linksState=this.links.length?this.linksState:"loading",await this.loadLinks(e),this.paintRail())}async reloadAfterLinkChange(e){if(this.detailChannelId===e){await this.refresh({quiet:!0});return}await this.loadLinks(e),this.active&&this.paintRail()}linkById(e){return this.links.find(t=>t.id===e)??null}renderLinkCreateDialog(e){let t=this.list?.channels.find(n=>n.id===e.channelId);if(!t||!this.caps.manage){this.closeDialog();return}this.renderScrim(`
|
|
634
629
|
<h3 id="slm-ch-dlg-title">Create a buyer link for ${c(t.name)}</h3>
|
|
635
630
|
<p class="sub">Anyone who opens the link can buy from this channel's allocation \u2014 and only from it.
|
|
636
631
|
You'll see the link once, right after you create it.</p>
|
|
@@ -669,7 +664,7 @@ var $="public",E="Public sale";function M(i){return i==null||i===""||i===$}var K
|
|
|
669
664
|
<div class="foot">
|
|
670
665
|
<button type="button" class="quiet" data-ch-close>Cancel</button>
|
|
671
666
|
<button type="button" class="slm-btn" data-ch-lk-create>Create link</button>
|
|
672
|
-
</div>`,n=>{let s=n.querySelector("[data-ch-lk-expiry]"),r=n.querySelector("[data-ch-lk-when-field]"),o=n.querySelector("#slm-ch-lk-when");s.addEventListener("change",()=>{let a=s.value==="custom";r.hidden=!a,a&&!o.value&&(o.value=
|
|
667
|
+
</div>`,n=>{let s=n.querySelector("[data-ch-lk-expiry]"),r=n.querySelector("[data-ch-lk-when-field]"),o=n.querySelector("#slm-ch-lk-when");s.addEventListener("change",()=>{let a=s.value==="custom";r.hidden=!a,a&&!o.value&&(o.value=Ae(Date.now()+7*864e5))}),n.querySelector("[data-ch-lk-create]")?.addEventListener("click",()=>{let a=oe(n,"#slm-ch-lk-redemptions"),l=oe(n,"#slm-ch-lk-quantity");if(a==null||l==null){this.showDialogError("Those two settings need to be whole numbers.");return}let d;if(s.value==="custom"&&(d=Date.parse(o.value),!Number.isFinite(d))){this.showDialogError("Pick the date and time the link should stop working.");return}this.createLink(t.id,{label:n.querySelector("#slm-ch-lk-label")?.value.trim()||null,includePublic:n.querySelector("#slm-ch-lk-public")?.checked??!1,...d===void 0?{}:{expiresAt:d},maxRedemptions:a,maxQuantity:l})})})}async createLink(e,t){await this.ensureHostedLinkRoute(e,t)&&await this.mintLink(e,t)}async mintLink(e,t){try{let n=await this.host.api.createAccessLink(this.host.eventKey,e,t);this.revealLink(n,{channelId:e}),await this.reloadAfterLinkChange(e)}catch(n){this.showDialogError(j(n instanceof b?n:void 0)),n instanceof b||this.host.onError(n)}}async ensureHostedLinkRoute(e,t){if((this.list?.channels.find(s=>s.id===e)?.access?.intent??"none")==="hosted_link")return!0;try{return await this.host.api.setChannelAccessIntent(this.host.eventKey,e,"hosted_link"),await this.refresh(),!0}catch(s){return s instanceof b&&s.code==="channel_intent_switch_blocked"?(this.openDialog({kind:"intentSwitch",channelId:e,intentTo:"hosted_link",switchBlocked:s.details,pendingLink:t}),!1):(this.showDialogError(s instanceof b&&s.code==="channel_access_intent_forbids"?G(s.details):"Couldn't set this channel up for buyer links. Try again."),s instanceof b||this.host.onError(s),!1)}}revealLink(e,t){let n=e.url;this.dialog=null;let s=t.rotated?`<div class="slm-ch-alert warn" role="status"><span>\u26A0</span><span>
|
|
673
668
|
<b>The old link has stopped working.</b> ${e.endedSessions?`${e.endedSessions.toLocaleString()} buyer${e.endedSessions===1?"":"s"} lost access immediately.`:"Buyers who already came in can finish; every new visit needs this link."}</span></div>`:"",r=se(e.link).map(o=>`<div class="slm-ch-lkrow"><span class="k">${c(o.k)}</span>
|
|
674
669
|
<span class="v">${c(o.v)}</span></div>`).join("");this.renderScrim(`
|
|
675
670
|
<h3 id="slm-ch-dlg-title">Copy this link now</h3>
|
|
@@ -687,7 +682,7 @@ var $="public",E="Public sale";function M(i){return i==null||i===""||i===$}var K
|
|
|
687
682
|
${r}
|
|
688
683
|
<div class="foot">
|
|
689
684
|
<button type="button" class="slm-btn" data-ch-close data-ch-lk-done>I've copied it</button>
|
|
690
|
-
</div>`,o=>{let a=o.querySelector("[data-ch-lk-copy]");a?.addEventListener("click",()=>{let l=()=>{a.textContent="Copied",this.announce("Buyer link copied.")},
|
|
685
|
+
</div>`,o=>{let a=o.querySelector("[data-ch-lk-copy]");a?.addEventListener("click",()=>{let l=()=>{a.textContent="Copied",this.announce("Buyer link copied.")},d=typeof navigator>"u"?null:navigator.clipboard;if(d?.writeText){d.writeText(n).then(l,()=>re(o));return}re(o)})}),this.announce("Your buyer link is ready and is shown once.")}renderLinkRotateDialog(e){let t=this.linkById(e.linkId);if(!t||!this.caps.manage){this.closeDialog();return}let n=t.activeSessions??0,s=n?`<div class="slm-ch-alert warn"><span>\u26A0</span>
|
|
691
686
|
<span><b>${n.toLocaleString()} buyer${n===1?"":"s"}</b> got in with the current link
|
|
692
687
|
and still ${n===1?"has":"have"} active access.</span></div>`:"";this.renderScrim(`
|
|
693
688
|
<h3 id="slm-ch-dlg-title">Rotate the ${c(t.label||"buyer")} link?</h3>
|
|
@@ -723,4 +718,4 @@ var $="public",E="Public sale";function M(i){return i==null||i===""||i===$}var K
|
|
|
723
718
|
<div class="foot">
|
|
724
719
|
<button type="button" class="quiet" data-ch-close>Cancel</button>
|
|
725
720
|
<button type="button" class="slm-btn danger" data-ch-lk-revoke>Revoke link</button>
|
|
726
|
-
</div>`,s=>{s.querySelector("[data-ch-lk-revoke]")?.addEventListener("click",()=>{let r=s.querySelector("[data-ch-lk-endsessions]")?.checked??!1;this.revokeLink(e.channelId,t.id,r)})})}async revokeLink(e,t,n){try{let s=await this.host.api.revokeAccessLink(this.host.eventKey,e,t,n);this.closeDialog(),await this.reloadAfterLinkChange(e),this.host.toast(s.endedSessions?`Link revoked. ${s.endedSessions.toLocaleString()} buyer${s.endedSessions===1?"":"s"} lost access.`:"Link revoked. It no longer opens for anyone.","ok")}catch(s){this.showDialogError(j(s instanceof b?s:void 0)),s instanceof b||this.host.onError(s)}}applySheetClasses(){let e=this.host.root,t=this.host.isCompact();e.classList.toggle("ch-sheet",t&&this.active);for(let n of["collapsed","medium","full"])e.classList.toggle(`detent-${n}`,t&&this.active&&this.detent===n);this.host.setMapInert(t&&this.active&&this.detent==="full")}cycleDetent(){let e=["collapsed","medium","full"];this.detent=e[(e.indexOf(this.detent)+1)%e.length],this.applySheetClasses()}handleBack(){return this.scrimEl?(this.closeDialog(),!0):this.host.isCompact()&&this.detent==="full"?(this.detent="medium",this.applySheetClasses(),!0):!1}};export{
|
|
721
|
+
</div>`,s=>{s.querySelector("[data-ch-lk-revoke]")?.addEventListener("click",()=>{let r=s.querySelector("[data-ch-lk-endsessions]")?.checked??!1;this.revokeLink(e.channelId,t.id,r)})})}async revokeLink(e,t,n){try{let s=await this.host.api.revokeAccessLink(this.host.eventKey,e,t,n);this.closeDialog(),await this.reloadAfterLinkChange(e),this.host.toast(s.endedSessions?`Link revoked. ${s.endedSessions.toLocaleString()} buyer${s.endedSessions===1?"":"s"} lost access.`:"Link revoked. It no longer opens for anyone.","ok")}catch(s){this.showDialogError(j(s instanceof b?s:void 0)),s instanceof b||this.host.onError(s)}}applySheetClasses(){let e=this.host.root,t=this.host.isCompact();e.classList.toggle("ch-sheet",t&&this.active);for(let n of["collapsed","medium","full"])e.classList.toggle(`detent-${n}`,t&&this.active&&this.detent===n);this.host.setMapInert(t&&this.active&&this.detent==="full")}cycleDetent(){let e=["collapsed","medium","full"];this.detent=e[(e.indexOf(this.detent)+1)%e.length],this.applySheetClasses()}handleBack(){return this.scrimEl?(this.closeDialog(),!0):this.host.isCompact()&&this.detent==="full"?(this.detent="medium",this.applySheetClasses(),!0):!1}};export{ce as a,b,$e as c,$ as d,E as e,M as f,q as g,ee as h,ue as i,pe as j,me as k,X as l,ge as m,be as n,ve as o,fe as p,_ as q,ye as r,G as s,ke as t,te as u,we as v,ne as w,se as x,j as y,tt as z,xe as A,ae as B,Je as C,Te as D};
|