PageSourceSearch

https://edubit.vn/_nuxt/DWl8pG8f.js

js edubit.vn collected 2026-09-25 10:47:55 UTC 311,148 bytes, 1,921 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./CJHBzVzk.js","./BbDbjuyS.js","./vendor-ckeditor.CReawncY.css"])))=>i.map(i=>d[i]);
2import{u as bt,c as Zt,g as en,h as zt,t as pe,m as Yn,e as tn,n as nn,o as hr,f as rn,r as fr,d as lt,M as Gt,p as gr,j as mr,q as br,l as yr,v as oa,a as vr,s as wr,w as sa,x as hi,y as la,z as fi,A as ca,B as da,C as gi,b as ua}from"./ClmazBKZ.js";import{_ as pa}from"./DtTkOoZY.js";import{_ as Qn}from"./NQh7fyZC.js";import{_ as ha}from"./CgLeZ70m.js";import{_ as xr}from"./BtF-0fXO.js";import{_ as Zn}from"./BiuJV8kb.js";import{_ as _r}from"./C43U5m0J.js";import{_ as Cr}from"./zXhcMgR0.js";import{c as kr,a as un}from"./CBnC-wTy.js";import{t as Sr}from"./a2VgpQa-.js";import{t as Er,a as Tr}from"./DAkb0LDe.js";import{n as $r}from"./DzKQ36gO.js";import{c as fa,d as ga}from"./lM3VcZ92.js";import{F as Pr}from"./C12GPS4T.js";import{_ as ei}from"./DX_ukVz8.js";import{d as yt,A as Je,b as It,ar as At,a6 as ct,a7 as ce,a9 as K,ai as F,u as k,E as me,ad as Ke,ae as dt,q as st,r as X,a5 as re,a8 as Jn,o as Mr,n as Kt,ah as je,z as Tt,a as ma,F as it,aa as ot,aq as Et,C as ba,av as gt,aw as mt,ax as pn,af as hn,ay as ya,R as Lr,I as va}from"./BbDbjuyS.js";import{_ as Ir}from"./D12NM5u8.js";import{_ as wa}from"./ChV-uFZA.js";import{_ as xa}from"./Cxlp-_jD.js";import{_ as _a}from"./DUT6xRX1.js";import{_ as Ca}from"./s_gtudcO.js";import{M as Rr}from"./B3Tlidbo.js";import{c as mi,_ as ka,v as Sa,a as Ea,b as Ta,p as $a,s as Pa,d as Ma,e as La,f as Ia,g as Ra,h as za,i as Aa,j as Ba,k as Da,l as Oa,m as Fa,n as bi,o as ja,t as yi}from"./V90iMeCH.js";import{t as qa}from"./CvGgU-Yu.js";import{E as Jt,a as fn}from"./xM3SvnY2.js";import{g as Ua}from"./CnLjmg0H.js";import{u as Ha,a as Va}from"./DvrTMMCr.js";import"./U3PEbFmj.js";import"./CrwicM1a.js";import"./Ca8GMZuu.js";import"./BHSXQnfV.js";import"./CH49u8mr.js";import"./BAsuuVqe.js";import"./ChYGUNEd.js";import"./7WWTGBXg.js";import"./BPunr_o_.js";import"./DJJEJJR3.js";import"./C771hr_R.js";import"./CA2yfkzM.js";import"./BXzDaxal.js";import"./jFYhBC76.js";import"./DcoTGaJf.js";import"./DpQ98tRW.js";import"./QZFUeJ65.js";import"./C48-1-6t.js";import"./C34AKM1r.js";import"./kRIii9yh.js";import"./C6Y-ieo6.js";const Na={class:"max-h-[75vh] overflow-y-auto"},Wa={class:"flex items-center gap-5 mb-5"},Ga={class:"grid md:grid-cols-2 grid-cols-1 gap-3"},Ka={class:"relative rounded-md border border-dashed border-accented p-3"},Ja={class:"relative rounded-md border border-dashed border-accented p-3"},Xa={key:0,class:"relative inline-block"},Ya={class:"flex justify-end gap-x-4"},Qa=yt({__name:"ModalSetting",props:{page:{},isOpen:{type:Boolean}},emits:["onCloseModal"],async setup(n,{emit:d}){let g,o;const c=n,r=d,{$t:h}=bt(),u=Zt(),l=X(!1),e=en();Je(()=>c.isOpen,C=>{l.value=C}),Je(l,C=>{C||r("onCloseModal")});const t=kr({}),s=X(),i=It({show_header:c.page.show_header,show_footer:c.page.show_footer,form:{id:c.page.form?.id??void 0,type_display:c.page.form?.type_display??fa.Always,display_after:c.page.form?.display_after??3},seo:{title:c.page.seo?.title??void 0,description:c.page.seo?.description??void 0,thumbnail:c.page.seo?.thumbnail??void 0}}),a=Sr(ga,Tr(),Er(([C,w])=>({value:C,label:w}))),p=async()=>{const C=e.create(Pr,{props:{custom:{url:"/api/v1/file-management/choose-image"},onFileCallback:x=>{hr(x)&&x.length>0&&(i.seo.thumbnail=$r(x).url),C.close()}}});await C.open().result,C.close()},b=X([]),{data:m}=([g,o]=At(()=>zt("/api/v1/forms/all","$Ct7Mf_PG7V")),g=await g,o(),g);m.value&&(b.value=m.value.map(C=>({value:C._id,label:C.title})));const _=async C=>{await $fetch(`/api/v1/pages/${c.page._id}`,{method:"PATCH",body:C.data,headers:lt(),onResponse({response:w}){w._data.statusCode===200&&w._data?(l.value=!1,u.add({description:String(h(w._data.message)),color:"success"})):w.status===403&&u.add({description:String(h("pages.builder.not_permission_setting")),color:"error"})},onResponseError({response:w}){typeof w._data?.message=="string"&&u.add({description:w._data?.message,color:"error"}),fr(w._data).forEach(f=>{u.add({description:f.message,color:"error"})})}})};return(C,w)=>{const x=tn,f=ha,v=xr,y=Zn,P=_r,E=Yn,T=nn,B=Qn,z=Cr,Y=rn;return re(),ct(Y,{open:k(l),"onUpdate:open":w[11]||(w[11]=J=>st(l)?l.value=J:null),ui:{content:"max-w-lg sm:max-w-4xl"}},{content:ce(()=>[K(z,{ref_key:"formPage",ref:s,schema:k(t),state:k(i),class:"space-y-4",onSubmit:_},{default:ce(()=>[K(B,null,{header:ce(()=>[K(x,{class:"flex absolute end-5 z-10",color:"neutral",icon:"i-material-symbols:close",padded:"",size:"sm",square:"",variant:"ghost",onClick:w[0]||(w[0]=J=>l.value=!1)}),Ke(" "+dt(String(k(pe)(k(h)("pages.builder.setting")))),1)]),footer:ce(()=>
2[F("div",Ya,[K(x,{label:String(k(pe)(k(h)("save"))),color:"primary",size:"lg",type:"submit",variant:"solid"},null,8,["label"])])]),default:ce(()=>[F("div",Na,[F("div",Wa,[K(f,{modelValue:k(i).show_header,"onUpdate:modelValue":w[1]||(w[1]=J=>k(i).show_header=J),label:`${k(h)("pages.builder.show_header")}`,class:"checkbox-custom",name:"show_header"},null,8,["modelValue","label"]),K(f,{modelValue:k(i).show_footer,"onUpdate:modelValue":w[2]||(w[2]=J=>k(i).show_footer=J),label:`${k(h)("pages.builder.show_footer")}`,class:"checkbox-custom",name:"show_footer"},null,8,["modelValue","label"])]),F("div",Ga,[F("fieldset",Ka,[w[12]||(w[12]=F("legend",{class:"text-gray-500 bg-white px-2"}," FORM ",-1)),K(y,{label:String(k(pe)(k(h)("pages.builder.form_show"))),name:"choose_form"},{default:ce(()=>[K(v,{modelValue:k(i).form.id,"onUpdate:modelValue":w[3]||(w[3]=J=>k(i).form.id=J),items:[{value:"null",label:String(k(h)("pages.builder.choose_form"))},...k(b)],placeholder:k(h)("pages.builder.choose_form"),class:"w-full",trailing:""},null,8,["modelValue","items","placeholder"])]),_:1},8,["label"]),K(y,{label:String(k(pe)(k(h)("pages.builder.type_display"))),class:"mt-3",name:"choose_form"},{default:ce(()=>[K(v,{modelValue:k(i).form.type_display,"onUpdate:modelValue":w[4]||(w[4]=J=>k(i).form.type_display=J),disabled:!k(i).form.id||k(i).form.id==="null",items:k(a),class:"w-full"},null,8,["modelValue","disabled","items"])]),_:1},8,["label"]),K(y,{label:String(k(pe)(k(h)("pages.builder.display_after"))),class:"mt-3",name:"choose_form"},{default:ce(()=>[K(v,{modelValue:k(i).form.display_after,"onUpdate:modelValue":w[5]||(w[5]=J=>k(i).form.display_after=J),disabled:!k(i).form.id||k(i).form.id==="null",items:[{value:0,label:String(k(h)("pages.builder.display_now"))},{value:1,label:`1 ${String(k(h)("pages.builder.seconds"))}`},{value:2,label:`2 ${String(k(h)("pages.builder.seconds"))}`},{value:3,label:`3 ${String(k(h)("pages.builder.seconds"))}`},{value:4,label:`4 ${String(k(h)("pages.builder.seconds"))}`},{value:5,label:`5 ${String(k(h)("pages.builder.seconds"))}`}],class:"w-full"},null,8,["modelValue","disabled","items"])]),_:1},8,["label"])]),F("fieldset",Ja,[w[13]||(w[13]=F("legend",{class:"text-gray-500 bg-white px-2"}," SEO ",-1)),K(y,{label:"Title",name:"seo_title"},{default:ce(()=>[K(k(ei),{modelValue:k(i).seo.title,"onUpdate:modelValue":w[6]||(w[6]=J=>k(i).seo.title=J),class:"w-full"},null,8,["modelValue"])]),_:1}),K(y,{class:"mt-3",label:"Description",name:"seo_description"},{default:ce(()=>[K(P,{modelValue:k(i).seo.description,"onUpdate:modelValue":w[7]||(w[7]=J=>k(i).seo.description=J),class:"w-full"},null,8,["modelValue"])]),_:1}),K(y,{label:`${k(h)("Thumbnail",{ratio:"1.91:1"})}`,ui:{label:"uppercase-first"},class:"mt-3",name:"logo"},{default:ce(()=>[k(i).seo.thumbnail?(re(),me("div",Xa,[K(E,{src:k(i).seo.thumbnail,alt:"",class:"h-[100px] aspect-[2/1] object-cover rounded-lg cursor-pointer select-none",onClick:w[8]||(w[8]=J=>p())},null,8,["src"]),K(x,{class:"absolute top-0 left-full z-1",color:"error",icon:"lucide:trash-2",size:"xs",square:"",variant:"ghost",onClick:w[9]||(w[9]=J=>k(i).seo.thumbnail=void 0)})])):(re(),ct(x,{key:1,class:"bg-primary-500 rounded-lg flex justify-center items-center h-[100px] aspect-[2/1] cursor-pointer select-none",onClick:w[10]||(w[10]=J=>p())},{default:ce(()=>[K(T,{color:"#0573ff",name:"ri:image-line",size:"20"})]),_:1}))]),_:1},8,["label"])])])])]),_:1})]),_:1},8,["schema","state"])]),_:1},8,["open"])}}}),Za=Object.assign(Qa,{__name:"ModalSetting"}),eo={class:"h-[calc(100%_-_119px)] overflow-y-auto p-3 pb-10"},to=yt({__name:"ChatStart",emits:["getInfoStart","submitInfoStart"],setup(n,{emit:d}){const g=d,o=X(""),c=X("#2b7fff"),r=X([]),h=X(["Header","Headline, subheadline","Các vấn đề khách hàng đang gặp phải","Giải pháp","Các lợi ích từ giải pháp, mỗi lợi ích 1 dòng (hoặc 1 box)","Tính năng hoặc nội dung chủ đề","Cảm nhận khách hàng, có ảnh avatar, tên, chức vụ, trên mobile cuộn ngang","Giá bán hoặc bảng giá","Quà tặng hấp dẫn, giúp khách hàng có kết quả nhanh hơn, hiệu quả hơn","Chính sách bảo hành đổi trả hàng, đồng hành đến khi có kết quả","FAQ: câu hỏi thường gặp","Footer"]),u=t=>`Chủ đề: ${o.value}
3Màu chủ đạo: ${c.value}
4Các section đã chọn:${t}
5`,l=t=>`Bạn là một AI chuyên tạo landing page để sử dụng trong nền tảng GrapesJS, tập trung vào phát triền chủ đề "${o.value}"
6- Màu chủ đạo: ${c.value}
7- Các section cần làm:${t}`,e=(t=!0)=>
7{if(!o.value||!c.value||!r.value.length){g(t?"submitInfoStart":"getInfoStart","","");return}const s=r.value.slice().sort((p,b)=>h.value.indexOf(p)-h.value.indexOf(b));let i="";s.forEach((p,b)=>{i+=`
8  + section ${b+1}: ${p}`});let a="";s.forEach(p=>{a+=`
9  - ${p}`}),g(t?"submitInfoStart":"getInfoStart",l(i),u(a))};return Je([o,c,r],()=>{e(!1)},{deep:!0}),(t,s)=>{const i=ei,a=Zn,p=tn,b=wa,m=xa,_=_a;return re(),me("div",eo,[s[6]||(s[6]=F("div",{class:"text-lg font-bold"}," Trước khi bắt đầu, hãy giúp Edubit AI hiểu về Landing Page của bạn hơn. ",-1)),K(a,{label:"Chủ đề của Landing Page bạn muốn làm là gì?",class:"mt-3",name:"topic",required:""},{default:ce(()=>[K(i,{modelValue:k(o),"onUpdate:modelValue":s[0]||(s[0]=C=>st(o)?o.value=C:null),placeholder:"Nhập chủ đề",class:"w-full"},null,8,["modelValue"])]),_:1}),K(a,{label:"Màu chủ đạo của Landing Page là gì?",name:"color",ui:{container:"flex",label:"uppercase-first"},required:"",class:"mt-3"},{default:ce(()=>[K(i,{modelValue:k(c),"onUpdate:modelValue":s[1]||(s[1]=C=>st(c)?c.value=C:null),ui:{root:"sm:w-[100px]"},type:"text"},null,8,["modelValue"]),K(m,null,{content:ce(()=>[K(b,{modelValue:k(c),"onUpdate:modelValue":s[2]||(s[2]=C=>st(c)?c.value=C:null),class:"p-2"},null,8,["modelValue"])]),default:ce(()=>[K(p,{color:"neutral",variant:"outline"},{leading:ce(()=>[F("span",{style:Jn({backgroundColor:k(c)}),class:"size-6"},null,4)]),_:1})]),_:1})]),_:1}),K(a,{label:"Bạn hãy chọn các section dưới đây để tạo 1 Landing Page hoàn chỉnh theo ý của bạn:",name:"sectionSelected",required:"",class:"mt-3"},{default:ce(()=>[K(_,{modelValue:k(r),"onUpdate:modelValue":s[3]||(s[3]=C=>st(r)?r.value=C:null),items:k(h)},null,8,["modelValue","items"])]),_:1}),s[7]||(s[7]=F("p",{class:"text-xs italic mt-5 mb-2"}," Bạn có thể nhập một số thông tin quan trọng khác vào ô bên dưới trước khi gửi, việc này sẽ giúp Edubit AI hiểu hơn về Landing Page của bạn ",-1)),K(p,{color:"primary",variant:"solid",size:"xs",disabled:!(k(o)&&k(c)&&k(r).length),onClick:s[4]||(s[4]=C=>e())},{default:ce(()=>[...s[5]||(s[5]=[Ke(" Gửi ngay ",-1)])]),_:1},8,["disabled"])])}}}),no=Object.assign(to,{__name:"ChatStart"}),io={class:"my-2 group"},ro=["innerHTML"],ao={key:0,class:"text-red-500 text-xs italic mt-1 mb-3"},oo={class:"rounded-md mt-1 p-1.5 cursor-pointer duration-75 hover:bg-[#e0e7ff]"},so={key:0,class:"size-4",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",fill:"none"},lo={key:1,xmlns:"http://www.w3.org/2000/svg",class:"size-4 text-green-600",viewBox:"0 0 20 20",fill:"currentColor"},co=yt({__name:"ChatMessage",props:{message:{},me:{type:Boolean},error:{}},emits:["previewCode","applyCode"],setup(n,{emit:d}){const g=en(),o=n,c=d,{$t:r}=bt(),h=new Rr({html:!0,breaks:!0,linkify:!0,highlight(t){return h.utils.escapeHtml(t)}});h.renderer.rules.fence=(t,s)=>{const i=t[s];if(i){const a=i.content.trim(),p=i.info.trim()||"text",b=h.utils.escapeHtml(a);return`<pre class="code-block" style="overflow: visible"><div class="relative rounded-t-[20px]"><div class="bg-[#f9f9f9] text-xs rounded-t-[20px] pt-3 pb-4 px-[0.9rem]">${p}</div><div class="sticky top-8"><div class="absolute bottom-2 right-[0.9rem] flex items-center gap-1"><button class="btn-preview flex items-center justify-end gap-1 text-xs bg-[#e0e7ff] rounded-md cursor-pointer px-2 py-1" data-code="${encodeURIComponent(a)}"><svg class="size-4" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M2.036 12.322a1.012 1.012 0 0 1 0-.639C3.423 7.51 7.36 4.5 12 4.5c4.638 0 8.573 3.007 9.963 7.178.07.207.07.431 0 .639C20.577 16.49 16.64 19.5 12 19.5c-4.638 0-8.573-3.007-9.963-7.178Z" /><path stroke-linecap="round" stroke-linejoin="round" d="M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z" /></svg>Xem trước</button><button class="btn-copy flex items-center justify-end gap-1 text-xs bg-[#e0e7ff] rounded-md cursor-pointer px-2 py-1" data-code="${encodeURIComponent(a)}"><svg class="size-4" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none"><g clip-path="url(#clip0_101_948)"><path d="M13.3333 6H7.33333C6.59695 6 6 6.59695 6 7.33333V13.3333C6 14.0697 6.59695 14.6667 7.33333 14.6667H13.3333C14.0697 14.6667 14.6667 14.0697 14.6667 13.3333V7.33333C14.6667 6.59695 14.0697 6 13.3333 6Z" stroke="black" stroke-linecap="round" stroke-linejoin="round" /><path d="M3.33325 9.99992H2.66659C2.31296 9.99992 1.97382 9.85944 1.72378 9.60939C1.47373 9.35935 1.33325 9.02021 1.33325 8.66659V2.66659C1.33325 2.31296 1.47373 1.97382 1.72378 1.72378C1.97382 1.47373 2.31296 1.33325 2.66659 1.33325H8.66659C9.02021 1.33325 9.35935 1.47373 9.60939 1.72378C9.85944 1.97382 9.99992 2.31296 9.99992 2.66659V3.33325" stroke="black" stroke-linecap="round" stroke-linejoin="round" /></g><defs><clipPath id="clip0_101_948"><rect width="16" height="16" fill="white" /></clipPath></defs></svg>Sao chép mã</button><button class="btn-apply flex items-center justify-end gap-1 text-xs bg-[#e0e7ff] rounded-md cursor-pointer px-2 py-1" data-code="${encodeURIComponent(a)}"><svg class="size-4" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M9 12.75 11.25 15 15 9.75M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z" /></svg>Áp dụng</button></div></div><code class="language-${p} block bg-[#f9f9f9] p-4 overflow-x-auto">${b}</code></div></pre>`}return""};const u=Tt(()=>h.render(o.message)),l=X(!1);async function e(){try{if(navigator.clipboard)await navigator.clipboard.writeText(o.message);else{const t=document.createElement("textarea");t.value=o.message,document.body.appendChild(t),t.select(),document.execCommand("copy"),document.body.removeChild(t)}l.value=!0,setTimeout(()=>l.value=!1,2e3)}catch(t){console.error(t)}}return Mr(async()=>{await Kt(),document.querySelectorAll(".btn-preview, .btn-copy, .btn-apply").forEach(a=>a.replaceWith(a.cloneNode(!0))),document.querySelectorAll(".code-block .btn-preview").forEach(a=>{a.addEventListener("click",async p=>{const b=p.currentTarget,m=decodeURIComponent(b.getAttribute("data-code")||"");c("previewCode",m)})}),document.querySelectorAll(".code-block .btn-copy").forEach(a=>{a.addEventListener("click",async p=>{const b=p.currentTarget,m=decodeURIComponent(b.getAttribute("data-code")||"");try{if(navigator.clipboard)await navigator.clipboard.writeText(m);else{const _=document.createElement("textarea");_.value=m,document.body.appendChild(_),_.select(),document.execCommand("copy"),document.body.removeChild(_)}a.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" class="size-4 text-green-600" viewB
9ox="0 0 20 20" fill="currentColor"><path fill-rule="evenodd" d="M16.707 5.293a1 1 0 010 1.414L8.414 15l-4.121-4.121a1 1 0 111.414-1.414L8.414 12.586l7.293-7.293a1 1 0 011.414 0z" clip-rule="evenodd" /></svg>Đã sao chép',setTimeout(()=>{a.innerHTML='<svg class="size-4" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none"><g clip-path="url(#clip0_101_948)"><path d="M13.3333 6H7.33333C6.59695 6 6 6.59695 6 7.33333V13.3333C6 14.0697 6.59695 14.6667 7.33333 14.6667H13.3333C14.0697 14.6667 14.6667 14.0697 14.6667 13.3333V7.33333C14.6667 6.59695 14.0697 6 13.3333 6Z" stroke="black" stroke-linecap="round" stroke-linejoin="round" /><path d="M3.33325 9.99992H2.66659C2.31296 9.99992 1.97382 9.85944 1.72378 9.60939C1.47373 9.35935 1.33325 9.02021 1.33325 8.66659V2.66659C1.33325 2.31296 1.47373 1.97382 1.72378 1.72378C1.97382 1.47373 2.31296 1.33325 2.66659 1.33325H8.66659C9.02021 1.33325 9.35935 1.47373 9.60939 1.72378C9.85944 1.97382 9.99992 2.31296 9.99992 2.66659V3.33325" stroke="black" stroke-linecap="round" stroke-linejoin="round" /></g><defs><clipPath id="clip0_101_948"><rect width="16" height="16" fill="white" /></clipPath></defs></svg>Sao chép mã'},2e3)}catch(_){console.error(_)}})}),document.querySelectorAll(".code-block .btn-apply").forEach(a=>{a.addEventListener("click",async p=>{const b=p.currentTarget,m=decodeURIComponent(b.getAttribute("data-code")||""),_=g.create(Gt,{props:{title:`${pe(`${r("pages.builder.title_confirm_save")}`)}`,body:"Bạn có chắc chắn muốn áp dụng đoạn code này vào giao diện không?",okText:"Áp dụng",onConfirm(){c("applyCode",m),_.close()}}});_.open()})})}),(t,s)=>{const i=Ir;return re(),me("div",io,[F("div",{class:je(["flex",o.me?"justify-end":"justify-start"])},[F("div",{class:je(["text-sm prose leading-relaxed",o.me?"max-w-[80%] bg-[#e0e7ff] rounded-2xl px-4 py-2 prose-me":"w-full text-gray-800"]),innerHTML:u.value},null,10,ro)],2),F("div",{class:je(["flex items-center gap-3 duration-200 group-hover:opacity-100",[o.me?"justify-end":"justify-start",n.error?"opacity-100":"opacity-0"]])},[n.error?(re(),me("div",ao,dt(n.error),1)):(re(),ct(i,{key:1,text:`${("capitalize"in t?t.capitalize:k(pe))(k(r)("copy"))}`,content:{align:"center",side:"top"},mode:"hover",onClick:e},{default:ce(()=>[F("div",oo,[k(l)?(re(),me("svg",lo,[...s[1]||(s[1]=[F("path",{"fill-rule":"evenodd",d:"M16.707 5.293a1 1 0 010 1.414L8.414 15l-4.121-4.121a1 1 0 111.414-1.414L8.414 12.586l7.293-7.293a1 1 0 011.414 0z","clip-rule":"evenodd"},null,-1)])])):(re(),me("svg",so,[...s[0]||(s[0]=[F("g",{"clip-path":"url(#clip0_101_948)"},[F("path",{d:"M13.3333 6H7.33333C6.59695 6 6 6.59695 6 7.33333V13.3333C6 14.0697 6.59695 14.6667 7.33333 14.6667H13.3333C14.0697 14.6667 14.6667 14.0697 14.6667 13.3333V7.33333C14.6667 6.59695 14.0697 6 13.3333 6Z",stroke:"black","stroke-linecap":"round","stroke-linejoin":"round"}),F("path",{d:"M3.33325 9.99992H2.66659C2.31296 9.99992 1.97382 9.85944 1.72378 9.60939C1.47373 9.35935 1.33325 9.02021 1.33325 8.66659V2.66659C1.33325 2.31296 1.47373 1.97382 1.72378 1.72378C1.97382 1.47373 2.31296 1.33325 2.66659 1.33325H8.66659C9.02021 1.33325 9.35935 1.47373 9.60939 1.72378C9.85944 1.97382 9.99992 2.31296 9.99992 2.66659V3.33325",stroke:"black","stroke-linecap":"round","stroke-linejoin":"round"})],-1),F("defs",null,[F("clipPath",{id:"clip0_101_948"},[F("rect",{width:"16",height:"16",fill:"white"})])],-1)])]))])]),_:1},8,["text"]))],2)])}}}),uo=Object.assign(co,{__name:"ChatMessage"}),po={class:"flex flex-col h-full"},ho={class:"flex items-center justify-between border-b border-b-gray-200 p-3"},fo={key:1,class:"flex items-center justify-start my-2"},go={class:"rounded-2xl rounded-bl-none py-2 whitespace-pre-line flex items-center transition-all duration-200"},mo={key:1,class:"typing text-sm prose leading-relaxed"},bo=["innerHTML"],yo={key:2,class:"invisible"},vo={key:0,class:"text-lg text-center mb-5"},wo={class:"flex items-center justify-end text-xs mb-1"},xo={key:0},_o={class:"text-xs text-center mt-2"},vi=10,Co=yt({__name:"ChatWithAi",props:{page:{},gjsData:{}},emits:["applyCode"],setup(n,{emit:d}){const g=d,o=n,{$t:c}=bt(),r=Zt(),h=X(!1),u=X(!1),l=X(null),e=X(!1),t=X(""),s=X(""),i=X(""),a=X(null),p=X("append"),b=X(!1),m=X(!1),_=X(!1),C=X(""),w=X(null),x=X(null),f=new Rr({breaks:!0,linkify:!0,highlight(Z){return`<pre class="hljs"><code>${f.utils.escapeHtml(Z)}</code></pre>`}}),v=Tt(()=>f.render(C.value)),y=X([]),P=X(0),E=X(!0),T=X(!1),B=X(!1),z=async(Z=!1)=>
9{if(T.value||!E.value)return;T.value=!0;const N=await $fetch(`/api/v1/gemini/${o.page._id}?skip=${P.value}&limit=${vi}`,{headers:lt()});N.length<vi&&(E.value=!1),P.value+=N.length;const Se=N.reverse().flatMap(ke=>[{text:ke.original_prompt&&ke.original_prompt!==ke.prompt?ke.original_prompt:ke.prompt,me:!0},{text:ke.response_text,me:!1}]);Z?(p.value="prepend",y.value=[...Se,...y.value]):(B.value=!0,p.value="append",y.value=Se,e.value=!o.page?.content&&!o.gjsData&&!y.value.length),T.value=!1},Y=X(0),J=X(0),I=Tt(()=>Y.value.toLocaleString()),H=Tt(()=>J.value.toLocaleString());function Q(Z,N,Se=800){const ke=Z.value,he=N-ke;if(he===0)return;const ae=performance.now(),Pe=Ze=>{const te=Math.min((Ze-ae)/Se,1);Z.value=Math.round(ke+he*te),te<1&&requestAnimationFrame(Pe)};requestAnimationFrame(Pe)}const D=async()=>{const Z=await $fetch("/api/v1/gemini/get-credit",{headers:lt()});Q(Y,Z.total_used_credit??0),Q(J,Z.total_remaining_credit??0)};function j(){return new Promise(requestAnimationFrame)}async function G(Z="auto"){l.value&&(await Kt(),await j(),l.value.scrollTo({top:l.value.scrollHeight,behavior:Z}))}Je(y,async()=>{!h.value||p.value!=="append"||await G("smooth")},{deep:!0});async function V(){const Z=l.value;if(!Z)return;const N=Z.scrollTop+Z.clientHeight>=Z.scrollHeight-50;if(b.value=!N,p.value=N?"append":"scrollUp",Z.scrollTop===0&&E.value&&!T.value){const Se=Z.scrollHeight;await z(!0),await Kt(),Z.scrollTop=Z.scrollHeight-Se}}async function q(){h.value=!0,u.value||await z(),await G("auto"),u.value=!0,await D()}const O=async(Z,N)=>{t.value=Z,s.value=N},de=async()=>{await ye()};async function ye(){if(m.value)return;let Z=i.value.trim(),N=i.value.trim();t.value&&s.value&&(Z?(N=`${s.value}
10${Z}`,Z=`${t.value}
11${Z}
12Bây giờ bạn hãy bắt đầu viết, khi bắt đầu một section hãy đánh dấu section đó bằng tiêu đề của section.`):(N=s.value,Z=`${t.value}
13Bây giờ bạn hãy bắt đầu viết, khi bắt đầu một section hãy đánh dấu section đó bằng tiêu đề của section.`)),!(!Z&&!N)&&(y.value.push({text:N,me:!0}),i.value="",m.value=!0,_.value=!0,p.value="append",await $fetch("/api/v1/gemini/send-message",{method:"POST",body:{page_v2_id:o.page._id,prompt:Z,original_prompt:N},onResponse({response:Se}){if(Se._data){let ke=function(){w.value&&(clearInterval(w.value),w.value=null),x.value&&(clearTimeout(x.value),x.value=null),C.value="",y.value.push({text:he,me:!1}),m.value=!1};const he=Se._data;C.value="",_.value=!1,e.value=!1,t.value="",s.value="",D();let ae=0;w.value&&(clearInterval(w.value),w.value=null),x.value&&(clearTimeout(x.value),x.value=null),w.value=gr(()=>{ae<he.length?(C.value+=he[ae],ae++,p.value!=="scrollUp"&&G("smooth")):ke()},10),x.value=setTimeout(()=>{ke()},30*1e3)}else Se.status===403&&(m.value=!1,_.value=!1,r.add({description:"Bạn không có quyền thực hiện hành động này",color:"error"}))},onResponseError({response:Se}){if(C.value="",_.value=!1,clearInterval(w.value),w.value=null,m.value=!1,y.value.length>0){const ke=y.value.length-1;y.value[ke]&&(y.value[ke]={...y.value[ke],error:Se._data?.message??`${pe(`${c("error_occurred")}`)}`})}}}))}ma(()=>{w.value&&clearInterval(w.value)});const Ce=X(!1),Ee=X(null),Ue=async()=>{Ce.value=!0;let Z=i.value.trim();t.value&&s.value&&(Z?Z=`${t.value}
14${Z}
15Bây giờ bạn hãy bắt đầu viết, khi bắt đầu một section hãy đánh dấu section đó bằng tiêu đề của section.`:Z=`${t.value}
16Bây giờ bạn hãy bắt đầu viết, khi bắt đầu một section hãy đánh dấu section đó bằng tiêu đề của section.`),await $fetch("/api/v1/gemini/count-credit",{method:"POST",body:{page_v2_id:o.page._id,prompt:Z},onResponse({response:N}){N._data&&(Ee.value=N._data,Ce.value=!1)},onResponseError(){Ce.value=!1,Ee.value=null,r.add({description:"Không thể tính toán số credit cho yêu cầu này.",color:"error"})}})},Te=X(!1);let Be=0;function He(){Te.value=!0}function ze(){Te.value=!1}function We(Z){Te.value||Z.preventDefault()}function Ae(){if(Te.value)return;const Z=Date.now();Z-Be<300||(Be=Z,ye())}const De=X(1);Je(i,async Z=>{De.value=Z.split(`
17`).length,Ee.value=null});const Ve=Z=>
17{if(Z.target.closest("button, svg, path, .cursor-pointer"))return;a.value?.$el?.querySelector("textarea")?.focus()},$e=X(!1),Qe=X(""),rt=Z=>{Qe.value=Z,$e.value=!0};Je($e,async Z=>{if(Z){await Kt();const N=document.getElementById("previewFrame");N&&N.contentDocument&&(N.contentDocument.open(),N.contentDocument.write(Qe.value),N.contentDocument.close())}});const wt=Z=>{g("applyCode",Z)};return(Z,N)=>{const Se=Yn,ke=Ir,he=mr,ae=no,Pe=Ca,Ze=uo,te=nn,at=_r,et=rn;return re(),me(it,null,[K(ke,{text:"Landing Page AI",content:{align:"center",side:"top"},mode:"hover"},{default:ce(()=>[F("div",{class:"fixed bottom-3 left-3 z-[9998] size-12 flex items-center text-center bg-white rounded-full shadow-[0_0_35px_rgba(0,0,0,0.25)] cursor-pointer overflow-hidden",onClick:q},[K(Se,{class:"w-10 mx-auto",src:"/images/ai-chat-icon.png"})])]),_:1}),F("div",{class:je(["fixed bottom-0 left-0 z-[9999] w-[500px] max-w-[90%] h-[calc(100%_-_42px)] bg-white shadow-[0_0_35px_rgba(0,0,0,0.25)] rounded-t-xl transition-all duration-150 ease-out",k(h)?"opacity-100 translate-y-0 scale-100":"opacity-0 translate-y-5 scale-95 pointer-events-none"])},[F("div",po,[F("div",ho,[N[6]||(N[6]=F("div",{class:"font-bold"}," Edubit AI ",-1)),K(he,{name:"mdi:close",class:"cursor-pointer size-5",onClick:N[0]||(N[0]=xe=>h.value=!1)})]),k(B)?(re(),me(it,{key:0},[!o.page?.content&&!o.gjsData&&!k(y).length?(re(),ct(ae,{key:0,onGetInfoStart:O,onSubmitInfoStart:de})):ot("",!0),k(y).length?(re(),me("div",{key:1,ref_key:"chatContent",ref:l,class:"chat-content h-[calc(100%_-_119px)] overflow-y-auto p-3 pb-10",onScroll:V},[k(T)?(re(),ct(Pe,{key:0,size:"15px",class:"mx-auto my-3"})):ot("",!0),(re(!0),me(it,null,Et(k(y),(xe,xt)=>(re(),ct(Ze,{key:xt,message:xe.text,me:xe.me,error:xe?.error,onPreviewCode:rt,onApplyCode:wt},null,8,["message","me","error"]))),128)),k(m)?(re(),me("div",fo,[F("div",go,[k(_)?(re(),me(it,{key:0},[N[7]||(N[7]=F("span",{class:"dot"},null,-1)),N[8]||(N[8]=F("span",{class:"dot"},null,-1)),N[9]||(N[9]=F("span",{class:"dot"},null,-1))],64)):k(C)?(re(),me("div",mo,[F("div",{innerHTML:k(v)},null,8,bo)])):(re(),me("span",yo,"▋"))])])):ot("",!0)],544)):ot("",!0),F("div",{class:je(["relative px-3 py-2",k(y).length?"mt-auto":o.page?.content||o.gjsData?"my-auto":"mt-auto"])},[(o.page?.content||o.gjsData)&&!k(y).length?(re(),me("div",vo,[...N[10]||(N[10]=[Ke(" Chào mừng bạn đến với ",-1),F("b",null,"Edubit AI",-1),Ke(", nơi giúp bạn tạo/chỉnh sửa landing page một cách nhanh chóng, ",-1),F("br",null,null,-1),Ke("dễ dàng và hiệu quả hơn bao giờ hết! ",-1)])])):ot("",!0),K(ba,{name:"fade"},{default:ce(()=>[k(b)?(re(),me("button",{key:0,class:"absolute -top-10 left-1/2 -translate-x-1/2 flex items-center justify-center size-8 bg-white hover:bg-gray-50 border border-gray-300 rounded-full cursor-pointer",onClick:N[1]||(N[1]=xe=>G("smooth"))},[K(te,{name:"mdi:arrow-down",class:"size-5"})])):ot("",!0)]),_:1}),gt(F("div",wo,[k(Ee)!==null?(re(),me("span",xo,[N[11]||(N[11]=Ke("Yêu cầu này được ước lượng sẽ sử dụng ",-1)),F("b",null,dt(k(Ee))+" credit",1)])):(re(),me("div",{key:1,class:"flex items-center justify-end gap-2 underline cursor-pointer hover:text-primary",onClick:Ue},[gt(K(Pe,{size:"10px"},null,512),[[mt,k(Ce)]]),N[12]||(N[12]=F("span",null,[Ke("Kiểm tra số "),F("b",null,"credit"),Ke(" sử dụng cho yêu cầu này")],-1))]))],512),[[mt,!k(_)&&(!k(e)&&k(i)||k(t))]]),F("div",{class:je(["relative w-full bg-white border border-gray-300 rounded-[28px] cursor-text",k(w)?"cursor-not-allowed":""]),onClick:Ve},[K(at,{ref_key:"textareaRef",ref:a,modelValue:k(i),"onUpdate:modelValue":N[2]||(N[2]=xe=>st(i)?i.value=xe:null),placeholder:"Gửi yêu cầu",variant:"none",autoresize:"",rows:1,class:je(["w-full border-none focus:ring-0 resize-none",k(De)===1?"pr-5":"px-0"]),ui:{base:`${k(De)===1?"pl-5.5 pr-7 py-3":"textarea-chat-ai max-h-[200px] px-4.5 pt-3 mb-15"}`},disabled:!!k(w),onKeydown:[N[3]||(N[3]=pn(hn(()=>{},["shift","stop"]),["enter"])),pn(hn(We,["exact","prevent"]),["enter"])],onKeyup:pn(hn(Ae,["exact","prevent","stop"]),["enter"]),onCompositionstart:He,onCompositionend:ze},null,8,["modelValue","class","ui","disabled","onKeydown","onKeyup"]),K(ke,{text:"Gửi",content:{align:"center",side:"top"},mode:"hover",class:"absolute bottom-1.5 right-2 z-10"},{default:ce(()=>[F("div",{class:je(["flex items-center justify-center size-8 rounded-full",!k(e)&&k(i)||k(t)?"bg-black cursor-pointer":"bg-[#ececec] curs
17or-not-allowed"]),onClick:N[4]||(N[4]=xe=>!k(e)&&k(i)||k(t)?ye():null)},[(re(),me("svg",{class:je(["size-5 -rotate-45 outline-none",!k(e)&&k(i)||k(t)?"text-white":""]),xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},[...N[13]||(N[13]=[F("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.8",d:"M14.76 12H6.832m0 0c0-.275-.057-.55-.17-.808L4.285 5.814c-.76-1.72 1.058-3.442 2.734-2.591L20.8 10.217c1.46.74 1.46 2.826 0 3.566L7.02 20.777c-1.677.851-3.495-.872-2.735-2.591l2.375-5.378A2 2 0 0 0 6.83 12"},null,-1)])],2))],2)]),_:1})],2),F("div",_o,[N[14]||(N[14]=Ke(" Đã dùng ",-1)),F("b",null,dt(k(I)),1),N[15]||(N[15]=Ke(" credits, còn lại ",-1)),F("b",null,dt(k(H)),1),N[16]||(N[16]=Ke(" credits ",-1))])],2)],64)):ot("",!0)])],2),K(et,{open:k($e),"onUpdate:open":N[5]||(N[5]=xe=>st($e)?$e.value=xe:null),title:"Xem trước",ui:{content:"w-full sm:max-w-[75dvw]"}},{body:ce(()=>[...N[17]||(N[17]=[F("iframe",{id:"previewFrame",class:"w-full h-[80vh] border-0 rounded-lg"},null,-1)])]),_:1},8,["open"])],64)}}}),ko=Object.assign(br(Co,[["__scopeId","data-v-a4a1d2d6"]]),{__name:"ChatWithAi"});var Vt={exports:{}},wi;function So(){if(wi)return Vt.exports;wi=1;var n=String,d=function(){return{isColorSupported:!1,reset:n,bold:n,dim:n,italic:n,underline:n,inverse:n,hidden:n,strikethrough:n,black:n,red:n,green:n,yellow:n,blue:n,magenta:n,cyan:n,white:n,gray:n,bgBlack:n,bgRed:n,bgGreen:n,bgYellow:n,bgBlue:n,bgMagenta:n,bgCyan:n,bgWhite:n,blackBright:n,redBright:n,greenBright:n,yellowBright:n,blueBright:n,magentaBright:n,cyanBright:n,whiteBright:n,bgBlackBright:n,bgRedBright:n,bgGreenBright:n,bgYellowBright:n,bgBlueBright:n,bgMagentaBright:n,bgCyanBright:n,bgWhiteBright:n}};return Vt.exports=d(),Vt.exports.createColors=d,Vt.exports}const Eo={},To=Object.freeze(Object.defineProperty({__proto__:null,default:Eo},Symbol.toStringTag,{value:"Module"})),Ye=ya(To);var gn,xi;function ti(){if(xi)return gn;xi=1;let n=So(),d=Ye;class g extends Error{constructor(c,r,h,u,l,e){super(c),this.name="CssSyntaxError",this.reason=c,l&&(this.file=l),u&&(this.source=u),e&&(this.plugin=e),typeof r<"u"&&typeof h<"u"&&(typeof r=="number"?(this.line=r,this.column=h):(this.line=r.line,this.column=r.column,this.endLine=h.line,this.endColumn=h.column)),this.setMessage(),Error.captureStackTrace&&Error.captureStackTrace(this,g)}setMessage(){this.message=this.plugin?this.plugin+": ":"",this.message+=this.file?this.file:"<css input>",typeof this.line<"u"&&(this.message+=":"+this.line+":"+this.column),this.message+=": "+this.reason}showSourceCode(c){if(!this.source)return"";let r=this.source;c==null&&(c=n.isColorSupported);let h=a=>a,u=a=>a,l=a=>a;if(c){let{bold:a,gray:p,red:b}=n.createColors(!0);u=m=>a(b(m)),h=m=>p(m),d&&(l=m=>d(m))}let e=r.split(/\r?\n/),t=Math.max(this.line-3,0),s=Math.min(this.line+2,e.length),i=String(s).length;return e.slice(t,s).map((a,p)=>{let b=t+1+p,m=" "+(" "+b).slice(-i)+" | ";if(b===this.line){if(a.length>160){let C=20,w=Math.max(0,this.column-C),x=Math.max(this.column+C,this.endColumn+C),f=a.slice(w,x),v=h(m.replace(/\d/g," "))+a.slice(0,Math.min(this.column-1,C-1)).replace(/[^\t]/g," ");return u(">")+h(m)+l(f)+`
18 `+v+u("^")}let _=h(m.replace(/\d/g," "))+a.slice(0,this.column-1).replace(/[^\t]/g," ");return u(">")+h(m)+l(a)+`
19 `+_+u("^")}return" "+h(m)+l(a)}).join(`
20`)}toString(){let c=this.showSourceCode();return c&&(c=`
21
22`+c+`
23`),this.name+": "+this.message+c}}return gn=g,g.default=g,gn}var mn,_i;function zr(){if(_i)return mn;_i=1;const n=/(<)(\/?style\b)/gi,d=/(<)(!--)/g;function g(h){return typeof h!="string"||!h.includes("<")?h:h.replace(n,"\\3c $2").replace(d,"\\3c $2")}const o={after:`
24`,beforeClose:`
25`,beforeComment:`
26`,beforeDecl:`
27`,beforeOpen:" ",beforeRule:`
28`,colon:": ",commentLeft:" ",commentRight:" ",emptyBody:"",indent:"    ",semicolon:!1};function c(h){return h[0].toUpperCase()+h.slice(1)}
28class r{constructor(u){this.builder=u}atrule(u,l){let e=u.raws,t="@"+u.name,s=u.params?this.rawValue(u,"params"):"";if(typeof e.afterName<"u"?t+=e.afterName:s&&(t+=" "),u.nodes)this.block(u,t+s);else{let i=(e.between||"")+(l?";":"");this.builder(g(t+s+i),u)}}beforeAfter(u,l){let e;u.type==="decl"?e=this.raw(u,null,"beforeDecl"):u.type==="comment"?e=this.raw(u,null,"beforeComment"):l==="before"?e=this.raw(u,null,"beforeRule"):e=this.raw(u,null,"beforeClose");let t=u.parent,s=0;for(;t&&t.type!=="root";)s+=1,t=t.parent;if(e.includes(`
29`)){let i=this.raw(u,null,"indent");if(i.length)for(let a=0;a<s;a++)e+=i}return e}block(u,l){let e=this.raw(u,"between","beforeOpen");this.builder(g(l+e)+"{",u,"start");let t;u.nodes&&u.nodes.length?(this.body(u),t=this.raw(u,"after")):t=this.raw(u,"after","emptyBody"),t&&this.builder(g(t)),this.builder("}",u,"end")}body(u){let l=u.nodes,e=l.length-1;for(;e>0&&l[e].type==="comment";)e-=1;let t=this.raw(u,"semicolon"),s=u.type==="document";for(let i=0;i<l.length;i++){let a=l[i],p=this.raw(a,"before");p&&this.builder(s?p:g(p)),this.stringify(a,e!==i||t)}}comment(u){let l=this.raw(u,"left","commentLeft"),e=this.raw(u,"right","commentRight");this.builder(g("/*"+l+u.text+e+"*/"),u)}decl(u,l){let e=u.raws,t=this.raw(u,"between","colon"),s=u.prop+t+this.rawValue(u,"value");u.important&&(s+=e.important||" !important"),l&&(s+=";"),this.builder(g(s),u)}document(u){this.body(u)}raw(u,l,e){let t;if(e||(e=l),l&&(t=u.raws[l],typeof t<"u"))return t;let s=u.parent;if(e==="before"&&(!s||s.type==="root"&&s.first===u||s&&s.type==="document"))return"";if(!s)return o[e];let i=u.root(),a=i.rawCache||(i.rawCache={});if(typeof a[e]<"u")return a[e];if(e==="before"||e==="after")return this.beforeAfter(u,e);{let p="raw"+c(e);this[p]?t=this[p](i,u):i.walk(b=>{if(t=b.raws[l],typeof t<"u")return!1})}return typeof t>"u"&&(t=o[e]),a[e]=t,t}rawBeforeClose(u){let l;return u.walk(e=>{if(e.nodes&&e.nodes.length>0&&typeof e.raws.after<"u")return l=e.raws.after,l.includes(`
30`)&&(l=l.replace(/[^\n]+$/,"")),!1}),l&&(l=l.replace(/\S/g,"")),l}rawBeforeComment(u,l){let e;return u.walkComments(t=>{if(typeof t.raws.before<"u")return e=t.raws.before,e.includes(`
31`)&&(e=e.replace(/[^\n]+$/,"")),!1}),typeof e>"u"?e=this.raw(l,null,"beforeDecl"):e&&(e=e.replace(/\S/g,"")),e}rawBeforeDecl(u,l){let e;return u.walkDecls(t=>{if(typeof t.raws.before<"u")return e=t.raws.before,e.includes(`
32`)&&(e=e.replace(/[^\n]+$/,"")),!1}),typeof e>"u"?e=this.raw(l,null,"beforeRule"):e&&(e=e.replace(/\S/g,"")),e}rawBeforeOpen(u){let l;return u.walk(e=>{if(e.type!=="decl"&&(l=e.raws.between,typeof l<"u"))return!1}),l}rawBeforeRule(u){let l;return u.walk(e=>{if(e.nodes&&(e.parent!==u||u.first!==e)&&typeof e.raws.before<"u")return l=e.raws.before,l.includes(`
33`)&&(l=l.replace(/[^\n]+$/,"")),!1}),l&&(l=l.replace(/\S/g,"")),l}rawColon(u){let l;return u.walkDecls(e=>{if(typeof e.raws.between<"u")return l=e.raws.between.replace(/[^\s:]/g,""),!1}),l}rawEmptyBody(u){let l;return u.walk(e=>{if(e.nodes&&e.nodes.length===0&&(l=e.raws.after,typeof l<"u"))return!1}),l}rawIndent(u){if(u.raws.indent)return u.raws.indent;let l;return u.walk(e=>{let t=e.parent;if(t&&t!==u&&t.parent&&t.parent===u&&typeof e.raws.before<"u"){let s=e.raws.before.split(`
34`);return l=s[s.length-1],l=l.replace(/\S/g,""),!1}}),l}rawSemicolon(u){let l;return u.walk(e=>{if(e.nodes&&e.nodes.length&&e.last.type==="decl"&&(l=e.raws.semicolon,typeof l<"u"))return!1}),l}rawValue(u,l){let e=u[l],t=u.raws[l];return t&&t.value===e?t.raw:e}root(u){if(this.body(u),u.raws.after){let l=u.raws.after,e=u.parent&&u.parent.type==="document";this.builder(e?l:g(l))}}rule(u){this.block(u,this.rawValue(u,"selector")),u.raws.ownSemicolon&&this.builder(g(u.raws.ownSemicolon),u,"end")}stringify(u,l){if(!this[u.type])throw new Error("Unknown AST node type "+u.type+". Maybe you need to change PostCSS stringifier.");this[u.type](u,l)}}return mn=r,r.default=r,mn}var bn,Ci;function an(){if(Ci)return bn;Ci=1;let n=zr();function d(g,o){new n(o).stringify(g)}return bn=d,d.default=d,bn}var Nt={},ki;function ni(){return ki||(ki=1,Nt.isClean=Symbol("isClean"),Nt.my=Symbol("my")),Nt}var yn,Si;function on(){if(Si)return yn;Si=1;let n=ti(),d=zr(),g=an(),{isClean:o,my:c}=ni();function r(l,e){let t=new l.constructor;for(let s in l){if(!Object.prototype.hasOwnProperty.call(l,s)||s==="proxyCache")continue;let i=l[s],a=typeof i;s==="parent"&&a==="object"?e&&(t[s]=e):s==="source"?t[s]=i:Array.isArray(i)?t[s]=i.map(p=>r(p,t)):(a==="object"&&i!==null&&(i=r(i)),t[s]=i)}return t}function h(l,e){if(e&&typeof e.offset<"u")return e.offset;let t=1,s=1,i=0;for(let a=0;a<l.length;a++){if(s===e.line&&t===e.column){i=a;break}l[a]===`
35`?(t=1,s+=1):t+=1}return i}class u{get proxyOf(){return this}constructor(e={}){this.raws={},this[o]=!1,this[c]=!0;for(let t in e)if(t==="nodes"){this.nodes=[];for(let s of e[t])typeof s.clone=="function"?this.append(s.clone()):this.append(s)}else this[t]=e[t]}addToError(e){if(e.postcssNode=this,e.stack&&this.source&&/\n\s{4}at /.test(e.stack)){let t=this.source;e.stack=e.stack.replace(/\n\s{4}at /,`$&${t.input.from}:${t.start.line}:${t.start.column}$&`)}return e}after(e){return this.parent.insertAfter(this,e),this}assign(e={}){for(let t in e)this[t]=e[t];return this}before(e){return this.parent.insertBefore(this,e),this}cleanRaws(e){delete this.raws.before,delete this.raws.after,e||delete this.raws.between}clone(e={}){let t=r(this);for(let s in e)t[s]=e[s];return t}cloneAfter(e={}){let t=this.clone(e);return this.parent.insertAfter(this,t),t}cloneBefore(e={}){let t=this.clone(e);return this.parent.insertBefore(this,t),t}
35error(e,t={}){if(this.source){let{end:s,start:i}=this.rangeBy(t);return this.source.input.error(e,{column:i.column,line:i.line},{column:s.column,line:s.line},t)}return new n(e)}getProxyProcessor(){return{get(e,t){return t==="proxyOf"?e:t==="root"?()=>e.root().toProxy():e[t]},set(e,t,s){return e[t]===s||(e[t]=s,(t==="prop"||t==="value"||t==="name"||t==="params"||t==="important"||t==="text")&&e.markDirty()),!0}}}markClean(){this[o]=!0}markDirty(){if(this[o]){this[o]=!1;let e=this;for(;e=e.parent;)e[o]=!1}}next(){if(!this.parent)return;let e=this.parent.index(this);return this.parent.nodes[e+1]}positionBy(e={}){let t=this.source.start;if(e.index)t=this.positionInside(e.index);else if(e.word){let s="document"in this.source.input?this.source.input.document:this.source.input.css,a=s.slice(h(s,this.source.start),h(s,this.source.end)).indexOf(e.word);a!==-1&&(t=this.positionInside(a))}return t}positionInside(e){let t=this.source.start.column,s=this.source.start.line,i="document"in this.source.input?this.source.input.document:this.source.input.css,a=h(i,this.source.start),p=a+e;for(let b=a;b<p;b++)i[b]===`
36`?(t=1,s+=1):t+=1;return{column:t,line:s,offset:p}}prev(){if(!this.parent)return;let e=this.parent.index(this);return this.parent.nodes[e-1]}rangeBy(e={}){let t="document"in this.source.input?this.source.input.document:this.source.input.css,s={column:this.source.start.column,line:this.source.start.line,offset:h(t,this.source.start)},i=this.source.end?{column:this.source.end.column+1,line:this.source.end.line,offset:typeof this.source.end.offset=="number"?this.source.end.offset:h(t,this.source.end)+1}:{column:s.column+1,line:s.line,offset:s.offset+1};if(e.word){let p=t.slice(h(t,this.source.start),h(t,this.source.end)).indexOf(e.word);p!==-1&&(s=this.positionInside(p),i=this.positionInside(p+e.word.length))}else e.start?s={column:e.start.column,line:e.start.line,offset:h(t,e.start)}:e.index&&(s=this.positionInside(e.index)),e.end?i={column:e.end.column,line:e.end.line,offset:h(t,e.end)}:typeof e.endIndex=="number"?i=this.positionInside(e.endIndex):e.index&&(i=this.positionInside(e.index+1));return(i.line<s.line||i.line===s.line&&i.column<=s.column)&&(i={column:s.column+1,line:s.line,offset:s.offset+1}),{end:i,start:s}}raw(e,t){return new d().raw(this,e,t)}remove(){return this.parent&&this.parent.removeChild(this),this.parent=void 0,this}replaceWith(...e){if(this.parent){let t=this,s=!1;for(let i of e)i===this?s=!0:s?(this.parent.insertAfter(t,i),t=i):this.parent.insertBefore(t,i);s||this.remove()}return this}root(){let e=this;for(;e.parent&&e.parent.type!=="document";)e=e.parent;return e}toJSON(e,t){let s={},i=t==null;t=t||new Map;let a=0;for(let p in this){if(!Object.prototype.hasOwnProperty.call(this,p)||p==="parent"||p==="proxyCache")continue;let b=this[p];if(Array.isArray(b))s[p]=b.map(m=>typeof m=="object"&&m.toJSON?m.toJSON(null,t):m);else if(typeof b=="object"&&b.toJSON)s[p]=b.toJSON(null,t);else if(p==="source"){if(b==null)continue;let m=t.get(b.input);m==null&&(m=a,t.set(b.input,a),a++),s[p]={end:b.end,inputId:m,start:b.start}}else s[p]=b}return i&&(s.inputs=[...t.keys()].map(p=>p.toJSON())),s}toProxy(){return this.proxyCache||(this.proxyCache=new Proxy(this,this.getProxyProcessor())),this.proxyCache}toString(e=g){e.stringify&&(e=e.stringify);let t="";return e(this,s=>{t+=s}),t}warn(e,t,s={}){let i={node:this};for(let a in s)i[a]=s[a];return e.warn(t,i)}}return yn=u,u.default=u,yn}var vn,Ei;function Bt(){if(Ei)return vn;Ei=1;let n=on();class d extends n{constructor(o){super(o),this.type="comment"}}return vn=d,d.default=d,vn}var wn,Ti;function sn(){if(Ti)return wn;Ti=1;let n=on();class d extends n{get variable(){return this.prop.startsWith("--")||this.prop[0]==="$"}constructor(o){o&&typeof o.value<"u"&&typeof o.value!="string"&&(o={...o,value:String(o.value)}),super(o),this.type="decl"}}return wn=d,d.default=d,wn}var xn,$i;function vt(){if($i)return xn;$i=1;let n=Bt(),d=sn(),g=on(),{isClean:o,my:c}=ni(),r,h,u,l;function e(i){return i.map(a=>(a.nodes&&(a.nodes=e(a.nodes)),delete a.source,a))}function t(i){if(i[o]=!1,i.proxyOf.nodes)for(let a of i.proxyOf.nodes)t(a)}class s extends g{get first(){if(this.proxyOf.nodes)return this.proxyOf.nodes[0]}get last(){if(this.proxyOf.nodes)return this.proxyOf.nodes[this.proxyOf.nodes.length-1]}append(...a){for(let p of a){let b=this.normalize(p,this.last);for(let m of b)this.proxyOf.nodes.push(m)}return this.markDirty(),this}cleanRaws(a){if(super.cleanRaws(a),this.nodes)for(let p of this.nodes)p.cleanRaws(a)}each(a){if(!this.proxyOf.nodes)return;let p=this.getIterator(),b,m;for(;this.indexes[p]<this.proxyOf.nodes.length&&(b=this.indexes[p],m=a(this.proxyOf.nodes[b],b),m!==!1);)this.indexes[p]+=1;return delete this.indexes[p],m}every(a){return this.nodes.every(a)}getIterator(){this.lastEach||(this.lastEach=0),this.indexes||(this.indexes={}),this.lastEach+=1;let a=this.lastEach;return this.indexes[a]=0,a}getProxyProcessor(){return{get(a,p){return p==="proxyOf"?a:a[p]?p==="each"||typeof p=="string"&&p.startsWith("walk")?(...b)=>a[p](...b.map(m=>typeof m=="function"?(_,C)=>m(_.toProxy(),C):m)):p==="every"||p==="some"?b=>a[p]((m,..._)=>b(m.toProxy(),..._)):p==="root"?()=>a.root().toProxy():p==="nodes"?a.nodes.map(b=>b.toProxy()):p==="first"||p==="last"?a[p].toProxy():a[p]:a[p]},set(a,p,b){return a[p]===b||(a[p]=b,(p==="name"||p==="params"||p==="selector")&&a.markDirty()),!0}}}index(a){return typeof a=="number"?a:(a.proxyOf&&(a=a.proxyOf),this.proxyOf.nodes.indexOf(a))}insertAfter(a,p){let b=this.index(a),m=this.normalize(p,this.proxyOf.nodes[b]).reverse();b=this.index(a);for(let C of m)this.proxyOf.nodes.splice(b+1,0,C);let _;for(let C in this.indexes)_=this.indexes[C],b<_&&(this.indexes[C]=_+m.length);return this.markDirty(),this}
vendor: 16,168 bytes, lines 36-43
36insertBefore(a,p){let b=this.index(a),m=b===0?"prepend":!1,_=this.normalize(p,this.proxyOf.nodes[b],m).reverse();b=this.index(a);for(let w of _)this.proxyOf.nodes.splice(b,0,w);let C;for(let w in this.indexes)C=this.indexes[w],b<=C&&(this.indexes[w]=C+_.length);return this.markDirty(),this}normalize(a,p){if(typeof a=="string")a=e(h(a).nodes);else if(typeof a>"u")a=[];else if(Array.isArray(a)){a=a.slice(0);for(let m of a)m.parent&&m.parent.removeChild(m,"ignore")}else if(a.type==="root"&&this.type!=="document"){a=a.nodes.slice(0);for(let m of a)m.parent&&m.parent.removeChild(m,"ignore")}else if(a.type)a=[a];else if(a.prop){if(typeof a.value>"u")throw new Error("Value field is missed in node creation");typeof a.value!="string"&&(a.value=String(a.value)),a=[new d(a)]}else if(a.selector||a.selectors)a=[new l(a)];else if(a.name)a=[new r(a)];else if(a.text)a=[new n(a)];else throw new Error("Unknown node type in node creation");return a.map(m=>(m[c]||s.rebuild(m),m=m.proxyOf,m.parent&&m.parent.removeChild(m),m[o]&&t(m),m.raws||(m.raws={}),typeof m.raws.before>"u"&&p&&typeof p.raws.before<"u"&&(m.raws.before=p.raws.before.replace(/\S/g,"")),m.parent=this.proxyOf,m))}prepend(...a){a=a.reverse();for(let p of a){let b=this.normalize(p,this.first,"prepend").reverse();for(let m of b)this.proxyOf.nodes.unshift(m);for(let m in this.indexes)this.indexes[m]=this.indexes[m]+b.length}return this.markDirty(),this}push(a){return a.parent=this,this.proxyOf.nodes.push(a),this}removeAll(){for(let a of this.proxyOf.nodes)a.parent=void 0;return this.proxyOf.nodes=[],this.markDirty(),this}removeChild(a){a=this.index(a),this.proxyOf.nodes[a].parent=void 0,this.proxyOf.nodes.splice(a,1);let p;for(let b in this.indexes)p=this.indexes[b],p>=a&&(this.indexes[b]=p-1);return this.markDirty(),this}replaceValues(a,p,b){return b||(b=p,p={}),this.walkDecls(m=>{p.props&&!p.props.includes(m.prop)||p.fast&&!m.value.includes(p.fast)||(m.value=m.value.replace(a,b))}),this.markDirty(),this}some(a){return this.nodes.some(a)}walk(a){return this.each((p,b)=>{let m;try{m=a(p,b)}catch(_){throw p.addToError(_)}return m!==!1&&p.walk&&(m=p.walk(a)),m})}walkAtRules(a,p){return p?a instanceof RegExp?this.walk((b,m)=>{if(b.type==="atrule"&&a.test(b.name))return p(b,m)}):this.walk((b,m)=>{if(b.type==="atrule"&&b.name===a)return p(b,m)}):(p=a,this.walk((b,m)=>{if(b.type==="atrule")return p(b,m)}))}walkComments(a){return this.walk((p,b)=>{if(p.type==="comment")return a(p,b)})}walkDecls(a,p){return p?a instanceof RegExp?this.walk((b,m)=>{if(b.type==="decl"&&a.test(b.prop))return p(b,m)}):this.walk((b,m)=>{if(b.type==="decl"&&b.prop===a)return p(b,m)}):(p=a,this.walk((b,m)=>{if(b.type==="decl")return p(b,m)}))}walkRules(a,p){return p?a instanceof RegExp?this.walk((b,m)=>{if(b.type==="rule"&&a.test(b.selector))return p(b,m)}):this.walk((b,m)=>{if(b.type==="rule"&&b.selector===a)return p(b,m)}):(p=a,this.walk((b,m)=>{if(b.type==="rule")return p(b,m)}))}}return s.registerParse=i=>{h=i},s.registerRule=i=>{l=i},s.registerAtRule=i=>{r=i},s.registerRoot=i=>{u=i},xn=s,s.default=s,s.rebuild=i=>{i.type==="atrule"?Object.setPrototypeOf(i,r.prototype):i.type==="rule"?Object.setPrototypeOf(i,l.prototype):i.type==="decl"?Object.setPrototypeOf(i,d.prototype):i.type==="comment"?Object.setPrototypeOf(i,n.prototype):i.type==="root"&&Object.setPrototypeOf(i,u.prototype),i[c]=!0,i.nodes&&i.nodes.forEach(a=>{s.rebuild(a)})},xn}var _n,Pi;function ii(){if(Pi)return _n;Pi=1;let n=vt();class d extends n{constructor(o){super(o),this.type="atrule"}append(...o){return this.proxyOf.nodes||(this.nodes=[]),super.append(...o)}prepend(...o){return this.proxyOf.nodes||(this.nodes=[]),super.prepend(...o)}}return _n=d,d.default=d,n.registerAtRule(d),_n}var Cn,Mi;function ri(){if(Mi)return Cn;Mi=1;let n=vt(),d,g;class o extends n{constructor(r){super({type:"document",...r}),this.nodes||(this.nodes=[])}toResult(r={}){return new d(new g,this,r).stringify()}}return o.registerLazyResult=c=>{d=c},o.registerProcessor=c=>{g=c},Cn=o,o.default=o,Cn}var kn,Li;function $o(){if(Li)return kn;Li=1;let n="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";return kn={nanoid:(o=21)=>{let c="",r=o|0;for(;r--;)c+=n[Math.random()*64|0];return c},customAlphabet:(o,c=21)=>(r=c)=>{let h="",u=r|0;for(;u--;)h+=o[Math.random()*o.length|0];return h}},kn}var Sn,Ii;function Ar(){if(Ii)return Sn;Ii=1;let{existsSync:n,readFileSync:d}=Ye,{dirname:g,join:o}=Ye,{SourceMapConsumer:c,SourceMapGenerator:r}=Ye;function h(l){return Buffer?Buffer.from(l,"base64").toString():window.atob(l)}class u{constructor(e,t){if(t.map===!1)return;t.unsafeMap&&(this.unsafeMap=!0),this.loadAnnotation(e),this.inline=this.startWith(this.annotation,"data:");let s=t.map?t.map.prev:void 0,i=this.loadMap(t.from,s);!this.mapFile&&t.from&&(this.mapFile=t.from),this.mapFile&&(this.root=g(this.mapFile)),i&&(this.text=i)}consumer(){return this.consumerCache||(this.consumerCache=new c(this.json||this.text)),this.consumerCache}decodeInline(e){let t=/^data:application\/json;charset=utf-?8;base64,/,s=/^data:application\/json;base64,/,i=/^data:application\/json;charset=utf-?8,/,a=/^data:application\/json,/,p=e.match(i)||e.match(a);if(p)return decodeURIComponent(e.substr(p[0].length));let b=e.match(t)||e.match(s);if(b)return h(e.substr(b[0].length));let m=e.slice(22);throw m=m.slice(0,m.indexOf(",")),new Error("Unsupported source map encoding "+m)}getAnnotationURL(e){return e.replace(/^\/\*\s*# sourceMappingURL=/,"").trim()}isMap(e){return typeof e!="object"?!1:typeof e.mappings=="string"||typeof e._mappings=="string"||Array.isArray(e.sections)}loadAnnotation(e){let t=e.match(/\/\*\s*# sourceMappingURL=/g);if(!t)return;let s=e.lastIndexOf(t.pop()),i=e.indexOf("*/",s);s>-1&&i>-1&&(this.annotation=this.getAnnotationURL(e.substring(s,i)))}loadFile(e,t,s){if(!(!s&&!this.unsafeMap&&!/\.map$/i.test(e))&&(this.root=g(e),n(e)))return this.mapFile=e,d(e,"utf-8").toString().trim()}loadMap(e,t){if(t===!1)return!1;if(t){if(typeof t=="string")return t;if(typeof t=="function"){let s=t(e);if(s){let i=this.loadFile(s,e,!0);if(!i)throw new Error("Unable to load previous source map: "+s.toString());return i}}else{if(t instanceof c)return r.fromSourceMap(t).toString();if(t instanceof r)return t.toString();if(this.isMap(t))return JSON.stringify(t);throw new Error("Unsupported previous source map format: "+t.toString())}}else{if(this.inline)return this.decodeInline(this.annotation);if(this.annotation){let s=this.annotation;e&&(s=o(g(e),s));let i=this.loadFile(s,e,!1);if(i)try{this.json=JSON.parse(i.replace(/^\)]}'[^\n]*\n/,""))}catch{return}return i}}}startWith(e,t){return e?e.substr(0,t.length)===t:!1}withContent(){return!!(this.consumer().sourcesContent&&this.consumer().sourcesContent.length>0)}}return Sn=u,u.default=u,Sn}var En,Ri;function ln(){if(Ri)return En;Ri=1;let{nanoid:n}=$o(),{isAbsolute:d,resolve:g}=Ye,{SourceMapConsumer:o,SourceMapGenerator:c}=Ye,{fileURLToPath:r,pathToFileURL:h}=Ye,u=ti(),l=Ar(),e=Ye,t=Symbol("lineToIndexCache"),s=!!(o&&c),i=!!(g&&d);function a(b){if(b[t])return b[t];let m=b.css.split(`
37`),_=new Array(m.length),C=0;for(let w=0,x=m.length;w<x;w++)_[w]=C,C+=m[w].length+1;return b[t]=_,_}class p{get from(){return this.file||this.id}constructor(m,_={}){if(m===null||typeof m>"u"||typeof m=="object"&&!m.toString)throw new Error(`PostCSS received ${m} instead of CSS string`);if(this.css=m.toString(),this.css[0]==="\uFEFF"||this.css[0]==="￾"?(this.hasBOM=!0,this.css=this.css.slice(1)):this.hasBOM=!1,this.document=this.css,_.document&&(this.document=_.document.toString()),_.from&&(!i||/^\w+:\/\//.test(_.from)||d(_.from)?this.file=_.from:this.file=g(_.from)),i&&s){let C=new l(this.css,_);if(C.text){this.map=C;let w=C.consumer().file;!this.file&&w&&(this.file=this.mapResolve(w))}}this.file||(this.id="<input css "+n(6)+">"),this.map&&(this.map.file=this.from)}error(m,_,C,w={}){let x,f,v,y,P;if(_&&typeof _=="object"){let T=_,B=C;if(typeof T.offset=="number"){y=T.offset;let z=this.fromOffset(y);_=z.line,C=z.col}else _=T.line,C=T.column,y=this.fromLineAndColumn(_,C);if(typeof B.offset=="number"){v=B.offset;let z=this.fromOffset(v);f=z.line,x=z.col}else f=B.line,x=B.column,v=this.fromLineAndColumn(B.line,B.column)}else if(C)y=this.fromLineAndColumn(_,C);else{y=_;let T=this.fromOffset(y);_=T.line,C=T.col}let E=this.origin(_,C,f,x);return E?P=new u(m,E.endLine===void 0?E.line:{column:E.column,line:E.line},E.endLine===void 0?E.column:{column:E.endColumn,line:E.endLine},E.source,E.file,w.plugin):P=new u(m,f===void 0?_:{column:C,line:_},f===void 0?C:{column:x,line:f},this.css,this.file,w.plugin),P.input={column:C,endColumn:x,endLine:f,endOffset:v,line:_,offset:y,source:this.css},this.file&&(h&&(P.input.url=h(this.file).toString()),P.input.file=this.file),P}fromLineAndColumn(m,_){return a(this)[m-1]+_-1}fromOffset(m){let _=a(this),C=_[_.length-1],w=0;if(m>=C)w=_.length-1;else{let x=_.length-2,f;for(;w<x;)if(f=w+(x-w>>1),m<_[f])x=f-1;else if(m>=_[f+1])w=f+1;else{w=f;break}}return{col:m-_[w]+1,line:w+1}}mapResolve(m){return/^\w+:\/\//.test(m)?m:g(this.map.consumer().sourceRoot||this.map.root||".",m)}origin(m,_,C,w){if(!this.map)return!1;let x=this.map.consumer(),f=x.originalPositionFor({column:_,line:m});if(!f.source)return!1;let v;typeof C=="number"&&(v=x.originalPositionFor({column:w,line:C}));let y;d(f.source)?y=h(f.source):y=new URL(f.source,this.map.consumer().sourceRoot||h(this.map.mapFile));let P={column:f.column,endColumn:v&&v.column,endLine:v&&v.line,line:f.line,url:y.toString()};if(y.protocol==="file:")if(r)P.file=r(y);else throw new Error("file: protocol is not available in this PostCSS build");let E=x.sourceContentFor(f.source);return E&&(P.source=E),P}toJSON(){let m={};for(let _ of["hasBOM","css","file","id"])this[_]!=null&&(m[_]=this[_]);return this.map&&(m.map={...this.map},m.map.consumerCache&&(m.map.consumerCache=void 0)),m}}return En=p,p.default=p,e&&e.registerInput&&e.registerInput(p),En}var Tn,zi;function Dt(){if(zi)return Tn;zi=1;let n=vt(),d,g;class o extends n{constructor(r){super(r),this.type="root",this.nodes||(this.nodes=[])}normalize(r,h,u){let l=super.normalize(r);if(h){if(u==="prepend")this.nodes.length>1?h.raws.before=this.nodes[1].raws.before:delete h.raws.before;else if(this.first!==h)for(let e of l)e.raws.before=h.raws.before}return l}removeChild(r,h){let u=this.index(r);return!h&&u===0&&this.nodes.length>1&&(this.nodes[1].raws.before=this.nodes[u].raws.before),super.removeChild(r)}toResult(r={}){return new d(new g,this,r).stringify()}}return o.registerLazyResult=c=>{d=c},o.registerProcessor=c=>{g=c},Tn=o,o.default=o,n.registerRoot(o),Tn}var $n,Ai;function Br(){if(Ai)return $n;Ai=1;let n={comma(d){return n.split(d,[","],!0)},space(d){let g=[" ",`
38`,"	"];return n.split(d,g)},split(d,g,o){let c=[],r="",h=!1,u=0,l=!1,e="",t=!1;for(let s of d)t?t=!1:s==="\\"?t=!0:l?s===e&&(l=!1):s==='"'||s==="'"?(l=!0,e=s):s==="("?u+=1:s===")"?u>0&&(u-=1):u===0&&g.includes(s)&&(h=!0),h?(r!==""&&c.push(r.trim()),r="",h=!1):r+=s;return(o||r!=="")&&c.push(r.trim()),c}};return $n=n,n.default=n,$n}var Pn,Bi;function ai(){if(Bi)return Pn;Bi=1;let n=vt(),d=Br();class g extends n{get selectors(){return d.comma(this.selector)}set selectors(c){let r=this.selector?this.selector.match(/,\s*/):null,h=r?r[0]:","+this.raw("between","beforeOpen");this.selector=c.join(h)}constructor(c){super(c),this.type="rule",this.nodes||(this.nodes=[])}}return Pn=g,g.default=g,n.registerRule(g),Pn}var Mn,Di;function Po(){if(Di)return Mn;Di=1;let n=ii(),d=Bt(),g=sn(),o=ln(),c=Ar(),r=Dt(),h=ai();function u(l,e){if(Array.isArray(l))return l.map(i=>u(i));let{inputs:t,...s}=l;if(t){e=[];for(let i of t){let a={...i,__proto__:o.prototype};a.map&&(a.map={...a.map,__proto__:c.prototype}),e.push(a)}}if(s.nodes&&(s.nodes=l.nodes.map(i=>u(i,e))),s.source){let{inputId:i,...a}=s.source;s.source=a,i!=null&&(s.source.input=e[i])}if(s.type==="root")return new r(s);if(s.type==="decl")return new g(s);if(s.type==="rule")return new h(s);if(s.type==="comment")return new d(s);if(s.type==="atrule")return new n(s);throw new Error("Unknown node type: "+l.type)}return Mn=u,u.default=u,Mn}var Ln,Oi;function Dr(){if(Oi)return Ln;Oi=1;let{dirname:n,relative:d,resolve:g,sep:o}=Ye,{SourceMapConsumer:c,SourceMapGenerator:r}=Ye,{pathToFileURL:h}=Ye,u=ln(),l=!!(c&&r),e=!!(n&&g&&d&&o);class t{constructor(i,a,p,b){this.stringify=i,this.mapOpts=p.map||{},this.root=a,this.opts=p,this.css=b,this.originalCSS=b,this.usesFileUrls=!this.mapOpts.from&&this.mapOpts.absolute,this.memoizedFileURLs=new Map,this.memoizedPaths=new Map,this.memoizedURLs=new Map}addAnnotation(){let i;this.isInline()?i="data:application/json;base64,"+this.toBase64(this.map.toString()):typeof this.mapOpts.annotation=="string"?i=this.mapOpts.annotation:typeof this.mapOpts.annotation=="function"?i=this.mapOpts.annotation(this.opts.to,this.root):i=this.outputFile()+".map";let a=`
39`;this.css.includes(`\r
40`)&&(a=`\r
41`),this.css+=a+"/*# sourceMappingURL="+i+" */"}applyPrevMaps(){for(let i of this.previous()){let a=this.toUrl(this.path(i.file)),p=i.root||n(i.file),b;this.mapOpts.sourcesContent===!1?(b=new c(i.text),b.sourcesContent&&(b.sourcesContent=null)):b=i.consumer(),this.map.applySourceMap(b,a,this.toUrl(this.path(p)))}}clearAnnotation(){if(this.mapOpts.annotation!==!1){if(this.root){let i;for(let a=this.root.nodes.length-1;a>=0;a--)i=this.root.nodes[a],i.type==="comment"&&i.text.startsWith("# sourceMappingURL=")&&this.root.removeChild(a)}else if(this.css){let i;for(;(i=this.css.lastIndexOf("/*#"))!==-1;){let a=this.css.indexOf("*/",i+3);if(a===-1)break;for(;i>0&&this.css[i-1]===`
42`;)i--;this.css=this.css.slice(0,i)+this.css.slice(a+2)}}}}generate(){if(this.clearAnnotation(),e&&l&&this.isMap())return this.generateMap();{let i="";return this.stringify(this.root,a=>{i+=a}),[i]}}generateMap(){if(this.root)this.generateString();else if(this.previous().length===1){let i=this.previous()[0].consumer();i.file=this.outputFile(),this.map=r.fromSourceMap(i,{ignoreInvalidMapping:!0})}else this.map=new r({file:this.outputFile(),ignoreInvalidMapping:!0}),this.map.addMapping({generated:{column:0,line:1},original:{column:0,line:1},source:this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>"});return this.isSourcesContent()&&this.setSourcesContent(),this.root&&this.previous().length>0&&this.applyPrevMaps(),this.isAnnotation()&&this.addAnnotation(),this.isInline()?[this.css]:[this.css,this.map]}generateString(){this.css="",this.map=new r({file:this.outputFile(),ignoreInvalidMapping:!0});let i=1,a=1,p="<no source>",b={generated:{column:0,line:0},original:{column:0,line:0},source:""},m,_;this.stringify(this.root,(C,w,x)=>{if(this.css+=C,w&&x!=="end"&&(b.generated.line=i,b.generated.column=a-1,w.source&&w.source.start?(b.source=this.sourcePath(w),b.original.line=w.source.start.line,b.original.column=w.source.start.column-1,this.map.addMapping(b)):(b.source=p,b.original.line=1,b.original.column=0,this.map.addMapping(b))),_=C.match(/\n/g),_?(i+=_.length,m=C.lastIndexOf(`
43`),a=C.length-m):a+=C.length,w&&x!=="start"){let f=w.parent||{raws:{}};(!(w.type==="decl"||w.type==="atrule"&&!w.nodes)||w!==f.last||f.raws.semicolon)&&(w.source&&w.source.end?(b.source=this.sourcePath(w),b.original.line=w.source.end.line,b.original.column=w.source.end.column-1,b.generated.line=i,b.generated.column=a-2,this.map.addMapping(b)):(b.source=p,b.original.line=1,b.original.column=0,b.generated.line=i,b.generated.column=a-1,this.map.addMapping(b)))}})}isAnnotation(){return this.isInline()?!0:typeof this.mapOpts.annotation<"u"?this.mapOpts.annotation:this.previous().length?this.previous().some(i=>i.annotation):!0}isInline(){if(typeof this.mapOpts.inline<"u")return this.mapOpts.inline;let i=this.mapOpts.annotation;return typeof i<"u"&&i!==!0?!1:this.previous().length?this.previous().some(a=>a.inline):!0}isMap(){return typeof this.opts.map<"u"?!!this.opts.map:this.previous().length>0}isSourcesContent(){return typeof this.mapOpts.sourcesContent<"u"?this.mapOpts.sourcesContent:this.previous().length?this.previous().some(i=>i.withContent()):!0}outputFile(){return this.opts.to?this.path(this.opts.to):this.opts.from?this.path(this.opts.from):"to.css"}
vendor: 8,874 bytes, line 43
43path(i){if(this.mapOpts.absolute||i.charCodeAt(0)===60||/^\w+:\/\//.test(i))return i;let a=this.memoizedPaths.get(i);if(a)return a;let p=this.opts.to?n(this.opts.to):".";typeof this.mapOpts.annotation=="string"&&(p=n(g(p,this.mapOpts.annotation)));let b=d(p,i);return this.memoizedPaths.set(i,b),b}previous(){if(!this.previousMaps)if(this.previousMaps=[],this.root)this.root.walk(i=>{if(i.source&&i.source.input.map){let a=i.source.input.map;this.previousMaps.includes(a)||this.previousMaps.push(a)}});else{let i=new u(this.originalCSS,this.opts);i.map&&this.previousMaps.push(i.map)}return this.previousMaps}setSourcesContent(){let i={};if(this.root)this.root.walk(a=>{if(a.source){let p=a.source.input.from;if(p&&!i[p]){i[p]=!0;let b=this.usesFileUrls?this.toFileUrl(p):this.toUrl(this.path(p));this.map.setSourceContent(b,a.source.input.css)}}});else if(this.css){let a=this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>";this.map.setSourceContent(a,this.css)}}sourcePath(i){return this.mapOpts.from?this.toUrl(this.mapOpts.from):this.usesFileUrls?this.toFileUrl(i.source.input.from):this.toUrl(this.path(i.source.input.from))}toBase64(i){return Buffer?Buffer.from(i).toString("base64"):window.btoa(unescape(encodeURIComponent(i)))}toFileUrl(i){let a=this.memoizedFileURLs.get(i);if(a)return a;if(h){let p=h(i).toString();return this.memoizedFileURLs.set(i,p),p}else throw new Error("`map.absolute` option is not available in this PostCSS build")}toUrl(i){let a=this.memoizedURLs.get(i);if(a)return a;o==="\\"&&(i=i.replace(/\\/g,"/"));let p=encodeURI(i).replace(/[#?]/g,encodeURIComponent);return this.memoizedURLs.set(i,p),p}}return Ln=t,Ln}var In,Fi;function Or(){if(Fi)return In;Fi=1;const n=39,d=34,g=92,o=47,c=10,r=32,h=12,u=9,l=13,e=91,t=93,s=40,i=41,a=123,p=125,b=59,m=42,_=58,C=64,w=/[\t\n\f\r "#'()/;[\\\]{}]/g,x=/[\t\n\f\r !"#'():;@[\\\]{}]|\/(?=\*)/g,f=/.[\r\n"'(/\\]/,v=/[\da-f]/i;return In=function(P,E={}){let T=P.css.valueOf(),B=E.ignoreErrors,z,Y,J,I,H,Q,D,j,G,V,q=T.length,O=0,de=[],ye=[],Ce=-1;function Ee(){return O}function Ue(ze){throw P.error("Unclosed "+ze,O)}function Te(){return ye.length===0&&O>=q}function Be(ze){if(ye.length)return ye.pop();if(O>=q)return;let We=ze?ze.ignoreUnclosed:!1;switch(z=T.charCodeAt(O),z){case c:case r:case u:case l:case h:{I=O;do I+=1,z=T.charCodeAt(I);while(z===r||z===c||z===u||z===l||z===h);Q=["space",T.slice(O,I)],O=I-1;break}case e:case t:case a:case p:case _:case b:case i:{let Ae=String.fromCharCode(z);Q=[Ae,Ae,O];break}case s:{if(V=de.length?de.pop()[1]:"",G=T.charCodeAt(O+1),V==="url"&&G!==n&&G!==d&&G!==r&&G!==c&&G!==u&&G!==h&&G!==l){I=O;do{if(D=!1,I=T.indexOf(")",I+1),I===-1)if(B||We){I=O;break}else Ue("bracket");for(j=I;T.charCodeAt(j-1)===g;)j-=1,D=!D}while(D);Q=["brackets",T.slice(O,I+1),O,I],O=I}else O<=Ce?Q=["(","(",O]:(I=T.indexOf(")",O+1),Y=T.slice(O,I+1),I===-1||f.test(Y)?(Ce=I===-1?q:I,Q=["(","(",O]):(Q=["brackets",Y,O,I],O=I));break}case n:case d:{H=z===n?"'":'"',I=O;do{if(D=!1,I=T.indexOf(H,I+1),I===-1)if(B||We){I=O+1;break}else Ue("string");for(j=I;T.charCodeAt(j-1)===g;)j-=1,D=!D}while(D);Q=["string",T.slice(O,I+1),O,I],O=I;break}case C:{w.lastIndex=O+1,w.test(T),w.lastIndex===0?I=T.length-1:I=w.lastIndex-2,Q=["at-word",T.slice(O,I+1),O,I],O=I;break}case g:{for(I=O,J=!0;T.charCodeAt(I+1)===g;)I+=1,J=!J;if(z=T.charCodeAt(I+1),J&&z!==o&&z!==r&&z!==c&&z!==u&&z!==l&&z!==h&&(I+=1,v.test(T.charAt(I)))){for(;v.test(T.charAt(I+1));)I+=1;T.charCodeAt(I+1)===r&&(I+=1)}Q=["word",T.slice(O,I+1),O,I],O=I;break}default:{z===o&&T.charCodeAt(O+1)===m?(I=T.indexOf("*/",O+2)+1,I===0&&(B||We?I=T.length:Ue("comment")),Q=["comment",T.slice(O,I+1),O,I],O=I):(x.lastIndex=O+1,x.test(T),x.lastIndex===0?I=T.length-1:I=x.lastIndex-2,Q=["word",T.slice(O,I+1),O,I],de.push(Q),O=I);break}}return O++,Q}function He(ze){ye.push(ze)}return{back:He,endOfFile:Te,nextToken:Be,position:Ee}},In}var Rn,ji;function Fr(){if(ji)return Rn;ji=1;let n=ii(),d=Bt(),g=sn(),o=Dt(),c=ai(),r=Or();const h={empty:!0,space:!0};function u(e){for(let t=e.length-1;t>=0;t--){let s=e[t],i=s[3]||s[2];if(i)return i}}class l{constructor(t){this.input=t,this.root=new o,this.current=this.root,this.spaces="",this.semicolon=!1,this.createTokenizer(),this.root.source={input:t,start:{column:1,line:1,offset:0}}}atrule(t){let s=new n;s.name=t[1].slice(1),s.name===""&&this.unnamedAtrule(s,t),this.init(s,t[2]);let i,a,p,b=!1,m=!1,_=[],C=[];for(;!this.tokenizer.endOfFile();){if(t=this.tokenizer.nextToken(),i=t[0],i==="("||i==="["?C.push(i==="("?")":"]"):i==="{"&&C.length>0?C.push("}"):i===C[C.length-1]&&C.pop(),C.length===0)if(i===";"){s.source.end=this.getPosition(t[2]),s.source.end.offset++,this.semicolon=!0;break}else if(i==="{"){m=!0;break}else if(i==="}"){if(_.length>0){for(p=_.length-1,a=_[p];a&&a[0]==="space";)a=_[--p];a&&(s.source.end=this.getPosition(a[3]||a[2]),s.source.end.offset++)}this.end(t);break}else _.push(t);else _.push(t);if(this.tokenizer.endOfFile()){b=!0;break}}s.raws.between=this.spacesAndCommentsFromEnd(_),_.length?(s.raws.afterName=this.spacesAndCommentsFromStart(_),this.raw(s,"params",_),b&&(t=_[_.length-1],s.source.end=this.getPosition(t[3]||t[2]),s.source.end.offset++,this.spaces=s.raws.between,s.raws.between="")):(s.raws.afterName="",s.params=""),m&&(s.nodes=[],this.current=s)}checkMissedSemicolon(t){let s=this.colon(t);if(s===!1)return;let i=0,a;for(let p=s-1;p>=0&&(a=t[p],!(a[0]!=="space"&&(i+=1,i===2)));p--);throw this.input.error("Missed semicolon",a[0]==="word"?a[3]+1:a[2])}colon(t){let s=0,i,a,p;for(let[b,m]of t.entries()){if(a=m,p=a[0],p==="("&&(s+=1),p===")"&&(s-=1),s===0&&p===":")if(!i)this.doubleColon(a);else{if(i[0]==="word"&&i[1]==="progid")continue;return b}i=a}return!1}comment(t){let s=new d;this.init(s,t[2]),s.source.end=this.getPosition(t[3]||t[2]),s.source.end.offset++;let i=t[1].slice(2,-2);if(!i.trim())s.text="",s.raws.left=i,s.raws.right="";else{let a=i.match(/^(\s*)([^]*\S)(\s*)$/);s.text=a[2],s.raws.left=a[1],s.raws.right=a[3]}}createTokenizer(){this.tokenizer=r(this.input)}decl(t,s){let i=new g;this.init(i,t[0][2]);let a=t[t.length-1];for(a[0]===";"&&(this.semicolon=!0,t.pop()),i.source.end=this.getPosition(a[3]||a[2]||u(t)),i.source.end.offset++;t[0][0]!=="word";)t.length===1&&this.unknownWord(t),i.raws.before+=t.shift()[1];for(i.source.start=this.getPosition(t[0][2]),i.prop="";t.length;){let C=t[0][0];if(C===":"||C==="space"||C==="comment")break;i.prop+=t.shift()[1]}i.raws.between="";let p;for(;t.length;)if(p=t.shift(),p[0]===":"){i.raws.between+=p[1];break}else p[0]==="word"&&/\w/.test(p[1])&&this.unknownWord([p]),i.raws.between+=p[1];(i.prop[0]==="_"||i.prop[0]==="*")&&(i.raws.before+=i.prop[0],i.prop=i.prop.slice(1));let b=[],m;for(;t.length&&(m=t[0][0],!(m!=="space"&&m!=="comment"));)b.push(t.shift());this.precheckMissedSemicolon(t);for(let C=t.length-1;C>=0;C--){if(p=t[C],p[1].toLowerCase()==="!important"){i.important=!0;let w=this.stringFrom(t,C);w=this.spacesFromEnd(t)+w,w!==" !important"&&(i.raws.important=w);break}else if(p[1].toLowerCase()==="important"){let w=t.slice(0),x="";for(let f=C;f>0;f--){let v=w[f][0];if(x.trim().startsWith("!")&&v!=="space")break;x=w.pop()[1]+x}x.trim().startsWith("!")&&(i.important=!0,i.raws.important=x,t=w)}if(p[0]!=="space"&&p[0]!=="comment")break}t.some(C=>C[0]!=="space"&&C[0]!=="comment")&&(i.raws.between+=b.map(C=>C[1]).join(""),b=[]),this.raw(i,"value",b.concat(t),s),i.value.includes(":")&&!s&&this.checkMissedSemicolon(t)}doubleColon(t){throw this.input.error("Double colon",{offset:t[2]},{offset:t[2]+t[1].length})}emptyRule(t){let s=new c;this.init(s,t[2]),s.selector="",s.raws.between="",this.current=s}end(t){this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.semicolon=!1,this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.spaces="",this.current.parent?(this.current.source.end=this.getPosition(t[2]),this.current.source.end.offset++,this.current=this.current.parent):this.unexpectedClose(t)}endFile(){this.current.parent&&this.unclosedBlock(),this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.root.source.end=this.getPosition(this.tokenizer.position())}freeSemicolon(t){if(this.spaces+=t[1],this.current.nodes){let s=this.current.nodes[this.current.nodes.length-1];s&&s.type==="rule"&&!s.raws.ownSemicolon&&(s.raws.ownSemicolon=this.spaces,this.spaces="",s.source.end=this.getPosition(t[2]),s.source.end.offset+=s.raws.ownSemicolon.length)}}getPosition(t){let s=this.input.fromOffset(t);return{column:s.col,line:s.line,offset:t}}init(t,s){this.current.push(t),t.source={input:this.input,start:this.getPosition(s)},t.raws.before=this.spaces,this.spaces="",t.type!=="comment"&&(this.semicolon=!1)}other(t){let s=!1,i=null,a=!1,p=null,b=[],m=t[1].startsWith("--"),_=[],C=t;
vendor: 4,359 bytes, line 43
43for(;C;){if(i=C[0],_.push(C),i==="("||i==="[")p||(p=C),b.push(i==="("?")":"]");else if(m&&a&&i==="{")p||(p=C),b.push("}");else if(b.length===0)if(i===";")if(a){this.decl(_,m);return}else break;else if(i==="{"){this.rule(_);return}else if(i==="}"){this.tokenizer.back(_.pop()),s=!0;break}else i===":"&&(a=!0);else i===b[b.length-1]&&(b.pop(),b.length===0&&(p=null));C=this.tokenizer.nextToken()}if(this.tokenizer.endOfFile()&&(s=!0),b.length>0&&this.unclosedBracket(p),s&&a){if(!m)for(;_.length&&(C=_[_.length-1][0],!(C!=="space"&&C!=="comment"));)this.tokenizer.back(_.pop());this.decl(_,m)}else this.unknownWord(_)}parse(){let t;for(;!this.tokenizer.endOfFile();)switch(t=this.tokenizer.nextToken(),t[0]){case"space":this.spaces+=t[1];break;case";":this.freeSemicolon(t);break;case"}":this.end(t);break;case"comment":this.comment(t);break;case"at-word":this.atrule(t);break;case"{":this.emptyRule(t);break;default:this.other(t);break}this.endFile()}precheckMissedSemicolon(){}raw(t,s,i,a){let p,b,m=i.length,_="",C=!0,w,x;for(let f=0;f<m;f+=1)p=i[f],b=p[0],b==="space"&&f===m-1&&!a?C=!1:b==="comment"?(x=i[f-1]?i[f-1][0]:"empty",w=i[f+1]?i[f+1][0]:"empty",!h[x]&&!h[w]?_.slice(-1)===","?C=!1:_+=p[1]:C=!1):_+=p[1];if(!C){let f=i.reduce((v,y)=>v+y[1],"");t.raws[s]={raw:f,value:_}}t[s]=_}rule(t){t.pop();let s=new c;this.init(s,t[0][2]),s.raws.between=this.spacesAndCommentsFromEnd(t),this.raw(s,"selector",t),this.current=s}spacesAndCommentsFromEnd(t){let s,i="";for(;t.length&&(s=t[t.length-1][0],!(s!=="space"&&s!=="comment"));)i=t.pop()[1]+i;return i}spacesAndCommentsFromStart(t){let s,i="";for(;t.length&&(s=t[0][0],!(s!=="space"&&s!=="comment"));)i+=t.shift()[1];return i}spacesFromEnd(t){let s,i="";for(;t.length&&(s=t[t.length-1][0],s==="space");)i=t.pop()[1]+i;return i}stringFrom(t,s){let i="";for(let a=s;a<t.length;a++)i+=t[a][1];return t.splice(s,t.length-s),i}unclosedBlock(){let t=this.current.source.start;throw this.input.error("Unclosed block",t.line,t.column)}unclosedBracket(t){throw this.input.error("Unclosed bracket",{offset:t[2]},{offset:t[2]+1})}unexpectedClose(t){throw this.input.error("Unexpected }",{offset:t[2]},{offset:t[2]+1})}unknownWord(t){throw this.input.error("Unknown word "+t[0][1],{offset:t[0][2]},{offset:t[0][2]+t[0][1].length})}unnamedAtrule(t,s){throw this.input.error("At-rule without name",{offset:s[2]},{offset:s[2]+s[1].length})}}return Rn=l,Rn}var zn,qi;function oi(){if(qi)return zn;qi=1;let n=vt(),d=ln(),g=Fr();function o(c,r){let h=new d(c,r),u=new g(h);try{u.parse()}catch(l){throw l}return u.root}return zn=o,o.default=o,n.registerParse(o),zn}var An,Ui;function jr(){if(Ui)return An;Ui=1;class n{constructor(g,o={}){if(this.type="warning",this.text=g,o.node&&o.node.source){let c=o.node.rangeBy(o);this.line=c.start.line,this.column=c.start.column,this.endLine=c.end.line,this.endColumn=c.end.column}for(let c in o)this[c]=o[c]}toString(){return this.node?this.node.error(this.text,{index:this.index,plugin:this.plugin,word:this.word}).message:this.plugin?this.plugin+": "+this.text:this.text}}return An=n,n.default=n,An}var Bn,Hi;function si(){if(Hi)return Bn;Hi=1;let n=jr();class d{get content(){return this.css}constructor(o,c,r){this.processor=o,this.messages=[],this.root=c,this.opts=r,this.css="",this.map=void 0}toString(){return this.css}warn(o,c={}){c.plugin||this.lastPlugin&&this.lastPlugin.postcssPlugin&&(c.plugin=this.lastPlugin.postcssPlugin);let r=new n(o,c);return this.messages.push(r),r}warnings(){return this.messages.filter(o=>o.type==="warning")}}return Bn=d,d.default=d,Bn}var Dn,Vi;function qr(){if(Vi)return Dn;Vi=1;let n=vt(),d=ri(),g=Dr(),o=oi(),c=si(),r=Dt(),h=an(),{isClean:u,my:l}=ni();const e={atrule:"AtRule",comment:"Comment",decl:"Declaration",document:"Document",root:"Root",rule:"Rule"},t={AtRule:!0,AtRuleExit:!0,Comment:!0,CommentExit:!0,Declaration:!0,DeclarationExit:!0,Document:!0,DocumentExit:!0,Once:!0,OnceExit:!0,postcssPlugin:!0,prepare:!0,Root:!0,RootExit:!0,Rule:!0,RuleExit:!0},s={Once:!0,postcssPlugin:!0,prepare:!0},i=0;function a(w){return typeof w=="object"&&typeof w.then=="function"}function p(w){let x=!1,f=e[w.type];return w.type==="decl"?x=w.prop.toLowerCase():w.type==="atrule"&&(x=w.name.toLowerCase()),x&&w.append?[f,f+"-"+x,i,f+"Exit",f+"Exit-"+x]:x?[f,f+"-"+x,f+"Exit",f+"Exit-"+x]:w.append?[f,i,f+"Exit"]:[f,f+"Exit"]}function b(w){let x;
vendor: 4,630 bytes, line 43
43return w.type==="document"?x=["Document",i,"DocumentExit"]:w.type==="root"?x=["Root",i,"RootExit"]:x=p(w),{eventIndex:0,events:x,iterator:0,node:w,visitorIndex:0,visitors:[]}}function m(w){return w[u]=!1,w.nodes&&w.nodes.forEach(x=>m(x)),w}let _={};class C{get content(){return this.stringify().content}get css(){return this.stringify().css}get map(){return this.stringify().map}get messages(){return this.sync().messages}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){return this.sync().root}get[Symbol.toStringTag](){return"LazyResult"}constructor(x,f,v){this.stringified=!1,this.processed=!1;let y;if(typeof f=="object"&&f!==null&&(f.type==="root"||f.type==="document"))y=m(f);else if(f instanceof C||f instanceof c)y=m(f.root),f.map&&(typeof v.map>"u"&&(v.map={}),v.map.inline||(v.map.inline=!1),v.map.prev=f.map);else{let P=o;v.syntax&&(P=v.syntax.parse),v.parser&&(P=v.parser),P.parse&&(P=P.parse);try{y=P(f,v)}catch(E){this.processed=!0,this.error=E}y&&!y[l]&&n.rebuild(y)}this.result=new c(x,y,v),this.helpers={..._,postcss:_,result:this.result},this.plugins=this.processor.plugins.map(P=>typeof P=="object"&&P.prepare?{...P,...P.prepare(this.result)}:P)}async(){return this.error?Promise.reject(this.error):this.processed?Promise.resolve(this.result):(this.processing||(this.processing=this.runAsync()),this.processing)}catch(x){return this.async().catch(x)}finally(x){return this.async().then(x,x)}getAsyncError(){throw new Error("Use process(css).then(cb) to work with async plugins")}handleError(x,f){let v=this.result.lastPlugin;try{f&&f.addToError(x),this.error=x,x.name==="CssSyntaxError"&&!x.plugin?(x.plugin=v.postcssPlugin,x.setMessage()):v.postcssVersion}catch(y){console&&console.error&&console.error(y)}return x}prepareVisitors(){this.listeners={};let x=(f,v,y)=>{this.listeners[v]||(this.listeners[v]=[]),this.listeners[v].push([f,y])};for(let f of this.plugins)if(typeof f=="object")for(let v in f){if(!t[v]&&/^[A-Z]/.test(v))throw new Error(`Unknown event ${v} in ${f.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`);if(!s[v])if(typeof f[v]=="object")for(let y in f[v])y==="*"?x(f,v,f[v][y]):x(f,v+"-"+y.toLowerCase(),f[v][y]);else typeof f[v]=="function"&&x(f,v,f[v])}this.hasListener=Object.keys(this.listeners).length>0}async runAsync(){this.plugin=0;for(let x=0;x<this.plugins.length;x++){let f=this.plugins[x],v=this.runOnRoot(f);if(a(v))try{await v}catch(y){throw this.handleError(y)}}if(this.prepareVisitors(),this.hasListener){let x=this.result.root;for(;!x[u];){x[u]=!0;let f=[b(x)];for(;f.length>0;){let v=this.visitTick(f);if(a(v))try{await v}catch(y){let P=f[f.length-1].node;throw this.handleError(y,P)}}}if(this.listeners.OnceExit)for(let[f,v]of this.listeners.OnceExit){this.result.lastPlugin=f;try{if(x.type==="document"){let y=x.nodes.map(P=>v(P,this.helpers));await Promise.all(y)}else await v(x,this.helpers)}catch(y){throw this.handleError(y)}}}return this.processed=!0,this.stringify()}runOnRoot(x){this.result.lastPlugin=x;try{if(typeof x=="object"&&x.Once){if(this.result.root.type==="document"){let f=this.result.root.nodes.map(v=>x.Once(v,this.helpers));return a(f[0])?Promise.all(f):f}return x.Once(this.result.root,this.helpers)}else if(typeof x=="function")return x(this.result.root,this.result)}catch(f){throw this.handleError(f)}}stringify(){if(this.error)throw this.error;if(this.stringified)return this.result;this.stringified=!0,this.sync();let x=this.result.opts,f=h;x.syntax&&(f=x.syntax.stringify),x.stringifier&&(f=x.stringifier),f.stringify&&(f=f.stringify);let v=this.result.root.source;if(x.map===void 0&&!(v&&v.input&&v.input.map)){let E="";return f(this.result.root,T=>{E+=T}),this.result.css=E,this.result}let P=new g(f,this.result.root,this.result.opts).generate();return this.result.css=P[0],this.result.map=P[1],this.result}sync(){if(this.error)throw this.error;if(this.processed)return this.result;if(this.processed=!0,this.processing)throw this.getAsyncError();for(let x of this.plugins){let f=this.runOnRoot(x);if(a(f))throw this.getAsyncError()}if(this.prepareVisitors(),this.hasListener){let x=this.result.root;for(;!x[u];)x[u]=!0,this.walkSync(x);if(this.listeners.OnceExit)if(x.type==="document")for(let f of x.nodes)this.visitSync(this.listeners.OnceExit,f);else this.visitSync(this.listeners.OnceExit,x)}return this.result}then(x,f){return this.async().then(x,f)}toString(){return this.css}visitSync(x,f){for(let[v,y]of x){this.result.lastPlugin=v;let P;try{P=y(f,this.helpers)}catch(E){throw this.handleError(E,f.proxyOf)}if(f.type!=="root"&&f.type!=="document"&&!f.parent)return!0;
43if(a(P))throw this.getAsyncError()}}visitTick(x){let f=x[x.length-1],{node:v,visitors:y}=f;if(v.type!=="root"&&v.type!=="document"&&!v.parent){x.pop();return}if(y.length>0&&f.visitorIndex<y.length){let[E,T]=y[f.visitorIndex];f.visitorIndex+=1,f.visitorIndex===y.length&&(f.visitors=[],f.visitorIndex=0),this.result.lastPlugin=E;try{return T(v.toProxy(),this.helpers)}catch(B){throw this.handleError(B,v)}}if(f.iterator!==0){let E=f.iterator,T;for(;T=v.nodes[v.indexes[E]];)if(v.indexes[E]+=1,!T[u]){T[u]=!0,x.push(b(T));return}f.iterator=0,delete v.indexes[E]}let P=f.events;for(;f.eventIndex<P.length;){let E=P[f.eventIndex];if(f.eventIndex+=1,E===i){v.nodes&&v.nodes.length&&(v[u]=!0,f.iterator=v.getIterator());return}else if(this.listeners[E]){f.visitors=this.listeners[E];return}}x.pop()}walkSync(x){x[u]=!0;let f=p(x);for(let v of f)if(v===i)x.nodes&&x.each(y=>{y[u]||this.walkSync(y)});else{let y=this.listeners[v];if(y&&this.visitSync(y,x.toProxy()))return}}warnings(){return this.sync().warnings()}}return C.registerPostcss=w=>{_=w},Dn=C,C.default=C,r.registerLazyResult(C),d.registerLazyResult(C),Dn}var On,Ni;function Mo(){if(Ni)return On;Ni=1;let n=Dr(),d=oi(),g=si(),o=an();class c{get content(){return this.result.css}get css(){return this.result.css}get map(){return this.result.map}get messages(){return[]}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){if(this._root)return this._root;let h,u=d;try{h=u(this._css,this._opts)}catch(l){this.error=l}if(this.error)throw this.error;return this._root=h,h}get[Symbol.toStringTag](){return"NoWorkResult"}constructor(h,u,l){u=u.toString(),this.stringified=!1,this._processor=h,this._css=u,this._opts=l,this._map=void 0;let e=o;this.result=new g(this._processor,void 0,this._opts),this.result.css=u;let t=this;Object.defineProperty(this.result,"root",{get(){return t.root}});let s=new n(e,void 0,this._opts,u);if(s.isMap()){let[i,a]=s.generate();i&&(this.result.css=i),a&&(this.result.map=a)}else s.clearAnnotation(),this.result.css=s.css}async(){return this.error?Promise.reject(this.error):Promise.resolve(this.result)}catch(h){return this.async().catch(h)}finally(h){return this.async().then(h,h)}sync(){if(this.error)throw this.error;return this.result}then(h,u){return this.async().then(h,u)}toString(){return this._css}warnings(){return[]}}return On=c,c.default=c,On}var Fn,Wi;function Lo(){if(Wi)return Fn;Wi=1;let n=ri(),d=qr(),g=Mo(),o=Dt();class c{constructor(h=[]){this.version="8.5.14",this.plugins=this.normalize(h)}normalize(h){let u=[];for(let l of h)if(l.postcss===!0?l=l():l.postcss&&(l=l.postcss),typeof l=="object"&&Array.isArray(l.plugins))u=u.concat(l.plugins);else if(typeof l=="object"&&l.postcssPlugin)u.push(l);else if(typeof l=="function")u.push(l);else if(!(typeof l=="object"&&(l.parse||l.stringify)))throw new Error(l+" is not a PostCSS plugin");return u}process(h,u={}){return!this.plugins.length&&!u.parser&&!u.stringifier&&!u.syntax?new g(this,h,u):new d(this,h,u)}use(h){return this.plugins=this.plugins.concat(this.normalize([h])),this}}return Fn=c,c.default=c,o.registerProcessor(c),n.registerProcessor(c),Fn}var jn,Gi;function Ur(){if(Gi)return jn;Gi=1;var n={};let d=ii(),g=Bt(),o=vt(),c=ti(),r=sn(),h=ri(),u=Po(),l=ln(),e=qr(),t=Br(),s=on(),i=oi(),a=Lo(),p=si(),b=Dt(),m=ai(),_=an(),C=jr();function w(...x){return x.length===1&&Array.isArray(x[0])&&(x=x[0]),new a(x)}return w.plugin=function(f,v){let y=!1;function P(...T){console&&console.warn&&!y&&(y=!0,console.warn(f+`: postcss.plugin was deprecated. Migration guide:
44https://evilmartians.com/chronicles/postcss-8-plugin-migration`),n.LANG&&n.LANG.startsWith("cn")&&console.warn(f+`: 里面 postcss.plugin 被弃用. 迁移指南:
45https://www.w3ctech.com/topic/2226`));let B=v(...T);return B.postcssPlugin=f,B.postcssVersion=new a().version,B}let E;return Object.defineProperty(P,"postcss",{get(){return E||(E=P()),E}}),P.process=function(T,B,z){return w([P(z)]).process(T,B)},P},w.stringify=_,w.parse=i,w.fromJSON=u,w.list=t,w.comment=x=>new g(x),w.atRule=x=>new d(x),w.decl=x=>new r(x),w.rule=x=>new m(x),w.root=x=>new b(x),w.document=x=>new h(x),w.CssSyntaxError=c,w.Declaration=r,w.Container=o,w.Processor=a,w.Document=h,w.Comment=g,w.Warning=C,w.AtRule=d,w.Result=p,w.Input=l,w.Rule=m,w.Root=b,w.Node=s,e.registerPostcss(w),jn=w,w.default=w,jn}var Io=Ur();const we=Lr(Io);we.stringify;we.fromJSON;we.plugin;we.parse;we.list;we.document;we.comment;we.atRule;we.rule;we.decl;we.root;we.CssSyntaxError;we.Declaration;we.Container;we.Processor;we.Document;we.Comment;we.Warning;we.AtRule;we.Result;we.Input;we.Rule;we.Root;we.Node;var qn,Ki;function Ro(){if(Ki)return qn;Ki=1;let n=Bt(),d=Fr(),g=Or();class o extends d{checkMissedSemicolon(){}comment(r){let h=new n;this.init(h,r[2]);let u=this.input.fromOffset(r[3])||this.input.fromOffset(this.input.css.length-1);h.source.end={column:u.col,line:u.line,offset:r[3]+1};let l=r[1].slice(2);if(l.slice(-2)==="*/"&&(l=l.slice(0,-2)),/^\s*$/.test(l))h.text="",h.raws.left=l,h.raws.right="";else{let e=l.match(/^(\s*)([^]*\S)(\s*)$/);h.text=e[2],h.raws.left=e[1],h.raws.right=e[3]}}createTokenizer(){this.tokenizer=g(this.input,{ignoreErrors:!0})}decl(r){r.length>1&&r.some(h=>h[0]==="word")&&super.decl(r)}doubleColon(){}endFile(){for(this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.current.raws.after=(this.current.raws.after||"")+this.spaces;this.current.parent;)this.current=this.current.parent,this.current.raws.after="";this.root.source.end=this.getPosition(this.tokenizer.position())}precheckMissedSemicolon(r){let h=this.colon(r);if(h===!1)return;let u,l;for(u=h-1;u>=0&&r[u][0]!=="word";u--);if(u===0||u<0)return;for(l=u-1;l>=0;l--)if(r[l][0]!=="space"){l+=1;break}let e=r.slice(u),t=r.slice(l,u);r.splice(l,r.length-l),this.spaces=t.map(s=>s[1]).join(""),this.decl(e)}unclosedBracket(){}unexpectedClose(){this.current.raws.after+="}"}unknownWord(r){this.spaces+=r.map(h=>h[1]).join("")}unnamedAtrule(r){r.name=""}}return qn=o,qn}var Un,Ji;function zo(){if(Ji)return Un;Ji=1;let{Input:n}=Ur(),d=Ro();return Un=function(o,c){let r=new n(o,c),h=new d(r);return h.parse(),h.root},Un}var Ao=zo();const Xi=Lr(Ao);function Bo(n,d){if(n.match(/^[a-z]+:\/\//i))return n;if(n.match(/^\/\//))return window.location.protocol+n;if(n.match(/^[a-z]+:/i))return n;const g=document.implementation.createHTMLDocument(),o=g.createElement("base"),c=g.createElement("a");return g.head.appendChild(o),g.body.appendChild(c),d&&(o.href=d),c.href=n,c.href}const Do=(()=>{let n=0;const d=()=>`0000${(Math.random()*36**4<<0).toString(36)}`.slice(-4);return()=>(n+=1,`u${d()}${n}`)})();function pt(n){const d=[];for(let g=0,o=n.length;g<o;g++)d.push(n[g]);return d}let kt=null;function Hr(n={}){return kt||(n.includeStyleProperties?(kt=n.includeStyleProperties,kt):(kt=pt(window.getComputedStyle(document.documentElement)),kt))}function Xt(n,d){const o=(n.ownerDocument.defaultView||window).getComputedStyle(n).getPropertyValue(d);return o?parseFloat(o.replace("px","")):0}function Oo(n){const d=Xt(n,"border-left-width"),g=Xt(n,"border-right-width");return n.clientWidth+d+g}function Fo(n){const d=Xt(n,"border-top-width"),g=Xt(n,"border-bottom-width");return n.clientHeight+d+g}function Vr(n,d={}){const g=d.width||Oo(n),o=d.height||Fo(n);return{width:g,height:o}}function jo(){let n,d;
45try{d=process}catch{}const g=d&&d.env?d.env.devicePixelRatio:null;return g&&(n=parseInt(g,10),Number.isNaN(n)&&(n=1)),n||window.devicePixelRatio||1}const Ne=16384;function qo(n){(n.width>Ne||n.height>Ne)&&(n.width>Ne&&n.height>Ne?n.width>n.height?(n.height*=Ne/n.width,n.width=Ne):(n.width*=Ne/n.height,n.height=Ne):n.width>Ne?(n.height*=Ne/n.width,n.width=Ne):(n.width*=Ne/n.height,n.height=Ne))}function Yt(n){return new Promise((d,g)=>{const o=new Image;o.onload=()=>{o.decode().then(()=>{requestAnimationFrame(()=>d(o))})},o.onerror=g,o.crossOrigin="anonymous",o.decoding="async",o.src=n})}async function Uo(n){return Promise.resolve().then(()=>new XMLSerializer().serializeToString(n)).then(encodeURIComponent).then(d=>`data:image/svg+xml;charset=utf-8,${d}`)}async function Ho(n,d,g){const o="http://www.w3.org/2000/svg",c=document.createElementNS(o,"svg"),r=document.createElementNS(o,"foreignObject");return c.setAttribute("width",`${d}`),c.setAttribute("height",`${g}`),c.setAttribute("viewBox",`0 0 ${d} ${g}`),r.setAttribute("width","100%"),r.setAttribute("height","100%"),r.setAttribute("x","0"),r.setAttribute("y","0"),r.setAttribute("externalResourcesRequired","true"),c.appendChild(r),r.appendChild(n),Uo(c)}const qe=(n,d)=>{if(n instanceof d)return!0;const g=Object.getPrototypeOf(n);return g===null?!1:g.constructor.name===d.name||qe(g,d)};function Vo(n){const d=n.getPropertyValue("content");return`${n.cssText} content: '${d.replace(/'|"/g,"")}';`}function No(n,d){return Hr(d).map(g=>{const o=n.getPropertyValue(g),c=n.getPropertyPriority(g);return`${g}: ${o}${c?" !important":""};`}).join(" ")}function Wo(n,d,g,o){const c=`.${n}:${d}`,r=g.cssText?Vo(g):No(g,o);return document.createTextNode(`${c}{${r}}`)}function Yi(n,d,g,o){const c=window.getComputedStyle(n,g),r=c.getPropertyValue("content");if(r===""||r==="none")return;const h=Do();try{d.className=`${d.className} ${h}`}catch{return}const u=document.createElement("style");u.appendChild(Wo(h,g,c,o)),d.appendChild(u)}function Go(n,d,g){Yi(n,d,":before",g),Yi(n,d,":after",g)}const Qi="application/font-woff",Zi="image/jpeg",Ko={woff:Qi,woff2:Qi,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:Zi,jpeg:Zi,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml",webp:"image/webp"};function Jo(n){const d=/\.([^./]*?)$/g.exec(n);return d?d[1]:""}function li(n){const d=Jo(n).toLowerCase();return Ko[d]||""}function Xo(n){return n.split(/,/)[1]}function Xn(n){return n.search(/^(data:)/)!==-1}function Yo(n,d){return`data:${d};base64,${n}`}async function Nr(n,d,g){const o=await fetch(n,d);if(o.status===404)throw new Error(`Resource "${o.url}" not found`);const c=await o.blob();return new Promise((r,h)=>{const u=new FileReader;u.onerror=h,u.onloadend=()=>{try{r(g({res:o,result:u.result}))}catch(l){h(l)}},u.readAsDataURL(c)})}const Hn={};function Qo(n,d,g){let o=n.replace(/\?.*/,"");return g&&(o=n),/ttf|otf|eot|woff2?/i.test(o)&&(o=o.replace(/.*\//,"")),d?`[${d}]${o}`:o}async function ci(n,d,g){const o=Qo(n,d,g.includeQueryParams);if(Hn[o]!=null)return Hn[o];g.cacheBust&&(n+=(/\?/.test(n)?"&":"?")+new Date().getTime());let c;try{const r=await Nr(n,g.fetchRequestInit,({res:h,result:u})=>(d||(d=h.headers.get("Content-Type")||""),Xo(u)));c=Yo(r,d)}catch(r){c=g.imagePlaceholder||"";let h=`Failed to fetch resource: ${n}`;r&&(h=typeof r=="string"?r:r.message),h&&console.warn(h)}return Hn[o]=c,c}async function Zo(n){const d=n.toDataURL();return d==="data:,"?n.cloneNode(!1):Yt(d)}async function es(n,d){if(n.currentSrc){const r=document.createElement("canvas"),h=r.getContext("2d");r.width=n.clientWidth,r.height=n.clientHeight,h?.drawImage(n,0,0,r.width,r.height);const u=r.toDataURL();return Yt(u)}const g=n.poster,o=li(g),c=await ci(g,o,d);return Yt(c)}async function ts(n,d){var g;try{if(!((g=n?.contentDocument)===null||g===void 0)&&g.body)return await cn(n.contentDocument.body,d,!0)}catch{}return n.cloneNode(!1)}async function ns(n,d){return qe(n,HTMLCanvasElement)?Zo(n):qe(n,HTMLVideoElement)?es(n,d):qe(n,HTMLIFrameElement)?ts(n,d):n.cloneNode(Wr(n))}const is=n=>n.tagName!=null&&n.tagName.toUpperCase()==="SLOT",Wr=n=>n.tagName!=null&&n.tagName.toUpperCase()==="SVG";async function rs(n,d,g){var o,c;if(Wr(d))return d;let r=[];return is(n)&&n.assignedNodes?r=pt(n.assignedNodes()):qe(n,HTMLIFrameElement)&&(!((o=n.contentDocument)===null||o===void 0)&&o.body)?r=pt(n.contentDocument.body.childNodes):r=pt(((c=n.shadowRoot)!==null&&c!==void 0?c:n).childNodes),r.length===0||qe(n,HTMLVideoElement)||await r.reduce((h,u)=>h.then(()=>cn(u,g)).then(l=>{l&&d.appendChild(l)}),Promise.resolve()),d}function as(n,d,g){const o=d.style;if(!o)return;const c=window.getComputedStyle(n);c.cssText?(o.cssText=c.cssText,o.transformOrigin=c.transformOrigin):Hr(g).forEach(r=>{let h=c.getPropertyValue(r);r==="font-size"&&h.endsWith("px")&&(h=`${Math.floor(parseFloat(h.substring(0,h.length-2)))-.1}px`),qe(n,HTMLIFrameElement)&&r==="display"&&h==="inline"&&(h="block"),r==="d"&&d.getAttribute("d")&&(h=`path(${d.getAttribute("d")})`),o.setProperty(r,h,c.getPropertyPriority(r))})}function os(n,d){qe(n,HTMLTextAreaElement)&&(d.innerHTML=n.value),qe(n,HTMLInputElement)&&d.setAttribute("value",n.value)}function ss(n,d){if(qe(n,HTMLSelectElement)){const o=Array.from(d.children).find(c=>n.value===c.getAttribute("value"));o&&o.setAttribute("selected","")}}function ls(n,d,g){return qe(d,Element)&&(as(n,d,g),Go(n,d,g),os(n,d),ss(n,d)),d}async function cs(n,d){const g=n.querySelectorAll?n.querySelectorAll("use"):[];if(g.length===0)return n;const o={};for(let r=0;r<g.length;r++){const u=g[r].getAttribute("xlink:href");if(u){const l=n.querySelector(u),e=document.querySelector(u);!l&&e&&!o[u]&&(o[u]=await cn(e,d,!0))}}const c=Object.values(o);if(c.length){const r="http://www.w3.org/1999/xhtml",h=document.createElementNS(r,"svg");h.setAttribute("xmlns",r),h.style.position="absolute",h.style.width="0",h.style.height="0",h.style.overflow="hidden",h.style.display="none";const u=document.createElementNS(r,"defs");h.appendChild(u);for(let l=0;l<c.length;l++)u.appendChild(c[l]);n.appendChild(h)}return n}async function cn(n,d,g){return!g&&d.filter&&!d.filter(n)?null:Promise.resolve(n).then(o=>ns(o,d)).then(o=>rs(n,o,d)).then(o=>ls(n,o,d)).then(o=>cs(o,d))}const Gr=/url\((['"]?)([^'"]+?)\1\)/g,ds=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,us=/src:\s
45*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;function ps(n){const d=n.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1");return new RegExp(`(url\\(['"]?)(${d})(['"]?\\))`,"g")}function hs(n){const d=[];return n.replace(Gr,(g,o,c)=>(d.push(c),g)),d.filter(g=>!Xn(g))}async function fs(n,d,g,o,c){try{const r=g?Bo(d,g):d,h=li(d);let u;return c||(u=await ci(r,h,o)),n.replace(ps(d),`$1${u}$3`)}catch{}return n}function gs(n,{preferredFontFormat:d}){return d?n.replace(us,g=>{for(;;){const[o,,c]=ds.exec(g)||[];if(!c)return"";if(c===d)return`src: ${o};`}}):n}function Kr(n){return n.search(Gr)!==-1}async function Jr(n,d,g){if(!Kr(n))return n;const o=gs(n,g);return hs(o).reduce((r,h)=>r.then(u=>fs(u,h,d,g)),Promise.resolve(o))}async function St(n,d,g){var o;const c=(o=d.style)===null||o===void 0?void 0:o.getPropertyValue(n);if(c){const r=await Jr(c,null,g);return d.style.setProperty(n,r,d.style.getPropertyPriority(n)),!0}return!1}async function ms(n,d){await St("background",n,d)||await St("background-image",n,d),await St("mask",n,d)||await St("-webkit-mask",n,d)||await St("mask-image",n,d)||await St("-webkit-mask-image",n,d)}async function bs(n,d){const g=qe(n,HTMLImageElement);if(!(g&&!Xn(n.src))&&!(qe(n,SVGImageElement)&&!Xn(n.href.baseVal)))return;const o=g?n.src:n.href.baseVal,c=await ci(o,li(o),d);await new Promise((r,h)=>{n.onload=r,n.onerror=d.onImageErrorHandler?(...l)=>{try{r(d.onImageErrorHandler(...l))}catch(e){h(e)}}:h;const u=n;u.decode&&(u.decode=r),u.loading==="lazy"&&(u.loading="eager"),g?(n.srcset="",n.src=c):n.href.baseVal=c})}async function ys(n,d){const o=pt(n.childNodes).map(c=>Xr(c,d));await Promise.all(o).then(()=>n)}async function Xr(n,d){qe(n,Element)&&(await ms(n,d),await bs(n,d),await ys(n,d))}function vs(n,d){const{style:g}=n;d.backgroundColor&&(g.backgroundColor=d.backgroundColor),d.width&&(g.width=`${d.width}px`),d.height&&(g.height=`${d.height}px`);const o=d.style;return o!=null&&Object.keys(o).forEach(c=>{g[c]=o[c]}),n}const er={};async function tr(n){let d=er[n];if(d!=null)return d;const o=await(await fetch(n)).text();return d={url:n,cssText:o},er[n]=d,d}async function nr(n,d){let g=n.cssText;const o=/url\(["']?([^"')]+)["']?\)/g,r=(g.match(/url\([^)]+\)/g)||[]).map(async h=>{let u=h.replace(o,"$1");return u.startsWith("https://")||(u=new URL(u,n.url).href),Nr(u,d.fetchRequestInit,({result:l})=>(g=g.replace(h,`url(${l})`),[h,l]))});return Promise.all(r).then(()=>g)}function ir(n){if(n==null)return[];const d=[],g=/(\/\*[\s\S]*?\*\/)/gi;let o=n.replace(g,"");const c=new RegExp("((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)}
45)","gi");for(;;){const l=c.exec(o);if(l===null)break;d.push(l[0])}o=o.replace(c,"");const r=/@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi,h="((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})",u=new RegExp(h,"gi");for(;;){let l=r.exec(o);if(l===null){if(l=u.exec(o),l===null)break;r.lastIndex=u.lastIndex}else u.lastIndex=r.lastIndex;d.push(l[0])}return d}async function ws(n,d){const g=[],o=[];return n.forEach(c=>{if("cssRules"in c)try{pt(c.cssRules||[]).forEach((r,h)=>{if(r.type===CSSRule.IMPORT_RULE){let u=h+1;const l=r.href,e=tr(l).then(t=>nr(t,d)).then(t=>ir(t).forEach(s=>{try{c.insertRule(s,s.startsWith("@import")?u+=1:c.cssRules.length)}catch(i){console.error("Error inserting rule from remote css",{rule:s,error:i})}})).catch(t=>{console.error("Error loading remote css",t.toString())});o.push(e)}})}catch(r){const h=n.find(u=>u.href==null)||document.styleSheets[0];c.href!=null&&o.push(tr(c.href).then(u=>nr(u,d)).then(u=>ir(u).forEach(l=>{h.insertRule(l,h.cssRules.length)})).catch(u=>{console.error("Error loading remote stylesheet",u)})),console.error("Error inlining remote css file",r)}}),Promise.all(o).then(()=>(n.forEach(c=>{if("cssRules"in c)try{pt(c.cssRules||[]).forEach(r=>{g.push(r)})}catch(r){console.error(`Error while reading CSS rules from ${c.href}`,r)}}),g))}function xs(n){return n.filter(d=>d.type===CSSRule.FONT_FACE_RULE).filter(d=>Kr(d.style.getPropertyValue("src")))}async function _s(n,d){if(n.ownerDocument==null)throw new Error("Provided element is not within a Document");const g=pt(n.ownerDocument.styleSheets),o=await ws(g,d);return xs(o)}function Yr(n){return n.trim().replace(/["']/g,"")}function Cs(n){const d=new Set;function g(o){(o.style.fontFamily||getComputedStyle(o).fontFamily).split(",").forEach(r=>{d.add(Yr(r))}),Array.from(o.children).forEach(r=>{r instanceof HTMLElement&&g(r)})}return g(n),d}async function ks(n,d){const g=await _s(n,d),o=Cs(n);return(await Promise.all(g.filter(r=>o.has(Yr(r.style.fontFamily))).map(r=>{const h=r.parentStyleSheet?r.parentStyleSheet.href:null;return Jr(r.cssText,h,d)}))).join(`
46`)}async function Ss(n,d){const g=d.fontEmbedCSS!=null?d.fontEmbedCSS:d.skipFonts?null:await ks(n,d);if(g){const o=document.createElement("style"),c=document.createTextNode(g);o.appendChild(c),n.firstChild?n.insertBefore(o,n.firstChild):n.appendChild(o)}}async function Es(n,d={}){const{width:g,height:o}=Vr(n,d),c=await cn(n,d,!0);return await Ss(c,d),await Xr(c,d),vs(c,d),await Ho(c,g,o)}async function Ts(n,d={}){const{width:g,height:o}=Vr(n,d),c=await Es(n,d),r=await Yt(c),h=document.createElement("canvas"),u=h.getContext("2d"),l=d.pixelRatio||jo(),e=d.canvasWidth||g,t=d.canvasHeight||o;return h.width=e*l,h.height=t*l,d.skipAutoScale||qo(h),h.style.width=`${e}`,h.style.height=`${t}`,d.backgroundColor&&(u.fillStyle=d.backgroundColor,u.fillRect(0,0,h.width,h.height)),u.drawImage(r,0,0,h.width,h.height),h}async function $s(n,d={}){return(await Ts(n,d)).toDataURL()}function Ps(n){n.DomComponents.addType("Feature",{model:{defaults:{tagName:"div",draggable:!0,droppable:!1,attributes:{class:"features"},"script-props":[],traits:[],style:{"font-family":"Roboto, sans-serif",padding:"15px 0"}}},view:{onRender({el:g,model:o}){const c=o.get("script");if(c)try{const r=new Function("return "+c).call(g);typeof r=="function"?r.call(g):console.error("Script does not return a valid function.")}catch(r){console.error("Error executing script:",r)}}}}),n.BlockManager.add("feature",{media:'<img src="/images/builder/sections/feature.png" alt="Tính năng">',label:"Tính năng",category:"default-other",content:`<div style="font-family: 'Roboto', sans-serif; margin: 20px 0;">
47      <div style="max-width: 46rem; width: 100%; margin: 0 auto;">
48        <div style="text-align: center; font-weight: bold; font-size: 3rem; line-height: 1.5; color: #101828;">Everything you need to deploy your app</div>
49        <div style="margin-top: 1rem; text-align: center; font-size: 1.125rem; line-height: 1.5; color: #4a5565;">Quis tellus eget adipiscing convallis sit sit eget aliquet quis. Suspendisse eget egestas a elementum pulvinar et feugiat blandit at. In mi viverra elit nunc.</div>
50      </div>
51      <div class="features">
52        <div style="display: flex;">
53          <img src="/images/builder/sections/icon-cloud.png" alt="Tính năng" style="width: 40px; height: 40px; border-radius: 5px; flex-shrink: 0;" />
54          <div style="margin-left: 15px;">
55            <div style="font-size: 1rem; font-weight: bold;">Push to deploy</div>
56            <div style="margin-top: 10px; font-size: 1rem; color: #4a5565;">Morbi viverra dui mi arcu sed. Tellus semper adipiscing suspendisse semper morbi. Odio urna massa nunc massa.</div>
57          </div>
58        </div>
59        <div style="display: flex;">
60          <img src="/images/builder/sections/icon-lock.png" alt="Tính năng" style="width: 40px; height: 40px; border-radius: 5px; flex-shrink: 0;" />
61          <div style="margin-left: 15px;">
62            <div style="font-size: 1rem; font-weight: bold;">SSL certificates</div>
63            <div style="margin-top: 10px; font-size: 1rem; color: #4a5565;">Sit quis amet rutrum tellus ullamcorper ultricies libero dolor eget. Sem sodales gravida quam turpis enim lacus amet.</div>
64          </div>
65        </div>
66        <div style="display: flex;">
67          <img src="/images/builder/sections/icon-reload.png" alt="Tính năng" style="width: 40px; height: 40px; border-radius: 5px; flex-shrink: 0;" />
68          <div style="margin-left: 15px;">
69            <div style="font-size: 1rem; font-weight: bold;">Simple queues</div>
70            <div style="margin-top: 10px; font-size: 1rem; color: #4a5565;">Quisque est vel vulputate cursus. Risus proin diam nunc commodo. Lobortis auctor congue commodo diam neque.</div>
71          </div>
72        </div>
73        <div style="display: flex;">
74          <img src="/images/builder/sections/icon-fingerprint.png" alt="Tính năng" style="width: 40px; height: 40px; border-radius: 5px; flex-shrink: 0;" />
75          <div style="margin-left: 15px;">
76            <div style="font-size: 1rem; font-weight: bold;">Advanced security</div>
77            <div style="margin-top: 10px; font-size: 1rem; color: #4a5565;">Arcu egestas dolor vel iaculis in ipsum mauris. Tincidunt mattis aliquet hac quis. Id hac maecenas ac donec pharetra eget.</div>
78          </div>
79        </div>
80      </div>
81    </div>
82    <style>
83      .features {
84        margin-top: 3rem;
85        display: grid;
86        grid-template-columns: 1fr 1fr;
87        gap: 1.5rem;
88      }
89      @media (max-width: 575px) {
90        .features {
91          grid-template-columns: 1fr;
92        }
93      }
94    </style>`})}function Ms(n){n.DomComponents.addType("stats",{model:{defaults:{tagName:"div",draggable:!0,droppable:!1,attributes:{class:"stats"},"script-props":[],traits:[],style:{"font-family":"Roboto, sans-serif",padding:"15px 0"},script:function(){document.querySelectorAll(".stats-count-up").forEach(o=>{if(o.textContent){let c=function(l){const e=Math.min((l-u)/1500,1);
94o.textContent=Math.floor(e*h).toLocaleString(),e<1&&requestAnimationFrame(c)};const r=o.textContent.trim();o.textContent="0";const h=parseFloat(r),u=performance.now();requestAnimationFrame(c)}})}}},view:{onRender({el:g,model:o}){const c=o.get("script");if(c)try{const r=new Function("return "+c).call(g);typeof r=="function"?r.call(g):console.error("Script does not return a valid function.")}catch(r){console.error("Error executing script:",r)}}}}),n.BlockManager.add("stats",{media:'<img src="/images/builder/sections/stats.png" alt="Thống kê">',label:"Thống kê",category:"default-other",content:`<div style="font-family: 'Roboto', sans-serif; margin: 20px 0;">
95      <div style="max-width: 46rem; width: 100%; margin: 0 auto;">
96        <div style="text-align: center; font-weight: bold; font-size: 3rem; line-height: 1.5; color: #101828;">Trusted by creators worldwide</div>
97        <div style="margin-top: 1rem; text-align: center; font-size: 1.125rem; line-height: 1.5; color: #4a5565;">Lorem ipsum dolor sit amet consect adipisicing possimus.</div>
98      </div>
99      <div data-gjs-type="stats" class="stats-section">
100        <div style="text-align: center; font-weight: bold;">
101          <div style="font-size: 1.875rem;"><span class="stats-count-up">8000</span>+</div>
102          <div style="margin-top: 10px; font-size: .875rem; color: #4a5565;">Creators on the platform</div>
103        </div>
104        <div style="text-align: center; font-weight: bold;">
105          <div style="font-size: 1.875rem;"><span class="stats-count-up">3</span>%</div>
106          <div style="margin-top: 10px; font-size: .875rem; color: #4a5565;">Flat platform fee</div>
107        </div>
108        <div style="text-align: center; font-weight: bold;">
109          <div style="font-size: 1.875rem;"><span class="stats-count-up">99.9</span>%</div>
110          <div style="margin-top: 10px; font-size: .875rem; color: #4a5565;">Uptime guarantee</div>
111        </div>
112        <div style="text-align: center; font-weight: bold;">
113          <div style="font-size: 1.875rem;">$<span class="stats-count-up">70</span></div>
114          <div style="margin-top: 10px; font-size: .875rem; color: #4a5565;">Paid out to creators</div>
115        </div>
116      </div>
117    </div>
118    <style>
119      .stats-section {
120        margin-top: 3rem;
121        display: grid;
122        grid-template-columns: 1fr 1fr 1fr 1fr;
123        gap: 1.5rem;
124      }
125      @media (max-width: 676px) {
126        .stats-section {
127          grid-template-columns: 1fr 1fr;
128        }
129      }
130      @media (max-width: 575px) {
131        .stats-section {
132          grid-template-columns: 1fr;
133        }
134      }
135    </style>`})}function Ls(n){n.DomComponents.addType("Footer",{model:{defaults:{tagName:"div",draggable:!0,droppable:!1,attributes:{class:"footer-section"},"script-props":[],traits:[],style:{padding:"15px 0"}}},view:{onRender({el:g,model:o}){const c=o.get("script");if(c)try{const r=new Function("return "+c).call(g);typeof r=="function"?r.call(g):console.error("Script does not return a valid function.")}catch(r){console.error("Error executing script:",r)}}}}),n.BlockManager.add("footer",{media:'<img src="/images/builder/sections/footer.png" alt="Footer">',label:"Mẫu 1",category:"default-footer",content:`
136 <footer class="footer">
137    <div class="container">
138      <div class="footer-top">
139        <div class="footer-left">
140          <div class="logo">
141            <img src="/images/edubit_logo.png" alt="Logo" />
142          </div>
143          <p>Making the world a better place through constructing elegant hierarchies.</p>
144          <div class="social-icons">
145            <a href="https://demo.com"><img src="https://cdn.jsdelivr.net/npm/simple-icons@v5/icons/facebook.svg" alt="Facebook" /></a>
146            <a href="https://demo.com"><img src="https://cdn.jsdelivr.net/npm/simple-icons@v5/icons/instagram.svg" alt="Instagram" /></a>
147            <a href="https://demo.com"><img src="https://cdn.jsdelivr.net/npm/simple-icons@v5/icons/github.svg" alt="GitHub" /></a>
148            <a href="https://demo.com"><img src="https://cdn.jsdelivr.net/npm/simple-icons@v5/icons/youtube.svg" alt="YouTube" /></a>
149          </div>
150        </div>
151
152        <div class="footer-links">
153          <div>
154            <h4>Solutions</h4>
155            <ul>
156              <li><a href="https://demo.com">Marketing</a></li>
157              <li><a href="https://demo.com">Analytics</a></li>
158              <li><a href="https://demo.com">Automation</a></li>
159              <li><a href="https://demo.com">Commerce</a></li>
160              <li><a href="https://demo.com">Insights</a></li>
161            </ul>
162          </div>
163          <div>
164            <h4>Support</h4>
165            <ul>
166              <li><a href="https://demo.com">Submit ticket</a></li>
167              <li><a href="https://demo.com">Documentation</a></li>
168              <li><a href="https://demo.com">Guides</a></li>
169            </ul>
170          </div>
171          <div>
172            <h4>Company</h4>
173            <ul>
174              <li><a href="https://demo.com">About</a></li>
175              <li><a href="https://demo.com">Blog</a></li>
176              <li><a href="https://demo.com">Jobs</a></li>
177              <li><a href="https://demo.com">Press</a></li>
178            </ul>
179          </div>
180          <div>
181            <h4>Content</h4>
182            <ul>
183              <li><a href="https://demo.com">About</a></li>
184              <li><a href="https://demo.com">Blog</a></li>
185              <li><a href="https://demo.com">Jobs</a></li>
186              <li><a href="https://demo.com">Press</a></li>
187            </ul>
188          </div>
189        </div>
190      </div>
191      <div class="copyright">
192        © 2025 Your Company, Inc. All rights reserved.
193      </div>
194    </div>
195  </footer>
196    <style>
197
198.footer {
199  background-color: #0f172a;
200  padding: 40px 20px;
201  color: #99a1af;
202}
203
204.footer-top {
205  display: flex;
206  flex-wrap: wrap;
207  justify-content: space-between;
208  gap: 60px;
209}
210
211.footer-left {
212  flex: 1 1 20px;
213  min-width: 240px;
214}
215
216.footer-left .logo img {
217  height: 48px;
218  margin-bottom: 16px;
219}
220
221.footer-left p {
222  margin-bottom: 16px;
223  font-size: 14px;
224  color: #d1d5db;
225}
226
227.social-icons a {
228  margin-right: 10px;
229  display: inline-block;
230}
231
232.social-icons img {
233  width: 20px;
234  height: 20px;
235  filter: invert(70%);
236  transition: transform 0.2s;
237}
238
239.social-icons img:hover {
240  transform: scale(1.1);
241}
242
243.footer-links {
244  flex: 2;
245  display: grid;
246  grid-template-columns: repeat(4, 1fr);
247  gap: 24px;
248}
249
250.footer-links h4 {
251  font-size: 16px;
252  margin-bottom: 12px;
253  color: #ffffff;
254}
255
256.footer-links ul {
257  list-style: none;
258  padding: 0;
259  margin: 0;
260}
261
262.footer-links li {
263  margin-bottom: 8px;
264}
265
266.footer-links a {
267  color: #99a1af;
268  text-decoration: none;
269}
270
271.footer-links a:hover {
272  color: #ffffff;
273  text-decoration: underline;
274}
275
276.copyright {
277  text-align: center;
278  border-top: 1px solid #1e293b;
279  padding-top: 20px;
280  margin-top: 30px;
281  font-size: 13px;
282  color: #64748b;
283}
284
285/* Responsive design */
286@media (max-width: 768px) {
287  .footer-top {
288    flex-direction: column;
289    align-items: flex-start;
290    gap: 30px;
291  }
292
293  .footer-left {
294    width: 100%;
295  }
296
297  .footer-links {
298    display: flex;
299    flex-direction: column;
300    gap: 20px;
301    width: 100%;
302  }
303
304  .footer-links > div {
305    width: 100%;
306  }
307
308  .footer-links h4 {
309    font-size: 15px;
310  }
311
312  .footer-links a {
313    font-size: 14px;
314  }
315
316  .social-icons img {
317    width: 24px;
318    height: 24px;
319  }
320  .copyright {
321    text-align: left;
322    font-size: 12px;
323    padding-top: 15px;
324  }
325}
326    </style>`})}function Is(n){n.DomComponents.addType("Collapse",{model:{defaults:{tagName:"div",draggable:!0,droppable:!1,attributes:{class:"collapse-section"},"script-props":[],traits:[],style:{padding:"15px 0"},script:function(){this.querySelectorAll(".faq-item").forEach(o=>{const c=o.querySelector(".faq-question"),r=o.querySelector(".faq-answer"),h=o.querySelector(".icon");c?.addEventListener("click",()=>{if(o.classList.contains("active"))r.style.height="0px",h.textContent="+",o.classList.remove("active");else{const l=r.scrollHeight+8;r.style.height=l+"px",h.textContent="–",o.classList.add("active")}}),r.style.height="0px"})}}},view:{onRender({el:g,model:o}){const c=o.get("script");if(c)try{const r=new Function("return "+c).call(g);typeof r=="function"?r.call(g):console.error("Script does not return a valid function.")}catch(r){console.error("Error executing script:",r)}}}}),n.BlockManager.add("collapse",{media:'<img src="/images/builder/sections/collapse.png" alt="Collapse">',label:"Mẫu 1",category:"default-other",content:`<div class="faq-wrapper" data-gjs-type="Collapse">
327      <div class="faq-item">
328        <button class="faq-question">
329          <span class="text">Acabiz có hỗ trợ triển khai...</span>
330          <span class="icon">+</span>
331        </button>
332        <div class="faq-answer">
333          <p>Chúng tôi có hỗ trợ đầy đủ các khung chương trình đào tạo phù hợp doanh nghiệp.</p>
334        </div>
335      </div>
336
337      <div class="faq-item">
338        <button class="faq-question">
339           <span class="text">Acabiz có hỗ trợ triển khai...</span>
340          <span class="icon">+</span>
341        </button>
342        <div class="faq-answer">
343          <p>Acabiz cung cấp kho nội dung đào tạo đa dạng, phù hợp nhiều ngành nghề.</p>
344        </div>
345      </div>
346
347      <div class="faq-item">
348        <button class="faq-question">
349            <span class="text">Acabiz có hỗ trợ triển khai...</span>
350          <span class="icon">+</span>
351        </button>
352        <div class="faq-answer">
353          <p>Hoàn toàn có thể, bạn có thể nâng cấp gói tùy theo nhu cầu sử dụng.</p>
354        </div>
355      </div>
356
357      <div class="faq-item">
358        <button class="faq-question">
359           <span class="text">Acabiz có hỗ trợ triển khai...</span>
360          <span class="icon">+</span>
361        </button>
362        <div class="faq-answer">
363          <p>Chúng tôi tuân thủ các tiêu chuẩn bảo mật cao nhất để bảo vệ dữ liệu.</p>
364        </div>
365      </div>
366    </div>
367
368    <style>
369      .faq-wrapper {
370        font-family: 'Roboto', sans-serif;
371        max-width: 800px;
372        margin: 0 auto;
373      }
374
375      .faq-title {
376        text-align: center;
377        font-size: 24px;
378        font-weight: bold;
379        color: #002B7F;
380        margin-bottom: 30px;
381      }
382
383      .faq-item {
384        border-top: 1px solid #ddd;
385      }
386
387      .faq-question {
388  background: none;
389  border: none;
390  padding: 15px 10px;
391  width: 100%;
392  text-align: left;
393  font-size: 16px;
394  font-weight: 500;
395  color: black;
396  display: flex;
397  justify-content: space-between; /* 👈 giúp đẩy icon ra phải */
398  align-items: center;
399  cursor: pointer;
400}
401.faq-question.text {
402      
403        margin-top: 2px;
404        margin-bottom: 2px;
405        background: #9f9f9f;
406}
407
408      .faq-question .icon {
409          font-size: 18px;
410  width: 24px;
411  height: 24px;
412  display: flex;
413  align-items: center;
414  justify-content: center;
415  line-height: 1;
416  color: #002B7F;
417  font-weight: bold;
418  transition: transform 0.3s ease;
419   border: 1px solid transparent;
420  border-radius: 50%;
421      }
422
423.faq-answer {
424  overflow: hidden;
425  transition: height 0.4s ease;
426  font-size: 14px;
427  color: #4a5565;
428  padding-top: 10px;
429  padding-left: 15px;
430}
431
432
433    </style>
434   `})}function Rs(n){n.DomComponents.addType("Testimonials",{model:{defaults:{tagName:"div",draggable:!0,droppable:!1,attributes:{class:"testimonials-section"},"script-props":[],traits:[],style:{padding:"15px 0"}}},view:{onRender({el:g,model:o}){const c=o.get("script");
434if(c)try{const r=new Function("return "+c).call(g);typeof r=="function"?r.call(g):console.error("Script does not return a valid function.")}catch(r){console.error("Error executing script:",r)}}}}),n.BlockManager.add("testimonials",{media:'<img src="/images/builder/sections/testimonials.png" alt="Testimonials">',label:"Testimonials",category:"default-other",content:`
435      <div class="testimonial-section">
436    <div class="testimonial-container">
437      <img class="testimonial-logo" src="https://tailwindcss.com/plus-assets/img/logos/workcation-logo-indigo-600.svg" alt="Workcation logo" />
438      <figure>
439        <blockquote class="testimonial-quote">
440          <p>“Lorem ipsum dolor sit amet consectetur adipisicing elit. Nemo expedita voluptas culpa sapiente alias molestiae. Numquam corrupti in laborum sed rerum et corporis.”</p>
441        </blockquote>
442        <figcaption class="testimonial-figcaption">
443          <img class="testimonial-avatar" src="https://images.unsplash.com/photo-1494790108377-be9c29b29330?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=facearea&facepad=2&w=256&h=256&q=80" alt="Judith Black" />
444          <div class="testimonial-info">
445            <div class="testimonial-name">Judith Black</div>
446            <div class="testimonial-dot"></div>
447            <div class="testimonial-role">CEO of Workcation</div>
448          </div>
449        </figcaption>
450      </figure>
451    </div>
452  </div>
453  
454    <style>
455    .testimonial-section {
456      position: relative;
457      overflow: hidden;
458      padding: 6rem 1.5rem;
459    }
460
461    .testimonial-section::before {
462      content: "";
463      position: absolute;
464      inset: 0;
465      z-index: -10;
466      /*background: radial-gradient(45rem 50rem at top, #e0e7ff, white); !* var(--color-indigo-100) *!*/
467      opacity: 0.2;
468    }
469
470    .testimonial-section::after {
471      content: "";
472      position: absolute;
473      top: 0;
474      bottom: 0;
475      right: 50%;
476      margin-right: 4rem;
477      width: 200%;
478      background: white;
479      transform: skewX(-30deg);
480      transform-origin: bottom left;
481      box-shadow: 0 0 20px rgba(79, 70, 229, 0.1); /* indigo-600 */
482      border: 1px solid #eef2ff; /* ring-indigo-50 */
483      z-index: -10;
484    }
485
486    .testimonial-container {
487      max-width: 64rem;
488      margin: 0 auto;
489      text-align: center;
490    }
491
492    .testimonial-logo {
493      height: 3rem;
494      margin: 0 auto;
495    }
496
497    .testimonial-quote {
498      margin-top: 2.5rem;
499      font-size: 1.25rem;
500      line-height: 2rem;
501      font-weight: 600;
502      color: #111827; /* gray-900 */
503    }
504
505    @media (min-width: 640px) {
506      .testimonial-quote {
507        font-size: 1.5rem;
508        line-height: 2.25rem;
509      }
510    }
511
512    .testimonial-figcaption {
513      margin-top: 2.5rem;
514    }
515
516    .testimonial-avatar {
517      width: 2.5rem;
518      height: 2.5rem;
519      border-radius: 50%;
520      object-fit: cover;
521      margin: 0 auto;
522    }
523
524    .testimonial-info {
525      margin-top: 1rem;
526      display: flex;
527      justify-content: center;
528      align-items: center;
529      gap: 0.75rem;
530      font-size: 1rem;
531    }
532
533    .testimonial-name {
534      font-weight: 600;
535      color: #111827;
536    }
537
538    .testimonial-dot {
539      width: 3px;
540      height: 3px;
541      background-color: #111827;
542      border-radius: 50%;
543    }
544
545    .testimonial-role {
546      color: #4b5563; /* gray-600 */
547    }
548  </style>
549   `})}function zs(n){n.DomComponents.addType("banner",{model:{defaults:{tagName:"div",draggable:!0,droppable:!1,attributes:{class:"banner"},"script-props":[],traits:[],style:{"font-family":"Roboto, sans-serif"},script:function(){const g=document.querySelector("header"),o=document.querySelector(".banner-section");if(o){window.location.href.includes("/admin/pages/")?document.body.style.paddingTop=`${o.offsetHeight}px`:g&&(g.style.paddingTop=`${o.offsetHeight}px`);let c=null;if("ResizeObserver"in window){const u=new ResizeObserver(l=>{for(const e of l){const t=e.target.clientHeight;window.location.href.includes("/admin/pages/")?document.body.style.paddingTop=`${t}px`:g&&(g.style.paddingTop=`${t}px`)}});u.observe(o),c=()=>{u.disconnect()}}else{let u=o.offsetHeight;const l=gr(()=>{const e=o.offsetHeight;e!==u&&(u=e,window.location.href.includes("/admin/pages/")?document.body.style.paddingTop=`${e}px`:g&&(g.style.paddingTop=`${e}px`))},300);c=()=>{clearInterval(l)}}const r=document.querySelector(".btn-close-banner-section"),h=()=>{o.remove(),window.location.href.includes("/admin/pages/")?document.body.style.paddingTop="":g&&(g.style.paddingTop=""),c&&c()};r&&r.addEventListener("click",h)}}}},view:{onRender({el:g,model:o}){const c=o.get("script");
549if(c)try{const r=new Function("return "+c).call(g);typeof r=="function"?r.call(g):console.error("Script does not return a valid function.")}catch(r){console.error("Error executing script:",r)}}}}),n.BlockManager.add("banner",{media:'<img src="/images/builder/sections/banner.png" alt="Banner">',label:"Mẫu 1",category:"default-banner",content:`<div data-gjs-type="banner" class="banner-section">
550      <div class="banner-section__content">
551        <a href="https://your-domain.com" class="banner-section__link">
552          <b>GeneriCon 2023</b> - Join us in Denver from June 7 - 9 to see what's coming next →
553        </a>
554        <svg class="btn-close-banner-section" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
555          <path stroke-linecap="round" stroke-linejoin="round" d="M6 18 18 6M6 6l12 12" />
556        </svg>
557      </div>
558    </div>
559    <style>
560      .banner-section {
561        position: fixed;
562        top: 0;
563        left: 0;
564        right: 0;
565        width: 100%;
566        z-index: 999999999;
567      }
568      .banner-section .banner-section__content {
569        position: relative;
570        width: 100%;
571        height: 100%;
572        padding: 10px 20px;
573        text-align: center;
574        background-color: #4f39f6;
575      }
576      .banner-section .banner-section__content .banner-section__link {
577        margin: 0 auto;
578        color: #ffffff;
579        text-decoration: none;
580      }
581      .banner-section .banner-section__content .btn-close-banner-section {
582        position: absolute;
583        top: 5px;
584        right: 5px;
585        z-index: 1;
586        width: 20px;
587        height: 20px;
588        color: #ffffff;
589      }
590      @media (max-width: 575px) {
591        .banner-section .banner-section__content {
592          padding: 10px 25px;
593        }
594      }
595    </style>`})}function As(n){const d=n.DomComponents,g={formId:null},c=[{type:"select-form",label:"Chọn form",name:"dataFormId",changeProp:!0,category:{id:"catGeneral",label:"Dữ liệu",open:!0}}];d.addType("FormEmbed",{model:{defaults:{tagName:"div",draggable:!0,droppable:!1,attributes:{class:"form-embed"},...g,"script-props":[...Object.keys(g)],components:"Chọn form...",traits:[...c],style:{"font-family":"Roboto, sans-serif"},script:function(r){r&&r.formId&&(fetch(`/api/v1/forms/get-form-embed/${r.formId}`,{}).then(h=>h.json()).then(h=>{const u=h?.data||h,l=u?.form_size?.width?`${u?.form_size?.width}px`:"100%",e=u?.form_size?.height?`${u?.form_size?.height}px`:"700px";this.innerHTML=`<iframe style="width: ${l}; height: ${e};" src="/form/embed/${r.formId}" frameborder="0"></iframe>`}).catch(h=>{console.log(h),this.innerHTML='<div style="text-align: center;"><svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 24 24"><path fill="currentColor" d="M11.001 10h2v5h-2zM11 16h2v2h-2z"/><path fill="currentColor" d="M13.768 4.2C13.42 3.545 12.742 3.138 12 3.138s-1.42.407-1.768 1.063L2.894 18.064a1.99 1.99 0 0 0 .054 1.968A1.98 1.98 0 0 0 4.661 21h14.678c.708 0 1.349-.362 1.714-.968a1.99 1.99 0 0 0 .054-1.968zM4.661 19L12 5.137L19.344 19z"/></svg><p>Có lỗi xảy ra khi tải dữ liệu.</p></div>'}),this.innerHTML="html")}}},view:{onRender({el:r,model:h}){const u=h.get("script");if(u)try{const l=new Function("return "+u).call(r);typeof l=="function"?l.call(r):console.error("Script does not return a valid function.")}catch(l){console.error("Error executing script:",l)}}}}),n.BlockManager.add("formEmbed",{media:'<img src="/images/builder/sections/form-embed.png" alt="Form nhúng">',label:"Form nhúng",category:"default-other",content:'<div data-gjs-type="FormEmbed" style="width: 100%;"></div>'}),n.Traits.addType("select-form",{createInput({component:r}){const h=document.createElement("select");return h.setAttribute("class","select-data-form_id"),fetch("/api/v1/forms/all",{}).then(u=>u.json()).then(u=>{const e=(u?.data||u).map(t=>({id:t._id,label:t.title}));h.innerHTML=`<option value="">Chọn form</option>${e.map(t=>`<option value="${t.id}">${t.label}</option>`).join("")}`}).catch(u=>{console.log(u)}),h.addEventListener("change",u=>{const l=u.target,e=Array.from(l.selectedOptions).map(t=>t.value);r.set("formId",e[0])}),h}})}const rr="LoginForm",Vn="/profile/my-courses";function Bs(n,d={}){const g={redirectUrl:Vn};n.DomComponents.addType(rr,{model:{defaults:{tagName:"div",draggable:!0,droppable:!1,attributes:{class:"edubit-login","data-auth-pending":"true"},redirectUrl:Vn,"script-props":Object.keys(g),traits:[{type:"text",label:"Trang sau đăng nhập",name:"redirectUrl",placeholder:Vn,changeProp:!0}],script:function(o){const c=this;if(c.dataset.loginRedirect=o?.redirectUrl||"/profile/my-courses",(()=>{try{return window.self!==window.top&&window.parent.location.pathname.startsWith("/admin/pages/")}catch{return!1}})()){c.removeAttribute("data-auth-pending"),c.hidden=!1;return}if(c.dataset.loginInitialized==="true")return;c.dataset.loginInitialized="true",c.hidden=!0;const h=c.querySelector("[data-login-form]"),u=c.querySelector("[data-login-account]"),l=c.querySelector("[data-login-account-label]")||u?.closest("label")?.querySelector(".edubit-login__label"),e=c.querySelector("[data-login-password]"),t=c.querySelector("[data-login-submit]"),s=c.querySelector("[data-login-submit-label]"),i=c.querySelectorAll("[data-login-message]"),a=c.querySelector("[data-login-otp-form]"),p=c.querySelector("[data-login-otp]"),b=c.querySelector("[data-login-otp-submit]"),m=c.querySelector("[data-login-otp-submit-label]"),_=c.querySelector("[data-login-select-form]"),C=c.querySelector("[data-login-accounts]"),w=c.querySelector("[data-login-select-submit]"),x=c.querySelector("[data-login-select-submit-label]");
595if(!h||!u||!e||!t||!s||i.length===0){c.removeAttribute("data-auth-pending"),c.hidden=!1;return}const f=()=>window.__EDUBIT_LOGIN__,v=async D=>{const j=f();if(j){await j.navigate(D);return}window.location.assign(D)},y=async()=>await v(c.dataset.loginRedirect||"/profile/my-courses"),P=()=>{c.removeAttribute("data-auth-pending"),c.removeAttribute("aria-hidden"),c.hidden=!1},E=()=>{c.setAttribute("aria-hidden","true"),c.hidden=!0},T=(D,j)=>{i.forEach(G=>{G.textContent=D,G.dataset.type=j,G.hidden=!D})},B=(D,j,G,V)=>{j.dataset.defaultLabel||(j.dataset.defaultLabel=j.textContent||""),D.disabled=G,D.setAttribute("aria-busy",String(G)),j.textContent=G?V:j.dataset.defaultLabel},z=D=>{c.querySelectorAll("[data-login-step]").forEach(j=>{j.hidden=j.dataset.loginStep!==D})},Y=D=>{const j=D,G=j.response?._data?.message||j.data?.message||j.message;return Array.isArray(G)?G.join(", "):G||"Đăng nhập không thành công. Vui lòng thử lại."};let J="",I="";const H=D=>{C&&(C.innerHTML="",D.forEach(j=>{const G=document.createElement("label");G.className="edubit-login__account";const V=document.createElement("input");if(V.type="radio",V.name="login-account",V.value=j.user_id,V.addEventListener("change",()=>{I=j.user_id}),j.photo){const ye=document.createElement("img");ye.className="edubit-login__avatar",ye.src=j.photo,ye.alt=j.fullname||"Tài khoản",G.appendChild(ye)}const q=document.createElement("span");q.className="edubit-login__account-detail";const O=document.createElement("strong");O.textContent=j.fullname||"Người dùng";const de=document.createElement("small");de.textContent=j.email_masked||"",q.append(O,de),G.prepend(V),G.appendChild(q),C.appendChild(G)}))};h.addEventListener("submit",async D=>{if(D.preventDefault(),t.disabled)return;const j=u.value.trim(),G=e.value;if(T("",""),!j||!G){T("Vui lòng nhập đầy đủ tài khoản và mật khẩu.","error");return}if(G.length<6){T("Mật khẩu phải có ít nhất 6 ký tự.","error");return}const V=f();if(!V){T("Không thể khởi tạo chức năng đăng nhập. Vui lòng tải lại trang.","error");return}B(t,s,!0,"Đang đăng nhập...");try{const q=await V.login({account:j,password:G});if(q.status==="invalid-account-type"){T("Phương thức đăng nhập này chưa được hỗ trợ.","error");return}if(q.status==="phone-conflict"){if(!a||!p||!b||!m){const O=c.dataset.loginRedirect||"/profile/my-courses";await v(`/login?redirect=${encodeURIComponent(O)}`);return}J=q.sessionId||"",T(q.message||"Vui lòng xác minh số điện thoại để tiếp tục.",""),z("otp"),p.focus();return}if(q.status==="verification-required"){await v(`/verify-browser?user_id=${encodeURIComponent(q.userId||"")}`);return}await y()}catch(q){T(Y(q),"error")}finally{B(t,s,!1,"Đang đăng nhập...")}}),a?.addEventListener("submit",async D=>{if(D.preventDefault(),!p||!b||!m)return;const j=p.value.replace(/\D/g,"");if(j.length!==6){T("Vui lòng nhập đủ 6 chữ số OTP.","error");return}const G=f();if(G){T("",""),B(b,m,!0,"Đang xác minh...");try{const V=await G.verifyPhoneOtp(J,j);if(!_||!C||!w||!x){const q=c.dataset.loginRedirect||"/profile/my-courses";await v(`/login?redirect=${encodeURIComponent(q)}`);return}H(V.accounts),I="",z("select-account")}catch(V){T(Y(V),"error")}finally{B(b,m,!1,"Đang xác minh...")}}}),_?.addEventListener("submit",async D=>{if(D.preventDefault(),!w||!x)return;if(!I){T("Vui lòng chọn một tài khoản.","error");return}const j=f();if(j){T("",""),B(w,x,!0,"Đang đăng nhập...");try{await j.selectPhoneAccount(J,I),T("Đăng nhập thành công. Đang chuyển hướng...","success"),await y()}catch(G){T(Y(G),"error")}finally{B(w,x,!1,"Đang đăng nhập...")}}}),c.querySelectorAll("[data-login-back]").forEach(D=>{D.addEventListener("click",()=>{T("",""),z("login")})});const Q=async()=>{const D=f();if(!D)return!1;try{if(await D.checkAuthenticated())return E(),!0}catch(de){console.error("[LoginForm] Không thể kiểm tra phiên đăng nhập",de)}const j=D.getEnabledMethods(),G=j.filter(de=>["email","username","phone"].includes(de)),V=G.length>0?G:["email"],q={email:"Email",username:"Tên đăng nhập",phone:"Số điện thoại"},O=V.map(de=>
595q[de]).filter(Boolean).join(" / ");return c.dataset.loginMethods=j.join(","),l&&(l.textContent=O),u.placeholder=`Nhập ${O}`,z("login"),P(),!0};Q().then(D=>{D||(window.addEventListener("edubit:login-bridge-ready",()=>{Q()},{once:!0}),window.setTimeout(()=>{f()||(P(),T("Không thể khởi tạo chức năng đăng nhập. Vui lòng tải lại trang.","error"))},3e3))})}}}}),d.addBlock!==!1&&n.BlockManager.add("loginForm",{media:'<img src="/images/builder/sections/form-login.png" alt="Form đăng nhập">',label:"Form đăng nhập",category:"default-other",content:`
596      <div data-gjs-type="${rr}" class="edubit-login" data-auth-pending="true">
597        <div class="edubit-login__card">
598          <div class="edubit-login__header">
599            <h2 class="edubit-login__title">Đăng nhập</h2>
600            <p class="edubit-login__description">Đăng nhập để tiếp tục học tập</p>
601          </div>
602          <div data-login-step="login">
603            <form class="edubit-login__form" data-login-form novalidate>
604              <label class="edubit-login__field">
605                <span class="edubit-login__label" data-login-account-label>Email / Tên đăng nhập / Số điện thoại</span>
606                <input class="edubit-login__input" data-login-account type="text" name="account" autocomplete="username" placeholder="Nhập Email / Tên đăng nhập / Số điện thoại" required>
607              </label>
608              <label class="edubit-login__field">
609                <span class="edubit-login__label">Mật khẩu</span>
610                <input class="edubit-login__input" data-login-password type="password" name="password" autocomplete="current-password" placeholder="Nhập mật khẩu" minlength="6" required>
611              </label>
612              <div class="edubit-login__actions">
613                <a class="edubit-login__link" href="/forgot-password">Quên mật khẩu?</a>
614              </div>
615              <button class="edubit-login__submit" data-login-submit type="submit">
616                <span data-login-submit-label>Đăng nhập</span>
617              </button>
618              <p class="edubit-login__message" data-login-message role="alert" aria-live="polite" hidden></p>
619            </form>
620            <p class="edubit-login__register">Chưa có tài khoản? <a class="edubit-login__link" href="/register">Đăng ký ngay</a></p>
621          </div>
622
623          <div data-login-step="otp" hidden>
624            <p class="edubit-login__step-description">Nhập mã OTP gồm 6 chữ số đã được gửi đến số điện thoại của bạn.</p>
625            <form class="edubit-login__form" data-login-otp-form novalidate>
626              <label class="edubit-login__field">
627                <span class="edubit-login__label">Mã OTP</span>
628                <input class="edubit-login__input edubit-login__otp" data-login-otp type="text" name="otp" inputmode="numeric" autocomplete="one-time-code" maxlength="6" placeholder="Nhập 6 chữ số" required>
629              </label>
630              <button class="edubit-login__submit" data-login-otp-submit type="submit">
631                <span data-login-otp-submit-label>Xác nhận</span>
632              </button>
633              <p class="edubit-login__message" data-login-message role="alert" aria-live="polite" hidden></p>
634              <button class="edubit-login__back" data-login-back type="button">Quay lại</button>
635            </form>
636          </div>
637
638          <div data-login-step="select-account" hidden>
639            <p class="edubit-login__step-description">Số điện thoại này thuộc nhiều tài khoản. Vui lòng chọn tài khoản bạn muốn sử dụng.</p>
640            <form class="edubit-login__form" data-login-select-form>
641              <div class="edubit-login__accounts" data-login-accounts></div>
642              <button class="edubit-login__submit" data-login-select-submit type="submit">
643                <span data-login-select-submit-label>Đăng nhập tài khoản này</span>
644              </button>
645              <p class="edubit-login__message" data-login-message role="alert" aria-live="polite" hidden></p>
646              <button class="edubit-login__back" data-login-back type="button">Quay lại</button>
647            </form>
648          </div>
649        </div>
650      </div>
651      <style>
652        .edubit-login[data-auth-pending="true"] { display: none; }
653        .edubit-login {
654          width: 100%;
655          padding: 48px 20px;
656          font-family: Roboto, Arial, sans-serif;
657          color: #111827;
658        }
659        .edubit-login * { box-sizing: border-box; }
660        .edubit-login__card {
661          width: 100%;
662          max-width: 440px;
663          margin: 0 auto;
664          padding: 32px;
665          border: 1px solid #e5e7eb;
666          border-radius: 16px;
667          background: #ffffff;
668          box-shadow: 0 12px 32px rgba(15, 23, 42, 0.08);
669        }
670        .edubit-login__header { margin-bottom: 28px; text-align: center; }
671        .edubit-login__title { margin: 0; font-size: 28px; font-weight: 700; line-height: 1.25; }
672        .edubit-login__description { margin: 8px 0 0; color: #6b7280; font-size: 15px; line-height: 1.5; }
673        .edubit-login__form { display: flex; flex-direction: column; gap: 18px; }
674        .edubit-login__field { display: flex; flex-direction: column; gap: 7px; }
675        .edubit-login__label { font-size: 14px; font-weight: 600; color: #374151; }
676        .edubit-login__input {
677          width: 100%;
678          height: 46px;
679          padding: 0 14px;
680          border: 1px solid #d1d5db;
681          border-radius: 9px;
682          outline: none;
683          background: #ffffff;
684          color: #111827;
685          font: inherit;
686          transition: border-color 0.2s, box-shadow 0.2s;
687        }
688        .edubit-login__input:focus { border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14); }
689        .edubit-login__actions { display: flex; justify-content: flex-end; margin-top: -6px; }
690        .edubit-login__link { color: #2563eb; font-size: 14px; font-weight: 600; text-decoration: none; }
691        .edubit-login__link:hover { text-decoration: underline; }
692        .edubit-login__message { margin: 0; font-size: 14px; line-height: 1.45; }
693        .edubit-login__message[data-type="error"] { color: #dc2626; }
694        .edubit-login__message[data-type="success"] { color: #15803d; }
695        .edubit-login__step-description { margin: 0 0 18px; color: #6b7280; font-size: 14px; line-height: 1.5; text-align: center; }
696        .edubit-login__otp { text-align: center; letter-spacing: 0.35em; font-size: 20px; }
697        .edubit-login__submit {
698          display: inline-flex;
699          align-items: center;
700          justify-content: center;
701          width: 100%;
702          height: 46px;
703          padding: 0 20px;
704          border: 0;
705          border-radius: 9px;
706          background: #2563eb;
707          color: #ffffff;
708          font: inherit;
709          font-weight: 700;
710          cursor: pointer;
711          transition: background-color 0.2s, opacity 0.2s;
712        }
713        .edubit-login__submit:hover { background: #1d4ed8; }
714        .edubit-login__submit:disabled { cursor: wait; opacity: 0.7; }
715        .edubit-login__back {
716          border: 0;
717          background: transparent;
718          color: #4b5563;
719          font: inherit;
720          font-size: 14px;
721          font-weight: 600;
722          cursor: pointer;
723        }
724        .edubit-login__accounts { display: flex; flex-direction: column; gap: 10px; max-height: 280px; overflow-y: auto; }
725        .edubit-login__account { display: flex; align-items: center; gap: 10px; padding: 12px; border: 1px solid #e5e7eb; border-radius: 9px; cursor: pointer; }
726        .edubit-login__account:has(input:checked) { border-color: #2563eb; background: #eff6ff; }
727        .edubit-login__avatar { width: 40px; height: 40px; border-radius: 999px; object-fit: cover; }
728        .edubit-login__account-detail { display: flex; min-width: 0; flex: 1; flex-direction: column; gap: 3px; }
729        .edubit-login__account-detail strong, .edubit-login__account-detail small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
730        .edubit-login__account-detail small { color: #6b7280; }
731        .edubit-login__register { margin: 22px 0 0; color: #6b7280; font-size: 14px; text-align: center; }
732        @media (max-width: 575px) {
733          .edubit-login { padding: 28px 14px; }
734          .edubit-login__card { padding: 24px 20px; border-radius: 12px; }
735          .edubit-login__title { font-size: 24px; }
736        }
737      </style>
738    `})}const Nn="AuthForm",ar="/login",or="/",Lt="/",sr="/register-pending-approval",lr="login",cr=6;function Ds(n){const d=(c,r=Lt)=>{const h=r.startsWith("/")&&!r.startsWith("//")?r:Lt,u=typeof c=="string"?c.trim():"";if(!u)return h;if(u.startsWith("/")&&!u.startsWith("//"))try{const l=new URL(u,window.location.origin);return`${l.pathname}${l.search}${l.hash}`||h}catch{return h}try{const l=new URL(u);return l.origin!==window.location.origin?h:`${l.pathname}${l.search}${l.hash}`||h}catch{return h}},g=c=>{if(!c?.get||!c?.set||c.get("type")!==Nn)return;const r=c.get("loginRedirectUrl"),h=d(r);r!==h&&c.set("loginRedirectUrl",h)},o={loginUrl:ar,redirectUrl:or,loginRedirectUrl:Lt,pendingApprovalUrl:sr,defaultTab:lr,siteId:null};n.DomComponents.addType(Nn,{model:{defaults:{tagName:"div",draggable:!0,droppable:!1,attributes:{class:"edubit-register","data-auth-pending":"true"},loginUrl:ar,redirectUrl:or,loginRedirectUrl:Lt,pendingApprovalUrl:sr,defaultTab:lr,siteId:null,"
738script-props":Object.keys(o),traits:[{type:"text",label:"Chuyển hướng sau khi đăng nhập",name:"loginRedirectUrl",placeholder:Lt,changeProp:!0}],script:function(c){const r=this;r.dataset.registerLogin=c?.loginUrl||"/login",r.dataset.registerRedirect=c?.redirectUrl||"/",r.dataset.authLoginRedirect=c?.loginRedirectUrl||c?.redirectUrl||"/",r.dataset.registerPendingApproval=c?.pendingApprovalUrl||"/register-pending-approval",r.dataset.authDefaultTab=c?.defaultTab||"login",r.dataset.registerSiteId=c?.siteId||"";const h=8,u="data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2024%2024%27%20width%3D%2724%27%20height%3D%2724%27%3E%3Cpath%20fill%3D%27none%27%20stroke%3D%27black%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%20stroke-width%3D%271.5%27%20d%3D%27M15%209h3.75M15%2012h3.75M15%2015h3.75M4.5%2019.5h15a2.25%202.25%200%200%200%202.25-2.25V6.75A2.25%202.25%200%200%200%2019.5%204.5h-15a2.25%202.25%200%200%200-2.25%202.25v10.5A2.25%202.25%200%200%200%204.5%2019.5m6-10.125a1.875%201.875%200%201%201-3.75%200a1.875%201.875%200%200%201%203.75%200m1.294%206.336a6.7%206.7%200%200%201-3.17.789a6.7%206.7%200%200%201-3.168-.789a3.376%203.376%200%200%201%206.338%200%27%2F%3E%3C%2Fsvg%3E",l="data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%20256%20262%27%20width%3D%27256%27%20height%3D%27262%27%3E%3Cpath%20fill%3D%27%234285F4%27%20d%3D%27M255.878%20133.451c0-10.734-.871-18.567-2.756-26.69H130.55v48.448h71.947c-1.45%2012.04-9.283%2030.172-26.69%2042.356l-.244%201.622l38.755%2030.023l2.685.268c24.659-22.774%2038.875-56.282%2038.875-96.027%27%2F%3E%3Cpath%20fill%3D%27%2334A853%27%20d%3D%27M130.55%20261.1c35.248%200%2064.839-11.605%2086.453-31.622l-41.196-31.913c-11.024%207.688-25.82%2013.055-45.257%2013.055c-34.523%200-63.824-22.773-74.269-54.25l-1.531.13l-40.298%2031.187l-.527%201.465C35.393%20231.798%2079.49%20261.1%20130.55%20261.1%27%2F%3E%3Cpath%20fill%3D%27%23FBBC05%27%20d%3D%27M56.281%20156.37c-2.756-8.123-4.351-16.827-4.351-25.82c0-8.994%201.595-17.697%204.206-25.82l-.073-1.73L15.26%2071.312l-1.335.635C5.077%2089.644%200%20109.517%200%20130.55s5.077%2040.905%2013.925%2058.602z%27%2F%3E%3Cpath%20fill%3D%27%23EB4335%27%20d%3D%27M130.55%2050.479c24.514%200%2041.05%2010.589%2050.479%2019.438l36.844-35.974C195.245%2012.91%20165.798%200%20130.55%200C79.49%200%2035.393%2029.301%2013.925%2071.947l42.211%2032.783c10.59-31.477%2039.891-54.251%2074.414-54.251%27%2F%3E%3C%2Fsvg%3E",e="data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%20256%20256%27%20width%3D%27256%27%20height%3D%27256%27%3E%3Cpath%20fill%3D%27%231877F2%27%20d%3D%27M256%20128C256%2057.308%20198.692%200%20128%200S0%2057.308%200%20128c0%2063.888%2046.808%20116.843%20108%20126.445V165H75.5v-37H108V99.8c0-32.08%2019.11-49.8%2048.348-49.8C170.352%2050%20185%2052.5%20185%2052.5V84h-16.14C152.959%2084%20148%2093.867%20148%20103.99V128h35.5l-5.675%2037H148v89.445c61.192-9.602%20108-62.556%20108-126.445%27%2F%3E%3Cpath%20fill%3D%27%23FFF%27%20d%3D%27m177.825%20165l5.675-37H148v-24.01C148%2093.866%20152.959%2084%20168.86%2084H185V52.5S170.352%2050%20156.347%2050C127.11%2050%20108%2067.72%20108%2099.8V128H75.5v37H108v89.445A129%20129%200%200%200%20128%20256a129%20129%200%200%200%2020-1.555V165z%27%2F%3E%3C%2Fsvg%3E",t=($,M)=>{const A=r.querySelector($);if(!A)return;A.textContent="",A.setAttribute("aria-hidden","true"),A.style.backgroundImage="",A.style.backgroundColor="transparent",A.style.overflow="hidden";let R=A.querySelector("img");R||(R=document.createElement("img"),R.alt="",R.decoding="async",R.loading="lazy",A.appendChild(R)),R.src=M,R.style.display="block",R.style.width="100%",R.style.height="100%",R.style.objectFit="contain"};if(t(".edubit-register__social-icon--passport",u),t(".edubit-register__social-icon--google",l),t(".edubit-register__social-icon--facebook",e),(()=>{try{return window.self!==window.top&&window.parent.location.pathname.startsWith("/admin/pages/")}catch{return!1}})()){const $=Array.from(r.querySelectorAll("[data-auth-tab]")),M=Array.from(r.querySelectorAll("[data-auth-panel]")),A=R=>{$.forEach(W=>{const Fe=W.dataset.authTab===R;W.classList.toggle("edubit-register__tab--active",Fe),W.setAttribute("aria-selected",String(Fe)),W.tabIndex=Fe?0:-1}),M.forEach(W=>{W.hidden=W.dataset.authPanel!==R})};$.forEach(R=>{R.addEventListener("click",()=>{const W=R.dataset.authTab;(W==="register"||W==="login")&&A(W)})}),A(r.dataset.authDefaultTab==="login"?"login":"register"),r.removeAttribute("data-auth-pending"),r.hidden=!1;return}if(r.dataset.registerInitialized==="true")return;r.dataset.registerInitialized="true",r.hidden=!0;const i=r.querySelector("[data-register-form]"),a=Array.from(r.querySelectorAll("[data-auth-tab]")),p=Array.from(r.querySelectorAll("[data-auth-panel]")),b=r.querySelector("[data-register-name]"),m=r.querySelector("[data-register-email]"),_=r.querySelector("[data-register-phone]"),C=r.querySelector("[data-register-username]"),w=r.querySelector("[data-register-password]"),x=r.querySelector("[data-register-password-confirm]"),f=r.querySelector("[data-register-agree]"),v=r.querySelector("[data-register-submit]"),y=r.querySelector("[data-register-submit-label]"),P=r.querySelector("[data-register-message]"),E=r.querySelector("[data-register-account-help
738]"),T=r.querySelector("[data-register-captcha]"),B=Array.from(r.querySelectorAll("[data-register-method]")),z=r.querySelector("[data-auth-login-form]"),Y=r.querySelector("[data-auth-login-account]"),J=r.querySelector("[data-auth-login-account-label]"),I=r.querySelector("[data-auth-login-password]"),H=r.querySelector("[data-auth-login-submit]"),Q=r.querySelector("[data-auth-login-submit-label]"),D=r.querySelector("[data-auth-login-message]"),j=r.querySelector("[data-auth-login-passport-note]"),G=r.querySelector("[data-auth-login-passport-back]"),V=r.querySelector("[data-auth-login-social-divider]"),q=r.querySelector("[data-auth-login-social]"),O=r.querySelector("[data-auth-login-passport]"),de=r.querySelector("[data-auth-login-google-wrap]"),ye=r.querySelector("[data-auth-login-google]"),Ce=r.querySelector("[data-auth-login-google-render]"),Ee=r.querySelector("[data-auth-login-facebook]"),Ue=r.querySelector("[data-auth-login-otp-form]"),Te=r.querySelector("[data-auth-login-otp]"),Be=r.querySelector("[data-auth-login-otp-submit]"),He=r.querySelector("[data-auth-login-otp-submit-label]"),ze=r.querySelector("[data-auth-login-select-form]"),We=r.querySelector("[data-auth-login-accounts]"),Ae=r.querySelector("[data-auth-login-select-submit]"),De=r.querySelector("[data-auth-login-select-submit-label]");if(!i||!b||!w||!x||!v||!y||!P){r.removeAttribute("data-auth-pending"),r.hidden=!1;return}const Ve=()=>window.__EDUBIT_LOGIN__,$e=async $=>{const M=Ve();if(M){await M.navigate($);return}window.location.assign($)},Qe=($,M="/")=>{const A=M.startsWith("/")&&!M.startsWith("//")?M:"/",R=($||"").trim();if(!R)return A;if(R.startsWith("/")&&!R.startsWith("//"))try{const W=new URL(R,window.location.origin);return`${W.pathname}${W.search}${W.hash}`||A}catch{return A}try{const W=new URL(R);return W.origin!==window.location.origin?A:`${W.pathname}${W.search}${W.hash}`||A}catch{return A}},rt=()=>Qe(r.dataset.registerRedirect,"/"),wt=()=>Qe(r.dataset.authLoginRedirect||r.dataset.registerRedirect,rt()),Z=async()=>await $e(wt()),N=async()=>await $e(rt()),Se=()=>{r.removeAttribute("data-auth-pending"),r.removeAttribute("aria-hidden"),r.hidden=!1},ke=()=>{r.setAttribute("aria-hidden","true"),r.hidden=!0},he=($,M)=>{P.textContent=$,P.dataset.type=M,P.hidden=!$},ae=($,M)=>{D&&(D.textContent=$,D.dataset.type=M,D.hidden=!$)},Pe=($,M,A,R)=>{M.dataset.defaultLabel||(M.dataset.defaultLabel=M.textContent||""),$.disabled=A,$.setAttribute("aria-busy",String(A)),M.textContent=A?R:M.dataset.defaultLabel},Ze=$=>{a.forEach(M=>{const A=M.dataset.authTab===$;M.classList.toggle("edubit-register__tab--active",A),M.setAttribute("aria-selected",String(A)),M.tabIndex=A?0:-1}),p.forEach(M=>{M.hidden=M.dataset.authPanel!==$}),r.dataset.authActiveTab=$},te=$=>{r.querySelectorAll("[data-auth-login-step]").forEach(M=>{M.hidden=M.dataset.authLoginStep!==$})},at=$=>{if(Array.isArray($))return $.map(at).filter(Boolean).join(", ");if(typeof $=="string")return $;if($&&typeof $=="object"){const M=$;if(M.message)return at(M.message);if(M.constraints)return Object.values(M.constraints).join(", ")}return""},et=$=>{const M=$,A=M.response?._data||M.data;if(A?.errors&&typeof A.errors=="object"){const R=Object.values(A.errors).map(at).filter(Boolean);if(R.length>0)return R.join(", ")}return at(A?.message||M.message)||"Đăng ký không thành công. Vui lòng thử lại."};let xe=["email"],xt=["email"],tt=!1,Me=!1,Ge=null,Oe=null,L=!1,S=null,U=!1,ne=null,se=!1,ue="none",ie="",le=null,fe=!1,ve="",ee="",be="";const Le={email:"Email",username:"Tên đăng nhập",phone:"Số điện thoại"},nt={...Le,passport:"CCCD"},Ot=$=>$==="email"||$==="username"||$==="phone",Ft=()=>window.google,$t=()=>window.FB,Pt=$=>new Promise((M,A)=>{let R=document.querySelector(`script[src="${$}"]`);if(R){if(R.dataset.authScriptStatus==="loaded"){M();return}if(R.dataset.authScriptStatus==="error"||R.crossOrigin)R.remove(),R=null;else{R.addEventListener("load",()=>M(),{once:!0}),R.addEventListener("error",()=>A(new Error("Không thể tải script đăng nhập")),{once:!0}),window.setTimeout(M,300);return}}const W=document.createElement("script");W.src=$,W.async=!0,W.defer=!0,W.dataset.authScriptStatus="loading",W.onload=()=>{W.dataset.authScriptStatus="loaded",M()},W.onerror=()=>{W.dataset.authScriptStatus="error",W.remove(),A(new Error("Không thể tải script đăng nhập"))},document.head.appendChild(W)}),jt=()=>new Promise(($,M)=>{const A=Date.now(),R=()=>{const W=Ft()?.accounts?.id;if(W){$(W);return}if(Date.now()-A>
7385e3){M(new Error("Google SDK chưa sẵn sàng"));return}window.setTimeout(R,100)};R()}),Ie=($,M)=>{$&&($.hidden=M)},Mt=()=>{if(!q)return;const $=Number(q.dataset.authSocialCount||"1"),M=Math.min(Math.max(Number.isFinite($)?$:1,1),3);q.style.gridTemplateColumns=window.matchMedia("(max-width: 575px)").matches?"1fr":`repeat(${M}, minmax(0, 1fr))`};function qt(){const $=[!Me&&tt,!!Ge?.enabled,!!Oe?.enabled].filter(Boolean).length,M=$>0;Ie(V,!M),Ie(q,!M),q&&(q.dataset.authSocialCount=String(Math.min(Math.max($,1),3)),Mt(),se||(se=!0,window.addEventListener("resize",Mt)))}const ht=($,M=!0)=>{Me=!!($&&tt);const A=Me?nt.passport:xt.map(R=>nt[R]).join(" / ");J&&(J.textContent=A),Y&&(M&&(Y.value=""),Y.placeholder=Me?"Nhập CCCD":`Nhập ${A}`,Y.type="text",Y.autocomplete=Me?"off":"username",Y.inputMode="text"),Ie(j,!Me),Ie(O,Me||!tt),qt()},oe=$=>{const M=et($);return M==="Đăng ký không thành công. Vui lòng thử lại."?"Đăng nhập không thành công. Vui lòng thử lại.":M},ge=async $=>{if($.status==="invalid-account-type"){ae("Phương thức đăng nhập này chưa được hỗ trợ.","error");return}if($.status==="phone-conflict"){if(!Ue||!Te||!Be||!He){await $e(Ht());return}ee=$.sessionId||"",ae($.message||"Vui lòng xác minh số điện thoại để tiếp tục.",""),te("otp"),Te.focus();return}if($.status==="verification-required"){await $e(`/verify-browser?user_id=${encodeURIComponent($.userId||"")}`);return}await Z()},_e=async $=>{const M=Ve();if(!M?.loginGoogle||!$.credential){ae("Không thể khởi tạo chức năng đăng nhập Google. Vui lòng tải lại trang.","error");return}ye&&(ye.disabled=!0),ae("","");try{const A=await M.loginGoogle({token:$.credential});await ge(A)}catch(A){ae(oe(A),"error")}finally{ye&&(ye.disabled=!1)}},Xe=async()=>{if(!Ge?.enabled||!de||!Ce)return!1;if(L)return!0;if(S)return await S;Ie(de,!1),Ie(Ce,!0),S=(async()=>{if(!Ge?.clientId)throw new Error("Chưa cấu hình Google Client ID");await Pt("https://accounts.google.com/gsi/client");const $=await jt();return $.initialize({client_id:Ge.clientId,callback:_e}),$.renderButton(Ce,{type:"standard",theme:"outline",size:"large",text:"signin_with",shape:"pill",width:240}),Ie(Ce,!1),L=!0,!0})();try{return await S}catch($){return console.error("[AuthForm] Không thể khởi tạo Google login",$),Ie(Ce,!0),L=!1,S=null,!1}},_t=async()=>{if(!Oe?.enabled)return!1;if(U)return!0;if(ne)return await ne;ne=(async()=>{if(!document.getElementById("fb-root")){const M=document.createElement("div");M.id="fb-root",document.body.prepend(M)}await Pt("https://connect.facebook.net/vi_VN/sdk.js");const $=$t();if(!$)throw new Error("Facebook SDK chưa sẵn sàng");return $.init({appId:Oe.appId,cookie:!0,xfbml:!0,version:Oe.version}),$.AppEvents?.logPageView(),U=!0,!0})();try{return await ne}catch($){return console.error("[AuthForm] Không thể khởi tạo Facebook login",$),ne=null,!1}},Ut=()=>new Promise(($,M)=>{const A=$t();if(!A){M(new Error("Facebook SDK chưa sẵn sàng"));return}A.getLoginStatus(R=>{if(R.status==="connected"&&R.authResponse?.accessToken){$(R);return}A.login(W=>{if(W.authResponse?.accessToken){$(W);return}M(new Error("Không thể đăng nhập Facebook"))},{scope:Oe?.scope})})}),Zr=($,M)=>{tt=M.includes("passport"),Ge=M.includes("google")||$.google?.enabled?{enabled:!0,clientId:$.google?.clientId||""}:null,Oe=M.includes("facebook")||$.facebook?.enabled?{enabled:!0,appId:$.facebook?.appId||"",version:$.facebook?.version||"v20.0",fields:$.facebook?.fields||"id,name,email,first_name,last_name,birthday",scope:$.facebook?.scope||"email,public_profile"}:null,Ie(O,!tt||Me),Ie(de,!Ge?.enabled),Ie(Ee,!Oe?.enabled),Ie(Ce,!0),ht(Me,!1),Ge?.enabled&&Xe(),Oe?.enabled&&_t()},ea=$=>{const M=$.filter(Ot);if(xe=M.length>0?M:["email"],xt=M.length>0?M:["email"],B.forEach(R=>{const W=R.dataset.registerMethod,Fe=R.querySelector("input"),Re=!!(W&&Ot(W)&&xe.includes(W));R.hidden=!Re,Fe&&(Fe.disabled=!Re,Fe.required=Re&&xe.length===1)}),E){const R=xe.map(W=>Le[W]).join(" / ");E.textContent=xe.length===1?`${R} sẽ dùng để đăng nhập.`:`Nhập ít nhất một thông tin đăng nhập: ${R}.`}const A=xe.map(R=>Le[R]).join(" / ");J&&(J.textContent=A),Y&&(Y.placeholder=`Nhập ${A}`),ht(Me,!1)},di=()=>({email:xe.includes("email")&&m?.value.trim()||"",username:xe.includes("username")&&C?.value.trim()||"",phone:xe.includes("phone")&&_?.value.trim()||""}),ta=$=>{const M=di(),A=xe.find(R=>M[R]);return A?{account:M[A],password:$,accountType:A}:null},Ht=($=wt())=>{const M=Qe(r.dataset.registerLogin,"/login"),A=Qe($,"/");try{const R=new URL(M,window.location.origin);return R.searchParams.set("redirect",A),R.origin!==window.location.origin?R.href:`${R.pathname}${R.search}${R.hash}`}catch{return`${M}?redirect=${encodeURIComponent(A)}`}},dn=()=>window.hcaptcha,na=()=>new Promise(($,M)=>{if(dn()?.render){$();return}let A=document.querySelector('script[src^="https://js.hcaptcha.com/1/api.js"]');if(A)if(A.dataset.authScriptStatus==="error")A.remove(),A=null;else{A.addEventListener("load",()=>$(),{once:!0}),A.addEventListener("error",()=>M(new Error("Không thể tải hCaptcha")),{once:!0}),window.setTimeout($,300);return}if(!A){const R=document.createElement("script");R.src="https://js.hcaptcha.com/1/api.js?render=explicit",R.async=!0,R.defer=!0,R.dataset.authScriptStatus="loading",R.onload=()=>{R.dataset.authScriptStatus="loaded",$()},R.onerror=()=>{R.dataset.authScriptStatus="error",R.remove(),M(new Error("Không thể tải hCaptcha"))},document.head.appendChild(R)}}),ia=()=>new Promise(($,M)=>{const A=Date.now(),R=()=>{const W=dn();if(W?.render){$(W);return}if(Date.now()-A>8e3){M(new Error("hCaptcha chưa sẵn sàng"));return}window.setTimeout(R,100)};R()}),ui=async $=>{if(!T)return!1;if(fe&&le!==null)return T.hidden=!1,!0;if(fe)return!1;if(!$)return T.hidden=!0,he("Không thể khởi tạo captcha. Vui lòng tải lại trang.","error"),!1;fe=!0;try{await na();const M=await ia();return T.hidden=!1,T.innerHTML="",le=M.render(T,{sitekey:$,callback:A=>{ie=A,he("","")},"expired-callback":()=>{ie=""},"error-callback":()=>{ie=""}}),!0}catch{return fe=!1,T.hidden=!0,he("Không thể tải captcha. Vui lòng tải lại trang.","error"),!1}},ra=()=>
738{if(ie="",ue==="hcaptcha")try{const $=dn();$&&le!==null&&$.reset(le)}catch{}},aa=$=>{We&&(We.innerHTML="",$.forEach(M=>{const A=document.createElement("label");A.className="edubit-register__account";const R=document.createElement("input");if(R.type="radio",R.name="auth-login-account",R.value=M.user_id,R.addEventListener("change",()=>{be=M.user_id}),M.photo){const ft=document.createElement("img");ft.className="edubit-register__avatar",ft.src=M.photo,ft.alt=M.fullname||"Tài khoản",A.appendChild(ft)}const W=document.createElement("span");W.className="edubit-register__account-detail";const Fe=document.createElement("strong");Fe.textContent=M.fullname||"Người dùng";const Re=document.createElement("small");Re.textContent=M.email_masked||"",W.append(Fe,Re),A.prepend(R),A.appendChild(W),We.appendChild(A)}))};a.forEach($=>{$.addEventListener("click",()=>{const M=$.dataset.authTab;M!=="register"&&M!=="login"||(he("",""),ae("",""),Ze(M),M==="login"&&te("login"))})}),O?.addEventListener("click",()=>{ae("",""),te("login"),ht(!0),Y?.focus()}),G?.addEventListener("click",()=>{ae("",""),ht(!1),Y?.focus()}),ye?.addEventListener("click",async()=>{if(!Ge?.enabled){ae("Phương thức đăng nhập Google chưa được bật.","error");return}if(!Ge.clientId){ae("Chưa cấu hình Google Client ID.","error");return}ae("",""),await Xe()||ae("Google SDK chưa sẵn sàng. Vui lòng thử lại sau.","error")}),Ee?.addEventListener("click",async()=>{const $=Ve();if(!$?.loginFacebook||!Oe?.enabled){ae("Không thể khởi tạo chức năng đăng nhập Facebook. Vui lòng tải lại trang.","error");return}if(!Oe.appId){ae("Chưa cấu hình Facebook App ID.","error");return}Ee.disabled=!0,ae("","");try{if(!await _t())throw new Error("Facebook SDK chưa sẵn sàng");const R=(await Ut()).authResponse?.accessToken;if(!R)throw new Error("Không thể đăng nhập Facebook");const W=await $.loginFacebook({token:R,version:Oe.version,fields:Oe.fields});await ge(W)}catch(M){ae(oe(M),"error")}finally{Ee.disabled=!1}}),z?.addEventListener("submit",async $=>{if($.preventDefault(),!Y||!I||!H||!Q||H.disabled)return;const M=Y.value.trim(),A=I.value;if(ae("",""),!M||!A){ae("Vui lòng nhập đầy đủ tài khoản và mật khẩu.","error");return}if(A.length<6){ae("Mật khẩu phải có ít nhất 6 ký tự.","error");return}if(Me&&!/^(\d{12}|[A-Za-z]\d{7})$/.test(M)){ae("CCCD không đúng định dạng.","error"),Y.focus();return}const R=Ve();if(!R){ae("Không thể khởi tạo chức năng đăng nhập. Vui lòng tải lại trang.","error");return}Pe(H,Q,!0,"Đang đăng nhập...");try{const W=await R.login({account:M,password:A,accountType:Me?"passport":void 0});await ge(W)}catch(W){ae(oe(W),"error")}finally{Pe(H,Q,!1,"Đang đăng nhập...")}}),Ue?.addEventListener("submit",async $=>{if($.preventDefault(),!Te||!Be||!He)return;const M=Te.value.replace(/\D/g,"");if(M.length!==6){ae("Vui lòng nhập đủ 6 chữ số OTP.","error");return}const A=Ve();if(A){ae("",""),Pe(Be,He,!0,"Đang xác minh...");try{const R=await A.verifyPhoneOtp(ee,M);if(!ze||!We||!Ae||!De){await $e(Ht());return}aa(R.accounts),be="",te("select-account")}catch(R){ae(et(R),"error")}finally{Pe(Be,He,!1,"Đang xác minh...")}}}),ze?.addEventListener("submit",async $=>{if($.preventDefault(),!Ae||!De)return;if(!be){ae("Vui lòng chọn một tài khoản.","error");return}const M=Ve();if(M){ae("",""),Pe(Ae,De,!0,"Đang đăng nhập...");try{await M.selectPhoneAccount(ee,be),await Z()}catch(A){ae(et(A),"error")}finally{Pe(Ae,De,!1,"Đang đăng nhập...")}}}),r.querySelectorAll("[data-auth-login-back]").forEach($=>{$.addEventListener("click",()=>{ae("",""),te("login")})}),i.addEventListener("submit",async $=>{if($.preventDefault(),v.disabled)return;const M=b.value.trim(),A=w.value,R=x.value,W=di();if(he("",""),M.length<3){he("Họ và tên phải có ít nhất 3 ký tự.","error"),b.focus();return}if(!xe.some(Re=>W[Re])){he("Vui lòng nhập ít nhất một thông tin đăng nhập.","error");return}if(W.email&&!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(W.email)){he("Email không đúng định dạng.","error"),m?.focus();return}if(W.username&&W.username.length<6){he("Tên đăng nhập phải có ít nhất 6 ký tự.","error"),C?.focus();return}if(W.phone&&W.phone.replace(/\D/g,"").length<8){he("Số điện thoại không đúng định dạng.","error"),_?.focus();return}if(A.length<h){he(`Mật khẩu phải có ít nhất ${h} ký tự.`,"error"),w.focus();return}if(A!==R){he("Mật khẩu nhập lại chưa khớp.","error"),x.focus();return}if(f&&!f.checked){he("Vui lòng đồng ý với điều khoản sử dụng.","error"),f.focus();return}if(ue==="hcaptcha"&&!ie){if(le===null&&!await ui(ve))return;T?.scrollIntoView({behavior:"smooth",block:"center"}),he("Vui lòng xác minh bạn không phải robot.","error");return}const Fe=Ve();if(!Fe?.register){he("Không thể khởi tạo chức năng đăng ký. Vui lòng tải lại trang.","error");return}Pe(v,y,!0,"Đang đăng ký...");try{const Re=await Fe.register({name:M,email:W.email||void 0,phone:W.phone||void 0,username:W.username||void 0,password:A,re_password:R,site_id:r.dataset.registerSiteId||void 0,captchaToken:ie||void 0});if(Re.status==="pending-approval"){he(Re.message||"Đăng ký thành công. Tài khoản của bạn đang chờ duyệt.","success"),await $e(r.dataset.registerPendingApproval||"/register-pending-approval");return}const ft=ta(A);
738if(!ft){he(Re.message||"Đăng ký thành công. Vui lòng đăng nhập để tiếp tục.","success"),await $e(Ht(rt()));return}Pe(v,y,!0,"Đang đăng nhập...");try{const Ct=await Fe.login(ft);if(Ct.status==="authenticated"){await N();return}if(Ct.status==="phone-conflict"&&Ue&&Te&&Be&&He){ee=Ct.sessionId||"",Ze("login"),te("otp"),ae(Ct.message||"Vui lòng xác minh số điện thoại để tiếp tục.",""),Te.focus();return}if(Ct.status==="verification-required"){await $e(`/verify-browser?user_id=${encodeURIComponent(Ct.userId||"")}`);return}}catch{}he(Re.message||"Đăng ký thành công. Vui lòng đăng nhập để tiếp tục.","success"),await $e(Ht(rt()))}catch(Re){he(et(Re),"error"),ra()}finally{Pe(v,y,!1,"Đang đăng ký...")}});const pi=async()=>{const $=Ve();if(!$)return!1;try{if(await $.checkAuthenticated())return ke(),!0}catch(R){console.error("[AuthForm] Không thể kiểm tra phiên đăng nhập",R)}const M=$.getEnabledMethods();ea(M),Zr($.getSocialLoginOptions?.()||{},M),te("login"),Ze(r.dataset.authDefaultTab==="login"?"login":"register");const A=$.getRegisterOptions?.()||{captcha:{type:"none"}};return ue=A.captcha.type,ve=A.captcha.type==="hcaptcha"?A.captcha.siteKey:"",T&&(T.hidden=!0),Se(),A.captcha.type==="hcaptcha"&&await ui(ve),!0};pi().then($=>{$||(window.addEventListener("edubit:login-bridge-ready",()=>{pi()},{once:!0}),window.setTimeout(()=>{Ve()||(Se(),he("Không thể khởi tạo chức năng đăng ký. Vui lòng tải lại trang.","error"))},3e3))})}}}}),n.on("component:add",g),n.on("component:update:loginRedirectUrl",g),n.BlockManager.add("authForm",{media:'<img src="/images/builder/sections/auth-form.png" alt="Form đăng ký / đăng nhập">',label:"Form đăng ký / đăng nhập",category:"default-other",content:`
739      <div data-gjs-type="${Nn}" class="edubit-register" data-auth-pending="true">
740        <div class="edubit-register__card">
741          <div class="edubit-register__tabs" role="tablist" aria-label="Tài khoản">
742            <button class="edubit-register__tab" data-auth-tab="register" type="button" role="tab" aria-selected="false" tabindex="-1">Đăng ký</button>
743            <button class="edubit-register__tab edubit-register__tab--active" data-auth-tab="login" type="button" role="tab" aria-selected="true">Đăng nhập</button>
744          </div>
745
746          <div data-auth-panel="register" role="tabpanel" hidden>
747            <div class="edubit-register__header">
748              <h2 class="edubit-register__title">Đăng ký tài khoản</h2>
749              <p class="edubit-register__description">Tạo tài khoản để bắt đầu học tập</p>
750            </div>
751
752            <form class="edubit-register__form" data-register-form novalidate>
753              <label class="edubit-register__field">
754                <span class="edubit-register__label">Họ và tên</span>
755                <input class="edubit-register__input" data-register-name type="text" name="name" autocomplete="name" placeholder="Nhập họ và tên" minlength="3" required>
756              </label>
757
758              <div class="edubit-register__account-fields">
759                <label class="edubit-register__field" data-register-method="email">
760                  <span class="edubit-register__label">Email</span>
761                  <input class="edubit-register__input" data-register-email type="email" name="email" autocomplete="email" placeholder="Nhập email">
762                </label>
763
764                <label class="edubit-register__field" data-register-method="phone">
765                  <span class="edubit-register__label">Số điện thoại</span>
766                  <input class="edubit-register__input" data-register-phone type="tel" name="phone" autocomplete="tel" placeholder="Nhập số điện thoại">
767                </label>
768
769                <label class="edubit-register__field" data-register-method="username">
770                  <span class="edubit-register__label">Tên đăng nhập</span>
771                  <input class="edubit-register__input" data-register-username type="text" name="username" autocomplete="username" placeholder="Nhập tên đăng nhập" minlength="6">
772                </label>
773
774                <p class="edubit-register__hint" data-register-account-help>Email sẽ dùng để đăng nhập.</p>
775              </div>
776
777              <label class="edubit-register__field">
778                <span class="edubit-register__label">Mật khẩu</span>
779                <input class="edubit-register__input" data-register-password type="password" name="password" autocomplete="new-password" placeholder="Nhập mật khẩu" minlength="${cr}" required>
780              </label>
781
782              <label class="edubit-register__field">
783                <span class="edubit-register__label">Nhập lại mật khẩu</span>
784                <input class="edubit-register__input" data-register-password-confirm type="password" name="re_password" autocomplete="new-password" placeholder="Nhập lại mật khẩu" minlength="${cr}" required>
785              </label>
786
787              <label class="edubit-register__agree">
788                <input data-register-agree type="checkbox" required>
789                <span>Tôi đồng ý với điều khoản sử dụng.</span>
790              </label>
791
792              <div class="edubit-register__captcha" data-register-captcha hidden></div>
793
794              <button class="edubit-register__submit" data-register-submit type="submit">
795                <span data-register-submit-label>Đăng ký học thử ngay - Hoàn toàn miễn phí</span>
796              </button>
797
798              <p class="edubit-register__message" data-register-message role="alert" aria-live="polite" hidden></p>
799            </form>
800          </div>
801
802          <div data-auth-panel="login" role="tabpanel">
803            <div class="edubit-register__header">
804              <h2 class="edubit-register__title">Đăng nhập</h2>
805              <p class="edubit-register__description">Đăng nhập để tiếp tục học tập</p>
806            </div>
807            <p class="edubit-register__mode-note" data-auth-login-passport-note hidden>
808              Đăng nhập bằng Email, Số điện thoại, Tên đăng nhập?
809              <button class="edubit-register__inline-button" data-auth-login-passport-back type="button">Trở lại</button>
810            </p>
811
812            <div data-auth-login-step="login">
813              <form class="edubit-register__form" data-auth-login-form novalidate>
814                <label class="edubit-register__field">
815                  <span class="edubit-register__label" data-auth-login-account-label>Email / Tên đăng nhập / Số điện thoại</span>
816                  <input class="edubit-register__input" data-auth-login-account type="text" name="account" autocomplete="username" placeholder="Nhập Email / Tên đăng nhập / Số điện thoại" required>
817                </label>
818                <label class="edubit-register__field">
819                  <span class="edubit-register__label">Mật khẩu</span>
820                  <input class="edubit-register__input" data-auth-login-password type="password" name="password" autocomplete="current-password" placeholder="Nhập mật khẩu" minlength="6" required>
821                </label>
822                <div class="edubit-register__actions">
823                  <a class="edubit-register__link" href="/forgot-password">Quên mật khẩu?</a>
824                </div>
825                <button class="edubit-register__submit" data-auth-login-submit type="submit">
826                  <span data-auth-login-submit-label>Đăng nhập</span>
827                </button>
828              </form>
829
830              <div class="edubit-register__divider" data-auth-login-social-divider>
831                <span>Hoặc đăng nhập với</span>
832              </div>
833              <div class="edubit-register__social" data-auth-login-social data-auth-social-count="3">
834                <button class="edubit-register__social-button" data-auth-login-passport type="button">
835                  <span class="edubit-register__social-icon edubit-register__social-icon--passport" aria-hidden="true">
836                    <img class="edubit-register__social-image" src="data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2024%2024%27%20width%3D%2724%27%20height%3D%2724%27%3E%3Cpath%20fill%3D%27none%27%20stroke%3D%27black%27%20stroke-linecap%3D%27round%27%20stroke-linejoin%3D%27round%27%20stroke-width%3D%271.5%27%20d%3D%27M15%209h3.75M15%2012h3.75M15%2015h3.75M4.5%2019.5h15a2.25%202.25%200%200%200%202.25-2.25V6.75A2.25%202.25%200%200%200%2019.5%204.5h-15a2.25%202.25%200%200%200-2.25%202.25v10.5A2.25%202.25%200%200%200%204.5%2019.5m6-10.125a1.875%201.875%200%201%201-3.75%200a1.875%201.875%200%200%201%203.75%200m1.294%206.336a6.7%206.7%200%200%201-3.17.789a6.7%206.7%200%200%201-3.168-.789a3.376%203.376%200%200%201%206.338%200%27%2F%3E%3C%2Fsvg%3E" alt="">
837                  </span>
838                  <span>CCCD</span>
839                </button>
840                <div class="edubit-register__social-google" data-auth-login-google-wrap>
841                  <button class="edubit-register__social-button" data-auth-login-google type="button">
842                    <span class="edubit-register__social-icon edubit-register__social-icon--google" aria-hidden="true">
843                      <img class="edubit-register__social-image" src="data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%20256%20262%27%20width%3D%27256%27%20height%3D%27262%27%3E%3Cpath%20fill%3D%27%234285F4%27%20d%3D%27M255.878%20133.451c0-10.734-.871-18.567-2.756-26.69H130.55v48.448h71.947c-1.45%2012.04-9.283%2030.172-26.69%2042.356l-.244%201.622l38.755%2030.023l2.685.268c24.659-22.774%2038.875-56.282%2038.875-96.027%27%2F%3E%3Cpath%20fill%3D%27%2334A853%27%20d%3D%27M130.55%20261.1c35.248%200%2064.839-11.605%2086.453-31.622l-41.196-31.913c-11.024%207.688-25.82%2013.055-45.257%2013.055c-34.523%200-63.824-22.773-74.269-54.25l-1.531.13l-40.298%2031.187l-.527%201.465C35.393%20231.798%2079.49%20261.1%20130.55%20261.1%27%2F%3E%3Cpath%20fill%3D%27%23FBBC05%27%20d%3D%27M56.281%20156.37c-2.756-8.123-4.351-16.827-4.351-25.82c0-8.994%201.595-17.697%204.206-25.82l-.073-1.73L15.26%2071.312l-1.335.635C5.077%2089.644%200%20109.517%200%20130.55s5.077%2040.905%2013.925%2058.602z%27%2F%3E%3Cpath%20fill%3D%27%23EB4335%27%20d%3D%27M130.55%2050.479c24.514%200%2041.05%2010.589%2050.479%2019.438l36.844-35.974C195.245%2012.91%20165.798%200%20130.55%200C79.49%200%2035.393%2029.301%2013.925%2071.947l42.211%2032.783c10.59-31.477%2039.891-54.251%2074.414-54.251%27%2F%3E%3C%2Fsvg%3E" alt="">
844                    </span>
845                    <span>Google</span>
846                  </button>
847                  <div class="edubit-register__google-render" data-auth-login-google-render></div>
848                </div>
849                <button class="edubit-register__social-button" data-auth-login-facebook type="button">
850                  <span class="edubit-register__social-icon edubit-register__social-icon--facebook" aria-hidden="true">
851                    <img class="edubit-register__social-image" src="data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%20256%20256%27%20width%3D%27256%27%20height%3D%27256%27%3E%3Cpath%20fill%3D%27%231877F2%27%20d%3D%27M256%20128C256%2057.308%20198.692%200%20128%200S0%2057.308%200%20128c0%2063.888%2046.808%20116.843%20108%20126.445V165H75.5v-37H108V99.8c0-32.08%2019.11-49.8%2048.348-49.8C170.352%2050%20185%2052.5%20185%2052.5V84h-16.14C152.959%2084%20148%2093.867%20148%20103.99V128h35.5l-5.675%2037H148v89.445c61.192-9.602%20108-62.556%20108-126.445%27%2F%3E%3Cpath%20fill%3D%27%23FFF%27%20d%3D%27m177.825%20165l5.675-37H148v-24.01C148%2093.866%20152.959%2084%20168.86%2084H185V52.5S170.352%2050%20156.347%2050C127.11%2050%20108%2067.72%20108%2099.8V128H75.5v37H108v89.445A129%20129%200%200%200%20128%20256a129%20129%200%200%200%2020-1.555V165z%27%2F%3E%3C%2Fsvg%3E" alt="">
852                  </span>
853                  <span>Facebook</span>
854                </button>
855              </div>
856            </div>
857
858            <div data-auth-login-step="otp" hidden>
859              <p class="edubit-register__step-description">Nhập mã OTP gồm 6 chữ số đã được gửi đến số điện thoại của bạn.</p>
860              <form class="edubit-register__form" data-auth-login-otp-form novalidate>
861                <label class="edubit-register__field">
862                  <span class="edubit-register__label">Mã OTP</span>
863                  <input class="edubit-register__input edubit-register__otp" data-auth-login-otp type="text" name="otp" inputmode="numeric" autocomplete="one-time-code" maxlength="6" placeholder="Nhập 6 chữ số" required>
864                </label>
865                <button class="edubit-register__submit" data-auth-login-otp-submit type="submit">
866                  <span data-auth-login-otp-submit-label>Xác nhận</span>
867                </button>
868                <button class="edubit-register__back" data-auth-login-back type="button">Quay lại</button>
869              </form>
870            </div>
871
872            <div data-auth-login-step="select-account" hidden>
873              <p class="edubit-register__step-description">Số điện thoại này thuộc nhiều tài khoản. Vui lòng chọn tài khoản bạn muốn sử dụng.</p>
874              <form class="edubit-register__form" data-auth-login-select-form>
875                <div class="edubit-register__accounts" data-auth-login-accounts></div>
876                <button class="edubit-register__submit" data-auth-login-select-submit type="submit">
877                  <span data-auth-login-select-submit-label>Đăng nhập tài khoản này</span>
878                </button>
879                <button class="edubit-register__back" data-auth-login-back type="button">Quay lại</button>
880              </form>
881            </div>
882
883            <p class="edubit-register__message" data-auth-login-message role="alert" aria-live="polite" hidden></p>
884          </div>
885        </div>
886      </div>
887      <style>
888        .edubit-register[data-auth-pending="true"] { display: none; }
889        .edubit-register {
890          width: 100%;
891          padding: 40px 20px;
892          font-family: Roboto, Arial, sans-serif;
893          color: #111827;
894          line-height: 1.5;
895        }
896        .edubit-register * { box-sizing: border-box; }
897        .edubit-register__card {
898          width: 100%;
899          max-width: 500px;
900          margin: 0 auto;
901          padding: 20px 20px 22px;
902          border: 1px solid #e2e8f0;
903          border-radius: 8px;
904          background: #ffffff;
905          box-shadow: 0 22px 50px rgba(15, 23, 42, 0.10);
906        }
907        .edubit-register__tabs {
908          display: grid;
909          grid-template-columns: repeat(2, minmax(0, 1fr));
910          gap: 5px;
911          margin-bottom: 24px;
912          padding: 5px;
913          border: 1px solid #cbd5e1;
914          border-radius: 8px;
915          background: #f8fafc;
916        }
917        .edubit-register__tab {
918          min-height: 38px;
919          border: 0;
920          border-radius: 6px;
921          background: transparent;
922          color: #4b5563;
923          font: inherit;
924          font-size: 14px;
925          font-weight: 700;
926          cursor: pointer;
927          transition: background-color 0.2s, color 0.2s, box-shadow 0.2s;
928        }
929        .edubit-register__tab--active {
930          background: #eff6ff;
931          color: #2563eb;
932          box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.16);
933        }
934        .edubit-register__header { margin-bottom: 22px; text-align: center; }
935        .edubit-register__title { margin: 0; font-size: 26px; font-weight: 800; line-height: 1.25; }
936        .edubit-register__description { margin: 8px 0 0; color: #6b7280; font-size: 14px; line-height: 1.5; }
937        .edubit-register__form { display: flex; flex-direction: column; gap: 16px; }
938        .edubit-register__account-fields { display: flex; flex-direction: column; gap: 16px; }
939        .edubit-register__field { display: flex; flex-direction: column; gap: 8px; }
940        .edubit-register__label { font-size: 14px; font-weight: 700; color: #334155; }
941        .edubit-register__input {
942          width: 100%;
943          height: 48px;
944          padding: 0 16px;
945          border: 1px solid #cbd5e1;
946          border-radius: 8px;
947          outline: none;
948          background: #ffffff;
949          color: #111827;
950          font: inherit;
951          font-size: 15px;
952          transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
953        }
954        .edubit-register__input::placeholder { color: #9ca3af; }
955        .edubit-register__input:focus { border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14); }
956        .edubit-register__hint { margin: -8px 0 0; color: #6b7280; font-size: 13px; line-height: 1.45; }
957        .edubit-register__agree { display: flex; align-items: flex-start; gap: 9px; color: #4b5563; font-size: 14px; line-height: 1.45; }
958        .edubit-register__agree input { width: 16px; height: 16px; margin-top: 2px; accent-color: #2563eb; }
959        .edubit-register__captcha:not(:empty) { min-height: 78px; }
960        .edubit-register__actions { display: flex; justify-content: flex-end; margin-top: -6px; }
961        .edubit-register__link { color: #2563eb; font-size: 14px; font-weight: 600; text-decoration: none; }
962        .edubit-register__link:hover { text-decoration: underline; }
963        .edubit-register__mode-note { margin: -8px 0 18px; color: #6b7280; font-size: 14px; line-height: 1.5; text-align: center; }
964        .edubit-register__inline-button {
965          display: inline;
966          padding: 0;
967          border: 0;
968          background: transparent;
969          color: #2563eb;
970          font: inherit;
971          font-weight: 700;
972          cursor: pointer;
973        }
974        .edubit-register__divider {
975          display: flex;
976          align-items: center;
977          gap: 12px;
978          margin: 24px 0 16px;
979          color: #64748b;
980          font-size: 14px;
981          font-weight: 600;
982        }
983        .edubit-register__divider::before,
984        .edubit-register__divider::after {
985          content: "";
986          height: 1px;
987          flex: 1;
988          background: #e5e7eb;
989        }
990        .edubit-register__social {
991          display: grid;
992          width: 100%;
993          grid-template-columns: 1fr;
994          gap: 10px;
995        }
996        .edubit-register__social[data-auth-social-count="2"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
997        .edubit-register__social[data-auth-social-count="3"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
998        .edubit-register__social-google { position: relative; min-width: 0; }
999        .edubit-register__social-button {
1000          display: inline-flex;
1001          align-items: center;
1002          justify-content: center;
1003          gap: 8px;
1004          width: 100%;
1005          min-height: 44px;
1006          padding: 8px 12px;
1007          border: 1px solid #cbd5e1;
1008          border-radius: 999px;
1009          background: #ffffff;
1010          color: #334155;
1011          font: inherit;
1012          font-size: 14px;
1013          font-weight: 700;
1014          line-height: 1.2;
1015          cursor: pointer;
1016          box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
1017          transition: border-color 0.2s, box-shadow 0.2s, opacity 0.2s, transform 0.2s;
1018        }
1019        .edubit-register__social-button:hover { border-color: #2563eb; box-shadow: 0 8px 18px rgba(37, 99, 235, 0.12); transform: translateY(-1px); }
1020        .edubit-register__social-button:disabled { cursor: wait; opacity: 0.65; box-shadow: none; transform: none; }
1021        .edubit-register__social-icon {
1022          display: inline-flex;
1023          align-items: center;
1024          justify-content: center;
1025          width: 18px;
1026          height: 18px;
1027          flex: 0 0 18px;
1028          font-size: 12px;
1029          font-weight: 800;
1030          line-height: 1;
1031        }
1032        .edubit-register__social-icon--passport {
1033          width: 22px;
1034          height: 22px;
1035          flex-basis: 22px;
1036          overflow: hidden;
1037          color: transparent;
1038          font-size: 0;
1039        }
1040        .edubit-register__social-icon--passport,
1041        .edubit-register__social-icon--google,
1042        .edubit-register__social-icon--facebook {
1043          overflow: hidden;
1044          color: transparent;
1045          font-size: 0;
1046        }
1047        .edubit-register__social-icon--facebook {
1048          border-radius: 999px;
1049        }
1050        .edubit-register__social-image {
1051          display: block;
1052          width: 100%;
1053          height: 100%;
1054          object-fit: contain;
1055        }
1056        .edubit-register__google-render {
1057          position: absolute;
1058          inset: 0;
1059          z-index: 2;
1060          overflow: hidden;
1061          opacity: 0.01;
1062        }
1063        .edubit-register__google-render iframe {
1064          width: 100% !important;
1065          height: 100% !important;
1066        }
1067        .edubit-register__message {
1068          margin: 16px 0 0;
1069          padding: 10px 12px;
1070          border: 1px solid transparent;
1071          border-radius: 8px;
1072          background: #f8fafc;
1073          font-size: 14px;
1074          font-weight: 600;
1075          line-height: 1.45;
1076        }
1077        .edubit-register__message[data-type="error"] {
1078          border-color: #fecaca;
1079          background: #fef2f2;
1080          color: #dc2626;
1081        }
1082        .edubit-register__message[data-type="success"] {
1083          border-color: #bbf7d0;
1084          background: #f0fdf4;
1085          color: #15803d;
1086        }
1087        .edubit-register__form > .edubit-register__message { margin-top: 0; }
1088        .edubit-register__step-description { margin: 0 0 18px; color: #6b7280; font-size: 14px; line-height: 1.5; text-align: center; }
1089        .edubit-register__otp { text-align: center; font-size: 20px; }
1090        .edubit-register__submit {
1091          display: inline-flex;
1092          align-items: center;
1093          justify-content: center;
1094          width: 100%;
1095          min-height: 48px;
1096          padding: 10px 20px;
1097          border: 0;
1098          border-radius: 999px;
1099          background: #2563eb;
1100          color: #ffffff;
1101          font: inherit;
1102          font-weight: 700;
1103          line-height: 1.25;
1104          text-align: center;
1105          cursor: pointer;
1106          box-shadow: 0 12px 24px rgba(37, 99, 235, 0.22);
1107          transition: background-color 0.2s, box-shadow 0.2s, opacity 0.2s, transform 0.2s;
1108        }
1109        .edubit-register__submit:hover { background: #1d4ed8; box-shadow: 0 14px 28px rgba(37, 99, 235, 0.28); transform: translateY(-1px); }
1110        .edubit-register__submit:disabled { cursor: wait; opacity: 0.7; box-shadow: none; transform: none; }
1111        .edubit-register__back {
1112          border: 0;
1113          background: transparent;
1114          color: #4b5563;
1115          font: inherit;
1116          font-size: 14px;
1117          font-weight: 600;
1118          cursor: pointer;
1119        }
1120        .edubit-register__accounts { display: flex; flex-direction: column; gap: 10px; max-height: 280px; overflow-y: auto; }
1121        .edubit-register__account { display: flex; align-items: center; gap: 10px; padding: 12px; border: 1px solid #e5e7eb; border-radius: 6px; cursor: pointer; }
1122        .edubit-register__account:has(input:checked) { border-color: #2563eb; background: #eff6ff; }
1123        .edubit-register__avatar { width: 40px; height: 40px; border-radius: 999px; object-fit: cover; }
1124        .edubit-register__account-detail { display: flex; min-width: 0; flex: 1; flex-direction: column; gap: 3px; }
1125        .edubit-register__account-detail strong, .edubit-register__account-detail small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
1126        .edubit-register__account-detail small { color: #6b7280; }
1127        @media (max-width: 575px) {
1128          .edubit-register { padding: 28px 14px; }
1129          .edubit-register__card { padding: 16px; }
1130          .edubit-register__title { font-size: 22px; }
1131          .edubit-register__social { grid-template-columns: 1fr; }
1132        }
1133      </style>
1134    `})}const dr="ActiveCodeForm",Wn="/login",Gn="/profile/my-courses";function Os(n){const d={loginUrl:Wn,redirectUrl:Gn};n.DomComponents.addType(dr,{model:{defaults:{tagName:"div",draggable:!0,droppable:!1,attributes:{class:"edubit-active-code"},loginUrl:Wn,redirectUrl:Gn,"script-props":Object.keys(d),traits:[{type:"text",label:"Trang đăng nhập",name:"loginUrl",placeholder:Wn,changeProp:!0},{type:"text",label:"Trang sau kích hoạt",name:"redirectUrl",placeholder:Gn,changeProp:!0}],script:function(g){const o=this;o.dataset.activeCodeLogin=g?.loginUrl||"/login",o.dataset.activeCodeRedirect=g?.redirectUrl||"/profile/my-courses";const c=(()=>{try{return window.self!==window.top&&window.parent.location.pathname.startsWith("/admin/pages/")}catch{return!1}})(),r=()=>{const m=o.querySelector(".edubit-active-code__wrap"),_=o.querySelector(".edubit-active-code__intro");if(!m)return;const C=!!(_&&!_.hidden&&window.getComputedStyle(_).display!=="none"&&window.getComputedStyle(_).visibility!=="hidden");m.classList.toggle("edubit-active-code__wrap--solo",!C)};if(o.dataset.activeCodeLayoutInitialized!=="true"){o.dataset.activeCodeLayoutInitialized="true",r(),new MutationObserver(r).observe(o,{attributes:!0,attributeFilter:["class","hidden","style"],childList:!0,subtree:!0});const _=o.querySelector(".edubit-active-code__wrap"),C=o.querySelector(".edubit-active-code__intro");if("ResizeObserver"in window&&_){const w=new ResizeObserver(r);w.observe(_),C&&w.observe(C)}}if(c||o.dataset.activeCodeInitialized==="true")return;o.dataset.activeCodeInitialized="true";const h=o.querySelector("[data-active-code-form]"),u=o.querySelector("[data-active-code-input]"),l=o.querySelector("[data-active-code-submit]"),e=o.querySelector("[data-active-code-submit-label]"),t=
1134o.querySelector("[data-active-code-message]"),s=o.querySelectorAll("[data-active-code-login-link]");if(!h||!u||!l||!e||!t)return;s.forEach(m=>{m.href=o.dataset.activeCodeLogin||"/login"});const i=()=>window.__EDUBIT_ACTIVE_CODE__,a=(m,_)=>{t.textContent=m,t.dataset.type=_,t.hidden=!m},p=m=>{e.dataset.defaultLabel||(e.dataset.defaultLabel=e.textContent||""),l.disabled=m,l.setAttribute("aria-busy",String(m)),e.textContent=m?"Đang kích hoạt...":e.dataset.defaultLabel},b=m=>m?m.length>16?"Tối đa 16 ký tự":"":"Mã kích hoạt không được để trống";u.addEventListener("input",()=>{t.hidden||a("","")}),h.addEventListener("submit",async m=>{if(m.preventDefault(),l.disabled)return;const _=u.value.trim();u.value=_;const C=b(_);if(C){a(C,"error"),u.focus();return}const w=i();if(!w){a("Không thể khởi tạo chức năng kích hoạt. Vui lòng tải lại trang.","error");return}a("",""),p(!0);try{const x=await w.activateCode({code:_,redirectUrl:o.dataset.activeCodeRedirect||"/profile/my-courses"});x.ok?a(x.message||"Kích hoạt thành công","success"):a(x.message||"Lỗi khi kích hoạt","error")}catch{a("Lỗi khi kích hoạt","error")}finally{p(!1)}})}}},view:{onRender({el:g,model:o}){const c=o.get("script");if(c)try{const r=new Function("return "+c).call(g);typeof r=="function"?r.call(g):console.error("Script does not return a valid function.")}catch(r){console.error("Error executing script:",r)}}}}),n.BlockManager.add("activeCodeForm",{media:'<img src="/images/builder/sections/form-active-code.png" alt="Form kích hoạt coupon">',label:"Form kích hoạt coupon",category:"default-other",content:`
1135      <div data-gjs-type="${dr}" class="edubit-active-code">
1136        <div class="edubit-active-code__wrap">
1137          <section class="edubit-active-code__intro">
1138            <div class="edubit-active-code__intro-inner">
1139              <h2 class="edubit-active-code__headline">Mở Khóa Đặc Quyền Của Bạn</h2>
1140              <p class="edubit-active-code__lead">Chỉ một bước nữa để khám phá thế giới tri thức vô tận.</p>
1141              <ul class="edubit-active-code__benefits">
1142                <li>
1143                  <span class="edubit-active-code__check" aria-hidden="true">
1144                    <svg viewBox="0 0 24 24"><path d="M9 12.75 11.25 15 15.75 9.75M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"/></svg>
1145                  </span>
1146                  <span>Mở khóa toàn bộ nội dung khóa học</span>
1147                </li>
1148                <li>
1149                  <span class="edubit-active-code__check" aria-hidden="true">
1150                    <svg viewBox="0 0 24 24"><path d="M9 12.75 11.25 15 15.75 9.75M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"/></svg>
1151                  </span>
1152                  <span>Học tập linh hoạt, mọi lúc mọi nơi</span>
1153                </li>
1154                <li>
1155                  <span class="edubit-active-code__check" aria-hidden="true">
1156                    <svg viewBox="0 0 24 24"><path d="M9 12.75 11.25 15 15.75 9.75M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"/></svg>
1157                  </span>
1158                  <span>Theo dõi tiến độ và chinh phục mục tiêu</span>
1159                </li>
1160              </ul>
1161            </div>
1162          </section>
1163
1164          <section class="edubit-active-code__card">
1165            <div class="edubit-active-code__form-head">
1166              <h3>🔑 Mã kích hoạt</h3>
1167              <p>Nhập mã của bạn để bắt đầu</p>
1168            </div>
1169
1170            <form class="edubit-active-code__form" data-active-code-form novalidate>
1171              <label class="edubit-active-code__field">
1172                <span>Nhập mã kích hoạt</span>
1173                <input data-active-code-input type="text" name="code" autocomplete="off" placeholder="XXXX-XXXX-XXXX-XXXX" required>
1174              </label>
1175              <button data-active-code-submit type="submit">
1176                <span data-active-code-submit-label>Kích hoạt</span>
1177              </button>
1178              <p class="edubit-active-code__message" data-active-code-message role="alert" aria-live="polite" hidden></p>
1179            </form>
1180
1181            <div class="edubit-active-code__note">
1182              <p>Để lưu lại tiến trình, vui lòng <a data-active-code-login-link href="/login">Đăng nhập</a> hoặc <a href="/register">Đăng ký</a>.</p>
1183              <div class="edubit-active-code__warning">
1184                <svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 9v4m0 4h.01M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0Z"/></svg>
1185                <span>Lưu ý: mỗi mã kích hoạt chỉ được sử dụng 1 lần.</span>
1186              </div>
1187            </div>
1188          </section>
1189        </div>
1190      </div>
1191      <style>
1192        .edubit-active-code {
1193          --edubit-active-code-card-width: 560px;
1194          width: 100%;
1195          padding: 72px 20px;
1196          color: #0f172a;
1197          font-family: Roboto, Arial, sans-serif;
1198        }
1199        .edubit-active-code * { box-sizing: border-box; }
1200        .edubit-active-code__wrap {
1201          display: grid;
1202          grid-template-columns: minmax(0, 1.15fr) minmax(360px, 0.85fr);
1203          align-items: stretch;
1204          max-width: 1024px;
1205          margin: 0 auto;
1206          border-radius: 32px;
1207          box-shadow: 0 24px 60px rgba(15, 23, 42, 0.16);
1208        }
1209        .edubit-active-code__wrap--solo,
1210        .edubit-active-code__wrap:not(:has(> .edubit-active-code__intro)),
1211        .edubit-active-code__wrap:has(> .edubit-active-code__intro[hidden]),
1212        .edubit-active-code__wrap:has(> .edubit-active-code__intro[style*="display:none"]),
1213        .edubit-active-code__wrap:has(> .edubit-active-code__intro[style*="display: none"]) {
1214          display: flex;
1215          justify-content: center;
1216          width: min(100%, var(--edubit-active-code-card-width));
1217          max-width: var(--edubit-active-code-card-width);
1218          box-shadow: none;
1219        }
1220        .edubit-active-code__intro {
1221          display: flex;
1222          min-height: 480px;
1223          align-items: center;
1224          border-radius: 32px 0 0 32px;
1225          background: #1d4ed8;
1226          color: #ffffff;
1227          padding: 54px;
1228        }
1229        .edubit-active-code__intro-inner { max-width: 560px; }
1230        .edubit-active-code__headline {
1231          margin: 0;
1232          font-size: 44px;
1233          line-height: 1.1;
1234          font-weight: 800;
1235        }
1236        .edubit-active-code__lead {
1237          margin: 18px 0 0;
1238          max-width: 500px;
1239          color: #dbeafe;
1240          font-size: 18px;
1241          line-height: 1.6;
1242        }
1243        .edubit-active-code__benefits {
1244          display: flex;
1245          flex-direction: column;
1246          gap: 18px;
1247          padding: 0;
1248          margin: 42px 0 0;
1249          list-style: none;
1250        }
1251        .edubit-active-code__benefits li {
1252          display: flex;
1253          align-items: center;
1254          gap: 12px;
1255          font-size: 17px;
1256        }
1257        .edubit-active-code__check {
1258          display: inline-flex;
1259          width: 28px;
1260          height: 28px;
1261          flex: 0 0 28px;
1262          align-items: center;
1263          justify-content: center;
1264        }
1265        .edubit-active-code__check svg {
1266          width: 28px;
1267          height: 28px;
1268          fill: none;
1269          stroke: currentColor;
1270          stroke-width: 2;
1271          stroke-linecap: round;
1272          stroke-linejoin: round;
1273        }
1274        .edubit-active-code__card {
1275          display: flex;
1276          flex-direction: column;
1277          justify-content: center;
1278          min-height: 480px;
1279          margin-left: -42px;
1280          border-radius: 32px;
1281          background: #ffffff;
1282          padding: 44px;
1283          box-shadow: 0 18px 45px rgba(15, 23, 42, 0.18);
1284        }
1285        .edubit-active-code__wrap--solo > .edubit-active-code__card,
1286        .edubit-active-code__wrap:not(:has(> .edubit-active-code__intro)) > .edubit-active-code__card,
1287        .edubit-active-code__wrap:has(> .edubit-active-code__intro[hidden]) > .edubit-active-code__card,
1288        .edubit-active-code__wrap:has(> .edubit-active-code__intro[style*="display:none"]) > .edubit-active-code__card,
1289        .edubit-active-code__wrap:has(> .edubit-active-code__intro[style*="display: none"]) > .edubit-active-code__card {
1290          width: 100%;
1291          max-width: var(--edubit-active-code-card-width);
1292          margin-left: 0;
1293          border-radius: 32px;
1294        }
1295        .edubit-active-code__form-head { margin-bottom: 28px; text-align: center; }
1296        .edubit-active-code__form-head h3 {
1297          margin: 0;
1298          color: #111827;
1299          font-size: 28px;
1300          line-height: 1.2;
1301          font-weight: 800;
1302        }
1303        .edubit-active-code__form-head p {
1304          margin: 10px 0 0;
1305          color: #6b7280;
1306          font-size: 15px;
1307          line-height: 1.5;
1308        }
1309        .edubit-active-code__form {
1310          display: flex;
1311          flex-direction: column;
1312          gap: 16px;
1313        }
1314        .edubit-active-code__field {
1315          display: flex;
1316          flex-direction: column;
1317          gap: 8px;
1318        }
1319        .edubit-active-code__field span {
1320          color: #374151;
1321          font-size: 14px;
1322        }
1323        .edubit-active-code__field input {
1324          width: 100%;
1325          height: 54px;
1326          border: 1px solid #d1d5db;
1327          border-radius: 12px;
1328          outline: none;
1329          padding: 0 16px;
1330          color: #111827;
1331          background: #ffffff;
1332          font: inherit;
1333          font-size: 18px;
1334          text-align: center;
1335          transition: border-color 0.2s, box-shadow 0.2s;
1336        }
1337        .edubit-active-code__field input::placeholder {
1338          color: #9ca3af;
1339        }
1340        .edubit-active-code__field input:focus {
1341          border-color: #2563eb;
1342          box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.14);
1343        }
1344        .edubit-active-code__form button {
1345          display: inline-flex;
1346          align-items: center;
1347          justify-content: center;
1348          width: 100%;
1349          min-height: 54px;
1350          border: 0;
1351          border-radius: 12px;
1352          background: #2563eb;
1353          color: #ffffff;
1354          font: inherit;
1355          font-size: 16px;
1356          cursor: pointer;
1357          transition: background-color 0.2s, opacity 0.2s, transform 0.2s, box-shadow 0.2s;
1358        }
1359        .edubit-active-code__form button:hover {
1360          background: #1d4ed8;
1361          box-shadow: 0 12px 24px rgba(37, 99, 235, 0.22);
1362          transform: translateY(-1px);
1363        }
1364        .edubit-active-code__form button:disabled {
1365          cursor: wait;
1366          opacity: 0.7;
1367          transform: none;
1368          box-shadow: none;
1369        }
1370        .edubit-active-code__message {
1371          margin: 0;
1372          font-size: 14px;
1373          line-height: 1.45;
1374          text-align: center;
1375        }
1376        .edubit-active-code__message[data-type="error"] { color: #dc2626; }
1377        .edubit-active-code__message[data-type="success"] { color: #15803d; }
1378        .edubit-active-code__note {
1379          display: flex;
1380          flex-direction: column;
1381          gap: 14px;
1382          margin-top: 26px;
1383          border-top: 1px solid #e5e7eb;
1384          padding-top: 22px;
1385          color: #4b5563;
1386          font-size: 14px;
1387          line-height: 1.5;
1388        }
1389        .edubit-active-code__note p {
1390          margin: 0;
1391          text-align: center;
1392        }
1393        .edubit-active-code__note a {
1394          color: #2563eb;
1395          text-decoration: none;
1396        }
1397        .edubit-active-code__note a:hover { text-decoration: underline; }
1398        .edubit-active-code__warning {
1399          display: flex;
1400          align-items: flex-start;
1401          gap: 10px;
1402          border: 1px solid #fde68a;
1403          border-radius: 12px;
1404          background: #fffbeb;
1405          padding: 12px;
1406          color: #92400e;
1407        }
1408        .edubit-active-code__warning svg {
1409          width: 20px;
1410          height: 20px;
1411          flex: 0 0 20px;
1412          fill: none;
1413          stroke: currentColor;
1414          stroke-width: 1.8;
1415          stroke-linecap: round;
1416          stroke-linejoin: round;
1417        }
1418        @media (max-width: 860px) {
1419          .edubit-active-code { padding: 40px 14px; }
1420          .edubit-active-code__wrap {
1421            grid-template-columns: 1fr;
1422            border-radius: 28px;
1423          }
1424          .edubit-active-code__intro {
1425            min-height: auto;
1426            border-radius: 28px 28px 0 0;
1427            padding: 36px 24px;
1428          }
1429          .edubit-active-code__headline { font-size: 24px; }
1430          .edubit-active-code__lead { margin: 8px 0 0; font-size: 16px; }
1431          .edubit-active-code__benefits { margin-top: 16px; gap: 10px; }
1432          .edubit-active-code__benefits li { font-size: 15px; }
1433          .edubit-active-code__card {
1434            min-height: auto;
1435            margin-left: 0;
1436            border-radius: 0 0 28px 28px;
1437            padding: 30px 22px;
1438          }
1439          .edubit-active-code__form-head h3 { font-size: 24px; }
1440        }
1441      </style>
1442    `})}let Kn=null,Wt=null;const Qt=new Set;async function Qr(){return Kn||(Wt||(Wt=fetch("/api/google-fonts").then(n=>n.json()).then(n=>(Kn=n,n)).catch(()=>(Wt=null,[]))),Wt)}const Fs=["Roboto","Inter","Poppins","DM Sans","Space Grotesk","Outfit","Work Sans","Merriweather","Playfair Display","Lora","Cormorant Garamond","Libre Baskerville","Bebas Neue","Oswald","Raleway","Anton","Abril Fatface","Nunito","Bricolage Grotesque","Be Vietnam Pro","Open Sans","Montserrat"];async function js(n,d=30){const g=await Qr(),o=n.toLowerCase().trim();if(!o)return Fs.map(r=>({family:r,category:g.find(h=>h.family===r)?.category||"Sans Serif"}));const c=g.filter(r=>r.family.toLowerCase().includes(o));return c.sort((r,h)=>{const u=r.family.toLowerCase(),l=h.family.toLowerCase(),e=u===o?0:u.startsWith(o)?1:2,t=l===o?0:l.startsWith(o)?1:2;return e!==t?e-t:u.localeCompare(l)}),c.slice(0,d)}async function qs(n,d){if(Qt.has(n))return;const o=d.Canvas.getFrameEl()?.contentWindow;if(!o)return;Qt.add(n);const c=await yr(()=>import("./CJHBzVzk.js").then(r=>r.w),__vite__mapDeps([0,1,2]),import.meta.url);return new Promise(r=>{c.load({google:{families:[`${n}:100,200,300,400,500,600,700,800,900`]},context:o,active:()=>r(),inactive:()=>r(),timeout:5e3}),setTimeout(r,6e3)})}function Us(){Qr()}const Hs=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui-rounded","arial","helvetica","times new roman","times","courier new","courier","verdana","georgia","tahoma","trebuchet ms","comic sans ms","impact","lucida console","lucida sans unicode","roboto-regular","arial-regular","open-sans-regular","times-new-roman-regular","french-vanilla-italic","charmonman-regular","charmonman-bold"]);function Vs(n){const d=new Set,g=/font-family\s*:\s*([^;}]+)/gi;let o;for(;(o=g.exec(n))!==null;){const c=o[1];if(c)for(const r of c.split(",")){const h=r.trim().replace(/^['"]|['"]$/g,"").replace(/!important/gi,"").trim();h&&(Hs.has(h.toLowerCase())||d.add(h))}}return[...d]}async function Ns(n){const d=n.Canvas.getFrameEl(),g=d?.contentWindow,o=d?.contentDocument;if(!g||!o)return;const c=o.documentElement.outerHTML,h=Vs(c).filter(e=>!Qt.has(e));if(h.length===0)return;h.forEach(e=>Qt.add(e));const u=await yr(()=>import("./CJHBzVzk.js").then(e=>e.w),__vite__mapDeps([0,1,2]),import.meta.url),l=h.map(e=>`${e}:100,200,300,400,500,600,700,800,900`);return new Promise(e=>{u.load({google:{families:l},context:g,active:()=>e(),inactive:()=>e(),timeout:8e3}),setTimeout(e,1e4)})}let ur=!1,ut=null,Rt="";function Ws(n){if(!ut)return;const d=n.getSelected();if(!d){Rt="",document.activeElement!==ut&&(ut.value="");return}const o=d.getStyle()["font-family"];if(!o){Rt="",document.activeElement!==ut&&(ut.value="");return}const c=o.split(",")[0]?.trim().replace(/^['"]|['"]$/g,"")||"";Rt=c,document.activeElement!==ut&&(ut.value=c)}async function Gs(n,d){const g=`"${n}", sans-serif`;await qs(n,d);const o=d.getSelected();o&&(o.addStyle({"font-family":g}),d.Canvas.refresh())}function Ks(n){if(ur)return;const o=n.StyleManager.getProperty("typography","font-family")?.view?.el;if(!o)return;ur=!0;const c=document.createElement("div");c.style.cssText="position: relative; padding: 0 5px; margin-bottom: 5px; width: 100%; box-sizing: border-box;",o.after(c);const r=document.createElement("input");ut=r,r.type="text",r.placeholder="Tim font tu Google Fonts...",r.style.cssText=`
1443    width: 100%; padding: 6px 8px; border: 1px solid rgba(255,255,255,0.15);
1444    background: rgba(0,0,0,0.2); color: var(--gjs-font-color, #ddd);
1445    font-size: 12px; outline: none; box-sizing: border-box;
1446    border-radius: 3px;
1447  `,r.addEventListener("blur",()=>{setTimeout(()=>{r.value.trim()||(r.value=Rt)},200)}),c.appendChild(r);const h=document.createElement("div");h.style.cssText=`
1448    display: none; position: absolute; top: 100%; left: 5px; right: 5px;
1449    background: var(--gjs-primary-color, #373d49); border: 1px solid rgba(255,255,255,0.15);
1450    border-radius: 0 0 4px 4px; z-index: 100;
1451    box-shadow: 0 8px 24px rgba(0,0,0,0.4); max-height: 250px;
1452    overflow-y: auto;
1453  `,c.appendChild(h);let u;function l(e){if(h.innerHTML="",e.length===0){r.value.trim()&&(h.innerHTML='<div style="padding:10px;text-align:center;color:#888;font-size:12px;">Khong tim thay font</div>'),h.style.display=e.length===0&&!r.value.trim()?"none":"block";return}h.style.display="block";for(const t of e){const s=document.createElement("div");s.textContent=t.family,s.title=t.category,s.style.cssText=`
1454        padding: 6px 10px; cursor: pointer; font-size: 12px;
1455        color: var(--gjs-font-color, #ddd); transition: background 0.15s;
1456        white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
1457      `,s.addEventListener("mouseenter",()=>{s.style.background="rgba(255,255,255,0.1)"}),s.addEventListener("mouseleave",()=>{s.style.background="none"}),s.addEventListener("click",()=>{Gs(t.family,n),Rt=t.family,r.value=t.family,h.style.display="none"}),h.appendChild(s)}}r.addEventListener("input",()=>{clearTimeout(u);const e=r.value.trim();if(!e){h.style.display="none";return}u=setTimeout(async()=>{const t=await js(e,30);l(t)},300)}),document.addEventListener("click",e=>{c.contains(e.target)||(h.style.display="none")})}function Js(n){n.on("load",()=>{Us(),Ns(n)}),n.on("component:selected",()=>{setTimeout(()=>{Ks(n),Ws(n)},100)})}const Xs={key:0,class:"relative w-[95%] inline-block shadow-2xl"},Ys={key:1,class:"relative w-[95%] inline-block shadow-2xl"},Qs={class:"flex justify-end gap-x-4"},Zs=yt({__name:"ModalSaveMyBlock",props:{thumbnail:{},content:{},js:{},gjsData:{},isOpen:{type:Boolean}},emits:["onCloseModal","onSaveMyBlockSuccess"],setup(n,{emit:d}){const g=n,o=d,{$t:c}=bt(),r=Zt(),h=en(),u=X(!1),l=X(!1);Je(()=>g.isOpen,f=>{u.value=f}),Je(u,f=>{f||o("onCloseModal")});const e=Sr(Jt,Tr(),Er(([f,v])=>({value:f,label:v}
1457))),t=kr({name:un().required(String(c("pages.builder.block.name_cannot_blank"))),type:un().required(String(c("pages.builder.block.category_cannot_blank"))),thumbnail:un().required(String(c("pages.builder.block.thumbnail_cannot_blank")))}),s=X(),i=It({name:"",type:void 0,thumbnail:g.thumbnail}),a=()=>{i.name="",i.type=void 0,i.thumbnail=void 0};Je(()=>g.thumbnail,f=>{i.thumbnail=f});const p=async()=>{const f=h.create(Pr,{props:{custom:{url:"/api/v1/file-management/choose-image"},onFileCallback:y=>{hr(y)&&y.length>0&&(i.thumbnail=$r(y).url,b.value=!1),f.close()}}});await f.open().result,f.close()},b=X(!0),m=()=>{i.thumbnail=g.thumbnail,b.value=!0},_=()=>{i.thumbnail=void 0,b.value=!1},C=async f=>{const v=oa(),y=new FormData;y.append("api_key",v.public.imgHippoApiKey),y.append("file",f);const E=await(await fetch("https://api.imghippo.com/v1/upload",{method:"POST",body:y})).json();return E.success?E.data.view_url:(console.error("Upload thất bại"),null)},w=(f,v="image.png")=>{if(!f.includes(","))return console.error("Chuỗi base64 không hợp lệ: thiếu dấu phẩy phân cách giữa prefix và dữ liệu."),null;const y=f.split(",");if(y.length!==2)return console.error("Chuỗi base64 không hợp lệ"),null;const[P,E]=y,B=P?.match(/data:(.*?);base64/)?.[1]||"application/octet-stream";if(!E)return console.error("Chuỗi base64 không hợp lệ: thiếu dữ liệu sau dấu phẩy"),null;const z=atob(E),Y=z.length,J=new Uint8Array(Y);for(let I=0;I<Y;I++)J[I]=z.charCodeAt(I);return new File([J],v,{type:B})},x=async f=>{l.value=!0;let v=f.data.thumbnail;if(!v.includes("http")){const y=w(v,"thumbnail.png");y&&(v=await C(y),v||(v=f.data.thumbnail))}await $fetch("/api/v2/page-blocks",{method:"POST",body:{...f.data,thumbnail:v,content:g.content,js:g.js,gjs_data:g.gjsData},headers:lt(),onResponse({response:y}){y._data.statusCode===201?(l.value=!1,u.value=!1,a(),r.add({description:String(c(y._data.message)),color:"success"}),o("onSaveMyBlockSuccess")):y.status===403&&r.add({description:String(c("pages.builder.not_permission_setting")),color:"error"})},onResponseError({response:y}){l.value=!1,typeof y._data?.message=="string"&&r.add({description:y._data?.message,color:"error"}),fr(y._data).forEach(E=>{r.add({description:E.message,color:"error"})})}})};return(f,v)=>{const y=tn,P=ei,E=Zn,T=xr,B=Yn,z=nn,Y=Qn,J=Cr,I=rn;return re(),ct(I,{open:k(u),"onUpdate:open":v[5]||(v[5]=H=>st(u)?u.value=H:null)},{content:ce(()=>[K(J,{ref_key:"formPage",ref:s,schema:k(t),state:k(i),class:"space-y-4",onSubmit:x},{default:ce(()=>[K(Y,{ui:{body:"max-h-[500px] overflow-y-auto"}},{header:ce(()=>[K(y,{class:"flex absolute end-5 z-10",color:"neutral",icon:"i-material-symbols:close",padded:"",size:"sm",square:"",variant:"ghost",onClick:v[0]||(v[0]=H=>u.value=!1)}),Ke(" "+dt(String(("capitalize"in f?f.capitalize:k(pe))(k(c)("pages.builder.block.save_my_block")))),1)]),footer:ce(()=>[F("div",Qs,[K(y,{label:String(("capitalize"in f?f.capitalize:k(pe))(k(c)("save"))),color:"primary",size:"lg",type:"submit",variant:"solid",loading:k(l)},null,8,["label","loading"])])]),default:ce(()=>[K(E,{label:String(("capitalize"in f?f.capitalize:k(pe))(k(c)("pages.builder.block.name"))),name:"name"},{default:ce(()=>[K(P,{modelValue:k(i).name,"onUpdate:modelValue":v[1]||(v[1]=H=>k(i).name=H),class:"w-full"},null,8,["modelValue"])]),_:1},8,["label"]),K(E,{label:String(("capitalize"in f?f.capitalize:k(pe))(k(c)("pages.builder.block.category"))),class:"mt-3",name:"type"},{default:ce(()=>[K(T,{modelValue:k(i).type,"onUpdate:modelValue":v[2]||(v[2]=H=>k(i).type=H),items:k(e),class:"w-full"},null,8,["modelValue","items"])]),_:1},8,["label"]),K(E,{label:"Thumbnail",ui:{label:"uppercase-first"},class:"mt-5",name:"thumbnail"},{default:ce(()=>[k(i).thumbnail?(re(),me("div",Xs,[K(B,{src:k(i).thumbnail,alt:"",class:"w-full rounded-lg cursor-pointer select-none",onClick:v[3]||(v[3]=H=>p())},null,8,["src"]),k(b)?ot("",!0):(re(),ct(y,{key:0,class:"absolute top-0 left-full z-1",color:"primary",icon:"lucide:refresh-cw",size:"xs",square:"",variant:"ghost",title:String(("capitalize"in f?f.capitalize:k(pe))(k(c)("pages.builder.block.back_thumbnail_default"))),onClick:m},null,8,["title"])),K(y,{class:je(["absolute top-[25px] left-full z-1",k(b)?"top-0":"top-[25px]"]),color:"error",icon:"lucide:trash-2",size:"xs",square:"",variant:"ghost",title:String(("capitalize"in f?f.capitalize:k(pe))(k(c)("delete"))),onClick:_},null,8,["class","title"])])):(re(),me("div",Ys,[K(y,{class:"bg-primary-500 rounded-lg flex justify-center items-center w-full aspect-[2/1] cursor-pointer select-none",onClick:v[4]||(v[4]=H=>p())},{default:ce(()=>[K(z,{color:"#0573ff",name:"ri:image-line",size:"20"})]),_:1}),K(y,{class:"absolute top-0 left-full z-1",color:"primary",icon:"lucide:refresh-cw",size:"xs",square:"",variant:"ghost",title:String(("capitalize"in f?f.capitalize:k(pe))(k(c)("pages.builder.block.back_thumbnail_default"))),onClick:m},null,8,["title"])]))]),_:1})]),_:1})]),_:1},8,["schema","state"])]),_:1},8,["open"])}}}),el=Object.assign(Zs,{__name:"ModalSaveMyBlock"}),tl=(n,d)=>{const g=n.getConfig("stylePrefix"),o=d.modalImportContent,c=d.toast;
1457n.Commands.add(mi,{codeViewer:null,container:null,run(r){let h=typeof o=="function"?o(r):o;h=h.replace("open_script","<script>").replace("close_script","<\/script>");const u=this.getCodeViewer();r.Modal.open({title:d.modalImportTitle,content:this.getContainer()}).onceClose(()=>r.stopCommand(mi)),u.setContent(h??""),u.refresh()},stop(){n.Modal.close()},getContainer(){if(!this.container){const r=this.getCodeViewer(),h=document.createElement("div");h.className=`${g}import-container`;const u=document.createElement("input");u.id="searchInput",u.className="w-1/2 rounded-md border-0 placeholder:text-dimmed focus:outline-none disabled:cursor-not-allowed disabled:opacity-75 transition-colors px-2.5 py-1.5 text-sm gap-1.5 text-highlighted bg-default ring ring-inset ring-accented focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-primary mb-2",u.placeholder="Tìm kiếm...";let l=0;const e=(a=0)=>{const p=r.editor,b=u.value.trim();if(!p||!b)return;const _=p.getValue().toLowerCase().indexOf(b.toLowerCase(),a);if(_===-1){a>0?e():c.add({description:"Không tìm thấy nội dung cho từ khóa trên",color:"warning"});return}const C=p.posFromIndex(_),w=p.posFromIndex(_+b.length);l=_+b.length,p.setSelection(C,w),p.scrollIntoView(C,100)};let t=null;u.addEventListener("input",()=>{t&&clearTimeout(t),t=window.setTimeout(e,300)}),u.addEventListener("keydown",a=>{a.key==="Enter"&&e(l)}),h.appendChild(u),h.appendChild(r.getElement());const s=document.createElement("div");s.className="text-right pr-[6px]";const i=document.createElement("button");i.type="button",i.innerHTML=d.modalImportButton,i.className=`${g}btn-prim ${g}btn-import font-normal mt-2 px-5`,i.onclick=()=>{try{let p=window.location.href.split("/admin/pages/");p.length&&p[1]!=null&&(p=p[1].split("?"));const b=p.length?p[0]:p,m=r.getContent().trim().replace('<body class="lazyload">',"<body>").replaceAll("body {",".ladi-wraper {").replaceAll("}.","}.ladi-wraper .").replaceAll("}a","}.ladi-wraper a").replaceAll(".ladi-wraper .ladi-wraper",".ladi-wraper").replace("article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section",".ladi-wraper article,.ladi-wraper aside,.ladi-wraper details,.ladi-wraper figcaption,.ladi-wraper figure,.ladi-wraper footer,.ladi-wraper header,.ladi-wraper hgroup,.ladi-wraper menu,.ladi-wraper nav,.ladi-wraper section").replace("a,abbr,acronym,address,applet,article,aside,audio,b,big,blockquote,body,button,canvas,caption,center,cite,code,dd,del,details,dfn,div,dl,dt,em,embed,fieldset,figcaption,figure,footer,form,h1,h2,h3,h4,h5,h6,header,hgroup,html,i,iframe,img,input,ins,kbd,label,legend,li,mark,menu,nav,object,ol,output,p,pre,q,ruby,s,samp,section,select,small,span,strike,strong,sub,summary,sup,table,tbody,td,textarea,tfoot,th,thead,time,tr,tt,u,ul,var,video",".ladi-wraper a, .ladi-wraper abbr, .ladi-wraper acronym, .ladi-wraper address, .ladi-wraper applet, .ladi-wraper article, .ladi-wraper aside, .ladi-wraper audio, .ladi-wraper b, .ladi-wraper big, .ladi-wraper blockquote, .ladi-wraper body, .ladi-wraper button, .ladi-wraper canvas, .ladi-wraper caption, .ladi-wraper center, .ladi-wraper cite, .ladi-wraper code, .ladi-wraper dd, .ladi-wraper del, .ladi-wraper details, .ladi-wraper dfn, .ladi-wraper div, .ladi-wraper dl, .ladi-wraper dt, .ladi-wraper em, .ladi-wraper embed, .ladi-wraper fieldset, .ladi-wraper figcaption, .ladi-wraper figure, .ladi-wraper footer, .ladi-wraper form, .ladi-wraper h1, .ladi-wraper h2, .ladi-wraper h3, .ladi-wraper h4, .ladi-wraper h5, .ladi-wraper h6, .ladi-wraper header, .ladi-wraper hgroup, .ladi-wraper html, .ladi-wraper i, .ladi-wraper iframe, .ladi-wraper img, .ladi-wraper input, .ladi-wraper ins, .ladi-wraper kbd, .ladi-wraper label, .ladi-wraper legend, .ladi-wraper li, .ladi-wraper mark, .ladi-wraper menu, .ladi-wraper nav, .ladi-wraper object, .ladi-wraper ol, .ladi-wraper output, .ladi-wraper p, .ladi-wraper pre, .ladi-wraper q, .ladi-wraper ruby, .ladi-wraper s, .ladi-wraper samp, .ladi-wraper section, .ladi-wraper select, .ladi-wraper small, .ladi-wraper span, .ladi-wraper strike, .ladi-wraper strong, .ladi-wraper sub, .ladi-wraper summary, .ladi-wraper sup, .ladi-wraper table, .ladi-wraper tbody, .ladi-wraper td, .ladi-wraper textarea, .ladi-wraper tfoot, .ladi-wraper th, .ladi-wraper thead, .ladi-wraper time, .ladi-wraper tr, .ladi-wraper tt, .ladi-wraper u, .ladi-wraper ul, .ladi-wraper var, .ladi-wraper video");fetch(`/api/v1/pages/${b}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({gjs_data:"{}",content:m})}).then(_=>_.json()).then(_=>{_.success===!0||_.statusCode===200?(n.Modal.close(),c.add({description:"Lưu thành công.",color:"success"}),setTimeout(()=>{const C=window.location.href;window.location.href=C.split("?")[0]??C},1e3)):c.add({description:"Không thể lưu, vui lòng thử lại sau.",color:"error"})}).catch(_=>{console.log(_),c.add({description:"Không thể lưu, vui lòng thử lại sau.",color:"error"})})}catch(a){console.error(a),c.add({description:"Không thể lưu, vui lòng thử lại sau.",color:"error"})}},s.appendChild(i),h.appendChild(s),this.container=h}return this.container}
1457,getCodeViewer(){return this.codeViewer||(this.codeViewer=n.CodeManager.createViewer({codeName:"htmlmixed",theme:"hopscotch",readOnly:!1,...d.importViewerOptions})),this.codeViewer}})},nl=n=>{const d=document.createElement("textarea");return d.innerHTML=n,d.value};function il(n){const d=n.DomComponents,g=(e,t,s,i,a,p,b)=>({createInput({trait:m,component:_}){const C={},w=H=>{const Q=document.createElement("textarea");return Q.innerHTML=H,Q.value},x=document.createElement("div");x.classList.add("custom-search-trait-container");const f=document.createElement("style");f.innerHTML=`
1458          .gjs-trt-trait:has(.custom-search-trait-container) {
1459            flex-wrap: wrap !important;
1460            height: auto !important;
1461          }
1462          .gjs-trt-trait:has(.custom-search-trait-container) .gjs-label-wrp,
1463          .gjs-trt-trait:has(.custom-search-trait-container) .gjs-label {
1464            flex: 1 1 100% !important;
1465            width: 100% !important;
1466            max-width: 100% !important;
1467            border-bottom: none !important;
1468            margin-bottom: 4px !important;
1469          }
1470          .gjs-trt-trait:has(.custom-search-trait-container) .gjs-field-wrp,
1471          .gjs-trt-trait:has(.custom-search-trait-container) .gjs-field {
1472            flex: 1 1 100% !important;
1473            width: 100% !important;
1474            max-width: 100% !important;
1475            border: none !important;
1476            background-color: transparent !important;
1477            box-shadow: none !important;
1478          }
1479        `,x.appendChild(f),x.style.position="relative",x.style.display="flex",x.style.flexDirection="column",x.style.gap="8px";const v=document.createElement("input");v.type="text",v.placeholder="Tìm kiếm "+e+"...",v.style.padding="6px",v.style.border="1px solid rgba(0,0,0,0.2)",v.style.borderRadius="3px",v.style.outline="none",v.style.background="#fff",v.style.fontSize="12px",v.style.width="100%",x.appendChild(v);const y=document.createElement("div");y.style.maxHeight="200px",y.style.overflowY="auto",y.style.border="1px solid rgba(0,0,0,0.2)",y.style.borderRadius="4px",y.style.display="none",y.style.background="#fff",y.style.color="#333",y.style.position="absolute",y.style.top="32px",y.style.left="0",y.style.right="0",y.style.zIndex="9999",y.style.boxShadow="0 4px 6px -1px rgba(0, 0, 0, 0.1)",x.appendChild(y);const P=document.createElement("div");P.style.marginTop="8px",P.style.paddingTop="8px",P.style.display="none";const E=document.createElement("div");E.innerText="Đã chọn:",E.style.fontSize="11px",E.style.fontWeight="bold",E.style.marginBottom="6px",E.style.opacity="0.7",P.appendChild(E);const T=document.createElement("div");T.style.display="flex",T.style.flexWrap="wrap",T.style.gap="6px",P.appendChild(T),x.appendChild(P);const B=()=>{let H=_.get(t)||[];if(typeof H=="string")try{H=JSON.parse(H)}catch{H=H.split(",").map(Q=>Q.trim()).filter(Q=>!!Q)}return Array.isArray(H)?H:[H]},z=()=>{T.innerHTML="";const H=B();H.length===0?P.style.display="none":P.style.display="block",H.forEach(Q=>{const D=C[Q]||`Đang tải... (ID: ${Q})`,j=document.createElement("div");if(j.style.display="inline-flex",j.style.alignItems="center",j.style.padding="2px 6px",j.style.background="#f3f4f6",j.style.color="#374151",j.style.fontSize="11px",j.style.borderRadius="4px",j.style.border="1px solid #e5e7eb",j.title=D,p){const q=document.createElement("a");q.href=p.replace(":id",Q),q.target="_blank",q.innerHTML="&#9998;",q.style.cursor="pointer",q.style.marginRight="4px",q.style.fontSize="12px",q.style.color="#3b82f6",q.style.textDecoration="none",j.appendChild(q)}const G=document.createElement("span");G.innerText=D.length>25?D.substring(0,25)+"...":D,G.style.marginRight="4px";const V=document.createElement("span");V.innerHTML="&times;",V.style.cursor="pointer",V.style.fontWeight="bold",V.onclick=()=>{const q=H.filter(O=>O!==Q);m.set("value",q),_.set(t,q),z()},j.appendChild(G),j.appendChild(V),T.appendChild(j)})},Y=B();z(),Y.length&&fetch(a(Y)).then(H=>H.json()).then(H=>{b(H).forEach(D=>{C[D._id||D.id]=w(D.title||D.name||"")}),z()}).catch(H=>console.log("Lỗi tải dữ liệu:",H));const J=H=>{y.innerHTML="";const Q=H?`${i}&keyword=${encodeURIComponent(H)}`:i;fetch(Q).then(D=>D.json()).then(D=>{y.innerHTML="";const j=b(D),G=B(),V=j.filter(q=>!G.includes(q._id||q.id));if(V.length)V.forEach(q=>{const O=q._id||q.id;C[O]=w(q.title||q.name||"");const de=document.createElement("div");de.innerText=C[O],de.style.padding="8px",de.style.cursor="pointer",de.style.fontSize="12px",de.style.borderBottom="1px solid #f3f4f6",de.addEventListener("mouseover",()=>de.style.background="#f3f4f6"),de.addEventListener("mouseout",()=>de.style.background="transparent"),de.addEventListener("click",()=>{const ye=B();if(!ye.includes(O)){const Ce=[...ye,O];
1479m.set("value",Ce),_.set(t,Ce),s.forEach(Ee=>{_.set(Ee,Array.isArray(_.get(Ee))?[]:null)}),z()}y.style.display="none",v.value=""}),y.appendChild(de)});else{const q=document.createElement("div");q.innerText="Không tìm thấy kết quả",q.style.padding="8px",q.style.fontSize="12px",q.style.color="#6b7280",y.appendChild(q)}y.style.display="block"}).catch(D=>{console.log("Lỗi tìm kiếm:",D),y.style.display="none"})};let I;return v.addEventListener("input",H=>{const Q=H.target.value;clearTimeout(I),I=setTimeout(()=>J(Q),300)}),v.addEventListener("focus",()=>{J(v.value)}),v.addEventListener("click",()=>{J(v.value)}),document.addEventListener("click",H=>{x.contains(H.target)||(y.style.display="none")}),x}}),o={showRating:!0,showSaleOff:!0,showTagSaleOff:!0,showNameTeacher:!0,pageSize:4,dataType:"course",widthCardProduct:350,fontSizeTitleCardProduct:20,colorTitleCardProduct:"#374151",fontSizeStarCardProduct:14,colorStarCardProduct:"#f59e0b",fontSizePriceSaleCardProduct:22,colorPriceSaleCardProduct:"#6b7280",fontSizePriceCardProduct:13,colorPriceCardProduct:"#6b7280",fontSizeTagSaleOffCardProduct:12,colorBgTagSaleOffCardProduct:"#e11d48",fontSizeTeacherNameCardProduct:16,colorTeacherNameCardProduct:"#6b7280",fontSizeInformationCardProduct:13,colorInformationCardProduct:"#004085",bgColorInformationCardProduct:"#cce5ff",lang:"vi",siteId:null,productIds:[],tagIds:[],categoryId:null,comboIds:[],examIds:[]},c={id:"catGeneral",label:"Chung",open:!0},r={id:"catStyle",label:"Thiết kế",open:!1},h=[{type:"number",label:"Số lượng",name:"pageSize",changeProp:!0,category:c,min:1,max:20},{type:"select-data-type",label:"Dữ liệu",name:"dataType",changeProp:!0,category:c},{type:"select-data-course",label:"Khóa học",name:"dataCourse",changeProp:!0,category:c},{type:"select",label:"Tag",name:"dataTag",changeProp:!0,category:c,attributes:{style:"display: none;"}},{type:"select",label:"Danh mục",name:"dataCategory",changeProp:!0,category:c,attributes:{style:"display: none;"}},{type:"select-data-combo",label:"Combo",name:"dataCombo",changeProp:!0,category:c,attributes:{style:"display: none;"}},{type:"select-data-exam",label:"Bài kiểm tra",name:"dataExam",changeProp:!0,category:c,attributes:{style:"display: none;"}}],u=[{type:"number",label:"Chiều rộng của card",name:"widthCardProduct",changeProp:!0,category:r,min:100,max:650},{type:"number",label:"Cỡ chữ tiêu đề",name:"fontSizeTitleCardProduct",changeProp:!0,category:r},{type:"color",label:"Màu tiêu đề",name:"colorTitleCardProduct",changeProp:!0,category:r},{type:"checkbox",label:"Đánh giá",name:"showRating",changeProp:!0,category:r},{type:"number",label:"Cỡ chữ đánh giá",name:"fontSizeStarCardProduct",changeProp:!0,category:r},{type:"color",label:"Màu đánh giá",name:"colorStarCardProduct",changeProp:!0,category:r},{type:"checkbox",label:"Giảm giá",name:"showSaleOff",changeProp:!0,category:r},{type:"number",label:"Cỡ chữ giá bán",name:"fontSizePriceSaleCardProduct",changeProp:!0,category:r},{type:"color",label:"Màu chữ giá bán",name:"colorPriceSaleCardProduct",changeProp:!0,category:r},{type:"number",label:"Cỡ chữ giá gốc",name:"fontSizePriceCardProduct",changeProp:!0,category:r},{type:"color",label:"Màu chữ giá gốc",name:"colorPriceCardProduct",changeProp:!0,category:r},{type:"checkbox",label:"Nhãn % giảm giá",name:"showTagSaleOff",changeProp:!0,category:r},{type:"number",label:"Cỡ chữ nhãn giảm giá",name:"fontSizeTagSaleOffCardProduct",changeProp:!0,category:r},{type:"color",label:"Màu nền nhãn giảm giá",name:"colorBgTagSaleOffCardProduct",changeProp:!0,category:r},{type:"checkbox",label:"Tên giảng viên",name:"showNameTeacher",changeProp:!0,category:r},{type:"number",label:"Cỡ chữ tên giảng viên",name:"fontSizeTeacherNameCardProduct",changeProp:!0,category:r},{type:"color",label:"Màu tên giảng viên",name:"colorTeacherNameCardProduct",changeProp:!0,category:r},{type:"number",label:"Cỡ chữ thông tin bài kiểm tra",name:"fontSizeInformationCardProduct",changeProp:!0,category:r},{type:"color",label:"Màu chữ thông tin bài kiểm tra",name:"colorInformationCardProduct",changeProp:!0,category:r},{type:"color",label:"Màu nền thông tin bài kiểm tra",name:"bgColorInformationCardProduct",changeProp:!0,category:r}];d.addType("Product2",{model:{defaults:{tagName:"div",draggable:!0,droppable:!1,attributes:{class:"products"},...o,"script-props":[...Object.keys(o)],components:"<p>Chọn khóa học...</p>",traits:[...h,...u],style:{"font-family":"Roboto, sans-serif",padding:"15px 0"},script:function(e){if(!e)return;function t(f){return`<a href="/${f.url}" style="width: 100%; max-width: ${e.widthCardProduct}px; margin: 0 auto; position: relative; text-decoration: none; background-color: #fff; border-radius: 10px; overflow: hidden; box-shadow: 0 4px 30px rgba(19, 28, 25, 0.1); display: flex; flex-direction: column;">
1480              <!-- Giảm giá -->
1481              ${f.show_tag_sale_off&&!f.no_retail&&i(f.price_origin||0,f.price_sale||0)!==0?`<div style="position: absolute; background-color: ${e.colorBgTagSaleOffCardProduct}; color: #fff; padding: 0.125rem 0.5rem; font-size: ${e.fontSizeTagSaleOffCardProduct}px; font-weight: bold; border-radius: 0.25rem; top: 5px; left: 5px">
1482                  ${i(f.price_origin||0,f.price_sale||0)}%
1483              </div>`:""}
1484              <!-- Hình ảnh -->
1485              <img style="aspect-ratio: 5 / 3; object-fit: cover; width: 100%;" src="${f.image}" alt="${f.name}" loading="lazy">
1486              <!-- Nội dung sản phẩm -->
1487              <div style="padding: 15px; display: flex; flex-direction: column; flex-grow: 1;">
1488                <h5 style="font-size: ${e.fontSizeTitleCardProduct}px; font-weight: bold; color: ${e.colorTitleCardProduct}; margin: 0 0 0.5rem; flex-grow: 1;">${f.name}</h5>
1489                ${f.show_teacher_name?`<p style="font-size: ${e.fontSizeTeacherNameCardProduct}px; color: ${e.colorTeacherNameCardProduct}; margin: 0 0 0.5rem;">${f.teacher_name}</p>`:""}
1490                <!-- Đánh giá sao -->
1491                ${f.show_rating||f.rating_avg&&f.rating_avg>0?`<div style="display: flex; align-items: center; font-size: ${e.fontSizeTagSaleOffCardProduct}px; color: ${e.colorStarCardProduct};">
1492                    ${a(f.rating_avg||0)} <span style="color: #6b7280; margin-left: 0.25rem; font-size: ${e.fontSizeStarCardProduct}px;">(${f.rating_count||0} đánh giá)</span>
1493                </div>`:""}
1494                <!-- Giá sản phẩm -->
1495                ${f.no_retail?"":`<div style="margin-top: 0.5rem;">
1496                  <span style="color: ${e.colorPriceCardProduct}; font-size: ${e.fontSizePriceSaleCardProduct}px; font-weight: 700; margin-right: 5px;">${f.price_sale>0?`${s(f.price_sale)}</span>`:"Miễn phí"}</span>
1497                  ${f.show_sale_off&&f.price_origin&&f.price_origin>0&&f.price_sale&&f.price_sale!=f.price_origin?`<span style="text-decoration: line-through; font-size: ${e.fontSizePriceCardProduct}px; margin-right: 0.5rem; color: ${e.colorPriceCardProduct};">${s(f.price_origin)}</span>`:""}
1498                </div>`}
1499              </div>
1500            </a>`}function s(f){return new Intl.NumberFormat("vi-VN",{style:"currency",currency:"VND",minimumFractionDigits:0}).format(f).replace(/\s/g,"")}function i(f,v){return f?Math.round((v-f)/f*100):0}function a(f){const v="★".repeat(Math.round(f)),y="☆".repeat(5-Math.round(f));return v+y}function p(f){let v=0;for(const y of Array(5).keys()){const P=`rating_${y+1}`;f[P]!==void 0&&(v+=f[P])}return v}function b(f){return`<a href="/exam/${f.code}" style="width: 100%; max-width: ${e.widthCardProduct}px; margin: 0 auto; position: relative; text-decoration: none; background-color: #fff; border-radius: 10px; overflow: hidden; box-shadow: 0 4px 30px rgba(19, 28, 25, 0.1);">
1501              <!-- Hình ảnh -->
1502              <img style="aspect-ratio: 5 / 3; object-fit: cover; width: 100%;" src="${f.image}" alt="${f.name}" loading="lazy">
1503              <!-- Nội dung bkt -->
1504              <div style="padding: 0.75rem;">
1505                <div style="display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px;">
1506                  <div style="padding: 5px 8px; background-color: ${e.bgColorInformationCardProduct}; color: ${e.colorInformationCardProduct}; font-size: 13px; border-radius: 3px;">${f.quiz_test_count} câu hỏi</div>
1507                  <div style="padding: 5px 8px; background-color: ${e.bgColorInformationCardProduct}; color: ${e.colorInformationCardProduct}; font-size: 13px; border-radius: 3px;">${f.count_result} lượt tham gia</div>
1508                </div>
1509                <h5 style="font-size: 16px; font-weight: bold; color: ${e.colorTitleCardProduct}; margin: 0 0 0.5rem;">${f.name}</h5>
1510              </div>
1511            </a>`}function m(f){return`<a href="/combo/${f.url}" style="width: 100%; max-width: ${e.widthCardProduct}px; margin: 0 auto; position: relative; text-decoration: none; background-color: #fff; border-radius: 10px; overflow: hidden; box-shadow: 0 4px 30px rgba(19, 28, 25, 0.1); display: flex; flex-direction: column;">
1512              <!-- Hình ảnh -->
1513              <img style="aspect-ratio: 5 / 3; object-fit: cover; width: 100%;" src="${f.image}" alt="${f.name}" loading="lazy">
1514              <!-- Nội dung bkt -->
1515              <div style="padding: 0.75rem;display: flex; flex-direction: column; flex-grow: 1;">
1516                <h5 style="font-size: 16px; font-weight: bold; color: ${e.colorTitleCardProduct}; margin: 0 0 0.5rem; flex-grow: 1;">${f.name}</h5>
1517                <div>
1518                  ${f.no_retail?"":`<span style="color: ${e.colorPriceCardProduct}; font-size: 16px; font-weight: bold;">${f.price_sell>0?`${s(f.price_sell)}</span>`:"Miễn phí"}</span>
1519                  ${e.showSaleOff&&f.price&&f.price>0&&f.price_sell&&f.price_sell!==f.price?`<span style="text-decoration: line-through; color: #6b7280; font-size: 14px; margin-right: 0.5rem;">${s(f.price)}</span>`:""}`}
1520                </div>
1521              </div>
1522            </a>`}const _={show_rating:!!e?.showRating,show_sale_off:!!e?.showSaleOff,show_tag_sale_off:!!e?.showTagSaleOff,show_teacher_name:!!e?.showNameTeacher,teacher_name:""};let C="Chưa cấu hình khóa học...";e.dataType==="combo"?C="Chưa cấu hình combo...":e.dataType==="exam"&&(C="Chưa cấu hình bài kiểm tra...");const w=e.productIds&&e.productIds.length||e.tagIds&&e.tagIds.length||e.categoryId||e.examIds&&e.examIds.length||e.comboIds&&e.comboIds.length;this.innerHTML=w?'<div style="text-align: center; padding: 20px; color: #666;">Đang tải dữ liệu...</div>':`<div style="text-align: center; padding: 20px; color: #666; border: 1px dashed #ccc; border-radius: 4px;">${C}</div>`;const x='<div style="text-align: center;"><svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewB
1522ox="0 0 24 24"><path fill="currentColor" d="M11.001 10h2v5h-2zM11 16h2v2h-2z"/><path fill="currentColor" d="M13.768 4.2C13.42 3.545 12.742 3.138 12 3.138s-1.42.407-1.768 1.063L2.894 18.064a1.99 1.99 0 0 0 .054 1.968A1.98 1.98 0 0 0 4.661 21h14.678c.708 0 1.349-.362 1.714-.968a1.99 1.99 0 0 0 .054-1.968zM4.661 19L12 5.137L19.344 19z"/></svg><p>Có lỗi xảy ra khi tải dữ liệu.</p></div>';if(e.productIds.length||e.tagIds.length||e.categoryId){const f=new URLSearchParams;f.append("limit",`${e.pageSize}`),e.productIds.length&&e.productIds.forEach(v=>f.append("ids[]",v)),e.tagIds.length&&e.tagIds.forEach(v=>f.append("tags[]",v)),e.categoryId&&f.append("category_id",e.categoryId),fetch(`/api/v1/courses?${f}`,{}).then(v=>v.json()).then(v=>{const y=v.data;let P=`
1523                  <style>
1524                    .grid-custom {
1525                      display: grid;
1526                      grid-template-columns: repeat(auto-fit, minmax(350px, max-content));
1527                      justify-content: center;
1528                      gap: 1.5rem;
1529                      max-width: 100%;
1530                    }
1531                    @media (max-width: 1025px) {
1532                      .grid-custom a {
1533                        max-width: 100%;
1534                      }
1535                    }
1536                    @media (max-width: 575px) {
1537                      .grid-custom {
1538                        grid-template-columns: 1fr;
1539                      }
1540                    }
1541                  </style>
1542                  <div class="grid-custom">
1543                `;y.forEach(E=>{P+=t({..._,name:E.name,url:E.url,image:E.thumbnail_url||"",teacher_name:E.teacher?.fullname??"",price_sale:E.price_sell,price_origin:E.price,rating_avg:E.avgRating||0,rating_count:p(E),no_retail:E.no_retail})}),P+="</div>",this.innerHTML=P}).catch(v=>{console.log(v),this.innerHTML=x})}else if(e.examIds.length){const f=new URLSearchParams;f.append("limit",`${e.pageSize}`),e.examIds.forEach(v=>f.append("ids[]",v)),fetch(`/api/v1/quiz-test/all?${f}`,{}).then(v=>v.json()).then(v=>{const y=v?.data||v;let P=`
1544                  <style>
1545                    .grid-custom {
1546                      display: grid;
1547                      grid-template-columns: repeat(auto-fit, minmax(350px, max-content));
1548                      justify-content: center;
1549                      gap: 1.5rem;
1550                      max-width: 100%;
1551                    }
1552                    @media (max-width: 1025px) {
1553                      .grid-custom a {
1554                        max-width: 100%;
1555                      }
1556                    }
1557                    @media (max-width: 575px) {
1558                      .grid-custom {
1559                        grid-template-columns: 1fr;
1560                      }
1561                    }
1562                  </style>
1563                  <div class="grid-custom">
1564                `;y.forEach(E=>{P+=b({code:E.code,name:E.title,image:E.thumbnail||"",quiz_test_count:E.quiz_test_count||0,count_result:E.count_result||0})}),P+="</div>",this.innerHTML=P}).catch(v=>{console.log(v),this.innerHTML=x})}else if(e.comboIds.length){const f=new URLSearchParams;f.append("limit",`${e.pageSize}`),e.comboIds.forEach(v=>f.append("ids[]",v)),fetch(`/api/v2/combos/select-list?${f}`,{}).then(v=>v.json()).then(v=>{const y=v?.data||v;let P=`
1565                  <style>
1566                    .grid-custom {
1567                      display: grid;
1568                      grid-template-columns: repeat(auto-fit, minmax(350px, max-content));
1569                      justify-content: center;
1570                      gap: 1.5rem;
1571                      max-width: 100%;
1572                    }
1573                    @media (max-width: 1025px) {
1574                      .grid-custom a {
1575                        max-width: 100%;
1576                      }
1577                    }
1578                    @media (max-width: 575px) {
1579                      .grid-custom {
1580                        grid-template-columns: 1fr;
1581                      }
1582                    }
1583                  </style>
1584                  <div class="grid-custom">
1585                `;y.forEach(E=>{P+=m({name:E.name,url:E.url??"",image:E.thumbnail||"",price:E.price||0,price_sell:E.price_sell||0,no_retail:E.no_retail})}),P+="</div>",this.innerHTML=P}).catch(v=>{console.log(v),this.innerHTML=x})}}}},view:{onRender({el:e,model:t}){const s=t.get("script");
1585if(s)try{const i=new Function("return "+s).call(e);typeof i=="function"?i.call(e):console.error("Script does not return a valid function.")}catch(i){console.error("Error executing script:",i)}}}}),n.BlockManager.add("products",{media:'<img src="/images/builder/sections/product/mau-2.png" alt="Product List">',label:"Mẫu 2",category:"default-product",content:`<div style="padding: 20px 0;">
1586      <div style="margin-bottom: 15px; text-align: center; font-weight: bold; font-size: 1.5rem; color: #314158;">KHÓA HỌC MỚI NHẤT</div>
1587      <div data-gjs-type="Product2"></div>
1588      <div style="text-align: center; margin-top: 25px;">
1589        <a href="/courses" style="padding: 15px 50px; text-decoration: none; color: #fff; background-color: #2b7fff; font-size: 16px; font-weight: 700; border-radius: 10px;">Xem tất cả</a>
1590      </div>
1591    </div>`}),n.Traits.addType("select-data-type",{createInput({trait:e}){const t=e.get("options")||[],s=t.length?t:[{id:"course",label:"Khóa học"},{id:"tag",label:"Khóa học theo tag"},{id:"category",label:"Khóa học theo danh mục"},{id:"combo",label:"Combo"},{id:"exam",label:"Bài kiểm tra"}],i=document.createElement("div");return i.innerHTML=`<select class="select-data-type__type">
1592          ${s.map(a=>`<option value="${a.id}" title="${a.label}">${a.label}</option>`).join("")}
1593        </select>`,i},onEvent({elInput:e,component:t}){const s=t.get("siteId"),i=e.querySelector(".select-data-type__type");switch(t.getTrait("dataType").setValue(i.value),i.value){case"tag":{fetch(`/api/v1/sites/${s}/tags?get_all=1`,{}).then(a=>a.json()).then(a=>{const p=a?.data||a;t.getTrait("dataTag").set({options:p.map(b=>({id:String(b._id||b.id||""),label:nl(b.title||b.name||"")}))})}).catch(a=>{console.log(a)}),l("dataTag",["dataCourse","dataCategory","dataCombo","dataExam"]);return}case"category":{Ua({},async()=>await(await fetch("/api/v1/categories/all",{})).json()).then(a=>{const p=a?.data||a;t.getTrait("dataCategory").set({options:p.map(b=>({id:String(b.id||""),label:String(b.name||"")}))})}).catch(a=>{console.log(a)}),l("dataCategory",["dataCourse","dataTag","dataCombo","dataExam"]);return}case"combo":{l("dataCombo",["dataCourse","dataTag","dataCategory","dataExam"]);return}case"exam":{l("dataExam",["dataCourse","dataTag","dataCategory","dataCombo"]);return}default:{l("dataCourse",["dataCategory","dataTag","dataCombo","dataExam"]);return}}}}),n.Traits.addType("select-data-course",g("khóa học","productIds",["tagIds","categoryId","comboIds","examIds"],"/api/v1/courses/all?limit=50",e=>"/api/v1/courses/all?limit=50&"+e.map(t=>`ids[]=${t}`).join("&"),"/admin/courses/:id",e=>e.data||e)),n.Traits.addType("select-data-combo",g("combo","comboIds",["productIds","tagIds","categoryId","examIds"],"/api/v2/combos/select-list?limit=50",e=>"/api/v2/combos/select-list?limit=50&"+e.map(t=>`ids[]=${t}`).join("&"),"/admin/combo-course/:id",e=>e.data||e)),n.Traits.addType("select-data-exam",g("bài kiểm tra","examIds",["productIds","tagIds","categoryId","comboIds"],"/api/v1/quiz-test/all?limit=50",e=>"/api/v1/quiz-test/all?limit=50&"+e.map(t=>`ids[]=${t}`).join("&"),"/admin/quiz-test/:id",e=>e.data||e)),n.on("component:update:traits",e=>{const t=e.getTrait("dataTag");t&&t.on("change:value",(i,a)=>{e.set("tagIds",[a]),e.set("categoryId",null),e.set("productIds",[]),e.set("examIds",[]),e.set("comboIds",[])});const s=e.getTrait("dataCategory");s&&s.on("change:value",(i,a)=>{e.set("categoryId",a),e.set("productIds",[]),e.set("tagIds",[]),e.set("examIds",[]),e.set("comboIds",[])})}),n.on("component:selected",e=>{e.get("type")==="Product2"&&setTimeout(()=>{const t=e.getTrait("dataType");if(t)switch(t.getValue()){case"tag":{l("dataTag",["dataCourse","dataCategory","dataCombo","dataExam"]);break}case"category":{l("dataCategory",["dataCourse","dataTag","dataCombo","dataExam"]);break}case"combo":{l("dataCombo",["dataCourse","dataTag","dataCategory","dataExam"]);break}case"exam":{l("dataExam",["dataCourse","dataTag","dataCategory","dataCombo"]);break}default:{l("dataCourse",["dataCategory","dataTag","dataCombo","dataExam"]);break}}},0)});const l=(e,t)=>
1593{const s=n.getSelected()?.getTrait(e);s?.view?.el&&(s.view.el.style.display=""),t.forEach(i=>{const a=n.getSelected()?.getTrait(i);a?.view?.el&&(a.view.el.style.display="none")})}}function rl(n){const d=n.DomComponents,g=(l,e,t,s,i,a,p)=>({createInput({trait:b,component:m}){const _={},C=I=>{const H=document.createElement("textarea");return H.innerHTML=I,H.value},w=document.createElement("div");w.classList.add("custom-search-trait-container");const x=document.createElement("style");x.innerHTML=`
1594          .gjs-trt-trait:has(.custom-search-trait-container) {
1595            flex-wrap: wrap !important;
1596            height: auto !important;
1597          }
1598          .gjs-trt-trait:has(.custom-search-trait-container) .gjs-label-wrp,
1599          .gjs-trt-trait:has(.custom-search-trait-container) .gjs-label {
1600            flex: 1 1 100% !important;
1601            width: 100% !important;
1602            max-width: 100% !important;
1603            border-bottom: none !important;
1604            margin-bottom: 4px !important;
1605          }
1606          .gjs-trt-trait:has(.custom-search-trait-container) .gjs-field-wrp,
1607          .gjs-trt-trait:has(.custom-search-trait-container) .gjs-field {
1608            flex: 1 1 100% !important;
1609            width: 100% !important;
1610            max-width: 100% !important;
1611            border: none !important;
1612            background-color: transparent !important;
1613            box-shadow: none !important;
1614          }
1615        `,w.appendChild(x),w.style.position="relative",w.style.display="flex",w.style.flexDirection="column",w.style.gap="8px";const f=document.createElement("input");f.type="text",f.placeholder="Tìm kiếm "+l+"...",f.style.padding="6px",f.style.border="1px solid rgba(0,0,0,0.2)",f.style.borderRadius="3px",f.style.outline="none",f.style.background="#fff",f.style.fontSize="12px",f.style.width="100%",w.appendChild(f);const v=document.createElement("div");v.style.maxHeight="200px",v.style.overflowY="auto",v.style.border="1px solid rgba(0,0,0,0.2)",v.style.borderRadius="4px",v.style.display="none",v.style.background="#fff",v.style.color="#333",v.style.position="absolute",v.style.top="32px",v.style.left="0",v.style.right="0",v.style.zIndex="9999",v.style.boxShadow="0 4px 6px -1px rgba(0, 0, 0, 0.1)",w.appendChild(v);const y=document.createElement("div");y.style.marginTop="8px",y.style.paddingTop="8px",y.style.display="none";const P=document.createElement("div");P.innerText="Đã chọn:",P.style.fontSize="11px",P.style.fontWeight="bold",P.style.marginBottom="6px",P.style.opacity="0.7",y.appendChild(P);const E=document.createElement("div");E.style.display="flex",E.style.flexWrap="wrap",E.style.gap="6px",y.appendChild(E),w.appendChild(y);const T=()=>{let I=m.get(e)||[];if(typeof I=="string")try{I=JSON.parse(I)}catch{I=I.split(",").map(H=>H.trim()).filter(H=>!!H)}return Array.isArray(I)?I:[I]},B=()=>{E.innerHTML="";const I=T();I.length===0?y.style.display="none":y.style.display="block",I.forEach(H=>{const Q=_[H]||`Đang tải... (ID: ${H})`,D=document.createElement("div");D.style.display="inline-flex",D.style.alignItems="center",D.style.padding="2px 6px",D.style.background="#f3f4f6",D.style.color="#374151",D.style.fontSize="11px",D.style.borderRadius="4px",D.style.border="1px solid #e5e7eb",D.title=Q;{const V=document.createElement("a");V.href=a.replace(":id",H),V.target="_blank",V.innerHTML="&#9998;",V.style.cursor="pointer",V.style.marginRight="4px",V.style.fontSize="12px",V.style.color="#3b82f6",V.style.textDecoration="none",D.appendChild(V)}const j=document.createElement("span");j.innerText=Q.length>25?Q.substring(0,25)+"...":Q,j.style.marginRight="4px";const G=document.createElement("span");G.innerHTML="&times;
1615",G.style.cursor="pointer",G.style.fontWeight="bold",G.onclick=()=>{const V=I.filter(q=>q!==H);b.set("value",V),m.set(e,V),B()},D.appendChild(j),D.appendChild(G),E.appendChild(D)})},z=T();B(),z.length&&fetch(i(z)).then(I=>I.json()).then(I=>{p(I).forEach(Q=>{_[Q._id||Q.id]=C(Q.title||Q.name||"")}),B()}).catch(I=>console.log("Lỗi tải dữ liệu:",I));const Y=I=>{v.innerHTML="";const H=I?`${s}&keyword=${encodeURIComponent(I)}`:s;fetch(H).then(Q=>Q.json()).then(Q=>{v.innerHTML="";const D=p(Q),j=T(),G=D.filter(V=>!j.includes(V._id||V.id));if(G.length)G.forEach(V=>{const q=V._id||V.id;_[q]=C(V.title||V.name||"");const O=document.createElement("div");O.innerText=_[q],O.style.padding="8px",O.style.cursor="pointer",O.style.fontSize="12px",O.style.borderBottom="1px solid #f3f4f6",O.addEventListener("mouseover",()=>O.style.background="#f3f4f6"),O.addEventListener("mouseout",()=>O.style.background="transparent"),O.addEventListener("click",()=>{const de=T();if(!de.includes(q)){const ye=[...de,q];b.set("value",ye),m.set(e,ye),t.forEach(Ce=>{m.set(Ce,Array.isArray(m.get(Ce))?[]:null)}),B()}v.style.display="none",f.value=""}),v.appendChild(O)});else{const V=document.createElement("div");V.innerText="Không tìm thấy kết quả",V.style.padding="8px",V.style.fontSize="12px",V.style.color="#6b7280",v.appendChild(V)}v.style.display="block"}).catch(Q=>{console.log("Lỗi tìm kiếm:",Q),v.style.display="none"})};let J;return f.addEventListener("input",I=>{const H=I.target.value;clearTimeout(J),J=setTimeout(()=>Y(H),300)}),f.addEventListener("focus",()=>{Y(f.value)}),f.addEventListener("click",()=>{Y(f.value)}),document.addEventListener("click",I=>{w.contains(I.target)||(v.style.display="none")}),w}}),o={showRating:!0,showSaleOff:!0,showTagSaleOff:!0,showNameTeacher:!0,pageSize:6,colorTextTab:"#1F7CFF",colorTextTabActive:"#ffffff",bgColorTextTabActive:"#1F7CFF",fontSizeTitleCardCourse:20,colorTitleCardCourse:"#374151",fontSizeStarCardCourse:14,colorStarCardCourse:"#f59e0b",fontSizePriceSaleCardCourse:22,colorPriceSaleCardCourse:"#6b7280",fontSizePriceCardCourse:13,colorPriceCardCourse:"#6b7280",fontSizeTagSaleOffCardCourse:12,colorBgTagSaleOffCardCourse:"#e11d48",fontSizeTeacherNameCardCourse:16,colorTeacherNameCardCourse:"#6b7280",fontSizeInformationCardCourse:13,colorInformationCardCourse:"#004085",bgColorInformationCardCourse:"#cce5ff",categoryIds:[],widthCardProduct:350},c={id:"categoryGeneral",label:"Chung",open:!0},r={id:"categoryStyle",label:"Thiết kế",open:!1},h=[{type:"number",label:"Số lượng khoá học mỗi tab",name:"pageSize",changeProp:!0,category:c,min:1,max:20},{type:"select-data-category",label:"Danh mục",name:"dataCategory",changeProp:!0,category:c}],u=[{type:"number",label:"Chiều rộng của card item",name:"widthCardProduct",changeProp:!0,category:r,min:100,max:650},{type:"color",label:"Màu chữ tab",name:"colorTextTab",changeProp:!0,category:r},{type:"color",label:"Màu chữ tab khi active",name:"colorTextTabActive",changeProp:!0,category:r},{type:"color",label:"Màu nền tab khi active",name:"bgColorTextTabActive",changeProp:!0,category:r},{type:"number",label:"Cỡ chữ tiêu đề",name:"fontSizeTitleCardCourse",changeProp:!0,category:r},{type:"color",label:"Màu tiêu đề",name:"colorTitleCardCourse",changeProp:!0,category:r},{type:"checkbox",label:"Đánh giá",name:"showRating",changeProp:!0,category:r},{type:"number",label:"Cỡ chữ đánh giá",name:"fontSizeStarCardCourse",changeProp:!0,category:r},{type:"color",label:"Màu đánh giá",name:"colorStarCardCourse",changeProp:!0,category:r},{type:"checkbox",label:"Giảm giá",name:"showSaleOff",changeProp:!0,category:r},{type:"number",label:"Cỡ chữ giá bán",name:"fontSizePriceSaleCardCourse",changeProp:!0,category:r},{type:"color",label:"Màu chữ giá bán",name:"colorPriceSaleCardCourse",changeProp:!0,category:r},{type:"number",label:"Cỡ chữ giá gốc",name:"fontSizePriceCardCourse",changeProp:!0,category:r},{type:"color",label:"Màu chữ giá gốc",name:"colorPriceCardCourse",changeProp:!0,category:r},{type:"checkbox",label:"Nhãn % giảm giá",name:"showTagSaleOff",changeProp:!0,category:r},{type:"number",label:"Cỡ chữ nhãn giảm giá",name:"fontSizeTagSaleOffCardCourse",changeProp:!0,category:r},{type:"color",label:"Màu nền nhãn giảm giá",name:"colorBgTagSaleOffCardCourse",changeProp:!0,category:r}
1615,{type:"checkbox",label:"Tên giảng viên",name:"showNameTeacher",changeProp:!0,category:r},{type:"number",label:"Cỡ chữ tên giảng viên",name:"fontSizeTeacherNameCardCourse",changeProp:!0,category:r},{type:"color",label:"Màu tên giảng viên",name:"colorTeacherNameCardCourse",changeProp:!0,category:r}];n.BlockManager.add("products-3",{media:'<img src="/images/builder/sections/product/mau-3.png" alt="Product List Tabs">',label:"Mẫu 3: Tabs",category:"default-product",content:`<div style="padding: 20px 0;">
1616      <div style="margin-bottom: 15px; text-align: center; font-weight: bold; font-size: 1.5rem; color: #314158;">CÁC KHOÁ HỌC NỔI BẬT</div>
1617      <div data-gjs-type="Product3"></div>
1618    </div>`}),d.addType("Product3",{model:{defaults:{tagName:"div",draggable:!0,droppable:!1,attributes:{class:"products-3"},...o,"script-props":[...Object.keys(o)],components:"<p>Chọn danh mục...</p>",traits:[...h,...u],style:{"font-family":"Roboto, sans-serif",padding:"15px 0"},script:function(l){if(!l)return;function e(m){return`<a href="/${m.url}" style="width: 100%; max-width: ${l.widthCardProduct}px; margin: 0 auto; position: relative; text-decoration: none; background-color: #fff; border-radius: 10px; overflow: hidden; box-shadow: 0 4px 30px rgba(19, 28, 25, 0.1); display: flex; flex-direction: column;">
1619              <!-- Giảm giá -->
1620              ${!m.no_retail&&m.show_tag_sale_off&&s(m.price_origin||0,m.price_sale||0)!==0?`<div style="position: absolute; background-color: ${l.colorBgTagSaleOffCardCourse}; color: #fff; padding: 0.125rem 0.5rem; font-size: ${l.fontSizeTagSaleOffCardCourse}px; font-weight: bold; border-radius: 0.25rem; top: 5px; left: 5px">
1621                  ${s(m.price_origin||0,m.price_sale||0)}%
1622              </div>`:""}
1623              <!-- Hình ảnh -->
1624              <img style="aspect-ratio: 5 / 3; object-fit: cover; width: 100%;" src="${m.image}" alt="${m.name}" loading="lazy">
1625              <!-- Nội dung sản phẩm -->
1626              <div style="padding: 15px; display: flex; flex-direction: column; flex-grow: 1;">
1627                <h5 style="font-size: ${l.fontSizeTitleCardCourse}px; font-weight: bold; color: ${l.colorTitleCardCourse}; margin: 0 0 0.5rem; flex-grow: 1;">${m.name}</h5>
1628                ${m.show_teacher_name?`<p style="font-size: ${l.fontSizeTeacherNameCardCourse}px; color: ${l.colorTeacherNameCardCourse}; margin: 0 0 0.5rem;">${m.teacher_name}</p>`:""}
1629                <!-- Đánh giá sao -->
1630                ${m.show_rating||m.rating_avg&&m.rating_avg>0?`<div style="display: flex; align-items: center; font-size: ${l.fontSizeTagSaleOffCardCourse}px; color: ${l.colorStarCardCourse};">
1631                    ${i(m.rating_avg||0)} <span style="color: #6b7280; margin-left: 0.25rem; font-size: ${l.fontSizeStarCardCourse}px;">(${m.rating_count||0} đánh giá)</span>
1632                </div>`:""}
1633                <!-- Giá sản phẩm -->
1634                ${m.no_retail?"":`<div style="margin-top: 0.5rem;">
1635                  <span style="color: ${l.colorPriceCardCourse}; font-size: ${l.fontSizePriceSaleCardCourse}px; font-weight: 700; margin-right: 5px;">${m.price_sale>0?`${t(m.price_sale)}</span>`:"Miễn phí"}</span>
1636                  ${m.show_sale_off&&m.price_origin&&m.price_origin>0&&m.price_sale&&m.price_sale!==m.price_origin?`<span style="text-decoration: line-through; font-size: ${l.fontSizePriceCardCourse}px; margin-right: 0.5rem; color: ${l.colorPriceCardCourse};">${t(m.price_origin)}</span>`:""}
1637                </div>`}
1638              </div>
1639            </a>`}function t(m){return new Intl.NumberFormat("vi-VN",{style:"currency",currency:"VND",minimumFractionDigits:0}).format(m).replace(/\s/g,"")}function s(m,_){return m?Math.round((_-m)/m*100):0}function i(m){const _="★".repeat(Math.round(m)),C="☆".repeat(5-Math.round(m));return _+C}function a(m){let _=0;for(const C of Array(5).keys()){const w=`rating_${C+1}`;m[w]!==void 0&&(_+=m[w])}return _}const p={show_rating:!!l?.showRating,show_sale_off:!!l?.showSaleOff,show_tag_sale_off:!!l?.showTagSaleOff,show_teacher_name:!!l?.showNameTeacher,teacher_name:""};this.innerHTML="Chọn danh mục...";const b='<div style="text-align: center;"><svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewB
1639ox="0 0 24 24"><path fill="currentColor" d="M11.001 10h2v5h-2zM11 16h2v2h-2z"/><path fill="currentColor" d="M13.768 4.2C13.42 3.545 12.742 3.138 12 3.138s-1.42.407-1.768 1.063L2.894 18.064a1.99 1.99 0 0 0 .054 1.968A1.98 1.98 0 0 0 4.661 21h14.678c.708 0 1.349-.362 1.714-.968a1.99 1.99 0 0 0 .054-1.968zM4.661 19L12 5.137L19.344 19z"/></svg><p>Có lỗi xảy ra khi tải dữ liệu.</p></div>';if(l.categoryIds.length){const m=new URLSearchParams;m.append("limit",`${l.pageSize}`),l.categoryIds.forEach(_=>m.append("category_ids[]",_)),fetch(`/api/v1/courses/get-by-category-for-builder?${m}`,{}).then(_=>_.json()).then(_=>{const C=_?.data||_,w=`
1640                  <style>
1641                    .box-tab .tab-list {
1642                      margin-bottom: 30px;
1643                      display: flex;
1644                      align-items: center;
1645                      justify-content: center;
1646                      gap: 20px;
1647                    }
1648                    .box-tab .tab-list .tab-item {
1649                      padding: 6px 12px;
1650                      color: ${l.colorTextTab};
1651                      border-radius: 6px;
1652                      cursor: pointer;
1653                    }
1654                    .box-tab .tab-list .tab-item.active {
1655                      background-color: ${l.bgColorTextTabActive};
1656                      color: ${l.colorTextTabActive};
1657                    }
1658                    .grid-custom {
1659                      display: grid;
1660                      grid-template-columns: repeat(auto-fit, minmax(350px, max-content));
1661                      justify-content: center;
1662                      gap: 1.5rem;
1663                      max-width: 100%;
1664                    }
1665                    @media (max-width: 1025px) {
1666                      .grid-custom a {
1667                        max-width: 100%;
1668                      }
1669                    }
1670                    @media (max-width: 575px) {
1671                      .grid-custom {
1672                        grid-template-columns: 1fr;
1673                      }
1674                    }
1675                  </style>
1676                `;let x="",f="";C.forEach((v,y)=>{x+=`<div id="tab-${v.category_id}" class="tab-item ${y===0?"active":""}">${v.category_name}</div>`;let P="";v.courses.forEach(E=>{P+=e({...p,name:E.name,url:E.url,image:E.thumbnail_url||"",teacher_name:E.teacher?.fullname??"",price_sale:E.price_sell,price_origin:E.price,rating_avg:E.avgRating||0,rating_count:a(E),no_retail:E.no_retail})}),P||(P='<div style="text-align: center; padding: 20px 0; font-style: italic; color: gray; font-size: 14px;">Chưa có khoá học nào</div>'),f+=`<div id="tab-content-item-${v.category_id}" class="tab-content-item" style="${y===0?"":"display: none;"}"><div class="grid-custom">${P}</div></div>`}),this.innerHTML=`${w}
1677                <div class="box-tab">
1678                  <div class="tab-list">${x}</div>
1679                  <div class="tab-content">${f}</div>
1680                </div>`,l.categoryIds.forEach(v=>{document.getElementById(`tab-${v}`)?.addEventListener("click",()=>{document.querySelectorAll(".tab-item").forEach(y=>{y.classList.remove("active")}),document.querySelectorAll(".tab-content-item").forEach(y=>{y.style.display="none"}),document.getElementById(`tab-${v}`)?.classList.add("active"),document.getElementById(`tab-content-item-${v}`)?.removeAttribute("style")})})}).catch(_=>{console.log(_),this.innerHTML=b})}}}},view:{onRender({el:l,model:e}){const t=e.get("script");if(t)try{const s=new Function("return "+t).call(l);typeof s=="function"?s.call(l):console.error("Script does not return a valid function.")}catch(s){console.error("Error executing script:",s)}}}}
1680),n.Traits.addType("select-data-category",g("danh mục","categoryIds",[],"/api/v1/categories/all?limit=50",l=>"/api/v1/courses/all?limit=50&"+l.map(e=>`ids[]=${e}`).join("&"),"/admin/courses/:id",l=>l.data||l))}function al(n){const d=n.DomComponents,g={fontSizeTitleBlog:16,colorTitleBlog:"#374151",fontSizeDescriptionBlog:14,colorDescriptionBlog:"#5e656f",blogIds:[],typeDisplay:"grid",widthCardProduct:350},o={id:"catGeneral",label:"Chung",open:!0},c={id:"catStyle",label:"Thiết kế",open:!0},r=[{type:"select-data-blog",label:"Blog",name:"dataBlog",changeProp:!0,category:o}],h=[{type:"number",label:"Chiều rộng của card item",name:"widthCardProduct",changeProp:!0,category:c,min:100,max:650},{type:"select-type-display",label:"Kiểu hiển thị",name:"typeDisplay",changeProp:!0,category:c},{type:"number",label:"Cỡ chữ tiêu đề",name:"fontSizeTitleBlog",changeProp:!0,category:c},{type:"color",label:"Màu tiêu đề",name:"colorTitleBlog",changeProp:!0,category:c},{type:"number",label:"Cỡ chữ mô tả",name:"fontSizeDescriptionBlog",changeProp:!0,category:c},{type:"color",label:"Màu chữ mô tả",name:"colorDescriptionBlog",changeProp:!0,category:c}];d.addType("Blog",{model:{defaults:{tagName:"div",draggable:!0,droppable:!1,attributes:{class:"blogs"},...g,"script-props":[...Object.keys(g)],components:"<p>Chọn blog...</p>",traits:[...r,...h],style:{"font-family":"Roboto, sans-serif",padding:"15px 0"},script:function(l){if(!l)return;function e(i){return l.typeDisplay==="list"?`<a href="/blog/${i.url}" style="width: 100%; max-width: ${l.widthCardProduct}px; margin: 0 auto; position: relative; text-decoration: none; display: flex; flex-direction: column;">
1681                <!-- Hình ảnh -->
1682                <div style="border-radius: 0.5rem; overflow: hidden; margin-right: 10px;">
1683                  <img style="aspect-ratio: 5 / 3; object-fit: cover; width: 300px; height: 100%;" src="${i.image}" alt="${i.title}" loading="lazy">
1684                </div>
1685                <!-- Nội dung sản phẩm -->
1686                <div style="display: flex; flex-direction: column; flex-grow: 1;">
1687                  <h5 style="font-size: ${l.fontSizeTitleBlog}px; font-weight: bold; color: ${l.colorTitleBlog}; margin: 0 0 0.5rem; flex-grow: 1;">${i.title}</h5>
1688                  <p class="line-clamp-2" style="font-size: ${l.fontSizeDescriptionBlog}px; color: ${l.colorDescriptionBlog}; margin: 0 0 0.5rem;">${i.description}</p>
1689                </div>
1690              </a>`:`<a href="/blog/${i.url}" style="width: 100%; max-width: 350px; margin: 0 auto; position: relative; text-decoration: none; display: flex; flex-direction: column;">
1691              <!-- Hình ảnh -->
1692              <div style="border-radius: 0.5rem; overflow: hidden;">
1693                <img style="aspect-ratio: 5 / 3; object-fit: cover; width: 100%; height: 100%;" src="${i.image}" alt="${i.title}" loading="lazy">
1694              </div>
1695              <!-- Nội dung sản phẩm -->
1696              <div style="padding: 0.75rem 0; display: flex; flex-direction: column; flex-grow: 1;">
1697                <h5 style="font-size: ${l.fontSizeTitleBlog}px; font-weight: bold; color: ${l.colorTitleBlog}; margin: 0 0 0.5rem; flex-grow: 1;">${i.title}</h5>
1698                <p class="line-clamp-2" style="font-size: ${l.fontSizeDescriptionBlog}px; color: ${l.colorDescriptionBlog}; margin: 0 0 0.5rem;">${i.description}</p>
1699              </div>
1700            </a>`}this.innerHTML="Chọn blog...";const t='<div style="text-align: center;"><svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 24 24"><path fill="currentColor" d="M11.001 10h2v5h-2zM11 16h2v2h-2z"/><path fill="currentColor" d="M13.768 4.2C13.42 3.545 12.742 3.138 12 3.138s-1.42.407-1.768 1.063L2.894 18.064a1.99 1.99 0 0 0 .054 1.968A1.98 1.98 0 0 0 4.661 21h14.678c.708 0 1.349-.362 1.714-.968a1.99 1.99 0 0 0 .054-1.968zM4.661 19L12 5.137L19.344 19z"/></svg><p>Có lỗi xảy ra khi tải dữ liệu.</p></div>',s=new URLSearchParams;l.blogIds.length&&l.blogIds.forEach(i=>s.append("ids[]",i)),fetch(`/api/v1/blogs/all?${s}`,{}).then(i=>i.json()).then(i=>{const a=i.data||i;let p=`
1701                <style>
1702                  .grid-custom {
1703                    display: grid;
1704                    grid-template-columns: repeat(auto-fit, minmax(350px, max-content));
1705                    justify-content: center;
1706                    gap: 1.5rem;
1707                    max-width: 100%;
1708                  }
1709                  .line-clamp-2 {
1710                    overflow: hidden;
1711                    display: -webkit-box;
1712                    -webkit-box-orient: vertical;
1713                    -webkit-line-clamp: 2;
1714                  }
1715                  @media (max-width: 1025px) {
1716                    .grid-custom a {
1717                      max-width: 100%;
1718                    }
1719                  }
1720                  @media (max-width: 575px) {
1721                    .grid-custom {
1722                      grid-template-columns: 1fr;
1723                    }
1724                  }
1725                </style>
1726                <div class="grid-custom">
1727              `;l.typeDisplay==="list"&&(p="<div>"),a.forEach(b=>{p+=e({title:b.title,url:b.url,image:b.thumbnail_url||"",description:b.description||""})}),p+="</div>",this.innerHTML=p}).catch(i=>{console.log(i),this.innerHTML=t})}}},view:{onRender({el:l,model:e}){const t=e.get("script");
1727if(t)try{const s=new Function("return "+t).call(l);typeof s=="function"?s.call(l):console.error("Script does not return a valid function.")}catch(s){console.error("Error executing script:",s)}}}}),n.BlockManager.add("blog_template_1",{media:'<img src="/images/builder/sections/blog/mau-1.png" alt="Blog">',label:"Mẫu 1",category:"default-blog",content:`<div style="font-family: 'Roboto', sans-serif;">
1728      <div style="display: flex; align-items: center; justify-content: space-between;">
1729        <div style="font-weight: bold; font-size: 1.5rem; color: #314158;">BLOG</div>
1730        <a href="/blog" style="display: flex; align-items: center; text-decoration: none; color: #233544;">
1731          <span class="display: inline-block; margin-right: 5px;">Xem thêm</span>
1732          <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="m9 5l6 7l-6 7"/></svg>
1733        </a>
1734      </div> 
1735      <div data-gjs-type="Blog"></div>
1736    </div>`});const u={};n.Traits.addType("select-data-blog",{createInput({trait:l,component:e}){const t=document.createElement("div");t.classList.add("custom-search-trait-container");const s=document.createElement("style");s.innerHTML=`
1737          .gjs-trt-trait:has(.custom-search-trait-container) {
1738            flex-wrap: wrap !important;
1739            height: auto !important;
1740          }
1741          .gjs-trt-trait:has(.custom-search-trait-container) .gjs-label-wrp,
1742          .gjs-trt-trait:has(.custom-search-trait-container) .gjs-label {
1743            flex: 1 1 100% !important;
1744            width: 100% !important;
1745            max-width: 100% !important;
1746            border-bottom: none !important;
1747            margin-bottom: 4px !important;
1748          }
1749          .gjs-trt-trait:has(.custom-search-trait-container) .gjs-field-wrp,
1750          .gjs-trt-trait:has(.custom-search-trait-container) .gjs-field {
1751            flex: 1 1 100% !important;
1752            width: 100% !important;
1753            max-width: 100% !important;
1754            border: none !important;
1755            background-color: transparent !important;
1756            box-shadow: none !important;
1757          }
1758        `,t.appendChild(s),t.style.display="flex",t.style.flexDirection="column",t.style.gap="8px",t.style.position="relative";const i=y=>{const P=document.createElement("textarea");return P.innerHTML=y,P.value},a=document.createElement("input");a.type="text",a.placeholder="Tìm kiếm bài viết...",a.style.padding="6px",a.style.border="1px solid rgba(0,0,0,0.2)",a.style.borderRadius="3px",a.style.outline="none",a.style.background="#fff",a.style.fontSize="12px",a.style.width="100%",t.appendChild(a);const p=document.createElement("div");p.style.maxHeight="200px",p.style.overflowY="auto",p.style.border="1px solid rgba(0,0,0,0.2)",p.style.borderRadius="4px",p.style.display="none",p.style.background="#fff",p.style.color="#333",p.style.position="absolute",p.style.top="32px",p.style.left="0",p.style.zIndex="10",p.style.width="100%",p.style.boxShadow="0 4px 6px rgba(0,0,0,0.3)",t.appendChild(p);const b=document.createElement("div");b.style.marginTop="8px",b.style.width="100%";const m=document.createElement("div");m.innerText="Đã chọn:",m.style.fontSize="11px",m.style.fontWeight="bold",m.style.marginBottom="6px",m.style.opacity="0.7",b.appendChild(m);const _=document.createElement("div");_.style.display="flex",_.style.flexWrap="wrap",_.style.gap="6px",b.appendChild(_),t.appendChild(b);let C;const w=()=>{let y=e.get("blogIds")||[];if(typeof y=="string")try{y=JSON.parse(y)}catch{y=y.split(",").map(P=>P.trim()).filter(P=>!!P)}return Array.isArray(y)?y:[y]},x=()=>{_.innerHTML="";const y=w();y.length===0?b.style.display="none":b.style.display="block",y.forEach(P=>{const E=u[P]||`Đang tải... (ID: ${P})`,T=document.createElement("div");T.style.display="flex",T.style.alignItems="center",T.style.background="rgba(110, 110, 110, 0.1)",T.style.padding="4px 8px",T.style.borderRadius="4px",T.style.fontSize="12px",T.style.gap="6px",T.style.border="1px solid rgba(0,0,0,0.1)";const B=document.createElement("a");B.href=`/admin/news/${P}`,B.target="_blank",B.style.color="#3b82f6",B.style.display="flex",B.style.alignItems="center",B.title="Chỉnh sửa bài viết",B.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24">
1758<path fill="currentColor" d="M3 17.25V21h3.75L17.81 9.94l-3.75-3.75zM20.71 7.04a.996.996 0 0 0 0-1.41l-2.34-2.34a.996.996 0 0 0-1.41 0l-1.83 1.83l3.75 3.75z"/></svg>',T.appendChild(B);const z=document.createElement("span");z.innerText=E,z.title=E,z.style.maxWidth="150px",z.style.overflow="hidden",z.style.textOverflow="ellipsis",z.style.whiteSpace="nowrap",T.appendChild(z);const Y=document.createElement("span");Y.innerHTML="&times;",Y.style.cursor="pointer",Y.style.color="#ff6b6b",Y.style.fontWeight="bold",Y.onclick=()=>{const J=y.filter(I=>I!==P);l.set("value",J),e.set("blogIds",J),x()},T.appendChild(Y),_.appendChild(T)})},f=w();x(),f.length&&fetch("/api/v1/blogs/all?limit=50&"+f.map(y=>`ids[]=${y}`).join("&")).then(y=>y.json()).then(y=>{(y.data||y).forEach(E=>{u[E._id]=i(E.title)}),x()}).catch(y=>console.log("Không tải được tiêu đề blog:",y)),e.on("change:blogIds",()=>{x()});const v=y=>{const P=y?`/api/v1/blogs/all?limit=20&search=${encodeURIComponent(y)}`:"/api/v1/blogs/all?limit=20";fetch(P).then(E=>E.json()).then(E=>{const T=E.data||E;if(p.innerHTML="",T.length===0){const B=document.createElement("div");B.style.padding="8px 12px",B.style.fontSize="12px",B.style.color="#aaa",B.innerText="Không tìm thấy kết quả",p.appendChild(B),p.style.display="block";return}T.forEach(B=>{const z=document.createElement("div");z.style.padding="8px 12px",z.style.cursor="pointer",z.style.fontSize="12px",z.style.borderBottom="1px solid #f3f4f6",z.innerText=i(B.title),z.addEventListener("mouseover",()=>z.style.background="#f3f4f6"),z.addEventListener("mouseout",()=>z.style.background="transparent"),z.onclick=()=>{const Y=w();if(!Y.includes(B._id)){const J=[...Y,B._id];u[B._id]=i(B.title),l.set("value",J),e.set("blogIds",J),x()}p.style.display="none",a.value=""},p.appendChild(z)}),p.style.display="block"}).catch(E=>{console.log("Lỗi tìm kiếm blog:",E),p.style.display="none"})};return a.addEventListener("input",y=>{clearTimeout(C);const E=y.target.value.trim();C=setTimeout(()=>v(E),300)}),a.addEventListener("focus",()=>{v(a.value.trim())}),a.addEventListener("click",()=>{v(a.value.trim())}),document.addEventListener("click",y=>{t.contains(y.target)||(p.style.display="none")}),t}}),n.Traits.addType("select-type-display",{createInput({trait:l}){const e=l.get("options")||[],t=e.length?e:[{id:"grid",label:"Dạng lưới"},{id:"list",label:"Dạng danh sách"}],s=document.createElement("div");return s.innerHTML=`<select class="select-data-type__type-display">
1759        ${t.map(i=>`<option value="${i.id}">${i.label}</option>`).join("")}
1760      </select>`,s},onEvent({elInput:l,component:e}){const t=l.querySelector(".select-data-type__type-display");e.set("typeDisplay",t.value)}})}function ol(n){const d=n.DomComponents,g={fontSizeTitleBlog:16,colorTitleBlog:"#374151",fontSizeDescriptionBlog:14,colorDescriptionBlog:"#5e656f",blogIds:[],typeDisplay:"grid",widthCardProduct:350},o={id:"catGeneral",label:"Chung",open:!0},c={id:"catStyle",label:"Thiết kế",open:!0},r=[{type:"select-data-blog",label:"Blog",name:"dataBlog",changeProp:!0,category:o}],h=[{type:"number",label:"Chiều rộng của card item",name:"widthCardProduct",changeProp:!0,category:c,min:100,max:650},{type:"select-type-display",label:"Kiểu hiển thị",name:"typeDisplay",changeProp:!0,category:c},{type:"number",label:"Cỡ chữ tiêu đề",name:"fontSizeTitleBlog",changeProp:!0,category:c},{type:"color",label:"Màu tiêu đề",name:"colorTitleBlog",changeProp:!0,category:c},{type:"number",label:"Cỡ chữ mô tả",name:"fontSizeDescriptionBlog",changeProp:!0,category:c},{type:"color",label:"Màu chữ mô tả",name:"colorDescriptionBlog",changeProp:!0,category:c}];d.addType("Blog2",{model:{defaults:{tagName:"div",draggable:!0,droppable:!1,attributes:{class:"blogs"},...g,"script-props":[...Object.keys(g)],components:"<p>Chọn blog...</p>",traits:[...r,...h],style:{"font-family":"Roboto, sans-serif",padding:"15px 0"},script:function(l){if(!l)return;function e(i){return l.typeDisplay==="list"?`<a href="/blog/${i.url}" style="width: 100%; max-width: ${l.widthCardProduct}px; margin: 0 auto; position: relative; text-decoration: none;background-color: #fff; box-shadow: 0 4px 30px rgba(19, 28, 25, 0.1); border-radius: 10px; overflow: hidden; display: flex; flex-direction: column;">
1761                <!-- Hình ảnh -->
1762                <div style="overflow: hidden; margin-right: 10px;">
1763                  <img style="aspect-ratio: 5 / 3; object-fit: cover; width: 300px; height: 100%;" src="${i.image}" alt="${i.title}" loading="lazy">
1764                </div>
1765                <!-- Nội dung sản phẩm -->
1766                <div style="display: flex; flex-direction: column; flex-grow: 1;">
1767                  <h5 style="font-size: ${l.fontSizeTitleBlog}px; font-weight: bold; color: ${l.colorTitleBlog}; margin: 0 0 0.5rem; flex-grow: 1;">${i.title}</h5>
1768                  <p class="line-clamp-2" style="font-size: ${l.fontSizeDescriptionBlog}px; color: ${l.colorDescriptionBlog}; margin: 0 0 0.5rem; line-height: 1.5;">${i.description}</p>
1769                </div>
1770              </a>`:`<a href="/blog/${i.url}" style="width: 100%; max-width: 350px; margin: 0 auto; position: relative; text-decoration: none;background-color: #fff; box-shadow: 0 4px 30px rgba(19, 28, 25, 0.1); border-radius: 10px; overflow: hidden; display: flex; flex-direction: column;">
1771              <!-- Hình ảnh -->
1772              <div style="overflow: hidden;">
1773                <img style="aspect-ratio: 5 / 3; object-fit: cover; width: 100%; height: 100%;" src="${i.image}" alt="${i.title}" loading="lazy">
1774              </div>
1775              <!-- Nội dung sản phẩm -->
1776              <div style="padding: 0.75rem; display: flex; flex-direction: column; flex-grow: 1;">
1777                <h5 style="font-size: ${l.fontSizeTitleBlog}px; font-weight: bold; color: ${l.colorTitleBlog}; margin: 0 0 0.5rem; flex-grow: 1;">${i.title}</h5>
1778                <p class="line-clamp-2" style="font-size: ${l.fontSizeDescriptionBlog}px; color: ${l.colorDescriptionBlog}; margin: 0 0 0.5rem; line-height: 1.5;">${i.description}</p>
1779              </div>
1780            </a>`}this.innerHTML="Chọn blog...";const t='<div style="text-align: center;"><svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewB
1780ox="0 0 24 24"><path fill="currentColor" d="M11.001 10h2v5h-2zM11 16h2v2h-2z"/><path fill="currentColor" d="M13.768 4.2C13.42 3.545 12.742 3.138 12 3.138s-1.42.407-1.768 1.063L2.894 18.064a1.99 1.99 0 0 0 .054 1.968A1.98 1.98 0 0 0 4.661 21h14.678c.708 0 1.349-.362 1.714-.968a1.99 1.99 0 0 0 .054-1.968zM4.661 19L12 5.137L19.344 19z"/></svg><p>Có lỗi xảy ra khi tải dữ liệu.</p></div>',s=new URLSearchParams;l.blogIds.length&&l.blogIds.forEach(i=>s.append("ids[]",i)),fetch(`/api/v1/blogs/all?${s}`,{}).then(i=>i.json()).then(i=>{const a=i.data||i;let p=`
1781                <style>
1782                  .grid-custom {
1783                    display: grid;
1784                    grid-template-columns: repeat(auto-fit, minmax(350px, max-content));
1785                    justify-content: center;
1786                    gap: 1.5rem;
1787                    max-width: 100%;
1788                  }
1789                  .line-clamp-2 {
1790                    overflow: hidden;
1791                    display: -webkit-box;
1792                    -webkit-box-orient: vertical;
1793                    -webkit-line-clamp: 2;
1794                  }
1795                  @media (max-width: 1025px) {
1796                    .grid-custom a {
1797                      max-width: 100%;
1798                    }
1799                  }
1800                  @media (max-width: 575px) {
1801                    .grid-custom {
1802                      grid-template-columns: 1fr;
1803                    }
1804                  }
1805                </style>
1806                <div class="grid-custom">
1807              `;l.typeDisplay==="list"&&(p="<div>"),a.forEach(b=>{p+=e({title:b.title,url:b.url,image:b.thumbnail_url||"",description:b.description||""})}),p+="</div>",this.innerHTML=p}).catch(i=>{console.log(i),this.innerHTML=t})}}},view:{onRender({el:l,model:e}){const t=e.get("script");if(t)try{const s=new Function("return "+t).call(l);typeof s=="function"?s.call(l):console.error("Script does not return a valid function.")}catch(s){console.error("Error executing script:",s)}}}}),n.BlockManager.add("blog2",{media:'<img src="/images/builder/sections/blog/mau-2.png" alt="Blog">',label:"Mẫu 2",category:"default-blog",content:`<div style="font-family: 'Roboto', sans-serif;">
1808      <div style="font-weight: bold; font-size: 1.5rem; color: #314158; text-align: center;">BLOG</div>
1809      <div data-gjs-type="Blog2"></div>
1810      <div style="text-align: center; margin-top: 25px;">
1811        <a href="/blog" style="padding: 15px 50px; text-decoration: none; color: #fff; background-color: #2b7fff; font-size: 16px; font-weight: 700; border-radius: 10px;">Xem tất cả</a>
1812      </div>
1813    </div>`});const u={};n.Traits.addType("select-data-blog",{createInput({trait:l,component:e}){const t=document.createElement("div");t.classList.add("custom-search-trait-container");const s=document.createElement("style");s.innerHTML=`
1814          .gjs-trt-trait:has(.custom-search-trait-container) {
1815            flex-wrap: wrap !important;
1816            height: auto !important;
1817          }
1818          .gjs-trt-trait:has(.custom-search-trait-container) .gjs-label-wrp,
1819          .gjs-trt-trait:has(.custom-search-trait-container) .gjs-label {
1820            flex: 1 1 100% !important;
1821            width: 100% !important;
1822            max-width: 100% !important;
1823            border-bottom: none !important;
1824            margin-bottom: 4px !important;
1825          }
1826          .gjs-trt-trait:has(.custom-search-trait-container) .gjs-field-wrp,
1827          .gjs-trt-trait:has(.custom-search-trait-container) .gjs-field {
1828            flex: 1 1 100% !important;
1829            width: 100% !important;
1830            max-width: 100% !important;
1831            border: none !important;
1832            background-color: transparent !important;
1833            box-shadow: none !important;
1834          }
1835        `,t.appendChild(s),t.style.display="flex",t.style.flexDirection="column",t.style.gap="8px",t.style.position="relative";const i=y=>{const P=document.createElement("textarea");return P.innerHTML=y,P.value},a=document.createElement("input");a.type="text",a.placeholder="Tìm kiếm bài viết...",a.style.padding="6px",a.style.border="1px solid rgba(0,0,0,0.2)",a.style.borderRadius="3px",a.style.outline="none",a.style.background="#fff",a.style.fontSize="12px",a.style.width="100%",t.appendChild(a);const p=document.createElement("div");p.style.maxHeight="200px",p.style.overflowY="auto",p.style.border="1px solid rgba(0,0,0,0.2)",p.style.borderRadius="4px",p.style.display="none",p.style.background="#fff",p.style.color="#333",p.style.position="absolute",p.style.top="32px",p.style.left="0",p.style.zIndex="10",p.style.width="100%",p.style.boxShadow="0 4px 6px rgba(0,0,0,0.3)",t.appendChild(p);const b=document.createElement("div");b.style.marginTop="8px",b.style.width="100%";
1835const m=document.createElement("div");m.innerText="Đã chọn:",m.style.fontSize="11px",m.style.fontWeight="bold",m.style.marginBottom="6px",m.style.opacity="0.7",b.appendChild(m);const _=document.createElement("div");_.style.display="flex",_.style.flexWrap="wrap",_.style.gap="6px",b.appendChild(_),t.appendChild(b);let C;const w=()=>{let y=e.get("blogIds")||[];if(typeof y=="string")try{y=JSON.parse(y)}catch{y=y.split(",").map(P=>P.trim()).filter(P=>!!P)}return Array.isArray(y)?y:[y]},x=()=>{_.innerHTML="";const y=w();y.length===0?b.style.display="none":b.style.display="block",y.forEach(P=>{const E=u[P]||`Đang tải... (ID: ${P})`,T=document.createElement("div");T.style.display="flex",T.style.alignItems="center",T.style.background="rgba(110, 110, 110, 0.1)",T.style.padding="4px 8px",T.style.borderRadius="4px",T.style.fontSize="12px",T.style.gap="6px",T.style.border="1px solid rgba(0,0,0,0.1)";const B=document.createElement("a");B.href=`/admin/news/${P}`,B.target="_blank",B.style.color="#3b82f6",B.style.display="flex",B.style.alignItems="center",B.title="Chỉnh sửa bài viết",B.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24"><path fill="currentColor" d="M3 17.25V21h3.75L17.81 9.94l-3.75-3.75zM20.71 7.04a.996.996 0 0 0 0-1.41l-2.34-2.34a.996.996 0 0 0-1.41 0l-1.83 1.83l3.75 3.75z"/></svg>',T.appendChild(B);const z=document.createElement("span");z.innerText=E,z.title=E,z.style.maxWidth="150px",z.style.overflow="hidden",z.style.textOverflow="ellipsis",z.style.whiteSpace="nowrap",T.appendChild(z);const Y=document.createElement("span");Y.innerHTML="&times;",Y.style.cursor="pointer",Y.style.color="#ff6b6b",Y.style.fontWeight="bold",Y.onclick=()=>{const J=y.filter(I=>I!==P);l.set("value",J),e.set("blogIds",J),x()},T.appendChild(Y),_.appendChild(T)})},f=w();x(),f.length&&fetch("/api/v1/blogs/all?limit=50&"+f.map(y=>`ids[]=${y}`).join("&")).then(y=>y.json()).then(y=>{(y.data||y).forEach(E=>{u[E._id]=i(E.title)}),x()}).catch(y=>console.log("Không tải được tiêu đề blog:",y)),e.on("change:blogIds",()=>{x()});const v=y=>{const P=y?`/api/v1/blogs/all?limit=20&search=${encodeURIComponent(y)}`:"/api/v1/blogs/all?limit=20";fetch(P).then(E=>E.json()).then(E=>{const T=E.data||E;if(p.innerHTML="",T.length===0){const B=document.createElement("div");B.style.padding="8px 12px",B.style.fontSize="12px",B.style.color="#aaa",B.innerText="Không tìm thấy kết quả",p.appendChild(B),p.style.display="block";return}T.forEach(B=>{const z=document.createElement("div");z.style.padding="8px 12px",z.style.cursor="pointer",z.style.fontSize="12px",z.style.borderBottom="1px solid #f3f4f6",z.innerText=i(B.title),z.addEventListener("mouseover",()=>z.style.background="#f3f4f6"),z.addEventListener("mouseout",()=>z.style.background="transparent"),z.onclick=()=>{const Y=w();if(!Y.includes(B._id)){const J=[...Y,B._id];u[B._id]=i(B.title),l.set("value",J),e.set("blogIds",J),x()}p.style.display="none",a.value=""},p.appendChild(z)}),p.style.display="block"}).catch(E=>{console.log("Lỗi tìm kiếm blog:",E),p.style.display="none"})};return a.addEventListener("input",y=>{clearTimeout(C);const E=y.target.value.trim();C=setTimeout(()=>v(E),300)}),a.addEventListener("focus",()=>{v(a.value.trim())}),a.addEventListener("click",()=>{v(a.value.trim())}),document.addEventListener("click",y=>{t.contains(y.target)||(p.style.display="none")}),t}}),n.Traits.addType("select-type-display",{createInput({trait:l}){const e=l.get("options")||[],t=e.length?e:[{id:"grid",label:"Dạng lưới"},{id:"list",label:"Dạng danh sách"}],s=document.createElement("div");return s.innerHTML=`<select class="select-data-type__type-display">
1836        ${t.map(i=>`<option value="${i.id}">${i.label}</option>`).join("")}
1837      </select>`,s},onEvent({elInput:l,component:e}){const t=l.querySelector(".select-data-type__type-display");e.set("typeDisplay",t.value)}})}const sl=["https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css","https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css","https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100..900;1,100..900&display=swap","https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap","https://fonts.googleapis.com/css2?family=Open+Sans:ital,wght@0,300..800;1,300..800&display=swap","https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap"];
1837function pr(n){if(typeof n!="string")return"";const d=n.trim();return!d||d==="undefined"||d==="null"?"":d}function ll(n,d,g){const{appendJs:o=!0,appendCss:c=!0,clear:r=!1}={},u=new DOMParser().parseFromString(d,"text/html"),l=Array.from(u.querySelectorAll("style")),e=[];l.forEach(a=>{a.textContent&&e.push(a.textContent),a.remove()});const t=Array.from(u.querySelectorAll("script")),s=[];t.forEach(a=>{const p=pr(a.textContent);!a.src&&p&&s.push(p),a.remove()});const i=u.body.innerHTML.trim();if(r&&(n.DomComponents.clear(),n.CssComposer.clear()),i&&n.addComponents(i),e.length){const a=e.join(`
1838
1839`);c||n.CssComposer.clear(),n.addStyle(a)}if(s.length){const a=n.Pages.getSelected(),p=s.join(`
1840
1841`);if(o){const m=`/*__GJS_JS_${cl(p)}__*/`,_=pr(a.get("js"));_.includes(m)||a.set("js",_?`${_}
1842
1843${m}
1844${p}`:`${m}
1845${p}`)}else a.set("js",p)}}function cl(n){let d=0;for(let g=0;g<n.length;g++)d=(d<<5)-d+n.charCodeAt(g),d|=0;return d.toString(16)}const dl={class:"h-dvh flex"},ul={class:"panel__blocks relative"},pl={class:"w-full h-[43px] flex items-center justify-between px-2 border-b border-[#ededed]"},hl={class:"divide-y divide-[#ededed] text-xs"},fl=["onClick"],gl={class:"leading-none"},ml={class:"absolute top-[42px] left-full w-[300px] h-[calc(100%-42px)] bg-white z-10 border-t border-l border-[#ededed] shadow-[12px_0_6px_-10px_rgb(0_0_0_/_0.1),_0_2px_4px_-2px_rgb(0_0_0_/_0.1)]"},bl={class:"flex items-center gap-5 border-b border-[#ededed] pl-2"},yl=["onClick"],vl={class:"editor-row"},wl={class:"editor-canvas"},xl=["innerHTML"],_l={class:"flex items-center justify-between pt-1"},Cl=["onClick"],kl={class:"mt-1 gjs-content"},Sl={class:"flex w-full justify-between items-center"},El=yt({__name:"Builder",props:{page:{},gjsData:{}},async setup(n){let d,g;const{$t:o}=bt(),c=X(),r=X(),h=n,u=X(h.gjsData??null),l=X(),e=X(!1),t=vr(),{siteId:s,site:i}=wr(t),{$getLocale:a}=bt(),p=Zt(),b=en(),m=sa(),_=X(""),C=[{label:o("pages.builder.detail.block"),icon:"material-symbols-light:layers-outline",class:"layers-container",slot:"block"},{label:o("pages.builder.detail.design"),icon:"material-symbols-light:ink-pen-outline",class:"styles-container",slot:"style"},{label:o("pages.builder.detail.advance"),icon:"material-symbols-light:display-settings-outline",class:"traits-container",slot:"advance"}],w=X("block"),{width:x,height:f}=ca(),v=X(),y=X(),{x:P,y:E}=hi(v,{initialValue:{x:1,y:43},handle:y,onMove:L=>{const S=v.value.getBoundingClientRect();L.y=Math.max(0,Math.min(L.y,f.value-S.height))}}),T=Tt(()=>yi(P.value,{min:0,max:x.value-40})),B=X(),z=X(),Y=X(),{x:J,y:I}=hi(z,{initialValue:{x:void 0,y:43},handle:Y,onMove:L=>{const S=z.value.getBoundingClientRect();L.y=Math.max(0,Math.min(L.y,f.value-S.height))}}),H=Tt(()=>yi(J.value,{min:0,max:x.value-230})),{data:Q}=la("/api/v1/file-management/choose-image",{method:"POST",headers:lt()},"$YGsH50iUKP"),D=X(!1),j=()=>{D.value=!1},G=X(!1),V=Object.values(fn),q=It(Object.fromEntries(V.map(L=>[L,null]))),O=new Set;function de(L,S){!S||O.has(L)||(q[L]=S,O.add(L))}const ye=It(Object.fromEntries(V.map(L=>[L,null]))),Ce=new Set;function Ee(L,S){!S||Ce.has(L)||(ye[L]=S,Ce.add(L))}const Ue=X(""),Te=X(""),Be=X(""),He=X(""),ze=X(!1),We=()=>{ze.value=!1,Ue.value="",Te.value="",Be.value="",He.value=""},{data:Ae}=([d,g]=At(()=>zt("/api/v2/page-blocks/block-shared-to-default",{headers:lt()},"$VfJtCIOpa5")),d=await d,g(),d),{data:De,refresh:Ve}=([d,g]=At(()=>zt("/api/v2/page-blocks/my-blocks",{headers:lt()},"$_k2g65cZuR")),d=await d,g(),d),$e=async()=>{await Ve()};function Qe(L){if(typeof L!="string")return"";const S=L.trim();return!S||S==="undefined"||S==="null"?"":S}function rt(L){const S=L.Pages.getSelected()?.get("js"),U=Qe(S);return`${L.getHtml()}<style>${L.getCss()}</style>${U?`open_script${U}close_script`:""}`}function wt(L){L.Pages.getAll().forEach(S=>{const U=Qe(S.get("js"));S.get("js")!==U&&S.set("js",U)})}async function Z(L){const S=L.getSelected();if(!S)return console.warn("Không có components nào được chọn."),null;const U=S.toHTML();function ne(oe){const ge=[],_e=oe.getClasses(),Xe=oe.getId();
1845return Xe&&ge.push(Xe),oe.components().forEach(_t=>{const Ut=ne(_t);ge.push(...Ut.ids),_e.push(...Ut.classes)}),{ids:ge,classes:_e}}const se=ne(S),ue=[...se.ids.map(oe=>`#${oe}`),...se.classes.map(oe=>`.${oe}`)],ie=[];let le=S.parent();for(;le;){const oe=le.getId();oe&&ie.push(`#${oe}`),le.getClasses().forEach(ge=>ie.push(`.${ge}`)),le=le.parent()}const fe=new Set(["color","font","font-family","font-size","font-style","font-variant","font-weight","letter-spacing","line-height","text-align","text-indent","text-transform","white-space","word-spacing","visibility","cursor","direction","list-style","list-style-type","list-style-position","text-decoration","text-shadow"]),ve=L.getCss(),ee=we().process(ve,{parser:Xi}).root;function be(oe,ge){const _e=ge.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(`${_e}(?=[^\\w-]|$)`).test(oe)}const Le=[],nt=[];if(ee.walkRules(oe=>{if(oe.parent?.type==="atrule"&&oe.parent.name==="media")return;const ge=oe.selector;ge&&ue.some(_e=>be(ge,_e))?Le.push(oe.toString()):ge&&ie.some(_e=>be(ge,_e))&&oe.walkDecls(_e=>{fe.has(_e.prop)&&nt.push(`  ${_e.prop}: ${_e.value};`)})}),ee.walkAtRules("media",oe=>{const ge=[];oe.walkRules(_e=>{const Xe=_e.selector;Xe&&ue.some(_t=>be(Xe,_t))&&ge.push(_e.toString())}),ge.length&&Le.push(`@media ${oe.params} {
1846${ge.join(`
1847`)}
1848}`)}),nt.length){const oe=S.getId(),ge=oe?`#${oe}`:ue[0]||"*",_e=[...new Set(nt)];Le.unshift(`${ge} {
1849${_e.join(`
1850`)}
1851}`)}const Ot=Le.join(`
1852`),Ft=we().process(Ot,{parser:Xi}).root,$t=new Map,Pt=[];Ft.walkRules(oe=>{if(oe.parent?.type==="atrule")return;const ge=$t.get(oe.selector);ge?(oe.walkDecls(_e=>{ge.walkDecls(_e.prop,Xe=>{Xe.remove()}),ge.append(_e.clone())}),Pt.push(oe)):$t.set(oe.selector,oe)}),Pt.forEach(oe=>oe.remove());const jt=Ft.toString(),Ie=[];function Mt(oe){const ge=oe.get("script");ge&&(typeof ge=="function"?Ie.push(ge.toString()):typeof ge=="string"&&Ie.push(ge)),oe.components().forEach(_e=>Mt(_e))}Mt(S);const qt=Ie.join(`
1853
1854`),ht=S.toJSON();return ht.type!==void 0&&ht.type==="Swiper"?{html:U,css:jt,js:qt,gjsData:JSON.stringify(S.toJSON())}:{html:U,css:jt,js:qt,gjsData:""}}async function N(L,S){const U=document.createElement("div");U.style.display="inline-block",U.style.background="transparent";const ne=document.createElement("style");ne.textContent=S,U.appendChild(ne);const se=document.createElement("div");se.innerHTML=L,U.appendChild(se),document.body.appendChild(U),await new Promise(ue=>setTimeout(ue,100));try{const ue=await $s(U,{skipFonts:!0});return document.body.removeChild(U),ue}catch(ue){return console.error("Không thể tạo thumbnail:",ue),document.body.removeChild(U),""}}const Se=async(L,S,U)=>{const ne=L.Blocks,se=Array.from(S.querySelectorAll(".gjs-block"));for(const ue of U){const ie=U.indexOf(ue),le=ue.getId?.()||ue.id||null,fe=se[ie];if(!fe||!le)continue;if(fe.style.position="relative",ue.attributes.attributes.is_share_to_default){const ee=document.createElement("span");let be="#f0b100";ue.attributes.attributes.is_approved===null?ee.innerHTML="Chờ duyệt":ue.attributes.attributes.is_approved?(ee.innerHTML="Đã duyệt",be="#00c951"):(ee.innerHTML="Không duyệt",be="#99a1af"),ee.style.cssText=`
1855        position: absolute;
1856        bottom: 9px;
1857        right: 25px;
1858        padding: 2px 5px;
1859        color: white;
1860        background-color: ${be};
1861        font-size: 10px;
1862        font-weight: 500;
1863        border-radius: 3px;
1864        z-index: 1;
1865      `,fe.appendChild(ee)}else{const ee=document.createElement("span");ee.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 25 25"><path fill="currentColor" fill-rule="evenodd" d="M14.276 2.286a.75.75 0 0 1 .817.162l7 7a.75.75 0 0 1 0 1.06l-7 7a.75.75 0 0 1-1.28-.53V13.18c-4.822.333-8.77 3.845-9.76 8.456a.75.75 0 0 1-1.467 0a12.3 12.3 0 0 1-.273-2.584c0-6.513 5.083-11.84 11.5-12.227V2.979a.75.75 0 0 1 .462-.693m1.037 2.503v2.763a.75.75 0 0 1-.75.75c-5.555 0-10.126 4.214-10.692 9.619a12.25 12.25 0 0 1 10.692-6.266a.75.75 0 0 1 .75.75v2.763l5.189-5.19z" clip-rule="evenodd"/></svg>',ee.title=String(pe(o("pages.builder.block.share_block_to_default"))),ee.style.cssText=`
1866      position: absolute;
1867      bottom: 10px;
1868      right: 25px;
1869      color: blue;
1870      width: 15px;
1871      height: 15px;
1872      cursor: pointer;
1873      font-size: 12px;
1874      z-index: 1;
1875    `,ee.onclick=async()=>{const be=b.create(Gt,{props:{title:String(pe(o("pages.builder.block.share_block_to_default"))),body:`${o("pages.builder.block.confirm_share_block")}`,okText:`${pe(`${o("share")}`)}`,async onConfirm(){await $fetch(`/api/v2/page-blocks/${le}/share-to-default`,{method:"PATCH",onResponse({response:Le}){if(be.close(),Le._data){p.add({description:String(o("share_block_success")),color:"success"}),ee.remove(),fe.appendChild(ee);const nt=document.createElement("span");nt.innerHTML="Chờ duyệt",nt.style.cssText=`
1876                      position: absolute;
1877                      bottom: 9px;
1878                      right: 25px;
1879                      padding: 2px 5px;
1880                      color: white;
1881                      background-color: #f0b100;
1882                      font-size: 10px;
1883                      font-weight: 500;
1884                      border-radius: 3px;
1885                      z-index: 1;
1886                    `,fe.appendChild(nt)}},onResponseError({response:Le}){p.add({description:Le._data?.message??`${pe(`${o("error_occurred")}`)}`,color:"warning"})}})}}});be.open()},fe.appendChild(ee)}const ve=document.createElement("span");ve.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
1886<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="m14.74 9l-.346 9m-4.788 0L9.26 9m9.968-3.21q.512.078 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 0 1-2.244 2.077H8.084a2.25 2.25 0 0 1-2.244-2.077L4.772 5.79m14.456 0a48 48 0 0 0-3.478-.397m-12 .562q.51-.088 1.022-.165m0 0a48 48 0 0 1 3.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a52 52 0 0 0-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a49 49 0 0 0-7.5 0"/></svg>',ve.title=String(pe(o("delete"))),ve.style.cssText=`
1887      position: absolute;
1888      bottom: 10px;
1889      right: 4px;
1890      color: red;
1891      width: 15px;
1892      height: 15px;
1893      cursor: pointer;
1894      font-size: 12px;
1895      z-index: 1;
1896    `,ve.onclick=async()=>{const ee=b.create(Gt,{props:{title:`${pe(`${o("pages.builder.title_confirm_save")}`)}`,body:`${o("pages.builder.block.confirm_delete_block")}`,okText:`${pe(`${o("delete")}`)}`,colorButton:"error",async onConfirm(){await $fetch(`/api/v2/page-blocks/${le}`,{method:"DELETE",onResponse({response:be}){ee.close(),ne.remove(String(le)),fe.remove(),be._data?(p.add({description:String(o("delete_success")),color:"success"}),fi(m.currentRoute.value.path,{replace:!0})):be.status===403&&p.add({description:String(o("pages.builder.not_permission_delete")),color:"error"})},onResponseError({response:be}){p.add({description:be._data?.message??`${pe(`${o("error_occurred")}`)}`,color:"warning"})}})}}});ee.open()},fe.appendChild(ve)}},ke=L=>{const S=L.Blocks,U=S.getAll(),ne=U.filter(se=>{if(!se.getCategoryLabel().includes("default-")&&!Object.values(fn).includes(se.getCategoryLabel()))return se});ne.map(se=>{const ue=se;return se.id==="countdown"&&(ue.attributes.media='<svg xmlns="http://www.w3.org/2000/svg" style="display: block; max-width:22px; margin: 0 auto;" viewBox="0 0 24 24"><path fill="currentColor" d="M14.935 16.223L11.5 12.789V7.923h1v4.464l3.123 3.123zM11.5 6V4h1v2zm6.5 6.5v-1h2v1zM11.5 20v-2h1v2zM4 12.5v-1h2v1zm8.003 8.5q-1.867 0-3.51-.708q-1.643-.709-2.859-1.924t-1.925-2.856T3 12.003t.709-3.51Q4.417 6.85 5.63 5.634t2.857-1.925T11.997 3t3.51.709q1.643.708 2.859 1.922t1.925 2.857t.709 3.509t-.708 3.51t-1.924 2.859t-2.856 1.925t-3.509.709M12 20q3.35 0 5.675-2.325T20 12t-2.325-5.675T12 4T6.325 6.325T4 12t2.325 5.675T12 20m0-8"/></svg>'),se.id==="custom-code"&&(ue.attributes.media='<svg xmlns="http://www.w3.org/2000/svg" style="display: block; max-width:22px; margin: 0 auto;" viewBox="0 0 24 24"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.3" d="M17.25 6.75L22.5 12l-5.25 5.25m-10.5 0L1.5 12l5.25-5.25m7.5-3l-4.5 16.5"/></svg>'),ue}),r.value.appendChild(S.render(ne,{external:!0})),V.forEach(async se=>{const ue=q[se];if(ue){const le=U.filter(ve=>{if(ve.getCategoryLabel().includes("default-")&&ve.getCategoryLabel().split("default-")[1]===se)return ve}),fe=S.render(le,{external:!0});fe&&ue.appendChild(fe)}const ie=ye[se];if(ie){const le=U.filter(ve=>ve.getCategoryLabel()===se),fe=S.render(le,{external:!0});fe&&(await Se(L,fe,le),ie.appendChild(fe))}})};function he(L,S,U=!1){L.BlockManager.remove(U?`default_${S._id}`:S._id),S.gjs_data?L.BlockManager.add(U?`default_${S._id}`:S._id,{category:U?`default-${S.type}`:S.type,label:S.name,media:`<img src="${S.thumbnail}" alt="${S.name}">`,content:S.gjs_data?JSON.parse(S.gjs_data):{},attributes:{is_share_to_default:S.is_share_to_default||!1,is_approved:S.is_approved||null}}):S.js?(L.DomComponents.removeType(`${S.type}-${S.name}`),L.DomComponents.addType(`${S.type}-${S.name}`,{model:{defaults:{components:S.content,script:new Function(`return ${S.js}`)()}}}),L.BlockManager.add(U?`default_${S._id}`:S._id,{category:U?`default-${S.type}`:S.type,label:S.name,media:`<img src="${S.thumbnail}" alt="${S.name}">`,content:{type:`${S.type}-${S.name}`},attributes:{is_share_to_default:S.is_share_to_default||!1,is_approved:S.is_approved||null}})):L.BlockManager.add(U?`default_${S._id}`:S._id,{category:U?`default-${S.type}`:S.type,label:S.name,media:`<img src="${S.thumbnail}" alt="${S.name}">`,content:S.content??"",attributes:{is_share_to_default:S.is_share_to_default||!1,is_approved:S.is_approved||null}})}function ae(L){if(Ae.value){Ae.value.forEach(ne=>{he(L,ne,!0)});const S=L.Blocks,U=S.getAll();Object.values(q).forEach(ne=>{ne&&(ne.innerHTML="")}
1896),V.forEach(async ne=>{const se=q[ne];if(se){const ue=U.filter(le=>{if(le.getCategoryLabel().includes("default-")&&le.getCategoryLabel().split("default-")[1]===ne)return le}),ie=S.render(ue,{external:!0});ie&&se.appendChild(ie)}})}}function Pe(L){if(De.value){De.value.forEach(se=>{he(L,se)});const S=L.Blocks,ne=S.getAll().filter(se=>Object.values(fn).includes(se.getCategoryLabel()));Object.values(ye).forEach(se=>{se&&(se.innerHTML="")}),V.forEach(async se=>{const ue=ye[se];if(ue){const ie=ne.filter(fe=>fe.getCategoryLabel()===se),le=S.render(ie,{external:!0});le&&(await Se(L,le,ie),ue.appendChild(le))}})}}const Ze=X(!1);let te;Mr(()=>{Ze.value=!0,te=ka.init({telemetry:!1,container:c.value,fromElement:h.gjsData=="{}",height:"100%",width:"auto",plugins:[$a,Pa,Ma,La,Ia,Ra,za,Aa,il,rl,al,ol,As,L=>Bs(L,{addBlock:!1}),Ds,Os,Ps,Ms,Ls,Is,Rs,zs,...i.value?.custom_site?.exam_score_ranking?[Ba]:[],Js],storageManager:!1,layerManager:{appendTo:".layers-container"},selectorManager:{appendTo:".styles-container",componentFirst:!0},traitManager:{appendTo:".traits-container"},styleManager:{appendTo:".styles-container"},blockManager:{custom:!0,blocks:Ta},panels:{defaults:Ea},assetManager:{custom:{open(L){l.value=L,e.value=!0},close(){e.value=!1}}},showDevices:!1,i18n:{locale:"vi",messages:{vi:Sa}},canvas:{styles:sl}});for(const L of Da)te.Panels.addPanel(L);u.value&&u.value!="{}"&&(te.loadProjectData(JSON.parse(u.value)),wt(te));for(const L of Oa)te.on(L.event,L.callback);te.on("block:drag:stop",()=>{G.value=!1}),te.on("component:add",L=>{L.set("siteId",s.value),L.set("lang",a())}),te.on("component:selected",L=>{B.value.innerHTML=`${qa(L.attributes.tagName)}#${L.ccid}`;const S=L.get("toolbar")||[],U=[];let ne=[];S.forEach(ie=>{const le=ie;let fe,ve;switch(ie.id||ie.command){case"tlb-move":fe=String(pe(o("pages.builder.block.move"))),ve='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><!-- Icon from Huge Icons by Hugeicons - undefined --><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="m4.875 13.158l2.136 1.83v-9.76a1.752 1.752 0 1 1 3.503 0v5.256l2.99.478c1.931.29 2.896.435 3.576.842c1.123.673 1.937 1.684 1.937 3.16c0 1.027-.254 1.717-.871 3.57c-.392 1.175-.588 1.762-.907 2.227a4 4 0 0 1-2.194 1.582c-.543.156-1.162.156-2.4.156h-1.05c-1.647 0-2.47 0-3.203-.302a4 4 0 0 1-.385-.183c-.697-.379-1.216-1.018-2.255-2.296l-3.361-4.139a1.742 1.742 0 0 1 2.484-2.42M16.919 2.368l.805-.758a.4.4 0 0 1 .273-.108m1.109.866l-.838-.762a.4.4 0 0 0-.271-.104m1.109 7.109l-.806.757a.4.4 0 0 1-.303.108m-1.078-.865l.837.762a.4.4 0 0 0 .24.103m0-7.974v7.974m3.137-5.08l.757.805a.4.4 0 0 1 .109.273m-.866 1.11l.762-.839a.4.4 0 0 0 .104-.271m-7.104 1.11l-.757-.806a.4.4 0 0 1-.108-.304m.865-1.079l-.762.838a.4.4 0 0 0-.103.24m7.969 0h-7.97" color="currentColor"/></svg>';break;case"tlb-clone":fe=String(pe(o("pages.builder.block.duplicate"))),ve='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15.75 17.25v3.375c0 .621-.504 1.125-1.125 1.125h-9.75a1.125 1.125 0 0 1-1.125-1.125V7.875c0-.621.504-1.125 1.125-1.125H6.75a9 9 0 0 1 1.5.124m7.5 10.376h3.375c.621 0 1.125-.504 1.125-1.125V11.25c0-4.46-3.243-8.161-7.5-8.876a9 9 0 0 0-1.5-.124H9.375c-.621 0-1.125.504-1.125 1.125v3.5m7.5 10.375H9.375a1.125 1.125 0 0 1-1.125-1.125v-9.25m12 6.625v-1.875a3.375 3.375 0 0 0-3.375-3.375h-1.5a1.125 1.125 0 0 1-1.125-1.125v-1.5a3.375 3.375 0 0 0-3.375-3.375H9.75"/></svg>';break;case"tlb-delete":fe=String(pe(o("delete"))),ve='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m14.74 9l-.346 9m-4.788 0L9.26 9m9.968-3.21q.512.078 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 0 1-2.244 2.077H8.084a2.25 2.25 0 0 1-2.244-2.077L4.772 5.79m14.456 0a48 48 0 0 0-3.478-.397m-12 .562q.51-.088 1.022-.165m0 0a48 48 0 0 1 3.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a52 52 0 0 0-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a49 49 0 0 0-7.5 0"/></svg>';break;
1896case"toggle-selector-manager":fe=String(pe(o("setting")));break;case"save-my-block":fe=String(pe(o("pages.builder.block.save_my_block")));break;default:fe=String(pe(o("pages.builder.block.choose_parent"))),ve='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="currentColor" fill-rule="evenodd" d="M11.47 2.47a.75.75 0 0 1 1.06 0l7.5 7.5a.75.75 0 1 1-1.06 1.06l-6.22-6.22V21a.75.75 0 0 1-1.5 0V4.81l-6.22 6.22a.75.75 0 1 1-1.06-1.06z" clip-rule="evenodd"/></svg>';break}le.attributes=le.attributes||{},le.attributes.title=fe,ve&&(le.label=ve),U.push(le)}),S.some(ie=>ie.command==="toggle-selector-manager")||(ne=[{command:"toggle-selector-manager",label:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.6"><path d="M9.594 3.94c.09-.542.56-.94 1.11-.94h2.593c.55 0 1.02.398 1.11.94l.213 1.281c.063.374.313.686.645.87q.11.06.22.127c.325.196.72.257 1.075.124l1.217-.456a1.125 1.125 0 0 1 1.37.49l1.296 2.247a1.125 1.125 0 0 1-.26 1.431l-1.003.827c-.293.241-.438.613-.43.992a8 8 0 0 1 0 .255c-.008.378.137.75.43.991l1.004.827c.424.35.534.955.26 1.43l-1.298 2.247a1.125 1.125 0 0 1-1.369.491l-1.217-.456c-.355-.133-.75-.072-1.076.124a7 7 0 0 1-.22.128c-.331.183-.581.495-.644.869l-.213 1.281c-.09.543-.56.94-1.11.94h-2.594c-.55 0-1.019-.398-1.11-.94l-.213-1.281c-.062-.374-.312-.686-.644-.87a7 7 0 0 1-.22-.127c-.325-.196-.72-.257-1.076-.124l-1.217.456a1.125 1.125 0 0 1-1.369-.49l-1.297-2.247a1.125 1.125 0 0 1 .26-1.431l1.004-.827c.292-.24.437-.613.43-.991a7 7 0 0 1 0-.255c.007-.38-.138-.751-.43-.992l-1.004-.827a1.125 1.125 0 0 1-.26-1.43l1.297-2.247a1.125 1.125 0 0 1 1.37-.491l1.216.456c.356.133.751.072 1.076-.124q.108-.066.22-.128c.332-.183.582-.495.644-.869z"/><path d="M15 12a3 3 0 1 1-6 0a3 3 0 0 1 6 0"/></g></svg>',attributes:{title:"Cài đặt"}}]),S.some(ie=>ie.id==="save-my-block")||(ne=[...ne,{id:"save-my-block",command:async()=>{const ie=await Z(te);ie&&(Ue.value=ie.gjsData?"":`${ie.html}<style>${ie.css}</style>`,Te.value=ie.gjsData?"":ie.js,Be.value=ie.gjsData,He.value=await N(ie.html,ie.css),ze.value=!0)},label:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.6"><path d="M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z"/><path d="M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7M7 3v4a1 1 0 0 0 1 1h7"/></g></svg>',attributes:{title:String(pe(o("pages.builder.block.save_my_block")))}}]),L.set("toolbar",[...ne,...U])}),te.on("load",()=>{const L=te.Canvas.getFrameEl();if(L&&L.contentDocument){const S=document.createElement("style");S.innerHTML=`
1897        body::-webkit-scrollbar {
1898          width: 8px;
1899        }
1900        body::-webkit-scrollbar-track {
1901          background: #ededed;
1902        }
1903        body::-webkit-scrollbar-thumb {
1904          background: #b8b8b8;
1905          border-radius: 5px;
1906        }
1907        body::-webkit-scrollbar-thumb:hover {
1908          background: #535353;
1909          cursor: pointer;
1910        }
1911        body .gjs-selected {
1912          outline: 2px solid #6366f1 !important;
1913        }
1914        #lastDiv {
1915          padding-bottom: 300px;
1916          background-size: 20px;
1917          background-image: url(/images/builder/transparent.svg);
1918          opacity: .5;
1919          pointer-events: none;
1920        }
1921      `,L.contentDocument.head.appendChild(S);const U=document.createElement("div");U.id="lastDiv",L.contentDocument.body.appendChild(U)}});for(const L of Fa)te.Commands.add(L.id,L.command);Ae.value&&Ae.value.forEach(L=>{he(te,L,!0)}),De.value&&De.value.forEach(L=>{he(te,L)}),ke(te),Je(Ae,()=>{ae(te)}),Je(De,()=>{Pe(te)}),tl(te,{modalImportTitle:"Source code",modalImportButton:String(pe(o("save"))),modalImportContent:()=>rt(te),importViewerOptions:{},toast:p}),te.StyleManager.addProperty("extra",{extend:"filter"}),te.StyleManager.addProperty("extra",{extend:"filter",property:"backdrop-filter"}),te.StyleManager.addProperty("extra",{name:"Animation",type:"select",property:"animate-name",defaults:"",list:[{id:"",name:"Chọn hiệu ứng"},{id:"animate__fadeIn",name:"fadeIn"},{id:"animate__fadeOut",name:"fadeOut"},{id:"animate__lightSpeedInRight",name:"lightSpeedInRight"},{id:"animate__bounce",name:"bounce"},{id:"animate__flash",name:"flash"},{id:"animate__pulse",name:"pulse"},{id:"animate__shakeX",name:"shakeX"},{id:"animate__shakeY",name:"shakeY"},{id:"animate__headShake",name:"headShake"},{id:"animate__swing",name:"swing"},{id:"animate__tada",name:"tada"},{id:"animate__wobble",name:"wobble"},{id:"animate__jello",name:"jello"},{id:"animate__heartBeat",name:"heartBeat"},{id:"animate__backInDown",name:"backInDown"},{id:"animate__backOutDown",name:"backOutDown"},{id:"animate__bounceIn",name:"bounceIn"},{id:"animate__flip",name:"flip"},{id:"animate__rotateIn",name:"rotateIn"},{id:"animate__zoomOut",name:"zoomOut"},{id:"animate__rotateOut",name:"rotateOut"}],onChange({value:L}){const S=te.getSelected();if(!S)return;let U=S.getClasses();U=U.filter(ne=>!ne.startsWith("animate__")),L&&(U.push("animate__animated"),U.push(L)),S.setClass(U)}}),te.StyleManager.addProperty("extra",{name:"Kéo dài",type:"select",property:"animate-duration",defaults:"",list:[{id:"",name:"Chọn thời gian"},{id:"animate__slow",name:"2s"},{id:"animate__slower",name:"3s"},{id:"animate__fast",name:"800ms"},{id:"animate__faster",name:"500ms"}],onChange({value:L}){const S=te.getSelected();if(!S)return;let U=S.getClasses();U=U.filter(ne=>!["animate__slow","animate__slower","animate__fast","animate__faster"].includes(ne)),L&&U.push(L),S.setClass(U)}}),te.StyleManager.addProperty("extra",{name:"Trì hoãn",type:"select",property:"animate-delay",defaults:"",list:[{id:"",name:"Chọn thời gian"},{id:"animate__delay-2s",name:"2s"},{id:"animate__delay-3s",name:"3s"},{id:"animate__delay-4s",name:"4s"},{id:"animate__delay-5s",name:"5s"}],onChange({value:L}){const S=te.getSelected();if(!S)return;let U=S.getClasses();U=U.filter(ne=>!["animate__delay-2s","animate__delay-3s","animate__delay-4s","animate__delay-5s"].includes(ne)),L&&U.push(L),S.setClass(U)}}),te.StyleManager.addProperty("extra",{name:"Lặp lại",type:"select",property:"animate-repeating",defaults:"",list:[{id:"",name:"Chọn lần lặp"},{id:"animate__repeat-1",name:"1"},{id:"animate__repeat-2",name:"2"},{id:"animate__repeat-3",name:"3"},{id:"animate__infinite",name:"Vô hạn"}],onChange({value:L}){const S=te.getSelected();if(!S)return;let U=S.getClasses();U=U.filter(ne=>!["animate__repeat-1","animate__repeat-2","animate__repeat-3","animate__infinite"].includes(ne)),L&&U.push(L),S.setClass(U)}}),te.Commands.add(bi,{async run(){D.value=!0}}),(h.page.url===Ha||h.page.url===Va)&&te.Panels.removeButton("actions",bi),te.Commands.add(ja,{async run(){const L=b.create(Gt,{props:{title:`${pe(`${o("pages.builder.title_confirm_save")}`)}`,body:`${o("pages.builder.description_confirm_save")}`,async onConfirm(){await $fetch(`/api/v1/pages/${h.page._id}`,{method:"PATCH",body:{gjs_data:JSON.stringify(te.getProjectData()),content:rt(te)},onResponse({response:S}){L.close(),S._data.statusCode===200&&S._data?(p.add({description:String(o(S._data.message)),color:"success"}),fi(m.currentRoute.value.path,{replace:!0})):S.status===403&&p.add({description:String(o("pages.builder.not_permission_setting")),color:"error"})},onResponseError({response:S}){p.add({description:S._data?.message??`${pe(`${o("error_occurred")}`)}`,color:"warning"})}})}}});L.open()}}),Je(_,L=>{L&&(ll(te,L),_.value="")}
1921),window.addEventListener("grapesjs-command",at)}),va(()=>{window.removeEventListener("grapesjs-command",at)});const at=L=>{L.detail.action==="toggle-panel-blocks"&&(G.value=!G.value)},et=()=>{l.value?.close(),e.value=!1},xe=L=>{L||et()},xt=L=>{l.value.select(Array.isArray(L)?L[0].url:L.url),et()},tt=X(null),Me=It(Object.fromEntries(V.map(L=>[L,`${L}DefaultBlock`]))),Ge=(L,S)=>[{label:L==="other"?"Mẫu":`${S} mẫu`,slot:`${L}DefaultBlock`},{label:L==="other"?"Của tôi":`${S} của tôi`,slot:`${L}MyBlock`}],Oe=L=>{_.value=L};return(L,S)=>{const U=tn,ne=nn,se=mr,ue=pa,ie=Qn,le=rn,fe=Za,ve=ko;return re(),me(it,null,[F("div",dl,[gt(F("div",ul,[F("div",pl,[S[3]||(S[3]=F("div",{class:"font-semibold"}," Thêm khối ",-1)),K(U,{icon:"material-symbols-light:close",variant:"link",onClick:S[0]||(S[0]=()=>{G.value=!1,tt.value=null})})]),F("div",hl,[(re(!0),me(it,null,Et(k(V),ee=>(re(),me("div",{key:ee},[F("div",{class:je(["flex items-center gap-1 cursor-pointer p-2",k(tt)===ee?"bg-[#e0e7ff]":""]),onClick:be=>tt.value=ee},[S[4]||(S[4]=F("svg",{class:"w-[17px] h-[17px] -rotate-90",viewBox:"0 0 24 24"},[F("path",{fill:"currentColor",d:"M7,10L12,15L17,10H7Z"})],-1)),F("span",gl,dt(k(Jt)[ee]),1)],10,fl),gt(F("div",ml,[F("div",null,[F("div",bl,[(re(!0),me(it,null,Et(Ge(ee,k(Jt)[ee]),be=>(re(),me("button",{key:be.slot,class:je(["text-md py-2 border-b border-transparent cursor-pointer hover:text-[#6366f1] duration-75",k(Me)[ee]===be.slot?"text-[#6366f1] !border-[#6366f1]":"text-black"]),onClick:Le=>k(Me)[ee]=be.slot??"other"},[F("div",null,dt(be.label),1)],10,yl))),128))]),(re(!0),me(it,null,Et(Ge(ee,k(Jt)[ee]),be=>gt((re(),me("div",{key:be.slot,ref_for:!0,ref:Le=>{be.slot?.includes("DefaultBlock")?de(ee,Le):Ee(ee,Le)}})),[[mt,k(Me)[ee]===be.slot]])),128))])],512),[[mt,k(tt)===ee]])]))),128))])],512),[[mt,k(G)]]),F("div",vl,[F("div",{ref_key:"refPanelLeft",ref:v,style:Jn(`left: ${k(T)}px; top: ${k(E)}px;`),class:"panel__left"},[K(ne,{ref_key:"refIconPanelLeft",ref:y,class:"cursor-move",name:"lucide:grip-vertical"},null,512),F("div",{ref_key:"refBlocks",ref:r},null,512)],4),F("div",wl,[k(u)=="{}"?gt((re(),me("div",{key:0,ref_key:"refGJS",ref:c,innerHTML:h.page.content},null,8,xl)),[[mt,k(Ze)]]):(re(),me("div",{key:1,ref_key:"refGJS",ref:c},null,512))]),F("div",{ref_key:"refPanelRight",ref:z,style:Jn(`left: ${k(H)}px; top: ${k(I)}px;`),class:"panel__right"},[F("div",{ref_key:"refIconPanelRight",ref:Y,class:"cursor-move flex justify-between border-b border-[#00000040] p-1"},[F("span",{ref_key:"refNamePanelRight",ref:B},"#",512),K(ne,{name:"mdi:close",onClick:S[1]||(S[1]=ee=>k(z).style.display="none")})],512),S[5]||(S[5]=F("div",{class:"panel__switcher"},null,-1)),F("div",null,[F("div",_l,[(re(),me(it,null,Et(C,ee=>F("button",{key:ee.slot,class:je(["text-md px-2 py-1 w-[33%] rounded",k(w)===ee.slot?"bg-[#e0e7ff]":""]),onClick:be=>w.value=ee.slot},[K(se,{name:ee.icon,class:"size-5"},null,8,["name"]),F("div",null,dt(ee.label),1)],10,Cl)),64))]),F("div",kl,[(re(),me(it,null,Et(C,ee=>gt(F("div",{key:ee.slot,class:je(ee.class)},null,2),[[mt,k(w)===ee.slot]])),64))])])],4)])]),K(le,{open:k(e),"onUpdate:open":[S[2]||(S[2]=ee=>st(e)?e.value=ee:null),xe],ui:{content:"w-full sm:max-w-[75dvw]"}},{content:ce(()=>[K(ie,{ui:{body:"p-0"}},{header:ce(()=>[F("div",Sl,[S[6]||(S[6]=F("span",null,"Quản lý tệp",-1)),K(U,{type:"button",variant:"link","aria-label":"Đóng",onClick:et},{default:ce(()=>[K(ne,{name:"i-material-symbols-close",class:"size-5"})]),_:1})])]),default:ce(()=>[K(ue,{accept:["jpg","jpeg","gif","apng","png","gif","bmp","webp","tif","tiff","svg","avif","ico","cur"],"access-token":k(Q),onFileCallback:xt},null,8,["access-token"])]),_:1})]),_:1},8,["open"]),K(fe,{"is-open":k(D),page:h.page,onOnCloseModal:j},null,8,["is-open","page"]),K(el,{thumbnail:k(He),content:k(Ue),js:k(Te),"gjs-data":k(Be),"is-open":k(ze),onOnCloseModal:We,onOnSaveMyBlockSuccess:$e},null,8,["thumbnail","content","js","gjs-data","is-open"]),K(ve,{page:h.page,"gjs-data":h.gjsData,onApplyCode:Oe},null,8,["page","gjs-data"])],64)}}}),Tl=Object.assign(br(El,[["__scopeId","data-v-30af4ec0"]]),{__name:"Builder"}),_c=yt({__name:"index",async setup(n){let d,g;const{$t:o}=bt(),c=da(),r=vr(),{site:h}=wr(r),{data:u,error:l}=([d,g]=At(()=>zt(`/api/v1/pages/${c.params.id}`,{headers:lt()},"$SqqEe1Vm1e")),d=await d,g(),d);if(!u.value){if(l.value?.statusCode===404)throw gi({status:404,message:pe(`${o("page_not_found")}`)}
1921);if(l.value?.statusCode===403)throw gi({status:403,message:pe(`${o("page_forbidden")}`)})}const e=X();if(c.query.template){const{data:t}=([d,g]=At(()=>zt(`/api/v2/page-templates/${c.query.template}`,{headers:lt()},"$B7WxFpTHhG")),d=await d,g(),d);e.value=t.value}return ua({title:()=>`${o("pages.builder.edit_interface")} - ${u.value?.title||""} | ${h.value?.name||""}`,robots:"noindex, nofollow"}),(t,s)=>{const i=Tl;return k(u)?(re(),ct(i,{key:0,"gjs-data":k(e)!==void 0?k(e).gjs_data:k(u)?.gjs_data,page:k(u)},null,8,["gjs-data","page"])):ot("",!0)}}});export{_c as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.