As they stand over the body of dearly departed Joffrey, Tywin leads Tommen, the heretofore little-seen but newly crucial second son, in a catechism. Is it holiness, the little boy asks? Justice? Strength? None of the above, Grandpa Lannister claims, turning to the royal history of Westeros for evidence: It’s wisdom that makes a good king.
In this case, of course, “wisdom” really means “listening to your grandpa.” Tywin isn’t going to let a little thing like Joffrey’s death loosen his personal grip on the throne, and he doesn’t waste any time insinuating himself into Tommen’s kingship and subtly recasting the history of their dynasty. “Your brother was not a wise king. Your brother was not a good king,” Tywin says, while the camera lingers on Cersei’s expressionlessface. It may be Joffrey’s corpse there on that slab, but it’s Cersei’s body and spirit that is bearing the brunt of last week’s events. As Tywin and Tommen start having a birds-and-the-bees talk about why a king needs a queen, they walk away from her – underlining the irony, considering that no one seems to need Cersei, despite her frantic attempts to the contrary.
The wisest move a king can make is to keep his friends close and his enemies closer. So Tywin’s got no time for grief today: he’s too busy interrupting Oberyn and Ellaria’s fivesome and extending the Red Viper an olive branch in the form of the Mountain’s head. Tywin halfheartedly raises the possibility that Oberyn, who studied poison at the Citadel (where maesters are trained), was responsible for his grandson’s death. But really, he knows that he needs to secure the Martells’ support and, like the Tyrells, turn these old enemies into allies. Tywin says that Daenerys will soon turn her attention to Westeros, and that the Dornishmen were the only ones who managed to resist her ancestor, the conqueror Aegon Targaryen some 300 years ago. It also seems likely that he’s also trying to secure the safety of Myrcella, Tommen’s big sister and an increasingly close claimant to the Iron Throne, who’s currently a ward of the Martells in Dorne and betrothed to Oberyn’s nephew, the youngest son of the Dornish ruler. In exchange for helping finding Joffrey’s assassin and serving as one of three judges in Tyrion’s case (the other two being himself and Margaery’s father Mace, Tywin offers Oberyn a seat on the Small Council and help bringing the Mountain to justice for the rape and murder of his sister Elia and her children.
In “Breaker of Chains,” everyone is reassessing their relationships and trying to figure out who can be counted on. Am I the queen?, Margaery wonders. What about you, do you care for me?, Gilly asks Sam. Will you avenge our son?, Cersei implores Jaime.
There were occasional pleasant surprises. Tyrion, locked up on Cersei’s orders, gets a visit from Podrick. The squire not only brings him secret supplies, news of Sansa’s disappearance, and the names of his judges, but also some much-needed moral support. He tells Tyrion that he turned down a chance to be named Sir Podrick Payne in exchange for testifying that Tyrion bought a poison called “The Strangler.” His simple reason: “You’ve been good to me, my lord.” The rest of the scene plays out like a teary outtake from some alternate-world version of Old Yeller: There never lived a more loyal dog than you, Pod, but now you have to leave before my father puts you down.
Meanwhile, in the bower where Olenna seems to have taken up permanent residence, the grande dame is reassuring her granddaughter that, despite the fact that she’s been widowed once by a notorious pillow-biter and then a second time by a noxious psychopath, her status is still secure: The Lannisters, as distasteful as they are, need the Tyrells. Also, further cementing her reputation as the baddest bitch to ever rock a head-poof, Olenna tells Margaery, “You may not have enjoyed watching him die, but you enjoyed it more than you would have enjoyed being married to him.” The next one will be easier, she says. Who’ll be lucky Groom #3?
Other examples of relationship re-negotiation proved more fraught and complicated. Gilly seems happy plucking birds at Castle Black, flirting awkwardly with Big Sam and caring for Little Sam, and shoring up Big Sam’s ego when none of the other brothers believe that he killed a White Walker. But Sam worries that in taking Gilly from Craster’s Keep to Castle Black, he’s simply moved her to a new place where her virtue is in danger. So, just as Tyrion did with Shae, Sam sends her someplace he believes is safer – an apparent tavern-cum-brothel near the Wall, where he tells the proprietress that Gilly will cook and clean and take care of the children but is not to be given any “other work.” It’s an expression of love and care on Sam’s part, but not received as such by Gilly, who believes she’s being shunted aside.
Also in the questionable category: Davos proves his loyalty to Stannis in a potentially disastrous way by sending the Iron Bank of Braavos a letter in his liege’s name. With Joffrey dead, Stannis has a great opportunity to claim the throne but doesn’t even have enough men “to raid a pantry.” He shoots down Davos’s idea that they hire the sellswords known as the Golden Company, but the smuggler argues that it’s hypocritical to rely on blood magic to kill your enemies from afar and then turn your nose up at paying for military assistance. Soldiers on the ground win wars. “I will not become a page in someone else’s history book,” Stannis thunders – the history book that Tywin is already re-writing with Tommen. It’s almost permission to buy an army, and Davos takes it.
He gets Shireen’s help to pen the letter, which I can’t imagine will help the girls’ tenuous standing with her parents. Kerry Ingram, who plays Shireen, is so great in every scene she appears in, with those moony but shrewd eyes that seem to see so much, despite the girl’s limited frame of reference. (She and Tyrion are twinned in this episode – small people kept locked away by their families.) Ingram seems to bring out a natural, more relaxed energy in the male actors who share screen time with her: I loved the little celebratory moment where Liam Cunningham,as Davos, struggles to read the title of a history book and they both cheer when he succeeds. It reminded me of the time last season when Stannis visited her, and the charmingly skewed line readings Stephen Dillane gave in that scene. She’s a playful presence – you can imagine she might be Arya-like, given different circumstances. And who knew she was a Monty Python fan? Silly Westerosi kniggit.
Sam and Davos are both trying their best to do right by other people, in their own, fumbling ways. But there’s a whole category of people in Westeros for whom this concept would be foreign, laughable, or at the very least, expendable when inconvenient.
Arya and the Hound are grooving along in their odd-couple routine when they are discovered by the man who owns the land they’re on and the man’s daughter. Quick-thinking Arya apologizes for her “father’s” gruff behavior, which is a funny bit until you remember that two episodes ago she was more or less posing as his sex slave. She guesses the man’s affiliation correctly and says that her father fought for House Tully; the ruse works, and soon Arya and the Hound are eating, sloppily, at the man’s table as daughter Sally watches, silently.
The scene plays like a fable, or one of those ancient myths where a god comes to Earth in disguise and is taken in by a poor peasant. Three bonds are explicitly enacted between these parties. There is the bond of liegemen: Both “fathers” fought for the Tullys. There is the bond of hospitality, or “bread and salt”: The man and his daughter invite the two strangers in and feed them at their table. And there is the bond of employment: The man offers the two room and board if the Hound will help with the field work and scare off raiders. “Fair wages for fair work,” is the contract he offers, and the one the Hound accepts.
There are clues that this will not end well, of course. As the man offers blessings to each of the seven gods, the hangry Hound ends grace by snarling, “And we ask the Stranger not to kill us in our beds tonight for no damn reason at all.” And the man brings up the Red Wedding, the ultimate violation of hospitality vows. Arya wakes the next day to the sound of fighting and a girl’s scream. The Hound has left the man bleeding and taken his gold: his weakness renders their contract moot. “You’re the worst shit in the Seven Kingdoms,” Arya yells, but the Hound tells her that there are plenty worse than him; he just understands the way things are. “How many Starks they got to behead before you figure it out?” he asks as he clomps on.
You could ask the same of Arya’s big sister, Sansa. Sansa has plenty of cause to believe the worst in people, yet she still allows Ser Dontos to carry her away from the scene of Joffrey’s murder and bring her, under cover of night, to a mysterious ship that will supposedly be her salvation. But steering this ship is Petyr Baelish, whom we last saw sailing off to the Vale of Arryn to woo Sansa’s aunt, Lisa Arryn, after a creepy but unsuccessful campaign to smuggle Sansa out of King’s Landing and take her for his own. As Littlefinger assures Sansa that she’ll be safe with him, his words of comfort sound even more sinister and weaselly than did his confession in Season 2 that she reminds him of his great love, her mother Catelyn. Sansa’s now locked to Littlefinger. She can never go back to King’s Landing; who’ll ever believe that she wasn’t responsible for Joffrey’s death, now that she’s fled? And then Littlefinger has Dontos shot for his service, and shows Sansa that the necklace he gave her – supposedly a token of his dearly departed mother – was nothing more than a cut-glass fake he’d had made.
But what’s Dontos to him or he to Dontos? Littlefinger has little reason to be loyal to the fool, despite the bonds of their contract. In an episode full of betrayals, both real and perceived, this was a straightforward but unsurprising one. The one that caught me off-guard – and which I felt was strangely underplayed – was Jaime’s betrayal of Cersei.
In a show full of over-the-top narrative decisions, having a one-handed man rape his weeping twin sister next to the corpse of their illegitimate son rates pretty high. It drives home the point that Cersei really can’t rely on anyone – certainly not any man. And in an episode where men are continually maneuvering to either protect or avenge their women’s virtue (from the Tully man praying to the Maiden to protect his daughter, to Sam moving Gilly out of Castle Black, to Oberyn seeking justice for his sister’s rapist), it shows that even the highest-born women of Westeros don’t have sovereignty over their own bodies. But the scene didn’t make sense to me, from Jaime’s perspective. I understand that he’s been broken by his long journey and his disability, and hurt by his family’s coldness toward him – particularly Cersei’s – but this seemed like a crazily out-of-character move for the maturing, softening Jaime of the past few seasons. “Why have the gods made me love a hateful woman?” he grunts. (She was asking for it! Clearly!) The lack of a character grounding made this scene feel twice-perverse, and sad, to me. I know I’m in the minority in my empathy for Cersei, but she deserves a lot better.
Next week, the bonds established, re-established, or broken today may be tested, as the wildlings are on their way to Castle Black, eating up mommies and daddies along the way. See you back here then. Bring some of your mom’s boiled potato. No one boils a potato better than your mom!
Stray comments and observations:
That opening scene was gorgeous, wasn’t it? And does this mean Littlefinger was responsible for Joffrey’s death? Or just that he knew it was coming?
Daenerys continues to prove that she’s the best showman in town: As she approaches Meereen, she delivers her address to the slaves, not the rulers. Her weapon of choice is symbolic: She shoots huge barrels full of collars over the walls. Remember that when she saw the crucified slave girl in Episode 1 of this season, she ordered that the collars be removed from all the dead slave children they encountered along the way. Dany’s waging – and winning – a hearts-and-minds campaign. Makes you wonder what Westeros might look like if Margaery’s Groom #3 was actually Dany.
Were people satisfied with the male eye candy this time around? I realized, while poking around the Game of Thrones wiki, that we’ve seen Blondie before: Olyver was Loras’s squire in Season 3, who told Littlefinger of the plan being hatched to wed Loras and Sansa. Devious! What’s he been telling Littlefinger about Oberyn, I wonder?
Is it just me, or is Game of Thrones taking a tour of Art History 101 this season? In the last episode, the girl being chased by Ramsay and Miranda reminded me of Millais’s Ophelia, in her white dress among the lush greenery; tonight, Sansa turned her face and struck a very Girl with the Pearl Earring pose, her open and wary face framed by darkness.
The shot of the King’s Landing roofs in the opening scene makes me realize that in Bran’s dream last week, when we saw dragon shadows over red roofs, they must have been flying over King’s Landing.
Now we know Podrick is good at three things: pleasing ladies, sigil-reading, and hiding things from prison guards in his clothes.
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();
// ]]