This article was featured in One Great Story, New York’s reading recommendation newsletter. Sign up here to get it nightly.
(This piece, and our package on Elon Musk, was originally published in August 2022. On October 27, Musk completed the acquisition of Twitter hours before a court deadline that would have required him to go to trial over the purchase. He immediately fired several top executives and tweeted “the bird is freed.”)
In January 2018, Tesla announced details of a new contract with its CEO, Elon Musk, that sounded less like an executive-compensation package and more like the premise of a game show. Under the deal, Musk would take no salary but could earn large bundles of stock options each time he raised the company’s value by $50 billion. If it went up by a mere $49,999,999,999, he would leave empty-handed.
The contract’s top prize could be unlocked only if the company’s market cap hit $650 billion by 2028, a 13-fold increase. Tesla was bleeding so much money — it was among the most shorted stocks on Wall Street — that growing its value that significantly in a decade, or ever, seemed hopeless. The New York Times’ Andrew Ross Sorkin described the feat as “laughably impossible.” And then, in December 2020, with seven years to spare, Tesla’s value blew past the target, lifting Musk’s personal net worth to $185 billion and making him the richest person on the planet.
There were lots of reasons for Tesla’s rise, many of them concrete. The company announced it would open new factories in Austin and Berlin. It reported four consecutive profitable quarters for the first time and was invited to join the S&P 500. It grew production to build half a million cars in one year and dominated the U.S. market for battery-powered electric vehicles. It was a pioneering company with incredible potential. Yet the single biggest accelerant — a factor that, today, explains why an industrialist memelord is the dominant figure in American business and culture — was probably Musk’s tweets.
Right after his new contract took effect, Musk started tweeting a lot. He had always been prolific, but this was the point where he went from, by one count, 197 tweets per month (December 2017) to 384 (May 2018), posting Baby Yoda memes and self-produced rap songs, calling a diver who had courageously helped rescue children from a cave a “pedo guy,” and announcing bogus plans to take Tesla private at $420 a share. And then, emboldened by his victory in the defamation lawsuit over his pedo-guy tweet and his light punishment from the Securities and Exchange Commission over his $420 tweet, Musk tweeted even more — 446 times in July 2020.
Whether Musk was making dubious claims about his company’s production capabilities (“1000 solar roofs/week by end of this year”), applying reverse psychology (“Tesla stock price is too high imo”), or hyping other meme stocks on the side (“Gamestonk!!”), Tesla’s stock went up — first by a little and then, during the pandemic, by a lot. His followers spent their stimulus checks on Tesla shares, then they discovered the options market, magnifying the gains. In late 2021, Musk’s net worth touched $315 billion, prompting Forbes to declare him the richest person who had ever lived.
It’s hard to fathom how somebody could make more money faster than anyone ever has by tweeting, yet that’s pretty much what happened: A carrot was dangled, and Musk, likely figuring he would never reach it on the basis of such old-fashioned metrics as quarterly earnings, yoked Tesla’s stock to his Twitter feed and went goblin mode. A little like when Neo from The Matrix realized that reality was a mirage and therefore he could do kung fu without any lessons, Musk intuited the illusory nature of the stock market and social media and ran up a new all-time-high score. If Tesla might have been a $300 billion company under a generic Silicon Valley CEO, it was a $1.2 trillion company with the guy who turned it into a product cult.
He had always been sui generis, but this is when he became the Elon Musk we know today — a master of atoms, bits, and bullshit who begs our awe, skepticism, and irritation in ever-shifting proportions and whose record-breaking fortune may be only the tenth-most-interesting thing about him. Musk puts a reported 80-plus hours a week into running two major companies, Tesla and SpaceX, with time left over for side projects in tunneling (the Boring Company) and brain implants (Neuralink) — and somehow even more time to host Saturday Night Live, suntan with Ari Emanuel, and spend entire afternoons explaining orbital physics and the limbic system to Joe Rogan. It’s no wonder Musk thinks we live in a simulation, because he definitely lives in one where the normal rules of the universe seem to hold less authority: Newton’s laws, financial regulations, mores of business and celebrity, and soon, he hopes, the legally binding terms of his purchase agreement with Twitter.
In April, Musk made an unsolicited $44 billion bid for his favorite social network. It looked like bad business; the company had lost money for eight of the past ten years. Musk insisted he wasn’t seeking a profit but rather to save what he called the internet’s “de facto town square” from partisan content moderators. “Having a public platform that is maximally trusted and broadly inclusive is extremely important to the future of civilization,” he said. “I don’t care about the economics at all.” But he cared about the economics somewhat when, amid a broader stock slide, Twitter’s value sank by almost a third from what Musk had agreed to pay for it. He then said the sale was “temporarily on hold” and accused the company of misleading him over the number of bots and spam accounts on the platform — though, he hinted, he might be willing to tolerate those extra bots at a discounted price. Twitter declined to bargain, and in July, Musk attempted to terminate his offer. (One theory is that Musk had always intended to bail on the deal and was using it only as cover to sell $8.5 billion of Tesla stock.)
Twitter sued to force Musk to follow through on the transaction, and a Delaware Chancery Court judge has scheduled an October trial. If Musk wins, it may prove he has reached escape velocity from all rules and laws; it’ll also probably decimate Twitter’s stock and leave the company exposed to another hostile takeover, assuming it isn’t incinerated by shareholder litigation first. If Musk loses, he’ll get the cosmic comeuppance of being judicially compelled to buy the stupidest company in the world at something like a $14 billion markup. Whatever the outcome, the Curb Your Enthusiasm tubaist waits in the wings.
Musk has played the troll so convincingly that it’s easy to forget he isn’t just one. Consider his offline skill set, an array of talents heretofore unimaginable outside Walter Isaacson’s most depraved fantasies. Musk’s formal education ended with bachelor’s degrees in physics and economics from the University of Pennsylvania, but his self-taught expertise spans aeronautics, solar energy, artificial intelligence, and other fields. People he has worked with say he combines the abilities of a venture capitalist who can spot and manifest funding for far-off opportunities (such as the potential to power a car with lithium-ion batteries or make cheap rockets that can be launched more than once), an engineer who can help clear the practical hurdles to those opportunities (like designing the body of an automobile or stress-testing rocketry components), a systems savant who can align complex organizational processes (as in vertically integrating supply chains so that many of Tesla’s and SpaceX’s parts are made in-house), and a leader whose warped charisma can push employees through difficult deadlines. (Musk is said to have motivated, or possibly just frightened, Tesla workers during the production of the company’s Model 3 by sleeping nights on the factory floor.)
To whom could you even compare this Musk? He makes internet moguls such as Mark Zuckerberg and the Google guys look like dilettantes and their products like glorified spyware. He has been called an heir to Steve Jobs, but while Jobs might have talked about putting a “dent in the universe,” Musk is actually operating at the level of interplanetary ambition. Attempting to buy Twitter as a gag and then getting pantsed in front of the entire contract-abiding world may not engender much faith in his farthest-fetched plans to spread humanity across the cosmos. But while everybody’s laughing, his car and rocket companies are on track to keep thriving into 2023 and beyond.
Tesla is the most valuable automaker in the world even though it sells only a fraction as many cars as most of its rivals. In the second quarter of 2022, it doubled profits over the same period in 2021, which is remarkable in itself but more so given COVID-related factory shutdowns and Musk’s copious personal distractions. Coming next year (maybe) is Tesla’s second-generation Roadster, and if it ships as Musk has promised, it will be among the fastest electric cars ever made, with a top speed of over 250 mph, and the fastest-accelerating cars of any kind, able to do zero to 60 in just 1.9 seconds. SpaceX’s prospects may be even greater. The company has reduced the cost to send cargo into orbit by a factor of 20. One of its rockets, Starship, the tallest and most powerful ever built, is theoretically capable of hauling more than 100 metric tons. If Musk’s engineers can figure out how to get the prototypes to stop exploding on takeoff and landing, the Starship may someday be able to transport 100 people to the moon or Mars, then, because it’s fully reusable, flip over and blast off to Earth again. Musk has said the Starship could eventually fly for as little as $2 million per launch, which would make its cost per kilogram of payload something on the order of overnighting an envelope from Manhattan to Brooklyn.
Or maybe none of that will happen, because Musk can be an appallingly bad estimator. As his biographer Ashlee Vance has noted, engineers at one of Musk’s early start-ups learned that if he anticipated a coding task would take an hour, it would usually take two or three days, and if he thought it would take a day, it might take a couple of weeks. He has bumped the ETA for SpaceX’s first manned rocket to Mars from 2026 to 2029. He predicted that Neuralink would test its brain interface in humans by 2020; now he says by the end of 2022. In May, he said that Tesla’s self-driving Autopilot feature would eliminate the need for human drivers by next year, which is similar to claims he has made every year since at least 2014.
Still, Musk has delivered on enough laughably impossible goals that those who doubt him do so at their own risk. He seems pathologically bent on silencing critics — either by succeeding or making them sign NDAs — and he might have been designed in a lab to carry long-term grudges as motivation. He says he was bullied as a kid in Pretoria, South Africa, and once got a nose job to reopen his airways after he was beaten up and thrown down a flight of stairs. He’s estranged from his father, a person he has called “a terrible human being.” He was ousted as CEO at his first two companies — Zip2, a maker of city-guide software for newspapers that sold to Compaq for some $300 million in 1999, and X.com, which became PayPal and was sold to eBay for $1.5 billion in 2002 — so he put his own money into Tesla and SpaceX, making him harder to get rid of. Tesla’s entire 2018–21 stock run might in part have been his revenge on the short sellers that once targeted the company, including Bill Gates, who Musk alleges still hasn’t closed a multibillion-dollar short position. And to Musk’s credit, his original visions for Zip2 and PayPal, both overruled at the time, were at least partially vindicated later. He’d wanted to turn Zip2 into a consumer hub for maps and local-business reviews years before the launch of Yelp and Google Maps. And he reportedly thought PayPal should have held out for a better acquisition offer; it’s currently worth around $100 billion.
The question is whether Musk’s attempted jilting of Twitter is just one more sideshow on a general path to business glory or evidence that he’s immolating like one of those Starship prototypes. So far, his 2022 has included multiple accusations of racial discrimination from employees; a resurfaced sexual-harassment allegation from a SpaceX flight attendant; the recall of nearly 600,000 Tesla vehicles; animal-cruelty complaints against Neuralink; the discovery of three publicly unacknowledged children; and a Wall Street Journalclaim that he had an affair with Sergey Brin’s estranged wife, Nicole Shanahan, that led to the Google co-founder filing for divorce. (Tesla denies the racial discrimination, Neuralink disputes the animal cruelty, and as for the affair: A lawyer for Shanahan denies it, as does Musk. “Haven’t even had sex in ages [sigh],” he posted.) None of these scandals hung around for long enough to inflict much damage in part because he tweeted right through them, creating an endless diversion.
Lately, there seems to be something purposeful about how Musk tweets the news, muscling his way into trending topics like a one-man bot farm. A tag cloud for one of his slower weeks may include climate, COVID, free speech, the 2024 election, abortion, gun control, the Russia-Ukraine war, UFOs, crypto, Elden Ring, the Johnny Depp–Amber Heard trial, and more. He has spread himself through every cultural jurisdiction so that he’s always the top story no matter which news bubble you’re in. Some billionaires own magazines and newspapers, but Musk may have built something bigger, a decentralized media empire that amplifies his every utterance into a blizzard of commentary and clickbait so that all praise, honest criticism, and exasperated overreach cancel one another out and he can wear our exhaustion like armor.
Once, during the post-dot-com innovation drought that spawned it, Twitter was the soft and ridiculous antithesis of everything that Musk, a maker of hard and serious tech, stood for. “We wanted flying cars,” went the motto of his PayPal co-founder Peter Thiel’s VC firm. “Instead we got 140 characters.” Now it’s existentially important to everything Musk does — and thanks to him, its own future has never been bleaker.
Musk’s Twitter imbroglio recalls one of his earliest vanity purchases. When Zip2 was acquired, he celebrated his first major payday by dropping $1 million on a McLaren F1, then the world’s fastest car. One afternoon, he was driving in Silicon Valley with Thiel, who asked, “So what can this do?” “Watch this,” said Musk as he stomped on the accelerator. The car hit an embankment, jumped three feet in the air, spun around, and touched down, its body and suspension totaled. “You know, I had read all these stories about people who made money and bought sports cars and crashed them,” Musk reportedly told Thiel. “But I knew it would never happen to me, so I didn’t get any insurance.” And then he climbed out of the wreck without a scratch on him.
By submitting your email, you agree to our
Terms and Privacy Notice
and to receive email correspondence from us. This site is protected by reCAPTCHA and the Google
Privacy Policy and
Terms of Service apply.
or
Already a subscriber?
What is your email?
This email will be used to sign into all New York sites. By submitting your email, you agree to our Terms and Privacy Policy and to receive email correspondence from us.
Password must be at least 8 characters and contain:
Lower case letters (a-z)
Upper case letters (A-Z)
Numbers (0-9)
Special Characters (!@#$%^&*)
This password will be used to sign into all New York sites. By submitting your email, you agree to our Terms and Privacy Policy and to receive email correspondence from us.
You’re in!
As part of your account, you’ll receive occasional updates and offers from New York, which you can opt out of anytime.
or
Already a subscriber?
What is your email?
This email will be used to sign into all New York sites. By submitting your email, you agree to our Terms and Privacy Policy and to receive email correspondence from us.
Password must be at least 8 characters and contain:
Lower case letters (a-z)
Upper case letters (A-Z)
Numbers (0-9)
Special Characters (!@#$%^&*)
This password will be used to sign into all New York sites. By submitting your email, you agree to our Terms and Privacy Policy and to receive email correspondence from us.
You’re in!
As part of your account, you’ll receive occasional updates and offers from New York, which you can opt out of anytime.
Already a subscriber?
Already a subscriber?
`;
// integrate Sub(x) scripts and elements
if (hostname !== 'subs.nymag.com') { // do not integrate on this subdomain
document.head.appendChild(trackingScript);
document.body.insertAdjacentHTML('beforeend', subXAnimationElements);
}
There was an error processing the request. Please try again later."}).catch(e=>console.error("Error verifying email: ",e)))(r.querySelector(".content"),o.bannerCTAVerification)})):(l.remove(),s.remove()),o.dismissable||n.remove(),o.useAlertIcon||a.remove(),r.classList.add("show"),n.addEventListener("click",()=>{u(),r.classList.remove("show")})}else r.remove()}});
}, {"1":1,"6":6,"12":12,"35":35,"40":40}];
window.modules["global-nav.client"] = [function(require,module,exports){"use strict";const dom=require(3),auth=require(12),signInButton=dom.find(".user-signin"),signOutButton=dom.find(".user-signout"),globalNav=dom.find('[class^="global-nav"]'),body=dom.find("body"),dropdownItems=dom.findAll(".dropdown-wrap"),gtm=require(1),appendLandingPageParams=require(136),pageUri=require(124).getPageUri(),subscriptionPromoLinks=dom.findAll(".persist-params"),searchString=window.location.search||"";function closeDropdowns(e){let n=globalNav.querySelectorAll(".dropdown.open");dropdownItems.forEach(function(t){let o=t.querySelector(".dropdown");!n||t.contains(e.target)&&27!==e.keyCode||o.classList.remove("open")})}function gtmSendReport(e,n,t){let o={eventCategory:"ecommerce",eventAction:"componentClick",brand:e,dimension23:"global-nav",list:pageUri,pageZone:"header",variant:"nav-link"};"global-nav-link"===t&&(o.eventLabel=n.href),gtm.reportNow(o)}function updateElementTargetUrlsIfQueryStrings(e){if(searchString){const n=new URLSearchParams(searchString);let t=e.href;if(t.includes("?")){const o=t.split("?"),i=new URLSearchParams(o[1]);for(let e of n.entries())i.set(e[0],e[1]);t=`${o[0]}?${i.toString()}`,e.href=t}else e.href=`${t}?${n.toString()}`}}function init(e){const n=e.querySelectorAll(".to-landing-page");window.addEventListener("auth:init",()=>{signInButton.addEventListener("click",function(e){e.preventDefault(),auth.showEmbeddedLoginFlow("top navigation")}),signOutButton.addEventListener("click",function(e){e.preventDefault(),gtmSendReport("Sign Out",e.target,"user-info-link"),auth.logout()}),auth.isAuthenticated()&&e.classList.add("signed-in"),auth.isSubscriber()&&e.classList.add("subscribed"),e.querySelectorAll(".user-link").forEach(e=>{e.classList.add("active")}),subscriptionPromoLinks.forEach(e=>{updateElementTargetUrlsIfQueryStrings(e)}),appendLandingPageParams(n)})}dropdownItems.forEach(function(e){e.addEventListener("click",function(){e.querySelector(".dropdown").classList.toggle("open")})}),body.addEventListener("click",closeDropdowns),document.addEventListener("keydown",closeDropdowns),globalNav.addEventListener("click",function(e){let n=e.target;n.classList.contains("global-nav-track")&>mSendReport(n.text,n,"global-nav-link")}),module.exports=init;
}, {"1":1,"3":3,"12":12,"124":124,"136":136}];
window.modules["aaa-module-mounting.legacy"] = [function(require,module,exports){"use strict";const _pickBy=require(221),_each=require(408),Fingerprint2=require(407),DS=require(406),Eventify=require(246);function registerGlobals(){window.DS=DS,window.Eventify=Eventify,window.Fingerprint2=Fingerprint2,DS.value("Eventify",Eventify),DS.value("Fingerprint2",Fingerprint2),DS.value("$document",window.document),DS.value("$window",window)}function mountDollarSliceComponents(){DS.service("components",["$document","$module",function(e,n){var o=_pickBy(n.definitions,e=>e.providerStrategy===n.providers.controller),r=Object.keys(o);function t(e){return o=>{try{n.get(e,o)}catch(e){logMountError(o,e)}}}_each(r,n=>{var o=e.querySelectorAll('[data-uri*="/_components/'+n+'/"]'),r=e.querySelectorAll('[data-uri$="/_components/'+n+'"]');_each(o,t(n)),_each(r,t(n))}),this.components=r}]),DS.get("components")}function logMountError(e,n){const o=e.outerHTML.slice(0,e.outerHTML.indexOf(e.innerHTML));console.error("Error attaching controller to "+o,n)}registerGlobals(),"loading"===document.readyState?document.addEventListener("DOMContentLoaded",()=>{mountDollarSliceComponents()}):mountDollarSliceComponents();
}, {"221":221,"246":246,"406":406,"407":407,"408":408}];
window.modules["ads.legacy"] = [function(require,module,exports){"use strict";const _map=require(118),_forEach=require(107),_isString=require(268),_intersectionWith=require(409),_isEqual=require(274),_each=require(408),_debounce=require(182),_sortBy=require(205),page=require(124),visit=require(114);DS.service("adService",["Eventify","$cid","$document","$window",function(e,t,a,i){var o,n,s,r,d,c,u,l,g={},p=this,h=[],f=visit.getQueryParamsObject(["utm_campaign"]),m=document.querySelector('script[data-type="ad-a9"]'),b=[],w=!1,v=[],y=document.querySelector('script[data-name="ad-doubleverify"]');document.querySelector('script[data-name="concert-ads"]')||(i.NYM={},i.NYM.analytics={},i.NYM.analytics.adStartTime=i.performance.now(),i.googletag=i.googletag||{},i.googletag.cmd=i.googletag.cmd||[],u=i.googletag,(m||y)&&(i.googletag.cmd=i.googletag.cmd||[],i.googletag.cmd.push(function(){i.googletag.pubads().disableInitialLoad()})),m&&(l=i.setInterval(function(){void 0!==window.apstag&&void 0!==window.apstag.timeout&&(i.clearInterval(l),window.apstag.cleared=!0,l=null)},10),setTimeout(function(){l&&(i.clearInterval(l),i.googletag.pubads().refresh(),window.apstag||console.log("MESSAGE: Timeout for A9 load exceeded, aborting"))},500)),y&&(b.push(new Promise(function(e){w?e():v.push(e)})),c=i.setTimeout(T,2500)),o=function(e){var t,a,o=e.data,n=[];return o.loaded?e:(o.loaded=!0,t=null,(t=o.sizes?u.defineSlot(o.name,o.sizes,o.id).addService(u.pubads()):u.defineOutOfPageSlot(o.name,o.id).addService(u.pubads())).setTargeting("adid",o.id),f.hasOwnProperty("utm_campaign")&&t.setTargeting("utmcamp",f.utm_campaign),a=p.getAdCount(o.label),t.setTargeting("label",o.label+"_"+o.site+"-"+a),u.display(o.id),u.pubads().addEventListener("slotOnload",function(){i.NYM.analytics.firstAdLoadTime||(i.NYM.analytics.firstAdLoadTime=i.performance.now(),i.NYM.analytics.firstAdLoadLabel=e.data.label)}),n=_(o),Promise.all(b).then(function(){n?window.apstag&&window.apstag.cleared?window.apstag.fetchBids({slots:[n],timeout:window.apstag.timeout},function(){u.cmd.push(function(){window.apstag.setDisplayBids(),u.pubads().refresh([t],{changeCorrelator:!1})})}):y&&u.pubads().refresh([t],{changeCorrelator:!1}):u.pubads().refresh([t],{changeCorrelator:!1})}),e.slot=t,e)},n=function(e){var a,i,o,n=t(),s=e.getAttribute("data-name"),r=e.getAttribute("data-sizes"),d=e.getAttribute("data-label"),c=e.getAttribute("data-site");n=e.id,r&&r.length?(r=r.split(","),a=[],_map(r,function(e){e=e.split("x"),i=parseInt(e[0]),o=parseInt(e[1]),a.push([i,o])})):(e.classList.add("oop"),a=!1),this.data={id:n,name:s,sizes:a,loaded:!1,label:d,site:c},g[n]=this},r=function(e){u.cmd.push(function(){var t=o(e);g[e.data.id]=t})},s=function(e){var t=[];e.slot?(t=_(e))&&window.apstag&&window.apstag.cleared&&window.apstag.fetchBids({slots:[t],timeout:window.apstag.timeout},function(){u.cmd.push(function(){window.apstag.setDisplayBids(),u.pubads().refresh([e.slot],{changeCorrelator:!1})})}):e&&r(e)},u.cmd.push(function(){var e,t,o,n=page.getMeta("article:tag"),s=page.getMeta("author"),r=i.location.href,d=(e=a.head.querySelector(".head-gtm"),t=a.body.querySelector(".gtm"),e&&"top"===e.getAttribute("data-gtm")?"gtmtop":t&&"bottom"===t.getAttribute("data-gtm")?"gtmbottom":"");o=[],_forEach([n,s,d],function(e){_forEach(e.split(","),function(e){(e=e.trim().toLowerCase().replace(/\s/g,"-").replace(/\'|\’/g,"")).length&&o.push(e)})}),u.pubads().setTargeting("kw",o),u.pubads().setTargeting("entry_group",o),r=r.slice(r.lastIndexOf("/")+1),u.pubads().setTargeting("pn",r),u.companionAds().setRefreshUnfilledSlots(!0),u.pubads().enableAsyncRendering(),u.enableServices()}),this.load=r,this.create=function(e){return new n(e)},this.refresh=function(e){var t;_isString(e)?(t=this.getById(e),s(t)):s(e)},this.remove=function(e){var t=e.data.id;a.getElementById(t).innerHTML=""},this.getAdCount=function(e){var t,a=0,i=Object.keys(g);return _each(i,function(i){(t=g[i]).data.loaded&&t.data.label===e&&a++}),a},this.getById=function(e){return g[e]},d=_debounce(function(){var e={TopLeaderboard:1,RightColTopMPU:2,outOfPage:99,"homepageTakeover/TopLeaderboard":1},t=_sortBy(h,function(t){return e[t.data.label]||10});_forEach(t,function(e){return e.data.sizes?r(e):i.setTimeout(function(){r(e)},2e3)}),y&&window.PQ.cmd.push(()=>{try{window.PQ.loadSignals(["ids","bsc","vlp"],T)}catch(e){T(),console.error(`There has been an error loading Double Verify signals: ${e}`)}}),h=[]},10),this.addToPageLoadQueue=function(e){h.push(e),d()});function _(e){var t,a=e.sizes;return a=_intersectionWith(a,[[970,250],[970,90],[728,90],[300,600],[300,250],[320,100],[320,50]],_isEqual),e.sizes&&e.sizes.length&&(t={slotID:e.id,sizes:a,slotName:e.label}),t}function T(){i.clearTimeout(c),w=!0,_forEach(v,function(e){e()})}}]);
}, {"107":107,"114":114,"118":118,"124":124,"182":182,"205":205,"268":268,"274":274,"408":408,"409":409}];
window.modules["cid.legacy"] = [function(require,module,exports){"use strict";DS.service("$cid",function(){var r=Math.floor(100*Math.random());return function(){return"cid-"+ ++r}});
}, {}];
window.modules["client.legacy"] = [function(require,module,exports){"use strict";require("cid.legacy"),require("ads.legacy"),require("facebook.legacy"),require("aaa-module-mounting.legacy");
}, {"cid.legacy":"cid.legacy","aaa-module-mounting.legacy":"aaa-module-mounting.legacy","ads.legacy":"ads.legacy","facebook.legacy":"facebook.legacy"}];
window.modules["facebook.legacy"] = [function(require,module,exports){"use strict";DS.service("facebook",[function(){this.fb=function(i){window.FB&&window.FB[i].apply(this,Array.prototype.slice.call(arguments,1))}}]);
}, {}];
require=(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o typeof key === 'string' && key.match(/\.legacy$/)).forEach(key => window.require(key));
}
function tryToMount(fn, el, name) {
try {
fn(el); // init the controller
} catch (e) {
const elementTag = el.outerHTML.slice(0, el.outerHTML.indexOf(el.innerHTML));
console.error(`Error initializing controller for "${name}" on "${elementTag}"`, e);
}
}
/**
* mount client.js component controllers
*/
function mountComponentModules() {
Object.keys(window.modules).filter(key => typeof key === 'string' && key.match(/\.client$/)).forEach(key => {
let controllerFn = window.require(key);
if (typeof controllerFn === 'function') {
const name = key.replace('.client', ''),
instancesSelector = `[data-uri*="_components/${name}/"]`,
defaultSelector = `[data-uri$="_components${name}"]`,
instances = document.querySelectorAll(instancesSelector),
defaults = document.querySelectorAll(defaultSelector);
for (let el of instances) {
tryToMount(controllerFn, el, name);
}
for (let el of defaults) {
tryToMount(controllerFn, el, name);
}
}
});
}
// Make sure that a `window.process.env.NODE_ENV` is available in the client for any dependencies,
// services, or components that could require it
// note: the `` value is swapped for the actual environment variable in /lib/cmd/compile/scripts.js
window.process = window.process || {};
window.process.env = window.process.env || {};
if (!window.process.env.NODE_ENV) {
window.process.env.NODE_ENV = '';
}
// note: legacy controllers that require legacy services (e.g. dollar-slice) must
// wait for DOMContentLoaded to initialize themselves, as the files themselves must be mounted first
mountLegacyServices();
mountComponentModules();
// ]]