House of the Dragon’s Fabien Frankel on Ser Criston Cole’s Wedding Woes
ByRoxana Hadadi,
a Vulture TV critic who also covers film and pop culture
Photo: Gareth Cattermole/Getty Images
Spoilers follow for House of the Dragon through its fifth episode, September 18’s “We Light the Way.”
As the Targaryens, Velaryons, Hightowers, Strongs, and Lannisters fight among themselves for power on House of the Dragon, Kingsguard member Ser Criston Cole (Fabien Frankel) is increasingly pulled into their scheming as the series’ clearest example of upstairs-downstairs tension. In the season’s fourth and fifth episodes, Cole tumbles through an arc that emphasizes his outsider status amid these nobles as both a lower-born man among royalty and an individual of Dornish descent living in King’s Landing.
He breaks his vows by sleeping with Princess Rhaenyra (Milly Alcock), who then rejects his suggestion that they run away together. He betrays Rhaenyra’s trust by telling her rival, former friend turned stepmother Queen Alicent (Emily Carey), that they had sex and gives into his feelings of rage and jealousy by murdering Ser Joffrey Lonmouth (Solly McLeod), the lover of Rhaenyra’s fiancé, Laenor Velaryon (Theo Nate), at Rhaenyra and Laenor’s wedding. It’s a lot! And when Cole nearly takes his own life at the end of “We Light the Way,” Frankel imbues the character with an openness and rawness that are at odds with everyone else’s practiced, smug imperiousness and that also signal a path forward for the character as Queen Alicent’s new ally.
To secure the part in House of the Dragon, Frankel auditioned for a character named “Ser Clint” with “dummy sides” that were typical of this franchise’s secrecy, which has “gun-to-my-head, head-on-the-spike” implications, he says. Along those lines, he avoided answering some of our questions about the motivations driving Cole, whom he describes as an instinctive fighter and killer. But Frankel is open about finding inspiration for Cole’s Dornish roots via his own paternal Iraqi English heritage, and the existential crisis the knight goes through after his relationship with Rhaenyra gets complicated.
You’ve read Fire & Blood. In Fire & Blood, Cole is not Dornish, so I’m curious about that change — if that was a result of your casting or if that was already in place once you were cast. In Fire & Blood, he’s still of Dornish descent. Is he not?
I don’t think so. Really? Wait. [Stands up, goes to get his book.] I gotta check it. I might be wrong.
We can come back to it! You wrote a letter to yourself, to Cole, after he reaches the tournament we see in the premiere when he unseats Prince Daemon. What did that letter include? It was trying to understand the mentality of what it would be like to come from a world that is so far removed from this world and then to arrive at this place. Especially in the first half of the show, it was so much for me about reminding himself of how much it had cost him to get to this place, and how much it meant to him, and how the stakes were very different to him than what they were for everyone else. A bad day for Rhaenyra, she gets a telling-off from her dad. A bad day for Criston, that’s his head on a spike, you know? It’s a really different thing. You can’t fuck up here.
That’s very clear when he takes off his helmet and there’s the “He’s Dornish!” response. It feels scandalous, like you’re subversive just by existing in this space. That’s why I thought it was interesting that they made him Dornish, whether that’s George R.R. Martin’s doing or Ryan [Condal] and Sara’s [Hess] adaptation of George’s writing — and I guess that would have to have been approved by George because I know that he’s very involved in all those decisions. But it even furthered him being an outsider. If you watch the original show, you read the books, the Dornish are looked at like pirates almost — real scum of the earth, real “They live like barbaric animals.” There’s no social structure that is implemented in this world that exists in Dorne, and the fact that he’s not born in Dorne but is of Dornish descent means that he’s looked at in the same scandalous way as a Dornish character from Dorne would be, but he’s born in Blackhaven. It’s a real juxtaposition, that thing: You look a certain way, but you are something different to that.
In episode three, Cole offers to kill Jason Lannister for Rhaenyra, and it’s sort of a joke, but I’m wondering how early you think Cole’s protective feelings toward Rhaenyra change into lust, love, or romance. Is that the moment? I think it’s more gradual. I don’t think Cole is ever looking at Rhaenyra going, I’m in love with you. I think that he finds her extraordinary. It’s like that friend of yours that you sort of subconsciously were always in love with, but they’re your friend, and that’s how it is. Not that Rhaenyra is Cole’s friend, but Cole is Rhaenyra’s confidant in a lot of ways. Something that Milly and I spoke about are the conversations that they would have had that are not written in the show and that would have lasted over the course of five years. I think he’s in awe of her pretty much from the moment she chooses him — and furthermore when she walks up on the dragon in “The Rogue Prince” to save the day.
There’s a take they took out: Cole’s reaction in that scene. I wondered whether it was that they didn’t want to give away too early to the audiences that there was a romance possibly going to unfold. But I know that they took that take out, and I haven’t asked Miguel [Sapochnik] or Ryan about it, but when I initially ADR’d it, it was there. I think he’s in awe of her from the beginning.
During the sex scene in episode four, Cole starts off avoiding eye contact with Rhaenyra. It looks like her undressing you is something that is happening to you, and there’s this moment when you lean over and pause, and when you come back up and kiss her, Cole is then actively participating. How did you want to use your physicality to communicate all the contrasting emotions he’s feeling? I haven’t broken this down — you’re the first person who has asked me in depth about that scene particularly. That scene always felt for me like the definitive scene of that person’s life. That’s what it is. That’s the moment — that and the wedding, but the wedding is in the aftermath of that thing. It was really a conversation that I had with Clare Kilner, our director on that episode, and she directed “King of the Narrow Sea” and “We Light the Way,” which are two very central episodes for Criston Cole. That wasn’t on the page. I felt that it was very important that it felt like it wasn’t just another sex scene for the sake of putting a sex scene in — that it had a purpose, and that purpose was obviously for Rhaenyra to explore the difficulty of her feelings (not only with Cole but also with Daemon) and for Criston Cole to essentially break the vows that he made as a Kingsguard.
Another scene that was taken out was him reciting his vows as a knight of the Kingsguard, which isn’t in there anymore. It was annoying. We fought to try and get it back, but it was just a dodgy camera thing that meant it wasn’t in there. But he gets knighted and recites these vows, and it’s a really big thing. I thought a lot about that — about what that means to break those vows, what it meant for him to take them in the first place and then to break them five years on.
Was the lean-over part not scripted and you added that? None of that was scripted.
Not the avoiding eye contact, not the pause? I’d have to look back over the intimacies of that scene, but Miguel and Ryan really let me, Milly, and Clare figure that scene out entirely in our way. There was some stuff on the page, and of course they’d written that it would be difficult for Cole; it’s not a massive stretch to know that it’s difficult for him to break his vows and soil his white cloak. But the intricacies and the beats of that scene were very much figured out by Milly, myself, and Clare.
The Game of Thrones version of someone soiling their Kingsguard cloak is Jaime Lannister, who doesn’t care at all. I love that, here, we understand how much this ruins Cole and sets him on an entirely different path. Yeah, totally. And, also, it’s not led by him. There’s no scenario in which that happens without Rhaenyra making that happen. It’s not even a thing he’s thought about, and if he has thought about it, he’s thought about it a million miles away. That whole thing is Rhaenyra led, which is why I think ultimately he goes on to have the feelings he has for her, in both love and anger.
The proposal in episode five is born out of that love and anger. Cole is going through everything in that scene: He’s sincere and then he’s offended when Rhaenyra treats it like a joke. Can you talk to me about preparing for that big moment for Cole? Without going into detail, I was going through a really weird period in my own life at that time irrespective of the scene. I remember that morning I went to see Milly in her makeup chair, and I had a piece of music and I put it in her ears and we didn’t speak. An hour and a half later, I was sitting outside, and she had a song that she had come up with for the scene and played it in my ears. And then we just went and did it. We didn’t rehearse it. I think we maybe ran the lines once together. There was really a feeling of being like, I have no idea how this is going to play out or how this is going to feel. You can only go into a scene like that thinking in every way that this is going to come out — this is going to work. In life, you don’t ask someone to be your girlfriend or to run away with you unless you have some hope that she is going to say yes. He has to go in like, I’m going to fucking give it everything I’ve got, and let it be what it is after that.
Do you mind sharing what the songs were? [Laughs.] I don’t want to do it. Milly’s song is very personal to her; my song is very personal to me. What’s interesting about the two songs is that they were really in the same musical world and rhythmically very similar — the pacing of them, how they play out.
When Cole says, “We’ll be nameless and free,” do you think that’s something Cole genuinely wants, or is that what he thinks Rhaenyra wants? How did you interpret that line? It’s funny — Rhaenyra complains so much about not feeling like she belongs, but Cole knows, I think, that she does belong. The idea of running away together is an old, addled thing, isn’t it? Look at Romeo and Juliet. It’s one of the oldest-written love-story tropes ever. Any time I’ve been in love, I’ve been like, Fuck it. Let’s just run away. What do we care? Let’s just go and be somewhere else. There’s no point being in this world when our love is like this. Especially when it’s love you’re not supposed to have — it’s like when you’re a kid and do something really naughty, and you just want to run away. If I was just not here, then none of this would matter. The game would be different.
What’s really funny to me about that scene is how Rhaenyra misreads it as, Is he asking me for leave? I didn’t know the Kingsguard could take vacation! It’s interesting that, in everything, she never just says, “You can go.” Why doesn’t she? He’s gone through all this shit. She clearly cares about him. At the end of it, there’s no scenario in which she could just go, “I get it. I’m sorry. You’re dismissed. I’m going to dismiss you, and you can go and do something else.” But no — he’s there; he’s at the wedding.
You raised this question, so I want to ask it: Does Cole love Rhaenyra? Did you play it like he loved her? I don’t want the audience to know what I felt playing that. I think that’s up to them for interpretation because it’s such a massive question.
Initially, they had written it in armor. And then they rewrote it and he was out of armor. And then they rewrote it and he was in armor. And then in the end, day of, they decided out of armor. It was very freeing for me to be able to play that scene out of armor.
It makes sense because he’s emotionally bare. He’s not Kingsguard Criston; he’s someone who cares for her, to whatever degree, and he’s making this appeal. It’s the first time you ever see him out of any uniform other than in “Second of His Name.” In that scene, he could be anyone, and it’s the only time in this show that he gets to be anyone. I remember saying “You need that,” because we don’t care what people are at work. It’s what people are at home that interests us. That’s life, you know? Now, we’re sitting here having this conversation, you’re interviewing me, but actually what’s probably more interesting is knowing what you’re having for dinner later, knowing what the rest of your evening is going to look like, knowing what other interviews you’ve got. That’s what’s interesting, and that’s what we’re yearning for as an audience. If you just have this man in uniform, you sort of end up going, Well, that’s all I’ll ever see him as.
Should I ask you what you’re having for dinner? My publicist is coming over for dinner, and I got breaded chicken, I got some mozzarella, some tomatoes — I’m cooking up a whole thing. It’s Italian-centric.
This interview has been edited and condensed for clarity.
After Frankel promised to speak to House of the Dragon co-creator Ryan Condal for more details about Cole’s heritage, Condal provided the following explanation about the characterization, which is different from Fire & Blood and unique to the TV adaptation: “Cole is from the Stormlands, which is right near Dorne on the map. We took the liberty of making him ‘of Dornish descent’ (he has Dornish blood), so he was probably raised in the marches and was from somewhat of a mixed union. He grew up common and simple with no real meaningful name (the Coles were nobodies). But the linkage to the book is very strong, even if GRRM wasn’t specific about him being specifically Dornish.”
HOTD’s Fabien Frankel on Ser Criston Cole’s Wedding Woeshttps://pyxis.nymag.com/v1/imgs/c0b/065/780a13e6072168994917baa8e778d98a63-chatroom-fabien-frankel-silo.png
Things you buy through our links may earn Vox Media a commission.
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();
// ]]