import{sasCe,yasfe,Easct,zaszt,Saspt,casFt,uasMt,gasLt,aasUt,easP,basC,Fashe,dasS,fasH,iash,jasO,pasd,aaasje,qasle,k,lasL,wasR,abasBt,acasMe,nasde,xasze,a8asZe,BasXe,LasG,Mas$e,adasie,tasY,hasK,masSe,rasgt,vasHt,oasbt,aeasAe}from"../chunks/scheduler.ncJpckHt.js";import{SasOe,iasVe,casD,basy,masI,tasv,aasw,dasE,fasee,gasIe,easEe}from"../chunks/index.DNKwBhZH.js";import{gas_e,aasce}from"../chunks/spread.CgU5AtxT.js";import{zasoe,Fasge,sasqt,aasRt,Casve,basUe,casye,daswe,IasLe,SasXt,TasWt}from"../chunks/textarea.AQfcKovJ.js";import"../chunks/entry.DqgMqN0S.js";import{tasht}from"../chunks/Toaster.svelte_svelte_type_style_lang.C_CyLwr0.js";import{caset}from"../chunks/config.o_6xWekK.js";import"../chunks/index.Bf9t7sah.js";import{BasYt}from"../chunks/button.Dry7Ezxz.js";functionKt(n){lete;constt=n[1].default,l=Ft(t,n,n[4],null);return{c(){l&&l.c()},l(s){l&&l.l(s)},m(s,i){l&&l.m(s,i),e=!0},p(s,i){l&&l.p&&(!e||i&16)&&Mt(l,t,s,s[4],e?Ut(t,s[4],i,null):Lt(s[4]),null)},i(s){e||(v(l,s),e=!0)},o(s){w(l,s),e=!1},d(s){l&&l.d(s)}}}functionGt(n){lete,t;constl=[{type:"submit"},n[0]];lets={$$slots:{default:[Kt]},$$scope:{ctx:n}};for(leti=0;i<l.length;i+=1)s=fe(s,l[i]);returne=newYt({props:s}),e.$on("click",n[2]),e.$on("keydown",n[3]),{c(){D(e.$$.fragment)},l(i){y(e.$$.fragment,i)},m(i,f){I(e,i,f),t=!0},p(i,[f]){constr=f&1?_e(l,[l[0],ce(i[0])]):{};f&16&&(r.$$scope={dirty:f,ctx:i}),e.$set(r)},i(i){t||(v(e.$$.fragment,i),t=!0)},o(i){w(e.$$.fragment,i),t=!1},d(i){E(e,i)}}}functionJt(n,e,t){constl=[];lets=ct(e,l),{$$slots:i={},$$scope:f}=e;functionr(u){pt.call(this,n,u)}functiona(u){pt.call(this,n,u)}returnn.$$set=u=>{e=fe(fe({},e),zt(u)),t(0,s=ct(e,l)),"$$scope"inu&&t(4,f=u.$$scope)},[s,i,r,a,f]}classQtextendsOe{constructor(e){super(),Ve(this,e,Jt,Gt,Ce,{})}}constZt=/^[a-z0-9\.\-]*$/,xt=n=>Zt.test(n),en=oe.object({id:oe.string(),name:oe.string().min(4).max(32),primary_color_hex:oe.string().length(7),secondary_color_hex:oe.string().length(7),text_color_hex:oe.string().length(7),domain:oe.string().refine(xt,{message:"Invalid domain"}).optional(),use_freebie:oe.boolean().default(!1),freebie_name:oe.string().optional(),freebie_url:oe.string().optional(),freebie_image_url:oe.string().optional(),freebie_text:oe.string().optional(),title:oe.string(),subtitle:oe.string()}).superRefine((n,e)=>{console.log(n),n.use_freebie&&((!n.freebie_name||n.freebie_name.length===0)&&e.addIssue({path:["freebie_name"],message:"A freebie name' is required when 'Use freebie' is true.",code:"custom"}),n.freebie_url||e.addIssue({path:["freebie_url"],message:"A freebie file is required when 'Use freebie' is true.",code:"custom"}))});vartn={grad:.9,turn:360,rad:360/(2*Math.PI)},Fe=function(n){returntypeofn=="string"?n.length>0:typeofn=="number"},te=function(n,e,t){returne===void0&&(e=0),t===void0&&(t=Math.pow(10,e)),Math.round(t*n)/t+0},be=function(n,e,t){returne===void0&&(e=0),t===void0&&(t=1),n>t?t:n>e?n:e},Pt=function(n){return(n=isFinite(n)?n%360:0)>0?n:n+360},dt=function(n){return{r:be(n.r,0,255),g:be(n.g,0,255),b:be(n.b,0,255),a:be(n.a)}},tt=function(n){return{r:te(n.r),g:te(n.g),b:te(n.b),a:te(n.a,3)}},nn=/^#([0-9a-f]{3,8})$/i,Ke=function(n){vare=n.toString(16);returne.length<2?"0"+e:e},St=function(n){vare=n.r,t=n.g,l=n.b,s=n.a,i=Math.max(e,t,l),f=i-Math.min(e,t,l),r=f?i===e?(t-l)/f:i===t?2+(l-e)/f:4+(e-t)/f:0;return{h:60*(r<0?r+6:r),s:i?f/i*100:0,v:i/255*100,a:s}},At=function(n){vare=n.h,t=n.s,l=n.v,s=n.a;e=e/360*6,t/=100,l/=100;vari=Math.floor(e),f=l*(1-t),r=l*(1-(e-i)*t),a=l*(1-(1-e+i)*t),u=i%6;return{r:255*[l,r,f,f,a,l][u],g:255*[a,l,l,r,f,f][u],b:255*[f,f,a,l,l,r][u],a:s}},$t=function(n){return{h:Pt(n.h),s:be(n.s,0,100),l:be(n.l,0,100),a:be(n.a)}},vt=function(n){return{h:te(n.h),s:te(n.s),l:te(n.l),a:te(n.a,3)}},wt=function(n){returnAt((t=(e=n).s,{h:e.h,s:(t*=((l=e.l)<50?l:100-l)/100)>0?2*t/(l+t)*100:0,v:l+t,a:e.a}));vare,t,l},We=function(n){return{h:(e=St(n)).h,s:(s=(200-(t=e.s))*(l=e.v)/100)>0&&