@seatlayer/core 0.60.0 → 0.61.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- import{a as H,b as V,c as Z,d as tt,e as et,f as ot,g as rt,h as nt,i as at,j as it,k as st}from"../../chunk-XU73MULJ.js";import{a as ct,b as lt,c as ut,d as pt,e as ft,h as P}from"../../chunk-P2NJ6UO6.js";import"../../chunk-VI2CLV3Y.js";import"../../chunk-DNGP2HDT.js";import{a as L,b as z,c as F,d as J,e as Q,f as U,g as Y,h as $,i as q}from"../../chunk-ATFAQDPR.js";import"../../chunk-VI3IZS2B.js";import{ka as v,l as C,ma as g,na as R,pa as S,qa as _,va as O,w}from"../../chunk-CNCFI5RT.js";import"../../chunk-CXF32VPG.js";function b(t){return t.floors?.length?t.floors.flatMap(e=>e.objects):t.objects}function I(t){return b(t).reduce((e,r)=>r.type==="row"?e+v(r):r.type==="table"?e+S(r):r.type==="gaArea"?e+Math.max(0,Math.floor(r.capacity)):r.type==="booth"?e+1:e,0)}function bt(t){let e={};for(let o of t.categories??[])e[o.key]=0;let r=(o,a)=>{a>0&&(e[o]=(e[o]??0)+a)};for(let o of b(t))if(o.type==="row")for(let a of g(o))r(a.categoryKey,1);else if(o.type==="table")if(o.bookAsWhole||o.variableOccupancy)r(o.categoryKey,Math.max(0,Math.round(o.seatCount)));else for(let a of _(o))r(a.categoryKey,1);else o.type==="gaArea"?r(o.categoryKey,Math.max(0,Math.floor(o.capacity))):o.type==="booth"&&r(o.categoryKey,1);return e}function G(t){if(!t.template)return null;let e=b(t),r=e.filter(l=>l.type==="row"||l.type==="table"||l.type==="gaArea");if(!r.length)return null;let a=e.filter(l=>l.type==="booth").length+r.reduce((l,f)=>l+(f.type==="table"?2:1),0),s=I(t),c=Math.max(a+1,Math.min(5e4,s*4)),u=[.5,1,1.5,2].map(l=>w(Math.round(s*l),a,c));return{family:t.template.family,display:t.template.family.replace(/-/g," ").replace(/\b\w/g,l=>l.toUpperCase()),min:a,max:c,presets:["S","M","L","XL"].map((l,f)=>({size:l,seats:u[f]}))}}function A(t){let e=g(t);return e.length?C(e):{...t.origin}}function dt(t,e){let r=G(t);if(!r)return structuredClone(t);let o=structuredClone(t),a=b(o),s=a.filter(n=>n.type==="row"||n.type==="table"||n.type==="gaArea"),c=a.filter(n=>n.type==="booth").length,u=Math.max(r.min,Math.min(r.max,Math.round(e))),l=u-c,f=s.map((n,i)=>{let m=n.type==="gaArea"?Math.max(0,Math.floor(n.capacity)):n.seatCount,x=n.type==="table"?2:1;return{object:n,index:i,current:m,minimum:x,value:x,fraction:0}}),E=f.reduce((n,i)=>n+i.minimum,0),d=Math.max(0,l-E),T=f.reduce((n,i)=>n+Math.max(1,i.current-i.minimum),0);for(let n of f){let i=d*Math.max(1,n.current-n.minimum)/T,m=Math.floor(i);n.value+=m,n.fraction=i-m}d=l-f.reduce((n,i)=>n+i.value,0),f.sort((n,i)=>i.fraction-n.fraction||n.index-i.index);for(let n=0;n<d;n++)f[n%f.length].value++;f.sort((n,i)=>n.index-i.index);for(let n of f)if(n.object.type==="row"){let i=A(n.object);n.object.seatCount=n.value;let m=A(n.object);n.object.origin.x+=i.x-m.x,n.object.origin.y+=i.y-m.y}else if(n.object.type==="table"){let i=n.object;if(i.seatCountsBySide){let m=["top","bottom","left","right"],x=R(i),N=m.reduce((p,y)=>p+x[y],0)||1,h=m.map((p,y)=>{let M=n.value*x[p]/N;return{side:p,index:y,value:Math.floor(M),fraction:M-Math.floor(M)}}),k=n.value-h.reduce((p,y)=>p+y.value,0);h.sort((p,y)=>y.fraction-p.fraction||p.index-y.index);for(let p=0;p<k;p++)h[p%h.length].value+=1;h.sort((p,y)=>p.index-y.index),i.seatCountsBySide={top:h[0].value,bottom:h[1].value,left:h[2].value,right:h[3].value},i.sides=m.filter(p=>i.seatCountsBySide[p]>0)}i.seatCount=n.value,i.overrides&&(i.overrides=i.overrides.filter(m=>m.index<n.value),i.overrides.length||delete i.overrides)}else n.object.capacity=n.value;return o.floors?.length&&(o.objects=o.floors[0].objects),o.template={family:o.template.family,targetSeats:u},o=P(o).doc,o.template={family:t.template.family,targetSeats:I(o)},o}var W=1,B=100;function X(t,e){if(!Number.isInteger(e)||e<W||e>B)return null;let r=t.rotation*Math.PI/180,o={x:Math.cos(r),y:Math.sin(r)},a={x:-o.y,y:o.x};return Array.from({length:e},(s,c)=>{let u=t.style==="intertwined"&&c%2===1?t.seatSpacing/2:0;return{type:"row",id:`__block_preview_${c}`,label:"",origin:{x:t.origin.x+a.x*c*t.rowGap+o.x*u,y:t.origin.y+a.y*c*t.rowGap+o.y*u},rotation:t.rotation,curve:t.curve,seatCount:t.seatsPerRow,seatSpacing:t.seatSpacing,categoryKey:"__preview__"}})}function j(t,e=t.rowCount){let r=X(t,e);return r?.length?O(r[r.length-1]):null}function Ct(t,e){if(!Number.isFinite(e.x)||!Number.isFinite(e.y)||t.rowGap<=0)return null;let r=j(t,1);if(!r)return null;let o=t.rotation*Math.PI/180,a={x:-Math.sin(o),y:Math.cos(o)},s=(e.x-r.x)*a.x+(e.y-r.y)*a.y,c=Math.max(W,Math.min(B,Math.round(s/t.rowGap)+1)),u=j(t,c);return u?{rowCount:c,edgePoint:u}:null}function wt(t,e){return t.length!==e.rowCount?!1:[...t].sort((o,a)=>(o.rowBlockGeneration?.rowIndex??1/0)-(a.rowBlockGeneration?.rowIndex??1/0)).every((o,a)=>{let s=o.rowBlockGeneration;return s?.kind==="row-block-v1"&&s.groupId===e.groupId&&s.rowIndex===a&&s.signature===e.signature&&JSON.stringify(s)===JSON.stringify({...e,rowIndex:a})})}var Rt=1,St=300,_t=330;function D(t,e){if(t.path||!Number.isInteger(e)||e<1||e>300)return null;let r=t.seatCount>1?t.curve/(t.seatCount-1):0;return{...t,seatCount:e,curve:r*(e-1)}}function K(t,e=t.seatCount){let r=D(t,e);if(!r)return null;if(e===1)return{...r.origin};let o=r.rotation*Math.PI/180,a=r.curve/(e-1)*Math.PI/180,s,c;if(Math.abs(a)<1e-9)s=(e-1)*r.seatSpacing,c=0;else{let u=r.seatSpacing/(2*Math.sin(Math.abs(a)/2)),l=a*(e-1);s=u*Math.sin(l),c=-u+u*Math.cos(l)}return{x:r.origin.x+s*Math.cos(o)-c*Math.sin(o),y:r.origin.y+s*Math.sin(o)+c*Math.cos(o)}}function Ot(t,e){if(t.path||!Number.isFinite(e.x)||!Number.isFinite(e.y))return null;let r=t.seatCount>1?t.curve/(t.seatCount-1):0,o=Math.abs(r)<1e-9?300:Math.min(300,Math.floor(330/Math.abs(r))+1),a=null;for(let s=1;s<=Math.max(1,o);s+=1){let c=K(t,s);if(!c)continue;let u=Math.hypot(c.x-e.x,c.y-e.y),l=r*(s-1);(!a||u<a.distance||u===a.distance&&s<a.seatCount)&&(a={seatCount:s,curve:l,endpoint:c,distance:u})}return a}export{ct as CATEGORY_INVENTORY_FAMILIES,it as GroupedTableProjectionError,_t as MAX_DIRECT_ROW_SWEEP,z as MAX_EVENT_INVENTORY,L as MAX_GA_CAPACITY,B as MAX_ROW_BLOCK_ROWS,St as MAX_ROW_SEATS,W as MIN_ROW_BLOCK_ROWS,Rt as MIN_ROW_SEATS,ot as applicableTicketTiers,G as capacityControl,bt as categoryCapacity,I as chartCapacity,nt as companionSelectionIssue,pt as describeCategoryInventoryConflict,lt as effectiveSeatOwnerCategoryCounts,$ as gaAreasOf,Q as gaInventorySegments,F as gaUnitLabel,U as gaUnitLabels,st as groupedTableInventory,Y as growJoinedGAInventory,ut as inspectCategoryInventoryConflicts,wt as intactRowBlockMembers,q as isGaUnitLabel,V as pickBestAvailable,Z as pickBestAvailableInventory,ft as remediateCategoryInventoryConflicts,dt as resizeChartCapacity,Ct as resolveRowBlockCount,Ot as resolveRowTerminalCapacity,rt as resolveTicketTierForSeat,j as rowBlockEdgePoint,X as rowBlockPreviewRows,K as rowTerminalEndpoint,D as rowWithTerminalCapacity,H as strandedSingles,tt as ticketOptionNotApplicableIssue,at as ticketSelectionIssue,et as ticketTierAppliesToSeat,J as validGAInventorySegments};
1
+ import{a as ct,b as lt,c as ut,d as pt,e as ft,h as P}from"../../chunk-P2NJ6UO6.js";import{a as H,b as V,c as Z,d as tt,e as et,f as ot,g as rt,h as nt,i as at,j as it,k as st}from"../../chunk-XU73MULJ.js";import"../../chunk-VI2CLV3Y.js";import"../../chunk-DNGP2HDT.js";import{a as L,b as z,c as F,d as J,e as Q,f as U,g as Y,h as $,i as q}from"../../chunk-ATFAQDPR.js";import"../../chunk-VI3IZS2B.js";import{ka as v,l as C,ma as g,na as R,pa as S,qa as _,va as O,w}from"../../chunk-CNCFI5RT.js";import"../../chunk-CXF32VPG.js";function b(t){return t.floors?.length?t.floors.flatMap(e=>e.objects):t.objects}function I(t){return b(t).reduce((e,r)=>r.type==="row"?e+v(r):r.type==="table"?e+S(r):r.type==="gaArea"?e+Math.max(0,Math.floor(r.capacity)):r.type==="booth"?e+1:e,0)}function bt(t){let e={};for(let o of t.categories??[])e[o.key]=0;let r=(o,a)=>{a>0&&(e[o]=(e[o]??0)+a)};for(let o of b(t))if(o.type==="row")for(let a of g(o))r(a.categoryKey,1);else if(o.type==="table")if(o.bookAsWhole||o.variableOccupancy)r(o.categoryKey,Math.max(0,Math.round(o.seatCount)));else for(let a of _(o))r(a.categoryKey,1);else o.type==="gaArea"?r(o.categoryKey,Math.max(0,Math.floor(o.capacity))):o.type==="booth"&&r(o.categoryKey,1);return e}function G(t){if(!t.template)return null;let e=b(t),r=e.filter(l=>l.type==="row"||l.type==="table"||l.type==="gaArea");if(!r.length)return null;let a=e.filter(l=>l.type==="booth").length+r.reduce((l,f)=>l+(f.type==="table"?2:1),0),s=I(t),c=Math.max(a+1,Math.min(5e4,s*4)),u=[.5,1,1.5,2].map(l=>w(Math.round(s*l),a,c));return{family:t.template.family,display:t.template.family.replace(/-/g," ").replace(/\b\w/g,l=>l.toUpperCase()),min:a,max:c,presets:["S","M","L","XL"].map((l,f)=>({size:l,seats:u[f]}))}}function A(t){let e=g(t);return e.length?C(e):{...t.origin}}function dt(t,e){let r=G(t);if(!r)return structuredClone(t);let o=structuredClone(t),a=b(o),s=a.filter(n=>n.type==="row"||n.type==="table"||n.type==="gaArea"),c=a.filter(n=>n.type==="booth").length,u=Math.max(r.min,Math.min(r.max,Math.round(e))),l=u-c,f=s.map((n,i)=>{let m=n.type==="gaArea"?Math.max(0,Math.floor(n.capacity)):n.seatCount,x=n.type==="table"?2:1;return{object:n,index:i,current:m,minimum:x,value:x,fraction:0}}),E=f.reduce((n,i)=>n+i.minimum,0),d=Math.max(0,l-E),T=f.reduce((n,i)=>n+Math.max(1,i.current-i.minimum),0);for(let n of f){let i=d*Math.max(1,n.current-n.minimum)/T,m=Math.floor(i);n.value+=m,n.fraction=i-m}d=l-f.reduce((n,i)=>n+i.value,0),f.sort((n,i)=>i.fraction-n.fraction||n.index-i.index);for(let n=0;n<d;n++)f[n%f.length].value++;f.sort((n,i)=>n.index-i.index);for(let n of f)if(n.object.type==="row"){let i=A(n.object);n.object.seatCount=n.value;let m=A(n.object);n.object.origin.x+=i.x-m.x,n.object.origin.y+=i.y-m.y}else if(n.object.type==="table"){let i=n.object;if(i.seatCountsBySide){let m=["top","bottom","left","right"],x=R(i),N=m.reduce((p,y)=>p+x[y],0)||1,h=m.map((p,y)=>{let M=n.value*x[p]/N;return{side:p,index:y,value:Math.floor(M),fraction:M-Math.floor(M)}}),k=n.value-h.reduce((p,y)=>p+y.value,0);h.sort((p,y)=>y.fraction-p.fraction||p.index-y.index);for(let p=0;p<k;p++)h[p%h.length].value+=1;h.sort((p,y)=>p.index-y.index),i.seatCountsBySide={top:h[0].value,bottom:h[1].value,left:h[2].value,right:h[3].value},i.sides=m.filter(p=>i.seatCountsBySide[p]>0)}i.seatCount=n.value,i.overrides&&(i.overrides=i.overrides.filter(m=>m.index<n.value),i.overrides.length||delete i.overrides)}else n.object.capacity=n.value;return o.floors?.length&&(o.objects=o.floors[0].objects),o.template={family:o.template.family,targetSeats:u},o=P(o).doc,o.template={family:t.template.family,targetSeats:I(o)},o}var W=1,B=100;function X(t,e){if(!Number.isInteger(e)||e<W||e>B)return null;let r=t.rotation*Math.PI/180,o={x:Math.cos(r),y:Math.sin(r)},a={x:-o.y,y:o.x};return Array.from({length:e},(s,c)=>{let u=t.style==="intertwined"&&c%2===1?t.seatSpacing/2:0;return{type:"row",id:`__block_preview_${c}`,label:"",origin:{x:t.origin.x+a.x*c*t.rowGap+o.x*u,y:t.origin.y+a.y*c*t.rowGap+o.y*u},rotation:t.rotation,curve:t.curve,seatCount:t.seatsPerRow,seatSpacing:t.seatSpacing,categoryKey:"__preview__"}})}function j(t,e=t.rowCount){let r=X(t,e);return r?.length?O(r[r.length-1]):null}function Ct(t,e){if(!Number.isFinite(e.x)||!Number.isFinite(e.y)||t.rowGap<=0)return null;let r=j(t,1);if(!r)return null;let o=t.rotation*Math.PI/180,a={x:-Math.sin(o),y:Math.cos(o)},s=(e.x-r.x)*a.x+(e.y-r.y)*a.y,c=Math.max(W,Math.min(B,Math.round(s/t.rowGap)+1)),u=j(t,c);return u?{rowCount:c,edgePoint:u}:null}function wt(t,e){return t.length!==e.rowCount?!1:[...t].sort((o,a)=>(o.rowBlockGeneration?.rowIndex??1/0)-(a.rowBlockGeneration?.rowIndex??1/0)).every((o,a)=>{let s=o.rowBlockGeneration;return s?.kind==="row-block-v1"&&s.groupId===e.groupId&&s.rowIndex===a&&s.signature===e.signature&&JSON.stringify(s)===JSON.stringify({...e,rowIndex:a})})}var Rt=1,St=300,_t=330;function D(t,e){if(t.path||!Number.isInteger(e)||e<1||e>300)return null;let r=t.seatCount>1?t.curve/(t.seatCount-1):0;return{...t,seatCount:e,curve:r*(e-1)}}function K(t,e=t.seatCount){let r=D(t,e);if(!r)return null;if(e===1)return{...r.origin};let o=r.rotation*Math.PI/180,a=r.curve/(e-1)*Math.PI/180,s,c;if(Math.abs(a)<1e-9)s=(e-1)*r.seatSpacing,c=0;else{let u=r.seatSpacing/(2*Math.sin(Math.abs(a)/2)),l=a*(e-1);s=u*Math.sin(l),c=-u+u*Math.cos(l)}return{x:r.origin.x+s*Math.cos(o)-c*Math.sin(o),y:r.origin.y+s*Math.sin(o)+c*Math.cos(o)}}function Ot(t,e){if(t.path||!Number.isFinite(e.x)||!Number.isFinite(e.y))return null;let r=t.seatCount>1?t.curve/(t.seatCount-1):0,o=Math.abs(r)<1e-9?300:Math.min(300,Math.floor(330/Math.abs(r))+1),a=null;for(let s=1;s<=Math.max(1,o);s+=1){let c=K(t,s);if(!c)continue;let u=Math.hypot(c.x-e.x,c.y-e.y),l=r*(s-1);(!a||u<a.distance||u===a.distance&&s<a.seatCount)&&(a={seatCount:s,curve:l,endpoint:c,distance:u})}return a}export{ct as CATEGORY_INVENTORY_FAMILIES,it as GroupedTableProjectionError,_t as MAX_DIRECT_ROW_SWEEP,z as MAX_EVENT_INVENTORY,L as MAX_GA_CAPACITY,B as MAX_ROW_BLOCK_ROWS,St as MAX_ROW_SEATS,W as MIN_ROW_BLOCK_ROWS,Rt as MIN_ROW_SEATS,ot as applicableTicketTiers,G as capacityControl,bt as categoryCapacity,I as chartCapacity,nt as companionSelectionIssue,pt as describeCategoryInventoryConflict,lt as effectiveSeatOwnerCategoryCounts,$ as gaAreasOf,Q as gaInventorySegments,F as gaUnitLabel,U as gaUnitLabels,st as groupedTableInventory,Y as growJoinedGAInventory,ut as inspectCategoryInventoryConflicts,wt as intactRowBlockMembers,q as isGaUnitLabel,V as pickBestAvailable,Z as pickBestAvailableInventory,ft as remediateCategoryInventoryConflicts,dt as resizeChartCapacity,Ct as resolveRowBlockCount,Ot as resolveRowTerminalCapacity,rt as resolveTicketTierForSeat,j as rowBlockEdgePoint,X as rowBlockPreviewRows,K as rowTerminalEndpoint,D as rowWithTerminalCapacity,H as strandedSingles,tt as ticketOptionNotApplicableIssue,at as ticketSelectionIssue,et as ticketTierAppliesToSeat,J as validGAInventorySegments};