PageSourceSearch

https://tbxunfiltered.com/assets/MainPowerExperience-C4THEQIo.js

js tbxunfiltered.com collected 2026-10-09 22:40:36 UTC 12,552 bytes, 1 lines download raw bytes

1import{r as e}from"./rolldown-runtime-S-ySWqyJ.js";import{i as t,r as n}from"./framework-CXnKph_e.js";var r=e(t(),1),i=n(),a=22e3,o=`tbx-display-name`,s=`tbx-celebrated-powerups`,c=`tbx:open-power`,l=`https://www.paypal.com/ncp/payment/NL2FX5TPAUSAQ`,u=`tbx-gas-money-paypal-away`,d=null,f=null,p=null,m=null,h=!1,g=null;function _(){return window}function v(e){let t=_();return t.paypal?Promise.resolve(t.paypal):(d||=new Promise((t,n)=>{let r=document.createElement(`script`);r.src=`https://www.paypal.com/sdk/js?client-id=${encodeURIComponent(e)}&currency=USD&intent=capture&components=buttons`,r.async=!0,r.onload=()=>_().paypal?t(_().paypal):n(Error(`PayPal checkout did not load.`)),r.onerror=()=>n(Error(`PayPal checkout could not be loaded.`)),document.head.appendChild(r)}),d)}async function y(e){let t=await e.json();if(!e.ok)throw Error(t.error||`Please try again.`);return t}function b(e){try{let t=window.sessionStorage.getItem(s),n=new Set(t?JSON.parse(t):[]);n.add(e),window.sessionStorage.setItem(s,JSON.stringify(Array.from(n).slice(-50)))}catch{}}function x(){return m||(m=new Audio(`/media/fireworks-real.mp3`),m.preload=`auto`,m.loop=!1),m}function S(){g!==null&&(window.clearTimeout(g),g=null),f&&=(f.pause(),f.muted=!0,f.currentTime=0,null),p&&=(p.close(),null)}function C(){let e=x();if(h&&!e.paused)return;e.currentTime=0,e.volume=1,e.muted=!0;let t=e.play();t&&t.then(()=>{h=!0}).catch(()=>{e.muted=!0})}function w(){let e=window.AudioContext||window.webkitAudioContext;if(!e)return;let t=new e;p=t;let n=t.currentTime;[0,.6,1.35,2.2,3.1,4.4,5.25,6.7,8.1,9.35,10.9,12.1,13.8,15.1,16.4,17.2,18.1,19,19.7,20.4].forEach((e,r)=>{let i=.8,a=t.createBuffer(1,t.sampleRate*i,t.sampleRate),o=a.getChannelData(0);for(let e=0;e<o.length;e+=1)o[e]=(Math.random()*2-1)*(1-e/o.length)**2.2;let s=t.createBufferSource(),c=t.createBiquadFilter(),l=t.createGain();s.buffer=a,c.type=`lowpass`,c.frequency.setValueAtTime(180+r%4*145,n+e),l.gain.setValueAtTime(1e-4,n+e),l.gain.exponentialRampToValueAtTime(.32,n+e+.015),l.gain.exponentialRampToValueAtTime(1e-4,n+e+i),s.connect(c).connect(l).connect(t.destination),s.start(n+e);for(let r=0;r<5;r+=1){let r=t.createOscillator(),i=t.createGain(),a=n+e+.08+Math.random()*.64;r.type=`square`,r.frequency.setValueAtTime(900+Math.random()*1700,a),i.gain.setValueAtTime(.06,a),i.gain.exponentialRampToValueAtTime(1e-4,a+.035),r.connect(i).connect(t.destination),r.start(a),r.stop(a+.04)}}),window.setTimeout(()=>{p===t&&(p=null),t.close()},a)}function T(){if(document.visibilityState!==`visible`)return;S();let e=x();e.loop=!1,e.currentTime=0,e.muted=!1,e.volume=.95,f=e;let t=e.play();t&&t.then(()=>{h=!0}).catch(()=>{f===e&&(f=null,w())}),g=window.setTimeout(S,a)}function E({name:e,onClose:t,eyebrow:n=`YOU POWERED THE SHOW`,signoff:o=`WITH GRATITUDE FROM GLEN, JENNIFER & TBX`}){let s=(0,r.useRef)(null);return(0,r.useEffect)(()=>{let e=s.current,n=e?.getContext(`2d`);if(!e||!n)return;let r=window.matchMedia(`(prefers-reduced-motion: reduce)`).matches,i=window.innerWidth,o=window.innerHeight,c=0,l=0,u=250,d=[],f=[`#f2d58a`,`#d7ad55`,`#fff4d2`,`#b11f2d`,`#ff5361`],p=()=>{i=window.innerWidth,o=window.innerHeight,e.width=i*devicePixelRatio,e.height=o*devicePixelRatio,e.style.width=`${i}px`,e.style.height=`${o}px`,n.setTransform(devicePixelRatio,0,0,devicePixelRatio,0,0)},m=(e=i*(.12+Math.random()*.76),t=o*(.08+Math.random()*.52))=>{let n=r?18:72,a=f[Math.floor(Math.random()*f.length)];for(let r=0;r<n;r+=1){let i=Math.PI*2*r/n+Math.random()*.08,o=1.8+Math.random()*6.6;d.push({x:e,y:t,vx:Math.cos(i)*o,vy:Math.sin(i)*o,life:0,maxLife:56+Math.random()*52,color:Math.random()>.22?a:`#ffffff`,size:1+Math.random()*2.7})}};p(),m(i*.22,o*.3),m(i*.78,o*.27);let h=e=>{l||=e;let s=e-l;n.fillStyle=`rgba(2, 2, 2, .17)`,n.fillRect(0,0,i,o),!r&&s>=u&&s<a-350&&(m(),s>a-4300&&Math.random()>.35&&m(),u+=s>a-4300?170+Math.random()*100:360+Math.random()*260),d.forEach(e=>{e.life+=1,e.x+=e.vx,e.y+=e.vy,e.vy+=.055,e.vx*=.994;let t=Math.max(0,1-e.life/e.maxLife);n.globalAlpha=t,n.fillStyle=e.color,n.beginPath(),n.arc(e.x,e.y,e.size*t+.2,0,Math.PI*2),n.fill()}),n.globalAlpha=1;for(let e=d.length-1;e>=0;--e)d[e].life>=d[e].maxLife&&d.splice(e,1);s<a?c=requestAnimationFrame(h):t()};return c=requestAnimationFrame(h),window.addEventListener(`resize`,p),()=>{cancelAnimationFrame(c),window.removeEventListener(`resize`,p)}},[t]),(0,i.jsxs)(`div`,{className:`fireworks`,role:`dialog`,"aria-modal":`true`,"aria-label":`Thank you ${e}`,children:[(0,i.jsx)(`canvas`,{ref:s,"aria-hidden":`true`}),(0,i.jsxs)(`div`,{className:`fireworks-copy`,children:[(0,i.jsx)(`img`,{src:`/assets/tbx-globe-logo.png`,alt:``}),(0,i.jsx)(`p`,{children:n}),(0,i.jsxs)(`h2`,{children:[`THANK YOU,`,(0,i.jsx)(`br`,{}),(0,i.jsx)(`strong`,{children:e})]}),(0,i.jsx)(`span`,{children:o}),(0,i.jsx)(`small`,{className:`fireworks-status`,children:`TBX FIREWORKS SPECTACULAR · 22 SECONDS`})]}),(0,i.jsx)(`div`,{className:`fireworks-progress`,"aria-hidden":`true`,children:(0,i.jsx)(`i`,{})}),(0,i.jsx)(`button`,{onClick:t,"aria-label":`Close celebration`,children:`×`})]})}function D({className:e,children:t,ariaLabel:n}){return(0,i.jsx)(`a`,{className:e,href:`/afterparty?power=1#power`,"aria-label":n,onClick:e=>{e.preventDefault(),window.dispatchEvent(new Event(c))},children:t})}function O({paypalClientId:e,campaign:t=`show`}){let[n,a]=(0,r.useState)(!1),[s,d]=(0,r.useState)(`intro`),[f,p]=(0,r.useState)(``),[m,h]=(0,r.useState)(``),[g,_]=(0,r.useState)(`25`),[w,D]=(0,r.useState)(``),[O,k]=(0,r.useState)(null),[A,j]=(0,r.useState)(``),[M,N]=(0,r.useState)(``),P=t===`gas-money`,F=(0,r.useCallback)(()=>{S(),N(``)},[]);(0,r.useEffect)(()=>{let e=window.localStorage.getItem(o);e&&p(e),x().load();let t=()=>{let e=window.localStorage.getItem(o);e&&p(e),C(),D(``),a(!0)};return window.addEventListener(c,t),()=>{window.removeEventListener(c,t)}},[]),(0,r.useEffect)(()=>
1{if(!n||s!==`checkout`||!A||!O||!e)return;let t=!1,r=document.getElementById(`main-paypal-button-container`);if(r)return r.replaceChildren(),v(e).then(e=>{if(!t)return e.Buttons({style:{layout:`vertical`,shape:`rect`,color:`gold`,label:`paypal`,height:48},createOrder:(e,t)=>t.order.create({purchase_units:[{description:P?`Gas Money — TBX On the Road: Homeward to the Ozarks`:`Power the Show — TBX Unfiltered`,custom_id:A,amount:{currency_code:`USD`,value:O.amount.toFixed(2)}}],application_context:{brand_name:`TBX Unfiltered`,shipping_preference:`NO_SHIPPING`}}),onApprove:async(e,t)=>{let n=(await t.order.capture()).purchase_units?.flatMap(e=>e.payments?.captures||[]).find(e=>e.status===`COMPLETED`);if(!n?.id)throw Error(`PayPal did not confirm the completed payment.`);b(`paypal:${n.id}`),j(``),d(`intro`),a(!1),k(null),T(),N(O.supporterName)},onCancel:()=>{D(`PayPal checkout was canceled. Nothing was charged.`),d(`intro`),j(``),k(null)},onError:()=>{D(`PayPal checkout could not finish. Please try again.`),d(`intro`),j(``),k(null)}}).render(r)}).catch(e=>{t||(D(e instanceof Error?e.message:`PayPal checkout could not be loaded.`),d(`intro`),j(``),k(null))}),()=>{t=!0}},[A,P,n,e,O,s]);async function I(){let t=f.replace(/\s+/g,` `).trim(),n=m.replace(/\s+/g,` `).trim(),r=Number(g);if(t.length<2||t.length>40){D(`Add the name you want TBX to celebrate.`);return}if(!Number.isFinite(r)||r<1||r>1e5){D(`Enter a contribution between $1 and $100,000.`);return}if(D(``),P){let e={supporterName:t,message:n,amount:r};window.localStorage.setItem(o,t),window.sessionStorage.setItem(u,`1`),k(e),d(`return`),window.open(l,`_blank`,`noopener,noreferrer`);return}if(!e){D(`PayPal checkout is being connected. Please try again shortly.`);return}try{let e=await y(await fetch(`/api/afterparty/paypal/pending`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({supporterName:t,message:n,amount:r})})),i={supporterName:t,message:n,amount:Number(e.amount)};window.localStorage.setItem(o,t),k(i),j(e.token),d(`checkout`)}catch(e){D(e instanceof Error?e.message:`PayPal checkout could not be prepared.`)}}function L(){let e=f.trim()||`TBX VIEWER`;T(),a(!1),N(e)}return(0,i.jsxs)(i.Fragment,{children:[n&&(0,i.jsx)(`div`,{className:`main-power-backdrop`,onMouseDown:e=>e.target===e.currentTarget&&a(!1),children:(0,i.jsxs)(`section`,{className:`main-power-modal`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`main-power-title`,children:[(0,i.jsx)(`button`,{className:`main-power-close`,onClick:()=>a(!1),"aria-label":`Close`,children:`×`}),(0,i.jsxs)(`div`,{className:`main-power-brand`,children:[(0,i.jsx)(`img`,{src:`/assets/tbx-globe-logo.png`,alt:``}),(0,i.jsx)(`p`,{children:P?`ROAD TRIP FUEL`:`VIEWER POWERED`})]}),s===`intro`?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(`h2`,{id:`main-power-title`,children:P?(0,i.jsxs)(i.Fragment,{children:[`Fill the tank.`,(0,i.jsx)(`br`,{}),(0,i.jsx)(`em`,{children:`Light the sky.`})]}):(0,i.jsxs)(i.Fragment,{children:[`Power the show.`,(0,i.jsx)(`br`,{}),(0,i.jsx)(`em`,{children:`Light up TBX.`})]})}),(0,i.jsx)(`p`,{children:P?`Send any amount of Gas Money through secure PayPal checkout. Every completed contribution launches the huge TBX fireworks display here and posts a verified shout-out in the Afterparty.`:`Complete PayPal checkout here. Your fireworks launch on this page and your verified contribution appears automatically in the Afterparty chat.`}),(0,i.jsxs)(`label`,{children:[`Name for the fireworks`,(0,i.jsx)(`input`,{value:f,onChange:e=>p(e.target.value),maxLength:40,placeholder:`Your name or family name`,autoFocus:!0})]}),(0,i.jsxs)(`label`,{children:[P?`Gas Money amount (USD)`:`Contribution amount (USD)`,(0,i.jsx)(`input`,{value:g,onChange:e=>_(e.target.value),type:`number`,inputMode:`decimal`,min:`1`,max:`100000`,step:`0.01`,placeholder:`25.00`})]}),(0,i.jsxs)(`label`,{children:[`Message `,(0,i.jsx)(`small`,{children:`optional`}),(0,i.jsx)(`textarea`,{value:m,onChange:e=>h(e.target.value),maxLength:180,rows:3,placeholder:P?`A road note for Glen and Jennifer`:`A short note for TBX`})]}),w&&(0,i.jsx)(`p`,{className:`main-power-error`,role:`alert`,children:w}),(0,i.jsxs)(`button`,{className:`main-power-primary`,onClick:I,children:[`Continue to secure PayPal `,(0,i.jsx)(`span`,{children:`↗`})]}),(0,i.jsx)(`button`,{className:`main-power-preview`,onClick:L,children:`Preview the fireworks`})]}):s===`return`?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(`h2`,{id:`main-power-title`,children:[`Welcome back.`,(0,i.jsx)(`br`,{}),(0,i.jsx)(`em`,{children:`Ready for fireworks?`})]}),(0,i.jsx)(`p`,{children:`After completing your Gas Money payment on the custom TBX PayPal page, return here and launch your thank-you celebration.`}),(0,i.jsxs)(`div`,{className:`main-power-summary`,children:[(0,i.jsx)(`small`,{children:`GAS MONEY`}),(0,i.jsx)(`strong`,{children:O?.supporterName}),(0,i.jsx)(`span`,{children:`✓ Custom TBX PayPal page`})]}),(0,i.jsxs)(`button`,{className:`main-power-primary`,onClick:()=>{window.sessionStorage.removeItem(u),a(!1),T(),N(O?.supporterName||f||`TBX VIEWER`),k(null),d(`intro`)},children:[`I completed PayPal — launch fireworks `,(0,i.jsx)(`span`,{children:`✦`})]}),(0,i.jsx)(`button`,{className:`main-power-preview`,onClick:()=>d(`intro`),children:`Go back`})]}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(`h2`,{id:`main-power-title`,children:[`Finish securely`,(0,i.jsx)(`br`,{}),(0,i.jsx)(`em`,{children:`with PayPal.`})]}),(0,i.jsx)(`p`,{children:P?`Once PayPal confirms your Gas Money, the full fireworks spectacular launches here and 
1your verified road-trip shout-out posts automatically.`:`Once PayPal confirms the payment, the full fireworks spectacular launches here and the verified chat shout-out posts automatically.`}),(0,i.jsxs)(`div`,{className:`main-power-summary`,children:[(0,i.jsx)(`small`,{children:P?`GAS MONEY`:`POWER THE SHOW`}),(0,i.jsxs)(`strong`,{children:[O?.supporterName,(0,i.jsx)(`br`,{}),`$`,O?.amount.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})]}),(0,i.jsx)(`span`,{children:`✓ Automatic verified shout-out`})]}),w&&(0,i.jsx)(`p`,{className:`main-power-error`,role:`alert`,children:w}),(0,i.jsx)(`div`,{id:`main-paypal-button-container`,className:`main-paypal-button-container`,"aria-label":`Secure PayPal checkout`}),(0,i.jsx)(`button`,{className:`main-power-preview`,onClick:()=>{d(`intro`),j(``),k(null)},children:`Change amount or message`})]})]})}),M&&(0,i.jsx)(E,{name:M,onClose:F,eyebrow:P?`YOU FUELED THE ROAD`:void 0,signoff:P?`WITH GRATITUDE FROM GLEN, JENNIFER & THE TBX FIELD UNIT`:void 0})]})}export{D as MainPowerButton,O as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.