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("./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("./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.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.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("./C42E8rVVpA.js",import.meta.url,"C42E8rVVpA");SML.di("./C-4AJ2Y78L.js",import.meta.url,"C-4AJ2Y78L");SML.di("./CsxDAjmHZE.js",import.meta.url,"CsxDAjmHZE");SML.di("./wDRHyxVKtb.js",import.meta.url,"wDRHyxVKtb");SML.di("./DUzIBJc2in.js",import.meta.url,"DUzIBJc2in");SML.di("./cjhvxMuwOm.js",import.meta.url,"cjhvxMuwOm"); SML.di("./BlHsaTCeEh.js",import.meta.url,"BlHsaTCeEh");SML.di("./D_F1vtGIq1.js",import.meta.url,"D_F1vtGIq1");SML.di("./C2rAA4roMn.js",import.meta.url,"C2rAA4roMn");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("./BcUlF1uWDA.js",import.meta.url,"BcUlF1uWDA");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("./Da-UYDWSOS.js",import.meta.url,"Da-UYDWSOS");SML.di("./BVwlQhSoPB.js",import.meta.url,"BVwlQhSoPB");SML.di("./B01f6V9jnX.js",import.meta.url,"B01f6V9jnX");SML.di("./DUaETbwyQ9.js",import.meta.url,"DUaETbwyQ9");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("./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("./CCtMKamAzh.js",import.meta.url,"CCtMKamAzh");SML.di("./BYyjGDBWHg.js",import.meta.url,"BYyjGDBWHg"); SML.di("./CsxDAjmHZE.js",import.meta.url,"CsxDAjmHZE"); SML.dm("CADvzNWQk1",["CsxDAjmHZE"],(async l=>{const{svg:a}=l.g();return{c:l.m(a``,"0 0 20 20","caret-up")}})); SML.di("./C42E8rVVpA.js",import.meta.url,"C42E8rVVpA");SML.di("./CsxDAjmHZE.js",import.meta.url,"CsxDAjmHZE"); SML.dm("CD0I_kVKzi",["C42E8rVVpA","CsxDAjmHZE"],(async(e,t)=>{let i=class extends t.s{constructor(){super(...arguments),this.windowEvents=new e.E(this,(()=>window)),this.setupEls=()=>{this.search=this.querySelector("reddit-search-large"),this.secondaryButton=this.querySelector('[data-part="secondary"]'),this.campaignButton=this.querySelector('[data-part="campaign"]')},this.handleResize=function(e){let t;const i=()=>void 0!==t;function n(...n){i()||(t=window.requestAnimationFrame((()=>{e.apply(this,n),t=void 0})))}return n.cancel=()=>{void 0!==t&&(window.cancelAnimationFrame(t),t=void 0)},n.pending=i,n}((()=>{const{search:e,secondaryButton:t,campaignButton:i}=this,s=i?.firstElementChild,h=t?.firstElementChild;if(!e||!h||!s)return;d(t,i);const o=()=>0!==r(s).width&&r(e).right>r(s).left-n;o()&&(a(t),o()&&a(i))})),this._resize=this.windowEvents.define("resize",this.handleResize)}connectedCallback(){super.connectedCallback(),this.setupEls(),this.handleResize()}createRenderRoot(){return this}};i=e._([e.e("reddit-header-action-items")],i);const n=16,s=["hidden","xs:hidden","s:hidden","m:hidden","l:hidden","xl:hidden"],d=(...e)=>e.forEach((e=>e.classList.remove(...s))),a=(...e)=>e.forEach((e=>e.classList.add(...s))),r=e=>e.getBoundingClientRect()})); SML.di("./C42E8rVVpA.js",import.meta.url,"C42E8rVVpA");SML.di("./CsxDAjmHZE.js",import.meta.url,"CsxDAjmHZE"); SML.dm("CMAMkGxOzL",["C42E8rVVpA","CsxDAjmHZE"],(async(e,t)=>{const o=async(t,o,s)=>{try{const{isBlocked:a,response:{data:{updateRedditorBlockState:u},errors:n}}=await r(t?e.e2.None:e.e2.Blocked,o);if(u?.ok){const t=a?`u/${s} is now blocked.`:`u/${s} is now unblocked.`;return{level:e.X.success,message:t}}if(n.length||null===u)return window.Sentry?.captureMessage(n?.[0]?.message??"Something went wrong"),{level:e.X.error,message:`You can't block u/${s} for 24 hours after unblocking them`,cause:"user-block-rate-limited"};throw new Error(n?.[0]?.message??"Generic error while blocking user")}catch(e){return window.Sentry?.captureMessage(e),a()}},r=async(t,o)=>{try{return{response:await e.C({operation:e.H.UpdateRedditorBlockState,variables:{input:{redditorId:o,blockState:t}}}),isBlocked:t!==e.e2.None}}catch(e){throw new Error("Error during user blocking gql call")}},a=()=>({level:e.X.error,message:"An error has occurred. Please try again later",cause:e.b8.UncaughtError}),s=t.s;let u=class extends s{constructor(){super(...arguments),this.userId="",this.username="",this.isUserInitBlocked=!1,this.showAlerts=!1,this.shouldNotHandleSubmission=!1,this.isUserBlocked=!1,this._onClick=()=>{this.shouldNotHandleSubmission||this.child?.disabled||this.handleBlockUserState()},this.handleBlockUserState=async()=>{const{level:t,message:r,cause:a}=await o(this.isUserBlocked,this.userId,this.username);(this.showAlerts||t===e.X.error)&&this.dispatchEvent(e.c("faceplate-alert",{level:t,message:r,cause:a})),t===e.X.error&&this.dispatchEvent(e.c("blocked-state-update-error")),t===e.X.success&&(this.isUserBlocked=!this.isUserBlocked,this.dispatchEvent(e.c("blocked-state-updated",{isBlocked:this.isUserBlocked})))}}get child(){return this.querySelector("button")??this.querySelector("faceplate-switch-input")??void 0}connectedCallback(){super.connectedCallback(),this.isUserBlocked=this.isUserInitBlocked,this.addEventListener("click",this._onClick)}disconnectedCallback(){this.removeEventListener("click",this._onClick)}render(){return t.x` `}};u.styles=[e.t],e._([e.n({type:String,attribute:"user-id"})],u.prototype,"userId",void 0),e._([e.n({type:String})],u.prototype,"username",void 0),e._([e.n({type:Boolean,attribute:"is-user-init-blocked"})],u.prototype,"isUserInitBlocked",void 0),e._([e.n({type:Boolean,attribute:"show-alerts"})],u.prototype,"showAlerts",void 0),e._([e.n({type:Boolean,attribute:"should-not-handle-submission"})],u.prototype,"shouldNotHandleSubmission",void 0),e._([e.v()],u.prototype,"isUserBlocked",void 0),u=e._([e.e("user-blocking")],u);var n=Object.freeze({__proto__:null,get UserBlocking(){return u}});return{h:o,get i(){return n}}})); SML.di("./C42E8rVVpA.js",import.meta.url,"C42E8rVVpA");SML.di("./D1r4R6mP-Z.js",import.meta.url,"D1r4R6mP-Z");SML.di("./B7-syxD746.js",import.meta.url,"B7-syxD746");SML.di("./e7dOdCRpDZ.js",import.meta.url,"e7dOdCRpDZ");SML.di("./DT4H06b_az.js",import.meta.url,"DT4H06b_az");SML.di("./1i4g9fLWHY.js",import.meta.url,"1i4g9fLWHY");SML.di("./CKuUwv2_dV.js",import.meta.url,"CKuUwv2_dV");SML.di("./CsxDAjmHZE.js",import.meta.url,"CsxDAjmHZE");SML.di("./Af-MWsPOE9.js",import.meta.url,"Af-MWsPOE9");SML.di("./P3i_qibcRb.js",import.meta.url,"P3i_qibcRb");SML.di("./GJ95KQEbk4.js",import.meta.url,"GJ95KQEbk4");SML.di("./DCbB57ubLb.js",import.meta.url,"DCbB57ubLb");SML.di("./BUnsiaD7oQ.js",import.meta.url,"BUnsiaD7oQ");SML.di("./DUzIBJc2in.js",import.meta.url,"DUzIBJc2in");SML.di("./tn7sgJBOIW.js",import.meta.url,"tn7sgJBOIW");SML.di("./DW4Y66xecc.js",import.meta.url,"DW4Y66xecc");SML.di("./C2rAA4roMn.js",import.meta.url,"C2rAA4roMn");SML.di("./CCtMKamAzh.js",import.meta.url,"CCtMKamAzh");SML.di("./CndptGkkPK.js",import.meta.url,"CndptGkkPK");SML.di("./BYyjGDBWHg.js",import.meta.url,"BYyjGDBWHg");SML.di("./CxBOcTjMlj.js",import.meta.url,"CxBOcTjMlj");SML.di("./tmkhvHLxT3.js",import.meta.url,"tmkhvHLxT3");SML.di("./BtqmVQuPYp.js",import.meta.url,"BtqmVQuPYp");SML.di("./B-LM1r1oJd.js",import.meta.url,"B-LM1r1oJd");SML.di("./DrM-WGXCsZ.js",import.meta.url,"DrM-WGXCsZ");SML.di("./BcUlF1uWDA.js",import.meta.url,"BcUlF1uWDA");SML.di("./BnZOm2BOqI.js",import.meta.url,"BnZOm2BOqI");SML.di("./Dg2hMEypTN.js",import.meta.url,"Dg2hMEypTN");SML.di("./B01f6V9jnX.js",import.meta.url,"B01f6V9jnX");SML.di("./Da-UYDWSOS.js",import.meta.url,"Da-UYDWSOS");SML.di("./BVwlQhSoPB.js",import.meta.url,"BVwlQhSoPB");SML.di("./5YOkNVVwii.js",import.meta.url,"5YOkNVVwii");SML.di("./wDRHyxVKtb.js",import.meta.url,"wDRHyxVKtb");SML.di("./cjhvxMuwOm.js",import.meta.url,"cjhvxMuwOm");SML.di("./CZU1X6W5t6.js",import.meta.url,"CZU1X6W5t6");SML.di("./CMwQRCekeQ.js",import.meta.url,"CMwQRCekeQ");SML.di("./UD2pUVjMzE.js",import.meta.url,"UD2pUVjMzE");SML.di("./s-4Yvb6Bvs.js",import.meta.url,"s-4Yvb6Bvs");SML.di("./D9SW9I8HSz.js",import.meta.url,"D9SW9I8HSz");SML.di("./OoVe58o1C_.js",import.meta.url,"OoVe58o1C_");SML.di("./49y-lAvwLm.js",import.meta.url,"49y-lAvwLm");SML.di("./CTI0RAQLXe.js",import.meta.url,"CTI0RAQLXe");SML.di("./Da26ZrtZTU.js",import.meta.url,"Da26ZrtZTU");SML.di("./kRpPw7movd.js",import.meta.url,"kRpPw7movd");SML.di("./CuC-xwr_mY.js",import.meta.url,"CuC-xwr_mY");SML.di("./D_F1vtGIq1.js",import.meta.url,"D_F1vtGIq1");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("./CMAMkGxOzL.js",import.meta.url,"CMAMkGxOzL");SML.di("./IEfg4Wg9pd.js",import.meta.url,"IEfg4Wg9pd");SML.di("./DRDo-q4GrF.js",import.meta.url,"DRDo-q4GrF");SML.di("./BsuRkrTcpO.js",import.meta.url,"BsuRkrTcpO");SML.di("./BskNjLbli-.js",import.meta.url,"BskNjLbli-"); SML.di("./CsxDAjmHZE.js",import.meta.url,"CsxDAjmHZE");SML.di("./C42E8rVVpA.js",import.meta.url,"C42E8rVVpA");SML.di("./DUzIBJc2in.js",import.meta.url,"DUzIBJc2in"); SML.dm("CSjBO_0WNc",["CsxDAjmHZE","C42E8rVVpA","DUzIBJc2in"],(async(n,t,e)=>{const i={plain:"plain",plainInverted:"plainInverted",error:"error",brand:"brand",caution:"caution",success:"success"};let a=class extends n.s{constructor(){super(...arguments),this.multiLine=!1,this.appearance="plain",this.shape="rounded",this.msg="",this.rafId=null,this.onTextContainerResize=(n,t)=>{this.rafId&&cancelAnimationFrame(this.rafId),this.rafId=requestAnimationFrame((()=>{if(!(this.actionButtons.length&&this.textContainer&&this.bannerText&&this.actionButtonContainer))return;const e=this.textContainer.getBoundingClientRect().width>this.bannerText.getBoundingClientRect().width+this.actionButtonContainer.getBoundingClientRect().width,i=2.5*t;for(const t of n){const n=t.contentRect.height>=i;this.multiLine&&e&&!n?this.multiLine=!1:!this.multiLine&&n&&(this.multiLine=!0)}}))}}static get styles(){return n.i`:host{display:block}.plain{background:var(--color-banner-plain);color:var(--color-banner-plain-text)}.plainInverted{background:var(--color-banner-plain-inverted);color:var(--color-banner-plain-inverted-text)}.error{background:var(--color-banner-error);color:var(--color-banner-error-text)}.success{background:var(--color-banner-success);color:var(--color-banner-success-text)}.brand{background:var(--color-banner-brand);color:var(--color-banner-brand-text)}.caution{background:var(--color-caution-background);color:var(--color-caution-onBackground)}.first-row{display:flex;justify-content:space-between;align-items:center;flex:1;height:var(--size-banner-height)}.first-row>.trailing-container{display:inline-flex;align-items:center}.first-row>.leading-container{display:inline-flex;align-items:center;flex:1}.icon-container,::slotted([slot=leadingIcon]),slot[name=leadingIcon]{display:inline-flex}.first-row .icon-container{padding-inline-end:var(--spacer-sm)}::slotted([slot=leadingIcon]),slot[name=leadingIcon]{align-items:center}#text-container{flex:1;max-height:${2.5};-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}#banner-text{padding-inline-end:var(--spacer-sm)}::slotted([slot=message]){display:inline}.banner{display:flex;padding-block:var(--spacer-2xs);padding-inline:var(--spacer-md) var(--spacer-xs);box-shadow:var(--elevation-xs)}.banner.multi-row{flex-direction:column;padding-top:var(--spacer-sm)}:host([shape=rounded]) .banner{border-radius:.75rem}.banner .second-row{margin:var(--spacer-sm) 0;justify-content:flex-end;display:flex}`}firstUpdated(){const n=parseFloat(getComputedStyle(document.documentElement).fontSize);this.resizeObserver=new ResizeObserver((t=>this.onTextContainerResize(t,n))),this.resizeObserver.observe(this.textContainer)}disconnectedCallback(){super.disconnectedCallback(),this.resizeObserver?.disconnect()}render(){return n.x``}};return a.getCloseButton=e.bj,a.getActionButtons=e.bk,t._([t.v()],a.prototype,"multiLine",void 0),t._([t.n({type:String})],a.prototype,"appearance",void 0),t._([t.n({type:String})],a.prototype,"shape",void 0),t._([t.n({type:String})],a.prototype,"msg",void 0),t._([t.Q("#text-container")],a.prototype,"textContainer",void 0),t._([t.Q("#banner-text")],a.prototype,"bannerText",void 0),t._([t.Q("#action-button-container")],a.prototype,"actionButtonContainer",void 0),t._([t.l({slot:"actionButtons"})],a.prototype,"actionButtons",void 0),a=t._([t.e("faceplate-banner")],a),{get F(){return a}}})); SML.di("./CsxDAjmHZE.js",import.meta.url,"CsxDAjmHZE");SML.di("./C42E8rVVpA.js",import.meta.url,"C42E8rVVpA");SML.di("./DUzIBJc2in.js",import.meta.url,"DUzIBJc2in"); SML.dm("CSjBO_0WNc",["CsxDAjmHZE","C42E8rVVpA","DUzIBJc2in"],(async(n,t,e)=>{const i={plain:"plain",plainInverted:"plainInverted",error:"error",brand:"brand",caution:"caution",success:"success"};let a=class extends n.s{constructor(){super(...arguments),this.multiLine=!1,this.appearance="plain",this.shape="rounded",this.msg="",this.rafId=null,this.onTextContainerResize=(n,t)=>{this.rafId&&cancelAnimationFrame(this.rafId),this.rafId=requestAnimationFrame((()=>{if(!(this.actionButtons.length&&this.textContainer&&this.bannerText&&this.actionButtonContainer))return;const e=this.textContainer.getBoundingClientRect().width>this.bannerText.getBoundingClientRect().width+this.actionButtonContainer.getBoundingClientRect().width,i=2.5*t;for(const t of n){const n=t.contentRect.height>=i;this.multiLine&&e&&!n?this.multiLine=!1:!this.multiLine&&n&&(this.multiLine=!0)}}))}}static get styles(){return n.i`:host{display:block}.plain{background:var(--color-banner-plain);color:var(--color-banner-plain-text)}.plainInverted{background:var(--color-banner-plain-inverted);color:var(--color-banner-plain-inverted-text)}.error{background:var(--color-banner-error);color:var(--color-banner-error-text)}.success{background:var(--color-banner-success);color:var(--color-banner-success-text)}.brand{background:var(--color-banner-brand);color:var(--color-banner-brand-text)}.caution{background:var(--color-caution-background);color:var(--color-caution-onBackground)}.first-row{display:flex;justify-content:space-between;align-items:center;flex:1;height:var(--size-banner-height)}.first-row>.trailing-container{display:inline-flex;align-items:center}.first-row>.leading-container{display:inline-flex;align-items:center;flex:1}.icon-container,::slotted([slot=leadingIcon]),slot[name=leadingIcon]{display:inline-flex}.first-row .icon-container{padding-inline-end:var(--spacer-sm)}::slotted([slot=leadingIcon]),slot[name=leadingIcon]{align-items:center}#text-container{flex:1;max-height:${2.5};-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}#banner-text{padding-inline-end:var(--spacer-sm)}::slotted([slot=message]){display:inline}.banner{display:flex;padding-block:var(--spacer-2xs);padding-inline:var(--spacer-md) var(--spacer-xs);box-shadow:var(--elevation-xs)}.banner.multi-row{flex-direction:column;padding-top:var(--spacer-sm)}:host([shape=rounded]) .banner{border-radius:.75rem}.banner .second-row{margin:var(--spacer-sm) 0;justify-content:flex-end;display:flex}`}firstUpdated(){const n=parseFloat(getComputedStyle(document.documentElement).fontSize);this.resizeObserver=new ResizeObserver((t=>this.onTextContainerResize(t,n))),this.resizeObserver.observe(this.textContainer)}disconnectedCallback(){super.disconnectedCallback(),this.resizeObserver?.disconnect()}render(){return n.x``}};return a.getCloseButton=e.bj,a.getActionButtons=e.bk,t._([t.v()],a.prototype,"multiLine",void 0),t._([t.n({type:String})],a.prototype,"appearance",void 0),t._([t.n({type:String})],a.prototype,"shape",void 0),t._([t.n({type:String})],a.prototype,"msg",void 0),t._([t.Q("#text-container")],a.prototype,"textContainer",void 0),t._([t.Q("#banner-text")],a.prototype,"bannerText",void 0),t._([t.Q("#action-button-container")],a.prototype,"actionButtonContainer",void 0),t._([t.l({slot:"actionButtons"})],a.prototype,"actionButtons",void 0),a=t._([t.e("faceplate-banner")],a),{get F(){return a}}})); 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.dm("CUTt-7x_aZ",["C42E8rVVpA","DUzIBJc2in","CsxDAjmHZE"],(async(e,t,r)=>{let n=class extends r.s{constructor(){super(...arguments),this.siteKey="",this.execute=async()=>{try{const e=this.getConfig();if(!e||!this.recaptchaController)return!1;this.recaptchaController.config.siteKey!==e.siteKey&&(this.recaptchaController.destroy(),this.recaptchaController=new t.aV({siteKey:e.siteKey}));const r=await this.recaptchaController.loadAndGenerateTokenSafe(e.pageType);if(r){const e=await this.sendToken(r);if(!e)throw new Error("Failed to transport reputation recaptcha token");if(e.errors&&e.errors.length>0)throw new Error(e.errors[0].message||"Failed to transport reputation recaptcha token");if(!1===e.data?.createCaptchaToken?.ok)throw new Error("Failed to transport reputation recaptcha token")}return!0}catch(e){return e instanceof Error&&window.Sentry?.captureException(e),!1}}}connectedCallback(){super.connectedCallback(),this.siteKey&&(this.recaptchaController=new t.aV({siteKey:this.siteKey})),window.addEventListener("afterRoute",this.execute),this.execute()}disconnectedCallback(){window.removeEventListener("afterRoute",this.execute),this.recaptchaController?.destroy(),super.disconnectedCallback()}async getToken(e){const{siteKey:r}=this;let n=this.recaptchaController,a=!1;n&&n.config.siteKey===r||(n=new t.aV({siteKey:r}),a=!0);try{const t=await n.generateTokenSafe(e);if(!t)throw new Error("Failed to generate reCAPTCHA token");return t}finally{a&&n.destroy()}}async sendToken(t){return e.C({operation:e.H.CreateCaptchaToken,variables:{input:{token:t}}})}getPageType(){return e.x()}getConfig(){const{siteKey:e}=this;if(!e)return null;const t=this.getPageType();return t?{pageType:t,siteKey:e}:null}};e._([e.n({type:String,attribute:"site-key"})],n.prototype,"siteKey",void 0),n=e._([e.e("reputation-recaptcha")],n);var a=Object.freeze({__proto__:null,get ReputationRecaptcha(){return n}});return{get i(){return a}}})); SML.di("./C42E8rVVpA.js",import.meta.url,"C42E8rVVpA");SML.di("./CsxDAjmHZE.js",import.meta.url,"CsxDAjmHZE"); SML.dm("CY0v7Q95fp",["C42E8rVVpA","CsxDAjmHZE"],(async(t,e)=>{let s=class extends e.s{constructor(){super(...arguments),this._events=new t.E(this),this.handleSlotChange=this._events.define("slotchange",(t=>{if(t.target.parentNode!==this.shadowRoot)return;const e=this.renderTemplate();e!==this.content&&(this.content=e,this.requestUpdate())})),this.onSetRouteRequested=this._events.define("shreddit-slotter-set-slot-name",(t=>{!t.defaultPrevented&&this.hasSlot(t.detail.slotName)&&(t.preventDefault(),this.slotName=t.detail.slotName)}))}static get styles(){return[t.t]}update(t){t.has("slotName")&&(this.content=this.renderTemplate(),this.requestUpdate()),super.update(t)}updated(e){e.has("slotName")&&this.slotName&&this.dispatchEvent(t.c("shreddit-slotter-slot-name-changed",{slotName:this.slotName})),super.updated(e)}renderTemplate(){if(!this.slotName)return;const s=this.querySelector(`template[slot=${this.slotName}]`);if(!(s instanceof HTMLTemplateElement))return"";const a=t.a4()?"theme-dark":"theme-light";return e.x`${t.N(s)}`}hasSlot(t){return this.querySelector(`template[slot=${t}]`)instanceof HTMLTemplateElement}render(){return e.x` ${this.content||""} `}};t._([t.n({type:String,attribute:"slot-name",reflect:!0})],s.prototype,"slotName",void 0),s=t._([t.e("shreddit-slotter")],s)})); 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("Cse0G_xARZ",["C42E8rVVpA","CsxDAjmHZE","DUzIBJc2in"],(async(e,t,a)=>{let p=class extends(a.W(t.s)){constructor(){super(...arguments),this.pages=0,this.for=void 0}get pageIndex(){return super.pageIndex}set pageIndex(e){super.pageIndex=e}get pageNames(){return super.pageNames}set pageNames(e){super.pageNames=e}static get styles(){return t.i`:host{display:block}.page{display:none}.active{display:block}`}render(){if(this.pages<1)return;const{pageNames:p}=this;return t.x`
${a.b(this.pages).map((a=>t.x`
`))}
`}pageIndexChangedCallback(e){super.pageIndexChangedCallback(e),this.requestUpdate("pageIndex",e)}};return e._([e.n({type:Number})],p.prototype,"pages",void 0),e._([e.n({type:Number,attribute:"pageindex"})],p.prototype,"pageIndex",null),e._([e.n({converter:e.J,attribute:"pagenames"})],p.prototype,"pageNames",null),e._([e.n({type:String})],p.prototype,"for",void 0),p=e._([e.e("faceplate-tabpanel")],p),{get F(){return p}}})); SML.di("./C42E8rVVpA.js",import.meta.url,"C42E8rVVpA"); SML.dm("CymmtHTitR",["C42E8rVVpA"],(async a=>{const t={[a.ap.Card]:{get description(){return "Card";}},[a.ap.Compact]:{get description(){return "Compact";}},[a.ap.Classic]:{get description(){return "Compact";}}};var o;return function(a){a.MANUAL="manual",a.AUTOMATIC="automatic"}(o||(o={})),{get B(){return o},C:"/svc/shreddit/:subredditName/community-highlights",F:t,P:"post-deletion-modal",S:"subreddit-mute-modal",a:"subreddit-right-rail__partial"}})); SML.di("./C42E8rVVpA.js",import.meta.url,"C42E8rVVpA");SML.di("./Af-MWsPOE9.js",import.meta.url,"Af-MWsPOE9");SML.di("./P3i_qibcRb.js",import.meta.url,"P3i_qibcRb");SML.di("./GJ95KQEbk4.js",import.meta.url,"GJ95KQEbk4");SML.di("./CsxDAjmHZE.js",import.meta.url,"CsxDAjmHZE");SML.di("./BUnsiaD7oQ.js",import.meta.url,"BUnsiaD7oQ");SML.di("./tn7sgJBOIW.js",import.meta.url,"tn7sgJBOIW");SML.di("./DUzIBJc2in.js",import.meta.url,"DUzIBJc2in");SML.di("./C2rAA4roMn.js",import.meta.url,"C2rAA4roMn");SML.di("./CxBOcTjMlj.js",import.meta.url,"CxBOcTjMlj");SML.di("./CndptGkkPK.js",import.meta.url,"CndptGkkPK");SML.di("./tmkhvHLxT3.js",import.meta.url,"tmkhvHLxT3");SML.di("./BcUlF1uWDA.js",import.meta.url,"BcUlF1uWDA");SML.di("./BnZOm2BOqI.js",import.meta.url,"BnZOm2BOqI");SML.di("./Dg2hMEypTN.js",import.meta.url,"Dg2hMEypTN");SML.di("./5YOkNVVwii.js",import.meta.url,"5YOkNVVwii");SML.di("./CZU1X6W5t6.js",import.meta.url,"CZU1X6W5t6");SML.di("./CMwQRCekeQ.js",import.meta.url,"CMwQRCekeQ");SML.di("./UD2pUVjMzE.js",import.meta.url,"UD2pUVjMzE");SML.di("./s-4Yvb6Bvs.js",import.meta.url,"s-4Yvb6Bvs");SML.di("./OoVe58o1C_.js",import.meta.url,"OoVe58o1C_");SML.di("./49y-lAvwLm.js",import.meta.url,"49y-lAvwLm");SML.di("./CTI0RAQLXe.js",import.meta.url,"CTI0RAQLXe");SML.di("./Da26ZrtZTU.js",import.meta.url,"Da26ZrtZTU");SML.di("./kRpPw7movd.js",import.meta.url,"kRpPw7movd"); SML.dm("D1r4R6mP-Z",["C42E8rVVpA","Af-MWsPOE9","P3i_qibcRb","GJ95KQEbk4","CsxDAjmHZE","BUnsiaD7oQ","DUzIBJc2in","CndptGkkPK","tmkhvHLxT3","BcUlF1uWDA","CMwQRCekeQ","UD2pUVjMzE","Da26ZrtZTU","kRpPw7movd","tn7sgJBOIW","C2rAA4roMn","CxBOcTjMlj","BnZOm2BOqI","Dg2hMEypTN","5YOkNVVwii","CZU1X6W5t6","s-4Yvb6Bvs","OoVe58o1C_","49y-lAvwLm","CTI0RAQLXe"],(async(e,t,i,a,r,s,o,n,l,d,c,u,p,h)=>{var m,f=function(e,t,i,a,r){if("m"===a)throw new TypeError("Private method is not writable");if("a"===a&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===a?r.call(e,i):r?r.value=i:t.set(e,i),i},v=function(e,t,i,a){if("a"===i&&!a)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?a:"a"===i?a.call(e):a?a.value:t.get(e)};class b{constructor(e){m.set(this,void 0),this.host=e,f(this,m,this.onEvent.bind(this),"f"),e.addController(this)}hostConnected(){this.host.addEventListener("devvit-ui-effect",v(this,m,"f"))}hostDisconnected(){this.host.removeEventListener("devvit-ui-effect",v(this,m,"f"))}}function w(e,t){const{windowTop:i,postMessageHostOrigin:a}=e;(i||a)&&i.postMessage(t,a)}function g(e){window.Sentry?.captureMessage?.(e)}m=new WeakMap;function E(e){return `useChannel:${e.replace(/^.+:/,"")}`;}const T=async e=>{try{const t=await fetch("https://gql-realtime.reddit.com/query",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),credentials:"include"});if(!t.ok){const e=await t.text();throw (g(`GQL realtime mutation failed with status ${t.status}: ${e}`), new Error(e))}return t.json()}catch(e){throw (g(`Failed to send realtime event: ${e}`), e)}};var k,_,y,I,N,S,R,D,C,P;class O extends b{constructor(t,i,a){super(t),k.add(this),this._channels=Object.create(null),this._enabled=!1,this._sendListenerAttached=!1,this._connections={},this._channelEventHandlers={},S.set(this,(async t=>{const{channel:i,data:a}=t.detail.event;if(!this._enabled)throw Error("realtime channel not connected");if(!(i in this._channels))throw Error(`realtime ${i} subscription required to send`);try{const t=e.a(this,k,"m",D).call(this,i);globalThis.devvit?.debug.realtime&&console.log(`[realtime] ${t} sends`,a),await(async(e,t)=>{await T({query:"\n mutation publish($input: PublishInput!) {\n publish(input: $input) {\n ok\n }\n }\n ",variables:{input:{channel:{teamOwner:"DEV_PLATFORM",category:"DEV_PLATFORM_APP_EVENTS",tag:e},DevPlatformAppMessageData:{payload:t}}}})})(t,a)}catch(e){g(`[realtime] onSendSock() failed: ${e}`)}})),this._appSlug=i,this._installationId=a,globalThis.devvit?.debug.realtime&&console.debug("[realtime] initialized",{appSlug:this._appSlug,installationId:this._installationId})}hostDisconnected(){super.hostDisconnected(),this.disable();for(const t in this._channels)e.a(this,k,"m",R).call(this,t)}onEvent(t){if(!("realtimeSubscriptions"in t.detail.effect)||!t.detail.effect.realtimeSubscriptions)return;if(t.detail.effect.type!==a.E.EFFECT_REALTIME_SUB)return;if(!this._enabled)throw Error("realtime permission required to un/subscribe");const i=new Set(t.detail.effect.realtimeSubscriptions.subscriptionIds);for(const a of i)this._channels[a]||e.a(this,k,"m",_).call(this,a,t.detail.onEvent);for(const a in this._channels)i.has(a)||e.a(this,k,"m",y).call(this,a,t.detail.onEvent)}enable(){if(!this._enabled){e.a(this,k,"m",C).call(this);for(const t in this._channels)"Disconnected"===this._channels[t]&&e.a(this,k,"m",I).call(this,t);this._enabled=!0}}disable(){if(this._enabled){e.a(this,k,"m",P).call(this);for(const t in this._channels)"Connected"===this._channels[t]&&e.a(this,k,"m",N).call(this,t);this._enabled=!1}}}S=new WeakMap,k=new WeakSet,_=function(t,i){"Connected"!==this._channels[t]&&(this._channelEventHandlers[t]=i,e.a(this,k,"m",I).call(this,t),i?.({scope:a.U.ALL,hook:E(t),realtimeEvent:{event:{channel:t},status:a.R.REALTIME_SUBSCRIBED}}))},y=function(t,i){"Connected"===this._channels[t]&&e.a(this,k,"m",N).call(this,t),"Disconnected"===this._channels[t]&&(i?.({scope:a.U.ALL,hook:E(t),realtimeEvent:{event:{channel:t},status:a.R.REALTIME_UNSUBSCRIBED}}),e.a(this,k,"m",R).call(this,t)),delete this._channelEventHandlers[t],globalThis.devvit?.debug.realtime&&console.debug(`[realtime] ${t} unsubscribed`)},I=function(t){var i;const r=this._channelEventHandlers[t];if(!r)return;const s=e.a(this,k,"m",D).call(this,t);(i=this._connections)[s]??(i[s]=new e.bJ(this.host));this._connections[s].subscribe(((e,t,i)=>({query:{operationName:"SubscribeSubscription",query:"\n subscription SubscribeSubscription($input: SubscribeInput!) {\n subscribe(input: $input) {\n id\n ... on BasicMessage {\n data {\n ... on DevPlatformAppMessageData {\n payload\n }\n }\n }\n }\n }\n ",variables:{input:{channel:{teamOwner:"DEV_PLATFORM",category:"DEV_PLATFORM_APP_EVENTS",tag:e}}}},onData:i=>{i.data&&t?.({hook:E(e),realtimeEvent:{event:{data:i.data.subscribe.data.payload,channel:e}},scope:a.U.LOCAL})},onClose:t=>{t&&(g(`[realtime] connection error for ${e}: ${t}`),i?.(t))},reconnectOnClose:!0}))(s,r,(e=>{this._channels[t]="Disconnected",r?.({scope:a.U.ALL,hook:E(t),realtimeEvent:{event:{channel:t,data:e?{error:String(e)}:void 0},status:a.R.REALTIME_UNSUBSCRIBED}}),this.host.dispatchEvent(a.B("devvit-init-event",{success:!1,failStep:"realtime_subscription_fail",error:e instanceof Error?e.message:String(e)})),globalThis.devvit?.debug.realtime&&console.error(`[realtime] ${s} connection failed:`,e)}))),this._channels[t]="Connected",globalThis.devvit?.debug.realtime&&console.debug(`[realtime] ${s} connected`)},N=function(t){const i=e.a(this,k,"m",D).call(this,t);this._connections[i]?.unsubscribe(),this._channels[t]="Disconnected",globalThis.devvit?.debug.realtime&&console.debug(`[realtime] ${i} disconnected`)},R=function(t){const i=e.a(this,k,"m",D).call(this,t);delete this._connections[i],delete this._channelEventHandlers[t],delete this._channels[t]},D=function(e){return e.startsWith(`${this._appSlug}:${this._installationId}:`)?e:`${this._appSlug}:${this._installationId}:${e}`},C=function(){this._sendListenerAttached||(this.host.addEventListener("devvit-realtime-send",e.a(this,S,"f")),this._sendListenerAttached=!0)},P=function(){this._sendListenerAttached&&(this.host.removeEventListener("devvit-realtime-send",e.a(this,S,"f")),this._sendListenerAttached=!1)};class A extends b{constructor(){super(...arguments),this._activateFeature=e.j,this._appConsentStatusCache={}}onEvent(e){if(!e.detail.effect.canRunAsUser)return;const{appSlug:t,subredditId:i,postId:a}=e.detail.effect.canRunAsUser;if(!a)return;const r=t&&i?`${t}_${i}`:a;this._appConsentStatusCache[r]?e.detail.onEvent({consentStatus:{consentStatus:this._appConsentStatusCache[r]}}):this._showDialog({postId:a,onEvent:t=>{const i=t?.consentStatus?.consentStatus;i!==h.C.GRANTED&&i!==h.C.REVOKED||(this._appConsentStatusCache[r]=i),e.detail.onEvent(t)}})}async _showDialog({postId:t,onEvent:i}){await this._activateFeature({name:e.iP,routeParams:{postId:t},renderMode:e.P.Contents});const a=document.querySelector(`devvit-app-permissions-consent-dialog[post-id="${t}"]`);if(a)a.showModal(),a.onEvent=i;else{const e=document.querySelector(`devvit-app-permissions-consent-error-dialog[post-id="${t}"]`);e&&(e.showModal(),e.onEvent=i)}}}const U=/((25[0-5]|(2[0-4]|1?[0-9])?[0-9])\.){3}(25[0-5]|(2[0-4]|1?[0-9])?[0-9])/,M=/(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]+|::(ffff(:0{1,4})?:)?((25[0-5]|(2[0-4]|1?[0-9])?[0-9])\.){3}(25[0-5]|(2[0-4]|1?[0-9])?[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1?[0-9])?[0-9])\.){3}(25[0-5]|(2[0-4]|1?[0-9])?[0-9]))/,$=new Set(["redditblog.com","i.redd.it","v.redd.it","i.redditmedia.com","g.redditmedia.com","i.reddituploads.com","www.redditinc.com","reddit.onelink.me","www.reddithelp.com","reddit.com","redditinc.com","support.reddithelp.com","redditforcommunity.com"]),L=/^.*\.reddit\.com$/,V=/\.snoo\.dev(:\d+)?$/,x=e=>{try{return $.has(e.host)||(e=>L.test(e))(e.host)||(e=>V.test(e))(e.host)}catch{return!1}};class z extends b{constructor(e){super(e)}setAdsMetadata(e){this._adsMetadata=e}setDialog(e){this._dialog=e}onEvent(e){if(e.detail.effect.type!==a.E.EFFECT_NAVIGATE_TO_URL)return;const{navigateToUrl:t}=e.detail.effect;if(!t)return;const i=function(e){let t;try{t=new URL(e)}catch{return}t.username&&(t.username="");t.password&&(t.password="");if("https:"!==t.protocol)return;if(t.hostname.match(U)||t.hostname.match(M))return;if(t.hostname.startsWith("xn--"))return;return t}(t.url);i&&(e.detail.adsMetadata||this._adsMetadata?window.open(i.href,"_blank","noopener,noreferrer"):x(i)?window.open(i.href,"_self","noopener,noreferrer"):this._dialog?.show(i.toString()))}}var j;let F;!function(e){e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.INLINE_MODE=1]="INLINE_MODE",e[e.IMMERSIVE_MODE=2]="IMMERSIVE_MODE",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"}(j||(j={}));const H=new Uint8Array(16);function W(){if(!F&&(F="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!F))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return F(H)}var G=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;const B=[];for(let e=0;e<256;++e)B.push((e+256).toString(16).slice(1));function J(e,t=0){return(B[e[t+0]]+B[e[t+1]]+B[e[t+2]]+B[e[t+3]]+"-"+B[e[t+4]]+B[e[t+5]]+"-"+B[e[t+6]]+B[e[t+7]]+"-"+B[e[t+8]]+B[e[t+9]]+"-"+B[e[t+10]]+B[e[t+11]]+B[e[t+12]]+B[e[t+13]]+B[e[t+14]]+B[e[t+15]]).toLowerCase()}function Y(e){if(!function(e){return"string"==typeof e&&G.test(e)}(e))throw TypeError("Invalid UUID");let t;const i=new Uint8Array(16);return i[0]=(t=parseInt(e.slice(0,8),16))>>>24,i[1]=t>>>16&255,i[2]=t>>>8&255,i[3]=255&t,i[4]=(t=parseInt(e.slice(9,13),16))>>>8,i[5]=255&t,i[6]=(t=parseInt(e.slice(14,18),16))>>>8,i[7]=255&t,i[8]=(t=parseInt(e.slice(19,23),16))>>>8,i[9]=255&t,i[10]=(t=parseInt(e.slice(24,36),16))/1099511627776&255,i[11]=t/4294967296&255,i[12]=t>>>24&255,i[13]=t>>>16&255,i[14]=t>>>8&255,i[15]=255&t,i}function q(e,t,i){function a(e,a,r,s){var o;if("string"==typeof e&&(e=function(e){e=unescape(encodeURIComponent(e));const t=[];for(let i=0;i>>9<<4)+1}function K(e,t){const i=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(i>>16)<<16|65535&i}function X(e,t,i,a,r,s){return K((o=K(K(t,e),K(a,s)))<<(n=r)|o>>>32-n,i);var o,n}function Q(e,t,i,a,r,s,o){return X(t&i|~t&a,e,t,r,s,o)}function ee(e,t,i,a,r,s,o){return X(t&a|i&~a,e,t,r,s,o)}function te(e,t,i,a,r,s,o){return X(t^i^a,e,t,r,s,o)}function ie(e,t,i,a,r,s,o){return X(i^(t|~a),e,t,r,s,o)}q("v3",48,(function(e){if("string"==typeof e){const t=unescape(encodeURIComponent(e));e=new Uint8Array(t.length);for(let i=0;i>5]>>>r%32&255,s=parseInt(a.charAt(i>>>4&15)+a.charAt(15&i),16);t.push(s)}return t}(function(e,t){e[t>>5]|=128<>5]|=(255&e[a/8])<>>32-t}q("v5",80,(function(e){const t=[1518500249,1859775393,2400959708,3395469782],i=[1732584193,4023233417,2562383102,271733878,3285377520];if("string"==typeof e){const t=unescape(encodeURIComponent(e));e=[];for(let i=0;i>>0;d=l,l=n,n=oe(o,30)>>>0,o=r,r=s}i[0]=i[0]+r>>>0,i[1]=i[1]+o>>>0,i[2]=i[2]+n>>>0,i[3]=i[3]+l>>>0,i[4]=i[4]+d>>>0}return[i[0]>>24&255,i[0]>>16&255,i[0]>>8&255,255&i[0],i[1]>>24&255,i[1]>>16&255,i[1]>>8&255,255&i[1],i[2]>>24&255,i[2]>>16&255,i[2]>>8&255,255&i[2],i[3]>>24&255,i[3]>>16&255,i[3]>>8&255,255&i[3],i[4]>>24&255,i[4]>>16&255,i[4]>>8&255,255&i[4]]}));class ne{constructor(t){this.checkoutCallbacks={},this.finishCheckout=({checkoutAttemptID:e,errorMessage:t,orderID:i,status:a})=>{if(!e)return;const r=this.checkoutCallbacks[e];r?.(a,i,t),delete this.checkoutCallbacks[e]},this.host=t,this.host.addController(this),this.pubsub=new e.m(this.host)}hostConnected(){this.pubsub.subscribe(e.T.PurchaseCheckout,this.finishCheckout,!1)}async beginCheckout(t){if(!e.g())return void this.host.dispatchEvent(e.c(e.dW.purchaseProduct));const i=re();this.checkoutCallbacks[i]=t.onCheckoutFinished,e.p(e.T.PurchaseCheckoutMetadata,{checkoutAttemptID:i,orderMetadata:t.orderMetadata||{}}),await e.j({name:e.iQ,queryParams:{checkoutAttemptId:i,...le(t.productInfo),...t.telemetryContext,...(t.environment && {environment:t.environment})},renderMode:e.P.Contents})}}function le(e){return t.p(e)?{...e,type:t.P.Default}:{[i.H.App]:e.app,[i.H.AppUser]:e.ownerID,[i.H.Version]:e.appVersion,"devvit-sku":e.sku,type:t.P.Devvit}}var de,ce,ue,pe=function(e,t,i,a,r){if("m"===a)throw new TypeError("Private method is not writable");if("a"===a&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===a?r.call(e,i):r?r.value=i:t.set(e,i),i},he=function(e,t,i,a){if("a"===i&&!a)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?a:"a"===i?a.call(e):a?a.value:t.get(e)};class me extends b{constructor(e,t="devvit-form-dialog",i){super(e),de.set(this,void 0),ce.set(this,void 0),ue.set(this,void 0),pe(this,de,t,"f"),pe(this,ce,i,"f")}hostUpdated(){pe(this,ue,this.host.renderRoot.querySelector(he(this,de,"f")),"f")}onEvent(e){const{showForm:t}=e.detail.effect;t?.form&&(he(this,ce,"f")?w(he(this,ce,"f"),{form:t.form,onEvent:e.detail.onEvent,effectName:"devvit:formEffect"}):he(this,ue,"f")?.showForm(t.form,e.detail.onEvent))}}de=new WeakMap,ce=new WeakMap,ue=new WeakMap;var fe,ve=function(e,t,i,a,r){if("m"===a)throw new TypeError("Private method is not writable");if("a"===a&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===a?r.call(e,i):r?r.value=i:t.set(e,i),i},be=function(e,t,i,a){if("a"===i&&!a)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?a:"a"===i?a.call(e):a?a.value:t.get(e)};class we extends b{constructor(e,t){super(e),fe.set(this,void 0),ve(this,fe,t,"f")}onEvent(t){const{showToast:i}=t.detail.effect;if(!i)return;if(!i.toast)return void console.warn("[toast] missing config");const r={message:i.toast.text,level:i.toast.appearance===a.b.SUCCESS?e.X.success:e.X.info};be(this,fe,"f")?w(be(this,fe,"f"),{...r,effectName:"devvit:toastEffect"}):this.host.dispatchEvent(e.c("faceplate-alert",r))}}fe=new WeakMap;var ge,Ee,Te,ke,_e,ye,Ie,Ne,Se,Re,De,Ce,Pe,Oe,Ae=function(e,t,i,a,r){if("m"===a)throw new TypeError("Private method is not writable");if("a"===a&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===a?r.call(e,i):r?r.value=i:t.set(e,i),i},Ue=function(e,t,i,a){if("a"===i&&!a)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?a:"a"===i?a.call(e):a?a.value:t.get(e)};a.i();class Me extends b{constructor(e,t,i){super(e),ge.add(this),this.hookId="",Ee.set(this,void 0),Te.set(this,(()=>{})),ke.set(this,void 0),_e.set(this,void 0),Ie.set(this,(()=>{Ue(this,ge,"m",Se).call(this,!0)})),Ne.set(this,(()=>{Ue(this,ge,"m",Se).call(this,!1)})),this.onReceivedPostMessage=e=>{Ue(this,Te,"f").call(this,{scope:a.U.ALL,hook:this.hookId,webView:{postMessage:{jsonString:JSON.stringify(e),message:e}}})},Re.set(this,(e=>{const t=Ue(this,Ee,"f")?.portalContainer.querySelector("devvit-blocks-web-view");t?.postMessage(e)})),De.set(this,(()=>{this.hookId="",Ae(this,Te,(()=>{}),"f")})),Ae(this,ke,t,"f"),Ae(this,_e,i??Ue(this,ge,"m",ye),"f")}hostUpdated(){Ae(this,Ee,Ue(this,_e,"f").call(this),"f"),Ue(this,Ee,"f")?.addEventListener("rpl-dialog:after-show",Ue(this,Ie,"f")),Ue(this,Ee,"f")?.addEventListener("rpl-dialog:after-hide",Ue(this,Ne,"f"))}hostDisconnected(){super.hostDisconnected(),Ue(this,Ee,"f")&&(Ue(this,Ee,"f").removeEventListener("rpl-dialog:after-show",Ue(this,Ie,"f")),Ue(this,Ee,"f").removeEventListener("rpl-dialog:after-hide",Ue(this,Ne,"f")),Ae(this,Ee,void 0,"f"))}onEvent(e){if("webView"in e.detail.effect)if(devvit?.debug.webView&&console.debug("[web view] WebViewEffectHandler.onEvent()",e.detail),e.detail.effect.webView?.fullscreen){const{fullscreen:t}=e.detail.effect.webView;t.show?(this.hookId=t.id,Ae(this,Te,e.detail.onEvent,"f"),devvit?.debug.webView&&console.debug(`[web view] Open fullscreen web view with url: ${t.url}`),Ue(this,ke,"f").call(this,t.url)):Ue(this,Ee,"f")?.hide()}else e.detail.effect.webView?.postMessage?.app&&this.hookId===e.detail.effect.webView.postMessage.webViewId&&Ue(this,Re,"f").call(this,e.detail.effect.webView.postMessage.app)}}function $e(e){switch(e){case 0:case"ENVIRONMENT_UNSPECIFIED":return Ce.ENVIRONMENT_UNSPECIFIED;case 1:case"ENVIRONMENT_SANDBOX":return Ce.ENVIRONMENT_SANDBOX;case 2:case"ENVIRONMENT_PRODUCTION":return Ce.ENVIRONMENT_PRODUCTION;default:return Ce.UNRECOGNIZED}}function Le(e){switch(e){case Ce.ENVIRONMENT_UNSPECIFIED:return 0;case Ce.ENVIRONMENT_SANDBOX:return 1;case Ce.ENVIRONMENT_PRODUCTION:return 2;case Ce.UNRECOGNIZED:default:return-1}}function Ve(e){switch(e){case 0:case"CURRENCY_UNSPECIFIED":return Pe.CURRENCY_UNSPECIFIED;case 200:case"GOLD":return Pe.GOLD;default:return Pe.UNRECOGNIZED}}function xe(e){switch(e){case 0:case"ACCOUNTING_TYPE_UNSPECIFIED":return Oe.ACCOUNTING_TYPE_UNSPECIFIED;case 1:case"ACCOUNTING_TYPE_INSTANT":return Oe.ACCOUNTING_TYPE_INSTANT;case 2:case"ACCOUNTING_TYPE_DURABLE":return Oe.ACCOUNTING_TYPE_DURABLE;case 3:case"ACCOUNTING_TYPE_CONSUMABLE":return Oe.ACCOUNTING_TYPE_CONSUMABLE;case 4:case"ACCOUNTING_TYPE_VALID_FOR_1D":return Oe.ACCOUNTING_TYPE_VALID_FOR_1D;case 5:case"ACCOUNTING_TYPE_VALID_FOR_7D":return Oe.ACCOUNTING_TYPE_VALID_FOR_7D;case 6:case"ACCOUNTING_TYPE_VALID_FOR_30D":return Oe.ACCOUNTING_TYPE_VALID_FOR_30D;case 7:case"ACCOUNTING_TYPE_VALID_FOR_1Y":return Oe.ACCOUNTING_TYPE_VALID_FOR_1Y;default:return Oe.UNRECOGNIZED}}Ee=new WeakMap,Te=new WeakMap,ke=new WeakMap,_e=new WeakMap,Ie=new WeakMap,Ne=new WeakMap,Re=new WeakMap,De=new WeakMap,ge=new WeakSet,ye=function(){const e=this.host.renderRoot.querySelector("devvit-web-view-dialog-loader");return e?e.shadowRoot?.querySelector("rpl-dialog")??void 0:this.host.renderRoot.querySelector("rpl-dialog")??void 0},Se=function(e){if(devvit?.debug.webView){const t=e?"visible":"hidden";console.debug(`[web view] onDialogVisibilityChange. Trigger event that web view is now ${t}`)}Ue(this,Te,"f").call(this,{scope:a.U.ALL,hook:this.hookId,webView:{fullScreen:{visibility:e?a.W.WEBVIEW_VISIBLE:a.W.WEBVIEW_HIDDEN}}}),e||Ue(this,De,"f").call(this)},function(e){e[e.ENVIRONMENT_UNSPECIFIED=0]="ENVIRONMENT_UNSPECIFIED",e[e.ENVIRONMENT_SANDBOX=1]="ENVIRONMENT_SANDBOX",e[e.ENVIRONMENT_PRODUCTION=2]="ENVIRONMENT_PRODUCTION",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"}(Ce||(Ce={})),function(e){e[e.CURRENCY_UNSPECIFIED=0]="CURRENCY_UNSPECIFIED",e[e.GOLD=200]="GOLD",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"}(Pe||(Pe={})),function(e){e[e.ACCOUNTING_TYPE_UNSPECIFIED=0]="ACCOUNTING_TYPE_UNSPECIFIED",e[e.ACCOUNTING_TYPE_INSTANT=1]="ACCOUNTING_TYPE_INSTANT",e[e.ACCOUNTING_TYPE_DURABLE=2]="ACCOUNTING_TYPE_DURABLE",e[e.ACCOUNTING_TYPE_CONSUMABLE=3]="ACCOUNTING_TYPE_CONSUMABLE",e[e.ACCOUNTING_TYPE_VALID_FOR_1D=4]="ACCOUNTING_TYPE_VALID_FOR_1D",e[e.ACCOUNTING_TYPE_VALID_FOR_7D=5]="ACCOUNTING_TYPE_VALID_FOR_7D",e[e.ACCOUNTING_TYPE_VALID_FOR_30D=6]="ACCOUNTING_TYPE_VALID_FOR_30D",e[e.ACCOUNTING_TYPE_VALID_FOR_1Y=7]="ACCOUNTING_TYPE_VALID_FOR_1Y",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"}(Oe||(Oe={}));const ze={$type:"devvit.payments.v1alpha.Product",encode:(e,t=a._.Writer.create())=>(""!==e.sku&&t.uint32(8010).string(e.sku),""!==e.name&&t.uint32(26).string(e.name),void 0!==e.price&&He.encode(e.price,t.uint32(42).fork()).ldelim(),0!==e.environment&&t.uint32(160).int32(e.environment),""!==e.description&&t.uint32(170).string(e.description),0!==e.accountingType&&t.uint32(184).int32(e.accountingType),Object.entries(e.productMetadata).forEach((([e,i])=>{je.encode({key:e,value:i},t.uint32(8018).fork()).ldelim()})),Object.entries(e.images).forEach((([e,i])=>{Fe.encode({key:e,value:i},t.uint32(8026).fork()).ldelim()})),t),decode(e,t){const i=e instanceof a._.Reader?e:a._.Reader.create(e);let r=void 0===t?i.len:i.pos+t;const s={sku:"",name:"",price:void 0,environment:0,description:"",accountingType:0,productMetadata:{},images:{}};for(;i.pos>>3){case 1001:if(8010!==e)break;s.sku=i.string();continue;case 3:if(26!==e)break;s.name=i.string();continue;case 5:if(42!==e)break;s.price=He.decode(i,i.uint32());continue;case 20:if(160!==e)break;s.environment=i.int32();continue;case 21:if(170!==e)break;s.description=i.string();continue;case 23:if(184!==e)break;s.accountingType=i.int32();continue;case 1002:if(8018!==e)break;const t=je.decode(i,i.uint32());void 0!==t.value&&(s.productMetadata[t.key]=t.value);continue;case 1003:if(8026!==e)break;const a=Fe.decode(i,i.uint32());void 0!==a.value&&(s.images[a.key]=a.value);continue}if(4==(7&e)||0===e)break;i.skipType(7&e)}return s},fromJSON:e=>({sku:Ge(e.sku)?globalThis.String(e.sku):"",name:Ge(e.name)?globalThis.String(e.name):"",price:Ge(e.price)?He.fromJSON(e.price):void 0,environment:Ge(e.environment)?$e(e.environment):0,description:Ge(e.description)?globalThis.String(e.description):"",accountingType:Ge(e.accountingType)?xe(e.accountingType):0,productMetadata:We(e.productMetadata)?Object.entries(e.productMetadata).reduce(((e,[t,i])=>(e[t]=String(i),e)),{}):{},images:We(e.images)?Object.entries(e.images).reduce(((e,[t,i])=>(e[t]=String(i),e)),{}):{}}),toJSON(e){const t={};if(""!==e.sku&&(t.sku=e.sku),""!==e.name&&(t.name=e.name),void 0!==e.price&&(t.price=He.toJSON(e.price)),0!==e.environment&&(t.environment=Le(e.environment)),""!==e.description&&(t.description=e.description),0!==e.accountingType&&(t.accountingType=function(e){switch(e){case Oe.ACCOUNTING_TYPE_UNSPECIFIED:return 0;case Oe.ACCOUNTING_TYPE_INSTANT:return 1;case Oe.ACCOUNTING_TYPE_DURABLE:return 2;case Oe.ACCOUNTING_TYPE_CONSUMABLE:return 3;case Oe.ACCOUNTING_TYPE_VALID_FOR_1D:return 4;case Oe.ACCOUNTING_TYPE_VALID_FOR_7D:return 5;case Oe.ACCOUNTING_TYPE_VALID_FOR_30D:return 6;case Oe.ACCOUNTING_TYPE_VALID_FOR_1Y:return 7;case Oe.UNRECOGNIZED:default:return-1}}(e.accountingType)),e.productMetadata){const i=Object.entries(e.productMetadata);i.length>0&&(t.productMetadata={},i.forEach((([e,i])=>{t.productMetadata[e]=i})))}if(e.images){const i=Object.entries(e.images);i.length>0&&(t.images={},i.forEach((([e,i])=>{t.images[e]=i})))}return t},create:e=>ze.fromPartial(e??{}),fromPartial(e){const t={sku:"",name:"",price:void 0,environment:0,description:"",accountingType:0,productMetadata:{},images:{}};return t.sku=e.sku??"",t.name=e.name??"",t.price=void 0!==e.price&&null!==e.price?He.fromPartial(e.price):void 0,t.environment=e.environment??0,t.description=e.description??"",t.accountingType=e.accountingType??0,t.productMetadata=Object.entries(e.productMetadata??{}).reduce(((e,[t,i])=>(void 0!==i&&(e[t]=globalThis.String(i)),e)),{}),t.images=Object.entries(e.images??{}).reduce(((e,[t,i])=>(void 0!==i&&(e[t]=globalThis.String(i)),e)),{}),t}};a.m.set(ze.$type,ze);const je={$type:"devvit.payments.v1alpha.Product.ProductMetadataEntry",encode:(e,t=a._.Writer.create())=>(""!==e.key&&t.uint32(10).string(e.key),""!==e.value&&t.uint32(18).string(e.value),t),decode(e,t){const i=e instanceof a._.Reader?e:a._.Reader.create(e);let r=void 0===t?i.len:i.pos+t;const s={key:"",value:""};for(;i.pos>>3){case 1:if(10!==e)break;s.key=i.string();continue;case 2:if(18!==e)break;s.value=i.string();continue}if(4==(7&e)||0===e)break;i.skipType(7&e)}return s},fromJSON:e=>({key:Ge(e.key)?globalThis.String(e.key):"",value:Ge(e.value)?globalThis.String(e.value):""}),toJSON(e){const t={};return""!==e.key&&(t.key=e.key),""!==e.value&&(t.value=e.value),t},create:e=>je.fromPartial(e??{}),fromPartial(e){const t={key:"",value:""};return t.key=e.key??"",t.value=e.value??"",t}};a.m.set(je.$type,je);const Fe={$type:"devvit.payments.v1alpha.Product.ImagesEntry",encode:(e,t=a._.Writer.create())=>(""!==e.key&&t.uint32(10).string(e.key),""!==e.value&&t.uint32(18).string(e.value),t),decode(e,t){const i=e instanceof a._.Reader?e:a._.Reader.create(e);let r=void 0===t?i.len:i.pos+t;const s={key:"",value:""};for(;i.pos>>3){case 1:if(10!==e)break;s.key=i.string();continue;case 2:if(18!==e)break;s.value=i.string();continue}if(4==(7&e)||0===e)break;i.skipType(7&e)}return s},fromJSON:e=>({key:Ge(e.key)?globalThis.String(e.key):"",value:Ge(e.value)?globalThis.String(e.value):""}),toJSON(e){const t={};return""!==e.key&&(t.key=e.key),""!==e.value&&(t.value=e.value),t},create:e=>Fe.fromPartial(e??{}),fromPartial(e){const t={key:"",value:""};return t.key=e.key??"",t.value=e.value??"",t}};a.m.set(Fe.$type,Fe);const He={$type:"devvit.payments.v1alpha.ProductPrice",encode:(e,t=a._.Writer.create())=>(0!==e.amount&&t.uint32(8).int32(e.amount),0!==e.currency&&t.uint32(16).int32(e.currency),t),decode(e,t){const i=e instanceof a._.Reader?e:a._.Reader.create(e);let r=void 0===t?i.len:i.pos+t;const s={amount:0,currency:0};for(;i.pos>>3){case 1:if(8!==e)break;s.amount=i.int32();continue;case 2:if(16!==e)break;s.currency=i.int32();continue}if(4==(7&e)||0===e)break;i.skipType(7&e)}return s},fromJSON:e=>({amount:Ge(e.amount)?globalThis.Number(e.amount):0,currency:Ge(e.currency)?Ve(e.currency):0}),toJSON(e){const t={};return 0!==e.amount&&(t.amount=Math.round(e.amount)),0!==e.currency&&(t.currency=function(e){switch(e){case Pe.CURRENCY_UNSPECIFIED:return 0;case Pe.GOLD:return 200;case Pe.UNRECOGNIZED:default:return-1}}(e.currency)),t},create:e=>He.fromPartial(e??{}),fromPartial(e){const t={amount:0,currency:0};return t.amount=e.amount??0,t.currency=e.currency??0,t}};function We(e){return"object"==typeof e&&null!==e}function Ge(e){return null!=e}var Be;function Je(e){switch(e){case 0:case"ORDER_STATUS_UNSPECIFIED":return Be.ORDER_STATUS_UNSPECIFIED;case 1:case"ORDER_STATUS_NEW":return Be.ORDER_STATUS_NEW;case 2:case"ORDER_STATUS_CREATED":return Be.ORDER_STATUS_CREATED;case 3:case"ORDER_STATUS_PAID":return Be.ORDER_STATUS_PAID;case 4:case"ORDER_STATUS_DELIVERED":return Be.ORDER_STATUS_DELIVERED;case 5:case"ORDER_STATUS_CANCELED":return Be.ORDER_STATUS_CANCELED;case 6:case"ORDER_STATUS_REVERTED":return Be.ORDER_STATUS_REVERTED;default:return Be.UNRECOGNIZED}}function Ye(e){switch(e){case Be.ORDER_STATUS_UNSPECIFIED:return 0;case Be.ORDER_STATUS_NEW:return 1;case Be.ORDER_STATUS_CREATED:return 2;case Be.ORDER_STATUS_PAID:return 3;case Be.ORDER_STATUS_DELIVERED:return 4;case Be.ORDER_STATUS_CANCELED:return 5;case Be.ORDER_STATUS_REVERTED:return 6;case Be.UNRECOGNIZED:default:return-1}}a.m.set(He.$type,He),function(e){e[e.ORDER_STATUS_UNSPECIFIED=0]="ORDER_STATUS_UNSPECIFIED",e[e.ORDER_STATUS_NEW=1]="ORDER_STATUS_NEW",e[e.ORDER_STATUS_CREATED=2]="ORDER_STATUS_CREATED",e[e.ORDER_STATUS_PAID=3]="ORDER_STATUS_PAID",e[e.ORDER_STATUS_DELIVERED=4]="ORDER_STATUS_DELIVERED",e[e.ORDER_STATUS_CANCELED=5]="ORDER_STATUS_CANCELED",e[e.ORDER_STATUS_REVERTED=6]="ORDER_STATUS_REVERTED",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"}(Be||(Be={}));const qe={$type:"devvit.payments.v1alpha.Order",encode(e,t=a._.Writer.create()){""!==e.id&&t.uint32(10).string(e.id),0!==e.status&&t.uint32(16).int32(e.status),void 0!==e.createdAt&&a.T.encode(Ke(e.createdAt),t.uint32(26).fork()).ldelim(),void 0!==e.updatedAt&&a.T.encode(Ke(e.updatedAt),t.uint32(34).fork()).ldelim();for(const i of e.products)ze.encode(i,t.uint32(42).fork()).ldelim();return 0!==e.environment&&t.uint32(64).int32(e.environment),Object.entries(e.metadata).forEach((([e,i])=>{Ze.encode({key:e,value:i},t.uint32(8010).fork()).ldelim()})),t},decode(e,t){const i=e instanceof a._.Reader?e:a._.Reader.create(e);let r=void 0===t?i.len:i.pos+t;const s={id:"",status:0,createdAt:void 0,updatedAt:void 0,products:[],environment:0,metadata:{}};for(;i.pos>>3){case 1:if(10!==e)break;s.id=i.string();continue;case 2:if(16!==e)break;s.status=i.int32();continue;case 3:if(26!==e)break;s.createdAt=Xe(a.T.decode(i,i.uint32()));continue;case 4:if(34!==e)break;s.updatedAt=Xe(a.T.decode(i,i.uint32()));continue;case 5:if(42!==e)break;s.products.push(ze.decode(i,i.uint32()));continue;case 8:if(64!==e)break;s.environment=i.int32();continue;case 1001:if(8010!==e)break;const t=Ze.decode(i,i.uint32());void 0!==t.value&&(s.metadata[t.key]=t.value);continue}if(4==(7&e)||0===e)break;i.skipType(7&e)}return s},fromJSON(e){return{id:et(e.id)?globalThis.String(e.id):"",status:et(e.status)?Je(e.status):0,createdAt:et(e.createdAt)?Qe(e.createdAt):void 0,updatedAt:et(e.updatedAt)?Qe(e.updatedAt):void 0,products:globalThis.Array.isArray(e?.products)?e.products.map((e=>ze.fromJSON(e))):[],environment:et(e.environment)?$e(e.environment):0,metadata:(t=e.metadata,"object"==typeof t&&null!==t?Object.entries(e.metadata).reduce(((e,[t,i])=>(e[t]=String(i),e)),{}):{})};var t},toJSON(e){const t={};if(""!==e.id&&(t.id=e.id),0!==e.status&&(t.status=Ye(e.status)),void 0!==e.createdAt&&(t.createdAt=e.createdAt.toISOString()),void 0!==e.updatedAt&&(t.updatedAt=e.updatedAt.toISOString()),e.products?.length&&(t.products=e.products.map((e=>ze.toJSON(e)))),0!==e.environment&&(t.environment=Le(e.environment)),e.metadata){const i=Object.entries(e.metadata);i.length>0&&(t.metadata={},i.forEach((([e,i])=>{t.metadata[e]=i})))}return t},create:e=>qe.fromPartial(e??{}),fromPartial(e){const t={id:"",status:0,createdAt:void 0,updatedAt:void 0,products:[],environment:0,metadata:{}};return t.id=e.id??"",t.status=e.status??0,t.createdAt=e.createdAt??void 0,t.updatedAt=e.updatedAt??void 0,t.products=e.products?.map((e=>ze.fromPartial(e)))||[],t.environment=e.environment??0,t.metadata=Object.entries(e.metadata??{}).reduce(((e,[t,i])=>(void 0!==i&&(e[t]=globalThis.String(i)),e)),{}),t}};a.m.set(qe.$type,qe);const Ze={$type:"devvit.payments.v1alpha.Order.MetadataEntry",encode:(e,t=a._.Writer.create())=>(""!==e.key&&t.uint32(10).string(e.key),""!==e.value&&t.uint32(18).string(e.value),t),decode(e,t){const i=e instanceof a._.Reader?e:a._.Reader.create(e);let r=void 0===t?i.len:i.pos+t;const s={key:"",value:""};for(;i.pos>>3){case 1:if(10!==e)break;s.key=i.string();continue;case 2:if(18!==e)break;s.value=i.string();continue}if(4==(7&e)||0===e)break;i.skipType(7&e)}return s},fromJSON:e=>({key:et(e.key)?globalThis.String(e.key):"",value:et(e.value)?globalThis.String(e.value):""}),toJSON(e){const t={};return""!==e.key&&(t.key=e.key),""!==e.value&&(t.value=e.value),t},create:e=>Ze.fromPartial(e??{}),fromPartial(e){const t={key:"",value:""};return t.key=e.key??"",t.value=e.value??"",t}};function Ke(e){return{seconds:Math.trunc(e.getTime()/1e3),nanos:e.getTime()%1e3*1e6}}function Xe(e){let t=1e3*(e.seconds||0);return t+=(e.nanos||0)/1e6,new globalThis.Date(t)}function Qe(e){return e instanceof globalThis.Date?e:"string"==typeof e?new globalThis.Date(e):Xe(a.T.fromJSON(e))}function et(e){return null!=e}a.m.set(Ze.$type,Ze);const tt={$type:"devvit.actor.payments.v1alpha.FulfillOrderRequest",encode:(e,t=a._.Writer.create())=>(void 0!==e.order&&qe.encode(e.order,t.uint32(10).fork()).ldelim(),t),decode(e,t){const i=e instanceof a._.Reader?e:a._.Reader.create(e);let r=void 0===t?i.len:i.pos+t;const s={order:void 0};for(;i.pos>>3){case 1:if(10!==e)break;s.order=qe.decode(i,i.uint32());continue}if(4==(7&e)||0===e)break;i.skipType(7&e)}return s},fromJSON:e=>({order:st(e.order)?qe.fromJSON(e.order):void 0}),toJSON(e){const t={};return void 0!==e.order&&(t.order=qe.toJSON(e.order)),t},create:e=>tt.fromPartial(e??{}),fromPartial(e){const t={order:void 0};return t.order=void 0!==e.order&&null!==e.order?qe.fromPartial(e.order):void 0,t}};a.m.set(tt.$type,tt);const it={$type:"devvit.actor.payments.v1alpha.RefundOrderRequest",encode:(e,t=a._.Writer.create())=>(void 0!==e.order&&qe.encode(e.order,t.uint32(10).fork()).ldelim(),t),decode(e,t){const i=e instanceof a._.Reader?e:a._.Reader.create(e);let r=void 0===t?i.len:i.pos+t;const s={order:void 0};for(;i.pos>>3){case 1:if(10!==e)break;s.order=qe.decode(i,i.uint32());continue}if(4==(7&e)||0===e)break;i.skipType(7&e)}return s},fromJSON:e=>({order:st(e.order)?qe.fromJSON(e.order):void 0}),toJSON(e){const t={};return void 0!==e.order&&(t.order=qe.toJSON(e.order)),t},create:e=>it.fromPartial(e??{}),fromPartial(e){const t={order:void 0};return t.order=void 0!==e.order&&null!==e.order?qe.fromPartial(e.order):void 0,t}};a.m.set(it.$type,it);const at={$type:"devvit.actor.payments.v1alpha.FulfillOrderResponse",encode:(e,t=a._.Writer.create())=>(void 0!==e.acknowledged&&t.uint32(8).bool(e.acknowledged),void 0!==e.rejectionReason&&t.uint32(18).string(e.rejectionReason),t),decode(e,t){const i=e instanceof a._.Reader?e:a._.Reader.create(e);let r=void 0===t?i.len:i.pos+t;const s={acknowledged:void 0,rejectionReason:void 0};for(;i.pos>>3){case 1:if(8!==e)break;s.acknowledged=i.bool();continue;case 2:if(18!==e)break;s.rejectionReason=i.string();continue}if(4==(7&e)||0===e)break;i.skipType(7&e)}return s},fromJSON:e=>({acknowledged:st(e.acknowledged)?globalThis.Boolean(e.acknowledged):void 0,rejectionReason:st(e.rejectionReason)?globalThis.String(e.rejectionReason):void 0}),toJSON(e){const t={};return void 0!==e.acknowledged&&(t.acknowledged=e.acknowledged),void 0!==e.rejectionReason&&(t.rejectionReason=e.rejectionReason),t},create:e=>at.fromPartial(e??{}),fromPartial(e){const t={acknowledged:void 0,rejectionReason:void 0};return t.acknowledged=e.acknowledged??void 0,t.rejectionReason=e.rejectionReason??void 0,t}};a.m.set(at.$type,at);const rt={$type:"devvit.actor.payments.v1alpha.RefundOrderResponse",encode:(e,t=a._.Writer.create())=>t,decode(e,t){const i=e instanceof a._.Reader?e:a._.Reader.create(e);let r=void 0===t?i.len:i.pos+t;const s={};for(;i.pos({}),toJSON:e=>({}),create:e=>rt.fromPartial(e??{}),fromPartial:e=>({})};function st(e){return null!=e}a.m.set(rt.$type,rt);const ot={$type:"devvit.plugin.payments.v1alpha.GetProductsRequest",encode(e,t=a._.Writer.create()){for(const i of e.skus)t.uint32(10).string(i);return Object.entries(e.metadata).forEach((([e,i])=>{nt.encode({key:e,value:i},t.uint32(18).fork()).ldelim()})),t},decode(e,t){const i=e instanceof a._.Reader?e:a._.Reader.create(e);let r=void 0===t?i.len:i.pos+t;const s={skus:[],metadata:{}};for(;i.pos>>3){case 1:if(10!==e)break;s.skus.push(i.string());continue;case 2:if(18!==e)break;const t=nt.decode(i,i.uint32());void 0!==t.value&&(s.metadata[t.key]=t.value);continue}if(4==(7&e)||0===e)break;i.skipType(7&e)}return s},fromJSON:e=>({skus:globalThis.Array.isArray(e?.skus)?e.skus.map((e=>globalThis.String(e))):[],metadata:wt(e.metadata)?Object.entries(e.metadata).reduce(((e,[t,i])=>(e[t]=String(i),e)),{}):{}}),toJSON(e){const t={};if(e.skus?.length&&(t.skus=e.skus),e.metadata){const i=Object.entries(e.metadata);i.length>0&&(t.metadata={},i.forEach((([e,i])=>{t.metadata[e]=i})))}return t},create:e=>ot.fromPartial(e??{}),fromPartial(e){const t={skus:[],metadata:{}};return t.skus=e.skus?.map((e=>e))||[],t.metadata=Object.entries(e.metadata??{}).reduce(((e,[t,i])=>(void 0!==i&&(e[t]=globalThis.String(i)),e)),{}),t}};a.m.set(ot.$type,ot);const nt={$type:"devvit.plugin.payments.v1alpha.GetProductsRequest.MetadataEntry",encode:(e,t=a._.Writer.create())=>(""!==e.key&&t.uint32(10).string(e.key),""!==e.value&&t.uint32(18).string(e.value),t),decode(e,t){const i=e instanceof a._.Reader?e:a._.Reader.create(e);let r=void 0===t?i.len:i.pos+t;const s={key:"",value:""};for(;i.pos>>3){case 1:if(10!==e)break;s.key=i.string();continue;case 2:if(18!==e)break;s.value=i.string();continue}if(4==(7&e)||0===e)break;i.skipType(7&e)}return s},fromJSON:e=>({key:gt(e.key)?globalThis.String(e.key):"",value:gt(e.value)?globalThis.String(e.value):""}),toJSON(e){const t={};return""!==e.key&&(t.key=e.key),""!==e.value&&(t.value=e.value),t},create:e=>nt.fromPartial(e??{}),fromPartial(e){const t={key:"",value:""};return t.key=e.key??"",t.value=e.value??"",t}};a.m.set(nt.$type,nt);const lt={$type:"devvit.plugin.payments.v1alpha.GetProductsResponse",encode(e,t=a._.Writer.create()){for(const i of e.products)ze.encode(i,t.uint32(10).fork()).ldelim();return t},decode(e,t){const i=e instanceof a._.Reader?e:a._.Reader.create(e);let r=void 0===t?i.len:i.pos+t;const s={products:[]};for(;i.pos>>3){case 1:if(10!==e)break;s.products.push(ze.decode(i,i.uint32()));continue}if(4==(7&e)||0===e)break;i.skipType(7&e)}return s},fromJSON:e=>({products:globalThis.Array.isArray(e?.products)?e.products.map((e=>ze.fromJSON(e))):[]}),toJSON(e){const t={};return e.products?.length&&(t.products=e.products.map((e=>ze.toJSON(e)))),t},create:e=>lt.fromPartial(e??{}),fromPartial(e){const t={products:[]};return t.products=e.products?.map((e=>ze.fromPartial(e)))||[],t}};a.m.set(lt.$type,lt);const dt={$type:"devvit.plugin.payments.v1alpha.GetOrdersRequest",encode:(e,t=a._.Writer.create())=>(void 0!==e.start&&a.T.encode(ft(e.start),t.uint32(10).fork()).ldelim(),void 0!==e.end&&a.T.encode(ft(e.end),t.uint32(18).fork()).ldelim(),0!==e.limit&&t.uint32(24).int32(e.limit),""!==e.sku&&t.uint32(34).string(e.sku),""!==e.buyer&&t.uint32(42).string(e.buyer),0!==e.status&&t.uint32(48).int32(e.status),Object.entries(e.metadata).forEach((([e,i])=>{ct.encode({key:e,value:i},t.uint32(58).fork()).ldelim()})),""!==e.cursor&&t.uint32(66).string(e.cursor),t),decode(e,t){const i=e instanceof a._.Reader?e:a._.Reader.create(e);let r=void 0===t?i.len:i.pos+t;const s={start:void 0,end:void 0,limit:0,sku:"",buyer:"",status:0,metadata:{},cursor:""};for(;i.pos>>3){case 1:if(10!==e)break;s.start=vt(a.T.decode(i,i.uint32()));continue;case 2:if(18!==e)break;s.end=vt(a.T.decode(i,i.uint32()));continue;case 3:if(24!==e)break;s.limit=i.int32();continue;case 4:if(34!==e)break;s.sku=i.string();continue;case 5:if(42!==e)break;s.buyer=i.string();continue;case 6:if(48!==e)break;s.status=i.int32();continue;case 7:if(58!==e)break;const t=ct.decode(i,i.uint32());void 0!==t.value&&(s.metadata[t.key]=t.value);continue;case 8:if(66!==e)break;s.cursor=i.string();continue}if(4==(7&e)||0===e)break;i.skipType(7&e)}return s},fromJSON:e=>({start:gt(e.start)?bt(e.start):void 0,end:gt(e.end)?bt(e.end):void 0,limit:gt(e.limit)?globalThis.Number(e.limit):0,sku:gt(e.sku)?globalThis.String(e.sku):"",buyer:gt(e.buyer)?globalThis.String(e.buyer):"",status:gt(e.status)?Je(e.status):0,metadata:wt(e.metadata)?Object.entries(e.metadata).reduce(((e,[t,i])=>(e[t]=String(i),e)),{}):{},cursor:gt(e.cursor)?globalThis.String(e.cursor):""}),toJSON(e){const t={};if(void 0!==e.start&&(t.start=e.start.toISOString()),void 0!==e.end&&(t.end=e.end.toISOString()),0!==e.limit&&(t.limit=Math.round(e.limit)),""!==e.sku&&(t.sku=e.sku),""!==e.buyer&&(t.buyer=e.buyer),0!==e.status&&(t.status=Ye(e.status)),e.metadata){const i=Object.entries(e.metadata);i.length>0&&(t.metadata={},i.forEach((([e,i])=>{t.metadata[e]=i})))}return""!==e.cursor&&(t.cursor=e.cursor),t},create:e=>dt.fromPartial(e??{}),fromPartial(e){const t={start:void 0,end:void 0,limit:0,sku:"",buyer:"",status:0,metadata:{},cursor:""};return t.start=e.start??void 0,t.end=e.end??void 0,t.limit=e.limit??0,t.sku=e.sku??"",t.buyer=e.buyer??"",t.status=e.status??0,t.metadata=Object.entries(e.metadata??{}).reduce(((e,[t,i])=>(void 0!==i&&(e[t]=globalThis.String(i)),e)),{}),t.cursor=e.cursor??"",t}};a.m.set(dt.$type,dt);const ct={$type:"devvit.plugin.payments.v1alpha.GetOrdersRequest.MetadataEntry",encode:(e,t=a._.Writer.create())=>(""!==e.key&&t.uint32(10).string(e.key),""!==e.value&&t.uint32(18).string(e.value),t),decode(e,t){const i=e instanceof a._.Reader?e:a._.Reader.create(e);let r=void 0===t?i.len:i.pos+t;const s={key:"",value:""};for(;i.pos>>3){case 1:if(10!==e)break;s.key=i.string();continue;case 2:if(18!==e)break;s.value=i.string();continue}if(4==(7&e)||0===e)break;i.skipType(7&e)}return s},fromJSON:e=>({key:gt(e.key)?globalThis.String(e.key):"",value:gt(e.value)?globalThis.String(e.value):""}),toJSON(e){const t={};return""!==e.key&&(t.key=e.key),""!==e.value&&(t.value=e.value),t},create:e=>ct.fromPartial(e??{}),fromPartial(e){const t={key:"",value:""};return t.key=e.key??"",t.value=e.value??"",t}};a.m.set(ct.$type,ct);const ut={$type:"devvit.plugin.payments.v1alpha.PageInfo",encode:(e,t=a._.Writer.create())=>(!1!==e.hasNextPage&&t.uint32(8).bool(e.hasNextPage),""!==e.endCursor&&t.uint32(18).string(e.endCursor),!1!==e.hasPreviousPage&&t.uint32(24).bool(e.hasPreviousPage),""!==e.startCursor&&t.uint32(34).string(e.startCursor),t),decode(e,t){const i=e instanceof a._.Reader?e:a._.Reader.create(e);let r=void 0===t?i.len:i.pos+t;const s={hasNextPage:!1,endCursor:"",hasPreviousPage:!1,startCursor:""};for(;i.pos>>3){case 1:if(8!==e)break;s.hasNextPage=i.bool();continue;case 2:if(18!==e)break;s.endCursor=i.string();continue;case 3:if(24!==e)break;s.hasPreviousPage=i.bool();continue;case 4:if(34!==e)break;s.startCursor=i.string();continue}if(4==(7&e)||0===e)break;i.skipType(7&e)}return s},fromJSON:e=>({hasNextPage:!!gt(e.hasNextPage)&&globalThis.Boolean(e.hasNextPage),endCursor:gt(e.endCursor)?globalThis.String(e.endCursor):"",hasPreviousPage:!!gt(e.hasPreviousPage)&&globalThis.Boolean(e.hasPreviousPage),startCursor:gt(e.startCursor)?globalThis.String(e.startCursor):""}),toJSON(e){const t={};return!1!==e.hasNextPage&&(t.hasNextPage=e.hasNextPage),""!==e.endCursor&&(t.endCursor=e.endCursor),!1!==e.hasPreviousPage&&(t.hasPreviousPage=e.hasPreviousPage),""!==e.startCursor&&(t.startCursor=e.startCursor),t},create:e=>ut.fromPartial(e??{}),fromPartial(e){const t={hasNextPage:!1,endCursor:"",hasPreviousPage:!1,startCursor:""};return t.hasNextPage=e.hasNextPage??!1,t.endCursor=e.endCursor??"",t.hasPreviousPage=e.hasPreviousPage??!1,t.startCursor=e.startCursor??"",t}};a.m.set(ut.$type,ut);const pt={$type:"devvit.plugin.payments.v1alpha.GetOrdersResponse",encode(e,t=a._.Writer.create()){for(const i of e.orders)qe.encode(i,t.uint32(10).fork()).ldelim();return void 0!==e.pageInfo&&ut.encode(e.pageInfo,t.uint32(18).fork()).ldelim(),t},decode(e,t){const i=e instanceof a._.Reader?e:a._.Reader.create(e);let r=void 0===t?i.len:i.pos+t;const s={orders:[],pageInfo:void 0};for(;i.pos>>3){case 1:if(10!==e)break;s.orders.push(qe.decode(i,i.uint32()));continue;case 2:if(18!==e)break;s.pageInfo=ut.decode(i,i.uint32());continue}if(4==(7&e)||0===e)break;i.skipType(7&e)}return s},fromJSON:e=>({orders:globalThis.Array.isArray(e?.orders)?e.orders.map((e=>qe.fromJSON(e))):[],pageInfo:gt(e.pageInfo)?ut.fromJSON(e.pageInfo):void 0}),toJSON(e){const t={};return e.orders?.length&&(t.orders=e.orders.map((e=>qe.toJSON(e)))),void 0!==e.pageInfo&&(t.pageInfo=ut.toJSON(e.pageInfo)),t},create:e=>pt.fromPartial(e??{}),fromPartial(e){const t={orders:[],pageInfo:void 0};return t.orders=e.orders?.map((e=>qe.fromPartial(e)))||[],t.pageInfo=void 0!==e.pageInfo&&null!==e.pageInfo?ut.fromPartial(e.pageInfo):void 0,t}};a.m.set(pt.$type,pt);const ht={$type:"devvit.plugin.payments.v1alpha.AcknowledgeOrderDeliveryRequest",encode:(e,t=a._.Writer.create())=>(""!==e.orderId&&t.uint32(10).string(e.orderId),t),decode(e,t){const i=e instanceof a._.Reader?e:a._.Reader.create(e);let r=void 0===t?i.len:i.pos+t;const s={orderId:""};for(;i.pos>>3){case 1:if(10!==e)break;s.orderId=i.string();continue}if(4==(7&e)||0===e)break;i.skipType(7&e)}return s},fromJSON:e=>({orderId:gt(e.orderId)?globalThis.String(e.orderId):""}),toJSON(e){const t={};return""!==e.orderId&&(t.orderId=e.orderId),t},create:e=>ht.fromPartial(e??{}),fromPartial(e){const t={orderId:""};return t.orderId=e.orderId??"",t}};a.m.set(ht.$type,ht);const mt={$type:"devvit.plugin.payments.v1alpha.AcknowledgeOrderDeliveryResponse",encode:(e,t=a._.Writer.create())=>t,decode(e,t){const i=e instanceof a._.Reader?e:a._.Reader.create(e);let r=void 0===t?i.len:i.pos+t;const s={};for(;i.pos({}),toJSON:e=>({}),create:e=>mt.fromPartial(e??{}),fromPartial:e=>({})};function ft(e){return{seconds:Math.trunc(e.getTime()/1e3),nanos:e.getTime()%1e3*1e6}}function vt(e){let t=1e3*(e.seconds||0);return t+=(e.nanos||0)/1e6,new globalThis.Date(t)}function bt(e){return e instanceof globalThis.Date?e:"string"==typeof e?new globalThis.Date(e):vt(a.T.fromJSON(e))}function wt(e){return"object"==typeof e&&null!==e}function gt(e){return null!=e}a.m.set(mt.$type,mt);class Et extends b{constructor(){super(...arguments),this.metadataKeys=[i.H.App,i.H.AppUser,i.H.Version]}onEvent(e){const{createOrder:t}=e.detail.effect;if(!t)return;if(0===t.skus.length)return void console.warn("[handler] missing products");const r=t.metadata||{},s=e.detail.metadata?.[i.H.Installation]?.values?.[0];if(!s)return void console.warn("[handler] missing installation ID");if(r[i.H.Installation]=s,devvit?.debug.payments){const e=JSON.stringify(t.skus),i=JSON.stringify(t.metadata);console.debug(`[handler] launching order flow for: ${e} (metadata: ${i})`)}const o={};this.metadataKeys.forEach((t=>{const i=e.detail.metadata?.[t]?.values?.[0];i&&(o[t]=i)})),this.onOrder(t.skus,r,o,((i,r,s,o)=>{e.detail.onEvent({scope:a.U.ALL,orderResult:{status:i,orderId:r,errorCode:s,errorMessage:o,order:t},hook:t.id})}))}}class Tt extends Et{constructor(e,t){super(e),this.metadataKeys=[i.H.App,i.H.AppUser,i.H.Version,i.H.Subreddit,i.H.Post,i.H.User,i.H.Installation],this.purchaseController=t}onOrder(e,r,s,o){this.purchaseController.beginCheckout({onCheckoutFinished:(e,i,r)=>{o(function(e){switch(e){case t.C.Succeeded:return a.O.STATUS_SUCCESS;case t.C.Error:return a.O.STATUS_ERROR;case t.C.Cancelled:return a.O.STATUS_CANCELLED}}(e),i||"",void 0,r)},orderMetadata:r,productInfo:{sku:e[0],app:s[i.H.App],appVersion:s[i.H.Version],ownerID:s[i.H.AppUser]},telemetryContext:{[i.H.Installation]:s[i.H.Installation],postId:s[i.H.Post],subredditId:s[i.H.Subreddit],userId:s[i.H.User]}})}}const kt=e=>{if("image/webp"===e)return".jpeg";const t=e?e.split("/"):"image/jpg";return t.length>1?`.${t[1]}`:".jpg"};async function _t(t,i){return async function(t,i,a,r){const s="There was an error uploading the file";try{const{mediaId:o}=await a(t);if(!o)throw new Error(s);const n=await r({operation:e.H.SubmitMedia,variables:{mediaID:o,redditID:`devvit_app_${i}`}});if(!n.data.submitMedia?.ok)throw new Error(s);const l=((e,t)=>"https://i.redd.it/"+e+kt(t))(o,t.type);return Promise.resolve({mediaId:o,url:l})}catch(e){const t=e instanceof Error?e.message:s;return Promise.resolve({error:t})}}(t,i,s.u,e.C);}var yt,It,Nt=function(e,t,i,a){var r,s=arguments.length,o=s<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,i):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,a);else for(var n=e.length-1;n>=0;n--)(r=e[n])&&(o=(s<3?r(o):s>3?r(t,i,o):r(t,i))||o);return s>3&&o&&Object.defineProperty(t,i,o),o},St=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},Rt=function(e,t,i,a){if("a"===i&&!a)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?a:"a"===i?a.call(e):a?a.value:t.get(e)};let Dt=class extends r.s{constructor(){super(...arguments),this.url="",yt.set(this,(()=>{this.$dialog?.hide()})),It.set(this,(()=>{window.open(this.url,"_blank"),this.$dialog?.hide()}))}static get styles(){return[a.c]}show(e){this.url=e,this.$dialog?.showModal()}render(){const t=r.x`
${a.d("Continue to external link?")}
${e.Z({appearance:"secondary",leadingIcon:r.r({size:r.h.Small}),size:e.ac.Small,attributes:{onclick:Rt(this,yt,"f")}})}
${this.url}

${a.d("This link leads to an external site. We cannot guarantee the security on the external site, nor verify its contents.")}

${e.Z({appearance:"secondary",size:e.ac.Medium,children:a.d("Cancel"),attributes:{onclick:Rt(this,yt,"f")}})} ${e.Z({appearance:"primary",size:e.ac.Medium,children:a.d("Continue"),attributes:{onclick:Rt(this,It,"f")}})}
`;return r.x` `}};function Ct(e){const t=e.match(/form\.hook\.(.+)\.0/);if(t?.[1])return t[1]}yt=new WeakMap,It=new WeakMap,Nt([e.n({type:String}),St("design:type",String)],Dt.prototype,"url",void 0),Nt([e.Q("rpl-dialog",!0),St("design:type",Function)],Dt.prototype,"$dialog",void 0),Dt=Nt([e.e("devvit-navigate-offsite-dialog")],Dt);const Pt=e=>e?r.ay``:r.ay``,Ot=(e,t)=>r.ay``;var At,Ut,Mt,$t,Lt,Vt,xt,zt,jt,Ft,Ht,Wt=function(e,t,i,a,r){if("m"===a)throw new TypeError("Private method is not writable");if("a"===a&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===a?r.call(e,i):r?r.value=i:t.set(e,i),i},Gt=function(e,t,i,a){if("a"===i&&!a)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?a:"a"===i?a.call(e):a?a.value:t.get(e)};!function(e){e.IDLE="IDLE",e.IN_WINDOW="IN_WINDOW",e.IN_FRAME="IN_FRAME"}(Ht||(Ht={}));class Bt{constructor(e,t){At.add(this),Ut.set(this,null),Mt.set(this,void 0),$t.set(this,void 0),this.dragState=Ht.IDLE,Vt.set(this,(e=>{e.preventDefault(),e.stopPropagation(),this.dragState=Ht.IN_FRAME,Gt(this,$t,"f").requestUpdate()})),xt.set(this,(e=>{if(e.preventDefault(),e.dataTransfer){const t=Jt(e.dataTransfer);Gt(this,Mt,"f").call(this,t)}this.dragState=Ht.IDLE,Gt(this,$t,"f").requestUpdate()})),zt.set(this,(e=>{e.preventDefault(),this.dragState=Ht.IN_WINDOW,Gt(this,$t,"f").requestUpdate()})),jt.set(this,(e=>{e.preventDefault(),e.relatedTarget&&e.relatedTarget!==document.body||(this.dragState=Ht.IDLE,Gt(this,$t,"f").requestUpdate())})),Ft.set(this,(e=>{e.preventDefault()})),Wt(this,Mt,t,"f"),Wt(this,$t,e,"f"),e.addController(this),Wt(this,Vt,Gt(this,Vt,"f").bind(this),"f"),Wt(this,xt,Gt(this,xt,"f").bind(this),"f"),Wt(this,zt,Gt(this,zt,"f").bind(this),"f"),Wt(this,jt,Gt(this,jt,"f").bind(this),"f"),Wt(this,Ft,Gt(this,Ft,"f").bind(this),"f")}hostDisconnected(){Gt(this,At,"m",Lt).call(this)}initEventListeners(e){Wt(this,Ut,e,"f"),this.dragState=Ht.IDLE,Gt(this,$t,"f").requestUpdate(),Gt(this,Ut,"f").addEventListener("dragover",Gt(this,Vt,"f")),Gt(this,Ut,"f").addEventListener("drop",Gt(this,xt,"f")),window.addEventListener("dragover",Gt(this,zt,"f")),window.addEventListener("dragleave",Gt(this,jt,"f")),window.addEventListener("drop",Gt(this,jt,"f")),window.addEventListener("dragover",Gt(this,Ft,"f"))}}Ut=new WeakMap,Mt=new WeakMap,$t=new WeakMap,Vt=new WeakMap,xt=new WeakMap,zt=new WeakMap,jt=new WeakMap,Ft=new WeakMap,At=new WeakSet,Lt=function(){Gt(this,Ut,"f")&&(Gt(this,Ut,"f").removeEventListener("dragover",Gt(this,Vt,"f")),Gt(this,Ut,"f").removeEventListener("drop",Gt(this,xt,"f"))),window.removeEventListener("dragover",Gt(this,zt,"f")),window.removeEventListener("dragleave",Gt(this,jt,"f")),window.removeEventListener("drop",Gt(this,jt,"f")),window.removeEventListener("dragover",Gt(this,Ft,"f")),this.dragState=Ht.IDLE,Gt(this,$t,"f").requestUpdate()};const Jt=e=>e.items?Array.from(e.items).map((e=>"file"===e.kind?e.getAsFile():null)).filter(Boolean):e.files?Array.from(e.files):[],Yt=20971520,qt=41943040,Zt=1073741824;const Kt=["image/png","image/gif","image/jpeg","image/webp"],Xt=["video/mp4","video/quicktime"];function Qt(e){const t=e.type;return Kt.includes(t)?function(e){const t=e.type;return"image/gif"===t&&e.size>qt?{valid:!1,error:a.d(a.e`Upload failed, GIF size should be less than ${Math.floor(40)}MB.`),reason:"IMAGE_SIZE_LIMIT_EXCEEDED_ERROR"}:t.includes("image/")&&"image/gif"!==t&&e.size>Yt?{valid:!1,error:a.d(a.e`Upload failed, Image size should be less than ${Math.floor(20)}MB.`),reason:"IMAGE_SIZE_LIMIT_EXCEEDED_ERROR"}:t.includes("video/")&&e.size>Zt?{valid:!1,error:a.d(a.e`Upload failed, Video size should be less than ${Math.floor(1)}GB.`),reason:"VIDEO_SIZE_LIMIT_EXCEEDED_ERROR"}:{valid:!0,error:null}}(e):{valid:!1,error:a.d("Sorry, we accept only files (.png, .jpeg, .gif, .webp).")}}var ei,ti,ii,ai,ri,si,oi,ni,li,di,ci,ui,pi,hi,mi,fi,vi,bi=function(e,t,i,a,r){if("m"===a)throw new TypeError("Private method is not writable");if("a"===a&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===a?r.call(e,i):r?r.value=i:t.set(e,i),i},wi=function(e,t,i,a){if("a"===i&&!a)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?a:"a"===i?a.call(e):a?a.value:t.get(e)};function gi(e){return e.value?.url||""}!function(e){e.loading="loading",e.success="success"}(fi||(fi={})),function(e){e.image="image"}(vi||(vi={}));class Ei{constructor(e,t){ei.add(this),this.media=[],ti.set(this,void 0),ii.set(this,void 0),bi(this,ti,e,"f"),bi(this,ii,t?.setValidation??(()=>{}),"f")}getValue(){const e=this.media.filter((e=>e.status===fi.success));return 0===e.length?"":1===e.length?gi(e[0]):JSON.stringify(e.map(gi))}setValue(e){const t=JSON.parse(e);this.media=t}async handleMedia(e){try{const t=this.media.length,i=wi(this,ei,"m",pi).call(this,e);if(i.length>0){wi(this,ii,"f").call(this,ki);const e=[];for(const t of i)e.push(wi(this,ei,"m",oi).call(this,t));this.media=this.media.concat(e),wi(this,ti,"f").requestUpdate("mediaLength",t);const a=await Promise.all(e.map((e=>e.mediaResponse)));a.every((e=>!e?.error&&e?.url))?wi(this,ii,"f").call(this,""):wi(this,ii,"f").call(this,Ti),wi(this,ei,"m",si).call(this,a,t),wi(this,ti,"f").requestUpdate()}}catch(e){if(!(e instanceof Error))return console.error(e),void wi(this,ei,"m",mi).call(this,a.d("Something went wrong. Please try again later"));wi(this,ei,"m",mi).call(this,e.message)}}getPostType(){return vi.image}hasLoadingMedia(){return this.media.some((e=>e.status===fi.loading))}removeMedia(e){this.media.splice(e,1)}}ti=new WeakMap,ii=new WeakMap,ei=new WeakSet,ai=function(e){const t=new RegExp(`^${e}-(?\\d+)$`);return`${e}-${1+this.media.reduce(((e,i)=>{const a=i.id.match(t);return a?Math.max(e,parseInt(a.groups.id,10)):e}),-1)}`},ri=function(){const e=new Event("change",{bubbles:!0});wi(this,ti,"f").dispatchEvent(e)},si=function(e,t){let i=!1;const a=[];for(const[r,s]of e.entries()){const e=t+r,{url:o,mediaId:n,error:l=null}=s??{},d=this.media[e];if(o&&n){const e={mediaId:n,url:o};d.id=n,d.value=e,d.status=fi.success,i=!0}else wi(this,ei,"m",ui).call(this,l),a.push(e)}a.length>0&&(this.media=this.media.filter(((e,t)=>!a.includes(t)))),i?wi(this,ei,"m",ri).call(this):wi(this,ti,"f").requestUpdate("mediaLength",this.media.length-1)},oi=function(e){const t=a.d("Unable to upload image"),i=wi(this,ei,"m",di).call(this,e),r=Qt(e);return r.valid?i.mediaResponse=wi(this,ei,"m",ni).call(this,e):i.mediaResponse=Promise.resolve({error:r.error??t}),i},ni=async function(t){const i=e.c("devvit-image-upload",{blob:t,uploadRequest:null});wi(this,ti,"f").dispatchEvent(i);const a=await i.detail.uploadRequest;return a||Promise.resolve({error:"Image upload failed"})},li=function(e){const t=URL.createObjectURL(e);return{id:wi(this,ei,"m",ai).call(this,e.name),file:e,src:t,status:fi.loading}},di=function(e){return{...wi(this,ei,"m",li).call(this,e),type:"still"}},ci=function(e){return!!e&&Xt.includes(e.type)},ui=function(t){wi(this,ti,"f").dispatchEvent(e.c("faceplate-alert",{level:4,message:t??wi(this,ei,"m",hi).call(this)}))},pi=function(e){let t=e;const i=e.some((e=>wi(this,ei,"m",ci).call(this,e))),r=e.length>1,s=this.media.length>0;if(r||s){const e=a.d("Only one file can be used for the image input");return wi(this,ei,"m",ui).call(this,e),[]}if(i&&(s||r)){const i=a.d("Image input can only contain images");wi(this,ei,"m",ui).call(this,i),t=e.filter((e=>!wi(this,ei,"m",ci).call(this,e)))}return t},hi=function(){return a.d("There was an error uploading the file")},mi=function(e){const t=e||wi(this,ei,"m",hi).call(this);wi(this,ii,"f").call(this,t)};const Ti="Media upload failed",ki="Image upload is in progress";function _i(e){return r.x`
${"video"===e.type?function(e){const{src:t,posterSrc:i,file:a}=e;return r.x`
`}(e):function(e){const{src:t}=e;return r.x`
`}(e)}
`}function yi(t){return r.x`
${function(t){return e.Z({size:e.ac.Small,shape:"pill",appearance:"media",attributes:{type:"button",disabled:t,className:"remove-media remove action invisible group-hover:visible"},leadingIcon:r.as({size:r.h.Small}),screenReaderContent:""})}(t)}
`}function Ii(e){return"loading"===e.status?function(e){return r.x`

${e?.file?.name}

${a.d("Uploading...")}

`}(e):_i(e)}function Ni(t){const i=t.hasLoadingMedia();return r.x`
${e.Z({appearance:"media",size:e.ac.Small,leadingIcon:r.ab({size:r.h.Small}),attributes:{type:"button",id:"media-carousel-prev"}})}
    ${t.media.map((e=>r.x`
  • ${Ii(e)}
  • `))}
${e.Z({appearance:"media",size:e.ac.Small,leadingIcon:r.aa({size:r.h.Small}),attributes:{type:"button",id:"media-carousel-next"}})}
${r.x`
`} ${yi(i)}
`}var Si,Ri,Di,Ci,Pi,Oi,Ai=function(e,t,i,a){var r,s=arguments.length,o=s<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,i):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,a);else for(var n=e.length-1;n>=0;n--)(r=e[n])&&(o=(s<3?r(o):s>3?r(t,i,o):r(t,i))||o);return s>3&&o&&Object.defineProperty(t,i,o),o},Ui=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},Mi=function(e,t,i,a){if("a"===i&&!a)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?a:"a"===i?a.call(e):a?a.value:t.get(e)};class $i extends n.I{constructor(){super(...arguments),Si.add(this),Ri.set(this,new Bt(this,(e=>{this.mediaController.handleMedia(e)}))),this.mediaController=new Ei(this,{setValidation:e=>{e!==Ti||!this.field||this.field.required?Mi(this,Si,"m",Ci).call(this,e):Mi(this,Si,"m",Ci).call(this,"")}}),this.handleRemoveClick=()=>{this.mediaController.media=[],this.mediaController.media.length||Mi(this,Si,"m",Pi).call(this),this.requestUpdate()},Oi.set(this,(async e=>{const t=e.target.closest("button.action");t&&(t.classList.contains("remove")?this.handleRemoveClick():t.classList.contains("upload-media")&&this._input?.click())}))}static get styles(){return[a.c,super.styles]}firstUpdated(e){super.firstUpdated(e),Mi(this,Ri,"f").initEventListeners(this.fileInputInnerWrapper)}get value(){return this.mediaController.getValue()}set value(e){this.mediaController.setValue(e)}formDisabledCallback(e){e?this.setCustomValidity(""):!e&&0===this.value?.length&&this.field?.required&&(Mi(this,Si,"m",Pi).call(this),this.reportValidity())}render(){const t=Kt;let i="border-neutral-border "+(this.mediaController.media.length?"border-solid":"border-dashed");Mi(this,Ri,"f").dragState===Ht.IN_WINDOW?i="bg-neutral-background-weak border-alienblue-600 border-dashed":Mi(this,Ri,"f").dragState===Ht.IN_FRAME&&(i="bg-neutral-background-weak border-alienblue-600 border-solid");const s=r.x` `;return r.x` ${s}
${this.mediaController.media.length?Ni(this.mediaController):function({allowImages:t,allowVideos:i,inputDragState:s}){let o;return o=t&&i?a.d("Drag and Drop images or videos or"):t?a.d("Drag and Drop images or"):a.d("Drag and Drop videos or"),s===Ht.IN_FRAME&&(o=a.d("Drop here to upload")),r.x`
${o} ${e.Z({size:e.ac.Small,shape:"pill",appearance:"secondary",attributes:{type:"button",className:"upload-media action",id:"device-upload-button"},leadingIcon:r.az({size:r.h.Small}),screenReaderContent:""})}
`}({allowImages:!0,allowVideos:!1,inputDragState:Mi(this,Ri,"f").dragState})}
`}}Ri=new WeakMap,Oi=new WeakMap,Si=new WeakSet,Di=function(e){if(!(e.target instanceof HTMLInputElement))return;const t=e.target.files;t?.length&&(this.mediaController.handleMedia(Array.from(t)),e.target.value="")},Ci=function(e){this.setCustomValidity(e),this.reportValidity()},Pi=function(){Mi(this,Si,"m",Ci).call(this,a.d("Please add an image"))},Ai([e.Q("#fileInputInnerWrapper"),Ui("design:type",HTMLDivElement)],$i.prototype,"fileInputInnerWrapper",void 0),Ai([e.n({type:Ei}),Ui("design:type",Ei)],$i.prototype,"mediaController",void 0),Ai([e.n({attribute:!1}),Ui("design:type",Object)],$i.prototype,"field",void 0),Ai([e.Q("input.file-input"),Ui("design:type",HTMLInputElement)],$i.prototype,"_input",void 0),customElements.define("devvit-form-image-field",$i);const Li=e=>r.ay` ${o.cg(e.fieldType,[[a.F.STRING,()=>(e=>{const{minLength:t,maxLength:i,placeholder:a}=e.fieldConfig?.stringConfig??{};return r.ay` ${e.label} `})(e)],[a.F.IMAGE,()=>(e=>r.ay`
${a.d("Formats: JPG, PNG, GIF, WEBP")}
${Pt(e.helpText)}
`)(e)],[a.F.PARAGRAPH,()=>(e=>{const{lineHeight:t,maxCharacters:i,placeholder:a}=e.fieldConfig?.paragraphConfig??{};return r.ay` ${e.label} `})(e)],[a.F.NUMBER,()=>(e=>{const{min:t,max:i,step:a}=e.fieldConfig?.numberConfig??{};return r.ay` ${e.label} `})(e)],[a.F.BOOLEAN,()=>(e=>r.ay`
${e.label} ${Pt(e.helpText)}
`)(e)],[a.F.SELECTION,()=>(e=>{const t=e.defaultValue?.selectionValue?.values??[],i=e.fieldConfig?.selectionConfig?.choices.map((e=>r.ay``));return r.ay` ${d.F.clearButton()} ${i}`})(e)],[a.F.GROUP,()=>((e,t)=>r.ay`
${Ot(e)}
${t(e.fieldConfig?.groupConfig?.fields??[])}
`)(e,Vi)]])} `,Vi=e=>r.ay`${r.aA(e,(e=>Li(e)))}`;var xi,zi,ji,Fi,Hi,Wi,Gi,Bi,Ji,Yi,qi,Zi=function(e,t,i,a){var r,s=arguments.length,o=s<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,i):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,a);else for(var n=e.length-1;n>=0;n--)(r=e[n])&&(o=(s<3?r(o):s>3?r(t,i,o):r(t,i))||o);return s>3&&o&&Object.defineProperty(t,i,o),o},Ki=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},Xi=function(e,t,i,a){if("a"===i&&!a)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?a:"a"===i?a.call(e):a?a.value:t.get(e)},Qi=function(e,t,i,a,r){if("m"===a)throw new TypeError("Private method is not writable");if("a"===a&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===a?r.call(e,i):r?r.value=i:t.set(e,i),i};let ea=class extends r.s{constructor(){super(...arguments),xi.set(this,(()=>{})),zi.set(this,{}),ji.set(this,(e=>e.reduce(((e,t)=>t.fieldType===a.F.GROUP?{...e,...Xi(this,ji,"f").call(this,t.fieldConfig?.groupConfig?.fields??[])}:(e[t.fieldId]=t,e)),{}))),Fi.set(this,(()=>{const e={};if(!this.$form)return e;for(const t of this.$form.elementsIterator()){const{name:i,value:r}=t,{fieldType:s}=Xi(this,zi,"f")[i],o={fieldType:s,stringValue:"",numberValue:0,boolValue:!1,selectionValue:{values:[]}};switch(s){case a.F.STRING:case a.F.PARAGRAPH:case a.F.IMAGE:if(null===r||""===r.trim())continue;o.stringValue=r;break;case a.F.NUMBER:o.numberValue=Number(r||0);break;case a.F.BOOLEAN:o.boolValue="true"===r||"on"===r;break;case a.F.SELECTION:{const e=t.selectedOptions.map((e=>e.value));if(0===e.length)continue;o.selectionValue={values:e};break}}e[i]=o}return e})),Hi.set(this,(async()=>{const e=this.$form?.querySelectorAll('[faceplate-validity="invalid"]');if(!e||e.length>0)return;if(!this.form?.id)throw new Error("Cannot submit form due to missing form id. If you are using 'useForm' please make sure that it is not called conditionally inside of your component.");const t={hook:Ct(this.form.id),formSubmitted:{formId:this.form.id,results:Xi(this,Fi,"f").call(this)}};await Xi(this,Gi,"f").call(this,!1),Xi(this,xi,"f").call(this,t)})),Wi.set(this,(e=>{"Enter"!==e.key||e.target.tagName.includes("TEXTAREA")||Xi(this,Hi,"f").call(this)})),Gi.set(this,(async e=>{if(e&&this.form?.id){const e={hook:Ct(this.form.id),formCancelled:{formId:this.form.id}};Xi(this,xi,"f").call(this,e)}await(this.$dialog?.hide())})),Bi.set(this,(()=>{this.form=void 0,Qi(this,zi,{},"f")})),Ji.set(this,(()=>r.x`
${e.dz(this.form?.title)}
`)),Yi.set(this,(()=>r.x`${this.form?.shortDescription}`)),qi.set(this,(()=>r.x`
${e.Z({appearance:"secondary",size:e.ac.Medium,children:this.form?.cancelLabel??e.dz("Cancel"),attributes:{onclick:()=>Xi(this,Gi,"f").call(this,!0)}})}
${e.Z({appearance:"primary",size:e.ac.Medium,children:this.form?.acceptLabel??e.dz("OK"),attributes:{type:"submit",onclick:Xi(this,Hi,"f")}})}
`))}static get styles(){return[a.c]}async showForm(e,t){this.$dialog&&(this.$form=this.$dialog.portalContainer.querySelector("faceplate-form"),this.form=e,Qi(this,zi,Xi(this,ji,"f").call(this,e.fields),"f"),Qi(this,xi,t,"f"),await(this.$dialog?.showModal()))}render(){const t=r.x` ${o.cx(this.form?.title,Xi(this,Ji,"f"))}
${e.Z({appearance:"secondary",leadingIcon:r.r({size:r.h.Small}),size:e.ac.Small,attributes:{onclick:()=>Xi(this,Gi,"f").call(this,!0)}})}
${o.cx(this.form?.shortDescription,Xi(this,Yi,"f"))} ${Vi(this.form?.fields??[])} ${Xi(this,qi,"f").call(this)}
`;return r.x` `}};var ta;xi=new WeakMap,zi=new WeakMap,ji=new WeakMap,Fi=new WeakMap,Hi=new WeakMap,Wi=new WeakMap,Gi=new WeakMap,Bi=new WeakMap,Ji=new WeakMap,Yi=new WeakMap,qi=new WeakMap,Zi([e.n({attribute:!1}),Ki("design:type",Object)],ea.prototype,"form",void 0),Zi([e.Q("rpl-dialog",!0),Ki("design:type",e.hV)],ea.prototype,"$dialog",void 0),ea=Zi([e.e("devvit-form-dialog")],ea),function(e){e.Mobile="Mobile",e.Desktop="Desktop",e.Fullscreen="Fullscreen"}(ta||(ta={}));const ia=375;let aa=class extends r.s{constructor(){super(...arguments),this.isFullscreen=!1,this.showUiSimulator=!1,this.previewSizes=[],this.selectedSize=ta.Mobile,this.isCoachmarkDismissed=!1}handleSizeChange(e){const t=new CustomEvent("size-changed",{detail:e,bubbles:!0,composed:!0});this.dispatchEvent(t)}handleDropdownClick(){const e=new CustomEvent("dropdown-click",{bubbles:!0,composed:!0});this.dispatchEvent(e)}render(){let t="";switch(this.selectedSize){case ta.Mobile:t="Mobile";break;case ta.Desktop:t="Desktop";break;case ta.Fullscreen:t="Fullscreen"}const i=this.showUiSimulator?r.x`
${o.n({appearance:"secondary",size:e.ac.Small,children:t,attributes:{onclick:()=>this.handleDropdownClick()}})}
${this.previewSizes.map((e=>r.x`${e}`))}
`:r.A,a=!this.showUiSimulator&&this.onExpandCollapse?e.Z({appearance:"secondary",shape:"pill",leadingIcon:this.isFullscreen?c.c({size:r.I.Small}):u.e({size:r.I.Small}),size:e.ac.Small,attributes:{"data-test-id":"expand-collapse-button","aria-label":"Toggle fullscreen web view",onclick:this.onExpandCollapse}}):r.A;return r.x`
${i} ${a}
`}};aa.styles=[e.t],e._([e.n({type:Boolean,attribute:"is-fullscreen"})],aa.prototype,"isFullscreen",void 0),e._([e.n({attribute:!1})],aa.prototype,"onExpandCollapse",void 0),e._([e.n({type:Boolean,attribute:"show-ui-simulator"})],aa.prototype,"showUiSimulator",void 0),e._([e.n({type:Array})],aa.prototype,"previewSizes",void 0),e._([e.n({type:String})],aa.prototype,"selectedSize",void 0),e._([e.n({type:Boolean,attribute:"is-coachmark-dismissed"})],aa.prototype,"isCoachmarkDismissed",void 0),aa=e._([e.e("devvit-web-view-preview-size-controls")],aa);let ra=class extends r.s{constructor(){super(...arguments),this.handleCoachmarkDismiss=()=>{}}render(){return r.x`
${"Preview across devices"} ${"Design responsively. Test your app in mobile and desktop views."} ${"This mode is only visible to you, the app owner."} ${"Learn more"}
${e.Z({children:"Got it",appearance:"secondary",shape:"pill",size:e.ac.Small,attributes:{"data-test-id":"dismiss-button","aria-label":"Got it",onclick:()=>this.handleCoachmarkDismiss()}})}
`;}};ra.styles=[e.t],e._([e.n({attribute:!1})],ra.prototype,"handleCoachmarkDismiss",void 0),ra=e._([e.e("devvit-ui-simulator-coachmark-card")],ra);let sa=class extends r.s{constructor(){super(...arguments),this.isDarkModeEnabled=!1}render(){return r.x` ${e.Z({appearance:"secondary",shape:"pill",leadingIcon:this.isDarkModeEnabled?p.n({size:r.I.Small}):p.d({size:r.I.Small}),size:e.ac.Small,attributes:{"data-test-id":"dark-mode-toggle","aria-label":this.isDarkModeEnabled?"Switch to light mode":"Switch to dark mode",onclick:()=>{this.onToggle?.(!this.isDarkModeEnabled)}}})} `;}};sa.styles=[e.t],e._([e.n({type:Boolean,attribute:"is-dark-mode-enabled"})],sa.prototype,"isDarkModeEnabled",void 0),e._([e.n({attribute:!1})],sa.prototype,"onToggle",void 0),sa=e._([e.e("devvit-preview-dark-mode-toggle")],sa);const oa="devvit-preview-coachmark-dismissed";let na=class extends r.s{constructor(){super(...arguments),this.isFullscreen=!1,this.onClose=()=>{},this.showUiSimulator=!1,this.previewSizes=[],this.selectedSize=ta.Mobile,this.isDarkModeEnabled=!1,this._isCoachmarkDismissed=!1,this.webViewSubredditDetails={showSubredditJoinButton:!1,subredditId:"",subredditName:""},this._handleCoachmarkDismiss=()=>{this._isCoachmarkDismissed=!0,e.a0.isAvailable()&&e.a0.setItem(oa,"true")}}connectedCallback(){super.connectedCallback(),e.a0.isAvailable()&&(this._isCoachmarkDismissed="true"===e.a0.getItem(oa))}render(){const t=!this._isCoachmarkDismissed&&this.showUiSimulator;return r.x`
${this.showUiSimulator?r.x` `:""} ${this.webViewSubredditDetails.showSubredditJoinButton?r.x` `:""} ${t?r.x``:r.A} ${e.Z({appearance:"secondary",shape:"pill",leadingIcon:r.c({size:r.I.Small}),size:e.ac.Small,attributes:{"data-test-id":"close-button","aria-label":"Close fullscreen web view",onclick:this.onClose}})}
`;}};na.styles=[e.t],e._([e.n({type:Boolean,attribute:"is-fullscreen"})],na.prototype,"isFullscreen",void 0),e._([e.n({attribute:!1})],na.prototype,"onExpandCollapse",void 0),e._([e.n({attribute:!1})],na.prototype,"onClose",void 0),e._([e.n({type:Boolean,attribute:"show-ui-simulator"})],na.prototype,"showUiSimulator",void 0),e._([e.n({type:Array})],na.prototype,"previewSizes",void 0),e._([e.n({type:String})],na.prototype,"selectedSize",void 0),e._([e.n({type:Boolean,attribute:"is-dark-mode-enabled"})],na.prototype,"isDarkModeEnabled",void 0),e._([e.v()],na.prototype,"_isCoachmarkDismissed",void 0),e._([e.n({type:Object})],na.prototype,"webViewSubredditDetails",void 0),na=e._([e.e("devvit-fullscreen-web-view-controls")],na);let la=class extends r.s{constructor(){super(...arguments),this.isDesktopViewport=!1,this.isDarkModeEnabled=!1,this.webViewUrl="",this.webViewPostTitle="",this.appSlug="",this.installationId="",this.showUiSimulator=!1,this.webViewSubredditDetails={showSubredditJoinButton:!1,subredditId:"",subredditName:""},this.onCloseWebView=[],this._selectedWebViewPreviewSize=ta.Mobile,this._focusWebViewIframe=()=>{const e=this._portalContainer,t=e?.querySelector("devvit-blocks-web-view"),i=t?.shadowRoot?.querySelector("iframe");i?.focus()},this._measureCssVarPx=e=>{const t=document.createElement("div");t.style.position="absolute",t.style.visibility="hidden",t.style.setProperty("width",`var(${e})`),document.body.appendChild(t);const i=t.getBoundingClientRect().width;return document.body.removeChild(t),Number.isFinite(i)&&i>0?Math.round(i):null},this._computeDesktopWidthPx=()=>{const e=this._measureCssVarPx("--size-2xl")??0,t=Math.max(0,window.innerWidth-e);return Math.min(724,t)},this._applyWidthVarToPortal=e=>{const t=this._portalContainer;t&&(e?t.style.setProperty("--wv-modal-width",e):t.style.removeProperty("--wv-modal-width"))},this._setWebViewPreviewSize=e=>{switch(this._selectedWebViewPreviewSize=e,e){case ta.Mobile:this._applyWidthVarToPortal("375px"),this.setAttribute("data-preview-size","mobile");break;case ta.Desktop:{const e=this._computeDesktopWidthPx();this._applyWidthVarToPortal(`${e}px`),this.setAttribute("data-preview-size","desktop");break}case ta.Fullscreen:this._applyWidthVarToPortal(null),this.setAttribute("data-preview-size","fullscreen")}this._focusWebViewIframe()},this._handleExpandCollapse=()=>{const e=this._selectedWebViewPreviewSize===ta.Fullscreen?ta.Desktop:ta.Fullscreen;this._setWebViewPreviewSize(e)},this._updateWebViewColorScheme=()=>{const e=document.getElementById("devvit-web-view-dialog");e&&this.showUiSimulator&&(e.style.colorScheme=this.isDarkModeEnabled?"dark":"light")}}firstUpdated(e){super.firstUpdated(e),this._initializeDialogSize()}_initializeDialogSize(){this.isDesktopViewport?this.showUiSimulator?this._setWebViewPreviewSize(ta.Mobile):this._setWebViewPreviewSize(ta.Desktop):this._setWebViewPreviewSize(ta.Fullscreen)}willUpdate(e){if((e.has("webViewUrl")||e.has("appSlug")||e.has("installationId"))&&this.webViewUrl&&this.appSlug&&this.installationId)switch(this._webViewDialog?.showModal(),this._selectedWebViewPreviewSize){case ta.Mobile:this._applyWidthVarToPortal("375px");break;case ta.Desktop:this._applyWidthVarToPortal("min(724px, calc(100vw - var(--size-2xl)))");break;case ta.Fullscreen:this._applyWidthVarToPortal(null)}e.has("webViewPostTitle")&&!this.webViewPostTitle&&this._webViewDialog?.hide(),e.has("isDarkModeEnabled")&&this._updateWebViewColorScheme()}updated(e){super.updated(e),e.has("showUiSimulator")&&this._initializeDialogSize(),e.has("isDarkModeEnabled")&&this._updateWebViewColorScheme()}get _portalContainer(){return this._webViewDialog?.portalContainer??document.getElementById("devvit-web-view-dialog")}render(){const e=this._selectedWebViewPreviewSize===ta.Fullscreen?"w-screen h-screen rounded-none":"w-[var(--wv-modal-width)] h-[644px] relative";let t="";if(this.showUiSimulator)switch(this._selectedWebViewPreviewSize){case ta.Mobile:t="max-w-[160px]";break;case ta.Desktop:t="max-w-[500px]";break;case ta.Fullscreen:t="";break;default:this._selectedWebViewPreviewSize}const i=this.webViewUrl&&this.webViewPostTitle?r.x`

${`${this.webViewPostTitle}`}

${this.showUiSimulator?r.x` ${"UI simulator"} `:r.A}
`:r.A;return r.x` `}};la.styles=[r.i`:host{display:block;--wv-modal-width:min(${724}px, calc(100vw - var(--size-2xl)))}@media (max-width:${724}px){:host{--wv-modal-width:min(${540}px, calc(100vw - var(--size-2xl)))}}:host([data-preview-size=mobile]){--wv-modal-width:${ia}}`,e.t],e._([e.Q("rpl-dialog")],la.prototype,"_webViewDialog",void 0),e._([e.n({type:Boolean,attribute:"is-desktop-viewport"})],la.prototype,"isDesktopViewport",void 0),e._([e.n({type:Boolean,attribute:"is-dark-mode-enabled"})],la.prototype,"isDarkModeEnabled",void 0),e._([e.n({type:String,attribute:!1})],la.prototype,"webViewUrl",void 0),e._([e.n({type:String,attribute:!1})],la.prototype,"webViewPostTitle",void 0),e._([e.n({type:String,attribute:!1})],la.prototype,"appSlug",void 0),e._([e.n({type:String,attribute:!1})],la.prototype,"installationId",void 0),e._([e.n({type:Boolean,attribute:"show-ui-simulator"})],la.prototype,"showUiSimulator",void 0),e._([e.n({type:Object,attribute:!1})],la.prototype,"webViewSubredditDetails",void 0),e._([e.n({type:Object,attribute:!1})],la.prototype,"onFullscreenUrlChange",void 0),e._([e.n({type:Array,attribute:!1})],la.prototype,"onCloseWebView",void 0),e._([e.n({type:Object,attribute:!1})],la.prototype,"trackWebViewEvent",void 0),e._([e.n({type:Object,attribute:!1})],la.prototype,"trackWebViewTTI",void 0),e._([e.n({type:Object,attribute:!1})],la.prototype,"clearRealtimeHandler",void 0),e._([e.n({type:Object,attribute:!1})],la.prototype,"webViewEffectHandler",void 0),e._([e.n({type:Object,attribute:!1})],la.prototype,"context",void 0),e._([e.n({type:Object,attribute:!1})],la.prototype,"onExpandEffect",void 0),e._([e.v()],la.prototype,"_selectedWebViewPreviewSize",void 0),la=e._([e.e("devvit-web-view-dialog-loader")],la);let da=class extends r.s{constructor(){super(...arguments),this.loid="unknown",this.isDesktopViewport=!1,this.isDarkModeEnabled=!1,this._webViewUrl="",this._webViewPostTitle="",this._appSlug="",this._installationId="",this._showUiSimulator=!1,this._webViewSubredditDetails={showSubredditJoinButton:!1,subredditId:"",subredditName:""},this._stagedSafetyReport={},this._realtimeEffectHandler=void 0,this._webViewEffectHandler=void 0,this._navigateToEffectHandler=void 0,this._eventsController=new e.E(this),this._purchaseController=new ne(this),this._onCloseWebView=[],this._trackWebViewEvent=null,this._trackWebViewTTI=null,this._fireBeforeRouteEvent=()=>{this._webViewPostTitle="",this._formDialog?.$dialog?.hide(),this._navigationDialog?.$dialog?.hide()},this.stageSafetyReport=e=>{this._stagedSafetyReport=e.detail},this.setFullscreenWebViewProperties=e=>{this._webViewPostTitle=e.detail.postTitle,this._webViewUrl=e.detail.webViewUrl??"",this._appSlug=e.detail.appSlug,this._installationId=e.detail.installationId,this._showUiSimulator=e.detail.showUiSimulator&&this.isDesktopViewport,this._webViewSubredditDetails=e.detail.subreddit,this._context=e.detail.context,this._onCloseWebView=e.detail.onCloseWebView??[],this._trackWebViewEvent=e.detail.trackDevvitPostV2Event,this._trackWebViewTTI=e.detail.trackWebViewTTI,this._clearRealtimeHandler(),this._appSlug&&this._installationId&&(this._realtimeEffectHandler=new O(this,this._appSlug,this._installationId),this.addController(this._realtimeEffectHandler),this._realtimeEffectHandler.enable()),this._navigateToEffectHandler?.setAdsMetadata(e.detail.adsMetadata),this._realtimeEffectHandler?.enable()},this.submitSafetyReport=async()=>{const{postId:t,encodedData:i}=this._stagedSafetyReport;await async function(t){try{const{encodedData:i}=t;if(!i)return null;const{data:a,errors:r}=await e.C({operation:e.H.CreateCustomPostSnapshot,variables:{input:t}});if(a.createCustomPostSnapshot?.errors?.[0])throw new Error(a.createCustomPostSnapshot?.errors?.[0].message);if(!a?.createCustomPostSnapshot?.ok||r?.[0])throw new Error("Something went wrong creating the snapshot");const{ok:s}=a.createCustomPostSnapshot;return s}catch(e){return window.Sentry?.captureException?.(e),null}}({postId:t,encodedData:i})},this.onFullscreenUrlChange=async e=>{this._webViewUrl=e,""===e&&(this._webViewPostTitle="",await this.updateComplete,this._resetFullscreenWebViewPropertiesEventCallbacks(),this._clearRealtimeHandler())},this.uploadImage=t=>{const{id:i}=e.iR(this.loid);t.detail.uploadRequest=_t(t.detail.blob,i)},this._onExpandEffect=e=>{e.detail.immersiveMode===j.IMMERSIVE_MODE?e.detail.entryUrl&&this.onFullscreenUrlChange(e.detail.entryUrl):this.onFullscreenUrlChange("")},this.clearRealtimeHandler=()=>{this._clearRealtimeHandler()}}_resetFullscreenWebViewPropertiesEventCallbacks(){this._onCloseWebView=[],this._trackWebViewEvent=null,this._trackWebViewTTI=null}connectedCallback(){super.connectedCallback(),a.i(),new we(this),new me(this),new Tt(this,this._purchaseController),new A(this),this._navigateToEffectHandler=new z(this),this._webViewEffectHandler=new Me(this,this.onFullscreenUrlChange),this._eventsController.define("stage-devplatform-snapshot",this.stageSafetyReport),this._eventsController.define("submit-report-modal",this.submitSafetyReport),this._eventsController.define("set-fullscreen-web-view-properties",this.setFullscreenWebViewProperties),window.addEventListener("beforeRoute",this._fireBeforeRouteEvent)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("beforeRoute",this._fireBeforeRouteEvent),this._clearRealtimeHandler()}firstUpdated(){this._navigateToEffectHandler&&this._navigationDialog&&this._navigateToEffectHandler.setDialog(this._navigationDialog)}render(){return r.x`
`}_clearRealtimeHandler(){this._realtimeEffectHandler&&(this._realtimeEffectHandler.hostDisconnected(),this.removeController(this._realtimeEffectHandler),this._realtimeEffectHandler=void 0)}};return da.styles=[r.i`:host{display:block}`,e.t],e._([e.n({type:String})],da.prototype,"loid",void 0),e._([e.n({type:Boolean,attribute:"is-desktop-viewport"})],da.prototype,"isDesktopViewport",void 0),e._([e.n({type:Boolean,attribute:"is-dark-mode-enabled"})],da.prototype,"isDarkModeEnabled",void 0),e._([e.Q("devvit-form-dialog")],da.prototype,"_formDialog",void 0),e._([e.Q("devvit-navigate-offsite-dialog")],da.prototype,"_navigationDialog",void 0),e._([e.v()],da.prototype,"_webViewUrl",void 0),e._([e.v()],da.prototype,"_webViewPostTitle",void 0),e._([e.v()],da.prototype,"_appSlug",void 0),e._([e.v()],da.prototype,"_installationId",void 0),e._([e.v()],da.prototype,"_showUiSimulator",void 0),e._([e.v()],da.prototype,"_webViewSubredditDetails",void 0),da=e._([e.e("devvit-wrapper")],da),{D:O,get W(){return j}}})); SML.di("./C42E8rVVpA.js",import.meta.url,"C42E8rVVpA");SML.di("./BcUlF1uWDA.js",import.meta.url,"BcUlF1uWDA");SML.di("./CsxDAjmHZE.js",import.meta.url,"CsxDAjmHZE");SML.di("./CndptGkkPK.js",import.meta.url,"CndptGkkPK");SML.di("./Da-UYDWSOS.js",import.meta.url,"Da-UYDWSOS");SML.di("./B01f6V9jnX.js",import.meta.url,"B01f6V9jnX");SML.di("./DUaETbwyQ9.js",import.meta.url,"DUaETbwyQ9");SML.di("./CxBOcTjMlj.js",import.meta.url,"CxBOcTjMlj"); SML.dm("D304_WY_yB",["C42E8rVVpA","BcUlF1uWDA","CsxDAjmHZE","CndptGkkPK","Da-UYDWSOS","B01f6V9jnX","DUaETbwyQ9","CxBOcTjMlj"],(async(e,t,s,i)=>{const a="community-picker-others",n="community-picker-your-communities",r="community-picker-default";let o=class extends(i.T()){constructor(){super(...arguments),this.isDirty=!1,this.hasBeenFocused=!1,this.exclude="",this.fitWidth=!1,this.searchOnInitialFocus=!1,this.communityIcon="",this.communityPrefixedName="",this.communityName="",this.communityId="",this.showSuggestionsInline=!1,this.placeholder="Search communities",this._query="",this.typeaheadResults=null,this.debouncedSearch=e.a7(this.fetchTypeaheadResults,300),this.partialRequest=new e.aJ(this),this.handleBlur=e=>{const t=e.relatedTarget;this.contains(t)||this.shadowRoot.contains(t)||this.dropdownMenu?.close()},this.handleClick=e=>{e.stopPropagation()},this.handleDropdownClick=e=>{this.handleDropdownSelect(e)},this.handleDropdownKeyDown=e=>{const t=e.target,[s]=e.composedPath(),{visibleListItems:i}=this,a=i.findIndex((e=>e===t||e.contains(t)||e.contains(s)));if(a<0)return;e.stopPropagation();const n=i[a+1],r=i[a-1];if("ArrowDown"===e.code){if(e.preventDefault(),!n)return this.handleSearchKeyDown(e);this.focusListItem(n)}else if("ArrowUp"===e.code)if(e.preventDefault(),r)this.focusListItem(r);else{const{searchInput:e,searchInputEl:t}=this;if(!e)return;e.value=this.query,e.focus();const s=e.value.length;s&&t?.setSelectionRange(s,s)}else"Enter"===e.code&&this.handleDropdownSelect(e)},this.handleDropdownSelect=e=>{e.preventDefault();const t=e.target,[s]=e.composedPath(),{visibleListItems:i}=this,a=i.find((e=>e===t||e.contains(t)||e.contains(s)))??null,n=this.parseListItemData(a);if(!a||!n)return;this.value=n.prefixedName??"",this.communityIcon=a.querySelector("img")?.src??"",this.communityPrefixedName=n.prefixedName??"",this.communityName=n.name??"",this.communityId=n.id??"",this.dropdownMenu?.close();const r=new InputEvent("input",{bubbles:!0,composed:!0}),o=new Event("change",{bubbles:!0});this.dispatchEvent(r),this.dispatchEvent(o)},this.handleSearchClear=()=>{this.reset(),this.searchInput?.focus()},this.handleSearchFocus=()=>{!this.hasBeenFocused&&this.searchOnInitialFocus&&this.fetchTypeaheadResults(),this.hasBeenFocused=!0,this.dropdownMenu?.show()},this.handleSearchInput=e=>{this.isDirty=!0,this.query=e.target.value}}static get styles(){return[e.t]}get value(){return this.parseListItemData(this.selectedItem)?.prefixedName??""}set value(e){const t=this.listItems.find((t=>this.parseListItemData(t)?.prefixedName===e));t&&(this.selectedItem=t)}get searchInputEl(){return this.searchInput?.shadowRoot?.querySelector("input")??null}get query(){return this._query}set query(e){e!==this._query&&(this._query=e,this.handleQueryChange())}get defaultListItems(){return(this.defaultItemGroups??[]).map((e=>Array.from(e.querySelectorAll(`li#${r} li:has(div[role="menuitem"])`)))).flat()}get typeaheadSubscribedListItems(){return Array.from(this.typeaheadContainer?.querySelectorAll(`li#${n} li[data-select-value]:has(div[role="menuitem"])`)??[])}get typeaheadOtherListItems(){return Array.from(this.typeaheadContainer?.querySelectorAll(`li#${a} li[data-select-value]:has(div[role="menuitem"])`)??[])}get listItems(){return[...this.defaultListItems,...this.typeaheadSubscribedListItems,...this.typeaheadOtherListItems]}get selectedItem(){return this.listItems.find((e=>e.hasAttribute("rpl-selected")))??null}set selectedItem(e){e&&this.selectedItem!==e&&(this.selectedItem?.toggleAttribute("rpl-selected"),e?.toggleAttribute("rpl-selected"))}get visibleDefaultListItems(){return this.defaultListItems.filter((e=>!e.classList.contains("hidden")))}get visibleTypeaheadSubscribedListItems(){return this.typeaheadSubscribedListItems.filter((e=>!e.classList.contains("hidden")))}get visibleTypeaheadOtherListItems(){return this.typeaheadOtherListItems.filter((e=>!e.classList.contains("hidden")))}get visibleListItems(){return this.listItems.filter((e=>!e.classList.contains("hidden")))}connectedCallback(){super.connectedCallback(),this.addEventListener("blur",this.handleBlur),this.addEventListener("click",this.handleClick),this.addEventListener("keydown",this.handleDropdownKeyDown,{capture:!0})}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("blur",this.handleBlur),this.removeEventListener("click",this.handleClick),this.removeEventListener("keydown",this.handleDropdownKeyDown,{capture:!0})}parseListItemData(e){return e?.dataset?.selectValue?JSON.parse(e.dataset.selectValue):null}async focusListItem(e){await(e?.querySelector("[tabindex]")?.focus()),this.searchInput&&null!=e.dataset.selectValue&&(this.searchInput.value=this.parseListItemData(e)?.prefixedName??"")}firstUpdated(){const e=this.getAttribute("value");e&&this.value!==e?this.value=e:this.value=this.parseListItemData(this.selectedItem)?.prefixedName??""}updated(){this.filterDropdownItems()}reset(){this.query="",this.value="",this.communityIcon="",this.communityPrefixedName="",this.communityName="",this.communityId="",this.searchInput&&(this.searchInput.value="")}async fetchTypeaheadResults(){const t=await this.partialRequest.request(`/svc/shreddit/community-search?q=${this.normalizeQuery(this.query)}&subs=1&exclude=${this.exclude}`),s=await(t?.text());this.typeaheadResults=s?e.b7(s):null}normalizeQuery(e){return e?e.toLowerCase().trim():""}focus(){super.focus(),this.contains(document.activeElement)&&this.shadowRoot?.activeElement!==this.dropdownButton||this.searchInput?.focus()}handleQueryChange(){this.searchInput&&(this.searchInput.value=this.query),this.debouncedSearch&&this.debouncedSearch(this.query),this.filterDropdownItems()}handleSearchKeyDown(e){"ArrowDown"===e.code&&(e.preventDefault(),this.focusListItem(this.visibleListItems[0]))}filterDropdownItems(){const{query:e}=this,t=this.listItems,s=new Set;for(const i of t){if(!i)continue;const t=this.parseListItemData(i);t?.prefixedName&&t.prefixedName.toLocaleLowerCase().includes(e.toLocaleLowerCase())&&!s.has(t.prefixedName.toLocaleLowerCase())?(i.classList.remove("hidden"),s.add(t.prefixedName.toLocaleLowerCase())):i.classList.add("hidden")}const i=this.typeaheadContainer?.querySelector(`#${a}`),o=this.typeaheadContainer?.querySelector(`#${n}`),l=this.querySelector(`#${r}`);0===this.visibleDefaultListItems.length?l?.classList.add("hidden"):l?.classList.remove("hidden"),0===this.visibleTypeaheadSubscribedListItems.length?o?.classList.add("hidden"):o?.classList.remove("hidden"),0===this.visibleTypeaheadOtherListItems.length?i?.classList.add("hidden"):i?.classList.remove("hidden"),this.isDirty&&(0===this.visibleListItems.length?this.emptyText?.classList.remove("hidden"):this.emptyText?.classList.add("hidden"))}renderSearchInput(){const i=`mx-0 ${this.fitWidth?"min-w-full":"min-w-[20rem]"} w-full`;return s.x` ${e.Z({attributes:{id:"search-input-clear-button",slot:"clearIcon",type:"button",onclick:this.handleSearchClear},appearance:"plain",size:e.ac.Small,screenReaderContent:"Clear search",leadingIcon:s.R({size:s.I.Small})})} `;}render(){const e=s.x`
${this.typeaheadResults??s.A}
`;return s.x`
${this.renderSearchInput()} ${this.hint?s.x` `:s.A} ${this.showSuggestionsInline?e:s.x` ${e} `}
${super.render()}`}};e._([e.n({type:String})],o.prototype,"exclude",void 0),e._([e.n({type:Boolean,attribute:"fit-width"})],o.prototype,"fitWidth",void 0),e._([e.n({type:Boolean,attribute:"search-on-initial-focus"})],o.prototype,"searchOnInitialFocus",void 0),e._([e.n()],o.prototype,"communityIcon",void 0),e._([e.n()],o.prototype,"communityPrefixedName",void 0),e._([e.n()],o.prototype,"communityName",void 0),e._([e.n()],o.prototype,"communityId",void 0),e._([e.n({type:Boolean,attribute:"show-suggestions-inline"})],o.prototype,"showSuggestionsInline",void 0),e._([e.n()],o.prototype,"placeholder",void 0),e._([e.n()],o.prototype,"hint",void 0),e._([e.n()],o.prototype,"value",null),e._([e.Q("#search-input",!0)],o.prototype,"searchInput",void 0),e._([e.Q("#dropdown-button",!0)],o.prototype,"dropdownButton",void 0),e._([e.Q("faceplate-dropdown-menu")],o.prototype,"dropdownMenu",void 0),e._([e.l({flatten:!0,selector:"li"})],o.prototype,"defaultItemGroups",void 0),e._([e.n()],o.prototype,"query",null),e._([e.v()],o.prototype,"typeaheadResults",void 0),e._([e.Q("#typeahead-results")],o.prototype,"typeaheadContainer",void 0),e._([e.Q("#community-search-empty")],o.prototype,"emptyText",void 0),o=e._([e.e("shreddit-community-search")],o)})); SML.di("./CsxDAjmHZE.js",import.meta.url,"CsxDAjmHZE"); SML.dm("D8LZ7OySIA",["CsxDAjmHZE"],(async a=>{const{svg:c}=a.g();return{c:a.m(c``,"0 0 20 20","chat-group")}})); SML.dm("DCbB57ubLb",[],(async()=>{var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function t(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const e of t)r.append("v",e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function n(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const e of t)r.append("v",e);n.search=r.toString(),console.warn(`Minified Lexical warning #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}const r="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,o=r&&"documentMode"in document?document.documentMode:null,i=r&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),s=r&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),l=!(!r||!("InputEvent"in window)||o)&&"getTargetRanges"in new window.InputEvent("input"),a=r&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),c=r&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,u=r&&/Android/.test(navigator.userAgent),d=r&&/^(?=.*Chrome).*/i.test(navigator.userAgent),g=r&&u&&d,f=r&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&i&&!d;function h(...e){const t=[];for(const n of e)if(n&&"string"==typeof n)for(const[e]of n.matchAll(/\S+/g))t.push(e);return t}const p=0,m=1,_=2,y=1,b=2,S=3,C=4,x=5,v=6,w=a||c||f?" ":"​",k="\n\n",T=s?" ":w,N={bold:1,capitalize:1024,code:16,highlight:128,italic:2,lowercase:256,strikethrough:4,subscript:32,superscript:64,underline:8,uppercase:512},E={directionless:1,unmergeable:2},A={center:2,end:6,justify:4,left:1,right:3,start:5},F={[b]:"center",[v]:"end",[C]:"justify",[y]:"left",[S]:"right",[x]:"start"},O={normal:0,segmented:2,token:1},P={[p]:"normal",[_]:"segmented",[m]:"token"},R="$config";function M(e,t,n,r,o,i){let s=e.getFirstChild();for(;null!==s;){const e=s.__key;s.__parent===t&&(Lr(s)&&M(s,e,n,r,o,i),n.has(e)||i.delete(e),o.push(e)),s=s.getNextSibling()}}let L=!1,D=0;function I(e){D=e.timeStamp}function K(e,t,n){const r="BR"===e.nodeName,o=t.__lexicalLineBreak;return o&&(e===o||r&&e.previousSibling===o)||r&&void 0!==Ao(e,n)}function z(e,t,n){const r=mi(ai(n));let o=null,i=null;null!==r&&r.anchorNode===e&&(o=r.anchorOffset,i=r.focusOffset);const s=e.nodeValue;null!==s&&Wo(t,s,o,i,!1)}function $(e,t,n){if(Dn(e)){const t=e.anchor.getNode();if(t.is(n)&&e.format!==t.getFormat())return!1}return yo(t)&&n.isAttached()}function B(e,t,n,r){for(let o=e;o&&!Fi(o);o=oi(o)){const e=Ao(o,t);if(void 0!==e){const t=No(e,n);if(t)return Kr(t)||!yi(o)?void 0:[o,t]}else if(o===r)return[r,Mo(n)]}}function W(e,t,n){L=!0;const r=performance.now()-D>100;try{Or(e,(()=>{const o=Qn()||function(e){return e.getEditorState().read((()=>{const e=Qn();return null!==e?e.clone():null}))}(e),i=new Map,l=e.getRootElement(),a=e._editorState,c=e._blockCursorElement;let u=!1,d="";for(let n=0;n0){let t=0;for(let o=0;o0)for(const[t,n]of i)n.reconcileObservedMutation(t,e);const g=n.takeRecords();if(g.length>0){for(let t=0;t{W(e,t,n)}))}function J(e){const t=new Map,n=new Set;for(let r="function"==typeof e?e:e.replace;r.prototype&&void 0!==r.prototype.getType;r=Object.getPrototypeOf(r)){const{ownNodeConfig:e}=Pi(r);if(e&&e.stateConfigs)for(const r of e.stateConfigs){let e;"stateConfig"in r?(e=r.stateConfig,r.flat&&n.add(e.key)):e=r,t.set(e.key,e)}}return{flatKeys:n,sharedConfigMap:t}}let j=class e{node;knownState;unknownState;sharedNodeState;size;constructor(e,t,n=void 0,r=new Map,o=void 0){this.node=e,this.sharedNodeState=t,this.unknownState=n,this.knownState=r;const{sharedConfigMap:i}=this.sharedNodeState,s=void 0!==o?o:function(e,t,n){let r=n.size;if(t)for(const o in t){const t=e.get(o);t&&n.has(t)||r++}return r}(i,n,r);this.size=s}getValue(e){const t=this.knownState.get(e);if(void 0!==t)return t;this.sharedNodeState.sharedConfigMap.set(e.key,e);let n=e.defaultValue;if(this.unknownState&&e.key in this.unknownState){const t=this.unknownState[e.key];void 0!==t&&(n=e.parse(t)),this.updateFromKnown(e,n)}return n}getInternalState(){return[this.unknownState,this.knownState]}toJSON(){const e={...this.unknownState},t={};for(const[t,n]of this.knownState)t.isEqual(n,t.defaultValue)?delete e[t.key]:e[t.key]=t.unparse(n);for(const n of this.sharedNodeState.flatKeys)n in e&&(t[n]=e[n],delete e[n]);return V(e)&&(t.$=e),t}getWritable(t){if(this.node===t)return this;const{sharedNodeState:n,unknownState:r}=this,o=new Map(this.knownState);return new e(t,n,function(e,t,n){let r;if(n)for(const[o,i]of Object.entries(n)){const n=e.get(o);n?t.has(n)||t.set(n,n.parse(i)):(r=r||{},r[o]=i)}return r}(n.sharedConfigMap,o,r),o,this.size)}updateFromKnown(e,t){const n=e.key;this.sharedNodeState.sharedConfigMap.set(n,e);const{knownState:r,unknownState:o}=this;r.has(e)||o&&n in o||(o&&(delete o[n],this.unknownState=V(o)),this.size++),r.set(e,t)}updateFromUnknown(e,t){const n=this.sharedNodeState.sharedConfigMap.get(e);n?this.updateFromKnown(n,n.parse(t)):(this.unknownState=this.unknownState||{},e in this.unknownState||this.size++,this.unknownState[e]=t)}updateFromJSON(e){const{knownState:t}=this;for(const e of t.keys())t.set(e,e.defaultValue);if(this.size=t.size,this.unknownState=void 0,e)for(const[t,n]of Object.entries(e))this.updateFromUnknown(t,n)}};function Y(e){return e.__state?e.__state.sharedNodeState:so(wi(),e.getType()).sharedNodeState}function V(e){if(e)for(const t in e)return e}function G(e,t,n){for(const[r,o]of t.knownState){if(e.has(r.key))continue;e.add(r.key);const t=n?n.getValue(r):r.defaultValue;if(t!==o&&!r.isEqual(t,o))return!0}return!1}function q(e,t,n){const{unknownState:r}=t,o=n?n.unknownState:void 0;if(r)for(const[t,n]of Object.entries(r))if(!e.has(t)&&(e.add(t),n!==(o?o[t]:void 0)))return!0;return!1}function Z(e,t){const n=e.__state;return n&&n.node===e?n.getWritable(t):n}function X(e,t){const n=e.__mode,r=e.__format,o=e.__style,i=t.__mode,s=t.__format,l=t.__style,a=e.__state,c=t.__state;return(null===n||n===i)&&(null===r||r===s)&&(null===o||o===l)&&(null===e.__state||a===c||function(e,t){if(e===t)return!0;if(e&&t&&e.size!==t.size)return!1;const n=new Set;return!(e&&G(n,e,t)||t&&G(n,t,e)||e&&q(n,e,t)||t&&q(n,t,e))}(a,c))}function Q(e,t){const n=e.mergeWithSibling(t),r=br()._normalizedNodes;return r.add(e.__key),r.add(t.__key),n}function ee(e){let t,n,r=e;if(""!==r.__text||!r.isSimpleText()||r.isUnmergeable()){for(;null!==(t=r.getPreviousSibling())&&Tn(t)&&t.isSimpleText()&&!t.isUnmergeable();){if(""!==t.__text){if(X(t,r)){r=Q(t,r);break}break}t.remove()}for(;null!==(n=r.getNextSibling())&&Tn(n)&&n.isSimpleText()&&!n.isUnmergeable();){if(""!==n.__text){if(X(r,n)){r=Q(r,n);break}break}n.remove()}}else r.remove()}function te(e){return ne(e.anchor),ne(e.focus),e}function ne(e){for(;"element"===e.type;){const t=e.getNode(),n=e.offset;let r,o;if(n===t.getChildrenSize()?(r=t.getChildAtIndex(n-1),o=!0):(r=t.getChildAtIndex(n),o=!1),Tn(r)){e.set(r.__key,o?r.getTextContentSize():0,"text",!0);break}if(!Lr(r))break;e.set(r.__key,o?r.getChildrenSize():0,"element",!0)}}let re,oe,ie,se,le,ae,ce,ue,de,ge,fe="",he=null,pe="",me="",_e=!1,ye=!1;function be(e,t){const n=ce.get(e);if(null!==t){const n=Le(e);n.parentNode===t&&t.removeChild(n)}if(ue.has(e)||oe._keyToDOMMap.delete(e),Lr(n)){const e=Oe(n,ce);Se(e,0,e.length-1,null)}void 0!==n&&Zo(ge,ie,se,n,"destroyed")}function Se(e,t,n,r){let o=t;for(;o<=n;++o){const t=e[o];void 0!==t&&be(t,r)}}function Ce(e,t){e.setProperty("text-align",t)}const xe="40px";function ve(e,t){const n=re.theme.indent;if("string"==typeof n){const r=e.classList.contains(n);t>0&&!r?e.classList.add(n):t<1&&r&&e.classList.remove(n)}const r=getComputedStyle(e).getPropertyValue("--lexical-indent-base-value")||xe;e.style.setProperty("padding-inline-start",0===t?"":`calc(${t} * ${r})`)}function we(e,t){const n=e.style;0===t?Ce(n,""):1===t?Ce(n,"left"):2===t?Ce(n,"center"):3===t?Ce(n,"right"):4===t?Ce(n,"justify"):5===t?Ce(n,"start"):6===t&&Ce(n,"end")}function ke(e,t){const n=function(e){const t=e.__dir;if(null!==t)return t;if($r(e))return null;const n=e.getParentOrThrow();return $r(n)&&null===n.__dir?"auto":null}(t);null!==n?e.dir=n:e.removeAttribute("dir")}function Te(e,n){const r=ue.get(e);void 0===r&&t(60);const o=r.createDOM(re,oe);if(function(e,t,n){const r=n._keyToDOMMap;(function(e,t,n){e[`__lexicalKey_${t._key}`]=n})(t,n,e),r.set(e,t)}(e,o,oe),Tn(r)?o.setAttribute("data-lexical-text","true"):Kr(r)&&o.setAttribute("data-lexical-decorator","true"),Lr(r)){const e=r.__indent,t=r.__size;if(ke(o,r),0!==e&&ve(o,e),0!==t){const e=t-1;Ne(Oe(r,ue),r,0,e,r.getDOMSlot(o))}const n=r.__format;0!==n&&we(o,n),r.isInline()||Ae(null,r,o),ni(r)&&(fe+=k,me+=k)}else{const t=r.getTextContent();if(Kr(r)){const t=r.decorate(oe,re);null!==t&&Re(e,t),o.contentEditable="false"}fe+=t,me+=t}return null!==n&&n.insertChild(o),Zo(ge,ie,se,r,"created"),o}function Ne(e,t,n,r,o){const i=fe;fe="";let s=n;for(;s<=r;++s){Te(e[s],o);const t=ue.get(e[s]);null!==t&&Tn(t)&&(null===he&&(he=t.getFormat()),""===pe&&(pe=t.getStyle()))}ni(t)&&(fe+=k),o.element.__lexicalTextContent=fe,fe=i+fe}function Ee(e,t){if(e){const n=e.__last;if(n){const e=t.get(n);if(e)return an(e)?"line-break":Kr(e)&&e.isInline()?"decorator":null}return"empty"}return null}function Ae(e,t,n){const r=Ee(e,ce),o=Ee(t,ue);r!==o&&t.getDOMSlot(n).setManagedLineBreak(o)}function Fe(e,n,r){var o;he=null,pe="",function(e,n,r){const o=fe,i=e.__size,s=n.__size;fe="";const l=r.element;if(1===i&&1===s){const t=e.__first,r=n.__first;if(t===r)Pe(t,l);else{const e=Le(t),n=Te(r,null);try{l.replaceChild(n,e)}catch(o){if("object"==typeof o&&null!=o){const i=`${o.toString()} Parent: ${l.tagName}, new child: {tag: ${n.tagName} key: ${r}}, old child: {tag: ${e.tagName}, key: ${t}}.`;throw new Error(i)}throw o}be(t,null)}const i=ue.get(r);Tn(i)&&(null===he&&(he=i.getFormat()),""===pe&&(pe=i.getStyle()))}else{const o=Oe(e,ce),a=Oe(n,ue);if(o.length!==i&&t(227),a.length!==s&&t(228),0===i)0!==s&&Ne(a,n,0,s-1,r);else if(0===s){if(0!==i){const e=null==r.after&&null==r.before&&null==r.element.__lexicalLineBreak;Se(o,0,i-1,e?null:l),e&&(l.textContent="")}}else!function(e,t,n,r,o,i){const s=r-1,l=o-1;let a,c,u=i.getFirstChild(),d=0,g=0;for(;d<=s&&g<=l;){const e=t[d],r=n[g];if(e===r)u=Me(Pe(r,i.element)),d++,g++;else{void 0===a&&(a=new Set(t)),void 0===c&&(c=new Set(n));const o=c.has(e),s=a.has(r);if(o)if(s){const e=ri(oe,r);e===u?u=Me(Pe(r,i.element)):(i.withBefore(u).insertChild(e),Pe(r,i.element)),d++,g++}else Te(r,i.withBefore(u)),g++;else u=Me(Le(e)),be(e,i.element),d++}const o=ue.get(r);null!==o&&Tn(o)&&(null===he&&(he=o.getFormat()),""===pe&&(pe=o.getStyle()))}const f=d>s,h=g>l;if(f&&!h){const t=n[l+1],r=void 0===t?null:oe.getElementByKey(t);Ne(n,e,g,l,i.withBefore(r))}else h&&!f&&Se(t,d,s,i.element)}(n,o,a,i,s,r)}ni(n)&&(fe+=k),l.__lexicalTextContent=fe,fe=o+fe}(e,n,n.getDOMSlot(r)),o=n,null==he||he===o.__textFormat||ye||o.setTextFormat(he),function(e){""===pe||pe===e.__textStyle||ye||e.setTextStyle(pe)}(n)}function Oe(e,n){const r=[];let o=e.__first;for(;null!==o;){const e=n.get(o);void 0===e&&t(101),r.push(o),o=e.__next}return r}function Pe(e,n){const r=ce.get(e);let o=ue.get(e);void 0!==r&&void 0!==o||t(61);const i=_e||ae.has(e)||le.has(e),s=ri(oe,e);if(r===o&&!i){if(Lr(r)){const e=s.__lexicalTextContent;void 0!==e&&(fe+=e,me+=e)}else{const e=r.getTextContent();me+=e,fe+=e}return s}if(r!==o&&i&&Zo(ge,ie,se,o,"updated"),o.updateDOM(r,s,re)){const r=Te(e,null);return null===n&&t(62),n.replaceChild(r,s),be(e,null),r}if(Lr(r)&&Lr(o)){const e=o.__indent;(_e||e!==r.__indent)&&ve(s,e);const t=o.__format;if((_e||t!==r.__format)&&we(s,t),i&&(Fe(r,o,s),$r(o)||o.isInline()||Ae(r,o,s)),ni(o)&&(fe+=k,me+=k),(_e||o.__dir!==r.__dir)&&(ke(s,o),$r(o)&&!_e))for(const e of o.getChildren())Lr(e)&&ke(ri(oe,e.getKey()),e)}else{const t=o.getTextContent();if(Kr(o)){const t=o.decorate(oe,re);null!==t&&Re(e,t)}fe+=t,me+=t}if(!ye&&$r(o)&&o.__cachedText!==me){const e=o.getWritable();e.__cachedText=me,o=e}return s}function Re(e,t){let n=oe._pendingDecorators;const r=oe._decorators;if(null===n){if(r[e]===t)return;n=Oo(oe)}n[e]=t}function Me(e){let t=e.nextSibling;return null!==t&&t===oe._blockCursorElement&&(t=t.nextSibling),t}function Le(e){const n=de.get(e);return void 0===n&&t(75,e),n}function De(e){return{type:e}}const Ie=De("SELECTION_CHANGE_COMMAND"),Ke=De("SELECTION_INSERT_CLIPBOARD_NODES_COMMAND"),ze=De("CLICK_COMMAND"),$e=De("DELETE_CHARACTER_COMMAND"),Be=De("INSERT_LINE_BREAK_COMMAND"),We=De("INSERT_PARAGRAPH_COMMAND"),Ue=De("CONTROLLED_TEXT_INSERTION_COMMAND"),He=De("PASTE_COMMAND"),Je=De("REMOVE_TEXT_COMMAND"),je=De("DELETE_WORD_COMMAND"),Ye=De("DELETE_LINE_COMMAND"),Ve=De("FORMAT_TEXT_COMMAND"),Ge=De("UNDO_COMMAND"),qe=De("REDO_COMMAND"),Ze=De("KEYDOWN_COMMAND"),Xe=De("KEY_ARROW_RIGHT_COMMAND"),Qe=De("MOVE_TO_END"),et=De("KEY_ARROW_LEFT_COMMAND"),tt=De("MOVE_TO_START"),nt=De("KEY_ARROW_UP_COMMAND"),rt=De("KEY_ARROW_DOWN_COMMAND"),ot=De("KEY_ENTER_COMMAND"),it=De("KEY_SPACE_COMMAND"),st=De("KEY_BACKSPACE_COMMAND"),lt=De("KEY_ESCAPE_COMMAND"),at=De("KEY_DELETE_COMMAND"),ct=De("KEY_TAB_COMMAND"),ut=De("INSERT_TAB_COMMAND"),dt=De("INDENT_CONTENT_COMMAND"),gt=De("OUTDENT_CONTENT_COMMAND"),ft=De("DROP_COMMAND"),ht=De("FORMAT_ELEMENT_COMMAND"),pt=De("DRAGSTART_COMMAND"),mt=De("DRAGOVER_COMMAND"),_t=De("DRAGEND_COMMAND"),yt=De("COPY_COMMAND"),bt=De("CUT_COMMAND"),St=De("SELECT_ALL_COMMAND"),Ct=De("CLEAR_EDITOR_COMMAND"),xt=De("CLEAR_HISTORY_COMMAND"),vt=De("CAN_REDO_COMMAND"),wt=De("CAN_UNDO_COMMAND"),kt=De("FOCUS_COMMAND"),Tt=De("BLUR_COMMAND"),Nt=De("KEY_MODIFIER_COMMAND"),Et=Object.freeze({}),At=[["keydown",function(e,t){if(!(Ft=e.timeStamp,Ot=e.key,t.isComposing()||ti(t,Ze,e)||null==e.key)){if(zt&&Vo(e))return Or(t,(()=>{Gt(t,$t)})),zt=!1,void($t="");if(function(e){return Jo(e,"ArrowRight",{shiftKey:"any"})}(e))ti(t,Xe,e);else if(function(e){return Jo(e,"ArrowRight",jo)}(e))ti(t,Qe,e);else if(function(e){return Jo(e,"ArrowLeft",{shiftKey:"any"})}(e))ti(t,et,e);else if(function(e){return Jo(e,"ArrowLeft",jo)}(e))ti(t,tt,e);else if(function(e){return Jo(e,"ArrowUp",{altKey:"any",shiftKey:"any"})}(e))ti(t,nt,e);else if(function(e){return Jo(e,"ArrowDown",{altKey:"any",shiftKey:"any"})}(e))ti(t,rt,e);else if(function(e){return Jo(e,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any",shiftKey:!0})}(e))It=!0,ti(t,ot,e);else if(function(e){return" "===e.key}(e))ti(t,it,e);else if(function(e){return i&&Jo(e,"o",{ctrlKey:!0})}(e))e.preventDefault(),It=!0,ti(t,Be,!0);else if(function(e){return Jo(e,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any"})}(e))It=!1,ti(t,ot,e);else if(function(e){return Jo(e,"Backspace",{shiftKey:"any"})||i&&Jo(e,"h",{ctrlKey:!0})}(e))Vo(e)?ti(t,st,e):(e.preventDefault(),ti(t,$e,!0));else if(function(e){return"Escape"===e.key}(e))ti(t,lt,e);else if(function(e){return Jo(e,"Delete",{})||i&&Jo(e,"d",{ctrlKey:!0})}(e))!function(e){return"Delete"===e.key}(e)?(e.preventDefault(),ti(t,$e,!1)):ti(t,at,e);else if(function(e){return Jo(e,"Backspace",Yo)}(e))e.preventDefault(),ti(t,je,!0);else if(function(e){return Jo(e,"Delete",Yo)}(e))e.preventDefault(),ti(t,je,!1);else if(function(e){return i&&Jo(e,"Backspace",{metaKey:!0})}(e))e.preventDefault(),ti(t,Ye,!0);else if(function(e){return i&&(Jo(e,"Delete",{metaKey:!0})||Jo(e,"k",{ctrlKey:!0}))}(e))e.preventDefault(),ti(t,Ye,!1);else if(function(e){return Jo(e,"b",jo)}(e))e.preventDefault(),ti(t,Ve,"bold");else if(function(e){return Jo(e,"u",jo)}(e))e.preventDefault(),ti(t,Ve,"underline");else if(function(e){return Jo(e,"i",jo)}(e))e.preventDefault(),ti(t,Ve,"italic");else if(function(e){return Jo(e,"Tab",{shiftKey:"any"})}(e))ti(t,ct,e);else if(function(e){return Jo(e,"z",jo)}(e))e.preventDefault(),ti(t,Ge,void 0);else if(function(e){return i?Jo(e,"z",{metaKey:!0,shiftKey:!0}):Jo(e,"y",{ctrlKey:!0})||Jo(e,"z",{ctrlKey:!0,shiftKey:!0})}(e))e.preventDefault(),ti(t,qe,void 0);else{const n=t._editorState._selection;null===n||Dn(n)?Go(e)&&(e.preventDefault(),ti(t,St,e)):function(e){return Jo(e,"c",jo)}(e)?(e.preventDefault(),ti(t,yt,e)):function(e){return Jo(e,"x",jo)}(e)?(e.preventDefault(),ti(t,bt,e)):Go(e)&&(e.preventDefault(),ti(t,St,e))}(function(e){return e.ctrlKey||e.shiftKey||e.altKey||e.metaKey})(e)&&ti(t,Nt,e)}}],["pointerdown",function(e,t){const n=e.target,r=e.pointerType;bi(n)&&"touch"!==r&&"pen"!==r&&0===e.button&&Or(t,(()=>{co(n)||(Dt=!0)}))}],["compositionstart",function(e,t){Or(t,(()=>{const n=Qn();if(Dn(n)&&!t.isComposing()){const r=n.anchor,o=n.anchor.getNode();ko(r.key),(e.timeStamp{Gt(t,e.data)})):(zt=!0,$t=e.data)}],["input",function(e,t){e.stopPropagation(),Or(t,(()=>{if(yi(e.target)&&co(e.target))return;const n=Qn(),r=e.data,o=Vt(e);if(null!=r&&Dn(n)&&Ut(n,o,r,e.timeStamp,!1)){Kt&&(Gt(t,r),Kt=!1);const o=n.anchor.getNode(),i=mi(ai(t));if(null===i)return;const u=n.isBackward(),d=u?n.anchor.offset:n.focus.offset,g=u?n.focus.offset:n.anchor.offset;l&&!n.isCollapsed()&&Tn(o)&&null!==i.anchorNode&&o.getTextContent().slice(0,d)+r+o.getTextContent().slice(d+g)===$o(i.anchorNode)||ti(t,Ue,r);const h=r.length;s&&h>1&&"insertCompositionText"===e.inputType&&!t.isComposing()&&(n.anchor.offset-=h),a||c||f||!t.isComposing()||(Ft=0,ko(null))}else Bo(!1,t,null!==r?r:void 0),Kt&&(Gt(t,r||void 0),Kt=!1);!function(){mr();U(br())}()}),{event:e}),Rt=null}],["click",function(e,t){Or(t,(()=>{const n=Qn(),r=mi(ai(t)),o=er();if(r)if(Dn(n)){const t=n.anchor,i=t.getNode();if("element"===t.type&&0===t.offset&&n.isCollapsed()&&!$r(i)&&1===Ro().getChildrenSize()&&i.getTopLevelElementOrThrow().isEmpty()&&null!==o&&n.is(o))r.removeAllRanges(),n.dirty=!0;else if(3===e.detail&&!n.isCollapsed()&&i!==n.focus.getNode()){const e=Ri(i,(e=>Lr(e)&&!e.isInline()));Lr(e)&&e.select(0)}}else if("touch"===e.pointerType||"pen"===e.pointerType){const n=r.anchorNode;(yi(n)||yo(n))&&Lo(Xn(o,r,t,e))}ti(t,ze,e)}))}],["cut",Et],["copy",Et],["dragstart",Et],["dragover",Et],["dragend",Et],["paste",Et],["focus",Et],["blur",Et],["drop",Et]];l&&At.push(["beforeinput",(e,n)=>function(e,n){const r=e.inputType,o=Vt(e);"deleteCompositionText"===r||s&&ei(n)||"insertCompositionText"!==r&&Or(n,(()=>{const i=Qn();if("deleteContentBackward"===r){if(null===i){const e=er();if(!Dn(e))return;Lo(e.clone())}if(Dn(i)){const r=i.anchor.key===i.focus.key;if(s=e.timeStamp,"MediaLast"===Ot&&s{Or(n,(()=>{ko(null)}))}),30),Dn(i)){const e=i.anchor.getNode();e.markDirty(),Tn(e)||t(142),Yt(i,e)}}else{ko(null),e.preventDefault();const t=i.anchor.getNode(),o=t.getTextContent(),s=t.canInsertTextAfter(),l=0===i.anchor.offset&&i.focus.offset===o.length;let a=g&&r&&!l&&s;if(a&&i.isCollapsed()&&(a=!Kr(Qo(i.anchor,!0))),!a){ti(n,$e,!0);const e=Qn();g&&Dn(e)&&e.isCollapsed()&&(Bt=e,setTimeout((()=>Bt=null)))}}return}}var s;if(!Dn(i))return;const l=e.data;null!==Rt&&Bo(!1,n,Rt),i.dirty&&null===Rt||!i.isCollapsed()||$r(i.anchor.getNode())||null===o||i.applyDOMRange(o),Rt=null;const a=i.anchor,u=i.focus,d=a.getNode(),f=u.getNode();if("insertText"!==r&&"insertTranspose"!==r)switch(e.preventDefault(),r){case"insertFromYank":case"insertFromDrop":case"insertReplacementText":ti(n,Ue,e);break;case"insertFromComposition":ko(null),ti(n,Ue,e);break;case"insertLineBreak":ko(null),ti(n,Be,!1);break;case"insertParagraph":ko(null),It&&!c?(It=!1,ti(n,Be,!1)):ti(n,We,void 0);break;case"insertFromPaste":case"insertFromPasteAsQuotation":ti(n,He,e);break;case"deleteByComposition":(function(e,t){return e!==t||Lr(e)||Lr(t)||!mo(e)||!mo(t)})(d,f)&&ti(n,Je,e);break;case"deleteByDrag":case"deleteByCut":ti(n,Je,e);break;case"deleteContent":ti(n,$e,!1);break;case"deleteWordBackward":ti(n,je,!0);break;case"deleteWordForward":ti(n,je,!1);break;case"deleteHardLineBackward":case"deleteSoftLineBackward":ti(n,Ye,!0);break;case"deleteContentForward":case"deleteHardLineForward":case"deleteSoftLineForward":ti(n,Ye,!1);break;case"formatStrikeThrough":ti(n,Ve,"strikethrough");break;case"formatBold":ti(n,Ve,"bold");break;case"formatItalic":ti(n,Ve,"italic");break;case"formatUnderline":ti(n,Ve,"underline");break;case"historyUndo":ti(n,Ge,void 0);break;case"historyRedo":ti(n,qe,void 0)}else{if("\n"===l)e.preventDefault(),ti(n,Be,!1);else if(l===k)e.preventDefault(),ti(n,We,void 0);else if(null==l&&e.dataTransfer){const t=e.dataTransfer.getData("text/plain");e.preventDefault(),i.insertRawText(t)}else null!=l&&Ut(i,o,l,e.timeStamp,!0)?(e.preventDefault(),ti(n,Ue,l)):Rt=l;Pt=e.timeStamp}}))}(e,n)]);let Ft=0,Ot=null,Pt=0,Rt=null;const Mt=new WeakMap;let Lt=!1,Dt=!1,It=!1,Kt=!1,zt=!1,$t="",Bt=null,Wt=[0,"",0,"root",0];function Ut(e,t,n,r,o){const i=e.anchor,s=e.focus,a=i.getNode(),c=br(),u=mi(ai(c)),d=null!==u?u.anchorNode:null,g=i.key,f=c.getElementByKey(g),h=n.length;return g!==s.key||!Tn(a)||(!o&&(!l||Pt1||(o||!l)&&null!==f&&!a.isComposing()&&d!==bo(f)||null!==u&&null!==t&&(!t.collapsed||t.startContainer!==u.anchorNode||t.startOffset!==u.anchorOffset)||a.getFormat()!==e.format||a.getStyle()!==e.style||function(e,t){if(t.isSegmented())return!0;if(!e.isCollapsed())return!1;const n=e.anchor.offset,r=t.getParentOrThrow(),o=mo(t);return 0===n?!t.canInsertTextBefore()||!r.canInsertTextBefore()&&!t.isComposing()||o||function(e){const t=e.getPreviousSibling();return(Tn(t)||Lr(t)&&t.isInline())&&!t.canInsertTextAfter()}(t):n===t.getTextContentSize()&&(!t.canInsertTextAfter()||!r.canInsertTextAfter()&&!t.isComposing()||o)}(e,a)}function Ht(e,t){return yo(e)&&null!==e.nodeValue&&0!==t&&t!==e.nodeValue.length}function Jt(e,n,r){const{anchorNode:o,anchorOffset:i,focusNode:s,focusOffset:l}=e;Lt&&(Lt=!1,Ht(o,i)&&Ht(s,l)&&!Bt)||Or(n,(()=>{if(!r)return void Lo(null);if(!go(n,o,s))return;let a=Qn();if(Bt&&Dn(a)&&a.isCollapsed()){const e=a.anchor,t=Bt.anchor;(e.key===t.key&&e.offset===t.offset+1||1===e.offset&&t.getNode().is(e.getNode().getPreviousSibling()))&&(a=Bt.clone(),Lo(a))}if(Bt=null,Dn(a)){const r=a.anchor,o=r.getNode();if(a.isCollapsed()){"Range"===e.type&&e.anchorNode===e.focusNode&&(a.dirty=!0);const i=ai(n).event,s=i?i.timeStamp:performance.now(),[l,c,u,d,g]=Wt,f=Ro(),h=!1===n.isComposing()&&""===f.getTextContent();if(s{const r=er(),o=t.anchorNode;(yi(o)||yo(o))&&Lo(Xn(r,t,n,e))})));const r=Ko(n),o=r[r.length-1],i=o._key,s=Zt.get(i),l=s||o;l!==n&&Jt(t,l,!1),Jt(t,n,!0),n!==o?Zt.set(i,n):s&&Zt.delete(i)}function Qt(e){e._lexicalHandled=!0}function en(e){return!0===e._lexicalHandled}function tn(e){const n=e.ownerDocument,r=Mt.get(n);if(void 0===r)return;const o=r-1;o>=0||t(164),Mt.set(n,o),0===o&&n.removeEventListener("selectionchange",Xt);const i=po(e);fo(i)?(function(e){if(null!==e._parentEditor){const t=Ko(e),n=t[t.length-1]._key;Zt.get(n)===e&&Zt.delete(n)}else Zt.delete(e._key)}(i),e.__lexicalEditor=null):i&&t(198);const s=qt(e);for(let e=0;ee.__key===this.__key));if(Tn(this))return n;if(Dn(t)&&"element"===t.anchor.type&&"element"===t.focus.type){if(t.isCollapsed())return!1;const e=this.getParent();if(Kr(this)&&this.isInline()&&e){const n=t.isBackward()?t.focus:t.anchor;if(e.is(n.getNode())&&n.offset===e.getChildrenSize()&&this.is(e.getLastChild()))return!1}}return n}getKey(){return this.__key}getIndexWithinParent(){const e=this.getParent();if(null===e)return-1;let t=e.getFirstChild(),n=0;for(;null!==t;){if(this.is(t))return n;n++,t=t.getNextSibling()}return-1}getParent(){const e=this.getLatest().__parent;return null===e?null:No(e)}getParentOrThrow(){const e=this.getParent();return null===e&&t(66,this.__key),e}getTopLevelElement(){let e=this;for(;null!==e;){const n=e.getParent();if(ui(n))return Lr(e)||e===this&&Kr(e)||t(194),e;e=n}return null}getTopLevelElementOrThrow(){const e=this.getTopLevelElement();return null===e&&t(67,this.__key),e}getParents(){const e=[];let t=this.getParent();for(;null!==t;)e.push(t),t=t.getParent();return e}getParentKeys(){const e=[];let t=this.getParent();for(;null!==t;)e.push(t.__key),t=t.getParent();return e}getPreviousSibling(){const e=this.getLatest().__prev;return null===e?null:No(e)}getPreviousSiblings(){const e=[],t=this.getParent();if(null===t)return e;let n=t.getFirstChild();for(;null!==n&&!n.is(this);)e.push(n),n=n.getNextSibling();return e}getNextSibling(){const e=this.getLatest().__next;return null===e?null:No(e)}getNextSiblings(){const e=[];let t=this.getNextSibling();for(;null!==t;)e.push(t),t=t.getNextSibling();return e}getCommonAncestor(e){const t=Lr(this)?this:this.getParent(),n=Lr(e)?e:e.getParent(),r=t&&n?us(t,n):null;return r?r.commonAncestor:null}is(e){return null!=e&&this.__key===e.__key}isBefore(e){const n=us(this,e);return null!==n&&("descendant"===n.type||("branch"===n.type?-1===ls(n):("same"!==n.type&&"ancestor"!==n.type&&t(279),!1)))}isParentOf(e){const t=us(this,e);return null!==t&&"ancestor"===t.type}getNodesBetween(e){const n=this.isBefore(e),r=[],o=new Set;let i=this;for(;null!==i;){const s=i.__key;if(o.has(s)||(o.add(s),r.push(i)),i===e)break;const l=Lr(i)?n?i.getFirstChild():i.getLastChild():null;if(null!==l){i=l;continue}const a=n?i.getNextSibling():i.getPreviousSibling();if(null!==a){i=a;continue}const c=i.getParentOrThrow();if(o.has(c.__key)||r.push(c),c===e)break;let u=null,d=c;do{if(null===d&&t(68),u=n?d.getNextSibling():d.getPreviousSibling(),d=d.getParent(),null===d)break;null!==u||o.has(d.__key)||r.push(d)}while(null===u);i=u}return n||r.reverse(),r}isDirty(){const e=br()._dirtyLeaves;return null!==e&&e.has(this.__key)}getLatest(){const e=No(this.__key);return null===e&&t(113),e}getWritable(){mr();const e=yr(),t=br(),n=e._nodeMap,r=this.__key,o=this.getLatest(),i=t._cloneNotNeeded,s=Qn();if(null!==s&&s.setCachedNodes(null),i.has(r))return wo(o),o;const l=Ei(o);return i.add(r),wo(l),n.set(r,l),l}getTextContent(){return""}getTextContentSize(){return this.getTextContent().length}createDOM(e,n){t(70)}updateDOM(e,n,r){t(71)}exportDOM(e){return{element:this.createDOM(e._config,e)}}exportJSON(){const e=this.__state?this.__state.toJSON():void 0;return{type:this.__type,version:1,...e}}static importJSON(e){t(18,this.name)}updateFromJSON(e){return function(e,t){const n=e.getWritable(),r=t.$;let o=r;for(const e of Y(n).flatKeys)e in t&&(void 0!==o&&o!==r||(o={...r}),o[e]=t[e]);return(n.__state||o)&&function(e){const t=e.getWritable(),n=t.__state?t.__state.getWritable(t):new j(t,Y(t));return t.__state=n,n}(e).updateFromJSON(o),n}(this,e)}static transform(){return null}remove(e){nn(this,!0,e)}replace(e,n){mr();let r=Qn();null!==r&&(r=r.clone()),fi(this,e);const o=this.getLatest(),i=this.__key,s=e.__key,l=e.getWritable(),a=this.getParentOrThrow().getWritable(),c=a.__size;vo(l);const u=o.getPreviousSibling(),d=o.getNextSibling(),g=o.__prev,f=o.__next,h=o.__parent;if(nn(o,!1,!0),null===u?a.__first=s:u.getWritable().__next=s,l.__prev=g,null===d?a.__last=s:d.getWritable().__prev=s,l.__next=f,l.__parent=h,a.__size=c,n&&(Lr(this)&&Lr(l)||t(139),this.getChildren().forEach((e=>{l.append(e)}))),Dn(r)){Lo(r);const e=r.anchor,t=r.focus;e.key===i&&Mn(e,l),t.key===i&&Mn(t,l)}return To()===i&&ko(s),l}insertAfter(e,t=!0){mr(),fi(this,e);const n=this.getWritable(),r=e.getWritable(),o=r.getParent(),i=Qn();let s=!1,l=!1;if(null!==o){const t=e.getIndexWithinParent();if(vo(r),Dn(i)){const e=o.__key,n=i.anchor,r=i.focus;s="element"===n.type&&n.key===e&&n.offset===t+1,l="element"===r.type&&r.key===e&&r.offset===t+1}}const a=this.getNextSibling(),c=this.getParentOrThrow().getWritable(),u=r.__key,d=n.__next;if(null===a?c.__last=u:a.getWritable().__prev=u,c.__size++,n.__next=u,r.__next=d,r.__prev=n.__key,r.__parent=n.__parent,t&&Dn(i)){const e=this.getIndexWithinParent();tr(i,c,e+1);const t=c.__key;s&&i.anchor.set(t,e+2,"element"),l&&i.focus.set(t,e+2,"element")}return e}insertBefore(e,t=!0){mr(),fi(this,e);const n=this.getWritable(),r=e.getWritable(),o=r.__key;vo(r);const i=this.getPreviousSibling(),s=this.getParentOrThrow().getWritable(),l=n.__prev,a=this.getIndexWithinParent();null===i?s.__first=o:i.getWritable().__next=o,s.__size++,n.__prev=o,r.__prev=l,r.__next=n.__key,r.__parent=n.__parent;const c=Qn();return t&&Dn(c)&&tr(c,this.getParentOrThrow(),a),e}isParentRequired(){return!1}createParentElementNode(){return Qr()}selectStart(){return this.selectPrevious()}selectEnd(){return this.selectNext(0,0)}selectPrevious(e,t){mr();const n=this.getPreviousSibling(),r=this.getParentOrThrow();if(null===n)return r.select(0,0);if(Lr(n))return n.select();if(!Tn(n)){const e=n.getIndexWithinParent()+1;return r.select(e,e)}return n.select(e,t)}selectNext(e,t){mr();const n=this.getNextSibling(),r=this.getParentOrThrow();if(null===n)return r.select();if(Lr(n))return n.select(0,0);if(!Tn(n)){const e=n.getIndexWithinParent();return r.select(e,e)}return n.select(e,t)}markDirty(){this.getWritable()}reconcileObservedMutation(e,t){this.markDirty()}}class on extends rn{static getType(){return"linebreak"}static clone(e){return new on(e.__key)}constructor(e){super(e)}getTextContent(){return"\n"}createDOM(){return document.createElement("br")}updateDOM(){return!1}isInline(){return!0}static importDOM(){return{br:e=>function(e){const t=e.parentElement;if(null!==t&&xi(t)){const n=t.firstChild;if(n===e||n.nextSibling===e&&cn(n)){const n=t.lastChild;if(n===e||n.previousSibling===e&&cn(n))return!0}}return!1}(e)||function(e){const t=e.parentElement;if(null!==t&&xi(t)){const n=t.firstChild;if(n===e||n.nextSibling===e&&cn(n))return!1;const r=t.lastChild;if(r===e||r.previousSibling===e&&cn(r))return!0}return!1}(e)?null:{conversion:sn,priority:0}}}static importJSON(e){return ln().updateFromJSON(e)}}function sn(e){return{node:ln()}}function ln(){return gi(new on)}function an(e){return e instanceof on}function cn(e){return yo(e)&&/^( |\t|\r?\n)+$/.test(e.textContent||"")}function un(e,t){return 16&t?"code":128&t?"mark":32&t?"sub":64&t?"sup":null}function dn(e,t){return 1&t?"strong":2&t?"em":"span"}function gn(e,t,n,r,o){const i=r.classList;let s=qo(o,"base");void 0!==s&&i.add(...s),s=qo(o,"underlineStrikethrough");let l=!1;const a=8&t&&4&t;void 0!==s&&(8&n&&4&n?(l=!0,a||i.add(...s)):a&&i.remove(...s));for(const e in N){const r=N[e];if(s=qo(o,e),void 0!==s)if(n&r){if(l&&("underline"===e||"strikethrough"===e)){t&r&&i.remove(...s);continue}t&r&&(!a||"underline"!==e)&&"strikethrough"!==e||i.add(...s)}else t&r&&i.remove(...s)}}function fn(e,t,n){const r=t.firstChild,o=n.isComposing(),i=e+(o?w:"");if(null==r)t.textContent=i;else{const e=r.nodeValue;if(e!==i)if(o||s){const[t,n,o]=function(e,t){const n=e.length,r=t.length;let o=0,i=0;for(;o({conversion:Cn,priority:0}),b:()=>({conversion:yn,priority:0}),code:()=>({conversion:wn,priority:0}),em:()=>({conversion:wn,priority:0}),i:()=>({conversion:wn,priority:0}),mark:()=>({conversion:wn,priority:0}),s:()=>({conversion:wn,priority:0}),span:()=>({conversion:_n,priority:0}),strong:()=>({conversion:wn,priority:0}),sub:()=>({conversion:wn,priority:0}),sup:()=>({conversion:wn,priority:0}),u:()=>({conversion:wn,priority:0})}}static importJSON(e){return kn().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setTextContent(e.text).setFormat(e.format).setDetail(e.detail).setMode(e.mode).setStyle(e.style)}exportDOM(e){let{element:n}=super.exportDOM(e);return yi(n)||t(132),n.style.whiteSpace="pre-wrap",this.hasFormat("lowercase")?n.style.textTransform="lowercase":this.hasFormat("uppercase")?n.style.textTransform="uppercase":this.hasFormat("capitalize")&&(n.style.textTransform="capitalize"),this.hasFormat("bold")&&(n=pn(n,"b")),this.hasFormat("italic")&&(n=pn(n,"i")),this.hasFormat("strikethrough")&&(n=pn(n,"s")),this.hasFormat("underline")&&(n=pn(n,"u")),{element:n}}exportJSON(){return{detail:this.getDetail(),format:this.getFormat(),mode:this.getMode(),style:this.getStyle(),text:this.getTextContent(),...super.exportJSON()}}selectionTransform(e,t){}setFormat(e){const t=this.getWritable();return t.__format="string"==typeof e?N[e]:e,t}setDetail(e){const t=this.getWritable();return t.__detail="string"==typeof e?E[e]:e,t}setStyle(e){const t=this.getWritable();return t.__style=e,t}toggleFormat(e){const t=So(this.getFormat(),e,null);return this.setFormat(t)}toggleDirectionless(){const e=this.getWritable();return e.__detail^=1,e}toggleUnmergeable(){const e=this.getWritable();return e.__detail^=2,e}setMode(e){const t=O[e];if(this.__mode===t)return this;const n=this.getWritable();return n.__mode=t,n}setTextContent(e){if(this.__text===e)return this;const t=this.getWritable();return t.__text=e,t}select(e,t){mr();let n=e,r=t;const o=Qn(),i=this.getTextContent(),s=this.__key;if("string"==typeof i){const e=i.length;void 0===n&&(n=e),void 0===r&&(r=e)}else n=0,r=0;if(!Dn(o))return Gn(s,n,s,r,"text","text");{const e=To();e!==o.anchor.key&&e!==o.focus.key||ko(s),o.setTextNodeRange(this,n,this,r)}return o}selectStart(){return this.select(0,0)}selectEnd(){const e=this.getTextContentSize();return this.select(e,e)}spliceText(e,t,n,r){const o=this.getWritable(),i=o.__text,s=n.length;let l=e;l<0&&(l=s+l,l<0&&(l=0));const a=Qn();if(r&&Dn(a)){const t=e+s;a.setTextNodeRange(o,t,o,t)}const c=i.slice(0,l)+n+i.slice(l+t);return o.__text=c,o}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}splitText(...e){mr();const t=this.getLatest(),n=t.getTextContent();if(""===n)return[];const r=t.__key,o=To(),i=n.length;e.sort(((e,t)=>e-t)),e.push(i);const s=[],l=e.length;for(let t=0,r=0;tt&&(s.push(n.slice(t,o)),t=o)}const a=s.length;if(1===a)return[t];const c=s[0],u=t.getParent();let d;const g=t.getFormat(),f=t.getStyle(),h=t.__detail;let p=!1,m=null,_=null;const y=Qn();if(Dn(y)){const[e,t]=y.isBackward()?[y.focus,y.anchor]:[y.anchor,y.focus];"text"===e.type&&e.key===r&&(m=e),"text"===t.type&&t.key===r&&(_=t)}t.isSegmented()?(d=kn(c),d.__format=g,d.__style=f,d.__detail=h,d.__state=Z(t,d),p=!0):d=t.setTextContent(c);const b=[d];for(let e=1;e=x&&(m.set(e.getKey(),S-x,"text"),S=x){_.set(e.getKey(),C-x,"text");break}x=t}if(null!==u){!function(e){const t=e.getPreviousSibling(),n=e.getNextSibling();null!==t&&wo(t),null!==n&&wo(n)}(this);const e=u.getWritable(),t=this.getIndexWithinParent();p?(e.splice(t,0,b),this.remove()):e.splice(t,1,b),Dn(y)&&tr(y,u,t,a-1)}return b}mergeWithSibling(e){const n=e===this.getPreviousSibling();n||e===this.getNextSibling()||t(50);const r=this.__key,o=e.__key,i=this.__text,s=i.length;To()===o&&ko(r);const l=Qn();if(Dn(l)){const t=l.anchor,i=l.focus;null!==t&&t.key===o&&or(t,n,r,e,s),null!==i&&i.key===o&&or(i,n,r,e,s)}const a=e.__text,c=n?a+i:i+a;this.setTextContent(c);const u=this.getWritable();return e.remove(),u}isTextEntity(){return!1}}function _n(e){return{forChild:Nn(e.style),node:null}}function yn(e){const t=e,n="normal"===t.style.fontWeight;return{forChild:Nn(t.style,n?void 0:"bold"),node:null}}const bn=new WeakMap;function Sn(e){if(!yi(e))return!1;if("PRE"===e.nodeName)return!0;const t=e.style.whiteSpace;return"string"==typeof t&&t.startsWith("pre")}function Cn(e){const n=e;null===e.parentElement&&t(129);let r=n.textContent||"";if(null!==function(e){let t,n=e.parentNode;const r=[e];for(;null!==n&&void 0===(t=bn.get(n))&&!Sn(n);)r.push(n),n=n.parentNode;const o=void 0===t?n:t;for(let e=0;e0){/[ \t\n]$/.test(n)&&(r=r.slice(1)),t=!1;break}}t&&(r=r.slice(1))}if(" "===r[r.length-1]){let e=n,t=!0;for(;null!==e&&null!==(e=xn(e,!0));)if((e.textContent||"").replace(/^( |\t|\r?\n)+/,"").length>0){t=!1;break}t&&(r=r.slice(0,r.length-1))}return""===r?{node:null}:{node:kn(r)}}function xn(e,t){let n=e;for(;;){let e;for(;null===(e=t?n.nextSibling:n.previousSibling);){const e=n.parentElement;if(null===e)return null;n=e}if(n=e,yi(n)){const e=n.style.display;if(""===e&&!Ci(n)||""!==e&&!e.startsWith("inline"))return null}let r=n;for(;null!==(r=t?n.firstChild:n.lastChild);)n=r;if(yo(n))return n;if("BR"===n.nodeName)return null}}const vn={code:"code",em:"italic",i:"italic",mark:"highlight",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"};function wn(e){const t=vn[e.nodeName.toLowerCase()];return void 0===t?{node:null}:{forChild:Nn(e.style,t),node:null}}function kn(e=""){return gi(new mn(e))}function Tn(e){return e instanceof mn}function Nn(e,t){const n=e.fontWeight,r=e.textDecoration.split(" "),o="700"===n||"bold"===n,i=r.includes("line-through"),s="italic"===e.fontStyle,l=r.includes("underline"),a=e.verticalAlign;return e=>Tn(e)?(o&&!e.hasFormat("bold")&&e.toggleFormat("bold"),i&&!e.hasFormat("strikethrough")&&e.toggleFormat("strikethrough"),s&&!e.hasFormat("italic")&&e.toggleFormat("italic"),l&&!e.hasFormat("underline")&&e.toggleFormat("underline"),"sub"!==a||e.hasFormat("subscript")||e.toggleFormat("subscript"),"super"!==a||e.hasFormat("superscript")||e.toggleFormat("superscript"),t&&!e.hasFormat(t)&&e.toggleFormat(t),e):e}class En extends mn{static getType(){return"tab"}static clone(e){return new En(e.__key)}constructor(e){super("\t",e),this.__detail=2}static importDOM(){return null}createDOM(e){const t=super.createDOM(e),n=qo(e.theme,"tab");return void 0!==n&&t.classList.add(...n),t}static importJSON(e){return An().updateFromJSON(e)}setTextContent(e){return"\t"!==e&&""!==e&&n(126),super.setTextContent("\t")}spliceText(e,n,r,o){return""===r&&0===n||"\t"===r&&1===n||t(286),this}setDetail(e){return 2!==e&&t(127),this}setMode(e){return"normal"!==e&&t(128),this}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}}function An(){return gi(new En)}function Fn(e){return e instanceof En}class On{key;offset;type;_selection;constructor(e,t,n){this._selection=null,this.key=e,this.offset=t,this.type=n}is(e){return this.key===e.key&&this.offset===e.offset&&this.type===e.type}isBefore(e){return this.key===e.key?this.offsete&&(r=e)}else if(!Lr(t)){const e=t.getNextSibling();if(Tn(e))n=e.__key,r=0,o="text";else{const e=t.getParent();e&&(n=e.__key,r=t.getIndexWithinParent()+1)}}e.set(n,r,o)}function Mn(e,t){if(Lr(t)){const n=t.getLastDescendant();Lr(n)||Tn(n)?Rn(e,n):Rn(e,t)}else Rn(e,t)}class Ln{_nodes;_cachedNodes;dirty;constructor(e){this._cachedNodes=null,this._nodes=e,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){if(!Kn(e))return!1;const t=this._nodes,n=e._nodes;return t.size===n.size&&Array.from(t).every((e=>n.has(e)))}isCollapsed(){return!1}isBackward(){return!1}getStartEndPoints(){return null}add(e){this.dirty=!0,this._nodes.add(e),this._cachedNodes=null}delete(e){this.dirty=!0,this._nodes.delete(e),this._cachedNodes=null}clear(){this.dirty=!0,this._nodes.clear(),this._cachedNodes=null}has(e){return this._nodes.has(e)}clone(){return new Ln(new Set(this._nodes))}extract(){return this.getNodes()}insertRawText(e){}insertText(){}insertNodes(e){const t=this.getNodes(),n=t.length,r=t[n-1];let o;if(Tn(r))o=r.select();else{const e=r.getIndexWithinParent()+1;o=r.getParentOrThrow().select(e,e)}o.insertNodes(e);for(let e=0;e1;){const e=t[t.length-1];if(!Lr(e)||i.has(e)||e.isEmpty()||o.has(e))break;t.pop()}if(0===t.length&&e.isCollapsed()){const n=Ss(e.anchor),r=Ss(e.anchor.getFlipped()),o=e=>Wi(e)?e.origin:e.getNodeAtCaret(),i=o(n)||o(r)||(e.anchor.getNodeAtCaret()?n.origin:r.origin);t.push(i)}return t}(vs(ps(this),"next"));return pr()||(this._cachedNodes=t),t}setTextNodeRange(e,t,n,r){this.anchor.set(e.__key,t,"text"),this.focus.set(n.__key,r,"text")}getTextContent(){const e=this.getNodes();if(0===e.length)return"";const t=e[0],n=e[e.length-1],r=this.anchor,o=this.focus,i=r.isBefore(o),[s,l]=$n(this);let a="",c=!0;for(let u=0;u=0;e--){const t=i[e];if(t.is(g)||Lr(t)&&t.isParentOf(g))break;t.isAttached()&&(!s.has(t)||t.is(o)?h||m.insertAfter(t,!1):t.remove())}if(!h){let e=r,n=null;for(;null!==e;){const r=e.getChildren(),o=r.length;(0===o||r[o-1].is(n))&&(t.delete(e.__key),n=e),e=e.getParent()}}if(mo(g))if(a===f)g.select();else{const t=kn(e);t.select(),g.replace(t)}else g=g.spliceText(a,f-a,e,!0),""===g.getTextContent()?g.remove():g.isComposing()&&"text"===this.anchor.type&&(this.anchor.offset-=e.length);for(let e=1;e{n.forEach((n=>{if(Lr(n)){const r=n.getFormatFlags(e,t);n.setTextFormat(r)}}))},i=r.length;if(0===i)return this.toggleFormat(e),ko(null),void o(t);const s=this.anchor,l=this.focus,a=this.isBackward(),c=a?l:s,u=a?s:l;let d=0,g=r[0],f="element"===c.type?0:c.offset;if("text"===c.type&&f===g.getTextContentSize()&&(d=1,g=r[1],f=0),null==g)return;const h=g.getFormatFlags(e,t);o(h);const p=i-1;let m=r[p];const _="text"===u.type?u.offset:m.getTextContentSize();if(g.is(m)){if(f===_)return;if(_o(g)||0===f&&_===g.getTextContentSize())g.setFormat(h);else{const e=g.splitText(f,_),t=0===f?e[0]:e[1];t.setFormat(h),"text"===c.type&&c.set(t.__key,0,"text"),"text"===u.type&&u.set(t.__key,_-f,"text")}return void(this.format=h)}0===f||_o(g)||([,g]=g.splitText(f),f=0),g.setFormat(h);const y=m.getFormatFlags(e,h);_>0&&(_===m.getTextContentSize()||_o(m)||([m]=m.splitText(_)),m.setFormat(y));for(let t=d+1;t(Lr(e)||Kr(e))&&!e.isInline()))){Lr(r)||t(211,n.constructor.name,n.getType());const i=sr(this);return r.splice(i,0,e),void o.selectEnd()}const i=function(e){const t=Qr();let n=null;for(let r=0;r0){const e=i.getRangeAt(0),n=this.anchor.getNode(),o=$r(n)?n:function(e){let t=e.getParentOrThrow();for(;null!==t;){if(ui(t))return t;t=t.getParentOrThrow()}return t}(n);if(this.applyDOMRange(e),this.dirty=!0,!r){const n=this.getNodes(),r=[];let s=!1;for(let e=0;e0)if(t){const e=r[0];Lr(e)?e.selectStart():e.getParentOrThrow().selectStart()}else{const e=r[r.length-1];Lr(e)?e.selectEnd():e.getParentOrThrow().selectEnd()}i.anchorNode===e.startContainer&&i.anchorOffset===e.startOffset||function(e){const t=e.focus,n=e.anchor,r=n.key,o=n.offset,i=n.type;n.set(t.key,t.offset,t.type,!0),t.set(r,o,i,!0)}(this)}}"lineboundary"===n&&ar(this,e,t,n,"decorators")}forwardDeletion(e,t,n){if(!n&&("element"===e.type&&Lr(t)&&e.offset===t.getChildrenSize()||"text"===e.type&&e.offset===t.getTextContentSize())){const e=t.getParent(),n=t.getNextSibling()||(null===e?null:e.getNextSibling());if(Lr(n)&&n.isShadowRoot())return!0}return!1}deleteCharacter(e){const t=this.isCollapsed();if(this.isCollapsed()){const t=this.anchor;let n=t.getNode();if(this.forwardDeletion(t,n,e))return;const r=ns(ds(t,e?"previous":"next"));if(r.getTextSlices().every((e=>null===e||0===e.distance))){let e={type:"initial"};for(const t of r.iterNodeCarets("shadowRoot"))if(Hi(t))if(t.origin.isInline());else{if(t.origin.isShadowRoot()){if("merge-block"===e.type)break;if(Lr(r.anchor.origin)&&r.anchor.origin.isEmpty()){const e=Ss(t);hs(this,os(e,e)),r.anchor.origin.remove()}return}"merge-next-block"!==e.type&&"merge-block"!==e.type||(e={block:e.block,caret:t,type:"merge-block"})}else{if("merge-block"===e.type)break;if(Ui(t)){if(Lr(t.origin)){if(t.origin.isInline()){if(!t.origin.isParentOf(r.anchor.origin))break}else e={block:t.origin,type:"merge-next-block"};continue}if(Kr(t.origin)){if(t.origin.isIsolated());else if("merge-next-block"===e.type&&(t.origin.isKeyboardSelectable()||!t.origin.isInline())&&Lr(r.anchor.origin)&&r.anchor.origin.isEmpty()){r.anchor.origin.remove();const e=Zn();e.add(t.origin.getKey()),Lo(e)}else t.origin.remove();return}break}}if("merge-block"===e.type){const{caret:t,block:n}=e;return hs(this,os(!t.origin.isEmpty()&&n.isEmpty()?ms(Vi(n,t.direction)):r.anchor,t)),this.removeText()}}const o=this.focus;if(this.modify("extend",e,"character"),this.isCollapsed()){if(e&&0===t.offset&&Bn(this,t.getNode()))return}else{const r="text"===o.type?o.getNode():null;if(n="text"===t.type?t.getNode():null,null!==r&&r.isSegmented()){const t=o.offset,i=r.getTextContentSize();if(r.is(n)||e&&t!==i||!e&&0!==t)return void Un(r,e,t)}else if(null!==n&&n.isSegmented()){const o=t.offset,i=n.getTextContentSize();if(n.is(r)||e&&0!==o||!e&&o!==i)return void Un(n,e,o)}!function(e,t){const n=e.anchor,r=e.focus,o=n.getNode();if(o===r.getNode()&&"text"===n.type&&"text"===r.type){const e=n.offset,i=r.offset,s=e{try{const e=new RegExp("\\p{Emoji}","u"),t=e.test.bind(e);if(t("❤️")&&t("#️⃣")&&t("👍"))return t}catch(e){}return()=>!1})();function Un(e,t,n){const r=e,o=r.getTextContent().split(/(?=\s)/g),i=o.length;let s=0,l=0;for(let e=0;en||r){o.splice(e,1),r&&(l=void 0);break}}const a=o.join("").trim();""===a?r.remove():(r.setTextContent(a),r.select(l,l))}function Hn(e,n,r,o){let i,s=n;if(yi(e)){let l=!1;const a=e.childNodes,c=a.length,u=o._blockCursorElement;s===c&&(l=!0,s=c-1);let d=a[s],g=!1;if(d===u)d=a[s+1],g=!0;else if(null!==u){const t=u.parentNode;e===t&&n>Array.prototype.indexOf.call(t.children,u)&&s--}if(i=Do(d),Tn(i))s=qi(i,l?"next":"previous");else{let a=Do(e);if(null===a)return null;if(Lr(a)){const c=o.getElementByKey(a.getKey());null===c&&t(214);const u=a.getDOMSlot(c);[a,s]=u.resolveChildIndex(a,c,e,n),Lr(a)||t(215),l&&s>=a.getChildrenSize()&&(s=Math.max(0,a.getChildrenSize()-1));let d=a.getChildAtIndex(s);if(Lr(d)&&function(e,t,n){const r=e.getParent();return null===n||null===r||!r.canBeEmpty()||r!==n.getNode()}(d,0,r)){const e=l?d.getLastDescendant():d.getFirstDescendant();null===e?a=d:(d=e,a=Lr(d)?d:d.getParentOrThrow()),s=0}Tn(d)?(i=d,a=null,s=qi(d,l?"next":"previous")):d!==a&&l&&!g&&(Lr(a)||t(216),s=Math.min(a.getChildrenSize(),s+1))}else{const t=a.getIndexWithinParent();s=0===n&&Kr(a)&&Do(e)===a?t:t+1,a=a.getParentOrThrow()}if(Lr(a))return Pn(a.__key,s,"element")}}else i=Do(e);return Tn(i)?Pn(i.__key,qi(i,s,"clamp"),"text"):null}function Jn(e,t,n){const r=e.offset,o=e.getNode();if(0===r){const r=o.getPreviousSibling(),i=o.getParent();if(t){if((n||!t)&&null===r&&Lr(i)&&i.isInline()){const t=i.getPreviousSibling();Tn(t)&&e.set(t.__key,t.getTextContent().length,"text")}}else Lr(r)&&!n&&r.isInline()?e.set(r.__key,r.getChildrenSize(),"element"):Tn(r)&&e.set(r.__key,r.getTextContent().length,"text")}else if(r===o.getTextContent().length){const r=o.getNextSibling(),i=o.getParent();if(t&&Lr(r)&&r.isInline())e.set(r.__key,0,"element");else if((n||t)&&null===r&&Lr(i)&&i.isInline()&&!i.canInsertTextAfter()){const t=i.getNextSibling();Tn(t)&&e.set(t.__key,0,"text")}}}function jn(e,t,n){if("text"===e.type&&"text"===t.type){const r=e.isBefore(t),o=e.is(t);Jn(e,r,o),Jn(t,!r,o),o&&t.set(e.key,e.offset,e.type);const i=br();if(i.isComposing()&&i._compositionKey!==e.key&&Dn(n)){const r=n.anchor,o=n.focus;e.set(r.key,r.offset,r.type,!0),t.set(o.key,o.offset,o.type,!0)}}}function Yn(e,t,n,r,o,i){if(null===e||null===n||!go(o,e,n))return null;const s=Hn(e,t,Dn(i)?i.anchor:null,o);if(null===s)return null;const l=Hn(n,r,Dn(i)?i.focus:null,o);if(null===l)return null;if("element"===s.type&&"element"===l.type){const t=Do(e),r=Do(n);if(Kr(t)&&Kr(r))return null}return jn(s,l,i),[s,l]}function Vn(e){return Lr(e)&&!e.isInline()}function Gn(e,t,n,r,o,i){const s=yr(),l=new In(Pn(e,t,o),Pn(n,r,i),0,"");return l.dirty=!0,s._selection=l,l}function qn(){const e=Pn("root",0,"element"),t=Pn("root",0,"element");return new In(e,t,0,"")}function Zn(){return new Ln(new Set)}function Xn(e,t,n,r){const o=n._window;if(null===o)return null;const i=r||o.event,s=i?i.type:void 0,l="selectionchange"===s,a=!L&&(l||"beforeinput"===s||"compositionstart"===s||"compositionend"===s||"click"===s&&i&&3===i.detail||"drop"===s||void 0===s);let c,u,d,g;if(Dn(e)&&!a)return e.clone();if(null===t)return null;if(c=t.anchorNode,u=t.focusNode,d=t.anchorOffset,g=t.focusOffset,l&&Dn(e)&&!go(n,c,u))return e.clone();const f=Yn(c,d,u,g,n,e);if(null===f)return null;const[h,p]=f;return new In(h,p,Dn(e)?e.format:0,Dn(e)?e.style:"")}function Qn(){return yr()._selection}function er(){return br()._editorState._selection}function tr(e,t,n,r=1){const o=e.anchor,i=e.focus,s=o.getNode(),l=i.getNode();if(!t.is(s)&&!t.is(l))return;const a=t.__key;if(e.isCollapsed()){const t=o.offset;if(n<=t&&r>0||n0||n0||n=e,s=o?i.getChildAtIndex(e-1):i.getChildAtIndex(n);if(Tn(s)){let e=0;o&&(e=s.getTextContentSize()),t.set(s.__key,e,"text"),r.set(s.__key,e,"text")}}else{if(Lr(i)){const e=i.getChildrenSize(),r=n>=e,o=r?i.getChildAtIndex(e-1):i.getChildAtIndex(n);if(Tn(o)){let e=0;r&&(e=o.getTextContentSize()),t.set(o.__key,e,"text")}}if(Lr(s)){const e=s.getChildrenSize(),t=o>=e,n=t?s.getChildAtIndex(e-1):s.getChildAtIndex(o);if(Tn(n)){let e=0;t&&(e=n.getTextContentSize()),r.set(n.__key,e,"text")}}}}function rr(e,t,n,r,o){let i=null,s=0,l=null;null!==r?(i=r.__key,Tn(r)?(s=r.getTextContentSize(),l="text"):Lr(r)&&(s=r.getChildrenSize(),l="element")):null!==o&&(i=o.__key,Tn(o)?l="text":Lr(o)&&(l="element")),null!==i&&null!==l?e.set(i,s,l):(s=t.getIndexWithinParent(),-1===s&&(s=n.getChildrenSize()),e.set(n.__key,s,"element"))}function or(e,t,n,r,o){"text"===e.type?e.set(n,e.offset+(t?0:o),"text"):e.offset>r.getIndexWithinParent()&&e.set(e.key,e.offset-1,"element")}function ir(e,t,n,r,o){try{e.setBaseAndExtent(t,n,r,o)}catch(e){}}function sr(e){let n=e;e.isCollapsed()||n.removeText();const r=Qn();Dn(r)&&(n=r),Dn(n)||t(161);const o=n.anchor;let i=o.getNode(),s=o.offset;for(;!vi(i);){const e=i;if([i,s]=lr(i,s),e.is(i))break}return s}function lr(e,t){const n=e.getParent();if(!n){const e=Qr();return Ro().append(e),e.select(),[Ro(),0]}if(Tn(e)){const r=e.splitText(t);if(0===r.length)return[n,e.getIndexWithinParent()];const o=0===t?0:1;return[n,r[0].getIndexWithinParent()+o]}if(!Lr(e)||0===t)return[n,e.getIndexWithinParent()];const r=e.getChildAtIndex(t);if(r){const n=new In(Pn(e.__key,t,"element"),Pn(e.__key,t,"element"),0,""),o=e.insertNewAfter(n);o&&o.append(r,...r.getNextSiblings())}return[n,e.getIndexWithinParent()+1]}function ar(e,t,n,r,o="decorators-and-blocks"){if("move"===t&&"character"===r&&!e.isCollapsed()){const[t,r]=n===e.isBackward()?[e.focus,e.anchor]:[e.anchor,e.focus];return r.set(t.key,t.offset,t.type),!0}const i=ds(e.focus,n?"previous":"next"),s="lineboundary"===r,l="move"===t;let a=i,c="decorators-and-blocks"===o;if(!Cs(a)){for(const e of a){c=!1;const{origin:t}=e;if(!Kr(t)||t.isIsolated()||(a=e,!s||!t.isInline()))break}if(c)for(const e of ns(i).iterNodeCarets("extend"===t?"shadowRoot":"root")){if(Hi(e))e.origin.isInline()||(a=e);else{if(Lr(e.origin))continue;Kr(e.origin)&&!e.origin.isInline()&&(a=e)}break}}if(a===i)return!1;if(l&&!s&&Kr(a.origin)&&a.origin.isKeyboardSelectable()){const e=Zn();return e.add(a.origin.getKey()),Lo(e),!0}return a=Ss(a),l&&gs(e.anchor,a),gs(e.focus,a),c||!s}let cr=null,ur=null,dr=!1,gr=!1,fr=0;const hr={characterData:!0,childList:!0,subtree:!0};function pr(){return dr||null!==cr&&cr._readOnly}function mr(){dr&&t(13)}function _r(){fr>99&&t(14)}function yr(){return null===cr&&t(195,Sr()),cr}function br(){return null===ur&&t(196,Sr()),ur}function Sr(){let e=0;const t=new Set,n=no.version;if("undefined"!=typeof window)for(const r of document.querySelectorAll("[contenteditable]")){const o=po(r);if(fo(o))e++;else if(o){let e=String(o.constructor.version||"<0.17.1");e===n&&(e+=" (separately built, likely a bundler configuration issue)"),t.add(e)}}let r=` Detected on the page: ${e} compatible editor(s) with version ${n}`;return t.size&&(r+=` and incompatible editors with versions ${Array.from(t).join(", ")}`),r}function Cr(e,t,n){const r=t.__type,o=so(e,r);let i=n.get(r);void 0===i&&(i=Array.from(o.transforms),n.set(r,i));const s=i.length;for(let e=0;e0?r.getRangeAt(0):null;if(null!==e){let t;if(e instanceof Text){const n=document.createRange();n.selectNode(e),t=n.getBoundingClientRect()}else t=e.getBoundingClientRect();!function(e,t,n){const r=ii(n),o=li(r);if(null===r||null===o)return;let{top:i,bottom:s}=t,l=0,a=0,c=n;for(;null!==c;){const t=c===r.body;if(t)l=0,a=ai(e).innerHeight;else{const e=c.getBoundingClientRect();l=e.top,a=e.bottom}let n=0;if(ia&&(n=s-a),0!==n)if(t)o.scrollBy(0,n);else{const e=c.scrollTop;c.scrollTop+=n;const t=c.scrollTop-e;i-=t,s-=t}if(t)break;c=oi(c)}}(n,t,i)}}Lt=!0}}(s,l,e,C,b,r)}!function(e,t,n){let r=e._blockCursorElement;if(Dn(n)&&n.isCollapsed()&&"element"===n.anchor.type&&t.contains(document.activeElement)){const o=n.anchor,i=o.getNode(),s=o.offset;let l=!1,a=null;if(s===i.getChildrenSize())hi(i.getChildAtIndex(s-1))&&(l=!0);else{const t=i.getChildAtIndex(s);if(null!==t&&hi(t)){const n=t.getPreviousSibling();(null===n||hi(n))&&(l=!0,a=e.getElementByKey(t.__key))}}if(l){const n=e.getElementByKey(i.__key);return null===r&&(e._blockCursorElement=r=function(e){const t=e.theme,n=document.createElement("div");n.contentEditable="false",n.setAttribute("data-lexical-cursor","true");let r=t.blockCursor;if(void 0!==r){if("string"==typeof r){const e=h(r);r=t.blockCursor=e}void 0!==r&&n.classList.add(...r)}return n}(e._config)),t.style.caretColor="transparent",void(null===a?n.appendChild(r):n.insertBefore(r,a))}}null!==r&&pi(r,e,t)}(e,r,l)}finally{null!==f&&f.observe(r,hr),ur=d,cr=c}}null!==p&&function(e,t,n,r,o){const i=Array.from(e._listeners.mutation),s=i.length;for(let e=0;e0||u>0;){if(a>0){t._dirtyLeaves=new Set;for(const e of l){const r=o.get(e);Tn(r)&&r.isAttached()&&r.isSimpleText()&&!r.isUnmergeable()&&ee(r),void 0!==r&&xr(r,i)&&Cr(t,r,s),n.add(e)}if(l=t._dirtyLeaves,a=l.size,a>0){fr++;continue}}t._dirtyLeaves=new Set,t._dirtyElements=new Map,c.delete("root")&&c.set("root",!0);for(const e of c){const n=e[0],l=e[1];if(r.set(n,l),!l)continue;const a=o.get(n);void 0!==a&&xr(a,i)&&Cr(t,a,s)}l=t._dirtyLeaves,a=l.size,c=t._dirtyElements,u=c.size,fr++}t._dirtyLeaves=n,t._dirtyElements=r}(c,e),Ar(e),function(e,t,n,r){const o=e._nodeMap,i=t._nodeMap,s=[];for(const[e]of r){const t=i.get(e);void 0!==t&&(t.isAttached()||(Lr(t)&&M(t,e,o,i,s,r),o.has(e)||r.delete(e),s.push(e)))}for(const e of s)i.delete(e);for(const e of n){const t=i.get(e);void 0===t||t.isAttached()||(o.has(e)||n.delete(e),i.delete(e))}}(a,c,e._dirtyLeaves,e._dirtyElements)),o!==e._compositionKey&&(c._flushSync=!0);const i=c._selection;if(Dn(i)){const e=c._nodeMap,n=i.anchor.key,r=i.focus.key;void 0!==e.get(n)&&void 0!==e.get(r)||t(19)}else Kn(i)&&0===i._nodes.size&&(c._selection=null)}catch(t){return t instanceof Error&&e._onError(t),e._pendingEditorState=a,e._dirtyType=2,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements.clear(),void Nr(e)}finally{cr=d,dr=g,ur=f,e._updating=h,fr=0}const m=0!==e._dirtyType||e._deferred.length>0||function(e,t){const n=t.getEditorState()._selection,r=e._selection;if(null!==r){if(r.dirty||!r.is(n))return!0}else if(null!==n)return!0;return!1}(c,e);m?c._flushSync?(c._flushSync=!1,Nr(e)):u&&ao((()=>{Nr(e)})):(c._flushSync=!1,u&&(o.clear(),e._deferred=[],e._pendingEditorState=null))}function Or(e,t,n){ur===e&&void 0===n?t():Fr(e,t,n)}class Pr{element;before;after;constructor(e,t,n){this.element=e,this.before=t||null,this.after=n||null}withBefore(e){return new Pr(this.element,e,this.after)}withAfter(e){return new Pr(this.element,this.before,e)}withElement(e){return this.element===e?this:new Pr(e,this.before,this.after)}insertChild(e){const n=this.before||this.getManagedLineBreak();return null!==n&&n.parentElement!==this.element&&t(222),this.element.insertBefore(e,n),this}removeChild(e){return e.parentElement!==this.element&&t(223),this.element.removeChild(e),this}replaceChild(e,n){return n.parentElement!==this.element&&t(224),this.element.replaceChild(e,n),this}getFirstChild(){const e=this.after?this.after.nextSibling:this.element.firstChild;return e===this.before||e===this.getManagedLineBreak()?null:e}getManagedLineBreak(){return this.element.__lexicalLineBreak||null}setManagedLineBreak(e){if(null===e)this.removeManagedLineBreak();else{const t="decorator"===e&&(f||c||a);this.insertManagedLineBreak(t)}}removeManagedLineBreak(){const e=this.getManagedLineBreak();if(e){const t=this.element,n="IMG"===e.nodeName?e.nextSibling:null;n&&t.removeChild(n),t.removeChild(e),t.__lexicalLineBreak=void 0}}insertManagedLineBreak(e){const t=this.getManagedLineBreak();if(t){if(e===("IMG"===t.nodeName))return;this.removeManagedLineBreak()}const n=this.element,r=this.before,o=document.createElement("br");if(n.insertBefore(o,r),e){const e=document.createElement("img");e.setAttribute("data-lexical-linebreak","true"),e.style.cssText="display: inline !important; border: 0px !important; margin: 0px !important;",e.alt="",n.insertBefore(e,o),n.__lexicalLineBreak=e}else n.__lexicalLineBreak=o}getFirstChildOffset(){let e=0;for(let t=this.after;null!==t;t=t.previousSibling)e++;return e}resolveChildIndex(e,t,n,r){if(n===this.element){const t=this.getFirstChildOffset();return[e,Math.min(t+e.getChildrenSize(),Math.max(t,r))]}const o=Rr(t,n);o.push(r);const i=Rr(t,this.element);let s=e.getIndexWithinParent();for(let e=0;en){s+=1;break}}return[e.getParentOrThrow(),s]}}function Rr(e,n){const r=[];let o=n;for(;o!==e&&null!==o;o=o.parentNode){let e=0;for(let t=o.previousSibling;null!==t;t=t.previousSibling)e++;r.push(e)}return o!==e&&t(225),r.reverse()}class Mr extends rn{__first;__last;__size;__format;__style;__indent;__dir;__textFormat;__textStyle;constructor(e){super(e),this.__first=null,this.__last=null,this.__size=0,this.__format=0,this.__style="",this.__indent=0,this.__dir=null,this.__textFormat=0,this.__textStyle=""}afterCloneFrom(e){super.afterCloneFrom(e),this.__key===e.__key&&(this.__first=e.__first,this.__last=e.__last,this.__size=e.__size),this.__indent=e.__indent,this.__format=e.__format,this.__style=e.__style,this.__dir=e.__dir,this.__textFormat=e.__textFormat,this.__textStyle=e.__textStyle}getFormat(){return this.getLatest().__format}getFormatType(){const e=this.getFormat();return F[e]||""}getStyle(){return this.getLatest().__style}getIndent(){return this.getLatest().__indent}getChildren(){const e=[];let t=this.getFirstChild();for(;null!==t;)e.push(t),t=t.getNextSibling();return e}getChildrenKeys(){const e=[];let t=this.getFirstChild();for(;null!==t;)e.push(t.__key),t=t.getNextSibling();return e}getChildrenSize(){return this.getLatest().__size}isEmpty(){return 0===this.getChildrenSize()}isDirty(){const e=br()._dirtyElements;return null!==e&&e.has(this.__key)}isLastChild(){const e=this.getLatest(),t=this.getParentOrThrow().getLastChild();return null!==t&&t.is(e)}getAllTextNodes(){const e=[];let t=this.getFirstChild();for(;null!==t;){if(Tn(t)&&e.push(t),Lr(t)){const n=t.getAllTextNodes();e.push(...n)}t=t.getNextSibling()}return e}getFirstDescendant(){let e=this.getFirstChild();for(;Lr(e);){const t=e.getFirstChild();if(null===t)break;e=t}return e}getLastDescendant(){let e=this.getLastChild();for(;Lr(e);){const t=e.getLastChild();if(null===t)break;e=t}return e}getDescendantByIndex(e){const t=this.getChildren(),n=t.length;if(e>=n){const e=t[n-1];return Lr(e)&&e.getLastDescendant()||e||null}const r=t[e];return Lr(r)&&r.getFirstDescendant()||r||null}getFirstChild(){const e=this.getLatest().__first;return null===e?null:No(e)}getFirstChildOrThrow(){const e=this.getFirstChild();return null===e&&t(45,this.__key),e}getLastChild(){const e=this.getLatest().__last;return null===e?null:No(e)}getLastChildOrThrow(){const e=this.getLastChild();return null===e&&t(96,this.__key),e}getChildAtIndex(e){const t=this.getChildrenSize();let n,r;if(e=e;){if(r===e)return n;n=n.getPreviousSibling(),r--}return null}getTextContent(){let e="";const t=this.getChildren(),n=t.length;for(let r=0;re.remove())),e}append(...e){return this.splice(this.getChildrenSize(),0,e)}setDirection(e){const t=this.getWritable();return t.__dir=e,t}setFormat(e){return this.getWritable().__format=""!==e?A[e]:0,this}setStyle(e){return this.getWritable().__style=e||"",this}setTextFormat(e){const t=this.getWritable();return t.__textFormat=e,t}setTextStyle(e){const t=this.getWritable();return t.__textStyle=e,t}setIndent(e){return this.getWritable().__indent=e,this}splice(e,n,r){const o=r.length,i=this.getChildrenSize(),s=this.getWritable();e+n<=i||t(226,String(e),String(n),String(i));const l=s.__key,a=[],c=[],u=this.getChildAtIndex(e+n);let d=null,g=i-n+o;if(0!==e)if(e===i)d=this.getLastChild();else{const t=this.getChildAtIndex(e);null!==t&&(d=t.getPreviousSibling())}if(n>0){let e=null===d?this.getFirstChild():d.getNextSibling();for(let r=0;r0&&(t.style.paddingInlineStart=40*e+"px");const n=this.getDirection();n&&(t.dir=n)}return{element:t}}exportJSON(){const e={children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),...super.exportJSON()},t=this.getTextFormat(),n=this.getTextStyle();return 0!==t&&(e.textFormat=t),""!==n&&(e.textStyle=n),e}updateFromJSON(e){return super.updateFromJSON(e).setFormat(e.format).setIndent(e.indent).setDirection(e.direction).setTextFormat(e.textFormat||0).setTextStyle(e.textStyle||"")}insertNewAfter(e,t){return null}canIndent(){return!0}collapseAtStart(e){return!1}excludeFromCopy(e){return!1}canReplaceWith(e){return!0}canInsertAfter(e){return!0}canBeEmpty(){return!0}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}isInline(){return!1}isShadowRoot(){return!1}canMergeWith(e){return!1}extractWithChild(e,t,n){return!1}canMergeWhenEmpty(){return!1}reconcileObservedMutation(e,t){const n=this.getDOMSlot(e);let r=n.getFirstChild();for(let e=this.getFirstChild();e;e=e.getNextSibling()){const o=t.getElementByKey(e.getKey());null!==o&&(null==r?(n.insertChild(o),r=o):r!==o&&n.replaceChild(o,r),r=r.nextSibling)}}}function Lr(e){return e instanceof Mr}function Dr(e,t,n){let r=e.getNode();for(;r;){const e=r.__key;if(t.has(e)&&!n.has(e))return!0;r=r.getParent()}return!1}class Ir extends rn{decorate(e,t){return null}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}}function Kr(e){return e instanceof Ir}class zr extends Mr{__cachedText;static getType(){return"root"}static clone(){return new zr}constructor(){super("root"),this.__cachedText=null}getTopLevelElementOrThrow(){t(51)}getTextContent(){const e=this.__cachedText;return!pr()&&0!==br()._dirtyType||null===e?super.getTextContent():e}remove(){t(52)}replace(e){t(53)}insertBefore(e){t(54)}insertAfter(e){t(55)}updateDOM(e,t){return!1}splice(e,n,r){for(const e of r)Lr(e)||Kr(e)||t(282);return super.splice(e,n,r)}static importJSON(e){return Ro().updateFromJSON(e)}collapseAtStart(){return!0}}function $r(e){return e instanceof zr}function Br(e){return new Hr(new Map(e._nodeMap))}function Wr(){return new Hr(new Map([["root",new zr]]))}function Ur(e){const n=e.exportJSON(),r=e.constructor;if(n.type!==r.getType()&&t(130,r.name),Lr(e)){const o=n.children;Array.isArray(o)||t(59,r.name);const i=e.getChildren();for(let e=0;e({root:Ur(Ro())})))}}const Jr="historic",jr="history-merge",Yr="collaboration",Vr="skip-scroll-into-view",Gr="skip-dom-selection";class qr extends Mr{static getType(){return"artificial"}createDOM(e){return document.createElement("div")}}class Zr extends Mr{static getType(){return"paragraph"}static clone(e){return new Zr(e.__key)}createDOM(e){const t=document.createElement("p"),n=qo(e.theme,"paragraph");return void 0!==n&&t.classList.add(...n),t}updateDOM(e,t,n){return!1}static importDOM(){return{p:e=>({conversion:Xr,priority:0})}}exportDOM(e){const{element:t}=super.exportDOM(e);if(yi(t)){this.isEmpty()&&t.append(document.createElement("br"));const e=this.getFormatType();e&&(t.style.textAlign=e)}return{element:t}}static importJSON(e){return Qr().updateFromJSON(e)}exportJSON(){return{...super.exportJSON(),textFormat:this.getTextFormat(),textStyle:this.getTextStyle()}}insertNewAfter(e,t){const n=Qr();n.setTextFormat(e.format),n.setTextStyle(e.style);const r=this.getDirection();return n.setDirection(r),n.setFormat(this.getFormatType()),n.setStyle(this.getStyle()),this.insertAfter(n,t),n}collapseAtStart(){const e=this.getChildren();if(0===e.length||Tn(e[0])&&""===e[0].getTextContent().trim()){if(null!==this.getNextSibling())return this.selectNext(),this.remove(),!0;if(null!==this.getPreviousSibling())return this.selectPrevious(),this.remove(),!0}return!1}}function Xr(e){const t=Qr();return e.style&&(t.setFormat(e.style.textAlign),Ai(e,t)),{node:t}}function Qr(){return gi(new Zr)}function eo(e){return e instanceof Zr}function to(e,t,n,r){const o=e._keyToDOMMap;o.clear(),e._editorState=Wr(),e._pendingEditorState=r,e._compositionKey=null,e._dirtyType=0,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements.clear(),e._normalizedNodes=new Set,e._updateTags=new Set,e._updates=[],e._blockCursorElement=null;const i=e._observer;null!==i&&(i.disconnect(),e._observer=null),null!==t&&(t.textContent=""),null!==n&&(n.textContent="",o.set("root",n))}class no{static version;_headless;_parentEditor;_rootElement;_editorState;_pendingEditorState;_compositionKey;_deferred;_keyToDOMMap;_updates;_updating;_listeners;_commands;_nodes;_decorators;_pendingDecorators;_config;_dirtyType;_cloneNotNeeded;_dirtyLeaves;_dirtyElements;_normalizedNodes;_updateTags;_observer;_key;_onError;_htmlConversions;_window;_editable;_blockCursorElement;_createEditorArgs;constructor(e,t,n,r,o,i,s,l){this._createEditorArgs=l,this._parentEditor=t,this._rootElement=null,this._editorState=e,this._pendingEditorState=null,this._compositionKey=null,this._deferred=[],this._keyToDOMMap=new Map,this._updates=[],this._updating=!1,this._listeners={decorator:new Set,editable:new Set,mutation:new Map,root:new Set,textcontent:new Set,update:new Set},this._commands=new Map,this._config=r,this._nodes=n,this._decorators={},this._pendingDecorators=null,this._dirtyType=0,this._cloneNotNeeded=new Set,this._dirtyLeaves=new Set,this._dirtyElements=new Map,this._normalizedNodes=new Set,this._updateTags=new Set,this._observer=null,this._key=zo(),this._onError=o,this._htmlConversions=i,this._editable=s,this._headless=null!==t&&t._headless,this._window=null,this._blockCursorElement=null}isComposing(){return null!=this._compositionKey}registerUpdateListener(e){const t=this._listeners.update;return t.add(e),()=>{t.delete(e)}}registerEditableListener(e){const t=this._listeners.editable;return t.add(e),()=>{t.delete(e)}}registerDecoratorListener(e){const t=this._listeners.decorator;return t.add(e),()=>{t.delete(e)}}registerTextContentListener(e){const t=this._listeners.textcontent;return t.add(e),()=>{t.delete(e)}}registerRootListener(e){const t=this._listeners.root;return e(this._rootElement,null),t.add(e),()=>{e(null,this._rootElement),t.delete(e)}}registerCommand(e,n,r){void 0===r&&t(35);const o=this._commands;o.has(e)||o.set(e,[new Set,new Set,new Set,new Set,new Set]);const i=o.get(e);void 0===i&&t(36,String(e));const s=i[r];return s.add(n),()=>{s.delete(n),i.every((e=>0===e.size))&&o.delete(e)}}registerMutationListener(e,t,n){const r=this.resolveRegisteredNodeAfterReplacements(this.getRegisteredNode(e)).klass,o=this._listeners.mutation;let i=o.get(t);void 0===i&&(i=new Set,o.set(t,i)),i.add(r);const s=n&&n.skipInitialization;return void 0!==s&&s||this.initializeMutationListener(t,r),()=>{i.delete(r),0===i.size&&o.delete(t)}}getRegisteredNode(e){const n=this._nodes.get(e.getType());return void 0===n&&t(37,e.name),n}resolveRegisteredNodeAfterReplacements(e){for(;e.replaceWithKlass;)e=this.getRegisteredNode(e.replaceWithKlass);return e}initializeMutationListener(e,t){const n=this._editorState,r=Ni(n).get(t.getType());if(!r)return;const o=new Map;for(const e of r.keys())o.set(e,"created");o.size>0&&e(o,{dirtyLeaves:new Set,prevEditorState:n,updateTags:new Set(["registerMutationListener"])})}registerNodeTransformToKlass(e,t){const n=this.getRegisteredNode(e);return n.transforms.add(t),n}registerNodeTransform(e,t){const n=this.registerNodeTransformToKlass(e,t),r=[n],o=n.replaceWithKlass;if(null!=o){const e=this.registerNodeTransformToKlass(o,t);r.push(e)}return function(e,t){const n=Ni(e.getEditorState()),r=[];for(const e of t){const t=n.get(e);t&&r.push(t)}0!==r.length&&e.update((()=>{for(const e of r)for(const t of e.keys()){const e=No(t);e&&e.markDirty()}}),null===e._pendingEditorState?{tag:jr}:void 0)}(this,r.map((e=>e.klass.getType()))),()=>{r.forEach((e=>e.transforms.delete(t)))}}hasNode(e){return this._nodes.has(e.getType())}hasNodes(e){return e.every(this.hasNode.bind(this))}dispatchCommand(e,t){return ti(this,e,t)}getDecorators(){return this._decorators}getRootElement(){return this._rootElement}getKey(){return this._key}setRootElement(e){const t=this._rootElement;if(e!==t){const n=qo(this._config.theme,"root"),r=this._pendingEditorState||this._editorState;if(this._rootElement=e,to(this,t,e,r),null!==t&&(this._config.disableEvents||tn(t),null!=n&&t.classList.remove(...n)),null!==e){const t=li(e),r=e.style;r.userSelect="text",r.whiteSpace="pre-wrap",r.wordBreak="break-word",e.setAttribute("data-lexical-editor","true"),this._window=t,this._dirtyType=2,H(this),this._updateTags.add(jr),Nr(this),this._config.disableEvents||function(e,t){const n=e.ownerDocument,r=Mt.get(n);(void 0===r||r<1)&&n.addEventListener("selectionchange",Xt),Mt.set(n,(r||0)+1),e.__lexicalEditor=t;const o=qt(e);for(let n=0;n{en(e)||(Qt(e),(t.isEditable()||"click"===r)&&i(e,t))}:e=>{if(en(e))return;Qt(e);const n=t.isEditable();switch(r){case"cut":return n&&ti(t,bt,e);case"copy":return ti(t,yt,e);case"paste":return n&&ti(t,He,e);case"dragstart":return n&&ti(t,pt,e);case"dragover":return n&&ti(t,mt,e);case"dragend":return n&&ti(t,_t,e);case"focus":return n&&ti(t,kt,e);case"blur":return n&&ti(t,Tt,e);case"drop":return n&&ti(t,ft,e)}};e.addEventListener(r,s),o.push((()=>{e.removeEventListener(r,s)}))}}(e,this),null!=n&&e.classList.add(...n)}else this._window=null,this._updateTags.add(jr),Nr(this);Er("root",this,!1,e,t)}}getElementByKey(e){return this._keyToDOMMap.get(e)||null}getEditorState(){return this._editorState}setEditorState(e,n){e.isEmpty()&&t(38);let r=e;r._readOnly&&(r=Br(e),r._selection=e._selection?e._selection.clone():null),U(this);const o=this._pendingEditorState,i=this._updateTags,s=void 0!==n?n.tag:null;null===o||o.isEmpty()||(null!=s&&i.add(s),Nr(this)),this._pendingEditorState=r,this._dirtyType=2,this._dirtyElements.set("root",!1),this._compositionKey=null,null!=s&&i.add(s),this._updating||Nr(this)}parseEditorState(e,t){return function(e,t,n){const r=Wr(),o=cr,i=dr,s=ur,l=t._dirtyElements,a=t._dirtyLeaves,c=t._cloneNotNeeded,u=t._dirtyType;t._dirtyElements=new Map,t._dirtyLeaves=new Set,t._cloneNotNeeded=new Set,t._dirtyType=0,cr=r,dr=!1,ur=t,oo(null);try{const o=t._nodes;kr(e.root,o),n&&n(),r._readOnly=!0}catch(e){e instanceof Error&&t._onError(e)}finally{t._dirtyElements=l,t._dirtyLeaves=a,t._cloneNotNeeded=c,t._dirtyType=u,cr=o,dr=i,ur=s}return r}("string"==typeof e?JSON.parse(e):e,this,t)}read(e){return Nr(this),this.getEditorState().read(e,{editor:this})}update(e,t){!function(e,t,n){e._updating?e._updates.push([t,n]):Fr(e,t,n)}(this,e,t)}focus(e,t={}){const n=this._rootElement;null!==n&&(n.setAttribute("autocapitalize","off"),Or(this,(()=>{const r=Qn(),o=Ro();null!==r?r.dirty||Lo(r.clone()):0!==o.getChildrenSize()&&("rootStart"===t.defaultSelection?o.selectStart():o.selectEnd()),function(e){mr(),br()._updateTags.add(e)}("focus"),function(e){mr(),br()._deferred.push(e)}((()=>{n.removeAttribute("autocapitalize"),e&&e()}))})),null===this._pendingEditorState&&n.removeAttribute("autocapitalize"))}blur(){const e=this._rootElement;null!==e&&e.blur();const t=mi(this._window);null!==t&&t.removeAllRanges()}isEditable(){return this._editable}setEditable(e){this._editable!==e&&(this._editable=e,Er("editable",this,!0,e))}toJSON(){return{editorState:this._editorState.toJSON()}}}no.version="0.36.1+prod.esm";let ro=null;function oo(e){ro=e}let io=1;function so(e,n){const r=lo(e,n);return void 0===r&&t(30,n),r}function lo(e,t){return e._nodes.get(t)}const ao="function"==typeof queueMicrotask?queueMicrotask:e=>{Promise.resolve().then(e)};function co(e){return Kr(Fo(e))}function uo(e){const t=document.activeElement;if(!yi(t))return!1;const n=t.nodeName;return Kr(Fo(e))&&("INPUT"===n||"TEXTAREA"===n||"true"===t.contentEditable&&null==po(t))}function go(e,t,n){const r=e.getRootElement();try{return null!==r&&r.contains(t)&&r.contains(n)&&null!==t&&!uo(t)&&ho(t)===e}catch(e){return!1}}function fo(e){return e instanceof no}function ho(e){let t=e;for(;null!=t;){const e=po(t);if(fo(e))return e;t=oi(t)}return null}function po(e){return e?e.__lexicalEditor:null}function mo(e){return Fn(e)||e.isToken()}function _o(e){return mo(e)||e.isSegmented()}function yo(e){return bi(e)&&3===e.nodeType}function bo(e){let t=e;for(;null!=t;){if(yo(t))return t;t=t.firstChild}return null}function So(e,t,n){const r=N[t];if(null!==n&&(e&r)==(n&r))return e;let o=e^r;return"subscript"===t?o&=-65:"superscript"===t?o&=-33:"lowercase"===t?(o&=-513,o&=-1025):"uppercase"===t?(o&=-257,o&=-1025):"capitalize"===t&&(o&=-257,o&=-513),o}function Co(e){return Tn(e)||an(e)||Kr(e)}function xo(e,t){const n=function(){const e=ro;return ro=null,e}();if(null!=(t=t||n&&n.__key))return void(e.__key=t);mr(),_r();const r=br(),o=yr(),i=""+io++;o._nodeMap.set(i,e),Lr(e)?r._dirtyElements.set(i,!0):r._dirtyLeaves.add(i),r._cloneNotNeeded.add(i),r._dirtyType=1,e.__key=i}function vo(e){const t=e.getParent();if(null!==t){const n=e.getWritable(),r=t.getWritable(),o=e.getPreviousSibling(),i=e.getNextSibling(),s=null!==i?i.__key:null,l=null!==o?o.__key:null,a=null!==o?o.getWritable():null,c=null!==i?i.getWritable():null;null===o&&(r.__first=s),null===i&&(r.__last=l),null!==a&&(a.__next=s),null!==c&&(c.__prev=l),n.__prev=null,n.__next=null,n.__parent=null,r.__size--}}function wo(e){_r();const t=e.getLatest(),n=t.__parent,r=yr(),o=br(),i=r._nodeMap,s=o._dirtyElements;null!==n&&function(e,t,n){let r=e;for(;null!==r;){if(n.has(r))return;const e=t.get(r);if(void 0===e)break;n.set(r,!1),r=e.__parent}}(n,i,s);const l=t.__key;o._dirtyType=1,Lr(e)?s.set(l,!0):o._dirtyLeaves.add(l)}function ko(e){mr();const t=br(),n=t._compositionKey;if(e!==n){if(t._compositionKey=e,null!==n){const e=No(n);null!==e&&e.getWritable()}if(null!==e){const t=No(e);null!==t&&t.getWritable()}}}function To(){return pr()?null:br()._compositionKey}function No(e,t){const n=(t||yr())._nodeMap.get(e);return void 0===n?null:n}function Eo(e,t){const n=Ao(e,br());return void 0!==n?No(n,t):null}function Ao(e,t){return e[`__lexicalKey_${t._key}`]}function Fo(e,t){let n=e;for(;null!=n;){const e=Eo(n,t);if(null!==e)return e;n=oi(n)}return null}function Oo(e){const t=e._decorators,n=Object.assign({},t);return e._pendingDecorators=n,n}function Po(e){return e.read((()=>Ro().getTextContent()))}function Ro(){return Mo(yr())}function Mo(e){return e._nodeMap.get("root")}function Lo(e){mr();const t=yr();null!==e&&(e.dirty=!0,e.setCachedNodes(null)),t._selection=e}function Do(e){const t=br(),n=function(e,t){let n=e;for(;null!=n;){const e=Ao(n,t);if(void 0!==e)return e;n=oi(n)}return null}(e,t);return null===n?e===t.getRootElement()?No("root"):null:No(n)}function Io(e){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(e)}function Ko(e){const t=[];let n=e;for(;null!==n;)t.push(n),n=n._parentEditor;return t}function zo(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substring(0,5)}function $o(e){return yo(e)?e.nodeValue:null}function Bo(e,t,n){const r=mi(ai(t));if(null===r)return;const o=r.anchorNode;let{anchorOffset:i,focusOffset:s}=r;if(null!==o){let t=$o(o);const r=Fo(o);if(null!==t&&Tn(r)){if(t===w&&n){const e=n.length;t=n,i=e,s=e}null!==t&&Wo(r,t,i,s,e)}}}function Wo(e,t,n,r,o){let i=e;if(i.isAttached()&&(o||!i.isDirty())){const s=i.isComposing();let l=t;(s||o)&&t[t.length-1]===w&&(l=t.slice(0,-1));const u=i.getTextContent();if(o||l!==u){if(""===l){if(ko(null),a||c||f)i.remove();else{const e=br();setTimeout((()=>{e.update((()=>{i.isAttached()&&i.remove()}))}),20)}return}const t=i.getParent(),o=er(),u=i.getTextContentSize(),d=To(),g=i.getKey();if(i.isToken()||null!==d&&g===d&&!s||Dn(o)&&(null!==t&&!t.canInsertTextBefore()&&0===o.anchor.offset||o.anchor.key===e.__key&&0===o.anchor.offset&&!i.canInsertTextBefore()&&!s||o.focus.key===e.__key&&o.focus.offset===u&&!i.canInsertTextAfter()&&!s))return void i.markDirty();const h=Qn();if(!Dn(h)||null===n||null===r)return void Uo(i,l,h);if(h.setTextNodeRange(i,n,i,r),i.isSegmented()){const e=kn(i.getTextContent());i.replace(e),i=e}Uo(i,l,h)}}}function Uo(e,t,n){if(e.setTextContent(t),Dn(n)){const t=e.getKey();for(const r of["anchor","focus"]){const o=n[r];"text"===o.type&&o.key===t&&(o.offset=qi(e,o.offset,"clamp"))}}}function Ho(e,t,n){const r=t[n]||!1;return"any"===r||r===e[n]}function Jo(e,t,n){return function(e,t){return Ho(e,t,"altKey")&&Ho(e,t,"ctrlKey")&&Ho(e,t,"shiftKey")&&Ho(e,t,"metaKey")}(e,n)&&e.key.toLowerCase()===t.toLowerCase()}const jo={ctrlKey:!i,metaKey:i},Yo={altKey:i,ctrlKey:!i};function Vo(e){return"Backspace"===e.key}function Go(e){return Jo(e,"a",jo)}function qo(e,t){void 0===e.__lexicalClassNameCache&&(e.__lexicalClassNameCache={});const n=e.__lexicalClassNameCache,r=n[t];if(void 0!==r)return r;const o=e[t];if("string"==typeof o){const e=h(o);return n[t]=e,e}return o}function Zo(e,n,r,o,i){if(0===r.size)return;const s=o.__type,l=o.__key,a=n.get(s);void 0===a&&t(33,s);const c=a.klass;let u=e.get(c);void 0===u&&(u=new Map,e.set(c,u));const d=u.get(l),g="destroyed"===d&&"created"===i;(void 0===d||g)&&u.set(l,g?"updated":i)}function Xo(e,t,n){const r=e.getParent();let o=n,i=e;return null!==r&&(t&&0===n?(o=i.getIndexWithinParent(),i=r):t||n!==i.getChildrenSize()||(o=i.getIndexWithinParent()+1,i=r)),i.getChildAtIndex(t?o-1:o)}function Qo(e,t){const n=e.offset;if("element"===e.type)return Xo(e.getNode(),t,n);{const r=e.getNode();if(t&&0===n||!t&&n===r.getTextContentSize()){const e=t?r.getPreviousSibling():r.getNextSibling();return null===e?Xo(r.getParentOrThrow(),t,r.getIndexWithinParent()+(t?0:1)):e}}return null}function ei(e){const t=ai(e).event,n=t&&t.inputType;return"insertFromPaste"===n||"insertFromPasteAsQuotation"===n}function ti(e,t,n){return function(e,t,n){const r=Ko(e);for(let o=4;o>=0;o--)for(let i=0;i{for(let t=0;ts),Oi(e,"clone")||(e.clone=t=>(oo(t),new e)),Oi(e,"importJSON")||(e.importJSON=i&&i.$importJSON||(t=>(new e).updateFromJSON(t))),!Oi(e,"importDOM")&&i)){const{importDOM:t}=i;t&&(e.importDOM=()=>t)}return{ownNodeConfig:i,ownNodeType:s}}const Ri=(e,t)=>{let n=e;for(;null!=n&&!$r(n);){if(t(n))return n;n=n.getParent()}return null},Mi={next:"previous",previous:"next"};class Li{origin;constructor(e){this.origin=e}[Symbol.iterator](){return is({hasNext:Ui,initial:this.getAdjacentCaret(),map:e=>e,step:e=>e.getAdjacentCaret()})}getAdjacentCaret(){return Vi(this.getNodeAtCaret(),this.direction)}getSiblingCaret(){return Vi(this.origin,this.direction)}remove(){const e=this.getNodeAtCaret();return e&&e.remove(),this}replaceOrInsert(e,t){const n=this.getNodeAtCaret();return e.is(this.origin)||e.is(n)||(null===n?this.insert(e):n.replace(e,t)),this}splice(e,n,r="next"){const o=r===this.direction?n:Array.from(n).reverse();let i=this;const s=this.getParentAtCaret(),l=new Map;for(let t=i.getAdjacentCaret();null!==t&&l.size0){const n=i.getNodeAtCaret();if(n)if(l.delete(n.getKey()),l.delete(e.getKey()),n.is(e)||i.origin.is(e));else{const t=e.getParent();t&&t.is(s)&&e.remove(),n.replace(e)}else null===n&&t(263,Array.from(l).join(" "))}else i.insert(e);i=Vi(e,this.direction)}for(const e of l.values())e.remove();return this}}class Di extends Li{type="child";getLatest(){const e=this.origin.getLatest();return e===this.origin?this:Xi(e,this.direction)}getParentCaret(e="root"){return Vi(zi(this.getParentAtCaret(),e),this.direction)}getFlipped(){const e=Ki(this.direction);return Vi(this.getNodeAtCaret(),e)||Xi(this.origin,e)}getParentAtCaret(){return this.origin}getChildCaret(){return this}isSameNodeCaret(e){return e instanceof Di&&this.direction===e.direction&&this.origin.is(e.origin)}isSamePointCaret(e){return this.isSameNodeCaret(e)}}const Ii={root:$r,shadowRoot:ui};function Ki(e){return Mi[e]}function zi(e,t="root"){return Ii[t](e)?null:e}class $i extends Li{type="sibling";getLatest(){const e=this.origin.getLatest();return e===this.origin?this:Vi(e,this.direction)}getSiblingCaret(){return this}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return Lr(this.origin)?Xi(this.origin,this.direction):null}getParentCaret(e="root"){return Vi(zi(this.getParentAtCaret(),e),this.direction)}getFlipped(){const e=Ki(this.direction);return Vi(this.getNodeAtCaret(),e)||Xi(this.origin.getParentOrThrow(),e)}isSamePointCaret(e){return e instanceof $i&&this.direction===e.direction&&this.origin.is(e.origin)}isSameNodeCaret(e){return(e instanceof $i||e instanceof Bi)&&this.direction===e.direction&&this.origin.is(e.origin)}}class Bi extends Li{type="text";offset;constructor(e,t){super(e),this.offset=t}getLatest(){const e=this.origin.getLatest();return e===this.origin?this:Gi(e,this.direction,this.offset)}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return null}getParentCaret(e="root"){return Vi(zi(this.getParentAtCaret(),e),this.direction)}getFlipped(){return Gi(this.origin,Ki(this.direction),this.offset)}isSamePointCaret(e){return e instanceof Bi&&this.direction===e.direction&&this.origin.is(e.origin)&&this.offset===e.offset}isSameNodeCaret(e){return(e instanceof $i||e instanceof Bi)&&this.direction===e.direction&&this.origin.is(e.origin)}getSiblingCaret(){return Vi(this.origin,this.direction)}}function Wi(e){return e instanceof Bi}function Ui(e){return e instanceof $i}function Hi(e){return e instanceof Di}const Ji={next:class extends Bi{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(e){return this.origin.insertAfter(e),this}},previous:class extends Bi{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(e){return this.origin.insertBefore(e),this}}},ji={next:class extends $i{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(e){return this.origin.insertAfter(e),this}},previous:class extends $i{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(e){return this.origin.insertBefore(e),this}}},Yi={next:class extends Di{direction="next";getNodeAtCaret(){return this.origin.getFirstChild()}insert(e){return this.origin.splice(0,0,[e]),this}},previous:class extends Di{direction="previous";getNodeAtCaret(){return this.origin.getLastChild()}insert(e){return this.origin.splice(this.origin.getChildrenSize(),0,[e]),this}}};function Vi(e,t){return e?new ji[t](e):null}function Gi(e,t,n){return e?new Ji[t](e,qi(e,n)):null}function qi(e,t,r="error"){const o=e.getTextContentSize();let i="next"===t?o:"previous"===t?0:t;return(i<0||i>o)&&("clamp"!==r&&n(284,String(t),String(o),e.getKey()),i=i<0?0:o),i}function Zi(e,t){return new ts(e,t)}function Xi(e,t){return Lr(e)?new Yi[t](e):null}function Qi(e){return e&&function(e){return e&&e.getChildCaret()||e}(e.getAdjacentCaret())}class es{type="node-caret-range";direction;anchor;focus;constructor(e,t,n){this.anchor=e,this.focus=t,this.direction=n}getLatest(){const e=this.anchor.getLatest(),t=this.focus.getLatest();return e===this.anchor&&t===this.focus?this:new es(e,t,this.direction)}isCollapsed(){return this.anchor.isSamePointCaret(this.focus)}getTextSlices(){const e=e=>{const t=this[e].getLatest();return Wi(t)?function(e,t){const{direction:n,origin:r}=e;return Zi(e,qi(r,"focus"===t?Ki(n):n)-e.offset)}(t,e):null},t=e("anchor"),n=e("focus");if(t&&n){const{caret:e}=t,{caret:r}=n;if(e.isSameNodeCaret(r))return[Zi(e,r.offset-e.offset),null]}return[t,n]}iterNodeCarets(e="root"){const t=Wi(this.anchor)?this.anchor.getSiblingCaret():this.anchor.getLatest(),n=this.focus.getLatest(),r=Wi(n),o=t=>t.isSameNodeCaret(n)?null:Qi(t)||t.getParentCaret(e);return is({hasNext:e=>null!==e&&!(r&&n.isSameNodeCaret(e)),initial:t.isSameNodeCaret(n)?null:o(t),map:e=>e,step:o})}[Symbol.iterator](){return this.iterNodeCarets("root")}}class ts{type="slice";caret;distance;constructor(e,t){this.caret=e,this.distance=t}getSliceIndices(){const{distance:e,caret:{offset:t}}=this,n=t+e;return n{let n;for(let r=a;rn.has(e.getKey())&&vi(e)));return u&&d?[u,d]:null}(d,g,c);if(f){const[e,t]=f;Xi(e,"previous").splice(0,t.getChildren()),t.remove()}const h=[d,g,...l,...a].find(ys);if(h)return rs(xs(Ss(h),e.direction));t(269,JSON.stringify(l.map((e=>e.origin.__key))))}function Ss(e){const t=function(e){let t=e;for(;Hi(t);){const e=Qi(t);if(!Hi(e))break;t=e}return t}(e.getLatest()),{direction:n}=t;if(Tn(t.origin))return Wi(t)?t:Gi(t.origin,n,n);const r=t.getAdjacentCaret();return Ui(r)&&Tn(r.origin)?Gi(r.origin,n,Ki(n)):t}function Cs(e){return Wi(e)&&e.offset!==qi(e.origin,e.direction)}function xs(e,t){return e.direction===t?e:e.getFlipped()}function vs(e,t){return e.direction===t?e:os(xs(e.focus,t),xs(e.anchor,t))}function ws(e){const{origin:n,offset:r,direction:o}=e;if(r===qi(n,o))return e.getSiblingCaret();if(r===qi(n,Ki(o)))return ms(e.getSiblingCaret());const[i]=n.splitText(r);return Tn(i)||t(281),xs(Vi(i,"next"),o)}function ks(e,t){return!0}function Ts(e,{$copyElementNode:t=di,$splitTextPointCaretNext:n=ws,rootMode:r="shadowRoot",$shouldSplit:o=ks}={}){if(Wi(e))return n(e);const i=e.getParentCaret(r);if(i){const{origin:n}=i;if(Hi(e)&&(!n.canBeEmpty()||!o(n,"first")))return ms(i);const r=function(e){const t=[];for(let n=e.getAdjacentCaret();n;n=n.getAdjacentCaret())t.push(n.origin);return t}(e);(r.length>0||n.canBeEmpty()&&o(n,"last"))&&i.insert(t(n).splice(0,0,r))}return i}const Ns=new Map;function Es(e){const t={};if(!e)return t;const n=e.split(";");for(const e of n)if(""!==e){const[n,r]=e.split(/:([^]+)/);n&&r&&(t[n.trim()]=r.trim())}return t}function As(e){let t=Ns.get(e);return void 0===t&&(t=Es(e),Ns.set(e,t)),t}function Fs(e){const t=wi().getElementByKey(e.getKey());if(null===t)return null;const n=t.ownerDocument.defaultView;return null===n?null:n.getComputedStyle(t)}function Os(e){return Fs($r(e)?e:e.getParentOrThrow())}function Ps(e){const t=Os(e);return null!==t&&"rtl"===t.direction}function Rs(e,t){const n=e.getStartEndPoints();if(t.isSelected(e)&&!_o(t)&&null!==n){const[r,o]=n,i=e.isBackward(),s=r.getNode(),l=o.getNode(),a=t.is(s),c=t.is(l);if(a||c){const[n,r]=$n(e),o=s.is(l),a=t.is(i?l:s),c=t.is(i?s:l);let u,d=0;o?(d=n>r?r:n,u=n>r?n:r):a?(d=i?r:n,u=void 0):c&&(d=0,u=i?n:r),t.__text=t.__text.slice(d,u)}}return t}function Ms(e){const t=e.getStyle(),n=Es(t);Ns.set(t,n)}function Ls(e,t){const n=e.getFormatType(),r=e.getIndent();n!==t.getFormatType()&&t.setFormat(n),r!==t.getIndent()&&t.setIndent(r)}function Ds(e){const t=Is(e);return null!==t&&"vertical-rl"===t.writingMode}function Is(e){const t=e.anchor.getNode();return Lr(t)?Fs(t):Os(t)}function Ks(e,t){let n=Ds(e)?!t:t;zs(e)&&(n=!n);const r=ds(e.focus,n?"previous":"next");if(Cs(r))return!1;for(const e of ns(r)){if(Hi(e))return!e.origin.isInline();if(!Lr(e.origin)){if(Kr(e.origin))return!0;break}}return!1}function zs(e){const t=Is(e);return null!==t&&"rtl"===t.direction}function $s(e,t,n){const r=zs(e);let o;o=Ds(e)||r?!n:n,function(e,t,n,r){e.modify(t?"extend":"move",n,r)}(e,t,o,"character")}function Bs(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const e of t)r.append("v",e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}const Ws="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,Us=Ws&&"documentMode"in document?document.documentMode:null;function Hs(...e){const t=[];for(const n of e)if(n&&"string"==typeof n)for(const[e]of n.matchAll(/\S+/g))t.push(e);return t}function Js(...e){return()=>{for(let t=e.length-1;t>=0;t--)e[t]();e.length=0}}function js(e,...t){const n=Hs(...t);n.length>0&&e.classList.add(...n)}function Ys(e,...t){const n=Hs(...t);n.length>0&&e.classList.remove(...n)}function Vs(e){return e?e.getAdjacentCaret():null}function Gs(e,t){let n=e;for(;null!=n;){if(n instanceof t)return n;n=n.getParent()}return null}function qs(e,t){return null!==e&&Object.getPrototypeOf(e).constructor.name===t.name}function Zs(e,t){const n=[],r=Array.from(e).reverse();for(let e=r.pop();void 0!==e;e=r.pop())if(t(e))n.push(e);else if(Lr(e))for(const t of Xs(e))r.push(t);return n}function Xs(e){return function(e){return is({hasNext:Ui,initial:e.getAdjacentCaret(),map:e=>e.origin.getLatest(),step:e=>e.getAdjacentCaret()})}(Xi(e,"previous"))}Ws&&"InputEvent"in window&&!Us&&new window.InputEvent("input");var Qs={},el={get exports(){return Qs},set exports(e){Qs=e}};function tl(e,t){for(const n of e.childNodes){if(yi(n)&&n.tagName===t)return!0;tl(n,t)}return!1}!function(t){var n=function(e){var t=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,n=0,r={},o={manual:e.Prism&&e.Prism.manual,disableWorkerMessageHandler:e.Prism&&e.Prism.disableWorkerMessageHandler,util:{encode:function e(t){return t instanceof i?new i(t.type,e(t.content),t.alias):Array.isArray(t)?t.map(e):t.replace(/&/g,"&").replace(/=d.reach);v+=x.value.length,x=x.next){var w=x.value;if(t.length>e.length)return;if(!(w instanceof i)){var k,T=1;if(y){if(!(k=s(C,v,e,_))||k.index>=e.length)break;var N=k.index,E=k.index+k[0].length,A=v;for(A+=x.value.length;N>=A;)A+=(x=x.next).value.length;if(v=A-=x.value.length,x.value instanceof i)continue;for(var F=x;F!==t.tail&&(Ad.reach&&(d.reach=M);var L=x.prev;if(P&&(L=c(t,L,P),v+=P.length),u(t,L,T),x=c(t,L,new i(g,m?o.tokenize(O,m):O,b,O)),R&&c(t,x,R),T>1){var D={cause:g+","+h,reach:M};l(e,t,n,x.prev,v,D),d&&D.reach>d.reach&&(d.reach=D.reach)}}}}}}function a(){var e={value:null,prev:null,next:null},t={value:null,prev:e,next:null};e.next=t,this.head=e,this.tail=t,this.length=0}function c(e,t,n){var r=t.next,o={value:n,prev:t,next:r};return t.next=o,r.prev=o,e.length++,o}function u(e,t,n){for(var r=t.next,o=0;o"+i.content+""},!e.document)return e.addEventListener?(o.disableWorkerMessageHandler||e.addEventListener("message",(function(t){var n=JSON.parse(t.data),r=n.language,i=n.code,s=n.immediateClose;e.postMessage(o.highlight(i,o.languages[r],r)),s&&e.close()}),!1),o):o;var d=o.util.currentScript();function g(){o.manual||o.highlightAll()}if(d&&(o.filename=d.src,d.hasAttribute("data-manual")&&(o.manual=!0)),!o.manual){var f=document.readyState;"loading"===f||"interactive"===f&&d&&d.defer?document.addEventListener("DOMContentLoaded",g):window.requestAnimationFrame?window.requestAnimationFrame(g):window.setTimeout(g,16)}return o}("undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{});t.exports&&(t.exports=n),void 0!==e&&(e.Prism=n),n.languages.markup={comment:{pattern://,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern://i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},n.languages.markup.tag.inside["attr-value"].inside.entity=n.languages.markup.entity,n.languages.markup.doctype.inside["internal-subset"].inside=n.languages.markup,n.hooks.add("wrap",(function(e){"entity"===e.type&&(e.attributes.title=e.content.replace(/&/,"&"))})),Object.defineProperty(n.languages.markup.tag,"addInlined",{value:function(e,t){var r={};r["language-"+t]={pattern:/(^$)/i,lookbehind:!0,inside:n.languages[t]},r.cdata=/^$/i;var o={"included-cdata":{pattern://i,inside:r}};o["language-"+t]={pattern:/[\s\S]+/,inside:n.languages[t]};var i={};i[e]={pattern:RegExp(/(<__[^>]*>)(?:))*\]\]>|(?!)/.source.replace(/__/g,(function(){return e})),"i"),lookbehind:!0,greedy:!0,inside:o},n.languages.insertBefore("markup","cdata",i)}}),Object.defineProperty(n.languages.markup.tag,"addAttribute",{value:function(e,t){n.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+e+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[t,"language-"+t],inside:n.languages[t]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),n.languages.html=n.languages.markup,n.languages.mathml=n.languages.markup,n.languages.svg=n.languages.markup,n.languages.xml=n.languages.extend("markup",{}),n.languages.ssml=n.languages.xml,n.languages.atom=n.languages.xml,n.languages.rss=n.languages.xml,function(e){var t=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;e.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+t.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+t.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+t.source+"$"),alias:"url"}}},selector:{pattern:RegExp("(^|[{}\\s])[^{}\\s](?:[^{};\"'\\s]|\\s+(?![\\s{])|"+t.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:t,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},e.languages.css.atrule.inside.rest=e.languages.css;var n=e.languages.markup;n&&(n.tag.addInlined("style","css"),n.tag.addAttribute("style","css"))}(n),n.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/},n.languages.javascript=n.languages.extend("clike",{"class-name":[n.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),n.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,n.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:n.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:n.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:n.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:n.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:n.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),n.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:n.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}}),n.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),n.languages.markup&&(n.languages.markup.tag.addInlined("script","javascript"),n.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript")),n.languages.js=n.languages.javascript,function(){if(void 0!==n&&"undefined"!=typeof document){Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector);var e={js:"javascript",py:"python",rb:"ruby",ps1:"powershell",psm1:"powershell",sh:"bash",bat:"batch",h:"c",tex:"latex"},t="data-src-status",r="loading",o="loaded",i="pre[data-src]:not(["+t+'="'+o+'"]):not(['+t+'="'+r+'"])';n.hooks.add("before-highlightall",(function(e){e.selector+=", "+i})),n.hooks.add("before-sanity-check",(function(s){var l=s.element;if(l.matches(i)){s.code="",l.setAttribute(t,r);var a=l.appendChild(document.createElement("CODE"));a.textContent="Loading…";var c=l.getAttribute("data-src"),u=s.language;if("none"===u){var d=(/\.(\w+)$/.exec(c)||[,"none"])[1];u=e[d]||d}n.util.setLanguage(a,u),n.util.setLanguage(l,u);var g=n.plugins.autoloader;g&&g.loadLanguages(u),function(e,t,n){var r=new XMLHttpRequest;r.open("GET",e,!0),r.onreadystatechange=function(){4==r.readyState&&(r.status<400&&r.responseText?t(r.responseText):r.status>=400?n("✖ Error "+r.status+" while fetching file: "+r.statusText):n("✖ Error: File does not exist or is empty"))},r.send(null)}(c,(function(e){l.setAttribute(t,o);var r=function(e){var t=/^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(e||"");if(t){var n=Number(t[1]),r=t[2],o=t[3];return r?o?[n,Number(o)]:[n,void 0]:[n,n]}}(l.getAttribute("data-range"));if(r){var i=e.split(/\r\n?|\n/g),s=r[0],c=null==r[1]?i.length:r[1];s<0&&(s+=i.length),s=Math.max(0,Math.min(s-1,i.length)),c<0&&(c+=i.length),c=Math.max(0,Math.min(c,i.length)),e=i.slice(s,c).join("\n"),l.hasAttribute("data-start")||l.setAttribute("data-start",String(s+1))}a.textContent=e,n.highlightElement(a)}),(function(e){l.setAttribute(t,"failed"),a.textContent=e}))}})),n.plugins.fileHighlight={highlight:function(e){for(var t,r=(e||document).querySelectorAll(i),o=0;t=r[o++];)n.highlightElement(t)}};var s=!1;n.fileHighlight=function(){s||(console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead."),s=!0),n.plugins.fileHighlight.highlight.apply(this,arguments)}}}()}(el),Prism.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/},Prism.languages.javascript=Prism.languages.extend("clike",{"class-name":[Prism.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),Prism.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,Prism.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:Prism.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:Prism.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),Prism.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:Prism.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}}),Prism.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),Prism.languages.markup&&(Prism.languages.markup.tag.addInlined("script","javascript"),Prism.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript")),Prism.languages.js=Prism.languages.javascript,Prism.languages.markup={comment:{pattern://,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern://i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},Prism.languages.markup.tag.inside["attr-value"].inside.entity=Prism.languages.markup.entity,Prism.languages.markup.doctype.inside["internal-subset"].inside=Prism.languages.markup,Prism.hooks.add("wrap",(function(e){"entity"===e.type&&(e.attributes.title=e.content.replace(/&/,"&"))})),Object.defineProperty(Prism.languages.markup.tag,"addInlined",{value:function(e,t){var n={};n["language-"+t]={pattern:/(^$)/i,lookbehind:!0,inside:Prism.languages[t]},n.cdata=/^$/i;var r={"included-cdata":{pattern://i,inside:n}};r["language-"+t]={pattern:/[\s\S]+/,inside:Prism.languages[t]};var o={};o[e]={pattern:RegExp(/(<__[^>]*>)(?:))*\]\]>|(?!)/.source.replace(/__/g,(function(){return e})),"i"),lookbehind:!0,greedy:!0,inside:r},Prism.languages.insertBefore("markup","cdata",o)}}),Object.defineProperty(Prism.languages.markup.tag,"addAttribute",{value:function(e,t){Prism.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+e+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[t,"language-"+t],inside:Prism.languages[t]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),Prism.languages.html=Prism.languages.markup,Prism.languages.mathml=Prism.languages.markup,Prism.languages.svg=Prism.languages.markup,Prism.languages.xml=Prism.languages.extend("markup",{}),Prism.languages.ssml=Prism.languages.xml,Prism.languages.atom=Prism.languages.xml,Prism.languages.rss=Prism.languages.xml,function(e){var t=/(?:\\.|[^\\\n\r]|(?:\n|\r\n?)(?![\r\n]))/.source;function n(e){return e=e.replace(//g,(function(){return t})),RegExp(/((?:^|[^\\])(?:\\{2})*)/.source+"(?:"+e+")")}var r=/(?:\\.|``(?:[^`\r\n]|`(?!`))+``|`[^`\r\n]+`|[^\\|\r\n`])+/.source,o=/\|?__(?:\|__)+\|?(?:(?:\n|\r\n?)|(?![\s\S]))/.source.replace(/__/g,(function(){return r})),i=/\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)+\|?(?:\n|\r\n?)/.source;e.languages.markdown=e.languages.extend("markup",{}),e.languages.insertBefore("markdown","prolog",{"front-matter-block":{pattern:/(^(?:\s*[\r\n])?)---(?!.)[\s\S]*?[\r\n]---(?!.)/,lookbehind:!0,greedy:!0,inside:{punctuation:/^---|---$/,"front-matter":{pattern:/\S+(?:\s+\S+)*/,alias:["yaml","language-yaml"],inside:e.languages.yaml}}},blockquote:{pattern:/^>(?:[\t ]*>)*/m,alias:"punctuation"},table:{pattern:RegExp("^"+o+i+"(?:"+o+")*","m"),inside:{"table-data-rows":{pattern:RegExp("^("+o+i+")(?:"+o+")*$"),lookbehind:!0,inside:{"table-data":{pattern:RegExp(r),inside:e.languages.markdown},punctuation:/\|/}},"table-line":{pattern:RegExp("^("+o+")"+i+"$"),lookbehind:!0,inside:{punctuation:/\||:?-{3,}:?/}},"table-header-row":{pattern:RegExp("^"+o+"$"),inside:{"table-header":{pattern:RegExp(r),alias:"important",inside:e.languages.markdown},punctuation:/\|/}}}},code:[{pattern:/((?:^|\n)[ \t]*\n|(?:^|\r\n?)[ \t]*\r\n?)(?: {4}|\t).+(?:(?:\n|\r\n?)(?: {4}|\t).+)*/,lookbehind:!0,alias:"keyword"},{pattern:/^```[\s\S]*?^```$/m,greedy:!0,inside:{"code-block":{pattern:/^(```.*(?:\n|\r\n?))[\s\S]+?(?=(?:\n|\r\n?)^```$)/m,lookbehind:!0},"code-language":{pattern:/^(```).+/,lookbehind:!0},punctuation:/```/}}],title:[{pattern:/\S.*(?:\n|\r\n?)(?:==+|--+)(?=[ \t]*$)/m,alias:"important",inside:{punctuation:/==+$|--+$/}},{pattern:/(^\s*)#.+/m,lookbehind:!0,alias:"important",inside:{punctuation:/^#+|#+$/}}],hr:{pattern:/(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m,lookbehind:!0,alias:"punctuation"},list:{pattern:/(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,lookbehind:!0,alias:"punctuation"},"url-reference":{pattern:/!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,inside:{variable:{pattern:/^(!?\[)[^\]]+/,lookbehind:!0},string:/(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,punctuation:/^[\[\]!:]|[<>]/},alias:"url"},bold:{pattern:n(/\b__(?:(?!_)|_(?:(?!_))+_)+__\b|\*\*(?:(?!\*)|\*(?:(?!\*))+\*)+\*\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^..)[\s\S]+(?=..$)/,lookbehind:!0,inside:{}},punctuation:/\*\*|__/}},italic:{pattern:n(/\b_(?:(?!_)|__(?:(?!_))+__)+_\b|\*(?:(?!\*)|\*\*(?:(?!\*))+\*\*)+\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^.)[\s\S]+(?=.$)/,lookbehind:!0,inside:{}},punctuation:/[*_]/}},strike:{pattern:n(/(~~?)(?:(?!~))+\2/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^~~?)[\s\S]+(?=\1$)/,lookbehind:!0,inside:{}},punctuation:/~~?/}},"code-snippet":{pattern:/(^|[^\\`])(?:``[^`\r\n]+(?:`[^`\r\n]+)*``(?!`)|`[^`\r\n]+`(?!`))/,lookbehind:!0,greedy:!0,alias:["code","keyword"]},url:{pattern:n(/!?\[(?:(?!\]))+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)|[ \t]?\[(?:(?!\]))+\])/.source),lookbehind:!0,greedy:!0,inside:{operator:/^!/,content:{pattern:/(^\[)[^\]]+(?=\])/,lookbehind:!0,inside:{}},variable:{pattern:/(^\][ \t]?\[)[^\]]+(?=\]$)/,lookbehind:!0},url:{pattern:/(^\]\()[^\s)]+/,lookbehind:!0},string:{pattern:/(^[ \t]+)"(?:\\.|[^"\\])*"(?=\)$)/,lookbehind:!0}}}}),["url","bold","italic","strike"].forEach((function(t){["url","bold","italic","strike","code-snippet"].forEach((function(n){t!==n&&(e.languages.markdown[t].inside.content.inside[n]=e.languages.markdown[n])}))})),e.hooks.add("after-tokenize",(function(e){"markdown"!==e.language&&"md"!==e.language||function e(t){if(t&&"string"!=typeof t)for(var n=0,r=t.length;n",quot:'"'},a=String.fromCodePoint||String.fromCharCode;e.languages.md=e.languages.markdown}(Prism),Prism.languages.c=Prism.languages.extend("clike",{comment:{pattern:/\/\/(?:[^\r\n\\]|\\(?:\r\n?|\n|(?![\r\n])))*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},string:{pattern:/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,greedy:!0},"class-name":{pattern:/(\b(?:enum|struct)\s+(?:__attribute__\s*\(\([\s\S]*?\)\)\s*)?)\w+|\b[a-z]\w*_t\b/,lookbehind:!0},keyword:/\b(?:_Alignas|_Alignof|_Atomic|_Bool|_Complex|_Generic|_Imaginary|_Noreturn|_Static_assert|_Thread_local|__attribute__|asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|inline|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|typeof|union|unsigned|void|volatile|while)\b/,function:/\b[a-z_]\w*(?=\s*\()/i,number:/(?:\b0x(?:[\da-f]+(?:\.[\da-f]*)?|\.[\da-f]+)(?:p[+-]?\d+)?|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?)[ful]{0,4}/i,operator:/>>=?|<<=?|->|([-+&|:])\1|[?:~]|[-+*/%&|^!=<>]=?/}),Prism.languages.insertBefore("c","string",{char:{pattern:/'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n]){0,32}'/,greedy:!0}}),Prism.languages.insertBefore("c","string",{macro:{pattern:/(^[\t ]*)#\s*[a-z](?:[^\r\n\\/]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|\\(?:\r\n|[\s\S]))*/im,lookbehind:!0,greedy:!0,alias:"property",inside:{string:[{pattern:/^(#\s*include\s*)<[^>]+>/,lookbehind:!0},Prism.languages.c.string],char:Prism.languages.c.char,comment:Prism.languages.c.comment,"macro-name":[{pattern:/(^#\s*define\s+)\w+\b(?!\()/i,lookbehind:!0},{pattern:/(^#\s*define\s+)\w+\b(?=\()/i,lookbehind:!0,alias:"function"}],directive:{pattern:/^(#\s*)[a-z]+/,lookbehind:!0,alias:"keyword"},"directive-hash":/^#/,punctuation:/##|\\(?=[\r\n])/,expression:{pattern:/\S[\s\S]*/,inside:Prism.languages.c}}}}),Prism.languages.insertBefore("c","function",{constant:/\b(?:EOF|NULL|SEEK_CUR|SEEK_END|SEEK_SET|__DATE__|__FILE__|__LINE__|__TIMESTAMP__|__TIME__|__func__|stderr|stdin|stdout)\b/}),delete Prism.languages.c.boolean,function(e){var t=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;e.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+t.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+t.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+t.source+"$"),alias:"url"}}},selector:{pattern:RegExp("(^|[{}\\s])[^{}\\s](?:[^{};\"'\\s]|\\s+(?![\\s{])|"+t.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:t,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},e.languages.css.atrule.inside.rest=e.languages.css;var n=e.languages.markup;n&&(n.tag.addInlined("style","css"),n.tag.addAttribute("style","css"))}(Prism),Prism.languages.objectivec=Prism.languages.extend("c",{string:{pattern:/@?"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,greedy:!0},keyword:/\b(?:asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|in|inline|int|long|register|return|self|short|signed|sizeof|static|struct|super|switch|typedef|typeof|union|unsigned|void|volatile|while)\b|(?:@interface|@end|@implementation|@protocol|@class|@public|@protected|@private|@property|@try|@catch|@finally|@throw|@synthesize|@dynamic|@selector)\b/,operator:/-[->]?|\+\+?|!=?|<>?=?|==?|&&?|\|\|?|[~^%?*\/@]/}),delete Prism.languages.objectivec["class-name"],Prism.languages.objc=Prism.languages.objectivec,Prism.languages.sql={comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/,lookbehind:!0},variable:[{pattern:/@(["'`])(?:\\[\s\S]|(?!\1)[^\\])+\1/,greedy:!0},/@[\w.$]+/],string:{pattern:/(^|[^@\\])("|')(?:\\[\s\S]|(?!\2)[^\\]|\2\2)*\2/,greedy:!0,lookbehind:!0},identifier:{pattern:/(^|[^@\\])`(?:\\[\s\S]|[^`\\]|``)*`/,greedy:!0,lookbehind:!0,inside:{punctuation:/^`|`$/}},function:/\b(?:AVG|COUNT|FIRST|FORMAT|LAST|LCASE|LEN|MAX|MID|MIN|MOD|NOW|ROUND|SUM|UCASE)(?=\s*\()/i,keyword:/\b(?:ACTION|ADD|AFTER|ALGORITHM|ALL|ALTER|ANALYZE|ANY|APPLY|AS|ASC|AUTHORIZATION|AUTO_INCREMENT|BACKUP|BDB|BEGIN|BERKELEYDB|BIGINT|BINARY|BIT|BLOB|BOOL|BOOLEAN|BREAK|BROWSE|BTREE|BULK|BY|CALL|CASCADED?|CASE|CHAIN|CHAR(?:ACTER|SET)?|CHECK(?:POINT)?|CLOSE|CLUSTERED|COALESCE|COLLATE|COLUMNS?|COMMENT|COMMIT(?:TED)?|COMPUTE|CONNECT|CONSISTENT|CONSTRAINT|CONTAINS(?:TABLE)?|CONTINUE|CONVERT|CREATE|CROSS|CURRENT(?:_DATE|_TIME|_TIMESTAMP|_USER)?|CURSOR|CYCLE|DATA(?:BASES?)?|DATE(?:TIME)?|DAY|DBCC|DEALLOCATE|DEC|DECIMAL|DECLARE|DEFAULT|DEFINER|DELAYED|DELETE|DELIMITERS?|DENY|DESC|DESCRIBE|DETERMINISTIC|DISABLE|DISCARD|DISK|DISTINCT|DISTINCTROW|DISTRIBUTED|DO|DOUBLE|DROP|DUMMY|DUMP(?:FILE)?|DUPLICATE|ELSE(?:IF)?|ENABLE|ENCLOSED|END|ENGINE|ENUM|ERRLVL|ERRORS|ESCAPED?|EXCEPT|EXEC(?:UTE)?|EXISTS|EXIT|EXPLAIN|EXTENDED|FETCH|FIELDS|FILE|FILLFACTOR|FIRST|FIXED|FLOAT|FOLLOWING|FOR(?: EACH ROW)?|FORCE|FOREIGN|FREETEXT(?:TABLE)?|FROM|FULL|FUNCTION|GEOMETRY(?:COLLECTION)?|GLOBAL|GOTO|GRANT|GROUP|HANDLER|HASH|HAVING|HOLDLOCK|HOUR|IDENTITY(?:COL|_INSERT)?|IF|IGNORE|IMPORT|INDEX|INFILE|INNER|INNODB|INOUT|INSERT|INT|INTEGER|INTERSECT|INTERVAL|INTO|INVOKER|ISOLATION|ITERATE|JOIN|KEYS?|KILL|LANGUAGE|LAST|LEAVE|LEFT|LEVEL|LIMIT|LINENO|LINES|LINESTRING|LOAD|LOCAL|LOCK|LONG(?:BLOB|TEXT)|LOOP|MATCH(?:ED)?|MEDIUM(?:BLOB|INT|TEXT)|MERGE|MIDDLEINT|MINUTE|MODE|MODIFIES|MODIFY|MONTH|MULTI(?:LINESTRING|POINT|POLYGON)|NATIONAL|NATURAL|NCHAR|NEXT|NO|NONCLUSTERED|NULLIF|NUMERIC|OFF?|OFFSETS?|ON|OPEN(?:DATASOURCE|QUERY|ROWSET)?|OPTIMIZE|OPTION(?:ALLY)?|ORDER|OUT(?:ER|FILE)?|OVER|PARTIAL|PARTITION|PERCENT|PIVOT|PLAN|POINT|POLYGON|PRECEDING|PRECISION|PREPARE|PREV|PRIMARY|PRINT|PRIVILEGES|PROC(?:EDURE)?|PUBLIC|PURGE|QUICK|RAISERROR|READS?|REAL|RECONFIGURE|REFERENCES|RELEASE|RENAME|REPEAT(?:ABLE)?|REPLACE|REPLICATION|REQUIRE|RESIGNAL|RESTORE|RESTRICT|RETURN(?:ING|S)?|REVOKE|RIGHT|ROLLBACK|ROUTINE|ROW(?:COUNT|GUIDCOL|S)?|RTREE|RULE|SAVE(?:POINT)?|SCHEMA|SECOND|SELECT|SERIAL(?:IZABLE)?|SESSION(?:_USER)?|SET(?:USER)?|SHARE|SHOW|SHUTDOWN|SIMPLE|SMALLINT|SNAPSHOT|SOME|SONAME|SQL|START(?:ING)?|STATISTICS|STATUS|STRIPED|SYSTEM_USER|TABLES?|TABLESPACE|TEMP(?:ORARY|TABLE)?|TERMINATED|TEXT(?:SIZE)?|THEN|TIME(?:STAMP)?|TINY(?:BLOB|INT|TEXT)|TOP?|TRAN(?:SACTIONS?)?|TRIGGER|TRUNCATE|TSEQUAL|TYPES?|UNBOUNDED|UNCOMMITTED|UNDEFINED|UNION|UNIQUE|UNLOCK|UNPIVOT|UNSIGNED|UPDATE(?:TEXT)?|USAGE|USE|USER|USING|VALUES?|VAR(?:BINARY|CHAR|CHARACTER|YING)|VIEW|WAITFOR|WARNINGS|WHEN|WHERE|WHILE|WITH(?: ROLLUP|IN)?|WORK|WRITE(?:TEXT)?|YEAR)\b/i,boolean:/\b(?:FALSE|NULL|TRUE)\b/i,number:/\b0x[\da-f]+\b|\b\d+(?:\.\d*)?|\B\.\d+\b/i,operator:/[-+*\/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?|\b(?:AND|BETWEEN|DIV|ILIKE|IN|IS|LIKE|NOT|OR|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b/i,punctuation:/[;[\]()`,.]/},function(e){var t=e.languages.powershell={comment:[{pattern:/(^|[^`])<#[\s\S]*?#>/,lookbehind:!0},{pattern:/(^|[^`])#.*/,lookbehind:!0}],string:[{pattern:/"(?:`[\s\S]|[^`"])*"/,greedy:!0,inside:null},{pattern:/'(?:[^']|'')*'/,greedy:!0}],namespace:/\[[a-z](?:\[(?:\[[^\]]*\]|[^\[\]])*\]|[^\[\]])*\]/i,boolean:/\$(?:false|true)\b/i,variable:/\$\w+\b/,function:[/\b(?:Add|Approve|Assert|Backup|Block|Checkpoint|Clear|Close|Compare|Complete|Compress|Confirm|Connect|Convert|ConvertFrom|ConvertTo|Copy|Debug|Deny|Disable|Disconnect|Dismount|Edit|Enable|Enter|Exit|Expand|Export|Find|ForEach|Format|Get|Grant|Group|Hide|Import|Initialize|Install|Invoke|Join|Limit|Lock|Measure|Merge|Move|New|Open|Optimize|Out|Ping|Pop|Protect|Publish|Push|Read|Receive|Redo|Register|Remove|Rename|Repair|Request|Reset|Resize|Resolve|Restart|Restore|Resume|Revoke|Save|Search|Select|Send|Set|Show|Skip|Sort|Split|Start|Step|Stop|Submit|Suspend|Switch|Sync|Tee|Test|Trace|Unblock|Undo|Uninstall|Unlock|Unprotect|Unpublish|Unregister|Update|Use|Wait|Watch|Where|Write)-[a-z]+\b/i,/\b(?:ac|cat|chdir|clc|cli|clp|clv|compare|copy|cp|cpi|cpp|cvpa|dbp|del|diff|dir|ebp|echo|epal|epcsv|epsn|erase|fc|fl|ft|fw|gal|gbp|gc|gci|gcs|gdr|gi|gl|gm|gp|gps|group|gsv|gu|gv|gwmi|iex|ii|ipal|ipcsv|ipsn|irm|iwmi|iwr|kill|lp|ls|measure|mi|mount|move|mp|mv|nal|ndr|ni|nv|ogv|popd|ps|pushd|pwd|rbp|rd|rdr|ren|ri|rm|rmdir|rni|rnp|rp|rv|rvpa|rwmi|sal|saps|sasv|sbp|sc|select|set|shcm|si|sl|sleep|sls|sort|sp|spps|spsv|start|sv|swmi|tee|trcm|type|write)\b/i],keyword:/\b(?:Begin|Break|Catch|Class|Continue|Data|Define|Do|DynamicParam|Else|ElseIf|End|Exit|Filter|Finally|For|ForEach|From|Function|If|InlineScript|Parallel|Param|Process|Return|Sequence|Switch|Throw|Trap|Try|Until|Using|Var|While|Workflow)\b/i,operator:{pattern:/(^|\W)(?:!|-(?:b?(?:and|x?or)|as|(?:Not)?(?:Contains|In|Like|Match)|eq|ge|gt|is(?:Not)?|Join|le|lt|ne|not|Replace|sh[lr])\b|-[-=]?|\+[+=]?|[*\/%]=?)/i,lookbehind:!0},punctuation:/[|{}[\];(),.]/};t.string[0].inside={function:{pattern:/(^|[^`])\$\((?:\$\([^\r\n()]*\)|(?!\$\()[^\r\n)])*\)/,lookbehind:!0,inside:t},boolean:t.boolean,variable:t.variable}}(Prism),Prism.languages.python={comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0,greedy:!0},"string-interpolation":{pattern:/(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,greedy:!0,inside:{interpolation:{pattern:/((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,lookbehind:!0,inside:{"format-spec":{pattern:/(:)[^:(){}]+(?=\}$)/,lookbehind:!0},"conversion-option":{pattern:/![sra](?=[:}]$)/,alias:"punctuation"},rest:null}},string:/[\s\S]+/}},"triple-quoted-string":{pattern:/(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,greedy:!0,alias:"string"},string:{pattern:/(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,greedy:!0},function:{pattern:/((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,lookbehind:!0},"class-name":{pattern:/(\bclass\s+)\w+/i,lookbehind:!0},decorator:{pattern:/(^[\t ]*)@\w+(?:\.\w+)*/m,lookbehind:!0,alias:["annotation","punctuation"],inside:{punctuation:/\./}},keyword:/\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,builtin:/\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,boolean:/\b(?:False|None|True)\b/,number:/\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,operator:/[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,punctuation:/[{}[\];(),.:]/},Prism.languages.python["string-interpolation"].inside.interpolation.inside.rest=Prism.languages.python,Prism.languages.py=Prism.languages.python,function(e){for(var t=/\/\*(?:[^*/]|\*(?!\/)|\/(?!\*)|)*\*\//.source,n=0;n<2;n++)t=t.replace(//g,(function(){return t}));t=t.replace(//g,(function(){return/[^\s\S]/.source})),e.languages.rust={comment:[{pattern:RegExp(/(^|[^\\])/.source+t),lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/b?"(?:\\[\s\S]|[^\\"])*"|b?r(#*)"(?:[^"]|"(?!\1))*"\1/,greedy:!0},char:{pattern:/b?'(?:\\(?:x[0-7][\da-fA-F]|u\{(?:[\da-fA-F]_*){1,6}\}|.)|[^\\\r\n\t'])'/,greedy:!0},attribute:{pattern:/#!?\[(?:[^\[\]"]|"(?:\\[\s\S]|[^\\"])*")*\]/,greedy:!0,alias:"attr-name",inside:{string:null}},"closure-params":{pattern:/([=(,:]\s*|\bmove\s*)\|[^|]*\||\|[^|]*\|(?=\s*(?:\{|->))/,lookbehind:!0,greedy:!0,inside:{"closure-punctuation":{pattern:/^\||\|$/,alias:"punctuation"},rest:null}},"lifetime-annotation":{pattern:/'\w+/,alias:"symbol"},"fragment-specifier":{pattern:/(\$\w+:)[a-z]+/,lookbehind:!0,alias:"punctuation"},variable:/\$\w+/,"function-definition":{pattern:/(\bfn\s+)\w+/,lookbehind:!0,alias:"function"},"type-definition":{pattern:/(\b(?:enum|struct|trait|type|union)\s+)\w+/,lookbehind:!0,alias:"class-name"},"module-declaration":[{pattern:/(\b(?:crate|mod)\s+)[a-z][a-z_\d]*/,lookbehind:!0,alias:"namespace"},{pattern:/(\b(?:crate|self|super)\s*)::\s*[a-z][a-z_\d]*\b(?:\s*::(?:\s*[a-z][a-z_\d]*\s*::)*)?/,lookbehind:!0,alias:"namespace",inside:{punctuation:/::/}}],keyword:[/\b(?:Self|abstract|as|async|await|become|box|break|const|continue|crate|do|dyn|else|enum|extern|final|fn|for|if|impl|in|let|loop|macro|match|mod|move|mut|override|priv|pub|ref|return|self|static|struct|super|trait|try|type|typeof|union|unsafe|unsized|use|virtual|where|while|yield)\b/,/\b(?:bool|char|f(?:32|64)|[ui](?:8|16|32|64|128|size)|str)\b/],function:/\b[a-z_]\w*(?=\s*(?:::\s*<|\())/,macro:{pattern:/\b\w+!/,alias:"property"},constant:/\b[A-Z_][A-Z_\d]+\b/,"class-name":/\b[A-Z]\w*\b/,namespace:{pattern:/(?:\b[a-z][a-z_\d]*\s*::\s*)*\b[a-z][a-z_\d]*\s*::(?!\s*<)/,inside:{punctuation:/::/}},number:/\b(?:0x[\dA-Fa-f](?:_?[\dA-Fa-f])*|0o[0-7](?:_?[0-7])*|0b[01](?:_?[01])*|(?:(?:\d(?:_?\d)*)?\.)?\d(?:_?\d)*(?:[Ee][+-]?\d+)?)(?:_?(?:f32|f64|[iu](?:8|16|32|64|size)?))?\b/,boolean:/\b(?:false|true)\b/,punctuation:/->|\.\.=|\.{1,3}|::|[{}[\];(),:]/,operator:/[-+*\/%!^]=?|=[=>]?|&[&=]?|\|[|=]?|<>?=?|[@?]/},e.languages.rust["closure-params"].inside.rest=e.languages.rust,e.languages.rust.attribute.inside.string=e.languages.rust.string}(Prism),Prism.languages.swift={comment:{pattern:/(^|[^\\:])(?:\/\/.*|\/\*(?:[^/*]|\/(?!\*)|\*(?!\/)|\/\*(?:[^*]|\*(?!\/))*\*\/)*\*\/)/,lookbehind:!0,greedy:!0},"string-literal":[{pattern:RegExp(/(^|[^"#])/.source+"(?:"+/"(?:\\(?:\((?:[^()]|\([^()]*\))*\)|\r\n|[^(])|[^\\\r\n"])*"/.source+"|"+/"""(?:\\(?:\((?:[^()]|\([^()]*\))*\)|[^(])|[^\\"]|"(?!""))*"""/.source+")"+/(?!["#])/.source),lookbehind:!0,greedy:!0,inside:{interpolation:{pattern:/(\\\()(?:[^()]|\([^()]*\))*(?=\))/,lookbehind:!0,inside:null},"interpolation-punctuation":{pattern:/^\)|\\\($/,alias:"punctuation"},punctuation:/\\(?=[\r\n])/,string:/[\s\S]+/}},{pattern:RegExp(/(^|[^"#])(#+)/.source+"(?:"+/"(?:\\(?:#+\((?:[^()]|\([^()]*\))*\)|\r\n|[^#])|[^\\\r\n])*?"/.source+"|"+/"""(?:\\(?:#+\((?:[^()]|\([^()]*\))*\)|[^#])|[^\\])*?"""/.source+")\\2"),lookbehind:!0,greedy:!0,inside:{interpolation:{pattern:/(\\#+\()(?:[^()]|\([^()]*\))*(?=\))/,lookbehind:!0,inside:null},"interpolation-punctuation":{pattern:/^\)|\\#+\($/,alias:"punctuation"},string:/[\s\S]+/}}],directive:{pattern:RegExp(/#/.source+"(?:"+/(?:elseif|if)\b/.source+"(?:[ \t]*"+/(?:![ \t]*)?(?:\b\w+\b(?:[ \t]*\((?:[^()]|\([^()]*\))*\))?|\((?:[^()]|\([^()]*\))*\))(?:[ \t]*(?:&&|\|\|))?/.source+")+|"+/(?:else|endif)\b/.source+")"),alias:"property",inside:{"directive-name":/^#\w+/,boolean:/\b(?:false|true)\b/,number:/\b\d+(?:\.\d+)*\b/,operator:/!|&&|\|\||[<>]=?/,punctuation:/[(),]/}},literal:{pattern:/#(?:colorLiteral|column|dsohandle|file(?:ID|Literal|Path)?|function|imageLiteral|line)\b/,alias:"constant"},"other-directive":{pattern:/#\w+\b/,alias:"property"},attribute:{pattern:/@\w+/,alias:"atrule"},"function-definition":{pattern:/(\bfunc\s+)\w+/,lookbehind:!0,alias:"function"},label:{pattern:/\b(break|continue)\s+\w+|\b[a-zA-Z_]\w*(?=\s*:\s*(?:for|repeat|while)\b)/,lookbehind:!0,alias:"important"},keyword:/\b(?:Any|Protocol|Self|Type|actor|as|assignment|associatedtype|associativity|async|await|break|case|catch|class|continue|convenience|default|defer|deinit|didSet|do|dynamic|else|enum|extension|fallthrough|fileprivate|final|for|func|get|guard|higherThan|if|import|in|indirect|infix|init|inout|internal|is|isolated|lazy|left|let|lowerThan|mutating|none|nonisolated|nonmutating|open|operator|optional|override|postfix|precedencegroup|prefix|private|protocol|public|repeat|required|rethrows|return|right|safe|self|set|some|static|struct|subscript|super|switch|throw|throws|try|typealias|unowned|unsafe|var|weak|where|while|willSet)\b/,boolean:/\b(?:false|true)\b/,nil:{pattern:/\bnil\b/,alias:"constant"},"short-argument":/\$\d+\b/,omit:{pattern:/\b_\b/,alias:"keyword"},number:/\b(?:[\d_]+(?:\.[\de_]+)?|0x[a-f0-9_]+(?:\.[a-f0-9p_]+)?|0b[01_]+|0o[0-7_]+)\b/i,"class-name":/\b[A-Z](?:[A-Z_\d]*[a-z]\w*)?\b/,function:/\b[a-z_]\w*(?=\s*\()/i,constant:/\b(?:[A-Z_]{2,}|k[A-Z][A-Za-z_]+)\b/,operator:/[-+*/%=!<>&|^~?]+|\.[.\-+*/%=!<>&|^~?]+/,punctuation:/[{}[\]();,.:\\]/},Prism.languages.swift["string-literal"].forEach((function(e){e.inside.interpolation.inside=Prism.languages.swift})),function(e){e.languages.typescript=e.languages.extend("javascript",{"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|type)\s+)(?!keyof\b)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?:\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>)?/,lookbehind:!0,greedy:!0,inside:null},builtin:/\b(?:Array|Function|Promise|any|boolean|console|never|number|string|symbol|unknown)\b/}),e.languages.typescript.keyword.push(/\b(?:abstract|declare|is|keyof|readonly|require)\b/,/\b(?:asserts|infer|interface|module|namespace|type)\b(?=\s*(?:[{_$a-zA-Z\xA0-\uFFFF]|$))/,/\btype\b(?=\s*(?:[\{*]|$))/),delete e.languages.typescript.parameter,delete e.languages.typescript["literal-property"];var t=e.languages.extend("typescript",{});delete t["class-name"],e.languages.typescript["class-name"].inside=t,e.languages.insertBefore("typescript","function",{decorator:{pattern:/@[$\w\xA0-\uFFFF]+/,inside:{at:{pattern:/^@/,alias:"operator"},function:/^[\s\S]+/}},"generic-function":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>(?=\s*\()/,greedy:!0,inside:{function:/^#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:t}}}}),e.languages.ts=e.languages.typescript}(Prism),function(e){var t=/\b(?:abstract|assert|boolean|break|byte|case|catch|char|class|const|continue|default|do|double|else|enum|exports|extends|final|finally|float|for|goto|if|implements|import|instanceof|int|interface|long|module|native|new|non-sealed|null|open|opens|package|permits|private|protected|provides|public|record(?!\s*[(){}[\]<>=%~.:,;?+\-*/&|^])|requires|return|sealed|short|static|strictfp|super|switch|synchronized|this|throw|throws|to|transient|transitive|try|uses|var|void|volatile|while|with|yield)\b/,n=/(?:[a-z]\w*\s*\.\s*)*(?:[A-Z]\w*\s*\.\s*)*/.source,r={pattern:RegExp(/(^|[^\w.])/.source+n+/[A-Z](?:[\d_A-Z]*[a-z]\w*)?\b/.source),lookbehind:!0,inside:{namespace:{pattern:/^[a-z]\w*(?:\s*\.\s*[a-z]\w*)*(?:\s*\.)?/,inside:{punctuation:/\./}},punctuation:/\./}};e.languages.java=e.languages.extend("clike",{string:{pattern:/(^|[^\\])"(?:\\.|[^"\\\r\n])*"/,lookbehind:!0,greedy:!0},"class-name":[r,{pattern:RegExp(/(^|[^\w.])/.source+n+/[A-Z]\w*(?=\s+\w+\s*[;,=()]|\s*(?:\[[\s,]*\]\s*)?::\s*new\b)/.source),lookbehind:!0,inside:r.inside},{pattern:RegExp(/(\b(?:class|enum|extends|implements|instanceof|interface|new|record|throws)\s+)/.source+n+/[A-Z]\w*\b/.source),lookbehind:!0,inside:r.inside}],keyword:t,function:[e.languages.clike.function,{pattern:/(::\s*)[a-z_]\w*/,lookbehind:!0}],number:/\b0b[01][01_]*L?\b|\b0x(?:\.[\da-f_p+-]+|[\da-f_]+(?:\.[\da-f_p+-]+)?)\b|(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?\d[\d_]*)?[dfl]?/i,operator:{pattern:/(^|[^.])(?:<<=?|>>>?=?|->|--|\+\+|&&|\|\||::|[?:~]|[-+*/%&|^!=<>]=?)/m,lookbehind:!0},constant:/\b[A-Z][A-Z_\d]+\b/}),e.languages.insertBefore("java","string",{"triple-quoted-string":{pattern:/"""[ \t]*[\r\n](?:(?:"|"")?(?:\\.|[^"\\]))*"""/,greedy:!0,alias:"string"},char:{pattern:/'(?:\\.|[^'\\\r\n]){1,6}'/,greedy:!0}}),e.languages.insertBefore("java","class-name",{annotation:{pattern:/(^|[^.])@\w+(?:\s*\.\s*\w+)*/,lookbehind:!0,alias:"punctuation"},generics:{pattern:/<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&))*>)*>)*>)*>/,inside:{"class-name":r,keyword:t,punctuation:/[<>(),.:]/,operator:/[?&|]/}},import:[{pattern:RegExp(/(\bimport\s+)/.source+n+/(?:[A-Z]\w*|\*)(?=\s*;)/.source),lookbehind:!0,inside:{namespace:r.inside.namespace,punctuation:/\./,operator:/\*/,"class-name":/\w+/}},{pattern:RegExp(/(\bimport\s+static\s+)/.source+n+/(?:\w+|\*)(?=\s*;)/.source),lookbehind:!0,alias:"static",inside:{namespace:r.inside.namespace,static:/\b\w+$/,punctuation:/\./,operator:/\*/,"class-name":/\w+/}}],namespace:{pattern:RegExp(/(\b(?:exports|import(?:\s+static)?|module|open|opens|package|provides|requires|to|transitive|uses|with)\s+)(?!)[a-z]\w*(?:\.[a-z]\w*)*\.?/.source.replace(//g,(function(){return t.source}))),lookbehind:!0,inside:{punctuation:/\./}}})}(Prism),function(e){var t=/\b(?:alignas|alignof|asm|auto|bool|break|case|catch|char|char16_t|char32_t|char8_t|class|co_await|co_return|co_yield|compl|concept|const|const_cast|consteval|constexpr|constinit|continue|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|final|float|for|friend|goto|if|import|inline|int|int16_t|int32_t|int64_t|int8_t|long|module|mutable|namespace|new|noexcept|nullptr|operator|override|private|protected|public|register|reinterpret_cast|requires|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|uint16_t|uint32_t|uint64_t|uint8_t|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/,n=/\b(?!)\w+(?:\s*\.\s*\w+)*\b/.source.replace(//g,(function(){return t.source}));e.languages.cpp=e.languages.extend("c",{"class-name":[{pattern:RegExp(/(\b(?:class|concept|enum|struct|typename)\s+)(?!)\w+/.source.replace(//g,(function(){return t.source}))),lookbehind:!0},/\b[A-Z]\w*(?=\s*::\s*\w+\s*\()/,/\b[A-Z_]\w*(?=\s*::\s*~\w+\s*\()/i,/\b\w+(?=\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>\s*::\s*\w+\s*\()/],keyword:t,number:{pattern:/(?:\b0b[01']+|\b0x(?:[\da-f']+(?:\.[\da-f']*)?|\.[\da-f']+)(?:p[+-]?[\d']+)?|(?:\b[\d']+(?:\.[\d']*)?|\B\.[\d']+)(?:e[+-]?[\d']+)?)[ful]{0,4}/i,greedy:!0},operator:/>>=?|<<=?|->|--|\+\+|&&|\|\||[?:~]|<=>|[-+*/%&|^!=<>]=?|\b(?:and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/,boolean:/\b(?:false|true)\b/}),e.languages.insertBefore("cpp","string",{module:{pattern:RegExp(/(\b(?:import|module)\s+)/.source+"(?:"+/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|<[^<>\r\n]*>/.source+"|"+/(?:\s*:\s*)?|:\s*/.source.replace(//g,(function(){return n}))+")"),lookbehind:!0,greedy:!0,inside:{string:/^[<"][\s\S]+/,operator:/:/,punctuation:/\./}},"raw-string":{pattern:/R"([^()\\ ]{0,16})\([\s\S]*?\)\1"/,alias:"string",greedy:!0}}),e.languages.insertBefore("cpp","keyword",{"generic-function":{pattern:/\b(?!operator\b)[a-z_]\w*\s*<(?:[^<>]|<[^<>]*>)*>(?=\s*\()/i,inside:{function:/^\w+/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:e.languages.cpp}}}}),e.languages.insertBefore("cpp","operator",{"double-colon":{pattern:/::/,alias:"punctuation"}}),e.languages.insertBefore("cpp","class-name",{"base-clause":{pattern:/(\b(?:class|struct)\s+\w+\s*:\s*)[^;{}"'\s]+(?:\s+[^;{}"'\s]+)*(?=\s*[;{])/,lookbehind:!0,greedy:!0,inside:e.languages.extend("cpp",{})}}),e.languages.insertBefore("inside","double-colon",{"class-name":/\b[a-z_]\w*\b(?!\s*::)/i},e.languages.cpp["base-clause"])}(Prism);const nl="data-language",rl="data-highlight-language",ol="data-theme";let il=class e extends Mr{__language;__theme;__isSyntaxHighlightSupported;static getType(){return"code"}static clone(t){return new e(t.__language,t.__key)}constructor(e,t){super(t),this.__language=e||void 0,this.__isSyntaxHighlightSupported=!1,this.__theme=void 0}afterCloneFrom(e){super.afterCloneFrom(e),this.__language=e.__language,this.__theme=e.__theme,this.__isSyntaxHighlightSupported=e.__isSyntaxHighlightSupported}createDOM(e){const t=document.createElement("code");js(t,e.theme.code),t.setAttribute("spellcheck","false");const n=this.getLanguage();n&&(t.setAttribute(nl,n),this.getIsSyntaxHighlightSupported()&&t.setAttribute(rl,n));const r=this.getTheme();r&&t.setAttribute(ol,r);const o=this.getStyle();return o&&t.setAttribute("style",o),t}updateDOM(e,t,n){const r=this.__language,o=e.__language;r?r!==o&&t.setAttribute(nl,r):o&&t.removeAttribute(nl);const i=this.__isSyntaxHighlightSupported;e.__isSyntaxHighlightSupported&&o?i&&r?r!==o&&t.setAttribute(rl,r):t.removeAttribute(rl):i&&r&&t.setAttribute(rl,r);const s=this.__theme,l=e.__theme;s?s!==l&&t.setAttribute(ol,s):l&&t.removeAttribute(ol);const a=this.__style,c=e.__style;return a?a!==c&&t.setAttribute("style",a):c&&t.removeAttribute("style"),!1}exportDOM(e){const t=document.createElement("pre");js(t,e._config.theme.code),t.setAttribute("spellcheck","false");const n=this.getLanguage();n&&(t.setAttribute(nl,n),this.getIsSyntaxHighlightSupported()&&t.setAttribute(rl,n));const r=this.getTheme();r&&t.setAttribute(ol,r);const o=this.getStyle();return o&&t.setAttribute("style",o),{element:t}}static importDOM(){return{code:e=>null!=e.textContent&&(/\r?\n/.test(e.textContent)||tl(e,"BR"))?{conversion:al,priority:1}:null,div:()=>({conversion:cl,priority:1}),pre:()=>({conversion:al,priority:0}),table:e=>fl(e)?{conversion:ul,priority:3}:null,td:e=>{const t=e,n=t.closest("table");return t.classList.contains("js-file-line")||n&&fl(n)?{conversion:dl,priority:3}:null},tr:e=>{const t=e.closest("table");return t&&fl(t)?{conversion:dl,priority:3}:null}}}static importJSON(e){return sl().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setLanguage(e.language).setTheme(e.theme)}exportJSON(){return{...super.exportJSON(),language:this.getLanguage(),theme:this.getTheme()}}insertNewAfter(e,t=!0){const n=this.getChildren(),r=n.length;if(r>=2&&"\n"===n[r-1].getTextContent()&&"\n"===n[r-2].getTextContent()&&e.isCollapsed()&&e.anchor.key===this.__key&&e.anchor.offset===r){n[r-1].remove(),n[r-2].remove();const e=Qr();return this.insertAfter(e,t),e}const{anchor:o,focus:i}=e,s=(o.isBefore(i)?o:i).getNode();if(Tn(s)){let e=function(e){return function(e,t){let n=e;for(let r=Vi(e,t);r&&(_l(r.origin)||Fn(r.origin));r=Vs(r))n=r.origin;return n}(e,"previous")}(s);const t=[];for(;;)if(Fn(e))t.push(An()),e=e.getNextSibling();else{if(!_l(e))break;{let n=0;const r=e.getTextContent(),o=e.getTextContentSize();for(;ne.append(t))),this.replace(e),!0}setLanguage(e){const t=this.getWritable();return t.__language=e||void 0,t}getLanguage(){return this.getLatest().__language}setIsSyntaxHighlightSupported(e){const t=this.getWritable();return t.__isSyntaxHighlightSupported=e,t}getIsSyntaxHighlightSupported(){return this.getLatest().__isSyntaxHighlightSupported}setTheme(e){const t=this.getWritable();return t.__theme=e||void 0,t}getTheme(){return this.getLatest().__theme}};function sl(e,t){return function(e){const t=wi();return mr(),new(t.resolveRegisteredNodeAfterReplacements(t.getRegisteredNode(e)).klass)}(il).setLanguage(e).setTheme(t)}function ll(e){return e instanceof il}function al(e){return{node:sl(e.getAttribute(nl))}}function cl(e){const t=e,n=gl(t);return n||function(e){let t=e.parentElement;for(;null!==t;){if(gl(t))return!0;t=t.parentElement}return!1}(t)?{node:n?sl():null}:{node:null}}function ul(){return{node:sl()}}function dl(){return{node:null}}function gl(e){return null!==e.style.fontFamily.match("monospace")}function fl(e){return e.classList.contains("js-file-line-container")}let hl=class e extends mn{__highlightType;constructor(e="",t,n){super(e,n),this.__highlightType=t}static getType(){return"code-highlight"}static clone(t){return new e(t.__text,t.__highlightType||void 0,t.__key)}getHighlightType(){return this.getLatest().__highlightType}setHighlightType(e){const t=this.getWritable();return t.__highlightType=e||void 0,t}canHaveFormat(){return!1}createDOM(e){const t=super.createDOM(e);return js(t,pl(e.theme,this.__highlightType)),t}updateDOM(e,t,n){const r=super.updateDOM(e,t,n),o=pl(n.theme,e.__highlightType),i=pl(n.theme,this.__highlightType);return o!==i&&(o&&Ys(t,o),i&&js(t,i)),r}static importJSON(e){return ml().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setHighlightType(e.highlightType)}exportJSON(){return{...super.exportJSON(),highlightType:this.getHighlightType()}}setFormat(e){return this}isParentRequired(){return!0}createParentElementNode(){return sl()}};function pl(e,t){return t&&e&&e.codeHighlight&&e.codeHighlight[t]}function ml(e="",t){return gi(new hl(e,t))}function _l(e){return e instanceof hl}function yl(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const e of t)r.append("v",e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function bl(e){let t=e.getParent();Ul(t)||yl(40);let n=t;for(;null!==n;)n=n.getParent(),Ul(n)&&(t=n);return t}function Sl(e){let t=[];const n=e.getChildren().filter(Dl);for(let e=0;e0&&e.append(...o),t.remove()}function El(){const e=Qn();if(Dn(e)){const t=new Set,n=e.getNodes(),r=e.anchor.getNode();if(vl(r,n))t.add(bl(r));else for(let e=0;ei.append(e)));const s=Ll(),l=Wl(r);s.append(l),kl(l,e.getNextSiblings()),n.insertBefore(o),n.insertAfter(s),n.replace(e)}}}function Ol(...e){const t=[];for(const n of e)if(n&&"string"==typeof n)for(const[e]of n.matchAll(/\S+/g))t.push(e);return t}!function(e){e.languages.diff={coord:[/^(?:\*{3}|-{3}|\+{3}).*$/m,/^@@.*@@$/m,/^\d.*$/m]};var t={"deleted-sign":"-","deleted-arrow":"<","inserted-sign":"+","inserted-arrow":">",unchanged:" ",diff:"!"};Object.keys(t).forEach((function(n){var r=t[n],o=[];/^\w+$/.test(n)||o.push(/\w+/.exec(n)[0]),"diff"===n&&o.push("bold"),e.languages.diff[n]={pattern:RegExp("^(?:["+r+"].*(?:\r\n?|\n|(?![\\s\\S])))+","m"),alias:o,inside:{line:{pattern:/(.)(?=[\s\S]).*(?:\r\n?|\n)?/,lookbehind:!0},prefix:{pattern:/[\s\S]/,alias:/\w+/.exec(n)[0]}}}})),Object.defineProperty(e.languages.diff,"PREFIXES",{value:t})}(Prism);let Pl=class extends Mr{__value;__checked;$config(){return this.config("listitem",{$transform:e=>{if(null==e.__checked)return;const t=e.getParent();Ul(t)&&"check"!==t.getListType()&&null!=e.getChecked()&&e.setChecked(void 0)},extends:Mr,importDOM:{li:()=>({conversion:Rl,priority:0})}})}constructor(e=1,t=void 0,n){super(n),this.__value=void 0===e?1:e,this.__checked=t}afterCloneFrom(e){super.afterCloneFrom(e),this.__value=e.__value,this.__checked=e.__checked}createDOM(e){const t=document.createElement("li");return this.updateListItemDOM(null,t,e),t}updateListItemDOM(e,t,n){!function(e,t,n){const r=t.getParent();!Ul(r)||"check"!==r.getListType()||Ul(t.getFirstChild())?(e.removeAttribute("role"),e.removeAttribute("tabIndex"),e.removeAttribute("aria-checked")):(e.setAttribute("role","checkbox"),e.setAttribute("tabIndex","-1"),n&&t.__checked===n.__checked||e.setAttribute("aria-checked",t.getChecked()?"true":"false"))}(t,this,e),t.value=this.__value,function(e,t,n){const r=[],o=[],i=t.list,s=i?i.listitem:void 0;let l;if(i&&i.nested&&(l=i.nested.listitem),void 0!==s&&r.push(...Ol(s)),i){const e=n.getParent(),t=Ul(e)&&"check"===e.getListType(),s=n.getChecked();t&&!s||o.push(i.listitemUnchecked),t&&s||o.push(i.listitemChecked),t&&r.push(s?i.listitemChecked:i.listitemUnchecked)}if(void 0!==l){const e=Ol(l);n.getChildren().some((e=>Ul(e)))?r.push(...e):o.push(...e)}o.length>0&&Ys(e,...o),r.length>0&&js(e,...r)}(t,n.theme,this);const r=e?e.__style:"",o=this.__style;r!==o&&(""===o?t.removeAttribute("style"):t.style.cssText=o),function(e,t,n){const r=As(t.__textStyle);for(const t in r)e.style.setProperty(`--listitem-marker-${t}`,r[t]);if(n)for(const t in As(n.__textStyle))t in r||e.style.removeProperty(`--listitem-marker-${t}`)}(t,this,e)}updateDOM(e,t,n){const r=t;return this.updateListItemDOM(e,r,n),!1}updateFromJSON(e){return super.updateFromJSON(e).setValue(e.value).setChecked(e.checked)}exportDOM(e){const t=this.createDOM(e._config),n=this.getFormatType();n&&(t.style.textAlign=n);const r=this.getDirection();return r&&(t.dir=r),{element:t}}exportJSON(){return{...super.exportJSON(),checked:this.getChecked(),value:this.getValue()}}append(...e){for(let t=0;t{e.append(t)}))),this.remove(),0===n.getChildrenSize()&&n.remove(),e}insertAfter(e,t=!0){const n=this.getParentOrThrow();if(Ul(n)||yl(39),Dl(e))return super.insertAfter(e,t);const r=this.getNextSiblings();if(n.insertAfter(e,t),0!==r.length){const o=Wl(n.getListType());r.forEach((e=>o.append(e))),e.insertAfter(o,t)}return e}remove(e){const t=this.getPreviousSibling(),n=this.getNextSibling();super.remove(e),t&&n&&Cl(t)&&Cl(n)&&(Nl(t.getFirstChild(),n.getFirstChild()),n.remove())}insertNewAfter(e,t=!0){const n=Ll().updateFromJSON(this.exportJSON()).setChecked(!this.getChecked()&&void 0);return this.insertAfter(n,t),n}collapseAtStart(e){const t=Qr();this.getChildren().forEach((e=>t.append(e)));const n=this.getParentOrThrow(),r=n.getParentOrThrow(),o=Dl(r);if(1===n.getChildrenSize())if(o)n.remove(),r.select();else{n.insertBefore(t),n.remove();const r=e.anchor,o=e.focus,i=t.getKey();"element"===r.type&&r.getNode().is(this)&&r.set(i,r.offset,"element"),"element"===o.type&&o.getNode().is(this)&&o.set(i,o.offset,"element")}else n.insertBefore(t),this.remove();return!0}getValue(){return this.getLatest().__value}setValue(e){const t=this.getWritable();return t.__value=e,t}getChecked(){const e=this.getLatest();let t;const n=this.getParent();return Ul(n)&&(t=n.getListType()),"check"===t?Boolean(e.__checked):void 0}setChecked(e){const t=this.getWritable();return t.__checked=e,t}toggleChecked(){const e=this.getWritable();return e.setChecked(!e.__checked)}getIndent(){const e=this.getParent();if(null===e||!this.isAttached())return this.getLatest().__indent;let t=e.getParentOrThrow(),n=0;for(;Dl(t);)t=t.getParentOrThrow().getParentOrThrow(),n++;return n}setIndent(e){"number"!=typeof e&&yl(117),(e=Math.floor(e))>=0||yl(199);let t=this.getIndent();for(;t!==e;)t{!function(e){const t=e.getNextSibling();Ul(t)&&e.getListType()===t.getListType()&&Nl(e,t)}(e),function(e){const t="check"!==e.getListType();let n=e.getStart();for(const r of e.getChildren())Dl(r)&&(r.getValue()!==n&&r.setValue(n),t&&null!=r.getLatest().__checked&&r.setChecked(void 0),Ul(r.getFirstChild())||n++)}(e)},extends:Mr,importDOM:{ol:()=>({conversion:$l,priority:0}),ul:()=>({conversion:$l,priority:0})}})}constructor(e="number",t=1,n){super(n);const r=Bl[e]||e;this.__listType=r,this.__tag="number"===r?"ol":"ul",this.__start=t}afterCloneFrom(e){super.afterCloneFrom(e),this.__listType=e.__listType,this.__tag=e.__tag,this.__start=e.__start}getTag(){return this.getLatest().__tag}setListType(e){const t=this.getWritable();return t.__listType=e,t.__tag="number"===e?"ol":"ul",t}getListType(){return this.getLatest().__listType}getStart(){return this.getLatest().__start}setStart(e){const t=this.getWritable();return t.__start=e,t}createDOM(e,t){const n=this.__tag,r=document.createElement(n);return 1!==this.__start&&r.setAttribute("start",String(this.__start)),r.__lexicalListType=this.__listType,Kl(r,e.theme,this),r}updateDOM(e,t,n){return e.__tag!==this.__tag||e.__listType!==this.__listType||(Kl(t,n.theme,this),!1)}updateFromJSON(e){return super.updateFromJSON(e).setListType(e.listType).setStart(e.start)}exportDOM(e){const t=this.createDOM(e._config,e);return yi(t)&&(1!==this.__start&&t.setAttribute("start",String(this.__start)),"check"===this.__listType&&t.setAttribute("__lexicalListType","check")),{element:t}}exportJSON(){return{...super.exportJSON(),listType:this.getListType(),start:this.getStart(),tag:this.getTag()}}canBeEmpty(){return!1}canIndent(){return!1}splice(e,t,n){let r=n;for(let e=0;e1?r.push(...e):o.push(...e)}}o.length>0&&Ys(e,...o),r.length>0&&js(e,...r)}function zl(e){const t=[];for(let n=0;n1&&e.forEach((e=>{Ul(e)&&t.push(xl(e))}))}else t.push(xl(r))}return t}function $l(e){const t=e.nodeName.toLowerCase();let n=null;return"ol"===t?n=Wl("number",e.start):"ul"===t&&(n=function(e){if("check"===e.getAttribute("__lexicallisttype")||e.classList.contains("contains-task-list"))return!0;for(const t of e.childNodes)if(yi(t)&&t.hasAttribute("aria-checked"))return!0;return!1}(e)?Wl("check"):Wl("bullet")),{after:zl,node:n}}const Bl={ol:"number",ul:"bullet"};function Wl(e="number",t=1){return gi(new Il(e,t))}function Ul(e){return e instanceof Il}const Hl=De("INSERT_UNORDERED_LIST_COMMAND"),Jl=De("INSERT_ORDERED_LIST_COMMAND"),jl=De("REMOVE_LIST_COMMAND");function Yl(e,t){const n=t.body?t.body.childNodes:[];let r=[];const o=[];for(let t=0;t{const e=new qr;return n.push(e),e}:Qr)),null==l?g.length>0?s=s.concat(g):xi(e)&&function(e){return null!=e.nextSibling&&null!=e.previousSibling&&(Ci(e.nextSibling)&&Ci(e.previousSibling))}(e)&&(s=s.concat(ln())):Lr(l)&&l.append(...g),s}function Xl(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const e of t)r.append("v",e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function Ql(e,t,n){const r=e.getData("application/x-lexical-editor");if(r)try{const e=JSON.parse(r);if(e.namespace===n._config.namespace&&Array.isArray(e.nodes))return ea(n,na(e.nodes),t)}catch(e){}const o=e.getData("text/html"),i=e.getData("text/plain");if(o&&i!==o)try{return ea(n,Yl(n,(new DOMParser).parseFromString(function(e){return window.trustedTypes&&window.trustedTypes.createPolicy?window.trustedTypes.createPolicy("lexical",{createHTML:e=>e}).createHTML(e):e}(o),"text/html")),t)}catch(e){}const s=i||e.getData("text/uri-list");if(null!=s)if(Dn(t)){const e=s.split(/(\r?\n|\t)/);""===e[e.length-1]&&e.pop();for(let t=0;t0?a.text=e:o=!1}for(let r=0;r{e.update((()=>{r(ia(e,t,n))}))}));const r=e.getRootElement(),o=e._window||window,i=o.document,s=mi(o);if(null===r||null===s)return!1;const l=i.createElement("span");l.style.cssText="position: fixed; top: -1000px;",l.append(i.createTextNode("#")),r.append(l);const a=new Range;return a.setStart(l,0),a.setEnd(l,1),s.removeAllRanges(),s.addRange(a),new Promise(((t,r)=>{const s=e.registerCommand(yt,(r=>(qs(r,ClipboardEvent)&&(s(),null!==ra&&(o.clearTimeout(ra),ra=null),t(ia(e,r,n))),!0)),4);ra=o.setTimeout((()=>{s(),ra=null,t(!1)}),50),i.execCommand("copy"),l.remove()}))}function ia(e,t,n){if(void 0===n){const t=mi(e._window);if(!t)return!1;const r=t.anchorNode,o=t.focusNode;if(null!==r&&null!==o&&!go(e,r,o))return!1;const i=Qn();if(null===i)return!1;n=la(i)}t.preventDefault();const r=t.clipboardData;return null!==r&&(function(e,t){for(const[n]of sa)void 0===t[n]&&e.setData(n,"");for(const n in t){const r=t[n];void 0!==r&&e.setData(n,r)}}(r,n),!0)}const sa=[["text/html",function(e,t=Qn()){return null==t&&Xl(166),Dn(t)&&t.isCollapsed()||0===t.getNodes().length?"":Vl(e,t)}],["application/x-lexical-editor",function(e,t=Qn()){return null==t&&Xl(166),Dn(t)&&t.isCollapsed()||0===t.getNodes().length?null:JSON.stringify(function(e,t){const n=[],r=Ro().getChildren();for(let o=0;o({conversion:va,priority:0})}}exportDOM(e){const{element:t}=super.exportDOM(e);if(yi(t)){this.isEmpty()&&t.append(document.createElement("br"));const e=this.getFormatType();e&&(t.style.textAlign=e);const n=this.getDirection();n&&(t.dir=n)}return{element:t}}static importJSON(e){return ba().updateFromJSON(e)}insertNewAfter(e,t){const n=Qr(),r=this.getDirection();return n.setDirection(r),this.insertAfter(n,t),n}collapseAtStart(){const e=Qr();return this.getChildren().forEach((t=>e.append(t))),this.replace(e),!0}canMergeWhenEmpty(){return!0}};function ba(){return gi(new ya)}let Sa=class e extends Mr{__tag;static getType(){return"heading"}static clone(t){return new e(t.__tag,t.__key)}constructor(e,t){super(t),this.__tag=e}getTag(){return this.__tag}setTag(e){const t=this.getWritable();return this.__tag=e,t}createDOM(e){const t=this.__tag,n=document.createElement(t),r=e.theme.heading;if(void 0!==r){js(n,r[t])}return n}updateDOM(e,t,n){return e.__tag!==this.__tag}static importDOM(){return{h1:e=>({conversion:xa,priority:0}),h2:e=>({conversion:xa,priority:0}),h3:e=>({conversion:xa,priority:0}),h4:e=>({conversion:xa,priority:0}),h5:e=>({conversion:xa,priority:0}),h6:e=>({conversion:xa,priority:0}),p:e=>{const t=e.firstChild;return null!==t&&Ca(t)?{conversion:()=>({node:null}),priority:3}:null},span:e=>Ca(e)?{conversion:e=>({node:wa("h1")}),priority:3}:null}}exportDOM(e){const{element:t}=super.exportDOM(e);if(yi(t)){this.isEmpty()&&t.append(document.createElement("br"));const e=this.getFormatType();e&&(t.style.textAlign=e);const n=this.getDirection();n&&(t.dir=n)}return{element:t}}static importJSON(e){return wa(e.tag).updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setTag(e.tag)}exportJSON(){return{...super.exportJSON(),tag:this.getTag()}}insertNewAfter(e,t=!0){const n=e?e.anchor.offset:0,r=this.getLastDescendant(),o=!r||e&&e.anchor.key===r.getKey()&&n===r.getTextContentSize()||!e?Qr():wa(this.getTag()),i=this.getDirection();if(o.setDirection(i),this.insertAfter(o,t),0===n&&!this.isEmpty()&&e){const e=Qr();e.select(),this.replace(e,!0)}return o}collapseAtStart(){const e=this.isEmpty()?Qr():wa(this.getTag());return this.getChildren().forEach((t=>e.append(t))),this.replace(e),!0}extractWithChild(){return!0}};function Ca(e){return"span"===e.nodeName.toLowerCase()&&"26pt"===e.style.fontSize}function xa(e){const t=e.nodeName.toLowerCase();let n=null;return"h1"!==t&&"h2"!==t&&"h3"!==t&&"h4"!==t&&"h5"!==t&&"h6"!==t||(n=wa(t),null!==e.style&&(Ai(e,n),n.setFormat(e.style.textAlign))),{node:n}}function va(e){const t=ba();return null!==e.style&&(t.setFormat(e.style.textAlign),Ai(e,t)),{node:t}}function wa(e="h1"){return gi(new Sa(e))}function ka(e){let t=null;if(qs(e,DragEvent)?t=e.dataTransfer:qs(e,ClipboardEvent)&&(t=e.clipboardData),null===t)return[!1,[],!1];const n=t.types,r=n.includes("Files"),o=n.includes("text/html")||n.includes("text/plain");return[r,Array.from(t.files),o]}function Ta(e){const t=Qn();if(!Dn(t))return!1;const n=new Set,r=t.getNodes();for(let t=0;tLr(e)&&!e.isInline()));if(null===s)continue;const l=s.getKey();s.canIndent()&&!n.has(l)&&(n.add(l),e(s))}return n.size>0}function Na(e){return Kr(Fo(e))}function Ea(e){for(const t of["lowercase","uppercase","capitalize"])e.hasFormat(t)&&e.toggleFormat(t)}const Aa=/^(\d+(?:\.\d+)?)px$/,Fa={BOTH:3,COLUMN:2,NO_STATUS:0,ROW:1};class Oa extends Mr{__colSpan;__rowSpan;__headerState;__width;__backgroundColor;__verticalAlign;static getType(){return"tablecell"}static clone(e){return new Oa(e.__headerState,e.__colSpan,e.__width,e.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__rowSpan=e.__rowSpan,this.__backgroundColor=e.__backgroundColor,this.__verticalAlign=e.__verticalAlign}static importDOM(){return{td:e=>({conversion:Ra,priority:0}),th:e=>({conversion:Ra,priority:0})}}static importJSON(e){return Ma().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setHeaderStyles(e.headerState).setColSpan(e.colSpan||1).setRowSpan(e.rowSpan||1).setWidth(e.width||void 0).setBackgroundColor(e.backgroundColor||null).setVerticalAlign(e.verticalAlign||void 0)}constructor(e=Fa.NO_STATUS,t=1,n,r){super(r),this.__colSpan=t,this.__rowSpan=1,this.__headerState=e,this.__width=n,this.__backgroundColor=null,this.__verticalAlign=void 0}createDOM(e){const t=document.createElement(this.getTag());return this.__width&&(t.style.width=`${this.__width}px`),this.__colSpan>1&&(t.colSpan=this.__colSpan),this.__rowSpan>1&&(t.rowSpan=this.__rowSpan),null!==this.__backgroundColor&&(t.style.backgroundColor=this.__backgroundColor),Pa(this.__verticalAlign)&&(t.style.verticalAlign=this.__verticalAlign),js(t,e.theme.tableCell,this.hasHeader()&&e.theme.tableCellHeader),t}exportDOM(e){const t=super.exportDOM(e);if(yi(t.element)){const e=t.element;e.setAttribute("data-temporary-table-cell-lexical-key",this.getKey()),e.style.border="1px solid black",this.__colSpan>1&&(e.colSpan=this.__colSpan),this.__rowSpan>1&&(e.rowSpan=this.__rowSpan),e.style.width=`${this.getWidth()||75}px`,e.style.verticalAlign=this.getVerticalAlign()||"top",e.style.textAlign="start",null===this.__backgroundColor&&this.hasHeader()&&(e.style.backgroundColor="#f2f3f5")}return t}exportJSON(){return{...super.exportJSON(),...Pa(this.__verticalAlign)&&{verticalAlign:this.__verticalAlign},backgroundColor:this.getBackgroundColor(),colSpan:this.__colSpan,headerState:this.__headerState,rowSpan:this.__rowSpan,width:this.getWidth()}}getColSpan(){return this.getLatest().__colSpan}setColSpan(e){const t=this.getWritable();return t.__colSpan=e,t}getRowSpan(){return this.getLatest().__rowSpan}setRowSpan(e){const t=this.getWritable();return t.__rowSpan=e,t}getTag(){return this.hasHeader()?"th":"td"}setHeaderStyles(e,t=Fa.BOTH){const n=this.getWritable();return n.__headerState=e&t|n.__headerState&~t,n}getHeaderStyles(){return this.getLatest().__headerState}setWidth(e){const t=this.getWritable();return t.__width=e,t}getWidth(){return this.getLatest().__width}getBackgroundColor(){return this.getLatest().__backgroundColor}setBackgroundColor(e){const t=this.getWritable();return t.__backgroundColor=e,t}getVerticalAlign(){return this.getLatest().__verticalAlign}setVerticalAlign(e){const t=this.getWritable();return t.__verticalAlign=e||void 0,t}toggleHeaderStyle(e){const t=this.getWritable();return(t.__headerState&e)===e?t.__headerState-=e:t.__headerState+=e,t}hasHeaderState(e){return(this.getHeaderStyles()&e)===e}hasHeader(){return this.getLatest().__headerState!==Fa.NO_STATUS}updateDOM(e){return e.__headerState!==this.__headerState||e.__width!==this.__width||e.__colSpan!==this.__colSpan||e.__rowSpan!==this.__rowSpan||e.__backgroundColor!==this.__backgroundColor||e.__verticalAlign!==this.__verticalAlign}isShadowRoot(){return!0}collapseAtStart(){return!0}canBeEmpty(){return!1}canIndent(){return!1}}function Pa(e){return"middle"===e||"bottom"===e}function Ra(e){const t=e,n=e.nodeName.toLowerCase();let r;Aa.test(t.style.width)&&(r=parseFloat(t.style.width));const o=Ma("th"===n?Fa.ROW:Fa.NO_STATUS,t.colSpan,r);o.__rowSpan=t.rowSpan;const i=t.style.backgroundColor;""!==i&&(o.__backgroundColor=i);const s=t.style.verticalAlign;Pa(s)&&(o.__verticalAlign=s);const l=t.style,a=(l&&l.textDecoration||"").split(" "),c="700"===l.fontWeight||"bold"===l.fontWeight,u=a.includes("line-through"),d="italic"===l.fontStyle,g=a.includes("underline");return{after:e=>{const t=[];let n=null;const r=()=>{if(n){const e=n.getFirstChild();an(e)&&1===n.getChildrenSize()&&e.remove()}};for(const o of e)ci(o)||Tn(o)||an(o)?(Tn(o)&&(c&&o.toggleFormat("bold"),u&&o.toggleFormat("strikethrough"),d&&o.toggleFormat("italic"),g&&o.toggleFormat("underline")),n?n.append(o):(n=Qr().append(o),t.push(n))):(t.push(o),r(),n=null);return r(),0===t.length&&t.push(Qr()),t},node:o}}function Ma(e=Fa.NO_STATUS,t=1,n){return gi(new Oa(e,t,n))}function La(e){return e instanceof Oa}const Da=De("INSERT_TABLE_COMMAND");function Ia(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const e of t)r.append("v",e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}class Ka extends Mr{__height;static getType(){return"tablerow"}static clone(e){return new Ka(e.__height,e.__key)}static importDOM(){return{tr:e=>({conversion:za,priority:0})}}static importJSON(e){return $a().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setHeight(e.height)}constructor(e,t){super(t),this.__height=e}exportJSON(){const e=this.getHeight();return{...super.exportJSON(),...void 0===e?void 0:{height:e}}}createDOM(e){const t=document.createElement("tr");return this.__height&&(t.style.height=`${this.__height}px`),js(t,e.theme.tableRow),t}extractWithChild(e,t,n){return"html"===n}isShadowRoot(){return!0}setHeight(e){const t=this.getWritable();return t.__height=e,t}getHeight(){return this.getLatest().__height}updateDOM(e){return e.__height!==this.__height}canBeEmpty(){return!1}canIndent(){return!1}}function za(e){const t=e;let n;return Aa.test(t.style.height)&&(n=parseFloat(t.style.height)),{after:e=>Zs(e,La),node:$a(n)}}function $a(e){return gi(new Ka(e))}function Ba(e){return e instanceof Ka}const Wa="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,Ua=Wa&&"documentMode"in document?document.documentMode:null,Ha=Wa&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent);function Ja(e){const t=Ri(e,(e=>Ba(e)));if(Ba(t))return t;throw new Error("Expected table cell to be inside of table row.")}function ja(e){const t=Ri(e,(e=>qc(e)));if(qc(t))return t;throw new Error("Expected table cell to be inside of table.")}Wa&&"InputEvent"in window&&!Ua&&new window.InputEvent("input");const Ya=(e,t)=>e===Fa.BOTH||e===t?t:Fa.NO_STATUS;function Va(e,t=!0){const[,,n]=rc(e),[r,o]=tc(n,e,e),i=r[0].length,{startRow:s}=o;let l=null;if(t){const t=s+e.__rowSpan-1,o=r[t],a=$a();for(let e=0;e1;){if(s-=i.__colSpan,!(s>=0)){g.append(d(r));continue e}{const{cell:e,startRow:r}=t[s];n=e,o=r}}n.insertAfter(d(r))}else i.setColSpan(i.__colSpan+1)}null!==u&&n&&qa(u);const f=r.getColWidths();if(f){const e=[...f],t=a<0?0:a,n=e[t];e.splice(t,0,n),r.setColWidths(e)}return u}function qa(e){const t=e.getFirstDescendant();null==t?e.selectStart():t.getParentOrThrow().selectStart()}function Za(e,t){const n=e.getFirstChild();null!==n?n.insertBefore(t):e.append(t)}function Xa(e){if(0===e.length)return null;const t=ja(e[0]),[n]=nc(t,null,null);let r=1/0,o=-1/0,i=1/0,s=-1/0;const l=new Set;for(const t of n)for(const n of t){if(!n||!n.cell)continue;const t=n.cell.getKey();if(!l.has(t)&&e.some((e=>e.is(n.cell)))){l.add(t);const e=n.startRow,a=n.startColumn,c=n.cell.__rowSpan||1,u=n.cell.__colSpan||1;r=Math.min(r,e),o=Math.max(o,e+c-1),i=Math.min(i,a),s=Math.max(s,a+u-1)}}if(r===1/0||i===1/0)return null;const a=o-r+1,c=s-i+1,u=n[r][i];if(!u.cell)return null;const d=u.cell;d.setColSpan(c),d.setRowSpan(a);const g=new Set([d.getKey()]);for(let e=r;e<=o;e++)for(let t=i;t<=s;t++){const r=n[e][t];if(!r.cell)continue;const o=r.cell,i=o.getKey();g.has(i)||(g.add(i),Qa(o)||d.append(...o.getChildren()),o.remove())}return 0===d.getChildrenSize()&&d.append(Qr()),d}function Qa(e){if(1!==e.getChildrenSize())return!1;const t=e.getFirstChildOrThrow();return!(!eo(t)||!t.isEmpty())}function ec(e){const[t,n,r]=rc(e),o=t.__colSpan,i=t.__rowSpan;if(1===o&&1===i)return;const[s,l]=tc(r,t,t),{startColumn:a,startRow:c}=l,u=t.__headerState&Fa.COLUMN,d=Array.from({length:o},((e,t)=>{let n=u;for(let e=0;0!==n&&e{let n=g;for(let e=0;0!==n&&e1){for(let e=1;e1){let e;for(let t=1;t1&&(e+=n.__colSpan-1)}if(null===l)for(let n=o-1;n>=0;n--)Za(e,Ma(d[n]|f[t]).append(Qr()));else for(let e=o-1;e>=0;e--)l.insertAfter(Ma(d[e]|f[t]).append(Qr()))}t.setRowSpan(1)}}function tc(e,t,n){const[r,o,i]=nc(e,t,n);return null===o&&Ia(207),null===i&&Ia(208),[r,o,i]}function nc(e,t,n){const r=[];let o=null,i=null;function s(e){let t=r[e];return void 0===t&&(r[e]=t=[]),t}const l=e.getChildren();for(let e=0;e=l.length);t++){const n=s(e+t);for(let e=0;e=o,g=a.startRow<=l&&u>=i;if(d&&g){const e=Math.min(o,a.startColumn),t=Math.max(s,c),n=Math.min(i,a.startRow),d=Math.max(l,u);e===o&&t===s&&n===i&&d===l||(o=e,s=t,i=n,l=d,r=!0)}}}while(r);return{maxColumn:s,maxRow:l,minColumn:o,minRow:i}}function ic(e){const[t,,n]=rc(e),r=n.getChildren(),o=r.length,i=r[0].getChildren().length,s=new Array(o);for(let e=0;e{const n=e[t].getNode(),r=Ri(n,La);La(r)||Ia(238,t,n.getKey(),n.getType());const o=r.getParent();Ba(o)||Ia(239,t);const i=o.getParent();return qc(i)||Ia(240,t),[n,r,o,i]}));return o.is(a)||Ia(241),{anchorCell:n,anchorNode:t,anchorRow:r,anchorTable:o,focusCell:s,focusNode:i,focusRow:l,focusTable:a}}class lc{tableKey;anchor;focus;_cachedNodes;dirty;constructor(e,t,n){this.anchor=t,this.focus=n,t._selection=this,n._selection=this,this._cachedNodes=null,this.dirty=!1,this.tableKey=e}getStartEndPoints(){return[this.anchor,this.focus]}isValid(){return"root"!==this.tableKey&&"root"!==this.anchor.key&&"element"===this.anchor.type&&"root"!==this.focus.key&&"element"===this.focus.type}isBackward(){return this.focus.isBefore(this.anchor)}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){return ac(e)&&this.tableKey===e.tableKey&&this.anchor.is(e.anchor)&&this.focus.is(e.focus)}set(e,t,n){this.dirty=this.dirty||e!==this.tableKey||t!==this.anchor.key||n!==this.focus.key,this.tableKey=e,this.anchor.key=t,this.focus.key=n,this._cachedNodes=null}clone(){return new lc(this.tableKey,Pn(this.anchor.key,this.anchor.offset,this.anchor.type),Pn(this.focus.key,this.focus.offset,this.focus.type))}isCollapsed(){return!1}extract(){return this.getNodes()}insertRawText(e){}insertText(){}hasFormat(e){let t=0;this.getNodes().filter(La).forEach((e=>{const n=e.getFirstChild();eo(n)&&(t|=n.getTextFormat())}));return!!(t&N[e])}insertNodes(e){const t=this.focus.getNode();Lr(t)||Ia(151),te(t.select(0,t.getChildrenSize())).insertNodes(e)}getShape(){const{anchorCell:e,focusCell:t}=sc(this),n=ic(e);null===n&&Ia(153);const r=ic(t);null===r&&Ia(155);const o=Math.min(n.columnIndex,r.columnIndex),i=Math.max(n.columnIndex+n.colSpan-1,r.columnIndex+r.colSpan-1),s=Math.min(n.rowIndex,r.rowIndex),l=Math.max(n.rowIndex+n.rowSpan-1,r.rowIndex+r.rowSpan-1);return{fromX:Math.min(o,i),fromY:Math.min(s,l),toX:Math.max(o,i),toY:Math.max(s,l)}}getNodes(){if(!this.isValid())return[];const e=this._cachedNodes;if(null!==e)return e;const{anchorTable:t,anchorCell:n,focusCell:r}=sc(this),o=r.getParents()[1];if(o!==t){if(t.isParentOf(r)){const e=o.getParent();null==e&&Ia(159),this.set(this.tableKey,r.getKey(),e.getKey())}else{const e=t.getParent();null==e&&Ia(158),this.set(this.tableKey,e.getKey(),r.getKey())}return this.getNodes()}const[i,s,l]=tc(t,n,r),{minColumn:a,maxColumn:c,minRow:u,maxRow:d}=oc(i,s,l),g=new Map([[t.getKey(),t]]);let f=null;for(let e=u;e<=d;e++)for(let t=a;t<=c;t++){const{cell:n}=i[e][t],r=n.getParent();Ba(r)||Ia(160),r!==f&&(g.set(r.getKey(),r),f=r),g.has(n.getKey())||uc(n,(e=>{g.set(e.getKey(),e)}))}const h=Array.from(g.values());return pr()||(this._cachedNodes=h),h}getTextContent(){const e=this.getNodes().filter((e=>La(e)));let t="";for(let n=0;n0;e=n.at(-1)){const r=e.pop();void 0===r?n.pop():!1!==t(r)&&Lr(r)&&n.push(r.getChildren())}}class dc{focusX;focusY;listenersToRemove;table;isHighlightingCells;anchorX;anchorY;tableNodeKey;anchorCell;focusCell;anchorCellNodeKey;focusCellNodeKey;editor;tableSelection;hasHijackedSelectionStyles;isSelecting;pointerType;shouldCheckSelection;abortController;listenerOptions;nextFocus;constructor(e,t){this.isHighlightingCells=!1,this.anchorX=-1,this.anchorY=-1,this.focusX=-1,this.focusY=-1,this.listenersToRemove=new Set,this.tableNodeKey=t,this.editor=e,this.table={columns:0,domRows:[],rows:0},this.tableSelection=null,this.anchorCellNodeKey=null,this.focusCellNodeKey=null,this.anchorCell=null,this.focusCell=null,this.hasHijackedSelectionStyles=!1,this.isSelecting=!1,this.pointerType=null,this.shouldCheckSelection=!1,this.abortController=new AbortController,this.listenerOptions={signal:this.abortController.signal},this.nextFocus=null,this.trackTable()}getTable(){return this.table}removeListeners(){this.abortController.abort("removeListeners"),Array.from(this.listenersToRemove).forEach((e=>e())),this.listenersToRemove.clear()}$lookup(){return function(e,t=wi()){const n=No(e);qc(n)||Ia(231,e);const r=hc(n,t.getElementByKey(e));return null===r&&Ia(232,e),{tableElement:r,tableNode:n}}(this.tableNodeKey,this.editor)}trackTable(){const e=new MutationObserver((e=>{this.editor.getEditorState().read((()=>{let t=!1;for(let n=0;n{const{tableNode:t,tableElement:n}=this.$lookup();this.table=vc(t,n),e.observe(n,{attributes:!0,childList:!0,subtree:!0})}),{editor:this.editor})}$clearHighlight(){const e=this.editor;this.isHighlightingCells=!1,this.anchorX=-1,this.anchorY=-1,this.focusX=-1,this.focusY=-1,this.tableSelection=null,this.anchorCellNodeKey=null,this.focusCellNodeKey=null,this.anchorCell=null,this.focusCell=null,this.hasHijackedSelectionStyles=!1,this.$enableHighlightStyle();const{tableNode:t,tableElement:n}=this.$lookup();wc(e,vc(t,n),null),null!==Qn()&&(Lo(null),e.dispatchCommand(Ie,void 0))}$enableHighlightStyle(){const e=this.editor,{tableElement:t}=this.$lookup();Ys(t,e._config.theme.tableSelection),t.classList.remove("disable-selection"),this.hasHijackedSelectionStyles=!1}$disableHighlightStyle(){const{tableElement:e}=this.$lookup();js(e,this.editor._config.theme.tableSelection),this.hasHijackedSelectionStyles=!0}$updateTableTableSelection(e){if(null!==e){e.tableKey!==this.tableNodeKey&&Ia(233,e.tableKey,this.tableNodeKey);const t=this.editor;this.tableSelection=e,this.isHighlightingCells=!0,this.$disableHighlightStyle(),this.updateDOMSelection(),wc(t,this.table,this.tableSelection)}else this.$clearHighlight()}setShouldCheckSelection(){this.shouldCheckSelection=!0}getAndClearShouldCheckSelection(){return!!this.shouldCheckSelection&&(this.shouldCheckSelection=!1,!0)}setNextFocus(e){this.nextFocus=e}getAndClearNextFocus(){const{nextFocus:e}=this;return null!==e&&(this.nextFocus=null),e}updateDOMSelection(){if(null!==this.anchorCell&&null!==this.focusCell){const e=mi(this.editor._window);e&&e.rangeCount>0&&e.removeAllRanges()}}$setFocusCellForSelection(e,t=!1){const n=this.editor,{tableNode:r}=this.$lookup(),o=e.x,i=e.y;if(this.focusCell=e,this.isHighlightingCells||this.anchorX===o&&this.anchorY===i&&!t){if(o===this.focusX&&i===this.focusY)return!1}else this.isHighlightingCells=!0,this.$disableHighlightStyle();if(this.focusX=o,this.focusY=i,this.isHighlightingCells){const t=Uc(r,e.elem);if(null!=this.tableSelection&&null!=this.anchorCellNodeKey&&null!==t)return this.focusCellNodeKey=t.getKey(),this.tableSelection=function(e,t,n){e.getKey(),t.getKey(),n.getKey();const r=Qn(),o=ac(r)?r.clone():cc();return o.set(e.getKey(),t.getKey(),n.getKey()),o}(r,this.$getAnchorTableCellOrThrow(),t),Lo(this.tableSelection),n.dispatchCommand(Ie,void 0),wc(n,this.table,this.tableSelection),!0}return!1}$getAnchorTableCell(){return this.anchorCellNodeKey?No(this.anchorCellNodeKey):null}$getAnchorTableCellOrThrow(){const e=this.$getAnchorTableCell();return null===e&&Ia(234),e}$getFocusTableCell(){return this.focusCellNodeKey?No(this.focusCellNodeKey):null}$getFocusTableCellOrThrow(){const e=this.$getFocusTableCell();return null===e&&Ia(235),e}$setAnchorCellForSelection(e){this.isHighlightingCells=!1,this.anchorCell=e,this.anchorX=e.x,this.anchorY=e.y;const{tableNode:t}=this.$lookup(),n=Uc(t,e.elem);if(null!==n){const e=n.getKey();this.tableSelection=null!=this.tableSelection?this.tableSelection.clone():cc(),this.anchorCellNodeKey=e}}$formatCells(e){const t=Qn();ac(t)||Ia(236);const n=qn(),r=n.anchor,o=n.focus,i=t.getNodes().filter(La);i.length>0||Ia(237);const s=i[0].getFirstChild(),l=eo(s)?s.getFormatFlags(e,null):null;i.forEach((t=>{r.set(t.getKey(),0,"element"),o.set(t.getKey(),t.getChildrenSize(),"element"),n.formatText(e,l)})),Lo(t),this.editor.dispatchCommand(Ie,void 0)}$clearText(){const{editor:e}=this,t=No(this.tableNodeKey);if(!qc(t))throw new Error("Expected TableNode.");const n=Qn();ac(n)||Ia(253);const r=n.getNodes().filter(La),o=t.getFirstChild(),i=t.getLastChild();if(r.length>0&&null!==o&&null!==i&&Ba(o)&&Ba(i)&&r[0]===o.getFirstChild()&&r[r.length-1]===i.getLastChild()){t.selectPrevious();const n=t.getParent();return t.remove(),void($r(n)&&n.isEmpty()&&e.dispatchCommand(We,void 0))}r.forEach((e=>{if(Lr(e)){const t=Qr(),n=kn();t.append(n),e.append(t),e.getChildren().forEach((e=>{e!==t&&e.remove()}))}})),wc(e,this.table,null),Lo(null),e.dispatchCommand(Ie,void 0)}}const gc="__lexicalTableSelection";function fc(e){return yi(e)&&"TABLE"===e.nodeName}function hc(e,t){if(!t)return t;const n=fc(t)?t:e.getDOMSlot(t).element;return"TABLE"!==n.nodeName&&Ia(245,t.nodeName),n}function pc(e){return e._window}function mc(e,t){for(let n=t,r=null;null!==n;n=n.getParent()){if(e.is(n))return r;La(n)&&(r=n)}return null}const _c=[[rt,"down"],[nt,"up"],[et,"backward"],[Xe,"forward"]],yc=[je,Ye,$e],bc=[st,at];function Sc(e){return e[gc]||null}function Cc(e){let t=e;for(;null!=t;){const e=t.nodeName;if("TD"===e||"TH"===e){const e=t._cell;return void 0===e?null:e}t=t.parentNode}return null}function xc(e,t){if(!e.contains(t))return null;let n=null;for(let r=t;null!=r;r=r.parentNode){if(r===e)return n;const t=r.nodeName;"TD"!==t&&"TH"!==t||(n=r._cell||null)}return null}function vc(e,t){const n=[],r={columns:0,domRows:n,rows:0};let o=hc(e,t).querySelector("tr"),i=0,s=0;for(n.length=0;null!=o;){const e=o.nodeName;if("TD"===e||"TH"===e){const e={elem:o,hasBackgroundColor:""!==o.style.backgroundColor,highlighted:!1,x:i,y:s};o._cell=e;let t=n[s];void 0===t&&(t=n[s]=[]),t[i]=e}else{const e=o.firstChild;if(null!=e){o=e;continue}}const t=o.nextSibling;if(null!=t){i++,o=t;continue}const r=o.parentNode;if(null!=r){const e=r.nextSibling;if(null==e)break;s++,i=0,o=e}}return r.columns=i+1,r.rows=s+1,r}function wc(e,t,n){const r=new Set(n?n.getNodes():[]);kc(t,((t,n)=>{const o=t.elem;r.has(n)?(t.highlighted=!0,Rc(e,t)):(t.highlighted=!1,Mc(e,t),o.getAttribute("style")||o.removeAttribute("style"))}))}function kc(e,t){const{domRows:n}=e;for(let e=0;e{t.highlighted=!0,Rc(e,t)}))}const Nc=(e,t,n,r,o)=>{const i="forward"===o;switch(o){case"backward":case"forward":return n!==(i?e.table.columns-1:0)?Pc(t.getCellNodeFromCordsOrThrow(n+(i?1:-1),r,e.table),i):r!==(i?e.table.rows-1:0)?Pc(t.getCellNodeFromCordsOrThrow(i?0:e.table.columns-1,r+(i?1:-1),e.table),i):i?t.selectNext():t.selectPrevious(),!0;case"up":return 0!==r?Pc(t.getCellNodeFromCordsOrThrow(n,r-1,e.table),!1):t.selectPrevious(),!0;case"down":return r!==e.table.rows-1?Pc(t.getCellNodeFromCordsOrThrow(n,r+1,e.table),!0):t.selectNext(),!0;default:return!1}};function Ec(e,t){let n,r;if(t.startColumn===e.minColumn)n="minColumn";else{if(t.startColumn+t.cell.__colSpan-1!==e.maxColumn)return null;n="maxColumn"}if(t.startRow===e.minRow)r="minRow";else{if(t.startRow+t.cell.__rowSpan-1!==e.maxRow)return null;r="maxRow"}return[n,r]}function Ac([e,t]){return["minColumn"===e?"maxColumn":"minColumn","minRow"===t?"maxRow":"minRow"]}function Fc(e,t,[n,r]){const o=t[r],i=e[o];void 0===i&&Ia(250,r,String(o));const s=t[n],l=i[s];return void 0===l&&Ia(250,n,String(s)),l}function Oc(e,t){if(Dn(e)||ac(e)){const n=t.isParentOf(e.anchor.getNode()),r=t.isParentOf(e.focus.getNode());return n&&r}return!1}function Pc(e,t){t?e.selectStart():e.selectEnd()}function Rc(e,t){const n=t.elem,r=e._config.theme;La(Fo(n))||Ia(131),js(n,r.tableCellSelected)}function Mc(e,t){const n=t.elem;La(Fo(n))||Ia(131);Ys(n,e._config.theme.tableCellSelected)}function Lc(e){const t=Ri(e,La);return La(t)?t:null}function Dc(e){const t=Ri(e,qc);return qc(t)?t:null}function Ic(e,t,n,r,o,i,s){const l=ds(n.focus,o?"previous":"next");if(Cs(l))return!1;let a=l;for(const e of ns(l).iterNodeCarets("shadowRoot")){if(!Ui(e)||!Lr(e.origin))return!1;a=e}const c=a.getParentAtCaret();if(!La(c))return!1;const u=c,d=function(e){for(const t of ns(e).iterNodeCarets("root")){const{origin:n}=t;if(La(n)){if(Hi(t))return Xi(n,e.direction)}else if(!Ba(n))break}return null}(Vi(u,a.direction)),g=Ri(u,qc);if(!g||!g.is(i))return!1;const f=e.getElementByKey(u.getKey()),h=Cc(f);if(!f||!h)return!1;const p=function(e,t){const n=e.getElementByKey(t.getKey());return null===n&&Ia(230),vc(t,n)}(e,g);if(s.table=p,d)if("extend"===r){const t=Cc(e.getElementByKey(d.origin.getKey()));if(!t)return!1;s.$setAnchorCellForSelection(h),s.$setFocusCellForSelection(t,!0)}else{const e=Ss(d);gs(n.anchor,e),gs(n.focus,e)}else if("extend"===r)s.$setAnchorCellForSelection(h),s.$setFocusCellForSelection(h,!0);else{const e=function(e){const t=Qi(e);return Hi(t)?Ss(t):e}(Vi(g,l.direction));gs(n.anchor,e),gs(n.focus,e)}return zc(t),!0}function Kc(e,t,n,r,o){if(("up"===n||"down"===n)&&function(e){const t=e.getRootElement();return!!t&&(t.hasAttribute("aria-controls")&&"typeahead-menu"===t.getAttribute("aria-controls"))}(e))return!1;const i=Qn();if(!Oc(i,r)){if(Dn(i)){if("backward"===n){if(i.focus.offset>0)return!1;const e=function(e){for(let t=e,n=e;null!==n;t=n,n=n.getParent())if(Lr(n)){if(n!==t&&n.getFirstChild()!==t)return null;if(!n.isInline())return n}return null}(i.focus.getNode());if(!e)return!1;const n=e.getPreviousSibling();return!!qc(n)&&(zc(t),t.shiftKey?i.focus.set(n.getParentOrThrow().getKey(),n.getIndexWithinParent(),"element"):n.selectEnd(),!0)}if(t.shiftKey&&("up"===n||"down"===n)){const e=i.focus.getNode();if(!i.isCollapsed()&&("up"===n&&!i.isBackward()||"down"===n&&i.isBackward())){let o=Ri(e,(e=>qc(e)));if(La(o)&&(o=Ri(o,qc)),o!==r)return!1;if(!o)return!1;const s="down"===n?o.getNextSibling():o.getPreviousSibling();if(!s)return!1;let l=0;"up"===n&&Lr(s)&&(l=s.getChildrenSize());let a=s;if("up"===n&&Lr(s)){a=s.getLastChild()||s,l=Tn(a)?a.getTextContentSize():0}const c=i.clone();return c.focus.set(a.getKey(),l,Tn(a)?"text":"element"),Lo(c),zc(t),!0}if(ui(e)){const e="up"===n?i.getNodes()[i.getNodes().length-1]:i.getNodes()[0];if(e&&null!==mc(r,e)){const e=r.getFirstDescendant(),t=r.getLastDescendant();if(!e||!t)return!1;const[n]=rc(e),[i]=rc(t),s=r.getCordsFromCellNode(n,o.table),l=r.getCordsFromCellNode(i,o.table),a=r.getDOMCellFromCordsOrThrow(s.x,s.y,o.table),c=r.getDOMCellFromCordsOrThrow(l.x,l.y,o.table);return o.$setAnchorCellForSelection(a),o.$setFocusCellForSelection(c,!0),!0}return!1}{let r=Ri(e,(e=>Lr(e)&&!e.isInline()));if(La(r)&&(r=Ri(r,qc)),!r)return!1;const s="down"===n?r.getNextSibling():r.getPreviousSibling();if(qc(s)&&o.tableNodeKey===s.getKey()){const e=s.getFirstDescendant(),r=s.getLastDescendant();if(!e||!r)return!1;const[o]=rc(e),[l]=rc(r),a=i.clone();return a.focus.set(("up"===n?o:l).getKey(),"up"===n?0:l.getChildrenSize(),"element"),zc(t),Lo(a),!0}}}}return"down"===n&&jc(e)&&o.setShouldCheckSelection(),!1}if(Dn(i)){if("backward"===n||"forward"===n)return Ic(e,t,i,t.shiftKey?"extend":"move","backward"===n,r,o);if(i.isCollapsed()){const{anchor:s,focus:l}=i,a=Ri(s.getNode(),La),c=Ri(l.getNode(),La);if(!La(a)||!a.is(c))return!1;const u=Dc(a);if(u!==r&&null!=u){const r=hc(u,e.getElementByKey(u.getKey()));if(null!=r)return o.table=vc(u,r),Kc(e,t,n,u,o)}const d=e.getElementByKey(a.__key),g=e.getElementByKey(s.key);if(null==g||null==d)return!1;let f;if("element"===s.type)f=g.getBoundingClientRect();else{const t=mi(pc(e));if(null===t||0===t.rangeCount)return!1;f=t.getRangeAt(0).getBoundingClientRect()}const h="up"===n?a.getFirstChild():a.getLastChild();if(null==h)return!1;const p=e.getElementByKey(h.__key);if(null==p)return!1;const m=p.getBoundingClientRect();if("up"===n?m.top>f.top-f.height:f.bottom+f.height>m.bottom){zc(t);const e=r.getCordsFromCellNode(a,o.table);if(!t.shiftKey)return Nc(o,r,e.x,e.y,n);{const t=r.getDOMCellFromCordsOrThrow(e.x,e.y,o.table);o.$setAnchorCellForSelection(t),o.$setFocusCellForSelection(t,!0)}return!0}}}else if(ac(i)){const{anchor:s,focus:l}=i,a=Ri(s.getNode(),La),c=Ri(l.getNode(),La),[u]=i.getNodes();qc(u)||Ia(251);const d=hc(u,e.getElementByKey(u.getKey()));if(!La(a)||!La(c)||!qc(u)||null==d)return!1;o.$updateTableTableSelection(i);const g=vc(u,d),f=r.getCordsFromCellNode(a,g),h=r.getDOMCellFromCordsOrThrow(f.x,f.y,g);if(o.$setAnchorCellForSelection(h),zc(t),t.shiftKey){const[e,t,i]=tc(r,a,c);return function(e,t,n,r,o){const i=oc(t,n,r),s=function(e,t){const{minColumn:n,maxColumn:r,minRow:o,maxRow:i}=t;let s=1,l=1,a=1,c=1;const u=e[o],d=e[i];for(let e=n;e<=r;e++)s=Math.max(s,u[e].cell.__rowSpan),c=Math.max(c,d[e].cell.__rowSpan);for(let t=o;t<=i;t++)l=Math.max(l,e[t][n].cell.__colSpan),a=Math.max(a,e[t][r].cell.__colSpan);return{bottomSpan:c,leftSpan:l,rightSpan:a,topSpan:s}}(t,i),{topSpan:l,leftSpan:a,bottomSpan:c,rightSpan:u}=s,d=function(e,t){const n=Ec(e,t);return null===n&&Ia(249,t.cell.getKey()),n}(i,n),[g,f]=Ac(d);let h=i[g],p=i[f];"forward"===o?h+="maxColumn"===g?1:a:"backward"===o?h-="minColumn"===g?1:u:"down"===o?p+="maxRow"===f?1:l:"up"===o&&(p-="minRow"===f?1:c);const m=t[p];if(void 0===m)return!1;const _=m[h];if(void 0===_)return!1;const[y,b]=function(e,t,n){const r=oc(e,t,n),o=Ec(r,t);if(o)return[Fc(e,r,o),Fc(e,r,Ac(o))];const i=Ec(r,n);if(i)return[Fc(e,r,Ac(i)),Fc(e,r,i)];const s=["minColumn","minRow"];return[Fc(e,r,s),Fc(e,r,Ac(s))]}(t,n,_),S=Wc(e,y.cell),C=Wc(e,b.cell);return e.$setAnchorCellForSelection(S),e.$setFocusCellForSelection(C,!0),!0}(o,e,t,i,n)}return c.selectEnd(),!0}return!1}function zc(e){e.preventDefault(),e.stopImmediatePropagation(),e.stopPropagation()}function $c(e,t,n){const r=Qr();"first"===e?t.insertBefore(r):t.insertAfter(r),r.append(...n||[]),r.selectEnd()}function Bc(e,t,n){const r=n.getParent();if(!r)return;const o=mi(pc(e));if(!o)return;const i=o.anchorNode,s=e.getElementByKey(r.getKey()),l=hc(n,e.getElementByKey(n.getKey()));if(!i||!s||!l||!s.contains(i)||l.contains(i))return;const a=Ri(t.anchor.getNode(),(e=>La(e)));if(!a)return;const c=Ri(a,(e=>qc(e)));if(!qc(c)||!c.is(n))return;const[u,d]=tc(n,a,a),g=u[0][0],f=u[u.length-1][u[0].length-1],{startRow:h,startColumn:p}=d,m=h===g.startRow&&p===g.startColumn,_=h===f.startRow&&p===f.startColumn;return m?"first":_?"last":void 0}function Wc(e,t){const{tableNode:n}=e.$lookup(),r=n.getCordsFromCellNode(t,e.table);return n.getDOMCellFromCordsOrThrow(r.x,r.y,e.table)}function Uc(e,t,n){return mc(e,Fo(t,n))}function Hc(e,t,n){if(!t.theme.tableAlignment)return;const r=[],o=[];for(const e of["center","right"]){const i=t.theme.tableAlignment[e];i&&(e===n?o:r).push(i)}Ys(e,...r),js(e,...o)}const Jc=new WeakSet;function jc(e=wi()){return Jc.has(e)}class Yc extends Mr{__rowStriping;__frozenColumnCount;__frozenRowCount;__colWidths;static getType(){return"table"}getColWidths(){return this.getLatest().__colWidths}setColWidths(e){const t=this.getWritable();return t.__colWidths=e,t}static clone(e){return new Yc(e.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__colWidths=e.__colWidths,this.__rowStriping=e.__rowStriping,this.__frozenColumnCount=e.__frozenColumnCount,this.__frozenRowCount=e.__frozenRowCount}static importDOM(){return{table:e=>({conversion:Vc,priority:1})}}static importJSON(e){return Gc().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setRowStriping(e.rowStriping||!1).setFrozenColumns(e.frozenColumnCount||0).setFrozenRows(e.frozenRowCount||0).setColWidths(e.colWidths)}constructor(e){super(e),this.__rowStriping=!1,this.__frozenColumnCount=0,this.__frozenRowCount=0}exportJSON(){return{...super.exportJSON(),colWidths:this.getColWidths(),frozenColumnCount:this.__frozenColumnCount?this.__frozenColumnCount:void 0,frozenRowCount:this.__frozenRowCount?this.__frozenRowCount:void 0,rowStriping:this.__rowStriping?this.__rowStriping:void 0}}extractWithChild(e,t,n){return"html"===n}getDOMSlot(e){const t=fc(e)?e:e.querySelector("table");return fc(t)||Ia(229),super.getDOMSlot(e).withElement(t).withAfter(t.querySelector("colgroup"))}createDOM(e,t){const n=document.createElement("table");this.__style&&(n.style.cssText=this.__style);const r=document.createElement("colgroup");if(n.appendChild(r),function(e){e.__lexicalUnmanaged=!0}(r),js(n,e.theme.table),this.updateTableElement(null,n,e),jc(t)){const t=document.createElement("div"),r=e.theme.tableScrollableWrapper;return r?js(t,r):t.style.cssText="overflow-x: auto;",t.appendChild(n),this.updateTableWrapper(null,t,n,e),t}return n}updateTableWrapper(e,t,n,r){this.__frozenColumnCount!==(e?e.__frozenColumnCount:0)&&function(e,t,n,r){r>0?(js(e,n.theme.tableFrozenColumn),t.setAttribute("data-lexical-frozen-column","true")):(Ys(e,n.theme.tableFrozenColumn),t.removeAttribute("data-lexical-frozen-column"))}(t,n,r,this.__frozenColumnCount),this.__frozenRowCount!==(e?e.__frozenRowCount:0)&&function(e,t,n,r){r>0?(js(e,n.theme.tableFrozenRow),t.setAttribute("data-lexical-frozen-row","true")):(Ys(e,n.theme.tableFrozenRow),t.removeAttribute("data-lexical-frozen-row"))}(t,n,r,this.__frozenRowCount)}updateTableElement(e,t,n){this.__style!==(e?e.__style:"")&&(t.style.cssText=this.__style),this.__rowStriping!==(!!e&&e.__rowStriping)&&function(e,t,n){n?(js(e,t.theme.tableRowStriping),e.setAttribute("data-lexical-row-striping","true")):(Ys(e,t.theme.tableRowStriping),e.removeAttribute("data-lexical-row-striping"))}(t,n,this.__rowStriping),function(e,t,n,r){const o=e.querySelector("colgroup");if(!o)return;const i=[];for(let e=0;e{if(t.after&&(n=t.after(n)),!fc(n)&&yi(n)&&(n=n.querySelector("table")),!fc(n))return null;Hc(n,e._config,this.getFormatType());const[r]=nc(this,null,null),o=new Map;for(const e of r)for(const t of e){const e=t.cell.getKey();o.has(e)||o.set(e,{colSpan:t.cell.getColSpan(),startColumn:t.startColumn})}const i=new Set;for(const e of n.querySelectorAll(":scope > tr > [data-temporary-table-cell-lexical-key]")){const t=e.getAttribute("data-temporary-table-cell-lexical-key");if(t){const n=o.get(t);if(e.removeAttribute("data-temporary-table-cell-lexical-key"),n){o.delete(t);for(let e=0;e colgroup");if(s){const e=Array.from(n.querySelectorAll(":scope > colgroup > col")).filter(((e,t)=>i.has(t)));s.replaceChildren(...e)}const l=n.querySelectorAll(":scope > tr");if(l.length>0){const e=document.createElement("tbody");for(const t of l)e.appendChild(t);n.append(e)}return n},element:!fc(n)&&yi(n)?n.querySelector("table"):n}}canBeEmpty(){return!1}isShadowRoot(){return!0}getCordsFromCellNode(e,t){const{rows:n,domRows:r}=t;for(let t=0;t{La(e)&&(t+=e.getColSpan())})),t}}function Vc(e){const t=Gc();e.hasAttribute("data-lexical-row-striping")&&t.setRowStriping(!0),e.hasAttribute("data-lexical-frozen-column")&&t.setFrozenColumns(1),e.hasAttribute("data-lexical-frozen-row")&&t.setFrozenRows(1);const n=e.querySelector(":scope > colgroup");if(n){let e=[];for(const t of n.querySelectorAll(":scope > col")){let n=t.style.width||"";if(!Aa.test(n)&&(n=t.getAttribute("width")||"",!/^\d+$/.test(n))){e=void 0;break}e.push(parseFloat(n))}e&&t.setColWidths(e)}return{after:e=>Zs(e,Ba),node:t}}function Gc(){return gi(new Yc)}function qc(e){return e instanceof Yc}const Zc=new Set(["http:","https:","mailto:","sms:","tel:"]);class Xc extends Mr{__url;__target;__rel;__title;static getType(){return"link"}static clone(e){return new Xc(e.__url,{rel:e.__rel,target:e.__target,title:e.__title},e.__key)}constructor(e="",t={},n){super(n);const{target:r=null,rel:o=null,title:i=null}=t;this.__url=e,this.__target=r,this.__rel=o,this.__title=i}createDOM(e){const t=document.createElement("a");return this.updateLinkDOM(null,t,e),js(t,e.theme.link),t}updateLinkDOM(e,t,n){if(_i(t)){e&&e.__url===this.__url||(t.href=this.sanitizeUrl(this.__url));for(const n of["target","rel","title"]){const r=`__${n}`,o=this[r];e&&e[r]===o||(o?t[n]=o:t.removeAttribute(n))}}}updateDOM(e,t,n){return this.updateLinkDOM(e,t,n),!1}static importDOM(){return{a:e=>({conversion:Qc,priority:1})}}static importJSON(e){return eu().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setURL(e.url).setRel(e.rel||null).setTarget(e.target||null).setTitle(e.title||null)}sanitizeUrl(e){e=lu(e);try{const t=new URL(lu(e));if(!Zc.has(t.protocol))return"about:blank"}catch(t){return e}return e}exportJSON(){return{...super.exportJSON(),rel:this.getRel(),target:this.getTarget(),title:this.getTitle(),url:this.getURL()}}getURL(){return this.getLatest().__url}setURL(e){const t=this.getWritable();return t.__url=e,t}getTarget(){return this.getLatest().__target}setTarget(e){const t=this.getWritable();return t.__target=e,t}getRel(){return this.getLatest().__rel}setRel(e){const t=this.getWritable();return t.__rel=e,t}getTitle(){return this.getLatest().__title}setTitle(e){const t=this.getWritable();return t.__title=e,t}insertNewAfter(e,t=!0){const n=eu(this.__url,{rel:this.__rel,target:this.__target,title:this.__title});return this.insertAfter(n,t),n}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}canBeEmpty(){return!1}isInline(){return!0}extractWithChild(e,t,n){if(!Dn(t))return!1;const r=t.anchor.getNode(),o=t.focus.getNode();return this.isParentOf(r)&&this.isParentOf(o)&&t.getTextContent().length>0}isEmailURI(){return this.__url.startsWith("mailto:")}isWebSiteURI(){return this.__url.startsWith("https://")||this.__url.startsWith("http://")}}function Qc(e){let t=null;if(_i(e)){const n=e.textContent;(null!==n&&""!==n||e.children.length>0)&&(t=eu(e.getAttribute("href")||"",{rel:e.getAttribute("rel"),target:e.getAttribute("target"),title:e.getAttribute("title")}))}return{node:t}}function eu(e="",t){return gi(new Xc(e,t))}function tu(e){return e instanceof Xc}class nu extends Xc{__isUnlinked;constructor(e="",t={},n){super(e,t,n),this.__isUnlinked=void 0!==t.isUnlinked&&null!==t.isUnlinked&&t.isUnlinked}static getType(){return"autolink"}static clone(e){return new nu(e.__url,{isUnlinked:e.__isUnlinked,rel:e.__rel,target:e.__target,title:e.__title},e.__key)}getIsUnlinked(){return this.__isUnlinked}setIsUnlinked(e){const t=this.getWritable();return t.__isUnlinked=e,t}createDOM(e){return this.__isUnlinked?document.createElement("span"):super.createDOM(e)}updateDOM(e,t,n){return super.updateDOM(e,t,n)||e.__isUnlinked!==this.__isUnlinked}static importJSON(e){return ru().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setIsUnlinked(e.isUnlinked||!1)}static importDOM(){return null}exportJSON(){return{...super.exportJSON(),isUnlinked:this.__isUnlinked}}insertNewAfter(e,t=!0){const n=this.getParentOrThrow().insertNewAfter(e,t);if(Lr(n)){const e=ru(this.__url,{isUnlinked:this.__isUnlinked,rel:this.__rel,target:this.__target,title:this.__title});return n.append(e),e}return null}}function ru(e="",t){return gi(new nu(e,t))}function ou(e){return e instanceof nu}function iu(e,t){if("element"===e.type){const n=e.getNode();return Lr(n)||function(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const e of t)r.append("v",e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(252),n.getChildren()[e.offset+t]||null}return null}const su=/^\+?[0-9\s()-]{5,}$/;function lu(e){return e.match(/^[a-z][a-z0-9+.-]*:/i)||e.match(/^[/#.]/)?e:e.includes("@")?`mailto:${e}`:su.test(e)?`tel:${e}`:`https://${e}`}function au(e,t=!0){if(e)return!1;let n=Ro().getTextContent();return t&&(n=n.trim()),""===n}function cu(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const e of t)r.append("v",e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function uu(e,t){let n=Date.now(),r=0;return(o,i,s,l,a,c)=>{const u=Date.now();if(c.has(Jr))return r=0,n=u,2;const d=function(e,t,n,r,o){if(null===e||0===n.size&&0===r.size&&!o)return 0;const i=t._selection,s=e._selection;if(o)return 1;if(!(Dn(i)&&Dn(s)&&s.isCollapsed()&&i.isCollapsed()))return 0;const l=function(e,t,n){const r=e._nodeMap,o=[];for(const e of t){const t=r.get(e);void 0!==t&&o.push(t)}for(const[e,t]of n){if(!t)continue;const n=r.get(e);void 0===n||$r(n)||o.push(n)}return o}(t,n,r);if(0===l.length)return 0;if(l.length>1){const n=t._nodeMap,r=n.get(i.anchor.key),o=n.get(s.anchor.key);return r&&o&&!e._nodeMap.has(r.__key)&&Tn(r)&&1===r.__text.length&&1===i.anchor.offset?2:0}const a=l[0],c=e._nodeMap.get(a.__key);if(!Tn(c)||!Tn(a)||c.__mode!==a.__mode)return 0;const u=c.__text,d=a.__text;if(u===d)return 0;const g=i.anchor,f=s.anchor;if(g.key!==f.key||"text"!==g.type)return 0;const h=g.offset,p=f.offset,m=d.length-u.length;return 1===m&&p===h-1?2:-1===m&&p===h+1?3:-1===m&&p===h?4:0}(o,i,l,a,e.isComposing()),g=(()=>{const g=null===s||s.editor===e,f=c.has("history-push");if(!f&&g&&c.has(jr))return 0;if(null===o)return 1;const h=i._selection;if(!(l.size>0||a.size>0))return null!==h?0:2;const p="number"==typeof t?t:t.peek();return!1===f&&0!==d&&d===r&&ur.exportJSON())))===JSON.stringify(n.read((()=>o.exportJSON())))}(Array.from(l)[0],o,i)?0:1})();return n=u,r=d,g}}function du(e){e.undoStack=[],e.redoStack=[],e.current=null}return{get $(){return il},A:nu,B:ht,C:Il,D:ct,E:Qn,F:Zr,G:Ri,H:gt,I:Qr,J:4,K:eo,L:ut,M:ot,N:dt,O:0,P:function(e,t,n){const r=uu(e,n),o=Js(e.registerCommand(Ge,(()=>(function(e,t){const n=t.redoStack,r=t.undoStack;if(0!==r.length){const o=t.current,i=r.pop();null!==o&&(n.push(o),e.dispatchCommand(vt,!0)),0===r.length&&e.dispatchCommand(wt,!1),t.current=i||null,i&&i.editor.setEditorState(i.editorState,{tag:Jr})}}(e,t),!0)),0),e.registerCommand(qe,(()=>(function(e,t){const n=t.redoStack,r=t.undoStack;if(0!==n.length){const o=t.current;null!==o&&(r.push(o),e.dispatchCommand(wt,!0));const i=n.pop();0===n.length&&e.dispatchCommand(vt,!1),t.current=i||null,i&&i.editor.setEditorState(i.editorState,{tag:Jr})}}(e,t),!0)),0),e.registerCommand(Ct,(()=>(du(t),!1)),0),e.registerCommand(xt,(()=>(du(t),e.dispatchCommand(vt,!1),e.dispatchCommand(wt,!1),!0)),0),e.registerUpdateListener((({editorState:n,prevEditorState:o,dirtyLeaves:i,dirtyElements:s,tags:l})=>{const a=t.current,c=t.redoStack,u=t.undoStack,d=null===a?null:a.editorState;if(null!==a&&n===d)return;const g=r(o,n,a,i,s,l);if(1===g)0!==c.length&&(t.redoStack=[],e.dispatchCommand(vt,!1)),null!==a&&(u.push({...a}),e.dispatchCommand(wt,!0));else if(2===g)return;t.current={editor:e,editorState:n}})));return o},Q:function(){return{current:null,redoStack:[],undoStack:[]}},R:2,S:No,T:qn,U:function(e){const t=e.getType(),n=yr();if(n._readOnly){const e=Ni(n).get(t);return e?Array.from(e.values()):[]}const r=n._nodeMap,o=[];for(const[,n]of r)n instanceof e&&n.__type===t&&n.isAttached()&&o.push(n);return o},V:function(e){if(!au(e,!1))return!1;const t=Ro().getChildren(),n=t.length;if(n>1)return!1;for(let e=0;ef){if(t===f){const e=f-r+1;n.setColSpan(n.__colSpan-e)}}else n.remove()}const m=s[u],_=c>d?m[c+r.__colSpan]:m[d+i.__colSpan];if(void 0!==_){const{cell:e}=_;qa(e)}else{const e=d{if(null===n){const t=Ri(e,(e=>!ou(e)&&tu(e)));t&&(t.insertBefore(e),0===t.getChildren().length&&t.remove())}else{const t=Ri(e,(e=>!ou(e)&&tu(e)));if(t)t.setURL(n),void 0!==r&&t.setTarget(r),void 0!==i&&t.setRel(i);else{const t=eu(n,{rel:i,target:r});e.insertBefore(t),t.append(e)}}}))}const l=s.extract();if(null===n)return void l.forEach((e=>{const t=Ri(e,(e=>!ou(e)&&tu(e)));if(t){const e=t.getChildren();for(let n=0;n{a.has(e.getKey())||(a.add(e.getKey()),e.setURL(n),void 0!==r&&e.setTarget(r),void 0!==i&&e.setRel(i),void 0!==o&&e.setTitle(o))};if(1===l.length){const e=l[0],t=Ri(e,tu);if(null!==t)return c(t)}!function(e){const t=Qn();if(!Dn(t))return e();const n=te(t),r=n.isBackward(),o=iu(n.anchor,r?-1:0),i=iu(n.focus,r?0:-1);if(e(),o||i){const e=Qn();if(Dn(e)){const t=e.clone();if(o){const e=o.getParent();e&&t.anchor.set(e.getKey(),o.getIndexWithinParent()+(r?1:0),"element")}if(i){const e=i.getParent();e&&t.focus.set(e.getKey(),i.getIndexWithinParent()+(r?0:1),"element")}Lo(te(t))}}}((()=>{let e=null;for(const t of l){if(!t.isAttached())continue;const s=Ri(t,tu);if(s){c(s);continue}if(Lr(t)){if(!t.isInline())continue;if(tu(t)){if(!(ou(t)||null!==e&&e.getParentOrThrow().isParentOf(t))){c(t),e=t;continue}for(const e of t.getChildren())t.insertBefore(e);t.remove();continue}}const l=t.getPreviousSibling();tu(l)&&l.is(e)?l.append(t):(e=eu(n,{rel:i,target:r,title:o}),t.insertAfter(e),e.append(t))}}))},aE:jl,aF:Hl,aG:function(){const e=Qn();if(!Dn(e)||!e.isCollapsed())return!1;const t=e.anchor.getNode();if(!Dl(t)||0!==t.getChildrenSize())return!1;const n=bl(t),r=t.getParent();Ul(r)||yl(40);const o=r.getParent();let i;if(ui(o))i=Qr(),n.insertAfter(i);else{if(!Dl(o))return!1;i=Ll(),o.insertAfter(i)}i.setTextStyle(e.style).setTextFormat(e.format).select();const s=t.getNextSiblings();if(s.length>0){const e=Wl(r.getListType());if(Dl(i)){const t=Ll();t.append(e),i.insertAfter(t)}else i.insertAfter(e);e.append(...s)}return function(e){let t=e;for(;null==t.getNextSibling()&&null==t.getPreviousSibling();){const e=t.getParent();if(null==e||!Dl(e)&&!Ul(e))break;t=e}t.remove()}(t),!0},aH:El,aI:wl,aJ:Jl,aK:function(e){e.update((()=>El()))},aL:function(e,t){e.update((()=>wl(t)))},aM:kt,aN:xt,aO:au,aP:Ir,aQ:gi,aR:ka,aS:na,aT:Yl,aU:Vn,aV:Kr,aW:function(e){ms(Vi(e,"next")).splice(1,e.getChildren())},aX:Dl,aY:lt,aZ:Kn,a_:Zn,aa:wa,ab:function(e){return e instanceof Sa},ac:et,ad:Xe,ae:st,af:Gs,ag:function(e){if("text"===e.type)return e.offset===e.getNode().getTextContentSize();const t=e.getNode();return Lr(t)||function(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const e of t)r.append("v",e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(177),e.offset===t.getChildrenSize()},ah:tu,ai:Da,aj:Ka,ak:Oa,al:Fa,am:function(e){const t=Ri(e,(e=>La(e)));return La(t)?t:null},an:ja,ao:function(e){return Ja(e).getChildren().findIndex((t=>t.is(e)))},ap:Ja,aq:La,ar:3,as:function(e,t,n=!0){const r=Gc();for(let o=0;ofunction(e,t){Sc(e)===t&&delete e[gc]}(l,s)));const a=t=>{if(s.pointerType=t.pointerType,0!==t.button||!bi(t.target)||!i)return;const r=Cc(t.target);null!==r&&n.update((()=>{const n=er();if(Ha&&t.shiftKey&&Oc(n,e)&&(Dn(n)||ac(n))){const o=n.anchor.getNode(),i=mc(e,n.anchor.getNode());i?(s.$setAnchorCellForSelection(Wc(s,i)),s.$setFocusCellForSelection(r),zc(t)):(e.isBefore(o)?e.selectStart():e.selectEnd()).anchor.set(n.anchor.key,n.anchor.offset,n.anchor.type)}else"touch"!==t.pointerType&&s.$setAnchorCellForSelection(r)})),(()=>{if(s.isSelecting)return;const e=()=>{s.isSelecting=!1,i.removeEventListener("pointerup",e),i.removeEventListener("pointermove",t)},t=r=>{if(!(e=>!(1&~e.buttons))(r)&&s.isSelecting)return s.isSelecting=!1,i.removeEventListener("pointerup",e),void i.removeEventListener("pointermove",t);if(!bi(r.target))return;let o=null;const a=!(Ha||l.contains(r.target));if(a)o=xc(l,r.target);else for(const e of document.elementsFromPoint(r.clientX,r.clientY))if(o=xc(l,e),o)break;!o||null!==s.focusCell&&o.elem===s.focusCell.elem||(s.setNextFocus({focusCell:o,override:a}),n.dispatchCommand(Ie,void 0))};s.isSelecting=!0,i.addEventListener("pointerup",e,s.listenerOptions),i.addEventListener("pointermove",t,s.listenerOptions)})()};l.addEventListener("pointerdown",a,s.listenerOptions),s.listenersToRemove.add((()=>{l.removeEventListener("pointerdown",a)}));const c=e=>{e.detail>=3&&bi(e.target)&&null!==Cc(e.target)&&e.preventDefault()};l.addEventListener("mousedown",c,s.listenerOptions),s.listenersToRemove.add((()=>{l.removeEventListener("mousedown",c)}));const u=e=>{const t=e.target;0===e.button&&bi(t)&&n.update((()=>{const e=Qn();ac(e)&&e.tableKey===s.tableNodeKey&&o.contains(t)&&s.$clearHighlight()}))};i.addEventListener("pointerdown",u,s.listenerOptions),s.listenersToRemove.add((()=>{i.removeEventListener("pointerdown",u)}));for(const[t,r]of _c)s.listenersToRemove.add(n.registerCommand(t,(t=>Kc(n,t,r,e,s)),3));s.listenersToRemove.add(n.registerCommand(lt,(t=>{const n=Qn();if(ac(n)){const r=mc(e,n.focus.getNode());if(null!==r)return zc(t),r.selectEnd(),!0}return!1}),3));const d=t=>()=>{const n=Qn();if(!Oc(n,e))return!1;if(ac(n))return s.$clearText(),!0;if(Dn(n)){if(!La(mc(e,n.anchor.getNode())))return!1;const r=n.anchor.getNode(),o=n.focus.getNode(),i=e.isParentOf(r),l=e.isParentOf(o);if(i&&!l||l&&!i)return s.$clearText(),!0;const a=Ri(n.anchor.getNode(),(e=>Lr(e))),c=a&&Ri(a,(e=>Lr(e)&&La(e.getParent())));if(!Lr(c)||!Lr(a))return!1;if(t===Ye&&null===c.getPreviousSibling())return!0}return!1};for(const e of yc)s.listenersToRemove.add(n.registerCommand(e,d(e),4));const g=t=>{const n=Qn();if(!ac(n)&&!Dn(n))return!1;const r=e.isParentOf(n.anchor.getNode());if(r!==e.isParentOf(n.focus.getNode())){const t=r?"anchor":"focus",o=r?"focus":"anchor",{key:i,offset:s,type:l}=n[o];return e[n[t].isBefore(n[o])?"selectPrevious":"selectNext"]()[o].set(i,s,l),!1}return!!Oc(n,e)&&!!ac(n)&&(t&&(t.preventDefault(),t.stopPropagation()),s.$clearText(),!0)};for(const e of bc)s.listenersToRemove.add(n.registerCommand(e,g,4));return s.listenersToRemove.add(n.registerCommand(bt,(e=>{const t=Qn();if(t){if(!ac(t)&&!Dn(t))return!1;oa(n,qs(e,ClipboardEvent)?e:null,la(t));const r=g(e);return Dn(t)?(t.removeText(),!0):r}return!1}),4)),s.listenersToRemove.add(n.registerCommand(Ve,(t=>{const n=Qn();if(!Oc(n,e))return!1;if(ac(n))return s.$formatCells(t),!0;if(Dn(n)){const e=Ri(n.anchor.getNode(),(e=>La(e)));if(!La(e))return!1}return!1}),4)),s.listenersToRemove.add(n.registerCommand(ht,(t=>{const n=Qn();if(!ac(n)||!Oc(n,e))return!1;const r=n.anchor.getNode(),o=n.focus.getNode();if(!La(r)||!La(o))return!1;if(function(e,t){if(ac(e)){const n=e.anchor.getNode(),r=e.focus.getNode();if(t&&n&&r){const[e]=tc(t,n,r);return n.getKey()===e[0][0].cell.getKey()&&r.getKey()===e[e.length-1].at(-1).cell.getKey()}}return!1}(n,e))return e.setFormat(t),!0;const[i,s,l]=tc(e,r,o),a=Math.max(s.startRow+s.cell.__rowSpan-1,l.startRow+l.cell.__rowSpan-1),c=Math.max(s.startColumn+s.cell.__colSpan-1,l.startColumn+l.cell.__colSpan-1),u=Math.min(s.startRow,l.startRow),d=Math.min(s.startColumn,l.startColumn),g=new Set;for(let e=u;e<=a;e++)for(let n=d;n<=c;n++){const r=i[e][n].cell;if(g.has(r))continue;g.add(r),r.setFormat(t);const o=r.getChildren();for(let e=0;e{const r=Qn();if(!Oc(r,e))return!1;if(ac(r))return s.$clearHighlight(),!1;if(Dn(r)){const o=Ri(r.anchor.getNode(),(e=>La(e)));if(!La(o))return!1;if("string"==typeof t){const o=Bc(n,r,e);if(o)return $c(o,e,[kn(t)]),!0}}return!1}),4)),s.listenersToRemove.add(n.registerCommand(ct,(t=>{const n=Qn();if(!Dn(n)||!n.isCollapsed()||!Oc(n,e))return!1;const r=Lc(n.anchor.getNode());return!(null===r||!e.is(Dc(r))||(zc(t),function(e,t){const n="next"===t?"getNextSibling":"getPreviousSibling",r="next"===t?"getFirstChild":"getLastChild",o=e[n]();if(Lr(o))return o.selectEnd();const i=Ri(e,Ba);null===i&&Ia(247);for(let e=i[n]();Ba(e);e=e[n]()){const t=e[r]();if(Lr(t))return t.selectEnd()}const s=Ri(i,qc);null===s&&Ia(248),"next"===t?s.selectNext():s.selectPrevious()}(r,t.shiftKey?"previous":"next"),0))}),4)),s.listenersToRemove.add(n.registerCommand(kt,(t=>e.isSelected()),3)),s.listenersToRemove.add(n.registerCommand(Ke,((e,t)=>{if(n!==t)return!1;const{nodes:r,selection:o}=e,i=o.getStartEndPoints(),s=ac(o),l=Dn(o)&&null!==Ri(o.anchor.getNode(),(e=>La(e)))&&null!==Ri(o.focus.getNode(),(e=>La(e)))||s;if(1!==r.length||!qc(r[0])||!l||null===i)return!1;const[a,c]=i,[u,d,g]=rc(a),f=Ri(c.getNode(),(e=>La(e)));if(!(La(u)&&La(f)&&Ba(d)&&qc(g)))return!1;const h=r[0],[p,m,_]=tc(g,u,f),[y]=nc(h,null,null),b=p.length,S=b>0?p[0].length:0;let C=m.startRow,x=m.startColumn,v=y.length,w=v>0?y[0].length:0;if(s){const e=oc(p,m,_),t=e.maxRow-e.minRow+1,n=e.maxColumn-e.minColumn+1;C=e.minRow,x=e.minColumn,v=Math.min(v,t),w=Math.min(w,n)}let k=!1;const T=Math.min(b,C+v)-1,N=Math.min(S,x+w)-1,E=new Set;for(let e=C;e<=T;e++)for(let t=x;t<=N;t++){const n=p[e][t];E.has(n.cell.getKey())||1===n.cell.__rowSpan&&1===n.cell.__colSpan||(ec(n.cell),E.add(n.cell.getKey()),k=!0)}let[A]=nc(g.getWritable(),null,null);const F=v-b+C;for(let e=0;e{Tn(e)?(Qr().append(e),s.append(e)):s.append(e)})),l.forEach((e=>e.remove()))}if(s&&k){const[e]=nc(g.getWritable(),null,null);e[m.startRow][m.startColumn].cell.selectEnd()}return!0}),4)),s.listenersToRemove.add(n.registerCommand(Ie,(()=>{const t=Qn(),r=er(),o=s.getAndClearNextFocus();if(null!==o){const{focusCell:n}=o;if(ac(t)&&t.tableKey===s.tableNodeKey)return(n.x!==s.focusX||n.y!==s.focusY)&&(s.$setFocusCellForSelection(n),!0);if(n!==s.anchorCell&&Oc(t,e))return s.$setFocusCellForSelection(n),!0}if(s.getAndClearShouldCheckSelection()&&Dn(r)&&Dn(t)&&t.isCollapsed()){const n=t.anchor.getNode(),r=e.getFirstChild(),o=Lc(n);if(null!==o&&Ba(r)){const t=r.getFirstChild();if(La(t)&&e.is(Ri(o,(n=>n.is(e)||n.is(t)))))return t.selectStart(),!0}}if(Dn(t)){const{anchor:o,focus:i}=t,l=o.getNode(),a=i.getNode(),c=Lc(l),u=Lc(a),d=!(!c||!e.is(Dc(c))),g=!(!u||!e.is(Dc(u))),f=d!==g,h=d&&g,p=t.isBackward();if(f){const r=t.clone();if(g){const[t]=tc(e,u,u),n=t[0][0].cell,o=t[t.length-1].at(-1).cell;r.focus.set(p?n.getKey():o.getKey(),p?n.getChildrenSize():o.getChildrenSize(),"element")}else if(d){const[t]=tc(e,c,c),n=t[0][0].cell,o=t[t.length-1].at(-1).cell;r.anchor.set(p?o.getKey():n.getKey(),p?o.getChildrenSize():0,"element")}Lo(r),Tc(n,s)}else if(h&&(c.is(u)||(s.$setAnchorCellForSelection(Wc(s,c)),s.$setFocusCellForSelection(Wc(s,u),!0)),"touch"===s.pointerType&&s.isSelecting&&t.isCollapsed()&&Dn(r)&&r.isCollapsed())){const e=Lc(r.anchor.getNode());e&&!e.is(u)&&(s.$setAnchorCellForSelection(Wc(s,e)),s.$setFocusCellForSelection(Wc(s,u),!0),s.pointerType=null)}}else if(t&&ac(t)&&t.is(r)&&t.tableKey===e.getKey()){const r=mi(i);if(r&&r.anchorNode&&r.focusNode){const o=Fo(r.focusNode),i=o&&!e.isParentOf(o),s=Fo(r.anchorNode),l=s&&e.isParentOf(s);if(i&&l&&r.rangeCount>0){const o=function(e,t){return Xn(null,e,t,null)}(r,n);o&&(o.anchor.set(e.getKey(),t.isBackward()?e.getChildrenSize():0,"element"),r.removeAllRanges(),Lo(o))}}}return t&&!t.is(r)&&(ac(t)||ac(r))&&s.tableSelection&&!s.tableSelection.is(r)?(ac(t)&&t.tableKey===s.tableNodeKey?s.$updateTableTableSelection(t):!ac(t)&&ac(r)&&r.tableKey===s.tableNodeKey&&s.$updateTableTableSelection(null),!1):(s.hasHijackedSelectionStyles&&!e.isSelected()?function(e,t){t.$enableHighlightStyle(),kc(t.table,(t=>{const n=t.elem;t.highlighted=!1,Mc(e,t),n.getAttribute("style")||n.removeAttribute("style")}))}(n,s):!s.hasHijackedSelectionStyles&&e.isSelected()&&Tc(n,s),!1)}),4)),s.listenersToRemove.add(n.registerCommand(We,(()=>{const t=Qn();if(!Dn(t)||!t.isCollapsed()||!Oc(t,e))return!1;const r=Bc(n,t,e);return!!r&&($c(r,e),!0)}),4)),s},av:Fo,aw:function(e){const t=Ja(e);return ja(t).getChildren().findIndex((e=>e.is(t)))},ax:function(e=!0){const t=Qn();Dn(t)||ac(t)||Ia(188);const n=t.anchor.getNode(),r=t.focus.getNode(),[o]=rc(n),[i,,s]=rc(r),[,l,a]=tc(s,i,o),{startRow:c}=a,{startRow:u}=l;return e?Va(c+o.__rowSpan>u+i.__rowSpan?o:i,!0):Va(u=c;e--){for(let t=g-1;t>=0;t--){const{cell:n,startRow:r,startColumn:o}=s[e][t];if(o===t){if(rd){const e=Math.max(r,c),t=Math.min(n.__rowSpan+r-1,d),o=e<=t?t-e+1:0;n.setRowSpan(n.__rowSpan-o)}if(r>=c&&r+n.__rowSpan-1>d&&e===d){null===h&&Ia(122);let r=null;for(let n=0;n1&&(n+=o.__colSpan-1)}null===r?Za(h,n):r.insertAfter(n)}}}const t=o.getChildAtIndex(e);Ba(t)||Ia(206,String(e)),t.remove()}if(void 0!==f){const{cell:e}=f[0];qa(e)}else{const e=s[c-1],{cell:t}=e[0];qa(t)}},az:function(e=!0){const t=Qn();Dn(t)||ac(t)||Ia(188);const n=t.anchor.getNode(),r=t.focus.getNode(),[o]=rc(n),[i,,s]=rc(r),[,l,a]=tc(s,i,o),{startColumn:c}=a,{startColumn:u}=l;return e?Ga(c+o.__colSpan>u+i.__colSpan?o:i,!0):Ga(u{Object.keys(e).forEach((t=>{let r=n.get(t);void 0===r&&(r=[],n.set(t,r)),r.push(e[t])}))};return e.forEach((e=>{const t=e.klass.importDOM;if(null==t||r.has(t))return;r.add(t);const n=t.call(e.klass);null!==n&&o(n)})),t&&o(t),n}(f,d?d.import:void 0),g,e);return void 0!==a&&(h._pendingEditorState=a,h._dirtyType=2),h},e:function(e){return Js(e.registerCommand(ze,(e=>{const t=Qn();return!!Kn(t)&&(t.clear(),!0)}),0),e.registerCommand($e,(e=>{const t=Qn();return Dn(t)?(t.deleteCharacter(e),!0):!!Kn(t)&&(t.deleteNodes(),!0)}),0),e.registerCommand(je,(e=>{const t=Qn();return!!Dn(t)&&(t.deleteWord(e),!0)}),0),e.registerCommand(Ye,(e=>{const t=Qn();return!!Dn(t)&&(t.deleteLine(e),!0)}),0),e.registerCommand(Ue,(t=>{const n=Qn();if("string"==typeof t)null!==n&&n.insertText(t);else{if(null===n)return!1;const r=t.dataTransfer;if(null!=r)Ql(r,n,e);else if(Dn(n)){const e=t.data;return e&&n.insertText(e),!0}}return!0}),0),e.registerCommand(Je,(()=>{const e=Qn();return!!Dn(e)&&(e.removeText(),!0)}),0),e.registerCommand(Ve,(e=>{const t=Qn();return!!Dn(t)&&(t.formatText(e),!0)}),0),e.registerCommand(ht,(e=>{const t=Qn();if(!Dn(t)&&!Kn(t))return!1;const n=t.getNodes();for(const t of n){const n=Ri(t,(e=>Lr(e)&&!e.isInline()));null!==n&&n.setFormat(e)}return!0}),0),e.registerCommand(Be,(e=>{const t=Qn();return!!Dn(t)&&(t.insertLineBreak(e),!0)}),0),e.registerCommand(We,(()=>{const e=Qn();return!!Dn(e)&&(e.insertParagraph(),!0)}),0),e.registerCommand(ut,(()=>(function(e){let t=Qn()||er();null===t&&(t=Ro().selectEnd()),t.insertNodes(e)}([An()]),!0)),0),e.registerCommand(dt,(()=>Ta((e=>{const t=e.getIndent();e.setIndent(t+1)}))),0),e.registerCommand(gt,(()=>Ta((e=>{const t=e.getIndent();t>0&&e.setIndent(Math.max(0,t-1))}))),0),e.registerCommand(nt,(e=>{const t=Qn();if(Kn(t)){const e=t.getNodes();if(e.length>0)return e[0].selectPrevious(),!0}else if(Dn(t)){const n=Qo(t.focus,!0);if(!e.shiftKey&&Kr(n)&&!n.isIsolated()&&!n.isInline())return n.selectPrevious(),e.preventDefault(),!0}return!1}),0),e.registerCommand(rt,(e=>{const t=Qn();if(Kn(t)){const e=t.getNodes();if(e.length>0)return e[0].selectNext(0,0),!0}else if(Dn(t)){if(function(e){const t=e.focus;return"root"===t.key&&t.offset===Ro().getChildrenSize()}(t))return e.preventDefault(),!0;const n=Qo(t.focus,!1);if(!e.shiftKey&&Kr(n)&&!n.isIsolated()&&!n.isInline())return n.selectNext(),e.preventDefault(),!0}return!1}),0),e.registerCommand(et,(e=>{const t=Qn();if(Kn(t)){const n=t.getNodes();if(n.length>0)return e.preventDefault(),Ps(n[0])?n[0].selectNext(0,0):n[0].selectPrevious(),!0}if(!Dn(t))return!1;if(Ks(t,!0)){const n=e.shiftKey;return e.preventDefault(),$s(t,n,!0),!0}return!1}),0),e.registerCommand(Xe,(e=>{const t=Qn();if(Kn(t)){const n=t.getNodes();if(n.length>0)return e.preventDefault(),Ps(n[0])?n[0].selectPrevious():n[0].selectNext(0,0),!0}if(!Dn(t))return!1;const n=e.shiftKey;return!!Ks(t,!1)&&(e.preventDefault(),$s(t,n,!1),!0)}),0),e.registerCommand(st,(t=>{if(Na(t.target))return!1;const n=Qn();if(Dn(n)){if(function(e){if(!e.isCollapsed())return!1;const{anchor:t}=e;if(0!==t.offset)return!1;const n=t.getNode();if($r(n))return!1;const r=function(e){const t=Ri(e,(e=>Lr(e)&&!e.isInline()));return Lr(t)||Bs(4,e.__key),t}(n);return r.getIndent()>0&&(r.is(n)||n.is(r.getFirstDescendant()))}(n))return t.preventDefault(),e.dispatchCommand(gt,void 0);if(ha&&"ko-KR"===navigator.language)return!1}else if(!Kn(n))return!1;return t.preventDefault(),e.dispatchCommand($e,!0)}),0),e.registerCommand(at,(t=>{if(Na(t.target))return!1;const n=Qn();return!(!Dn(n)&&!Kn(n))&&(t.preventDefault(),e.dispatchCommand($e,!1))}),0),e.registerCommand(ot,(t=>{const n=Qn();if(!Dn(n))return!1;if(Ea(n),null!==t){if((ha||fa||ma)&&ga)return!1;if(t.preventDefault(),t.shiftKey)return e.dispatchCommand(Be,!1)}return e.dispatchCommand(We,void 0)}),0),e.registerCommand(lt,(()=>!!Dn(Qn())&&(e.blur(),!0)),0),e.registerCommand(ft,(t=>{const[,n]=ka(t);if(n.length>0){const r=aa(t.clientX,t.clientY);if(null!==r){const{offset:t,node:o}=r,i=Fo(o);if(null!==i){const e=qn();if(Tn(i))e.anchor.set(i.getKey(),t,"text"),e.focus.set(i.getKey(),t,"text");else{const t=i.getParentOrThrow().getKey(),n=i.getIndexWithinParent()+1;e.anchor.set(t,n,"element"),e.focus.set(t,n,"element")}Lo(te(e))}e.dispatchCommand(_a,n)}return t.preventDefault(),!0}return!!Dn(Qn())}),0),e.registerCommand(pt,(e=>{const[t]=ka(e),n=Qn();return!(t&&!Dn(n))}),0),e.registerCommand(mt,(e=>{const[t]=ka(e),n=Qn();if(t&&!Dn(n))return!1;const r=aa(e.clientX,e.clientY);if(null!==r){Kr(Fo(r.node))&&e.preventDefault()}return!0}),0),e.registerCommand(St,(()=>(function(e){const t=Ro();if(Dn(e)){const t=e.anchor,n=e.focus,r=t.getNode().getTopLevelElementOrThrow().getParentOrThrow();return t.set(r.getKey(),0,"element"),n.set(r.getKey(),r.getChildrenSize(),"element"),te(e),e}{const e=t.select(0,t.getChildrenSize());Lo(te(e))}}(),!0)),0),e.registerCommand(yt,(t=>(oa(e,qs(t,ClipboardEvent)?t:null),!0)),0),e.registerCommand(bt,(t=>(async function(e,t){await oa(t,qs(e,ClipboardEvent)?e:null),t.update((()=>{const e=Qn();Dn(e)?e.removeText():Kn(e)&&e.getNodes().forEach((e=>e.remove()))}))}(t,e),!0)),0),e.registerCommand(He,(t=>{const[,n,r]=ka(t);return n.length>0&&!r?(e.dispatchCommand(_a,n),!0):(!bi(t.target)||!uo(t.target))&&(null!==Qn()&&(function(e,t){e.preventDefault(),t.update((()=>{const n=Qn(),r=qs(e,InputEvent)||qs(e,KeyboardEvent)?null:e.clipboardData;null!=r&&null!==n&&Ql(r,n,t)}),{tag:"paste"})}(t,e),!0))}),0),e.registerCommand(it,(e=>{const t=Qn();return Dn(t)&&Ea(t),!1}),0),e.registerCommand(ct,(e=>{const t=Qn();return Dn(t)&&Ea(t),!1}),0))},f:Be,g:Lr,h:We,i:Ve,j:mn,k:pt,l:Lo,get m(){return e},n:function(e){if(e.__esModule)return e;var t=e.default;if("function"==typeof t){var n=function e(){if(this instanceof e){var n=[null];return n.push.apply(n,arguments),new(Function.bind.apply(t,n))}return t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach((function(t){var r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:function(){return e[t]}})})),n},o:Xc,p:an,q:Ul,r:ll,s:1,t:Js,u:Dn,v:function(e,t,n,r){const o=e=>e instanceof n,i=e=>{const t=kn(e.getTextContent());t.setFormat(e.getFormat()),e.replace(t)};return[e.registerNodeTransform(mn,(e=>{if(!e.isSimpleText())return;let n,s=e.getPreviousSibling(),l=e.getTextContent(),a=e;if(Tn(s)){const n=s.getTextContent(),r=t(n+l);if(o(s)){if(null===r||0!==(e=>e.getLatest().__mode)(s))return void i(s);{const t=r.end-n.length;if(t>0){const r=n+l.slice(0,t);if(s.select(),s.setTextContent(r),t===l.length)e.remove();else{const n=l.slice(t);e.setTextContent(n)}return}}}else if(null===r||r.start{const n=e.getTextContent(),r=t(n);if(null===r||0!==r.start)return void i(e);if(n.length>r.end)return void e.splitText(r.end);const s=e.getPreviousSibling();Tn(s)&&s.isTextEntity()&&(i(s),i(e));const l=e.getNextSibling();Tn(l)&&l.isTextEntity()&&(i(l),o(e)&&i(e))}))]},w:Tn,x:$r,y:Yc,z:ft}})); SML.di("./C42E8rVVpA.js",import.meta.url,"C42E8rVVpA");SML.di("./CsxDAjmHZE.js",import.meta.url,"CsxDAjmHZE");SML.di("./BsuRkrTcpO.js",import.meta.url,"BsuRkrTcpO");SML.di("./BskNjLbli-.js",import.meta.url,"BskNjLbli-"); SML.dm("DT4H06b_az",["C42E8rVVpA","CsxDAjmHZE","BsuRkrTcpO","BskNjLbli-"],(async(e,t,r,n)=>{let o=class extends t.s{constructor(){super(...arguments),this.pubsub=new e.m(this),this._activateFeature=async t=>e.j(t),this.openCTL=async({authorName:t,thingId:r,userDetailType:n})=>{const o=n?{userDetailType:n}:void 0;await this._activateFeature({name:e.br,renderMode:e.P.Contents,routeParams:{authorName:t,thingId:r},queryParams:{...o}})}}connectedCallback(){super.connectedCallback(),this.pubsub.subscribe(e.T.CTLReportInit,this.openCTL,!1)}render(){return t.x``}};o=e._([e.e("ctl-reporting-provider")],o);let a=class extends t.s{constructor(){super(...arguments),this.closeCTLModal=()=>{this.ctlModal?.hide(),this.dispatchEvent(e.c("report-flow-close"))}}get ctlModal(){return document.querySelector("rpl-dialog#ctl-report-content-modal")}get ctlModalContents(){return document.querySelector("#ctl-report-content-modal rpl-modal-card")}};a=e._([e.e("base-ctl-component")],a);let i=class extends a{constructor(){super(...arguments),this.requestClientGQL=e.C,this.showThankYou=()=>{const t=e.c("shreddit-slotter-set-slot-name",{slotName:"thankyou"});this.ctlModalContents?.querySelector("shreddit-slotter")?.dispatchEvent(t)},this.reportRequest=async(e,t)=>{const n=r.g[e];if(!n)throw new Error("No corresponding gql operation for the item type provided");try{const e=await this.requestClientGQL({operation:n,variables:{input:t}});return r.c(e)?e:void 0}catch(e){throw new Error("Error calling the gql report operation")}},this.submitCTLReport=async()=>{if(!this.thingId)return;const t=r.a(this.thingId);try{const o=r.b({itemType:t,formValues:{REPORT_REASONS:"SELF_HARM",...(this.userDetailType ? {USER_DETAILS:this.userDetailType} : {})},thingId:this.thingId});if(!(await this.reportRequest(t,o)))throw new Error;this.showThankYou(),this.dispatchEvent(e.c("report-tracking",{reportFlow:{flowOptionSelected:n.F.REDDITCARES_BUTTON}}))}catch(t){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."}))}}}render(){return t.x``}};e._([e.n({type:String,attribute:"author-name"})],i.prototype,"authorName",void 0),e._([e.n({type:String,attribute:"thing-id"})],i.prototype,"thingId",void 0),e._([e.n({type:String,attribute:"user-detail-type"})],i.prototype,"userDetailType",void 0),i=e._([e.e("ctl-step-one")],i);let s=class extends a{constructor(){super(...arguments),this.firstUpdated=()=>{this.okButton?.addEventListener("click",this.closeCTLModal)}}get okButton(){return this.querySelector("#ctl-ok-button")}render(){return t.x``}};s=e._([e.e("ctl-step-two")],s)})); 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("DYFdTZXVs2",["C42E8rVVpA","CsxDAjmHZE","DUzIBJc2in"],(async(e,t,s)=>{let a=class extends(s.W(e.aF)){constructor(){super(...arguments),this.pages=0,this.for=void 0,this._events=new e.E(this),this._windowEvents=new e.E(this,(()=>window)),this._locationHashMap=new Map,this._selectedElements=new Set,this._activeSlotRef=e.U(),this._handleHashChange=this._windowEvents.define("hashchange",(()=>{const e=this._locationHashMap.get(window.location.hash);e&&(this.pageIndex=e)})),this._handleClick=this._events.define("click",(e=>{let t=null;e.target instanceof HTMLAnchorElement&&(t=e.target.getAttribute("href"),t&&"#"!==t[0]&&(t=null)),null!==t&&(e.preventDefault(),e.stopPropagation());const s=e.composedPath();for(let e=0;e{if("ArrowLeft"===e.key)this.previousPage();else{if("ArrowRight"!==e.key)return;this.nextPage()}e.preventDefault(),e.stopPropagation()}))}get pageIndex(){return super.pageIndex}set pageIndex(e){super.pageIndex=e}get pageNames(){return super.pageNames}set pageNames(e){super.pageNames=e}render(){if(this.pages<1)return t.x``;const{pageNames:a}=this;return t.x`
${s.b(this.pages).map((s=>t.x` `))}
`}updated(e){if(e.has("pageIndex")){this._clearSelectedAttributes();const e=this._activeSlotRef.value;if(!e)return;for(const t of e.assignedElements())this._setSelectedAttribute(t),t.focus()}}_clearSelectedAttributes(){if(this._selectedElements.size){for(const e of this._selectedElements)e.removeAttribute("faceplate-tab-selected");this._selectedElements.clear()}}_setSelectedAttribute(e){this._selectedElements.add(e),e.setAttribute("faceplate-tab-selected","")}handleSlotChange(e){const{hash:t}=window.location,s=e.target;if(!(s.parentElement instanceof HTMLSpanElement))return;const a=s.assignedElements(),n=this.getPageIndexFromSpanWrapper(s.parentElement),i=n===this.pageIndex;if(i&&this._clearSelectedAttributes(),a.length)for(const e of a){if(i&&this._setSelectedAttribute(e),!(e instanceof HTMLAnchorElement))continue;const s=e.getAttribute("href");s&&(this._locationHashMap.set(s,n),s===t&&(this.pageIndex=n))}}getPageIndexFromSpanWrapper(e){return e.dataset.i?parseInt(e.dataset.i,10):0}pageIndexChangedCallback(e){super.pageIndexChangedCallback(e),this.requestUpdate("pageIndex",e)}};return e._([e.n({type:Number})],a.prototype,"pages",void 0),e._([e.n({type:Number,attribute:"pageindex"})],a.prototype,"pageIndex",null),e._([e.n({type:String})],a.prototype,"for",void 0),e._([e.n({converter:e.J,attribute:"pagenames"})],a.prototype,"pageNames",null),e._([e.Q(".tablist")],a.prototype,"tabList",void 0),a=e._([e.e("faceplate-tablist")],a),{get F(){return a}}})); 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("./CCtMKamAzh.js",import.meta.url,"CCtMKamAzh");SML.di("./CndptGkkPK.js",import.meta.url,"CndptGkkPK");SML.di("./DW4Y66xecc.js",import.meta.url,"DW4Y66xecc"); SML.dm("D_F1vtGIq1",["C42E8rVVpA","DUzIBJc2in","CsxDAjmHZE","CCtMKamAzh","CndptGkkPK","DW4Y66xecc"],(async(t,e,o,i)=>{const s=new WeakMap;let r=class extends i.C{constructor(){super(),this.ariaRole="radio"}static get styles(){return[super.styles,o.i`:host(:focus) .icon{border-radius:100%}:host{margin:var(--spacer-sm)}:host([checked]) .icon,:host([indeterminate]) .icon{display:inline-block;color:var(--color-input-radio-hover)}:host .icon{color:var(--color-input-radio)}:host(:hover) .icon{color:var(--color-input-radio-hover)}`]}connectedCallback(){super.connectedCallback(),this._contextKey=e.g(this.name,this.getRootNode()),s.has(this._contextKey)?s.get(this._contextKey).add(this):s.set(this._contextKey,new Set([this]))}disconnectedCallback(){super.disconnectedCallback(),this._contextKey&&s.get(this._contextKey)?.delete(this)}handleInteraction(){if(this._contextKey){const t=s.get(this._contextKey);if(t)for(const e of t)e!==this&&(e.checked=!1)}this.checked=!0,super.handleInteraction()}render(){const t={size:o.h.Small,attributes:{className:"icon"}};return o.x` ${this.checked?o.n(t):o.p(t)} ${super.render()} `}};return r=t._([t.e("faceplate-radio-input")],r),{get FaceplateRadioInput(){return r}}})); SML.di("./CsxDAjmHZE.js",import.meta.url,"CsxDAjmHZE"); SML.dm("Da26ZrtZTU",["CsxDAjmHZE"],(async a=>{const{svg:c}=a.g(),h=a.m(c``,"0 0 20 20","day"),{svg:l}=a.g();return{d:h,n:a.m(l``,"0 0 20 20","night")}})); SML.di("./C42E8rVVpA.js",import.meta.url,"C42E8rVVpA");SML.di("./CsxDAjmHZE.js",import.meta.url,"CsxDAjmHZE");SML.di("./CCtMKamAzh.js",import.meta.url,"CCtMKamAzh"); SML.dm("DaR0j2K3uG",["C42E8rVVpA","CsxDAjmHZE","CCtMKamAzh"],(async(e,t,i)=>{var s;!function(e){e.CHECKED="faceplate-checkbox-input:checked",e.UNCHECKED="faceplate-checkbox-input:unchecked"}(s||(s={}));let a=class extends i.C{constructor(){super(),this.indeterminate=!1,this.ariaRole="checkbox"}static get styles(){return[super.styles,t.i`:host(:focus-visible) svg{outline:1px auto var(--color-global-focus)}`]}handleInteraction(){this.checked=!this.checked,this.dispatchEvent(e.c(this.checked?s.CHECKED:s.UNCHECKED)),super.handleInteraction(),this.indeterminate&&(this.indeterminate=!1)}render(){return t.x` ${this.indeterminate?t.f({attributes:{className:"icon"},size:t.h.Small}):this.checked?t.j({attributes:{className:"icon"},size:t.h.Small}):t.k({attributes:{className:"icon"},size:t.h.Small})} ${super.render()} `}};e._([e.n({type:Boolean})],a.prototype,"indeterminate",void 0),a=e._([e.e("faceplate-checkbox-input")],a)})); SML.di("./CsxDAjmHZE.js",import.meta.url,"CsxDAjmHZE"); SML.dm("DdaDf_pDuu",["CsxDAjmHZE"],(async h=>{const{svg:s}=h.g();return{a:h.m(s``,"0 0 20 20","add")}})); SML.di("./C42E8rVVpA.js",import.meta.url,"C42E8rVVpA");SML.di("./DW4Y66xecc.js",import.meta.url,"DW4Y66xecc");SML.di("./CsxDAjmHZE.js",import.meta.url,"CsxDAjmHZE");SML.di("./B01f6V9jnX.js",import.meta.url,"B01f6V9jnX");SML.di("./Da-UYDWSOS.js",import.meta.url,"Da-UYDWSOS");SML.di("./CndptGkkPK.js",import.meta.url,"CndptGkkPK");SML.di("./BcUlF1uWDA.js",import.meta.url,"BcUlF1uWDA"); SML.dm("Dg2hMEypTN",["C42E8rVVpA","DW4Y66xecc","CsxDAjmHZE","B01f6V9jnX","CndptGkkPK","BcUlF1uWDA","Da-UYDWSOS"],(async(e,t,i,l,a,r)=>{let s=class extends a.F{constructor(){super(...arguments),this.appearance=r.T.SECONDARY,this.label="",this.clearable=!1,this.multiple=!1,this.required=!1,this.prefix=null,this.helperTextLevel=null,this.helperTextPlaceholder="",this.helperTextAriaLive="polite",this.helperTextMessage="",this.readonly=!1,this.inputRef=e.U(),this._selectController=new l.S(this),this.focus=()=>{this.inputRef.value?.focus()},this.syncInputValidation=(e=!1)=>{const t=this.options.map((e=>e.value)),i=this.inputRef?.value?.value,l=this.value||this.arbitrary&&i||!this.arbitrary&&t.includes(i);if(this.required&&!l){const t=this.inputRef?.value?._internals.validationMessage;this.dropdownMenu?.hidden&&t&&(e?this.form?.invalidateFieldWithMessage(this.name,t):this.setCustomValidity(t))}else this.form?.invalidateFieldWithMessage(this.name,"")},this.resetFaceplateDirty=()=>{this.removeAttribute("faceplate-dirty")},this.matchOptionsToInput=e=>{if(this.autocomplete&&!this.multiple){const t=e.currentTarget?.value;this.options.forEach((e=>{const i=e.displayText?.toLowerCase().trim();if(this.onFilterOption?this.onFilterOption?.(t,e):i?.startsWith(t.toLowerCase())){if(!t)return e.removeAttribute("hidden"),void(e.matchedText="");e.hasAttribute("hidden")&&e.removeAttribute("hidden"),e.matchedText=e.displayText?.slice(0,t.length)}else e.setAttribute("hidden","")})),this._selectController.focusedIndex=0}},this.clear=e=>{e.preventDefault(),e.stopPropagation(),this._selectController.selectedOptions.forEach((e=>{e.resetSelection()})),this._selectController.value="",this.inputRef.value&&(this.inputRef.value.value="")},this.handleKeyBindings=e=>{this.readonly||this.multiple?e.preventDefault():"Backspace"!==e.key||this.multiple||(this._selectController.value="")},this.getTextField=()=>i.x` ${this.label} ${i.y({attributes:{"aria-hidden":"true"}})} `}get referenceElement(){return this.inputRef.value}get selectedOptions(){return this._selectController.selectedOptions}get selectedIndex(){return this._selectController.selectedIndex}get value(){return this._selectController.value}set value(e){e!==this.value&&(this._selectController.value=e)}connectedCallback(){super.connectedCallback(),this.addEventListener("focus",this.resetFaceplateDirty),this.addEventListener("keydown",this.handleKeyBindings)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("focus",this.resetFaceplateDirty),this.removeEventListener("keydown",this.handleKeyBindings)}async firstUpdated(){super.firstUpdated(),this.setupValidationSync()}async setupValidationSync(){const e=await t.c(this);e&&this.isConnected&&(this.inputRef.value?.hasValidationHelpers||this.inputRef.value?.setFormValidationHelpers(e),this.syncInputValidation(),this.addEventListener(e.validationTrigger,(()=>this.syncInputValidation(!0))),e.addEventListener("faceplate-submit",(()=>this.syncInputValidation(!0))))}static get styles(){return i.i`:host{display:inline-block}:host([disabled]){cursor:not-allowed}faceplate-text-input{flex:1}:host([readonly]){caret-color:transparent}faceplate-menu{height:var(--faceplate-select-menu-height,auto);width:var(--faceplate-select-menu-width,auto);max-height:var(--faceplate-select-menu-max-height,auto);max-width:var(--faceplate-select-menu-max-width,auto);overflow:auto}`}render(){return i.x` ${this.getTextField()} `}};e._([e.n({type:String})],s.prototype,"appearance",void 0),e._([e.n({type:String})],s.prototype,"label",void 0),e._([e.n({type:Boolean})],s.prototype,"clearable",void 0),e._([e.n({type:Boolean})],s.prototype,"multiple",void 0),e._([e.n({type:Boolean})],s.prototype,"required",void 0),e._([e.n({type:String})],s.prototype,"prefix",void 0),e._([e.n({type:String})],s.prototype,"autocomplete",void 0),e._([e.n({type:Boolean})],s.prototype,"arbitrary",void 0),e._([e.n({type:String,reflect:!0,attribute:"helper-text-level"})],s.prototype,"helperTextLevel",void 0),e._([e.n({type:String,attribute:"helper-text-placeholder"})],s.prototype,"helperTextPlaceholder",void 0),e._([e.n({type:String,reflect:!0,attribute:"helper-text-aria-live"})],s.prototype,"helperTextAriaLive",void 0),e._([e.n({type:String,attribute:"helper-text-message"})],s.prototype,"helperTextMessage",void 0),e._([e.n({type:String,attribute:"helper-text-screen-reader-msg"})],s.prototype,"helperTextScreenReaderMsg",void 0),e._([e.n()],s.prototype,"onFilterOption",void 0),e._([e.n({type:Boolean})],s.prototype,"readonly",void 0),e._([e.l()],s.prototype,"options",void 0),e._([e.l({selector:"faceplate-option:not([hidden])"})],s.prototype,"visibleOptions",void 0),e._([e.l()],s.prototype,"triggerSlot",void 0),e._([e.Q("faceplate-dropdown-menu")],s.prototype,"dropdownMenu",void 0),s=e._([e.e("faceplate-select-text-input")],s)})); SML.di("./C42E8rVVpA.js",import.meta.url,"C42E8rVVpA");SML.di("./CsxDAjmHZE.js",import.meta.url,"CsxDAjmHZE"); SML.dm("DoAaOvteiR",["C42E8rVVpA","CsxDAjmHZE"],(async(t,e)=>{var r;!function(t){t.Error="error",t.Success="success",t.Incomplete="incomplete"}(r||(r={}));const s=a(16);function o(t,e){return t-e/100*t}function a(t){return 2*Math.PI*t}let c=class extends e.s{constructor(){super(...arguments),this.value=0,this.status=r.Incomplete}static get styles(){return e.i`:host{--loader-size-base:var(--rem40);display:inline-block;position:relative}:host([status=incomplete]){color:var(--color-neutral-content,var(--color-tone-1))}:host([status=success]){color:var(--color-success-content,var(--color-alert-positive))}:host([status=error]){color:var(--color-danger-content,var(--color-alert-negative))}svg{height:var(--loader-size,var(--loader-size-base));width:var(--loader-size,var(--loader-size-base));fill:none;stroke-width:8;display:block}.bg{stroke:var(--color-neutral-content-disabled,var(--color-tone-3))}.track{stroke:currentColor;transition:.35s stroke-dashoffset;transform:rotate(-90deg);transform-origin:50% 50%}.icon{position:absolute;inset-inline-start:50%;top:50%;transform:translate(-50%,-50%)}::slotted([slot=error]),::slotted([slot=success]){display:flex}`}render(){const t=this.status===r.Success;return e.x`
`}};t._([t.n({type:Number})],c.prototype,"value",void 0),t._([t.n({type:String,reflect:!0})],c.prototype,"status",void 0),c=t._([t.e("faceplate-progress")],c);var l=Object.freeze({__proto__:null,get FaceplateProgress(){return c},get ProgressState(){return r},calcCircumference:a,calcStokeDashOffset:o});return{get f(){return l}}})); SML.di("./C42E8rVVpA.js",import.meta.url,"C42E8rVVpA");SML.di("./CsxDAjmHZE.js",import.meta.url,"CsxDAjmHZE"); SML.dm("DrM-WGXCsZ",["C42E8rVVpA","CsxDAjmHZE"],(async(t,e)=>{var a;!function(t){t.PLAIN="plain",t.MEDIA="media"}(a||(a={}));const i=12;let r=class extends e.s{constructor(){super(...arguments),this.pages=0,this.pageIndex=0,this.appearance=a.PLAIN,this.animationDuration=0,this.containerLabel="",this.numVisible=2,this.centerIndexPosition=3,this.setTransitionDuration=async()=>{this._dotsContainer&&(await this.updateComplete,this._dotsContainer.style.setProperty("--pagination-transition-duration",`${this.animationDuration}ms`))},this.animateInfiniteCurrentPage=t=>{if(this._currentPageIndicator){const e=[{transform:t?`translateX(${i*this.pages}px)`:"translateX(-12px)",opacity:0},{opacity:0,transform:t?"translateX(-12px)":`translateX(${i*this.pages}px)`},{opacity:1,transform:t?"translateX(0px)":`translateX(${i*(this.pages-1)}px)`}],a={duration:this.animationDuration,fill:"forwards",iterations:1};this.setDotsTrackTransform(!t),this._currentPageIndicator.animate(e,a)}},this.animateCurrentPage=async()=>{this.setDotsTrackTransform(),this.animateCurrentPageNumber()},this.animateCurrentPageNumber=()=>{if(this._currentPageIndicator){const t=[{width:"var(--rem6)"},{width:"var(--rem18)",borderRadius:"4px"},{width:"var(--rem6)",transform:`translateX(${i*this.pageIndex}px)`}],e={duration:this.animationDuration,fill:"forwards",iterations:1};this._currentPageIndicator.animate(t,e)}},this.onSelect=t=>{const e=new CustomEvent("pagination-click",{detail:{pageIndex:t},bubbles:!0,composed:!0});this.dispatchEvent(e)},this.isEdgeDot=t=>{if(this.pages>=6){const e=t===this.pageIndex-3,a=t===this.pageIndex+3;return e||a}return!1},this.getDotButton=a=>{const i=Math.abs(a-this.pageIndex),r=t=>t===this.pageIndex?`(${this.currentPageLabel??"Current Page"})`:"",n=this.getPageLabels?`${this.getPageLabels(a)} ${r(a)}`:`Page ${a+1} ${r(a)}`,o=0===i||1===i;return e.x``},this.render=()=>{if(0!==this.pages)return e.x`
${this.currentPageIndicator} ${[...Array(this.pages).keys()].map(((t,e)=>this.getDotButton(e)))}
`}}static get styles(){return e.i`:host{display:inline-flex;height:var(--rem16,1rem);width:100%;justify-content:center}:host(:dir(rtl)){transform:scaleX(-1)}:host #dots-container{display:inline-flex;position:relative;height:100%;overflow:hidden;align-items:center;border-radius:var(--rem8,.5rem);padding:0 var(--rem2,.125rem);transition:width ease-in-out var(--pagination-transition-duration)}:host .dots-track-container{position:relative;height:100%;width:100%;display:flex;align-items:center}:host #dots-track{display:flex;position:absolute;inset-inline-start:0;height:var(--rem12,.75rem);overflow:hidden;box-sizing:border-box;font-size:var(--rem10,.625rem);align-items:center;transition:transform ease-in-out var(--pagination-transition-duration)}:host([appearance=media]) #dots-container{background-color:var(--color-media-background)}:host([appearance=media]) .dot{background-color:var(--color-media-onbackground-disabled)}:host .dot:focus-visible{outline:solid 1px var(--color-global-focus)}:host([appearance=media]) #current-page-indicator.number{color:var(--color-media-onbackground)}:host([appearance=media]) #current-page-indicator.dot{background-color:var(--color-media-onbackground)}:host #current-page-indicator{z-index:2;position:absolute}:host #current-page-indicator.number{color:var(--color-neutral-content);display:flex;align-items:center;justify-content:center;transition:transform ease-in-out var(--pagination-transition-duration)}:host #current-page-indicator.dot{background-color:var(--color-neutral-content)}:host .dot{height:var(--rem6,.375rem);width:var(--rem6,.375rem);border-radius:50%;box-sizing:content-box;display:inline-block;margin:calc(var(--rem2,.125rem) + var(--rem1,.0625rem));padding:0;border:none}:host #current-page-indicator.number{height:var(--rem15,.9375rem);width:var(--rem16,1rem);margin:0}:host .dot{background-color:var(--color-neutral-border);background-clip:content-box;transition:all ease-in-out var(--pagination-transition-duration)}:host .dot[tabindex='0']{cursor:pointer}:host .dot:focus{transition:none}:host .dot.edge{transform:scale(.5);flex-shrink:0}`}willUpdate(t){t.has("pageIndex")&&(this.pageIndex<0||this.pageIndex>this.pages-1)&&(this.pageIndex=0)}async updated(t){await this.updateComplete,(t.has("pageIndex")||t.has("pages"))&&this.shrinkOrStretch();const e=t.get("pageIndex")===this.pages-1&&0===this.pageIndex,a=0===t.get("pageIndex")&&this.pageIndex===this.pages-1;e||a?this.animateInfiniteCurrentPage(e):t.has("pageIndex")&&await this.animateCurrentPage(),t.has("animationDuration")&&this.setTransitionDuration()}shrinkOrStretch(){this.pages>=6?0===this.pageIndex||this.pageIndex===this.pages-1?this.numVisible=4:1===this.pageIndex||this.pageIndex===this.pages-2?this.numVisible=5:2===this.pageIndex||this.pageIndex===this.pages-3?this.numVisible=6:this.pageIndex>=3&&this.pageIndex<=this.pages-4&&(this.numVisible=7):this.numVisible=this.pages,this._dotsContainer&&(this._dotsContainer.style.width=`calc(var(--rem12, 0.75rem) * ${this.numVisible})`)}setDotsTrackTransform(t){const e=this.pageIndex-this.centerIndexPosition,a=e>0?e:0;if(this._dotsTrack){const e=`translateX(${i*a*-1}px)`;e!==this._dotsTrack.style.transform?this._dotsTrack.style.transform=e:t&&"translateX(0px)"!==this._dotsTrack.style.transform&&(this._dotsTrack.style.transform="translateX(0px)")}}get currentPageIndicator(){return e.x``}};return t._([t.n({type:Number})],r.prototype,"pages",void 0),t._([t.n({type:Number,attribute:"page-index"})],r.prototype,"pageIndex",void 0),t._([t.n({type:String})],r.prototype,"appearance",void 0),t._([t.n({type:Number,attribute:"animation-duration"})],r.prototype,"animationDuration",void 0),t._([t.n({type:String,attribute:"current-page-label"})],r.prototype,"currentPageLabel",void 0),t._([t.n()],r.prototype,"getPageLabels",void 0),t._([t.n({type:String,attribute:"container-label"})],r.prototype,"containerLabel",void 0),t._([t.Q("#dots-container")],r.prototype,"_dotsContainer",void 0),t._([t.Q("#dots-track")],r.prototype,"_dotsTrack",void 0),t._([t.Q("#current-page-indicator")],r.prototype,"_currentPageIndicator",void 0),t._([t.aY(".dot")],r.prototype,"_dots",void 0),r=t._([t.e("faceplate-pagination-indicator")],r),{get P(){return a}}})); SML.di("./CsxDAjmHZE.js",import.meta.url,"CsxDAjmHZE"); SML.dm("Dx86bnsEIQ",["CsxDAjmHZE"],(async a=>{const{svg:m}=a.g();return{c:a.m(m``,"0 0 20 20","chat")}})); SML.di("./C42E8rVVpA.js",import.meta.url,"C42E8rVVpA");SML.di("./CsxDAjmHZE.js",import.meta.url,"CsxDAjmHZE");SML.di("./DCbB57ubLb.js",import.meta.url,"DCbB57ubLb"); SML.dm("GJ95KQEbk4",["C42E8rVVpA","CsxDAjmHZE","DCbB57ubLb"],(async(sm26581800001,sm265818000hl,sm265818000hm)=>{var minimalExports={},minimal$1={get exports(){return minimalExports},set exports(e){minimalExports=e}},indexMinimal={},minimal={},aspromise,hasRequiredAspromise;function requireAspromise(){if(hasRequiredAspromise)return aspromise;return hasRequiredAspromise=1,aspromise=function(e,t){var o=new Array(arguments.length-1),r=0,n=2,a=!0;for(;n1&&"="===e.charAt(t);)++o;return Math.ceil(3*e.length)/4-o};for(var o=new Array(64),r=new Array(123),n=0;n<64;)r[o[n]=n<26?n+65:n<52?n+71:n<62?n-4:n-59|43]=n++;t.encode=function(e,t,r){for(var n,a=null,i=[],s=0,l=0;t>2],n=(3&c)<<4,l=1;break;case 1:i[s++]=o[n|c>>4],n=(15&c)<<2,l=2;break;case 2:i[s++]=o[n|c>>6],i[s++]=o[63&c],l=0}s>8191&&((a||(a=[])).push(String.fromCharCode.apply(String,i)),s=0)}return l&&(i[s++]=o[n],i[s++]=61,1===l&&(i[s++]=61)),a?(s&&a.push(String.fromCharCode.apply(String,i.slice(0,s))),a.join("")):String.fromCharCode.apply(String,i.slice(0,s))};var a="invalid encoding";t.decode=function(e,t,o){for(var n,i=o,s=0,l=0;l1)break;if(void 0===(c=r[c]))throw Error(a);switch(s){case 0:n=c,s=1;break;case 1:t[o++]=n<<2|(48&c)>>4,n=c,s=2;break;case 2:t[o++]=(15&n)<<4|(60&c)>>2,n=c,s=3;break;case 3:t[o++]=(3&n)<<6|c,s=0}}if(1===s)throw Error(a);return o-i},t.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}}(base64$1)),base64$1}function requireEventemitter(){if(hasRequiredEventemitter)return eventemitter;function e(){this._listeners={}}return hasRequiredEventemitter=1,eventemitter=e,e.prototype.on=function(e,t,o){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:t,ctx:o||this}),this},e.prototype.off=function(e,t){if(void 0===e)this._listeners={};else if(void 0===t)this._listeners[e]=[];else for(var o=this._listeners[e],r=0;r0?0:2147483648,o,r);else if(isNaN(t))e(2143289344,o,r);else if(t>34028234663852886e22)e((n<<31|2139095040)>>>0,o,r);else if(t<11754943508222875e-54)e((n<<31|Math.round(t/1401298464324817e-60))>>>0,o,r);else{var a=Math.floor(Math.log(t)/Math.LN2);e((n<<31|a+127<<23|8388607&Math.round(t*Math.pow(2,-a)*8388608))>>>0,o,r)}}function i(e,t,o){var r=e(t,o),n=2*(r>>31)+1,a=r>>>23&255,i=8388607&r;return 255===a?i?NaN:n*(1/0):0===a?1401298464324817e-60*n*i:n*Math.pow(2,a-150)*(i+8388608)}e.writeFloatLE=a.bind(null,t),e.writeFloatBE=a.bind(null,o),e.readFloatLE=i.bind(null,r),e.readFloatBE=i.bind(null,n)}(),"undefined"!=typeof Float64Array?function(){var t=new Float64Array([-0]),o=new Uint8Array(t.buffer),r=128===o[7];function n(e,r,n){t[0]=e,r[n]=o[0],r[n+1]=o[1],r[n+2]=o[2],r[n+3]=o[3],r[n+4]=o[4],r[n+5]=o[5],r[n+6]=o[6],r[n+7]=o[7]}function a(e,r,n){t[0]=e,r[n]=o[7],r[n+1]=o[6],r[n+2]=o[5],r[n+3]=o[4],r[n+4]=o[3],r[n+5]=o[2],r[n+6]=o[1],r[n+7]=o[0]}function i(e,r){return o[0]=e[r],o[1]=e[r+1],o[2]=e[r+2],o[3]=e[r+3],o[4]=e[r+4],o[5]=e[r+5],o[6]=e[r+6],o[7]=e[r+7],t[0]}function s(e,r){return o[7]=e[r],o[6]=e[r+1],o[5]=e[r+2],o[4]=e[r+3],o[3]=e[r+4],o[2]=e[r+5],o[1]=e[r+6],o[0]=e[r+7],t[0]}e.writeDoubleLE=r?n:a,e.writeDoubleBE=r?a:n,e.readDoubleLE=r?i:s,e.readDoubleBE=r?s:i}():function(){function a(e,t,o,r,n,a){var i=r<0?1:0;if(i&&(r=-r),0===r)e(0,n,a+t),e(1/r>0?0:2147483648,n,a+o);else if(isNaN(r))e(0,n,a+t),e(2146959360,n,a+o);else if(r>17976931348623157e292)e(0,n,a+t),e((i<<31|2146435072)>>>0,n,a+o);else{var s;if(r<22250738585072014e-324)e((s=r/5e-324)>>>0,n,a+t),e((i<<31|s/4294967296)>>>0,n,a+o);else{var l=Math.floor(Math.log(r)/Math.LN2);1024===l&&(l=1023),e(4503599627370496*(s=r*Math.pow(2,-l))>>>0,n,a+t),e((i<<31|l+1023<<20|1048576*s&1048575)>>>0,n,a+o)}}}function i(e,t,o,r,n){var a=e(r,n+t),i=e(r,n+o),s=2*(i>>31)+1,l=i>>>20&2047,c=4294967296*(1048575&i)+a;return 2047===l?c?NaN:s*(1/0):0===l?5e-324*s*c:s*Math.pow(2,l-1075)*(c+4503599627370496)}e.writeDoubleLE=a.bind(null,t,0,4),e.writeDoubleBE=a.bind(null,o,4,0),e.readDoubleLE=i.bind(null,r,0,4),e.readDoubleBE=i.bind(null,n,4,0)}(),e}function t(e,t,o){t[o]=255&e,t[o+1]=e>>>8&255,t[o+2]=e>>>16&255,t[o+3]=e>>>24}function o(e,t,o){t[o]=e>>>24,t[o+1]=e>>>16&255,t[o+2]=e>>>8&255,t[o+3]=255&e}function r(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}function n(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}return hasRequiredFloat=1,float=e(e)}function requireInquire(){if(hasRequiredInquire)return inquire_1;function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(e){}return null}return hasRequiredInquire=1,inquire_1=inquire,inquire_1}var utf8$2={},hasRequiredUtf8,pool_1,hasRequiredPool,longbits,hasRequiredLongbits,hasRequiredMinimal;function requireUtf8(){return hasRequiredUtf8||(hasRequiredUtf8=1,function(e){var t=e;t.length=function(e){for(var t=0,o=0,r=0;r191&&r<224?a[i++]=(31&r)<<6|63&e[t++]:r>239&&r<365?(r=((7&r)<<18|(63&e[t++])<<12|(63&e[t++])<<6|63&e[t++])-65536,a[i++]=55296+(r>>10),a[i++]=56320+(1023&r)):a[i++]=(15&r)<<12|(63&e[t++])<<6|63&e[t++],i>8191&&((n||(n=[])).push(String.fromCharCode.apply(String,a)),i=0);return n?(i&&n.push(String.fromCharCode.apply(String,a.slice(0,i))),n.join("")):String.fromCharCode.apply(String,a.slice(0,i))},t.write=function(e,t,o){for(var r,n,a=o,i=0;i>6|192,t[o++]=63&r|128):55296==(64512&r)&&56320==(64512&(n=e.charCodeAt(i+1)))?(r=65536+((1023&r)<<10)+(1023&n),++i,t[o++]=r>>18|240,t[o++]=r>>12&63|128,t[o++]=r>>6&63|128,t[o++]=63&r|128):(t[o++]=r>>12|224,t[o++]=r>>6&63|128,t[o++]=63&r|128);return o-a}}(utf8$2)),utf8$2}function requirePool(){if(hasRequiredPool)return pool_1;return hasRequiredPool=1,pool_1=function(e,t,o){var r=o||8192,n=r>>>1,a=null,i=r;return function(o){if(o<1||o>n)return e(o);i+o>r&&(a=e(r),i=0);var s=t.call(a,i,i+=o);return 7&i&&(i=1+(7|i)),s}}}function requireLongbits(){if(hasRequiredLongbits)return longbits;hasRequiredLongbits=1,longbits=t;var e=requireMinimal();function t(e,t){this.lo=e>>>0,this.hi=t>>>0}var o=t.zero=new t(0,0);o.toNumber=function(){return 0},o.zzEncode=o.zzDecode=function(){return this},o.length=function(){return 1};var r=t.zeroHash="\0\0\0\0\0\0\0\0";t.fromNumber=function(e){if(0===e)return o;var r=e<0;r&&(e=-e);var n=e>>>0,a=(e-n)/4294967296>>>0;return r&&(a=~a>>>0,n=~n>>>0,++n>4294967295&&(n=0,++a>4294967295&&(a=0))),new t(n,a)},t.from=function(r){if("number"==typeof r)return t.fromNumber(r);if(e.isString(r)){if(!e.Long)return t.fromNumber(parseInt(r,10));r=e.Long.fromString(r)}return r.low||r.high?new t(r.low>>>0,r.high>>>0):o},t.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var t=1+~this.lo>>>0,o=~this.hi>>>0;return t||(o=o+1>>>0),-(t+4294967296*o)}return this.lo+4294967296*this.hi},t.prototype.toLong=function(t){return e.Long?new e.Long(0|this.lo,0|this.hi,Boolean(t)):{low:0|this.lo,high:0|this.hi,unsigned:Boolean(t)}};var n=String.prototype.charCodeAt;return t.fromHash=function(e){return e===r?o:new t((n.call(e,0)|n.call(e,1)<<8|n.call(e,2)<<16|n.call(e,3)<<24)>>>0,(n.call(e,4)|n.call(e,5)<<8|n.call(e,6)<<16|n.call(e,7)<<24)>>>0)},t.prototype.toHash=function(){return String.fromCharCode(255&this.lo,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,255&this.hi,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},t.prototype.zzEncode=function(){var e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this},t.prototype.zzDecode=function(){var e=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this},t.prototype.length=function(){var e=this.lo,t=(this.lo>>>28|this.hi<<4)>>>0,o=this.hi>>>24;return 0===o?0===t?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:o<128?9:10},longbits}function requireMinimal(){return hasRequiredMinimal||(hasRequiredMinimal=1,function(e){var t=e;function o(e,t,o){for(var r=Object.keys(t),n=0;n0)},t.Buffer=function(){try{var e=t.inquire("buffer").Buffer;return e.prototype.utf8Write?e:null}catch(e){return null}}(),t._Buffer_from=null,t._Buffer_allocUnsafe=null,t.newBuffer=function(e){return"number"==typeof e?t.Buffer?t._Buffer_allocUnsafe(e):new t.Array(e):t.Buffer?t._Buffer_from(e):"undefined"==typeof Uint8Array?e:new Uint8Array(e)},t.Array="undefined"!=typeof Uint8Array?Uint8Array:Array,t.Long=t.global.dcodeIO&&t.global.dcodeIO.Long||t.global.Long||t.inquire("long"),t.key2Re=/^true|false|0|1$/,t.key32Re=/^-?(?:0|[1-9][0-9]*)$/,t.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,t.longToHash=function(e){return e?t.LongBits.from(e).toHash():t.LongBits.zeroHash},t.longFromHash=function(e,o){var r=t.LongBits.fromHash(e);return t.Long?t.Long.fromBits(r.lo,r.hi,o):r.toNumber(Boolean(o))},t.merge=o,t.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)},t.newError=r,t.ProtocolError=r("ProtocolError"),t.oneOfGetter=function(e){for(var t={},o=0;o-1;--o)if(1===t[e[o]]&&void 0!==this[e[o]]&&null!==this[e[o]])return e[o]}},t.oneOfSetter=function(e){return function(t){for(var o=0;o127;)t[o++]=127&e|128,e>>>=7;t[o]=e}function VarintOp(e,t){this.len=e,this.next=void 0,this.val=t}function writeVarint64(e,t,o){for(;e.hi;)t[o++]=127&e.lo|128,e.lo=(e.lo>>>7|e.hi<<25)>>>0,e.hi>>>=7;for(;e.lo>127;)t[o++]=127&e.lo|128,e.lo=e.lo>>>7;t[o++]=e.lo}function writeFixed32(e,t,o){t[o]=255&e,t[o+1]=e>>>8&255,t[o+2]=e>>>16&255,t[o+3]=e>>>24}Writer$1.create=create$1(),Writer$1.alloc=function(e){return new util$4.Array(e)},util$4.Array!==Array&&(Writer$1.alloc=util$4.pool(Writer$1.alloc,util$4.Array.prototype.subarray)),Writer$1.prototype._push=function(e,t,o){return this.tail=this.tail.next=new Op(e,t,o),this.len+=t,this},VarintOp.prototype=Object.create(Op.prototype),VarintOp.prototype.fn=writeVarint32,Writer$1.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new VarintOp((e>>>=0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this},Writer$1.prototype.int32=function(e){return e<0?this._push(writeVarint64,10,LongBits$1.fromNumber(e)):this.uint32(e)},Writer$1.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)},Writer$1.prototype.uint64=function(e){var t=LongBits$1.from(e);return this._push(writeVarint64,t.length(),t)},Writer$1.prototype.int64=Writer$1.prototype.uint64,Writer$1.prototype.sint64=function(e){var t=LongBits$1.from(e).zzEncode();return this._push(writeVarint64,t.length(),t)},Writer$1.prototype.bool=function(e){return this._push(writeByte,1,e?1:0)},Writer$1.prototype.fixed32=function(e){return this._push(writeFixed32,4,e>>>0)},Writer$1.prototype.sfixed32=Writer$1.prototype.fixed32,Writer$1.prototype.fixed64=function(e){var t=LongBits$1.from(e);return this._push(writeFixed32,4,t.lo)._push(writeFixed32,4,t.hi)},Writer$1.prototype.sfixed64=Writer$1.prototype.fixed64,Writer$1.prototype.float=function(e){return this._push(util$4.float.writeFloatLE,4,e)},Writer$1.prototype.double=function(e){return this._push(util$4.float.writeDoubleLE,8,e)};var writeBytes=util$4.Array.prototype.set?function(e,t,o){t.set(e,o)}:function(e,t,o){for(var r=0;r>>0;if(!t)return this._push(writeByte,1,0);if(util$4.isString(e)){var o=Writer$1.alloc(t=base64.length(e));base64.decode(e,o,0),e=o}return this.uint32(t)._push(writeBytes,t,e)},Writer$1.prototype.string=function(e){var t=utf8$1.length(e);return t?this.uint32(t)._push(utf8$1.write,t,e):this._push(writeByte,1,0)},Writer$1.prototype.fork=function(){return this.states=new State(this),this.head=this.tail=new Op(noop,0,0),this.len=0,this},Writer$1.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new Op(noop,0,0),this.len=0),this},Writer$1.prototype.ldelim=function(){var e=this.head,t=this.tail,o=this.len;return this.reset().uint32(o),o&&(this.tail.next=e.next,this.tail=t,this.len+=o),this},Writer$1.prototype.finish=function(){for(var e=this.head.next,t=this.constructor.alloc(this.len),o=0;e;)e.fn(e.val,t,o),o+=e.len,e=e.next;return t},Writer$1._configure=function(e){BufferWriter$1=e,Writer$1.create=create$1(),BufferWriter$1._configure()};var writer_buffer=BufferWriter,Writer=writer;(BufferWriter.prototype=Object.create(Writer.prototype)).constructor=BufferWriter;var util$3=requireMinimal();function BufferWriter(){Writer.call(this)}function writeStringBuffer(e,t,o){e.length<40?util$3.utf8.write(e,t,o):t.utf8Write?t.utf8Write(e,o):t.write(e,o)}BufferWriter._configure=function(){BufferWriter.alloc=util$3._Buffer_allocUnsafe,BufferWriter.writeBytesBuffer=util$3.Buffer&&util$3.Buffer.prototype instanceof Uint8Array&&"set"===util$3.Buffer.prototype.set.name?function(e,t,o){t.set(e,o)}:function(e,t,o){if(e.copy)e.copy(t,o,0,e.length);else for(var r=0;r>>0;return this.uint32(t),t&&this._push(BufferWriter.writeBytesBuffer,t,e),this},BufferWriter.prototype.string=function(e){var t=util$3.Buffer.byteLength(e);return this.uint32(t),t&&this._push(writeStringBuffer,t,e),this},BufferWriter._configure();var reader=Reader$1,util$2=requireMinimal(),BufferReader$1,LongBits=util$2.LongBits,utf8=util$2.utf8;function indexOutOfRange(e,t){return RangeError("index out of range: "+e.pos+" + "+(t||1)+" > "+e.len)}function Reader$1(e){this.buf=e,this.pos=0,this.len=e.length}var create_array="undefined"!=typeof Uint8Array?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new Reader$1(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new Reader$1(e);throw Error("illegal buffer")},create=function(){return util$2.Buffer?function(e){return(Reader$1.create=function(e){return util$2.Buffer.isBuffer(e)?new BufferReader$1(e):create_array(e)})(e)}:create_array},value;function readLongVarint(){var e=new LongBits(0,0),t=0;if(!(this.len-this.pos>4)){for(;t<3;++t){if(this.pos>=this.len)throw indexOutOfRange(this);if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(127&this.buf[this.pos++])<<7*t)>>>0,e}for(;t<4;++t)if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e;if(e.lo=(e.lo|(127&this.buf[this.pos])<<28)>>>0,e.hi=(e.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return e;if(t=0,this.len-this.pos>4){for(;t<5;++t)if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}else for(;t<5;++t){if(this.pos>=this.len)throw indexOutOfRange(this);if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}function readFixed32_end(e,t){return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0}function readFixed64(){if(this.pos+8>this.len)throw indexOutOfRange(this,8);return new LongBits(readFixed32_end(this.buf,this.pos+=4),readFixed32_end(this.buf,this.pos+=4))}Reader$1.create=create(),Reader$1.prototype._slice=util$2.Array.prototype.subarray||util$2.Array.prototype.slice,Reader$1.prototype.uint32=(value=4294967295,function(){if(value=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128)return value;if(value=(value|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)return value;if(value=(value|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)return value;if(value=(value|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)return value;if(value=(value|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)return value;if((this.pos+=5)>this.len)throw this.pos=this.len,indexOutOfRange(this,10);return value}),Reader$1.prototype.int32=function(){return 0|this.uint32()},Reader$1.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(1&e)},Reader$1.prototype.bool=function(){return 0!==this.uint32()},Reader$1.prototype.fixed32=function(){if(this.pos+4>this.len)throw indexOutOfRange(this,4);return readFixed32_end(this.buf,this.pos+=4)},Reader$1.prototype.sfixed32=function(){if(this.pos+4>this.len)throw indexOutOfRange(this,4);return 0|readFixed32_end(this.buf,this.pos+=4)},Reader$1.prototype.float=function(){if(this.pos+4>this.len)throw indexOutOfRange(this,4);var e=util$2.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e},Reader$1.prototype.double=function(){if(this.pos+8>this.len)throw indexOutOfRange(this,4);var e=util$2.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e},Reader$1.prototype.bytes=function(){var e=this.uint32(),t=this.pos,o=this.pos+e;if(o>this.len)throw indexOutOfRange(this,e);if(this.pos+=e,Array.isArray(this.buf))return this.buf.slice(t,o);if(t===o){var r=util$2.Buffer;return r?r.alloc(0):new this.buf.constructor(0)}return this._slice.call(this.buf,t,o)},Reader$1.prototype.string=function(){var e=this.bytes();return utf8.read(e,0,e.length)},Reader$1.prototype.skip=function(e){if("number"==typeof e){if(this.pos+e>this.len)throw indexOutOfRange(this,e);this.pos+=e}else do{if(this.pos>=this.len)throw indexOutOfRange(this)}while(128&this.buf[this.pos++]);return this},Reader$1.prototype.skipType=function(e){switch(e){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;4!=(e=7&this.uint32());)this.skipType(e);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+e+" at offset "+this.pos)}return this},Reader$1._configure=function(e){BufferReader$1=e,Reader$1.create=create(),BufferReader$1._configure();var t=util$2.Long?"toLong":"toNumber";util$2.merge(Reader$1.prototype,{int64:function(){return readLongVarint.call(this)[t](!1)},uint64:function(){return readLongVarint.call(this)[t](!0)},sint64:function(){return readLongVarint.call(this).zzDecode()[t](!1)},fixed64:function(){return readFixed64.call(this)[t](!0)},sfixed64:function(){return readFixed64.call(this)[t](!1)}})};var reader_buffer=BufferReader,Reader=reader;(BufferReader.prototype=Object.create(Reader.prototype)).constructor=BufferReader;var util$1=requireMinimal();function BufferReader(e){Reader.call(this,e)}BufferReader._configure=function(){util$1.Buffer&&(BufferReader.prototype._slice=util$1.Buffer.prototype.slice)},BufferReader.prototype.string=function(){var e=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+e,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+e,this.len))},BufferReader._configure();var rpc={},service=Service,util=requireMinimal(),exports;function Service(e,t,o){if("function"!=typeof e)throw TypeError("rpcImpl must be a function");util.EventEmitter.call(this),this.rpcImpl=e,this.requestDelimited=Boolean(t),this.responseDelimited=Boolean(o)}(Service.prototype=Object.create(util.EventEmitter.prototype)).constructor=Service,Service.prototype.rpcCall=function e(t,o,r,n,a){if(!n)throw TypeError("request must be specified");var i=this;if(!a)return util.asPromise(e,i,t,o,r,n);if(i.rpcImpl)try{return i.rpcImpl(t,o[i.requestDelimited?"encodeDelimited":"encode"](n).finish(),(function(e,o){if(e)return i.emit("error",e,t),a(e);if(null!==o){if(!(o instanceof r))try{o=r[i.responseDelimited?"decodeDelimited":"decode"](o)}catch(e){return i.emit("error",e,t),a(e)}return i.emit("data",o,t),a(null,o)}i.end(!0)}))}catch(e){return i.emit("error",e,t),void setTimeout((function(){a(e)}),0)}else setTimeout((function(){a(Error("already ended"))}),0)},Service.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this},exports=rpc,exports.Service=service;var roots={},module;!function(e){var t=e;function o(){t.util._configure(),t.Writer._configure(t.BufferWriter),t.Reader._configure(t.BufferReader)}t.build="minimal",t.Writer=writer,t.BufferWriter=writer_buffer,t.Reader=reader,t.BufferReader=reader_buffer,t.util=requireMinimal(),t.rpc=rpc,t.roots=roots,t.configure=o,o()}(indexMinimal),module=minimal$1,module.exports=indexMinimal;var _m0=sm265818000hm.ba(minimalExports),wasm=null;try{wasm=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch(e){}function Long(e,t,o){this.low=0|e,this.high=0|t,this.unsigned=!!o}function isLong(e){return!0===(e&&e.__isLong__)}function ctz32(e){var t=Math.clz32(e&-e);return e?31-t:t}Long.prototype.__isLong__,Object.defineProperty(Long.prototype,"__isLong__",{value:!0}),Long.isLong=isLong;var INT_CACHE={},UINT_CACHE={};function fromInt(e,t){var o,r,n;return t?(n=0<=(e>>>=0)&&e<256)&&(r=UINT_CACHE[e])?r:(o=fromBits(e,0,!0),n&&(UINT_CACHE[e]=o),o):(n=-128<=(e|=0)&&e<128)&&(r=INT_CACHE[e])?r:(o=fromBits(e,e<0?-1:0,!1),n&&(INT_CACHE[e]=o),o)}function fromNumber(e,t){if(isNaN(e))return t?UZERO:ZERO;if(t){if(e<0)return UZERO;if(e>=TWO_PWR_64_DBL)return MAX_UNSIGNED_VALUE}else{if(e<=-0x8000000000000000)return MIN_VALUE;if(e+1>=TWO_PWR_63_DBL)return MAX_VALUE}return e<0?fromNumber(-e,t).neg():fromBits(e%TWO_PWR_32_DBL|0,e/TWO_PWR_32_DBL|0,t)}function fromBits(e,t,o){return new Long(e,t,o)}Long.fromInt=fromInt,Long.fromNumber=fromNumber,Long.fromBits=fromBits;var pow_dbl=Math.pow;function fromString(e,t,o){if(0===e.length)throw Error("empty string");if("number"==typeof t?(o=t,t=!1):t=!!t,"NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return t?UZERO:ZERO;if((o=o||10)<2||360)throw Error("interior hyphen");if(0===r)return fromString(e.substring(1),t,o).neg();for(var n=fromNumber(pow_dbl(o,8)),a=ZERO,i=0;i>>0:this.low},LongPrototype.toNumber=function(){return this.unsigned?(this.high>>>0)*TWO_PWR_32_DBL+(this.low>>>0):this.high*TWO_PWR_32_DBL+(this.low>>>0)},LongPrototype.toString=function(e){if((e=e||10)<2||36>>0).toString(e);if((a=s).isZero())return l+i;for(;l.length<6;)l="0"+l;i=""+l+i}},LongPrototype.getHighBits=function(){return this.high},LongPrototype.getHighBitsUnsigned=function(){return this.high>>>0},LongPrototype.getLowBits=function(){return this.low},LongPrototype.getLowBitsUnsigned=function(){return this.low>>>0},LongPrototype.getNumBitsAbs=function(){if(this.isNegative())return this.eq(MIN_VALUE)?64:this.neg().getNumBitsAbs();for(var e=0!=this.high?this.high:this.low,t=31;t>0&&!(e&1<=0},LongPrototype.isOdd=function(){return!(1&~this.low)},LongPrototype.isEven=function(){return!(1&this.low)},LongPrototype.equals=function(e){return isLong(e)||(e=fromValue(e)),(this.unsigned===e.unsigned||this.high>>>31!=1||e.high>>>31!=1)&&(this.high===e.high&&this.low===e.low)},LongPrototype.eq=LongPrototype.equals,LongPrototype.notEquals=function(e){return!this.eq(e)},LongPrototype.neq=LongPrototype.notEquals,LongPrototype.ne=LongPrototype.notEquals,LongPrototype.lessThan=function(e){return this.comp(e)<0},LongPrototype.lt=LongPrototype.lessThan,LongPrototype.lessThanOrEqual=function(e){return this.comp(e)<=0},LongPrototype.lte=LongPrototype.lessThanOrEqual,LongPrototype.le=LongPrototype.lessThanOrEqual,LongPrototype.greaterThan=function(e){return this.comp(e)>0},LongPrototype.gt=LongPrototype.greaterThan,LongPrototype.greaterThanOrEqual=function(e){return this.comp(e)>=0},LongPrototype.gte=LongPrototype.greaterThanOrEqual,LongPrototype.ge=LongPrototype.greaterThanOrEqual,LongPrototype.compare=function(e){if(isLong(e)||(e=fromValue(e)),this.eq(e))return 0;var t=this.isNegative(),o=e.isNegative();return t&&!o?-1:!t&&o?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1},LongPrototype.comp=LongPrototype.compare,LongPrototype.negate=function(){return!this.unsigned&&this.eq(MIN_VALUE)?MIN_VALUE:this.not().add(ONE)},LongPrototype.neg=LongPrototype.negate,LongPrototype.add=function(e){isLong(e)||(e=fromValue(e));var t=this.high>>>16,o=65535&this.high,r=this.low>>>16,n=65535&this.low,a=e.high>>>16,i=65535&e.high,s=e.low>>>16,l=0,c=0,d=0,u=0;return d+=(u+=n+(65535&e.low))>>>16,c+=(d+=r+s)>>>16,l+=(c+=o+i)>>>16,l+=t+a,fromBits((d&=65535)<<16|(u&=65535),(l&=65535)<<16|(c&=65535),this.unsigned)},LongPrototype.subtract=function(e){return isLong(e)||(e=fromValue(e)),this.add(e.neg())},LongPrototype.sub=LongPrototype.subtract,LongPrototype.multiply=function(e){if(this.isZero())return this;if(isLong(e)||(e=fromValue(e)),wasm)return fromBits(wasm.mul(this.low,this.high,e.low,e.high),wasm.get_high(),this.unsigned);if(e.isZero())return this.unsigned?UZERO:ZERO;if(this.eq(MIN_VALUE))return e.isOdd()?MIN_VALUE:ZERO;if(e.eq(MIN_VALUE))return this.isOdd()?MIN_VALUE:ZERO;if(this.isNegative())return e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg();if(e.isNegative())return this.mul(e.neg()).neg();if(this.lt(TWO_PWR_24)&&e.lt(TWO_PWR_24))return fromNumber(this.toNumber()*e.toNumber(),this.unsigned);var t=this.high>>>16,o=65535&this.high,r=this.low>>>16,n=65535&this.low,a=e.high>>>16,i=65535&e.high,s=e.low>>>16,l=65535&e.low,c=0,d=0,u=0,b=0;return u+=(b+=n*l)>>>16,d+=(u+=r*l)>>>16,u&=65535,d+=(u+=n*s)>>>16,c+=(d+=o*l)>>>16,d&=65535,c+=(d+=r*s)>>>16,d&=65535,c+=(d+=n*i)>>>16,c+=t*l+o*s+r*i+n*a,fromBits((u&=65535)<<16|(b&=65535),(c&=65535)<<16|(d&=65535),this.unsigned)},LongPrototype.mul=LongPrototype.multiply,LongPrototype.divide=function(e){if(isLong(e)||(e=fromValue(e)),e.isZero())throw Error("division by zero");var t,o,r;if(wasm)return this.unsigned||-2147483648!==this.high||-1!==e.low||-1!==e.high?fromBits((this.unsigned?wasm.div_u:wasm.div_s)(this.low,this.high,e.low,e.high),wasm.get_high(),this.unsigned):this;if(this.isZero())return this.unsigned?UZERO:ZERO;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return UZERO;if(e.gt(this.shru(1)))return UONE;r=UZERO}else{if(this.eq(MIN_VALUE))return e.eq(ONE)||e.eq(NEG_ONE)?MIN_VALUE:e.eq(MIN_VALUE)?ONE:(t=this.shr(1).div(e).shl(1)).eq(ZERO)?e.isNegative()?ONE:NEG_ONE:(o=this.sub(e.mul(t)),r=t.add(o.div(e)));if(e.eq(MIN_VALUE))return this.unsigned?UZERO:ZERO;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();r=ZERO}for(o=this;o.gte(e);){t=Math.max(1,Math.floor(o.toNumber()/e.toNumber()));for(var n=Math.ceil(Math.log(t)/Math.LN2),a=n<=48?1:pow_dbl(2,n-48),i=fromNumber(t),s=i.mul(e);s.isNegative()||s.gt(o);)s=(i=fromNumber(t-=a,this.unsigned)).mul(e);i.isZero()&&(i=ONE),r=r.add(i),o=o.sub(s)}return r},LongPrototype.div=LongPrototype.divide,LongPrototype.modulo=function(e){return isLong(e)||(e=fromValue(e)),wasm?fromBits((this.unsigned?wasm.rem_u:wasm.rem_s)(this.low,this.high,e.low,e.high),wasm.get_high(),this.unsigned):this.sub(this.div(e).mul(e))},LongPrototype.mod=LongPrototype.modulo,LongPrototype.rem=LongPrototype.modulo,LongPrototype.not=function(){return fromBits(~this.low,~this.high,this.unsigned)},LongPrototype.countLeadingZeros=function(){return this.high?Math.clz32(this.high):Math.clz32(this.low)+32},LongPrototype.clz=LongPrototype.countLeadingZeros,LongPrototype.countTrailingZeros=function(){return this.low?ctz32(this.low):ctz32(this.high)+32},LongPrototype.ctz=LongPrototype.countTrailingZeros,LongPrototype.and=function(e){return isLong(e)||(e=fromValue(e)),fromBits(this.low&e.low,this.high&e.high,this.unsigned)},LongPrototype.or=function(e){return isLong(e)||(e=fromValue(e)),fromBits(this.low|e.low,this.high|e.high,this.unsigned)},LongPrototype.xor=function(e){return isLong(e)||(e=fromValue(e)),fromBits(this.low^e.low,this.high^e.high,this.unsigned)},LongPrototype.shiftLeft=function(e){return isLong(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?fromBits(this.low<>>32-e,this.unsigned):fromBits(0,this.low<>>e|this.high<<32-e,this.high>>e,this.unsigned):fromBits(this.high>>e-32,this.high>=0?0:-1,this.unsigned)},LongPrototype.shr=LongPrototype.shiftRight,LongPrototype.shiftRightUnsigned=function(e){return isLong(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?fromBits(this.low>>>e|this.high<<32-e,this.high>>>e,this.unsigned):fromBits(32===e?this.high:this.high>>>e-32,0,this.unsigned)},LongPrototype.shru=LongPrototype.shiftRightUnsigned,LongPrototype.shr_u=LongPrototype.shiftRightUnsigned,LongPrototype.rotateLeft=function(e){var t;return isLong(e)&&(e=e.toInt()),0==(e&=63)?this:32===e?fromBits(this.high,this.low,this.unsigned):e<32?(t=32-e,fromBits(this.low<>>t,this.high<>>t,this.unsigned)):(t=32-(e-=32),fromBits(this.high<>>t,this.low<>>t,this.unsigned))},LongPrototype.rotl=LongPrototype.rotateLeft,LongPrototype.rotateRight=function(e){var t;return isLong(e)&&(e=e.toInt()),0==(e&=63)?this:32===e?fromBits(this.high,this.low,this.unsigned):e<32?(t=32-e,fromBits(this.high<>>e,this.low<>>e,this.unsigned)):(t=32-(e-=32),fromBits(this.low<>>e,this.high<>>e,this.unsigned))},LongPrototype.rotr=LongPrototype.rotateRight,LongPrototype.toSigned=function(){return this.unsigned?fromBits(this.low,this.high,!1):this},LongPrototype.toUnsigned=function(){return this.unsigned?this:fromBits(this.low,this.high,!0)},LongPrototype.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},LongPrototype.toBytesLE=function(){var e=this.high,t=this.low;return[255&t,t>>>8&255,t>>>16&255,t>>>24,255&e,e>>>8&255,e>>>16&255,e>>>24]},LongPrototype.toBytesBE=function(){var e=this.high,t=this.low;return[e>>>24,e>>>16&255,e>>>8&255,255&e,t>>>24,t>>>16&255,t>>>8&255,255&t]},Long.fromBytes=function(e,t,o){return o?Long.fromBytesLE(e,t):Long.fromBytesBE(e,t)},Long.fromBytesLE=function(e,t){return new Long(e[0]|e[1]<<8|e[2]<<16|e[3]<<24,e[4]|e[5]<<8|e[6]<<16|e[7]<<24,t)},Long.fromBytesBE=function(e,t){return new Long(e[4]<<24|e[5]<<16|e[6]<<8|e[7],e[0]<<24|e[1]<<16|e[2]<<8|e[3],t)};const messageTypeRegistry=new Map;function createBaseTimestamp(){return{seconds:0,nanos:0}}const Timestamp={$type:"google.protobuf.Timestamp",encode:(e,t=_m0.Writer.create())=>(0!==e.seconds&&t.uint32(8).int64(e.seconds),0!==e.nanos&&t.uint32(16).int32(e.nanos),t),decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseTimestamp();for(;o.pos>>3){case 1:if(8!==e)break;n.seconds=longToNumber$2(o.int64());continue;case 2:if(16!==e)break;n.nanos=o.int32();continue}if(4==(7&e)||0===e)break;o.skipType(7&e)}return n},fromJSON:e=>({seconds:isSet$u(e.seconds)?globalThis.Number(e.seconds):0,nanos:isSet$u(e.nanos)?globalThis.Number(e.nanos):0}),toJSON(e){const t={};return 0!==e.seconds&&(t.seconds=Math.round(e.seconds)),0!==e.nanos&&(t.nanos=Math.round(e.nanos)),t},create:e=>Timestamp.fromPartial(e??{}),fromPartial(e){const t=createBaseTimestamp();return t.seconds=e.seconds??0,t.nanos=e.nanos??0,t}};function longToNumber$2(e){if(e.gt(globalThis.Number.MAX_SAFE_INTEGER))throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");return e.toNumber()}function isSet$u(e){return null!=e}function createBaseDoubleValue(){return{value:0}}messageTypeRegistry.set(Timestamp.$type,Timestamp),_m0.util.Long!==Long&&(_m0.util.Long=Long,_m0.configure());const DoubleValue={$type:"google.protobuf.DoubleValue",encode:(e,t=_m0.Writer.create())=>(0!==e.value&&t.uint32(9).double(e.value),t),decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseDoubleValue();for(;o.pos>>3){case 1:if(9!==e)break;n.value=o.double();continue}if(4==(7&e)||0===e)break;o.skipType(7&e)}return n},fromJSON:e=>({value:isSet$t(e.value)?globalThis.Number(e.value):0}),toJSON(e){const t={};return 0!==e.value&&(t.value=e.value),t},create:e=>DoubleValue.fromPartial(e??{}),fromPartial(e){const t=createBaseDoubleValue();return t.value=e.value??0,t}};function createBaseFloatValue(){return{value:0}}messageTypeRegistry.set(DoubleValue.$type,DoubleValue);const FloatValue={$type:"google.protobuf.FloatValue",encode:(e,t=_m0.Writer.create())=>(0!==e.value&&t.uint32(13).float(e.value),t),decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseFloatValue();for(;o.pos>>3){case 1:if(13!==e)break;n.value=o.float();continue}if(4==(7&e)||0===e)break;o.skipType(7&e)}return n},fromJSON:e=>({value:isSet$t(e.value)?globalThis.Number(e.value):0}),toJSON(e){const t={};return 0!==e.value&&(t.value=e.value),t},create:e=>FloatValue.fromPartial(e??{}),fromPartial(e){const t=createBaseFloatValue();return t.value=e.value??0,t}};function createBaseInt64Value(){return{value:0}}messageTypeRegistry.set(FloatValue.$type,FloatValue);const Int64Value={$type:"google.protobuf.Int64Value",encode:(e,t=_m0.Writer.create())=>(0!==e.value&&t.uint32(8).int64(e.value),t),decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseInt64Value();for(;o.pos>>3){case 1:if(8!==e)break;n.value=longToNumber$1(o.int64());continue}if(4==(7&e)||0===e)break;o.skipType(7&e)}return n},fromJSON:e=>({value:isSet$t(e.value)?globalThis.Number(e.value):0}),toJSON(e){const t={};return 0!==e.value&&(t.value=Math.round(e.value)),t},create:e=>Int64Value.fromPartial(e??{}),fromPartial(e){const t=createBaseInt64Value();return t.value=e.value??0,t}};function createBaseUInt64Value(){return{value:0}}messageTypeRegistry.set(Int64Value.$type,Int64Value);const UInt64Value={$type:"google.protobuf.UInt64Value",encode:(e,t=_m0.Writer.create())=>(0!==e.value&&t.uint32(8).uint64(e.value),t),decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseUInt64Value();for(;o.pos>>3){case 1:if(8!==e)break;n.value=longToNumber$1(o.uint64());continue}if(4==(7&e)||0===e)break;o.skipType(7&e)}return n},fromJSON:e=>({value:isSet$t(e.value)?globalThis.Number(e.value):0}),toJSON(e){const t={};return 0!==e.value&&(t.value=Math.round(e.value)),t},create:e=>UInt64Value.fromPartial(e??{}),fromPartial(e){const t=createBaseUInt64Value();return t.value=e.value??0,t}};function createBaseInt32Value(){return{value:0}}messageTypeRegistry.set(UInt64Value.$type,UInt64Value);const Int32Value={$type:"google.protobuf.Int32Value",encode:(e,t=_m0.Writer.create())=>(0!==e.value&&t.uint32(8).int32(e.value),t),decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseInt32Value();for(;o.pos>>3){case 1:if(8!==e)break;n.value=o.int32();continue}if(4==(7&e)||0===e)break;o.skipType(7&e)}return n},fromJSON:e=>({value:isSet$t(e.value)?globalThis.Number(e.value):0}),toJSON(e){const t={};return 0!==e.value&&(t.value=Math.round(e.value)),t},create:e=>Int32Value.fromPartial(e??{}),fromPartial(e){const t=createBaseInt32Value();return t.value=e.value??0,t}};function createBaseUInt32Value(){return{value:0}}messageTypeRegistry.set(Int32Value.$type,Int32Value);const UInt32Value={$type:"google.protobuf.UInt32Value",encode:(e,t=_m0.Writer.create())=>(0!==e.value&&t.uint32(8).uint32(e.value),t),decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseUInt32Value();for(;o.pos>>3){case 1:if(8!==e)break;n.value=o.uint32();continue}if(4==(7&e)||0===e)break;o.skipType(7&e)}return n},fromJSON:e=>({value:isSet$t(e.value)?globalThis.Number(e.value):0}),toJSON(e){const t={};return 0!==e.value&&(t.value=Math.round(e.value)),t},create:e=>UInt32Value.fromPartial(e??{}),fromPartial(e){const t=createBaseUInt32Value();return t.value=e.value??0,t}};function createBaseBoolValue(){return{value:!1}}messageTypeRegistry.set(UInt32Value.$type,UInt32Value);const BoolValue={$type:"google.protobuf.BoolValue",encode:(e,t=_m0.Writer.create())=>(!1!==e.value&&t.uint32(8).bool(e.value),t),decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseBoolValue();for(;o.pos>>3){case 1:if(8!==e)break;n.value=o.bool();continue}if(4==(7&e)||0===e)break;o.skipType(7&e)}return n},fromJSON:e=>({value:!!isSet$t(e.value)&&globalThis.Boolean(e.value)}),toJSON(e){const t={};return!1!==e.value&&(t.value=e.value),t},create:e=>BoolValue.fromPartial(e??{}),fromPartial(e){const t=createBaseBoolValue();return t.value=e.value??!1,t}};function createBaseStringValue(){return{value:""}}messageTypeRegistry.set(BoolValue.$type,BoolValue);const StringValue={$type:"google.protobuf.StringValue",encode:(e,t=_m0.Writer.create())=>(""!==e.value&&t.uint32(10).string(e.value),t),decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseStringValue();for(;o.pos>>3){case 1:if(10!==e)break;n.value=o.string();continue}if(4==(7&e)||0===e)break;o.skipType(7&e)}return n},fromJSON:e=>({value:isSet$t(e.value)?globalThis.String(e.value):""}),toJSON(e){const t={};return""!==e.value&&(t.value=e.value),t},create:e=>StringValue.fromPartial(e??{}),fromPartial(e){const t=createBaseStringValue();return t.value=e.value??"",t}};function createBaseBytesValue(){return{value:new Uint8Array(0)}}messageTypeRegistry.set(StringValue.$type,StringValue);const BytesValue={$type:"google.protobuf.BytesValue",encode:(e,t=_m0.Writer.create())=>(0!==e.value.length&&t.uint32(10).bytes(e.value),t),decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseBytesValue();for(;o.pos>>3){case 1:if(10!==e)break;n.value=o.bytes();continue}if(4==(7&e)||0===e)break;o.skipType(7&e)}return n},fromJSON:e=>({value:isSet$t(e.value)?bytesFromBase64(e.value):new Uint8Array(0)}),toJSON(e){const t={};return 0!==e.value.length&&(t.value=base64FromBytes(e.value)),t},create:e=>BytesValue.fromPartial(e??{}),fromPartial(e){const t=createBaseBytesValue();return t.value=e.value??new Uint8Array(0),t}};function bytesFromBase64(e){if(globalThis.Buffer)return Uint8Array.from(globalThis.Buffer.from(e,"base64"));{const t=globalThis.atob(e),o=new Uint8Array(t.length);for(let e=0;e{t.push(globalThis.String.fromCharCode(e))})),globalThis.btoa(t.join(""))}}function longToNumber$1(e){if(e.gt(globalThis.Number.MAX_SAFE_INTEGER))throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");return e.toNumber()}function isSet$t(e){return null!=e}var ConsentStatus,Scope;function consentStatusFromJSON(e){switch(e){case 0:case"CONSENT_STATUS_UNKNOWN":return ConsentStatus.CONSENT_STATUS_UNKNOWN;case 1:case"REVOKED":return ConsentStatus.REVOKED;case 2:case"GRANTED":return ConsentStatus.GRANTED;default:return ConsentStatus.UNRECOGNIZED}}function consentStatusToJSON(e){switch(e){case ConsentStatus.CONSENT_STATUS_UNKNOWN:return 0;case ConsentStatus.REVOKED:return 1;case ConsentStatus.GRANTED:return 2;case ConsentStatus.UNRECOGNIZED:default:return-1}}function scopeFromJSON(e){switch(e){case 0:case"SCOPE_UNKNOWN":return Scope.SCOPE_UNKNOWN;case 1:case"SUBMIT_POST":return Scope.SUBMIT_POST;case 2:case"SUBMIT_COMMENT":return Scope.SUBMIT_COMMENT;case 3:case"SUBSCRIBE_TO_SUBREDDIT":return Scope.SUBSCRIBE_TO_SUBREDDIT;default:return Scope.UNRECOGNIZED}}function scopeToJSON(e){switch(e){case Scope.SCOPE_UNKNOWN:return 0;case Scope.SUBMIT_POST:return 1;case Scope.SUBMIT_COMMENT:return 2;case Scope.SUBSCRIBE_TO_SUBREDDIT:return 3;case Scope.UNRECOGNIZED:default:return-1}}function createBaseAppPermission(){return{appSlug:"",subredditId:"",scopes:[],consentStatus:0,updatedAt:void 0}}messageTypeRegistry.set(BytesValue.$type,BytesValue),_m0.util.Long!==Long&&(_m0.util.Long=Long,_m0.configure()),function(e){e[e.CONSENT_STATUS_UNKNOWN=0]="CONSENT_STATUS_UNKNOWN",e[e.REVOKED=1]="REVOKED",e[e.GRANTED=2]="GRANTED",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"}(ConsentStatus||(ConsentStatus={})),function(e){e[e.SCOPE_UNKNOWN=0]="SCOPE_UNKNOWN",e[e.SUBMIT_POST=1]="SUBMIT_POST",e[e.SUBMIT_COMMENT=2]="SUBMIT_COMMENT",e[e.SUBSCRIBE_TO_SUBREDDIT=3]="SUBSCRIBE_TO_SUBREDDIT",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"}(Scope||(Scope={}));const AppPermission={$type:"reddit.devvit.app_permission.v1.AppPermission",encode(e,t=_m0.Writer.create()){""!==e.appSlug&&t.uint32(10).string(e.appSlug),""!==e.subredditId&&t.uint32(18).string(e.subredditId),t.uint32(26).fork();for(const o of e.scopes)t.int32(o);return t.ldelim(),0!==e.consentStatus&&t.uint32(32).int32(e.consentStatus),void 0!==e.updatedAt&&Timestamp.encode(toTimestamp(e.updatedAt),t.uint32(42).fork()).ldelim(),t},decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseAppPermission();for(;o.pos>>3){case 1:if(10!==e)break;n.appSlug=o.string();continue;case 2:if(18!==e)break;n.subredditId=o.string();continue;case 3:if(24===e){n.scopes.push(o.int32());continue}if(26===e){const e=o.uint32()+o.pos;for(;o.pos({appSlug:isSet$s(e.appSlug)?globalThis.String(e.appSlug):"",subredditId:isSet$s(e.subredditId)?globalThis.String(e.subredditId):"",scopes:globalThis.Array.isArray(e?.scopes)?e.scopes.map((e=>scopeFromJSON(e))):[],consentStatus:isSet$s(e.consentStatus)?consentStatusFromJSON(e.consentStatus):0,updatedAt:isSet$s(e.updatedAt)?fromJsonTimestamp(e.updatedAt):void 0}),toJSON(e){const t={};return""!==e.appSlug&&(t.appSlug=e.appSlug),""!==e.subredditId&&(t.subredditId=e.subredditId),e.scopes?.length&&(t.scopes=e.scopes.map((e=>scopeToJSON(e)))),0!==e.consentStatus&&(t.consentStatus=consentStatusToJSON(e.consentStatus)),void 0!==e.updatedAt&&(t.updatedAt=e.updatedAt.toISOString()),t},create:e=>AppPermission.fromPartial(e??{}),fromPartial(e){const t=createBaseAppPermission();return t.appSlug=e.appSlug??"",t.subredditId=e.subredditId??"",t.scopes=e.scopes?.map((e=>e))||[],t.consentStatus=e.consentStatus??0,t.updatedAt=e.updatedAt??void 0,t}};function createBaseDevvitApp(){return{appSlug:"",appName:""}}messageTypeRegistry.set(AppPermission.$type,AppPermission);const DevvitApp={$type:"reddit.devvit.app_permission.v1.DevvitApp",encode:(e,t=_m0.Writer.create())=>(""!==e.appSlug&&t.uint32(10).string(e.appSlug),""!==e.appName&&t.uint32(18).string(e.appName),t),decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseDevvitApp();for(;o.pos>>3){case 1:if(10!==e)break;n.appSlug=o.string();continue;case 2:if(18!==e)break;n.appName=o.string();continue}if(4==(7&e)||0===e)break;o.skipType(7&e)}return n},fromJSON:e=>({appSlug:isSet$s(e.appSlug)?globalThis.String(e.appSlug):"",appName:isSet$s(e.appName)?globalThis.String(e.appName):""}),toJSON(e){const t={};return""!==e.appSlug&&(t.appSlug=e.appSlug),""!==e.appName&&(t.appName=e.appName),t},create:e=>DevvitApp.fromPartial(e??{}),fromPartial(e){const t=createBaseDevvitApp();return t.appSlug=e.appSlug??"",t.appName=e.appName??"",t}};function createBaseGetAppPermissionsByUserIdRequest(){return{userId:""}}messageTypeRegistry.set(DevvitApp.$type,DevvitApp);const GetAppPermissionsByUserIdRequest={$type:"reddit.devvit.app_permission.v1.GetAppPermissionsByUserIdRequest",encode:(e,t=_m0.Writer.create())=>(""!==e.userId&&t.uint32(10).string(e.userId),t),decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseGetAppPermissionsByUserIdRequest();for(;o.pos>>3){case 1:if(10!==e)break;n.userId=o.string();continue}if(4==(7&e)||0===e)break;o.skipType(7&e)}return n},fromJSON:e=>({userId:isSet$s(e.userId)?globalThis.String(e.userId):""}),toJSON(e){const t={};return""!==e.userId&&(t.userId=e.userId),t},create:e=>GetAppPermissionsByUserIdRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseGetAppPermissionsByUserIdRequest();return t.userId=e.userId??"",t}};function createBaseGetAppPermissionsByUserIdResponse(){return{appPermissions:[],devvitApps:[]}}messageTypeRegistry.set(GetAppPermissionsByUserIdRequest.$type,GetAppPermissionsByUserIdRequest);const GetAppPermissionsByUserIdResponse={$type:"reddit.devvit.app_permission.v1.GetAppPermissionsByUserIdResponse",encode(e,t=_m0.Writer.create()){for(const o of e.appPermissions)AppPermission.encode(o,t.uint32(10).fork()).ldelim();for(const o of e.devvitApps)DevvitApp.encode(o,t.uint32(18).fork()).ldelim();return t},decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseGetAppPermissionsByUserIdResponse();for(;o.pos>>3){case 1:if(10!==e)break;n.appPermissions.push(AppPermission.decode(o,o.uint32()));continue;case 2:if(18!==e)break;n.devvitApps.push(DevvitApp.decode(o,o.uint32()));continue}if(4==(7&e)||0===e)break;o.skipType(7&e)}return n},fromJSON:e=>({appPermissions:globalThis.Array.isArray(e?.appPermissions)?e.appPermissions.map((e=>AppPermission.fromJSON(e))):[],devvitApps:globalThis.Array.isArray(e?.devvitApps)?e.devvitApps.map((e=>DevvitApp.fromJSON(e))):[]}),toJSON(e){const t={};return e.appPermissions?.length&&(t.appPermissions=e.appPermissions.map((e=>AppPermission.toJSON(e)))),e.devvitApps?.length&&(t.devvitApps=e.devvitApps.map((e=>DevvitApp.toJSON(e)))),t},create:e=>GetAppPermissionsByUserIdResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseGetAppPermissionsByUserIdResponse();return t.appPermissions=e.appPermissions?.map((e=>AppPermission.fromPartial(e)))||[],t.devvitApps=e.devvitApps?.map((e=>DevvitApp.fromPartial(e)))||[],t}};function createBaseGrantAppPermissionRequest(){return{userId:"",appSlug:"",subredditId:"",scopes:[]}}messageTypeRegistry.set(GetAppPermissionsByUserIdResponse.$type,GetAppPermissionsByUserIdResponse);const GrantAppPermissionRequest={$type:"reddit.devvit.app_permission.v1.GrantAppPermissionRequest",encode(e,t=_m0.Writer.create()){""!==e.userId&&t.uint32(10).string(e.userId),""!==e.appSlug&&t.uint32(18).string(e.appSlug),""!==e.subredditId&&t.uint32(26).string(e.subredditId),t.uint32(34).fork();for(const o of e.scopes)t.int32(o);return t.ldelim(),t},decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseGrantAppPermissionRequest();for(;o.pos>>3){case 1:if(10!==e)break;n.userId=o.string();continue;case 2:if(18!==e)break;n.appSlug=o.string();continue;case 3:if(26!==e)break;n.subredditId=o.string();continue;case 4:if(32===e){n.scopes.push(o.int32());continue}if(34===e){const e=o.uint32()+o.pos;for(;o.pos({userId:isSet$s(e.userId)?globalThis.String(e.userId):"",appSlug:isSet$s(e.appSlug)?globalThis.String(e.appSlug):"",subredditId:isSet$s(e.subredditId)?globalThis.String(e.subredditId):"",scopes:globalThis.Array.isArray(e?.scopes)?e.scopes.map((e=>scopeFromJSON(e))):[]}),toJSON(e){const t={};return""!==e.userId&&(t.userId=e.userId),""!==e.appSlug&&(t.appSlug=e.appSlug),""!==e.subredditId&&(t.subredditId=e.subredditId),e.scopes?.length&&(t.scopes=e.scopes.map((e=>scopeToJSON(e)))),t},create:e=>GrantAppPermissionRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseGrantAppPermissionRequest();return t.userId=e.userId??"",t.appSlug=e.appSlug??"",t.subredditId=e.subredditId??"",t.scopes=e.scopes?.map((e=>e))||[],t}};function createBaseGrantAppPermissionResponse(){return{error:void 0}}messageTypeRegistry.set(GrantAppPermissionRequest.$type,GrantAppPermissionRequest);const GrantAppPermissionResponse={$type:"reddit.devvit.app_permission.v1.GrantAppPermissionResponse",encode:(e,t=_m0.Writer.create())=>(void 0!==e.error&&ErrorMessage.encode(e.error,t.uint32(10).fork()).ldelim(),t),decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseGrantAppPermissionResponse();for(;o.pos>>3){case 1:if(10!==e)break;n.error=ErrorMessage.decode(o,o.uint32());continue}if(4==(7&e)||0===e)break;o.skipType(7&e)}return n},fromJSON:e=>({error:isSet$s(e.error)?ErrorMessage.fromJSON(e.error):void 0}),toJSON(e){const t={};return void 0!==e.error&&(t.error=ErrorMessage.toJSON(e.error)),t},create:e=>GrantAppPermissionResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseGrantAppPermissionResponse();return t.error=void 0!==e.error&&null!==e.error?ErrorMessage.fromPartial(e.error):void 0,t}};function createBaseRevokeAppPermissionRequest(){return{appSlug:"",userId:"",subredditId:""}}messageTypeRegistry.set(GrantAppPermissionResponse.$type,GrantAppPermissionResponse);const RevokeAppPermissionRequest={$type:"reddit.devvit.app_permission.v1.RevokeAppPermissionRequest",encode:(e,t=_m0.Writer.create())=>(""!==e.appSlug&&t.uint32(10).string(e.appSlug),""!==e.userId&&t.uint32(18).string(e.userId),""!==e.subredditId&&t.uint32(26).string(e.subredditId),t),decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseRevokeAppPermissionRequest();for(;o.pos>>3){case 1:if(10!==e)break;n.appSlug=o.string();continue;case 2:if(18!==e)break;n.userId=o.string();continue;case 3:if(26!==e)break;n.subredditId=o.string();continue}if(4==(7&e)||0===e)break;o.skipType(7&e)}return n},fromJSON:e=>({appSlug:isSet$s(e.appSlug)?globalThis.String(e.appSlug):"",userId:isSet$s(e.userId)?globalThis.String(e.userId):"",subredditId:isSet$s(e.subredditId)?globalThis.String(e.subredditId):""}),toJSON(e){const t={};return""!==e.appSlug&&(t.appSlug=e.appSlug),""!==e.userId&&(t.userId=e.userId),""!==e.subredditId&&(t.subredditId=e.subredditId),t},create:e=>RevokeAppPermissionRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseRevokeAppPermissionRequest();return t.appSlug=e.appSlug??"",t.userId=e.userId??"",t.subredditId=e.subredditId??"",t}};function createBaseRevokeAppPermissionResponse(){return{error:void 0}}messageTypeRegistry.set(RevokeAppPermissionRequest.$type,RevokeAppPermissionRequest);const RevokeAppPermissionResponse={$type:"reddit.devvit.app_permission.v1.RevokeAppPermissionResponse",encode:(e,t=_m0.Writer.create())=>(void 0!==e.error&&ErrorMessage.encode(e.error,t.uint32(10).fork()).ldelim(),t),decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseRevokeAppPermissionResponse();for(;o.pos>>3){case 1:if(10!==e)break;n.error=ErrorMessage.decode(o,o.uint32());continue}if(4==(7&e)||0===e)break;o.skipType(7&e)}return n},fromJSON:e=>({error:isSet$s(e.error)?ErrorMessage.fromJSON(e.error):void 0}),toJSON(e){const t={};return void 0!==e.error&&(t.error=ErrorMessage.toJSON(e.error)),t},create:e=>RevokeAppPermissionResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseRevokeAppPermissionResponse();return t.error=void 0!==e.error&&null!==e.error?ErrorMessage.fromPartial(e.error):void 0,t}};function createBaseErrorMessage(){return{message:""}}messageTypeRegistry.set(RevokeAppPermissionResponse.$type,RevokeAppPermissionResponse);const ErrorMessage={$type:"reddit.devvit.app_permission.v1.ErrorMessage",encode:(e,t=_m0.Writer.create())=>(""!==e.message&&t.uint32(10).string(e.message),t),decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseErrorMessage();for(;o.pos>>3){case 1:if(10!==e)break;n.message=o.string();continue}if(4==(7&e)||0===e)break;o.skipType(7&e)}return n},fromJSON:e=>({message:isSet$s(e.message)?globalThis.String(e.message):""}),toJSON(e){const t={};return""!==e.message&&(t.message=e.message),t},create:e=>ErrorMessage.fromPartial(e??{}),fromPartial(e){const t=createBaseErrorMessage();return t.message=e.message??"",t}};function toTimestamp(e){return{seconds:Math.trunc(e.getTime()/1e3),nanos:e.getTime()%1e3*1e6}}function fromTimestamp(e){let t=1e3*(e.seconds||0);return t+=(e.nanos||0)/1e6,new globalThis.Date(t)}function fromJsonTimestamp(e){return e instanceof globalThis.Date?e:"string"==typeof e?new globalThis.Date(e):fromTimestamp(Timestamp.fromJSON(e))}function isSet$s(e){return null!=e}function createBaseEmpty(){return{}}messageTypeRegistry.set(ErrorMessage.$type,ErrorMessage);const Empty={$type:"google.protobuf.Empty",encode:(e,t=_m0.Writer.create())=>t,decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseEmpty();for(;o.pos({}),toJSON:e=>({}),create:e=>Empty.fromPartial(e??{}),fromPartial:e=>createBaseEmpty()};var NullValue;function nullValueFromJSON(e){switch(e){case 0:case"NULL_VALUE":return NullValue.NULL_VALUE;default:return NullValue.UNRECOGNIZED}}function nullValueToJSON(e){switch(e){case NullValue.NULL_VALUE:return 0;case NullValue.UNRECOGNIZED:default:return-1}}function createBaseStruct(){return{fields:{}}}messageTypeRegistry.set(Empty.$type,Empty),function(e){e[e.NULL_VALUE=0]="NULL_VALUE",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"}(NullValue||(NullValue={}));const Struct={$type:"google.protobuf.Struct",encode:(e,t=_m0.Writer.create())=>(Object.entries(e.fields).forEach((([e,o])=>{void 0!==o&&Struct_FieldsEntry.encode({key:e,value:o},t.uint32(10).fork()).ldelim()})),t),decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseStruct();for(;o.pos>>3){case 1:if(10!==e)break;const t=Struct_FieldsEntry.decode(o,o.uint32());void 0!==t.value&&(n.fields[t.key]=t.value);continue}if(4==(7&e)||0===e)break;o.skipType(7&e)}return n},fromJSON:e=>({fields:isObject$8(e.fields)?Object.entries(e.fields).reduce(((e,[t,o])=>(e[t]=o,e)),{}):{}}),toJSON(e){const t={};if(e.fields){const o=Object.entries(e.fields);o.length>0&&(t.fields={},o.forEach((([e,o])=>{t.fields[e]=o})))}return t},create:e=>Struct.fromPartial(e??{}),fromPartial(e){const t=createBaseStruct();return t.fields=Object.entries(e.fields??{}).reduce(((e,[t,o])=>(void 0!==o&&(e[t]=o),e)),{}),t},wrap(e){const t=createBaseStruct();if(void 0!==e)for(const o of Object.keys(e))t.fields[o]=e[o];return t},unwrap(e){const t={};if(e.fields)for(const o of Object.keys(e.fields))t[o]=e.fields[o];return t}};function createBaseStruct_FieldsEntry(){return{key:"",value:void 0}}messageTypeRegistry.set(Struct.$type,Struct);const Struct_FieldsEntry={$type:"google.protobuf.Struct.FieldsEntry",encode:(e,t=_m0.Writer.create())=>(""!==e.key&&t.uint32(10).string(e.key),void 0!==e.value&&Value.encode(Value.wrap(e.value),t.uint32(18).fork()).ldelim(),t),decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseStruct_FieldsEntry();for(;o.pos>>3){case 1:if(10!==e)break;n.key=o.string();continue;case 2:if(18!==e)break;n.value=Value.unwrap(Value.decode(o,o.uint32()));continue}if(4==(7&e)||0===e)break;o.skipType(7&e)}return n},fromJSON:e=>({key:isSet$r(e.key)?globalThis.String(e.key):"",value:isSet$r(e?.value)?e.value:void 0}),toJSON(e){const t={};return""!==e.key&&(t.key=e.key),void 0!==e.value&&(t.value=e.value),t},create:e=>Struct_FieldsEntry.fromPartial(e??{}),fromPartial(e){const t=createBaseStruct_FieldsEntry();return t.key=e.key??"",t.value=e.value??void 0,t}};function createBaseValue(){return{nullValue:void 0,numberValue:void 0,stringValue:void 0,boolValue:void 0,structValue:void 0,listValue:void 0}}messageTypeRegistry.set(Struct_FieldsEntry.$type,Struct_FieldsEntry);const Value={$type:"google.protobuf.Value",encode:(e,t=_m0.Writer.create())=>(void 0!==e.nullValue&&t.uint32(8).int32(e.nullValue),void 0!==e.numberValue&&t.uint32(17).double(e.numberValue),void 0!==e.stringValue&&t.uint32(26).string(e.stringValue),void 0!==e.boolValue&&t.uint32(32).bool(e.boolValue),void 0!==e.structValue&&Struct.encode(Struct.wrap(e.structValue),t.uint32(42).fork()).ldelim(),void 0!==e.listValue&&ListValue.encode(ListValue.wrap(e.listValue),t.uint32(50).fork()).ldelim(),t),decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseValue();for(;o.pos>>3){case 1:if(8!==e)break;n.nullValue=o.int32();continue;case 2:if(17!==e)break;n.numberValue=o.double();continue;case 3:if(26!==e)break;n.stringValue=o.string();continue;case 4:if(32!==e)break;n.boolValue=o.bool();continue;case 5:if(42!==e)break;n.structValue=Struct.unwrap(Struct.decode(o,o.uint32()));continue;case 6:if(50!==e)break;n.listValue=ListValue.unwrap(ListValue.decode(o,o.uint32()));continue}if(4==(7&e)||0===e)break;o.skipType(7&e)}return n},fromJSON:e=>({nullValue:isSet$r(e.nullValue)?nullValueFromJSON(e.nullValue):void 0,numberValue:isSet$r(e.numberValue)?globalThis.Number(e.numberValue):void 0,stringValue:isSet$r(e.stringValue)?globalThis.String(e.stringValue):void 0,boolValue:isSet$r(e.boolValue)?globalThis.Boolean(e.boolValue):void 0,structValue:isObject$8(e.structValue)?e.structValue:void 0,listValue:globalThis.Array.isArray(e.listValue)?[...e.listValue]:void 0}),toJSON(e){const t={};return void 0!==e.nullValue&&(t.nullValue=nullValueToJSON(e.nullValue)),void 0!==e.numberValue&&(t.numberValue=e.numberValue),void 0!==e.stringValue&&(t.stringValue=e.stringValue),void 0!==e.boolValue&&(t.boolValue=e.boolValue),void 0!==e.structValue&&(t.structValue=e.structValue),void 0!==e.listValue&&(t.listValue=e.listValue),t},create:e=>Value.fromPartial(e??{}),fromPartial(e){const t=createBaseValue();return t.nullValue=e.nullValue??void 0,t.numberValue=e.numberValue??void 0,t.stringValue=e.stringValue??void 0,t.boolValue=e.boolValue??void 0,t.structValue=e.structValue??void 0,t.listValue=e.listValue??void 0,t},wrap(e){const t=createBaseValue();if(null===e)t.nullValue=NullValue.NULL_VALUE;else if("boolean"==typeof e)t.boolValue=e;else if("number"==typeof e)t.numberValue=e;else if("string"==typeof e)t.stringValue=e;else if(globalThis.Array.isArray(e))t.listValue=e;else if("object"==typeof e)t.structValue=e;else if(void 0!==e)throw new globalThis.Error("Unsupported any value type: "+typeof e);return t},unwrap:e=>void 0!==e.stringValue?e.stringValue:void 0!==e?.numberValue?e.numberValue:void 0!==e?.boolValue?e.boolValue:void 0!==e?.structValue?e.structValue:void 0!==e?.listValue?e.listValue:void 0!==e?.nullValue?null:void 0};function createBaseListValue(){return{values:[]}}messageTypeRegistry.set(Value.$type,Value);const ListValue={$type:"google.protobuf.ListValue",encode(e,t=_m0.Writer.create()){for(const o of e.values)Value.encode(Value.wrap(o),t.uint32(10).fork()).ldelim();return t},decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseListValue();for(;o.pos>>3){case 1:if(10!==e)break;n.values.push(Value.unwrap(Value.decode(o,o.uint32())));continue}if(4==(7&e)||0===e)break;o.skipType(7&e)}return n},fromJSON:e=>({values:globalThis.Array.isArray(e?.values)?[...e.values]:[]}),toJSON(e){const t={};return e.values?.length&&(t.values=e.values),t},create:e=>ListValue.fromPartial(e??{}),fromPartial(e){const t=createBaseListValue();return t.values=e.values?.map((e=>e))||[],t},wrap(e){const t=createBaseListValue();return t.values=e??[],t},unwrap:e=>e?.hasOwnProperty("values")&&globalThis.Array.isArray(e.values)?e.values:e};function isObject$8(e){return"object"==typeof e&&null!==e}function isSet$r(e){return null!=e}function createBaseCanRunAsUserEffect(){return{postId:void 0,appSlug:void 0,subredditId:void 0}}messageTypeRegistry.set(ListValue.$type,ListValue);const CanRunAsUserEffect={$type:"devvit.ui.effect_types.v1alpha.CanRunAsUserEffect",encode:(e,t=_m0.Writer.create())=>(void 0!==e.postId&&t.uint32(10).string(e.postId),void 0!==e.appSlug&&t.uint32(18).string(e.appSlug),void 0!==e.subredditId&&t.uint32(26).string(e.subredditId),t),decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseCanRunAsUserEffect();for(;o.pos>>3){case 1:if(10!==e)break;n.postId=o.string();continue;case 2:if(18!==e)break;n.appSlug=o.string();continue;case 3:if(26!==e)break;n.subredditId=o.string();continue}if(4==(7&e)||0===e)break;o.skipType(7&e)}return n},fromJSON:e=>({postId:isSet$q(e.postId)?globalThis.String(e.postId):void 0,appSlug:isSet$q(e.appSlug)?globalThis.String(e.appSlug):void 0,subredditId:isSet$q(e.subredditId)?globalThis.String(e.subredditId):void 0}),toJSON(e){const t={};return void 0!==e.postId&&(t.postId=e.postId),void 0!==e.appSlug&&(t.appSlug=e.appSlug),void 0!==e.subredditId&&(t.subredditId=e.subredditId),t},create:e=>CanRunAsUserEffect.fromPartial(e??{}),fromPartial(e){const t=createBaseCanRunAsUserEffect();return t.postId=e.postId??void 0,t.appSlug=e.appSlug??void 0,t.subredditId=e.subredditId??void 0,t}};function createBaseConsentStatusEvent(){return{consentStatus:0}}messageTypeRegistry.set(CanRunAsUserEffect.$type,CanRunAsUserEffect);const ConsentStatusEvent={$type:"devvit.ui.effect_types.v1alpha.ConsentStatusEvent",encode:(e,t=_m0.Writer.create())=>(0!==e.consentStatus&&t.uint32(8).int32(e.consentStatus),t),decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseConsentStatusEvent();for(;o.pos>>3){case 1:if(8!==e)break;n.consentStatus=o.int32();continue}if(4==(7&e)||0===e)break;o.skipType(7&e)}return n},fromJSON:e=>({consentStatus:isSet$q(e.consentStatus)?consentStatusFromJSON(e.consentStatus):0}),toJSON(e){const t={};return 0!==e.consentStatus&&(t.consentStatus=consentStatusToJSON(e.consentStatus)),t},create:e=>ConsentStatusEvent.fromPartial(e??{}),fromPartial(e){const t=createBaseConsentStatusEvent();return t.consentStatus=e.consentStatus??0,t}};function isSet$q(e){return null!=e}var OrderResultStatus;function orderResultStatusFromJSON(e){switch(e){case 0:case"STATUS_CANCELLED":return OrderResultStatus.STATUS_CANCELLED;case 1:case"STATUS_SUCCESS":return OrderResultStatus.STATUS_SUCCESS;case 2:case"STATUS_ERROR":return OrderResultStatus.STATUS_ERROR;default:return OrderResultStatus.UNRECOGNIZED}}function orderResultStatusToJSON(e){switch(e){case OrderResultStatus.STATUS_CANCELLED:return 0;case OrderResultStatus.STATUS_SUCCESS:return 1;case OrderResultStatus.STATUS_ERROR:return 2;case OrderResultStatus.UNRECOGNIZED:default:return-1}}function createBaseCreateOrderEffect(){return{id:"",skus:[],metadata:{}}}messageTypeRegistry.set(ConsentStatusEvent.$type,ConsentStatusEvent),function(e){e[e.STATUS_CANCELLED=0]="STATUS_CANCELLED",e[e.STATUS_SUCCESS=1]="STATUS_SUCCESS",e[e.STATUS_ERROR=2]="STATUS_ERROR",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"}(OrderResultStatus||(OrderResultStatus={}));const CreateOrderEffect={$type:"devvit.ui.effect_types.v1alpha.CreateOrderEffect",encode(e,t=_m0.Writer.create()){""!==e.id&&t.uint32(10).string(e.id);for(const o of e.skus)t.uint32(18).string(o);return Object.entries(e.metadata).forEach((([e,o])=>{CreateOrderEffect_MetadataEntry.encode({key:e,value:o},t.uint32(26).fork()).ldelim()})),t},decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseCreateOrderEffect();for(;o.pos>>3){case 1:if(10!==e)break;n.id=o.string();continue;case 2:if(18!==e)break;n.skus.push(o.string());continue;case 3:if(26!==e)break;const t=CreateOrderEffect_MetadataEntry.decode(o,o.uint32());void 0!==t.value&&(n.metadata[t.key]=t.value);continue}if(4==(7&e)||0===e)break;o.skipType(7&e)}return n},fromJSON:e=>({id:isSet$p(e.id)?globalThis.String(e.id):"",skus:globalThis.Array.isArray(e?.skus)?e.skus.map((e=>globalThis.String(e))):[],metadata:isObject$7(e.metadata)?Object.entries(e.metadata).reduce(((e,[t,o])=>(e[t]=String(o),e)),{}):{}}),toJSON(e){const t={};if(""!==e.id&&(t.id=e.id),e.skus?.length&&(t.skus=e.skus),e.metadata){const o=Object.entries(e.metadata);o.length>0&&(t.metadata={},o.forEach((([e,o])=>{t.metadata[e]=o})))}return t},create:e=>CreateOrderEffect.fromPartial(e??{}),fromPartial(e){const t=createBaseCreateOrderEffect();return t.id=e.id??"",t.skus=e.skus?.map((e=>e))||[],t.metadata=Object.entries(e.metadata??{}).reduce(((e,[t,o])=>(void 0!==o&&(e[t]=globalThis.String(o)),e)),{}),t}};function createBaseCreateOrderEffect_MetadataEntry(){return{key:"",value:""}}messageTypeRegistry.set(CreateOrderEffect.$type,CreateOrderEffect);const CreateOrderEffect_MetadataEntry={$type:"devvit.ui.effect_types.v1alpha.CreateOrderEffect.MetadataEntry",encode:(e,t=_m0.Writer.create())=>(""!==e.key&&t.uint32(10).string(e.key),""!==e.value&&t.uint32(18).string(e.value),t),decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseCreateOrderEffect_MetadataEntry();for(;o.pos>>3){case 1:if(10!==e)break;n.key=o.string();continue;case 2:if(18!==e)break;n.value=o.string();continue}if(4==(7&e)||0===e)break;o.skipType(7&e)}return n},fromJSON:e=>({key:isSet$p(e.key)?globalThis.String(e.key):"",value:isSet$p(e.value)?globalThis.String(e.value):""}),toJSON(e){const t={};return""!==e.key&&(t.key=e.key),""!==e.value&&(t.value=e.value),t},create:e=>CreateOrderEffect_MetadataEntry.fromPartial(e??{}),fromPartial(e){const t=createBaseCreateOrderEffect_MetadataEntry();return t.key=e.key??"",t.value=e.value??"",t}};function createBaseOrderResultEvent(){return{errorMessage:void 0,orderId:void 0,order:void 0,status:0,errorCode:void 0}}messageTypeRegistry.set(CreateOrderEffect_MetadataEntry.$type,CreateOrderEffect_MetadataEntry);const OrderResultEvent={$type:"devvit.ui.effect_types.v1alpha.OrderResultEvent",encode:(e,t=_m0.Writer.create())=>(void 0!==e.errorMessage&&t.uint32(18).string(e.errorMessage),void 0!==e.orderId&&t.uint32(26).string(e.orderId),void 0!==e.order&&CreateOrderEffect.encode(e.order,t.uint32(34).fork()).ldelim(),0!==e.status&&t.uint32(40).int32(e.status),void 0!==e.errorCode&&t.uint32(48).int32(e.errorCode),t),decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseOrderResultEvent();for(;o.pos>>3){case 2:if(18!==e)break;n.errorMessage=o.string();continue;case 3:if(26!==e)break;n.orderId=o.string();continue;case 4:if(34!==e)break;n.order=CreateOrderEffect.decode(o,o.uint32());continue;case 5:if(40!==e)break;n.status=o.int32();continue;case 6:if(48!==e)break;n.errorCode=o.int32();continue}if(4==(7&e)||0===e)break;o.skipType(7&e)}return n},fromJSON:e=>({errorMessage:isSet$p(e.errorMessage)?globalThis.String(e.errorMessage):void 0,orderId:isSet$p(e.orderId)?globalThis.String(e.orderId):void 0,order:isSet$p(e.order)?CreateOrderEffect.fromJSON(e.order):void 0,status:isSet$p(e.status)?orderResultStatusFromJSON(e.status):0,errorCode:isSet$p(e.errorCode)?globalThis.Number(e.errorCode):void 0}),toJSON(e){const t={};return void 0!==e.errorMessage&&(t.errorMessage=e.errorMessage),void 0!==e.orderId&&(t.orderId=e.orderId),void 0!==e.order&&(t.order=CreateOrderEffect.toJSON(e.order)),0!==e.status&&(t.status=orderResultStatusToJSON(e.status)),void 0!==e.errorCode&&(t.errorCode=Math.round(e.errorCode)),t},create:e=>OrderResultEvent.fromPartial(e??{}),fromPartial(e){const t=createBaseOrderResultEvent();return t.errorMessage=e.errorMessage??void 0,t.orderId=e.orderId??void 0,t.order=void 0!==e.order&&null!==e.order?CreateOrderEffect.fromPartial(e.order):void 0,t.status=e.status??0,t.errorCode=e.errorCode??void 0,t}};function isObject$7(e){return"object"==typeof e&&null!==e}function isSet$p(e){return null!=e}function createBaseNavigateToUrlEffect(){return{url:"",target:void 0}}messageTypeRegistry.set(OrderResultEvent.$type,OrderResultEvent);const NavigateToUrlEffect={$type:"devvit.ui.effect_types.v1alpha.NavigateToUrlEffect",encode:(e,t=_m0.Writer.create())=>(""!==e.url&&t.uint32(10).string(e.url),void 0!==e.target&&t.uint32(18).string(e.target),t),decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseNavigateToUrlEffect();for(;o.pos>>3){case 1:if(10!==e)break;n.url=o.string();continue;case 2:if(18!==e)break;n.target=o.string();continue}if(4==(7&e)||0===e)break;o.skipType(7&e)}return n},fromJSON:e=>({url:isSet$o(e.url)?globalThis.String(e.url):"",target:isSet$o(e.target)?globalThis.String(e.target):void 0}),toJSON(e){const t={};return""!==e.url&&(t.url=e.url),void 0!==e.target&&(t.target=e.target),t},create:e=>NavigateToUrlEffect.fromPartial(e??{}),fromPartial(e){const t=createBaseNavigateToUrlEffect();return t.url=e.url??"",t.target=e.target??void 0,t}};function isSet$o(e){return null!=e}var FormFieldType;function formFieldTypeFromJSON(e){switch(e){case 0:case"STRING":return FormFieldType.STRING;case 1:case"PARAGRAPH":return FormFieldType.PARAGRAPH;case 2:case"NUMBER":return FormFieldType.NUMBER;case 3:case"BOOLEAN":return FormFieldType.BOOLEAN;case 4:case"LIST":return FormFieldType.LIST;case 5:case"SELECTION":return FormFieldType.SELECTION;case 6:case"GROUP":return FormFieldType.GROUP;case 7:case"IMAGE":return FormFieldType.IMAGE;default:return FormFieldType.UNRECOGNIZED}}function formFieldTypeToJSON(e){switch(e){case FormFieldType.STRING:return 0;case FormFieldType.PARAGRAPH:return 1;case FormFieldType.NUMBER:return 2;case FormFieldType.BOOLEAN:return 3;case FormFieldType.LIST:return 4;case FormFieldType.SELECTION:return 5;case FormFieldType.GROUP:return 6;case FormFieldType.IMAGE:return 7;case FormFieldType.UNRECOGNIZED:default:return-1}}function createBaseFormFieldValue(){return{fieldType:0,isSecret:void 0,stringValue:void 0,numberValue:void 0,boolValue:void 0,listValue:void 0,selectionValue:void 0,groupValue:void 0}}messageTypeRegistry.set(NavigateToUrlEffect.$type,NavigateToUrlEffect),function(e){e[e.STRING=0]="STRING",e[e.PARAGRAPH=1]="PARAGRAPH",e[e.NUMBER=2]="NUMBER",e[e.BOOLEAN=3]="BOOLEAN",e[e.LIST=4]="LIST",e[e.SELECTION=5]="SELECTION",e[e.GROUP=6]="GROUP",e[e.IMAGE=7]="IMAGE",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"}(FormFieldType||(FormFieldType={}));const FormFieldValue={$type:"devvit.ui.form_builder.v1alpha.FormFieldValue",encode:(e,t=_m0.Writer.create())=>(0!==e.fieldType&&t.uint32(8).int32(e.fieldType),void 0!==e.isSecret&&t.uint32(800).bool(e.isSecret),void 0!==e.stringValue&&t.uint32(18).string(e.stringValue),void 0!==e.numberValue&&t.uint32(25).double(e.numberValue),void 0!==e.boolValue&&t.uint32(32).bool(e.boolValue),void 0!==e.listValue&&FormFieldValue_ListValue.encode(e.listValue,t.uint32(42).fork()).ldelim(),void 0!==e.selectionValue&&FormFieldValue_SelectionValue.encode(e.selectionValue,t.uint32(50).fork()).ldelim(),void 0!==e.groupValue&&FormFieldValue_GroupValue.encode(e.groupValue,t.uint32(58).fork()).ldelim(),t),decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseFormFieldValue();for(;o.pos>>3){case 1:if(8!==e)break;n.fieldType=o.int32();continue;case 100:if(800!==e)break;n.isSecret=o.bool();continue;case 2:if(18!==e)break;n.stringValue=o.string();continue;case 3:if(25!==e)break;n.numberValue=o.double();continue;case 4:if(32!==e)break;n.boolValue=o.bool();continue;case 5:if(42!==e)break;n.listValue=FormFieldValue_ListValue.decode(o,o.uint32());continue;case 6:if(50!==e)break;n.selectionValue=FormFieldValue_SelectionValue.decode(o,o.uint32());continue;case 7:if(58!==e)break;n.groupValue=FormFieldValue_GroupValue.decode(o,o.uint32());continue}if(4==(7&e)||0===e)break;o.skipType(7&e)}return n},fromJSON:e=>({fieldType:isSet$n(e.fieldType)?formFieldTypeFromJSON(e.fieldType):0,isSecret:isSet$n(e.isSecret)?globalThis.Boolean(e.isSecret):void 0,stringValue:isSet$n(e.stringValue)?globalThis.String(e.stringValue):void 0,numberValue:isSet$n(e.numberValue)?globalThis.Number(e.numberValue):void 0,boolValue:isSet$n(e.boolValue)?globalThis.Boolean(e.boolValue):void 0,listValue:isSet$n(e.listValue)?FormFieldValue_ListValue.fromJSON(e.listValue):void 0,selectionValue:isSet$n(e.selectionValue)?FormFieldValue_SelectionValue.fromJSON(e.selectionValue):void 0,groupValue:isSet$n(e.groupValue)?FormFieldValue_GroupValue.fromJSON(e.groupValue):void 0}),toJSON(e){const t={};return 0!==e.fieldType&&(t.fieldType=formFieldTypeToJSON(e.fieldType)),void 0!==e.isSecret&&(t.isSecret=e.isSecret),void 0!==e.stringValue&&(t.stringValue=e.stringValue),void 0!==e.numberValue&&(t.numberValue=e.numberValue),void 0!==e.boolValue&&(t.boolValue=e.boolValue),void 0!==e.listValue&&(t.listValue=FormFieldValue_ListValue.toJSON(e.listValue)),void 0!==e.selectionValue&&(t.selectionValue=FormFieldValue_SelectionValue.toJSON(e.selectionValue)),void 0!==e.groupValue&&(t.groupValue=FormFieldValue_GroupValue.toJSON(e.groupValue)),t},create:e=>FormFieldValue.fromPartial(e??{}),fromPartial(e){const t=createBaseFormFieldValue();return t.fieldType=e.fieldType??0,t.isSecret=e.isSecret??void 0,t.stringValue=e.stringValue??void 0,t.numberValue=e.numberValue??void 0,t.boolValue=e.boolValue??void 0,t.listValue=void 0!==e.listValue&&null!==e.listValue?FormFieldValue_ListValue.fromPartial(e.listValue):void 0,t.selectionValue=void 0!==e.selectionValue&&null!==e.selectionValue?FormFieldValue_SelectionValue.fromPartial(e.selectionValue):void 0,t.groupValue=void 0!==e.groupValue&&null!==e.groupValue?FormFieldValue_GroupValue.fromPartial(e.groupValue):void 0,t}};function createBaseFormFieldValue_ListValue(){return{itemType:0,items:[]}}messageTypeRegistry.set(FormFieldValue.$type,FormFieldValue);const FormFieldValue_ListValue={$type:"devvit.ui.form_builder.v1alpha.FormFieldValue.ListValue",encode(e,t=_m0.Writer.create()){0!==e.itemType&&t.uint32(8).int32(e.itemType);for(const o of e.items)FormFieldValue.encode(o,t.uint32(18).fork()).ldelim();return t},decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseFormFieldValue_ListValue();for(;o.pos>>3){case 1:if(8!==e)break;n.itemType=o.int32();continue;case 2:if(18!==e)break;n.items.push(FormFieldValue.decode(o,o.uint32()));continue}if(4==(7&e)||0===e)break;o.skipType(7&e)}return n},fromJSON:e=>({itemType:isSet$n(e.itemType)?formFieldTypeFromJSON(e.itemType):0,items:globalThis.Array.isArray(e?.items)?e.items.map((e=>FormFieldValue.fromJSON(e))):[]}),toJSON(e){const t={};return 0!==e.itemType&&(t.itemType=formFieldTypeToJSON(e.itemType)),e.items?.length&&(t.items=e.items.map((e=>FormFieldValue.toJSON(e)))),t},create:e=>FormFieldValue_ListValue.fromPartial(e??{}),fromPartial(e){const t=createBaseFormFieldValue_ListValue();return t.itemType=e.itemType??0,t.items=e.items?.map((e=>FormFieldValue.fromPartial(e)))||[],t}};function createBaseFormFieldValue_SelectionValue(){return{values:[]}}messageTypeRegistry.set(FormFieldValue_ListValue.$type,FormFieldValue_ListValue);const FormFieldValue_SelectionValue={$type:"devvit.ui.form_builder.v1alpha.FormFieldValue.SelectionValue",encode(e,t=_m0.Writer.create()){for(const o of e.values)t.uint32(10).string(o);return t},decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseFormFieldValue_SelectionValue();for(;o.pos>>3){case 1:if(10!==e)break;n.values.push(o.string());continue}if(4==(7&e)||0===e)break;o.skipType(7&e)}return n},fromJSON:e=>({values:globalThis.Array.isArray(e?.values)?e.values.map((e=>globalThis.String(e))):[]}),toJSON(e){const t={};return e.values?.length&&(t.values=e.values),t},create:e=>FormFieldValue_SelectionValue.fromPartial(e??{}),fromPartial(e){const t=createBaseFormFieldValue_SelectionValue();return t.values=e.values?.map((e=>e))||[],t}};function createBaseFormFieldValue_GroupValue(){return{}}messageTypeRegistry.set(FormFieldValue_SelectionValue.$type,FormFieldValue_SelectionValue);const FormFieldValue_GroupValue={$type:"devvit.ui.form_builder.v1alpha.FormFieldValue.GroupValue",encode:(e,t=_m0.Writer.create())=>t,decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseFormFieldValue_GroupValue();for(;o.pos({}),toJSON:e=>({}),create:e=>FormFieldValue_GroupValue.fromPartial(e??{}),fromPartial:e=>createBaseFormFieldValue_GroupValue()};function isSet$n(e){return null!=e}function createBaseFormField(){return{fieldId:"",fieldType:0,label:"",helpText:void 0,defaultValue:void 0,required:void 0,disabled:void 0,fieldConfig:void 0,isSecret:void 0}}messageTypeRegistry.set(FormFieldValue_GroupValue.$type,FormFieldValue_GroupValue);const FormField={$type:"devvit.ui.form_builder.v1alpha.FormField",encode:(e,t=_m0.Writer.create())=>(""!==e.fieldId&&t.uint32(10).string(e.fieldId),0!==e.fieldType&&t.uint32(16).int32(e.fieldType),""!==e.label&&t.uint32(26).string(e.label),void 0!==e.helpText&&t.uint32(34).string(e.helpText),void 0!==e.defaultValue&&FormFieldValue.encode(e.defaultValue,t.uint32(42).fork()).ldelim(),void 0!==e.required&&t.uint32(48).bool(e.required),void 0!==e.disabled&&t.uint32(56).bool(e.disabled),void 0!==e.fieldConfig&&FieldConfig.encode(e.fieldConfig,t.uint32(66).fork()).ldelim(),void 0!==e.isSecret&&t.uint32(72).bool(e.isSecret),t),decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseFormField();for(;o.pos>>3){case 1:if(10!==e)break;n.fieldId=o.string();continue;case 2:if(16!==e)break;n.fieldType=o.int32();continue;case 3:if(26!==e)break;n.label=o.string();continue;case 4:if(34!==e)break;n.helpText=o.string();continue;case 5:if(42!==e)break;n.defaultValue=FormFieldValue.decode(o,o.uint32());continue;case 6:if(48!==e)break;n.required=o.bool();continue;case 7:if(56!==e)break;n.disabled=o.bool();continue;case 8:if(66!==e)break;n.fieldConfig=FieldConfig.decode(o,o.uint32());continue;case 9:if(72!==e)break;n.isSecret=o.bool();continue}if(4==(7&e)||0===e)break;o.skipType(7&e)}return n},fromJSON:e=>({fieldId:isSet$m(e.fieldId)?globalThis.String(e.fieldId):"",fieldType:isSet$m(e.fieldType)?formFieldTypeFromJSON(e.fieldType):0,label:isSet$m(e.label)?globalThis.String(e.label):"",helpText:isSet$m(e.helpText)?globalThis.String(e.helpText):void 0,defaultValue:isSet$m(e.defaultValue)?FormFieldValue.fromJSON(e.defaultValue):void 0,required:isSet$m(e.required)?globalThis.Boolean(e.required):void 0,disabled:isSet$m(e.disabled)?globalThis.Boolean(e.disabled):void 0,fieldConfig:isSet$m(e.fieldConfig)?FieldConfig.fromJSON(e.fieldConfig):void 0,isSecret:isSet$m(e.isSecret)?globalThis.Boolean(e.isSecret):void 0}),toJSON(e){const t={};return""!==e.fieldId&&(t.fieldId=e.fieldId),0!==e.fieldType&&(t.fieldType=formFieldTypeToJSON(e.fieldType)),""!==e.label&&(t.label=e.label),void 0!==e.helpText&&(t.helpText=e.helpText),void 0!==e.defaultValue&&(t.defaultValue=FormFieldValue.toJSON(e.defaultValue)),void 0!==e.required&&(t.required=e.required),void 0!==e.disabled&&(t.disabled=e.disabled),void 0!==e.fieldConfig&&(t.fieldConfig=FieldConfig.toJSON(e.fieldConfig)),void 0!==e.isSecret&&(t.isSecret=e.isSecret),t},create:e=>FormField.fromPartial(e??{}),fromPartial(e){const t=createBaseFormField();return t.fieldId=e.fieldId??"",t.fieldType=e.fieldType??0,t.label=e.label??"",t.helpText=e.helpText??void 0,t.defaultValue=void 0!==e.defaultValue&&null!==e.defaultValue?FormFieldValue.fromPartial(e.defaultValue):void 0,t.required=e.required??void 0,t.disabled=e.disabled??void 0,t.fieldConfig=void 0!==e.fieldConfig&&null!==e.fieldConfig?FieldConfig.fromPartial(e.fieldConfig):void 0,t.isSecret=e.isSecret??void 0,t}};function createBaseFieldConfig(){return{stringConfig:void 0,paragraphConfig:void 0,numberConfig:void 0,booleanConfig:void 0,listConfig:void 0,selectionConfig:void 0,groupConfig:void 0}}messageTypeRegistry.set(FormField.$type,FormField);const FieldConfig={$type:"devvit.ui.form_builder.v1alpha.FieldConfig",encode:(e,t=_m0.Writer.create())=>(void 0!==e.stringConfig&&FieldConfig_String.encode(e.stringConfig,t.uint32(10).fork()).ldelim(),void 0!==e.paragraphConfig&&FieldConfig_Paragraph.encode(e.paragraphConfig,t.uint32(18).fork()).ldelim(),void 0!==e.numberConfig&&FieldConfig_Number.encode(e.numberConfig,t.uint32(26).fork()).ldelim(),void 0!==e.booleanConfig&&FieldConfig_Boolean.encode(e.booleanConfig,t.uint32(34).fork()).ldelim(),void 0!==e.listConfig&&FieldConfig_List.encode(e.listConfig,t.uint32(42).fork()).ldelim(),void 0!==e.selectionConfig&&FieldConfig_Selection.encode(e.selectionConfig,t.uint32(50).fork()).ldelim(),void 0!==e.groupConfig&&FieldConfig_Group.encode(e.groupConfig,t.uint32(58).fork()).ldelim(),t),decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseFieldConfig();for(;o.pos>>3){case 1:if(10!==e)break;n.stringConfig=FieldConfig_String.decode(o,o.uint32());continue;case 2:if(18!==e)break;n.paragraphConfig=FieldConfig_Paragraph.decode(o,o.uint32());continue;case 3:if(26!==e)break;n.numberConfig=FieldConfig_Number.decode(o,o.uint32());continue;case 4:if(34!==e)break;n.booleanConfig=FieldConfig_Boolean.decode(o,o.uint32());continue;case 5:if(42!==e)break;n.listConfig=FieldConfig_List.decode(o,o.uint32());continue;case 6:if(50!==e)break;n.selectionConfig=FieldConfig_Selection.decode(o,o.uint32());continue;case 7:if(58!==e)break;n.groupConfig=FieldConfig_Group.decode(o,o.uint32());continue}if(4==(7&e)||0===e)break;o.skipType(7&e)}return n},fromJSON:e=>({stringConfig:isSet$m(e.stringConfig)?FieldConfig_String.fromJSON(e.stringConfig):void 0,paragraphConfig:isSet$m(e.paragraphConfig)?FieldConfig_Paragraph.fromJSON(e.paragraphConfig):void 0,numberConfig:isSet$m(e.numberConfig)?FieldConfig_Number.fromJSON(e.numberConfig):void 0,booleanConfig:isSet$m(e.booleanConfig)?FieldConfig_Boolean.fromJSON(e.booleanConfig):void 0,listConfig:isSet$m(e.listConfig)?FieldConfig_List.fromJSON(e.listConfig):void 0,selectionConfig:isSet$m(e.selectionConfig)?FieldConfig_Selection.fromJSON(e.selectionConfig):void 0,groupConfig:isSet$m(e.groupConfig)?FieldConfig_Group.fromJSON(e.groupConfig):void 0}),toJSON(e){const t={};return void 0!==e.stringConfig&&(t.stringConfig=FieldConfig_String.toJSON(e.stringConfig)),void 0!==e.paragraphConfig&&(t.paragraphConfig=FieldConfig_Paragraph.toJSON(e.paragraphConfig)),void 0!==e.numberConfig&&(t.numberConfig=FieldConfig_Number.toJSON(e.numberConfig)),void 0!==e.booleanConfig&&(t.booleanConfig=FieldConfig_Boolean.toJSON(e.booleanConfig)),void 0!==e.listConfig&&(t.listConfig=FieldConfig_List.toJSON(e.listConfig)),void 0!==e.selectionConfig&&(t.selectionConfig=FieldConfig_Selection.toJSON(e.selectionConfig)),void 0!==e.groupConfig&&(t.groupConfig=FieldConfig_Group.toJSON(e.groupConfig)),t},create:e=>FieldConfig.fromPartial(e??{}),fromPartial(e){const t=createBaseFieldConfig();return t.stringConfig=void 0!==e.stringConfig&&null!==e.stringConfig?FieldConfig_String.fromPartial(e.stringConfig):void 0,t.paragraphConfig=void 0!==e.paragraphConfig&&null!==e.paragraphConfig?FieldConfig_Paragraph.fromPartial(e.paragraphConfig):void 0,t.numberConfig=void 0!==e.numberConfig&&null!==e.numberConfig?FieldConfig_Number.fromPartial(e.numberConfig):void 0,t.booleanConfig=void 0!==e.booleanConfig&&null!==e.booleanConfig?FieldConfig_Boolean.fromPartial(e.booleanConfig):void 0,t.listConfig=void 0!==e.listConfig&&null!==e.listConfig?FieldConfig_List.fromPartial(e.listConfig):void 0,t.selectionConfig=void 0!==e.selectionConfig&&null!==e.selectionConfig?FieldConfig_Selection.fromPartial(e.selectionConfig):void 0,t.groupConfig=void 0!==e.groupConfig&&null!==e.groupConfig?FieldConfig_Group.fromPartial(e.groupConfig):void 0,t}};function createBaseFieldConfig_String(){return{minLength:void 0,maxLength:void 0,placeholder:void 0}}messageTypeRegistry.set(FieldConfig.$type,FieldConfig);const FieldConfig_String={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.String",encode:(e,t=_m0.Writer.create())=>(void 0!==e.minLength&&t.uint32(8).int32(e.minLength),void 0!==e.maxLength&&t.uint32(16).int32(e.maxLength),void 0!==e.placeholder&&t.uint32(26).string(e.placeholder),t),decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseFieldConfig_String();for(;o.pos>>3){case 1:if(8!==e)break;n.minLength=o.int32();continue;case 2:if(16!==e)break;n.maxLength=o.int32();continue;case 3:if(26!==e)break;n.placeholder=o.string();continue}if(4==(7&e)||0===e)break;o.skipType(7&e)}return n},fromJSON:e=>({minLength:isSet$m(e.minLength)?globalThis.Number(e.minLength):void 0,maxLength:isSet$m(e.maxLength)?globalThis.Number(e.maxLength):void 0,placeholder:isSet$m(e.placeholder)?globalThis.String(e.placeholder):void 0}),toJSON(e){const t={};return void 0!==e.minLength&&(t.minLength=Math.round(e.minLength)),void 0!==e.maxLength&&(t.maxLength=Math.round(e.maxLength)),void 0!==e.placeholder&&(t.placeholder=e.placeholder),t},create:e=>FieldConfig_String.fromPartial(e??{}),fromPartial(e){const t=createBaseFieldConfig_String();return t.minLength=e.minLength??void 0,t.maxLength=e.maxLength??void 0,t.placeholder=e.placeholder??void 0,t}};function createBaseFieldConfig_Paragraph(){return{maxCharacters:void 0,lineHeight:void 0,placeholder:void 0}}messageTypeRegistry.set(FieldConfig_String.$type,FieldConfig_String);const FieldConfig_Paragraph={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.Paragraph",encode:(e,t=_m0.Writer.create())=>(void 0!==e.maxCharacters&&t.uint32(8).int32(e.maxCharacters),void 0!==e.lineHeight&&t.uint32(16).int32(e.lineHeight),void 0!==e.placeholder&&t.uint32(26).string(e.placeholder),t),decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseFieldConfig_Paragraph();for(;o.pos>>3){case 1:if(8!==e)break;n.maxCharacters=o.int32();continue;case 2:if(16!==e)break;n.lineHeight=o.int32();continue;case 3:if(26!==e)break;n.placeholder=o.string();continue}if(4==(7&e)||0===e)break;o.skipType(7&e)}return n},fromJSON:e=>({maxCharacters:isSet$m(e.maxCharacters)?globalThis.Number(e.maxCharacters):void 0,lineHeight:isSet$m(e.lineHeight)?globalThis.Number(e.lineHeight):void 0,placeholder:isSet$m(e.placeholder)?globalThis.String(e.placeholder):void 0}),toJSON(e){const t={};return void 0!==e.maxCharacters&&(t.maxCharacters=Math.round(e.maxCharacters)),void 0!==e.lineHeight&&(t.lineHeight=Math.round(e.lineHeight)),void 0!==e.placeholder&&(t.placeholder=e.placeholder),t},create:e=>FieldConfig_Paragraph.fromPartial(e??{}),fromPartial(e){const t=createBaseFieldConfig_Paragraph();return t.maxCharacters=e.maxCharacters??void 0,t.lineHeight=e.lineHeight??void 0,t.placeholder=e.placeholder??void 0,t}};function createBaseFieldConfig_Number(){return{step:void 0,min:void 0,max:void 0}}messageTypeRegistry.set(FieldConfig_Paragraph.$type,FieldConfig_Paragraph);const FieldConfig_Number={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.Number",encode:(e,t=_m0.Writer.create())=>(void 0!==e.step&&t.uint32(9).double(e.step),void 0!==e.min&&t.uint32(17).double(e.min),void 0!==e.max&&t.uint32(25).double(e.max),t),decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseFieldConfig_Number();for(;o.pos>>3){case 1:if(9!==e)break;n.step=o.double();continue;case 2:if(17!==e)break;n.min=o.double();continue;case 3:if(25!==e)break;n.max=o.double();continue}if(4==(7&e)||0===e)break;o.skipType(7&e)}return n},fromJSON:e=>({step:isSet$m(e.step)?globalThis.Number(e.step):void 0,min:isSet$m(e.min)?globalThis.Number(e.min):void 0,max:isSet$m(e.max)?globalThis.Number(e.max):void 0}),toJSON(e){const t={};return void 0!==e.step&&(t.step=e.step),void 0!==e.min&&(t.min=e.min),void 0!==e.max&&(t.max=e.max),t},create:e=>FieldConfig_Number.fromPartial(e??{}),fromPartial(e){const t=createBaseFieldConfig_Number();return t.step=e.step??void 0,t.min=e.min??void 0,t.max=e.max??void 0,t}};function createBaseFieldConfig_Boolean(){return{}}messageTypeRegistry.set(FieldConfig_Number.$type,FieldConfig_Number);const FieldConfig_Boolean={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.Boolean",encode:(e,t=_m0.Writer.create())=>t,decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseFieldConfig_Boolean();for(;o.pos({}),toJSON:e=>({}),create:e=>FieldConfig_Boolean.fromPartial(e??{}),fromPartial:e=>createBaseFieldConfig_Boolean()};function createBaseFieldConfig_List(){return{itemType:0,itemConfig:void 0,minEntries:void 0,maxEntries:void 0,entryLabel:void 0}}messageTypeRegistry.set(FieldConfig_Boolean.$type,FieldConfig_Boolean);const FieldConfig_List={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.List",encode:(e,t=_m0.Writer.create())=>(0!==e.itemType&&t.uint32(8).int32(e.itemType),void 0!==e.itemConfig&&FieldConfig.encode(e.itemConfig,t.uint32(18).fork()).ldelim(),void 0!==e.minEntries&&t.uint32(24).int32(e.minEntries),void 0!==e.maxEntries&&t.uint32(32).int32(e.maxEntries),void 0!==e.entryLabel&&t.uint32(42).string(e.entryLabel),t),decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseFieldConfig_List();for(;o.pos>>3){case 1:if(8!==e)break;n.itemType=o.int32();continue;case 2:if(18!==e)break;n.itemConfig=FieldConfig.decode(o,o.uint32());continue;case 3:if(24!==e)break;n.minEntries=o.int32();continue;case 4:if(32!==e)break;n.maxEntries=o.int32();continue;case 5:if(42!==e)break;n.entryLabel=o.string();continue}if(4==(7&e)||0===e)break;o.skipType(7&e)}return n},fromJSON:e=>({itemType:isSet$m(e.itemType)?formFieldTypeFromJSON(e.itemType):0,itemConfig:isSet$m(e.itemConfig)?FieldConfig.fromJSON(e.itemConfig):void 0,minEntries:isSet$m(e.minEntries)?globalThis.Number(e.minEntries):void 0,maxEntries:isSet$m(e.maxEntries)?globalThis.Number(e.maxEntries):void 0,entryLabel:isSet$m(e.entryLabel)?globalThis.String(e.entryLabel):void 0}),toJSON(e){const t={};return 0!==e.itemType&&(t.itemType=formFieldTypeToJSON(e.itemType)),void 0!==e.itemConfig&&(t.itemConfig=FieldConfig.toJSON(e.itemConfig)),void 0!==e.minEntries&&(t.minEntries=Math.round(e.minEntries)),void 0!==e.maxEntries&&(t.maxEntries=Math.round(e.maxEntries)),void 0!==e.entryLabel&&(t.entryLabel=e.entryLabel),t},create:e=>FieldConfig_List.fromPartial(e??{}),fromPartial(e){const t=createBaseFieldConfig_List();return t.itemType=e.itemType??0,t.itemConfig=void 0!==e.itemConfig&&null!==e.itemConfig?FieldConfig.fromPartial(e.itemConfig):void 0,t.minEntries=e.minEntries??void 0,t.maxEntries=e.maxEntries??void 0,t.entryLabel=e.entryLabel??void 0,t}};function createBaseFieldConfig_Selection(){return{choices:[],multiSelect:void 0,minSelections:void 0,maxSelections:void 0,renderAsList:void 0}}messageTypeRegistry.set(FieldConfig_List.$type,FieldConfig_List);const FieldConfig_Selection={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.Selection",encode(e,t=_m0.Writer.create()){for(const o of e.choices)FieldConfig_Selection_Item.encode(o,t.uint32(10).fork()).ldelim();return void 0!==e.multiSelect&&t.uint32(16).bool(e.multiSelect),void 0!==e.minSelections&&t.uint32(24).int32(e.minSelections),void 0!==e.maxSelections&&t.uint32(32).int32(e.maxSelections),void 0!==e.renderAsList&&t.uint32(40).bool(e.renderAsList),t},decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseFieldConfig_Selection();for(;o.pos>>3){case 1:if(10!==e)break;n.choices.push(FieldConfig_Selection_Item.decode(o,o.uint32()));continue;case 2:if(16!==e)break;n.multiSelect=o.bool();continue;case 3:if(24!==e)break;n.minSelections=o.int32();continue;case 4:if(32!==e)break;n.maxSelections=o.int32();continue;case 5:if(40!==e)break;n.renderAsList=o.bool();continue}if(4==(7&e)||0===e)break;o.skipType(7&e)}return n},fromJSON:e=>({choices:globalThis.Array.isArray(e?.choices)?e.choices.map((e=>FieldConfig_Selection_Item.fromJSON(e))):[],multiSelect:isSet$m(e.multiSelect)?globalThis.Boolean(e.multiSelect):void 0,minSelections:isSet$m(e.minSelections)?globalThis.Number(e.minSelections):void 0,maxSelections:isSet$m(e.maxSelections)?globalThis.Number(e.maxSelections):void 0,renderAsList:isSet$m(e.renderAsList)?globalThis.Boolean(e.renderAsList):void 0}),toJSON(e){const t={};return e.choices?.length&&(t.choices=e.choices.map((e=>FieldConfig_Selection_Item.toJSON(e)))),void 0!==e.multiSelect&&(t.multiSelect=e.multiSelect),void 0!==e.minSelections&&(t.minSelections=Math.round(e.minSelections)),void 0!==e.maxSelections&&(t.maxSelections=Math.round(e.maxSelections)),void 0!==e.renderAsList&&(t.renderAsList=e.renderAsList),t},create:e=>FieldConfig_Selection.fromPartial(e??{}),fromPartial(e){const t=createBaseFieldConfig_Selection();return t.choices=e.choices?.map((e=>FieldConfig_Selection_Item.fromPartial(e)))||[],t.multiSelect=e.multiSelect??void 0,t.minSelections=e.minSelections??void 0,t.maxSelections=e.maxSelections??void 0,t.renderAsList=e.renderAsList??void 0,t}};function createBaseFieldConfig_Selection_Item(){return{label:"",value:""}}messageTypeRegistry.set(FieldConfig_Selection.$type,FieldConfig_Selection);const FieldConfig_Selection_Item={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.Selection.Item",encode:(e,t=_m0.Writer.create())=>(""!==e.label&&t.uint32(10).string(e.label),""!==e.value&&t.uint32(18).string(e.value),t),decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseFieldConfig_Selection_Item();for(;o.pos>>3){case 1:if(10!==e)break;n.label=o.string();continue;case 2:if(18!==e)break;n.value=o.string();continue}if(4==(7&e)||0===e)break;o.skipType(7&e)}return n},fromJSON:e=>({label:isSet$m(e.label)?globalThis.String(e.label):"",value:isSet$m(e.value)?globalThis.String(e.value):""}),toJSON(e){const t={};return""!==e.label&&(t.label=e.label),""!==e.value&&(t.value=e.value),t},create:e=>FieldConfig_Selection_Item.fromPartial(e??{}),fromPartial(e){const t=createBaseFieldConfig_Selection_Item();return t.label=e.label??"",t.value=e.value??"",t}};function createBaseFieldConfig_Group(){return{fields:[]}}messageTypeRegistry.set(FieldConfig_Selection_Item.$type,FieldConfig_Selection_Item);const FieldConfig_Group={$type:"devvit.ui.form_builder.v1alpha.FieldConfig.Group",encode(e,t=_m0.Writer.create()){for(const o of e.fields)FormField.encode(o,t.uint32(10).fork()).ldelim();return t},decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseFieldConfig_Group();for(;o.pos>>3){case 1:if(10!==e)break;n.fields.push(FormField.decode(o,o.uint32()));continue}if(4==(7&e)||0===e)break;o.skipType(7&e)}return n},fromJSON:e=>({fields:globalThis.Array.isArray(e?.fields)?e.fields.map((e=>FormField.fromJSON(e))):[]}),toJSON(e){const t={};return e.fields?.length&&(t.fields=e.fields.map((e=>FormField.toJSON(e)))),t},create:e=>FieldConfig_Group.fromPartial(e??{}),fromPartial(e){const t=createBaseFieldConfig_Group();return t.fields=e.fields?.map((e=>FormField.fromPartial(e)))||[],t}};function isSet$m(e){return null!=e}function createBaseForm(){return{fields:[],title:void 0,shortDescription:void 0,acceptLabel:void 0,cancelLabel:void 0,id:void 0}}messageTypeRegistry.set(FieldConfig_Group.$type,FieldConfig_Group);const Form={$type:"devvit.ui.form_builder.v1alpha.Form",encode(e,t=_m0.Writer.create()){for(const o of e.fields)FormField.encode(o,t.uint32(10).fork()).ldelim();return void 0!==e.title&&t.uint32(18).string(e.title),void 0!==e.shortDescription&&t.uint32(26).string(e.shortDescription),void 0!==e.acceptLabel&&t.uint32(34).string(e.acceptLabel),void 0!==e.cancelLabel&&t.uint32(42).string(e.cancelLabel),void 0!==e.id&&t.uint32(50).string(e.id),t},decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseForm();for(;o.pos>>3){case 1:if(10!==e)break;n.fields.push(FormField.decode(o,o.uint32()));continue;case 2:if(18!==e)break;n.title=o.string();continue;case 3:if(26!==e)break;n.shortDescription=o.string();continue;case 4:if(34!==e)break;n.acceptLabel=o.string();continue;case 5:if(42!==e)break;n.cancelLabel=o.string();continue;case 6:if(50!==e)break;n.id=o.string();continue}if(4==(7&e)||0===e)break;o.skipType(7&e)}return n},fromJSON:e=>({fields:globalThis.Array.isArray(e?.fields)?e.fields.map((e=>FormField.fromJSON(e))):[],title:isSet$l(e.title)?globalThis.String(e.title):void 0,shortDescription:isSet$l(e.shortDescription)?globalThis.String(e.shortDescription):void 0,acceptLabel:isSet$l(e.acceptLabel)?globalThis.String(e.acceptLabel):void 0,cancelLabel:isSet$l(e.cancelLabel)?globalThis.String(e.cancelLabel):void 0,id:isSet$l(e.id)?globalThis.String(e.id):void 0}),toJSON(e){const t={};return e.fields?.length&&(t.fields=e.fields.map((e=>FormField.toJSON(e)))),void 0!==e.title&&(t.title=e.title),void 0!==e.shortDescription&&(t.shortDescription=e.shortDescription),void 0!==e.acceptLabel&&(t.acceptLabel=e.acceptLabel),void 0!==e.cancelLabel&&(t.cancelLabel=e.cancelLabel),void 0!==e.id&&(t.id=e.id),t},create:e=>Form.fromPartial(e??{}),fromPartial(e){const t=createBaseForm();return t.fields=e.fields?.map((e=>FormField.fromPartial(e)))||[],t.title=e.title??void 0,t.shortDescription=e.shortDescription??void 0,t.acceptLabel=e.acceptLabel??void 0,t.cancelLabel=e.cancelLabel??void 0,t.id=e.id??void 0,t}};function isSet$l(e){return null!=e}function createBaseShowFormEffect(){return{form:void 0}}messageTypeRegistry.set(Form.$type,Form);const ShowFormEffect={$type:"devvit.ui.effect_types.v1alpha.ShowFormEffect",encode:(e,t=_m0.Writer.create())=>(void 0!==e.form&&Form.encode(e.form,t.uint32(10).fork()).ldelim(),t),decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseShowFormEffect();for(;o.pos>>3){case 1:if(10!==e)break;n.form=Form.decode(o,o.uint32());continue}if(4==(7&e)||0===e)break;o.skipType(7&e)}return n},fromJSON:e=>({form:isSet$k(e.form)?Form.fromJSON(e.form):void 0}),toJSON(e){const t={};return void 0!==e.form&&(t.form=Form.toJSON(e.form)),t},create:e=>ShowFormEffect.fromPartial(e??{}),fromPartial(e){const t=createBaseShowFormEffect();return t.form=void 0!==e.form&&null!==e.form?Form.fromPartial(e.form):void 0,t}};function createBaseFormSubmittedEvent(){return{results:{},formId:void 0}}messageTypeRegistry.set(ShowFormEffect.$type,ShowFormEffect);const FormSubmittedEvent={$type:"devvit.ui.effect_types.v1alpha.FormSubmittedEvent",encode:(e,t=_m0.Writer.create())=>(Object.entries(e.results).forEach((([e,o])=>{FormSubmittedEvent_ResultsEntry.encode({key:e,value:o},t.uint32(10).fork()).ldelim()})),void 0!==e.formId&&t.uint32(18).string(e.formId),t),decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseFormSubmittedEvent();for(;o.pos>>3){case 1:if(10!==e)break;const t=FormSubmittedEvent_ResultsEntry.decode(o,o.uint32());void 0!==t.value&&(n.results[t.key]=t.value);continue;case 2:if(18!==e)break;n.formId=o.string();continue}if(4==(7&e)||0===e)break;o.skipType(7&e)}return n},fromJSON:e=>({results:isObject$6(e.results)?Object.entries(e.results).reduce(((e,[t,o])=>(e[t]=FormFieldValue.fromJSON(o),e)),{}):{},formId:isSet$k(e.formId)?globalThis.String(e.formId):void 0}),toJSON(e){const t={};if(e.results){const o=Object.entries(e.results);o.length>0&&(t.results={},o.forEach((([e,o])=>{t.results[e]=FormFieldValue.toJSON(o)})))}return void 0!==e.formId&&(t.formId=e.formId),t},create:e=>FormSubmittedEvent.fromPartial(e??{}),fromPartial(e){const t=createBaseFormSubmittedEvent();return t.results=Object.entries(e.results??{}).reduce(((e,[t,o])=>(void 0!==o&&(e[t]=FormFieldValue.fromPartial(o)),e)),{}),t.formId=e.formId??void 0,t}};function createBaseFormSubmittedEvent_ResultsEntry(){return{key:"",value:void 0}}messageTypeRegistry.set(FormSubmittedEvent.$type,FormSubmittedEvent);const FormSubmittedEvent_ResultsEntry={$type:"devvit.ui.effect_types.v1alpha.FormSubmittedEvent.ResultsEntry",encode:(e,t=_m0.Writer.create())=>(""!==e.key&&t.uint32(10).string(e.key),void 0!==e.value&&FormFieldValue.encode(e.value,t.uint32(18).fork()).ldelim(),t),decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseFormSubmittedEvent_ResultsEntry();for(;o.pos>>3){case 1:if(10!==e)break;n.key=o.string();continue;case 2:if(18!==e)break;n.value=FormFieldValue.decode(o,o.uint32());continue}if(4==(7&e)||0===e)break;o.skipType(7&e)}return n},fromJSON:e=>({key:isSet$k(e.key)?globalThis.String(e.key):"",value:isSet$k(e.value)?FormFieldValue.fromJSON(e.value):void 0}),toJSON(e){const t={};return""!==e.key&&(t.key=e.key),void 0!==e.value&&(t.value=FormFieldValue.toJSON(e.value)),t},create:e=>FormSubmittedEvent_ResultsEntry.fromPartial(e??{}),fromPartial(e){const t=createBaseFormSubmittedEvent_ResultsEntry();return t.key=e.key??"",t.value=void 0!==e.value&&null!==e.value?FormFieldValue.fromPartial(e.value):void 0,t}};function createBaseFormCanceledEvent(){return{formId:void 0}}messageTypeRegistry.set(FormSubmittedEvent_ResultsEntry.$type,FormSubmittedEvent_ResultsEntry);const FormCanceledEvent={$type:"devvit.ui.effect_types.v1alpha.FormCanceledEvent",encode:(e,t=_m0.Writer.create())=>(void 0!==e.formId&&t.uint32(10).string(e.formId),t),decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseFormCanceledEvent();for(;o.pos>>3){case 1:if(10!==e)break;n.formId=o.string();continue}if(4==(7&e)||0===e)break;o.skipType(7&e)}return n},fromJSON:e=>({formId:isSet$k(e.formId)?globalThis.String(e.formId):void 0}),toJSON(e){const t={};return void 0!==e.formId&&(t.formId=e.formId),t},create:e=>FormCanceledEvent.fromPartial(e??{}),fromPartial(e){const t=createBaseFormCanceledEvent();return t.formId=e.formId??void 0,t}};function isObject$6(e){return"object"==typeof e&&null!==e}function isSet$k(e){return null!=e}var ToastAppearance;function toastAppearanceFromJSON(e){switch(e){case 0:case"NEUTRAL":return ToastAppearance.NEUTRAL;case 1:case"SUCCESS":return ToastAppearance.SUCCESS;default:return ToastAppearance.UNRECOGNIZED}}function toastAppearanceToJSON(e){switch(e){case ToastAppearance.NEUTRAL:return 0;case ToastAppearance.SUCCESS:return 1;case ToastAppearance.UNRECOGNIZED:default:return-1}}function createBaseToastLeadingElement(){return{icon:void 0,emoji:void 0,avatar:void 0}}messageTypeRegistry.set(FormCanceledEvent.$type,FormCanceledEvent),function(e){e[e.NEUTRAL=0]="NEUTRAL",e[e.SUCCESS=1]="SUCCESS",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"}(ToastAppearance||(ToastAppearance={}));const ToastLeadingElement={$type:"devvit.ui.toast.ToastLeadingElement",encode:(e,t=_m0.Writer.create())=>(void 0!==e.icon&&t.uint32(10).string(e.icon),void 0!==e.emoji&&t.uint32(18).string(e.emoji),void 0!==e.avatar&&t.uint32(26).string(e.avatar),t),decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseToastLeadingElement();for(;o.pos>>3){case 1:if(10!==e)break;n.icon=o.string();continue;case 2:if(18!==e)break;n.emoji=o.string();continue;case 3:if(26!==e)break;n.avatar=o.string();continue}if(4==(7&e)||0===e)break;o.skipType(7&e)}return n},fromJSON:e=>({icon:isSet$j(e.icon)?globalThis.String(e.icon):void 0,emoji:isSet$j(e.emoji)?globalThis.String(e.emoji):void 0,avatar:isSet$j(e.avatar)?globalThis.String(e.avatar):void 0}),toJSON(e){const t={};return void 0!==e.icon&&(t.icon=e.icon),void 0!==e.emoji&&(t.emoji=e.emoji),void 0!==e.avatar&&(t.avatar=e.avatar),t},create:e=>ToastLeadingElement.fromPartial(e??{}),fromPartial(e){const t=createBaseToastLeadingElement();return t.icon=e.icon??void 0,t.emoji=e.emoji??void 0,t.avatar=e.avatar??void 0,t}};function createBaseToastTrailingElement(){return{label:void 0,icon:void 0}}messageTypeRegistry.set(ToastLeadingElement.$type,ToastLeadingElement);const ToastTrailingElement={$type:"devvit.ui.toast.ToastTrailingElement",encode:(e,t=_m0.Writer.create())=>(void 0!==e.label&&t.uint32(10).string(e.label),void 0!==e.icon&&t.uint32(18).string(e.icon),t),decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseToastTrailingElement();for(;o.pos>>3){case 1:if(10!==e)break;n.label=o.string();continue;case 2:if(18!==e)break;n.icon=o.string();continue}if(4==(7&e)||0===e)break;o.skipType(7&e)}return n},fromJSON:e=>({label:isSet$j(e.label)?globalThis.String(e.label):void 0,icon:isSet$j(e.icon)?globalThis.String(e.icon):void 0}),toJSON(e){const t={};return void 0!==e.label&&(t.label=e.label),void 0!==e.icon&&(t.icon=e.icon),t},create:e=>ToastTrailingElement.fromPartial(e??{}),fromPartial(e){const t=createBaseToastTrailingElement();return t.label=e.label??void 0,t.icon=e.icon??void 0,t}};function createBaseToast(){return{text:"",appearance:void 0,leadingElement:void 0,trailingElement:void 0}}messageTypeRegistry.set(ToastTrailingElement.$type,ToastTrailingElement);const Toast={$type:"devvit.ui.toast.Toast",encode:(e,t=_m0.Writer.create())=>(""!==e.text&&t.uint32(10).string(e.text),void 0!==e.appearance&&t.uint32(16).int32(e.appearance),void 0!==e.leadingElement&&ToastLeadingElement.encode(e.leadingElement,t.uint32(26).fork()).ldelim(),void 0!==e.trailingElement&&ToastTrailingElement.encode(e.trailingElement,t.uint32(34).fork()).ldelim(),t),decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseToast();for(;o.pos>>3){case 1:if(10!==e)break;n.text=o.string();continue;case 2:if(16!==e)break;n.appearance=o.int32();continue;case 3:if(26!==e)break;n.leadingElement=ToastLeadingElement.decode(o,o.uint32());continue;case 4:if(34!==e)break;n.trailingElement=ToastTrailingElement.decode(o,o.uint32());continue}if(4==(7&e)||0===e)break;o.skipType(7&e)}return n},fromJSON:e=>({text:isSet$j(e.text)?globalThis.String(e.text):"",appearance:isSet$j(e.appearance)?toastAppearanceFromJSON(e.appearance):void 0,leadingElement:isSet$j(e.leadingElement)?ToastLeadingElement.fromJSON(e.leadingElement):void 0,trailingElement:isSet$j(e.trailingElement)?ToastTrailingElement.fromJSON(e.trailingElement):void 0}),toJSON(e){const t={};return""!==e.text&&(t.text=e.text),void 0!==e.appearance&&(t.appearance=toastAppearanceToJSON(e.appearance)),void 0!==e.leadingElement&&(t.leadingElement=ToastLeadingElement.toJSON(e.leadingElement)),void 0!==e.trailingElement&&(t.trailingElement=ToastTrailingElement.toJSON(e.trailingElement)),t},create:e=>Toast.fromPartial(e??{}),fromPartial(e){const t=createBaseToast();return t.text=e.text??"",t.appearance=e.appearance??void 0,t.leadingElement=void 0!==e.leadingElement&&null!==e.leadingElement?ToastLeadingElement.fromPartial(e.leadingElement):void 0,t.trailingElement=void 0!==e.trailingElement&&null!==e.trailingElement?ToastTrailingElement.fromPartial(e.trailingElement):void 0,t}};function isSet$j(e){return null!=e}function createBaseShowToastEffect(){return{toast:void 0}}messageTypeRegistry.set(Toast.$type,Toast);const ShowToastEffect={$type:"devvit.ui.effect_types.v1alpha.ShowToastEffect",encode:(e,t=_m0.Writer.create())=>(void 0!==e.toast&&Toast.encode(e.toast,t.uint32(10).fork()).ldelim(),t),decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseShowToastEffect();for(;o.pos>>3){case 1:if(10!==e)break;n.toast=Toast.decode(o,o.uint32());continue}if(4==(7&e)||0===e)break;o.skipType(7&e)}return n},fromJSON:e=>({toast:isSet$i(e.toast)?Toast.fromJSON(e.toast):void 0}),toJSON(e){const t={};return void 0!==e.toast&&(t.toast=Toast.toJSON(e.toast)),t},create:e=>ShowToastEffect.fromPartial(e??{}),fromPartial(e){const t=createBaseShowToastEffect();return t.toast=void 0!==e.toast&&null!==e.toast?Toast.fromPartial(e.toast):void 0,t}};function createBaseToastActionEvent(){return{}}messageTypeRegistry.set(ShowToastEffect.$type,ShowToastEffect);const ToastActionEvent={$type:"devvit.ui.effect_types.v1alpha.ToastActionEvent",encode:(e,t=_m0.Writer.create())=>t,decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseToastActionEvent();for(;o.pos({}),toJSON:e=>({}),create:e=>ToastActionEvent.fromPartial(e??{}),fromPartial:e=>createBaseToastActionEvent()};function isSet$i(e){return null!=e}function createBaseWebViewFullScreenVisibilityEffect(){return{show:!1,url:"",id:""}}messageTypeRegistry.set(ToastActionEvent.$type,ToastActionEvent);const WebViewFullScreenVisibilityEffect={$type:"devvit.ui.effects.web_view.v1alpha.WebViewFullScreenVisibilityEffect",encode:(e,t=_m0.Writer.create())=>(!1!==e.show&&t.uint32(8).bool(e.show),""!==e.url&&t.uint32(18).string(e.url),""!==e.id&&t.uint32(26).string(e.id),t),decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseWebViewFullScreenVisibilityEffect();for(;o.pos>>3){case 1:if(8!==e)break;n.show=o.bool();continue;case 2:if(18!==e)break;n.url=o.string();continue;case 3:if(26!==e)break;n.id=o.string();continue}if(4==(7&e)||0===e)break;o.skipType(7&e)}return n},fromJSON:e=>({show:!!isSet$h(e.show)&&globalThis.Boolean(e.show),url:isSet$h(e.url)?globalThis.String(e.url):"",id:isSet$h(e.id)?globalThis.String(e.id):""}),toJSON(e){const t={};return!1!==e.show&&(t.show=e.show),""!==e.url&&(t.url=e.url),""!==e.id&&(t.id=e.id),t},create:e=>WebViewFullScreenVisibilityEffect.fromPartial(e??{}),fromPartial(e){const t=createBaseWebViewFullScreenVisibilityEffect();return t.show=e.show??!1,t.url=e.url??"",t.id=e.id??"",t}};function isSet$h(e){return null!=e}function createBaseRealtimeRequest(){return{channels:[]}}messageTypeRegistry.set(WebViewFullScreenVisibilityEffect.$type,WebViewFullScreenVisibilityEffect);const RealtimeRequest={$type:"devvit.events.v1alpha.RealtimeRequest",encode(e,t=_m0.Writer.create()){for(const o of e.channels)t.uint32(10).string(o);return t},decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseRealtimeRequest();for(;o.pos>>3){case 1:if(10!==e)break;n.channels.push(o.string());continue}if(4==(7&e)||0===e)break;o.skipType(7&e)}return n},fromJSON:e=>({channels:globalThis.Array.isArray(e?.channels)?e.channels.map((e=>globalThis.String(e))):[]}),toJSON(e){const t={};return e.channels?.length&&(t.channels=e.channels),t},create:e=>RealtimeRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseRealtimeRequest();return t.channels=e.channels?.map((e=>e))||[],t}};function createBaseRealtimeEvent(){return{channel:"",data:void 0}}messageTypeRegistry.set(RealtimeRequest.$type,RealtimeRequest);const RealtimeEvent={$type:"devvit.events.v1alpha.RealtimeEvent",encode:(e,t=_m0.Writer.create())=>(""!==e.channel&&t.uint32(10).string(e.channel),void 0!==e.data&&Struct.encode(Struct.wrap(e.data),t.uint32(18).fork()).ldelim(),t),decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseRealtimeEvent();for(;o.pos>>3){case 1:if(10!==e)break;n.channel=o.string();continue;case 2:if(18!==e)break;n.data=Struct.unwrap(Struct.decode(o,o.uint32()));continue}if(4==(7&e)||0===e)break;o.skipType(7&e)}return n},fromJSON:e=>({channel:isSet$g(e.channel)?globalThis.String(e.channel):"",data:isObject$5(e.data)?e.data:void 0}),toJSON(e){const t={};return""!==e.channel&&(t.channel=e.channel),void 0!==e.data&&(t.data=e.data),t},create:e=>RealtimeEvent.fromPartial(e??{}),fromPartial(e){const t=createBaseRealtimeEvent();return t.channel=e.channel??"",t.data=e.data??void 0,t}};messageTypeRegistry.set(RealtimeEvent.$type,RealtimeEvent);const RealtimeDefinition={name:"Realtime",fullName:"devvit.events.v1alpha.Realtime",methods:{subscribe:{name:"Subscribe",requestType:RealtimeRequest,requestStream:!1,responseType:RealtimeEvent,responseStream:!0,options:{}},send:{name:"Send",requestType:RealtimeEvent,requestStream:!1,responseType:Empty,responseStream:!1,options:{}}}};function isObject$5(e){return"object"==typeof e&&null!==e}function isSet$g(e){return null!=e}var RealtimeSubscriptionStatus$1;function realtimeSubscriptionStatusFromJSON$1(e){switch(e){case 0:case"REALTIME_SUBSCRIBED":return RealtimeSubscriptionStatus$1.REALTIME_SUBSCRIBED;case 1:case"REALTIME_UNSUBSCRIBED":return RealtimeSubscriptionStatus$1.REALTIME_UNSUBSCRIBED;default:return RealtimeSubscriptionStatus$1.UNRECOGNIZED}}function realtimeSubscriptionStatusToJSON$1(e){switch(e){case RealtimeSubscriptionStatus$1.REALTIME_SUBSCRIBED:return 0;case RealtimeSubscriptionStatus$1.REALTIME_UNSUBSCRIBED:return 1;case RealtimeSubscriptionStatus$1.UNRECOGNIZED:default:return-1}}function createBaseRealtimeSubscriptionsEffect$1(){return{subscriptionIds:[]}}!function(e){e[e.REALTIME_SUBSCRIBED=0]="REALTIME_SUBSCRIBED",e[e.REALTIME_UNSUBSCRIBED=1]="REALTIME_UNSUBSCRIBED",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"}(RealtimeSubscriptionStatus$1||(RealtimeSubscriptionStatus$1={}));const RealtimeSubscriptionsEffect$1={$type:"devvit.ui.effect_types.v1alpha.RealtimeSubscriptionsEffect",encode(e,t=_m0.Writer.create()){for(const o of e.subscriptionIds)t.uint32(10).string(o);return t},decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseRealtimeSubscriptionsEffect$1();for(;o.pos>>3){case 1:if(10!==e)break;n.subscriptionIds.push(o.string());continue}if(4==(7&e)||0===e)break;o.skipType(7&e)}return n},fromJSON:e=>({subscriptionIds:globalThis.Array.isArray(e?.subscriptionIds)?e.subscriptionIds.map((e=>globalThis.String(e))):[]}),toJSON(e){const t={};return e.subscriptionIds?.length&&(t.subscriptionIds=e.subscriptionIds),t},create:e=>RealtimeSubscriptionsEffect$1.fromPartial(e??{}),fromPartial(e){const t=createBaseRealtimeSubscriptionsEffect$1();return t.subscriptionIds=e.subscriptionIds?.map((e=>e))||[],t}};function createBaseRealtimeSubscriptionEvent$1(){return{event:void 0,status:void 0}}messageTypeRegistry.set(RealtimeSubscriptionsEffect$1.$type,RealtimeSubscriptionsEffect$1);const RealtimeSubscriptionEvent$1={$type:"devvit.ui.effect_types.v1alpha.RealtimeSubscriptionEvent",encode:(e,t=_m0.Writer.create())=>(void 0!==e.event&&RealtimeEvent.encode(e.event,t.uint32(10).fork()).ldelim(),void 0!==e.status&&t.uint32(16).int32(e.status),t),decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseRealtimeSubscriptionEvent$1();for(;o.pos>>3){case 1:if(10!==e)break;n.event=RealtimeEvent.decode(o,o.uint32());continue;case 2:if(16!==e)break;n.status=o.int32();continue}if(4==(7&e)||0===e)break;o.skipType(7&e)}return n},fromJSON:e=>({event:isSet$f(e.event)?RealtimeEvent.fromJSON(e.event):void 0,status:isSet$f(e.status)?realtimeSubscriptionStatusFromJSON$1(e.status):void 0}),toJSON(e){const t={};return void 0!==e.event&&(t.event=RealtimeEvent.toJSON(e.event)),void 0!==e.status&&(t.status=realtimeSubscriptionStatusToJSON$1(e.status)),t},create:e=>RealtimeSubscriptionEvent$1.fromPartial(e??{}),fromPartial(e){const t=createBaseRealtimeSubscriptionEvent$1();return t.event=void 0!==e.event&&null!==e.event?RealtimeEvent.fromPartial(e.event):void 0,t.status=e.status??void 0,t}};function isSet$f(e){return null!=e}var WebViewImmersiveMode;function webViewImmersiveModeFromJSON(e){switch(e){case 0:case"UNSPECIFIED":return WebViewImmersiveMode.UNSPECIFIED;case 1:case"INLINE_MODE":return WebViewImmersiveMode.INLINE_MODE;case 2:case"IMMERSIVE_MODE":return WebViewImmersiveMode.IMMERSIVE_MODE;default:return WebViewImmersiveMode.UNRECOGNIZED}}function webViewImmersiveModeToJSON(e){switch(e){case WebViewImmersiveMode.UNSPECIFIED:return 0;case WebViewImmersiveMode.INLINE_MODE:return 1;case WebViewImmersiveMode.IMMERSIVE_MODE:return 2;case WebViewImmersiveMode.UNRECOGNIZED:default:return-1}}function createBaseWebViewImmersiveModeEffect(){return{immersiveMode:0,entryUrl:void 0}}messageTypeRegistry.set(RealtimeSubscriptionEvent$1.$type,RealtimeSubscriptionEvent$1),function(e){e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.INLINE_MODE=1]="INLINE_MODE",e[e.IMMERSIVE_MODE=2]="IMMERSIVE_MODE",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"}(WebViewImmersiveMode||(WebViewImmersiveMode={}));const WebViewImmersiveModeEffect={$type:"devvit.ui.effects.web_view.v1alpha.WebViewImmersiveModeEffect",encode:(e,t=_m0.Writer.create())=>(0!==e.immersiveMode&&t.uint32(8).int32(e.immersiveMode),void 0!==e.entryUrl&&t.uint32(18).string(e.entryUrl),t),decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseWebViewImmersiveModeEffect();for(;o.pos>>3){case 1:if(8!==e)break;n.immersiveMode=o.int32();continue;case 2:if(18!==e)break;n.entryUrl=o.string();continue}if(4==(7&e)||0===e)break;o.skipType(7&e)}return n},fromJSON:e=>({immersiveMode:isSet$e(e.immersiveMode)?webViewImmersiveModeFromJSON(e.immersiveMode):0,entryUrl:isSet$e(e.entryUrl)?globalThis.String(e.entryUrl):void 0}),toJSON(e){const t={};return 0!==e.immersiveMode&&(t.immersiveMode=webViewImmersiveModeToJSON(e.immersiveMode)),void 0!==e.entryUrl&&(t.entryUrl=e.entryUrl),t},create:e=>WebViewImmersiveModeEffect.fromPartial(e??{}),fromPartial(e){const t=createBaseWebViewImmersiveModeEffect();return t.immersiveMode=e.immersiveMode??0,t.entryUrl=e.entryUrl??void 0,t}};function isSet$e(e){return null!=e}function createBaseWebViewShareEffect(){return{userData:void 0,title:void 0,text:void 0,appIconUri:void 0}}messageTypeRegistry.set(WebViewImmersiveModeEffect.$type,WebViewImmersiveModeEffect);const WebViewShareEffect={$type:"devvit.ui.effects.web_view.v1alpha.WebViewShareEffect",encode:(e,t=_m0.Writer.create())=>(void 0!==e.userData&&t.uint32(10).string(e.userData),void 0!==e.title&&t.uint32(18).string(e.title),void 0!==e.text&&t.uint32(26).string(e.text),void 0!==e.appIconUri&&t.uint32(34).string(e.appIconUri),t),decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseWebViewShareEffect();for(;o.pos>>3){case 1:if(10!==e)break;n.userData=o.string();continue;case 2:if(18!==e)break;n.title=o.string();continue;case 3:if(26!==e)break;n.text=o.string();continue;case 4:if(34!==e)break;n.appIconUri=o.string();continue}if(4==(7&e)||0===e)break;o.skipType(7&e)}return n},fromJSON:e=>({userData:isSet$d(e.userData)?globalThis.String(e.userData):void 0,title:isSet$d(e.title)?globalThis.String(e.title):void 0,text:isSet$d(e.text)?globalThis.String(e.text):void 0,appIconUri:isSet$d(e.appIconUri)?globalThis.String(e.appIconUri):void 0}),toJSON(e){const t={};return void 0!==e.userData&&(t.userData=e.userData),void 0!==e.title&&(t.title=e.title),void 0!==e.text&&(t.text=e.text),void 0!==e.appIconUri&&(t.appIconUri=e.appIconUri),t},create:e=>WebViewShareEffect.fromPartial(e??{}),fromPartial(e){const t=createBaseWebViewShareEffect();return t.userData=e.userData??void 0,t.title=e.title??void 0,t.text=e.text??void 0,t.appIconUri=e.appIconUri??void 0,t}};function isSet$d(e){return null!=e}function createBaseWebViewTelemetryEffect(){return{event:void 0,click:void 0,loaded:void 0,metrics:void 0}}messageTypeRegistry.set(WebViewShareEffect.$type,WebViewShareEffect);const WebViewTelemetryEffect={$type:"devvit.ui.effects.web_view.v1alpha.WebViewTelemetryEffect",encode:(e,t=_m0.Writer.create())=>(void 0!==e.event&&t.uint32(10).string(e.event),void 0!==e.click&&WebViewTelemetryClickEffect.encode(e.click,t.uint32(18).fork()).ldelim(),void 0!==e.loaded&&WebViewTelemetryLoadedEffect.encode(e.loaded,t.uint32(26).fork()).ldelim(),void 0!==e.metrics&&WebViewTelemetryMetricsEffect.encode(e.metrics,t.uint32(34).fork()).ldelim(),t),decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseWebViewTelemetryEffect();for(;o.pos>>3){case 1:if(10!==e)break;n.event=o.string();continue;case 2:if(18!==e)break;n.click=WebViewTelemetryClickEffect.decode(o,o.uint32());continue;case 3:if(26!==e)break;n.loaded=WebViewTelemetryLoadedEffect.decode(o,o.uint32());continue;case 4:if(34!==e)break;n.metrics=WebViewTelemetryMetricsEffect.decode(o,o.uint32());continue}if(4==(7&e)||0===e)break;o.skipType(7&e)}return n},fromJSON:e=>({event:isSet$c(e.event)?globalThis.String(e.event):void 0,click:isSet$c(e.click)?WebViewTelemetryClickEffect.fromJSON(e.click):void 0,loaded:isSet$c(e.loaded)?WebViewTelemetryLoadedEffect.fromJSON(e.loaded):void 0,metrics:isSet$c(e.metrics)?WebViewTelemetryMetricsEffect.fromJSON(e.metrics):void 0}),toJSON(e){const t={};return void 0!==e.event&&(t.event=e.event),void 0!==e.click&&(t.click=WebViewTelemetryClickEffect.toJSON(e.click)),void 0!==e.loaded&&(t.loaded=WebViewTelemetryLoadedEffect.toJSON(e.loaded)),void 0!==e.metrics&&(t.metrics=WebViewTelemetryMetricsEffect.toJSON(e.metrics)),t},create:e=>WebViewTelemetryEffect.fromPartial(e??{}),fromPartial(e){const t=createBaseWebViewTelemetryEffect();return t.event=e.event??void 0,t.click=void 0!==e.click&&null!==e.click?WebViewTelemetryClickEffect.fromPartial(e.click):void 0,t.loaded=void 0!==e.loaded&&null!==e.loaded?WebViewTelemetryLoadedEffect.fromPartial(e.loaded):void 0,t.metrics=void 0!==e.metrics&&null!==e.metrics?WebViewTelemetryMetricsEffect.fromPartial(e.metrics):void 0,t}};function createBaseWebViewTelemetryClickEffect(){return{event:"",definition:""}}messageTypeRegistry.set(WebViewTelemetryEffect.$type,WebViewTelemetryEffect);const WebViewTelemetryClickEffect={$type:"devvit.ui.effects.web_view.v1alpha.WebViewTelemetryClickEffect",encode:(e,t=_m0.Writer.create())=>(""!==e.event&&t.uint32(10).string(e.event),""!==e.definition&&t.uint32(18).string(e.definition),t),decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseWebViewTelemetryClickEffect();for(;o.pos>>3){case 1:if(10!==e)break;n.event=o.string();continue;case 2:if(18!==e)break;n.definition=o.string();continue}if(4==(7&e)||0===e)break;o.skipType(7&e)}return n},fromJSON:e=>({event:isSet$c(e.event)?globalThis.String(e.event):"",definition:isSet$c(e.definition)?globalThis.String(e.definition):""}),toJSON(e){const t={};return""!==e.event&&(t.event=e.event),""!==e.definition&&(t.definition=e.definition),t},create:e=>WebViewTelemetryClickEffect.fromPartial(e??{}),fromPartial(e){const t=createBaseWebViewTelemetryClickEffect();return t.event=e.event??"",t.definition=e.definition??"",t}};function createBaseWebViewTelemetryLoadedEffect(){return{event:"",timeStart:0,timeEnd:0,duration:0}}messageTypeRegistry.set(WebViewTelemetryClickEffect.$type,WebViewTelemetryClickEffect);const WebViewTelemetryLoadedEffect={$type:"devvit.ui.effects.web_view.v1alpha.WebViewTelemetryLoadedEffect",encode:(e,t=_m0.Writer.create())=>(""!==e.event&&t.uint32(10).string(e.event),0!==e.timeStart&&t.uint32(17).double(e.timeStart),0!==e.timeEnd&&t.uint32(25).double(e.timeEnd),0!==e.duration&&t.uint32(33).double(e.duration),t),decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseWebViewTelemetryLoadedEffect();for(;o.pos>>3){case 1:if(10!==e)break;n.event=o.string();continue;case 2:if(17!==e)break;n.timeStart=o.double();continue;case 3:if(25!==e)break;n.timeEnd=o.double();continue;case 4:if(33!==e)break;n.duration=o.double();continue}if(4==(7&e)||0===e)break;o.skipType(7&e)}return n},fromJSON:e=>({event:isSet$c(e.event)?globalThis.String(e.event):"",timeStart:isSet$c(e.timeStart)?globalThis.Number(e.timeStart):0,timeEnd:isSet$c(e.timeEnd)?globalThis.Number(e.timeEnd):0,duration:isSet$c(e.duration)?globalThis.Number(e.duration):0}),toJSON(e){const t={};return""!==e.event&&(t.event=e.event),0!==e.timeStart&&(t.timeStart=e.timeStart),0!==e.timeEnd&&(t.timeEnd=e.timeEnd),0!==e.duration&&(t.duration=e.duration),t},create:e=>WebViewTelemetryLoadedEffect.fromPartial(e??{}),fromPartial(e){const t=createBaseWebViewTelemetryLoadedEffect();return t.event=e.event??"",t.timeStart=e.timeStart??0,t.timeEnd=e.timeEnd??0,t.duration=e.duration??0,t}};function createBaseWebViewTelemetryMetric(){return{spanName:"",timeStart:0,timeEnd:0}}messageTypeRegistry.set(WebViewTelemetryLoadedEffect.$type,WebViewTelemetryLoadedEffect);const WebViewTelemetryMetric={$type:"devvit.ui.effects.web_view.v1alpha.WebViewTelemetryMetric",encode:(e,t=_m0.Writer.create())=>(""!==e.spanName&&t.uint32(10).string(e.spanName),0!==e.timeStart&&t.uint32(17).double(e.timeStart),0!==e.timeEnd&&t.uint32(25).double(e.timeEnd),t),decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseWebViewTelemetryMetric();for(;o.pos>>3){case 1:if(10!==e)break;n.spanName=o.string();continue;case 2:if(17!==e)break;n.timeStart=o.double();continue;case 3:if(25!==e)break;n.timeEnd=o.double();continue}if(4==(7&e)||0===e)break;o.skipType(7&e)}return n},fromJSON:e=>({spanName:isSet$c(e.spanName)?globalThis.String(e.spanName):"",timeStart:isSet$c(e.timeStart)?globalThis.Number(e.timeStart):0,timeEnd:isSet$c(e.timeEnd)?globalThis.Number(e.timeEnd):0}),toJSON(e){const t={};return""!==e.spanName&&(t.spanName=e.spanName),0!==e.timeStart&&(t.timeStart=e.timeStart),0!==e.timeEnd&&(t.timeEnd=e.timeEnd),t},create:e=>WebViewTelemetryMetric.fromPartial(e??{}),fromPartial(e){const t=createBaseWebViewTelemetryMetric();return t.spanName=e.spanName??"",t.timeStart=e.timeStart??0,t.timeEnd=e.timeEnd??0,t}};function createBaseWebViewTelemetryMetricsEffect(){return{metrics:[]}}messageTypeRegistry.set(WebViewTelemetryMetric.$type,WebViewTelemetryMetric);const WebViewTelemetryMetricsEffect={$type:"devvit.ui.effects.web_view.v1alpha.WebViewTelemetryMetricsEffect",encode(e,t=_m0.Writer.create()){for(const o of e.metrics)WebViewTelemetryMetric.encode(o,t.uint32(10).fork()).ldelim();return t},decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseWebViewTelemetryMetricsEffect();for(;o.pos>>3){case 1:if(10!==e)break;n.metrics.push(WebViewTelemetryMetric.decode(o,o.uint32()));continue}if(4==(7&e)||0===e)break;o.skipType(7&e)}return n},fromJSON:e=>({metrics:globalThis.Array.isArray(e?.metrics)?e.metrics.map((e=>WebViewTelemetryMetric.fromJSON(e))):[]}),toJSON(e){const t={};return e.metrics?.length&&(t.metrics=e.metrics.map((e=>WebViewTelemetryMetric.toJSON(e)))),t},create:e=>WebViewTelemetryMetricsEffect.fromPartial(e??{}),fromPartial(e){const t=createBaseWebViewTelemetryMetricsEffect();return t.metrics=e.metrics?.map((e=>WebViewTelemetryMetric.fromPartial(e)))||[],t}};function isSet$c(e){return null!=e}var WebViewInternalMessageScope$1;function webViewInternalMessageScopeFromJSON(e){switch(e){case 0:case"CLIENT":return WebViewInternalMessageScope$1.CLIENT;default:return WebViewInternalMessageScope$1.UNRECOGNIZED}}function webViewInternalMessageScopeToJSON(e){switch(e){case WebViewInternalMessageScope$1.CLIENT:return 0;case WebViewInternalMessageScope$1.UNRECOGNIZED:default:return-1}}function createBaseWebViewInternalMessage(){return{type:"",scope:0,analytics:void 0,effect:void 0,realtimeEffect:void 0,immersiveMode:void 0,share:void 0,showToast:void 0,navigateToUrl:void 0,showForm:void 0,createOrder:void 0,realtime:void 0,canRunAsUser:void 0,telemetry:void 0,id:void 0}}messageTypeRegistry.set(WebViewTelemetryMetricsEffect.$type,WebViewTelemetryMetricsEffect),function(e){e[e.CLIENT=0]="CLIENT",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"}(WebViewInternalMessageScope$1||(WebViewInternalMessageScope$1={}));const WebViewInternalMessage={$type:"devvit.ui.effects.web_view.v1alpha.WebViewInternalMessage",encode:(e,t=_m0.Writer.create())=>(""!==e.type&&t.uint32(10).string(e.type),0!==e.scope&&t.uint32(16).int32(e.scope),void 0!==e.analytics&&Struct.encode(Struct.wrap(e.analytics),t.uint32(26).fork()).ldelim(),void 0!==e.effect&&Struct.encode(Struct.wrap(e.effect),t.uint32(34).fork()).ldelim(),void 0!==e.realtimeEffect&&RealtimeSubscriptionsEffect$1.encode(e.realtimeEffect,t.uint32(50).fork()).ldelim(),void 0!==e.immersiveMode&&WebViewImmersiveModeEffect.encode(e.immersiveMode,t.uint32(58).fork()).ldelim(),void 0!==e.share&&WebViewShareEffect.encode(e.share,t.uint32(66).fork()).ldelim(),void 0!==e.showToast&&ShowToastEffect.encode(e.showToast,t.uint32(74).fork()).ldelim(),void 0!==e.navigateToUrl&&NavigateToUrlEffect.encode(e.navigateToUrl,t.uint32(82).fork()).ldelim(),void 0!==e.showForm&&ShowFormEffect.encode(e.showForm,t.uint32(90).fork()).ldelim(),void 0!==e.createOrder&&CreateOrderEffect.encode(e.createOrder,t.uint32(98).fork()).ldelim(),void 0!==e.realtime&&RealtimeSubscriptionsEffect$1.encode(e.realtime,t.uint32(106).fork()).ldelim(),void 0!==e.canRunAsUser&&CanRunAsUserEffect.encode(e.canRunAsUser,t.uint32(114).fork()).ldelim(),void 0!==e.telemetry&&WebViewTelemetryEffect.encode(e.telemetry,t.uint32(122).fork()).ldelim(),void 0!==e.id&&t.uint32(42).string(e.id),t),decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseWebViewInternalMessage();for(;o.pos>>3){case 1:if(10!==e)break;n.type=o.string();continue;case 2:if(16!==e)break;n.scope=o.int32();continue;case 3:if(26!==e)break;n.analytics=Struct.unwrap(Struct.decode(o,o.uint32()));continue;case 4:if(34!==e)break;n.effect=Struct.unwrap(Struct.decode(o,o.uint32()));continue;case 6:if(50!==e)break;n.realtimeEffect=RealtimeSubscriptionsEffect$1.decode(o,o.uint32());continue;case 7:if(58!==e)break;n.immersiveMode=WebViewImmersiveModeEffect.decode(o,o.uint32());continue;case 8:if(66!==e)break;n.share=WebViewShareEffect.decode(o,o.uint32());continue;case 9:if(74!==e)break;n.showToast=ShowToastEffect.decode(o,o.uint32());continue;case 10:if(82!==e)break;n.navigateToUrl=NavigateToUrlEffect.decode(o,o.uint32());continue;case 11:if(90!==e)break;n.showForm=ShowFormEffect.decode(o,o.uint32());continue;case 12:if(98!==e)break;n.createOrder=CreateOrderEffect.decode(o,o.uint32());continue;case 13:if(106!==e)break;n.realtime=RealtimeSubscriptionsEffect$1.decode(o,o.uint32());continue;case 14:if(114!==e)break;n.canRunAsUser=CanRunAsUserEffect.decode(o,o.uint32());continue;case 15:if(122!==e)break;n.telemetry=WebViewTelemetryEffect.decode(o,o.uint32());continue;case 5:if(42!==e)break;n.id=o.string();continue}if(4==(7&e)||0===e)break;o.skipType(7&e)}return n},fromJSON:e=>({type:isSet$b(e.type)?globalThis.String(e.type):"",scope:isSet$b(e.scope)?webViewInternalMessageScopeFromJSON(e.scope):0,analytics:isObject$4(e.analytics)?e.analytics:void 0,effect:isObject$4(e.effect)?e.effect:void 0,realtimeEffect:isSet$b(e.realtimeEffect)?RealtimeSubscriptionsEffect$1.fromJSON(e.realtimeEffect):void 0,immersiveMode:isSet$b(e.immersiveMode)?WebViewImmersiveModeEffect.fromJSON(e.immersiveMode):void 0,share:isSet$b(e.share)?WebViewShareEffect.fromJSON(e.share):void 0,showToast:isSet$b(e.showToast)?ShowToastEffect.fromJSON(e.showToast):void 0,navigateToUrl:isSet$b(e.navigateToUrl)?NavigateToUrlEffect.fromJSON(e.navigateToUrl):void 0,showForm:isSet$b(e.showForm)?ShowFormEffect.fromJSON(e.showForm):void 0,createOrder:isSet$b(e.createOrder)?CreateOrderEffect.fromJSON(e.createOrder):void 0,realtime:isSet$b(e.realtime)?RealtimeSubscriptionsEffect$1.fromJSON(e.realtime):void 0,canRunAsUser:isSet$b(e.canRunAsUser)?CanRunAsUserEffect.fromJSON(e.canRunAsUser):void 0,telemetry:isSet$b(e.telemetry)?WebViewTelemetryEffect.fromJSON(e.telemetry):void 0,id:isSet$b(e.id)?globalThis.String(e.id):void 0}),toJSON(e){const t={};return""!==e.type&&(t.type=e.type),0!==e.scope&&(t.scope=webViewInternalMessageScopeToJSON(e.scope)),void 0!==e.analytics&&(t.analytics=e.analytics),void 0!==e.effect&&(t.effect=e.effect),void 0!==e.realtimeEffect&&(t.realtimeEffect=RealtimeSubscriptionsEffect$1.toJSON(e.realtimeEffect)),void 0!==e.immersiveMode&&(t.immersiveMode=WebViewImmersiveModeEffect.toJSON(e.immersiveMode)),void 0!==e.share&&(t.share=WebViewShareEffect.toJSON(e.share)),void 0!==e.showToast&&(t.showToast=ShowToastEffect.toJSON(e.showToast)),void 0!==e.navigateToUrl&&(t.navigateToUrl=NavigateToUrlEffect.toJSON(e.navigateToUrl)),void 0!==e.showForm&&(t.showForm=ShowFormEffect.toJSON(e.showForm)),void 0!==e.createOrder&&(t.createOrder=CreateOrderEffect.toJSON(e.createOrder)),void 0!==e.realtime&&(t.realtime=RealtimeSubscriptionsEffect$1.toJSON(e.realtime)),void 0!==e.canRunAsUser&&(t.canRunAsUser=CanRunAsUserEffect.toJSON(e.canRunAsUser)),void 0!==e.telemetry&&(t.telemetry=WebViewTelemetryEffect.toJSON(e.telemetry)),void 0!==e.id&&(t.id=e.id),t},create:e=>WebViewInternalMessage.fromPartial(e??{}),fromPartial(e){const t=createBaseWebViewInternalMessage();return t.type=e.type??"",t.scope=e.scope??0,t.analytics=e.analytics??void 0,t.effect=e.effect??void 0,t.realtimeEffect=void 0!==e.realtimeEffect&&null!==e.realtimeEffect?RealtimeSubscriptionsEffect$1.fromPartial(e.realtimeEffect):void 0,t.immersiveMode=void 0!==e.immersiveMode&&null!==e.immersiveMode?WebViewImmersiveModeEffect.fromPartial(e.immersiveMode):void 0,t.share=void 0!==e.share&&null!==e.share?WebViewShareEffect.fromPartial(e.share):void 0,t.showToast=void 0!==e.showToast&&null!==e.showToast?ShowToastEffect.fromPartial(e.showToast):void 0,t.navigateToUrl=void 0!==e.navigateToUrl&&null!==e.navigateToUrl?NavigateToUrlEffect.fromPartial(e.navigateToUrl):void 0,t.showForm=void 0!==e.showForm&&null!==e.showForm?ShowFormEffect.fromPartial(e.showForm):void 0,t.createOrder=void 0!==e.createOrder&&null!==e.createOrder?CreateOrderEffect.fromPartial(e.createOrder):void 0,t.realtime=void 0!==e.realtime&&null!==e.realtime?RealtimeSubscriptionsEffect$1.fromPartial(e.realtime):void 0,t.canRunAsUser=void 0!==e.canRunAsUser&&null!==e.canRunAsUser?CanRunAsUserEffect.fromPartial(e.canRunAsUser):void 0,t.telemetry=void 0!==e.telemetry&&null!==e.telemetry?WebViewTelemetryEffect.fromPartial(e.telemetry):void 0,t.id=e.id??void 0,t}};function createBaseWebViewPostMessage(){return{type:"",data:void 0}}messageTypeRegistry.set(WebViewInternalMessage.$type,WebViewInternalMessage);const WebViewPostMessage={$type:"devvit.ui.effects.web_view.v1alpha.WebViewPostMessage",encode:(e,t=_m0.Writer.create())=>(""!==e.type&&t.uint32(10).string(e.type),void 0!==e.data&&Struct.encode(Struct.wrap(e.data),t.uint32(18).fork()).ldelim(),t),decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseWebViewPostMessage();for(;o.pos>>3){case 1:if(10!==e)break;n.type=o.string();continue;case 2:if(18!==e)break;n.data=Struct.unwrap(Struct.decode(o,o.uint32()));continue}if(4==(7&e)||0===e)break;o.skipType(7&e)}return n},fromJSON:e=>({type:isSet$b(e.type)?globalThis.String(e.type):"",data:isObject$4(e.data)?e.data:void 0}),toJSON(e){const t={};return""!==e.type&&(t.type=e.type),void 0!==e.data&&(t.data=e.data),t},create:e=>WebViewPostMessage.fromPartial(e??{}),fromPartial(e){const t=createBaseWebViewPostMessage();return t.type=e.type??"",t.data=e.data??void 0,t}};function createBaseWebViewAppMessage(){return{message:void 0,jsonString:void 0}}messageTypeRegistry.set(WebViewPostMessage.$type,WebViewPostMessage);const WebViewAppMessage={$type:"devvit.ui.effects.web_view.v1alpha.WebViewAppMessage",encode:(e,t=_m0.Writer.create())=>(void 0!==e.message&&Value.encode(Value.wrap(e.message),t.uint32(10).fork()).ldelim(),void 0!==e.jsonString&&t.uint32(18).string(e.jsonString),t),decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseWebViewAppMessage();for(;o.pos>>3){case 1:if(10!==e)break;n.message=Value.unwrap(Value.decode(o,o.uint32()));continue;case 2:if(18!==e)break;n.jsonString=o.string();continue}if(4==(7&e)||0===e)break;o.skipType(7&e)}return n},fromJSON:e=>({message:isSet$b(e?.message)?e.message:void 0,jsonString:isSet$b(e.jsonString)?globalThis.String(e.jsonString):void 0}),toJSON(e){const t={};return void 0!==e.message&&(t.message=e.message),void 0!==e.jsonString&&(t.jsonString=e.jsonString),t},create:e=>WebViewAppMessage.fromPartial(e??{}),fromPartial(e){const t=createBaseWebViewAppMessage();return t.message=e.message??void 0,t.jsonString=e.jsonString??void 0,t}};function createBaseWebViewStateMessage(){return{state:void 0}}messageTypeRegistry.set(WebViewAppMessage.$type,WebViewAppMessage);const WebViewStateMessage={$type:"devvit.ui.effects.web_view.v1alpha.WebViewStateMessage",encode:(e,t=_m0.Writer.create())=>(void 0!==e.state&&Struct.encode(Struct.wrap(e.state),t.uint32(10).fork()).ldelim(),t),decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseWebViewStateMessage();for(;o.pos>>3){case 1:if(10!==e)break;n.state=Struct.unwrap(Struct.decode(o,o.uint32()));continue}if(4==(7&e)||0===e)break;o.skipType(7&e)}return n},fromJSON:e=>({state:isObject$4(e.state)?e.state:void 0}),toJSON(e){const t={};return void 0!==e.state&&(t.state=e.state),t},create:e=>WebViewStateMessage.fromPartial(e??{}),fromPartial(e){const t=createBaseWebViewStateMessage();return t.state=e.state??void 0,t}};function createBaseWebViewPostMessageEffect(){return{webViewId:"",app:void 0,state:void 0}}messageTypeRegistry.set(WebViewStateMessage.$type,WebViewStateMessage);const WebViewPostMessageEffect={$type:"devvit.ui.effects.web_view.v1alpha.WebViewPostMessageEffect",encode:(e,t=_m0.Writer.create())=>(""!==e.webViewId&&t.uint32(10).string(e.webViewId),void 0!==e.app&&WebViewAppMessage.encode(e.app,t.uint32(18).fork()).ldelim(),void 0!==e.state&&WebViewStateMessage.encode(e.state,t.uint32(26).fork()).ldelim(),t),decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseWebViewPostMessageEffect();for(;o.pos>>3){case 1:if(10!==e)break;n.webViewId=o.string();continue;case 2:if(18!==e)break;n.app=WebViewAppMessage.decode(o,o.uint32());continue;case 3:if(26!==e)break;n.state=WebViewStateMessage.decode(o,o.uint32());continue}if(4==(7&e)||0===e)break;o.skipType(7&e)}return n},fromJSON:e=>({webViewId:isSet$b(e.webViewId)?globalThis.String(e.webViewId):"",app:isSet$b(e.app)?WebViewAppMessage.fromJSON(e.app):void 0,state:isSet$b(e.state)?WebViewStateMessage.fromJSON(e.state):void 0}),toJSON(e){const t={};return""!==e.webViewId&&(t.webViewId=e.webViewId),void 0!==e.app&&(t.app=WebViewAppMessage.toJSON(e.app)),void 0!==e.state&&(t.state=WebViewStateMessage.toJSON(e.state)),t},create:e=>WebViewPostMessageEffect.fromPartial(e??{}),fromPartial(e){const t=createBaseWebViewPostMessageEffect();return t.webViewId=e.webViewId??"",t.app=void 0!==e.app&&null!==e.app?WebViewAppMessage.fromPartial(e.app):void 0,t.state=void 0!==e.state&&null!==e.state?WebViewStateMessage.fromPartial(e.state):void 0,t}};function isObject$4(e){return"object"==typeof e&&null!==e}function isSet$b(e){return null!=e}function createBaseWebViewEffect(){return{postMessage:void 0,fullscreen:void 0}}messageTypeRegistry.set(WebViewPostMessageEffect.$type,WebViewPostMessageEffect);const WebViewEffect={$type:"devvit.ui.effects.web_view.v1alpha.WebViewEffect",encode:(e,t=_m0.Writer.create())=>(void 0!==e.postMessage&&WebViewPostMessageEffect.encode(e.postMessage,t.uint32(10).fork()).ldelim(),void 0!==e.fullscreen&&WebViewFullScreenVisibilityEffect.encode(e.fullscreen,t.uint32(18).fork()).ldelim(),t),decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseWebViewEffect();for(;o.pos>>3){case 1:if(10!==e)break;n.postMessage=WebViewPostMessageEffect.decode(o,o.uint32());continue;case 2:if(18!==e)break;n.fullscreen=WebViewFullScreenVisibilityEffect.decode(o,o.uint32());continue}if(4==(7&e)||0===e)break;o.skipType(7&e)}return n},fromJSON:e=>({postMessage:isSet$a(e.postMessage)?WebViewPostMessageEffect.fromJSON(e.postMessage):void 0,fullscreen:isSet$a(e.fullscreen)?WebViewFullScreenVisibilityEffect.fromJSON(e.fullscreen):void 0}),toJSON(e){const t={};return void 0!==e.postMessage&&(t.postMessage=WebViewPostMessageEffect.toJSON(e.postMessage)),void 0!==e.fullscreen&&(t.fullscreen=WebViewFullScreenVisibilityEffect.toJSON(e.fullscreen)),t},create:e=>WebViewEffect.fromPartial(e??{}),fromPartial(e){const t=createBaseWebViewEffect();return t.postMessage=void 0!==e.postMessage&&null!==e.postMessage?WebViewPostMessageEffect.fromPartial(e.postMessage):void 0,t.fullscreen=void 0!==e.fullscreen&&null!==e.fullscreen?WebViewFullScreenVisibilityEffect.fromPartial(e.fullscreen):void 0,t}};function isSet$a(e){return null!=e}function createBaseDuration(){return{seconds:0,nanos:0}}messageTypeRegistry.set(WebViewEffect.$type,WebViewEffect);const Duration={$type:"google.protobuf.Duration",encode:(e,t=_m0.Writer.create())=>(0!==e.seconds&&t.uint32(8).int64(e.seconds),0!==e.nanos&&t.uint32(16).int32(e.nanos),t),decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseDuration();for(;o.pos>>3){case 1:if(8!==e)break;n.seconds=longToNumber(o.int64());continue;case 2:if(16!==e)break;n.nanos=o.int32();continue}if(4==(7&e)||0===e)break;o.skipType(7&e)}return n},fromJSON:e=>({seconds:isSet$9(e.seconds)?globalThis.Number(e.seconds):0,nanos:isSet$9(e.nanos)?globalThis.Number(e.nanos):0}),toJSON(e){const t={};return 0!==e.seconds&&(t.seconds=Math.round(e.seconds)),0!==e.nanos&&(t.nanos=Math.round(e.nanos)),t},create:e=>Duration.fromPartial(e??{}),fromPartial(e){const t=createBaseDuration();return t.seconds=e.seconds??0,t.nanos=e.nanos??0,t}};function longToNumber(e){if(e.gt(globalThis.Number.MAX_SAFE_INTEGER))throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");return e.toNumber()}function isSet$9(e){return null!=e}function createBaseSetIntervalsEffect(){return{intervals:{}}}messageTypeRegistry.set(Duration.$type,Duration),_m0.util.Long!==Long&&(_m0.util.Long=Long,_m0.configure());const SetIntervalsEffect={$type:"devvit.ui.effects.v1alpha.SetIntervalsEffect",encode:(e,t=_m0.Writer.create())=>(Object.entries(e.intervals).forEach((([e,o])=>{SetIntervalsEffect_IntervalsEntry.encode({key:e,value:o},t.uint32(10).fork()).ldelim()})),t),decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseSetIntervalsEffect();for(;o.pos>>3){case 1:if(10!==e)break;const t=SetIntervalsEffect_IntervalsEntry.decode(o,o.uint32());void 0!==t.value&&(n.intervals[t.key]=t.value);continue}if(4==(7&e)||0===e)break;o.skipType(7&e)}return n},fromJSON:e=>({intervals:isObject$3(e.intervals)?Object.entries(e.intervals).reduce(((e,[t,o])=>(e[t]=IntervalDetails.fromJSON(o),e)),{}):{}}),toJSON(e){const t={};if(e.intervals){const o=Object.entries(e.intervals);o.length>0&&(t.intervals={},o.forEach((([e,o])=>{t.intervals[e]=IntervalDetails.toJSON(o)})))}return t},create:e=>SetIntervalsEffect.fromPartial(e??{}),fromPartial(e){const t=createBaseSetIntervalsEffect();return t.intervals=Object.entries(e.intervals??{}).reduce(((e,[t,o])=>(void 0!==o&&(e[t]=IntervalDetails.fromPartial(o)),e)),{}),t}};function createBaseSetIntervalsEffect_IntervalsEntry(){return{key:"",value:void 0}}messageTypeRegistry.set(SetIntervalsEffect.$type,SetIntervalsEffect);const SetIntervalsEffect_IntervalsEntry={$type:"devvit.ui.effects.v1alpha.SetIntervalsEffect.IntervalsEntry",encode:(e,t=_m0.Writer.create())=>(""!==e.key&&t.uint32(10).string(e.key),void 0!==e.value&&IntervalDetails.encode(e.value,t.uint32(18).fork()).ldelim(),t),decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseSetIntervalsEffect_IntervalsEntry();for(;o.pos>>3){case 1:if(10!==e)break;n.key=o.string();continue;case 2:if(18!==e)break;n.value=IntervalDetails.decode(o,o.uint32());continue}if(4==(7&e)||0===e)break;o.skipType(7&e)}return n},fromJSON:e=>({key:isSet$8(e.key)?globalThis.String(e.key):"",value:isSet$8(e.value)?IntervalDetails.fromJSON(e.value):void 0}),toJSON(e){const t={};return""!==e.key&&(t.key=e.key),void 0!==e.value&&(t.value=IntervalDetails.toJSON(e.value)),t},create:e=>SetIntervalsEffect_IntervalsEntry.fromPartial(e??{}),fromPartial(e){const t=createBaseSetIntervalsEffect_IntervalsEntry();return t.key=e.key??"",t.value=void 0!==e.value&&null!==e.value?IntervalDetails.fromPartial(e.value):void 0,t}};function createBaseIntervalDetails(){return{duration:void 0,async:void 0}}messageTypeRegistry.set(SetIntervalsEffect_IntervalsEntry.$type,SetIntervalsEffect_IntervalsEntry);const IntervalDetails={$type:"devvit.ui.effects.v1alpha.IntervalDetails",encode:(e,t=_m0.Writer.create())=>(void 0!==e.duration&&Duration.encode(e.duration,t.uint32(10).fork()).ldelim(),void 0!==e.async&&BoolValue.encode({value:e.async},t.uint32(26).fork()).ldelim(),t),decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseIntervalDetails();for(;o.pos>>3){case 1:if(10!==e)break;n.duration=Duration.decode(o,o.uint32());continue;case 3:if(26!==e)break;n.async=BoolValue.decode(o,o.uint32()).value;continue}if(4==(7&e)||0===e)break;o.skipType(7&e)}return n},fromJSON:e=>({duration:isSet$8(e.duration)?Duration.fromJSON(e.duration):void 0,async:isSet$8(e.async)?Boolean(e.async):void 0}),toJSON(e){const t={};return void 0!==e.duration&&(t.duration=Duration.toJSON(e.duration)),void 0!==e.async&&(t.async=e.async),t},create:e=>IntervalDetails.fromPartial(e??{}),fromPartial(e){const t=createBaseIntervalDetails();return t.duration=void 0!==e.duration&&null!==e.duration?Duration.fromPartial(e.duration):void 0,t.async=e.async??void 0,t}};function isObject$3(e){return"object"==typeof e&&null!==e}function isSet$8(e){return null!=e}var RealtimeSubscriptionStatus;function realtimeSubscriptionStatusFromJSON(e){switch(e){case 0:case"REALTIME_SUBSCRIBED":return RealtimeSubscriptionStatus.REALTIME_SUBSCRIBED;case 1:case"REALTIME_UNSUBSCRIBED":return RealtimeSubscriptionStatus.REALTIME_UNSUBSCRIBED;default:return RealtimeSubscriptionStatus.UNRECOGNIZED}}function realtimeSubscriptionStatusToJSON(e){switch(e){case RealtimeSubscriptionStatus.REALTIME_SUBSCRIBED:return 0;case RealtimeSubscriptionStatus.REALTIME_UNSUBSCRIBED:return 1;case RealtimeSubscriptionStatus.UNRECOGNIZED:default:return-1}}function createBaseRealtimeSubscriptionsEffect(){return{subscriptionIds:[]}}messageTypeRegistry.set(IntervalDetails.$type,IntervalDetails),function(e){e[e.REALTIME_SUBSCRIBED=0]="REALTIME_SUBSCRIBED",e[e.REALTIME_UNSUBSCRIBED=1]="REALTIME_UNSUBSCRIBED",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"}(RealtimeSubscriptionStatus||(RealtimeSubscriptionStatus={}));const RealtimeSubscriptionsEffect={$type:"devvit.ui.effects.v1alpha.RealtimeSubscriptionsEffect",encode(e,t=_m0.Writer.create()){for(const o of e.subscriptionIds)t.uint32(10).string(o);return t},decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseRealtimeSubscriptionsEffect();for(;o.pos>>3){case 1:if(10!==e)break;n.subscriptionIds.push(o.string());continue}if(4==(7&e)||0===e)break;o.skipType(7&e)}return n},fromJSON:e=>({subscriptionIds:globalThis.Array.isArray(e?.subscriptionIds)?e.subscriptionIds.map((e=>globalThis.String(e))):[]}),toJSON(e){const t={};return e.subscriptionIds?.length&&(t.subscriptionIds=e.subscriptionIds),t},create:e=>RealtimeSubscriptionsEffect.fromPartial(e??{}),fromPartial(e){const t=createBaseRealtimeSubscriptionsEffect();return t.subscriptionIds=e.subscriptionIds?.map((e=>e))||[],t}};function createBaseRealtimeSubscriptionEvent(){return{event:void 0,status:void 0}}messageTypeRegistry.set(RealtimeSubscriptionsEffect.$type,RealtimeSubscriptionsEffect);const RealtimeSubscriptionEvent={$type:"devvit.ui.effects.v1alpha.RealtimeSubscriptionEvent",encode:(e,t=_m0.Writer.create())=>(void 0!==e.event&&RealtimeEvent.encode(e.event,t.uint32(10).fork()).ldelim(),void 0!==e.status&&t.uint32(16).int32(e.status),t),decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseRealtimeSubscriptionEvent();for(;o.pos>>3){case 1:if(10!==e)break;n.event=RealtimeEvent.decode(o,o.uint32());continue;case 2:if(16!==e)break;n.status=o.int32();continue}if(4==(7&e)||0===e)break;o.skipType(7&e)}return n},fromJSON:e=>({event:isSet$7(e.event)?RealtimeEvent.fromJSON(e.event):void 0,status:isSet$7(e.status)?realtimeSubscriptionStatusFromJSON(e.status):void 0}),toJSON(e){const t={};return void 0!==e.event&&(t.event=RealtimeEvent.toJSON(e.event)),void 0!==e.status&&(t.status=realtimeSubscriptionStatusToJSON(e.status)),t},create:e=>RealtimeSubscriptionEvent.fromPartial(e??{}),fromPartial(e){const t=createBaseRealtimeSubscriptionEvent();return t.event=void 0!==e.event&&null!==e.event?RealtimeEvent.fromPartial(e.event):void 0,t.status=e.status??void 0,t}};function isSet$7(e){return null!=e}function createBaseRerenderEffect(){return{delaySeconds:void 0}}messageTypeRegistry.set(RealtimeSubscriptionEvent.$type,RealtimeSubscriptionEvent);const RerenderEffect={$type:"devvit.ui.effects.v1alpha.RerenderEffect",encode:(e,t=_m0.Writer.create())=>(void 0!==e.delaySeconds&&t.uint32(13).float(e.delaySeconds),t),decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseRerenderEffect();for(;o.pos>>3){case 1:if(13!==e)break;n.delaySeconds=o.float();continue}if(4==(7&e)||0===e)break;o.skipType(7&e)}return n},fromJSON:e=>({delaySeconds:isSet$6(e.delaySeconds)?globalThis.Number(e.delaySeconds):void 0}),toJSON(e){const t={};return void 0!==e.delaySeconds&&(t.delaySeconds=e.delaySeconds),t},create:e=>RerenderEffect.fromPartial(e??{}),fromPartial(e){const t=createBaseRerenderEffect();return t.delaySeconds=e.delaySeconds??void 0,t}};function isSet$6(e){return null!=e}var EffectType$1;function effectTypeFromJSON(e){switch(e){case 0:case"EFFECT_REALTIME_SUB":return EffectType$1.EFFECT_REALTIME_SUB;case 1:case"EFFECT_RERENDER_UI":return EffectType$1.EFFECT_RERENDER_UI;case 2:case"EFFECT_RELOAD_PART":return EffectType$1.EFFECT_RELOAD_PART;case 3:case"EFFECT_SHOW_FORM":return EffectType$1.EFFECT_SHOW_FORM;case 4:case"EFFECT_SHOW_TOAST":return EffectType$1.EFFECT_SHOW_TOAST;case 5:case"EFFECT_NAVIGATE_TO_URL":return EffectType$1.EFFECT_NAVIGATE_TO_URL;case 7:case"EFFECT_SET_INTERVALS":return EffectType$1.EFFECT_SET_INTERVALS;case 8:case"EFFECT_CREATE_ORDER":return EffectType$1.EFFECT_CREATE_ORDER;case 9:case"EFFECT_WEB_VIEW":return EffectType$1.EFFECT_WEB_VIEW;case 11:case"EFFECT_CAN_RUN_AS_USER":return EffectType$1.EFFECT_CAN_RUN_AS_USER;case 12:case"EFFECT_TELEMETRY":return EffectType$1.EFFECT_TELEMETRY;default:return EffectType$1.UNRECOGNIZED}}function effectTypeToJSON(e){switch(e){case EffectType$1.EFFECT_REALTIME_SUB:return 0;case EffectType$1.EFFECT_RERENDER_UI:return 1;case EffectType$1.EFFECT_RELOAD_PART:return 2;case EffectType$1.EFFECT_SHOW_FORM:return 3;case EffectType$1.EFFECT_SHOW_TOAST:return 4;case EffectType$1.EFFECT_NAVIGATE_TO_URL:return 5;case EffectType$1.EFFECT_SET_INTERVALS:return 7;case EffectType$1.EFFECT_CREATE_ORDER:return 8;case EffectType$1.EFFECT_WEB_VIEW:return 9;case EffectType$1.EFFECT_CAN_RUN_AS_USER:return 11;case EffectType$1.EFFECT_TELEMETRY:return 12;case EffectType$1.UNRECOGNIZED:default:return-1}}function createBaseEffect(){return{realtimeSubscriptions:void 0,rerenderUi:void 0,showForm:void 0,showToast:void 0,navigateToUrl:void 0,interval:void 0,createOrder:void 0,webView:void 0,canRunAsUser:void 0,type:0}}messageTypeRegistry.set(RerenderEffect.$type,RerenderEffect),function(e){e[e.EFFECT_REALTIME_SUB=0]="EFFECT_REALTIME_SUB",e[e.EFFECT_RERENDER_UI=1]="EFFECT_RERENDER_UI",e[e.EFFECT_RELOAD_PART=2]="EFFECT_RELOAD_PART",e[e.EFFECT_SHOW_FORM=3]="EFFECT_SHOW_FORM",e[e.EFFECT_SHOW_TOAST=4]="EFFECT_SHOW_TOAST",e[e.EFFECT_NAVIGATE_TO_URL=5]="EFFECT_NAVIGATE_TO_URL",e[e.EFFECT_SET_INTERVALS=7]="EFFECT_SET_INTERVALS",e[e.EFFECT_CREATE_ORDER=8]="EFFECT_CREATE_ORDER",e[e.EFFECT_WEB_VIEW=9]="EFFECT_WEB_VIEW",e[e.EFFECT_CAN_RUN_AS_USER=11]="EFFECT_CAN_RUN_AS_USER",e[e.EFFECT_TELEMETRY=12]="EFFECT_TELEMETRY",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"}(EffectType$1||(EffectType$1={}));const Effect={$type:"devvit.ui.effects.v1alpha.Effect",encode:(e,t=_m0.Writer.create())=>(void 0!==e.realtimeSubscriptions&&RealtimeSubscriptionsEffect.encode(e.realtimeSubscriptions,t.uint32(10).fork()).ldelim(),void 0!==e.rerenderUi&&RerenderEffect.encode(e.rerenderUi,t.uint32(18).fork()).ldelim(),void 0!==e.showForm&&ShowFormEffect.encode(e.showForm,t.uint32(34).fork()).ldelim(),void 0!==e.showToast&&ShowToastEffect.encode(e.showToast,t.uint32(42).fork()).ldelim(),void 0!==e.navigateToUrl&&NavigateToUrlEffect.encode(e.navigateToUrl,t.uint32(50).fork()).ldelim(),void 0!==e.interval&&SetIntervalsEffect.encode(e.interval,t.uint32(74).fork()).ldelim(),void 0!==e.createOrder&&CreateOrderEffect.encode(e.createOrder,t.uint32(82).fork()).ldelim(),void 0!==e.webView&&WebViewEffect.encode(e.webView,t.uint32(90).fork()).ldelim(),void 0!==e.canRunAsUser&&CanRunAsUserEffect.encode(e.canRunAsUser,t.uint32(106).fork()).ldelim(),0!==e.type&&t.uint32(56).int32(e.type),t),decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseEffect();for(;o.pos>>3){case 1:if(10!==e)break;n.realtimeSubscriptions=RealtimeSubscriptionsEffect.decode(o,o.uint32());continue;case 2:if(18!==e)break;n.rerenderUi=RerenderEffect.decode(o,o.uint32());continue;case 4:if(34!==e)break;n.showForm=ShowFormEffect.decode(o,o.uint32());continue;case 5:if(42!==e)break;n.showToast=ShowToastEffect.decode(o,o.uint32());continue;case 6:if(50!==e)break;n.navigateToUrl=NavigateToUrlEffect.decode(o,o.uint32());continue;case 9:if(74!==e)break;n.interval=SetIntervalsEffect.decode(o,o.uint32());continue;case 10:if(82!==e)break;n.createOrder=CreateOrderEffect.decode(o,o.uint32());continue;case 11:if(90!==e)break;n.webView=WebViewEffect.decode(o,o.uint32());continue;case 13:if(106!==e)break;n.canRunAsUser=CanRunAsUserEffect.decode(o,o.uint32());continue;case 7:if(56!==e)break;n.type=o.int32();continue}if(4==(7&e)||0===e)break;o.skipType(7&e)}return n},fromJSON:e=>({realtimeSubscriptions:isSet$5(e.realtimeSubscriptions)?RealtimeSubscriptionsEffect.fromJSON(e.realtimeSubscriptions):void 0,rerenderUi:isSet$5(e.rerenderUi)?RerenderEffect.fromJSON(e.rerenderUi):void 0,showForm:isSet$5(e.showForm)?ShowFormEffect.fromJSON(e.showForm):void 0,showToast:isSet$5(e.showToast)?ShowToastEffect.fromJSON(e.showToast):void 0,navigateToUrl:isSet$5(e.navigateToUrl)?NavigateToUrlEffect.fromJSON(e.navigateToUrl):void 0,interval:isSet$5(e.interval)?SetIntervalsEffect.fromJSON(e.interval):void 0,createOrder:isSet$5(e.createOrder)?CreateOrderEffect.fromJSON(e.createOrder):void 0,webView:isSet$5(e.webView)?WebViewEffect.fromJSON(e.webView):void 0,canRunAsUser:isSet$5(e.canRunAsUser)?CanRunAsUserEffect.fromJSON(e.canRunAsUser):void 0,type:isSet$5(e.type)?effectTypeFromJSON(e.type):0}),toJSON(e){const t={};return void 0!==e.realtimeSubscriptions&&(t.realtimeSubscriptions=RealtimeSubscriptionsEffect.toJSON(e.realtimeSubscriptions)),void 0!==e.rerenderUi&&(t.rerenderUi=RerenderEffect.toJSON(e.rerenderUi)),void 0!==e.showForm&&(t.showForm=ShowFormEffect.toJSON(e.showForm)),void 0!==e.showToast&&(t.showToast=ShowToastEffect.toJSON(e.showToast)),void 0!==e.navigateToUrl&&(t.navigateToUrl=NavigateToUrlEffect.toJSON(e.navigateToUrl)),void 0!==e.interval&&(t.interval=SetIntervalsEffect.toJSON(e.interval)),void 0!==e.createOrder&&(t.createOrder=CreateOrderEffect.toJSON(e.createOrder)),void 0!==e.webView&&(t.webView=WebViewEffect.toJSON(e.webView)),void 0!==e.canRunAsUser&&(t.canRunAsUser=CanRunAsUserEffect.toJSON(e.canRunAsUser)),0!==e.type&&(t.type=effectTypeToJSON(e.type)),t},create:e=>Effect.fromPartial(e??{}),fromPartial(e){const t=createBaseEffect();return t.realtimeSubscriptions=void 0!==e.realtimeSubscriptions&&null!==e.realtimeSubscriptions?RealtimeSubscriptionsEffect.fromPartial(e.realtimeSubscriptions):void 0,t.rerenderUi=void 0!==e.rerenderUi&&null!==e.rerenderUi?RerenderEffect.fromPartial(e.rerenderUi):void 0,t.showForm=void 0!==e.showForm&&null!==e.showForm?ShowFormEffect.fromPartial(e.showForm):void 0,t.showToast=void 0!==e.showToast&&null!==e.showToast?ShowToastEffect.fromPartial(e.showToast):void 0,t.navigateToUrl=void 0!==e.navigateToUrl&&null!==e.navigateToUrl?NavigateToUrlEffect.fromPartial(e.navigateToUrl):void 0,t.interval=void 0!==e.interval&&null!==e.interval?SetIntervalsEffect.fromPartial(e.interval):void 0,t.createOrder=void 0!==e.createOrder&&null!==e.createOrder?CreateOrderEffect.fromPartial(e.createOrder):void 0,t.webView=void 0!==e.webView&&null!==e.webView?WebViewEffect.fromPartial(e.webView):void 0,t.canRunAsUser=void 0!==e.canRunAsUser&&null!==e.canRunAsUser?CanRunAsUserEffect.fromPartial(e.canRunAsUser):void 0,t.type=e.type??0,t}};function isSet$5(e){return null!=e}var WebViewVisibility;function webViewVisibilityFromJSON(e){switch(e){case 0:case"WEBVIEW_VISIBLE":return WebViewVisibility.WEBVIEW_VISIBLE;case 1:case"WEBVIEW_HIDDEN":return WebViewVisibility.WEBVIEW_HIDDEN;default:return WebViewVisibility.UNRECOGNIZED}}function webViewVisibilityToJSON(e){switch(e){case WebViewVisibility.WEBVIEW_VISIBLE:return 0;case WebViewVisibility.WEBVIEW_HIDDEN:return 1;case WebViewVisibility.UNRECOGNIZED:default:return-1}}function createBaseWebViewPostMessageEvent(){return{message:void 0,jsonString:""}}messageTypeRegistry.set(Effect.$type,Effect),function(e){e[e.WEBVIEW_VISIBLE=0]="WEBVIEW_VISIBLE",e[e.WEBVIEW_HIDDEN=1]="WEBVIEW_HIDDEN",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"}(WebViewVisibility||(WebViewVisibility={}));const WebViewPostMessageEvent={$type:"devvit.ui.events.v1alpha.WebViewPostMessageEvent",encode:(e,t=_m0.Writer.create())=>(void 0!==e.message&&Value.encode(Value.wrap(e.message),t.uint32(10).fork()).ldelim(),""!==e.jsonString&&t.uint32(18).string(e.jsonString),t),decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseWebViewPostMessageEvent();for(;o.pos>>3){case 1:if(10!==e)break;n.message=Value.unwrap(Value.decode(o,o.uint32()));continue;case 2:if(18!==e)break;n.jsonString=o.string();continue}if(4==(7&e)||0===e)break;o.skipType(7&e)}return n},fromJSON:e=>({message:isSet$4(e?.message)?e.message:void 0,jsonString:isSet$4(e.jsonString)?globalThis.String(e.jsonString):""}),toJSON(e){const t={};return void 0!==e.message&&(t.message=e.message),""!==e.jsonString&&(t.jsonString=e.jsonString),t},create:e=>WebViewPostMessageEvent.fromPartial(e??{}),fromPartial(e){const t=createBaseWebViewPostMessageEvent();return t.message=e.message??void 0,t.jsonString=e.jsonString??"",t}};function createBaseWebViewFullScreenEvent(){return{visibility:0}}messageTypeRegistry.set(WebViewPostMessageEvent.$type,WebViewPostMessageEvent);const WebViewFullScreenEvent={$type:"devvit.ui.events.v1alpha.WebViewFullScreenEvent",encode:(e,t=_m0.Writer.create())=>(0!==e.visibility&&t.uint32(8).int32(e.visibility),t),decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseWebViewFullScreenEvent();for(;o.pos>>3){case 1:if(8!==e)break;n.visibility=o.int32();continue}if(4==(7&e)||0===e)break;o.skipType(7&e)}return n},fromJSON:e=>({visibility:isSet$4(e.visibility)?webViewVisibilityFromJSON(e.visibility):0}),toJSON(e){const t={};return 0!==e.visibility&&(t.visibility=webViewVisibilityToJSON(e.visibility)),t},create:e=>WebViewFullScreenEvent.fromPartial(e??{}),fromPartial(e){const t=createBaseWebViewFullScreenEvent();return t.visibility=e.visibility??0,t}};function createBaseWebViewEvent(){return{postMessage:void 0,fullScreen:void 0}}messageTypeRegistry.set(WebViewFullScreenEvent.$type,WebViewFullScreenEvent);const WebViewEvent={$type:"devvit.ui.events.v1alpha.WebViewEvent",encode:(e,t=_m0.Writer.create())=>(void 0!==e.postMessage&&WebViewPostMessageEvent.encode(e.postMessage,t.uint32(10).fork()).ldelim(),void 0!==e.fullScreen&&WebViewFullScreenEvent.encode(e.fullScreen,t.uint32(18).fork()).ldelim(),t),decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseWebViewEvent();for(;o.pos>>3){case 1:if(10!==e)break;n.postMessage=WebViewPostMessageEvent.decode(o,o.uint32());continue;case 2:if(18!==e)break;n.fullScreen=WebViewFullScreenEvent.decode(o,o.uint32());continue}if(4==(7&e)||0===e)break;o.skipType(7&e)}return n},fromJSON:e=>({postMessage:isSet$4(e.postMessage)?WebViewPostMessageEvent.fromJSON(e.postMessage):void 0,fullScreen:isSet$4(e.fullScreen)?WebViewFullScreenEvent.fromJSON(e.fullScreen):void 0}),toJSON(e){const t={};return void 0!==e.postMessage&&(t.postMessage=WebViewPostMessageEvent.toJSON(e.postMessage)),void 0!==e.fullScreen&&(t.fullScreen=WebViewFullScreenEvent.toJSON(e.fullScreen)),t},create:e=>WebViewEvent.fromPartial(e??{}),fromPartial(e){const t=createBaseWebViewEvent();return t.postMessage=void 0!==e.postMessage&&null!==e.postMessage?WebViewPostMessageEvent.fromPartial(e.postMessage):void 0,t.fullScreen=void 0!==e.fullScreen&&null!==e.fullScreen?WebViewFullScreenEvent.fromPartial(e.fullScreen):void 0,t}};function createBaseWebViewImmersiveModeChangedEvent(){return{immersiveMode:0}}messageTypeRegistry.set(WebViewEvent.$type,WebViewEvent);const WebViewImmersiveModeChangedEvent={$type:"devvit.ui.events.v1alpha.WebViewImmersiveModeChangedEvent",encode:(e,t=_m0.Writer.create())=>(0!==e.immersiveMode&&t.uint32(8).int32(e.immersiveMode),t),decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseWebViewImmersiveModeChangedEvent();for(;o.pos>>3){case 1:if(8!==e)break;n.immersiveMode=o.int32();continue}if(4==(7&e)||0===e)break;o.skipType(7&e)}return n},fromJSON:e=>({immersiveMode:isSet$4(e.immersiveMode)?webViewImmersiveModeFromJSON(e.immersiveMode):0}),toJSON(e){const t={};return 0!==e.immersiveMode&&(t.immersiveMode=webViewImmersiveModeToJSON(e.immersiveMode)),t},create:e=>WebViewImmersiveModeChangedEvent.fromPartial(e??{}),fromPartial(e){const t=createBaseWebViewImmersiveModeChangedEvent();return t.immersiveMode=e.immersiveMode??0,t}};function createBaseWebViewInternalEventMessage(){return{id:"",formCanceled:void 0,formSubmitted:void 0,realtimeEvent:void 0,immersiveModeEvent:void 0,consentStatus:void 0,orderResult:void 0}}messageTypeRegistry.set(WebViewImmersiveModeChangedEvent.$type,WebViewImmersiveModeChangedEvent);const WebViewInternalEventMessage={$type:"devvit.ui.events.v1alpha.WebViewInternalEventMessage",encode:(e,t=_m0.Writer.create())=>(""!==e.id&&t.uint32(10).string(e.id),void 0!==e.formCanceled&&FormCanceledEvent.encode(e.formCanceled,t.uint32(18).fork()).ldelim(),void 0!==e.formSubmitted&&FormSubmittedEvent.encode(e.formSubmitted,t.uint32(26).fork()).ldelim(),void 0!==e.realtimeEvent&&RealtimeSubscriptionEvent.encode(e.realtimeEvent,t.uint32(34).fork()).ldelim(),void 0!==e.immersiveModeEvent&&WebViewImmersiveModeChangedEvent.encode(e.immersiveModeEvent,t.uint32(42).fork()).ldelim(),void 0!==e.consentStatus&&ConsentStatusEvent.encode(e.consentStatus,t.uint32(58).fork()).ldelim(),void 0!==e.orderResult&&OrderResultEvent.encode(e.orderResult,t.uint32(66).fork()).ldelim(),t),decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseWebViewInternalEventMessage();for(;o.pos>>3){case 1:if(10!==e)break;n.id=o.string();continue;case 2:if(18!==e)break;n.formCanceled=FormCanceledEvent.decode(o,o.uint32());continue;case 3:if(26!==e)break;n.formSubmitted=FormSubmittedEvent.decode(o,o.uint32());continue;case 4:if(34!==e)break;n.realtimeEvent=RealtimeSubscriptionEvent.decode(o,o.uint32());continue;case 5:if(42!==e)break;n.immersiveModeEvent=WebViewImmersiveModeChangedEvent.decode(o,o.uint32());continue;case 7:if(58!==e)break;n.consentStatus=ConsentStatusEvent.decode(o,o.uint32());continue;case 8:if(66!==e)break;n.orderResult=OrderResultEvent.decode(o,o.uint32());continue}if(4==(7&e)||0===e)break;o.skipType(7&e)}return n},fromJSON:e=>({id:isSet$4(e.id)?globalThis.String(e.id):"",formCanceled:isSet$4(e.formCanceled)?FormCanceledEvent.fromJSON(e.formCanceled):void 0,formSubmitted:isSet$4(e.formSubmitted)?FormSubmittedEvent.fromJSON(e.formSubmitted):void 0,realtimeEvent:isSet$4(e.realtimeEvent)?RealtimeSubscriptionEvent.fromJSON(e.realtimeEvent):void 0,immersiveModeEvent:isSet$4(e.immersiveModeEvent)?WebViewImmersiveModeChangedEvent.fromJSON(e.immersiveModeEvent):void 0,consentStatus:isSet$4(e.consentStatus)?ConsentStatusEvent.fromJSON(e.consentStatus):void 0,orderResult:isSet$4(e.orderResult)?OrderResultEvent.fromJSON(e.orderResult):void 0}),toJSON(e){const t={};return""!==e.id&&(t.id=e.id),void 0!==e.formCanceled&&(t.formCanceled=FormCanceledEvent.toJSON(e.formCanceled)),void 0!==e.formSubmitted&&(t.formSubmitted=FormSubmittedEvent.toJSON(e.formSubmitted)),void 0!==e.realtimeEvent&&(t.realtimeEvent=RealtimeSubscriptionEvent.toJSON(e.realtimeEvent)),void 0!==e.immersiveModeEvent&&(t.immersiveModeEvent=WebViewImmersiveModeChangedEvent.toJSON(e.immersiveModeEvent)),void 0!==e.consentStatus&&(t.consentStatus=ConsentStatusEvent.toJSON(e.consentStatus)),void 0!==e.orderResult&&(t.orderResult=OrderResultEvent.toJSON(e.orderResult)),t},create:e=>WebViewInternalEventMessage.fromPartial(e??{}),fromPartial(e){const t=createBaseWebViewInternalEventMessage();return t.id=e.id??"",t.formCanceled=void 0!==e.formCanceled&&null!==e.formCanceled?FormCanceledEvent.fromPartial(e.formCanceled):void 0,t.formSubmitted=void 0!==e.formSubmitted&&null!==e.formSubmitted?FormSubmittedEvent.fromPartial(e.formSubmitted):void 0,t.realtimeEvent=void 0!==e.realtimeEvent&&null!==e.realtimeEvent?RealtimeSubscriptionEvent.fromPartial(e.realtimeEvent):void 0,t.immersiveModeEvent=void 0!==e.immersiveModeEvent&&null!==e.immersiveModeEvent?WebViewImmersiveModeChangedEvent.fromPartial(e.immersiveModeEvent):void 0,t.consentStatus=void 0!==e.consentStatus&&null!==e.consentStatus?ConsentStatusEvent.fromPartial(e.consentStatus):void 0,t.orderResult=void 0!==e.orderResult&&null!==e.orderResult?OrderResultEvent.fromPartial(e.orderResult):void 0,t}};function createBaseWebViewMessageEvent(){return{data:void 0}}messageTypeRegistry.set(WebViewInternalEventMessage.$type,WebViewInternalEventMessage);const WebViewMessageEvent={$type:"devvit.ui.events.v1alpha.WebViewMessageEvent",encode:(e,t=_m0.Writer.create())=>(void 0!==e.data&&WebViewMessageEvent_MessageData.encode(e.data,t.uint32(10).fork()).ldelim(),t),decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseWebViewMessageEvent();for(;o.pos>>3){case 1:if(10!==e)break;n.data=WebViewMessageEvent_MessageData.decode(o,o.uint32());continue}if(4==(7&e)||0===e)break;o.skipType(7&e)}return n},fromJSON:e=>({data:isSet$4(e.data)?WebViewMessageEvent_MessageData.fromJSON(e.data):void 0}),toJSON(e){const t={};return void 0!==e.data&&(t.data=WebViewMessageEvent_MessageData.toJSON(e.data)),t},create:e=>WebViewMessageEvent.fromPartial(e??{}),fromPartial(e){const t=createBaseWebViewMessageEvent();return t.data=void 0!==e.data&&null!==e.data?WebViewMessageEvent_MessageData.fromPartial(e.data):void 0,t}};function createBaseWebViewMessageEvent_MessageData(){return{type:"",data:void 0}}messageTypeRegistry.set(WebViewMessageEvent.$type,WebViewMessageEvent);const WebViewMessageEvent_MessageData={$type:"devvit.ui.events.v1alpha.WebViewMessageEvent.MessageData",encode:(e,t=_m0.Writer.create())=>(""!==e.type&&t.uint32(10).string(e.type),void 0!==e.data&&WebViewInternalEventMessage.encode(e.data,t.uint32(18).fork()).ldelim(),t),decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseWebViewMessageEvent_MessageData();for(;o.pos>>3){case 1:if(10!==e)break;n.type=o.string();continue;case 2:if(18!==e)break;n.data=WebViewInternalEventMessage.decode(o,o.uint32());continue}if(4==(7&e)||0===e)break;o.skipType(7&e)}return n},fromJSON:e=>({type:isSet$4(e.type)?globalThis.String(e.type):"",data:isSet$4(e.data)?WebViewInternalEventMessage.fromJSON(e.data):void 0}),toJSON(e){const t={};return""!==e.type&&(t.type=e.type),void 0!==e.data&&(t.data=WebViewInternalEventMessage.toJSON(e.data)),t},create:e=>WebViewMessageEvent_MessageData.fromPartial(e??{}),fromPartial(e){const t=createBaseWebViewMessageEvent_MessageData();return t.type=e.type??"",t.data=void 0!==e.data&&null!==e.data?WebViewInternalEventMessage.fromPartial(e.data):void 0,t}};function isSet$4(e){return null!=e}var UIEventScope;function uIEventScopeFromJSON(e){switch(e){case 0:case"ALL":return UIEventScope.ALL;case 1:case"LOCAL":return UIEventScope.LOCAL;case 2:case"REMOTE":return UIEventScope.REMOTE;default:return UIEventScope.UNRECOGNIZED}}function uIEventScopeToJSON(e){switch(e){case UIEventScope.ALL:return 0;case UIEventScope.LOCAL:return 1;case UIEventScope.REMOTE:return 2;case UIEventScope.UNRECOGNIZED:default:return-1}}function createBaseUIEvent(){return{realtimeEvent:void 0,formSubmitted:void 0,orderResult:void 0,toastAction:void 0,userAction:void 0,asyncRequest:void 0,asyncResponse:void 0,timer:void 0,blocking:void 0,resize:void 0,webView:void 0,formCanceled:void 0,consentStatus:void 0,async:void 0,hook:void 0,retry:void 0,scope:void 0}}messageTypeRegistry.set(WebViewMessageEvent_MessageData.$type,WebViewMessageEvent_MessageData),function(e){e[e.ALL=0]="ALL",e[e.LOCAL=1]="LOCAL",e[e.REMOTE=2]="REMOTE",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"}(UIEventScope||(UIEventScope={}));const UIEvent={$type:"devvit.ui.events.v1alpha.UIEvent",encode:(e,t=_m0.Writer.create())=>(void 0!==e.realtimeEvent&&RealtimeSubscriptionEvent.encode(e.realtimeEvent,t.uint32(18).fork()).ldelim(),void 0!==e.formSubmitted&&FormSubmittedEvent.encode(e.formSubmitted,t.uint32(26).fork()).ldelim(),void 0!==e.orderResult&&OrderResultEvent.encode(e.orderResult,t.uint32(154).fork()).ldelim(),void 0!==e.toastAction&&ToastActionEvent.encode(e.toastAction,t.uint32(34).fork()).ldelim(),void 0!==e.userAction&&UserAction.encode(e.userAction,t.uint32(50).fork()).ldelim(),void 0!==e.asyncRequest&&AsyncRequest.encode(e.asyncRequest,t.uint32(58).fork()).ldelim(),void 0!==e.asyncResponse&&AsyncResponse.encode(e.asyncResponse,t.uint32(66).fork()).ldelim(),void 0!==e.timer&&TimerEvent.encode(e.timer,t.uint32(98).fork()).ldelim(),void 0!==e.blocking&&BlockingRenderEvent.encode(e.blocking,t.uint32(106).fork()).ldelim(),void 0!==e.resize&&ResizeEvent.encode(e.resize,t.uint32(114).fork()).ldelim(),void 0!==e.webView&&WebViewEvent.encode(e.webView,t.uint32(162).fork()).ldelim(),void 0!==e.formCanceled&&FormCanceledEvent.encode(e.formCanceled,t.uint32(170).fork()).ldelim(),void 0!==e.consentStatus&&ConsentStatusEvent.encode(e.consentStatus,t.uint32(186).fork()).ldelim(),void 0!==e.async&&BoolValue.encode({value:e.async},t.uint32(122).fork()).ldelim(),void 0!==e.hook&&StringValue.encode({value:e.hook},t.uint32(82).fork()).ldelim(),void 0!==e.retry&&BoolValue.encode({value:e.retry},t.uint32(138).fork()).ldelim(),void 0!==e.scope&&t.uint32(144).int32(e.scope),t),decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseUIEvent();for(;o.pos>>3){case 2:if(18!==e)break;n.realtimeEvent=RealtimeSubscriptionEvent.decode(o,o.uint32());continue;case 3:if(26!==e)break;n.formSubmitted=FormSubmittedEvent.decode(o,o.uint32());continue;case 19:if(154!==e)break;n.orderResult=OrderResultEvent.decode(o,o.uint32());continue;case 4:if(34!==e)break;n.toastAction=ToastActionEvent.decode(o,o.uint32());continue;case 6:if(50!==e)break;n.userAction=UserAction.decode(o,o.uint32());continue;case 7:if(58!==e)break;n.asyncRequest=AsyncRequest.decode(o,o.uint32());continue;case 8:if(66!==e)break;n.asyncResponse=AsyncResponse.decode(o,o.uint32());continue;case 12:if(98!==e)break;n.timer=TimerEvent.decode(o,o.uint32());continue;case 13:if(106!==e)break;n.blocking=BlockingRenderEvent.decode(o,o.uint32());continue;case 14:if(114!==e)break;n.resize=ResizeEvent.decode(o,o.uint32());continue;case 20:if(162!==e)break;n.webView=WebViewEvent.decode(o,o.uint32());continue;case 21:if(170!==e)break;n.formCanceled=FormCanceledEvent.decode(o,o.uint32());continue;case 23:if(186!==e)break;n.consentStatus=ConsentStatusEvent.decode(o,o.uint32());continue;case 15:if(122!==e)break;n.async=BoolValue.decode(o,o.uint32()).value;continue;case 10:if(82!==e)break;n.hook=StringValue.decode(o,o.uint32()).value;continue;case 17:if(138!==e)break;n.retry=BoolValue.decode(o,o.uint32()).value;continue;case 18:if(144!==e)break;n.scope=o.int32();continue}if(4==(7&e)||0===e)break;o.skipType(7&e)}return n},fromJSON:e=>({realtimeEvent:isSet$3(e.realtimeEvent)?RealtimeSubscriptionEvent.fromJSON(e.realtimeEvent):void 0,formSubmitted:isSet$3(e.formSubmitted)?FormSubmittedEvent.fromJSON(e.formSubmitted):void 0,orderResult:isSet$3(e.orderResult)?OrderResultEvent.fromJSON(e.orderResult):void 0,toastAction:isSet$3(e.toastAction)?ToastActionEvent.fromJSON(e.toastAction):void 0,userAction:isSet$3(e.userAction)?UserAction.fromJSON(e.userAction):void 0,asyncRequest:isSet$3(e.asyncRequest)?AsyncRequest.fromJSON(e.asyncRequest):void 0,asyncResponse:isSet$3(e.asyncResponse)?AsyncResponse.fromJSON(e.asyncResponse):void 0,timer:isSet$3(e.timer)?TimerEvent.fromJSON(e.timer):void 0,blocking:isSet$3(e.blocking)?BlockingRenderEvent.fromJSON(e.blocking):void 0,resize:isSet$3(e.resize)?ResizeEvent.fromJSON(e.resize):void 0,webView:isSet$3(e.webView)?WebViewEvent.fromJSON(e.webView):void 0,formCanceled:isSet$3(e.formCanceled)?FormCanceledEvent.fromJSON(e.formCanceled):void 0,consentStatus:isSet$3(e.consentStatus)?ConsentStatusEvent.fromJSON(e.consentStatus):void 0,async:isSet$3(e.async)?Boolean(e.async):void 0,hook:isSet$3(e.hook)?String(e.hook):void 0,retry:isSet$3(e.retry)?Boolean(e.retry):void 0,scope:isSet$3(e.scope)?uIEventScopeFromJSON(e.scope):void 0}),toJSON(e){const t={};return void 0!==e.realtimeEvent&&(t.realtimeEvent=RealtimeSubscriptionEvent.toJSON(e.realtimeEvent)),void 0!==e.formSubmitted&&(t.formSubmitted=FormSubmittedEvent.toJSON(e.formSubmitted)),void 0!==e.orderResult&&(t.orderResult=OrderResultEvent.toJSON(e.orderResult)),void 0!==e.toastAction&&(t.toastAction=ToastActionEvent.toJSON(e.toastAction)),void 0!==e.userAction&&(t.userAction=UserAction.toJSON(e.userAction)),void 0!==e.asyncRequest&&(t.asyncRequest=AsyncRequest.toJSON(e.asyncRequest)),void 0!==e.asyncResponse&&(t.asyncResponse=AsyncResponse.toJSON(e.asyncResponse)),void 0!==e.timer&&(t.timer=TimerEvent.toJSON(e.timer)),void 0!==e.blocking&&(t.blocking=BlockingRenderEvent.toJSON(e.blocking)),void 0!==e.resize&&(t.resize=ResizeEvent.toJSON(e.resize)),void 0!==e.webView&&(t.webView=WebViewEvent.toJSON(e.webView)),void 0!==e.formCanceled&&(t.formCanceled=FormCanceledEvent.toJSON(e.formCanceled)),void 0!==e.consentStatus&&(t.consentStatus=ConsentStatusEvent.toJSON(e.consentStatus)),void 0!==e.async&&(t.async=e.async),void 0!==e.hook&&(t.hook=e.hook),void 0!==e.retry&&(t.retry=e.retry),void 0!==e.scope&&(t.scope=uIEventScopeToJSON(e.scope)),t},create:e=>UIEvent.fromPartial(e??{}),fromPartial(e){const t=createBaseUIEvent();return t.realtimeEvent=void 0!==e.realtimeEvent&&null!==e.realtimeEvent?RealtimeSubscriptionEvent.fromPartial(e.realtimeEvent):void 0,t.formSubmitted=void 0!==e.formSubmitted&&null!==e.formSubmitted?FormSubmittedEvent.fromPartial(e.formSubmitted):void 0,t.orderResult=void 0!==e.orderResult&&null!==e.orderResult?OrderResultEvent.fromPartial(e.orderResult):void 0,t.toastAction=void 0!==e.toastAction&&null!==e.toastAction?ToastActionEvent.fromPartial(e.toastAction):void 0,t.userAction=void 0!==e.userAction&&null!==e.userAction?UserAction.fromPartial(e.userAction):void 0,t.asyncRequest=void 0!==e.asyncRequest&&null!==e.asyncRequest?AsyncRequest.fromPartial(e.asyncRequest):void 0,t.asyncResponse=void 0!==e.asyncResponse&&null!==e.asyncResponse?AsyncResponse.fromPartial(e.asyncResponse):void 0,t.timer=void 0!==e.timer&&null!==e.timer?TimerEvent.fromPartial(e.timer):void 0,t.blocking=void 0!==e.blocking&&null!==e.blocking?BlockingRenderEvent.fromPartial(e.blocking):void 0,t.resize=void 0!==e.resize&&null!==e.resize?ResizeEvent.fromPartial(e.resize):void 0,t.webView=void 0!==e.webView&&null!==e.webView?WebViewEvent.fromPartial(e.webView):void 0,t.formCanceled=void 0!==e.formCanceled&&null!==e.formCanceled?FormCanceledEvent.fromPartial(e.formCanceled):void 0,t.consentStatus=void 0!==e.consentStatus&&null!==e.consentStatus?ConsentStatusEvent.fromPartial(e.consentStatus):void 0,t.async=e.async??void 0,t.hook=e.hook??void 0,t.retry=e.retry??void 0,t.scope=e.scope??void 0,t}};function createBaseBlockingRenderEvent(){return{}}messageTypeRegistry.set(UIEvent.$type,UIEvent);const BlockingRenderEvent={$type:"devvit.ui.events.v1alpha.BlockingRenderEvent",encode:(e,t=_m0.Writer.create())=>t,decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseBlockingRenderEvent();for(;o.pos({}),toJSON:e=>({}),create:e=>BlockingRenderEvent.fromPartial(e??{}),fromPartial:e=>createBaseBlockingRenderEvent()};function createBaseResizeEvent(){return{}}messageTypeRegistry.set(BlockingRenderEvent.$type,BlockingRenderEvent);const ResizeEvent={$type:"devvit.ui.events.v1alpha.ResizeEvent",encode:(e,t=_m0.Writer.create())=>t,decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseResizeEvent();for(;o.pos({}),toJSON:e=>({}),create:e=>ResizeEvent.fromPartial(e??{}),fromPartial:e=>createBaseResizeEvent()};function createBaseTimerEvent(){return{}}messageTypeRegistry.set(ResizeEvent.$type,ResizeEvent);const TimerEvent={$type:"devvit.ui.events.v1alpha.TimerEvent",encode:(e,t=_m0.Writer.create())=>t,decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseTimerEvent();for(;o.pos({}),toJSON:e=>({}),create:e=>TimerEvent.fromPartial(e??{}),fromPartial:e=>createBaseTimerEvent()};function createBaseAsyncError(){return{message:"",details:""}}messageTypeRegistry.set(TimerEvent.$type,TimerEvent);const AsyncError={$type:"devvit.ui.events.v1alpha.AsyncError",encode:(e,t=_m0.Writer.create())=>(""!==e.message&&t.uint32(10).string(e.message),""!==e.details&&t.uint32(18).string(e.details),t),decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseAsyncError();for(;o.pos>>3){case 1:if(10!==e)break;n.message=o.string();continue;case 2:if(18!==e)break;n.details=o.string();continue}if(4==(7&e)||0===e)break;o.skipType(7&e)}return n},fromJSON:e=>({message:isSet$3(e.message)?globalThis.String(e.message):"",details:isSet$3(e.details)?globalThis.String(e.details):""}),toJSON(e){const t={};return""!==e.message&&(t.message=e.message),""!==e.details&&(t.details=e.details),t},create:e=>AsyncError.fromPartial(e??{}),fromPartial(e){const t=createBaseAsyncError();return t.message=e.message??"",t.details=e.details??"",t}};function createBaseAsyncRequest(){return{requestId:"",data:void 0}}messageTypeRegistry.set(AsyncError.$type,AsyncError);const AsyncRequest={$type:"devvit.ui.events.v1alpha.AsyncRequest",encode:(e,t=_m0.Writer.create())=>(""!==e.requestId&&t.uint32(10).string(e.requestId),void 0!==e.data&&Struct.encode(Struct.wrap(e.data),t.uint32(18).fork()).ldelim(),t),decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseAsyncRequest();for(;o.pos>>3){case 1:if(10!==e)break;n.requestId=o.string();continue;case 2:if(18!==e)break;n.data=Struct.unwrap(Struct.decode(o,o.uint32()));continue}if(4==(7&e)||0===e)break;o.skipType(7&e)}return n},fromJSON:e=>({requestId:isSet$3(e.requestId)?globalThis.String(e.requestId):"",data:isObject$2(e.data)?e.data:void 0}),toJSON(e){const t={};return""!==e.requestId&&(t.requestId=e.requestId),void 0!==e.data&&(t.data=e.data),t},create:e=>AsyncRequest.fromPartial(e??{}),fromPartial(e){const t=createBaseAsyncRequest();return t.requestId=e.requestId??"",t.data=e.data??void 0,t}};function createBaseAsyncResponse(){return{requestId:"",data:void 0,error:void 0}}messageTypeRegistry.set(AsyncRequest.$type,AsyncRequest);const AsyncResponse={$type:"devvit.ui.events.v1alpha.AsyncResponse",encode:(e,t=_m0.Writer.create())=>(""!==e.requestId&&t.uint32(10).string(e.requestId),void 0!==e.data&&Struct.encode(Struct.wrap(e.data),t.uint32(18).fork()).ldelim(),void 0!==e.error&&AsyncError.encode(e.error,t.uint32(26).fork()).ldelim(),t),decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseAsyncResponse();for(;o.pos>>3){case 1:if(10!==e)break;n.requestId=o.string();continue;case 2:if(18!==e)break;n.data=Struct.unwrap(Struct.decode(o,o.uint32()));continue;case 3:if(26!==e)break;n.error=AsyncError.decode(o,o.uint32());continue}if(4==(7&e)||0===e)break;o.skipType(7&e)}return n},fromJSON:e=>({requestId:isSet$3(e.requestId)?globalThis.String(e.requestId):"",data:isObject$2(e.data)?e.data:void 0,error:isSet$3(e.error)?AsyncError.fromJSON(e.error):void 0}),toJSON(e){const t={};return""!==e.requestId&&(t.requestId=e.requestId),void 0!==e.data&&(t.data=e.data),void 0!==e.error&&(t.error=AsyncError.toJSON(e.error)),t},create:e=>AsyncResponse.fromPartial(e??{}),fromPartial(e){const t=createBaseAsyncResponse();return t.requestId=e.requestId??"",t.data=e.data??void 0,t.error=void 0!==e.error&&null!==e.error?AsyncError.fromPartial(e.error):void 0,t}};function createBaseUserAction(){return{actionId:"",data:void 0}}messageTypeRegistry.set(AsyncResponse.$type,AsyncResponse);const UserAction={$type:"devvit.ui.events.v1alpha.UserAction",encode:(e,t=_m0.Writer.create())=>(""!==e.actionId&&t.uint32(10).string(e.actionId),void 0!==e.data&&Struct.encode(Struct.wrap(e.data),t.uint32(18).fork()).ldelim(),t),decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseUserAction();for(;o.pos>>3){case 1:if(10!==e)break;n.actionId=o.string();continue;case 2:if(18!==e)break;n.data=Struct.unwrap(Struct.decode(o,o.uint32()));continue}if(4==(7&e)||0===e)break;o.skipType(7&e)}return n},fromJSON:e=>({actionId:isSet$3(e.actionId)?globalThis.String(e.actionId):"",data:isObject$2(e.data)?e.data:void 0}),toJSON(e){const t={};return""!==e.actionId&&(t.actionId=e.actionId),void 0!==e.data&&(t.data=e.data),t},create:e=>UserAction.fromPartial(e??{}),fromPartial(e){const t=createBaseUserAction();return t.actionId=e.actionId??"",t.data=e.data??void 0,t}};function isObject$2(e){return"object"==typeof e&&null!==e}function isSet$3(e){return null!=e}function Bubble(e,t){return new CustomEvent(e,{bubbles:!0,composed:!0,detail:t})}var AppPromoStatus;function appPromoStatusFromJSON(e){switch(e){case 0:case"APS_UNSPECIFIED":return AppPromoStatus.APS_UNSPECIFIED;case 1:case"APS_REDDIT_PROMOTED":return AppPromoStatus.APS_REDDIT_PROMOTED;default:return AppPromoStatus.UNRECOGNIZED}}function appPromoStatusToJSON(e){switch(e){case AppPromoStatus.APS_UNSPECIFIED:return 0;case AppPromoStatus.APS_REDDIT_PROMOTED:return 1;case AppPromoStatus.UNRECOGNIZED:default:return-1}}function createBaseAdsConfig(){return{promoStatus:0}}messageTypeRegistry.set(UserAction.$type,UserAction),function(e){e[e.APS_UNSPECIFIED=0]="APS_UNSPECIFIED",e[e.APS_REDDIT_PROMOTED=1]="APS_REDDIT_PROMOTED",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"}(AppPromoStatus||(AppPromoStatus={}));const AdsConfig={$type:"reddit.devvit.ads.v1.AdsConfig",encode:(e,t=_m0.Writer.create())=>(0!==e.promoStatus&&t.uint32(8).int32(e.promoStatus),t),decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseAdsConfig();for(;o.pos>>3){case 1:if(8!==e)break;n.promoStatus=o.int32();continue}if(4==(7&e)||0===e)break;o.skipType(7&e)}return n},fromJSON:e=>({promoStatus:isSet$2(e.promoStatus)?appPromoStatusFromJSON(e.promoStatus):0}),toJSON(e){const t={};return 0!==e.promoStatus&&(t.promoStatus=appPromoStatusToJSON(e.promoStatus)),t},create:e=>AdsConfig.fromPartial(e??{}),fromPartial(e){const t=createBaseAdsConfig();return t.promoStatus=e.promoStatus??0,t}};function isSet$2(e){return null!=e}var AppVisibility,RenderVersion;function appVisibilityFromJSON(e){switch(e){case 0:case"PUBLIC":return AppVisibility.PUBLIC;case 1:case"PRIVATE":return AppVisibility.PRIVATE;case 2:case"UNLISTED":return AppVisibility.UNLISTED;default:return AppVisibility.UNRECOGNIZED}}function appVisibilityToJSON(e){switch(e){case AppVisibility.PUBLIC:return 0;case AppVisibility.PRIVATE:return 1;case AppVisibility.UNLISTED:return 2;case AppVisibility.UNRECOGNIZED:default:return-1}}function createBaseApp(){return{id:"",slug:"",name:"",visibility:0,owner:void 0,version:"",adsConfig:void 0,termsAndConditions:"",privacyPolicy:"",requestedPermissionScopes:[],renderVersion:void 0}}messageTypeRegistry.set(AdsConfig.$type,AdsConfig),function(e){e[e.PUBLIC=0]="PUBLIC",e[e.PRIVATE=1]="PRIVATE",e[e.UNLISTED=2]="UNLISTED",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"}(AppVisibility||(AppVisibility={})),function(e){e[e.RENDER_VERSION_UNSPECIFIED=0]="RENDER_VERSION_UNSPECIFIED",e[e.NO_DEVVIT_JSON=256]="NO_DEVVIT_JSON",e[e.WEBBIT_BLOCKS=512]="WEBBIT_BLOCKS",e[e.WEBBIT_PURE_NO_ENTRYPOINT=1024]="WEBBIT_PURE_NO_ENTRYPOINT",e[e.WEBBIT_PURE_NO_INLINE=1040]="WEBBIT_PURE_NO_INLINE",e[e.WEBBIT_PURE_INLINE=1056]="WEBBIT_PURE_INLINE",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"}(RenderVersion||(RenderVersion={}));const App={$type:"reddit.devvit.common.v1.App",encode(e,t=_m0.Writer.create()){""!==e.id&&t.uint32(10).string(e.id),""!==e.slug&&t.uint32(18).string(e.slug),""!==e.name&&t.uint32(26).string(e.name),0!==e.visibility&&t.uint32(32).int32(e.visibility),void 0!==e.owner&&AppOwner.encode(e.owner,t.uint32(42).fork()).ldelim(),""!==e.version&&t.uint32(50).string(e.version),void 0!==e.adsConfig&&AdsConfig.encode(e.adsConfig,t.uint32(58).fork()).ldelim(),""!==e.termsAndConditions&&t.uint32(66).string(e.termsAndConditions),""!==e.privacyPolicy&&t.uint32(74).string(e.privacyPolicy),t.uint32(82).fork();for(const o of e.requestedPermissionScopes)t.int32(o);return t.ldelim(),void 0!==e.renderVersion&&t.uint32(88).int32(e.renderVersion),t},decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseApp();for(;o.pos>>3){case 1:if(10!==e)break;n.id=o.string();continue;case 2:if(18!==e)break;n.slug=o.string();continue;case 3:if(26!==e)break;n.name=o.string();continue;case 4:if(32!==e)break;n.visibility=o.int32();continue;case 5:if(42!==e)break;n.owner=AppOwner.decode(o,o.uint32());continue;case 6:if(50!==e)break;n.version=o.string();continue;case 7:if(58!==e)break;n.adsConfig=AdsConfig.decode(o,o.uint32());continue;case 8:if(66!==e)break;n.termsAndConditions=o.string();continue;case 9:if(74!==e)break;n.privacyPolicy=o.string();continue;case 10:if(80===e){n.requestedPermissionScopes.push(o.int32());continue}if(82===e){const e=o.uint32()+o.pos;for(;o.pos({id:isSet$1(e.id)?globalThis.String(e.id):"",slug:isSet$1(e.slug)?globalThis.String(e.slug):"",name:isSet$1(e.name)?globalThis.String(e.name):"",visibility:isSet$1(e.visibility)?appVisibilityFromJSON(e.visibility):0,owner:isSet$1(e.owner)?AppOwner.fromJSON(e.owner):void 0,version:isSet$1(e.version)?globalThis.String(e.version):"",adsConfig:isSet$1(e.adsConfig)?AdsConfig.fromJSON(e.adsConfig):void 0,termsAndConditions:isSet$1(e.termsAndConditions)?globalThis.String(e.termsAndConditions):"",privacyPolicy:isSet$1(e.privacyPolicy)?globalThis.String(e.privacyPolicy):"",requestedPermissionScopes:globalThis.Array.isArray(e?.requestedPermissionScopes)?e.requestedPermissionScopes.map((e=>scopeFromJSON(e))):[],renderVersion:isSet$1(e.renderVersion)?globalThis.Number(e.renderVersion):void 0}),toJSON(e){const t={};return""!==e.id&&(t.id=e.id),""!==e.slug&&(t.slug=e.slug),""!==e.name&&(t.name=e.name),0!==e.visibility&&(t.visibility=appVisibilityToJSON(e.visibility)),void 0!==e.owner&&(t.owner=AppOwner.toJSON(e.owner)),""!==e.version&&(t.version=e.version),void 0!==e.adsConfig&&(t.adsConfig=AdsConfig.toJSON(e.adsConfig)),""!==e.termsAndConditions&&(t.termsAndConditions=e.termsAndConditions),""!==e.privacyPolicy&&(t.privacyPolicy=e.privacyPolicy),e.requestedPermissionScopes?.length&&(t.requestedPermissionScopes=e.requestedPermissionScopes.map((e=>scopeToJSON(e)))),void 0!==e.renderVersion&&(t.renderVersion=Math.round(e.renderVersion)),t},create:e=>App.fromPartial(e??{}),fromPartial(e){const t=createBaseApp();return t.id=e.id??"",t.slug=e.slug??"",t.name=e.name??"",t.visibility=e.visibility??0,t.owner=void 0!==e.owner&&null!==e.owner?AppOwner.fromPartial(e.owner):void 0,t.version=e.version??"",t.adsConfig=void 0!==e.adsConfig&&null!==e.adsConfig?AdsConfig.fromPartial(e.adsConfig):void 0,t.termsAndConditions=e.termsAndConditions??"",t.privacyPolicy=e.privacyPolicy??"",t.requestedPermissionScopes=e.requestedPermissionScopes?.map((e=>e))||[],t.renderVersion=e.renderVersion??void 0,t}};function createBaseAppOwner(){return{userId:"",userName:""}}messageTypeRegistry.set(App.$type,App);const AppOwner={$type:"reddit.devvit.common.v1.AppOwner",encode:(e,t=_m0.Writer.create())=>(""!==e.userId&&t.uint32(10).string(e.userId),""!==e.userName&&t.uint32(18).string(e.userName),t),decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseAppOwner();for(;o.pos>>3){case 1:if(10!==e)break;n.userId=o.string();continue;case 2:if(18!==e)break;n.userName=o.string();continue}if(4==(7&e)||0===e)break;o.skipType(7&e)}return n},fromJSON:e=>({userId:isSet$1(e.userId)?globalThis.String(e.userId):"",userName:isSet$1(e.userName)?globalThis.String(e.userName):""}),toJSON(e){const t={};return""!==e.userId&&(t.userId=e.userId),""!==e.userName&&(t.userName=e.userName),t},create:e=>AppOwner.fromPartial(e??{}),fromPartial(e){const t=createBaseAppOwner();return t.userId=e.userId??"",t.userName=e.userName??"",t}};function createBaseAppConfig(){return{entrypoints:{}}}messageTypeRegistry.set(AppOwner.$type,AppOwner);const AppConfig={$type:"reddit.devvit.common.v1.AppConfig",encode:(e,t=_m0.Writer.create())=>(Object.entries(e.entrypoints).forEach((([e,o])=>{AppConfig_EntrypointsEntry.encode({key:e,value:o},t.uint32(10).fork()).ldelim()})),t),decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseAppConfig();for(;o.pos>>3){case 1:if(10!==e)break;const t=AppConfig_EntrypointsEntry.decode(o,o.uint32());void 0!==t.value&&(n.entrypoints[t.key]=t.value);continue}if(4==(7&e)||0===e)break;o.skipType(7&e)}return n},fromJSON:e=>({entrypoints:isObject$1(e.entrypoints)?Object.entries(e.entrypoints).reduce(((e,[t,o])=>(e[t]=String(o),e)),{}):{}}),toJSON(e){const t={};if(e.entrypoints){const o=Object.entries(e.entrypoints);o.length>0&&(t.entrypoints={},o.forEach((([e,o])=>{t.entrypoints[e]=o})))}return t},create:e=>AppConfig.fromPartial(e??{}),fromPartial(e){const t=createBaseAppConfig();return t.entrypoints=Object.entries(e.entrypoints??{}).reduce(((e,[t,o])=>(void 0!==o&&(e[t]=globalThis.String(o)),e)),{}),t}};function createBaseAppConfig_EntrypointsEntry(){return{key:"",value:""}}messageTypeRegistry.set(AppConfig.$type,AppConfig);const AppConfig_EntrypointsEntry={$type:"reddit.devvit.common.v1.AppConfig.EntrypointsEntry",encode:(e,t=_m0.Writer.create())=>(""!==e.key&&t.uint32(10).string(e.key),""!==e.value&&t.uint32(18).string(e.value),t),decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseAppConfig_EntrypointsEntry();for(;o.pos>>3){case 1:if(10!==e)break;n.key=o.string();continue;case 2:if(18!==e)break;n.value=o.string();continue}if(4==(7&e)||0===e)break;o.skipType(7&e)}return n},fromJSON:e=>({key:isSet$1(e.key)?globalThis.String(e.key):"",value:isSet$1(e.value)?globalThis.String(e.value):""}),toJSON(e){const t={};return""!==e.key&&(t.key=e.key),""!==e.value&&(t.value=e.value),t},create:e=>AppConfig_EntrypointsEntry.fromPartial(e??{}),fromPartial(e){const t=createBaseAppConfig_EntrypointsEntry();return t.key=e.key??"",t.value=e.value??"",t}};function isObject$1(e){return"object"==typeof e&&null!==e}function isSet$1(e){return null!=e}var Client,Height;function clientFromJSON(e){switch(e){case 0:case"CLIENT_UNSPECIFIED":return Client.CLIENT_UNSPECIFIED;case 1:case"ANDROID":return Client.ANDROID;case 2:case"IOS":return Client.IOS;case 3:case"SHREDDIT":return Client.SHREDDIT;default:return Client.UNRECOGNIZED}}function clientToJSON(e){switch(e){case Client.CLIENT_UNSPECIFIED:return 0;case Client.ANDROID:return 1;case Client.IOS:return 2;case Client.SHREDDIT:return 3;case Client.UNRECOGNIZED:default:return-1}}function createBaseBridgeContext(){return{postData:void 0,shareParam:void 0,webViewContext:void 0,webbitToken:"",devvitDebug:"",client:0,nativeVersion:void 0,shredditVersion:void 0,appPermissionState:void 0,viewMode:void 0,signedRequestContext:void 0,webViewClientData:void 0,startTime:void 0}}messageTypeRegistry.set(AppConfig_EntrypointsEntry.$type,AppConfig_EntrypointsEntry),function(e){e[e.CLIENT_UNSPECIFIED=0]="CLIENT_UNSPECIFIED",e[e.ANDROID=1]="ANDROID",e[e.IOS=2]="IOS",e[e.SHREDDIT=3]="SHREDDIT",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"}(Client||(Client={})),function(e){e[e.HEIGHT_UNSPECIFIED=0]="HEIGHT_UNSPECIFIED",e[e.REGULAR=1]="REGULAR",e[e.TALL=2]="TALL",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"}(Height||(Height={}));const BridgeContext={$type:"devvit.ui.effects.web_view.v1alpha.BridgeContext",encode:(e,t=_m0.Writer.create())=>(void 0!==e.postData&&DevvitPostData.encode(e.postData,t.uint32(10).fork()).ldelim(),void 0!==e.shareParam&&ShareParam.encode(e.shareParam,t.uint32(18).fork()).ldelim(),void 0!==e.webViewContext&&WebViewContext.encode(e.webViewContext,t.uint32(26).fork()).ldelim(),""!==e.webbitToken&&t.uint32(34).string(e.webbitToken),""!==e.devvitDebug&&t.uint32(42).string(e.devvitDebug),0!==e.client&&t.uint32(48).int32(e.client),void 0!==e.nativeVersion&&NativeClientVersion.encode(e.nativeVersion,t.uint32(58).fork()).ldelim(),void 0!==e.shredditVersion&&SemVer.encode(e.shredditVersion,t.uint32(66).fork()).ldelim(),void 0!==e.appPermissionState&&AppPermissionState.encode(e.appPermissionState,t.uint32(74).fork()).ldelim(),void 0!==e.viewMode&&t.uint32(80).int32(e.viewMode),void 0!==e.signedRequestContext&&t.uint32(98).string(e.signedRequestContext),void 0!==e.webViewClientData&&Struct.encode(Struct.wrap(e.webViewClientData),t.uint32(106).fork()).ldelim(),void 0!==e.startTime&&t.uint32(113).double(e.startTime),t),decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseBridgeContext();for(;o.pos>>3){case 1:if(10!==e)break;n.postData=DevvitPostData.decode(o,o.uint32());continue;case 2:if(18!==e)break;n.shareParam=ShareParam.decode(o,o.uint32());continue;case 3:if(26!==e)break;n.webViewContext=WebViewContext.decode(o,o.uint32());continue;case 4:if(34!==e)break;n.webbitToken=o.string();continue;case 5:if(42!==e)break;n.devvitDebug=o.string();continue;case 6:if(48!==e)break;n.client=o.int32();continue;case 7:if(58!==e)break;n.nativeVersion=NativeClientVersion.decode(o,o.uint32());continue;case 8:if(66!==e)break;n.shredditVersion=SemVer.decode(o,o.uint32());continue;case 9:if(74!==e)break;n.appPermissionState=AppPermissionState.decode(o,o.uint32());continue;case 10:if(80!==e)break;n.viewMode=o.int32();continue;case 12:if(98!==e)break;n.signedRequestContext=o.string();continue;case 13:if(106!==e)break;n.webViewClientData=Struct.unwrap(Struct.decode(o,o.uint32()));continue;case 14:if(113!==e)break;n.startTime=o.double();continue}if(4==(7&e)||0===e)break;o.skipType(7&e)}return n},fromJSON:e=>({postData:isSet(e.postData)?DevvitPostData.fromJSON(e.postData):void 0,shareParam:isSet(e.shareParam)?ShareParam.fromJSON(e.shareParam):void 0,webViewContext:isSet(e.webViewContext)?WebViewContext.fromJSON(e.webViewContext):void 0,webbitToken:isSet(e.webbitToken)?globalThis.String(e.webbitToken):"",devvitDebug:isSet(e.devvitDebug)?globalThis.String(e.devvitDebug):"",client:isSet(e.client)?clientFromJSON(e.client):0,nativeVersion:isSet(e.nativeVersion)?NativeClientVersion.fromJSON(e.nativeVersion):void 0,shredditVersion:isSet(e.shredditVersion)?SemVer.fromJSON(e.shredditVersion):void 0,appPermissionState:isSet(e.appPermissionState)?AppPermissionState.fromJSON(e.appPermissionState):void 0,viewMode:isSet(e.viewMode)?webViewImmersiveModeFromJSON(e.viewMode):void 0,signedRequestContext:isSet(e.signedRequestContext)?globalThis.String(e.signedRequestContext):void 0,webViewClientData:isObject(e.webViewClientData)?e.webViewClientData:void 0,startTime:isSet(e.startTime)?globalThis.Number(e.startTime):void 0}),toJSON(e){const t={};return void 0!==e.postData&&(t.postData=DevvitPostData.toJSON(e.postData)),void 0!==e.shareParam&&(t.shareParam=ShareParam.toJSON(e.shareParam)),void 0!==e.webViewContext&&(t.webViewContext=WebViewContext.toJSON(e.webViewContext)),""!==e.webbitToken&&(t.webbitToken=e.webbitToken),""!==e.devvitDebug&&(t.devvitDebug=e.devvitDebug),0!==e.client&&(t.client=clientToJSON(e.client)),void 0!==e.nativeVersion&&(t.nativeVersion=NativeClientVersion.toJSON(e.nativeVersion)),void 0!==e.shredditVersion&&(t.shredditVersion=SemVer.toJSON(e.shredditVersion)),void 0!==e.appPermissionState&&(t.appPermissionState=AppPermissionState.toJSON(e.appPermissionState)),void 0!==e.viewMode&&(t.viewMode=webViewImmersiveModeToJSON(e.viewMode)),void 0!==e.signedRequestContext&&(t.signedRequestContext=e.signedRequestContext),void 0!==e.webViewClientData&&(t.webViewClientData=e.webViewClientData),void 0!==e.startTime&&(t.startTime=e.startTime),t},create:e=>BridgeContext.fromPartial(e??{}),fromPartial(e){const t=createBaseBridgeContext();return t.postData=void 0!==e.postData&&null!==e.postData?DevvitPostData.fromPartial(e.postData):void 0,t.shareParam=void 0!==e.shareParam&&null!==e.shareParam?ShareParam.fromPartial(e.shareParam):void 0,t.webViewContext=void 0!==e.webViewContext&&null!==e.webViewContext?WebViewContext.fromPartial(e.webViewContext):void 0,t.webbitToken=e.webbitToken??"",t.devvitDebug=e.devvitDebug??"",t.client=e.client??0,t.nativeVersion=void 0!==e.nativeVersion&&null!==e.nativeVersion?NativeClientVersion.fromPartial(e.nativeVersion):void 0,t.shredditVersion=void 0!==e.shredditVersion&&null!==e.shredditVersion?SemVer.fromPartial(e.shredditVersion):void 0,t.appPermissionState=void 0!==e.appPermissionState&&null!==e.appPermissionState?AppPermissionState.fromPartial(e.appPermissionState):void 0,t.viewMode=e.viewMode??void 0,t.signedRequestContext=e.signedRequestContext??void 0,t.webViewClientData=e.webViewClientData??void 0,t.startTime=e.startTime??void 0,t}};function createBaseNativeClientVersion(){return{yyyy:0,release:0,attempt:0,number:0}}messageTypeRegistry.set(BridgeContext.$type,BridgeContext);const NativeClientVersion={$type:"devvit.ui.effects.web_view.v1alpha.NativeClientVersion",encode:(e,t=_m0.Writer.create())=>(0!==e.yyyy&&t.uint32(8).int32(e.yyyy),0!==e.release&&t.uint32(16).int32(e.release),0!==e.attempt&&t.uint32(24).int32(e.attempt),0!==e.number&&t.uint32(32).int32(e.number),t),decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseNativeClientVersion();for(;o.pos>>3){case 1:if(8!==e)break;n.yyyy=o.int32();continue;case 2:if(16!==e)break;n.release=o.int32();continue;case 3:if(24!==e)break;n.attempt=o.int32();continue;case 4:if(32!==e)break;n.number=o.int32();continue}if(4==(7&e)||0===e)break;o.skipType(7&e)}return n},fromJSON:e=>({yyyy:isSet(e.yyyy)?globalThis.Number(e.yyyy):0,release:isSet(e.release)?globalThis.Number(e.release):0,attempt:isSet(e.attempt)?globalThis.Number(e.attempt):0,number:isSet(e.number)?globalThis.Number(e.number):0}),toJSON(e){const t={};return 0!==e.yyyy&&(t.yyyy=Math.round(e.yyyy)),0!==e.release&&(t.release=Math.round(e.release)),0!==e.attempt&&(t.attempt=Math.round(e.attempt)),0!==e.number&&(t.number=Math.round(e.number)),t},create:e=>NativeClientVersion.fromPartial(e??{}),fromPartial(e){const t=createBaseNativeClientVersion();return t.yyyy=e.yyyy??0,t.release=e.release??0,t.attempt=e.attempt??0,t.number=e.number??0,t}};function createBaseSemVer(){return{major:0,minor:0,patch:0,version:""}}messageTypeRegistry.set(NativeClientVersion.$type,NativeClientVersion);const SemVer={$type:"devvit.ui.effects.web_view.v1alpha.SemVer",encode:(e,t=_m0.Writer.create())=>(0!==e.major&&t.uint32(8).int32(e.major),0!==e.minor&&t.uint32(16).int32(e.minor),0!==e.patch&&t.uint32(24).int32(e.patch),""!==e.version&&t.uint32(34).string(e.version),t),decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseSemVer();for(;o.pos>>3){case 1:if(8!==e)break;n.major=o.int32();continue;case 2:if(16!==e)break;n.minor=o.int32();continue;case 3:if(24!==e)break;n.patch=o.int32();continue;case 4:if(34!==e)break;n.version=o.string();continue}if(4==(7&e)||0===e)break;o.skipType(7&e)}return n},fromJSON:e=>({major:isSet(e.major)?globalThis.Number(e.major):0,minor:isSet(e.minor)?globalThis.Number(e.minor):0,patch:isSet(e.patch)?globalThis.Number(e.patch):0,version:isSet(e.version)?globalThis.String(e.version):""}),toJSON(e){const t={};return 0!==e.major&&(t.major=Math.round(e.major)),0!==e.minor&&(t.minor=Math.round(e.minor)),0!==e.patch&&(t.patch=Math.round(e.patch)),""!==e.version&&(t.version=e.version),t},create:e=>SemVer.fromPartial(e??{}),fromPartial(e){const t=createBaseSemVer();return t.major=e.major??0,t.minor=e.minor??0,t.patch=e.patch??0,t.version=e.version??"",t}};function createBaseWebViewClientData(){return{appConfig:void 0}}messageTypeRegistry.set(SemVer.$type,SemVer);const WebViewClientData={$type:"devvit.ui.effects.web_view.v1alpha.WebViewClientData",encode:(e,t=_m0.Writer.create())=>(void 0!==e.appConfig&&AppConfig.encode(e.appConfig,t.uint32(10).fork()).ldelim(),t),decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseWebViewClientData();for(;o.pos>>3){case 1:if(10!==e)break;n.appConfig=AppConfig.decode(o,o.uint32());continue}if(4==(7&e)||0===e)break;o.skipType(7&e)}return n},fromJSON:e=>({appConfig:isSet(e.appConfig)?AppConfig.fromJSON(e.appConfig):void 0}),toJSON(e){const t={};return void 0!==e.appConfig&&(t.appConfig=AppConfig.toJSON(e.appConfig)),t},create:e=>WebViewClientData.fromPartial(e??{}),fromPartial(e){const t=createBaseWebViewClientData();return t.appConfig=void 0!==e.appConfig&&null!==e.appConfig?AppConfig.fromPartial(e.appConfig):void 0,t}};function createBaseWebViewContext(){return{subredditId:"",subredditName:"",userId:"",appName:"",appVersion:"",postId:""}}messageTypeRegistry.set(WebViewClientData.$type,WebViewClientData);const WebViewContext={$type:"devvit.ui.effects.web_view.v1alpha.WebViewContext",encode:(e,t=_m0.Writer.create())=>(""!==e.subredditId&&t.uint32(10).string(e.subredditId),""!==e.subredditName&&t.uint32(18).string(e.subredditName),""!==e.userId&&t.uint32(26).string(e.userId),""!==e.appName&&t.uint32(34).string(e.appName),""!==e.appVersion&&t.uint32(42).string(e.appVersion),""!==e.postId&&t.uint32(50).string(e.postId),t),decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseWebViewContext();for(;o.pos>>3){case 1:if(10!==e)break;n.subredditId=o.string();continue;case 2:if(18!==e)break;n.subredditName=o.string();continue;case 3:if(26!==e)break;n.userId=o.string();continue;case 4:if(34!==e)break;n.appName=o.string();continue;case 5:if(42!==e)break;n.appVersion=o.string();continue;case 6:if(50!==e)break;n.postId=o.string();continue}if(4==(7&e)||0===e)break;o.skipType(7&e)}return n},fromJSON:e=>({subredditId:isSet(e.subredditId)?globalThis.String(e.subredditId):"",subredditName:isSet(e.subredditName)?globalThis.String(e.subredditName):"",userId:isSet(e.userId)?globalThis.String(e.userId):"",appName:isSet(e.appName)?globalThis.String(e.appName):"",appVersion:isSet(e.appVersion)?globalThis.String(e.appVersion):"",postId:isSet(e.postId)?globalThis.String(e.postId):""}),toJSON(e){const t={};return""!==e.subredditId&&(t.subredditId=e.subredditId),""!==e.subredditName&&(t.subredditName=e.subredditName),""!==e.userId&&(t.userId=e.userId),""!==e.appName&&(t.appName=e.appName),""!==e.appVersion&&(t.appVersion=e.appVersion),""!==e.postId&&(t.postId=e.postId),t},create:e=>WebViewContext.fromPartial(e??{}),fromPartial(e){const t=createBaseWebViewContext();return t.subredditId=e.subredditId??"",t.subredditName=e.subredditName??"",t.userId=e.userId??"",t.appName=e.appName??"",t.appVersion=e.appVersion??"",t.postId=e.postId??"",t}};function createBaseDevvitPostData(){return{splash:void 0,developerData:void 0}}messageTypeRegistry.set(WebViewContext.$type,WebViewContext);const DevvitPostData={$type:"devvit.ui.effects.web_view.v1alpha.DevvitPostData",encode:(e,t=_m0.Writer.create())=>(void 0!==e.splash&&SplashPostData.encode(e.splash,t.uint32(26).fork()).ldelim(),void 0!==e.developerData&&Struct.encode(Struct.wrap(e.developerData),t.uint32(18).fork()).ldelim(),t),decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseDevvitPostData();for(;o.pos>>3){case 3:if(26!==e)break;n.splash=SplashPostData.decode(o,o.uint32());continue;case 2:if(18!==e)break;n.developerData=Struct.unwrap(Struct.decode(o,o.uint32()));continue}if(4==(7&e)||0===e)break;o.skipType(7&e)}return n},fromJSON:e=>({splash:isSet(e.splash)?SplashPostData.fromJSON(e.splash):void 0,developerData:isObject(e.developerData)?e.developerData:void 0}),toJSON(e){const t={};return void 0!==e.splash&&(t.splash=SplashPostData.toJSON(e.splash)),void 0!==e.developerData&&(t.developerData=e.developerData),t},create:e=>DevvitPostData.fromPartial(e??{}),fromPartial(e){const t=createBaseDevvitPostData();return t.splash=void 0!==e.splash&&null!==e.splash?SplashPostData.fromPartial(e.splash):void 0,t.developerData=e.developerData??void 0,t}};function createBaseShareParam(){return{path:"",params:{},hash:"",userData:void 0}}messageTypeRegistry.set(DevvitPostData.$type,DevvitPostData);const ShareParam={$type:"devvit.ui.effects.web_view.v1alpha.ShareParam",encode:(e,t=_m0.Writer.create())=>(""!==e.path&&t.uint32(10).string(e.path),Object.entries(e.params).forEach((([e,o])=>{ShareParam_ParamsEntry.encode({key:e,value:o},t.uint32(18).fork()).ldelim()})),""!==e.hash&&t.uint32(26).string(e.hash),void 0!==e.userData&&t.uint32(34).string(e.userData),t),decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseShareParam();for(;o.pos>>3){case 1:if(10!==e)break;n.path=o.string();continue;case 2:if(18!==e)break;const t=ShareParam_ParamsEntry.decode(o,o.uint32());void 0!==t.value&&(n.params[t.key]=t.value);continue;case 3:if(26!==e)break;n.hash=o.string();continue;case 4:if(34!==e)break;n.userData=o.string();continue}if(4==(7&e)||0===e)break;o.skipType(7&e)}return n},fromJSON:e=>({path:isSet(e.path)?globalThis.String(e.path):"",params:isObject(e.params)?Object.entries(e.params).reduce(((e,[t,o])=>(e[t]=String(o),e)),{}):{},hash:isSet(e.hash)?globalThis.String(e.hash):"",userData:isSet(e.userData)?globalThis.String(e.userData):void 0}),toJSON(e){const t={};if(""!==e.path&&(t.path=e.path),e.params){const o=Object.entries(e.params);o.length>0&&(t.params={},o.forEach((([e,o])=>{t.params[e]=o})))}return""!==e.hash&&(t.hash=e.hash),void 0!==e.userData&&(t.userData=e.userData),t},create:e=>ShareParam.fromPartial(e??{}),fromPartial(e){const t=createBaseShareParam();return t.path=e.path??"",t.params=Object.entries(e.params??{}).reduce(((e,[t,o])=>(void 0!==o&&(e[t]=globalThis.String(o)),e)),{}),t.hash=e.hash??"",t.userData=e.userData??void 0,t}};function createBaseShareParam_ParamsEntry(){return{key:"",value:""}}messageTypeRegistry.set(ShareParam.$type,ShareParam);const ShareParam_ParamsEntry={$type:"devvit.ui.effects.web_view.v1alpha.ShareParam.ParamsEntry",encode:(e,t=_m0.Writer.create())=>(""!==e.key&&t.uint32(10).string(e.key),""!==e.value&&t.uint32(18).string(e.value),t),decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseShareParam_ParamsEntry();for(;o.pos>>3){case 1:if(10!==e)break;n.key=o.string();continue;case 2:if(18!==e)break;n.value=o.string();continue}if(4==(7&e)||0===e)break;o.skipType(7&e)}return n},fromJSON:e=>({key:isSet(e.key)?globalThis.String(e.key):"",value:isSet(e.value)?globalThis.String(e.value):""}),toJSON(e){const t={};return""!==e.key&&(t.key=e.key),""!==e.value&&(t.value=e.value),t},create:e=>ShareParam_ParamsEntry.fromPartial(e??{}),fromPartial(e){const t=createBaseShareParam_ParamsEntry();return t.key=e.key??"",t.value=e.value??"",t}};function createBaseSplashPostData(){return{appDisplayName:void 0,appIconUri:void 0,backgroundUri:void 0,buttonLabel:void 0,description:void 0,entry:void 0,title:void 0}}messageTypeRegistry.set(ShareParam_ParamsEntry.$type,ShareParam_ParamsEntry);const SplashPostData={$type:"devvit.ui.effects.web_view.v1alpha.SplashPostData",encode:(e,t=_m0.Writer.create())=>(void 0!==e.appDisplayName&&t.uint32(10).string(e.appDisplayName),void 0!==e.appIconUri&&t.uint32(18).string(e.appIconUri),void 0!==e.backgroundUri&&t.uint32(26).string(e.backgroundUri),void 0!==e.buttonLabel&&t.uint32(34).string(e.buttonLabel),void 0!==e.description&&t.uint32(42).string(e.description),void 0!==e.entry&&t.uint32(74).string(e.entry),void 0!==e.title&&t.uint32(58).string(e.title),t),decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseSplashPostData();for(;o.pos>>3){case 1:if(10!==e)break;n.appDisplayName=o.string();continue;case 2:if(18!==e)break;n.appIconUri=o.string();continue;case 3:if(26!==e)break;n.backgroundUri=o.string();continue;case 4:if(34!==e)break;n.buttonLabel=o.string();continue;case 5:if(42!==e)break;n.description=o.string();continue;case 9:if(74!==e)break;n.entry=o.string();continue;case 7:if(58!==e)break;n.title=o.string();continue}if(4==(7&e)||0===e)break;o.skipType(7&e)}return n},fromJSON:e=>({appDisplayName:isSet(e.appDisplayName)?globalThis.String(e.appDisplayName):void 0,appIconUri:isSet(e.appIconUri)?globalThis.String(e.appIconUri):void 0,backgroundUri:isSet(e.backgroundUri)?globalThis.String(e.backgroundUri):void 0,buttonLabel:isSet(e.buttonLabel)?globalThis.String(e.buttonLabel):void 0,description:isSet(e.description)?globalThis.String(e.description):void 0,entry:isSet(e.entry)?globalThis.String(e.entry):void 0,title:isSet(e.title)?globalThis.String(e.title):void 0}),toJSON(e){const t={};return void 0!==e.appDisplayName&&(t.appDisplayName=e.appDisplayName),void 0!==e.appIconUri&&(t.appIconUri=e.appIconUri),void 0!==e.backgroundUri&&(t.backgroundUri=e.backgroundUri),void 0!==e.buttonLabel&&(t.buttonLabel=e.buttonLabel),void 0!==e.description&&(t.description=e.description),void 0!==e.entry&&(t.entry=e.entry),void 0!==e.title&&(t.title=e.title),t},create:e=>SplashPostData.fromPartial(e??{}),fromPartial(e){const t=createBaseSplashPostData();return t.appDisplayName=e.appDisplayName??void 0,t.appIconUri=e.appIconUri??void 0,t.backgroundUri=e.backgroundUri??void 0,t.buttonLabel=e.buttonLabel??void 0,t.description=e.description??void 0,t.entry=e.entry??void 0,t.title=e.title??void 0,t}};function createBaseAppPermissionState(){return{consentStatus:0,grantedScopes:[],requestedScopes:[]}}messageTypeRegistry.set(SplashPostData.$type,SplashPostData);const AppPermissionState={$type:"devvit.ui.effects.web_view.v1alpha.AppPermissionState",encode(e,t=_m0.Writer.create()){0!==e.consentStatus&&t.uint32(8).int32(e.consentStatus),t.uint32(18).fork();for(const o of e.grantedScopes)t.int32(o);t.ldelim(),t.uint32(26).fork();for(const o of e.requestedScopes)t.int32(o);return t.ldelim(),t},decode(e,t){const o=e instanceof _m0.Reader?e:_m0.Reader.create(e);let r=void 0===t?o.len:o.pos+t;const n=createBaseAppPermissionState();for(;o.pos>>3){case 1:if(8!==e)break;n.consentStatus=o.int32();continue;case 2:if(16===e){n.grantedScopes.push(o.int32());continue}if(18===e){const e=o.uint32()+o.pos;for(;o.pos({consentStatus:isSet(e.consentStatus)?consentStatusFromJSON(e.consentStatus):0,grantedScopes:globalThis.Array.isArray(e?.grantedScopes)?e.grantedScopes.map((e=>scopeFromJSON(e))):[],requestedScopes:globalThis.Array.isArray(e?.requestedScopes)?e.requestedScopes.map((e=>scopeFromJSON(e))):[]}),toJSON(e){const t={};return 0!==e.consentStatus&&(t.consentStatus=consentStatusToJSON(e.consentStatus)),e.grantedScopes?.length&&(t.grantedScopes=e.grantedScopes.map((e=>scopeToJSON(e)))),e.requestedScopes?.length&&(t.requestedScopes=e.requestedScopes.map((e=>scopeToJSON(e)))),t},create:e=>AppPermissionState.fromPartial(e??{}),fromPartial(e){const t=createBaseAppPermissionState();return t.consentStatus=e.consentStatus??0,t.grantedScopes=e.grantedScopes?.map((e=>e))||[],t.requestedScopes=e.requestedScopes?.map((e=>e))||[],t}};function isObject(e){return"object"==typeof e&&null!==e}function isSet(e){return null!=e}messageTypeRegistry.set(AppPermissionState.$type,AppPermissionState);const queryParamDevvitDebug="devvitdebug",queryParamDevvitShare="devvitshare";function getDevvitDebug(){return getQueryParam(queryParamDevvitDebug)}function getDevvitShareParam(){return getQueryParam(queryParamDevvitShare)}function initDevvitGlobal(){var e,t,o;if(globalThis.devvit??(globalThis.devvit={}),globalThis.devvit.debug)return;(e=globalThis.devvit).debug??(e.debug={});const r={blocks:void 0,emitSnapshots:void 0,emitState:void 0,realtime:void 0,runtime:void 0,surface:void 0,useAsync:void 0,payments:void 0,bootstrap:void 0,webView:void 0},n={};for(const e in r)n[e.toLowerCase()]=e;let a=getDevvitDebug();if(null!=a){"all"===a&&(a=Object.keys(r).filter((e=>"emitSnapshots"!==e&&"emitState"!==e)).join());for(const e of a.split(",")??[]){let[r,a]=e.split("=");r&&(r.toLowerCase()in n?r=n[r.toLowerCase()]:console.warn(`[devvit] unknown devvitdebug parameter "${r}"`),(t=globalThis.devvit.debug)[o=r]??(t[o]=a||"true"),console.info(`[devvit] set devvitdebug ${r}=${globalThis.devvit.debug[r]}`))}}}function getQueryParam(e){const t=new URL(globalThis.location?location.href:"file://");return[...t.searchParams].find((([t])=>t.toLowerCase()===e))?.[1]}const _str=(e,...t)=>({strTag:!0,strings:e,values:t}),str=_str,isStrTagged=e=>"string"!=typeof e&&"strTag"in e,joinStringsAndValues=(e,t,o)=>{let r=e[0];for(let o=1;oisStrTagged(e)?joinStringsAndValues(e.strings,e.values):e;let msg=defaultMsg;class Deferred{constructor(){this.settled=!1,this.promise=new Promise(((e,t)=>{this._resolve=e,this._reject=t}))}resolve(e){this.settled=!0,this._resolve(e)}reject(e){this.settled=!0,this._reject(e)}}for(let e=0;e<256;e++)(e>>4&15).toString(16),(15&e).toString(16);let loading=new Deferred;loading.resolve();const stylesCSS="faceplate-expandable-section-helper { display: contents; /* [rpl] just to boost the selector */ /* Target the [open] attribute on either the root element OR the details element to rotate the chevron. This is to handle rotating chevrons both before and after the faceplate-expandable-section-helper component is defined. Before the component is defined, the [open] attribute on the component will not toggle if the user clicks on details, but the [open] attribute will toggle on the details element, so we need to target details too. The reason we can't target only the details element is because once the web component is defined, we delay toggling the [open] attribute on the details element until AFTER the animation finishes. So if we only targeted the details element for the chevron rotation the chevron wouldn't rotate until after the collapse animation finished and we finally toggle the [open] attriubte on the details element. */ /* Specific handling for nested menus. We only need to handle collapse menus inside of expanded menus, not expanded menus inside collapsed menus because you can't see those! */ } faceplate-expandable-section-helper > details > summary { list-style-type: none; /* For Safari */ } faceplate-expandable-section-helper > details > summary::marker, faceplate-expandable-section-helper > details > summary::-webkit-details-marker { display: none; } faceplate-expandable-section-helper[rpl] > details > summary { /* override details.less */ margin: 0; } faceplate-expandable-section-helper > details > summary [icon-name='caret-down-outline'] { transition: transform 0.22s ease-in-out; } faceplate-expandable-section-helper[open] > details > summary svg[rpl][icon-name='caret-down-outline'], faceplate-expandable-section-helper:not(:defined) > details[open] > summary svg[rpl][icon-name='caret-down-outline'] { transform: rotate(180deg); } faceplate-expandable-section-helper:not([open]) > details > summary svg[rpl][icon-name='caret-down-outline'], faceplate-expandable-section-helper:not(:defined) > details[open] > summary svg[rpl][icon-name='caret-down-outline'] { transform: rotate(0deg); } faceplate-hovercard:not(:defined) > [slot='content'] { display: none; } faceplate-hovercard[trigger='mouse'] a, faceplate-hovercard[trigger='mouse'] button, faceplate-hovercard[trigger='mouse'] [faceplate-focusable], faceplate-hovercard[trigger='mouse'] [tabindex='0'] { outline: none; } /* * This is a Tailwind CSS file, it must be run through the PostCSS compiler * with the Tailwind plugin, not Less. The `postcss-import` plugin is also * needed, if you have other additions to your Tailwind entry point CSS. * * @example * // tailwind.css * @import '@reddit/faceplate/styles/tailwind-components.css' * @tailwind components; * @tailwind utilities; * * // styles.less * @import (less) '@reddit/faceplate/faceplate.css'; * @import (less) './tailwind-build.css'; */ /* rem-based sizing units referenced by equivalent pixel sizes */ :root, .theme-light { --rem360: 22.5rem; --rem320: 20rem; --rem192: 12rem; --rem144: 9rem; --rem128: 8rem; --rem96: 6rem; --rem90: 5.625rem; --rem88: 5.5rem; --rem64: 4rem; --rem56: 3.5rem; --rem48: 3rem; --rem40: 2.5rem; --rem36: 2.25rem; --rem32: 2rem; --rem28: 1.75rem; --rem26: 1.625rem; --rem24: 1.5rem; --rem22: 1.375rem; --rem20: 1.25rem; --rem18: 1.125rem; --rem16: 1rem; --rem15: 0.9375rem; --rem14: 0.875rem; --rem12: 0.75rem; --rem10: 0.625rem; --rem8: 0.5rem; --rem6: 0.375rem; --rem4: 0.25rem; --rem2: 0.125rem; --rem1: 0.0625rem; --spacer-4xs: 0.125rem; --spacer-2xs: 0.25rem; --spacer-xs: 0.5rem; --spacer-sm: 0.75rem; --spacer-md: 1rem; --spacer-lg: 1.5rem; --spacer-xl: 2rem; --spacer-2xl: 3rem; --spacer-a-px: 0px; --spacer-button-lg-px: var(--spacer-lg); --spacer-button-md-px: var(--spacer-lg); --spacer-button-sm-px: var(--spacer-md); --spacer-input-padding-left: 0px; --spacer-input-padding-top: 0px; --spacer-label-default: 0px; --spacer-switch-input-active-pl: 0px; --size-2xs: 0.25rem; --size-xs: 0.5rem; --size-sm: 0.75rem; --size-md: 1rem; --size-lg: 1.5rem; --size-xl: 2rem; --size-2xl: 3rem; --size-3xl: 4rem; --size-4xl: 6rem; --size-5xl: 8rem; --size-button-lg-h: 3.375rem; --size-button-md-h: 2.75rem; --size-button-sm-h: 2.125rem; --size-button-xs-h: 1.375rem; --size-switch-input-h: 1.25rem; --size-switch-input-w: 2rem; --line-sm: 0.0625rem; --line-md: 0.125rem; --line-lg: 0.25rem; --line-a-focus: 0px; --line-a-outline-moz: 0.0625rem; --line-a-outline-wb: 0.3125rem; --line-button-lg-border: 0.0625rem; --line-button-md-border: 0.0625rem; --line-button-sm-border: 0.0625rem; --line-button-xs-border: 0.0625rem; --line-button-border-activated: 0.0625rem; --line-input-border: var(--line-sm); --radius-sm: 0.25rem; --radius-lg: 2rem; --radius-full: 624.9375rem; --radius-accordion-size: var(--radius-sm); --font-10-15-bold: normal 700 0.625rem / 0.9375rem var(--font-sans); --font-button-lg: normal 700 1.125rem / 1.375rem var(--font-sans); --font-button-md: normal 700 1rem / 1.25rem var(--font-sans); --font-button-sm: normal 700 0.875rem / 1.125rem var(--font-sans); --font-button-xs: normal 700 0.75rem / 0.875rem var(--font-sans); --font-label-default: var(--font-10-15-bold); --misc-accordion-border: 1px solid var(--color-tone-5); --misc-accordion-open-list-style-type: disclosure-open; --misc-accordion-closed-list-style-type: disclosure-closed; --misc-divider-margin: 0.5rem auto; --misc-label-text-transform: uppercase; --misc-label-letter-spacing: 0.5px; --color-primary-visited: #660099; --color-primary-background: #24a0ed; --color-primary-background-hover: #006cbf; --color-danger-content: #ea0027; --color-success-content: #46d160; --color-global-black: #000000; --color-global-white: #ffffff; --color-global-orangered: #D93900; --color-global-alienblue: #0079d3; --color-global-darkblue: #1d2535; --color-tone-1: #1a1a1b; --color-tone-2: #6a6d6f; --color-tone-3: #878a8c; --color-tone-4: #d3d6da; --color-tone-5: #edeff1; --color-tone-6: #f6f7f8; --color-tone-7: #ffffff; --color-action-primary: var(--color-primary-background); --color-action-secondary: var(--color-primary-background-hover); --color-action-upvote: var(--color-global-orangered); --color-action-downvote: #7193ff; --color-alert-positive: var(--color-success-content); --color-alert-negative: var(--color-danger-content); --color-alert-caution: #ffb000; --color-identity-admin: var(--color-global-orangered); --color-identity-moderator: #46d160; --color-identity-self: #0dd3bb; --color-identity-coins: #ddbd37; --color-category-live: var(--color-global-orangered); --color-category-nsfw: #ff3881; --color-category-spoiler: var(--color-tone-1); --color-ui-canvas: var(--color-tone-5); --color-ui-modalbackground: var(--color-tone-7); --color-opacity-highlight: linear-gradient(#006cbf1a, var(--color-tone-6)); --color-opacity-08: #1a1a1b14; --color-opacity-50: #00000080; --color-scrim: #1a1a1b4d; --color-a-default: var(--color-primary-background-hover); --color-a-hover: var(--color-primary-background-hover); --color-a-visited: var(--color-primary-background-hover); --color-button-overlay-focus: #ffffff1a; --color-button-overlay-active: #00000014; --color-button-primary-background-hover: var(--color-primary-background); --color-button-primary-background-disabled: var(--color-tone-6); --color-button-primary-border-hover: transparent; --color-button-primary-border-active: transparent; --color-button-primary-border-activated: transparent; --color-button-primary-border-disabled: transparent; --color-button-primary-text-disabled: var(--color-tone-2); --color-button-secondary-background: transparent; --color-button-secondary-background-focus: transparent; --color-button-secondary-background-hover: transparent; --color-button-secondary-background-disabled: var(--color-tone-6); --color-button-secondary-background-activated: transparent; --color-button-secondary-border: var(--color-primary-background-hover); --color-button-secondary-border-hover: var(--color-primary-background-hover); --color-button-secondary-border-active: var(--color-primary-background-hover); --color-button-secondary-border-activated: var(--color-primary-background-hover); --color-button-secondary-border-disabled: var(--color-tone-2); --color-button-secondary-text: var(--color-primary-background-hover); --color-button-secondary-text-disabled: var(--color-tone-2); --color-button-secondary-text-activated: var(--color-button-secondary-text); --color-button-tertiary-background: var(--color-tone-6); --color-button-tertiary-background-focus: var(--color-tone-6); --color-button-tertiary-background-hover: var(--color-tone-6); --color-button-tertiary-background-disabled: var(--color-tone-6); --color-button-tertiary-background-activated: var(--color-tone-6); --color-button-tertiary-border-hover: transparent; --color-button-tertiary-border-active: transparent; --color-button-tertiary-text: var(--color-primary-background-hover); --color-button-tertiary-text-disabled: var(--color-tone-2); --color-button-tertiary-text-activated: var(--color-primary-background-hover); --color-button-plain-background-hover: transparent; --color-button-plain-background-disabled: var(--color-tone-7); --color-button-plain-background-activated: transparent; --color-button-plain-border-hover: transparent; --color-button-plain-border-active: transparent; --color-button-plain-text: var(--color-primary-background-hover); --color-button-plain-text-disabled: var(--color-tone-2); --color-button-plain-text-activated: var(--color-primary-background-hover); --color-divider-default: var(--color-tone-5); --color-input-default: var(--color-tone-6); --color-input-hover: var(--color-primary-background-hover); --color-input-border: var(--color-tone-5); --color-input-text: var(--color-tone-1); --color-input-helper-text: var(--color-tone-1); --color-label-default: var(--color-tone-1); --color-switch-input-background-default: var(--color-tone-3); --color-switch-input-background-checked: var(--color-global-alienblue); --color-switch-input-background-disabled: var(--color-tone-6); --color-switch-input-background-checked-disabled: var(--color-tone-5); --color-switch-input-background-hover: var(--color-tone-3); --color-switch-input-background-checked-hover: var(--color-global-alienblue); --elevation-xs: 0 0.0625rem 0.125rem 0 #00000040; --elevation-sm: 0 0.0625rem 0.25rem 0 #00000026, 0 0.25rem 0.25rem 0 #00000026; --elevation-md: 0 0.25rem 0.5rem 0 #0000001a, 0 0.375rem 0.75rem 0 #00000040; --elevation-lg: 0 0.75rem 0.75rem 0 #00000026, 0 1rem 2rem 0 #00000040; --elevation-focus-ring: 0 0 0 0.25rem var(--color-global-alienblue); --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', sans-serif; --font-mono: Noto Mono, Menlo, Monaco, Consolas, monospace; /* https://www.figma.com/file/iu3o6C8NVE1a3BPHVA6G2U/Reddit-Design-Kit---Desktop?node-id=73%3A7092 */ --font-title-h0: normal 500 1.625rem / 2rem var(--font-sans); --font-title-h1: normal 500 1.375rem / 1.625rem var(--font-sans); --font-title-h2: normal 500 1.25rem / 1.5rem var(--font-sans); --font-title-h3: normal 500 1.125rem / 1.375rem var(--font-sans); --font-title-h4: normal 500 1rem / 1.25rem var(--font-sans); --font-title-h5: normal 500 0.875rem / 1.125rem var(--font-sans); --font-title-h6: normal 500 0.75rem / 1rem var(--font-sans); --font-body: 0.875rem; --font-small: 0.75rem; --font-code: 0.875rem; --font-subheading: 0.75rem; --font-label: 0.625rem; --font-button-b1: normal bold 1.125rem / 1.375rem var(--font-sans); --font-button-b2: normal bold 1rem / 1.25rem var(--font-sans); --font-button-b3: normal bold 0.875rem / 1.125rem var(--font-sans); --font-button-b4: normal bold 0.75rem / 0.875rem var(--font-sans); --color-gradient-orangeyellow: linear-gradient(89.94deg, #ec0623 0%, #ff8717 100%); --color-gradient-bluepink: linear-gradient(89.94deg, #51b9ff 0%, #7785ff 52.6%, #b279ff 73.96%, #ff81ed 100%); --boxshadow-modal: 0px 2px 15px rgba(26, 26, 27, 0.3); --boxshadow-navigation: 0px 4px 14px rgba(0, 0, 0, 0.1); --boxshadow-tooltip: 0 1px 4px rgba(0, 0, 0, 0.15), 0 4px 4px rgba(0, 0, 0, 0.15); color-scheme: light; } :root dialog::backdrop, .theme-light dialog::backdrop { --color-dialog-background: #00000080; } @media (prefers-color-scheme: dark) { :root:not(.theme-light) { --color-primary-visited: #c58af9; --color-primary-background: #006cbf; --color-primary-background-hover: #24a0ed; --color-tone-1: #d7dadc; --color-tone-2: #818384; --color-tone-3: #565758; --color-tone-4: #3a3a3c; --color-tone-5: #272729; --color-tone-6: #1a1a1b; --color-tone-7: #121213; --color-identity-coins: #ffe600; --color-ui-canvas: #050505; --color-ui-modalbackground: var(--color-tone-6); --color-opacity-50: #d7dadc80; --color-scrim: #0000004d; --elevation-xs: 0 0.0625rem 0.125rem 0 #000000ab; --elevation-sm: 0 0.0625rem 0.25rem 0 #00000054, 0 0.25rem 0.25rem 0 #00000054; --elevation-md: 0 0.25rem 0.5rem 0 #00000033, 0 0.375rem 0.75rem 0 #00000080; --elevation-lg: 0 0.75rem 0.75rem 0 #00000033, 0 1rem 2rem 0 #00000080; --boxshadow-modal: 0px 2px 15px rgba(0, 0, 0, 0.3); --boxshadow-tooltip: 0 1px 4px rgba(0, 0, 0, 0.33), 0 4px 4px rgba(0, 0, 0, 0.33); color-scheme: dark; } :root:not(.theme-light) dialog::backdrop { --color-dialog-background: #d7dadc80; } } .theme-dark { --color-primary-visited: #c58af9; --color-primary-background: #006cbf; --color-primary-background-hover: #24a0ed; --color-tone-1: #d7dadc; --color-tone-2: #818384; --color-tone-3: #565758; --color-tone-4: #3a3a3c; --color-tone-5: #272729; --color-tone-6: #1a1a1b; --color-tone-7: #121213; --color-identity-coins: #ffe600; --color-ui-canvas: #050505; --color-ui-modalbackground: var(--color-tone-6); --color-opacity-50: #d7dadc80; --color-scrim: #0000004d; --elevation-xs: 0 0.0625rem 0.125rem 0 #000000ab; --elevation-sm: 0 0.0625rem 0.25rem 0 #00000054, 0 0.25rem 0.25rem 0 #00000054; --elevation-md: 0 0.25rem 0.5rem 0 #00000033, 0 0.375rem 0.75rem 0 #00000080; --elevation-lg: 0 0.75rem 0.75rem 0 #00000033, 0 1rem 2rem 0 #00000080; --boxshadow-modal: 0px 2px 15px rgba(0, 0, 0, 0.3); --boxshadow-tooltip: 0 1px 4px rgba(0, 0, 0, 0.33), 0 4px 4px rgba(0, 0, 0, 0.33); color-scheme: dark; } .theme-dark dialog::backdrop { --color-dialog-background: #d7dadc80; } .theme-beta, .theme-light.theme-beta { --spacer-a-px: 0.125rem; --spacer-button-lg-px: var(--spacer-md); --spacer-button-md-px: var(--spacer-md); --spacer-button-sm-px: var(--spacer-sm); --spacer-input-padding-left: var(--spacer-md); --spacer-input-padding-top: var(--spacer-2xs); --spacer-label-default: var(--spacer-md); --spacer-switch-input-active-pl: var(--spacer-xs); --size-banner-height: var(--size-rem40); --size-button-lg-h: var(--size-2xl); --size-button-md-h: 2.5rem; --size-button-sm-h: var(--size-xl); --size-button-xs-h: var(--size-lg); --size-switch-input-h: var(--size-xl); --size-switch-input-w: var(--size-2xl); --line-a-focus: var(--line-md); --line-a-outline-moz: 0px; --line-a-outline-wb: 0px; --line-button-lg-border: var(--line-sm); --line-button-md-border: var(--line-sm); --line-button-sm-border: var(--line-sm); --line-button-xs-border: var(--line-sm); --line-button-border-activated: var(--line-lg); --line-input-border: var(--line-lg); --radius-md: 1.25rem; --radius-accordion-size: 0px; --font-10: normal undefined null / null var(--font-sans); --font-12: normal undefined null / null var(--font-sans); --font-14: normal undefined null / null var(--font-sans); --font-16: normal undefined null / null var(--font-sans); --font-18: normal undefined null / null var(--font-sans); --font-20: normal undefined null / null var(--font-sans); --font-24: normal undefined null / null var(--font-sans); --font-32: normal undefined null / null var(--font-sans); --font-48: normal undefined null / null var(--font-sans); --font-64: normal undefined null / null var(--font-sans); --font-title-h0: var(--font-64); --font-title-h1: var(--font-32); --font-title-h2: var(--font-24); --font-title-h3: var(--font-18); --font-title-h4: var(--font-16); --font-title-h5: var(--font-14); --font-title-h6: var(--font-12); --font-14-20-regular: normal 400 0.875rem / 1.25rem var(--font-sans); --font-14-20-semibold: normal 600 0.875rem / 1.25rem var(--font-sans); --font-16-20-regular: normal 400 1rem / 1.25rem var(--font-sans); --font-12-16-regular: normal 400 0.75rem / 1rem var(--font-sans); --font-12-16-semibold: normal 600 0.75rem / 1rem var(--font-sans); --font-button-lg: var(--font-14-20-semibold); --font-button-md: var(--font-14-20-semibold); --font-button-sm: var(--font-12-16-semibold); --font-label-default: var(--font-12-16-regular); --misc-accordion-border: 0; --misc-accordion-open-list-style-type: none; --misc-accordion-closed-list-style-type: none; --misc-divider-margin: 0; --misc-label-text-transform: capitalize; --misc-label-letter-spacing: initial; --blur-sm: 0.25rem; --blur-normal: 0.5rem; --blur-md: 0.75rem; --blur-lg: 1rem; --blur-xl: 1.5rem; --blur-2xl: 2.5rem; --blur-3xl: 4rem; --color-action-downvote: #6A5CFF; --color-action-upvote: #D93900; --color-ai-background-weaker: #E7FDF5; --color-ai-plain: #006C56; --color-ai-plain-hover: #015140; --color-alert-caution: #977000; --color-avatar-gradient: linear-gradient(0deg, #97AFBCff, #ffffffff 75%); --color-avatar-media-gradient: linear-gradient(0deg, #00000099, #181C1Fff 75%); --color-brand-background: #D93900; --color-brand-background-hover: #AE2C00; --color-brand-gradient-active: linear-gradient(180deg, #cd3700ff, #db3b00ff 68%, #D93900ff 100%); --color-brand-gradient-active-highlight: linear-gradient(83deg, #db3f0000 80%, #D93900ff 100%); --color-brand-gradient-default: linear-gradient(180deg, #D93900ff, #db3b00ff 30%, #AE2C00ff 100%); --color-brand-gradient-default-highlight: linear-gradient(258deg, #db3f0000 80%, #D93900ff 100%); --color-brand-gradient-hover: linear-gradient(180deg, #e23d00ff 15%, #cb3600ff 49%, #b43000ff 100%); --color-brand-gradient-hover-highlight: linear-gradient(323deg, #cb360000 65%, #cb3600ff 100%); --color-brand-onBackground: #FFFFFF; --color-category-live: #D93900; --color-category-nsfw: #DE019F; --color-category-spoiler: var(--color-tone-1); --color-caution-background: #FFBF0B; --color-caution-background-hover: #D8A100; --color-caution-onBackground: #000000; --color-caution-plain: #785800; --color-caution-plain-hover: #5B4200; --color-danger-background: #EB001F; --color-danger-background-disabled: #FDB3A4; --color-danger-background-hover: #BC0117; --color-danger-background-weaker: #FBDBD4; --color-danger-content: #BC0117; --color-danger-content-default: #ffffff; --color-danger-content-hover: #90000F; --color-danger-onBackground: #FFFFFF; --color-danger-plain: #BC0117; --color-danger-plain-hover: #90000F; --color-downvote-background: #6A5CFF; --color-downvote-background-disabled: rgba(106, 92, 255, 0.3); --color-downvote-background-hover: #523DFF; --color-downvote-content: #523DFF; --color-downvote-content-weak: #6A5CFF; --color-downvote-disabled: #523DFF4d; --color-downvote-onBackground: #FFFFFF; --color-downvote-onStrongScrim: #B29FFF; --color-downvote-onStrongScrim-disabled: rgba(178, 159, 255, 0.3); --color-downvote-onStrongScrim-weaker: #9580FF; --color-downvote-plain: #523DFF; --color-downvote-plain-disabled: rgba(82, 61, 255, 0.3); --color-downvote-plain-weaker: #6A5CFF; --color-elevation-large1: #0000003F; --color-elevation-large2: #00000026; --color-elevation-medium1: #0000003F; --color-elevation-medium2: #00000019; --color-elevation-small: #00000026; --color-elevation-xsmall: #0000003F; --color-favorite: #977000; --color-global-admin: #D93900; --color-global-alienblue: #1870F4; --color-global-black: #000000; --color-global-brand-orangered: #FF4500; --color-global-darkblue: #2A3236; --color-global-focus: #029DD5; --color-global-gold: #B78800; --color-global-moderator: #008A10; --color-global-nsfw: #DE019F; --color-global-offline: #667780; --color-global-online: #00C61C; --color-global-orangered: #FF4500; --color-global-stars: #977000; --color-global-white: #FFFFFF; --color-gradient-media: linear-gradient(180deg, #00000000, #0000008a 60%, #00000099 100%); --color-gradient-media-strong: linear-gradient(180deg, #00000000, #000000cc 60%, #000000e6 100%); --color-identity-admin: #D93900; --color-identity-coins: #B78800; --color-identity-moderator: #008A10; --color-identity-self: #01876D; --color-interactive-background-disabled: #0000000C; --color-interactive-content-disabled: #0000003F; --color-interactive-focused: #007FAE; --color-interactive-pressed: #00000026; --color-inverted-interactive-background-disabled: #FFFFFF0C; --color-inverted-interactive-content-disabled: #FFFFFF3F; --color-inverted-interactive-pressed: #FFFFFF26; --color-inverted-neutral-background: #0E1113; --color-inverted-neutral-background-hover: #181C1F; --color-inverted-neutral-border: #FFFFFF33; --color-inverted-neutral-content: #B7CAD4; --color-inverted-neutral-content-strong: #EEF1F3; --color-inverted-secondary-background: #2A3236; --color-inverted-secondary-background-hover: #333D42; --color-inverted-secondary-background-selected: #3D494E; --color-inverted-secondary-onBackground: #FFFFFF; --color-inverted-secondary-plain: #DBE4E9; --color-inverted-secondary-plain-hover: #FFFFFF; --color-media-background: rgba(0, 0, 0, 0.6); --color-media-background-hover: rgba(0, 0, 0, 0.8); --color-media-background-selected: rgba(0, 0, 0, 0.8); --color-media-border-selected: #FFFFFF; --color-media-border-weak: #FFFFFF19; --color-media-onBackground: #FFFFFF; --color-media-onBackground-disabled: #FFFFFF3F; --color-media-onBackground-weak: #E5EBEE; --color-media-onbackground: #ffffff; --color-media-onbackground-disabled: #ffffff40; --color-media-onbackground-weak: #B7CAD4; --color-neutral-background: #FFFFFF; --color-neutral-background-container: #F6F8F9; --color-neutral-background-container-hover: #EEF1F3; --color-neutral-background-container-strong: #EEF1F3; --color-neutral-background-container-strong-hover: #E5EBEE; --color-neutral-background-gilded: #FFF9E0; --color-neutral-background-gilded-hover: #FFF3C0; --color-neutral-background-hover: #F6F8F9; --color-neutral-background-medium: #F8F8F8; --color-neutral-background-pinned: #FFFFFF; --color-neutral-background-selected: #E5EBEE; --color-neutral-background-strong: #FFFFFF; --color-neutral-background-strong-hover: #F6F8F9; --color-neutral-background-weak: #F6F8F9; --color-neutral-background-weak-hover: #EEF1F3; --color-neutral-border: #00000033; --color-neutral-border-medium: #0000007F; --color-neutral-border-strong: #181C1F; --color-neutral-border-weak: #00000019; --color-neutral-content: #333D42; --color-neutral-content-disabled: #D6D6D6; --color-neutral-content-strong: #181C1F; --color-neutral-content-weak: #5C6C74; --color-offline: #767676; --color-online: #01A816; --color-opacity-08: #13131314; --color-opacity-50: #00000080; --color-opacity-highlight: linear-gradient(#0A2F6C1a, var(--color-tone-6)); --color-pizzaRed: #ef5350; --color-primary: #115BCA; --color-primary-background: #0A449B; --color-primary-background-hover: #0A2F6C; --color-primary-background-selected: #0A1A3F; --color-primary-border: #0A449B; --color-primary-border-hover: #0A2F6C; --color-primary-hover: #0A449B; --color-primary-onBackground: #FFFFFF; --color-primary-onBackground-selected: #FFFFFF; --color-primary-plain: #0A449B; --color-primary-plain-hover: #0A2F6C; --color-primary-plain-visited: #7600A3; --color-primary-visited: #9B00D4; --color-scrim: #00000099; --color-scrim-background: #00000099; --color-scrim-background-strong: #000000CC; --color-scrim-gradient: linear-gradient(180deg, #00000000, #0000008a 60%, #00000099 100%); --color-scrim-strong: #000000cc; --color-secondary: #21272A; --color-secondary-background: #E5EBEE; --color-secondary-background-hover: #DBE4E9; --color-secondary-background-selected: #C9D7DE; --color-secondary-hover: #000000; --color-secondary-onBackground: #000000; --color-secondary-plain: #181C1F; --color-secondary-plain-hover: #000000; --color-secondary-plain-weak: #5C6C74; --color-secondary-weak: #576F76; --color-success-background: #008A10; --color-success-background-hover: #016E0B; --color-success-content: #016E0B; --color-success-hover: #005306; --color-success-onBackground: #FFFFFF; --color-success-plain: #016E0B; --color-success-plain-hover: #005306; --color-tone-1: #131313; --color-tone-2: #434343; --color-tone-3: #ACACAC; --color-tone-4: #E4E4E4; --color-tone-5: #F2F2F2; --color-tone-6: #F8F8F8; --color-tone-7: #ffffff; --color-transparent-background-hover: #7487911a; --color-ui-canvas: var(--color-tone-5); --color-ui-modalbackground: var(--color-neutral-background-strong); --color-upvote-background: #D93900; --color-upvote-background-disabled: rgba(217, 57, 0, 0.3); --color-upvote-background-hover: #AE2C00; --color-upvote-content: #AE2C00; --color-upvote-content-weak: var(--color-global-brand-orangered); --color-upvote-disabled: #AE2C004d; --color-upvote-onBackground: #FFFFFF; --color-upvote-onStrongScrim: #FF895D; --color-upvote-onStrongScrim-disabled: rgba(255, 137, 93, 0.3); --color-upvote-onStrongScrim-weaker: #FF4500; --color-upvote-plain: #AE2C00; --color-upvote-plain-disabled: rgba(174, 44, 0, 0.3); --color-upvote-plain-weaker: #FF4500; --color-warning-background: #B78800; --color-warning-background-hover: #977000; --color-warning-content: #785800; --color-warning-content-hover: #5B4200; --color-warning-onBackground: #000000; --color-a-default: var(--color-primary); --color-a-hover: var(--color-primary-hover); --color-a-visited: var(--color-primary-visited); --color-banner-plain: var(--color-neutral-background-strong); --color-banner-plain-inverted: var(--color-neutral-content-strong); --color-banner-error: var(--color-danger-background); --color-banner-caution: var(--color-warning-background); --color-banner-success: var(--color-success-background); --color-banner-brand: var(--color-brand-background); --color-banner-plain-text: var(--color-neutral-content); --color-banner-plain-inverted-text: var(--color-neutral-background-weak); --color-banner-error-text: var(--color-danger-onBackground); --color-banner-caution-text: var(--color-warning-onBackground); --color-banner-caution-hover: var(--color-warning-background-hover); --color-banner-success-text: var(--color-success-onBackground); --color-banner-brand-text: var(--color-brand-onBackground); --color-button-overlay-focus: transparent; --color-button-overlay-active: transparent; --color-button-border-width: tomato; --color-button-border-width-activated: tomato; --color-button-primary-background-hover: var(--color-primary-background-hover); --color-button-primary-background-activated: var(--color-primary-background-selected); --color-button-primary-background-disabled: var(--color-interactive-background-disabled); --color-button-primary-border-hover: var(--color-primary-background); --color-button-primary-border-active: var(--color-primary-background-hover); --color-button-primary-text-disabled: var(--color-interactive-content-disabled); --color-button-primary-text-activated: var(--color-primary-onBackground-selected); --color-button-secondary-background: var(--color-secondary-background); --color-button-secondary-background-focus: var(--color-secondary-background); --color-button-secondary-background-hover: var(--color-secondary-background-hover); --color-button-secondary-background-disabled: var(--color-interactive-background-disabled); --color-button-secondary-background-activated: var(--color-secondary-background-selected); --color-button-secondary-border: transparent; --color-button-secondary-border-hover: var(--color-secondary-background); --color-button-secondary-border-active: var(--color-secondary-background-hover); --color-button-secondary-border-activated: transparent; --color-button-secondary-border-disabled: transparent; --color-button-secondary-text: var(--color-secondary-onBackground); --color-button-secondary-text-disabled: var(--color-interactive-content-disabled); --color-button-secondary-text-activated: var(--color-secondary-onBackground); --color-button-tertiary-background: transparent; --color-button-tertiary-background-focus: transparent; --color-button-tertiary-background-hover: var(--color-secondary-background-hover); --color-button-tertiary-background-disabled: transparent; --color-button-tertiary-background-activated: var(--color-neutral-content); --color-button-tertiary-border-hover: var(--color-secondary-background); --color-button-tertiary-border-active: var(--color-secondary-background-hover); --color-button-tertiary-text: var(--color-neutral-content-strong); --color-button-tertiary-text-disabled: var(--color-neutral-content-disabled); --color-button-tertiary-text-activated: var(--color-neutral-background); --color-button-plain-background-hover: var(--color-secondary-background-hover); --color-button-plain-background-disabled: transparent; --color-button-plain-background-activated: var(--color-secondary-background-selected); --color-button-plain-border-hover: var(--color-secondary-background); --color-button-plain-border-active: var(--color-secondary-background-hover); --color-button-plain-text: var(--color-secondary-plain); --color-button-plain-text-hover: var(--color-secondary-plain-hover); --color-button-plain-text-disabled: var(--color-interactive-content-disabled); --color-button-plain-text-activated: var(--color-secondary-onBackground); --color-button-primary-border-activated: var(--color-primary-background); --color-button-plain-text-weak: var(--color-secondary-plain-weak); --color-button-plain-inverted-background-activated: var(--color-neutral-content); --color-button-plain-inverted-text-activated: var(--color-neutral-background); --color-button-media-border-color-activated: var(--color-media-border-selected); --color-button-favorite-text: var(--color-favorite); --color-button-caution-background: var(--color-caution-background); --color-button-caution-background-hover: var(--color-caution-background-hover); --color-button-caution-background-disabled: var(--color-interactive-background-disabled); --color-button-caution-text: var(--color-caution-onBackground); --color-divider-default: var(--color-neutral-border); --color-input-secondary: var(--color-secondary-background); --color-input-secondary-hover: var(--color-secondary-background-hover); --color-input-border: transparent; --color-input-bordered: transparent; --color-input-bordered-hover: var(--color-neutral-background-hover); --color-input-secondary-text: var(--color-secondary-onBackground); --color-input-bordered-text: var(--color-secondary-plain); --color-input-helper-text: var(--color-neutral-content-weak); --color-input-pressed: var(--color-interactive-pressed); --color-input-radio: var(--color-secondary-plain-weak); --color-input-radio-hover: var(--color-neutral-content-strong); --color-label-default: var(--color-neutral-content-weak); --color-shimmer-background: #00000008; --color-shimmer-gradient-overlay: linear-gradient(to right, #00000000, #00000005 20%, #0000000f 50%, #00000008 70%, #00000000 100%); --color-switch-input-background-pressed-scrim: var(--color-interactive-pressed); --color-switch-input-background-handle: var(--color-global-white); --color-switch-input-background-handle-disabled: var(--color-secondary-background); --color-switch-input-background-default: var(--color-secondary-background); --color-switch-input-background-default-hover: var(--color-secondary-background-hover); --color-switch-input-background-default-disabled: var(--color-interactive-background-disabled); --color-switch-input-background-checked: var(--color-primary-background); --color-switch-input-background-checked-hover: var(--color-primary-background-hover); --color-switch-input-background-checked-disabled: var(--color-interactive-content-disabled); --color-tooltip-bg-neutral: var(--color-neutral-background-strong); --color-tooltip-text-neutral: var(--color-neutral-content); --color-tooltip-bg-inverted: var(--color-neutral-content); --color-tooltip-text-inverted: var(--color-neutral-background); --color-tooltip-bg-primary: var(--color-primary-background); --color-tooltip-text-primary: var(--color-primary-onBackground); --elevation-sm-inset: inset 0 0.0625rem 0.125rem 0 #00000021; --elevation-button-focus: var(--elevation-focus-ring); --elevation-switch-input-default-inset: var(--elevation-sm-inset); } @media (prefers-color-scheme: dark) { :root:not(.theme-light) .theme-beta, :root:not(.theme-light).theme-beta { --color-ai-background-weaker: #00382B; --color-ai-plain: #01A484; --color-ai-plain-hover: #00C29D; --color-avatar-gradient: linear-gradient(0deg, #48545Bff, #181C1Fff 75%); --color-brand-background: #D93900; --color-brand-background-hover: #AE2C00; --color-brand-onBackground: #FFFFFF; --color-caution-background: #D8A100; --color-caution-background-hover: #FFBF0B; --color-caution-onBackground: #000000; --color-caution-plain: #FFBF0B; --color-caution-plain-hover: #FFE284; --color-danger-background: #BC0117; --color-danger-background-disabled: #340F05; --color-danger-background-hover: #EB001F; --color-danger-background-weaker: #650405; --color-danger-content: #FF4F40; --color-danger-content-hover: #FF8773; --color-danger-onBackground: #FFFFFF; --color-danger-plain: #FF8773; --color-danger-plain-hover: #FDB3A4; --color-downvote-background: #6A5CFF; --color-downvote-background-disabled: rgba(106, 92, 255, 0.3); --color-downvote-background-hover: #523DFF; --color-downvote-content: #9580FF; --color-downvote-content-weak: #6A5CFF; --color-downvote-disabled: #9580FF4d; --color-downvote-onBackground: #FFFFFF; --color-downvote-onStrongScrim: #B29FFF; --color-downvote-onStrongScrim-disabled: rgba(178, 159, 255, 0.3); --color-downvote-onStrongScrim-weaker: #9580FF; --color-downvote-plain: #9580FF; --color-downvote-plain-disabled: rgba(149, 128, 255, 0.3); --color-downvote-plain-weaker: #6A5CFF; --color-elevation-large1: #0000007F; --color-elevation-large2: #00000033; --color-elevation-medium1: #0000007F; --color-elevation-medium2: #00000033; --color-elevation-small: #00000054; --color-elevation-xsmall: #000000AA; --color-favorite: #B78800; --color-global-admin: #D93900; --color-global-black: #000000; --color-global-brand-orangered: #FF4500; --color-global-focus: #007FAE; --color-global-gold: #D8A100; --color-global-moderator: #008A10; --color-global-nsfw: #DE019F; --color-global-offline: #667780; --color-global-online: #00C61C; --color-global-orangered: #FF4500; --color-global-stars: #D8A100; --color-global-white: #FFFFFF; --color-interactive-background-disabled: #FFFFFF0C; --color-interactive-content-disabled: #FFFFFF3F; --color-interactive-focused: #007FAE; --color-interactive-pressed: #FFFFFF26; --color-inverted-interactive-background-disabled: #0000000C; --color-inverted-interactive-content-disabled: #0000003F; --color-inverted-interactive-pressed: #00000026; --color-inverted-neutral-background: #FFFFFF; --color-inverted-neutral-background-hover: #F6F8F9; --color-inverted-neutral-border: #00000033; --color-inverted-neutral-content: #333D42; --color-inverted-neutral-content-strong: #181C1F; --color-inverted-secondary-background: #E5EBEE; --color-inverted-secondary-background-hover: #DBE4E9; --color-inverted-secondary-background-selected: #C9D7DE; --color-inverted-secondary-onBackground: #000000; --color-inverted-secondary-plain: #181C1F; --color-inverted-secondary-plain-hover: #000000; --color-media-background: rgba(0, 0, 0, 0.6); --color-media-background-hover: rgba(0, 0, 0, 0.8); --color-media-background-selected: rgba(0, 0, 0, 0.8); --color-media-border-selected: #FFFFFF; --color-media-border-weak: #FFFFFF19; --color-media-onBackground: #FFFFFF; --color-media-onBackground-disabled: #FFFFFF3F; --color-media-onBackground-weak: #E5EBEE; --color-neutral-background: #0E1113; --color-neutral-background-container: #181C1F; --color-neutral-background-container-hover: #21272A; --color-neutral-background-container-strong: #21272A; --color-neutral-background-container-strong-hover: #2A3236; --color-neutral-background-gilded: #181C1F; --color-neutral-background-gilded-hover: #21272A; --color-neutral-background-hover: #181C1F; --color-neutral-background-medium: #131313; --color-neutral-background-pinned: #0E1113; --color-neutral-background-selected: #2A3236; --color-neutral-background-strong: #181C1F; --color-neutral-background-strong-hover: #21272A; --color-neutral-background-weak: #000000; --color-neutral-background-weak-hover: #0E1113; --color-neutral-border: #FFFFFF33; --color-neutral-border-medium: #FFFFFF7F; --color-neutral-border-strong: #F6F8F9; --color-neutral-border-weak: #FFFFFF19; --color-neutral-content: #B7CAD4; --color-neutral-content-disabled: #303030; --color-neutral-content-strong: #EEF1F3; --color-neutral-content-weak: #8BA2AD; --color-offline: #767676; --color-online: #01A816; --color-opacity-50: #F2F2F280; --color-pizzaRed: #c62828; --color-primary: #648EFC; --color-primary-background: #115BCA; --color-primary-background-hover: #1870F4; --color-primary-background-selected: #648EFC; --color-primary-border: #648EFC; --color-primary-border-hover: #90A9FD; --color-primary-hover: #90A9FD; --color-primary-onBackground: #FFFFFF; --color-primary-onBackground-selected: #000000; --color-primary-plain: #648EFC; --color-primary-plain-hover: #90A9FD; --color-primary-plain-visited: #CF5FFF; --color-primary-visited: #CF5FFF; --color-scrim-background: #00000099; --color-scrim-background-strong: #000000CC; --color-secondary: #DBE4E9; --color-secondary-background: #2A3236; --color-secondary-background-hover: #333D42; --color-secondary-background-selected: #3D494E; --color-secondary-hover: #ffffff; --color-secondary-onBackground: #FFFFFF; --color-secondary-plain: #DBE4E9; --color-secondary-plain-hover: #FFFFFF; --color-secondary-plain-weak: #8BA2AD; --color-secondary-weak: #748791; --color-success-background: #016E0B; --color-success-background-hover: #008A10; --color-success-content: #01A816; --color-success-hover: #00C61C; --color-success-onBackground: #FFFFFF; --color-success-plain: #00C61C; --color-success-plain-hover: #58E15B; --color-tone-1: #F2F2F2; --color-tone-2: #ACACAC; --color-tone-3: #434343; --color-tone-4: #303030; --color-tone-5: #1E1E1E; --color-tone-6: #131313; --color-tone-7: #080808; --color-transparent-background-hover: #6677801a; --color-ui-canvas: #080808; --color-ui-modalbackground: var(--color-neutral-background-strong); --color-upvote-background: #D93900; --color-upvote-background-disabled: rgba(217, 57, 0, 0.3); --color-upvote-background-hover: #AE2C00; --color-upvote-content: #FF4500; --color-upvote-content-weak: var(--color-global-brand-orangered); --color-upvote-disabled: #FF45004d; --color-upvote-onBackground: #FFFFFF; --color-upvote-onStrongScrim: #FF895D; --color-upvote-onStrongScrim-disabled: rgba(255, 137, 93, 0.3); --color-upvote-onStrongScrim-weaker: #FF4500; --color-upvote-plain: #FF895D; --color-upvote-plain-disabled: rgba(255, 137, 93, 0.3); --color-upvote-plain-weaker: #FF4500; --color-warning-background: #B78800; --color-warning-background-hover: #D8A100; --color-warning-content: #B78800; --color-warning-content-hover: #D8A100; --color-warning-onBackground: #000000; --color-button-primary-border-activated: transparent; --color-button-plain-inverted-activated-text: var(--color-neutral-background); --color-input-radio-hover: var(--color-secondary-plain); --color-shimmer-background: #ffffff08; --color-shimmer-gradient-overlay: linear-gradient(to right, #ffffff00, #ffffff05 20%, #ffffff0f 50%, #ffffff08 70%, #ffffff00 100%); } } .theme-dark .theme-beta, .theme-dark.theme-beta { --color-ai-background-weaker: #00382B; --color-ai-plain: #01A484; --color-ai-plain-hover: #00C29D; --color-avatar-gradient: linear-gradient(0deg, #48545Bff, #181C1Fff 75%); --color-brand-background: #D93900; --color-brand-background-hover: #AE2C00; --color-brand-onBackground: #FFFFFF; --color-caution-background: #D8A100; --color-caution-background-hover: #FFBF0B; --color-caution-onBackground: #000000; --color-caution-plain: #FFBF0B; --color-caution-plain-hover: #FFE284; --color-danger-background: #BC0117; --color-danger-background-disabled: #340F05; --color-danger-background-hover: #EB001F; --color-danger-background-weaker: #650405; --color-danger-content: #FF4F40; --color-danger-content-hover: #FF8773; --color-danger-onBackground: #FFFFFF; --color-danger-plain: #FF8773; --color-danger-plain-hover: #FDB3A4; --color-downvote-background: #6A5CFF; --color-downvote-background-disabled: rgba(106, 92, 255, 0.3); --color-downvote-background-hover: #523DFF; --color-downvote-content: #9580FF; --color-downvote-content-weak: #6A5CFF; --color-downvote-disabled: #9580FF4d; --color-downvote-onBackground: #FFFFFF; --color-downvote-onStrongScrim: #B29FFF; --color-downvote-onStrongScrim-disabled: rgba(178, 159, 255, 0.3); --color-downvote-onStrongScrim-weaker: #9580FF; --color-downvote-plain: #9580FF; --color-downvote-plain-disabled: rgba(149, 128, 255, 0.3); --color-downvote-plain-weaker: #6A5CFF; --color-elevation-large1: #0000007F; --color-elevation-large2: #00000033; --color-elevation-medium1: #0000007F; --color-elevation-medium2: #00000033; --color-elevation-small: #00000054; --color-elevation-xsmall: #000000AA; --color-favorite: #B78800; --color-global-admin: #D93900; --color-global-black: #000000; --color-global-brand-orangered: #FF4500; --color-global-focus: #007FAE; --color-global-gold: #D8A100; --color-global-moderator: #008A10; --color-global-nsfw: #DE019F; --color-global-offline: #667780; --color-global-online: #00C61C; --color-global-orangered: #FF4500; --color-global-stars: #D8A100; --color-global-white: #FFFFFF; --color-interactive-background-disabled: #FFFFFF0C; --color-interactive-content-disabled: #FFFFFF3F; --color-interactive-focused: #007FAE; --color-interactive-pressed: #FFFFFF26; --color-inverted-interactive-background-disabled: #0000000C; --color-inverted-interactive-content-disabled: #0000003F; --color-inverted-interactive-pressed: #00000026; --color-inverted-neutral-background: #FFFFFF; --color-inverted-neutral-background-hover: #F6F8F9; --color-inverted-neutral-border: #00000033; --color-inverted-neutral-content: #333D42; --color-inverted-neutral-content-strong: #181C1F; --color-inverted-secondary-background: #E5EBEE; --color-inverted-secondary-background-hover: #DBE4E9; --color-inverted-secondary-background-selected: #C9D7DE; --color-inverted-secondary-onBackground: #000000; --color-inverted-secondary-plain: #181C1F; --color-inverted-secondary-plain-hover: #000000; --color-media-background: rgba(0, 0, 0, 0.6); --color-media-background-hover: rgba(0, 0, 0, 0.8); --color-media-background-selected: rgba(0, 0, 0, 0.8); --color-media-border-selected: #FFFFFF; --color-media-border-weak: #FFFFFF19; --color-media-onBackground: #FFFFFF; --color-media-onBackground-disabled: #FFFFFF3F; --color-media-onBackground-weak: #E5EBEE; --color-neutral-background: #0E1113; --color-neutral-background-container: #181C1F; --color-neutral-background-container-hover: #21272A; --color-neutral-background-container-strong: #21272A; --color-neutral-background-container-strong-hover: #2A3236; --color-neutral-background-gilded: #181C1F; --color-neutral-background-gilded-hover: #21272A; --color-neutral-background-hover: #181C1F; --color-neutral-background-medium: #131313; --color-neutral-background-pinned: #0E1113; --color-neutral-background-selected: #2A3236; --color-neutral-background-strong: #181C1F; --color-neutral-background-strong-hover: #21272A; --color-neutral-background-weak: #000000; --color-neutral-background-weak-hover: #0E1113; --color-neutral-border: #FFFFFF33; --color-neutral-border-medium: #FFFFFF7F; --color-neutral-border-strong: #F6F8F9; --color-neutral-border-weak: #FFFFFF19; --color-neutral-content: #B7CAD4; --color-neutral-content-disabled: #303030; --color-neutral-content-strong: #EEF1F3; --color-neutral-content-weak: #8BA2AD; --color-offline: #767676; --color-online: #01A816; --color-opacity-50: #F2F2F280; --color-pizzaRed: #c62828; --color-primary: #648EFC; --color-primary-background: #115BCA; --color-primary-background-hover: #1870F4; --color-primary-background-selected: #648EFC; --color-primary-border: #648EFC; --color-primary-border-hover: #90A9FD; --color-primary-hover: #90A9FD; --color-primary-onBackground: #FFFFFF; --color-primary-onBackground-selected: #000000; --color-primary-plain: #648EFC; --color-primary-plain-hover: #90A9FD; --color-primary-plain-visited: #CF5FFF; --color-primary-visited: #CF5FFF; --color-scrim-background: #00000099; --color-scrim-background-strong: #000000CC; --color-secondary: #DBE4E9; --color-secondary-background: #2A3236; --color-secondary-background-hover: #333D42; --color-secondary-background-selected: #3D494E; --color-secondary-hover: #ffffff; --color-secondary-onBackground: #FFFFFF; --color-secondary-plain: #DBE4E9; --color-secondary-plain-hover: #FFFFFF; --color-secondary-plain-weak: #8BA2AD; --color-secondary-weak: #748791; --color-success-background: #016E0B; --color-success-background-hover: #008A10; --color-success-content: #01A816; --color-success-hover: #00C61C; --color-success-onBackground: #FFFFFF; --color-success-plain: #00C61C; --color-success-plain-hover: #58E15B; --color-tone-1: #F2F2F2; --color-tone-2: #ACACAC; --color-tone-3: #434343; --color-tone-4: #303030; --color-tone-5: #1E1E1E; --color-tone-6: #131313; --color-tone-7: #080808; --color-transparent-background-hover: #6677801a; --color-ui-canvas: #080808; --color-ui-modalbackground: var(--color-neutral-background-strong); --color-upvote-background: #D93900; --color-upvote-background-disabled: rgba(217, 57, 0, 0.3); --color-upvote-background-hover: #AE2C00; --color-upvote-content: #FF4500; --color-upvote-content-weak: var(--color-global-brand-orangered); --color-upvote-disabled: #FF45004d; --color-upvote-onBackground: #FFFFFF; --color-upvote-onStrongScrim: #FF895D; --color-upvote-onStrongScrim-disabled: rgba(255, 137, 93, 0.3); --color-upvote-onStrongScrim-weaker: #FF4500; --color-upvote-plain: #FF895D; --color-upvote-plain-disabled: rgba(255, 137, 93, 0.3); --color-upvote-plain-weaker: #FF4500; --color-warning-background: #B78800; --color-warning-background-hover: #D8A100; --color-warning-content: #B78800; --color-warning-content-hover: #D8A100; --color-warning-onBackground: #000000; --color-button-primary-border-activated: transparent; --color-button-plain-inverted-activated-text: var(--color-neutral-background); --color-input-radio-hover: var(--color-secondary-plain); --color-shimmer-background: #ffffff08; --color-shimmer-gradient-overlay: linear-gradient(to right, #ffffff00, #ffffff05 20%, #ffffff0f 50%, #ffffff08 70%, #ffffff00 100%); } .theme-rpl, .theme-light.theme-rpl { --spacer-a-px: 0.125rem; --spacer-button-lg-px: var(--spacer-md); --spacer-button-md-px: var(--spacer-md); --spacer-button-sm-px: var(--spacer-sm); --spacer-input-padding-left: var(--spacer-md); --spacer-input-padding-top: var(--spacer-2xs); --spacer-label-default: var(--spacer-md); --spacer-switch-input-active-pl: var(--spacer-xs); --size-banner-height: var(--size-rem40); --size-button-lg-h: var(--size-2xl); --size-button-md-h: 2.5rem; --size-button-sm-h: var(--size-xl); --size-button-xs-h: var(--size-lg); --size-switch-input-h: var(--size-xl); --size-switch-input-w: var(--size-2xl); --line-a-focus: var(--line-md); --line-a-outline-moz: 0px; --line-a-outline-wb: 0px; --line-button-lg-border: var(--line-sm); --line-button-md-border: var(--line-sm); --line-button-sm-border: var(--line-sm); --line-button-xs-border: var(--line-sm); --line-button-border-activated: var(--line-lg); --line-input-border: var(--line-lg); --radius-md: 1.25rem; --radius-accordion-size: 0px; --font-10: normal undefined null / null var(--font-sans); --font-12: normal undefined null / null var(--font-sans); --font-14: normal undefined null / null var(--font-sans); --font-16: normal undefined null / null var(--font-sans); --font-18: normal undefined null / null var(--font-sans); --font-20: normal undefined null / null var(--font-sans); --font-24: normal undefined null / null var(--font-sans); --font-32: normal undefined null / null var(--font-sans); --font-48: normal undefined null / null var(--font-sans); --font-64: normal undefined null / null var(--font-sans); --font-title-h0: var(--font-64); --font-title-h1: var(--font-32); --font-title-h2: var(--font-24); --font-title-h3: var(--font-18); --font-title-h4: var(--font-16); --font-title-h5: var(--font-14); --font-title-h6: var(--font-12); --font-14-20-regular: normal 400 0.875rem / 1.25rem var(--font-sans); --font-14-20-semibold: normal 600 0.875rem / 1.25rem var(--font-sans); --font-16-20-regular: normal 400 1rem / 1.25rem var(--font-sans); --font-12-16-regular: normal 400 0.75rem / 1rem var(--font-sans); --font-12-16-semibold: normal 600 0.75rem / 1rem var(--font-sans); --font-button-lg: var(--font-14-20-semibold); --font-button-md: var(--font-14-20-semibold); --font-button-sm: var(--font-12-16-semibold); --font-label-default: var(--font-12-16-regular); --misc-accordion-border: 0; --misc-accordion-open-list-style-type: none; --misc-accordion-closed-list-style-type: none; --misc-divider-margin: 0; --misc-label-text-transform: capitalize; --misc-label-letter-spacing: initial; --blur-sm: 0.25rem; --blur-normal: 0.5rem; --blur-md: 0.75rem; --blur-lg: 1rem; --blur-xl: 1.5rem; --blur-2xl: 2.5rem; --blur-3xl: 4rem; --color-action-downvote: #6A5CFF; --color-action-upvote: #D93900; --color-ai-background-weaker: #E7FDF5; --color-ai-plain: #006C56; --color-ai-plain-hover: #015140; --color-alert-caution: #977000; --color-avatar-gradient: linear-gradient(0deg, #97AFBCff, #ffffffff 75%); --color-avatar-media-gradient: linear-gradient(0deg, #00000099, #181C1Fff 75%); --color-brand-background: #D93900; --color-brand-background-hover: #AE2C00; --color-brand-gradient-active: linear-gradient(180deg, #cd3700ff, #db3b00ff 68%, #D93900ff 100%); --color-brand-gradient-active-highlight: linear-gradient(83deg, #db3f0000 80%, #D93900ff 100%); --color-brand-gradient-default: linear-gradient(180deg, #D93900ff, #db3b00ff 30%, #AE2C00ff 100%); --color-brand-gradient-default-highlight: linear-gradient(258deg, #db3f0000 80%, #D93900ff 100%); --color-brand-gradient-hover: linear-gradient(180deg, #e23d00ff 15%, #cb3600ff 49%, #b43000ff 100%); --color-brand-gradient-hover-highlight: linear-gradient(323deg, #cb360000 65%, #cb3600ff 100%); --color-brand-onBackground: #FFFFFF; --color-category-live: #D93900; --color-category-nsfw: #DE019F; --color-category-spoiler: var(--color-tone-1); --color-caution-background: #FFBF0B; --color-caution-background-hover: #D8A100; --color-caution-onBackground: #000000; --color-caution-plain: #785800; --color-caution-plain-hover: #5B4200; --color-danger-background: #EB001F; --color-danger-background-disabled: #FDB3A4; --color-danger-background-hover: #BC0117; --color-danger-background-weaker: #FBDBD4; --color-danger-content: #BC0117; --color-danger-content-default: #ffffff; --color-danger-content-hover: #90000F; --color-danger-onBackground: #FFFFFF; --color-danger-plain: #BC0117; --color-danger-plain-hover: #90000F; --color-downvote-background: #6A5CFF; --color-downvote-background-disabled: rgba(106, 92, 255, 0.3); --color-downvote-background-hover: #523DFF; --color-downvote-content: #523DFF; --color-downvote-content-weak: #6A5CFF; --color-downvote-disabled: #523DFF4d; --color-downvote-onBackground: #FFFFFF; --color-downvote-onStrongScrim: #B29FFF; --color-downvote-onStrongScrim-disabled: rgba(178, 159, 255, 0.3); --color-downvote-onStrongScrim-weaker: #9580FF; --color-downvote-plain: #523DFF; --color-downvote-plain-disabled: rgba(82, 61, 255, 0.3); --color-downvote-plain-weaker: #6A5CFF; --color-elevation-large1: #0000003F; --color-elevation-large2: #00000026; --color-elevation-medium1: #0000003F; --color-elevation-medium2: #00000019; --color-elevation-small: #00000026; --color-elevation-xsmall: #0000003F; --color-favorite: #977000; --color-global-admin: #D93900; --color-global-alienblue: #1870F4; --color-global-black: #000000; --color-global-brand-orangered: #FF4500; --color-global-darkblue: #2A3236; --color-global-focus: #029DD5; --color-global-gold: #B78800; --color-global-moderator: #008A10; --color-global-nsfw: #DE019F; --color-global-offline: #667780; --color-global-online: #00C61C; --color-global-orangered: #FF4500; --color-global-stars: #977000; --color-global-white: #FFFFFF; --color-gradient-media: linear-gradient(180deg, #00000000, #0000008a 60%, #00000099 100%); --color-gradient-media-strong: linear-gradient(180deg, #00000000, #000000cc 60%, #000000e6 100%); --color-identity-admin: #D93900; --color-identity-coins: #B78800; --color-identity-moderator: #008A10; --color-identity-self: #01876D; --color-interactive-background-disabled: #0000000C; --color-interactive-content-disabled: #0000003F; --color-interactive-focused: #007FAE; --color-interactive-pressed: #00000026; --color-inverted-interactive-background-disabled: #FFFFFF0C; --color-inverted-interactive-content-disabled: #FFFFFF3F; --color-inverted-interactive-pressed: #FFFFFF26; --color-inverted-neutral-background: #0E1113; --color-inverted-neutral-background-hover: #181C1F; --color-inverted-neutral-border: #FFFFFF33; --color-inverted-neutral-content: #B7CAD4; --color-inverted-neutral-content-strong: #EEF1F3; --color-inverted-secondary-background: #2A3236; --color-inverted-secondary-background-hover: #333D42; --color-inverted-secondary-background-selected: #3D494E; --color-inverted-secondary-onBackground: #FFFFFF; --color-inverted-secondary-plain: #DBE4E9; --color-inverted-secondary-plain-hover: #FFFFFF; --color-media-background: rgba(0, 0, 0, 0.6); --color-media-background-hover: rgba(0, 0, 0, 0.8); --color-media-background-selected: rgba(0, 0, 0, 0.8); --color-media-border-selected: #FFFFFF; --color-media-border-weak: #FFFFFF19; --color-media-onBackground: #FFFFFF; --color-media-onBackground-disabled: #FFFFFF3F; --color-media-onBackground-weak: #E5EBEE; --color-media-onbackground: #ffffff; --color-media-onbackground-disabled: #ffffff40; --color-media-onbackground-weak: #B7CAD4; --color-neutral-background: #FFFFFF; --color-neutral-background-container: #F6F8F9; --color-neutral-background-container-hover: #EEF1F3; --color-neutral-background-container-strong: #EEF1F3; --color-neutral-background-container-strong-hover: #E5EBEE; --color-neutral-background-gilded: #FFF9E0; --color-neutral-background-gilded-hover: #FFF3C0; --color-neutral-background-hover: #F6F8F9; --color-neutral-background-medium: #F8F8F8; --color-neutral-background-pinned: #FFFFFF; --color-neutral-background-selected: #E5EBEE; --color-neutral-background-strong: #FFFFFF; --color-neutral-background-strong-hover: #F6F8F9; --color-neutral-background-weak: #F6F8F9; --color-neutral-background-weak-hover: #EEF1F3; --color-neutral-border: #00000033; --color-neutral-border-medium: #0000007F; --color-neutral-border-strong: #181C1F; --color-neutral-border-weak: #00000019; --color-neutral-content: #333D42; --color-neutral-content-disabled: #D6D6D6; --color-neutral-content-strong: #181C1F; --color-neutral-content-weak: #5C6C74; --color-offline: #767676; --color-online: #01A816; --color-opacity-08: #13131314; --color-opacity-50: #00000080; --color-opacity-highlight: linear-gradient(#0A2F6C1a, var(--color-tone-6)); --color-pizzaRed: #ef5350; --color-primary: #115BCA; --color-primary-background: #0A449B; --color-primary-background-hover: #0A2F6C; --color-primary-background-selected: #0A1A3F; --color-primary-border: #0A449B; --color-primary-border-hover: #0A2F6C; --color-primary-hover: #0A449B; --color-primary-onBackground: #FFFFFF; --color-primary-onBackground-selected: #FFFFFF; --color-primary-plain: #0A449B; --color-primary-plain-hover: #0A2F6C; --color-primary-plain-visited: #7600A3; --color-primary-visited: #9B00D4; --color-scrim: #00000099; --color-scrim-background: #00000099; --color-scrim-background-strong: #000000CC; --color-scrim-gradient: linear-gradient(180deg, #00000000, #0000008a 60%, #00000099 100%); --color-scrim-strong: #000000cc; --color-secondary: #21272A; --color-secondary-background: #E5EBEE; --color-secondary-background-hover: #DBE4E9; --color-secondary-background-selected: #C9D7DE; --color-secondary-hover: #000000; --color-secondary-onBackground: #000000; --color-secondary-plain: #181C1F; --color-secondary-plain-hover: #000000; --color-secondary-plain-weak: #5C6C74; --color-secondary-weak: #576F76; --color-success-background: #008A10; --color-success-background-hover: #016E0B; --color-success-content: #016E0B; --color-success-hover: #005306; --color-success-onBackground: #FFFFFF; --color-success-plain: #016E0B; --color-success-plain-hover: #005306; --color-tone-1: #131313; --color-tone-2: #434343; --color-tone-3: #ACACAC; --color-tone-4: #E4E4E4; --color-tone-5: #F2F2F2; --color-tone-6: #F8F8F8; --color-tone-7: #ffffff; --color-transparent-background-hover: #7487911a; --color-ui-canvas: var(--color-tone-5); --color-ui-modalbackground: var(--color-neutral-background-strong); --color-upvote-background: #D93900; --color-upvote-background-disabled: rgba(217, 57, 0, 0.3); --color-upvote-background-hover: #AE2C00; --color-upvote-content: #AE2C00; --color-upvote-content-weak: var(--color-global-brand-orangered); --color-upvote-disabled: #AE2C004d; --color-upvote-onBackground: #FFFFFF; --color-upvote-onStrongScrim: #FF895D; --color-upvote-onStrongScrim-disabled: rgba(255, 137, 93, 0.3); --color-upvote-onStrongScrim-weaker: #FF4500; --color-upvote-plain: #AE2C00; --color-upvote-plain-disabled: rgba(174, 44, 0, 0.3); --color-upvote-plain-weaker: #FF4500; --color-warning-background: #B78800; --color-warning-background-hover: #977000; --color-warning-content: #785800; --color-warning-content-hover: #5B4200; --color-warning-onBackground: #000000; --color-a-default: var(--color-primary); --color-a-hover: var(--color-primary-hover); --color-a-visited: var(--color-primary-visited); --color-banner-plain: var(--color-neutral-background-strong); --color-banner-plain-inverted: var(--color-neutral-content-strong); --color-banner-error: var(--color-danger-background); --color-banner-caution: var(--color-warning-background); --color-banner-success: var(--color-success-background); --color-banner-brand: var(--color-brand-background); --color-banner-plain-text: var(--color-neutral-content); --color-banner-plain-inverted-text: var(--color-neutral-background-weak); --color-banner-error-text: var(--color-danger-onBackground); --color-banner-caution-text: var(--color-warning-onBackground); --color-banner-caution-hover: var(--color-warning-background-hover); --color-banner-success-text: var(--color-success-onBackground); --color-banner-brand-text: var(--color-brand-onBackground); --color-button-overlay-focus: transparent; --color-button-overlay-active: transparent; --color-button-border-width: tomato; --color-button-border-width-activated: tomato; --color-button-primary-background-hover: var(--color-primary-background-hover); --color-button-primary-background-activated: var(--color-primary-background-selected); --color-button-primary-background-disabled: var(--color-interactive-background-disabled); --color-button-primary-border-hover: var(--color-primary-background); --color-button-primary-border-active: var(--color-primary-background-hover); --color-button-primary-text-disabled: var(--color-interactive-content-disabled); --color-button-primary-text-activated: var(--color-primary-onBackground-selected); --color-button-secondary-background: var(--color-secondary-background); --color-button-secondary-background-focus: var(--color-secondary-background); --color-button-secondary-background-hover: var(--color-secondary-background-hover); --color-button-secondary-background-disabled: var(--color-interactive-background-disabled); --color-button-secondary-background-activated: var(--color-secondary-background-selected); --color-button-secondary-border: transparent; --color-button-secondary-border-hover: var(--color-secondary-background); --color-button-secondary-border-active: var(--color-secondary-background-hover); --color-button-secondary-border-activated: transparent; --color-button-secondary-border-disabled: transparent; --color-button-secondary-text: var(--color-secondary-onBackground); --color-button-secondary-text-disabled: var(--color-interactive-content-disabled); --color-button-secondary-text-activated: var(--color-secondary-onBackground); --color-button-tertiary-background: transparent; --color-button-tertiary-background-focus: transparent; --color-button-tertiary-background-hover: var(--color-secondary-background-hover); --color-button-tertiary-background-disabled: transparent; --color-button-tertiary-background-activated: var(--color-neutral-content); --color-button-tertiary-border-hover: var(--color-secondary-background); --color-button-tertiary-border-active: var(--color-secondary-background-hover); --color-button-tertiary-text: var(--color-neutral-content-strong); --color-button-tertiary-text-disabled: var(--color-neutral-content-disabled); --color-button-tertiary-text-activated: var(--color-neutral-background); --color-button-plain-background-hover: var(--color-secondary-background-hover); --color-button-plain-background-disabled: transparent; --color-button-plain-background-activated: var(--color-secondary-background-selected); --color-button-plain-border-hover: var(--color-secondary-background); --color-button-plain-border-active: var(--color-secondary-background-hover); --color-button-plain-text: var(--color-secondary-plain); --color-button-plain-text-hover: var(--color-secondary-plain-hover); --color-button-plain-text-disabled: var(--color-interactive-content-disabled); --color-button-plain-text-activated: var(--color-secondary-onBackground); --color-button-primary-border-activated: var(--color-primary-background); --color-button-plain-text-weak: var(--color-secondary-plain-weak); --color-button-plain-inverted-background-activated: var(--color-neutral-content); --color-button-plain-inverted-text-activated: var(--color-neutral-background); --color-button-media-border-color-activated: var(--color-media-border-selected); --color-button-favorite-text: var(--color-favorite); --color-button-caution-background: var(--color-caution-background); --color-button-caution-background-hover: var(--color-caution-background-hover); --color-button-caution-background-disabled: var(--color-interactive-background-disabled); --color-button-caution-text: var(--color-caution-onBackground); --color-divider-default: var(--color-neutral-border); --color-input-secondary: var(--color-secondary-background); --color-input-secondary-hover: var(--color-secondary-background-hover); --color-input-border: transparent; --color-input-bordered: transparent; --color-input-bordered-hover: var(--color-neutral-background-hover); --color-input-secondary-text: var(--color-secondary-onBackground); --color-input-bordered-text: var(--color-secondary-plain); --color-input-helper-text: var(--color-neutral-content-weak); --color-input-pressed: var(--color-interactive-pressed); --color-input-radio: var(--color-secondary-plain-weak); --color-input-radio-hover: var(--color-neutral-content-strong); --color-label-default: var(--color-neutral-content-weak); --color-shimmer-background: #00000008; --color-shimmer-gradient-overlay: linear-gradient(to right, #00000000, #00000005 20%, #0000000f 50%, #00000008 70%, #00000000 100%); --color-switch-input-background-pressed-scrim: var(--color-interactive-pressed); --color-switch-input-background-handle: var(--color-global-white); --color-switch-input-background-handle-disabled: var(--color-secondary-background); --color-switch-input-background-default: var(--color-secondary-background); --color-switch-input-background-default-hover: var(--color-secondary-background-hover); --color-switch-input-background-default-disabled: var(--color-interactive-background-disabled); --color-switch-input-background-checked: var(--color-primary-background); --color-switch-input-background-checked-hover: var(--color-primary-background-hover); --color-switch-input-background-checked-disabled: var(--color-interactive-content-disabled); --color-tooltip-bg-neutral: var(--color-neutral-background-strong); --color-tooltip-text-neutral: var(--color-neutral-content); --color-tooltip-bg-inverted: var(--color-neutral-content); --color-tooltip-text-inverted: var(--color-neutral-background); --color-tooltip-bg-primary: var(--color-primary-background); --color-tooltip-text-primary: var(--color-primary-onBackground); --elevation-sm-inset: inset 0 0.0625rem 0.125rem 0 #00000021; --elevation-button-focus: var(--elevation-focus-ring); --elevation-switch-input-default-inset: var(--elevation-sm-inset); } @media (prefers-color-scheme: dark) { :root:not(.theme-light) .theme-rpl, :root:not(.theme-light).theme-rpl { --color-ai-background-weaker: #00382B; --color-ai-plain: #01A484; --color-ai-plain-hover: #00C29D; --color-avatar-gradient: linear-gradient(0deg, #48545Bff, #181C1Fff 75%); --color-brand-background: #D93900; --color-brand-background-hover: #AE2C00; --color-brand-onBackground: #FFFFFF; --color-caution-background: #D8A100; --color-caution-background-hover: #FFBF0B; --color-caution-onBackground: #000000; --color-caution-plain: #FFBF0B; --color-caution-plain-hover: #FFE284; --color-danger-background: #BC0117; --color-danger-background-disabled: #340F05; --color-danger-background-hover: #EB001F; --color-danger-background-weaker: #650405; --color-danger-content: #FF4F40; --color-danger-content-hover: #FF8773; --color-danger-onBackground: #FFFFFF; --color-danger-plain: #FF8773; --color-danger-plain-hover: #FDB3A4; --color-downvote-background: #6A5CFF; --color-downvote-background-disabled: rgba(106, 92, 255, 0.3); --color-downvote-background-hover: #523DFF; --color-downvote-content: #9580FF; --color-downvote-content-weak: #6A5CFF; --color-downvote-disabled: #9580FF4d; --color-downvote-onBackground: #FFFFFF; --color-downvote-onStrongScrim: #B29FFF; --color-downvote-onStrongScrim-disabled: rgba(178, 159, 255, 0.3); --color-downvote-onStrongScrim-weaker: #9580FF; --color-downvote-plain: #9580FF; --color-downvote-plain-disabled: rgba(149, 128, 255, 0.3); --color-downvote-plain-weaker: #6A5CFF; --color-elevation-large1: #0000007F; --color-elevation-large2: #00000033; --color-elevation-medium1: #0000007F; --color-elevation-medium2: #00000033; --color-elevation-small: #00000054; --color-elevation-xsmall: #000000AA; --color-favorite: #B78800; --color-global-admin: #D93900; --color-global-black: #000000; --color-global-brand-orangered: #FF4500; --color-global-focus: #007FAE; --color-global-gold: #D8A100; --color-global-moderator: #008A10; --color-global-nsfw: #DE019F; --color-global-offline: #667780; --color-global-online: #00C61C; --color-global-orangered: #FF4500; --color-global-stars: #D8A100; --color-global-white: #FFFFFF; --color-interactive-background-disabled: #FFFFFF0C; --color-interactive-content-disabled: #FFFFFF3F; --color-interactive-focused: #007FAE; --color-interactive-pressed: #FFFFFF26; --color-inverted-interactive-background-disabled: #0000000C; --color-inverted-interactive-content-disabled: #0000003F; --color-inverted-interactive-pressed: #00000026; --color-inverted-neutral-background: #FFFFFF; --color-inverted-neutral-background-hover: #F6F8F9; --color-inverted-neutral-border: #00000033; --color-inverted-neutral-content: #333D42; --color-inverted-neutral-content-strong: #181C1F; --color-inverted-secondary-background: #E5EBEE; --color-inverted-secondary-background-hover: #DBE4E9; --color-inverted-secondary-background-selected: #C9D7DE; --color-inverted-secondary-onBackground: #000000; --color-inverted-secondary-plain: #181C1F; --color-inverted-secondary-plain-hover: #000000; --color-media-background: rgba(0, 0, 0, 0.6); --color-media-background-hover: rgba(0, 0, 0, 0.8); --color-media-background-selected: rgba(0, 0, 0, 0.8); --color-media-border-selected: #FFFFFF; --color-media-border-weak: #FFFFFF19; --color-media-onBackground: #FFFFFF; --color-media-onBackground-disabled: #FFFFFF3F; --color-media-onBackground-weak: #E5EBEE; --color-neutral-background: #0E1113; --color-neutral-background-container: #181C1F; --color-neutral-background-container-hover: #21272A; --color-neutral-background-container-strong: #21272A; --color-neutral-background-container-strong-hover: #2A3236; --color-neutral-background-gilded: #181C1F; --color-neutral-background-gilded-hover: #21272A; --color-neutral-background-hover: #181C1F; --color-neutral-background-medium: #131313; --color-neutral-background-pinned: #0E1113; --color-neutral-background-selected: #2A3236; --color-neutral-background-strong: #181C1F; --color-neutral-background-strong-hover: #21272A; --color-neutral-background-weak: #000000; --color-neutral-background-weak-hover: #0E1113; --color-neutral-border: #FFFFFF33; --color-neutral-border-medium: #FFFFFF7F; --color-neutral-border-strong: #F6F8F9; --color-neutral-border-weak: #FFFFFF19; --color-neutral-content: #B7CAD4; --color-neutral-content-disabled: #303030; --color-neutral-content-strong: #EEF1F3; --color-neutral-content-weak: #8BA2AD; --color-offline: #767676; --color-online: #01A816; --color-opacity-50: #F2F2F280; --color-pizzaRed: #c62828; --color-primary: #648EFC; --color-primary-background: #115BCA; --color-primary-background-hover: #1870F4; --color-primary-background-selected: #648EFC; --color-primary-border: #648EFC; --color-primary-border-hover: #90A9FD; --color-primary-hover: #90A9FD; --color-primary-onBackground: #FFFFFF; --color-primary-onBackground-selected: #000000; --color-primary-plain: #648EFC; --color-primary-plain-hover: #90A9FD; --color-primary-plain-visited: #CF5FFF; --color-primary-visited: #CF5FFF; --color-scrim-background: #00000099; --color-scrim-background-strong: #000000CC; --color-secondary: #DBE4E9; --color-secondary-background: #2A3236; --color-secondary-background-hover: #333D42; --color-secondary-background-selected: #3D494E; --color-secondary-hover: #ffffff; --color-secondary-onBackground: #FFFFFF; --color-secondary-plain: #DBE4E9; --color-secondary-plain-hover: #FFFFFF; --color-secondary-plain-weak: #8BA2AD; --color-secondary-weak: #748791; --color-success-background: #016E0B; --color-success-background-hover: #008A10; --color-success-content: #01A816; --color-success-hover: #00C61C; --color-success-onBackground: #FFFFFF; --color-success-plain: #00C61C; --color-success-plain-hover: #58E15B; --color-tone-1: #F2F2F2; --color-tone-2: #ACACAC; --color-tone-3: #434343; --color-tone-4: #303030; --color-tone-5: #1E1E1E; --color-tone-6: #131313; --color-tone-7: #080808; --color-transparent-background-hover: #6677801a; --color-ui-canvas: #080808; --color-ui-modalbackground: var(--color-neutral-background-strong); --color-upvote-background: #D93900; --color-upvote-background-disabled: rgba(217, 57, 0, 0.3); --color-upvote-background-hover: #AE2C00; --color-upvote-content: #FF4500; --color-upvote-content-weak: var(--color-global-brand-orangered); --color-upvote-disabled: #FF45004d; --color-upvote-onBackground: #FFFFFF; --color-upvote-onStrongScrim: #FF895D; --color-upvote-onStrongScrim-disabled: rgba(255, 137, 93, 0.3); --color-upvote-onStrongScrim-weaker: #FF4500; --color-upvote-plain: #FF895D; --color-upvote-plain-disabled: rgba(255, 137, 93, 0.3); --color-upvote-plain-weaker: #FF4500; --color-warning-background: #B78800; --color-warning-background-hover: #D8A100; --color-warning-content: #B78800; --color-warning-content-hover: #D8A100; --color-warning-onBackground: #000000; --color-button-primary-border-activated: transparent; --color-button-plain-inverted-activated-text: var(--color-neutral-background); --color-input-radio-hover: var(--color-secondary-plain); --color-shimmer-background: #ffffff08; --color-shimmer-gradient-overlay: linear-gradient(to right, #ffffff00, #ffffff05 20%, #ffffff0f 50%, #ffffff08 70%, #ffffff00 100%); } } .theme-dark .theme-rpl, .theme-dark.theme-rpl { --color-ai-background-weaker: #00382B; --color-ai-plain: #01A484; --color-ai-plain-hover: #00C29D; --color-avatar-gradient: linear-gradient(0deg, #48545Bff, #181C1Fff 75%); --color-brand-background: #D93900; --color-brand-background-hover: #AE2C00; --color-brand-onBackground: #FFFFFF; --color-caution-background: #D8A100; --color-caution-background-hover: #FFBF0B; --color-caution-onBackground: #000000; --color-caution-plain: #FFBF0B; --color-caution-plain-hover: #FFE284; --color-danger-background: #BC0117; --color-danger-background-disabled: #340F05; --color-danger-background-hover: #EB001F; --color-danger-background-weaker: #650405; --color-danger-content: #FF4F40; --color-danger-content-hover: #FF8773; --color-danger-onBackground: #FFFFFF; --color-danger-plain: #FF8773; --color-danger-plain-hover: #FDB3A4; --color-downvote-background: #6A5CFF; --color-downvote-background-disabled: rgba(106, 92, 255, 0.3); --color-downvote-background-hover: #523DFF; --color-downvote-content: #9580FF; --color-downvote-content-weak: #6A5CFF; --color-downvote-disabled: #9580FF4d; --color-downvote-onBackground: #FFFFFF; --color-downvote-onStrongScrim: #B29FFF; --color-downvote-onStrongScrim-disabled: rgba(178, 159, 255, 0.3); --color-downvote-onStrongScrim-weaker: #9580FF; --color-downvote-plain: #9580FF; --color-downvote-plain-disabled: rgba(149, 128, 255, 0.3); --color-downvote-plain-weaker: #6A5CFF; --color-elevation-large1: #0000007F; --color-elevation-large2: #00000033; --color-elevation-medium1: #0000007F; --color-elevation-medium2: #00000033; --color-elevation-small: #00000054; --color-elevation-xsmall: #000000AA; --color-favorite: #B78800; --color-global-admin: #D93900; --color-global-black: #000000; --color-global-brand-orangered: #FF4500; --color-global-focus: #007FAE; --color-global-gold: #D8A100; --color-global-moderator: #008A10; --color-global-nsfw: #DE019F; --color-global-offline: #667780; --color-global-online: #00C61C; --color-global-orangered: #FF4500; --color-global-stars: #D8A100; --color-global-white: #FFFFFF; --color-interactive-background-disabled: #FFFFFF0C; --color-interactive-content-disabled: #FFFFFF3F; --color-interactive-focused: #007FAE; --color-interactive-pressed: #FFFFFF26; --color-inverted-interactive-background-disabled: #0000000C; --color-inverted-interactive-content-disabled: #0000003F; --color-inverted-interactive-pressed: #00000026; --color-inverted-neutral-background: #FFFFFF; --color-inverted-neutral-background-hover: #F6F8F9; --color-inverted-neutral-border: #00000033; --color-inverted-neutral-content: #333D42; --color-inverted-neutral-content-strong: #181C1F; --color-inverted-secondary-background: #E5EBEE; --color-inverted-secondary-background-hover: #DBE4E9; --color-inverted-secondary-background-selected: #C9D7DE; --color-inverted-secondary-onBackground: #000000; --color-inverted-secondary-plain: #181C1F; --color-inverted-secondary-plain-hover: #000000; --color-media-background: rgba(0, 0, 0, 0.6); --color-media-background-hover: rgba(0, 0, 0, 0.8); --color-media-background-selected: rgba(0, 0, 0, 0.8); --color-media-border-selected: #FFFFFF; --color-media-border-weak: #FFFFFF19; --color-media-onBackground: #FFFFFF; --color-media-onBackground-disabled: #FFFFFF3F; --color-media-onBackground-weak: #E5EBEE; --color-neutral-background: #0E1113; --color-neutral-background-container: #181C1F; --color-neutral-background-container-hover: #21272A; --color-neutral-background-container-strong: #21272A; --color-neutral-background-container-strong-hover: #2A3236; --color-neutral-background-gilded: #181C1F; --color-neutral-background-gilded-hover: #21272A; --color-neutral-background-hover: #181C1F; --color-neutral-background-medium: #131313; --color-neutral-background-pinned: #0E1113; --color-neutral-background-selected: #2A3236; --color-neutral-background-strong: #181C1F; --color-neutral-background-strong-hover: #21272A; --color-neutral-background-weak: #000000; --color-neutral-background-weak-hover: #0E1113; --color-neutral-border: #FFFFFF33; --color-neutral-border-medium: #FFFFFF7F; --color-neutral-border-strong: #F6F8F9; --color-neutral-border-weak: #FFFFFF19; --color-neutral-content: #B7CAD4; --color-neutral-content-disabled: #303030; --color-neutral-content-strong: #EEF1F3; --color-neutral-content-weak: #8BA2AD; --color-offline: #767676; --color-online: #01A816; --color-opacity-50: #F2F2F280; --color-pizzaRed: #c62828; --color-primary: #648EFC; --color-primary-background: #115BCA; --color-primary-background-hover: #1870F4; --color-primary-background-selected: #648EFC; --color-primary-border: #648EFC; --color-primary-border-hover: #90A9FD; --color-primary-hover: #90A9FD; --color-primary-onBackground: #FFFFFF; --color-primary-onBackground-selected: #000000; --color-primary-plain: #648EFC; --color-primary-plain-hover: #90A9FD; --color-primary-plain-visited: #CF5FFF; --color-primary-visited: #CF5FFF; --color-scrim-background: #00000099; --color-scrim-background-strong: #000000CC; --color-secondary: #DBE4E9; --color-secondary-background: #2A3236; --color-secondary-background-hover: #333D42; --color-secondary-background-selected: #3D494E; --color-secondary-hover: #ffffff; --color-secondary-onBackground: #FFFFFF; --color-secondary-plain: #DBE4E9; --color-secondary-plain-hover: #FFFFFF; --color-secondary-plain-weak: #8BA2AD; --color-secondary-weak: #748791; --color-success-background: #016E0B; --color-success-background-hover: #008A10; --color-success-content: #01A816; --color-success-hover: #00C61C; --color-success-onBackground: #FFFFFF; --color-success-plain: #00C61C; --color-success-plain-hover: #58E15B; --color-tone-1: #F2F2F2; --color-tone-2: #ACACAC; --color-tone-3: #434343; --color-tone-4: #303030; --color-tone-5: #1E1E1E; --color-tone-6: #131313; --color-tone-7: #080808; --color-transparent-background-hover: #6677801a; --color-ui-canvas: #080808; --color-ui-modalbackground: var(--color-neutral-background-strong); --color-upvote-background: #D93900; --color-upvote-background-disabled: rgba(217, 57, 0, 0.3); --color-upvote-background-hover: #AE2C00; --color-upvote-content: #FF4500; --color-upvote-content-weak: var(--color-global-brand-orangered); --color-upvote-disabled: #FF45004d; --color-upvote-onBackground: #FFFFFF; --color-upvote-onStrongScrim: #FF895D; --color-upvote-onStrongScrim-disabled: rgba(255, 137, 93, 0.3); --color-upvote-onStrongScrim-weaker: #FF4500; --color-upvote-plain: #FF895D; --color-upvote-plain-disabled: rgba(255, 137, 93, 0.3); --color-upvote-plain-weaker: #FF4500; --color-warning-background: #B78800; --color-warning-background-hover: #D8A100; --color-warning-content: #B78800; --color-warning-content-hover: #D8A100; --color-warning-onBackground: #000000; --color-button-primary-border-activated: transparent; --color-button-plain-inverted-activated-text: var(--color-neutral-background); --color-input-radio-hover: var(--color-secondary-plain); --color-shimmer-background: #ffffff08; --color-shimmer-gradient-overlay: linear-gradient(to right, #ffffff00, #ffffff05 20%, #ffffff0f 50%, #ffffff08 70%, #ffffff00 100%); } :root { font-family: var(--font-sans); font-size: 16px; } :root, .theme-light, .theme-dark { background: var(--color-tone-7); color: var(--color-neutral-content, var(--color-tone-1)); } /* iOS form zoom fix */ body { font-size: var(--font-body); } /* Fix FOUC by hiding custom elements until they are registered. Certain components that gaurantee that they do not affect layout may be excluded. */ :not(:defined):not(faceplate-auto-height-animator, faceplate-dropdown-menu, faceplate-expandable-section-helper, faceplate-hovercard, faceplate-tracker) { visibility: hidden; } faceplate-hovercard:not(:defined) > [slot='content'] { display: none; } /* Override the _color_ of the default user-agent outline ring on focus-visible */ :focus-visible { outline-color: var(--color-global-focus); } faceplate-banner [slot='closeButton'] { margin-left: var(--spacer-sm); } faceplate-banner [slot='actionButtons'] button:first-of-type { margin-right: var(--spacer-xs); } faceplate-banner[appearance='caution'] button { color: var(--color-banner-caution-text); } faceplate-banner[appearance='caution'] button:hover { background-color: var(--color-banner-caution-hover); } /** * The blockquote style module * * This LESS module provides the default Faceplate styles for `
` elements. * * ```less * @import '@reddit/faceplate-ui/styles/elements/blockquote.less'; * * // To apply styles to
elements within a scope (e.g. a shadow DOM) * blockquote { * .blockquote(); * } * * // To apply styles to a custom element directly * :host { * display: block; * .blockquote(); * } * ``` * * --- * * Faceplate includes these styles on the `
` element by default. * * ```demo:html *
* that happened to me once but instead of clapping it was eating doritos *
* ``` * * @packageDocumentation */ /* Toggle Buttons */ .button-favorite { --button-color-background-focus: transparent; --button-color-background-hover: var(--color-button-plain-background-hover); --button-color-background-disabled: var(--color-button-plain-background-disabled); --button-color-background-activated: var(--color-button-plain-background-activated); --button-color-background-active: linear-gradient(var(--color-button-secondary-background-hover), var(--color-button-secondary-background-hover)); --button-color-text-default: var(--color-button-plain-text); --button-color-text-disabled: var(--color-button-plain-text-disabled); --button-color-text-activated: var(--color-button-plain-text-activated); --button-color-text-hover: var(--color-button-plain-text-hover); --button-border-color-default: transparent; --button-color-text-default: var(--color-neutral-content-weak); --button-color-background-default: transparent; --button-color-text-hover: var(--color-secondary-onBackground); } .button-favorite-toggled { --button-color-background-focus: transparent; --button-color-background-hover: var(--color-button-plain-background-hover); --button-color-background-disabled: var(--color-button-plain-background-disabled); --button-color-background-activated: var(--color-button-plain-background-activated); --button-color-background-active: linear-gradient(var(--color-button-secondary-background-hover), var(--color-button-secondary-background-hover)); --button-color-text-default: var(--color-button-plain-text); --button-color-text-disabled: var(--color-button-plain-text-disabled); --button-color-text-activated: var(--color-button-plain-text-activated); --button-color-text-hover: var(--color-button-plain-text-hover); --button-border-color-default: transparent; --button-color-background-default: transparent; --button-color-text-default: var(--color-button-favorite-text); --button-color-text-hover: var(--color-button-favorite-text); } .button-secondary-toggled { --button-color-background-default: var(--color-button-secondary-background); --button-color-background-focus: var(--color-button-secondary-background-focus); --button-color-background-hover: var(--color-button-secondary-background-hover); --button-color-background-active: linear-gradient(var(--color-button-secondary-background-hover), var(--color-button-secondary-background-hover)); --button-color-background-disabled: var(--color-button-secondary-background-disabled); --button-color-background-activated: var(--color-button-secondary-background-activated); --button-color-text-default: var(--color-button-secondary-text); --button-color-text-disabled: var(--color-button-secondary-text-disabled); --button-color-text-activated: var(--color-button-secondary-text-activated); --button-border-color-default: var(--color-button-secondary-border); --button-color-background-default: var(--color-button-secondary-background-activated); --button-border-color-default: var(--color-neutral-border); } .button-caution { --button-color-background-default: var(--color-button-caution-background); --button-color-background-hover: var(--color-button-caution-background-hover); --button-color-background-disabled: var(--color-button-caution-background-disabled); --button-color-text-default: var(--color-button-caution-text); } .rpl-vote-button-group { /* APPEARANCE AGNOSTIC STYLES */ /* PLAIN APPEARANCE */ /* SECONDARY APPEARANCE */ /* BORDERED APPEARANCE */ --vote-button-divider-color: var(--color-neutral-border-weak); /* MEDIA APPEARANCE */ } .rpl-vote-button-group:not([disabled]) .rpl-vote-button-group-label { color: var(--vote-button-label-color); } .rpl-vote-button-group:not([disabled]):hover.rpl-vote-button-group-label { color: var(--vote-button-label-color-hover); } .rpl-vote-button-group .rpl-vote-button-group-divider { background-color: var(--vote-button-divider-color); } .rpl-vote-button-group[disabled] button[rpl]:disabled { --button-color-background-disabled: transparent; } .rpl-vote-button-group.button-plain { --vote-button-label-color: var(--color-secondary-plain); --vote-button-label-color-hover: var(--color-secondary-plain); } .rpl-vote-button-group.button-plain button[rpl]:first-child { --button-color-text-hover: var(--color-upvote-plain-weaker); } .rpl-vote-button-group.button-plain button[rpl]:last-child { --button-color-text-hover: var(--color-downvote-plain-weaker); } .rpl-vote-button-group.button-plain.upvote { --vote-button-label-color: var(--color-upvote-plain); } .rpl-vote-button-group.button-plain.upvote button[rpl]:first-child { --button-color-text-default: var(--color-upvote-plain-weaker); --button-color-text-hover: var(--color-upvote-plain-weaker); --button-color-text-disabled: var(--color-upvote-plain-disabled); --button-color-text-activated: var(--color-upvote-plain-weaker); } .rpl-vote-button-group.button-plain.downvote { --vote-button-label-color: var(--color-downvote-plain); } .rpl-vote-button-group.button-plain.downvote button[rpl]:last-child { --button-color-text-default: var(--color-downvote-plain-weaker); --button-color-text-disabled: var(--color-downvote-plain-disabled); --button-color-text-activated: var(--color-downvote-plain-weaker); } .rpl-vote-button-group.button-secondary { --vote-button-label-color: var(--color-secondary-plain); --vote-button-label-color-hover: var(--color-secondary-plain); --vote-button-divider-color: var(--color-neutral-border); } .rpl-vote-button-group.button-secondary button[rpl]:first-child { --button-color-text-hover: var(--color-upvote-plain-weaker); } .rpl-vote-button-group.button-secondary button[rpl]:last-child { --button-color-text-hover: var(--color-downvote-plain-weaker); } .rpl-vote-button-group.button-secondary.upvote, .rpl-vote-button-group.button-secondary.upvote button[rpl] { --button-color-text-default: var(--color-upvote-onBackground); --button-color-text-hover: var(--color-upvote-onBackground); --button-color-text-disabled: var(--color-upvote-disabled); --button-color-text-activated: var(--color-upvote-onBackground); } .rpl-vote-button-group.button-secondary.upvote:not([disabled]), .rpl-vote-button-group.button-secondary.upvote button[rpl]:not([disabled]) { --button-color-background-default: var(--color-upvote-background); --button-color-background-hover: var(--color-upvote-background-hover); --button-color-background-active: var(--color-upvote-background-hover); --vote-button-divider-color: var(--color-upvote-onBackground); --vote-button-label-color: var(--color-media-onBackground); } .rpl-vote-button-group.button-secondary.downvote, .rpl-vote-button-group.button-secondary.downvote button[rpl] { --button-color-text-default: var(--color-downvote-onBackground); --button-color-text-hover: var(--color-downvote-onBackground); --button-color-text-disabled: var(--color-downvote-disabled); --button-color-text-activated: var(--color-downvote-onBackground); } .rpl-vote-button-group.button-secondary.downvote:not([disabled]), .rpl-vote-button-group.button-secondary.downvote button[rpl]:not([disabled]) { --button-color-background-default: var(--color-downvote-background); --button-color-background-hover: var(--color-downvote-background-hover); --button-color-background-active: var(--color-downvote-background-hover); --vote-button-divider-color: var(--color-upvote-onBackground); --vote-button-label-color: var(--color-media-onBackground); } .rpl-vote-button-group.button-bordered-cab { --vote-button-label-color: var(--color-secondary-plain); --vote-button-label-color-hover: var(--color-secondary-plain); } .rpl-vote-button-group.button-bordered-cab button[rpl]:first-child { --button-color-text-hover: var(--color-upvote-plain-weaker); } .rpl-vote-button-group.button-bordered-cab button[rpl]:last-child { --button-color-text-hover: var(--color-downvote-plain-weaker); } .rpl-vote-button-group.button-bordered-cab.upvote { --vote-button-label-color: var(--color-upvote-plain); } .rpl-vote-button-group.button-bordered-cab.upvote button[rpl]:first-child { --button-color-text-default: var(--color-upvote-plain-weaker); --button-color-text-hover: var(--color-upvote-plain-weaker); --button-color-text-disabled: var(--color-upvote-plain-disabled); --button-color-text-activated: var(--color-upvote-plain-weaker); } .rpl-vote-button-group.button-bordered-cab.downvote { --vote-button-label-color: var(--color-downvote-plain); } .rpl-vote-button-group.button-bordered-cab.downvote button[rpl]:last-child { --button-color-text-default: var(--color-downvote-plain-weaker); --button-color-text-hover: var(--color-downvote-plain-weaker); --button-color-text-disabled: var(--color-downvote-plain-disabled); --button-color-text-activated: var(--color-downvote-plain-weaker); } .rpl-vote-button-group.button-media-cab { --vote-button-label-color: var(--color-media-onBackground); --vote-button-label-color-hover: var(--color-media-onBackground); --vote-button-divider-color: var(--color-media-border-weak); } .rpl-vote-button-group.button-media-cab button[rpl]:first-child { --button-color-text-hover: var(--color-upvote-onStrongScrim-weaker); } .rpl-vote-button-group.button-media-cab button[rpl]:last-child { --button-color-text-hover: var(--color-downvote-onStrongScrim-weaker); } .rpl-vote-button-group.button-media-cab.upvote { --vote-button-label-color: var(--color-upvote-onStrongScrim); } .rpl-vote-button-group.button-media-cab.upvote button[rpl]:first-child { --button-color-text-default: var(--color-upvote-onStrongScrim-weaker); --button-color-text-activated: var(--color-upvote-onStrongScrim-weaker); --button-color-text-disabled: var(--color-upvote-onStrongScrim-disabled); } .rpl-vote-button-group.button-media-cab.downvote { --vote-button-label-color: var(--color-downvote-onStrongScrim); } .rpl-vote-button-group.button-media-cab.downvote button[rpl]:last-child { --button-color-text-default: var(--color-downvote-onStrongScrim-weaker); --button-color-text-activated: var(--color-downvote-onStrongScrim-weaker); --button-color-text-disabled: var(--color-downvote-onStrongScrim-disabled); } /** * The code style module * * This LESS module provides the default Faceplate styles for `` elements. * * ```less * @import '@reddit/faceplate-ui/styles/elements/code.less'; * * // To apply styles to elements within a scope (e.g. a shadow DOM) * code { * .code(); * } * * // To apply styles to a custom element directly * :host { * display: block; * .code(); * } * ``` * * --- * * Faceplate includes these styles on the following elements: * * - `` * - `
`   * - ``   * - ``   *   * ```demo:html   * 

This is some inline code.

* *
This is some   * preformatted   * code   * 
* *

This is a sample element.

* *

This is a keyboard element.

* ``` * * @packageDocumentation */ /** * The details style module * * This LESS module provides the default Faceplate styles for `
` elements, and `` * elements nested in them. * * ```less * @import '@reddit/faceplate-ui/styles/elements/details.less'; * * // To apply styles to
elements within a scope (e.g. a shadow DOM) * details { * .details(); * } * ``` * * --- * * Faceplate includes these styles on the `details` element by default. * * ```demo:html *
* Click for more info *

More info

*
* ``` * * @packageDocumentation */ faceplate-dropdown-menu:not(.connected) [slot='menu'] { display: none; } faceplate-dropdown-menu faceplate-menu li[rpl]:first-child [role='menuitem'] { border-top-left-radius: var(--rem8); border-top-right-radius: var(--rem8); } faceplate-dropdown-menu faceplate-menu li[rpl]:last-child [role='menuitem'] { border-bottom-left-radius: var(--rem8); border-bottom-right-radius: var(--rem8); } faceplate-expandable-section-helper { display: contents; /* [rpl] just to boost the selector */ /* Target the [open] attribute on either the root element OR the details element to rotate the chevron. This is to handle rotating chevrons both before and after the faceplate-expandable-section-helper component is defined. Before the component is defined, the [open] attribute on the component will not toggle if the user clicks on details, but the [open] attribute will toggle on the details element, so we need to target details too. The reason we can't target only the details element is because once the web component is defined, we delay toggling the [open] attribute on the details element until AFTER the animation finishes. So if we only targeted the details element for the chevron rotation the chevron wouldn't rotate until after the collapse animation finished and we finally toggle the [open] attriubte on the details element. */ /* Specific handling for nested menus. We only need to handle collapse menus inside of expanded menus, not expanded menus inside collapsed menus because you can't see those! */ } faceplate-expandable-section-helper > details > summary { list-style-type: none; /* For Safari */ } faceplate-expandable-section-helper > details > summary::marker, faceplate-expandable-section-helper > details > summary::-webkit-details-marker { display: none; } faceplate-expandable-section-helper[rpl] > details > summary { /* override details.less */ margin: 0; } faceplate-expandable-section-helper > details > summary [icon-name='caret-down-outline'] { transition: transform 0.22s ease-in-out; } faceplate-expandable-section-helper[open] > details > summary svg[rpl][icon-name='caret-down-outline'], faceplate-expandable-section-helper:not(:defined) > details[open] > summary svg[rpl][icon-name='caret-down-outline'] { transform: rotate(180deg); } faceplate-expandable-section-helper:not([open]) > details > summary svg[rpl][icon-name='caret-down-outline'], faceplate-expandable-section-helper:not(:defined) > details[open] > summary svg[rpl][icon-name='caret-down-outline'] { transform: rotate(0deg); } /** * The header style module * * This LESS module provides the default Faceplate styles for `
` elements. This includes * the behavior of forcing the element's background to take the full width of the page. * * ```less * @import '@reddit/faceplate-ui/styles/elements/header.less'; * * // To apply styles to
elements within a scope (e.g. a shadow DOM) * header { * .header(); * } * * // To apply styles to a custom element directly * :host { * display: block; * .header(); * } * ``` * * --- * * Faceplate applies these styles to the `
` element by default. * * ```html *
* Header content. *
* ``` * * @packageDocumentation */ /** * The input style module * * This LESS module provides the default Faceplate styles for ``, ` *

* ``` * * @packageDocumentation */ /** * The kbd style module * * This LESS module provides the default Faceplate styles for `` elements. * * ```less * @import '@reddit/faceplate/styles/elements/kbd.less'; * * // To apply styles to elements within a scope (e.g. a shadow DOM) * kbd { * .kbd(); * } * * // To apply styles to a custom element directly * :host { * display: block; * .kbd(); * } * ``` * * --- * * Faceplate applies these styles to `` elements _in addition to_ the styles provided by the * `code.less` module. * * ```demo:html *

This is a keyboard element.

* ``` * * @packageDocumentation */ /** * The label style module * * This LESS module provides the default Faceplate styles for `