“There are no rules that apply to him,” Goldtooth explains of his character, William Knifeman, a spirit tasked with guiding Bear (D’Pharaoh Woon-A-Tai). “He can talk to Die Hard movies and Indigenous knowledge, because that’s who we are as people today.”
Photo: Shane Brown/FX
“There are no rules that apply to him,” Goldtooth explains of his character, William Knifeman, a spirit tasked with guiding Bear (D’Pharaoh Woon-A-Tai). “He can talk to Die Hard movies and Indigenous knowledge, because that’s who we are as people today.”
Photo: Shane Brown/FX
William Knifeman, the irreverent, dubiously helpful spirit tasked with ushering D’Pharaoh Woon-A-Tai’s Bear through his coming of age on Reservation Dogs, is the result of years of collaboration between Dallas Goldtooth and Sterlin Harjo. They’re both founding members of the sketch-comedy group the 1491s, whose comedic sensibility and approach to Native American storytelling helped shape Harjo’s perspective when creating the FX series. Writer and actor Goldtooth has been on the series from the beginning and joined the writers’ room for seasons two and three, but the approach to his character was his and Harjo’s from the start. William Knifeman is based, Goldtooth says, on a potent combination of influences: stereotypes of stoic Indian warriors, characters he created for the 1491s, a mix of ’80s and ’90s action heroes, and Goldtooth’s own family. “We are well aware of the gaze that falls upon Native people,” Goldtooth says. The goal of William Knifeman is to “blow it out of the water.”
In a conversation that took place before the SAG-AFTRA strike, Goldtooth described the development of William Knifeman and the role Reservation Dogs has played in creating opportunities for Native writers and creators in Hollywood. Thanks to Rez Dogs, Peacock’s Rutherford Falls, and the AMC series Dark Winds, there was a short moment on television in which multiple series by Native writers featuring Native performers aired around the same time. The cancellation of Rutherford Falls and the end of Reservation Dogsmeans that moment is ending, but Goldtooth is hopeful for the future. “This is not a blip,” he says. “We’ve sent a signal to the industry. You can’t tell the same old stupid Indian stories. There are better storytellers out there.”
How did you conceive of William Knifeman? There was never a William Knifeman character, but there were elements of him from my performances in the past. What I find important about William Knifeman is that he’s very self-aware — not only him as a character, but the self-awareness of us as the writers and creators of the show. We are well aware of how the outside world sees Native American people. We are well aware of the gaze that falls upon Native people and the stories we tell. I think it’s fitting that in episode one of season one, right out of the gate, we just blow it out of the water. This is not the Native American story you’re going to expect or even want — some people want a stereotypical stoic Indian on a horseback, and we’re like … nah, fuck that. We’re going to do something different.
William Knifeman in many ways is the best and worst traits of all the uncles I’ve had in my life. Over-the-top storytellers who only talk about their successful deeds and not their downfalls. That’s who I pull from: good storytelling uncles. He’s also one of the hearts of the overall story of Reservation Dogs. Through thick and thin, the past and the future, we’re still able to laugh and make light of a situation, and that really carries us through the arc of the past two seasons.
How did William Knifeman grow out of the characters you and Sterlin worked on for the 1491s? We had a ridiculous sketch that we want to put on the screen some day. It’s a story about how a Boy Scout troop got their Indian name and their drum. Some random Indian guy emerges from the woods; he’s probably on a bender. He comes across these Boy Scouts and tells them a bullshit story about the drum. It’s this whole sketch about a common dude, but in the eyes of these kids he becomes a legend because of how he comes to them.
There was a powwow MC character I played a number of times — someone who’s a little too confident and who exhibits hypermasculinity in many different ways. The 1491s, a lot of our comedy is about teasing ourselves, especially as Indian men. There’s a whole aspect of How we can take these models of masculinity and have a commentary on them through comedy? How can we make fun of the funny shit we do as men? There’s two ways I approach it. There’s how the outside world says, “This is how you should be, Native men.” Then there’s the internalized aspect of what we tell ourselves. Okay, this is how we think we should be. We were influenced by Dances with Wolves and all the Wes Studi–Gary Farmer movies. We’re influenced by the ’80s and ’90s. It’s how we built this identity of what it means to be a Native man.
From the perspective of the rules for how William Knifeman works, can you tell me what his references are? He’s constantly talking about movies, and I wondered if there’s some logic to what he has and hasn’t seen. This is a spirit that has existed since his death, and he’s helped many people. This is how I think about it, because I’ve actually never talked to Sterlin about it. William Knifeman’s helped countless wayward souls over the years, and as such, he’s watched a crazy amount of ’80s action flicks and bad B-movies. That has greatly influenced him.
Wait, because that’s what all these wayward people were watching? That’s what they were watching! So he watched along with them. He finds a hero in Jean-Claude Van Damme and Arnold Schwarzenegger of the ’80s — not Arnold Schwarzenegger the governor. For us as writers, William Knifeman is our chance to show the world that we as Native people are a wide range of craziness, oddness, and beauty that pulls from a crazy amount of references that you may not be used to or expect. He’s watched many bad movies and really likes action flicks and the hero that’s over-the-top, braggadocious, and talks about his war deeds with no qualms.
And Sterlin, when we were breaking season three, one of the first things he had in mind was that he wanted William Knifeman to speak to the camera. That was day one, one of the first things on the board: William Knifeman breaking the fourth wall. Because he’s a spirit! There are no rules that apply to him. He can talk to Die Hard movies and Indigenous knowledge, because that’s who we are as people today. It’s a reflection of us — we can play into the stoicism, we can be “one with nature,” but at the same time, fart jokes. We’re human!
For the second episode, we filmed on the salt flats of Oklahoma and it was 34 degrees out. We had to act like it was 90 degrees. That’s why I’m wearing that fur hat! We had a whole costume and I was gonna wear this big-ass buffalo-fur cape. But the horse freaked out so we got rid of the cape and I had to bare my nips. But I kept the hat.
So you had to write in a line about the Genghis Khan hat? Oh yeah, that was all improv on the spot.
“It wasn’t until the last day of shooting for this season that I was like, There are no rules … I could’ve changed costume. I want to do another season just so I can do a costume change!”
Photo: Shane Brown/FX
How much of what William Knifeman says is improv and how much is pre-scripted? It’s about 50-50. I wrote the first episode with Sterlin and all the William Knifeman stuff, so I gave myself an outline to go off. And it’s a fucking amazing crew to work with. All the directors are on point, and for both of the first two episodes — the first was Tazbah Chavez and the second was Danis Goulet — they’re really supportive of doing improv. And Sterlin’s there, so he’d feed me lines, or the other writers on set would feed lines.
There’s a very funny little scene where William Knifeman says he can’t touch a bathroom door, and it made me wonder if there are also rules about what he can and can’t interact with in the world. Because I could swear he’s touched other things? The thing that’s awesome about him is you can’t believehim. It wasn’t until the last day of shooting for this season that I was like, There are no rules … I could’ve changed costume. You guys put me in this costume this whole time?! I want to do another season just so I can do a costume change!
What was it about breaking the fourth wall that felt so appealing to start this season? Sterlin and I didn’t have an in-depth discussion about it, but I think Sterlin, over the course of writing this season, made it known that it’s probably going to be the final season. Part of his working practice for the past two seasons was, Let’s write as if this one’s the last. It’s why seasons one and two have such strong closing points. In the bigger picture, there’s a recognition of the impact this show has had, not only for the industry and media in general, but in particular for Native peoples. By breaking that fourth wall, by speaking to the audience, it’s an acknowledgment of people who’ve come with us on this journey. It’s a nod that says, “We see you.” This is a part of our story, even though you may not be able to trust this storyteller. There’s a power to that.
There’s also a winking thing. You have to wonder — who is Spirit actually speaking to? Is he speaking to non-natives? Is he speaking to Native people? It depends on who you are. Everyone finds someone different. But there’s coded language in that intro. “Disenrolled ones, girthy ones.” There’s language that speaks to Native people who are watching. I find power in that. It acknowledges that these stories are being consumed and there are outsiders watching. But it also allows them to come into the joke.
When did you know this would be the last season? Midway through production, Sterlin gave me a call and said, “Hey, this is it. We’re going to be wrapping it up after this.” He wanted to let everyone know. It was the day before he posted it on Instagram. But in the lead-up to that, in the writers’ room, he would say, “I think this may be the last one.” We did have a conversation about what we might see for season four. We did wonder what the story could look like beyond here, and it was a challenge to imagine. It was a very difficult decision. I’m really proud of Sterlin for making it and taking that lead.
I’m so glad the show will be ending on its own terms, but it occurred to me that there was this brief moment when there were three shows on TV that were full of Native perspectives and creators: Reservation Dogs, Rutherford Falls, and Dark Winds. And now we’re down to one. It’s an active conversation a lot of us are having. Of course it’s tinted by what’s going on with the strikes. But it’s, “What do we do as a collective? Now that we’ve been brought into this space as Native writers and creators within this industry, what do we do from here?” But also, what does the industry look like after this strike? Is there going to be a contraction of jobs and opportunities? But there’s been enough of a foothold that I would hope to see more Native shows brought to the screen.
What cannot be understated is the tremendous work that has been done to give opportunities to other Native writers. I want to speak specifically for Rutherford Falls and Reservation Dogs, because I know Sierra Teller Ornelas and Sterlin have been very conscientious, very purposeful in giving people a leg up into the industry faster than they would’ve been able to without those shows. I just acted in a Netflix movie called Rez Ball. I don’t know when it’s supposed to come out. The director is Sydney Freeland, who was a writer on season two and directed in season one and season two. She’s also the director of the Echo series on Marvel, which is another Native series coming out later this year. I was talking to Sydney and she was like, “Can you fuckin’ believe it?”Season one of Rez Dogs, Sterlin said, “I want all Native directors.” The network was like, “Fuck, do you even have enough? Who could do it?”He’s like, “Fuckin’ trust me! There are!”In the normal process, the network would’ve only approved two people, Sydney and Sterlin, because they were the only ones with enough credits to do it. Sterlin had to go to bat for everybody else. Because they got those gigs, they were able to get more directing gigs. Tazbah Chavez is a great example. Because of Rutherford and because of Reservation Dogs, she’s emerging as a successful director.
That gives me hope. It’s going to be a struggle. But this is not a blip. If anything, we’ve sent a signal to the industry: Look, you can’t tell the same old stupid Indian stories. There are better storytellers out there. The time of old tropes should be done.
What do you want for your own post–Reservation Dogs future, once you’re no longer on strike? I was working a nine-to-five until last fall, and finally I decided I wanted to commit to this role as a writer and actor completely. So I left the nine-to-five, which was great timing! Right before a strike!
But I want to run a show. I want to create a show, a show that can also create opportunities and collaboration. I’m a sketch-comedy and improv comedy person at heart, so it’s all about collaboration for me. I want to make people laugh, but I also want to create more opportunities for folks. On the acting side, I’m doing my best! I just got finished with Amazon’s production of Fallout, and when I first brought on my managers, they asked me what kinds of jobs I wanted for acting. I said, “You know what? I want to see how far I can go as an actor without getting a stoic-Indian-on-a-horse-in-the-1800s gig.”That’s my goal. Unless I’m writing it and I have some creative control, the question is how far I can go before I’m like, Ah, better take that job.
Because after the first season of Rez Dogs came out, in the two weeks after the second episode, I got four job offers. They were all Indian on a horse in the 1800s. I was like, Did you not see? Did you not get the point of the joke in the show?
How many of them were in the Taylor Sheridan universe? [Laughs.] No comment on that!
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();
// ]]