import{j as N,k as o,z as T,s as j,J as F,c as l,a,m as L,v as V,F as z,u as A,y as p,i as k,t as b,d as B,n as D,p as q,q as J,e as M,o as n,_ as P}from"./index-5dca7a6a.js";import{c as R,g as y,p as U}from"./api-2fe5baa7.js";const r=u=>(q("data-v-ee0acc2c"),u=u(),J(),u),$={class:"page-wrapper",id:"app","data-layout":"horizontal","data-navbarbg":"skin6","data-sidebartype":"full","data-sidebar-position":"fixed","data-header-position":"fixed"},E=B('
',1),O={class:"body-wrapper overflow-hidden"},Q={class:"position-relative overflow-hidden min-vh-100 d-flex align-items-center justify-content-center drawise-auth-bg"},W={class:"d-flex align-items-center justify-content-center w-100"},G={class:"row justify-content-center w-100"},H={class:"col-md-8 col-lg-8 col-xxl-5"},K={class:"card mb-0"},X={class:"card-body"},Y=r(()=>a("h1",{class:"display-6 fs-7 mb-4"}," Pick some tags related to your business ",-1)),Z={class:"form-floating mb-3"},ee=r(()=>a("label",null,[a("i",{class:"ti ti-search me-2 fs-4"}),k("Search")],-1)),ae={class:"d-flex gap-2 industry-flex mb-4",style:{"flex-wrap":"wrap"}},te=["id","checked","onChange"],se=["for"],oe={key:0},ce=["disabled"],le=r(()=>a("i",{class:"ti ti-chevron-right fs-4 me-2"},null,-1)),ne={key:2,class:"progress-container"},ie=r(()=>a("div",{class:"track"},[a("div",{class:"bar"})],-1)),de=r(()=>a("div",null,"Please Wait. Drawise is creating your Logo with AI. it may takes few minutes.",-1)),re=[ie,de],ue=N({__name:"tag",setup(u){const v=o([]),_=o(""),t=o(!0),i=o("Continue"),c=o([]),h=o(!1),f=o(),w=T().params.id;j(()=>{R(),x()});async function x(){t.value=!0;try{(await y)("/tag/").then(e=>{console.log(e.data),v.value=e.data,t.value=!1}).catch(()=>{t.value=!1,i.value="Failed. Try Again"}),y(`/create_site/sites/${w}/`).then(e=>{f.value=e.data.site_name,t.value=!1}).catch(()=>{t.value=!1,i.value="Failed. Refresh the page"})}catch(e){console.error(e)}}const S=F(()=>{const e=_.value.toLowerCase();return v.value?v.value.filter(s=>s.toLowerCase().includes(e)).slice(0,20):[]});function g(e){return c.value.includes(e)}function C(e){console.log([...c.value]),g(e)?c.value=c.value.filter(d=>d!==e):c.value.push(e)}async function I(){h.value=!1;try{t.value=!0,i.value="loading",(await U)("/create_icon/create_icon/",{text:f.value,tags:c.value}).then(e=>{e.data&&(console.log(e.data),localStorage.setItem("logos",JSON.stringify(e.data)),console.log(localStorage.getItem("logos")),D.push("logo"),t.value=!1)}).catch(()=>{t.value=!1,i.value="Failed. Try Again"}),console.log("alert")}catch{h.value=!0,console.log("alert")}}return(e,d)=>(n(),l("div",$,[E,a("div",O,[a("div",Q,[a("div",W,[a("div",G,[a("div",H,[a("div",K,[a("div",X,[a("div",null,[Y,a("div",Z,[L(a("input",{"onUpdate:modelValue":d[0]||(d[0]=s=>_.value=s),type:"text",class:"form-control",placeholder:"Username"},null,512),[[V,_.value]]),ee]),a("div",ae,[(n(!0),l(z,null,A(S.value,(s,m)=>(n(),l("div",{key:s},[a("input",{type:"checkbox",class:"btn-check",id:"btn-check-"+(m+1),checked:g(s),onChange:_e=>C(s),autocomplete:"off"},null,40,te),a("label",{class:"btn btn-outline-success font-medium rounded-pill",for:"btn-check-"+(m+1)},b(s),9,se)]))),128))]),h.value?(n(),l("p",oe,"No media found for these tags")):p("",!0),t.value?p("",!0):(n(),l("button",{key:1,onClick:I,disabled:t.value,to:{name:"logo"},class:"btn btn-success w-100 py-8 mb-4 rounded-2"},[k(b(i.value)+" ",1),le],8,ce)),t.value?(n(),l("div",ne,re)):p("",!0)])])])])])])])])]))}});const fe=P(ue,[["__scopeId","data-v-ee0acc2c"]]);export{fe as default};