SML.di("./B01f6V9jnX.js",import.meta.url,"B01f6V9jnX");SML.di("./C-tVJ2k8LW.js",import.meta.url,"C-tVJ2k8LW");SML.di("./HANiMUxQI0.js",import.meta.url,"HANiMUxQI0");SML.di("./Crk5iZvFJp.js",import.meta.url,"Crk5iZvFJp");SML.di("./C42E8rVVpA.js",import.meta.url,"C42E8rVVpA");SML.di("./CsxDAjmHZE.js",import.meta.url,"CsxDAjmHZE");SML.di("./BkjgI35gdl.js",import.meta.url,"BkjgI35gdl");SML.di("./Bl61SFcBdT.js",import.meta.url,"Bl61SFcBdT");SML.di("./B7v2ktuRzR.js",import.meta.url,"B7v2ktuRzR");SML.di("./Dx86bnsEIQ.js",import.meta.url,"Dx86bnsEIQ");SML.di("./CSXN-JxJ1k.js",import.meta.url,"CSXN-JxJ1k");SML.di("./tV3xSlhcb4.js",import.meta.url,"tV3xSlhcb4");SML.di("./CZo6l6vjsi.js",import.meta.url,"CZo6l6vjsi");SML.di("./DUzIBJc2in.js",import.meta.url,"DUzIBJc2in");SML.di("./C54I1XOtVF.js",import.meta.url,"C54I1XOtVF");SML.di("./BFDJQElz9q.js",import.meta.url,"BFDJQElz9q");SML.di("./C-4AJ2Y78L.js",import.meta.url,"C-4AJ2Y78L");SML.di("./wDRHyxVKtb.js",import.meta.url,"wDRHyxVKtb");SML.di("./cjhvxMuwOm.js",import.meta.url,"cjhvxMuwOm"); SML.di("./C42E8rVVpA.js",import.meta.url,"C42E8rVVpA");SML.di("./CsxDAjmHZE.js",import.meta.url,"CsxDAjmHZE");SML.di("./DUzIBJc2in.js",import.meta.url,"DUzIBJc2in"); SML.dm("1i4g9fLWHY",["C42E8rVVpA","CsxDAjmHZE","DUzIBJc2in"],(async(e,a,t)=>{let r=class extends e.h4{constructor(){super(...arguments),this._fullscreenBlurEl=document.createElement("div"),this._appliedBlurFilter=null,this._blurElement=null,this.shouldContentScroll=!1,this.isFooterEmpty=!0,this.render=()=>{const t=a.x``,r=a.x``,n=a.x` `;return a.x` ${e.cA(this.modal?"\n \n":"\n \n")}
${t}
${r}
`}}static get styles(){return a.i`${e.h4.styles}:host{--content-padding:var(--spacer-md);box-sizing:border-box;max-width:none;border-radius:var(--rem16);padding:0;overflow:hidden}#wrapper{display:flex;flex-direction:column;align-items:center;height:100%;position:relative;font-size:16px;box-sizing:border-box;max-height:inherit;min-height:inherit;overflow:hidden}slot[name=closeButton]{display:inline-flex;position:absolute;position:absolute;top:0;inset-inline-end:0;margin:var(--content-padding)}#header{display:flex;flex-direction:column;gap:var(--spacer-sm);align-items:center;text-align:start;width:100%;box-sizing:border-box}#header.with-icon{text-align:center;padding:0 var(--rem40)}slot[name=title]{font-size:var(--rem18);font-weight:700}slot:not([name]){display:flex;flex-grow:1;width:100%;padding:var(--spacer-xs) 0;font-size:var(--rem14)}#footer{display:flex;flex-direction:column;gap:var(--spacer-sm);width:100%;background:var(--color-ui-modalbackground);padding:var(--spacer-md);box-sizing:border-box}slot[name=tertiaryButton]{display:inline-flex;justify-content:center;font-size:14px}#footer.empty{display:none}@media (min-width:640px){#content{padding:var(--content-padding)}#header,#header.with-icon{flex-direction:row;padding-inline:0 var(--spacer-2xl)}#footer{flex-direction:row-reverse;align-items:center;justify-content:end}slot[name=tertiaryButton]{margin-inline-end:auto}slot[name=title]{text-align:start}}#content{height:100%;max-height:100%;width:100%;overflow:auto;position:relative;--content-padding:var(--spacer-md);padding:var(--content-padding);box-sizing:border-box;flex:1}.overflowing-content{max-height:100%;overflow-y:auto}.sticky-footer{box-shadow:var(--elevation-md)}slot[name=closeButton].floating{box-shadow:var(--elevation-sm);border-radius:999px}`}connectedCallback(){super.connectedCallback(),Object.assign(this._fullscreenBlurEl.style,{position:"fixed",top:"0",bottom:"0",right:"0",left:"0",backdropFilter:n(4)})}disconnectedCallback(){this._fullscreenBlurEl.remove(),e.g_.remove(this),this.resizeObserver?.disconnect()}firstUpdated(){this.resizeObserver=new ResizeObserver((()=>{this.measureShouldContentScroll()})),this.resizeObserver.observe(this.content)}calcFooterChildren(){this.isFooterEmpty=!(this._footerSlot?.length||this._primaryButtonSlot?.length||this._secondaryButtonSlot?.length||this._tertiaryButtonSlot?.length)}measureShouldContentScroll(){this.shouldContentScroll=Boolean(this.content?.scrollHeight&&this.content?.scrollHeight>this.content.offsetHeight)}showModal(a){if(e.g_.add(this),super.showModal(),null!=a?.blur){const e=!0===a.blur?4:Number(a.blur);this._appliedBlurFilter=n(e),a?.blurElement?(this._blurElement=a.blurElement,t=this._blurElement,r=this._appliedBlurFilter,t.style.filter=t.style.filter+" "+r):(Object.assign(this._fullscreenBlurEl.style,{backdropFilter:this._appliedBlurFilter}),document.body.append(this._fullscreenBlurEl))}var t,r}close(){this.open&&(super.close(),e.g_.remove(this),null!=this._blurElement&&null!=this._appliedBlurFilter?(!function(e,a){const t=e.style.filter.split(" ").filter(Boolean).reverse(),r=t.indexOf(a);if(-1===r)return;t.splice(r,1),e.style.filter=t.reverse().join(" ")}(this._blurElement,this._appliedBlurFilter),this._appliedBlurFilter=null,this._blurElement=null):this._fullscreenBlurEl.remove())}};function n(e){return`blur(${e}px)`}e._([e.v()],r.prototype,"shouldContentScroll",void 0),e._([e.l({slot:"titleGraphic"})],r.prototype,"_titleGraphic",void 0),e._([e.Q("#content")],r.prototype,"content",void 0),e._([e.Q("#footer")],r.prototype,"footer",void 0),e._([e.v()],r.prototype,"isFooterEmpty",void 0),e._([e.av({slot:"footer",flatten:!0})],r.prototype,"_footerSlot",void 0),e._([e.av({slot:"primaryButton",flatten:!0})],r.prototype,"_primaryButtonSlot",void 0),e._([e.av({slot:"secondaryButton",flatten:!0})],r.prototype,"_secondaryButtonSlot",void 0),e._([e.av({slot:"tertiaryButton",flatten:!0})],r.prototype,"_tertiaryButtonSlot",void 0),r=e._([e.e("faceplate-modal")],r);const i=()=>"Something went wrong saving the avatar.",o=()=>"Something went wrong while saving the banner.";function l(e){return e?.[0]?.message??"Something went wrong";}const s=e=>({error:e||"There was an error uploading the file."});async function d(a,r){const n=t.U.get(a.type);if(!n)throw new Error(`${a.type} files are not supported.`);try{const i=await async function(a){const t=await e.C({operation:e.H.CreateSubredditStructuredStylesUploadLease,variables:{input:a}});if(t.errors?.length)throw new Error(l(t.errors));const r=t.data.createSubredditStructuredStylesUploadLease;if(r?.ok&&r.uploadLease)return{uploadLeaseUrl:r.uploadLease.uploadLeaseUrl,uploadLeaseHeaders:r.uploadLease.uploadLeaseHeaders};throw new Error(l(r?.errors))}({...r,filepath:a.name,mimetype:n}),o=await t.X(a,i);return o?{url:o}:s()}catch(e){return i=e.message,window.Sentry?.captureMessage?.(`Media file upload failed with error: ${i}`),s(e.message)}var i}return {C:class{constructor(){this.url=void 0}async makeGQLRequest(...a){return e.C(...a)}async uploadMedia(...e){return d(...e)}async saveImage({subredditId:e,url:a,fileContent:t,uploadType:r,gqlOperation:n}){if(t)try{const n=await this.uploadMedia(t,{subredditId:e,imagetype:r});if(a=n.url?decodeURIComponent(n.url):a,n.error)return this.handleError(r);this.url=a}catch(e){return this.handleError(r)}try{await this.makeGQLRequest({operation:n,variables:{input:{subredditId:e,[this.getOperationArg(r)]:a??""}}})}catch(e){return this.handleError(r)}return null}async saveCommunityIcon(a,t,r){return this.saveImage({subredditId:a,url:t,fileContent:r,uploadType:e.h5.CommunityIcon,gqlOperation:e.H.UpdateSubredditIcon})}async saveBanner(a,t,r){return this.saveImage({subredditId:a,url:t,fileContent:r,uploadType:e.h5.BannerBackgroundImage,gqlOperation:e.H.UpdateSubredditBanner})}async saveMobileBanner(a,t,r){return this.saveImage({subredditId:a,url:t,fileContent:r,uploadType:e.h5.MobileBannerImage,gqlOperation:e.H.UpdateSubredditBanner})}handleError(a){switch(a){case e.h5.BannerBackgroundImage:return o();case e.h5.MobileBannerImage:return "Something went wrong while saving the mobile banner.";case e.h5.CommunityIcon:default:return i()}}getOperationArg(a){switch(a){case e.h5.BannerBackgroundImage:return"bannerBackgroundImage";case e.h5.MobileBannerImage:return"mobileBannerImage";case e.h5.CommunityIcon:default:return"communityIcon"}}},E:o,get F(){return r},O:"mod-show-post-level-crowd-control-modal",a:i,u:d};})); SML.di("./C42E8rVVpA.js",import.meta.url,"C42E8rVVpA");SML.di("./CsxDAjmHZE.js",import.meta.url,"CsxDAjmHZE");SML.di("./DUzIBJc2in.js",import.meta.url,"DUzIBJc2in"); SML.dm("1i4g9fLWHY",["C42E8rVVpA","CsxDAjmHZE","DUzIBJc2in"],(async(e,a,t)=>{let r=class extends e.h4{constructor(){super(...arguments),this._fullscreenBlurEl=document.createElement("div"),this._appliedBlurFilter=null,this._blurElement=null,this.shouldContentScroll=!1,this.isFooterEmpty=!0,this.render=()=>{const t=a.x``,r=a.x``,n=a.x` `;return a.x` ${e.cA(this.modal?"\n \n":"\n \n")}
${t}
${r}
`}}static get styles(){return a.i`${e.h4.styles}:host{--content-padding:var(--spacer-md);box-sizing:border-box;max-width:none;border-radius:var(--rem16);padding:0;overflow:hidden}#wrapper{display:flex;flex-direction:column;align-items:center;height:100%;position:relative;font-size:16px;box-sizing:border-box;max-height:inherit;min-height:inherit;overflow:hidden}slot[name=closeButton]{display:inline-flex;position:absolute;position:absolute;top:0;inset-inline-end:0;margin:var(--content-padding)}#header{display:flex;flex-direction:column;gap:var(--spacer-sm);align-items:center;text-align:start;width:100%;box-sizing:border-box}#header.with-icon{text-align:center;padding:0 var(--rem40)}slot[name=title]{font-size:var(--rem18);font-weight:700}slot:not([name]){display:flex;flex-grow:1;width:100%;padding:var(--spacer-xs) 0;font-size:var(--rem14)}#footer{display:flex;flex-direction:column;gap:var(--spacer-sm);width:100%;background:var(--color-ui-modalbackground);padding:var(--spacer-md);box-sizing:border-box}slot[name=tertiaryButton]{display:inline-flex;justify-content:center;font-size:14px}#footer.empty{display:none}@media (min-width:640px){#content{padding:var(--content-padding)}#header,#header.with-icon{flex-direction:row;padding-inline:0 var(--spacer-2xl)}#footer{flex-direction:row-reverse;align-items:center;justify-content:end}slot[name=tertiaryButton]{margin-inline-end:auto}slot[name=title]{text-align:start}}#content{height:100%;max-height:100%;width:100%;overflow:auto;position:relative;--content-padding:var(--spacer-md);padding:var(--content-padding);box-sizing:border-box;flex:1}.overflowing-content{max-height:100%;overflow-y:auto}.sticky-footer{box-shadow:var(--elevation-md)}slot[name=closeButton].floating{box-shadow:var(--elevation-sm);border-radius:999px}`}connectedCallback(){super.connectedCallback(),Object.assign(this._fullscreenBlurEl.style,{position:"fixed",top:"0",bottom:"0",right:"0",left:"0",backdropFilter:n(4)})}disconnectedCallback(){this._fullscreenBlurEl.remove(),e.g_.remove(this),this.resizeObserver?.disconnect()}firstUpdated(){this.resizeObserver=new ResizeObserver((()=>{this.measureShouldContentScroll()})),this.resizeObserver.observe(this.content)}calcFooterChildren(){this.isFooterEmpty=!(this._footerSlot?.length||this._primaryButtonSlot?.length||this._secondaryButtonSlot?.length||this._tertiaryButtonSlot?.length)}measureShouldContentScroll(){this.shouldContentScroll=Boolean(this.content?.scrollHeight&&this.content?.scrollHeight>this.content.offsetHeight)}showModal(a){if(e.g_.add(this),super.showModal(),null!=a?.blur){const e=!0===a.blur?4:Number(a.blur);this._appliedBlurFilter=n(e),a?.blurElement?(this._blurElement=a.blurElement,t=this._blurElement,r=this._appliedBlurFilter,t.style.filter=t.style.filter+" "+r):(Object.assign(this._fullscreenBlurEl.style,{backdropFilter:this._appliedBlurFilter}),document.body.append(this._fullscreenBlurEl))}var t,r}close(){this.open&&(super.close(),e.g_.remove(this),null!=this._blurElement&&null!=this._appliedBlurFilter?(!function(e,a){const t=e.style.filter.split(" ").filter(Boolean).reverse(),r=t.indexOf(a);if(-1===r)return;t.splice(r,1),e.style.filter=t.reverse().join(" ")}(this._blurElement,this._appliedBlurFilter),this._appliedBlurFilter=null,this._blurElement=null):this._fullscreenBlurEl.remove())}};function n(e){return`blur(${e}px)`}e._([e.v()],r.prototype,"shouldContentScroll",void 0),e._([e.l({slot:"titleGraphic"})],r.prototype,"_titleGraphic",void 0),e._([e.Q("#content")],r.prototype,"content",void 0),e._([e.Q("#footer")],r.prototype,"footer",void 0),e._([e.v()],r.prototype,"isFooterEmpty",void 0),e._([e.av({slot:"footer",flatten:!0})],r.prototype,"_footerSlot",void 0),e._([e.av({slot:"primaryButton",flatten:!0})],r.prototype,"_primaryButtonSlot",void 0),e._([e.av({slot:"secondaryButton",flatten:!0})],r.prototype,"_secondaryButtonSlot",void 0),e._([e.av({slot:"tertiaryButton",flatten:!0})],r.prototype,"_tertiaryButtonSlot",void 0),r=e._([e.e("faceplate-modal")],r);const i=()=>"Something went wrong saving the avatar.",o=()=>"Something went wrong while saving the banner.";function l(e){return e?.[0]?.message??"Something went wrong";}const s=e=>({error:e||"There was an error uploading the file."});async function d(a,r){const n=t.U.get(a.type);if(!n)throw new Error(`${a.type} files are not supported.`);try{const i=await async function(a){const t=await e.C({operation:e.H.CreateSubredditStructuredStylesUploadLease,variables:{input:a}});if(t.errors?.length)throw new Error(l(t.errors));const r=t.data.createSubredditStructuredStylesUploadLease;if(r?.ok&&r.uploadLease)return{uploadLeaseUrl:r.uploadLease.uploadLeaseUrl,uploadLeaseHeaders:r.uploadLease.uploadLeaseHeaders};throw new Error(l(r?.errors))}({...r,filepath:a.name,mimetype:n}),o=await t.X(a,i);return o?{url:o}:s()}catch(e){return i=e.message,window.Sentry?.captureMessage?.(`Media file upload failed with error: ${i}`),s(e.message)}var i}return {C:class{constructor(){this.url=void 0}async makeGQLRequest(...a){return e.C(...a)}async uploadMedia(...e){return d(...e)}async saveImage({subredditId:e,url:a,fileContent:t,uploadType:r,gqlOperation:n}){if(t)try{const n=await this.uploadMedia(t,{subredditId:e,imagetype:r});if(a=n.url?decodeURIComponent(n.url):a,n.error)return this.handleError(r);this.url=a}catch(e){return this.handleError(r)}try{await this.makeGQLRequest({operation:n,variables:{input:{subredditId:e,[this.getOperationArg(r)]:a??""}}})}catch(e){return this.handleError(r)}return null}async saveCommunityIcon(a,t,r){return this.saveImage({subredditId:a,url:t,fileContent:r,uploadType:e.h5.CommunityIcon,gqlOperation:e.H.UpdateSubredditIcon})}async saveBanner(a,t,r){return this.saveImage({subredditId:a,url:t,fileContent:r,uploadType:e.h5.BannerBackgroundImage,gqlOperation:e.H.UpdateSubredditBanner})}async saveMobileBanner(a,t,r){return this.saveImage({subredditId:a,url:t,fileContent:r,uploadType:e.h5.MobileBannerImage,gqlOperation:e.H.UpdateSubredditBanner})}handleError(a){switch(a){case e.h5.BannerBackgroundImage:return o();case e.h5.MobileBannerImage:return "Something went wrong while saving the mobile banner.";case e.h5.CommunityIcon:default:return i()}}getOperationArg(a){switch(a){case e.h5.BannerBackgroundImage:return"bannerBackgroundImage";case e.h5.MobileBannerImage:return"mobileBannerImage";case e.h5.CommunityIcon:default:return"communityIcon"}}},E:o,get F(){return r},O:"mod-show-post-level-crowd-control-modal",a:i,u:d};})); SML.dm("2F24kjFEFA",[],(async()=>{const E=["BE","BG","HR","CZ","DK","EE","FI","FR","DE","GR","HU","IE","IT","LV","LT","LU","MT","NL","PL","PT","CY","RO","SK","SI","ES","SE"],n=["EU","UK","AU"];var t;!function(E){E.REGION_SUFFIX="odsa",E.URL_REGION_KEY="&tf_35141892305556=",E.URL_PERMALINK_KEY="&tf_19617252816916="}(t||(t={}));const R=R=>{if("GB"===R?R="UK":function(n){return E.includes(n)}(R)&&(R="EU"),n.includes(R))return R.toLowerCase()+"_"+t.REGION_SUFFIX};return{c:(E,n="",L="",_=!1)=>{const U=R(n);if(!U)return E;const o=t.URL_REGION_KEY+U;let r="";return""!==L&&(r=_?t.URL_PERMALINK_KEY+L:t.URL_PERMALINK_KEY+location.origin+L),E+o+r}}})); SML.di("./C42E8rVVpA.js",import.meta.url,"C42E8rVVpA");SML.di("./1i4g9fLWHY.js",import.meta.url,"1i4g9fLWHY");SML.di("./CsxDAjmHZE.js",import.meta.url,"CsxDAjmHZE");SML.di("./DdizCVGdC6.js",import.meta.url,"DdizCVGdC6");SML.di("./DUzIBJc2in.js",import.meta.url,"DUzIBJc2in"); SML.dm("4SW1PeumCl",["C42E8rVVpA","1i4g9fLWHY","CsxDAjmHZE","DdizCVGdC6","DUzIBJc2in"],(async(e,t,a,i)=>{class s extends Error{constructor(e){super(e.map((e=>e.message)).join(", ")),this.fieldErrors=[],this.fieldErrors=e,this.reason=e[0]?.code}}var r;!function(e){e.SUBREDDIT_EXISTS="SUBREDDIT_EXISTS"}(r||(r={}));const o=(n=e.C,async t=>{const a=await n({operation:e.H.CreateSubreddit,variables:{input:t}});if(a?.errors?.length||!a?.data?.createSubreddit){const e=a.errors.map((e=>e.message)).join(", ");throw (window.Sentry?.captureException?.(e), new Error(e))}const{ok:i,fieldErrors:r,errors:o,subreddit:l}=a.data.createSubreddit;if(o&&o.length){const e=o.map((e=>e.message)).join(", ");window.Sentry?.captureException?.(e)}if(!0===i&&l?.path)return l;if(r&&r.length)throw new s(r);return null});var n;const l="update-subreddit-creation",d="community-creation-show-message";function c(e,t){const a=Object.keys(t).filter((e=>null!==t[e]));return Object.assign({},e,...a.map((e=>({[e]:t[e]}))))}const p=`\n #${i.C}[data-step="celebration"] rpl-modal-card::part(content) {\n background: linear-gradient(\n 90deg,\n var(--color-neutral-background) 50%,\n transparent 50%\n ),\n linear-gradient(\n 180deg,\n var(--celebration-color-start) 0%,\n var(--celebration-color-end) 100%\n );\n }\n\n #${i.C}[data-step="celebration"] rpl-modal-card::part(footer) {\n background: var(--color-neutral-background);\n border-top: 1px solid var(--color-neutral-border-weak);\n }\n\n #${i.C}[data-step="celebration"] [slot="footer"] {\n display: flex;\n }\n\n #${i.C}[data-step="celebration"] [slot="title"] {\n display: none;\n }\n\n #${i.C}[data-loading="true"] [slot="title"] {\n display: none;\n }\n`,h=a.ae(p);e.cU(h);const u=a.s;let m=class extends u{constructor(){super(...arguments),this.isSrCreationExperimentEnabled=!1,this.isCreationTemplatesEnabled=!1,this.subreddit={name:"",description:"",topics:[],type:e.cE.Public,isNSFW:!1},this._loading=!1,this.showWarning=!1,this.editImageType=void 0,this.imageUploader=new t.C,this.getCloseButtons=()=>{const e=this.rplDialog?.portalContainer;return e?.querySelectorAll('[slot="close-button"]')??[]},this.hideCloseButtons=()=>{this.getCloseButtons().forEach((e=>{e.style.display="none"}))},this.showCloseButtons=()=>{this.getCloseButtons().forEach((e=>{e.style.display=""}))},this.changeModalTitle=e=>{const t=this.rplDialog?.portalContainer,a=t?.querySelector('[id="title"]');null!=a&&(null!=e.title&&(a.textContent=e.title),null!=e.ariaLabel&&(a.ariaLabel=e.ariaLabel))},this.setupCloseListeners=()=>{this.getCloseButtons().forEach((e=>{e.addEventListener("click",(()=>{this.closeModal()}))}))},this.refreshFocusAndUpdateTitle=e=>{e.detail.title&&this.changeModalTitle(e.detail),this.rplDialog?.checkFocus()},this.updateSubredditCreation=e=>{this.subreddit=c(this.subreddit,e.detail.subreddit),e.stopImmediatePropagation();const{editBanner:t,editIcon:a}=e.detail;this.editImageType=t?"banner":a?"icon":void 0,"next"===e.detail.direction&&this.goNext(e.detail.source),"back"===e.detail.direction&&this.goBack(e.detail.source)},this.addUpdateListener=()=>{this.addEventListener(l,this.updateSubredditCreation)},this.showWarningMessageListener=e=>{this.warningMessage=e.detail,this.showWarning=!0},this.addWarningMessageListener=()=>{this.addEventListener(d,this.showWarningMessageListener)},this.addSlotterListener=()=>{this.slotterElement?.addEventListener("shreddit-slotter-slot-name-changed",(async()=>{let e;switch(this.isCreationTemplatesEnabled&&this.rplDialog?.portalContainer&&(this.rplDialog.portalContainer.removeAttribute("data-step"),this.rplDialog.portalContainer.style.removeProperty("--celebration-color-start"),this.rplDialog.portalContainer.style.removeProperty("--celebration-color-end")),this.slotterElement.slotName!==i.g.UpdateImages&&this.showCloseButtons(),this.slotterElement.slotName){case i.g.NameAndDescription:e=this.slotterElement.shadowRoot?.querySelector("community-creation-name-description");break;case i.g.Images:e=this.slotterElement.shadowRoot?.querySelector("community-creation-walkthrough-images");break;case i.g.Topics:e=this.slotterElement.shadowRoot?.querySelector("community-creation-topic-selection");break;case i.g.Type:e=this.slotterElement.shadowRoot?.querySelector("community-creation-walkthrough-type");break;case i.g.Celebration:if(this.isCreationTemplatesEnabled&&(e=this.slotterElement.shadowRoot?.querySelector("community-creation-celebration"),e&&(e.shouldShowConfetti=this.previousStep===i.g.NameAndDescription),this.rplDialog?.portalContainer)){this.rplDialog.portalContainer.setAttribute("data-step","celebration");const e=this.subreddit.defaultTheme?.colorHex;if(e){const t=e.replace("#","").slice(0,6),a=parseInt(t.substring(0,2),16),i=parseInt(t.substring(2,4),16),s=parseInt(t.substring(4,6),16),r=`rgba(${a}, ${i}, ${s}, 0.50)`,o=`rgba(${a}, ${i}, ${s}, 0.20)`;this.rplDialog.portalContainer.style.setProperty("--celebration-color-start",r),this.rplDialog.portalContainer.style.setProperty("--celebration-color-end",o)}}break;case i.g.UpdateImages:e=this.slotterElement.shadowRoot?.querySelector("community-image-editor"),e&&(e.editingImageType=this.editImageType),this.hideCloseButtons()}e&&(e.subreddit=this.subreddit),await this.slotterElement.updateComplete,await this.slotterElement.updateComplete}))}}async connectedCallback(){super.connectedCallback(),this.prefilledName&&(this.subreddit.name=this.prefilledName??""),this.slotterElement?.slotName!==i.g.Celebration&&this.slotterElement?.slotName!==i.g.UpdateImages||this.resetFlowState()}get rplDialog(){return document.querySelector(`rpl-dialog[dialog-id="${i.C}"]`)}get slotterElement(){return this.querySelector('shreddit-slotter[name="community-creation-walkthrough-slotter"]')}clearError(){document.body.querySelector("alert-controller")?.bannerController?.closeBanner()}goToStep(e){this.previousStep=this.slotterElement.slotName,this.slotterElement.slotName=e}resetFlowState(){this.isSrCreationExperimentEnabled?this.goToStep(i.g.Topics):this.goToStep(i.g.NameAndDescription),this.subreddit={name:"",description:"",topics:[],type:e.cE.Public,isNSFW:!1}}closeModal(){this.resetFlowState(),this.rplDialog?.hide()}async firstUpdated(){await this.updateComplete,this.addSlotterListener(),this.addUpdateListener(),this.addWarningMessageListener(),this.setupCloseListeners(),this.rplDialog?.addEventListener("rpl-dialog:request-close",(()=>{e.f(this,i.l(this.slotterElement.slotName)),this.slotterElement?.slotName!==i.g.Celebration&&this.slotterElement?.slotName!==i.g.UpdateImages||this.resetFlowState()})),this.addEventListener("refresh_focus",this.refreshFocusAndUpdateTitle)}updated(e){super.updated(e),e.has("_loading")&&this.rplDialog?.portalContainer&&(this._loading?this.rplDialog.portalContainer.setAttribute("data-loading","true"):this.rplDialog.portalContainer.removeAttribute("data-loading"))}goBack(e){switch(e){case i.g.NameAndDescription:if(this.isSrCreationExperimentEnabled){this.goToStep(i.g.Type);break}this.closeModal();break;case i.g.Images:this.goToStep(i.g.NameAndDescription);break;case i.g.Topics:if(this.isSrCreationExperimentEnabled){this.closeModal();break}this.goToStep(i.g.Images);break;case i.g.Type:this.goToStep(i.g.Topics);break;case i.g.UpdateImages:this.goToStep(i.g.Celebration)}}async goNext(t){switch(t){case i.g.NameAndDescription:if(this.isSrCreationExperimentEnabled){if(e.f(this,i.t(t)),this.isCreationTemplatesEnabled){await this.handleSubmit(),this._loading||this.goToStep(i.g.Celebration);break}this.goToStep(i.g.Images);break}e.f(this,i.i(t)),this.goToStep(i.g.Images);break;case i.g.Images:if(this.isSrCreationExperimentEnabled){await this.handleSubmit();break}e.f(this,i.h(t)),this.clearError(),this.goToStep(i.g.Topics);break;case i.g.Topics:if(this.isSrCreationExperimentEnabled){e.f(this,i.i(t)),this.goToStep(i.g.Type);break}e.f(this,i.t(t)),this.goToStep(i.g.Type);break;case i.g.Type:if(this.isSrCreationExperimentEnabled){e.f(this,i.h(t)),this.clearError(),this.goToStep(i.g.NameAndDescription);break}this.handleSubmit();break;case i.g.Celebration:this.goToStep(i.g.UpdateImages);break;case i.g.UpdateImages:{const e=this.slotterElement.shadowRoot?.querySelector("community-image-editor");e&&(await e.handleSaveImage()),this.goToStep(i.g.Celebration);break}}}showModal(){this.rplDialog?.showModal()}async handleSubmit(){this._loading=!0,await this.createSubredditMutation()}async saveAvatar(t){if(void 0!==this.subreddit.avatar){const a=await this.imageUploader.saveCommunityIcon(t,"",this.subreddit.avatar);if(a){const t=e.c("faceplate-alert",{level:e.X.error,cause:"uncategorized",message:a});this.dispatchEvent(t)}}}async saveBanner(t){if(void 0!==this.subreddit.banner){const a=await this.imageUploader.saveBanner(t,"",this.subreddit.banner);if(a){const t=e.c("faceplate-alert",{level:e.X.error,cause:"uncategorized",message:a});this.dispatchEvent(t)}}}closeWarning(){this.showWarning=!1}renderWarningMessage(){return a.x`
${this.warningMessage?.title}
${e.Z({appearance:"secondary",attributes:{"aria-label":"Close",onclick:this.closeWarning},leadingIcon:a.c({size:a.I.Small}),size:e.ac.Small})}

${this.warningMessage?.message}

${this.warningMessage?.primaryButton?a.x`
${e.Z({children:this.warningMessage?.primaryButton,appearance:"primary",attributes:{className:"w-100",onclick:()=>{this.warningMessage?.primaryButtonClick&&this.warningMessage?.primaryButtonClick(),this.closeWarning()}}})}
`:""} ${this.warningMessage?.secondaryButton?a.x`
${e.Z({children:this.warningMessage?.secondaryButton,appearance:"secondary",attributes:{className:"w-100",onclick:this.closeWarning}})}
`:""}
`}goToNewCommunity(e){this._loading=!1,this.requestUpdate(),this.closeModal();const t=new URL(window.location.href);t.pathname=e,this.redirect(t)}redirect(e){window.location.href=e.href}async validateSubredditCreatedAndUpdated(){try{const t=await e.C({operation:e.H.SubredditStyles,variables:{subredditName:this.subreddit.name||""}});return!(null==t.data.subredditInfoByName||"Subreddit"!==t.data.subredditInfoByName.__typename||this.subreddit.avatar&&null==t.data.subredditInfoByName.styles?.icon||this.subreddit.banner&&null==t.data.subredditInfoByName.styles?.bannerBackgroundImage)}catch(e){return!1}}setCelebrationFooterButtonsHrefs(t){this._loading=!1;const a=this.rplDialog?.portalContainer.querySelector("#go-to-community-button");a&&(a.href=t);const i=this.rplDialog?.portalContainer.querySelector("#view-next-steps-button");if(i){const t=this.subreddit.type===e.cE.Public,a=!this.subreddit.isNSFW;t&&a?(i.href=`/mod/${this.subreddit.name}/achievements/category/set-up`,i.style.display=""):i.style.display="none"}}async pollUntilSubredditCreated(e){if(!0===(await this.validateSubredditCreatedAndUpdated()))return this.isCreationTemplatesEnabled?void this.setCelebrationFooterButtonsHrefs(e):void this.goToNewCommunity(e);let t=0;if(this.isCreationTemplatesEnabled){for(;t<5;){t+=1;if(!0===(await this.validateSubredditCreatedAndUpdated()))break;t<5&&(await new Promise((e=>setTimeout(e,1e3))))}return void this.setCelebrationFooterButtonsHrefs(e)}const a=setInterval((async()=>{t++;(!0===(await this.validateSubredditCreatedAndUpdated())||t>=5)&&(clearInterval(a),this.goToNewCommunity(e))}),1e3)}trackSubredditCreated(){e.f(this,i.j({name:this.subreddit.name,description_length:this.subreddit.description.length,banner_background_image:void 0!==this.subreddit.banner,icon_img:void 0!==this.subreddit.avatar,topics:this.subreddit.topics.map((e=>e.displayName)).join(","),topics_ids:this.subreddit.topics.map((e=>e.id)).join(","),topics_length:this.subreddit.topics.length,community_type:this.subreddit.type,nsfw:this.subreddit.isNSFW}))}async createSubredditMutation(){this.clearError(),this.trackSubredditCreated();const t={name:this.subreddit.name,isNsfw:this.subreddit.isNSFW,type:this.subreddit.type,publicDescription:this.subreddit.description,modSelectedTopics:this.subreddit.topics?.map((e=>e.id))};try{const e=await o(t);if(!(e&&e.path&&e.id))throw new Error("There was a problem creating the community. Please try again later.");this.subreddit.id=e.id,await Promise.all([this.saveAvatar(e.id),this.saveBanner(e.id)]),await this.pollUntilSubredditCreated(e.path)}catch(t){e.f(this,i.k({reason:t.message||"error creating community",setting_value:"creating_community"})),this._loading=!1;const a=e.c("faceplate-alert",{level:e.X.error,cause:"uncategorized",message:t.message});return void this.dispatchEvent(a)}}render(){return this._loading?a.x`
`:a.x`${this.showWarning?this.renderWarningMessage():""}`}};return m.styles=[e.K("\n .warning-message {\n position: fixed;\n width: 100vh;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n }\n @media (max-width: 528px) {\n :host {\n --horizontal-padding: 16px;\n --topbar-horizontal-padding: 16px;\n max-height: none;\n width: 100%;\n max-width: none;\n border-radius: 0;\n margin-top: 20px;\n padding-bottom: 0;\n transition: padding-bottom 200ms ease-in-out;\n z-index: 5;\n }\n }\n "),e.t],e._([e.n({type:String,attribute:"prefilled-name"})],m.prototype,"prefilledName",void 0),e._([e.n({type:Boolean,attribute:"sr-creation-experiment-enabled"})],m.prototype,"isSrCreationExperimentEnabled",void 0),e._([e.n({type:Boolean,attribute:"creation-templates-enabled"})],m.prototype,"isCreationTemplatesEnabled",void 0),e._([e.v()],m.prototype,"subreddit",void 0),e._([e.v()],m.prototype,"_loading",void 0),e._([e.v()],m.prototype,"showWarning",void 0),e._([e.v()],m.prototype,"editImageType",void 0),e._([e.v()],m.prototype,"previousStep",void 0),m=e._([e.e("community-creation-walkthrough")],m),{C:d,S:e=>`Step ${e} of 4.`,U:l,u:c};})); SML.di("./C42E8rVVpA.js",import.meta.url,"C42E8rVVpA");SML.di("./DUzIBJc2in.js",import.meta.url,"DUzIBJc2in");SML.di("./CsxDAjmHZE.js",import.meta.url,"CsxDAjmHZE");SML.di("./BtqmVQuPYp.js",import.meta.url,"BtqmVQuPYp");SML.di("./jnLprzpLrH.js",import.meta.url,"jnLprzpLrH"); SML.dm("7jLO_KarT_",["C42E8rVVpA","DUzIBJc2in","CsxDAjmHZE","BtqmVQuPYp","jnLprzpLrH"],(async(t,e,i,s,n)=>{let r=class extends i.s{constructor(){super(...arguments),this.ariaLive="polite",this.min=t.X.error,this.max=t.X.success,this._gesture=new s.T(this,{mouseSupport:!0}),this._alertsCtrl=new e.A(this,{batchWindow:100,onAlert:e=>{const s={...e,meta:{...e.meta},namedContent:{...e.namedContent}},{level:r,namedContent:o}=s;o.action??(o.action=t.Z({attributes:{onclick:()=>a.dismiss()},appearance:"plainInverted",leadingIcon:i.r()})),r===t.X.error&&(o.icon=i.u({size:i.h.Large})),r===t.X.warning&&(o.icon=i.v({size:i.h.Large}));const a=n.r(this,s);r&&r>=t.X.warning&&r<=t.X.success&&window.setTimeout((()=>{a.dismiss()}),s.meta?.duration??4e3),this.appendChild(a)},isOnline:()=>!0})}static get styles(){return i.i`:host{position:fixed}:host>slot{display:flex;flex-direction:column;gap:var(--spacer-md);align-items:center;position:fixed;inset-inline-start:50%;transform:translateX(-50%);padding:0 1rem;bottom:var(--rem16)}`}connectedCallback(){super.connectedCallback(),this._alertsCtrl.options.min=this.min,this._alertsCtrl.options.max=this.max,this._gesture.on("swipeleft",this._onSwipe),this._gesture.on("swiperight",this._onSwipe)}disconnectedCallback(){super.disconnectedCallback(),this._gesture.destroy()}_onSwipe(t){if(t instanceof MouseEvent)return;const e=t.target instanceof HTMLElement?t.target:null,i=e?.closest("faceplate-toast");i instanceof n.F&&i.dismiss()}render(){return i.x``}};return t._([t.n({type:String,reflect:!0,attribute:"aria-live"})],r.prototype,"ariaLive",void 0),t._([t.n({attribute:"min",converter:t.aw})],r.prototype,"min",void 0),t._([t.n({attribute:"max",converter:t.aw})],r.prototype,"max",void 0),r=t._([t.e("faceplate-toaster")],r),{get F(){return r}}})); SML.dm("7mROGt_umO",[],(async()=>{var e,n,t,a;!function(e){e.AllChats="all_chats",e.AllChatsSpoke="all_chats_spoke",e.Chat="chat",e.Community="community",e.FeedElementOverflowMenu="chat_channel_overflow",e.ChannelInfo="channel_info",e.ChannelInfoEdit="channel_info_edit",e.ChannelInfoModeration="channel_info_moderation",e.HomefeedElement="chat_module_home",e.HomefeedMultiChatElement="multi_chat_module_home",e.MultiChatOverflowMenu="multi_chat_channel_overflow",e.Post="post",e.RelatedChatChannels="chat_related_cc",e.RightRail="chat_right_rail",e.RightRailUpsell="chat_right_rail_upsell"}(e||(e={})),function(e){e.AllChannel="all_channel",e.Channel="channel",e.ChannelCreate="channel_create",e.Chat="chat",e.ChatChannel="chat_channel",e.ChatChannelsChannelsTab="chat_channels_channels_tab",e.ChatChannelsSettingsTab="chat_channels_settings_tab",e.Chats="chats",e.ContentControls="content_controls",e.CrowdControl="crowd_control",e.Delete="delete",e.DeleteConfirm="delete_confirm",e.DiscoverItem="discover_item",e.EditInfo="edit_info",e.FeedOverflowMenu="chat_channel_overflow",e.Hide="hide",e.ImageMessageLoading="image_message_loading",e.InAppToast="in_app_toast",e.InAppToastActionSheet="in_app_toast_action_sheet",e.OpenChannel="open_channel",e.OverflowMenu="overflow",e.RelatedChatChannel="related_cc",e.RightRailUpsell="chat_right_rail_upsell",e.Save="save",e.Screen="screen",e.SetUpButton="set_up_button",e.TopNav="top_nav",e.ViewModChat="view_mod_chat"}(n||(n={})),function(e){e.SubredditChannel="channel",e.UserChannel="reddit_ucc"}(t||(t={})),function(e){e.Subscribed="subscribed",e.RecommendedSingle="recommended_single",e.RecommendedMultiple="recommended_multiple",e.Empty=""}(a||(a={}));return{get C(){return e},get a(){return n},b:{Chat:"chat"},c:{Resize:"resize"},d:{Screen:"screen"}}})); SML.di("./C42E8rVVpA.js",import.meta.url,"C42E8rVVpA");SML.di("./B2hncWv3Jq.js",import.meta.url,"B2hncWv3Jq");SML.di("./BskNjLbli-.js",import.meta.url,"BskNjLbli-");SML.di("./CndptGkkPK.js",import.meta.url,"CndptGkkPK");SML.di("./BFDJQElz9q.js",import.meta.url,"BFDJQElz9q");SML.di("./CsxDAjmHZE.js",import.meta.url,"CsxDAjmHZE");SML.di("./DaR0j2K3uG.js",import.meta.url,"DaR0j2K3uG");SML.di("./Cse0G_xARZ.js",import.meta.url,"Cse0G_xARZ");SML.di("./DYFdTZXVs2.js",import.meta.url,"DYFdTZXVs2");SML.di("./DUzIBJc2in.js",import.meta.url,"DUzIBJc2in");SML.di("./DW4Y66xecc.js",import.meta.url,"DW4Y66xecc");SML.di("./CCtMKamAzh.js",import.meta.url,"CCtMKamAzh"); SML.dm("ALUmE1s_ix",["C42E8rVVpA","B2hncWv3Jq","BskNjLbli-","CndptGkkPK","BFDJQElz9q","CsxDAjmHZE","DaR0j2K3uG","Cse0G_xARZ","DYFdTZXVs2","DUzIBJc2in","DW4Y66xecc","CCtMKamAzh"],(async(t,e,i,s,n,a)=>{const l="additionalContent";var o;!function(t){t.ADDITION="addition",t.REMOVAL="removal"}(o||(o={}));let r=class extends a.s{get uncheckedInputs(){return this.querySelectorAll("faceplate-checkbox-input:not([checked])")}get allInputs(){return this.querySelectorAll("faceplate-checkbox-input")}get tabpanel(){return this.querySelector("faceplate-tabpanel")}get badges(){return this.querySelectorAll("temporary-tabgroup span[rpl] span")}get additionalContentInput(){return document.querySelector("#additional-content")}connectedCallback(){super.connectedCallback(),this.initEventListeners();const t=this.getRootNode().host?.closest("report-form");t&&(this.helpers=new s.R(t)),this.badges&&this.badges.forEach((t=>{const e=t.closest("span.gap-xs");e?.classList.remove("gap-xs"),t.classList.add("hidden")})),this.populateValues()}disconnectedCallback(){super.disconnectedCallback()}firstUpdated(){this.updateComplete.then((()=>{(this.isFlexibleReporting||this.isSmartEscalations)&&this.updateFormState()}))}constructor(){super(),this.selectLimit=2,this.isFlexibleReporting=!1,this.isSmartEscalations=!1,this.initEventListeners=()=>{const t=this.allInputs;t?.forEach((t=>{t.addEventListener("input",this.handleClick)}));const e=this.querySelectorAll("temporary-tabgroup button");e?.forEach((t=>{t.addEventListener("click",this.resetPanelScroll)}));const i=this.querySelectorAll(".empty-state-button");i?.forEach((t=>{t.addEventListener("click",this.toggleEmptyState)}))},this.resetPanelScroll=async()=>{await this.updateComplete,this.tabpanel?.scrollTo(0,0)},this.normalizeValueArray=t=>{const e=Array.from(this.allInputs,(t=>t.getAttribute("data-value"))),i=t?.split(",");return i?.filter((t=>e.includes(t)))},this.populateValues=()=>{const t=this.isFlexibleReporting||this.isSmartEscalations?this.additionalContentInput?.getAttribute("value"):this.helpers?.getHiddenInputValue(l);if(!t)return;const e=this.isSmartEscalations?this.normalizeValueArray(t).slice(0,this.selectLimit):t?.split(",");this.isSmartEscalations&&this.additionalContentInput?.setAttribute("value",e.slice(0,this.selectLimit).toString()),this.populateCheckboxSelections(e),this.populateBadgeCounts(e)},this.populateCheckboxSelections=t=>{const e=t.length===this.selectLimit;this.allInputs.forEach((i=>{const s=i.getAttribute("data-value")??"";t?.includes(s)?i.checked=!0:e&&(i.disabled=!0)}))},this.populateBadgeCounts=t=>{const e=t.reduce(((t,e)=>n.j(e)?{...t,posts:t.posts+1}:e.startsWith("t1_")?{...t,comments:t.comments+1}:t),{posts:0,comments:0}),i=this.badges[0],s=this.badges[1];e.posts>0&&(i.parentElement?.parentElement?.parentElement?.classList.add("gap-xs"),i.classList.remove("hidden"),i.textContent=e.posts.toString()),e.comments>0&&(s.parentElement?.parentElement?.parentElement?.classList.add("gap-xs"),s.classList.remove("hidden"),s.textContent=e.comments.toString())},this.toggleEmptyState=t=>{const e=this.tabpanel,i=t.currentTarget,s=i.getAttribute("slot")?.split("-")[1];e?.setAttribute("pageindex",`${s}`)},this.disableAllUnchecked=()=>{this.uncheckedInputs.forEach((t=>{t.disabled=!0}))},this.enableAllUnchecked=()=>{this.uncheckedInputs.forEach((t=>{t.removeAttribute("disabled")}))},this.modifyList=(t,e)=>{if(!t)return{modificationType:o.ADDITION,newList:[e]};const i=t.split(",");return i.includes(e)?{modificationType:o.REMOVAL,newList:i.filter((t=>t!==e))}:{modificationType:o.ADDITION,newList:[...i,e]}},this.updateBadgeCounts=t=>{const e=this.querySelector("temporary-tabgroup [faceplate-tab-selected]"),i=e?.querySelector("span[rpl] span");if(!i)return;const s=Number(i.textContent),n=i.parentElement?.parentElement?.parentElement;t===o.ADDITION&&(n?.classList.add("gap-xs"),i.classList.remove("hidden"),i.textContent=`${s+1}`),t===o.REMOVAL&&(s-1==0&&(n?.classList.remove("gap-xs"),i.classList.add("hidden")),i.textContent=""+(s-1))},this.handleClick=async t=>{t.preventDefault(),t.stopPropagation();const e=t.currentTarget,i=e?.getAttribute("data-value")??"",s=this.isFlexibleReporting||this.isSmartEscalations,n=s?this.additionalContentInput?.getAttribute("value")??"":this.helpers?.getHiddenInputValue(l)??"";if(!i)return;const{modificationType:a,newList:o}=this.modifyList(n,i);this.updateBadgeCounts(a),s?this.additionalContentInput?.setAttribute("value",o.toString()):this.helpers?.setHiddenInputValue(l,o.toString()),await this.updateComplete,s&&this.updateFormState(),o.length===this.selectLimit?this.disableAllUnchecked():n.split(",").length===this.selectLimit&&this.enableAllUnchecked()},this.updateFormState=()=>{if(this.isSmartEscalations)this.dispatchEvent(t.c("update-smart-escalations-form-state",{stepName:i.S.ADDITIONAL_CONTENT,value:this.additionalContentInput?.getAttribute("value")??"",nextStep:i.S.FREE_TEXT}));else{const e=Array.from(this.uncheckedInputs,(t=>t.getAttribute("data-value")));this.dispatchEvent(t.c("report-tracking",{reportFlow:{flowOptionSelected:i.F.ADD_CONTENT,flowContent:this.additionalContentInput?.getAttribute("value")??"",flowOptionAvailable:e.toString()}})),this.dispatchEvent(t.c("update-report-form",{fieldName:i.S.ADDITIONAL_CONTENT,value:this.additionalContentInput?.getAttribute("value")??"",nextAction:{type:this.nextActionType,step:this.nextStep},button:{isDisabled:!1}}))}}}render(){return a.x``}};t._([t.n({type:Number,attribute:"select-limit"})],r.prototype,"selectLimit",void 0),t._([t.n({type:Boolean,attribute:"is-flexible-reporting"})],r.prototype,"isFlexibleReporting",void 0),t._([t.n({type:String,attribute:"data-nextaction"})],r.prototype,"nextActionType",void 0),t._([t.n({type:String,attribute:"data-next-step"})],r.prototype,"nextStep",void 0),t._([t.n({type:Boolean,attribute:"is-smart-escalations"})],r.prototype,"isSmartEscalations",void 0),r=t._([t.e("multi-content-wrapper")],r);let c=class extends e.F{connectedCallback(){super.connectedCallback(),this._events._events.delete("click"),this._events.define("click",(t=>{const e=t.composedPath();for(let t=0;t{let o=class extends t.s{constructor(){super(...arguments),this.isVisible=!1,this.alertMessage="",this.isDevelopment=!1,this.appearance="plain",this.openBanner=t=>{const r=t;this.alert=r.detail;const{level:n=e.X.none}=this.alert,a="Server error. Try again later.",s=this.alert?.content??this.alert?.message??a;switch(n){case e.X.emergency:case e.X.alert:case e.X.critical:case e.X.error:this.appearance="error";break;case e.X.warning:case e.X.notice:this.appearance="caution";break;case e.X.success:this.appearance="success";break;default:this.appearance="plain"}const i=`Multiple errors occured, including: ${s}`;n<=e.X.success||this.isDevelopment?this.isVisible?this.alertMessage=this.isDevelopment?i:a:(this.alertMessage=s,this.isVisible=!0):this.isVisible=!1},this.closeBanner=()=>{this.isVisible=!1}}connectedCallback(){super.connectedCallback(),this.addEventListener("show-banner",this.openBanner)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("show-banner",this.openBanner)}render(){return t.x`${this.isVisible?t.x`
${this.alert?.namedContent?.icon?this.alert.namedContent.icon:n.w()}
${a.bj("error",{"aria-label":"close error button",onclick:this.closeBanner})}
`:t.A}`}};o.styles=[e.t],e._([e.v()],o.prototype,"isVisible",void 0),e._([e.v()],o.prototype,"alertMessage",void 0),o=e._([e.e("banner-controller")],o);let l=class extends t.s{constructor(){super(...arguments),this.ariaLive="polite",this._gesture=new i.T(this,{mouseSupport:!0}),this.handleToast=r=>{const n=r.detail,a={...n,meta:{...n.meta},namedContent:{...n.namedContent}},{level:i,namedContent:o,meta:l}=a;o.action??(o.action=e.Z({attributes:{onclick:()=>c.dismiss()},appearance:"plainInverted",leadingIcon:t.c()}));const c=s.r(this,a);i&&i>=e.X.warning&&i<=e.X.success&&!l?.disableAutoDismiss&&window.setTimeout((()=>{c.dismiss()}),l?.duration??4e3),this.appendChild(c)}}static get styles(){return t.i`:host{position:fixed}:host>slot{display:flex;flex-direction:column;gap:var(--spacer-md);align-items:center;position:fixed;left:50%;transform:translateX(-50%);padding:0 1rem;bottom:var(--rem16)}`}connectedCallback(){super.connectedCallback(),this.addEventListener("show-toast",this.handleToast),this._gesture.on("swipeleft",this._onSwipe),this._gesture.on("swiperight",this._onSwipe)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("show-toast",this.handleToast),this._gesture.destroy()}_onSwipe(e){if(e instanceof MouseEvent)return;const t=e.target instanceof HTMLElement?e.target:null,r=t?.closest("faceplate-toast");r instanceof s.F&&r.dismiss()}render(){return t.x``}};e._([e.n({type:String,reflect:!0,attribute:"aria-live"})],l.prototype,"ariaLive",void 0),l=e._([e.e("toaster-lite")],l);let c=class extends t.s{constructor(){super(...arguments),this.ariaLive="polite",this.min=e.X.error,this.max=e.X.success,this.BATCH_TIMEOUT=100,this._alertsCtrl=new a.A(this,{batchWindow:this.BATCH_TIMEOUT,onAlert:a=>{const{level:s=e.X.none}=a;if(a.namedContent=a.namedContent||{},"string"==typeof a.namedContent.iconTemplateId){const e=document.querySelector(a.namedContent.iconTemplateId);e&&(a.namedContent.icon=e.content.cloneNode(!0))}if(!a.namedContent.icon)switch(s){case e.X.emergency:case e.X.alert:case e.X.critical:case e.X.error:a.namedContent.icon=r.e({size:t.I.Large});break;case e.X.warning:case e.X.notice:a.namedContent.icon=n.w({size:t.I.Large})}if("string"==typeof a.namedContent.actionTemplateId){const e=document.querySelector(a.namedContent.actionTemplateId);e&&(a.namedContent.action=e.content.cloneNode(!0))}if(s<=e.X.error)return this._trackEvent(a,"banner"),this.triggerBanner(a);this._trackEvent(a,"toast"),this.triggerToast(a)},isOnline:()=>!0}),this._trackEvent=(t,r)=>{e.f(this,e.b({source:"client",action:"record",noun:"alert"},{action_info:{feature:t.sourceElement||"unknown",reason:t.cause||t.message||"unknown",setting_value:`${t.level??"unknown"}`,type:r}}))},this.triggerToast=t=>{this.toaster?.dispatchEvent(e.c("show-toast",t))},this.triggerBanner=t=>{this.bannerController?.dispatchEvent(e.c("show-banner",t))}}connectedCallback(){super.connectedCallback(),this._alertsCtrl.options.min=this.min,this._alertsCtrl.options.max=this.max}render(){return t.x` `}};c.styles=[t.i`:host{position:fixed;width:100%}`,e.t],e._([e.n({type:String,reflect:!0,attribute:"aria-live"})],c.prototype,"ariaLive",void 0),e._([e.n({attribute:"min",converter:e.aw})],c.prototype,"min",void 0),e._([e.n({attribute:"max",converter:e.aw})],c.prototype,"max",void 0),e._([e.Q("banner-controller")],c.prototype,"bannerController",void 0),e._([e.Q("toaster-lite")],c.prototype,"toaster",void 0),c=e._([e.e("alert-controller")],c)})); SML.dm("Af-MWsPOE9",[],(async()=>{var e,r;return function(e){e.Succeeded="Succeeded",e.Cancelled="Cancelled",e.Error="Error"}(e||(e={})),function(e){e.Devvit="Devvit",e.Default="Default"}(r||(r={})),{get C(){return e},get P(){return r},p:function(e){return Object.hasOwn(e,"productID")}}})); SML.di("./C42E8rVVpA.js",import.meta.url,"C42E8rVVpA");SML.di("./DYFdTZXVs2.js",import.meta.url,"DYFdTZXVs2");SML.di("./DUzIBJc2in.js",import.meta.url,"DUzIBJc2in");SML.di("./CsxDAjmHZE.js",import.meta.url,"CsxDAjmHZE"); SML.dm("B2hncWv3Jq",["C42E8rVVpA","DYFdTZXVs2","DUzIBJc2in","CsxDAjmHZE"],(async(t,e,i,n)=>{var s;let a=s=class extends e.F{constructor(){super(...arguments),this._setup=!1,this._bbwidth=0,this._fbwidth=0,this._forwardButtonVisible=!0,this._backButtonVisible=!1,this.selectedClasses=["bg-secondary-background-selected","!text-neutral-content-strong","tab-selected"],this.appearance="fill",this.insetHug=!1,this.underline=!1,this._mutationCallback=t=>{for(const e of t)if("attributes"===e.type&&"faceplate-tab-selected"===e.attributeName&&e.target.nodeType===Node.ELEMENT_NODE){e.target.hasAttribute("faceplate-tab-selected")?this._handleTabSelected(e.target):this._handleTabDeselected(e.target)}},this._setupButtons=()=>{this._setup&&(this.backButtonElements[0]?.removeEventListener("click",this._handleBackButtonClick),this.style.removeProperty("--back-button-width"),this.forwardButtonElements[0]?.removeEventListener("click",this._handleForwardButtonClick),this.style.removeProperty("--forward-button-width")),this.backButtonElements[0]instanceof HTMLElement&&(this._backButtonVisible||this.backButton?.removeAttribute("hidden"),this._bbwidth=this.backButton.clientWidth,this._backButtonVisible||this.backButton?.setAttribute("hidden",""),this.style.setProperty("--back-button-width",`${this._bbwidth}px`),this.backButtonElements[0].addEventListener("click",this._handleBackButtonClick)),this.forwardButtonElements[0]instanceof HTMLElement&&(this._forwardButtonVisible||this.forwardButton?.removeAttribute("hidden"),this._fbwidth=this.forwardButton.clientWidth,this._forwardButtonVisible||this.backButton?.setAttribute("hidden",""),this.style.setProperty("--forward-button-width",`${this._fbwidth}px`),this.forwardButtonElements[0].addEventListener("click",this._handleForwardButtonClick))},this._handleContainerScroll=()=>{this._backButtonVisible=0!==Math.floor(this._containerLeft),this._forwardButtonVisible=Math.round(this._containerBaseRight)!==Math.round(this.container?.scrollWidth??0)},this._handleBackButtonClick=t=>{t.preventDefault(),t.stopPropagation();const e=this._tabs,i=this._leftmostVisibleTab,n=e[i];if(null==n)return;let a=n.right-(this.container?.clientWidth??0);i!==e.length-1&&(a+=(this._fbwidth??0)-s.tabSpacing.raw),this.container?.scroll({behavior:"smooth",left:a})},this._handleForwardButtonClick=t=>{t.preventDefault(),t.stopPropagation();const e=this._tabs,i=this._rightmostVisibleTab,n=e[i];if(null==n)return;let a=n.left;0!==i&&(a-=(this._bbwidth??0)+s.tabSpacing.raw),this.container?.scroll({behavior:"smooth",left:a})},this._scrollToSelected=()=>{const t=this._tabs,e=t.findIndex((t=>"true"===t.el.getAttribute("aria-selected"))),i=t[e];if(null==i)return;const n=i.right-i.left,s=(this.container?.clientWidth??0)-(this._bbwidth+this._fbwidth),a=i.left-this._bbwidth-s/2+n/2;this.container?.scroll({behavior:"smooth",left:a})}}connectedCallback(){super.connectedCallback(),this._mutationObserver=new MutationObserver(this._mutationCallback),this._mutationObserver.observe(this,s.mutationObserverOptions)}disconnectedCallback(){super.disconnectedCallback(),this._mutationObserver.disconnect()}firstUpdated(t){super.firstUpdated(t),this._setupAll()}_setupAll(){this._setup&&this.container&&(this.container.removeEventListener("scroll",this._handleContainerScroll),this._resizeObserver?.unobserve(this.container)),this.container?.addEventListener("scroll",this._handleContainerScroll),this.container?.removeEventListener("resize",this._setupAll),this._setupButtons(),this._resizeObserver||(this._resizeObserver=new ResizeObserver(this._handleContainerScroll)),this.container&&this._resizeObserver?.observe(this.container),this._setup||(this.style.setProperty("--anim-duration","0ms"),this._handleContainerScroll(),requestAnimationFrame((()=>{this.style.removeProperty("--anim-duration")}))),this._setup=!0}_handleTabSelected(t){let e=this.selectedClasses;t.classList.contains("tab-bottom-border")&&t.hasAttribute("rpl")&&(e=e?.filter((t=>"bg-secondary-background-selected"!==t))),t.classList.add(...e??[]),t.tabIndex=0,this._scrollToSelected()}_handleTabDeselected(t){t.tabIndex=-1,t.classList.remove(...this.selectedClasses??[])}get _containerBaseWidth(){return this.container?.clientWidth??0}get _containerBaseLeft(){return this.container?.scrollLeft??0}get _containerLeft(){return 0===this._containerBaseLeft?this._containerBaseLeft:this._containerBaseLeft+(this.backButton?.clientWidth??0)+s.tabSpacing.raw}get _containerBaseRight(){return this._containerBaseLeft+this._containerBaseWidth}get _containerRight(){return this._containerBaseRight===this.container?.scrollWidth?this._containerBaseRight:this._containerBaseRight-((this.forwardButton?.clientWidth??0)+s.tabSpacing.raw)}get _rightmostVisibleTab(){const t=this._tabs;let e=0,i=0;for(let i=t.length-1;i>=0;i--)if(t[i]?.isVisible){e=i;break}if(0===e)for(let i=t.length-1;i>=0;i--)if(t[i]?.partiallyVisible){e=i;break}for(const[e,n]of t.entries()){const s=t[i];n.partiallyVisible&&s&&n.right>s.right&&(i=e)}return i<=e&&e=e&&e>0?e-1:t[i]?.isVisible&&0!==i?i-1:i}get _tabs(){const{pageNames:t}=this,e=[];for(const n of i.b(this.pages)){const i=t?t[n-1]:`page-${n}`,s=this.shadowRoot.querySelector(`slot[name="${i}"]`).parentElement,a=s.offsetLeft,r=s.offsetLeft+s.offsetWidth,o=a>this._containerLeft&&athis._containerLeft,l=a>this._containerLeft&&rthis._containerRight;e.push({el:s,left:a,right:r,isVisible:l,partiallyVisible:o})}return e}render(){const e=super.render();return n.x`
${e}
`}};return a.mutationObserverOptions={childList:!0,subtree:!0,attributes:!0,attributeFilter:["faceplate-tab-selected"]},a.tabSpacing={raw:8},a.backButton=()=>t.Z({appearance:"plain",attributes:{type:"button",tabindex:"-1",slot:"back-button"},shape:"pill",size:t.ac.Small,leadingIcon:n.a0({size:n.h.Small}),screenReaderContent:"back"}),a.forwardButton=()=>t.Z({appearance:"plain",attributes:{type:"button",tabindex:"-1",slot:"forward-button"},shape:"pill",size:t.ac.Small,leadingIcon:n.a1({size:n.h.Small}),screenReaderContent:"forward"}),a.styles=n.i`:host{--plain-background:rgba(255, 255, 255, 0);--anim-duration:300ms;--button-gap:var(--spacer-xs, 8);display:flex;width:fit-content;max-width:100%}@media (prefers-color-scheme:dark){:host{--plain-background:rgba(0, 0, 0, 0)}}@media (prefers-reduced-motion){:host{--anim-duration:0ms}}.hideable{transition:opacity var(--anim-duration,300ms) ease;visibility:visible;opacity:1}.hidden{animation-name:hide-button;animation-duration:var(--anim-duration,300ms);animation-fill-mode:forwards;opacity:0}@keyframes hide-button{from{visiblity:visible}to{visiblity:hidden;z-index:-1}}.container{width:fit-content;max-width:100%;overflow:hidden;display:flex;justify-content:center;align-items:center;flex-direction:row;flex-wrap:nowrap;position:relative}.tablist{display:flex;overflow:auto;align-items:center;flex-flow:row nowrap;gap:var(--button-gap);scroll-behavior:smooth;scrollbar-width:none}.tablist::-webkit-scrollbar{display:none}.tablist:focus-visible{outline:0}[role=tab]{display:flex;flex-shrink:0}.internalButton{position:absolute;top:0;bottom:0;display:flex;align-items:center}.internalForwardButton{inset-inline-end:0;padding-inline-start:var(--button-gap);background-image:linear-gradient(to right,var(--plain-background) 0,var(--color-neutral-background) 30%);cursor:pointer}.internalBackButton{inset-inline-start:0;padding-inline-end:var(--button-gap);background-image:linear-gradient(to left,var(--plain-background) 0,var(--color-neutral-background) 30%);cursor:pointer}:host([inset]) .container{margin:0 var(--spacer-md)}:host([appearance=fill]){--button-gap:0;width:100%}:host([appearance=fill]) .container,:host([appearance=fill]) .tablist{width:inherit}:host([appearance=fill]) [role=tab]{flex-grow:1}:host([underline]) .container::after{position:absolute;display:block;content:'';border-bottom:solid var(--rem1) var(--color-neutral-border-weak);inset-inline:0;bottom:0}`,t._([t.Q(".internalForwardButton")],a.prototype,"forwardButton",void 0),t._([t.Q(".internalBackButton")],a.prototype,"backButton",void 0),t._([t.Q(".tablist")],a.prototype,"container",void 0),t._([t.l({slot:"forward-button"})],a.prototype,"forwardButtonElements",void 0),t._([t.l({slot:"back-button"})],a.prototype,"backButtonElements",void 0),t._([t.v()],a.prototype,"_forwardButtonVisible",void 0),t._([t.v()],a.prototype,"_backButtonVisible",void 0),t._([t.n({attribute:!1})],a.prototype,"selectedClasses",void 0),t._([t.n({attribute:!0})],a.prototype,"appearance",void 0),t._([t.n({attribute:!0,type:Boolean})],a.prototype,"insetHug",void 0),t._([t.n({attribute:!0,type:Boolean})],a.prototype,"underline",void 0),a=s=t._([t.e("faceplate-tabgroup")],a),{get F(){return a}}})); SML.di("./C42E8rVVpA.js",import.meta.url,"C42E8rVVpA");SML.di("./DYFdTZXVs2.js",import.meta.url,"DYFdTZXVs2");SML.di("./DUzIBJc2in.js",import.meta.url,"DUzIBJc2in");SML.di("./CsxDAjmHZE.js",import.meta.url,"CsxDAjmHZE"); SML.dm("B2hncWv3Jq",["C42E8rVVpA","DYFdTZXVs2","DUzIBJc2in","CsxDAjmHZE"],(async(t,e,i,n)=>{var s;let a=s=class extends e.F{constructor(){super(...arguments),this._setup=!1,this._bbwidth=0,this._fbwidth=0,this._forwardButtonVisible=!0,this._backButtonVisible=!1,this.selectedClasses=["bg-secondary-background-selected","!text-neutral-content-strong","tab-selected"],this.appearance="fill",this.insetHug=!1,this.underline=!1,this._mutationCallback=t=>{for(const e of t)if("attributes"===e.type&&"faceplate-tab-selected"===e.attributeName&&e.target.nodeType===Node.ELEMENT_NODE){e.target.hasAttribute("faceplate-tab-selected")?this._handleTabSelected(e.target):this._handleTabDeselected(e.target)}},this._setupButtons=()=>{this._setup&&(this.backButtonElements[0]?.removeEventListener("click",this._handleBackButtonClick),this.style.removeProperty("--back-button-width"),this.forwardButtonElements[0]?.removeEventListener("click",this._handleForwardButtonClick),this.style.removeProperty("--forward-button-width")),this.backButtonElements[0]instanceof HTMLElement&&(this._backButtonVisible||this.backButton?.removeAttribute("hidden"),this._bbwidth=this.backButton.clientWidth,this._backButtonVisible||this.backButton?.setAttribute("hidden",""),this.style.setProperty("--back-button-width",`${this._bbwidth}px`),this.backButtonElements[0].addEventListener("click",this._handleBackButtonClick)),this.forwardButtonElements[0]instanceof HTMLElement&&(this._forwardButtonVisible||this.forwardButton?.removeAttribute("hidden"),this._fbwidth=this.forwardButton.clientWidth,this._forwardButtonVisible||this.backButton?.setAttribute("hidden",""),this.style.setProperty("--forward-button-width",`${this._fbwidth}px`),this.forwardButtonElements[0].addEventListener("click",this._handleForwardButtonClick))},this._handleContainerScroll=()=>{this._backButtonVisible=0!==Math.floor(this._containerLeft),this._forwardButtonVisible=Math.round(this._containerBaseRight)!==Math.round(this.container?.scrollWidth??0)},this._handleBackButtonClick=t=>{t.preventDefault(),t.stopPropagation();const e=this._tabs,i=this._leftmostVisibleTab,n=e[i];if(null==n)return;let a=n.right-(this.container?.clientWidth??0);i!==e.length-1&&(a+=(this._fbwidth??0)-s.tabSpacing.raw),this.container?.scroll({behavior:"smooth",left:a})},this._handleForwardButtonClick=t=>{t.preventDefault(),t.stopPropagation();const e=this._tabs,i=this._rightmostVisibleTab,n=e[i];if(null==n)return;let a=n.left;0!==i&&(a-=(this._bbwidth??0)+s.tabSpacing.raw),this.container?.scroll({behavior:"smooth",left:a})},this._scrollToSelected=()=>{const t=this._tabs,e=t.findIndex((t=>"true"===t.el.getAttribute("aria-selected"))),i=t[e];if(null==i)return;const n=i.right-i.left,s=(this.container?.clientWidth??0)-(this._bbwidth+this._fbwidth),a=i.left-this._bbwidth-s/2+n/2;this.container?.scroll({behavior:"smooth",left:a})}}connectedCallback(){super.connectedCallback(),this._mutationObserver=new MutationObserver(this._mutationCallback),this._mutationObserver.observe(this,s.mutationObserverOptions)}disconnectedCallback(){super.disconnectedCallback(),this._mutationObserver.disconnect()}firstUpdated(t){super.firstUpdated(t),this._setupAll()}_setupAll(){this._setup&&this.container&&(this.container.removeEventListener("scroll",this._handleContainerScroll),this._resizeObserver?.unobserve(this.container)),this.container?.addEventListener("scroll",this._handleContainerScroll),this.container?.removeEventListener("resize",this._setupAll),this._setupButtons(),this._resizeObserver||(this._resizeObserver=new ResizeObserver(this._handleContainerScroll)),this.container&&this._resizeObserver?.observe(this.container),this._setup||(this.style.setProperty("--anim-duration","0ms"),this._handleContainerScroll(),requestAnimationFrame((()=>{this.style.removeProperty("--anim-duration")}))),this._setup=!0}_handleTabSelected(t){let e=this.selectedClasses;t.classList.contains("tab-bottom-border")&&t.hasAttribute("rpl")&&(e=e?.filter((t=>"bg-secondary-background-selected"!==t))),t.classList.add(...e??[]),t.tabIndex=0,this._scrollToSelected()}_handleTabDeselected(t){t.tabIndex=-1,t.classList.remove(...this.selectedClasses??[])}get _containerBaseWidth(){return this.container?.clientWidth??0}get _containerBaseLeft(){return this.container?.scrollLeft??0}get _containerLeft(){return 0===this._containerBaseLeft?this._containerBaseLeft:this._containerBaseLeft+(this.backButton?.clientWidth??0)+s.tabSpacing.raw}get _containerBaseRight(){return this._containerBaseLeft+this._containerBaseWidth}get _containerRight(){return this._containerBaseRight===this.container?.scrollWidth?this._containerBaseRight:this._containerBaseRight-((this.forwardButton?.clientWidth??0)+s.tabSpacing.raw)}get _rightmostVisibleTab(){const t=this._tabs;let e=0,i=0;for(let i=t.length-1;i>=0;i--)if(t[i]?.isVisible){e=i;break}if(0===e)for(let i=t.length-1;i>=0;i--)if(t[i]?.partiallyVisible){e=i;break}for(const[e,n]of t.entries()){const s=t[i];n.partiallyVisible&&s&&n.right>s.right&&(i=e)}return i<=e&&e=e&&e>0?e-1:t[i]?.isVisible&&0!==i?i-1:i}get _tabs(){const{pageNames:t}=this,e=[];for(const n of i.b(this.pages)){const i=t?t[n-1]:`page-${n}`,s=this.shadowRoot.querySelector(`slot[name="${i}"]`).parentElement,a=s.offsetLeft,r=s.offsetLeft+s.offsetWidth,o=a>this._containerLeft&&athis._containerLeft,l=a>this._containerLeft&&rthis._containerRight;e.push({el:s,left:a,right:r,isVisible:l,partiallyVisible:o})}return e}render(){const e=super.render();return n.x`
${e}
`}};return a.mutationObserverOptions={childList:!0,subtree:!0,attributes:!0,attributeFilter:["faceplate-tab-selected"]},a.tabSpacing={raw:8},a.backButton=()=>t.Z({appearance:"plain",attributes:{type:"button",tabindex:"-1",slot:"back-button"},shape:"pill",size:t.ac.Small,leadingIcon:n.a0({size:n.h.Small}),screenReaderContent:"back"}),a.forwardButton=()=>t.Z({appearance:"plain",attributes:{type:"button",tabindex:"-1",slot:"forward-button"},shape:"pill",size:t.ac.Small,leadingIcon:n.a1({size:n.h.Small}),screenReaderContent:"forward"}),a.styles=n.i`:host{--plain-background:rgba(255, 255, 255, 0);--anim-duration:300ms;--button-gap:var(--spacer-xs, 8);display:flex;width:fit-content;max-width:100%}@media (prefers-color-scheme:dark){:host{--plain-background:rgba(0, 0, 0, 0)}}@media (prefers-reduced-motion){:host{--anim-duration:0ms}}.hideable{transition:opacity var(--anim-duration,300ms) ease;visibility:visible;opacity:1}.hidden{animation-name:hide-button;animation-duration:var(--anim-duration,300ms);animation-fill-mode:forwards;opacity:0}@keyframes hide-button{from{visiblity:visible}to{visiblity:hidden;z-index:-1}}.container{width:fit-content;max-width:100%;overflow:hidden;display:flex;justify-content:center;align-items:center;flex-direction:row;flex-wrap:nowrap;position:relative}.tablist{display:flex;overflow:auto;align-items:center;flex-flow:row nowrap;gap:var(--button-gap);scroll-behavior:smooth;scrollbar-width:none}.tablist::-webkit-scrollbar{display:none}.tablist:focus-visible{outline:0}[role=tab]{display:flex;flex-shrink:0}.internalButton{position:absolute;top:0;bottom:0;display:flex;align-items:center}.internalForwardButton{inset-inline-end:0;padding-inline-start:var(--button-gap);background-image:linear-gradient(to right,var(--plain-background) 0,var(--color-neutral-background) 30%);cursor:pointer}.internalBackButton{inset-inline-start:0;padding-inline-end:var(--button-gap);background-image:linear-gradient(to left,var(--plain-background) 0,var(--color-neutral-background) 30%);cursor:pointer}:host([inset]) .container{margin:0 var(--spacer-md)}:host([appearance=fill]){--button-gap:0;width:100%}:host([appearance=fill]) .container,:host([appearance=fill]) .tablist{width:inherit}:host([appearance=fill]) [role=tab]{flex-grow:1}:host([underline]) .container::after{position:absolute;display:block;content:'';border-bottom:solid var(--rem1) var(--color-neutral-border-weak);inset-inline:0;bottom:0}`,t._([t.Q(".internalForwardButton")],a.prototype,"forwardButton",void 0),t._([t.Q(".internalBackButton")],a.prototype,"backButton",void 0),t._([t.Q(".tablist")],a.prototype,"container",void 0),t._([t.l({slot:"forward-button"})],a.prototype,"forwardButtonElements",void 0),t._([t.l({slot:"back-button"})],a.prototype,"backButtonElements",void 0),t._([t.v()],a.prototype,"_forwardButtonVisible",void 0),t._([t.v()],a.prototype,"_backButtonVisible",void 0),t._([t.n({attribute:!1})],a.prototype,"selectedClasses",void 0),t._([t.n({attribute:!0})],a.prototype,"appearance",void 0),t._([t.n({attribute:!0,type:Boolean})],a.prototype,"insetHug",void 0),t._([t.n({attribute:!0,type:Boolean})],a.prototype,"underline",void 0),a=s=t._([t.e("faceplate-tabgroup")],a),{get F(){return a}}})); SML.di("./C42E8rVVpA.js",import.meta.url,"C42E8rVVpA");SML.di("./fkwt71QUP_.js",import.meta.url,"fkwt71QUP_");SML.di("./RVjQJ3_OrG.js",import.meta.url,"RVjQJ3_OrG");SML.di("./CsxDAjmHZE.js",import.meta.url,"CsxDAjmHZE");SML.di("./DUzIBJc2in.js",import.meta.url,"DUzIBJc2in"); SML.dm("B4SlC9EIct",["C42E8rVVpA","fkwt71QUP_","RVjQJ3_OrG","CsxDAjmHZE","DUzIBJc2in"],(async(o,e,a)=>{const r={[e.B.Back]:"secondary_cta",[e.B.Close]:"dismiss",[e.B.GetApp]:"primary_cta",[e.B.Login]:"secondary_cta",[e.B.Signup]:"secondary_cta",[e.B.DontShowAgain]:"dismiss"},n={[e.B.Login]:"primary_cta",[e.B.NotOver18]:"secondary_cta",[e.B.Over18]:"secondary_cta",[e.B.Back]:"dismiss"},t={[a.A.LOGIN]:"secondary_cta",[a.A.SIGNUP]:"secondary_cta",[a.A.OPEN_APP]:"primary_cta",[a.A.GOOGLE_SSO]:"primary_cta",[a.A.APPLE_SSO]:"primary_cta",[a.A.EMAIL]:"secondary_cta",[a.A.CLOSE]:"dismiss"},i="unknown";function c(e){return{name:"shreddit_xpromo_views",type:o.al.Counter,value:1,labels:e}}function _(e){return{name:"shreddit_xpromo_clicks",type:o.al.Counter,value:1,labels:e}}return{CSP_TARGET_BY_ACTION_INFO_TYPE:t,DESKTOP_XPROMO_TARGET_BY_MODAL_BUTTON_TEXT:n,XPROMO_TARGET_BY_MODAL_BUTTON_TEXT:r,getW3ReportsFromV2Event:function(e){const a=o.a_(e),s=o.a$()===o.b0.Desktop,p=[];switch(a){case"global/view/screen":e.action_info?.trigger_type===o.b1.Initial&&p.push({name:"shreddit_page_views",type:o.al.Counter,value:1});break;case"xpromo/view/app_selector":case"xpromo/view/bottom_bar":case"xpromo/view/marketplace_community_launch":case"xpromo/view/nsfw_blur":case"xpromo/view/top_button":case"xpromo/view/unrated_block":case"xpromo/view/viral_community":case"xpromo/view/ios_educational_deeplink":case"xpromo/view/lo_only_bottom_sheet":p.push(c({xpromo_name:e.noun}));break;case"xpromo/view/logged_in_action":p.push(c({xpromo_name:e.noun,target:e.action_info?.type||"other"}));break;case"xpromo/click/marketplace_community_launch":case"xpromo/dismiss/nsfw_blur":case"xpromo/click/nsfw_blur":case"xpromo/click/unrated_block":case"xpromo/click/app_selector":case"xpromo/click/viral_community":case"xpromo/click/ios_educational_deeplink":case"xpromo/click/lo_only_bottom_sheet":{const o=e?.popup?.button_text,a=s?n[o]||i:r[o]||i;a!==i&&p.push(_({target:a,xpromo_name:e.noun}));break}case"xpromo/click/logged_in_action":{const o=e.action_info?.type;p.push(_({xpromo_name:e.noun,target:t[o]||"other"}));break}case"xpromo/click/bottom_bar":case"xpromo/click/top_button":p.push(_({target:"primary_cta",xpromo_name:e.noun}));break;case"onboarding/click/login":case"onboarding/click/register":case"onboarding/click/signup_drawer":{const a=e.action_info?.type;a&&p.push({name:"shreddit_auth_flow_provider_clicks",type:o.al.Counter,value:1,labels:{auth_flow:e.noun,provider:a}});break}case"onboarding/resolve/login":case"onboarding/resolve/one_tap":case"onboarding/resolve/register":case"onboarding/resolve/signup_drawer":{const a=e?.action_info?.reason,r=e?.action_info?.type;a&&r&&p.push({name:"shreddit_auth_flow_resolved_accounts",type:o.al.Counter,value:1,labels:{auth_flow:e.noun,method:a,provider:r}});break}case"onboarding/dismiss/google_one_tap":{const a=e?.action_info?.reason;a&&p.push({name:"shreddit_google_one_tap_dismissed_moments",type:o.al.Counter,value:1,labels:{reason:a}});break}}return p}}})); SML.di("./C42E8rVVpA.js",import.meta.url,"C42E8rVVpA");SML.di("./CndptGkkPK.js",import.meta.url,"CndptGkkPK");SML.di("./1i4g9fLWHY.js",import.meta.url,"1i4g9fLWHY");SML.di("./CKuUwv2_dV.js",import.meta.url,"CKuUwv2_dV");SML.di("./CuC-xwr_mY.js",import.meta.url,"CuC-xwr_mY");SML.di("./CsxDAjmHZE.js",import.meta.url,"CsxDAjmHZE");SML.di("./D_F1vtGIq1.js",import.meta.url,"D_F1vtGIq1");SML.di("./BcUlF1uWDA.js",import.meta.url,"BcUlF1uWDA");SML.di("./CY0v7Q95fp.js",import.meta.url,"CY0v7Q95fp");SML.di("./2F24kjFEFA.js",import.meta.url,"2F24kjFEFA");SML.di("./DoAaOvteiR.js",import.meta.url,"DoAaOvteiR");SML.di("./BnZOm2BOqI.js",import.meta.url,"BnZOm2BOqI");SML.di("./C2rAA4roMn.js",import.meta.url,"C2rAA4roMn");SML.di("./CMAMkGxOzL.js",import.meta.url,"CMAMkGxOzL"); SML.dm("B7-syxD746",["C42E8rVVpA","CndptGkkPK","CuC-xwr_mY","CsxDAjmHZE","2F24kjFEFA","1i4g9fLWHY","CKuUwv2_dV","D_F1vtGIq1","BcUlF1uWDA","CY0v7Q95fp","DoAaOvteiR","BnZOm2BOqI","C2rAA4roMn","CMAMkGxOzL"],(async(e,t,i,r,a)=>{var s,n;!function(e){e.isSubmitError="isSubmitError",e.isRateLimitError="isRateLimitError",e.isBlockingError="isBlockingError",e.isReportBlockingSuccess="isReportBlockingSuccess",e.isReportUnblockingSuccess="isReportUnblockingSuccess"}(s||(s={})),function(e){e.Post="post",e.Comment="comment",e.User="user",e.PrivateMessage="private_message"}(n||(n={}));class o{constructor(t){this.gqlOperationByType={[n.Post]:e.H.ReportPost,[n.Comment]:e.H.ReportComment,[n.User]:e.H.ReportUserDetails,[n.PrivateMessage]:e.H.ReportPrivateMessage},this.inputKeyByType={[n.Post]:"postId",[n.Comment]:"commentId",[n.User]:"redditorId",[n.PrivateMessage]:"messageId"},this.getItemType=e=>{if(e.includes("t4_"))return n.PrivateMessage;if(e.includes("t3_"))return n.Post;if(e.includes("t2_"))return n.User;if(e.includes("t1_"))return n.Comment;throw new Error("Unsupported item type provided")},this.onReportSubmit=async e=>{const{actionData:t,hiddenInputValues:i}=e;if(!t)return;const r=i.thingId,a=this.getItemType(r),s=this.reportPayloadGenerator(i,t),n=await this.getReportOperationResponse(a,r,s);if(!n||n.errors&&n.errors.length)return!1;const o="reportPost"in n.data&&n.data?.reportPost?.ok,l="reportComment"in n.data&&n.data?.reportComment?.ok,d="reportUserDetails"in n.data&&n.data?.reportUserDetails?.ok,u="reportPrivateMessage"in n.data&&n.data?.reportPrivateMessage?.ok;return o||l||d||u},this.onCTLReportSubmit=async(e,t)=>{const i=this.getItemType(e),r=await this.getReportOperationResponse(i,e,{fromHelpDesk:!1,siteRule:"SELF_HARM",...(t ? {userDetailType:t} : {})});if(!r||r.errors&&r.errors.length)return!1;const a="reportPost"in r.data&&r.data?.reportPost?.ok,s="reportComment"in r.data&&r.data?.reportComment?.ok,n="reportUserDetails"in r.data&&r.data?.reportUserDetails?.ok;return!!(a||s||n)||null},this.reportPayloadGenerator=(e,t)=>{const{ruleType:i,ruleId:r,freeText:a,additionalContent:s}=t,o=e[r.ref],l=this.getItemType(e.thingId),d={fromHelpDesk:!1,...(this.isEmbed ? {hostAppName:"R2"} : {})};if("site"===i?d.siteRule=o:"subreddit"===i&&"other"===o?d.customRule=e["customRule.value"]:d.subredditRule=e["subredditRule.value"],l===n.User&&(d.userDetailType=e["userDetail.value"]),a&&a.ref&&(d.freeText=e["freeText.value"]),s&&s.ref){const t=e[s.ref];t&&(d.reportedItems=t.split(",").map((e=>({itemId:e}))))}return d},this.getReportOperationResponse=async(e,t,i)=>{const r=this.inputKeyByType[e];if(!r)throw new Error("Unsupported item type provided");const a={[r]:t,...i};return await this.reportRequest(e,a)},this.reportRequest=async(t,i)=>{const r=this.gqlOperationByType[t];if(!r)throw new Error("Unsupported item type provided");try{return await e.C({operation:r,variables:{input:i}})}catch(e){return}},this.isEmbed=t}}let l=class extends r.s{constructor(){super(...arguments),this.isEmbed=!1,this.permalink="",this.countryCode="",this.buttonText="Next",this.isDisabled=!0,this.href="",this.onButtonClick=t=>{t.stopImmediatePropagation();const i=this.config.action,r=i?this.helpers?.getAction(i):null;if(i&&r){const t=this.helpers?.performAction(r);if("screenId"===t?.key){const i=e.c("shreddit-slotter-set-slot-name",{slotName:t.value}),r=this.helpers?.getHiddenInputValue("screenSequence"),a=r.split(" ");a.push(t.value),this.helpers?.setHiddenInputValue("screenSequence",a.toString()),this.getRootNode().host.dispatchEvent(i)}else t?.formSubmit?(this.dispatchEvent(e.c("submit-report-modal",{thingId:this.helpers?.getHiddenInputValue("thingId")})),this.handleSubmission(t.data)):t?.href?("DSA"===this.helpers?.getHiddenInputValue("categoryOrRule.value")&&this.countryCode?window.open(a.c("https://support.reddithelp.com/hc/requests/new?ticket_form_id=19623931614484",this.countryCode,this.permalink)):window.open(t.href),this.dispatchEvent(e.c("close-report-modal",{buttonAction:i.actionType}))):t?.formClose?this.dispatchEvent(e.c("close-report-modal",{buttonAction:i.actionType})):t?.openCtlFlow&&this.dispatchEvent(e.c("open-ctl-modal"))}},this.toggleLoadingIndicator=()=>{const e=this.shadowRoot?.querySelector("faceplate-progress"),t=this.shadowRoot?.querySelector("span.report-button-content");e?.classList.toggle("hidden"),t?.classList.toggle("opacity-0")},this.handleSubmission=async t=>{this.toggleLoadingIndicator();const i=this.helpers?.getAllHiddenInputValues();if(t&&i){(await (this.gqlHelpers?.onReportSubmit({actionData:t,hiddenInputValues:i})))?(this.helpers?.setHiddenInputValue("formSubmitted","true"),this.formEl?.querySelector("shreddit-slotter")?.dispatchEvent(e.c("shreddit-slotter-set-slot-name",{slotName:"formSubmitted"}))):this.dispatchEvent(e.c("faceplate-alert",{level:e.X.error,cause:"uncategorized",message:"An error occurred while submitting your report. Wait a bit, and try again."}))}},this.initTemplatedUrlListener=()=>{const{action:e}=this.config;if(e&&"openTemplatedUrl"===e.actionType){const t=e.args;if(t){const i=t?.placeholders;i?.forEach((i=>{const r=t[i]?.ref;r&&this.formEl?.querySelector(`input[type=hidden][name="${r}"]`)?.addEventListener("change",(()=>{const t=this.helpers?.performAction(e);t?.href&&(this.href=t.href)}))}))}}},this.initEventListeners=()=>{const{text:e,disabled:t}=this.config;if(!this.helpers?.isString(e)){const t=this.helpers?.getTextDataRef(e);t&&this.formEl?.querySelector(`input[type=hidden][name="${t}"]`)?.addEventListener("change",(()=>{this.buttonText=this.helpers?.getText(this.config.text)??this.buttonText}))}if(t){const e=this.helpers?.getDisabledRef(t);e&&e.length&&e.forEach((e=>this.formEl?.querySelector(`input[type=hidden][name="${e}"]`)?.addEventListener("change",(async()=>{this.isDisabled=(this.config.disabled&&this.helpers?.getDisabledCondition(this.config.disabled))??this.isDisabled,await this.updateComplete,this.getRootNode()?.host?.getRootNode()?.host?.getModal().focusManager.refresh()}))))}else this.isDisabled=!1;this.initTemplatedUrlListener()}}firstUpdated(){this.initEventListeners()}connectedCallback(){super.connectedCallback();const e=this.getRootNode().host.closest("report-form");this.formEl=e,this.helpers=new t.R(e),this.gqlHelpers=new o(this.isEmbed),this.buttonText=this.helpers?.getText(this.config.text)??this.buttonText,this.config.disabled?this.isDisabled=this.helpers?.getDisabledCondition(this.config.disabled)??this.isDisabled:this.isDisabled=!1}render(){const t=this.href?{href:this.href,target:"_blank",rel:"noopener noreferrer"}:{};return r.x` ${e.Z({appearance:"primary",attributes:{disabled:this.isDisabled,onclick:this.onButtonClick,className:"w-full s:w-auto relative",...t},children:r.x` ${this.buttonText}`})} `}};l.styles=[e.t],e._([e.n({type:Object})],l.prototype,"config",void 0),e._([e.n({type:Boolean,attribute:"is-embed"})],l.prototype,"isEmbed",void 0),e._([e.n({type:String,attribute:"permalink"})],l.prototype,"permalink",void 0),e._([e.n({type:String,attribute:"country-code"})],l.prototype,"countryCode",void 0),e._([e.v()],l.prototype,"buttonText",void 0),e._([e.v()],l.prototype,"isDisabled",void 0),e._([e.v()],l.prototype,"href",void 0),l=e._([e.e("report-action")],l);const d=[{hiddenInputRef:"value",inputAttribute:"value"},{hiddenInputRef:"nextAction",inputAttribute:"data-nextaction"},{hiddenInputRef:"label",inputAttribute:"data-label"},{hiddenInputRef:"description",inputAttribute:"data-description"}];let u=class extends r.s{firstUpdated(){this.updateComplete.then((()=>{this.dispatchEvent(e.c("report-form-rendered"))}))}constructor(){super(),this.reasonSelectionCache={},this.getSlotter=()=>this.querySelector("shreddit-slotter")?.shadowRoot,this.getSelectedReason=()=>this.getSlotter()?.querySelector("[data-buttonbar] button.button-activated"),this.getHiddenInput=e=>this.querySelector("form")?.querySelector(`input[type=hidden][name="${e}"]`),this.getFormElementById=e=>this.getSlotter()?.querySelector(`#${e}`),this.setHiddenInputValue=(e,t)=>{const i=this.getHiddenInput(e);i?.setAttribute("value",t??""),i?.dispatchEvent(new Event("change"))},this.getPreviousValue=e=>{if(e===t.S){const i=this.getHiddenInput(t.C)?.getAttribute("value")??"",r=this.reasonSelectionCache[i];this.setHiddenInputValue(e,r)}return this.getHiddenInput(e)?.getAttribute("value")},this.populateValue=async({fieldName:e,el:t,elType:i})=>{if(e){const r=this.getPreviousValue(e);if(r||""===r)switch(i){case"button":t.getAttribute("value")===r&&this.toggleReportReason(t);break;case"textDisplay":t.textContent=r,await this.updateComplete,this.helpers?.bottomScrollIntoViewIfNeeded(this.getSelectedReason());break;case"radioInput":t.getAttribute("value")===r&&t.setAttribute("checked","true");break;default:t.setAttribute("value",r)}}},this.toggleReportReason=e=>{const t=this.getSelectedReason();t&&(t.classList.remove("button-activated"),t.ariaChecked=null,t.removeAttribute("aria-describedby")),e.classList.add("button-activated"),e.ariaChecked="true",e.setAttribute("aria-describedby","report-footer-content-body")},this.updateHiddenInputsFromReportReason=e=>{const t=e.getAttribute("data-ref");d.forEach((({hiddenInputRef:i,inputAttribute:r})=>{this.setHiddenInputValue(`${t}.${i}`,e.getAttribute(r))}))},this.updateReasonSelectionCache=e=>{const i=this.getHiddenInput(t.C)?.getAttribute("value")??"";this.reasonSelectionCache={...this.reasonSelectionCache,[i]:e}},this.addReportReasonListeners=()=>{const e=this.getSlotter()?.querySelectorAll("[data-buttonbar] button");e?.length&&e.forEach((e=>{const t=e.getAttribute("data-ref");this.populateValue({fieldName:`${t}.value`,el:e,elType:"button"}),e.addEventListener("click",(e=>{e.stopImmediatePropagation(),e.currentTarget instanceof Element&&(this.toggleReportReason(e.currentTarget),this.updateHiddenInputsFromReportReason(e.currentTarget))}))}))},this.createTextWithLinkElement=e=>e.map((e=>"Link"===e.type?r.x`${i.a({children:e.text,attributes:{href:e.linkTo,target:"_blank",rel:"noopener noreferrer"}})}  `:r.x`${e.text} `)),this.showCurrentDynamicLinkElements=(e,t)=>{const i=JSON.parse(e);this.createTextWithLinkElement(i).forEach((e=>{const i=document.createElement("div");r.B(e,i),t.appendChild(i.firstElementChild)}))},this.addFooterListener=(e,t)=>{const i=this.getFormElementById(e),r=i?.getAttribute(t);i&&r&&(this.populateValue({fieldName:i.getAttribute(t),el:i,elType:"textDisplay"}),this.getHiddenInput(r)?.addEventListener("change",(async e=>{e.currentTarget instanceof Element&&(this.setFooterContent(i,e.currentTarget),await this.updateComplete,this.helpers?.bottomScrollIntoViewIfNeeded(this.getSelectedReason()))})))},this.setFooterContent=(e,t)=>{e.firstChild&&(e.innerHTML="");const i=t.getAttribute("value");i?.includes("PlainText")?this.showCurrentDynamicLinkElements(i,e):e.textContent=t.getAttribute("value")??""},this.addReasonFooterContentListeners=()=>{this.addFooterListener("report-footer-content-title","data-title-ref"),this.addFooterListener("report-footer-content-body","data-text-ref")},this.addRadioListeners=()=>{const e=this.getSlotter()?.querySelectorAll("faceplate-radio-input");e?.length&&e?.forEach((e=>{this.populateValue({fieldName:`${e.getAttribute("name")}.value`,el:e,elType:"radioInput"}),e.addEventListener("input",(e=>{if(e.currentTarget instanceof Element){const t=e.currentTarget.getAttribute("name"),i=e.currentTarget.getAttribute("value");this.setHiddenInputValue(`${t}.value`,i),this.updateReasonSelectionCache(i??"")}}))}))},this.showTextInput=e=>{e.classList.remove("hidden"),this.querySelector("shreddit-slotter")?.shadowRoot?.querySelector('faceplate-radio-input[name="subredditRule"][value="other"]')?.scrollIntoView()},this.addTextInputListeners=()=>{const e=this.getSlotter()?.querySelectorAll("faceplate-textarea-input");e?.length&&e.forEach((e=>{const t=e.getAttribute("data-visibility-ref"),i=e.getAttribute("data-visibility-check");this.populateValue({fieldName:e.name,el:e,elType:"textInput"});if(t&&i){const r=this.getHiddenInput(t);r?.getAttribute("value")===i&&this.showTextInput(e),r?.addEventListener("change",(t=>{t.currentTarget.getAttribute("value")===i?this.showTextInput(e):e.classList.contains("hidden")||e.classList.add("hidden")}))}e.shadowRoot?.querySelector("textarea")?.addEventListener("keyup",(e=>{const t=e.currentTarget.getAttribute("name"),i=e.currentTarget.value;t&&i&&this.setHiddenInputValue(t,i)}))}))},this.addUserBlockingSwitchListener=()=>{const t=this.getSlotter()?.querySelector("faceplate-switch-input");t&&t.addEventListener("click",(()=>{const i=t.checked;this.dispatchEvent(e.c("report-flow-blocking",{checked:i}))}))},this.addInteractionListeners=()=>{this.addReportReasonListeners(),this.addReasonFooterContentListeners(),this.addRadioListeners(),this.addTextInputListeners(),this.addUserBlockingSwitchListener()},this.addStepChangeListener=()=>{const e=this.querySelector("shreddit-slotter");e?.addEventListener("shreddit-slotter-set-slot-name",(async()=>{await e.updateComplete,this.addInteractionListeners()}))},this.initEventListeners=e=>{"report/view/reportform"===e.SAN&&(this.addInteractionListeners(),this.addStepChangeListener())},this.helpers=new t.R(this),this.addEventListener("faceplate-track",this.initEventListeners)}render(){return r.x` `}};u.styles=[r.i`:host{display:block;width:100%}`,e.t],e._([e.n({type:String,attribute:"author-id"})],u.prototype,"authorId",void 0),u=e._([e.e("report-form")],u);let h=class extends r.s{static get styles(){return[r.i`:host>faceplate-banner{display:flex;flex-direction:column;gap:var(--spacer-md);align-items:center;position:fixed;left:50%;transform:translateX(-50%);padding:0 1rem;bottom:var(--rem16);width:calc(100% - 2rem)}`,e.t]}disconnectedCallback(){super.disconnectedCallback()}connectedCallback(){super.connectedCallback(),this.showError&&(this.dispatchAlert({}),this.dispatchCloseReportFlowEvent()),this.isEmbed&&this.thingId?.startsWith("t3_")&&this.stageCustomPostSnapshot()}async stageCustomPostSnapshot(){if(!this.devvitInitialRender)return;const e=this.closest("devvit-wrapper");e&&e.dispatchEvent(new CustomEvent("stage-devplatform-snapshot",{detail:{postId:this.thingId,encodedData:this.devvitInitialRender},bubbles:!0,composed:!0}))}constructor(){super(),this.isEmbed=!1,this.thingId="",this.isOpen=!1,this.showError=!1,this.authorId="",this.authorName="",this.partialSrc="/svc/shreddit/report-flow/",this.getModal=()=>this.isDesktop?this.querySelector("faceplate-modal"):this.querySelector("faceplate-bottom-sheet"),this.initModalCloseListener=()=>{this.getModal()?.querySelector("#report-modal-close")?.addEventListener("click",this.onCloseModal)},this.dispatchCloseReportFlowEvent=()=>{this.dispatchEvent(e.c("report-flow-close"))},this.closeFramedModal=()=>{this.isEmbed&&parent.postMessage(JSON.stringify({type:"close.framedmodal"}),"*")},this.onCloseModal=e=>{if(e){const{buttonAction:t}=e.detail;this.isUserBlockedSwitchChecked&&"formClose"===t&&this.handleUserBlocking()}this.getModal()?.close(),this.dispatchCloseReportFlowEvent(),this.closeFramedModal()},this.addBaseSlotterListener=()=>{const e=this.getModal()?.querySelector("shreddit-slotter");e?.addEventListener("shreddit-slotter-set-slot-name",(async()=>{await e.updateComplete,this.getModal()?.focusManager.refresh(),this.getModal()?.focusManager.focusFirst()}))},this.initFlowSlotterListener=()=>{this.addEventListener("shreddit-slotter-set-slot-name",(()=>{this.renderBackButton(),this.updateModalTitle()}))},this.initModal=()=>{this.initFlowSlotterListener(),this.getModal()?.showModal(),this.initModalCloseListener(),this.initEscapeListener(),this.initModalBackButtonListener(),this.addBaseSlotterListener(),this.isEmbed&&parent.postMessage(JSON.stringify({type:"loaded.framedmodal"}),"*")},this.getInputValue=e=>this.getModal()?.querySelector("report-form")?.querySelector(`form input[type=hidden][name="${e}"]`)?.getAttribute("value"),this.setInputValue=(e,t)=>this.getModal()?.querySelector("report-form")?.querySelector(`form input[type=hidden][name="${e}"]`)?.setAttribute("value",t),this.onBackButtonClick=()=>{const t=this.getInputValue("screenSequence").split(","),i=t.slice(0,t.length);i.pop(),this.setInputValue("screenSequence",i.toString());const r=e.c("shreddit-slotter-set-slot-name",{slotName:i[i.length-1]});this.querySelector("shreddit-slotter").dispatchEvent(r)},this.renderBackButton=()=>{const e=this.getModal()?.querySelector("#report-modal-back");if(e){const t=this.getInputValue("formSubmitted");this.getInputValue("screenSequence").split(",").length>1&&"false"===t?(e?.classList.remove("hidden"),e.disabled=!1):(e?.classList.add("hidden"),e.disabled=!0)}},this.updateModalTitle=async()=>{await this.updateComplete;"true"===this.getInputValue("formSubmitted")&&(this.getModal()?.querySelector(".header-title")?.classList.add("hidden"),this.getModal()?.querySelector(".report-success-title")?.classList.remove("hidden"))},this.initModalBackButtonListener=()=>{this.getModal()?.querySelector("#report-modal-back")?.addEventListener("click",this.onBackButtonClick)},this.initEscapeListener=()=>{document.addEventListener("keydown",(e=>{if("Escape"===e.key){const e=this.getModal(),t=this.getCTLModal();""===e?.getAttribute("open")&&this.onCloseModal(),""===t?.getAttribute("open")&&this.onCloseCTLModal()}}))},this.handleUserBlocking=async()=>{try{await e.C({operation:e.H.UpdateRedditorBlockState,variables:{input:{redditorId:this.authorId,blockState:e.e2.Blocked}}}),this.dispatchAlert({level:e.X.success,message:`u/${this.authorName} is now blocked.`})}catch(t){this.dispatchAlert({level:e.X.error,message:"An error has occured. Please try again later"})}},this.dispatchAlert=({level:t=e.X.error,message:i="Reporting is currently unavailable. Try reloading the page or waiting a few minutes, before trying again."})=>{this.dispatchEvent(e.c("faceplate-alert",{level:t,message:i}))},this.onCloseCTLModal=()=>{this.getCTLModal()?.close(),this.dispatchCloseReportFlowEvent(),this.closeFramedModal()},this.addCTLSlotterListener=()=>{const e=this.getCTLModal()?.querySelector("shreddit-slotter");e?.addEventListener("shreddit-slotter-set-slot-name",(async()=>{await e.updateComplete,this.getCTLModal()?.focusManager.refresh(),this.getCTLModal()?.focusManager.focusFirst();const t=this.getCTLModal()?.querySelector("shreddit-slotter")?.shadowRoot?.querySelector("#ctl-ok-button");t?.addEventListener("click",this.onCloseCTLModal)}))},this.getCTLModal=()=>this.querySelector("#ctl-modal"),this.initCTLModalCloseListener=()=>{this.getCTLModal()?.querySelector("#ctl-modal-close")?.addEventListener("click",this.onCloseCTLModal)},this.initCTLModal=async()=>{this.getModal()?.close(),this.getCTLModal()?.showModal(),this.initCTLModalCloseListener()},this.showThankYou=()=>{const t=e.c("shreddit-slotter-set-slot-name",{slotName:"thankyou"});this.getCTLModal()?.querySelector("shreddit-slotter")?.dispatchEvent(t)},this.submitCTLReport=async()=>{const t=this.helpers?.getHiddenInputValue("userDetail.value");(await (this.gqlHelpers?.onCTLReportSubmit(this.thingId, t)))?this.showThankYou():this.dispatchAlert({level:e.X.error,message:"An error occurred while submitting your report. Wait a bit, and try again."})},this.initCTLListeners=e=>{if("report/view/ctl"===e.SAN){const e=this.getCTLModal()?.querySelector("shreddit-slotter")?.shadowRoot?.querySelector("#ctl-yes-button");e?.addEventListener("click",this.submitCTLReport),this.getCTLModal()?.focusManager.refresh(),this.getCTLModal()?.focusManager.focusFirst(),this.addCTLSlotterListener()}},this.gqlHelpers=new o(this.isEmbed);const i=this.querySelector("report-form");i&&(this.helpers=new t.R(i)),this.addEventListener("report-form-rendered",this.initModal),this.addEventListener("faceplate-track",this.initCTLListeners),this.addEventListener("close-report-modal",this.onCloseModal),this.addEventListener("open-ctl-modal",this.initCTLModal),this.addEventListener("report-flow-blocking",(e=>{const{checked:t}=e.detail;this.isUserBlockedSwitchChecked=t}))}render(){return r.x``}};e._([e.n({type:Boolean,attribute:"is-desktop"})],h.prototype,"isDesktop",void 0),e._([e.n({type:Boolean,attribute:"is-embed"})],h.prototype,"isEmbed",void 0),e._([e.n({type:String,attribute:"thing-id"})],h.prototype,"thingId",void 0),e._([e.n({type:Boolean,attribute:"is-open"})],h.prototype,"isOpen",void 0),e._([e.n({type:Boolean,attribute:"show-error"})],h.prototype,"showError",void 0),e._([e.n({type:String,attribute:"author-id"})],h.prototype,"authorId",void 0),e._([e.n({type:String,attribute:"author-name"})],h.prototype,"authorName",void 0),e._([e.n({type:String,attribute:"devvit-initial-render"})],h.prototype,"devvitInitialRender",void 0),h=e._([e.e("report-flow")],h)})); SML.di("./C42E8rVVpA.js",import.meta.url,"C42E8rVVpA");SML.di("./CsxDAjmHZE.js",import.meta.url,"CsxDAjmHZE"); SML.dm("BEzA-QPMTz",["C42E8rVVpA","CsxDAjmHZE"],(async(t,e)=>{let i=class extends e.s{constructor(){super(...arguments),this.type="",this.detail={},this.dispatchFromTarget=!1}handleClick(e){(this.dispatchFromTarget?e.target??this:this).dispatchEvent(t.c(this.type,this.detail))}handleKeydown(t){"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handleClick(t))}render(){return e.x``}};t._([t.n({type:String,attribute:"type"})],i.prototype,"type",void 0),t._([t.n({type:Object,attribute:"detail"})],i.prototype,"detail",void 0),t._([t.n({type:Boolean,attribute:"dispatch-from-target"})],i.prototype,"dispatchFromTarget",void 0),i=t._([t.e("custom-event-dispatch-wrapper")],i)})); SML.di("./C42E8rVVpA.js",import.meta.url,"C42E8rVVpA");SML.di("./CuC-xwr_mY.js",import.meta.url,"CuC-xwr_mY");SML.di("./Uj_4iRVeQl.js",import.meta.url,"Uj_4iRVeQl");SML.di("./B-DM_KtOOe.js",import.meta.url,"B-DM_KtOOe");SML.di("./CsxDAjmHZE.js",import.meta.url,"CsxDAjmHZE");SML.di("./DUzIBJc2in.js",import.meta.url,"DUzIBJc2in"); SML.dm("BPIKD-7Sf_",["C42E8rVVpA","CuC-xwr_mY","Uj_4iRVeQl","B-DM_KtOOe","CsxDAjmHZE","DUzIBJc2in"],(async(a,r,e,i,t)=>{var n;!function(a){a.LEFT="left",a.RIGHT="right",a.BOTTOM="bottom"}(n||(n={}));let l=class extends t.s{constructor(){super(...arguments),this.leftSidebar=null,this.rightSidebar=null,this.bottomBar=null,this.handleNavigationClick=(r,e)=>{if(r.preventDefault(),r.stopPropagation(),e===n.LEFT&&s(this.leftSidebar))return this.leftSidebar.focusContents();let i;switch(e){case n.LEFT:i=this.leftSidebar;break;case n.BOTTOM:i=this.bottomBar?.portalContainer||this.bottomBar;break;case n.RIGHT:default:i=this.rightSidebar}if(i){const r=a.aU(i);r?r.focus():i.focus()}}}connectedCallback(){super.connectedCallback(),this.leftSidebar=document.getElementById(i.a.LeftSidebarContainer),this.rightSidebar=document.getElementById("right-sidebar-container"),this.bottomBar=document.getElementById("email-capture-bottom-sheet")}render(){return t.x`${this.leftSidebar?t.x`${r.a({attributes:{href:"#left-sidebar-container",onclick:a=>this.handleNavigationClick(a,n.LEFT),className:"sr-only focus:not-sr-only hidden m:inline-block"},children:"Skip to Navigation"})} `:""}${this.rightSidebar?t.x`${r.a({attributes:{href:"#right-sidebar-container",onclick:a=>this.handleNavigationClick(a,n.RIGHT),className:"sr-only focus:not-sr-only hidden m:inline-block"},children:"Skip to Right Sidebar"})} `:""} ${this.bottomBar?t.x`${r.a({attributes:{href:"#bottom-bar-container",onclick:a=>this.handleNavigationClick(a,n.BOTTOM),className:"sr-only focus:not-sr-only hidden m:inline-block"},children:"Skip to Bottom Bar"})} `:""}`;}};l.styles=[a.t],l=a._([a.e("reddit-skip-to-sidebar")],l);const s=a=>a instanceof e.F;return{get RedditSkipToSidebar(){return l}}})); SML.di("./C42E8rVVpA.js",import.meta.url,"C42E8rVVpA");SML.di("./CsxDAjmHZE.js",import.meta.url,"CsxDAjmHZE"); SML.di("./4SW1PeumCl.js",import.meta.url,"4SW1PeumCl");SML.di("./C42E8rVVpA.js",import.meta.url,"C42E8rVVpA");SML.di("./CsxDAjmHZE.js",import.meta.url,"CsxDAjmHZE");SML.di("./DnH8baXgu3.js",import.meta.url,"DnH8baXgu3");SML.di("./D8Nk5WxpiL.js",import.meta.url,"D8Nk5WxpiL");SML.di("./DEQ5AnqT_V.js",import.meta.url,"DEQ5AnqT_V");SML.di("./B2hncWv3Jq.js",import.meta.url,"B2hncWv3Jq");SML.di("./MvWSZOZYAh.js",import.meta.url,"MvWSZOZYAh");SML.di("./DjjIXmCgnO.js",import.meta.url,"DjjIXmCgnO");SML.di("./1i4g9fLWHY.js",import.meta.url,"1i4g9fLWHY");SML.di("./DdizCVGdC6.js",import.meta.url,"DdizCVGdC6");SML.di("./Cse0G_xARZ.js",import.meta.url,"Cse0G_xARZ");SML.di("./DDTa19N1fy.js",import.meta.url,"DDTa19N1fy");SML.di("./BEzA-QPMTz.js",import.meta.url,"BEzA-QPMTz");SML.di("./C9S3A50Ur_.js",import.meta.url,"C9S3A50Ur_");SML.di("./BYyjGDBWHg.js",import.meta.url,"BYyjGDBWHg");SML.di("./BnZOm2BOqI.js",import.meta.url,"BnZOm2BOqI");SML.di("./CxBOcTjMlj.js",import.meta.url,"CxBOcTjMlj");SML.di("./DW4Y66xecc.js",import.meta.url,"DW4Y66xecc");SML.di("./CndptGkkPK.js",import.meta.url,"CndptGkkPK");SML.di("./DUzIBJc2in.js",import.meta.url,"DUzIBJc2in");SML.di("./BcUlF1uWDA.js",import.meta.url,"BcUlF1uWDA");SML.di("./tn7sgJBOIW.js",import.meta.url,"tn7sgJBOIW");SML.di("./BxXMRtW0Ao.js",import.meta.url,"BxXMRtW0Ao");SML.di("./BkjgI35gdl.js",import.meta.url,"BkjgI35gdl");SML.di("./DrwVpipAUZ.js",import.meta.url,"DrwVpipAUZ");SML.di("./9vUF7asw4v.js",import.meta.url,"9vUF7asw4v");SML.di("./Ns-fTnJmu9.js",import.meta.url,"Ns-fTnJmu9");SML.di("./B2OLf9kcBe.js",import.meta.url,"B2OLf9kcBe");SML.di("./DZBIvVodeO.js",import.meta.url,"DZBIvVodeO");SML.di("./BHPKNOzIpV.js",import.meta.url,"BHPKNOzIpV");SML.di("./B5z9hfVW57.js",import.meta.url,"B5z9hfVW57");SML.di("./DCWWud_0J8.js",import.meta.url,"DCWWud_0J8");SML.di("./BaFXWsm32y.js",import.meta.url,"BaFXWsm32y");SML.di("./DUaETbwyQ9.js",import.meta.url,"DUaETbwyQ9");SML.di("./D_F1vtGIq1.js",import.meta.url,"D_F1vtGIq1");SML.di("./CCtMKamAzh.js",import.meta.url,"CCtMKamAzh");SML.di("./C2rAA4roMn.js",import.meta.url,"C2rAA4roMn");SML.di("./C-4AJ2Y78L.js",import.meta.url,"C-4AJ2Y78L");SML.di("./wDRHyxVKtb.js",import.meta.url,"wDRHyxVKtb");SML.di("./cjhvxMuwOm.js",import.meta.url,"cjhvxMuwOm");SML.di("./BFfc43snhj.js",import.meta.url,"BFfc43snhj");SML.di("./Cm_szELb1W.js",import.meta.url,"Cm_szELb1W");SML.di("./PJJ5-f-jpV.js",import.meta.url,"PJJ5-f-jpV");SML.di("./DdaDf_pDuu.js",import.meta.url,"DdaDf_pDuu");SML.di("./fxzIBx3XyR.js",import.meta.url,"fxzIBx3XyR");SML.di("./DYFdTZXVs2.js",import.meta.url,"DYFdTZXVs2");SML.di("./B-LM1r1oJd.js",import.meta.url,"B-LM1r1oJd"); SML.dm("Bk8i13YAI7",["4SW1PeumCl","C42E8rVVpA","CsxDAjmHZE","B2hncWv3Jq","MvWSZOZYAh","DjjIXmCgnO","1i4g9fLWHY","DdizCVGdC6","DnH8baXgu3","D8Nk5WxpiL","DEQ5AnqT_V","Cse0G_xARZ","DDTa19N1fy","BEzA-QPMTz","C9S3A50Ur_","BYyjGDBWHg","BnZOm2BOqI","CxBOcTjMlj","DW4Y66xecc","CndptGkkPK","DUzIBJc2in","BcUlF1uWDA","tn7sgJBOIW","BxXMRtW0Ao","BkjgI35gdl","DrwVpipAUZ","9vUF7asw4v","Ns-fTnJmu9","B2OLf9kcBe","DZBIvVodeO","BHPKNOzIpV","B5z9hfVW57","DCWWud_0J8","BaFXWsm32y","DUaETbwyQ9","D_F1vtGIq1","CCtMKamAzh","C2rAA4roMn","C-4AJ2Y78L","wDRHyxVKtb","cjhvxMuwOm","BFfc43snhj","Cm_szELb1W","PJJ5-f-jpV","DdaDf_pDuu","fxzIBx3XyR","DYFdTZXVs2","B-LM1r1oJd"],(async(e,t,i,a,r,n,s,l)=>{function d(e){return i.x``}const o=i.s;let m=class extends o{constructor(){super(...arguments),this.isM2ExperimentEnabled=!1,this.subreddit={},this.shouldShowConfetti=!0,this.updateSubredditCreationListener=e=>{this.subreddit=e.detail.subreddit,this.requestUpdate()}}connectedCallback(){super.connectedCallback(),document.addEventListener(e.U,this.updateSubredditCreationListener)}firstUpdated(){const e=this.shadowRoot?.querySelector("shreddit-lottie-player");e?.addEventListener("complete",(()=>{this.shouldShowConfetti=!1}),{once:!0})}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener(e.U,this.updateSubredditCreationListener)}renderConfetti(){if(!this.shouldShowConfetti)return i.A;const e=window.matchMedia?.("(min-width: 768px)").matches??!1,t=window.matchMedia?.("(min-width: 1200px)").matches??!1;return i.x`
${d("w-full xs:w-1/2 m:w-1/3 h-full")} ${e?d("w-1/2 m:w-1/3 h-full"):i.A} ${t?d("w-1/3 h-full"):i.A}
`}render(){let e,t;const{defaultTheme:a}=this.subreddit;return a&&(e=a.banner?.mobile?.rawUrl??a.banner?.desktop?.rawUrl??void 0,t=a.icon?.rawUrl??void 0),i.x` ${this.renderConfetti()}
${this.subreddit.name&&this.isM2ExperimentEnabled?i.x`
${[{text:"Rules",href:`/mod/${this.subreddit.name}/rules`},{text:"Welcome guide",href:`/mod/${this.subreddit.name}/guide`}].map((({text:e,href:t})=>i.x` ${i.C({size:i.I.Small,attributes:{slot:"leading",fill:"var(--color-success-plain)"}})} ${e} `))}
`:i.A}
`;}};m.styles=[t.t],t._([t.n({type:Boolean,attribute:"m2-enabled"})],m.prototype,"isM2ExperimentEnabled",void 0),t._([t.v()],m.prototype,"subreddit",void 0),t._([t.v()],m.prototype,"shouldShowConfetti",void 0),m=t._([t.e("community-creation-celebration")],m);const T="banner",u="icon",E="preselected",p="upload",I=i.s;let c=class extends I{constructor(){super(...arguments),this.editingImageType=T,this.subredditId="",this.subreddit={},this.currentTab=0,this._loading=!1,this.editingImage=!1,this.imagesByTheme=[],this.selectedImage=null,this.uploadedImage=void 0,this.imageUploader=new s.C,this.setSaveButtonState=()=>{const e=this.querySelector('button[type="submit"]');e&&(this._loading||!this.uploadedImage&&!this.selectedImage?e.setAttribute("disabled","true"):e.removeAttribute("disabled"))},this.handleAvatarChange=e=>{const i=e.target;this.imageCropperProps={imageSrc:i.src,selectionHeight:300,selectionWidth:300,fileName:i.file.name,onSave:e=>{t.f(this,l.e()),this.editingImage=!1,this.uploadedImage=e,this.selectedImage=null,this.setSaveButtonState(),this.dispatchEvent(t.c("image-cropper-saved",{bubbles:!0,composed:!0,detail:{image:e,imageType:u}})),this.requestUpdate()}},this.requestUpdate(),this.editingImage=!0,this.editingImageType=u},this.handleBannerChange=e=>{const i=e.target;this.imageCropperProps={imageSrc:i.src,selectionHeight:60,selectionWidth:500,fileName:i.file.name,onSave:e=>{t.f(this,l.a()),this.editingImage=!1,this.uploadedImage=e,this.selectedImage=null,this.setSaveButtonState(),this.dispatchEvent(t.c("image-cropper-saved",{bubbles:!0,composed:!0,detail:{image:e,imageType:T}})),this.requestUpdate()}},this.requestUpdate(),this.editingImage=!0,this.editingImageType=T},this.handleTabClick=e=>{this.currentTab=e,1===e&&(this.editingImageType===T?t.f(this,l.s(p)):t.f(this,l.b(p)))},this.handleImageClick=e=>{this.selectedImage=e,this.uploadedImage=void 0,this.setSaveButtonState(),this.editingImageType===T?t.f(this,l.s(E)):t.f(this,l.b(E))},this.handleSaveImage=async()=>{const e=!this.uploadedImage&&this.selectedImage,i=e?E:p,a=this.subreddit?.id??"";let r,n,s=null;if(e?s=await this.savePresetImage(a,this.selectedImage):this.uploadedImage&&(s=await(this.editingImageType===T?this.imageUploader.saveBanner(a,"",this.uploadedImage):this.imageUploader.saveCommunityIcon(a,"",this.uploadedImage))),s){const e=t.c("faceplate-alert",{level:t.X.error,cause:"uncategorized",message:s});this.dispatchEvent(e)}else this.editingImageType===T?t.f(this,l.c(i)):t.f(this,l.d(i));if(e)r=this.editingImageType===u?this.selectedImage:void 0,n=this.editingImageType===T?this.selectedImage:void 0;else{const e=this.shadowRoot?.querySelector("community-image-upload");if(e){const t=e.getAttribute("src");t&&(r=this.editingImageType===u?t:void 0,n=this.editingImageType===T?t:void 0)}}const d={banner:{desktop:{rawUrl:n},mobile:{rawUrl:n}}},o={icon:{rawUrl:r}};this.dispatchEvent(t.c("update-subreddit-creation",{source:"community_creation_walkthrough_update_images",direction:"next",subreddit:{...this.subreddit,...(n ? {banner:n,defaultTheme:{...this.subreddit.defaultTheme,...d}} : {}),...(r ? {avatar:r,defaultTheme:{...this.subreddit.defaultTheme,...o}} : {})}})),this.selectedImage=null,this.uploadedImage=void 0,this.setSaveButtonState(),this.editingImage=!1,this.imageCropperProps=void 0,this.requestUpdate()}}get headerText(){return this.editingImageType===T?"Edit banner":"Edit icon";}connectedCallback(){super.connectedCallback(),this.setSaveButtonState()}async firstUpdated(){this.loadImages(),await this.updateComplete,this.dispatchEvent(t.c("refresh_focus",{title:this.headerText}))}async loadImages(){this._loading=!0,this.setSaveButtonState();const e=await t.C({operation:t.H.GetSubredditThemes,variables:{includeIcons:this.editingImageType===u,includeBanners:this.editingImageType===T}});this._loading=!1,this.setSaveButtonState();const i=e.data?.subredditThemes||[];this.imagesByTheme=i}renderBannerImage(e){const t=e.desktop.url,a=this.selectedImage===t;return i.x``}renderIconImage(e){const t=e.url,a=this.selectedImage===t;return i.x``}renderGallery(){return i.x`
${this.imagesByTheme.map((e=>{const t=e.name,a=this.editingImageType===T?e.banners:e.icons;return a.length>0?i.x`
${t}
${a.map((e=>this.editingImageType===T?this.renderBannerImage(e):this.renderIconImage(e)))}
`:i.x``}))}
`}renderButton(e,a,r){return i.x`${t.Z({attributes:{"aria-label":a+" "+r},appearance:e,children:a,leadingIcon:n.i(),size:t.ac.Small})}`}renderUploadContent(e,t,a){const r=this.uploadedImage?URL.createObjectURL(this.uploadedImage):void 0;return i.x`
Uploaded ${this.editingImageType===T?
${this.editingImageType===T?"Banner":"Icon"}
${this.renderButton("bordered","Change",a)}
`:i.x`
${i.V({size:i.h.Medium,attributes:{className:"text-neutral-content-weak"}})}
${"Upload image"}
`}">
`;}renderUpload(){const e=this.editingImageType===T?this.handleBannerChange:this.handleAvatarChange,t=!!this.uploadedImage,i=this.editingImageType===T?"Upload banner":"Upload icon";return this.renderUploadContent(e,t,i)}async savePresetImage(e,i){try{if(this.editingImageType===T){const a=await t.C({operation:t.H.UploadPresetSubredditBanner,variables:{input:{subredditId:e,banner:i,mobileBanner:i}}});if(!a.data?.uploadPresetSubredditBanner?.ok)return a.data?.uploadPresetSubredditBanner?.errors?.[0]?.message??s.E()}else{const a=await t.C({operation:t.H.UploadPresetSubredditIcon,variables:{input:{subredditId:e,icon:i}}});if(!a.data?.uploadPresetSubredditIcon?.ok)return a.data?.uploadPresetSubredditIcon?.errors?.[0]?.message??s.a()}return null}catch{return this.editingImageType===T?s.E():s.a()}}render(){const e=["Gallery","Upload"];return this.editingImage?i.x`
`:i.x`
${e.map(((e,t)=>r.t({size:r.T.Medium,label:e,attributes:{className:"w-[50%]",type:"button",slot:`page-${t+1}`,tabindex:"-1",onclick:()=>this.handleTabClick(t)},appearance:r.a.Fill})))} [${a.F.backButton()}, ${a.F.forwardButton()}] ${e.map(((e,t)=>0===t?i.x`
${this.renderGallery()}
`:i.x`
${this.renderUpload()}
`))}
`}};c.styles=[t.t],t._([t.n({type:String,attribute:"editing-image-type"})],c.prototype,"editingImageType",void 0),t._([t.n({type:String,attribute:"subreddit-id"})],c.prototype,"subredditId",void 0),t._([t.v()],c.prototype,"subreddit",void 0),t._([t.v()],c.prototype,"currentTab",void 0),t._([t.v()],c.prototype,"_loading",void 0),t._([t.v()],c.prototype,"editingImage",void 0),t._([t.v()],c.prototype,"imagesByTheme",void 0),t._([t.v()],c.prototype,"selectedImage",void 0),t._([t.v()],c.prototype,"uploadedImage",void 0),c=t._([t.e("community-image-editor")],c)})); SML.di("./C42E8rVVpA.js",import.meta.url,"C42E8rVVpA");SML.di("./CsxDAjmHZE.js",import.meta.url,"CsxDAjmHZE");SML.di("./D304_WY_yB.js",import.meta.url,"D304_WY_yB");SML.di("./BskNjLbli-.js",import.meta.url,"BskNjLbli-");SML.di("./CMAMkGxOzL.js",import.meta.url,"CMAMkGxOzL");SML.di("./tn7sgJBOIW.js",import.meta.url,"tn7sgJBOIW");SML.di("./DoAaOvteiR.js",import.meta.url,"DoAaOvteiR");SML.di("./BcUlF1uWDA.js",import.meta.url,"BcUlF1uWDA");SML.di("./D_F1vtGIq1.js",import.meta.url,"D_F1vtGIq1");SML.di("./CY0v7Q95fp.js",import.meta.url,"CY0v7Q95fp");SML.di("./BsuRkrTcpO.js",import.meta.url,"BsuRkrTcpO");SML.di("./2F24kjFEFA.js",import.meta.url,"2F24kjFEFA");SML.di("./DdaDf_pDuu.js",import.meta.url,"DdaDf_pDuu");SML.di("./CxBOcTjMlj.js",import.meta.url,"CxBOcTjMlj"); SML.dm("BlHsaTCeEh",["C42E8rVVpA","CsxDAjmHZE","BskNjLbli-","CMAMkGxOzL","BsuRkrTcpO","2F24kjFEFA","DdaDf_pDuu","D304_WY_yB","tn7sgJBOIW","DoAaOvteiR","BcUlF1uWDA","D_F1vtGIq1","CY0v7Q95fp","CxBOcTjMlj"],(async(e,t,i,a,n,r,s)=>{var o;let d=o=class extends t.s{constructor(){super(...arguments),this.savedUsernames=[],this.repopulateScreen=()=>{const t=this.reportFormManager?.banEvasionSubredditNode,i=this.reportFormManager?.formValues?.[o.subredditFieldName],a=this.reportFormManager?.savedUsernames,n=this.reportFormManager?.banEvasionSubredditId;t&&(i||n)&&(this.subredditNode=t,this.reportFormManager.nextAction=o.nextAction,this.updateButtonState()),a&&a.length>0&&(this.savedUsernames=a,this.usernameEntryField&&(this.usernameEntryField.inputFields=[...a],this.usernameEntryField.dispatchEvent(e.c("saved-usernames-update",{usernames:a})))),this.updateButtonState()},this.clearSubredditSelection=()=>{this.dispatchEvent(e.c("update-report-form",{fieldName:o.subredditFieldName,value:""})),this.dispatchEvent(e.c("update-report-form",{fieldName:"redditorUsernames",value:""})),this.dispatchEvent(e.c("update-report-form",{fieldName:"redditorUsernames",value:""})),this.dispatchEvent(e.c("update-ban-evasion-nodes",{subredditNode:null,savedUsernames:[]})),this.subredditNode=void 0,this.savedUsernames=[],this.updateButtonState()},this.initializeUsernameEntryField=()=>{this.usernameEntryField?.classList.remove("hidden"),this.usernameEntryField&&(this.usernameEntryField.addEventListener("username-update",(t=>{const i=t,{usernames:a}=i.detail;this.dispatchEvent(e.c("update-report-form",{fieldName:"redditorUsernames",value:a.join(",")})),this.updateButtonState()})),this.usernameEntryField.addEventListener("saved-usernames-update",(t=>{const i=t,{usernames:a}=i.detail;this.savedUsernames=a,this.updateBanEvasionSummary(),this.updateButtonState(),this.dispatchEvent(e.c("update-report-form",{fieldName:"redditorUsernames",value:a.join(",")}))})),this.usernameEntryField.addEventListener("saved-usernames-update",(e=>{const t=e,{usernames:i}=t.detail;this.savedUsernames=i,this.updateBanEvasionSummary()})))},this.updateBanEvasionSummary=()=>{this.dispatchEvent(e.c("update-ban-evasion-nodes",{savedUsernames:this.savedUsernames}))}}get subredditInput(){return this.querySelector("shreddit-community-search")}get usernameEntryField(){return this.querySelector("username-input-list")}get reportFormManager(){const e=document.querySelector("report-page-manager");return e?e?.querySelector("shreddit-slotter")?.shadowRoot?.querySelector("report-form-manager"):document.querySelector("report-form-manager")}isFormValid(){const e=!!this.subredditNode,t=this.savedUsernames.length>0;return e&&t}updateButtonState(){const e=this.isFormValid();this.reportFormManager?.updateButton(!e,!0)}firstUpdated(){this.updateComplete.then((()=>{this.repopulateScreen(),this.subredditInput?.addEventListener("change",(t=>{const i=t.target,a=i?.shadowRoot?.querySelector("li[rpl-selected] div span")?.cloneNode(!0);a.querySelector("faceplate-number").innerHTML="";const n=a.querySelector("img")?.getAttribute("src")||i.communityIcon,r=i.communityId;this.subredditNode=a,this.dispatchEvent(e.c("update-report-form",{fieldName:o.subredditFieldName,value:r,nextAction:o.nextAction})),this.dispatchEvent(e.c("update-ban-evasion-nodes",{subredditNode:this.subredditNode,subredditIcon:n,subredditId:this.subredditInput?.communityId})),this.usernameEntryField&&this.usernameEntryField.reset(),this.updateButtonState()})),this.usernameEntryField&&(this.initializeUsernameEntryField(),this.updateBanEvasionSummary())}))}render(){return t.x` ${this.subredditNode?t.x`
${this.subredditNode}
${e.Z({appearance:"plain",attributes:{onclick:()=>this.clearSubredditSelection(),"aria-label":"Clear selected community"},leadingIcon:t.R({size:t.I.Small})})}

`:t.x``} `;}};d.styles=[e.t],d.subredditFieldName="subredditId",d.usersFieldName="redditorUsernames",d.nextAction={type:i.N.SUPPORTING_EVIDENCE,step:i.S.FREE_TEXT},e._([e.v()],d.prototype,"subredditNode",void 0),e._([e.v()],d.prototype,"userNodes",void 0),e._([e.v()],d.prototype,"savedUsernames",void 0),d=o=e._([e.e("ban-evasion-step-new")],d);let l=class extends t.s{constructor(){super(...arguments),this.updateFormState=(t,i=!1)=>{const a=t.getAttribute("name")??"",n=this.textarea?.value??"",r=t.getAttribute("data-nextaction")??void 0,s=t.getAttribute("data-next-step")??"",o=!!i;this.dispatchEvent(e.c("update-report-form",{fieldName:a,value:n,nextAction:{type:r,step:s},button:{isDisabled:o}}))},this.dispatchReportEvent=()=>{this.dispatchEvent(e.c("report-tracking",{reportFlow:{flowOptionSelected:i.F.FREE_TEXT,flowContent:this.textarea?.value??""}}))},this.addFreeTextListener=()=>{const e=this.textarea;e&&(e.addEventListener("input",(e=>{e.stopImmediatePropagation(),this.updateFormState(e.currentTarget),this.dispatchReportEvent()})),e.addEventListener("keyup",(()=>{0===e.value.length&&"FREE_TEXT"!==e.getAttribute("name")&&this.updateFormState(e,!0)})))},this.repopulateBanEvasionFreeText=async()=>{if(await this.updateComplete,this.textarea?.getAttribute("name")!==i.S.FREE_TEXT)return;let e;if(this.reportFormManager)e=this.reportFormManager.formValues?.[i.S.FREE_TEXT];else{const t=this.reportPageManager?.reportPageFormValues?.BAN_EVASION;e=t?.[i.S.FREE_TEXT]}e&&(this.textarea.value=e,this.updateFormState(this.textarea))},this.repopulateFreeTextFromContext=async()=>{if(await this.updateComplete,"FREE_TEXT"===this.textarea?.getAttribute("name")){let e;if(this.reportFormManager)e=this.reportFormManager.formValues?.[i.S.FREE_TEXT];else if(this.reportPageManager){const t=this.reportPageManager.reportType;if(t){const a=this.reportPageManager.reportPageFormValues?.[t];e=a?.[i.S.FREE_TEXT]}}e&&(this.textarea.value=e),this.updateFormState(this.textarea)}}}get textarea(){return this.querySelector("faceplate-textarea-input")}get reportFormManager(){return document.querySelector("report-form-manager")}get reportPageManager(){return document.querySelector("report-page-manager")}firstUpdated(){this.updateComplete.then((()=>{this.repopulateFreeTextFromContext(),this.addFreeTextListener()}))}render(){return t.x` `}};l=e._([e.e("free-textbox")],l);const u=e=>{const t=e?.parentElement;if(t&&e){t.clientHeight-(e.offsetTop+e.clientHeight)<0&&e.scrollIntoView()}};class p extends t.s{constructor(){super(...arguments),this.updateFormState=(t,i)=>{const a=t.getAttribute("name")??"",n=t.getAttribute("value")??"",r=t.getAttribute("data-ref")??"",s=t.getAttribute("data-nextaction")??void 0,o=t.getAttribute("data-next-step")??"",d=t.getAttribute("data-supporting-evidence")?.split(",")??void 0,l=!(!i||this.textarea?.value.length);this.dispatchReportEvent({fieldName:a,value:n,url:r}),this.dispatchEvent(e.c("update-report-form",{fieldName:a,value:n,nextAction:{type:s,url:r,step:o},supportingEvidence:d,button:{isDisabled:l}}))},this.dispatchReportEvent=t=>{const{fieldName:i,value:a,url:n}=t,r=this.determineFlowOptionSelected(i,a);this.dispatchEvent(e.c("report-tracking",{reportFlow:{flowOptionSelected:r,flowOutboundLink:n}}))},this.determineFlowOptionSelected=(e,t)=>"SUBREDDIT"===e&&"customResponse"===t?i.F.CUSTOM_RESPONSE:e===i.R.REPORT_REASONS?i.F.REPORT_REASON:i.F.REPORT_SUBREASON}get textarea(){return this.querySelector("faceplate-textarea-input")}}let h=class extends p{constructor(){super(...arguments),this.addPolicyOptionListeners=()=>{const e=this.querySelectorAll("faceplate-radio-input");e?.length&&e.forEach((e=>{e.addEventListener("input",(e=>{e.stopImmediatePropagation();const t=e.currentTarget;this.updateFormState(t)}))}))}}firstUpdated(){this.addPolicyOptionListeners()}render(){return t.x` `}};h=e._([e.e("user-detail-options")],h);let c=class extends p{constructor(){super(...arguments),this.pubsub=new e.m(this),this.isStandalone=!1,this.getFormElementById=e=>this.querySelector(`#${e}`),this.updateSelection=e=>{const t=this.selectedReason;this.isStandalone||(t&&(t.classList.remove("button-activated"),t.ariaChecked=null),e.classList.add("button-activated"),e.ariaChecked="true"),t?.removeAttribute("aria-describedby"),e.setAttribute("aria-describedby","report-footer-content-body")},this.updatePolicyOptionsUI=t=>{const i=t.getAttribute("data-description"),a=t.innerText;a&&this.titleElement&&(this.titleElement.textContent=a),i&&this.descriptionElement&&(this.descriptionElement.textContent=i),this.isStandalone&&this.pubsub.publish(e.T.ReportPageSummaryUpdate,{reportReasonTitle:a,reportReasonDesc:i})},this.addPolicyOptionListeners=()=>{const e=this.reasonOptions;e?.length&&e.forEach((e=>{e.addEventListener("click",(e=>{e.stopImmediatePropagation(),this.updatePolicyOptionsUI(e.currentTarget),this.updateSelection(e.currentTarget),this.isStandalone||u(e.currentTarget),this.updateFormState(e.currentTarget)}))}))}}get selectedReason(){return this.isStandalone?this.querySelector("[data-buttonbar] faceplate-radio-input[aria-describedby]"):this.querySelector("[data-buttonbar] button.button-activated")}get reasonOptions(){return this.isStandalone?this.querySelectorAll("[data-buttonbar] faceplate-radio-input"):this.querySelectorAll("[data-buttonbar] button")}get titleElement(){return this.getFormElementById("report-footer-content-title")}get descriptionElement(){return this.getFormElementById("report-footer-content-body")}firstUpdated(){this.addPolicyOptionListeners()}render(){return t.x` `}};e._([e.n({type:Boolean,attribute:"is-standalone"})],c.prototype,"isStandalone",void 0),c=e._([e.e("policy-options")],c);let m=class extends p{constructor(){super(...arguments),this.addPolicyOptionListeners=()=>{const e=this.querySelectorAll("faceplate-radio-input");e?.length&&e.forEach((e=>{e.addEventListener("input",(e=>{e.stopImmediatePropagation();const t=e.currentTarget,i=t.hasAttribute("value")&&"customResponse"===t.getAttribute("value");i?(this.textarea?.classList.remove("hidden"),this.textarea?.scrollIntoView()):this.textarea?.classList.add("hidden"),this.updateFormState(t,i)}))}))}}get textarea(){return this.querySelector("faceplate-textarea-input")}firstUpdated(){this.addPolicyOptionListeners()}render(){return t.x` `}};var g,b,v;m=e._([e.e("followup-policy-options")],m),function(e){e.POST="post",e.COMMENT="comment",e.MESSAGE="message",e.VIDEO_PAGE="video_page"}(g||(g={})),function(e){e.USER="USER",e.CONTENT="CONTENT",e.BAN_EVASION="BAN_EVASION"}(b||(b={})),function(e){e.ReportFlow="report_flow"}(v||(v={}));const E=({report_flow:t,user_target_status:i,thingId:a})=>{let n=!1,r=!1,s=!1;return void 0!==a&&"string"==typeof a&&(n=a.startsWith("t3_"),r=a.startsWith("t2_1"),s=a.startsWith("t1_")),r&&(i={...i,target_user_id:a}),e.b({source:v.ReportFlow,action:e.af.Click,noun:v.ReportFlow},{report_flow:t,user_target_status:i,...(a&&n && {post:{id:a}}),...(a&&s && {comment:{id:a}})});};var S;const N=t.s;let k=S=class extends N{get slotter(){return this.querySelector("shreddit-slotter")?.shadowRoot}get actionButton(){return this.slotter?.querySelector("#report-action-button")}get actionLinkButton(){return this.slotter?.querySelector("#report-action-link-button")}get backButton(){const e=this.closest("#report-flow-modal-card")?this.closest("#report-flow-modal-card"):this.closest("#mobile-report-flow-bottom-sheet");return this.isStandalone?this.slotter?.querySelector("#report-action-button-back"):e?.querySelector("#report-modal-back")}get closeButton(){const e=this.closest("#report-flow-modal-card")?this.closest("#report-flow-modal-card"):this.closest("#mobile-report-flow-bottom-sheet");return e?.querySelector("#report-modal-close")}get contentLoader(){return this.isStandalone?this.reportPageManager?.querySelector("shreddit-slotter")?.shadowRoot?.querySelector("#report-flow-content-loader"):document.querySelector("#report-flow-content-loader")}get contentWrapper(){return this.isStandalone?this.reportPageManager?.querySelector("shreddit-slotter")?.shadowRoot?.querySelector("#report-flow-content-wrapper"):document.querySelector("#report-flow-content-wrapper")}get standAloneReportTitle(){return this.querySelector("#stand-alone-title")}get reportPageManager(){return document.querySelector("report-page-manager")}get nextStepIsSuccess(){return this.nextAction?.type===i.N.SUBMIT||this.nextAction?.type===i.N.FLOW_SUBMIT}get isBanEvasionReport(){return this.standAloneReportType===b.BAN_EVASION}get initSubredditNode(){return this.querySelector("#ssr-subreddit-node")}initializeBanEvasionFormValues(){this.formValues={...this.formValues,REPORT_REASONS:"BAN_EVASION"},this.nextAction={type:i.N.SUPPORTING_EVIDENCE,step:i.S.FREE_TEXT}}intializeBlankFormValues(){this.formValues={},this.nextAction={type:i.N.OPTIONS}}firstUpdated(){this.updateComplete.then((()=>{this.savedUsernames=this.authorName?[this.authorName]:[];const t=this.initSubredditNode?.querySelector("li[rpl] div span")?.cloneNode(!0);t&&(t.querySelector("faceplate-number").innerHTML="");const i=t?.querySelector("img")?.getAttribute("src");if(this.banEvasionSubredditNode=t,this.banEvasionSubredditIcon=i??"",this.banEvasionSubredditId=this.subredditId,this.contentLoader?.classList.add("hidden"),this.contentWrapper?.classList.remove("hidden"),!this.isStandalone)return;if(this.isBanEvasionReport?this.initializeBanEvasionFormValues():this.intializeBlankFormValues(),this.reportPageManager&&Object.keys(this.reportPageManager?.reportPageFormValues).length){const e=this.reportPageManager.reportPageFormValues[this.standAloneReportType??""];this.formValues=e||{}}this.reportPageManager&&this.isBanEvasionReport&&this.reportPageManager.banEvasionNodesCache&&this.restoreBanEvasionStateFromCache();const a=this.screenSequence[0];this.isStandalone&&!this.isBanEvasionReport&&this.dispatchEvent(e.c("report-page-update-state-values",{lastRFScreen:a})),this.renderBackButton(),this.repopulateReportForm(a),this.applyStandAloneTitle(),this.isBanEvasionReport?(this.updateButton(!0,!0),this.updateBanEvasionSummary()):this.pubsub.publish(e.T.ReportPageSummaryUpdate,{thingId:this.thingId,authorAvatar:this.authorAvatar,authorId:this.authorId,authorName:this.authorName,hideSummary:!1})}))}constructor(){super(),this.pubsub=new e.m(this),this.conversationId="",this.isUserBlocked=!1,this.isModerator=!1,this.isStandalone=!1,this.permalink="",this.countryCode="",this.formValues={},this.supportingEvidence=[],this.savedUsernames=[],this.nextAction={type:i.N.OPTIONS},this.requestClientGQL=e.C,this.changeStep=t=>{const i=e.c("shreddit-slotter-set-slot-name",{slotName:t});this.slotter?.dispatchEvent(i),this.renderBackButton(),this.isStandalone&&this.applyStandAloneTitle()},this.getFlowType=()=>this.reportPageManager?i.a.REPORT_PAGE:this.isModerator?i.a.MOD_CONTENT:i.a.USER_CONTENT,this.reportTracking=t=>{const{reportFlow:{flowOptionSelected:i,flowContent:a,flowOptionAvailable:n,flowOutboundLink:r},userTargetStatus:s}=t.detail,o={report_flow:{flow_type:this.getFlowType(),flow_option_selected:i??"",flow_content:a??"",flow_option_available:n??"",flow_outbound_link:r??""},user_target_status:{target_user_is_blocked_by_user:s?.targetUserisBlockedByUser??this.isUserBlocked},thingId:this.thingId};e.f(this,E(o))},this.displayBanEvasionError=t=>{const a=t||"To report someone for ban evasion, you must be a mod of the community they've been banned from.";this.dispatchEvent(e.c("faceplate-alert",{level:e.X.error,cause:"uncategorized",message:a})),this.screenSequence=[...this.screenSequence.slice(0,this.screenSequence.indexOf("BAN_EVASION_USERS")+1)],this.changeStep(i.R.BAN_EVASION)},this.performNextAction=()=>{switch(this.nextAction?.type){case i.N.OPTIONS:case i.N.SUBREDDIT_RULES:this.nextAction.step&&this.changeStep(this.nextAction.step);break;case i.N.FLOW:this.isStandalone&&this.nextAction.step?this.changeStep(this.nextAction.step):(this.closeReportFlow(),this.pubsub.publish(e.T.CTLReportInit,{authorName:this.authorName,thingId:this.thingId??"",userDetailType:this.formValues.USER_DETAILS}));break;case i.N.FLOW_SUBMIT:case i.N.SUBMIT:this.nextAction.step&&this.submitReport(this.nextAction.step);break;case i.N.URL:this.reportTracking({detail:{reportFlow:{flowOptionSelected:i.F.OUTBOUND_LINK}}}),"DSA"===this.formValues.REPORT_REASONS&&this.nextAction.url&&this.countryCode?window.open(r.c(this.nextAction.url,this.countryCode,this.permalink,this.isStandalone)):window.open(this.nextAction.url),this.isStandalone||this.closeReportFlow();break;case i.N.SUPPORTING_EVIDENCE:this.nextAction.step&&this.changeStep(this.nextAction.step)}this.nextAction=void 0},this.submitReport=async t=>{this.toggleButtonLoadingIndicator();const a=n.a(this.thingId);try{const r=n.b({itemType:a,formValues:this.formValues,thingId:this.thingId,isStandalone:this.isStandalone,conversationId:this.conversationId}),s=await this.reportRequest(a,r);if(!s||s.errors&&s.errors.length||!n.c(s)){if(s?.errors[0]?.message.includes("reportRedditor NotAuthorizedError"))throw new Error(S.banEvasionError);if(s?.errors[0]?.message.includes("reportRedditor Internal error"))throw new Error(S.invalidUsernameError);throw new Error("Unsuccessful report response")}this.reportTracking({detail:{reportFlow:{flowOptionSelected:i.F.REPORT_SUBMIT}}}),this.dispatchEvent(e.c("submit-report-modal",{thingId:this.thingId})),this.changeStep(t)}catch(e){if(e.message===S.banEvasionError)return this.displayBanEvasionError();if(e.message===S.invalidUsernameError)return this.displayBanEvasionError("One or more of the inputted usernames is invalid.");this.dispatchReportErrorAlert()}},this.toggleButtonLoadingIndicator=()=>{this.actionButton?.querySelector("faceplate-progress")?.classList.toggle("hidden"),this.actionButton?.querySelector("span.report-button-content")?.classList.toggle("opacity-0")},this.reportRequest=async(e,t)=>{const i=n.d(e,this.isStandalone);if(!i)throw new Error("No corresponding gql operation for the item type provided");try{return await this.requestClientGQL({operation:i,variables:{input:t}})}catch(e){throw new Error("Error calling the gql report operation")}},this.dispatchReportErrorAlert=()=>{this.dispatchEvent(e.c("faceplate-alert",{level:e.X.error,cause:"uncategorized",message:"An error occurred while submitting your report. Wait a bit, and try again."})),this.toggleButtonLoadingIndicator()},this.getBlockingTracking=t=>{const i=this.isUserBlockingSwitchChecked&&this.isStandalone,a=t?.level===e.X.success;return{includeBlockingStatus:i||!!t,blockingStatus:!!i||a}},this.handleFormDone=async e=>{if(e){const{buttonAction:t}=e.detail;if(t===i.F.REPORT_FLOW_DONE||t===i.F.SUBMIT_ANOTHER){const e=await this.handleReportFlowUserBlocking(),{includeBlockingStatus:i,blockingStatus:a}=this.getBlockingTracking(e),n={reportFlow:{flowOptionSelected:t},...(i ? {userTargetStatus:{targetUserisBlockedByUser:a}} : {})};this.reportTracking({detail:n})}}},this.closeReportFlow=async t=>{await this.handleFormDone(t),this.pubsub.publish(e.T.ReportFlowClose)},this.updateBlockingSwitch=e=>{this.isUserBlockingSwitchChecked=e.detail.isChecked},this.handleReportFlowUserBlocking=async()=>{if(this.isUserBlockingSwitchChecked&&!this.isStandalone){const{level:t,message:i}=await a.h(!1,this.authorId,this.authorName);return this.dispatchEvent(e.c("faceplate-alert",{level:t,message:i})),{level:t,message:i}}},this.updateStepHistory=e=>{e&&(this.screenSequence=[...this.screenSequence,e])},this.onButtonClick=e=>{e.stopImmediatePropagation(),this.nextStepIsSuccess||this.updateStepHistory(this.nextAction?.step),this.performNextAction(),this.repopulateReportForm(this.screenSequence[this.screenSequence.length-1]),this.reportTracking({detail:{reportFlow:{flowOptionSelected:i.F.NEXT_BUTTON}}})},this.getButtonLabel=()=>this.nextAction?.type===i.N.SUBMIT?"Submit":"Next",this.updateButton=(e,t=!0)=>{if(this.nextAction?.url&&this.actionLinkButton)this.actionLinkButton.classList.remove("hidden"),this.actionLinkButton.href=this.nextAction.url,this.actionLinkButton?.addEventListener("click",this.onButtonClick),this.actionButton?.classList.add("hidden");else if(this.actionButton){this.actionButton?.addEventListener("click",this.onButtonClick);const i=this.actionButton.querySelector("span.report-button-content");i&&t&&(i.textContent=this.getButtonLabel()),void 0!==e&&(this.actionButton.disabled=e),this.actionLinkButton?.classList.add("hidden"),this.actionButton?.classList.remove("hidden")}},this.updateFormValues=(e,t)=>{this.formValues={...this.formValues,[e]:t}},this.updateBanEvasionNodes=e=>{const{subredditNode:t,subredditIcon:i,subredditId:a,userNodes:n,savedUsernames:r}=e.detail;void 0!==t&&(this.banEvasionSubredditNode=t),void 0!==i&&(this.banEvasionSubredditIcon=i),void 0!==a&&(this.banEvasionSubredditId=a,this.updateFormValues("subredditId",a)),void 0!==n&&(this.banEvasionAdditionalUserNodes=n),void 0!==r&&(this.savedUsernames=r,r.length>0&&this.updateFormValues("redditorUsernames",r.join(","))),this.cacheCurrentState(),this.updateBanEvasionSummary()},this.cacheCurrentState=()=>{const e=document.querySelector("report-page-manager");if(e){const t={banEvasionSubredditNode:this.banEvasionSubredditNode,banEvasionAdditionalUserNodes:this.banEvasionAdditionalUserNodes,banEvasionSubredditIcon:this.banEvasionSubredditIcon};e.banEvasionNodesCache=t,e.reportPageFormValues={...e.reportPageFormValues,[b.BAN_EVASION]:{...this.formValues}}}},this.updateBanEvasionSummary=()=>{if(!this.isStandalone&&!this.isBanEvasionReport)return;let t,i,a;if(this.banEvasionSubredditNode){const e=this.banEvasionSubredditNode;t=e.textContent?.trim()?.split(/\s+/)[0],i=this.banEvasionSubredditIcon,a=this.banEvasionSubredditId}else t=void 0,i=void 0,a=void 0;const n=this.banEvasionAdditionalUserNodes?.length||0;this.pubsub.publish(e.T.BanEvasionSummaryUpdate,{subredditName:t,subredditIcon:i,subredditId:a,userCount:n,savedUsernames:this.savedUsernames,hideSummary:!1})},this.repopulateBanEvasionForm=e=>{this.updateComplete.then((()=>{const t=this.querySelector("ban-evasion-step-new");t&&e===i.S.BAN_EVASION_USERS&&(t.repopulateScreen?.(),this.updateComplete.then((()=>{this.nextAction&&this.updateButton(!0,!0)})))}))},this.restoreBanEvasionStateFromCache=()=>{const e=document.querySelector("report-page-manager");if(!e?.banEvasionNodesCache)return;const t=e.banEvasionNodesCache;Object.assign(this,{banEvasionSubredditNode:t.banEvasionSubredditNode,banEvasionAdditionalUserNodes:t.banEvasionAdditionalUserNodes,banEvasionSubredditIcon:t.banEvasionSubredditIcon});const i=e.reportPageFormValues[b.BAN_EVASION];i&&(this.formValues={...this.formValues,...i},i.redditorUsernames&&(this.savedUsernames=i.redditorUsernames.split(",")),i.subredditId&&(this.banEvasionSubredditId=i.subredditId)),this.updateBanEvasionSummary()},this.updateReportForm=e=>{const{fieldName:t,value:i,nextAction:a,supportingEvidence:n,button:r}=e.detail;a&&(this.nextAction=a),n&&(this.supportingEvidence=n),this.updateFormValues(t,i),this.updateButton(r?.isDisabled,r?.updateButtonText),this.isBanEvasionReport&&this.cacheCurrentState()},this.hideTitle=()=>{this.standAloneReportTitle?.classList.add("hidden")},this.applyStandaloneSummaryValues=(t,a)=>{const n=t?.getAttribute("data-description");if(a!==i.R.REPORT_REASONS||t&&n){if(this.isStandalone&&n){const i=t?.innerText;this.pubsub.publish(e.T.ReportPageSummaryUpdate,{reportReasonTitle:i,reportReasonDesc:n})}}else this.pubsub.publish(e.T.ReportPageSummaryUpdate,{clearReportReason:!0,hideSummary:!1})},this.applyStandAloneTitle=()=>{if(!this.standAloneReportTitle)return;const e="Report content",t="Report account(s)",a="Crisis report",n=this.isBanEvasionReport?t:this.standAloneReportType===b.CONTENT?e:t;this.screenSequence[this.screenSequence.length-1]===i.R.CTL_STEP_ONE?this.standAloneReportTitle.textContent=a:this.standAloneReportTitle.textContent=n},this.renderBackButton=async()=>{if(await this.updateComplete,!this.backButton)return;this.backButton?.addEventListener("click",this.navigateBack);const e=this.querySelector("shreddit-slotter")?.getAttribute("slot-name");this.screenSequence.length>1&&"SUCCESS"!==e||this.isStandalone?(this.backButton.classList.remove("hidden"),this.backButton.disabled=!1):(this.backButton.classList.add("hidden"),this.backButton.disabled=!0)},this.navigateBack=()=>{const t=this.screenSequence,a=t.slice(0,t.length);a.pop(),this.screenSequence=a;const n=a[a.length-1];this.isStandalone&&this.backButton?.classList.contains("first-rf-screen")&&(this.dispatchEvent(e.c("report-page-update-state-values",{formValues:this.formValues,banEvasionNodes:{banEvasionSubredditNode:this.banEvasionSubredditNode,banEvasionAdditionalUserNodes:this.banEvasionAdditionalUserNodes}})),this.pubsub.publish(e.T.ReportPageSummaryUpdate,{hideSummary:!0}),this.pubsub.publish(e.T.BanEvasionSummaryUpdate,{hideSummary:!0})),this.changeStep(n),this.repopulateReportForm(n),this.reportTracking({detail:{reportFlow:{flowOptionSelected:i.F.BACK_ARROW}}})},this.getStepValue=e=>this.formValues[e],this.repopulateReportForm=async e=>{if(await this.updateComplete,!e)return;const t=this.getStepValue(e);if(!t)return void this.applyStandaloneSummaryValues(null,e);const i=this.slotter?.querySelectorAll("[data-buttonbar] button"),a=this.slotter?.querySelectorAll("faceplate-radio-input"),n=this.slotter?.querySelector("faceplate-textarea-input");if(i?.length&&this.applyButtonBarButtonValue(t),a?.length&&this.applyRadioButtonValue(t),n){const i={step:e,stepValue:t,textarea:n};this.applyTextAreaValue(i)}},this.applyTextAreaValue=async({step:e,stepValue:t,textarea:i})=>{if("SUBREDDIT"===e){if(!this.formValues.customResponse?.length&&"customResponse"===t){const t={detail:{fieldName:e,value:"",button:{isDisabled:!0}}};this.updateReportForm(t)}"customResponse"===t&&(i.classList.remove("hidden"),await i.updateComplete,i.scrollIntoView()),i.setAttribute("value",this.formValues.customResponse??"")}"FREE_TEXT"===e&&i.setAttribute("value",t)},this.applyButtonBarButtonValue=e=>{const t=this.slotter?.querySelector(`[data-buttonbar] button[value="${e}"]`);if(!t)return;t.classList.add("button-activated"),t.ariaChecked="true",t.setAttribute("aria-describedby","report-footer-content-body");const i=t.getAttribute("data-description"),a=t.innerText;a&&(this.slotter.querySelector("#report-footer-content-title").textContent=a),i&&(this.slotter.querySelector("#report-footer-content-body").textContent=i),this.applyActionButtonValue(t),this.isStandalone||this.updateComplete.then((()=>u(t)))},this.applyRadioButtonValue=e=>{const t=this.slotter?.querySelector(`faceplate-radio-input[value="${e}"]`);t&&(t.setAttribute("checked","true"),this.applyActionButtonValue(t),this.isStandalone&&this.applyStandaloneSummaryValues(t,e))},this.applyActionButtonValue=e=>{const t=e.getAttribute("name")??"",i=e.getAttribute("value")??"",a=e.getAttribute("data-ref")??"",n=e.getAttribute("data-nextaction")??void 0,r=e.getAttribute("data-next-step")??"",s=e.getAttribute("data-supporting-evidence")?.split(","),o={detail:{fieldName:t,value:i,nextAction:{type:n,url:a,step:r},supportingEvidence:s,button:{isDisabled:!1}}};this.updateReportForm(o)};const t=this.querySelector("shreddit-slotter")?.getAttribute("slot-name");this.screenSequence=t?[t]:[],this.addEventListener("update-report-form",this.updateReportForm),this.addEventListener("close-report-form",this.closeReportFlow),this.addEventListener("handle-form-done",this.handleFormDone),this.addEventListener("report-tracking",this.reportTracking),this.addEventListener("update-blocking-switch",this.updateBlockingSwitch),this.addEventListener("update-ban-evasion-nodes",this.updateBanEvasionNodes),this.addEventListener("hide-page-title-success-screen",this.hideTitle),this.closeButton?.addEventListener("click",(()=>{this.reportTracking({detail:{reportFlow:{flowOptionSelected:i.F.X_OUT}}})}))}render(){return t.x` `}};k.styles=[e.t],k.banEvasionError="Ban Evasion: Not Authorized",k.invalidUsernameError="Ban Evasion: Invalid Username",e._([e.n({type:String,attribute:"author-id"})],k.prototype,"authorId",void 0),e._([e.n({type:String,attribute:"author-name"})],k.prototype,"authorName",void 0),e._([e.n({type:String,attribute:"author-avatar"})],k.prototype,"authorAvatar",void 0),e._([e.n({type:String,attribute:"thing-id"})],k.prototype,"thingId",void 0),e._([e.n({type:String,attribute:"subreddit-id"})],k.prototype,"subredditId",void 0),e._([e.n({type:String,attribute:"conversation-id"})],k.prototype,"conversationId",void 0),e._([e.n({type:Boolean,attribute:"is-user-blocked"})],k.prototype,"isUserBlocked",void 0),e._([e.n({type:Boolean,attribute:"is-moderator"})],k.prototype,"isModerator",void 0),e._([e.n({type:Boolean,attribute:"is-standalone"})],k.prototype,"isStandalone",void 0),e._([e.n({type:String,attribute:"standalone-report-type"})],k.prototype,"standAloneReportType",void 0),e._([e.n({type:String,attribute:"permalink"})],k.prototype,"permalink",void 0),e._([e.n({type:String,attribute:"country-code"})],k.prototype,"countryCode",void 0),e._([e.v()],k.prototype,"formValues",void 0),k=S=e._([e.e("report-form-manager")],k);let R=class extends t.s{constructor(){super(...arguments),this.pubsub=new e.m(this),this.addDoneListener=()=>{this.doneButton?.addEventListener("click",(()=>{this.dispatchEvent(e.c("close-report-form",{buttonAction:i.F.REPORT_FLOW_DONE}))}))},this.addSubmitAnotherListener=()=>{this.submitAnotherButton?.addEventListener("click",(()=>{this.dispatchEvent(e.c("handle-form-done",{buttonAction:i.F.SUBMIT_ANOTHER}))}))},this.hideElements=()=>{this.dispatchEvent(e.c("hide-page-title-success-screen")),this.pubsub.publish(e.T.ReportPageSummaryUpdate,{hideSummary:!0}),this.pubsub.publish(e.T.BanEvasionSummaryUpdate,{hideSummary:!0})}}get doneButton(){const e=this.querySelector("#report-action-link-button");return!e||e?.className.includes("hidden")?this.querySelector("#report-action-button"):e}get submitAnotherButton(){return this.querySelector("#report-submit-another-link-button")}firstUpdated(){this.hideElements(),this.updateComplete.then((()=>{this.addDoneListener(),this.addSubmitAnotherListener()}))}};R=e._([e.e("base-success-step")],R);let T=class extends R{constructor(){super(...arguments),this.toggleButtonLoadingIndicator=()=>{this.blockingModule?.querySelector("faceplate-progress")?.classList.toggle("hidden"),this.blockingModule?.querySelector("span.report-button-content")?.classList.toggle("opacity-0")},this.dispatchReportEvent=t=>{this.dispatchEvent(e.c("report-tracking",{reportFlow:{flowOptionSelected:t}}))},this.dispatchBlockEvents=t=>{this.dispatchEvent(e.c("update-blocking-switch",{isChecked:t})),this.dispatchReportEvent(i.F.BLOCK_USER_TOGGLE)},this.addUserBlockingSwitchListener=()=>{this.userBlockingSwitch?.addEventListener("click",(()=>{this.dispatchBlockEvents(this.userBlockingSwitch?.checked??!1)}))},this.addUserBlockingButtonListeners=()=>{this.blockingModule?.addEventListener("click",(()=>{this.toggleButtonLoadingIndicator()})),this.blockingModule?.addEventListener("blocked-state-update-error",(()=>{this.toggleButtonLoadingIndicator()})),this.blockingModule?.addEventListener("blocked-state-updated",(()=>{this.dispatchBlockEvents(!0),this.toggleButtonLoadingIndicator(),this.userBlockingButton?.setAttribute("disabled",""),this.userBlockingButton.innerText="Blocked"}))}}get userBlockingSwitch(){return this.querySelector("faceplate-switch-input")}get blockingModule(){return this.querySelector("user-blocking")}get userBlockingButton(){return this.blockingModule?.querySelector("#block-user-button")}firstUpdated(){super.firstUpdated(),this.updateComplete.then((()=>{this.addUserBlockingSwitchListener(),this.addUserBlockingButtonListeners()}))}render(){return t.x` `}};T=e._([e.e("success-screen")],T);let I=class extends t.s{constructor(){super(...arguments),this.updateFormState=()=>{const t=this.getAttribute("name")??"",i=this.getAttribute("value")??"",a=this.getAttribute("data-nextaction")??void 0,n=this.getAttribute("data-next-step")??"";this.dispatchEvent(e.c("update-report-form",{fieldName:t,value:i,nextAction:{type:a,step:n},button:{updateButtonText:!1,isDisabled:!1}}))},this.dispatchReportEvent=t=>{this.dispatchEvent(e.c("report-tracking",{reportFlow:{flowOptionSelected:i.F.OUTBOUND_LINK,flowOutboundLink:t}}))}}get yesButton(){return this.querySelector("#report-action-button")}get crisisTextLineLink(){return this.querySelector('a[id="crisis-text-line-link"]')}get ctlOptionsLink(){return this.querySelector('a[id="ctl-options-link"]')}firstUpdated(){this.updateFormState(),this.ctlOptionsLink?.addEventListener("click",(()=>this.dispatchReportEvent(this.ctlOptionsLink?.href??""))),this.crisisTextLineLink?.addEventListener("click",(()=>this.dispatchReportEvent(this.crisisTextLineLink?.href??"")))}render(){return t.x` `}};I=e._([e.e("ctl-step-one")],I);let y=class extends R{constructor(){super(...arguments),this.dispatchReportEvent=t=>{this.dispatchEvent(e.c("report-tracking",{reportFlow:{flowOptionSelected:i.F.OUTBOUND_LINK,flowOutboundLink:t}}))}}get listItemOne(){return this.querySelector('a[id="ctl-success-list-item-one"]')}get listItemTwo(){return this.querySelector('a[id="ctl-success-list-item-two"]')}firstUpdated(){super.firstUpdated(),this.listItemOne?.addEventListener("click",(()=>this.dispatchReportEvent(this.listItemOne?.href??""))),this.listItemTwo?.addEventListener("click",(()=>this.dispatchReportEvent(this.listItemTwo?.href??"")))}render(){return t.x` `}};var f;y=e._([e.e("ctl-step-two")],y);let A=f=class extends t.s{constructor(){super(...arguments),this.selectedRedditorUsernames=[],this.showInput=!0,this.inputFields=[""],this.savedUsernames=[],this.handleShowInput=()=>{this.addNewInputField()},this.addNewInputField=()=>{this.inputFields.length{this.selectedRedditorUsernames=this.inputFields.filter((e=>""!==e.trim())).map((e=>e.trim())),this.dispatchEvent(e.c("username-update",{usernames:this.selectedRedditorUsernames}))},this.handleAddAccountsClick=()=>{this.addNewInputField()},this.handleInputFieldBlur=t=>{this.savedUsernames=this.inputFields.filter((e=>""!==e.trim())).map((e=>e.trim())),this.dispatchEvent(e.c("saved-usernames-update",{usernames:this.savedUsernames}))},this.renderInputFields=()=>this.inputFields.map(((i,a)=>{const n=i.length>0;return t.x`
${"Username"}
${this.inputFields.length>1&&a>0?t.x`
${e.Z({appearance:"plain",attributes:{onclick:()=>this.removeInputField(a),"aria-label":"Clear username input"},leadingIcon:t.R({size:t.I.Small})})}
`:t.x`
${e.Z({appearance:"plain",attributes:{disabled:!0,style:"visibility: hidden;"},leadingIcon:t.R({size:t.I.Small})})}
`}
`;})),this.handleInputFieldChange=(e,t)=>{const i=e.target;this.inputFields[t]=i.value,this.inputFields=[...this.inputFields],this.updateSelectedRedditors()},this.removeInputField=t=>{this.inputFields.length<=1||(this.inputFields.splice(t,1),this.inputFields=[...this.inputFields],this.updateSelectedRedditors(),this.savedUsernames=this.inputFields.filter((e=>""!==e.trim())).map((e=>e.trim())),this.dispatchEvent(e.c("saved-usernames-update",{usernames:this.savedUsernames})))},this.reset=()=>{this.inputFields=[""],this.selectedRedditorUsernames=[],this.savedUsernames=[],this.updateSelectedRedditors(),this.dispatchEvent(e.c("saved-usernames-update",{usernames:[]}))}}render(){return t.x`
${this.hint?t.x` `:t.A}
${this.renderInputFields()}
${e.Z({attributes:{id:"report-additional-accounts",className:"grow-0 shrink-0 self-start",onclick:()=>this.handleAddAccountsClick(),disabled:this.inputFields.length>=f.MAX_USERS},appearance:"plain",children:"Report additional accounts",leadingIcon:s.a({size:t.I.Small})})}
`;}};return A.styles=[e.t],A.MAX_USERS=10,e._([e.n()],A.prototype,"hint",void 0),e._([e.v()],A.prototype,"selectedRedditorUsernames",void 0),e._([e.v()],A.prototype,"showInput",void 0),e._([e.v()],A.prototype,"inputFields",void 0),e._([e.v()],A.prototype,"savedUsernames",void 0),A=f=e._([e.e("username-input-list")],A),{get R(){return g},get a(){return b},g:E}})); SML.di("./C42E8rVVpA.js",import.meta.url,"C42E8rVVpA");SML.di("./BcUlF1uWDA.js",import.meta.url,"BcUlF1uWDA");SML.di("./BnZOm2BOqI.js",import.meta.url,"BnZOm2BOqI");SML.di("./BkjgI35gdl.js",import.meta.url,"BkjgI35gdl");SML.di("./DUzIBJc2in.js",import.meta.url,"DUzIBJc2in");SML.di("./CsxDAjmHZE.js",import.meta.url,"CsxDAjmHZE");SML.di("./C2rAA4roMn.js",import.meta.url,"C2rAA4roMn");SML.di("./tn7sgJBOIW.js",import.meta.url,"tn7sgJBOIW");SML.di("./CxBOcTjMlj.js",import.meta.url,"CxBOcTjMlj");SML.di("./DW4Y66xecc.js",import.meta.url,"DW4Y66xecc");SML.di("./CndptGkkPK.js",import.meta.url,"CndptGkkPK");SML.di("./CCtMKamAzh.js",import.meta.url,"CCtMKamAzh");SML.di("./BYyjGDBWHg.js",import.meta.url,"BYyjGDBWHg"); SML.dm("BlbLcqZQ27",["C42E8rVVpA","BcUlF1uWDA","BnZOm2BOqI","BkjgI35gdl","DUzIBJc2in","CsxDAjmHZE","C2rAA4roMn","tn7sgJBOIW","CxBOcTjMlj","DW4Y66xecc","CndptGkkPK","CCtMKamAzh","BYyjGDBWHg"],(async(e,i,a,t,s,r)=>{const n=r.s;let l=window.location,o=class extends n{constructor(){super(...arguments),this.visibility=e.ha.Public,this.subredditIds="",this.isCreateMode=!1,this.isCopyMode=!1,this.displayNameInput=e.U(),this.descriptionInput=e.U(),this.visibilityInput=e.U(),this.isPrivate=!1,this.showOnProfile=!1,this._events=new e.E(this),this.handleResponse=this._events.define("faceplate-response",(async i=>{(await i.detail.response.clone().text()).includes("faceplate-alert")||(this.fireCloseDialogEvent(),e.p(e.T.CustomFeedUpdated,{label:this.label??"",name:this.displayNameInput.value?.value??"",visibility:this.visibilityInput.value?.value,descriptionMd:this.descriptionInput.value?.value}),e.cd(this,{message:"Custom feed description updated"}))})),this.handleSubmit=this._events.define("faceplate-request",(async i=>{if(this.isCreateMode||this.isCopyMode){i.preventDefault();try{const a=i.detail.request.body,t=a?.get("subredditIds")?.toString().split(",").filter((e=>e.startsWith("t5_")))||[],{data:{createMultireddit:r}}=await e.C({operation:e.H.CustomFeedCreate,variables:{input:{displayName:a?.get("displayName")?.toString()??"",descriptionMd:a?.get("descriptionMd")?.toString()??"",visibility:a?.get("visibility")?.toString()??e.ha.Public,subredditIds:t}}});if(r){const{ok:i,multireddit:a}=r;if(i&&a?.path){e.p(e.T.CustomFeedCreated),e.f(this,this.isCopyMode?s.cl(a.path):s.cm(a.path));const i=new URL(l.href);return i.pathname=a.path,void(l.href=i.href)}}throw new Error("error creating custom feed")}catch(i){const a=this.isCopyMode?"Failed to copy custom feed":"Failed to create custom feed";this.dispatchEvent(e.c("faceplate-alert",{level:e.X.error,cause:"uncategorized",message:a}))}}}))}firstUpdated(){this.isPrivate="PRIVATE"===this.visibility,this.showOnProfile="PUBLIC"===this.visibility,this.isCreateMode||this.isCopyMode||this._events.define("faceplate-alert",(e=>{e.detail.message="Failed to save custom feed"}))}willUpdate(i){if(this.hasUpdated){const a=i.has("isPrivate"),t=i.has("showOnProfile");(a||t)&&(this.visibility=a?this.isPrivate?e.ha.Private:e.ha.Public:this.showOnProfile?e.ha.Public:e.ha.Hidden,a&&(this.showOnProfile=this.visibility===e.ha.Public))}}fireCloseDialogEvent(){this.dispatchEvent(new CustomEvent("close-dialog",{composed:!0,bubbles:!0}))}handleCancelClick(){this.fireCloseDialogEvent()}renderForm(){return r.x`
${"Name"} ${"Description"} ${t.l({onClick:()=>this.isPrivate=!this.isPrivate,label:"Make private",attributes:{role:"menuitemcheckbox",className:"group"},size:t.L.Medium,trailingSlot:r.x` `,description:"Only viewable by you"})} ${t.l({onClick:()=>{this.isPrivate||(this.showOnProfile=!this.showOnProfile)},label:"Show on profile",attributes:{role:"menuitemcheckbox"},size:t.L.Medium,trailingSlot:r.x` `,description:"Display this feed on your profile so others can find it"})}
${e.Z({appearance:"secondary",size:e.ac.Small,children:"Cancel",attributes:{type:"button",onclick:this.handleCancelClick}})} ${e.Z({appearance:"primary",size:e.ac.Small,children:"Submit",attributes:{type:"submit"}})}
`;}render(){return this.renderForm()}};o.styles=[e.t],e._([e.n({type:String})],o.prototype,"label",void 0),e._([e.n({type:String,attribute:"display-name"})],o.prototype,"displayName",void 0),e._([e.n({type:String})],o.prototype,"description",void 0),e._([e.n({type:String,reflect:!0})],o.prototype,"visibility",void 0),e._([e.n({type:String,attribute:"subreddit-ids"})],o.prototype,"subredditIds",void 0),e._([e.n({type:Boolean,attribute:"create"})],o.prototype,"isCreateMode",void 0),e._([e.n({type:Boolean,attribute:"copy"})],o.prototype,"isCopyMode",void 0),e._([e.v()],o.prototype,"isPrivate",void 0),e._([e.v()],o.prototype,"showOnProfile",void 0),o=e._([e.e("custom-feed-details-form")],o)})); SML.dm("BskNjLbli-",[],(async()=>{var _,E,e,t,T,S;return function(_){_.OPTIONS="options",_.SUBREDDIT_RULES="subreddit_rules",_.SUPPORTING_EVIDENCE="supporting_evidence",_.SUBMIT="submit",_.URL="url",_.FLOW="flow",_.FLOW_SUBMIT="flow_submit"}(_||(_={})),function(_){_.ADDITIONAL_CONTENT="ADDITIONAL_CONTENT",_.FREE_TEXT="FREE_TEXT",_.USERNAMES="USERNAMES",_.BAN_EVASION_USERS="BAN_EVASION_USERS"}(E||(E={})),function(_){_.REPORT_REASONS="REPORT_REASONS",_.USER_DETAILS="USER_DETAILS",_.BAN_EVASION="BAN_EVASION_USERS",_.SUCCESS="SUCCESS",_.CTL_STEP_ONE="CTL_STEP_ONE",_.CTL_STEP_TWO="CTL_STEP_TWO"}(e||(e={})),function(_){_.Post="post",_.Comment="comment",_.User="user",_.PrivateMessage="PrivateMessage",_.ModmailMessage="ModmailMessage",_.Username="username"}(t||(t={})),function(_){_.MOD_CONTENT="mod_content",_.USER_CONTENT="user_content",_.REPORT_PAGE="report_page"}(T||(T={})),function(_){_.ADD_CONTENT="add_content",_.FREE_TEXT="free_text",_.CUSTOM_RESPONSE="custom_response",_.REPORT_REASON="report_reason",_.REPORT_SUBREASON="report_subreason",_.OUTBOUND_LINK="outbound_link",_.REPORT_SUBMIT="report_submit",_.REPORT_FLOW_DONE="report_flow_done",_.NEXT_BUTTON="next_button",_.BACK_ARROW="back_arrow",_.X_OUT="x_out",_.BLOCK_USER_TOGGLE="block_user_toggle",_.REDDITCARES_BUTTON="redditcares_button",_.USER="another_user",_.CONTENT="reddit_content",_.BAN_EVASION="ban_evasion",_.SUBMIT_ANOTHER="submit_another_report"}(S||(S={})),{get F(){return S},get N(){return _},get R(){return e},get S(){return E},get V(){return t},get a(){return T}}})); SML.di("./C42E8rVVpA.js",import.meta.url,"C42E8rVVpA");SML.di("./BskNjLbli-.js",import.meta.url,"BskNjLbli-"); SML.dm("BsuRkrTcpO",["C42E8rVVpA","BskNjLbli-"],(async(e,t)=>{const r="ModmailMessage_",s={[t.V.Post]:"postId",[t.V.Comment]:"commentId",[t.V.User]:"redditorId",[t.V.PrivateMessage]:"messageId",[t.V.ModmailMessage]:"messageId"},o={[t.V.Post]:e.H.ReportPost,[t.V.Comment]:e.H.ReportComment,[t.V.User]:e.H.ReportUserDetails,[t.V.PrivateMessage]:e.H.ReportPrivateMessage,[t.V.ModmailMessage]:e.H.ReportModmailMessage,[t.V.Username]:e.H.ReportRedditor};return{a:e=>{if(!e)return t.V.Username;if(e.includes("t4_"))return t.V.PrivateMessage;if(e.includes("t3_"))return t.V.Post;if(e.includes("t2_"))return t.V.User;if(e.includes("t1_"))return t.V.Comment;if(e.includes(r))return t.V.ModmailMessage;throw new Error("Unsupported item type provided")},b:({itemType:o,formValues:a,thingId:i,isStandalone:d,conversationId:n})=>{const m={fromHelpDesk:!1},p=o===t.V.ModmailMessage;if(o===t.V.User&&a?.USER_DETAILS&&(m.userDetailType=a?.USER_DETAILS),p&&n&&(m.conversationId=n),!a?.REPORT_REASONS)throw new Error("Report reasons form value not found");const l=a?.REPORT_REASONS;if("SUBREDDIT"===l){const e=a[l];"customResponse"===e?m.customRule=a[e]:m.subredditRule=e}else m.siteRule=a[l]??l;if(a.FREE_TEXT&&(m.freeText=a.FREE_TEXT),a.ADDITIONAL_CONTENT){const e=a.ADDITIONAL_CONTENT;m.reportedItems=e.split(",").map((e=>({itemId:e})))}if(m.siteRule===e.aP.BanEvasion){if(a.redditorUsernames){const e=a.redditorUsernames.split(",").map((e=>e.trim())).map((e=>e.startsWith("u/")?e.slice(2):e)).filter((e=>e));m[p?"additionalUserNames":"redditorUsernames"]=e}a.subredditId&&(m.subredditId=a.subredditId)}const R=p?i?.split(r).at(1)??"":i;return{...m,...o===t.V.Username?{}:{[s[o]]:R},fromHelpDesk:d||!1}},c:e=>{const t="reportPost"in e.data&&e.data?.reportPost?.ok,r="reportComment"in e.data&&e.data?.reportComment?.ok,s="reportUserDetails"in e.data&&e.data?.reportUserDetails?.ok,o="reportPrivateMessage"in e.data&&e.data?.reportPrivateMessage?.ok,a="reportRedditor"in e.data&&e.data?.reportRedditor?.ok,i="reportModmailMessage"in e.data&&e.data?.reportModmailMessage?.ok;return t||r||s||o||a||i},d:(r,s)=>!s||r!==t.V.User&&r!==t.V.Username?o[r]:e.H.ReportRedditor,g:o}})); SML.di("./0Jw_Y6qiJT.js",import.meta.url,"0Jw_Y6qiJT");SML.di("./C42E8rVVpA.js",import.meta.url,"C42E8rVVpA");SML.di("./CsxDAjmHZE.js",import.meta.url,"CsxDAjmHZE");SML.di("./DDlHO7m_JZ.js",import.meta.url,"DDlHO7m_JZ");SML.di("./DUzIBJc2in.js",import.meta.url,"DUzIBJc2in");SML.di("./BkjgI35gdl.js",import.meta.url,"BkjgI35gdl");SML.di("./CeSBv4aKUm.js",import.meta.url,"CeSBv4aKUm");SML.di("./CTI0RAQLXe.js",import.meta.url,"CTI0RAQLXe");SML.di("./DENs6JDSt6.js",import.meta.url,"DENs6JDSt6");SML.di("./P3i_qibcRb.js",import.meta.url,"P3i_qibcRb");SML.di("./BIrqd8tOEI.js",import.meta.url,"BIrqd8tOEI");SML.di("./BYHcj9m37j.js",import.meta.url,"BYHcj9m37j");SML.di("./QNObn5oVP6.js",import.meta.url,"QNObn5oVP6"); SML.dm("BtqSougqCi",["C42E8rVVpA","CsxDAjmHZE","DDlHO7m_JZ","DUzIBJc2in","BkjgI35gdl","CeSBv4aKUm","CTI0RAQLXe","BIrqd8tOEI","0Jw_Y6qiJT","DENs6JDSt6","P3i_qibcRb","BYHcj9m37j","QNObn5oVP6"],(async(e,t,a,i,s,n,r,d)=>{var o;!function(e){e.Collapsed="0",e.Expanded="1"}(o||(o={})),Object.values(o);let l=class extends t.s{constructor(){super(...arguments),this.country="",this.featuredGameSlug="",this.persistedCollapsePreferenceEnabled=!1,this.badgedPersonalizedGameSlugs=[],this._activeBadgedGameSlugs=[],this._isFeaturedGameBadgeActive=!0,this._drawerState=null,this._onClick=()=>{const e=this._getCurrentExpandedState();this._drawerState!==e&&(this._clearNavBadgeIfEligible(),this._setGamesDrawerState(e))},this._getCurrentExpandedState=()=>void 0===this._sectionHelpers?.[0]?.open?o.Collapsed:this._sectionHelpers[0].open?o.Expanded:o.Collapsed,this._setGamesDrawerState=async t=>{var a,i;(this._drawerState=t,this.country&&void 0!==this._sectionHelpers?.[0]?.open)&&(e.f(this,e.b({source:"nav",action:"click",noun:t===o.Expanded?"games_drawer_open":"games_drawer_close"})),a=t,i=this.country,e.B({name:e.fy,value:a,country:i}),this.persistedCollapsePreferenceEnabled&&(this._saveCollapseStateOnServerWithDebounce(t),this.showSuccessToast(t)))},this.showSuccessToast=e.a7((t=>{const a=e.c("faceplate-alert",{level:e.X.success,message:"Games section badges turned "+(t===o.Expanded?"on":"off")});this.dispatchEvent(a)}),250,{leading:!0,trailing:!0}),this._saveCollapseStateOnServer=t=>this._requestClientGQL({operation:e.H.UpdateDevvitPreferences,variables:{input:{isGamesDrawerCollapsed:t===o.Collapsed}}}),this._saveCollapseStateOnServerWithDebounce=e.a7(this._saveCollapseStateOnServer,250),this._requestClientGQL=e.C,this._clearNavBadgeIfEligible=()=>{if(this._isFeaturedGameBadgeActive||this._activeBadgedGameSlugs.length>0)return;document.querySelectorAll("games-section-badge-wrapper").forEach((e=>e.isBadgeActive=!1))},this._onGamesSectionBadgeWrapperClick=t=>{t.stopPropagation(),e.a0.isAvailable()&&e.a0.setItem(e.a1.DevvitGamesSectionFeaturedGameSlug,this.featuredGameSlug),this._isFeaturedGameBadgeActive=!1,this._clearNavBadgeIfEligible()},this._onPersonalizedGameBadgeClick=e=>{e.stopPropagation();const{appSlug:t}=e.detail;this._activeBadgedGameSlugs=this._activeBadgedGameSlugs.filter((e=>e!==t)),0===this._activeBadgedGameSlugs.length&&this._clearNavBadgeIfEligible()}}firstUpdated(){this._activeBadgedGameSlugs=[...this.badgedPersonalizedGameSlugs],this._isFeaturedGameBadgeActive=a.s(this.featuredGameSlug),this._drawerState=this._getCurrentExpandedState()}render(){return t.x` `}};e._([e.l({selector:"faceplate-expandable-section-helper",flatten:!0})],l.prototype,"_sectionHelpers",void 0),e._([e.n({attribute:"country",type:String})],l.prototype,"country",void 0),e._([e.n({attribute:"featured-game-slug",type:String})],l.prototype,"featuredGameSlug",void 0),e._([e.n({attribute:"persisted-collapse-preference-enabled",type:Boolean})],l.prototype,"persistedCollapsePreferenceEnabled",void 0),e._([e.n({attribute:"badged-personalized-game-slugs",converter:{fromAttribute:e=>e?e.split(","):[]}})],l.prototype,"badgedPersonalizedGameSlugs",void 0),e._([e.v()],l.prototype,"_activeBadgedGameSlugs",void 0),e._([e.v()],l.prototype,"_isFeaturedGameBadgeActive",void 0),l=e._([e.e("games-section-badge-controller")],l);let p=class extends t.s{constructor(){super(...arguments),this.name="",this.slug="",this.iconUrl="",this.ctaLink="",this.subredditId=void 0,this.isSubscribedToSubreddit=!1,this.slotNumber=0,this.isRecentlyPlayed=!1,this.itemLabel="",this.isBadged=!1,this.isBadgedAndVisible=!1,this.onClick=async()=>{e.f(this,this.buildEventData("click")),this.isBadgedAndVisible&&(this.isBadgedAndVisible=!1,this.dispatchEvent(e.c("personalized-game-badge-click",{appSlug:this.slug})),e.a0.isAvailable()&&e.a0.setItem(e.a1.DevvitGamesPersonalizedBadgeClearedAt,String(Date.now())),await(async t=>{try{await e.C({operation:e.H.ClearPersonalizedDevvitGameBadge,variables:{input:{appSlug:t}}})}catch(e){window.Sentry?.captureException?.(e)}})(this.slug))}}static get styles(){return[e.t]}buildEventData(t){return e.b({source:"nav",action:t,noun:"games_drawer_personalized_game"},{devplatform:{app_slug:this.slug,internal_entry_point:`games_drawer_slot_${this.slotNumber}`,app_recommendation_criteria:this.isRecentlyPlayed?"recently_played":"popular",app_badged_by_developer:this.isBadgedAndVisible}})}connectedCallback(){super.connectedCallback(),this.isBadgedAndVisible=this.isBadged&&(()=>{if(!e.a0.isAvailable())return!0;const t=e.a0.getItem(e.a1.DevvitGamesPersonalizedBadgeClearedAt);if(t){const a=Number(t),i=Date.now(),s=864e5;if(Number.isFinite(a)&&i-a