import{N as j,s as q,j as k,k as B,Q as K,d as b,w as W,m as s,o as p,c as u,e as g,b as a,f as w,a as O,G as _,t as i,D as f,I as y}from"./Bgmy51Qv.js";import{_ as G}from"./D_7E8SMU.js";import{_ as Y}from"./YvhBcM5y.js";import{_ as z}from"./BOhf1Bbf.js";import{u as A}from"./7pZkuj9N.js";import{u as J}from"./DKgjlGGV.js";import"./CNIrc0EA.js";import"./DZl4_Bww.js";import"./AmaTRG5a.js";import"./BHvLfWtM.js";import"./DuSynPle.js";import"./B2895E6R.js";const L={key:0,class:"spinner-wrapper"},M={class:"input-wrapper"},Q=["placeholder"],H={key:0,class:"error"},X={class:"input-wrapper"},Z=["placeholder"],E={key:0,class:"error"},x={class:"input-wrapper"},ee={class:"flex-v-centered mb j-left"},te={class:"mr-15"},se={key:1,class:"input-wrapper"},oe={class:"flex-v-centered mb j-left"},ae={class:"mr-15"},ne={class:"input-wrapper mt-15"},le=["placeholder"],ie={key:0,class:"error"},pe={class:"input-wrapper"},re=["placeholder"],de={key:0,class:"error"},me={class:"input-wrapper"},ue=["placeholder"],Se={__name:"[id]",setup(ce){const P=j(),{currentLanguage:ge}=q(P),D=A(),{setRequest:S,deleteData:V}=D,c=k(!1),$=k(""),e=k({id:"",title:"",slug:"",meta_title:"",description:"",meta_description:"",meta_keywords:"",page_from_component:""}),{status:I,pageComponent:h,featuredObj:F}=J(),C=B(()=>{var t;return parseInt((t=e.value)==null?void 0:t.page_from_component)!==I.PRIVATE}),N=t=>{e.value.page_from_component=t.key,C.value?($.value=e.value.description,e.value.description=Object.keys(h)[0]):$.value&&(e.value.description=$.value)},R=({deleted:t,file:o,Editor:m,cursorLocation:r,resetUploader:v})=>{U({deleted:t,file:o,Editor:m,cursorLocation:r,resetUploader:v})},T=K(),U=async({deleted:t,file:o,Editor:m,cursorLocation:r,resetUploader:v})=>{if(t)c.value=!0,await V({params:getImageName(o),api:"deletePageWysiwygImage"}),c.value=!1;else{c.value=!0;const d=new FormData;e.value.id?(d.append("description",e.value.description),d.append("page_id",e.value.id)):d.append("page",JSON.stringify(e.value)),d.append("photo",o);const l=await S({params:d,api:"setPageWysiwygImage"});l&&(e.value.id?(m.insertEmbed(r,"image",l.url),m.setSelection(r+1)):await T.push({path:`/pages/${l.page_id}`})),c.value=!1}};return(t,o)=>{const m=O,r=G,v=Y,d=z;return p(),b(d,{ref:"dataPageRef","set-api":"setPage","get-api":"getPage","route-name":"pages",gate:"page","empty-store-variable":"allPages",name:t.$t("dataPage.page"),"validation-keys":["title","slug","meta_title","meta_description"],result:s(e),onResult:o[8]||(o[8]=l=>e.value=l)},{form:W(({hasError:l})=>[s(c)?(p(),u("div",L,[w(m,{radius:70,color:"primary"})])):g("",!0),a("div",M,[a("label",null,i(t.$t("index.title")),1),_(a("input",{type:"text",placeholder:t.$t("index.title"),"onUpdate:modelValue":o[0]||(o[0]=n=>s(e).title=n),onChange:o[1]||(o[1]=(...n)=>t.slugChange&&t.slugChange(...n)),class:f({invalid:!s(e).title&&l})},null,42,Q),[[y,s(e).title]]),!s(e).title&&l?(p(),u("span",H,i(t.$t("category.req",{type:t.$t("index.title")})),1)):g("",!0)]),a("div",X,[a("label",null,i(t.$t("category.slug")),1),_(a("input",{type:"text",placeholder:t.$t("category.slug"),"onUpdate:modelValue":o[2]||(o[2]=n=>s(e).slug=n),class:f({invalid:!s(e).slug&&l})},null,10,Z),[[y,s(e).slug]]),!s(e).slug&&l?(p(),u("span",E,i(t.$t("category.req",{type:t.$t("category.slug")})),1)):g("",!0)]),a("div",x,[a("div",ee,[a("span",te,i(t.$t("admin.pageComp")),1),w(r,{selectedKey:s(e).page_from_component,options:s(F),onClicked:N},null,8,["selectedKey","options"])])]),s(C)?(p(),u("div",se,[a("div",oe,[a("span",ae,i(t.$t("admin.comp")),1),w(r,{selectedKey:s(e).description,options:s(h),onClicked:o[3]||(o[3]=n=>s(e).description=n.key)},null,8,["selectedKey","options"])])])):(p(),b(v,{key:2,title:t.$t("prod.desc"),description:s(e).description,onChange:o[4]||(o[4]=n=>s(e).description=n),onFile:R},null,8,["title","description"])),a("div",ne,[a("label",null,i(t.$t("category.mTitle")),1),_(a("input",{type:"text",placeholder:t.$t("category.mTitle"),"onUpdate:modelValue":o[5]||(o[5]=n=>s(e).meta_title=n),class:f({invalid:!s(e).meta_title&&l})},null,10,le),[[y,s(e).meta_title]]),!s(e).meta_title&&l?(p(),u("span",ie,i(t.$t("category.req",{type:t.$t("category.mTitle")})),1)):g("",!0)]),a("div",pe,[a("label",null,i(t.$t("category.mDesc")),1),_(a("textarea",{placeholder:t.$t("category.mDesc"),"onUpdate:modelValue":o[6]||(o[6]=n=>s(e).meta_description=n),class:f({invalid:!s(e).meta_description&&l})},null,10,re),[[y,s(e).meta_description]]),!s(e).meta_description&&l?(p(),u("span",de,i(t.$t("category.req",{type:t.$t("category.mDesc")})),1)):g("",!0)]),a("div",me,[a("label",null,i(t.$t("ship.mk"))+" ("+i(t.$t("ship.csk"))+")",1),_(a("textarea",{placeholder:t.$t("ship.mk"),"onUpdate:modelValue":o[7]||(o[7]=n=>s(e).meta_keywords=n)},null,8,ue),[[y,s(e).meta_keywords]])])]),_:1},8,["name","result"])}}};export{Se as default};
