diff --git a/bg1.js b/bg1.js index 713d58a..6be41cf 100644 --- a/bg1.js +++ b/bg1.js @@ -1,10 +1,10 @@ -var Pi=Object.defineProperty;var Ci=e=>{throw TypeError(e)};var Di=(e,t,n)=>t in e?Pi(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var T=(e,t,n)=>Di(e,typeof t!="symbol"?t+"":t,n);var Ct=(e,t,n)=>t.has(e)?Ci("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n);var be,N,vn,re,Dt,bn,qe,lt,Ke,Je,xn,_e={},wn=[],Ai=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,$e=Array.isArray;function X(e,t){for(var n in t)e[n]=t[n];return e}function kn(e){var t=e.parentNode;t&&t.removeChild(e)}function ge(e,t,n){var r,o,s,a={};for(s in t)s=="key"?r=t[s]:s=="ref"?o=t[s]:a[s]=t[s];if(arguments.length>2&&(a.children=arguments.length>3?be.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(s in e.defaultProps)a[s]===void 0&&(a[s]=e.defaultProps[s]);return fe(e,a,r,o,null)}function fe(e,t,n,r,o){var s={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:o??++vn,__i:-1,__u:0};return o==null&&N.vnode!=null&&N.vnode(s),s}function x(e){return e.children}function Z(e,t){this.props=e,this.context=t}function oe(e,t){if(t==null)return e.__?oe(e.__,e.__i+1):null;for(var n;tt&&re.sort(qe));De.__r=0}function In(e,t,n,r,o,s,a,c,l,u,h){var d,f,p,g,E,k=r&&r.__k||wn,w=t.length;for(n.__d=l,Li(n,t,k),l=n.__d,d=0;d0?fe(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):o)!=null?(o.__=e,o.__b=e.__b+1,c=Ri(o,n,a,h),o.__i=c,s=null,c!==-1&&(h--,(s=n[c])&&(s.__u|=131072)),s==null||s.__v===null?(c==-1&&d--,typeof o.type!="function"&&(o.__u|=65536)):c!==a&&(c==a-1?d=c-a:c==a+1?d++:c>a?h>l-a?d+=c-a:d--:c(l!=null&&!(131072&l.__u)?1:0))for(;a>=0||c=0){if((l=t[a])&&!(131072&l.__u)&&o==l.key&&s===l.type)return a;a--}if(c2&&(c.children=arguments.length>3?be.call(arguments,2):n),fe(e.type,c,r||e.key,o||e.ref,null)}function q(e,t){var n={__c:t="__cC"+xn++,__:e,Consumer:function(r,o){return r.children(o)},Provider:function(r){var o,s;return this.getChildContext||(o=[],(s={})[t]=this,this.getChildContext=function(){return s},this.componentWillUnmount=function(){o=null},this.shouldComponentUpdate=function(a){this.props.value!==a.value&&o.some(function(c){c.__e=!0,Xe(c)})},this.sub=function(a){o.push(a);var c=a.componentWillUnmount;a.componentWillUnmount=function(){o&&o.splice(o.indexOf(a),1),c&&c.call(a)}}),r.children}};return n.Provider.__=n.Consumer.contextType=n}be=wn.slice,N={__e:function(e,t,n,r){for(var o,s,a;t=t.__;)if((o=t.__c)&&!o.__)try{if((s=o.constructor)&&s.getDerivedStateFromError!=null&&(o.setState(s.getDerivedStateFromError(e)),a=o.__d),o.componentDidCatch!=null&&(o.componentDidCatch(e,r||{}),a=o.__d),a)return o.__E=o}catch(c){e=c}throw e}},vn=0,Z.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=X({},this.state),typeof e=="function"&&(e=e(X({},n),this.props)),e&&X(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),Xe(this))},Z.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Xe(this))},Z.prototype.render=x,re=[],bn=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,qe=function(e,t){return e.__v.__b-t.__v.__b},De.__r=0,lt=0,Ke=Lt(!1),Je=Lt(!0),xn=0;var ae,D,He,Rt,ye=0,Pn=[],A=N,$t=A.__b,Ot=A.__r,Mt=A.diffed,Gt=A.__c,Bt=A.unmount,Ut=A.__;function xe(e,t){A.__h&&A.__h(D,e,ye||t),ye=0;var n=D.__H||(D.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function I(e){return ye=1,Gi(Cn,e)}function Gi(e,t,n){var r=xe(ae++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):Cn(void 0,t),function(c){var l=r.__N?r.__N[0]:r.__[0],u=r.t(l,c);l!==u&&(r.__N=[u,r.__[1]],r.__c.setState({}))}],r.__c=D,!D.u)){var o=function(c,l,u){if(!r.__c.__H)return!0;var h=r.__c.__H.__.filter(function(f){return!!f.__c});if(h.every(function(f){return!f.__N}))return!s||s.call(this,c,l,u);var d=!1;return h.forEach(function(f){if(f.__N){var p=f.__[0];f.__=f.__N,f.__N=void 0,p!==f.__[0]&&(d=!0)}}),!(!d&&r.__c.props===c)&&(!s||s.call(this,c,l,u))};D.u=!0;var s=D.shouldComponentUpdate,a=D.componentWillUpdate;D.componentWillUpdate=function(c,l,u){if(this.__e){var h=s;s=void 0,o(c,l,u),s=h}a&&a.call(this,c,l,u)},D.shouldComponentUpdate=o}return r.__N||r.__}function C(e,t){var n=xe(ae++,3);!A.__s&&mt(n.__H,t)&&(n.__=e,n.i=t,D.__H.__h.push(n))}function ht(e,t){var n=xe(ae++,4);!A.__s&&mt(n.__H,t)&&(n.__=e,n.i=t,D.__h.push(n))}function te(e){return ye=5,pt(function(){return{current:e}},[])}function pt(e,t){var n=xe(ae++,7);return mt(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function Q(e,t){return ye=8,pt(function(){return e},t)}function K(e){var t=D.context[e.__c],n=xe(ae++,9);return n.c=e,t?(n.__==null&&(n.__=!0,t.sub(D)),t.props.value):e.__}function Bi(){for(var e;e=Pn.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(Ce),e.__H.__h.forEach(et),e.__H.__h=[]}catch(t){e.__H.__h=[],A.__e(t,e.__v)}}A.__b=function(e){D=null,$t&&$t(e)},A.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Ut&&Ut(e,t)},A.__r=function(e){Ot&&Ot(e),ae=0;var t=(D=e.__c).__H;t&&(He===D?(t.__h=[],D.__h=[],t.__.forEach(function(n){n.__N&&(n.__=n.__N),n.i=n.__N=void 0})):(t.__h.forEach(Ce),t.__h.forEach(et),t.__h=[],ae=0)),He=D},A.diffed=function(e){Mt&&Mt(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Pn.push(t)!==1&&Rt===A.requestAnimationFrame||((Rt=A.requestAnimationFrame)||Ui)(Bi)),t.__H.__.forEach(function(n){n.i&&(n.__H=n.i),n.i=void 0})),He=D=null},A.__c=function(e,t){t.some(function(n){try{n.__h.forEach(Ce),n.__h=n.__h.filter(function(r){return!r.__||et(r)})}catch(r){t.some(function(o){o.__h&&(o.__h=[])}),t=[],A.__e(r,n.__v)}}),Gt&&Gt(e,t)},A.unmount=function(e){Bt&&Bt(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(r){try{Ce(r)}catch(o){t=o}}),n.__H=void 0,t&&A.__e(t,n.__v))};var Ht=typeof requestAnimationFrame=="function";function Ui(e){var t,n=function(){clearTimeout(r),Ht&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,100);Ht&&(t=requestAnimationFrame(n))}function Ce(e){var t=D,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),D=t}function et(e){var t=D;e.__c=e.__(),D=t}function mt(e,t){return!e||e.length!==t.length||t.some(function(n,r){return n!==e[r]})}function Cn(e,t){return typeof t=="function"?t(e):t}function Hi(e,t){for(var n in t)e[n]=t[n];return e}function tt(e,t){for(var n in e)if(n!=="__source"&&!(n in t))return!0;for(var r in t)if(r!=="__source"&&e[r]!==t[r])return!0;return!1}function zt(e,t){this.props=e,this.context=t}function ft(e,t){function n(o){var s=this.props.ref,a=s==o.ref;return!a&&s&&(s.call?s(null):s.current=null),t?!t(this.props,o)||!a:tt(this.props,o)}function r(o){return this.shouldComponentUpdate=n,ge(e,o)}return r.displayName="Memo("+(e.displayName||e.name)+")",r.prototype.isReactComponent=!0,r.__f=!0,r}(zt.prototype=new Z).isPureReactComponent=!0,zt.prototype.shouldComponentUpdate=function(e,t){return tt(this.props,e)||tt(this.state,t)};var Ft=N.__b;N.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),Ft&&Ft(e)};var jt=function(e,t){return e==null?null:ee(ee(e).map(t))},zi={map:jt,forEach:jt,count:function(e){return e?ee(e).length:0},only:function(e){var t=ee(e);if(t.length!==1)throw"Children.only";return t[0]},toArray:ee},Fi=N.__e;N.__e=function(e,t,n,r){if(e.then){for(var o,s=t;s=s.__;)if((o=s.__c)&&o.__c)return t.__e==null&&(t.__e=n.__e,t.__k=n.__k),o.__c(e,t)}Fi(e,t,n,r)};var Wt=N.unmount;function Dn(e,t,n){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(r){typeof r.__c=="function"&&r.__c()}),e.__c.__H=null),(e=Hi({},e)).__c!=null&&(e.__c.__P===n&&(e.__c.__P=t),e.__c=null),e.__k=e.__k&&e.__k.map(function(r){return Dn(r,t,n)})),e}function An(e,t,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(r){return An(r,t,n)}),e.__c&&e.__c.__P===t&&(e.__e&&n.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=n)),e}function ze(){this.__u=0,this.t=null,this.__b=null}function Ln(e){var t=e.__.__c;return t&&t.__a&&t.__a(e)}function Ee(){this.u=null,this.o=null}N.unmount=function(e){var t=e.__c;t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),Wt&&Wt(e)},(ze.prototype=new Z).__c=function(e,t){var n=t.__c,r=this;r.t==null&&(r.t=[]),r.t.push(n);var o=Ln(r.__v),s=!1,a=function(){s||(s=!0,n.__R=null,o?o(c):c())};n.__R=a;var c=function(){if(!--r.__u){if(r.state.__a){var l=r.state.__a;r.__v.__k[0]=An(l,l.__c.__P,l.__c.__O)}var u;for(r.setState({__a:r.__b=null});u=r.t.pop();)u.forceUpdate()}};r.__u++||32&t.__u||r.setState({__a:r.__b=r.__v.__k[0]}),e.then(a,a)},ze.prototype.componentWillUnmount=function(){this.t=[]},ze.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement("div"),r=this.__v.__k[0].__c;this.__v.__k[0]=Dn(this.__b,n,r.__O=r.__P)}this.__b=null}var o=t.__a&&ge(x,null,e.fallback);return o&&(o.__u&=-33),[ge(x,null,t.__a?null:e.children),o]};var Yt=function(e,t,n){if(++n[1]===n[0]&&e.o.delete(t),e.props.revealOrder&&(e.props.revealOrder[0]!=="t"||!e.o.size))for(n=e.u;n;){for(;n.length>3;)n.pop()();if(n[1]t[r.type]=r.value),{date:`${t.year}-${t.month}-${t.day}`,time:`${t.hour}:${t.minute}:${t.second}`}}function H(e){if(e??(e=L()),(e.time??"1")>"03:00:00")return e.date??L().date;const t=new Date(`${e.date}T00:00:00`);return t.setDate(t.getDate()-1),L(t).date}function sr(e,t){const n=new Date(e+"T00:00:00"),r=n.toLocaleString("en-US",{month:"long",day:"numeric"});if(t==="short")return r;const o=H();if(e===o)return`Today, ${r}`;const s=new Date(o);s.setDate(s.getDate()+1);const a=s.toISOString().split("T")[0];return e===a?`Tomorrow, ${r}`:`${n.toLocaleString("en-US",{weekday:"long"})}, ${r}`}function z(e){const t=e.split(":").slice(0,2).map(Number),n=t[0]>=12?"PM":"AM";return t[0]=t[0]%12||12,t.map(r=>String(r).padStart(2,"0")).join(":").replace(/^0/,"")+" "+n}function se(e){const[t,n]=e.slice(0,19).split("T");return{date:t,time:n}}function Ae(e){const[t,n]=e.split(":").map(Number);return(t+17)%24*60+n}function ue(e){if(!Array.isArray(e))return[];const t=L().time.slice(0,5),n=e.findIndex(r=>r>=t);return n>=0?e.slice(n):[]}const Fe=e=>Array.isArray(e)?e.join("."):e,M={get(e){const t=localStorage.getItem(Fe(e));try{return JSON.parse(t??"")}catch{return}},set(e,t){localStorage.setItem(Fe(e),JSON.stringify(t))},delete(e){localStorage.removeItem(Fe(e))},clear(){localStorage.clear()}},je=["bg1","auth"];class Mn extends Error{constructor(){super("Auth data missing or expired");T(this,"name","ReauthNeeded")}}class or{constructor(){T(this,"onUnauthorized",()=>{})}getData(){try{const t=M.get(je);if(t){const{swid:n,accessToken:r,expires:o}=t,s=L(o),a=L();if(s.date>a.date||s.date===a.date&&s.time>a.time&&s.time>="17")return{swid:n,accessToken:r}}}catch(t){console.error(t)}throw this.deleteData(),new Mn}setData(t){M.set(je,t)}deleteData(){M.delete(je),setTimeout(this.onUnauthorized)}}const V=new or,ar=8e3;async function Gn(e,t={}){const{params:n,data:r,timeout:o=ar,...s}=t;t=s,t.referrer||(t.referrer=""),t.credentials||(t.credentials="omit"),t.cache||(t.cache="no-store"),t.headers={...t.headers||{}},n&&Object.keys(n).length>0&&(e+=(e.includes("?")?"&":"?")+Object.entries(n).filter(([,u])=>u!=="").map(u=>u.map(encodeURIComponent).join("=")).join("&")),r&&(t.method||(t.method="POST"),t.headers={...t.headers,"Content-Type":"application/json"},t.body=JSON.stringify(r)),t.method||(t.method="GET");const a=new AbortController;t.signal=a.signal;const c=setTimeout(()=>a.abort(),o);let l;try{l=await fetch(e,t)}catch(u){return console.error(u),{ok:!1,status:0,data:null}}finally{clearTimeout(c)}return{ok:l.ok,status:l.status,data:(l.headers.get("Content-Type")||"").startsWith("application/json")?await l.json():{}}}class Bn extends Error{constructor(){super(...arguments);T(this,"name","InvalidOrigin")}}class de extends Error{constructor(n,r="Request failed"){super(`${r}: ${JSON.stringify(n)}`);T(this,"name","RequestError");this.response=n}}class Oe{constructor(t){T(this,"resort");T(this,"origin");this.resort=t,this.origin=this.constructor.origins[this.resort.id]}static originToResortId(t){var o;const r=(o=Object.entries(this.origins).find(([,s])=>s===t))==null?void 0:o[0];if(r)return r;throw new Bn(t)}async request(t){const{swid:n,accessToken:r}=V.getData(),o=this.origin+t.path,s=await Gn(o,{method:t.method,params:t.params,data:t.data,headers:{"Accept-Language":"en-US",Authorization:`BEARER ${r}`,"x-user-id":n}});if(s.status===401&&!t.ignoreUnauth)setTimeout(()=>V.deleteData());else{const{key:a}=t;if(s.ok&&(!a||s.data[a]))return{...s,data:a?s.data[a]:s.data}}throw new de(s)}}T(Oe,"origins",{WDW:"https://disneyworld.disney.go.com",DLR:"https://disneyland.disney.go.com"});const cr="modulepreload",lr=function(e){return"/bg1/"+e},Jt={},Le=function(t,n,r){let o=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const s=document.querySelector("meta[property=csp-nonce]"),a=(s==null?void 0:s.nonce)||(s==null?void 0:s.getAttribute("nonce"));o=Promise.all(n.map(c=>{if(c=lr(c),c in Jt)return;Jt[c]=!0;const l=c.endsWith(".css"),u=l?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${u}`))return;const h=document.createElement("link");if(h.rel=l?"stylesheet":cr,l||(h.as="script",h.crossOrigin=""),h.href=c,a&&h.setAttribute("nonce",a),document.head.appendChild(h),l)return new Promise((d,f)=>{h.addEventListener("load",d),h.addEventListener("error",()=>f(new Error(`Unable to preload CSS for ${c}`)))})}))}return o.then(()=>t()).catch(s=>{const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=s,window.dispatchEvent(a),!a.defaultPrevented)throw s})},dr={48199:"Mr-Incredible",48200:"Mrs-Incredible",261227:"Nemo",339625:"Russell",339626:"Carl",364907:"Jack-Skellington",431014:"Princess-Tiana",431065:"Darth_Vader",15549505:"Rapunzel",15655408:"Default_SignedIn",15675686:"Crush",15831168:"Wall-E",16453979:"Merida",16726412:"Stormtrooper",16818199:"Violet",16869301:"Jack-Jack",17345357:"R2-D2",17345359:"C-3PO",17532220:"Bruce",17532224:"Green-Alien",17532227:"Kermit",17532228:"Sorcerer-Mickey",17577168:"Elsa",17577169:"Anna",17813977:"Olaf",17888784:"Yoda",18101167:"Captain-Mickey",18368743:"-Nick",18368747:"-Judy",18393706:"-Flash",18403761:"kion",18405224:"-Moana",18405236:"-Elena",19633995:"50th_Mickey",19633996:"50th_Minnie",90003819:"Alice",90003846:"Ariel",90003898:"Belle",90003967:"Buzz",90003976:"Captain-Hook",90004004:"Chesire-Cat",90004017:"Cinderella",90004068:"Daisy",90004076:"Dash",90004104:"Donald",90004228:"Goofy",90004260:"Hamm",90004328:"Princess-Jasmine",90004340:"Jiminy",90004395:"Lady",90004482:"Mickey-Mouse",90004486:"Minnie",90004537:"Mulan",90004605:"Peter-Pan",90004625:"Pluto",90004626:"Pocahontas",90004642:"Princess-Aurora",90004682:"Rex",90004772:"Snow-White",90004778:"Sparky",90004846:"TinkerBell",90004860:"Tramp",90004939:"Zero"},_t="https://cdn1.parksmedia.wdprapps.disney.com/resize/mwImage/1/90/90/75/dam/",ur=_t+"wdpro-assets/avatars/180x180/RetAvatar_180x180_",hr=_t+"wdpro-assets/avatars/180x180/RetAvatar-180x180",pr=_t+"disney-world/50th-anniversary/avatars/RetAvatar_180x180_",mr={"-":hr,5:pr};function Re(e){const t=dr[e||""];if(t)return(mr[t[0]]||ur)+t+".png"}const fr=(e,t,n)=>{const r=e[t];return r?typeof r=="function"?r():Promise.resolve(r):new Promise((o,s)=>{(typeof queueMicrotask=="function"?queueMicrotask:setTimeout)(s.bind(null,new Error("Unknown variable dynamic import: "+t+(t.split("/").length!==n?". Note that variables only represent file names one level deep.":""))))})},le=e=>`/das-vas/api/v1/${e}`;function _r(e){return{id:e.id,name:e.name.replace(/ \(Me\)$/,""),avatarImageUrl:Re(e.characterId),primary:e.primary}}class nt extends Error{constructor(n){super();T(this,"name","ConflictsError");this.conflicts=n}}class gr extends Error{constructor(){super(...arguments);T(this,"name","NoPrimaryGuest")}}class Un extends Error{constructor(){super(...arguments);T(this,"name","ExperienceUnavailable")}}var ct;class yr extends Oe{constructor(){super(...arguments);T(this,"bookingGuestId");Ct(this,ct)}async experiences(n){const r=encodeURIComponent(n.id),{data:o}=await this.request({path:le(`availability/parks/${r}/experiences`),key:"experiences"});return o.filter(s=>s.available&&!!s.nextAvailableTime).map(s=>{try{return{...s,...this.resort.experience(s.id)}}catch{return s}}).sort((s,a)=>s.name.localeCompare(a.name))}async parties(){const{swid:n}=V.getData(),{data:{bookingGuestId:r,parties:o}}=await this.request({path:le(`users/${encodeURIComponent(n)}/parties`)});return this.bookingGuestId=r,o.map(s=>[{...s.primaryGuest,primary:!0},...s.linkedGuests].map(_r))}async book({park:n,experience:r,guests:o}){var d,f;const s=await this.eligibility({park:n,experience:r,guests:o}),a=new Set((d=s.find(({type:p})=>p==="ELIGIBLE"))==null?void 0:d.guestIds);if(!o.every(p=>a.has(p.id)))throw new nt(Object.fromEntries(s.filter(p=>p.type!=="ELIGIBLE").flatMap(p=>p.guestIds.map(g=>[g,p.type]))));const c=await this.availability({park:n,experience:r}),l=(f=o.find(p=>p.primary))==null?void 0:f.id,u=new Map(o.map(p=>[p.id,p])),{data:h}=await this.request({path:le("bookings"),key:"booking",data:{bookingGuestId:this.bookingGuestId,primaryGuestId:l,guestIds:o.map(p=>p.id),experienceId:r.id,startTime:c}});return{type:"DAS",subtype:"IN_PARK",id:r.id,name:r.name,park:n,guests:h.entitlements.map(p=>{const g=u.get(p.guestId);return{id:p.guestId,name:(g==null?void 0:g.name)??"",avatarImageUrl:g==null?void 0:g.avatarImageUrl,entitlementId:p.id}}),start:se(h.startDateTime),end:{},bookingId:h.id}}async cancelBooking(n){const o=n.map(s=>s.entitlementId).map(encodeURIComponent).join(",");await this.request({path:le(`entitlements/${o}`),method:"DELETE"})}async eligibility({park:n,experience:r,guests:o}={}){const s=o.find(c=>!!c.primary);if(!s)throw new gr;const{data:a}=await this.request({path:le("eligibility"),params:{experienceId:r.id,parkId:n.id,primaryGuestId:s.id,guestIds:o.map(c=>c.id).join(",")},key:"eligibility"});return a}async availability({park:n,experience:r}){const o=encodeURIComponent(r.id),s=encodeURIComponent(n.id),{data:{available:a,nextAvailableTime:c}}=await this.request({path:le(`availability/parks/${s}/experiences/${o}`),key:"experience"});if(!a||!c)throw new Un;return c}}ct=new WeakMap;class vr{constructor(t){T(this,"cachedShowtimes",{});this.resort=t}async shows(t){Object.keys(this.cachedShowtimes).length===0&&(this.cachedShowtimes=(await this.request("showtimes")).data);const n=this.cachedShowtimes[t.id]??{},{time:r}=L();return Object.fromEntries(Object.entries(n).flatMap(([o,s])=>{const a=s.filter(d=>d>=r),c=a[0],l=a.slice(1),u=c!==void 0,h=u?void 0:"NO_MORE_SHOWS";try{return[[o,{type:"ENTERTAINMENT",...this.resort.experience(o),park:t,standby:{available:u,unavailableReason:h,nextShowTime:c},additionalShowTimes:l}]]}catch(d){if(d instanceof ie)return[];throw d}}))}async request(t){const n=await Gn(`https://bg1.joelface.com/livedata/${this.resort.id.toLowerCase()}/${t}.json`);if(!n.ok)throw new Error("Fetch failed");return n}}const br=e=>e.sort((t,n)=>+n.primary-+t.primary||+n.preselected-+t.preselected||t.name.localeCompare(n.name)),xr=e=>`/application/v1/guest/${e}`;class gt extends Oe{async getQueues(){var n;const t=await this.post({resource:"getQueues"});if(!Array.isArray((n=t.data)==null?void 0:n.queues))throw new de(t);return t.data.queues.filter(r=>!!r.categoryContentId).map(({queueId:r,tabContentId:o="",...s})=>{const a={...s,id:r};try{a.park=this.resort.park(o.split(";")[0])}catch(c){if(!(c instanceof ie))throw c}return a})}async getQueue(t){const n=(await this.getQueues()).find(r=>r.id===t.id);if(n)return n;throw new Error("Queue not Found")}async getLinkedGuests(t){const{data:n}=await this.post({resource:"getLinkedGuests",data:{queueId:t.id,requestType:"REVIEW"}});return br(n.guests.map(({guestId:r,firstName:o="",lastName:s="",isPrimaryGuest:a,isPreselected:c,avatarImageUrl:l})=>({id:r,name:`${o} ${s}`.trim(),primary:!!a,preselected:!!c,avatarImageUrl:l})))}async joinQueue(t,n){const r=n.map(a=>a.id),o=await this.post({resource:"joinQueue",data:{queueId:t.id,guestIds:r}}),{data:s}=o;if(s.responseStatus==="OK"){const a=s.positions.find(c=>c.queueId===t.id&&c.guestIds.length>0&&r.some(l=>c.guestIds.includes(l)));if(!a)throw new de(o);return{boardingGroup:a.boardingGroup,conflicts:{},closed:!1}}else if(s.responseStatus==="INVALID_GUEST"||s.responseStatus==="CLOSED_QUEUE"){const a=s.responseStatus==="CLOSED_QUEUE",c=new Set,l={};for(const d of s.conflicts)for(const f of d.guestIds){const p=n.find(g=>g.id===f);p&&(l[p.id]=d.conflictType,c.add(f))}const u=n.filter(d=>!c.has(d.id));if(a||u.length===0)return{boardingGroup:null,conflicts:l,closed:a};const h=await this.joinQueue(t,u);return h.conflicts={...l,...h.conflicts},h}else throw new de(o)}async post(t){try{return await this.request({...t,method:"data"in t?"POST":"GET",path:xr(t.resource)})}catch(n){if(n instanceof de){const r=n.response,{ok:o,status:s}=r;if(!o&&s<500&&s!==401)return r}throw n}}}T(gt,"origins",{WDW:"https://vqguest-svc-wdw.wdprapps.disney.com",DLR:"https://vqguest-svc.wdprapps.disney.com"});class ie extends Error{constructor(n){super(`Invalid ID: ${n}`);T(this,"name","InvalidId")}}class Hn{constructor(t,n){T(this,"parks");T(this,"genie");T(this,"vq");T(this,"das");T(this,"liveData");T(this,"parksById");T(this,"expsById");T(this,"dropExpsByPark");var r,o,s;this.id=t,this.parks=n.parks,this.parksById=Object.fromEntries(this.parks.map(a=>[a.id,a])),this.expsById=n.experiences,this.dropExpsByPark=new Map(this.parks.map(a=>[a,[]]));for(const[a,c]of Object.entries(this.expsById))c&&(c.id=a,c.park=c.land.park),c!=null&&c.dropTimes&&((r=this.dropExpsByPark.get(c.land.park))==null||r.push(c));for(const a of this.parks)a.dropTimes=[...new Set((o=this.dropExpsByPark.get(a))==null?void 0:o.flatMap(c=>c.dropTimes??[]))].sort(),(s=this.dropExpsByPark.get(a))==null||s.sort((c,l)=>c.name.localeCompare(l.name));this.genie=t==="WDW"?new Tr(this):new Sr(this),this.vq=new gt(this),this.das=new yr(this),this.liveData=new vr(this)}experience(t){const n=this.expsById[t];if(n)return n;throw n!==null&&console.warn(`Missing experience: ${t}`),new ie(t)}park(t){const n=this.parksById[t];if(n)return n;throw new ie(t)}dropExperiences(t){return this.dropExpsByPark.get(t)??[]}}async function wr(e){const t=await fr(Object.assign({"./data/dlr.ts":()=>Le(()=>import("./dlr.js"),[]),"./data/wdw.ts":()=>Le(()=>import("./wdw.js"),[])}),`./data/${e.toLowerCase()}.ts`,3);return new Hn(e,t)}const kr={WDW:"wdw-itinerary-api",DLR:"dlr-itinerary-web-api"},Er={WDW:{id:"80010110",park:{id:"80007944"}},DLR:{id:"353295",park:{id:"330339"}}},Ir=new Set(["ACTIVITY","DINING"]),Ie=e=>e.split(";")[0];function zn(e){const t=L();return e.modifiable&&H(e.start)===H(t)&&(t.date===e.end.date&&t.time<=(e.end.time??"")||t.date<(e.end.date??""))}class Nr extends Error{constructor(){super(...arguments);T(this,"name","ModifyNotAllowed")}}function Xt(e){if(e&&!zn(e))throw new Nr}class yt extends Oe{constructor(n,r){super(n);T(this,"maxPartySize",12);T(this,"nextBookTime");T(this,"onUnauthorized",()=>{});T(this,"partyIds",new Set);T(this,"guestCache",new Map);T(this,"tracker");T(this,"primaryGuestId","");T(this,"convertGuest",n=>{const{id:r,firstName:o,lastName:s,characterId:a,...c}=n,l=`${o} ${s}`.trim();if(!this.guestCache.has(r))switch(n.ineligibleReason){case"INVALID_PARK_ADMISSION":case"PARK_RESERVATION_NEEDED":case"GENIE_PLUS_NEEDED":n.primary&&this.cacheGuest(r,l,a);break;default:this.cacheGuest(r,l,a)}const u=Re(a);return this.partyIds.size>0&&!this.partyIds.has(r)&&(c.ineligibleReason="NOT_IN_PARTY",delete c.eligibleAfter),{...c,id:r,name:l,avatarImageUrl:u}});this.tracker=r??new Pr}setPartyIds(n){this.partyIds=new Set(n)}async experiences(n){var o,s,a,c;await this.primeGuestCache();const{data:r}=await this.request({path:`/tipboard-vas/planning/v1/parks/${encodeURIComponent(n.id)}/experiences/`,params:{eligibilityGuestIds:[...this.guestCache.keys()].join(",")},userId:!0});return this.nextBookTime=(c=(((a=(s=(o=r.eligibility)==null?void 0:o.geniePlusEligibility)==null?void 0:s[H()])==null?void 0:a.flexEligibilityWindows)||[]).sort((l,u)=>l.time.time.localeCompare(u.time.time))[0])==null?void 0:c.time.time,r.availableExperiences.flatMap(l=>{try{return[{...l,...this.resort.experience(l.id),park:n,experienced:this.tracker.experienced(l)}]}catch(u){if(u instanceof ie)return[];throw u}})}async cancelBooking(n){const o=n.map(s=>s.entitlementId).map(encodeURIComponent).join(",");await this.request({path:`/ea-vas/api/v1/entitlements/${o}`,method:"DELETE"})}async bookings(){const{swid:n}=V.getData(),r=L().date,o=H(),s=kr[this.resort.id],{data:{items:a=[],assets:c={},profiles:l={}}}=await this.request({path:`/plan/${s}/api/v1/itinerary-items/${n}?item-types=FASTPASS&item-types=DINING&item-types=ACTIVITY&item-types=VIRTUAL_QUEUE_POSITION`,params:{destination:this.resort.id,fields:"items,profiles,assets","guest-locators":n+";type=swid","guest-locator-groups":"MY_FAMILY","start-date":r,"show-friends":"false"},ignoreUnauth:!0}),u=m=>{const{name:b,avatarId:_,type:y}=l[m.id];return{id:Ie(m.id),name:`${b.firstName} ${b.lastName}`.trim(),avatarImageUrl:Re(_),...y==="transactional"&&{transactional:!0}}},h=m=>{const b=c[m.asset],y=c[b.facility].location??"",v=this.getPark(y);v.name===""&&y&&(v.name=c[y].name);const S=new Date(m.startDateTime);return{type:"RES",subtype:m.type,id:Ie(m.asset),park:v,name:b.name,start:L(S),guests:m.guests.map(u).sort((R,G)=>+(G.id===this.primaryGuestId)-+(R.id===this.primaryGuestId)||+!G.transactional-+!R.transactional||R.name.localeCompare(G.name)),bookingId:m.id}},d=m=>{const b=c[m.facility],_=new Set;return{...this.getBookingExperienceData(m.facility,b.location,b.name),start:(m.displayStartDate??r)_.has(y.id)||y.redemptionsRemaining===0?!1:(_.add(y.id),!0)).map(y=>({...u(y),entitlementId:y.entitlementId,bookingId:y.bookingId,...y.redemptionsRemaining!==void 0&&{redemptions:Math.min(y.redemptionsRemaining,y.redemptionsAllowed??1)}})),bookingId:m.id}},f=m=>{const b={FLEX:"G+",STANDARD:"ILL",OTHER:"OTHER"},_=m.multipleExperiences?"MEP":b[m.kind];if(!_)return;const y=_==="G+";let v={type:"LL",subtype:_,...d(m),cancellable:m.cancellable&&y,modifiable:m.modifiable&&y,bookingId:m.id};if(v.modifiable=zn(v),m.multipleExperiences){const S=m.assets.find(P=>P.original);v={...v,...S?this.getBookingExperienceData(S.content,c[S.content].location):{id:"",name:""}},v.choices=m.assets.filter(P=>!P.excluded&&!P.original).map(({content:P})=>{const{name:R,location:G}=c[P];return this.getBookingExperienceData(P,G,R)}).sort((P,R)=>P.name.localeCompare(R.name))}return v},p=m=>{const _={DAS:"IN_PARK",FDS:"ADVANCE"}[m.kind],y=_==="IN_PARK";return{type:"DAS",subtype:_,cancellable:m.cancellable&&y,...d(m)}},g=m=>{const b=c[m.asset],_=c[b.facility],y=this.getBookingExperienceData(b.facility,_.location,b.name);return y.park.name===""&&(y.park.name=_.name),{...y,type:"BG",boardingGroup:m.boardingGroup.id,status:m.status,start:L(new Date(m.startDateTime)),guests:m.guests.map(u),bookingId:m.id}},k={PARK_PASS:m=>{const b=this.getPark(c[m.facility].location);if(b)return{type:"APR",id:b.id,name:b.name,park:b,start:{date:m.displayStartDate,time:"06:00:00"},guests:m.guests.map(u),bookingId:m.id}},DAS:p,FDS:p},w=a.map(m=>{try{if(m.type==="FASTPASS")return(k[m.kind]??f)(m);if(m.type==="VIRTUAL_QUEUE_POSITION")return g(m);if(m.type&&Ir.has(m.type))return h(m)}catch(b){console.error(b)}}).filter(m=>!!m);return this.tracker.update(w,this),w}getPark(n){n=Ie(n);try{return this.resort.park(n)}catch(r){if(r instanceof ie)return{id:n,name:"",icon:"",geo:{n:0,s:0,e:0,w:0},theme:{bg:"bg-blue-500",text:"text-blue-500"},dropTimes:[]};throw r}}getBookingExperienceData(n,r,o="Experience"){n=Ie(n);try{const s=this.resort.experience(n);return{id:n,name:s.name,park:s.park}}catch(s){if(s instanceof ie&&r)return{id:n,name:o,park:this.getPark(r)};throw s}}async primeGuestCache(){this.primaryGuestId===""&&(this.primaryGuestId=".",await this.guests())}cacheGuest(n,r,o){this.guestCache.set(n,{name:r,characterId:o})}async request(n){if(n.userId){const{swid:r}=V.getData();n={...n},n.params={...n.params,userId:r}}return super.request(n)}createGuestsObject(n){var c;const{guests:r,ineligibleGuests:o}=n;this.primaryGuestId=((c=[...r,...o].find(l=>!!l.primary))==null?void 0:c.id)??this.primaryGuestId;const s=r.map(this.convertGuest),a=o.map(this.convertGuest);return a.sort((l,u)=>{const h=+!l.primary-+!u.primary||l.name.localeCompare(u.name);return l.eligibleAfter||u.eligibleAfter?(l.eligibleAfter||"99").localeCompare(u.eligibleAfter||"99")||h:l.ineligibleReason===u.ineligibleReason?h:l.ineligibleReason==="NOT_IN_PARTY"?1:u.ineligibleReason==="NOT_IN_PARTY"||l.ineligibleReason==="EXPERIENCE_LIMIT_REACHED"?-1:u.ineligibleReason==="EXPERIENCE_LIMIT_REACHED"?1:h}),{eligible:s,ineligible:a}}fallbackExperience(n){return n?this.resort.experience(n.id):Er[this.resort.id]}}class Tr extends yt{async guests(t){const n=this.fallbackExperience(t),{data:{guests:r,ineligibleGuests:o}}=await this.request({path:"/ea-vas/planning/api/v1/experiences/guest/guests",data:{date:L().date,facilityId:n.id,parkId:n.park.id}});return this.createGuestsObject({guests:r,ineligibleGuests:o.map(s=>s.ineligibleReason?{...s,ineligibleReason:s.ineligibleReason.ineligibleReason}:s)})}async offer(t,n,r){const{date:o}=L(),{data:s}=await this.request({path:`/ea-vas/planning/api/v1/experiences${r?"/mod":""}/offerset/generate`,data:{date:r?r.start.date:o,parkId:t.park.id,guestIds:n.map(g=>g.id),targetedTime:t.flex.nextAvailableTime??"09:00:00",...r?{experienceId:t.id,originalExperienceId:r==null?void 0:r.id,originalEntitlementIds:r==null?void 0:r.guests.map(g=>g.entitlementId)}:{experienceIds:[t.id]}}}),a=s.itinerary.items.find(g=>g.type==="OFFER_ITEM"),{guests:c,ineligibleGuests:l}=s.party;if(!a)throw new de({ok:!1,status:410,data:s});const{offerSetId:u,offerId:h,startDateTime:d,endDateTime:f}=a,p=Object.fromEntries(n.map(g=>[g.id,g]));return{offerSetId:u,id:h,start:se(d),end:se(f),experience:{id:a.facilityId},guests:{eligible:(c||[]).map(g=>({...p[g.id],...this.convertGuest(g)})),ineligible:(l||[]).map(this.convertGuest)},active:!0,changed:a.conflict==="ALTERNATIVE_TIME_FOUND"}}async book(t,n,r){const{offerSetId:o,guests:{eligible:s}}=t;if(n)return this.modify(t,n,r);const{data:a}=await this.request({path:"/ea-vas/planning/api/v1/experiences/entitlements/book",data:{offerSetId:o,orderGuestDetails:s.map(({id:c,orderDetails:{externalIdentifier:l,...u}})=>({guestDetails:[{guestId:c,externalIdentifier:l}],...u}))}});return this.createLLFromResponse(a)}async modify(t,n,r){const{offerSetId:o,guests:{eligible:s}}=t,a=new Set((r??t.guests.eligible).map(u=>u.id)),c=Object.fromEntries(n.guests.map(u=>[u.id,u.entitlementId])),{data:l}=await this.request({path:"/ea-vas/planning/api/v1/experiences/mod/entitlements/book",data:{offerSetId:o,eligibleGuestsEntitlements:s.filter(u=>a.has(u.id)).map(u=>({guestId:u.id,entitlementId:c[u.id],...u.orderDetails}))}});return this.createLLFromResponse({entitlementExperiences:[l.booking],party:l.party})}createLLFromResponse(t){var o;const n=t.entitlementExperiences[0],r=Object.fromEntries(n.guests.map(s=>[s.guestId,s.entitlementId]));return{type:"LL",subtype:"G+",...this.getBookingExperienceData(n.experienceId),bookingId:(o=n.guests[0])==null?void 0:o.entitlementId,start:se(n.startDateTime),end:se(n.endDateTime),cancellable:!0,modifiable:!1,guests:t.party.guests.map(s=>({...this.convertGuest(s),entitlementId:r[s.id]}))}}}class Sr extends yt{async guests(t){const n=this.fallbackExperience(t),{data:r}=await this.request({path:"/ea-vas/api/v1/guests",params:{productType:"FLEX",experienceId:n.id,parkId:n.park.id},userId:!0}),o=r.guests.map(this.convertGuest),s=r.ineligibleGuests.map(this.convertGuest);return s.sort((a,c)=>{const l=+!a.primary-+!c.primary||a.name.localeCompare(c.name);return a.eligibleAfter||c.eligibleAfter?(a.eligibleAfter||"99").localeCompare(c.eligibleAfter||"99")||l:a.ineligibleReason===c.ineligibleReason?l:a.ineligibleReason==="NOT_IN_PARTY"?1:c.ineligibleReason==="NOT_IN_PARTY"||a.ineligibleReason==="EXPERIENCE_LIMIT_REACHED"?-1:c.ineligibleReason==="EXPERIENCE_LIMIT_REACHED"?1:l}),{eligible:o,ineligible:s}}async offer(t,n,r){Xt(r);const{data:{offer:{id:o,date:s,startTime:a,endTime:c,status:l,changeStatus:u},eligibleGuests:h,ineligibleGuests:d}}=await this.request({path:r?"/ea-vas/api/v1/products/modifications/flex/offers":"/ea-vas/api/v2/products/flex/offers",method:"POST",data:{guestIds:((r==null?void 0:r.guests)??n).map(f=>f.id),ineligibleGuests:[],primaryGuestId:n.map(f=>f.id).sort((f,p)=>f.localeCompare(p))[0],parkId:t.park.id,experienceId:t.id,selectedTime:t.flex.nextAvailableTime,...r?{date:L().date,modificationType:t.id===r.id?"TIME":"EXPERIENCE"}:{}}});return Le(()=>import("./diu.js"),[]),{id:o,start:{date:s,time:a},end:{date:s,time:c},active:l==="ACTIVE",changed:u!=="NONE",guests:{eligible:(h||[]).map(f=>({...this.convertGuest(f),orderDetails:{externalIdentifier:{id:"",idType:""},orderId:"",orderItemId:""}})),ineligible:(d||[]).map(this.convertGuest)},experience:t}}async book(t,n,r){var f;Xt(n);const o=(await Le(async()=>{const{default:p}=await import("./diu.js");return{default:p}},[])).default,s=new Set((r??t.guests.eligible).map(p=>p.id)),{data:a}=await this.request({path:n?"/ea-vas/api/v2/products/modifications/flex/bookings":"/ea-vas/api/v2/products/flex/bookings",method:"POST",data:{offerId:t.id,...await o(t.id),...n?{date:L().date,modificationType:n.id===t.experience.id?"TIME":"EXPERIENCE",existingEntitlements:n.guests.filter(p=>s.has(p.id)).map(p=>({entitlementId:p.entitlementId,entitlementBookingId:p.bookingId})),guestIdsToExclude:n.guests.filter(p=>!s.has(p.id)).map(p=>p.id)}:{}},key:"booking"}),{singleExperienceDetails:{experienceId:c,parkId:l},entitlements:u,startDateTime:h,endDateTime:d}=a;return{type:"LL",subtype:"G+",...this.getBookingExperienceData(c,l),bookingId:(f=u[0])==null?void 0:f.id,start:se(h),end:se(d),cancellable:!0,modifiable:!1,guests:u.map(p=>{const g=this.guestCache.get(p.guestId);return{id:p.guestId,name:(g==null?void 0:g.name)||"",avatarImageUrl:Re(g==null?void 0:g.characterId),entitlementId:p.id}})}}}const Zt=["bg1","genie","bookings"];class Pr{constructor(){T(this,"date");T(this,"expIds",new Set);T(this,"experiencedExpIds",new Set);const{date:t=H(),expIds:n=[],experiencedExpIds:r=[]}=M.get(Zt)??{};this.date=t,this.expIds=new Set(n),this.experiencedExpIds=new Set(r),this.checkDate()}experienced(t){return this.experiencedExpIds.has(t.id)}async update(t,n){this.checkDate();const r=H(),o=t.filter(a=>a.type==="LL"&&!!a.cancellable&&H(a.start)===r);for(const a of o)this.experiencedExpIds[a.modifiable?"delete":"add"](a.id);const s=this.expIds;this.expIds=new Set(o.map(a=>a.id));for(const a of s){if(this.expIds.has(a))continue;const{ineligible:c}=await n.guests({id:a}),l=c.some(u=>u.ineligibleReason==="EXPERIENCE_LIMIT_REACHED");this.experiencedExpIds[l?"add":"delete"](a)}M.set(Zt,{date:this.date,expIds:[...this.expIds],experiencedExpIds:[...this.experiencedExpIds]})}checkDate(){const t=H();this.date!==t&&(this.date=t,this.expIds=new Set,this.experiencedExpIds=new Set)}}const Fn=q(new Hn("WDW",{experiences:{},parks:[]})),Cr=Fn.Provider,O=()=>K(Fn),jn=q({goTo:()=>{},goBack:async()=>{}}),Dr=jn.Provider,B=()=>K(jn),Wn=q({current:i("div",{})}),Ar=Wn.Provider,Yn=()=>K(Wn);let Lr=0;const en=()=>++Lr,Ne=()=>Number(location.hash.slice(1))||0;let it=()=>{};class Rr extends Promise{constructor(){super(t=>{it=()=>{t(),it=()=>{}}})}}function Vn({children:e}){const[t,n]=I({current:e}),r=te([{elem:e,key:0}]),o=te({goTo(a,c){let l=Ne(),u;c!=null&&c.replace?(u=r.current[l].key??en(),n(h=>({...h,current:a}))):(r.current=r.current.slice(0,++l),location.hash=`#${l}`,u=en()),r.current[l]={elem:a,key:u}},goBack({screen:a,props:c}={}){if(a){const l=Ne();for(let u=l-1;u>=0;--u)if(r.current[u].elem.type===a){if(history.go(u-l),c){const h={...r.current[u].elem.props,...c};r.current[u].elem=i(a,{...h})}break}}else history.back();return new Rr}});C(()=>{function a(){var u,h;it();const l=Ne();l>=r.current.length?history.back():n({current:((u=r.current[l])==null?void 0:u.elem)??i("div",{}),prev:(h=r.current[l-1])==null?void 0:h.elem})}function c(l){l.preventDefault()}return location.replace("#0"),addEventListener("hashchange",a),addEventListener("beforeunload",c),()=>{removeEventListener("hashchange",a),removeEventListener("beforeunload",c)}},[]);const s=Math.min(Ne(),r.current.length-1);return i(Dr,{value:o.current,children:i(Ar,{value:t,children:r.current.slice(0,s+1).map(({elem:a,key:c},l)=>i("article",{hidden:l!==s,children:a},c))})})}const vt={bg:"bg-blue-500",text:"text-blue-500"},Qn=q(vt),qn=Qn.Provider,j=()=>K(Qn),$r={normal:"py-1",small:"py-1.5 text-xs uppercase tracking-wide",full:"w-full py-3"};function $(e){const{goBack:t}=B(),{type:n,back:r,onClick:o,className:s,...a}=e;let c=`${$r[n||"normal"]} ${s||""}`;const{bg:l}=j();return c.includes(" bg-")||(c+=` ${l} text-white`),i("button",{onClick:async()=>{o&&await o(),r&&(r===!0?t():t(r))},className:`${c} inline-flex items-center justify-center min-w-[36px] rounded-lg px-2 font-semibold disabled:opacity-50`,...a})}function Y(e){return i("div",{className:"mb-20",children:i("div",{className:"fixed bottom-0 left-0 w-full px-5 pb-5 text-center",children:i($,{...e,className:"max-w-2xl mx-auto shadow-[0px_4px_8px_-1px_#0005]",type:"full"})})})}function W({children:e,className:t,title:n}){return t||(t=""),t.match(/\bw-\S+\s*/)||(t+=" w-4"),t.match(/\bh-\S+\s*/)||(t+=" h-auto"),i("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",viewBox:"0 0 16 16",className:`mx-auto ${t}`,role:"img",children:[n&&i("title",{children:n}),e]})}/** +var Pi=Object.defineProperty;var Ci=e=>{throw TypeError(e)};var Di=(e,t,n)=>t in e?Pi(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var T=(e,t,n)=>Di(e,typeof t!="symbol"?t+"":t,n);var Ct=(e,t,n)=>t.has(e)?Ci("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n);var be,I,vn,re,Dt,bn,qe,lt,Ke,Je,xn,_e={},wn=[],Ai=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,$e=Array.isArray;function X(e,t){for(var n in t)e[n]=t[n];return e}function kn(e){var t=e.parentNode;t&&t.removeChild(e)}function ge(e,t,n){var r,o,s,a={};for(s in t)s=="key"?r=t[s]:s=="ref"?o=t[s]:a[s]=t[s];if(arguments.length>2&&(a.children=arguments.length>3?be.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(s in e.defaultProps)a[s]===void 0&&(a[s]=e.defaultProps[s]);return fe(e,a,r,o,null)}function fe(e,t,n,r,o){var s={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:o??++vn,__i:-1,__u:0};return o==null&&I.vnode!=null&&I.vnode(s),s}function x(e){return e.children}function Z(e,t){this.props=e,this.context=t}function oe(e,t){if(t==null)return e.__?oe(e.__,e.__i+1):null;for(var n;tt&&re.sort(qe));De.__r=0}function Nn(e,t,n,r,o,s,a,c,l,u,h){var d,f,p,g,E,k=r&&r.__k||wn,w=t.length;for(n.__d=l,Li(n,t,k),l=n.__d,d=0;d0?fe(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):o)!=null?(o.__=e,o.__b=e.__b+1,c=Ri(o,n,a,h),o.__i=c,s=null,c!==-1&&(h--,(s=n[c])&&(s.__u|=131072)),s==null||s.__v===null?(c==-1&&d--,typeof o.type!="function"&&(o.__u|=65536)):c!==a&&(c==a-1?d=c-a:c==a+1?d++:c>a?h>l-a?d+=c-a:d--:c(l!=null&&!(131072&l.__u)?1:0))for(;a>=0||c=0){if((l=t[a])&&!(131072&l.__u)&&o==l.key&&s===l.type)return a;a--}if(c2&&(c.children=arguments.length>3?be.call(arguments,2):n),fe(e.type,c,r||e.key,o||e.ref,null)}function q(e,t){var n={__c:t="__cC"+xn++,__:e,Consumer:function(r,o){return r.children(o)},Provider:function(r){var o,s;return this.getChildContext||(o=[],(s={})[t]=this,this.getChildContext=function(){return s},this.componentWillUnmount=function(){o=null},this.shouldComponentUpdate=function(a){this.props.value!==a.value&&o.some(function(c){c.__e=!0,Xe(c)})},this.sub=function(a){o.push(a);var c=a.componentWillUnmount;a.componentWillUnmount=function(){o&&o.splice(o.indexOf(a),1),c&&c.call(a)}}),r.children}};return n.Provider.__=n.Consumer.contextType=n}be=wn.slice,I={__e:function(e,t,n,r){for(var o,s,a;t=t.__;)if((o=t.__c)&&!o.__)try{if((s=o.constructor)&&s.getDerivedStateFromError!=null&&(o.setState(s.getDerivedStateFromError(e)),a=o.__d),o.componentDidCatch!=null&&(o.componentDidCatch(e,r||{}),a=o.__d),a)return o.__E=o}catch(c){e=c}throw e}},vn=0,Z.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=X({},this.state),typeof e=="function"&&(e=e(X({},n),this.props)),e&&X(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),Xe(this))},Z.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Xe(this))},Z.prototype.render=x,re=[],bn=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,qe=function(e,t){return e.__v.__b-t.__v.__b},De.__r=0,lt=0,Ke=Lt(!1),Je=Lt(!0),xn=0;var ae,D,He,Rt,ye=0,Pn=[],A=I,$t=A.__b,Ot=A.__r,Mt=A.diffed,Gt=A.__c,Bt=A.unmount,Ut=A.__;function xe(e,t){A.__h&&A.__h(D,e,ye||t),ye=0;var n=D.__H||(D.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function N(e){return ye=1,Gi(Cn,e)}function Gi(e,t,n){var r=xe(ae++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):Cn(void 0,t),function(c){var l=r.__N?r.__N[0]:r.__[0],u=r.t(l,c);l!==u&&(r.__N=[u,r.__[1]],r.__c.setState({}))}],r.__c=D,!D.u)){var o=function(c,l,u){if(!r.__c.__H)return!0;var h=r.__c.__H.__.filter(function(f){return!!f.__c});if(h.every(function(f){return!f.__N}))return!s||s.call(this,c,l,u);var d=!1;return h.forEach(function(f){if(f.__N){var p=f.__[0];f.__=f.__N,f.__N=void 0,p!==f.__[0]&&(d=!0)}}),!(!d&&r.__c.props===c)&&(!s||s.call(this,c,l,u))};D.u=!0;var s=D.shouldComponentUpdate,a=D.componentWillUpdate;D.componentWillUpdate=function(c,l,u){if(this.__e){var h=s;s=void 0,o(c,l,u),s=h}a&&a.call(this,c,l,u)},D.shouldComponentUpdate=o}return r.__N||r.__}function C(e,t){var n=xe(ae++,3);!A.__s&&mt(n.__H,t)&&(n.__=e,n.i=t,D.__H.__h.push(n))}function ht(e,t){var n=xe(ae++,4);!A.__s&&mt(n.__H,t)&&(n.__=e,n.i=t,D.__h.push(n))}function te(e){return ye=5,pt(function(){return{current:e}},[])}function pt(e,t){var n=xe(ae++,7);return mt(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function Q(e,t){return ye=8,pt(function(){return e},t)}function K(e){var t=D.context[e.__c],n=xe(ae++,9);return n.c=e,t?(n.__==null&&(n.__=!0,t.sub(D)),t.props.value):e.__}function Bi(){for(var e;e=Pn.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(Ce),e.__H.__h.forEach(et),e.__H.__h=[]}catch(t){e.__H.__h=[],A.__e(t,e.__v)}}A.__b=function(e){D=null,$t&&$t(e)},A.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Ut&&Ut(e,t)},A.__r=function(e){Ot&&Ot(e),ae=0;var t=(D=e.__c).__H;t&&(He===D?(t.__h=[],D.__h=[],t.__.forEach(function(n){n.__N&&(n.__=n.__N),n.i=n.__N=void 0})):(t.__h.forEach(Ce),t.__h.forEach(et),t.__h=[],ae=0)),He=D},A.diffed=function(e){Mt&&Mt(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Pn.push(t)!==1&&Rt===A.requestAnimationFrame||((Rt=A.requestAnimationFrame)||Ui)(Bi)),t.__H.__.forEach(function(n){n.i&&(n.__H=n.i),n.i=void 0})),He=D=null},A.__c=function(e,t){t.some(function(n){try{n.__h.forEach(Ce),n.__h=n.__h.filter(function(r){return!r.__||et(r)})}catch(r){t.some(function(o){o.__h&&(o.__h=[])}),t=[],A.__e(r,n.__v)}}),Gt&&Gt(e,t)},A.unmount=function(e){Bt&&Bt(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(r){try{Ce(r)}catch(o){t=o}}),n.__H=void 0,t&&A.__e(t,n.__v))};var Ht=typeof requestAnimationFrame=="function";function Ui(e){var t,n=function(){clearTimeout(r),Ht&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,100);Ht&&(t=requestAnimationFrame(n))}function Ce(e){var t=D,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),D=t}function et(e){var t=D;e.__c=e.__(),D=t}function mt(e,t){return!e||e.length!==t.length||t.some(function(n,r){return n!==e[r]})}function Cn(e,t){return typeof t=="function"?t(e):t}function Hi(e,t){for(var n in t)e[n]=t[n];return e}function tt(e,t){for(var n in e)if(n!=="__source"&&!(n in t))return!0;for(var r in t)if(r!=="__source"&&e[r]!==t[r])return!0;return!1}function zt(e,t){this.props=e,this.context=t}function ft(e,t){function n(o){var s=this.props.ref,a=s==o.ref;return!a&&s&&(s.call?s(null):s.current=null),t?!t(this.props,o)||!a:tt(this.props,o)}function r(o){return this.shouldComponentUpdate=n,ge(e,o)}return r.displayName="Memo("+(e.displayName||e.name)+")",r.prototype.isReactComponent=!0,r.__f=!0,r}(zt.prototype=new Z).isPureReactComponent=!0,zt.prototype.shouldComponentUpdate=function(e,t){return tt(this.props,e)||tt(this.state,t)};var Ft=I.__b;I.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),Ft&&Ft(e)};var jt=function(e,t){return e==null?null:ee(ee(e).map(t))},zi={map:jt,forEach:jt,count:function(e){return e?ee(e).length:0},only:function(e){var t=ee(e);if(t.length!==1)throw"Children.only";return t[0]},toArray:ee},Fi=I.__e;I.__e=function(e,t,n,r){if(e.then){for(var o,s=t;s=s.__;)if((o=s.__c)&&o.__c)return t.__e==null&&(t.__e=n.__e,t.__k=n.__k),o.__c(e,t)}Fi(e,t,n,r)};var Wt=I.unmount;function Dn(e,t,n){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(r){typeof r.__c=="function"&&r.__c()}),e.__c.__H=null),(e=Hi({},e)).__c!=null&&(e.__c.__P===n&&(e.__c.__P=t),e.__c=null),e.__k=e.__k&&e.__k.map(function(r){return Dn(r,t,n)})),e}function An(e,t,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(r){return An(r,t,n)}),e.__c&&e.__c.__P===t&&(e.__e&&n.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=n)),e}function ze(){this.__u=0,this.t=null,this.__b=null}function Ln(e){var t=e.__.__c;return t&&t.__a&&t.__a(e)}function Ee(){this.u=null,this.o=null}I.unmount=function(e){var t=e.__c;t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),Wt&&Wt(e)},(ze.prototype=new Z).__c=function(e,t){var n=t.__c,r=this;r.t==null&&(r.t=[]),r.t.push(n);var o=Ln(r.__v),s=!1,a=function(){s||(s=!0,n.__R=null,o?o(c):c())};n.__R=a;var c=function(){if(!--r.__u){if(r.state.__a){var l=r.state.__a;r.__v.__k[0]=An(l,l.__c.__P,l.__c.__O)}var u;for(r.setState({__a:r.__b=null});u=r.t.pop();)u.forceUpdate()}};r.__u++||32&t.__u||r.setState({__a:r.__b=r.__v.__k[0]}),e.then(a,a)},ze.prototype.componentWillUnmount=function(){this.t=[]},ze.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement("div"),r=this.__v.__k[0].__c;this.__v.__k[0]=Dn(this.__b,n,r.__O=r.__P)}this.__b=null}var o=t.__a&&ge(x,null,e.fallback);return o&&(o.__u&=-33),[ge(x,null,t.__a?null:e.children),o]};var Yt=function(e,t,n){if(++n[1]===n[0]&&e.o.delete(t),e.props.revealOrder&&(e.props.revealOrder[0]!=="t"||!e.o.size))for(n=e.u;n;){for(;n.length>3;)n.pop()();if(n[1]t[r.type]=r.value),{date:`${t.year}-${t.month}-${t.day}`,time:`${t.hour}:${t.minute}:${t.second}`}}function H(e){if(e??(e=L()),(e.time??"1")>"03:00:00")return e.date??L().date;const t=new Date(`${e.date}T00:00:00`);return t.setDate(t.getDate()-1),L(t).date}function sr(e,t){const n=new Date(e+"T00:00:00"),r=n.toLocaleString("en-US",{month:"long",day:"numeric"});if(t==="short")return r;const o=H();if(e===o)return`Today, ${r}`;const s=new Date(o);s.setDate(s.getDate()+1);const a=s.toISOString().split("T")[0];return e===a?`Tomorrow, ${r}`:`${n.toLocaleString("en-US",{weekday:"long"})}, ${r}`}function z(e){const t=e.split(":").slice(0,2).map(Number),n=t[0]>=12?"PM":"AM";return t[0]=t[0]%12||12,t.map(r=>String(r).padStart(2,"0")).join(":").replace(/^0/,"")+" "+n}function se(e){const[t,n]=e.slice(0,19).split("T");return{date:t,time:n}}function Ae(e){const[t,n]=e.split(":").map(Number);return(t+17)%24*60+n}function ue(e){if(!Array.isArray(e))return[];const t=L().time.slice(0,5),n=e.findIndex(r=>r>=t);return n>=0?e.slice(n):[]}const Fe=e=>Array.isArray(e)?e.join("."):e,M={get(e){const t=localStorage.getItem(Fe(e));try{return JSON.parse(t??"")}catch{return}},set(e,t){localStorage.setItem(Fe(e),JSON.stringify(t))},delete(e){localStorage.removeItem(Fe(e))},clear(){localStorage.clear()}},je=["bg1","auth"];class Mn extends Error{constructor(){super("Auth data missing or expired");T(this,"name","ReauthNeeded")}}class or{constructor(){T(this,"onUnauthorized",()=>{})}getData(){try{const t=M.get(je);if(t){const{swid:n,accessToken:r,expires:o}=t,s=L(o),a=L();if(s.date>a.date||s.date===a.date&&s.time>a.time&&s.time>="17")return{swid:n,accessToken:r}}}catch(t){console.error(t)}throw this.deleteData(),new Mn}setData(t){M.set(je,t)}deleteData(){M.delete(je),setTimeout(this.onUnauthorized)}}const V=new or,ar=8e3;async function Gn(e,t={}){const{params:n,data:r,timeout:o=ar,...s}=t;t=s,t.referrer||(t.referrer=""),t.credentials||(t.credentials="omit"),t.cache||(t.cache="no-store"),t.headers={...t.headers||{}},n&&Object.keys(n).length>0&&(e+=(e.includes("?")?"&":"?")+Object.entries(n).filter(([,u])=>u!=="").map(u=>u.map(encodeURIComponent).join("=")).join("&")),r&&(t.method||(t.method="POST"),t.headers={...t.headers,"Content-Type":"application/json"},t.body=JSON.stringify(r)),t.method||(t.method="GET");const a=new AbortController;t.signal=a.signal;const c=setTimeout(()=>a.abort(),o);let l;try{l=await fetch(e,t)}catch(u){return console.error(u),{ok:!1,status:0,data:null}}finally{clearTimeout(c)}return{ok:l.ok,status:l.status,data:(l.headers.get("Content-Type")||"").startsWith("application/json")?await l.json():{}}}class Bn extends Error{constructor(){super(...arguments);T(this,"name","InvalidOrigin")}}class de extends Error{constructor(n,r="Request failed"){super(`${r}: ${JSON.stringify(n)}`);T(this,"name","RequestError");this.response=n}}class Oe{constructor(t){T(this,"resort");T(this,"origin");this.resort=t,this.origin=this.constructor.origins[this.resort.id]}static originToResortId(t){var o;const r=(o=Object.entries(this.origins).find(([,s])=>s===t))==null?void 0:o[0];if(r)return r;throw new Bn(t)}async request(t){const{swid:n,accessToken:r}=V.getData(),o=this.origin+t.path,s=await Gn(o,{method:t.method,params:t.params,data:t.data,headers:{"Accept-Language":"en-US",Authorization:`BEARER ${r}`,"x-user-id":n}});if(s.status===401&&!t.ignoreUnauth)setTimeout(()=>V.deleteData());else{const{key:a}=t;if(s.ok&&(!a||s.data[a]))return{...s,data:a?s.data[a]:s.data}}throw new de(s)}}T(Oe,"origins",{WDW:"https://disneyworld.disney.go.com",DLR:"https://disneyland.disney.go.com"});const cr="modulepreload",lr=function(e){return"/bg1/"+e},Jt={},Le=function(t,n,r){let o=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const s=document.querySelector("meta[property=csp-nonce]"),a=(s==null?void 0:s.nonce)||(s==null?void 0:s.getAttribute("nonce"));o=Promise.all(n.map(c=>{if(c=lr(c),c in Jt)return;Jt[c]=!0;const l=c.endsWith(".css"),u=l?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${u}`))return;const h=document.createElement("link");if(h.rel=l?"stylesheet":cr,l||(h.as="script",h.crossOrigin=""),h.href=c,a&&h.setAttribute("nonce",a),document.head.appendChild(h),l)return new Promise((d,f)=>{h.addEventListener("load",d),h.addEventListener("error",()=>f(new Error(`Unable to preload CSS for ${c}`)))})}))}return o.then(()=>t()).catch(s=>{const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=s,window.dispatchEvent(a),!a.defaultPrevented)throw s})},dr={48199:"Mr-Incredible",48200:"Mrs-Incredible",261227:"Nemo",339625:"Russell",339626:"Carl",364907:"Jack-Skellington",431014:"Princess-Tiana",431065:"Darth_Vader",15549505:"Rapunzel",15655408:"Default_SignedIn",15675686:"Crush",15831168:"Wall-E",16453979:"Merida",16726412:"Stormtrooper",16818199:"Violet",16869301:"Jack-Jack",17345357:"R2-D2",17345359:"C-3PO",17532220:"Bruce",17532224:"Green-Alien",17532227:"Kermit",17532228:"Sorcerer-Mickey",17577168:"Elsa",17577169:"Anna",17813977:"Olaf",17888784:"Yoda",18101167:"Captain-Mickey",18368743:"-Nick",18368747:"-Judy",18393706:"-Flash",18403761:"kion",18405224:"-Moana",18405236:"-Elena",19633995:"50th_Mickey",19633996:"50th_Minnie",90003819:"Alice",90003846:"Ariel",90003898:"Belle",90003967:"Buzz",90003976:"Captain-Hook",90004004:"Chesire-Cat",90004017:"Cinderella",90004068:"Daisy",90004076:"Dash",90004104:"Donald",90004228:"Goofy",90004260:"Hamm",90004328:"Princess-Jasmine",90004340:"Jiminy",90004395:"Lady",90004482:"Mickey-Mouse",90004486:"Minnie",90004537:"Mulan",90004605:"Peter-Pan",90004625:"Pluto",90004626:"Pocahontas",90004642:"Princess-Aurora",90004682:"Rex",90004772:"Snow-White",90004778:"Sparky",90004846:"TinkerBell",90004860:"Tramp",90004939:"Zero"},_t="https://cdn1.parksmedia.wdprapps.disney.com/resize/mwImage/1/90/90/75/dam/",ur=_t+"wdpro-assets/avatars/180x180/RetAvatar_180x180_",hr=_t+"wdpro-assets/avatars/180x180/RetAvatar-180x180",pr=_t+"disney-world/50th-anniversary/avatars/RetAvatar_180x180_",mr={"-":hr,5:pr};function Re(e){const t=dr[e||""];if(t)return(mr[t[0]]||ur)+t+".png"}const fr=(e,t,n)=>{const r=e[t];return r?typeof r=="function"?r():Promise.resolve(r):new Promise((o,s)=>{(typeof queueMicrotask=="function"?queueMicrotask:setTimeout)(s.bind(null,new Error("Unknown variable dynamic import: "+t+(t.split("/").length!==n?". Note that variables only represent file names one level deep.":""))))})},le=e=>`/das-vas/api/v1/${e}`;function _r(e){return{id:e.id,name:e.name.replace(/ \(Me\)$/,""),avatarImageUrl:Re(e.characterId),primary:e.primary}}class nt extends Error{constructor(n){super();T(this,"name","ConflictsError");this.conflicts=n}}class gr extends Error{constructor(){super(...arguments);T(this,"name","NoPrimaryGuest")}}class Un extends Error{constructor(){super(...arguments);T(this,"name","ExperienceUnavailable")}}var ct;class yr extends Oe{constructor(){super(...arguments);T(this,"bookingGuestId");Ct(this,ct)}async experiences(n){const r=encodeURIComponent(n.id),{data:o}=await this.request({path:le(`availability/parks/${r}/experiences`),key:"experiences"});return o.filter(s=>s.available&&!!s.nextAvailableTime).map(s=>{try{return{...s,...this.resort.experience(s.id)}}catch{return s}}).sort((s,a)=>s.name.localeCompare(a.name))}async parties(){const{swid:n}=V.getData(),{data:{bookingGuestId:r,parties:o}}=await this.request({path:le(`users/${encodeURIComponent(n)}/parties`)});return this.bookingGuestId=r,o.map(s=>[{...s.primaryGuest,primary:!0},...s.linkedGuests].map(_r))}async book({park:n,experience:r,guests:o}){var d,f;const s=await this.eligibility({park:n,experience:r,guests:o}),a=new Set((d=s.find(({type:p})=>p==="ELIGIBLE"))==null?void 0:d.guestIds);if(!o.every(p=>a.has(p.id)))throw new nt(Object.fromEntries(s.filter(p=>p.type!=="ELIGIBLE").flatMap(p=>p.guestIds.map(g=>[g,p.type]))));const c=await this.availability({park:n,experience:r}),l=(f=o.find(p=>p.primary))==null?void 0:f.id,u=new Map(o.map(p=>[p.id,p])),{data:h}=await this.request({path:le("bookings"),key:"booking",data:{bookingGuestId:this.bookingGuestId,primaryGuestId:l,guestIds:o.map(p=>p.id),experienceId:r.id,startTime:c}});return{type:"DAS",subtype:"IN_PARK",id:r.id,name:r.name,park:n,guests:h.entitlements.map(p=>{const g=u.get(p.guestId);return{id:p.guestId,name:(g==null?void 0:g.name)??"",avatarImageUrl:g==null?void 0:g.avatarImageUrl,entitlementId:p.id}}),start:se(h.startDateTime),end:{},bookingId:h.id}}async cancelBooking(n){const o=n.map(s=>s.entitlementId).map(encodeURIComponent).join(",");await this.request({path:le(`entitlements/${o}`),method:"DELETE"})}async eligibility({park:n,experience:r,guests:o}={}){const s=o.find(c=>!!c.primary);if(!s)throw new gr;const{data:a}=await this.request({path:le("eligibility"),params:{experienceId:r.id,parkId:n.id,primaryGuestId:s.id,guestIds:o.map(c=>c.id).join(",")},key:"eligibility"});return a}async availability({park:n,experience:r}){const o=encodeURIComponent(r.id),s=encodeURIComponent(n.id),{data:{available:a,nextAvailableTime:c}}=await this.request({path:le(`availability/parks/${s}/experiences/${o}`),key:"experience"});if(!a||!c)throw new Un;return c}}ct=new WeakMap;class vr{constructor(t){T(this,"cachedShowtimes",{});this.resort=t}async shows(t){Object.keys(this.cachedShowtimes).length===0&&(this.cachedShowtimes=(await this.request("showtimes")).data);const n=this.cachedShowtimes[t.id]??{},{time:r}=L();return Object.fromEntries(Object.entries(n).flatMap(([o,s])=>{const a=s.filter(d=>d>=r),c=a[0],l=a.slice(1),u=c!==void 0,h=u?void 0:"NO_MORE_SHOWS";try{return[[o,{type:"ENTERTAINMENT",...this.resort.experience(o),park:t,standby:{available:u,unavailableReason:h,nextShowTime:c},additionalShowTimes:l}]]}catch(d){if(d instanceof ie)return[];throw d}}))}async request(t){const n=await Gn(`https://bg1.joelface.com/livedata/${this.resort.id.toLowerCase()}/${t}.json`);if(!n.ok)throw new Error("Fetch failed");return n}}const br=e=>e.sort((t,n)=>+n.primary-+t.primary||+n.preselected-+t.preselected||t.name.localeCompare(n.name)),xr=e=>`/application/v1/guest/${e}`;class gt extends Oe{async getQueues(){var n;const t=await this.post({resource:"getQueues"});if(!Array.isArray((n=t.data)==null?void 0:n.queues))throw new de(t);return t.data.queues.filter(r=>!!r.categoryContentId).map(({queueId:r,tabContentId:o="",...s})=>{const a={...s,id:r};try{a.park=this.resort.park(o.split(";")[0])}catch(c){if(!(c instanceof ie))throw c}return a})}async getQueue(t){const n=(await this.getQueues()).find(r=>r.id===t.id);if(n)return n;throw new Error("Queue not Found")}async getLinkedGuests(t){const{data:n}=await this.post({resource:"getLinkedGuests",data:{queueId:t.id,requestType:"REVIEW"}});return br(n.guests.map(({guestId:r,firstName:o="",lastName:s="",isPrimaryGuest:a,isPreselected:c,avatarImageUrl:l})=>({id:r,name:`${o} ${s}`.trim(),primary:!!a,preselected:!!c,avatarImageUrl:l})))}async joinQueue(t,n){const r=n.map(a=>a.id),o=await this.post({resource:"joinQueue",data:{queueId:t.id,guestIds:r}}),{data:s}=o;if(s.responseStatus==="OK"){const a=s.positions.find(c=>c.queueId===t.id&&c.guestIds.length>0&&r.some(l=>c.guestIds.includes(l)));if(!a)throw new de(o);return{boardingGroup:a.boardingGroup,conflicts:{},closed:!1}}else if(s.responseStatus==="INVALID_GUEST"||s.responseStatus==="CLOSED_QUEUE"){const a=s.responseStatus==="CLOSED_QUEUE",c=new Set,l={};for(const d of s.conflicts)for(const f of d.guestIds){const p=n.find(g=>g.id===f);p&&(l[p.id]=d.conflictType,c.add(f))}const u=n.filter(d=>!c.has(d.id));if(a||u.length===0)return{boardingGroup:null,conflicts:l,closed:a};const h=await this.joinQueue(t,u);return h.conflicts={...l,...h.conflicts},h}else throw new de(o)}async post(t){try{return await this.request({...t,method:"data"in t?"POST":"GET",path:xr(t.resource)})}catch(n){if(n instanceof de){const r=n.response,{ok:o,status:s}=r;if(!o&&s<500&&s!==401)return r}throw n}}}T(gt,"origins",{WDW:"https://vqguest-svc-wdw.wdprapps.disney.com",DLR:"https://vqguest-svc.wdprapps.disney.com"});class ie extends Error{constructor(n){super(`Invalid ID: ${n}`);T(this,"name","InvalidId")}}class Hn{constructor(t,n){T(this,"parks");T(this,"genie");T(this,"vq");T(this,"das");T(this,"liveData");T(this,"parksById");T(this,"expsById");T(this,"dropExpsByPark");var r,o,s;this.id=t,this.parks=n.parks,this.parksById=Object.fromEntries(this.parks.map(a=>[a.id,a])),this.expsById=n.experiences,this.dropExpsByPark=new Map(this.parks.map(a=>[a,[]]));for(const[a,c]of Object.entries(this.expsById))c&&(c.id=a,c.park=c.land.park),c!=null&&c.dropTimes&&((r=this.dropExpsByPark.get(c.land.park))==null||r.push(c));for(const a of this.parks)a.dropTimes=[...new Set((o=this.dropExpsByPark.get(a))==null?void 0:o.flatMap(c=>c.dropTimes??[]))].sort(),(s=this.dropExpsByPark.get(a))==null||s.sort((c,l)=>c.name.localeCompare(l.name));this.genie=t==="WDW"?new Tr(this):new Sr(this),this.vq=new gt(this),this.das=new yr(this),this.liveData=new vr(this)}experience(t){const n=this.expsById[t];if(n)return n;throw n!==null&&console.warn(`Missing experience: ${t}`),new ie(t)}park(t){const n=this.parksById[t];if(n)return n;throw new ie(t)}dropExperiences(t){return this.dropExpsByPark.get(t)??[]}}async function wr(e){const t=await fr(Object.assign({"./data/dlr.ts":()=>Le(()=>import("./dlr.js"),[]),"./data/wdw.ts":()=>Le(()=>import("./wdw.js"),[])}),`./data/${e.toLowerCase()}.ts`,3);return new Hn(e,t)}const kr={WDW:"wdw-itinerary-api",DLR:"dlr-itinerary-web-api"},Er={WDW:{id:"80010110",park:{id:"80007944"}},DLR:{id:"353295",park:{id:"330339"}}},Nr=new Set(["ACTIVITY","DINING"]),Ne=e=>e.split(";")[0];function zn(e){const t=L();return e.modifiable&&H(e.start)===H(t)}class Ir extends Error{constructor(){super(...arguments);T(this,"name","ModifyNotAllowed")}}function Xt(e){if(e&&!zn(e))throw new Ir}class yt extends Oe{constructor(n,r){super(n);T(this,"maxPartySize",12);T(this,"nextBookTime");T(this,"onUnauthorized",()=>{});T(this,"partyIds",new Set);T(this,"guestCache",new Map);T(this,"tracker");T(this,"primaryGuestId","");T(this,"convertGuest",n=>{const{id:r,firstName:o,lastName:s,characterId:a,...c}=n,l=`${o} ${s}`.trim();if(!this.guestCache.has(r))switch(n.ineligibleReason){case"INVALID_PARK_ADMISSION":case"PARK_RESERVATION_NEEDED":case"GENIE_PLUS_NEEDED":n.primary&&this.cacheGuest(r,l,a);break;default:this.cacheGuest(r,l,a)}const u=Re(a);return this.partyIds.size>0&&!this.partyIds.has(r)&&(c.ineligibleReason="NOT_IN_PARTY",delete c.eligibleAfter),{...c,id:r,name:l,avatarImageUrl:u}});this.tracker=r??new Pr}setPartyIds(n){this.partyIds=new Set(n)}async experiences(n){var o,s,a,c;await this.primeGuestCache();const{data:r}=await this.request({path:`/tipboard-vas/planning/v1/parks/${encodeURIComponent(n.id)}/experiences/`,params:{eligibilityGuestIds:[...this.guestCache.keys()].join(",")},userId:!0});return this.nextBookTime=(c=(((a=(s=(o=r.eligibility)==null?void 0:o.geniePlusEligibility)==null?void 0:s[H()])==null?void 0:a.flexEligibilityWindows)||[]).sort((l,u)=>l.time.time.localeCompare(u.time.time))[0])==null?void 0:c.time.time,r.availableExperiences.flatMap(l=>{try{return[{...l,...this.resort.experience(l.id),park:n,experienced:this.tracker.experienced(l)}]}catch(u){if(u instanceof ie)return[];throw u}})}async cancelBooking(n){const o=n.map(s=>s.entitlementId).map(encodeURIComponent).join(",");await this.request({path:`/ea-vas/api/v1/entitlements/${o}`,method:"DELETE"})}async bookings(){const{swid:n}=V.getData(),r=L().date,o=H(),s=kr[this.resort.id],{data:{items:a=[],assets:c={},profiles:l={}}}=await this.request({path:`/plan/${s}/api/v1/itinerary-items/${n}?item-types=FASTPASS&item-types=DINING&item-types=ACTIVITY&item-types=VIRTUAL_QUEUE_POSITION`,params:{destination:this.resort.id,fields:"items,profiles,assets","guest-locators":n+";type=swid","guest-locator-groups":"MY_FAMILY","start-date":r,"show-friends":"false"},ignoreUnauth:!0}),u=m=>{const{name:b,avatarId:_,type:y}=l[m.id];return{id:Ne(m.id),name:`${b.firstName} ${b.lastName}`.trim(),avatarImageUrl:Re(_),...y==="transactional"&&{transactional:!0}}},h=m=>{const b=c[m.asset],y=c[b.facility].location??"",v=this.getPark(y);v.name===""&&y&&(v.name=c[y].name);const S=new Date(m.startDateTime);return{type:"RES",subtype:m.type,id:Ne(m.asset),park:v,name:b.name,start:L(S),guests:m.guests.map(u).sort((R,G)=>+(G.id===this.primaryGuestId)-+(R.id===this.primaryGuestId)||+!G.transactional-+!R.transactional||R.name.localeCompare(G.name)),bookingId:m.id}},d=m=>{const b=c[m.facility],_=new Set;return{...this.getBookingExperienceData(m.facility,b.location,b.name),start:(m.displayStartDate??r)_.has(y.id)||y.redemptionsRemaining===0?!1:(_.add(y.id),!0)).map(y=>({...u(y),entitlementId:y.entitlementId,bookingId:y.bookingId,...y.redemptionsRemaining!==void 0&&{redemptions:Math.min(y.redemptionsRemaining,y.redemptionsAllowed??1)}})),bookingId:m.id}},f=m=>{const b={FLEX:"G+",STANDARD:"ILL",OTHER:"OTHER"},_=m.multipleExperiences?"MEP":b[m.kind];if(!_)return;const y=_==="G+";let v={type:"LL",subtype:_,...d(m),cancellable:m.cancellable&&y,modifiable:m.modifiable&&y,bookingId:m.id};if(v.modifiable=zn(v),m.multipleExperiences){const S=m.assets.find(P=>P.original);v={...v,...S?this.getBookingExperienceData(S.content,c[S.content].location):{id:"",name:""}},v.choices=m.assets.filter(P=>!P.excluded&&!P.original).map(({content:P})=>{const{name:R,location:G}=c[P];return this.getBookingExperienceData(P,G,R)}).sort((P,R)=>P.name.localeCompare(R.name))}return v},p=m=>{const _={DAS:"IN_PARK",FDS:"ADVANCE"}[m.kind],y=_==="IN_PARK";return{type:"DAS",subtype:_,cancellable:m.cancellable&&y,...d(m)}},g=m=>{const b=c[m.asset],_=c[b.facility],y=this.getBookingExperienceData(b.facility,_.location,b.name);return y.park.name===""&&(y.park.name=_.name),{...y,type:"BG",boardingGroup:m.boardingGroup.id,status:m.status,start:L(new Date(m.startDateTime)),guests:m.guests.map(u),bookingId:m.id}},k={PARK_PASS:m=>{const b=this.getPark(c[m.facility].location);if(b)return{type:"APR",id:b.id,name:b.name,park:b,start:{date:m.displayStartDate,time:"06:00:00"},guests:m.guests.map(u),bookingId:m.id}},DAS:p,FDS:p},w=a.map(m=>{try{if(m.type==="FASTPASS")return(k[m.kind]??f)(m);if(m.type==="VIRTUAL_QUEUE_POSITION")return g(m);if(m.type&&Nr.has(m.type))return h(m)}catch(b){console.error(b)}}).filter(m=>!!m);return this.tracker.update(w,this),w}getPark(n){n=Ne(n);try{return this.resort.park(n)}catch(r){if(r instanceof ie)return{id:n,name:"",icon:"",geo:{n:0,s:0,e:0,w:0},theme:{bg:"bg-blue-500",text:"text-blue-500"},dropTimes:[]};throw r}}getBookingExperienceData(n,r,o="Experience"){n=Ne(n);try{const s=this.resort.experience(n);return{id:n,name:s.name,park:s.park}}catch(s){if(s instanceof ie&&r)return{id:n,name:o,park:this.getPark(r)};throw s}}async primeGuestCache(){this.primaryGuestId===""&&(this.primaryGuestId=".",await this.guests())}cacheGuest(n,r,o){this.guestCache.set(n,{name:r,characterId:o})}async request(n){if(n.userId){const{swid:r}=V.getData();n={...n},n.params={...n.params,userId:r}}return super.request(n)}createGuestsObject(n){var c;const{guests:r,ineligibleGuests:o}=n;this.primaryGuestId=((c=[...r,...o].find(l=>!!l.primary))==null?void 0:c.id)??this.primaryGuestId;const s=r.map(this.convertGuest),a=o.map(this.convertGuest);return a.sort((l,u)=>{const h=+!l.primary-+!u.primary||l.name.localeCompare(u.name);return l.eligibleAfter||u.eligibleAfter?(l.eligibleAfter||"99").localeCompare(u.eligibleAfter||"99")||h:l.ineligibleReason===u.ineligibleReason?h:l.ineligibleReason==="NOT_IN_PARTY"?1:u.ineligibleReason==="NOT_IN_PARTY"||l.ineligibleReason==="EXPERIENCE_LIMIT_REACHED"?-1:u.ineligibleReason==="EXPERIENCE_LIMIT_REACHED"?1:h}),{eligible:s,ineligible:a}}fallbackExperience(n){return n?this.resort.experience(n.id):Er[this.resort.id]}}class Tr extends yt{async guests(t){const n=this.fallbackExperience(t),{data:{guests:r,ineligibleGuests:o}}=await this.request({path:"/ea-vas/planning/api/v1/experiences/guest/guests",data:{date:L().date,facilityId:n.id,parkId:n.park.id}});return this.createGuestsObject({guests:r,ineligibleGuests:o.map(s=>s.ineligibleReason?{...s,ineligibleReason:s.ineligibleReason.ineligibleReason}:s)})}async offer(t,n,r){const{date:o}=L(),{data:s}=await this.request({path:`/ea-vas/planning/api/v1/experiences${r?"/mod":""}/offerset/generate`,data:{date:r?r.start.date:o,parkId:t.park.id,guestIds:n.map(g=>g.id),targetedTime:t.flex.nextAvailableTime??"09:00:00",...r?{experienceId:t.id,originalExperienceId:r==null?void 0:r.id,originalEntitlementIds:r==null?void 0:r.guests.map(g=>g.entitlementId)}:{experienceIds:[t.id]}}}),a=s.itinerary.items.find(g=>g.type==="OFFER_ITEM"),{guests:c,ineligibleGuests:l}=s.party;if(!a)throw new de({ok:!1,status:410,data:s});const{offerSetId:u,offerId:h,startDateTime:d,endDateTime:f}=a,p=Object.fromEntries(n.map(g=>[g.id,g]));return{offerSetId:u,id:h,start:se(d),end:se(f),experience:{id:a.facilityId},guests:{eligible:(c||[]).map(g=>({...p[g.id],...this.convertGuest(g)})),ineligible:(l||[]).map(this.convertGuest)},active:!0,changed:a.conflict==="ALTERNATIVE_TIME_FOUND"}}async book(t,n,r){const{offerSetId:o,guests:{eligible:s}}=t;if(n)return this.modify(t,n,r);const{data:a}=await this.request({path:"/ea-vas/planning/api/v1/experiences/entitlements/book",data:{offerSetId:o,orderGuestDetails:s.filter(c=>!!c.orderDetails).map(({id:c,orderDetails:{externalIdentifier:l,...u}})=>({guestDetails:[{guestId:c,externalIdentifier:l}],...u}))}});return this.createLLFromResponse(a)}async modify(t,n,r){const{offerSetId:o,guests:{eligible:s}}=t,a=new Set((r??t.guests.eligible).map(u=>u.id)),c=Object.fromEntries(n.guests.map(u=>[u.id,u.entitlementId])),{data:l}=await this.request({path:"/ea-vas/planning/api/v1/experiences/mod/entitlements/book",data:{offerSetId:o,eligibleGuestsEntitlements:s.filter(u=>a.has(u.id)).map(u=>({guestId:u.id,entitlementId:c[u.id],...u.orderDetails}))}});return this.createLLFromResponse({entitlementExperiences:[l.booking],party:l.party})}createLLFromResponse(t){var o;const n=t.entitlementExperiences[0],r=Object.fromEntries(n.guests.map(s=>[s.guestId,s.entitlementId]));return{type:"LL",subtype:"G+",...this.getBookingExperienceData(n.experienceId),bookingId:(o=n.guests[0])==null?void 0:o.entitlementId,start:se(n.startDateTime),end:se(n.endDateTime),cancellable:!0,modifiable:!1,guests:t.party.guests.map(s=>({...this.convertGuest(s),entitlementId:r[s.id]}))}}}class Sr extends yt{async guests(t){const n=this.fallbackExperience(t),{data:r}=await this.request({path:"/ea-vas/api/v1/guests",params:{productType:"FLEX",experienceId:n.id,parkId:n.park.id},userId:!0}),o=r.guests.map(this.convertGuest),s=r.ineligibleGuests.map(this.convertGuest);return s.sort((a,c)=>{const l=+!a.primary-+!c.primary||a.name.localeCompare(c.name);return a.eligibleAfter||c.eligibleAfter?(a.eligibleAfter||"99").localeCompare(c.eligibleAfter||"99")||l:a.ineligibleReason===c.ineligibleReason?l:a.ineligibleReason==="NOT_IN_PARTY"?1:c.ineligibleReason==="NOT_IN_PARTY"||a.ineligibleReason==="EXPERIENCE_LIMIT_REACHED"?-1:c.ineligibleReason==="EXPERIENCE_LIMIT_REACHED"?1:l}),{eligible:o,ineligible:s}}async offer(t,n,r){Xt(r);const{data:{offer:{id:o,date:s,startTime:a,endTime:c,status:l,changeStatus:u},eligibleGuests:h,ineligibleGuests:d}}=await this.request({path:r?"/ea-vas/api/v1/products/modifications/flex/offers":"/ea-vas/api/v2/products/flex/offers",method:"POST",data:{guestIds:((r==null?void 0:r.guests)??n).map(f=>f.id),ineligibleGuests:[],primaryGuestId:n.map(f=>f.id).sort((f,p)=>f.localeCompare(p))[0],parkId:t.park.id,experienceId:t.id,selectedTime:t.flex.nextAvailableTime,...r?{date:L().date,modificationType:t.id===r.id?"TIME":"EXPERIENCE"}:{}}});return Le(()=>import("./diu.js"),[]),{id:o,start:{date:s,time:a},end:{date:s,time:c},active:l==="ACTIVE",changed:u!=="NONE",guests:{eligible:(h||[]).map(this.convertGuest),ineligible:(d||[]).map(this.convertGuest)},experience:t}}async book(t,n,r){var f;Xt(n);const o=(await Le(async()=>{const{default:p}=await import("./diu.js");return{default:p}},[])).default,s=new Set((r??t.guests.eligible).map(p=>p.id)),{data:a}=await this.request({path:n?"/ea-vas/api/v2/products/modifications/flex/bookings":"/ea-vas/api/v2/products/flex/bookings",method:"POST",data:{offerId:t.id,...await o(t.id),...n?{date:L().date,modificationType:n.id===t.experience.id?"TIME":"EXPERIENCE",existingEntitlements:n.guests.filter(p=>s.has(p.id)).map(p=>({entitlementId:p.entitlementId,entitlementBookingId:p.bookingId})),guestIdsToExclude:n.guests.filter(p=>!s.has(p.id)).map(p=>p.id)}:{}},key:"booking"}),{singleExperienceDetails:{experienceId:c,parkId:l},entitlements:u,startDateTime:h,endDateTime:d}=a;return{type:"LL",subtype:"G+",...this.getBookingExperienceData(c,l),bookingId:(f=u[0])==null?void 0:f.id,start:se(h),end:se(d),cancellable:!0,modifiable:!1,guests:u.map(p=>{const g=this.guestCache.get(p.guestId);return{id:p.guestId,name:(g==null?void 0:g.name)||"",avatarImageUrl:Re(g==null?void 0:g.characterId),entitlementId:p.id}})}}}const Zt=["bg1","genie","bookings"];class Pr{constructor(){T(this,"date");T(this,"expIds",new Set);T(this,"experiencedExpIds",new Set);const{date:t=H(),expIds:n=[],experiencedExpIds:r=[]}=M.get(Zt)??{};this.date=t,this.expIds=new Set(n),this.experiencedExpIds=new Set(r),this.checkDate()}experienced(t){return this.experiencedExpIds.has(t.id)}async update(t,n){this.checkDate();const r=H(),o=t.filter(a=>a.type==="LL"&&!!a.cancellable&&H(a.start)===r);for(const a of o)this.experiencedExpIds[a.modifiable?"delete":"add"](a.id);const s=this.expIds;this.expIds=new Set(o.map(a=>a.id));for(const a of s){if(this.expIds.has(a))continue;const{ineligible:c}=await n.guests({id:a}),l=c.some(u=>u.ineligibleReason==="EXPERIENCE_LIMIT_REACHED");this.experiencedExpIds[l?"add":"delete"](a)}M.set(Zt,{date:this.date,expIds:[...this.expIds],experiencedExpIds:[...this.experiencedExpIds]})}checkDate(){const t=H();this.date!==t&&(this.date=t,this.expIds=new Set,this.experiencedExpIds=new Set)}}const Fn=q(new Hn("WDW",{experiences:{},parks:[]})),Cr=Fn.Provider,O=()=>K(Fn),jn=q({goTo:()=>{},goBack:async()=>{}}),Dr=jn.Provider,B=()=>K(jn),Wn=q({current:i("div",{})}),Ar=Wn.Provider,Yn=()=>K(Wn);let Lr=0;const en=()=>++Lr,Ie=()=>Number(location.hash.slice(1))||0;let it=()=>{};class Rr extends Promise{constructor(){super(t=>{it=()=>{t(),it=()=>{}}})}}function Vn({children:e}){const[t,n]=N({current:e}),r=te([{elem:e,key:0}]),o=te({goTo(a,c){let l=Ie(),u;c!=null&&c.replace?(u=r.current[l].key??en(),n(h=>({...h,current:a}))):(r.current=r.current.slice(0,++l),location.hash=`#${l}`,u=en()),r.current[l]={elem:a,key:u}},goBack({screen:a,props:c}={}){if(a){const l=Ie();for(let u=l-1;u>=0;--u)if(r.current[u].elem.type===a){if(history.go(u-l),c){const h={...r.current[u].elem.props,...c};r.current[u].elem=i(a,{...h})}break}}else history.back();return new Rr}});C(()=>{function a(){var u,h;it();const l=Ie();l>=r.current.length?history.back():n({current:((u=r.current[l])==null?void 0:u.elem)??i("div",{}),prev:(h=r.current[l-1])==null?void 0:h.elem})}function c(l){l.preventDefault()}return location.replace("#0"),addEventListener("hashchange",a),addEventListener("beforeunload",c),()=>{removeEventListener("hashchange",a),removeEventListener("beforeunload",c)}},[]);const s=Math.min(Ie(),r.current.length-1);return i(Dr,{value:o.current,children:i(Ar,{value:t,children:r.current.slice(0,s+1).map(({elem:a,key:c},l)=>i("article",{hidden:l!==s,children:a},c))})})}const vt={bg:"bg-blue-500",text:"text-blue-500"},Qn=q(vt),qn=Qn.Provider,j=()=>K(Qn),$r={normal:"py-1",small:"py-1.5 text-xs uppercase tracking-wide",full:"w-full py-3"};function $(e){const{goBack:t}=B(),{type:n,back:r,onClick:o,className:s,...a}=e;let c=`${$r[n||"normal"]} ${s||""}`;const{bg:l}=j();return c.includes(" bg-")||(c+=` ${l} text-white`),i("button",{onClick:async()=>{o&&await o(),r&&(r===!0?t():t(r))},className:`${c} inline-flex items-center justify-center min-w-[36px] rounded-lg px-2 font-semibold disabled:opacity-50`,...a})}function Y(e){return i("div",{className:"mb-20",children:i("div",{className:"fixed bottom-0 left-0 w-full px-5 pb-5 text-center",children:i($,{...e,className:"max-w-2xl mx-auto shadow-[0px_4px_8px_-1px_#0005]",type:"full"})})})}function W({children:e,className:t,title:n}){return t||(t=""),t.match(/\bw-\S+\s*/)||(t+=" w-4"),t.match(/\bh-\S+\s*/)||(t+=" h-auto"),i("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",viewBox:"0 0 16 16",className:`mx-auto ${t}`,role:"img",children:[n&&i("title",{children:n}),e]})}/** * Modified arrow-left2 icon from [IcoMoon]{@link https://icomoon.io/#icons-icomoon} * @license CC-BY-4.0 - */function Or(e){return i(W,{...e,children:i("path",{d:"M0.293,7.337L7.333,0.297C7.723,-0.093 8.357,-0.093 8.747,0.297C9.137,0.687 9.137,1.321 8.747,1.711L3.414,7.044L15,7.044C15.552,7.044 16,7.492 16,8.044C16,8.596 15.552,9.044 15,9.044L3.414,9.044L8.747,14.377C9.137,14.767 9.137,15.401 8.747,15.791C8.357,16.181 7.723,16.181 7.333,15.791L0.293,8.751C0.102,8.561 0,8.307 0,8.044C0,7.781 0.102,7.527 0.293,7.337Z"})})}function Mr({title:e,subhead:t,children:n}){const{prev:r}=Yn(),{bg:o,text:s}=j();function a(c){return!$n(c)||typeof c.type=="string"?c:c.type===x?zi.map(c.props.children,a):er(c,{className:`bg-white bg-opacity-90 ${s} ${c.props.className||""}`})}return i("div",{className:`px-3 ext-lg text-white ${o}`,children:[i("div",{className:"flex justify-end gap-x-2 gap-y-1 min-h-[36px] py-2",children:[!!r&&i($,{back:!0,className:"-my-2 -ml-3",title:"Go Back",children:i(Or,{})}),i("h1",{className:"flex-1 self-center py-1 text-xl font-semibold overflow-hidden whitespace-nowrap",children:e}),a(n)]}),t&&i("div",{className:"flex flex-col gap-y-1 pb-1",children:t})]})}function U({title:e,buttons:t,subhead:n,footer:r,theme:o,children:s,contentRef:a}){const c=j();return o??(o=c),i(qn,{value:o,children:i("div",{className:"fixed inset-0 flex flex-col",children:[i(Mr,{title:e,subhead:n,children:t}),i("div",{ref:a,className:"relative flex-1 overflow-auto px-3 pb-3",children:s}),r&&i("div",{className:`relative ${o.bg} text-white font-semibold`,children:r})]})})}const tn=["bg1","disclaimer","accepted"],Gr={bg:"bg-red-600",text:"text-red-600"};function Br(){const[e,t]=I(!!M.get(tn));return e?null:i(Ur,{onAccept:()=>{M.set(tn,1),t(!0)}})}function Ur({onAccept:e}){return i(U,{title:"Warning!",theme:Gr,children:[i("p",{children:'Use at your own risk. BG1 is highly experimental, for demonstration purposes only, and provided "as is" without warranty of any kind. It is in no way endorsed by or associated with the Walt Disney Company and could stop working at any time for any reason. To ensure the intended experience, always use the official Disney app.'}),i(Y,{onClick:e,children:"Accept"})]})}function Kn(){return i(U,{title:"BG1 News",children:i("iframe",{src:"https://joelface.github.io/bg1/news.html",className:"absolute inset-0 w-full h-full"})})}const nn=["bg1","news","version"];function Hr(e){const[t,n]=I(()=>{const r=Number(M.get(nn));return Number.isInteger(r)?r:0});return t{M.set(nn,e),n(e)},children:"Close"})]}):null}function bt(e){const t=()=>{document.hidden||e()};return document.addEventListener("visibilitychange",t),()=>{document.removeEventListener("visibilitychange",t)}}const zr="https://cdn.registerdisney.go.com/v4/OneID.js",We="oneid-script",Fr="oneid-wrapper",jr="oneid-secure-responder";function Wr({resort:e,onLogin:t}){return C(()=>{let n=0;async function r(){if(!window.OneID){n=self.setTimeout(r,100);return}const o=navigator.userAgent.includes("Android")?"AND":"IOS",s=window.OneID.get({clientId:`TPR-${e.id}-LBSDK.${o}`,responderPage:"https://bg1.joelface.com/responder.html"});s.on("login",({token:a})=>{t({swid:a.swid,accessToken:a.access_token,expires:new Date(a.exp).getTime()})}),s.on("close",()=>{s.launchLogin()}),await s.init(),s.launchLogin()}if(!document.getElementById(We)){const o=document.createElement("script");o.id=We,o.src=zr,document.head.appendChild(o)}return r(),()=>{var o;n&&clearTimeout(n);for(const s of[Fr,jr,We]){const a=document.getElementById(s);(o=a==null?void 0:a.parentNode)==null||o.removeChild(a)}}},[e,t]),i("div",{className:"fixed top-0 left-0 w-full h-full border-0"})}const Jn=q([]),Yr=Jn.Provider,Xn=()=>K(Jn);function Vr(){const{das:e}=O(),[t,n]=I([]);return C(()=>{e.parties().then(n)},[e]),t}const rn=["bg1","genie","park"],Zn=q({park:{},setPark:()=>{}}),Qr=({value:e,children:t})=>i(Zn.Provider,{value:e,children:t}),Me=()=>K(Zn);function qr(){const e=O(),[t,n]=I(()=>{const r=e.parks[0],{id:o=r.id,date:s=""}=M.get(rn)??{};try{return s===H()?e.park(o):r}catch(a){return a instanceof ie||console.error(a),r}});return C(()=>{M.set(rn,{id:t.id,date:H()})},[t]),{park:t,setPark:n}}/** + */function Or(e){return i(W,{...e,children:i("path",{d:"M0.293,7.337L7.333,0.297C7.723,-0.093 8.357,-0.093 8.747,0.297C9.137,0.687 9.137,1.321 8.747,1.711L3.414,7.044L15,7.044C15.552,7.044 16,7.492 16,8.044C16,8.596 15.552,9.044 15,9.044L3.414,9.044L8.747,14.377C9.137,14.767 9.137,15.401 8.747,15.791C8.357,16.181 7.723,16.181 7.333,15.791L0.293,8.751C0.102,8.561 0,8.307 0,8.044C0,7.781 0.102,7.527 0.293,7.337Z"})})}function Mr({title:e,subhead:t,children:n}){const{prev:r}=Yn(),{bg:o,text:s}=j();function a(c){return!$n(c)||typeof c.type=="string"?c:c.type===x?zi.map(c.props.children,a):er(c,{className:`bg-white bg-opacity-90 ${s} ${c.props.className||""}`})}return i("div",{className:`px-3 ext-lg text-white ${o}`,children:[i("div",{className:"flex justify-end gap-x-2 gap-y-1 min-h-[36px] py-2",children:[!!r&&i($,{back:!0,className:"-my-2 -ml-3",title:"Go Back",children:i(Or,{})}),i("h1",{className:"flex-1 self-center py-1 text-xl font-semibold overflow-hidden whitespace-nowrap",children:e}),a(n)]}),t&&i("div",{className:"flex flex-col gap-y-1 pb-1",children:t})]})}function U({title:e,buttons:t,subhead:n,footer:r,theme:o,children:s,contentRef:a}){const c=j();return o??(o=c),i(qn,{value:o,children:i("div",{className:"fixed inset-0 flex flex-col",children:[i(Mr,{title:e,subhead:n,children:t}),i("div",{ref:a,className:"relative flex-1 overflow-auto px-3 pb-3",children:s}),r&&i("div",{className:`relative ${o.bg} text-white font-semibold`,children:r})]})})}const tn=["bg1","disclaimer","accepted"],Gr={bg:"bg-red-600",text:"text-red-600"};function Br(){const[e,t]=N(!!M.get(tn));return e?null:i(Ur,{onAccept:()=>{M.set(tn,1),t(!0)}})}function Ur({onAccept:e}){return i(U,{title:"Warning!",theme:Gr,children:[i("p",{children:'Use at your own risk. BG1 is highly experimental, for demonstration purposes only, and provided "as is" without warranty of any kind. It is in no way endorsed by or associated with the Walt Disney Company and could stop working at any time for any reason. To ensure the intended experience, always use the official Disney app.'}),i(Y,{onClick:e,children:"Accept"})]})}function Kn(){return i(U,{title:"BG1 News",children:i("iframe",{src:"https://joelface.github.io/bg1/news.html",className:"absolute inset-0 w-full h-full"})})}const nn=["bg1","news","version"];function Hr(e){const[t,n]=N(()=>{const r=Number(M.get(nn));return Number.isInteger(r)?r:0});return t{M.set(nn,e),n(e)},children:"Close"})]}):null}function bt(e){const t=()=>{document.hidden||e()};return document.addEventListener("visibilitychange",t),()=>{document.removeEventListener("visibilitychange",t)}}const zr="https://cdn.registerdisney.go.com/v4/OneID.js",We="oneid-script",Fr="oneid-wrapper",jr="oneid-secure-responder";function Wr({resort:e,onLogin:t}){return C(()=>{let n=0;async function r(){if(!window.OneID){n=self.setTimeout(r,100);return}const o=navigator.userAgent.includes("Android")?"AND":"IOS",s=window.OneID.get({clientId:`TPR-${e.id}-LBSDK.${o}`,responderPage:"https://bg1.joelface.com/responder.html"});s.on("login",({token:a})=>{t({swid:a.swid,accessToken:a.access_token,expires:new Date(a.exp).getTime()})}),s.on("close",()=>{s.launchLogin()}),await s.init(),s.launchLogin()}if(!document.getElementById(We)){const o=document.createElement("script");o.id=We,o.src=zr,document.head.appendChild(o)}return r(),()=>{var o;n&&clearTimeout(n);for(const s of[Fr,jr,We]){const a=document.getElementById(s);(o=a==null?void 0:a.parentNode)==null||o.removeChild(a)}}},[e,t]),i("div",{className:"fixed top-0 left-0 w-full h-full border-0"})}const Jn=q([]),Yr=Jn.Provider,Xn=()=>K(Jn);function Vr(){const{das:e}=O(),[t,n]=N([]);return C(()=>{e.parties().then(n)},[e]),t}const rn=["bg1","genie","park"],Zn=q({park:{},setPark:()=>{}}),Qr=({value:e,children:t})=>i(Zn.Provider,{value:e,children:t}),Me=()=>K(Zn);function qr(){const e=O(),[t,n]=N(()=>{const r=e.parks[0],{id:o=r.id,date:s=""}=M.get(rn)??{};try{return s===H()?e.park(o):r}catch(a){return a instanceof ie||console.error(a),r}});return C(()=>{M.set(rn,{id:t.id,date:H()})},[t]),{park:t,setPark:n}}/** * Refresh icon from [IcoMoon]{@link https://icomoon.io/#icons-icomoon} * @license CC-BY-4.0 - */function xt({className:e}){return i(W,{className:e,children:i("path",{d:"M16 6h-6l2.243-2.243c-1.133-1.133-2.64-1.757-4.243-1.757s-3.109 0.624-4.243 1.757c-1.133 1.133-1.757 2.64-1.757 4.243s0.624 3.109 1.757 4.243c1.133 1.133 2.64 1.757 4.243 1.757s3.109-0.624 4.243-1.757c0.095-0.095 0.185-0.192 0.273-0.292l1.505 1.317c-1.466 1.674-3.62 2.732-6.020 2.732-4.418 0-8-3.582-8-8s3.582-8 8-8c2.209 0 4.209 0.896 5.656 2.344l2.343-2.344v6z"})})}function wt(e){const{children:t,color:n="bg-black",className:r="",...o}=e;return i("div",{className:`fixed inset-0 z-10 flex items-center justify-center p-2 ${n} bg-opacity-75 ${r}`,...o,children:t})}function Kr(){const{bg:e}=j();return i(wt,{color:"bg-white",children:i("div",{className:"w-[50px] mx-auto",children:i("div",{"aria-label":"Loading\u2026",className:`rounded-full p-[20%] ${e}`,children:i(xt,{className:"animate-spin w-full text-white"})})})})}const Jr=3e3,Xr={alert:"bg-yellow-200",error:"bg-red-200"};function ei(){const[,e]=I(0),[t,n]=I(""),[r,o]=I("alert"),s=Q((c,l)=>{n(c),o(l||"alert"),e(u=>(clearTimeout(u),c?self.setTimeout(()=>{n("")},Jr):u))},[]);return[t?i(Zr,{message:t,type:r}):null,s]}function Zr({message:e,type:t}){return e?i("div",{role:"alert",className:`fixed bottom-20 left-0 w-full p-2 font-semibold text-center ${Xr[t]} text-gray-800`,children:e}):null}async function es(e){return new Promise(t=>{setTimeout(t,e)})}const ts=500;function J(){const[e,t]=I(0),[n,r]=ei(),o=Q(async(a,c={})=>{var g;const{messages:l={},minLoadTime:u=ts}=c,h={error:"Unknown error occurred",request:"Network request failed",...l};r("");let d=[""];function f(...E){d=E}t(E=>E+1);const p=es(u);try{await a(f)}catch(E){const k=(g=E==null?void 0:E.response)==null?void 0:g.status;h[E.name]!==void 0?f(h[E.name],"error"):Number.isInteger(k)?f(k in h?h[k]:h.request,"error"):(console.error(E),f(h.error,"error"))}await p,t(E=>E-1),r(...d)},[r]),s=e>0||n?i(x,{children:[e>0&&i(Kr,{}),n]}):null;return{loadData:o,loaderElem:s,flash:r}}function ti(e){const[,t]=I(0);return Q((n=0)=>{t(r=>Date.now()-r{},loaderElem:null}),ns=ni.Provider,me=()=>K(ni);function is(){const{genie:e}=O(),{loadData:t,loaderElem:n}=J(),[r,o]=I([]),s=ti(Q(()=>{t(async()=>{o(await e.bookings())})},[e,t]));return C(s,[s]),{plans:r,refreshPlans:s,loaderElem:n}}const ii=q({current:void 0,begin:()=>{},end:()=>{}}),rs=ii.Provider,ce=()=>K(ii),ss=()=>{const[e,t]=I({current:void 0,begin:n=>{t({...e,current:n})},end:()=>{t(n=>n.current?{...n,current:void 0}:n)}});return e},ri=q({tabs:[],active:{name:"",icon:i("div",{}),component:()=>null},changeTab:()=>{},scrollPos:{get:()=>0,set:()=>{}}}),si=()=>K(ri);function os({name:e,icon:t}){const n=j(),{active:r,changeTab:o}=si();if(!o)return null;const a=(r==null?void 0:r.name)===e?`bg-white bg-opacity-90 ${n.text}`:`${n.bg} text-white`;return i("button",{className:"px-4 py-2",onClick:()=>o(e),children:[i("div",{className:`min-w-[3rem] rounded-full py-1.5 ${a}`,children:t}),i("div",{className:"mt-0.5 text-sm",children:e})]})}function kt({title:e,buttons:t,subhead:n,children:r,contentRef:o}){const{tabs:s,scrollPos:a,footer:c}=si();let l=te(null);return o&&(l=o),ht(()=>{const u=l.current;if(!u)return;u.scroll(0,a.get());const h=()=>a.set(u.scrollTop);return u.addEventListener("scroll",h),()=>u.removeEventListener("scroll",h)},[a]),i(U,{title:e,buttons:t,subhead:n,footer:i(x,{children:[i("div",{className:"flex items-center justify-center",children:s.map(u=>ge(os,{...u,key:u.name}))}),c]}),contentRef:l,children:r})}function as({tabs:e,footer:t},n){return function r({tabName:o}){const{goTo:s}=B(),a=Q(u=>{u!==o&&s(i(r,{tabName:u}),{replace:!0})},[o,s]),c=te(Object.fromEntries(e.map(u=>[u.name,0]))),l=e.find(({name:u})=>u===o)??e[0];return l?i(ri.Provider,{value:{tabs:e,active:l,changeTab:a,scrollPos:{get:()=>c.current[l.name],set:u=>{c.current[l.name]=u}},footer:t},children:i(n,{tab:l})}):null}}const oi=q({experiences:[],refreshExperiences:()=>{},park:{},setPark:()=>null,loaderElem:null}),cs=oi.Provider,Ge=()=>K(oi);function ls(){const{genie:e,liveData:t}=O(),{park:n,setPark:r}=Me(),{loadData:o,loaderElem:s}=J(),[a,c]=I([]),l=ti(Q(()=>{o(async()=>{const u=t.shows(n);let h={...Object.fromEntries((await e.experiences(n)).map(d=>[d.id,d]))};try{h={...await u,...h}}catch(d){console.error(d)}c(Object.values(h))})},[n,e,t,o]));return C(l,[l]),{experiences:a,park:n,refreshExperiences:l,loaderElem:s,setPark:u=>{r(u),c([])}}}/** + */function xt({className:e}){return i(W,{className:e,children:i("path",{d:"M16 6h-6l2.243-2.243c-1.133-1.133-2.64-1.757-4.243-1.757s-3.109 0.624-4.243 1.757c-1.133 1.133-1.757 2.64-1.757 4.243s0.624 3.109 1.757 4.243c1.133 1.133 2.64 1.757 4.243 1.757s3.109-0.624 4.243-1.757c0.095-0.095 0.185-0.192 0.273-0.292l1.505 1.317c-1.466 1.674-3.62 2.732-6.020 2.732-4.418 0-8-3.582-8-8s3.582-8 8-8c2.209 0 4.209 0.896 5.656 2.344l2.343-2.344v6z"})})}function wt(e){const{children:t,color:n="bg-black",className:r="",...o}=e;return i("div",{className:`fixed inset-0 z-10 flex items-center justify-center p-2 ${n} bg-opacity-75 ${r}`,...o,children:t})}function Kr(){const{bg:e}=j();return i(wt,{color:"bg-white",children:i("div",{className:"w-[50px] mx-auto",children:i("div",{"aria-label":"Loading\u2026",className:`rounded-full p-[20%] ${e}`,children:i(xt,{className:"animate-spin w-full text-white"})})})})}const Jr=3e3,Xr={alert:"bg-yellow-200",error:"bg-red-200"};function ei(){const[,e]=N(0),[t,n]=N(""),[r,o]=N("alert"),s=Q((c,l)=>{n(c),o(l||"alert"),e(u=>(clearTimeout(u),c?self.setTimeout(()=>{n("")},Jr):u))},[]);return[t?i(Zr,{message:t,type:r}):null,s]}function Zr({message:e,type:t}){return e?i("div",{role:"alert",className:`fixed bottom-20 left-0 w-full p-2 font-semibold text-center ${Xr[t]} text-gray-800`,children:e}):null}async function es(e){return new Promise(t=>{setTimeout(t,e)})}const ts=500;function J(){const[e,t]=N(0),[n,r]=ei(),o=Q(async(a,c={})=>{var g;const{messages:l={},minLoadTime:u=ts}=c,h={error:"Unknown error occurred",request:"Network request failed",...l};r("");let d=[""];function f(...E){d=E}t(E=>E+1);const p=es(u);try{await a(f)}catch(E){const k=(g=E==null?void 0:E.response)==null?void 0:g.status;h[E.name]!==void 0?f(h[E.name],"error"):Number.isInteger(k)?f(k in h?h[k]:h.request,"error"):(console.error(E),f(h.error,"error"))}await p,t(E=>E-1),r(...d)},[r]),s=e>0||n?i(x,{children:[e>0&&i(Kr,{}),n]}):null;return{loadData:o,loaderElem:s,flash:r}}function ti(e){const[,t]=N(0);return Q((n=0)=>{t(r=>Date.now()-r{},loaderElem:null}),ns=ni.Provider,me=()=>K(ni);function is(){const{genie:e}=O(),{loadData:t,loaderElem:n}=J(),[r,o]=N([]),s=ti(Q(()=>{t(async()=>{o(await e.bookings())})},[e,t]));return C(s,[s]),{plans:r,refreshPlans:s,loaderElem:n}}const ii=q({current:void 0,begin:()=>{},end:()=>{}}),rs=ii.Provider,ce=()=>K(ii),ss=()=>{const[e,t]=N({current:void 0,begin:n=>{t({...e,current:n})},end:()=>{t(n=>n.current?{...n,current:void 0}:n)}});return e},ri=q({tabs:[],active:{name:"",icon:i("div",{}),component:()=>null},changeTab:()=>{},scrollPos:{get:()=>0,set:()=>{}}}),si=()=>K(ri);function os({name:e,icon:t}){const n=j(),{active:r,changeTab:o}=si();if(!o)return null;const a=(r==null?void 0:r.name)===e?`bg-white bg-opacity-90 ${n.text}`:`${n.bg} text-white`;return i("button",{className:"px-4 py-2",onClick:()=>o(e),children:[i("div",{className:`min-w-[3rem] rounded-full py-1.5 ${a}`,children:t}),i("div",{className:"mt-0.5 text-sm",children:e})]})}function kt({title:e,buttons:t,subhead:n,children:r,contentRef:o}){const{tabs:s,scrollPos:a,footer:c}=si();let l=te(null);return o&&(l=o),ht(()=>{const u=l.current;if(!u)return;u.scroll(0,a.get());const h=()=>a.set(u.scrollTop);return u.addEventListener("scroll",h),()=>u.removeEventListener("scroll",h)},[a]),i(U,{title:e,buttons:t,subhead:n,footer:i(x,{children:[i("div",{className:"flex items-center justify-center",children:s.map(u=>ge(os,{...u,key:u.name}))}),c]}),contentRef:l,children:r})}function as({tabs:e,footer:t},n){return function r({tabName:o}){const{goTo:s}=B(),a=Q(u=>{u!==o&&s(i(r,{tabName:u}),{replace:!0})},[o,s]),c=te(Object.fromEntries(e.map(u=>[u.name,0]))),l=e.find(({name:u})=>u===o)??e[0];return l?i(ri.Provider,{value:{tabs:e,active:l,changeTab:a,scrollPos:{get:()=>c.current[l.name],set:u=>{c.current[l.name]=u}},footer:t},children:i(n,{tab:l})}):null}}const oi=q({experiences:[],refreshExperiences:()=>{},park:{},setPark:()=>null,loaderElem:null}),cs=oi.Provider,Ge=()=>K(oi);function ls(){const{genie:e,liveData:t}=O(),{park:n,setPark:r}=Me(),{loadData:o,loaderElem:s}=J(),[a,c]=N([]),l=ti(Q(()=>{o(async()=>{const u=t.shows(n);let h={...Object.fromEntries((await e.experiences(n)).map(d=>[d.id,d]))};try{h={...await u,...h}}catch(d){console.error(d)}c(Object.values(h))})},[n,e,t,o]));return C(l,[l]),{experiences:a,park:n,refreshExperiences:l,loaderElem:s,setPark:u=>{r(u),c([])}}}/** * Calendar icon from [IcoMoon]{@link https://icomoon.io/#icons-icomoon} * @license CC-BY-4.0 */function ai({className:e}){return i(W,{className:e,children:i("path",{d:"M5 6h2v2h-2zM8 6h2v2h-2zM11 6h2v2h-2zM2 12h2v2h-2zM5 12h2v2h-2zM8 12h2v2h-2zM5 9h2v2h-2zM8 9h2v2h-2zM11 9h2v2h-2zM2 9h2v2h-2zM13 0v1h-2v-1h-7v1h-2v-1h-2v16h15v-16h-2zM14 15h-13v-11h13v11z"})})}/** @@ -22,7 +22,7 @@ var Pi=Object.defineProperty;var Ci=e=>{throw TypeError(e)};var Di=(e,t,n)=>t in */function on(e){return i(W,{...e,children:i("path",{d:"M8 15.5l7.5-7.5h-4.5v-8h-6v8h-4.5z"})})}/** * Star icon from [IcoMoon]{@link https://icomoon.io/#icons-icomoon} * @license CC-BY-4.0 - */function us(e){return i(W,{...e,children:i("path",{d:"M16 6.204l-5.528-0.803-2.472-5.009-2.472 5.009-5.528 0.803 4 3.899-0.944 5.505 4.944-2.599 4.944 2.599-0.944-5.505 4-3.899z"})})}function ne({date:e,time:t,type:n,...r}){return i("time",{...r,dateTime:e||t,children:e?sr(e,n):t?z(t):""})}function ci({start:e,end:t}){const n=H(e),r=H(t);return t?i(x,{children:[e.time?i(ne,{time:e.time}):i("span",{children:"Park Open"})," \u2013"," ",r>n?i(ne,{date:r,type:"short"}):t.time?i(ne,{time:t.time}):i("span",{children:"Park Close"})]}):i(ne,{time:e.time})}const an=i("span",{"aria-hidden":!0,children:"\u2022"});function li({booking:e,button:t}){const n=j();return i("div",{className:"flex items-center gap-x-3",children:[i("div",{className:"flex-1 min-w-0",children:[i("div",{className:"flex items-center gap-x-2 text-gray-500 text-sm font-semibold uppercase whitespace-nowrap",children:[e.type==="DAS"&&i(x,{children:[i("span",{children:"DAS"}),an]}),e.type==="BG"?i(x,{children:[i("span",{children:["BG ",e.boardingGroup]}),e.status==="SUMMONED"&&i(x,{children:[an,i("span",{className:`${n.text} font-bold`,children:"Board Now"})]})]}):i(ci,{...e})]}),i("div",{className:"text-lg font-semibold leading-snug truncate",children:e.choices?"Multiple Experiences":e.name})]}),t&&i("div",{children:t})]})}function di(){const e=ce(),t=j();return e.current?i("div",{className:`${t.bg}`,children:i("div",{className:"-mx-3 pb-3 bg-white text-black",children:[i("div",{className:`pb-1 ${t.bg} text-white text-sm font-semibold uppercase text-center`,children:"Modifying Reservation"}),i("div",{className:"mt-2 px-3",children:i(li,{booking:e.current,button:i($,{type:"small",back:{screen:pe},onClick:e.end,children:"Keep"})})})]})}):null}function F({guests:e,selectable:t,conflicts:n}){return e.length===0?null:i("ul",{className:"mt-2",children:e.map(r=>{var o;return i("li",{className:"px-3 py-1",children:i("label",{className:"flex items-center",children:[t&&i("input",{type:"checkbox",checked:t.isSelected(r),onChange:()=>t.onToggle(r),className:"mr-3"}),i("span",{className:"w-[48px] h-[48px] leading-[48px] mr-3 rounded-full text-3xl font-bold text-center bg-gray-400 text-white",children:r.avatarImageUrl?i("img",{src:r.avatarImageUrl,alt:"",width:"48",height:"48",className:"rounded-full"}):i("span",{"aria-hidden":"true",children:r.name[0]})}),i("span",{className:"leading-tight",children:[r.name,(n==null?void 0:n[r.id])&&i("span",{className:"block text-xs font-semibold text-red-700 uppercase",children:(o=n[r.id])==null?void 0:o.replace(/_/g," ")})]})]})},r.id)})})}const ui=["bg1","genie","partyIds"];function hi(){const e=M.get(ui)??[];return Array.isArray(e)?e:[]}function hs(){const{genie:e}=O();C(()=>e.setPartyIds(hi()),[e])}function ps(){const{genie:e}=O(),{loadData:t,loaderElem:n}=J(),[r,o]=I(!0),[s,a]=I(),[c,l]=I(()=>{const p=new Set(hi());return o(p.size===0),p});function u(){const p=[...c];M.set(ui,p),e.setPartyIds(p)}C(()=>{t(async()=>{const p=await e.guests();a([...p.eligible,...p.ineligible].sort((g,E)=>+!g.primary-+!E.primary||g.name.localeCompare(E.name)))})},[e,t]),C(()=>{r&&l(new Set)},[r]);const h=s==null?void 0:s.filter(p=>c.has(p.id)),d=s==null?void 0:s.filter(p=>!c.has(p.id)),f=p=>i("li",{children:i("label",{className:"flex items-center mt-2",children:[i("input",{type:"radio",name:"auto",onChange:()=>o(p.auto),checked:r===p.auto,className:"mr-2"})," ",p.children]})});return i(U,{title:"Party Selection",children:[i("p",{children:"By default, all eligible guests (up to a maximum of 12) are automatically selected when you book a Lightning Lane. If you would like to limit who you book for, you can manually select your party here."}),i("ul",{children:[i(f,{auto:!0,children:"Book for all eligible guests"}),i(f,{auto:!1,children:"Only book for selected guests"})]}),r?null:(s==null?void 0:s.length)===0?i("p",{className:"text-red-700",children:"No guests to select"}):h&&d?i(x,{children:[h.length>0&&i(x,{children:[i("h3",{children:"Your Party"}),i(F,{guests:h,selectable:{isSelected:()=>!0,onToggle:p=>{const g=new Set(c);g.delete(p.id),l(g)}}})]}),d.length>0&&i(x,{children:[i("h3",{children:"Add to Your Party"}),i(F,{guests:d,selectable:{isSelected:()=>!1,onToggle:p=>{const g=new Set(c);g.add(p.id),l(g)}}})]})]}):null,n,i(Y,{back:!0,disabled:!r&&c.size===0,onClick:u,children:"Save"})]})}function Be({name:e,onClick:t,...n}){return i($,{...n,title:`Refresh ${e}`,onClick:t,children:i(xt,{})})}const pi=q({eligible:[],ineligible:[],selected:[],setSelected:()=>null,experience:{name:"",park:{name:"",theme:{bg:"",text:""}}}}),mi=pi.Provider,fi=()=>K(pi),ms="https://bg1.joelface.com/ping";async function Et(e,t){const{date:n}=L(),r=["bg1","ping",e.id,t];if(M.get(r)===n)return;const{ok:s}=await fetch(ms,{method:"POST",body:new URLSearchParams({resort:e.id,service:t})});s&&M.set(r,n)}function fs(e){return i(W,{...e,children:i("path",{d:"M 5.5253906 0.9296875 L 3.4042969 3.0507812 L 8.3535156 8 L 3.4042969 12.949219 L 5.5253906 15.070312 L 10.474609 10.121094 L 12.595703 8 L 10.474609 5.8789062 L 5.5253906 0.9296875 z"})})}function _i(e){return i("div",{className:`mt-4 border-2 rounded border-green-600 p-1 font-semibold text-center text-green-600 bg-green-100 ${e.className}`,children:e.children})}function _s({bg:e,experiences:t,heading:n}){return i("div",{className:`mt-4 rounded ${e}`,children:[i("h3",{className:"mt-0 p-1 text-white text-center",children:n}),i("ul",{className:"list-disc py-2 pl-8 bg-white bg-opacity-90",children:t.map(r=>i("li",{children:r.name},r.id))})]})}function It({start:e,end:t}){return i("div",{className:"mt-4 text-lg",children:[t?"Arrive by":"Reservation at",":"," ",i("span",{className:"pl-1 font-semibold",children:i(ci,{start:e,end:t})})]})}function gs({booking:e,onCancel:t,dasGuest:n}){const{genie:r,das:o}=O(),s=e.type==="DAS"?o:r,{refreshPlans:a}=me(),[c,l]=I(new Set),{loadData:u,loaderElem:h}=J(),{name:d,park:f,guests:p}=e,g=c.size===0,E=c.size===p.length;async function k(){g||(await u(async()=>{await s.cancelBooking([...c]),a()}),t(p.filter(w=>!c.has(w))))}return i(U,{title:"Cancel Guests",theme:f.theme,children:[i("h2",{children:d}),i("div",{children:f.name}),i(It,{...e}),i("div",{className:"ml-3",children:i("label",{className:"flex items-center py-4",children:[i("input",{type:"checkbox",checked:E,onChange:()=>l(new Set(E?[]:p))}),i("span",{className:"ml-3",children:"Select All"})]})}),!g&&i("div",{className:"mb-4",children:[i("h3",{children:"Cancel These Guests"}),i(F,{guests:p.filter(w=>c.has(w)),selectable:{isSelected:()=>!0,onToggle:w=>{if(n&&w!==n&&c.has(n))l(new Set);else{const m=new Set(c);m.delete(w),l(m)}}}})]}),!E&&i("div",{children:[i("h3",{children:"Select Guests to Cancel"}),i(F,{guests:p.filter(w=>!c.has(w)),selectable:{isSelected:()=>!1,onToggle:w=>{l(new Set(w===n?p:c).add(w))}}})]}),i(Y,{back:!0,disabled:g,onClick:k,children:"Cancel "+(E?"Reservation":"Guests")}),h]})}function ve({booking:e,isNew:t}){var y;const{goTo:n,goBack:r}=B(),{setPark:o}=Me(),s=O(),a=Xn(),{name:c,park:l,choices:u,type:h,subtype:d,start:f}=e,p=h==="DAS"&&d==="IN_PARK"?e.guests.find(v=>a.find(S=>S[0].id===v.id)):void 0,g=ce(),[E,k]=I(e.cancellable&&(h!=="DAS"||p)?e.guests:void 0),w=new Map([[l,[]],...s.parks.map(v=>[v,[]])]);for(const v of u||[])(y=w.get(v.park))==null||y.push(v);const m=[...w].filter(([,v])=>v.length>0).map(([v])=>v),b=(u?m.length===1?m[0]:{}:l).theme??vt;return i(U,{title:"Your "+{LL:"Lightning Lane",DAS:"DAS Selection",BG:"Boarding Group",APR:"Park Pass",RES:"Reservation"}[h],theme:b,buttons:e.modifiable&&i($,{onClick:()=>{g.begin(e),o(e.park),r({screen:pe,props:{tabName:"LL"}})},children:"Modify"}),children:[i("div",{className:`-mx-3 px-2 py-1 text-center ${b.bg} text-white text-sm font-semibold uppercase`,children:i(ne,{date:H(f)})}),u?i("h2",{children:"Multiple Experiences"}):i(x,{children:[i("h2",{children:c}),l.name&&i("div",{children:l.name})]}),h==="BG"?i(x,{children:[e.status==="SUMMONED"&&i(_i,{children:"Your boarding group has been called"}),i("h3",{children:["Boarding Group:"," ",i("span",{className:"ml-1 font-semibold",children:e.boardingGroup})]}),i("p",{children:"Check the official Disney app for return time and other virtual queue information."})]}):i(It,{...e}),u&&i(x,{children:[i("p",{children:[c&&i(x,{children:[i("b",{children:c})," was temporarily unavailable during your return time."]}),"You may redeem this Lightning Lane at one of these replacement experiences:"]}),[...w].filter(([,v])=>v.length>0).map(([v,S])=>i(_s,{heading:v.name,experiences:S,bg:v.theme.bg},v.id))]}),i("div",{className:"flex mt-4",children:[i("h3",{className:"inline mt-0",children:"Your Party"}),e.cancellable&&E&&i($,{type:"small",onClick:()=>{n(i(gs,{booking:{...e,guests:E},dasGuest:p,onCancel:v=>{v.length>0?k(v):r()}}))},className:"ml-3",children:"Cancel"})]}),i(F,{guests:E||e.guests,conflicts:Object.fromEntries(e.type==="LL"?e.guests.filter(v=>(v.redemptions??1)!==1).map(v=>[v.id,`Redemptions left: ${v.redemptions}`]):[])}),t&&i(Y,{onClick:()=>r({screen:pe,props:{tabName:"Plans"}}),children:"Show Plans"})]})}function gi({...e}){const{plans:t,refreshPlans:n,loaderElem:r}=me();return i(kt,{title:"Your Plans",buttons:i(Be,{name:"Plans",onClick:n}),theme:vt,...e,children:[i(ys,{plans:t}),r]})}const ys=ft(function({plans:t}){var l,u;const{goTo:n}=B(),r=j();function o(h){n(i(ve,{booking:h}))}const s=new Map,a=new Map;for(const h of t){const d=H(h.start);s.has(d)||s.set(d,[]),h.type!=="APR"&&((l=s.get(d))==null||l.push(h)),a.has(d)||a.set(d,new Set),(h.type!=="LL"||h.subtype!=="MEP")&&h.park.icon&&((u=a.get(d))==null||u.add(h.park))}const c=i("p",{className:"font-semibold text-center uppercase text-gray-500",children:"No existing plans"});return i("ul",{children:t.length>0?[...s].map(([h,d])=>i("li",{children:[i("div",{className:"sticky top-0 -mx-3 pt-1 bg-white",children:i("div",{className:"flex items-center",children:[i("h2",{className:`flex-1 mt-0 rounded-r-full px-3 py-1 ${r.bg} text-white text-sm uppercase`,children:i(ne,{date:h})}),i("ul",{className:"px-3 pl-2 text-lg text-right",children:[...a.get(h)??[]].map(f=>i("li",{className:"inline ml-1 first:ml-0","aria-label":f.name,children:f.icon},f.id))})]})}),d.length>0?i("ul",{className:d.length===0?"mt-3":"",children:d.map(f=>i("li",{className:"py-2.5 first:border-0 border-t-4 border-gray-300",onClick:()=>o(f),children:i(li,{booking:f,button:i("button",{className:r.text,title:"More Info",children:i(fs,{})})})},f.bookingId))}):c]},h)):c})});function vs({...e}){const{goTo:t}=B();return i(x,{children:i($,{...e,onClick:()=>t(i(gi,{})),title:"Plans",children:i(ai,{})})})}function Nt(){const{ineligible:e}=fi();return i(F,{guests:e,conflicts:Object.fromEntries(e.map(t=>[t.id,t.eligibleAfter?`TOO EARLY (${z(t.eligibleAfter)})`:t.ineligibleReason||"ELIGIBLE FOR NEW BOOKING"]))})}function bs(){const{genie:e}=O(),t=ce();return i(x,{children:[t.current?i(x,{children:[i("h3",{children:"Unable to Modify"}),i("p",{children:"Your current reservation cannot be modified to this experience due to the following conflicts:"})]}):i(x,{children:[e.nextBookTime&&e.nextBookTime.slice(0,5)>L().time.slice(0,5)&&i(_i,{children:["Eligible at ",i(ne,{time:e.nextBookTime})]}),i("h3",{children:"No Eligible Guests"}),i("p",{children:"No one in your party is currently eligible for this Lightning Lane."})]}),i(Nt,{})]})}function xs({onRefresh:e}){return i(x,{children:[i("h3",{children:"No Guests Found"}),i("p",{children:"Your party could not be loaded. This is probably just a temporary network error. Wait a few seconds and try again."}),i(Y,{onClick:e,children:"Try Again"})]})}function ws(e){return i("div",{className:`mt-4 border-2 rounded border-red-600 p-1 font-semibold text-center text-red-600 bg-red-100 ${e.className}`,children:e.children})}function ks({party:e}){const{eligible:t,ineligible:n,selected:r,setSelected:o,experience:s}=e,[a,c]=I(new Set(r)),[l,u]=ei(),{maxPartySize:h}=O().genie;function d(f){c(p=>{u(""),p=new Set(p);const g=p.has(f)?"delete":"add";return g==="add"&&p.size>=h?u(`Maximum party size: ${h}`):p[g](f),p})}return i(mi,{value:e,children:i(U,{title:"Modify Party",theme:s.park.theme,children:[i("h2",{children:s.name}),i("div",{children:s.park.name}),i("h3",{children:"Your Party"}),i(F,{guests:t,selectable:{isSelected:f=>a.has(f),onToggle:d}}),n.length>0&&i(x,{children:[i("h3",{children:"Ineligible Guests"}),i(Nt,{})]}),i(Y,{back:!0,disabled:a.size===0,onClick:()=>{o(t.filter(f=>a.has(f)))},children:"Confirm Party"}),l]})})}function Tt({button:e}){const{goTo:t}=B(),n=fi(),{eligible:r,selected:o}=n,{maxPartySize:s}=O().genie;return i(x,{children:[r.length>s&&o.length===s&&i(ws,{children:"Party size restricted"}),o.length>0?i(x,{children:[i("div",{className:"mt-4",children:[i("h3",{className:"inline mt-0",children:"Your Party"}),i($,{type:"small",onClick:()=>t(i(ks,{party:n})),className:"ml-3",children:"Modify"})]}),i(F,{guests:o})]}):i(x,{children:[i("h3",{children:"Ineligible Guests"}),i(Nt,{})]}),e]})}function Es(){return i(x,{children:[i("h3",{children:"No Reservations Available"}),i("p",{children:"There aren't enough reservation slots available for your entire party. If only part of your group wishes to go on this attraction, edit your party to check again. Otherwise, go back to the attraction list and select another attraction."}),i(Tt,{})]})}function Is({offer:e,onBook:t}){const n=ce();return i(x,{children:[i(It,{...e}),e.changed&&i("div",{className:"text-sm",children:[i("strong",{children:"Note:"})," Return time has been changed"]}),i(Tt,{button:i(Y,{onClick:t,children:`${n.current?"Modify":"Book"} Lightning Lane`})})]})}const Ns=500,cn=100,Ts=5,Ss=5*6e4;let yi=0,Te=0;const ln=()=>Date.now()+yi;class Ps extends Error{constructor(){super(...arguments);T(this,"name","SyncFailed")}}async function Cs(){if(Date.now()-Teo-s);for(const[o,s]of n.slice(0,-1).entries()){const a=n[o+1],c=Math.abs(s-a);cNs)return NaN;const o=parseFloat(String(t==null?void 0:t.get("T")))*1e3;return Math.round(o-(e+n)/2)}const As=50;function Ls({onSync:e}){const[t,n]=I(ln());return C(()=>{const r=setInterval(()=>n(ln()),As);return()=>clearInterval(r)},[]),C(()=>{Cs().then(()=>e(!0)).catch(()=>e(!1))},[e]),i("time",{children:L(t).time})}function vi({time:e,label:t}){const[n,r]=I(!0);return i("table",{className:"mt-4 mx-auto text-gray-500",children:i("tbody",{children:[i(dn,{heading:t,time:i("time",{children:e||"--:--:--"})}),i(dn,{heading:"Current time",time:i(x,{children:[i(Ls,{onSync:r}),!n&&i("span",{className:"text-sm font-sans font-semibold text-red-600",children:[" ","(unsynced)"]})]})})]})})}function dn({heading:e,time:t}){return i("tr",{children:[i("th",{scope:"row",className:"pr-3 text-right text-xs font-semibold uppercase",children:[e,":"]}),i("td",{className:"text-xl font-mono leading-tight",children:["\uFEFF",t]})]})}function Rs({startTime:e,onRefresh:t}){return i(x,{children:[e?i(x,{children:[i(vi,{time:e,label:"Booking start"}),i("p",{children:["At"," ",i("time",{dateTime:e,className:"font-semibold",children:z(e)}),", tap the ",i("span",{className:"font-semibold",children:"Check Availability"})," ","button below to start booking this Lightning Lane."]})]}):i("p",{children:"Sorry, but you can't make a Lightning Lane reservation for this attraction yet."}),i(Tt,{button:i(Y,{onClick:t,children:"Check Availability"})})]})}function $s({experience:e}){const{goTo:t}=B(),n=O(),{genie:r}=n,{refreshPlans:o}=me(),s=ce(),[a,c]=I(),[l,u]=I(!e.flex.available&&e.flex.enrollmentStartTime!==void 0),[h,d]=I(l?null:void 0),{loadData:f,loaderElem:p}=J();async function g(){!h||!a||f(async()=>{let _=null;_=await r.book(h,s.current,a.selected),s.end();const y=new Set(a.selected.map(S=>S.id)),v=_.guests.filter(S=>!y.has(S.id));v.length>0&&(await r.cancelBooking(v),_.guests=_.guests.filter(S=>y.has(S.id))),_&&t(i(ve,{booking:_,isNew:!0}),{replace:!0}),o(),Et(n,"G")},{messages:{410:"Offer expired"}})}function E(){f(async _=>{var S;const v=(await r.experiences(e.park)).find(P=>P.id===e.id);(S=v==null?void 0:v.flex)!=null&&S.available?(u(!1),d(void 0)):_("Reservations not open yet")})}const k=Q(()=>{f(async()=>{const _=s.current?{eligible:s.current.guests,ineligible:[]}:await r.guests(e);c({..._,selected:_.eligible.slice(0,r.maxPartySize),setSelected:y=>c(v=>{if(!v)return v;const S=new Set(v.selected);return u(P=>(P||d(R=>R===null||y.some(G=>!S.has(G))?void 0:R),P)),{...v,selected:y}}),experience:e})})},[r,e,s,f]);C(()=>{a||k()},[a,k]);const w=Q(_=>{!a||a.selected.length===0||f(async()=>{try{const y=await r.offer(e,a.selected,s.current),{ineligible:v}=y.guests;if(v.length>0){const S=new Set(v.map(R=>R.id)),P=R=>!S.has(R.id);c({...a,eligible:a.eligible.filter(P),ineligible:[...v,...a.ineligible],selected:a.selected.filter(P)})}y.active?(h&&(y.changed=!1),d(y)):d(S=>S??null)}catch(y){throw _||d(null),y}},{messages:{410:h?"No reservations available":""}})},[r,e,a,h,s,f]);C(()=>{h===void 0&&w()},[h,w]);const m=(a==null?void 0:a.eligible.length)===0,b=m&&(a==null?void 0:a.ineligible.length)===0;return i(U,{title:"Lightning Lane",theme:e.park.theme,buttons:i(x,{children:[i(vs,{}),!l&&i(Be,{onClick:()=>{m?k():w()},name:m?"Party":"Offer"})]}),subhead:i(di,{}),children:[i("h2",{children:e.name}),i("div",{children:e.park.name}),a&&i(mi,{value:a,children:l&&a?i(Rs,{startTime:e.flex.enrollmentStartTime,onRefresh:E}):b?i(xs,{onRefresh:k}):m?i(bs,{}):!a||h===void 0?i("div",{}):h===null?i(Es,{}):i(Is,{offer:h,onBook:g})}),p]})}function Ue({label:e,children:t}){return i("div",{className:"flex items-center flex-1 whitespace-nowrap",children:[i("span",{className:"mr-2 text-xs font-semibold uppercase text-gray-500",children:e})," ",t]})}function Os({experience:e}){const{goTo:t}=B(),{flex:n}=e;return i(Ue,{label:"LL",children:i("span",{children:i($,{onClick:()=>t(i($s,{experience:e})),children:n.nextAvailableTime?z(n.nextAvailableTime):"none"})})})}function bi({children:e}){return i("div",{className:"mt-8 flex justify-center",children:i("div",{children:[i("h2",{className:"mt-0 pl-1 text-gray-500 text-sm leading-tight uppercase",children:"Symbols"}),i("div",{className:"border-2 border-gray-500 rounded px-2 py-0.5 bg-gray-100",children:i("table",{children:i("tbody",{children:e})})})]})})}function he({sym:e,def:t,onInfo:n}){return i("tr",{children:[i("th",{className:"py-0.5 text-center font-bold",children:e}),i("td",{className:"pl-3 py-0.5",children:t}),n&&i("td",{className:"pl-3 py-0.5",children:i($,{type:"small",onClick:n,children:"Info"})})]})}const Ms="_SELECT_RADIO_BUTTON_";function xi(e){const{options:t,selected:n,title:r,onChange:o,disabled:s,...a}=e,{bg:c}=j(),[l,u]=I(!1),[h,d]=I(0),f=te(null),p=te(null);ht(()=>{var P;if((P=t.values().next().value)!=null&&P.icon)return;const _=f.current,y=_==null?void 0:_.firstChild;if(!y)return;const v=y.nodeValue;if(!v)return;let S=0;for(const R of t.values())y.nodeValue=R.text,S=Math.max(_.offsetWidth,S);y.nodeValue=v,d(S)},[t]);const g=()=>{var _;return(_=p.current)==null?void 0:_.querySelector("input:checked")};C(()=>{var v;if(!l)return;const _=g();(v=_==null?void 0:_.closest("li"))==null||v.scrollIntoView(),_==null||_.focus();const y=S=>{var P;(P=p.current)!=null&&P.contains(S.target)||u(!1)};return addEventListener("focusin",y),()=>removeEventListener("focusin",y)},[l]);const E=()=>{const _=g();if(_){const y=_.value,v=t.get(y);v&&o(v.value??y)}u(!1)},k=n?t.get(n):r!==void 0?{text:r}:void 0;if(!k)return null;const{icon:w,text:m}=k;let b=!1;return i(x,{children:[i($,{...a,title:w?`${r}: ${m}`:r,disabled:s||t.size===0,onClick:()=>u(!0),children:[w||i("span",{className:"flex-1 truncate",style:{minWidth:`${h}px`},ref:f,children:m}),i(W,{className:"w-2.5 ml-2 shrink-0",children:i("path",{d:"m6.8273 12.401-5.6333-7.7812a1.0212 1.0212 117.05 0 1 0.82716-1.62l11.958-2e-7a1.0212 1.0212 62.952 0 1 0.82714 1.62l-1.6438 2.2705a79984 79984 125.9 0 0-2.3456 3.2401l-1.6437 2.2706a1.4479 1.4479 180 0 1-2.3456 4.4e-5z"})})]}),l&&i(wt,{onChange:()=>{b||E(),b=!1},onClick:_=>{var y;b||(!((y=p.current)!=null&&y.contains(_.target))||n&&_.target.value===n)&&(u(!1),_.preventDefault())},onKeyDown:({key:_})=>{["Enter"," "].includes(_)?E():_.startsWith("Arrow")&&(b=!0)},"data-testid":"shade",children:i("div",{className:"flex flex-col min-w-[50%] max-h-[90%] rounded-lg bg-white text-black",children:[r&&i("h3",{className:`mt-0 rounded-t-lg px-5 py-1 ${c} text-white font-semibold text-center`,children:r}),i("ul",{className:"overflow-auto",ref:p,children:[...t].map(([_,y])=>i("li",{className:"border-t-2 first:border-0 border-gray-300",children:i("label",{className:"flex flex-row items-center gap-x-2.5 px-4 py-3",children:[i("input",{type:"radio",name:Ms,value:_,defaultChecked:_===n,className:"w-4 h-4 shrink-0"})," ",y.icon&&i("span",{"aria-hidden":"true",children:y.icon})," ",y.text]})},y.text))})]})})]})}function wi(e){const{parks:t}=O(),{park:n,setPark:r}=Ge(),o=ce(),s=pt(()=>new Map(t.map(a=>[a.id,{value:a,icon:a.icon,text:a.name}])),[t]);return i(xi,{...e,options:s,selected:n.id,onChange:r,disabled:!!o.current,title:"Park","data-testid":"park-select"})}function Gs({experience:{type:e,standby:t,virtualQueue:n}}){return t.nextShowTime||e==="ENTERTAINMENT"&&!t.waitTime?i(Us,{standby:t}):n?i(Hs,{virtualQueue:n}):i(Bs,{standby:t})}const Bs=({standby:e})=>i(Ue,{label:"Standby",children:e.available?i(St,{time:e.waitTime!==void 0?e.waitTime+" min":"now"}):i(Ei,{text:"down"})}),Us=({standby:e})=>i(Ue,{label:i(x,{children:["Next ",i("span",{className:"hidden xs:inline",children:"Show"})]}),children:e.nextShowTime?i(St,{time:z(e.nextShowTime)}):i(Ei,{text:"none"})}),Hs=({virtualQueue:e})=>i(Ue,{label:i("abbr",{title:"Virtual Queue",children:"VQ"}),children:i(St,{time:e.nextAvailableTime?z(e.nextAvailableTime):"closed"})}),ki="inline-block border-2 rounded px-1.5 py-0.5 font-semibold",St=({time:e})=>i("span",{className:`${ki} border-gray-500 text-gray-500 bg-gray-100`,children:e}),Ei=({text:e})=>i("span",{className:`${ki} border-red-600 text-red-600 bg-red-100`,children:e});function zs({bookTime:e,dropTime:t}){const n=j();return!e&&!t?null:i("div",{className:`flex justify-center gap-x-10 ${n.bg} text-white text-sm font-semibold uppercase text-center`,children:[i(un,{label:"Book",time:e}),i(un,{label:"Drop",time:t})]})}function un({label:e,time:t}){if(!t)return null;t=t.slice(0,5);const n=L().time.slice(0,5);return i("div",{children:[e,":"," ",i("time",{dateTime:t,className:"whitespace-nowrap",children:t>n?z(t):"now"})]})}async function Fs(e={}){return new Promise((t,n)=>{navigator.geolocation.getCurrentPosition(r=>{t(r)},r=>{n(r)},e)})}const js={maximumAge:15e3,timeout:2e3};function Ws(){const[e,t]=I(),n=Q(async()=>{try{const{coords:r}=await Fs(js);t(o=>o&&r.latitude===o[0]&&r.longitude===o[1]?o:[r.latitude,r.longitude])}catch{t(void 0)}},[]);return[e,n]}const Ys=(e,t)=>(e.priority||1/0)-(t.priority||1/0),Ye=(e,t)=>(t.standby.waitTime||-1)-(e.standby.waitTime||-1),Ve=(e,t)=>{var n,r;return Ae(((n=e==null?void 0:e.flex)==null?void 0:n.nextAvailableTime)||"00:00")-Ae(((r=t==null?void 0:t.flex)==null?void 0:r.nextAvailableTime)||"00:00")},Vs=(e,t)=>e.name.toLowerCase().localeCompare(t.name.toLowerCase()),hn=(e,t)=>Math.sqrt(Math.pow(e[0]-t[0],2)+Math.pow(e[1]-t[1],2)),Qs=(e,t,n)=>e.geo===t.geo?0:e.geo?t.geo?n?hn(e.geo,n)-hn(t.geo,n):0:-1:1,qs={priority:(e,t)=>Ys(e,t)||Ye(e,t)||Ve(e,t),standby:(e,t)=>Ye(e,t)||Ve(e,t),soonest:(e,t)=>Ve(e,t)||Ye(e,t),nearby:(e,t,n)=>Qs(e,t,n),aToZ:()=>0},Ks=new Map([["priority",{text:"Priority"}],["nearby",{text:"Nearby"}],["standby",{text:"Standby"}],["soonest",{text:"Soonest"}],["aToZ",{text:"A to Z"}]]);function Js(e,t){const{n,s:r,e:o,w:s}=e.geo,[a,c]=t;return ar&&cs}function Xs(){const{experiences:e,park:t}=Ge(),[n,r]=Ws(),[o,s]=I("priority");C(()=>{o==="nearby"&&r()},[e,o,r]);const a=Q((l,u)=>{var h,d;return Number((h=u==null?void 0:u.flex)==null?void 0:h.available)-Number((d=l==null?void 0:l.flex)==null?void 0:d.available)||qs[o==="nearby"&&!(n&&Js(t,n))?"priority":o](l,u,n)||Vs(l,u)},[n,t,o]);return{sortType:o,sorter:a,SortSelect:l=>i(xi,{...l,options:Ks,selected:o,onChange:s,title:"Sort By"})}}const Zs=30,eo=60,pn=["bg1","genie","tipBoard","starred"],st="Lightning Pick",ot="Upcoming Drop",at="Booked",mn=e=>e.experienced&&!e.starred;function to({contentRef:e}){hs();const{genie:t}=O(),{experiences:n,refreshExperiences:r,park:o,loaderElem:s}=Ge(),{sortType:a,sorter:c,SortSelect:l}=Xs(),u=te(!0);C(()=>{var d;u.current||(d=e.current)==null||d.scroll(0,0)},[a,e]),C(()=>{u.current=!1},[]);const h=ue(o.dropTimes)[0];return i(kt,{title:i(x,{children:"Availability"}),buttons:i(x,{children:[i(l,{}),i(wi,{}),i(Be,{name:"Experiences",onClick:r})]}),subhead:i(x,{children:[i(di,{}),i(zs,{bookTime:t.nextBookTime,dropTime:h})]}),contentRef:e,children:[i(no,{experiences:n,park:o,sorter:c}),s]})}const no=ft(function({experiences:t,park:n,sorter:r}){const{goTo:o}=B(),s=j(),[a,c]=I(()=>{const m=M.get(pn)??[];return new Set(Array.isArray(m)?m:[])}),l=ue(n.dropTimes)[0],u=Ae(L().time);function h({id:m}){c(b=>(b=new Set(b),b.has(m)?b.delete(m):b.add(m),M.set(pn,[...b]),b))}const d=()=>o(i(ro,{})),f=m=>o(i(so,{park:n,experience:m})),p=()=>o(i(oo,{})),g=({experiences:m,type:b})=>i("ul",{"data-testid":b,children:m.map(_=>{const[y]=ue(_.dropTimes??[]);return i("li",{className:"pb-3 first:border-0 border-t-4 border-gray-300",children:[i("div",{className:"flex items-center gap-x-2 mt-2",children:[i(io,{experience:_,toggleStar:h}),i("h3",{className:"flex-1 mt-0 text-lg font-semibold leading-tight truncate",children:_.name}),_.lp?i(Qe,{name:st,icon:rt,onClick:d}):y?i(Qe,{name:ot,icon:on,onClick:()=>f(_),className:y!==l?"opacity-50":""}):null,_.flex.preexistingPlan&&i(Qe,{name:at,icon:sn,onClick:p})]}),i("div",{className:"flex flex-wrap gap-1.5 mt-2",children:[i(Gs,{experience:_}),i(Os,{experience:_})]})]},_.id+(_.starred?"*":""))})}),E=t.filter(m=>!!m.flex).map(m=>{var v;const b=m.standby.waitTime||0,_=(v=m==null?void 0:m.flex)==null?void 0:v.nextAvailableTime,y=Math.trunc(m.priority||4);return{...m,lp:!!_&&b>=Zs&&y<3&&Ae(_)-u<=Math.min(eo,(4-y)/3*b),starred:a.has(m.id)}}).sort((m,b)=>+!m.starred-+!b.starred||+!m.lp-+!b.lp||r(m,b)),k=E.filter(m=>!mn(m)),w=E.filter(mn).sort((m,b)=>m.name.localeCompare(b.name));return i(x,{children:[i(g,{experiences:k,type:"unexperienced"}),w.length>0&&i(x,{children:[i("h2",{className:`-mx-3 px-3 py-1 text-sm uppercase text-center ${s.bg} text-white`,children:"Previously Experienced"}),i(g,{experiences:w,type:"experienced"})]}),(k.length>0||w.length>0)&&i(bi,{children:[i(he,{sym:i(rt,{className:s.text}),def:st,onInfo:d}),n.dropTimes.length>0&&i(he,{sym:i(on,{className:s.text}),def:ot,onInfo:f}),i(he,{sym:i(sn,{className:s.text}),def:at,onInfo:p})]})]})});function Qe({name:e,icon:t,onClick:n,className:r}){const o=j();return i("button",{title:`${e} (more info)`,className:`-mx-2 px-2 ${o.text} ${r}`,onClick:n,children:i(t,{})})}function io({experience:e,toggleStar:t}){const n=j();return i("button",{title:`${e.starred?"Remove from":"Add to"} Favorites`,className:"-m-2 p-2",onClick:()=>t(e),children:i(us,{className:e.starred?n.text:"text-gray-300"})})}function ro(){return i(U,{title:st,children:i("p",{children:"When an attraction with a long standby wait has a Lightning Lane return time in the near future, it's highlighted as a Lightning Pick. Book these quick before they're gone!"})})}function so({park:e,experience:t}){const n=O(),r=ue((t==null?void 0:t.dropTimes)??[])[0],o=n.parks.filter(s=>s.dropTimes.length>0).sort((s,a)=>s===e?-1:a===e?1:0);return i(U,{title:ot,children:[i("p",{children:[t?i("b",{children:t.name}):"This attraction"," may be part of"," ",r?i(x,{children:["the"," ",i("time",{dateTime:r,className:"font-semibold",children:z(r)})]}):i(x,{children:"an upcoming"})," ","drop of additional Lightning Lane inventory, with earlier return times than what's currently being offered. Availability varies but is always limited, so be sure you're ready to book when the drop time arrives!"]}),o.map(s=>{const[a]=ue(s.dropTimes);return i("div",{className:`mt-5 rounded overflow-hidden ${s.theme.bg}`,children:[i("h2",{className:`mt-0 py-1 ${s.theme.bg} text-white text-base text-center`,children:s.name}),i("div",{className:"flex flex-col px-2 pb-3 bg-white bg-opacity-90",children:n.dropExperiences(s).map((c,l)=>{var d;const u=l===1&&s.name==="Hollywood Studios",h=new Set(ue(c.dropTimes??[]));return i("div",{children:[i("h3",{className:`mt-3 text-base ${u?`${s.theme.text}font-bold`:""}`,children:c.name}),i("ul",{className:"flex flex-wrap gap-y-2 mt-1 leading-tight",children:(d=c.dropTimes)==null?void 0:d.map(f=>{const p=f===a;return i("li",{className:"min-w-[6em] text-center",children:[i("div",{className:`${p?`${s.theme.text} font-bold`:h.has(f)?"font-semibold":"text-gray-500"}`,children:i("time",{dateTime:f,children:z(f)})}),p?i("div",{className:`rounded-sm ${s.theme.bg} text-white text-opacity-90 text-xs font-semibold text-center uppercase`,children:"next"}):null]},f)})})]},c.id)})})]},s.id)})]})}function oo(){return i(U,{title:at,children:i("p",{children:"You currently have a Lightning Lane reservation for this attraction."})})}/** + */function us(e){return i(W,{...e,children:i("path",{d:"M16 6.204l-5.528-0.803-2.472-5.009-2.472 5.009-5.528 0.803 4 3.899-0.944 5.505 4.944-2.599 4.944 2.599-0.944-5.505 4-3.899z"})})}function ne({date:e,time:t,type:n,...r}){return i("time",{...r,dateTime:e||t,children:e?sr(e,n):t?z(t):""})}function ci({start:e,end:t}){const n=H(e),r=H(t);return t?i(x,{children:[e.time?i(ne,{time:e.time}):i("span",{children:"Park Open"})," \u2013"," ",r>n?i(ne,{date:r,type:"short"}):t.time?i(ne,{time:t.time}):i("span",{children:"Park Close"})]}):i(ne,{time:e.time})}const an=i("span",{"aria-hidden":!0,children:"\u2022"});function li({booking:e,button:t}){const n=j();return i("div",{className:"flex items-center gap-x-3",children:[i("div",{className:"flex-1 min-w-0",children:[i("div",{className:"flex items-center gap-x-2 text-gray-500 text-sm font-semibold uppercase whitespace-nowrap",children:[e.type==="DAS"&&i(x,{children:[i("span",{children:"DAS"}),an]}),e.type==="BG"?i(x,{children:[i("span",{children:["BG ",e.boardingGroup]}),e.status==="SUMMONED"&&i(x,{children:[an,i("span",{className:`${n.text} font-bold`,children:"Board Now"})]})]}):i(ci,{...e})]}),i("div",{className:"text-lg font-semibold leading-snug truncate",children:e.choices?"Multiple Experiences":e.name})]}),t&&i("div",{children:t})]})}function di(){const e=ce(),t=j();return e.current?i("div",{className:`${t.bg}`,children:i("div",{className:"-mx-3 pb-3 bg-white text-black",children:[i("div",{className:`pb-1 ${t.bg} text-white text-sm font-semibold uppercase text-center`,children:"Modifying Reservation"}),i("div",{className:"mt-2 px-3",children:i(li,{booking:e.current,button:i($,{type:"small",back:{screen:pe},onClick:e.end,children:"Keep"})})})]})}):null}function F({guests:e,selectable:t,conflicts:n}){return e.length===0?null:i("ul",{className:"mt-2",children:e.map(r=>{var o;return i("li",{className:"px-3 py-1",children:i("label",{className:"flex items-center",children:[t&&i("input",{type:"checkbox",checked:t.isSelected(r),onChange:()=>t.onToggle(r),className:"mr-3"}),i("span",{className:"w-[48px] h-[48px] leading-[48px] mr-3 rounded-full text-3xl font-bold text-center bg-gray-400 text-white",children:r.avatarImageUrl?i("img",{src:r.avatarImageUrl,alt:"",width:"48",height:"48",className:"rounded-full"}):i("span",{"aria-hidden":"true",children:r.name[0]})}),i("span",{className:"leading-tight",children:[r.name,(n==null?void 0:n[r.id])&&i("span",{className:"block text-xs font-semibold text-red-700 uppercase",children:(o=n[r.id])==null?void 0:o.replace(/_/g," ")})]})]})},r.id)})})}const ui=["bg1","genie","partyIds"];function hi(){const e=M.get(ui)??[];return Array.isArray(e)?e:[]}function hs(){const{genie:e}=O();C(()=>e.setPartyIds(hi()),[e])}function ps(){const{genie:e}=O(),{loadData:t,loaderElem:n}=J(),[r,o]=N(!0),[s,a]=N(),[c,l]=N(()=>{const p=new Set(hi());return o(p.size===0),p});function u(){const p=[...c];M.set(ui,p),e.setPartyIds(p)}C(()=>{t(async()=>{const p=await e.guests();a([...p.eligible,...p.ineligible].sort((g,E)=>+!g.primary-+!E.primary||g.name.localeCompare(E.name)))})},[e,t]),C(()=>{r&&l(new Set)},[r]);const h=s==null?void 0:s.filter(p=>c.has(p.id)),d=s==null?void 0:s.filter(p=>!c.has(p.id)),f=p=>i("li",{children:i("label",{className:"flex items-center mt-2",children:[i("input",{type:"radio",name:"auto",onChange:()=>o(p.auto),checked:r===p.auto,className:"mr-2"})," ",p.children]})});return i(U,{title:"Party Selection",children:[i("p",{children:"By default, all eligible guests (up to a maximum of 12) are automatically selected when you book a Lightning Lane. If you would like to limit who you book for, you can manually select your party here."}),i("ul",{children:[i(f,{auto:!0,children:"Book for all eligible guests"}),i(f,{auto:!1,children:"Only book for selected guests"})]}),r?null:(s==null?void 0:s.length)===0?i("p",{className:"text-red-700",children:"No guests to select"}):h&&d?i(x,{children:[h.length>0&&i(x,{children:[i("h3",{children:"Your Party"}),i(F,{guests:h,selectable:{isSelected:()=>!0,onToggle:p=>{const g=new Set(c);g.delete(p.id),l(g)}}})]}),d.length>0&&i(x,{children:[i("h3",{children:"Add to Your Party"}),i(F,{guests:d,selectable:{isSelected:()=>!1,onToggle:p=>{const g=new Set(c);g.add(p.id),l(g)}}})]})]}):null,n,i(Y,{back:!0,disabled:!r&&c.size===0,onClick:u,children:"Save"})]})}function Be({name:e,onClick:t,...n}){return i($,{...n,title:`Refresh ${e}`,onClick:t,children:i(xt,{})})}const pi=q({eligible:[],ineligible:[],selected:[],setSelected:()=>null,experience:{name:"",park:{name:"",theme:{bg:"",text:""}}}}),mi=pi.Provider,fi=()=>K(pi),ms="https://bg1.joelface.com/ping";async function Et(e,t){const{date:n}=L(),r=["bg1","ping",e.id,t];if(M.get(r)===n)return;const{ok:s}=await fetch(ms,{method:"POST",body:new URLSearchParams({resort:e.id,service:t})});s&&M.set(r,n)}function fs(e){return i(W,{...e,children:i("path",{d:"M 5.5253906 0.9296875 L 3.4042969 3.0507812 L 8.3535156 8 L 3.4042969 12.949219 L 5.5253906 15.070312 L 10.474609 10.121094 L 12.595703 8 L 10.474609 5.8789062 L 5.5253906 0.9296875 z"})})}function _i(e){return i("div",{className:`mt-4 border-2 rounded border-green-600 p-1 font-semibold text-center text-green-600 bg-green-100 ${e.className}`,children:e.children})}function _s({bg:e,experiences:t,heading:n}){return i("div",{className:`mt-4 rounded ${e}`,children:[i("h3",{className:"mt-0 p-1 text-white text-center",children:n}),i("ul",{className:"list-disc py-2 pl-8 bg-white bg-opacity-90",children:t.map(r=>i("li",{children:r.name},r.id))})]})}function Nt({start:e,end:t}){return i("div",{className:"mt-4 text-lg",children:[t?"Arrive by":"Reservation at",":"," ",i("span",{className:"pl-1 font-semibold",children:i(ci,{start:e,end:t})})]})}function gs({booking:e,onCancel:t,dasGuest:n}){const{genie:r,das:o}=O(),s=e.type==="DAS"?o:r,{refreshPlans:a}=me(),[c,l]=N(new Set),{loadData:u,loaderElem:h}=J(),{name:d,park:f,guests:p}=e,g=c.size===0,E=c.size===p.length;async function k(){g||(await u(async()=>{await s.cancelBooking([...c]),a()}),t(p.filter(w=>!c.has(w))))}return i(U,{title:"Cancel Guests",theme:f.theme,children:[i("h2",{children:d}),i("div",{children:f.name}),i(Nt,{...e}),i("div",{className:"ml-3",children:i("label",{className:"flex items-center py-4",children:[i("input",{type:"checkbox",checked:E,onChange:()=>l(new Set(E?[]:p))}),i("span",{className:"ml-3",children:"Select All"})]})}),!g&&i("div",{className:"mb-4",children:[i("h3",{children:"Cancel These Guests"}),i(F,{guests:p.filter(w=>c.has(w)),selectable:{isSelected:()=>!0,onToggle:w=>{if(n&&w!==n&&c.has(n))l(new Set);else{const m=new Set(c);m.delete(w),l(m)}}}})]}),!E&&i("div",{children:[i("h3",{children:"Select Guests to Cancel"}),i(F,{guests:p.filter(w=>!c.has(w)),selectable:{isSelected:()=>!1,onToggle:w=>{l(new Set(w===n?p:c).add(w))}}})]}),i(Y,{back:!0,disabled:g,onClick:k,children:"Cancel "+(E?"Reservation":"Guests")}),h]})}function ve({booking:e,isNew:t}){var y;const{goTo:n,goBack:r}=B(),{setPark:o}=Me(),s=O(),a=Xn(),{name:c,park:l,choices:u,type:h,subtype:d,start:f}=e,p=h==="DAS"&&d==="IN_PARK"?e.guests.find(v=>a.find(S=>S[0].id===v.id)):void 0,g=ce(),[E,k]=N(e.cancellable&&(h!=="DAS"||p)?e.guests:void 0),w=new Map([[l,[]],...s.parks.map(v=>[v,[]])]);for(const v of u||[])(y=w.get(v.park))==null||y.push(v);const m=[...w].filter(([,v])=>v.length>0).map(([v])=>v),b=(u?m.length===1?m[0]:{}:l).theme??vt;return i(U,{title:"Your "+{LL:"Lightning Lane",DAS:"DAS Selection",BG:"Boarding Group",APR:"Park Pass",RES:"Reservation"}[h],theme:b,buttons:e.modifiable&&i($,{onClick:()=>{g.begin(e),o(e.park),r({screen:pe,props:{tabName:"LL"}})},children:"Modify"}),children:[i("div",{className:`-mx-3 px-2 py-1 text-center ${b.bg} text-white text-sm font-semibold uppercase`,children:i(ne,{date:H(f)})}),u?i("h2",{children:"Multiple Experiences"}):i(x,{children:[i("h2",{children:c}),l.name&&i("div",{children:l.name})]}),h==="BG"?i(x,{children:[e.status==="SUMMONED"&&i(_i,{children:"Your boarding group has been called"}),i("h3",{children:["Boarding Group:"," ",i("span",{className:"ml-1 font-semibold",children:e.boardingGroup})]}),i("p",{children:"Check the official Disney app for return time and other virtual queue information."})]}):i(Nt,{...e}),u&&i(x,{children:[i("p",{children:[c&&i(x,{children:[i("b",{children:c})," was temporarily unavailable during your return time."]}),"You may redeem this Lightning Lane at one of these replacement experiences:"]}),[...w].filter(([,v])=>v.length>0).map(([v,S])=>i(_s,{heading:v.name,experiences:S,bg:v.theme.bg},v.id))]}),i("div",{className:"flex mt-4",children:[i("h3",{className:"inline mt-0",children:"Your Party"}),e.cancellable&&E&&i($,{type:"small",onClick:()=>{n(i(gs,{booking:{...e,guests:E},dasGuest:p,onCancel:v=>{v.length>0?k(v):r()}}))},className:"ml-3",children:"Cancel"})]}),i(F,{guests:E||e.guests,conflicts:Object.fromEntries(e.type==="LL"?e.guests.filter(v=>(v.redemptions??1)!==1).map(v=>[v.id,`Redemptions left: ${v.redemptions}`]):[])}),t&&i(Y,{onClick:()=>r({screen:pe,props:{tabName:"Plans"}}),children:"Show Plans"})]})}function gi({...e}){const{plans:t,refreshPlans:n,loaderElem:r}=me();return i(kt,{title:"Your Plans",buttons:i(Be,{name:"Plans",onClick:n}),theme:vt,...e,children:[i(ys,{plans:t}),r]})}const ys=ft(function({plans:t}){var l,u;const{goTo:n}=B(),r=j();function o(h){n(i(ve,{booking:h}))}const s=new Map,a=new Map;for(const h of t){const d=H(h.start);s.has(d)||s.set(d,[]),h.type!=="APR"&&((l=s.get(d))==null||l.push(h)),a.has(d)||a.set(d,new Set),(h.type!=="LL"||h.subtype!=="MEP")&&h.park.icon&&((u=a.get(d))==null||u.add(h.park))}const c=i("p",{className:"font-semibold text-center uppercase text-gray-500",children:"No existing plans"});return i("ul",{children:t.length>0?[...s].map(([h,d])=>i("li",{children:[i("div",{className:"sticky top-0 -mx-3 pt-1 bg-white",children:i("div",{className:"flex items-center",children:[i("h2",{className:`flex-1 mt-0 rounded-r-full px-3 py-1 ${r.bg} text-white text-sm uppercase`,children:i(ne,{date:h})}),i("ul",{className:"px-3 pl-2 text-lg text-right",children:[...a.get(h)??[]].map(f=>i("li",{className:"inline ml-1 first:ml-0","aria-label":f.name,children:f.icon},f.id))})]})}),d.length>0?i("ul",{className:d.length===0?"mt-3":"",children:d.map(f=>i("li",{className:"py-2.5 first:border-0 border-t-4 border-gray-300",onClick:()=>o(f),children:i(li,{booking:f,button:i("button",{className:r.text,title:"More Info",children:i(fs,{})})})},f.bookingId))}):c]},h)):c})});function vs({...e}){const{goTo:t}=B();return i(x,{children:i($,{...e,onClick:()=>t(i(gi,{})),title:"Plans",children:i(ai,{})})})}function It(){const{ineligible:e}=fi();return i(F,{guests:e,conflicts:Object.fromEntries(e.map(t=>[t.id,t.eligibleAfter?`TOO EARLY (${z(t.eligibleAfter)})`:t.ineligibleReason||"ELIGIBLE FOR NEW BOOKING"]))})}function bs(){const{genie:e}=O(),t=ce();return i(x,{children:[t.current?i(x,{children:[i("h3",{children:"Unable to Modify"}),i("p",{children:"Your current reservation cannot be modified to this experience due to the following conflicts:"})]}):i(x,{children:[e.nextBookTime&&e.nextBookTime.slice(0,5)>L().time.slice(0,5)&&i(_i,{children:["Eligible at ",i(ne,{time:e.nextBookTime})]}),i("h3",{children:"No Eligible Guests"}),i("p",{children:"No one in your party is currently eligible for this Lightning Lane."})]}),i(It,{})]})}function xs({onRefresh:e}){return i(x,{children:[i("h3",{children:"No Guests Found"}),i("p",{children:"Your party could not be loaded. This is probably just a temporary network error. Wait a few seconds and try again."}),i(Y,{onClick:e,children:"Try Again"})]})}function ws(e){return i("div",{className:`mt-4 border-2 rounded border-red-600 p-1 font-semibold text-center text-red-600 bg-red-100 ${e.className}`,children:e.children})}function ks({party:e}){const{eligible:t,ineligible:n,selected:r,setSelected:o,experience:s}=e,[a,c]=N(new Set(r)),[l,u]=ei(),{maxPartySize:h}=O().genie;function d(f){c(p=>{u(""),p=new Set(p);const g=p.has(f)?"delete":"add";return g==="add"&&p.size>=h?u(`Maximum party size: ${h}`):p[g](f),p})}return i(mi,{value:e,children:i(U,{title:"Modify Party",theme:s.park.theme,children:[i("h2",{children:s.name}),i("div",{children:s.park.name}),i("h3",{children:"Your Party"}),i(F,{guests:t,selectable:{isSelected:f=>a.has(f),onToggle:d}}),n.length>0&&i(x,{children:[i("h3",{children:"Ineligible Guests"}),i(It,{})]}),i(Y,{back:!0,disabled:a.size===0,onClick:()=>{o(t.filter(f=>a.has(f)))},children:"Confirm Party"}),l]})})}function Tt({button:e}){const{goTo:t}=B(),n=fi(),{eligible:r,selected:o}=n,{maxPartySize:s}=O().genie;return i(x,{children:[r.length>s&&o.length===s&&i(ws,{children:"Party size restricted"}),o.length>0?i(x,{children:[i("div",{className:"mt-4",children:[i("h3",{className:"inline mt-0",children:"Your Party"}),i($,{type:"small",onClick:()=>t(i(ks,{party:n})),className:"ml-3",children:"Modify"})]}),i(F,{guests:o})]}):i(x,{children:[i("h3",{children:"Ineligible Guests"}),i(It,{})]}),e]})}function Es(){return i(x,{children:[i("h3",{children:"No Reservations Available"}),i("p",{children:"There aren't enough reservation slots available for your entire party. If only part of your group wishes to go on this attraction, edit your party to check again. Otherwise, go back to the attraction list and select another attraction."}),i(Tt,{})]})}function Ns({offer:e,onBook:t}){const n=ce();return i(x,{children:[i(Nt,{...e}),e.changed&&i("div",{className:"text-sm",children:[i("strong",{children:"Note:"})," Return time has been changed"]}),i(Tt,{button:i(Y,{onClick:t,children:`${n.current?"Modify":"Book"} Lightning Lane`})})]})}const Is=500,cn=100,Ts=5,Ss=5*6e4;let yi=0,Te=0;const ln=()=>Date.now()+yi;class Ps extends Error{constructor(){super(...arguments);T(this,"name","SyncFailed")}}async function Cs(){if(Date.now()-Teo-s);for(const[o,s]of n.slice(0,-1).entries()){const a=n[o+1],c=Math.abs(s-a);cIs)return NaN;const o=parseFloat(String(t==null?void 0:t.get("T")))*1e3;return Math.round(o-(e+n)/2)}const As=50;function Ls({onSync:e}){const[t,n]=N(ln());return C(()=>{const r=setInterval(()=>n(ln()),As);return()=>clearInterval(r)},[]),C(()=>{Cs().then(()=>e(!0)).catch(()=>e(!1))},[e]),i("time",{children:L(t).time})}function vi({time:e,label:t}){const[n,r]=N(!0);return i("table",{className:"mt-4 mx-auto text-gray-500",children:i("tbody",{children:[i(dn,{heading:t,time:i("time",{children:e||"--:--:--"})}),i(dn,{heading:"Current time",time:i(x,{children:[i(Ls,{onSync:r}),!n&&i("span",{className:"text-sm font-sans font-semibold text-red-600",children:[" ","(unsynced)"]})]})})]})})}function dn({heading:e,time:t}){return i("tr",{children:[i("th",{scope:"row",className:"pr-3 text-right text-xs font-semibold uppercase",children:[e,":"]}),i("td",{className:"text-xl font-mono leading-tight",children:["\uFEFF",t]})]})}function Rs({startTime:e,onRefresh:t}){return i(x,{children:[e?i(x,{children:[i(vi,{time:e,label:"Booking start"}),i("p",{children:["At"," ",i("time",{dateTime:e,className:"font-semibold",children:z(e)}),", tap the ",i("span",{className:"font-semibold",children:"Check Availability"})," ","button below to start booking this Lightning Lane."]})]}):i("p",{children:"Sorry, but you can't make a Lightning Lane reservation for this attraction yet."}),i(Tt,{button:i(Y,{onClick:t,children:"Check Availability"})})]})}function $s({experience:e}){const{goTo:t}=B(),n=O(),{genie:r}=n,{refreshPlans:o}=me(),s=ce(),[a,c]=N(),[l,u]=N(!e.flex.available&&e.flex.enrollmentStartTime!==void 0),[h,d]=N(l?null:void 0),{loadData:f,loaderElem:p}=J();async function g(){!h||!a||f(async()=>{let _=null;_=await r.book(h,s.current,a.selected),s.end();const y=new Set(a.selected.map(S=>S.id)),v=_.guests.filter(S=>!y.has(S.id));v.length>0&&(await r.cancelBooking(v),_.guests=_.guests.filter(S=>y.has(S.id))),_&&t(i(ve,{booking:_,isNew:!0}),{replace:!0}),o(),Et(n,"G")},{messages:{410:"Offer expired"}})}function E(){f(async _=>{var S;const v=(await r.experiences(e.park)).find(P=>P.id===e.id);(S=v==null?void 0:v.flex)!=null&&S.available?(u(!1),d(void 0)):_("Reservations not open yet")})}const k=Q(()=>{f(async()=>{const _=s.current?{eligible:s.current.guests,ineligible:[]}:await r.guests(e);c({..._,selected:_.eligible.slice(0,r.maxPartySize),setSelected:y=>c(v=>{if(!v)return v;const S=new Set(v.selected);return u(P=>(P||d(R=>R===null||y.some(G=>!S.has(G))?void 0:R),P)),{...v,selected:y}}),experience:e})})},[r,e,s,f]);C(()=>{a||k()},[a,k]);const w=Q(_=>{!a||a.selected.length===0||f(async()=>{try{const y=await r.offer(e,a.selected,s.current),{ineligible:v}=y.guests;if(v.length>0){const S=new Set(v.map(R=>R.id)),P=R=>!S.has(R.id);c({...a,eligible:a.eligible.filter(P),ineligible:[...v,...a.ineligible],selected:a.selected.filter(P)})}y.active?(h&&(y.changed=!1),d(y)):d(S=>S??null)}catch(y){throw _||d(null),y}},{messages:{410:h?"No reservations available":""}})},[r,e,a,h,s,f]);C(()=>{h===void 0&&w()},[h,w]);const m=(a==null?void 0:a.eligible.length)===0,b=m&&(a==null?void 0:a.ineligible.length)===0;return i(U,{title:"Lightning Lane",theme:e.park.theme,buttons:i(x,{children:[i(vs,{}),!l&&i(Be,{onClick:()=>{m?k():w()},name:m?"Party":"Offer"})]}),subhead:i(di,{}),children:[i("h2",{children:e.name}),i("div",{children:e.park.name}),a&&i(mi,{value:a,children:l&&a?i(Rs,{startTime:e.flex.enrollmentStartTime,onRefresh:E}):b?i(xs,{onRefresh:k}):m?i(bs,{}):!a||h===void 0?i("div",{}):h===null?i(Es,{}):i(Ns,{offer:h,onBook:g})}),p]})}function Ue({label:e,children:t}){return i("div",{className:"flex items-center flex-1 whitespace-nowrap",children:[i("span",{className:"mr-2 text-xs font-semibold uppercase text-gray-500",children:e})," ",t]})}function Os({experience:e}){const{goTo:t}=B(),{flex:n}=e;return i(Ue,{label:"LL",children:i("span",{children:i($,{onClick:()=>t(i($s,{experience:e})),children:n.nextAvailableTime?z(n.nextAvailableTime):"none"})})})}function bi({children:e}){return i("div",{className:"mt-8 flex justify-center",children:i("div",{children:[i("h2",{className:"mt-0 pl-1 text-gray-500 text-sm leading-tight uppercase",children:"Symbols"}),i("div",{className:"border-2 border-gray-500 rounded px-2 py-0.5 bg-gray-100",children:i("table",{children:i("tbody",{children:e})})})]})})}function he({sym:e,def:t,onInfo:n}){return i("tr",{children:[i("th",{className:"py-0.5 text-center font-bold",children:e}),i("td",{className:"pl-3 py-0.5",children:t}),n&&i("td",{className:"pl-3 py-0.5",children:i($,{type:"small",onClick:n,children:"Info"})})]})}const Ms="_SELECT_RADIO_BUTTON_";function xi(e){const{options:t,selected:n,title:r,onChange:o,disabled:s,...a}=e,{bg:c}=j(),[l,u]=N(!1),[h,d]=N(0),f=te(null),p=te(null);ht(()=>{var P;if((P=t.values().next().value)!=null&&P.icon)return;const _=f.current,y=_==null?void 0:_.firstChild;if(!y)return;const v=y.nodeValue;if(!v)return;let S=0;for(const R of t.values())y.nodeValue=R.text,S=Math.max(_.offsetWidth,S);y.nodeValue=v,d(S)},[t]);const g=()=>{var _;return(_=p.current)==null?void 0:_.querySelector("input:checked")};C(()=>{var v;if(!l)return;const _=g();(v=_==null?void 0:_.closest("li"))==null||v.scrollIntoView(),_==null||_.focus();const y=S=>{var P;(P=p.current)!=null&&P.contains(S.target)||u(!1)};return addEventListener("focusin",y),()=>removeEventListener("focusin",y)},[l]);const E=()=>{const _=g();if(_){const y=_.value,v=t.get(y);v&&o(v.value??y)}u(!1)},k=n?t.get(n):r!==void 0?{text:r}:void 0;if(!k)return null;const{icon:w,text:m}=k;let b=!1;return i(x,{children:[i($,{...a,title:w?`${r}: ${m}`:r,disabled:s||t.size===0,onClick:()=>u(!0),children:[w||i("span",{className:"flex-1 truncate",style:{minWidth:`${h}px`},ref:f,children:m}),i(W,{className:"w-2.5 ml-2 shrink-0",children:i("path",{d:"m6.8273 12.401-5.6333-7.7812a1.0212 1.0212 117.05 0 1 0.82716-1.62l11.958-2e-7a1.0212 1.0212 62.952 0 1 0.82714 1.62l-1.6438 2.2705a79984 79984 125.9 0 0-2.3456 3.2401l-1.6437 2.2706a1.4479 1.4479 180 0 1-2.3456 4.4e-5z"})})]}),l&&i(wt,{onChange:()=>{b||E(),b=!1},onClick:_=>{var y;b||(!((y=p.current)!=null&&y.contains(_.target))||n&&_.target.value===n)&&(u(!1),_.preventDefault())},onKeyDown:({key:_})=>{["Enter"," "].includes(_)?E():_.startsWith("Arrow")&&(b=!0)},"data-testid":"shade",children:i("div",{className:"flex flex-col min-w-[50%] max-h-[90%] rounded-lg bg-white text-black",children:[r&&i("h3",{className:`mt-0 rounded-t-lg px-5 py-1 ${c} text-white font-semibold text-center`,children:r}),i("ul",{className:"overflow-auto",ref:p,children:[...t].map(([_,y])=>i("li",{className:"border-t-2 first:border-0 border-gray-300",children:i("label",{className:"flex flex-row items-center gap-x-2.5 px-4 py-3",children:[i("input",{type:"radio",name:Ms,value:_,defaultChecked:_===n,className:"w-4 h-4 shrink-0"})," ",y.icon&&i("span",{"aria-hidden":"true",children:y.icon})," ",y.text]})},y.text))})]})})]})}function wi(e){const{parks:t}=O(),{park:n,setPark:r}=Ge(),o=ce(),s=pt(()=>new Map(t.map(a=>[a.id,{value:a,icon:a.icon,text:a.name}])),[t]);return i(xi,{...e,options:s,selected:n.id,onChange:r,disabled:!!o.current,title:"Park","data-testid":"park-select"})}function Gs({experience:{type:e,standby:t,virtualQueue:n}}){return t.nextShowTime||e==="ENTERTAINMENT"&&!t.waitTime?i(Us,{standby:t}):n?i(Hs,{virtualQueue:n}):i(Bs,{standby:t})}const Bs=({standby:e})=>i(Ue,{label:"Standby",children:e.available?i(St,{time:e.waitTime!==void 0?e.waitTime+" min":"now"}):i(Ei,{text:"down"})}),Us=({standby:e})=>i(Ue,{label:i(x,{children:["Next ",i("span",{className:"hidden xs:inline",children:"Show"})]}),children:e.nextShowTime?i(St,{time:z(e.nextShowTime)}):i(Ei,{text:"none"})}),Hs=({virtualQueue:e})=>i(Ue,{label:i("abbr",{title:"Virtual Queue",children:"VQ"}),children:i(St,{time:e.nextAvailableTime?z(e.nextAvailableTime):"closed"})}),ki="inline-block border-2 rounded px-1.5 py-0.5 font-semibold",St=({time:e})=>i("span",{className:`${ki} border-gray-500 text-gray-500 bg-gray-100`,children:e}),Ei=({text:e})=>i("span",{className:`${ki} border-red-600 text-red-600 bg-red-100`,children:e});function zs({bookTime:e,dropTime:t}){const n=j();return!e&&!t?null:i("div",{className:`flex justify-center gap-x-10 ${n.bg} text-white text-sm font-semibold uppercase text-center`,children:[i(un,{label:"Book",time:e}),i(un,{label:"Drop",time:t})]})}function un({label:e,time:t}){if(!t)return null;t=t.slice(0,5);const n=L().time.slice(0,5);return i("div",{children:[e,":"," ",i("time",{dateTime:t,className:"whitespace-nowrap",children:t>n?z(t):"now"})]})}async function Fs(e={}){return new Promise((t,n)=>{navigator.geolocation.getCurrentPosition(r=>{t(r)},r=>{n(r)},e)})}const js={maximumAge:15e3,timeout:2e3};function Ws(){const[e,t]=N(),n=Q(async()=>{try{const{coords:r}=await Fs(js);t(o=>o&&r.latitude===o[0]&&r.longitude===o[1]?o:[r.latitude,r.longitude])}catch{t(void 0)}},[]);return[e,n]}const Ys=(e,t)=>(e.priority||1/0)-(t.priority||1/0),Ye=(e,t)=>(t.standby.waitTime||-1)-(e.standby.waitTime||-1),Ve=(e,t)=>{var n,r;return Ae(((n=e==null?void 0:e.flex)==null?void 0:n.nextAvailableTime)||"00:00")-Ae(((r=t==null?void 0:t.flex)==null?void 0:r.nextAvailableTime)||"00:00")},Vs=(e,t)=>e.name.toLowerCase().localeCompare(t.name.toLowerCase()),hn=(e,t)=>Math.sqrt(Math.pow(e[0]-t[0],2)+Math.pow(e[1]-t[1],2)),Qs=(e,t,n)=>e.geo===t.geo?0:e.geo?t.geo?n?hn(e.geo,n)-hn(t.geo,n):0:-1:1,qs={priority:(e,t)=>Ys(e,t)||Ye(e,t)||Ve(e,t),standby:(e,t)=>Ye(e,t)||Ve(e,t),soonest:(e,t)=>Ve(e,t)||Ye(e,t),nearby:(e,t,n)=>Qs(e,t,n),aToZ:()=>0},Ks=new Map([["priority",{text:"Priority"}],["nearby",{text:"Nearby"}],["standby",{text:"Standby"}],["soonest",{text:"Soonest"}],["aToZ",{text:"A to Z"}]]);function Js(e,t){const{n,s:r,e:o,w:s}=e.geo,[a,c]=t;return ar&&cs}function Xs(){const{experiences:e,park:t}=Ge(),[n,r]=Ws(),[o,s]=N("priority");C(()=>{o==="nearby"&&r()},[e,o,r]);const a=Q((l,u)=>{var h,d;return Number((h=u==null?void 0:u.flex)==null?void 0:h.available)-Number((d=l==null?void 0:l.flex)==null?void 0:d.available)||qs[o==="nearby"&&!(n&&Js(t,n))?"priority":o](l,u,n)||Vs(l,u)},[n,t,o]);return{sortType:o,sorter:a,SortSelect:l=>i(xi,{...l,options:Ks,selected:o,onChange:s,title:"Sort By"})}}const Zs=30,eo=60,pn=["bg1","genie","tipBoard","starred"],st="Lightning Pick",ot="Upcoming Drop",at="Booked",mn=e=>e.experienced&&!e.starred;function to({contentRef:e}){hs();const{genie:t}=O(),{experiences:n,refreshExperiences:r,park:o,loaderElem:s}=Ge(),{sortType:a,sorter:c,SortSelect:l}=Xs(),u=te(!0);C(()=>{var d;u.current||(d=e.current)==null||d.scroll(0,0)},[a,e]),C(()=>{u.current=!1},[]);const h=ue(o.dropTimes)[0];return i(kt,{title:i(x,{children:"Availability"}),buttons:i(x,{children:[i(l,{}),i(wi,{}),i(Be,{name:"Experiences",onClick:r})]}),subhead:i(x,{children:[i(di,{}),i(zs,{bookTime:t.nextBookTime,dropTime:h})]}),contentRef:e,children:[i(no,{experiences:n,park:o,sorter:c}),s]})}const no=ft(function({experiences:t,park:n,sorter:r}){const{goTo:o}=B(),s=j(),[a,c]=N(()=>{const m=M.get(pn)??[];return new Set(Array.isArray(m)?m:[])}),l=ue(n.dropTimes)[0],u=Ae(L().time);function h({id:m}){c(b=>(b=new Set(b),b.has(m)?b.delete(m):b.add(m),M.set(pn,[...b]),b))}const d=()=>o(i(ro,{})),f=m=>o(i(so,{park:n,experience:m})),p=()=>o(i(oo,{})),g=({experiences:m,type:b})=>i("ul",{"data-testid":b,children:m.map(_=>{const[y]=ue(_.dropTimes??[]);return i("li",{className:"pb-3 first:border-0 border-t-4 border-gray-300",children:[i("div",{className:"flex items-center gap-x-2 mt-2",children:[i(io,{experience:_,toggleStar:h}),i("h3",{className:"flex-1 mt-0 text-lg font-semibold leading-tight truncate",children:_.name}),_.lp?i(Qe,{name:st,icon:rt,onClick:d}):y?i(Qe,{name:ot,icon:on,onClick:()=>f(_),className:y!==l?"opacity-50":""}):null,_.flex.preexistingPlan&&i(Qe,{name:at,icon:sn,onClick:p})]}),i("div",{className:"flex flex-wrap gap-1.5 mt-2",children:[i(Gs,{experience:_}),i(Os,{experience:_})]})]},_.id+(_.starred?"*":""))})}),E=t.filter(m=>!!m.flex).map(m=>{var v;const b=m.standby.waitTime||0,_=(v=m==null?void 0:m.flex)==null?void 0:v.nextAvailableTime,y=Math.trunc(m.priority||4);return{...m,lp:!!_&&b>=Zs&&y<3&&Ae(_)-u<=Math.min(eo,(4-y)/3*b),starred:a.has(m.id)}}).sort((m,b)=>+!m.starred-+!b.starred||+!m.lp-+!b.lp||r(m,b)),k=E.filter(m=>!mn(m)),w=E.filter(mn).sort((m,b)=>m.name.localeCompare(b.name));return i(x,{children:[i(g,{experiences:k,type:"unexperienced"}),w.length>0&&i(x,{children:[i("h2",{className:`-mx-3 px-3 py-1 text-sm uppercase text-center ${s.bg} text-white`,children:"Previously Experienced"}),i(g,{experiences:w,type:"experienced"})]}),(k.length>0||w.length>0)&&i(bi,{children:[i(he,{sym:i(rt,{className:s.text}),def:st,onInfo:d}),n.dropTimes.length>0&&i(he,{sym:i(on,{className:s.text}),def:ot,onInfo:f}),i(he,{sym:i(sn,{className:s.text}),def:at,onInfo:p})]})]})});function Qe({name:e,icon:t,onClick:n,className:r}){const o=j();return i("button",{title:`${e} (more info)`,className:`-mx-2 px-2 ${o.text} ${r}`,onClick:n,children:i(t,{})})}function io({experience:e,toggleStar:t}){const n=j();return i("button",{title:`${e.starred?"Remove from":"Add to"} Favorites`,className:"-m-2 p-2",onClick:()=>t(e),children:i(us,{className:e.starred?n.text:"text-gray-300"})})}function ro(){return i(U,{title:st,children:i("p",{children:"When an attraction with a long standby wait has a Lightning Lane return time in the near future, it's highlighted as a Lightning Pick. Book these quick before they're gone!"})})}function so({park:e,experience:t}){const n=O(),r=ue((t==null?void 0:t.dropTimes)??[])[0],o=n.parks.filter(s=>s.dropTimes.length>0).sort((s,a)=>s===e?-1:a===e?1:0);return i(U,{title:ot,children:[i("p",{children:[t?i("b",{children:t.name}):"This attraction"," may be part of"," ",r?i(x,{children:["the"," ",i("time",{dateTime:r,className:"font-semibold",children:z(r)})]}):i(x,{children:"an upcoming"})," ","drop of additional Lightning Lane inventory, with earlier return times than what's currently being offered. Availability varies but is always limited, so be sure you're ready to book when the drop time arrives!"]}),o.map(s=>{const[a]=ue(s.dropTimes);return i("div",{className:`mt-5 rounded overflow-hidden ${s.theme.bg}`,children:[i("h2",{className:`mt-0 py-1 ${s.theme.bg} text-white text-base text-center`,children:s.name}),i("div",{className:"flex flex-col px-2 pb-3 bg-white bg-opacity-90",children:n.dropExperiences(s).map((c,l)=>{var d;const u=l===1&&s.name==="Hollywood Studios",h=new Set(ue(c.dropTimes??[]));return i("div",{children:[i("h3",{className:`mt-3 text-base ${u?`${s.theme.text}font-bold`:""}`,children:c.name}),i("ul",{className:"flex flex-wrap gap-y-2 mt-1 leading-tight",children:(d=c.dropTimes)==null?void 0:d.map(f=>{const p=f===a;return i("li",{className:"min-w-[6em] text-center",children:[i("div",{className:`${p?`${s.theme.text} font-bold`:h.has(f)?"font-semibold":"text-gray-500"}`,children:i("time",{dateTime:f,children:z(f)})}),p?i("div",{className:`rounded-sm ${s.theme.bg} text-white text-opacity-90 text-xs font-semibold text-center uppercase`,children:"next"}):null]},f)})})]},c.id)})})]},s.id)})]})}function oo(){return i(U,{title:at,children:i("p",{children:"You currently have a Lightning Lane reservation for this attraction."})})}/** * Exit icon from [IcoMoon]{@link https://icomoon.io/#icons-icomoon} * @license CC-BY-4.0 */function ao(e){return i(W,{...e,children:i("path",{d:"M12 10v-2h-5v-2h5v-2l3 3zM11 9v4h-5v3l-6-3v-13h11v5h-1v-4h-8l4 2v9h4v-3z"})})}/** @@ -34,6 +34,6 @@ var Pi=Object.defineProperty;var Ci=e=>{throw TypeError(e)};var Di=(e,t,n)=>t in */function lo(e){return i(W,{...e,children:i("path",{d:"M14.59 9.535c-0.839-1.454-0.335-3.317 1.127-4.164l-1.572-2.723c-0.449 0.263-0.972 0.414-1.529 0.414-1.68 0-3.042-1.371-3.042-3.062h-3.145c0.004 0.522-0.126 1.051-0.406 1.535-0.839 1.454-2.706 1.948-4.17 1.106l-1.572 2.723c0.453 0.257 0.845 0.634 1.123 1.117 0.838 1.452 0.336 3.311-1.12 4.16l1.572 2.723c0.448-0.261 0.967-0.41 1.522-0.41 1.675 0 3.033 1.362 3.042 3.046h3.145c-0.001-0.517 0.129-1.040 0.406-1.519 0.838-1.452 2.7-1.947 4.163-1.11l1.572-2.723c-0.45-0.257-0.839-0.633-1.116-1.113zM8 11.24c-1.789 0-3.24-1.45-3.24-3.24s1.45-3.24 3.24-3.24c1.789 0 3.24 1.45 3.24 3.24s-1.45 3.24-3.24 3.24z"})})}/** * User icon from [IcoMoon]{@link https://icomoon.io/#icons-icomoon} * @license CC-BY-4.0 - */function uo(e){return i(W,{...e,children:i("path",{d:"M9 11.041v-0.825c1.102-0.621 2-2.168 2-3.716 0-2.485 0-4.5-3-4.5s-3 2.015-3 4.5c0 1.548 0.898 3.095 2 3.716v0.825c-3.392 0.277-6 1.944-6 3.959h14c0-2.015-2.608-3.682-6-3.959z"})})}function ho(){const{goTo:e}=B(),[t]=I([{text:"Party Selection",icon:i(uo,{}),action:()=>e(i(ps,{}))},{text:"Log Out",icon:i(ao,{}),action:()=>V.deleteData()},{text:"BG1 News",icon:i(co,{}),action:()=>e(i(Kn,{}))}]),[n,r]=I(!1),o=te(null);return i(x,{children:[i("button",{className:"absolute top-0 right-0 h-full px-4",onClick:()=>r(!0),title:"Settings Menu",children:i(lo,{})}),n&&i(wt,{onClick:s=>{var a;(a=o.current)!=null&&a.contains(s.target)||r(!1)},"data-testid":"shade",children:i("ul",{className:"overflow-auto min-w-[50%] max-h-[90%] rounded-lg bg-white text-black text-lg font-normal",ref:o,children:t.map(s=>i("li",{className:"border-t-2 first:border-0 border-gray-300",children:i("button",{className:"flex flex-row items-center w-full px-4 py-3",onClick:()=>{r(!1),setTimeout(s.action,50)},children:[i("span",{className:"mr-2.5 text-gray-700","aria-hidden":!0,children:s.icon}),s.text]})},s.text))})})]})}function Ii(e){const[t,n]=e.split(":").map(Number);return t*60+n}const po=(e,t)=>Ii(e)-t;function fn({park:e,onSelect:t}){const{das:n}=O(),{loadData:r,loaderElem:o}=J(),[s,a]=I();C(()=>{r(async()=>{const l=await n.experiences(e);a(l.filter(u=>u.available&&!!u.nextAvailableTime).sort((u,h)=>u.name.localeCompare(h.name)))})},[e,n,r]);const c=[{heading:"Attractions",type:"ATTRACTION"},{heading:"Characters",type:"CHARACTER"},{heading:"Entertainment",type:"ENTERTAINMENT"}];return i(U,{title:"Select Experience",theme:e.theme,children:[s?s.length===0?i("p",{children:"No DAS experiences available"}):i(x,{children:c.map(l=>i(mo,{park:e,experiences:s.filter(u=>u.type===l.type),heading:l.heading,onSelect:t},l.type))}):null,o]})}function mo({park:e,experiences:t,heading:n,onSelect:r}){if(t.length===0)return null;const o=Ii(L().time);return i("div",{className:`mt-4 rounded overflow-hidden ${e.theme.bg}`,children:[i("h3",{className:"mt-0 py-1 text-white text-xs font-semibold text-center uppercase",children:n}),i("ul",{className:"bg-white bg-opacity-90 leading-snug",children:t.map(s=>i("li",{className:"flex items-center pt-3 last:pb-3",children:[i("div",{className:"flex-1 px-2",children:s.name}),i("div",{className:"px-2",children:i($,{onClick:()=>r(s),children:i("span",{className:"min-w-[4rem]",children:[po(s.nextAvailableTime,o)," ",i("abbr",{title:"minutes",children:"min."})]})})})]},s.id))})]})}function _n({park:e,party:t}){const{goTo:n,goBack:r}=B(),o=O(),{das:s}=o,{refreshPlans:a}=me(),[c,l]=I(),[u,h]=I(new Set(t)),[d,f]=I({}),{loadData:p,loaderElem:g}=J();async function E(){c&&p(async()=>{try{const k=await s.book({park:e,experience:c,guests:[...u]});a(),Et(o,"D"),await r({screen:pe}),n(i(ve,{booking:k,isNew:!0}))}catch(k){throw k instanceof nt&&f(k.conflicts),k}},{messages:{[nt.name]:"Some guests not eligible",[Un.name]:"Experience currently unavailable"}})}return i(U,{title:"DAS Selection",theme:e.theme,children:[i("h3",{children:"Experience"}),c?i("div",{className:"flex items-center mt-3",children:[i("div",{className:"text-lg font-semibold truncate",children:c.name}),i("div",{className:"ml-3",children:i($,{type:"small",onClick:()=>n(i(fn,{park:e,onSelect:k=>{l(k),r()}})),children:"Modify"})})]}):i("div",{className:"mt-3 text-center",children:i($,{onClick:()=>n(i(fn,{park:e,onSelect:k=>{l(k),r()}})),children:"Select Experience"})}),i("h3",{children:"DAS Guest"}),i(F,{guests:t.slice(0,1),conflicts:d}),t.length>1&&i(x,{children:[i("h3",{children:"Additional Guests"}),i(F,{guests:t.slice(1),selectable:{isSelected:k=>u.has(k),onToggle:k=>{u.has(k)?u.delete(k):u.add(k),h(new Set(u))}},conflicts:d})]}),i(Y,{disabled:!t||!c,onClick:E,children:"Request Return Time"}),g]})}function fo({parties:e}){const{goTo:t}=B(),{park:n}=Me(),{plans:r,refreshPlans:o,loaderElem:s}=me();ht(o,[o]);const a=new Set(e.map(d=>d[0]).map(d=>d.id)),c=r.filter(d=>d.type==="DAS"&&d.subtype==="IN_PARK"),l=new Map(c.filter(d=>d.type==="DAS"&&d.subtype==="IN_PARK").map(d=>{var f;return[((f=d.guests.find(p=>a.has(p.id)))==null?void 0:f.id)??"",d]}));if(!s&&e.length===1){const d=e[0],f=l.get(d[0].id);return f?i(ve,{booking:f}):i(_n,{park:n,party:d})}const u=e.filter(d=>!(l!=null&&l.has(d[0].id))),h=e.filter(d=>l==null?void 0:l.has(d[0].id));return i(U,{title:`DAS ${e.length===1?"Selection":"Parties"}`,theme:n.theme,children:s||(e.length>0?i(x,{children:[u.length>0&&i(x,{children:[i("h3",{children:"Select Next Experience"}),i("ul",{className:"mt-2",children:u.map(d=>i("li",{className:"flex items-center gap-x-3 pl-3 py-1",children:[i("span",{className:"flex-shrink-0 w-[48px] h-[48px] leading-[48px] rounded-full text-3xl font-bold text-center bg-gray-400 text-white","aria-hidden":"true",children:d[0].avatarImageUrl?i("img",{src:d[0].avatarImageUrl,alt:"",width:"48",height:"48",className:"rounded-full"}):d[0].name[0]}),i("span",{className:"flex-1 leading-tight",children:d[0].name}),i($,{type:"small",onClick:()=>t(i(_n,{park:n,party:d})),children:"Select"})]},d[0].id))})]}),h.length>0&&i(x,{children:[i("h3",{children:"Current Selection"}),i("ul",{className:"mt-2",children:h.map(d=>{const f=l.get(d[0].id);return i("li",{className:"flex items-center gap-x-3 pl-3 py-1",children:[i("span",{className:"flex-shrink-0 w-[48px] h-[48px] leading-[48px] rounded-full text-3xl font-bold text-center bg-gray-400 text-white","aria-hidden":"true",children:d[0].avatarImageUrl?i("img",{src:d[0].avatarImageUrl,alt:"",width:"48",height:"48",className:"rounded-full"}):d[0].name[0]}),i("div",{className:"flex-1",children:[i("div",{children:d[0].name}),f&&i("div",{className:"text-gray-500 text-xs font-semibold uppercase",children:[f.name," @"," ",i(ne,{time:f.start.time})]})]}),i($,{type:"small",onClick:()=>{f&&t(i(ve,{booking:f}))},children:"Details"})]},d[0].id)})})]})]}):i("div",{}))})}function _o({contentRef:e}){const{goTo:t}=B(),{experiences:n,refreshExperiences:r,loaderElem:o}=Ge(),s=Xn();return i(kt,{title:"Times Guide",buttons:i(x,{children:[s.length>0&&i($,{title:"Disability Access Service",onClick:()=>t(i(fo,{parties:s})),children:"DAS"}),i(wi,{}),i(Be,{name:"Times",onClick:r})]}),contentRef:e,children:[i(go,{experiences:n}),o]})}const go=ft(function({experiences:t}){const{goTo:n}=B(),r=s=>n(i(yo,{exp:s})),o=new Map;return t.filter(s=>{var a;return s.standby.available||s.standby.unavailableReason==="TEMPORARILY_DOWN"||((a=s.individual)==null?void 0:a.available)||s.virtualQueue}).sort((s,a)=>s.land.sort-a.land.sort||s.name.localeCompare(a.name)).forEach(s=>{var a,c;o.has(s.land)||o.set(s.land,{ATTRACTION:[],ENTERTAINMENT:[],CHARACTER:[],HOLIDAY:[]}),(c=(a=o.get(s.land))==null?void 0:a[s.type])==null||c.push(s)}),i(x,{children:[[...o].map(([s,a])=>i("div",{children:[i("h2",{className:`pr-1 ${s.theme.text} text-sm font-semibold text-right uppercase`,children:s.name}),i("div",{className:"rounded overflow-hidden",children:[i(Se,{title:"Attractions",land:s,experiences:a.ATTRACTION,onInfoClick:r}),i(Se,{title:"Entertainment",land:s,experiences:a.ENTERTAINMENT,onInfoClick:r}),i(Se,{title:"Holiday Entertainment",land:s,experiences:a.HOLIDAY,onInfoClick:r}),i(Se,{title:"Characters",land:s,experiences:a.CHARACTER,onInfoClick:r})]})]},s.name)),t.length>0&&i(bi,{children:[i(he,{sym:"*",def:"No posted wait/show time"}),i(he,{sym:"\u274C",def:"Temporarily down"}),i(he,{sym:"VQ",def:"Virtual queue"})]})]})});function Se({title:e,land:t,experiences:n,onInfoClick:r}){return n.length===0?null:i("div",{className:`${t.theme.bg}`,"data-testid":`${t.name}-${e}`,children:[i("h3",{className:"mt-0 py-1 text-white text-xs font-semibold text-center uppercase",children:e}),i("table",{className:"w-full leading-snug",children:i("tbody",{children:n.map(o=>{var s;return i("tr",{className:"group",children:[i("td",{className:`${o.standby.nextShowTime?"min-w-[5.625rem]":"min-w-[2.75rem]"} px-2 py-0.5 group-first:pt-1 group-last:pb-1 bg-white bg-opacity-80 font-bold text-center uppercase whitespace-nowrap`,children:o.standby.nextShowTime?(((s=o.additionalShowTimes)==null?void 0:s.length)??0)>0?i("button",{onClick:()=>r(o),className:"underline",children:z(o.standby.nextShowTime)}):z(o.standby.nextShowTime):o.standby.available?o.standby.waitTime??"*":o.virtualQueue&&o.standby.unavailableReason==="NOT_STANDBY_ENABLED"?"VQ":"\u274C"}),i("td",{className:"w-full px-1 pl-2 py-0.5 group-first:pt-1 group-last:pb-1 bg-white bg-opacity-90",children:i("div",{className:"flex items-center gap-x-2",children:[i("div",{className:`flex-1 ${o.type==="ATTRACTION"&&!o.virtualQueue&&(o.priority??4)<4?`font-bold ${t.theme.text}`:""}`,children:o.name}),(o==null?void 0:o.individual)&&i("div",{className:`${t.theme.text} text-xs leading-tight font-semibold text-center uppercase`,children:[i("div",{children:[i("abbr",{title:"Individual Lightning Lane",children:"ILL"}),": "+o.individual.displayPrice]}),o.individual.nextAvailableTime&&i("div",{children:z(o.individual.nextAvailableTime)})]})]})})]},o.id)})})})]})}const yo=({exp:e})=>{var t;return i(U,{title:"Experience Info",children:[i("h2",{children:e.name}),i("div",{children:e.park.name}),i("h3",{children:["Upcoming ",e.type==="CHARACTER"?"Appearances":"Shows"]}),i("ul",{className:"list-disc mt-2 pl-6",children:[!!e.standby.nextShowTime&&i("li",{children:z(e.standby.nextShowTime)}),(t=e.additionalShowTimes)==null?void 0:t.map(n=>i("li",{children:z(n)},n))]})]})},gn=6e4,Ni=["bg1","genie","merlock","tab"],vo=()=>M.get(Ni)??"LL",bo=[{name:"LL",icon:i(rt,{}),component:to},{name:"Times",icon:i(ds,{}),component:_o},{name:"Plans",icon:i(ai,{}),component:gi}],xo=i(ho,{}),pe=as({tabs:bo,footer:xo},({tab:e})=>{const{current:t}=Yn(),n=ce(),{park:r}=Me(),o=ls(),{refreshExperiences:s}=o,{refreshPlans:a}=me(),c=te(null);return C(()=>{M.set(Ni,e.name)},[e]),C(()=>bt(()=>{t.type===pe&&(s(gn),a(gn))}),[t,s,a]),C(()=>{var l;n.current&&((l=c.current)==null||l.scroll(0,0))},[n]),i(qn,{value:r.theme,children:i(cs,{value:o,children:i(e.component,{contentRef:c})})})});function wo(){return i(Yr,{value:Vr(),children:i(ns,{value:is(),children:i(rs,{value:ss(),children:i(Qr,{value:qr(),children:i(Vn,{children:i(pe,{tabName:vo()})})})})})})}function Pt({queue:e,title:t,children:n}){var r;return i(U,{title:t,theme:(r=e.park)==null?void 0:r.theme,children:[i("h2",{children:e.name}),n]})}const ko=5e3;function Eo({queue:e,guests:t,result:n}){const{boardingGroup:r,conflicts:o}=n,s=r!==null,a=t.filter(d=>!(d.id in o)),c=t.filter(d=>d.id in o),{goBack:l}=B(),[u,h]=I(!1);return C(()=>{s&&setTimeout(()=>h(!0),ko)},[s]),i(Pt,{queue:e,title:"Boarding Group",children:s?i(x,{children:[i("h3",{children:"Congratulations! \u{1F389}"}),i("p",{children:"You joined the virtual queue!"}),i("p",{className:"text-lg font-semibold",children:["Boarding Group: ",r]}),i(F,{guests:a}),Object.keys(o).length>0&&i(x,{children:[i("p",{className:"font-semibold",children:"These guests could not join:"}),i(F,{guests:c,conflicts:o})]}),i("p",{children:"Refer to the My Disney Experience app for return time and other information."}),u&&i(Y,{onClick:()=>l({screen:Ti}),children:"Done"})]}):i(x,{children:[i("h3",{children:"Sorry!"}),i("p",{children:"A boarding group could not be obtained. Go back and try again."}),i(F,{guests:c,conflicts:o})]})})}function Io({queue:e,guests:t}){const{goTo:n}=B(),r=O(),{vq:o}=r,{loadData:s,loaderElem:a}=J();async function c(){await s(async l=>{const u=await o.getQueue(e);if(!u.isAcceptingJoins)return l(u.isAcceptingPartyCreation?"Queue not open yet":"No boarding groups available");const h=await o.joinQueue(e,t);n(i(Eo,{queue:e,guests:t,result:h}),{replace:!0}),h.boardingGroup!==null&&Et(r,"V")},{minLoadTime:999})}return i(Pt,{queue:e,title:"Virtual Queue",children:[!e.isAcceptingJoins&&i(vi,{time:e.nextScheduledOpenTime,label:"Next queue opening"}),!e.isAcceptingJoins&&e.nextScheduledOpenTime!==null&&i("p",{children:["Tap the ",i("b",{children:"Join Virtual Queue"})," button when the clock reads"," ",i("time",{className:"font-semibold",children:e.nextScheduledOpenTime}),". The queue can fill up almost instantly, so be quick!"]}),i("h3",{children:"Your Party"}),i(F,{guests:t}),i(Y,{onClick:c,children:"Join Virtual Queue"}),a]})}function No({queue:e}){const{goTo:t}=B(),{vq:n}=O(),{loadData:r,loaderElem:o,flash:s}=J(),[a,c]=I([]),[l,u]=I(new Set);C(()=>{r(async()=>{const d=await n.getLinkedGuests(e);c(d),u(new Set(d.filter(f=>f.preselected)))})},[e,n,r]);function h(d){const f=new Set(l);f[f.has(d)?"delete":"add"](d);const{maxPartySize:p}=e;p>0&&f.size>p?s(`Maximum party size: ${p}`):(u(f),s(""))}return i(Pt,{queue:e,title:"Choose Your Party",children:[e.howToEnterMessage.split(` + */function uo(e){return i(W,{...e,children:i("path",{d:"M9 11.041v-0.825c1.102-0.621 2-2.168 2-3.716 0-2.485 0-4.5-3-4.5s-3 2.015-3 4.5c0 1.548 0.898 3.095 2 3.716v0.825c-3.392 0.277-6 1.944-6 3.959h14c0-2.015-2.608-3.682-6-3.959z"})})}function ho(){const{goTo:e}=B(),[t]=N([{text:"Party Selection",icon:i(uo,{}),action:()=>e(i(ps,{}))},{text:"Log Out",icon:i(ao,{}),action:()=>V.deleteData()},{text:"BG1 News",icon:i(co,{}),action:()=>e(i(Kn,{}))}]),[n,r]=N(!1),o=te(null);return i(x,{children:[i("button",{className:"absolute top-0 right-0 h-full px-4",onClick:()=>r(!0),title:"Settings Menu",children:i(lo,{})}),n&&i(wt,{onClick:s=>{var a;(a=o.current)!=null&&a.contains(s.target)||r(!1)},"data-testid":"shade",children:i("ul",{className:"overflow-auto min-w-[50%] max-h-[90%] rounded-lg bg-white text-black text-lg font-normal",ref:o,children:t.map(s=>i("li",{className:"border-t-2 first:border-0 border-gray-300",children:i("button",{className:"flex flex-row items-center w-full px-4 py-3",onClick:()=>{r(!1),setTimeout(s.action,50)},children:[i("span",{className:"mr-2.5 text-gray-700","aria-hidden":!0,children:s.icon}),s.text]})},s.text))})})]})}function Ni(e){const[t,n]=e.split(":").map(Number);return t*60+n}const po=(e,t)=>Ni(e)-t;function fn({park:e,onSelect:t}){const{das:n}=O(),{loadData:r,loaderElem:o}=J(),[s,a]=N();C(()=>{r(async()=>{const l=await n.experiences(e);a(l.filter(u=>u.available&&!!u.nextAvailableTime).sort((u,h)=>u.name.localeCompare(h.name)))})},[e,n,r]);const c=[{heading:"Attractions",type:"ATTRACTION"},{heading:"Characters",type:"CHARACTER"},{heading:"Entertainment",type:"ENTERTAINMENT"}];return i(U,{title:"Select Experience",theme:e.theme,children:[s?s.length===0?i("p",{children:"No DAS experiences available"}):i(x,{children:c.map(l=>i(mo,{park:e,experiences:s.filter(u=>u.type===l.type),heading:l.heading,onSelect:t},l.type))}):null,o]})}function mo({park:e,experiences:t,heading:n,onSelect:r}){if(t.length===0)return null;const o=Ni(L().time);return i("div",{className:`mt-4 rounded overflow-hidden ${e.theme.bg}`,children:[i("h3",{className:"mt-0 py-1 text-white text-xs font-semibold text-center uppercase",children:n}),i("ul",{className:"bg-white bg-opacity-90 leading-snug",children:t.map(s=>i("li",{className:"flex items-center pt-3 last:pb-3",children:[i("div",{className:"flex-1 px-2",children:s.name}),i("div",{className:"px-2",children:i($,{onClick:()=>r(s),children:i("span",{className:"min-w-[4rem]",children:[po(s.nextAvailableTime,o)," ",i("abbr",{title:"minutes",children:"min."})]})})})]},s.id))})]})}function _n({park:e,party:t}){const{goTo:n,goBack:r}=B(),o=O(),{das:s}=o,{refreshPlans:a}=me(),[c,l]=N(),[u,h]=N(new Set(t)),[d,f]=N({}),{loadData:p,loaderElem:g}=J();async function E(){c&&p(async()=>{try{const k=await s.book({park:e,experience:c,guests:[...u]});a(),Et(o,"D"),await r({screen:pe}),n(i(ve,{booking:k,isNew:!0}))}catch(k){throw k instanceof nt&&f(k.conflicts),k}},{messages:{[nt.name]:"Some guests not eligible",[Un.name]:"Experience currently unavailable"}})}return i(U,{title:"DAS Selection",theme:e.theme,children:[i("h3",{children:"Experience"}),c?i("div",{className:"flex items-center mt-3",children:[i("div",{className:"text-lg font-semibold truncate",children:c.name}),i("div",{className:"ml-3",children:i($,{type:"small",onClick:()=>n(i(fn,{park:e,onSelect:k=>{l(k),r()}})),children:"Modify"})})]}):i("div",{className:"mt-3 text-center",children:i($,{onClick:()=>n(i(fn,{park:e,onSelect:k=>{l(k),r()}})),children:"Select Experience"})}),i("h3",{children:"DAS Guest"}),i(F,{guests:t.slice(0,1),conflicts:d}),t.length>1&&i(x,{children:[i("h3",{children:"Additional Guests"}),i(F,{guests:t.slice(1),selectable:{isSelected:k=>u.has(k),onToggle:k=>{u.has(k)?u.delete(k):u.add(k),h(new Set(u))}},conflicts:d})]}),i(Y,{disabled:!t||!c,onClick:E,children:"Request Return Time"}),g]})}function fo({parties:e}){const{goTo:t}=B(),{park:n}=Me(),{plans:r,refreshPlans:o,loaderElem:s}=me();ht(o,[o]);const a=new Set(e.map(d=>d[0]).map(d=>d.id)),c=r.filter(d=>d.type==="DAS"&&d.subtype==="IN_PARK"),l=new Map(c.filter(d=>d.type==="DAS"&&d.subtype==="IN_PARK").map(d=>{var f;return[((f=d.guests.find(p=>a.has(p.id)))==null?void 0:f.id)??"",d]}));if(!s&&e.length===1){const d=e[0],f=l.get(d[0].id);return f?i(ve,{booking:f}):i(_n,{park:n,party:d})}const u=e.filter(d=>!(l!=null&&l.has(d[0].id))),h=e.filter(d=>l==null?void 0:l.has(d[0].id));return i(U,{title:`DAS ${e.length===1?"Selection":"Parties"}`,theme:n.theme,children:s||(e.length>0?i(x,{children:[u.length>0&&i(x,{children:[i("h3",{children:"Select Next Experience"}),i("ul",{className:"mt-2",children:u.map(d=>i("li",{className:"flex items-center gap-x-3 pl-3 py-1",children:[i("span",{className:"flex-shrink-0 w-[48px] h-[48px] leading-[48px] rounded-full text-3xl font-bold text-center bg-gray-400 text-white","aria-hidden":"true",children:d[0].avatarImageUrl?i("img",{src:d[0].avatarImageUrl,alt:"",width:"48",height:"48",className:"rounded-full"}):d[0].name[0]}),i("span",{className:"flex-1 leading-tight",children:d[0].name}),i($,{type:"small",onClick:()=>t(i(_n,{park:n,party:d})),children:"Select"})]},d[0].id))})]}),h.length>0&&i(x,{children:[i("h3",{children:"Current Selection"}),i("ul",{className:"mt-2",children:h.map(d=>{const f=l.get(d[0].id);return i("li",{className:"flex items-center gap-x-3 pl-3 py-1",children:[i("span",{className:"flex-shrink-0 w-[48px] h-[48px] leading-[48px] rounded-full text-3xl font-bold text-center bg-gray-400 text-white","aria-hidden":"true",children:d[0].avatarImageUrl?i("img",{src:d[0].avatarImageUrl,alt:"",width:"48",height:"48",className:"rounded-full"}):d[0].name[0]}),i("div",{className:"flex-1",children:[i("div",{children:d[0].name}),f&&i("div",{className:"text-gray-500 text-xs font-semibold uppercase",children:[f.name," @"," ",i(ne,{time:f.start.time})]})]}),i($,{type:"small",onClick:()=>{f&&t(i(ve,{booking:f}))},children:"Details"})]},d[0].id)})})]})]}):i("div",{}))})}function _o({contentRef:e}){const{goTo:t}=B(),{experiences:n,refreshExperiences:r,loaderElem:o}=Ge(),s=Xn();return i(kt,{title:"Times Guide",buttons:i(x,{children:[s.length>0&&i($,{title:"Disability Access Service",onClick:()=>t(i(fo,{parties:s})),children:"DAS"}),i(wi,{}),i(Be,{name:"Times",onClick:r})]}),contentRef:e,children:[i(go,{experiences:n}),o]})}const go=ft(function({experiences:t}){const{goTo:n}=B(),r=s=>n(i(yo,{exp:s})),o=new Map;return t.filter(s=>{var a;return s.standby.available||s.standby.unavailableReason==="TEMPORARILY_DOWN"||((a=s.individual)==null?void 0:a.available)||s.virtualQueue}).sort((s,a)=>s.land.sort-a.land.sort||s.name.localeCompare(a.name)).forEach(s=>{var a,c;o.has(s.land)||o.set(s.land,{ATTRACTION:[],ENTERTAINMENT:[],CHARACTER:[],HOLIDAY:[]}),(c=(a=o.get(s.land))==null?void 0:a[s.type])==null||c.push(s)}),i(x,{children:[[...o].map(([s,a])=>i("div",{children:[i("h2",{className:`pr-1 ${s.theme.text} text-sm font-semibold text-right uppercase`,children:s.name}),i("div",{className:"rounded overflow-hidden",children:[i(Se,{title:"Attractions",land:s,experiences:a.ATTRACTION,onInfoClick:r}),i(Se,{title:"Entertainment",land:s,experiences:a.ENTERTAINMENT,onInfoClick:r}),i(Se,{title:"Holiday Entertainment",land:s,experiences:a.HOLIDAY,onInfoClick:r}),i(Se,{title:"Characters",land:s,experiences:a.CHARACTER,onInfoClick:r})]})]},s.name)),t.length>0&&i(bi,{children:[i(he,{sym:"*",def:"No posted wait/show time"}),i(he,{sym:"\u274C",def:"Temporarily down"}),i(he,{sym:"VQ",def:"Virtual queue"})]})]})});function Se({title:e,land:t,experiences:n,onInfoClick:r}){return n.length===0?null:i("div",{className:`${t.theme.bg}`,"data-testid":`${t.name}-${e}`,children:[i("h3",{className:"mt-0 py-1 text-white text-xs font-semibold text-center uppercase",children:e}),i("table",{className:"w-full leading-snug",children:i("tbody",{children:n.map(o=>{var s;return i("tr",{className:"group",children:[i("td",{className:`${o.standby.nextShowTime?"min-w-[5.625rem]":"min-w-[2.75rem]"} px-2 py-0.5 group-first:pt-1 group-last:pb-1 bg-white bg-opacity-80 font-bold text-center uppercase whitespace-nowrap`,children:o.standby.nextShowTime?(((s=o.additionalShowTimes)==null?void 0:s.length)??0)>0?i("button",{onClick:()=>r(o),className:"underline",children:z(o.standby.nextShowTime)}):z(o.standby.nextShowTime):o.standby.available?o.standby.waitTime??"*":o.virtualQueue&&o.standby.unavailableReason==="NOT_STANDBY_ENABLED"?"VQ":"\u274C"}),i("td",{className:"w-full px-1 pl-2 py-0.5 group-first:pt-1 group-last:pb-1 bg-white bg-opacity-90",children:i("div",{className:"flex items-center gap-x-2",children:[i("div",{className:`flex-1 ${o.type==="ATTRACTION"&&!o.virtualQueue&&(o.priority??4)<4?`font-bold ${t.theme.text}`:""}`,children:o.name}),(o==null?void 0:o.individual)&&i("div",{className:`${t.theme.text} text-xs leading-tight font-semibold text-center uppercase`,children:[i("div",{children:[i("abbr",{title:"Individual Lightning Lane",children:"ILL"}),": "+o.individual.displayPrice]}),o.individual.nextAvailableTime&&i("div",{children:z(o.individual.nextAvailableTime)})]})]})})]},o.id)})})})]})}const yo=({exp:e})=>{var t;return i(U,{title:"Experience Info",children:[i("h2",{children:e.name}),i("div",{children:e.park.name}),i("h3",{children:["Upcoming ",e.type==="CHARACTER"?"Appearances":"Shows"]}),i("ul",{className:"list-disc mt-2 pl-6",children:[!!e.standby.nextShowTime&&i("li",{children:z(e.standby.nextShowTime)}),(t=e.additionalShowTimes)==null?void 0:t.map(n=>i("li",{children:z(n)},n))]})]})},gn=6e4,Ii=["bg1","genie","merlock","tab"],vo=()=>M.get(Ii)??"LL",bo=[{name:"LL",icon:i(rt,{}),component:to},{name:"Times",icon:i(ds,{}),component:_o},{name:"Plans",icon:i(ai,{}),component:gi}],xo=i(ho,{}),pe=as({tabs:bo,footer:xo},({tab:e})=>{const{current:t}=Yn(),n=ce(),{park:r}=Me(),o=ls(),{refreshExperiences:s}=o,{refreshPlans:a}=me(),c=te(null);return C(()=>{M.set(Ii,e.name)},[e]),C(()=>bt(()=>{t.type===pe&&(s(gn),a(gn))}),[t,s,a]),C(()=>{var l;n.current&&((l=c.current)==null||l.scroll(0,0))},[n]),i(qn,{value:r.theme,children:i(cs,{value:o,children:i(e.component,{contentRef:c})})})});function wo(){return i(Yr,{value:Vr(),children:i(ns,{value:is(),children:i(rs,{value:ss(),children:i(Qr,{value:qr(),children:i(Vn,{children:i(pe,{tabName:vo()})})})})})})}function Pt({queue:e,title:t,children:n}){var r;return i(U,{title:t,theme:(r=e.park)==null?void 0:r.theme,children:[i("h2",{children:e.name}),n]})}const ko=5e3;function Eo({queue:e,guests:t,result:n}){const{boardingGroup:r,conflicts:o}=n,s=r!==null,a=t.filter(d=>!(d.id in o)),c=t.filter(d=>d.id in o),{goBack:l}=B(),[u,h]=N(!1);return C(()=>{s&&setTimeout(()=>h(!0),ko)},[s]),i(Pt,{queue:e,title:"Boarding Group",children:s?i(x,{children:[i("h3",{children:"Congratulations! \u{1F389}"}),i("p",{children:"You joined the virtual queue!"}),i("p",{className:"text-lg font-semibold",children:["Boarding Group: ",r]}),i(F,{guests:a}),Object.keys(o).length>0&&i(x,{children:[i("p",{className:"font-semibold",children:"These guests could not join:"}),i(F,{guests:c,conflicts:o})]}),i("p",{children:"Refer to the My Disney Experience app for return time and other information."}),u&&i(Y,{onClick:()=>l({screen:Ti}),children:"Done"})]}):i(x,{children:[i("h3",{children:"Sorry!"}),i("p",{children:"A boarding group could not be obtained. Go back and try again."}),i(F,{guests:c,conflicts:o})]})})}function No({queue:e,guests:t}){const{goTo:n}=B(),r=O(),{vq:o}=r,{loadData:s,loaderElem:a}=J();async function c(){await s(async l=>{const u=await o.getQueue(e);if(!u.isAcceptingJoins)return l(u.isAcceptingPartyCreation?"Queue not open yet":"No boarding groups available");const h=await o.joinQueue(e,t);n(i(Eo,{queue:e,guests:t,result:h}),{replace:!0}),h.boardingGroup!==null&&Et(r,"V")},{minLoadTime:999})}return i(Pt,{queue:e,title:"Virtual Queue",children:[!e.isAcceptingJoins&&i(vi,{time:e.nextScheduledOpenTime,label:"Next queue opening"}),!e.isAcceptingJoins&&e.nextScheduledOpenTime!==null&&i("p",{children:["Tap the ",i("b",{children:"Join Virtual Queue"})," button when the clock reads"," ",i("time",{className:"font-semibold",children:e.nextScheduledOpenTime}),". The queue can fill up almost instantly, so be quick!"]}),i("h3",{children:"Your Party"}),i(F,{guests:t}),i(Y,{onClick:c,children:"Join Virtual Queue"}),a]})}function Io({queue:e}){const{goTo:t}=B(),{vq:n}=O(),{loadData:r,loaderElem:o,flash:s}=J(),[a,c]=N([]),[l,u]=N(new Set);C(()=>{r(async()=>{const d=await n.getLinkedGuests(e);c(d),u(new Set(d.filter(f=>f.preselected)))})},[e,n,r]);function h(d){const f=new Set(l);f[f.has(d)?"delete":"add"](d);const{maxPartySize:p}=e;p>0&&f.size>p?s(`Maximum party size: ${p}`):(u(f),s(""))}return i(Pt,{queue:e,title:"Choose Your Party",children:[e.howToEnterMessage.split(` -`).map((d,f)=>i("p",{children:d},f)),i("h3",{children:"Choose Your Party"}),a.length>0?i(F,{guests:a,selectable:{isSelected:d=>l.has(d),onToggle:h}}):i("p",{children:"No guests available"}),i(Y,{disabled:l.size===0,onClick:()=>t(i(Io,{queue:e,guests:[...l]})),children:"Confirm Party"}),o]})}const yn=e=>e.categoryContentId==="attraction",Pe=e=>e.isAcceptingPartyCreation||e.isAcceptingJoins;function Ti(){const{vq:e}=O(),{goTo:t}=B(),n=j(),{loadData:r,loaderElem:o}=J(),[s,a]=I(),c=Q(()=>{r(async()=>{a((await e.getQueues()).sort((l,u)=>+Pe(u)-+Pe(l)||+yn(u)-+yn(l)))})},[e,r]);return C(()=>(c(),bt(c)),[c]),i(U,{title:"Virtual Queues",buttons:i($,{title:"Refresh Queues",onClick:c,children:i(xt,{})}),footer:i("div",{className:"p-2 text-right",children:i($,{className:`bg-opacity-90 bg-white ${n.text}`,onClick:()=>V.deleteData(),children:"Log Out"})}),children:[s?s.length>0?i("ul",{className:"mt-1",children:s.map(l=>i("li",{className:"py-3 first:border-0 border-t-4 border-gray-300",children:[i("h2",{className:"mt-0",children:l.name}),i("div",{className:"flex items-center mt-2",children:[i("div",{className:"flex-1",children:l.isAcceptingJoins?i("span",{children:"Available now"}):l.nextScheduledOpenTime?i(x,{children:["Next opening:"," ",i("time",{dateTime:l.nextScheduledOpenTime,className:"font-semibold",children:z(l.nextScheduledOpenTime)})]}):"No more openings today"}),i("div",{className:"pl-3",children:i($,{disabled:!Pe(l),onClick:()=>t(i(No,{queue:l})),children:Pe(l)?"Join Queue":"Closed"})})]})]},l.id))}):!o&&i("p",{className:"text-gray-500 font-semibold text-center uppercase",children:"No virtual queues found"}):null,o]})}function To(){return i(Vn,{children:i(Ti,{})})}const So=0;function Po(){document.body.addEventListener("click",()=>null)}function Co(){const[e,t]=I(),[n,r]=I(i("div",{})),o=Br(),s=Hr(So),[a,c]=I(()=>{try{V.getData()}catch(l){if(!(l instanceof Mn))throw l;return!0}return!1});return C(()=>{Po()},[]),C(()=>{V.onUnauthorized=()=>c(!0),(async()=>{for(const[l,u]of[[yt,wo],[gt,To]])try{const h=await wr(l.originToResortId(origin));t(h),rr({WDW:"America/New_York",DLR:"America/Los_Angeles"}[h.id]),r(i(Cr,{value:h,children:i(u,{})}));return}catch(h){if(!(h instanceof Bn))throw h}location.assign("https://joelface.github.io/bg1/start.html")})()},[]),C(()=>{function l(){if(!a)try{V.getData(),c(!1)}catch{c(!0)}}return l(),bt(l)},[a]),o||s||a&&e&&i(Wr,{resort:e,onLogin:l=>{V.setData(l),c(!1)}})||n}Si();function Si(){if(!document.body){setTimeout(Si,100);return}document.close(),Do(),Ao(),Lo().render(i(Co,{}))}function Do(){const e=document.createElement("meta");e.name="viewport",e.content="width=device-width, initial-scale=1, maximum-scale=1",document.head.appendChild(e)}function Ao(){const e=document.createElement("link");e.rel="icon",e.href="data:,",document.head.appendChild(e)}function Lo(){return ir(document.body.appendChild(document.createElement("div")))} +`).map((d,f)=>i("p",{children:d},f)),i("h3",{children:"Choose Your Party"}),a.length>0?i(F,{guests:a,selectable:{isSelected:d=>l.has(d),onToggle:h}}):i("p",{children:"No guests available"}),i(Y,{disabled:l.size===0,onClick:()=>t(i(No,{queue:e,guests:[...l]})),children:"Confirm Party"}),o]})}const yn=e=>e.categoryContentId==="attraction",Pe=e=>e.isAcceptingPartyCreation||e.isAcceptingJoins;function Ti(){const{vq:e}=O(),{goTo:t}=B(),n=j(),{loadData:r,loaderElem:o}=J(),[s,a]=N(),c=Q(()=>{r(async()=>{a((await e.getQueues()).sort((l,u)=>+Pe(u)-+Pe(l)||+yn(u)-+yn(l)))})},[e,r]);return C(()=>(c(),bt(c)),[c]),i(U,{title:"Virtual Queues",buttons:i($,{title:"Refresh Queues",onClick:c,children:i(xt,{})}),footer:i("div",{className:"p-2 text-right",children:i($,{className:`bg-opacity-90 bg-white ${n.text}`,onClick:()=>V.deleteData(),children:"Log Out"})}),children:[s?s.length>0?i("ul",{className:"mt-1",children:s.map(l=>i("li",{className:"py-3 first:border-0 border-t-4 border-gray-300",children:[i("h2",{className:"mt-0",children:l.name}),i("div",{className:"flex items-center mt-2",children:[i("div",{className:"flex-1",children:l.isAcceptingJoins?i("span",{children:"Available now"}):l.nextScheduledOpenTime?i(x,{children:["Next opening:"," ",i("time",{dateTime:l.nextScheduledOpenTime,className:"font-semibold",children:z(l.nextScheduledOpenTime)})]}):"No more openings today"}),i("div",{className:"pl-3",children:i($,{disabled:!Pe(l),onClick:()=>t(i(Io,{queue:l})),children:Pe(l)?"Join Queue":"Closed"})})]})]},l.id))}):!o&&i("p",{className:"text-gray-500 font-semibold text-center uppercase",children:"No virtual queues found"}):null,o]})}function To(){return i(Vn,{children:i(Ti,{})})}const So=0;function Po(){document.body.addEventListener("click",()=>null)}function Co(){const[e,t]=N(),[n,r]=N(i("div",{})),o=Br(),s=Hr(So),[a,c]=N(()=>{try{V.getData()}catch(l){if(!(l instanceof Mn))throw l;return!0}return!1});return C(()=>{Po()},[]),C(()=>{V.onUnauthorized=()=>c(!0),(async()=>{for(const[l,u]of[[yt,wo],[gt,To]])try{const h=await wr(l.originToResortId(origin));t(h),rr({WDW:"America/New_York",DLR:"America/Los_Angeles"}[h.id]),r(i(Cr,{value:h,children:i(u,{})}));return}catch(h){if(!(h instanceof Bn))throw h}location.assign("https://joelface.github.io/bg1/start.html")})()},[]),C(()=>{function l(){if(!a)try{V.getData(),c(!1)}catch{c(!0)}}return l(),bt(l)},[a]),o||s||a&&e&&i(Wr,{resort:e,onLogin:l=>{V.setData(l),c(!1)}})||n}Si();function Si(){if(!document.body){setTimeout(Si,100);return}document.close(),Do(),Ao(),Lo().render(i(Co,{}))}function Do(){const e=document.createElement("meta");e.name="viewport",e.content="width=device-width, initial-scale=1, maximum-scale=1",document.head.appendChild(e)}function Ao(){const e=document.createElement("link");e.rel="icon",e.href="data:,",document.head.appendChild(e)}function Lo(){return ir(document.body.appendChild(document.createElement("div")))}