var C=Object.defineProperty;var S=a=>{throw TypeError(a)};var k=(a,e,t)=>e in a?C(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t;var b=(a,e,t)=>k(a,typeof e!="symbol"?e+"":e,t),A=(a,e,t)=>e.has(a)||S("Cannot "+t);var s=(a,e,t)=>(A(a,e,"read from private field"),t?t.call(a):e.get(a)),n=(a,e,t)=>e.has(a)?S("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(a):e.set(a,t);import{ap as Y,aq as _,s as r,a as i,g as l,e as u,D as j,h as x}from"./c625DOTJ.js";import{g as O}from"./BPHiMHp4.js";import{p as E,u as T}from"./CkTfP3o1.js";import{l as V}from"./zO0CuF4M.js";function B(a,e,t){var o=Y(a,e);o&&o.set&&(a[e]=t,_(()=>{a[e]=null}))}const h=E,G=T,v=Symbol();function P(a,e){a.searchParams.delete(e),O(a.toString(),{replaceState:!0})}var d,m,p,M,w,f;class J{constructor(e){b(this,"user",null);n(this,d,r(i({open:!1,title:"",content:"",buttonText:"",buttonAction:null,closeAction:null})));n(this,m,r(i({open:!1})));n(this,p,r(i({open:!1,image:null,prompt:""})));n(this,M,r(i({open:!1,data:null,showDownloadButton:!1})));n(this,w,r(i({open:!1,creation:null})));n(this,f,r(i({open:!1,creation:null})));j(v,this),this.user=e}get message(){return l(s(this,d))}set message(e){u(s(this,d),e,!0)}get signIn(){return l(s(this,m))}set signIn(e){u(s(this,m),e,!0)}get imageModal(){return l(s(this,p))}set imageModal(e){u(s(this,p),e,!0)}get videoModal(){return l(s(this,M))}set videoModal(e){u(s(this,M),e,!0)}get createImageModal(){return l(s(this,w))}set createImageModal(e){u(s(this,w),e,!0)}get editImageModal(){return l(s(this,f))}set editImageModal(e){u(s(this,f),e,!0)}static get(){return x(v)}showMessage(e,t,o,c=null,g=null){Object.assign(this.message,{open:!0,title:e,content:t,buttonText:o,buttonAction:c,closeAction:g})}showImage(e,t=""){Object.assign(this.imageModal,{open:!0,image:e,prompt:t})}showVideo(e,t=!0){Object.assign(this.videoModal,{open:!0,data:e,showDownloadButton:t})}showCreateImage(e){Object.assign(this.createImageModal,{open:!0,creation:e})}showEditImage(e){Object.assign(this.editImageModal,{open:!0,creation:e})}showCreationsInfo(e){var t;if(!e){if((t=V("shownCreationInfoModal",{shown:!1}))!=null&&t.shown)return;localStorage.setItem("shownCreationInfoModal",JSON.stringify({shown:!0}))}this.showMessage("Storage Information","Creations are stored locally in your browser. When the storage is full, new creations delete the oldest creation. Make sure to save anything you want to keep!","Okay")}showGenericError(){this.showMessage("Something went wrong","We're working on it!","Close")}closeCreateModal(){this.createImageModal.open=!1}showSignIn(){this.signIn.open=!0}promptSignIn(){return this.user.isSignedIn()?!0:(this.showSignIn(),!1)}promptMatureEnabled(){return this.user.isMature()?!0:(this.showMessage("Allow NSFW Content?","Turn on 'Show mature content' in account settings to view.","Account Settings",()=>{this.promptSignIn()&&O("/account")}),!1)}handleSearchParamMessage(e,t,o,c,g){if(e.searchParams.get(t)!==null){const I=()=>P(e,t);this.showMessage(o,c,g,I,I)}}handleSearchParamValueMessage(e,t,o,c,g,I){if(o(e.searchParams.get(t))){const y=()=>P(e,t);this.showMessage(c,g,I,y,y)}}setupSearchParamMessages(){this.handleSearchParamMessage(h.url,"account_deleted","Account deleted","Your account was deactivated and scheduled for deletion. You can sign in again to reactivate it if you change your mind.","Okay"),this.handleSearchParamMessage(h.url,"account_reactivated","Account reactivated","Your account has been reactivated. Please sign in again.","Okay"),this.handleSearchParamMessage(h.url,"account_suspended","Account suspended","Your account has been suspended. Please contact support if you believe this was a mistake.","Okay"),this.handleSearchParamValueMessage(h.url,"errorType",e=>e==="auth","Couldn't sign you in","There was a problem signing you in, please try again.","Okay"),this.handleSearchParamMessage(h.url,"payment_success","Payment success!","Your payment was completed. Your gems will be credited to your account shortly.","Okay")}}d=new WeakMap,m=new WeakMap,p=new WeakMap,M=new WeakMap,w=new WeakMap,f=new WeakMap;export{J as M,B as b,h as p,G as u};