1 line
1.9 KiB
JavaScript
1 line
1.9 KiB
JavaScript
import{Ht as e,cr as t,hn as n,lt as r,pn as i,qn as a,t as o,ur as s,xn as c,zn as l}from"./D6Ym2dQP.js";var u=typeof window<`u`&&typeof document<`u`;typeof WorkerGlobalScope<`u`&&globalThis instanceof WorkerGlobalScope;var d=Object.prototype.toString,f=e=>d.call(e)===`[object Object]`;function p(e){return Array.isArray(e)?e:[e]}function m(e,t,n){return a(e,t,{...n,immediate:!0})}var h=u?window:void 0;u&&window.document,u&&window.navigator,u&&window.location;function g(e){let n=t(e);return n?.$el??n}function _(...e){let n=(e,t,n,r)=>(e.addEventListener(t,n,r),()=>e.removeEventListener(t,n,r)),r=i(()=>{let n=p(t(e[0])).filter(e=>e!=null);return n.every(e=>typeof e!=`string`)?n:void 0});return m(()=>[r.value?.map(e=>g(e))??[h].filter(e=>e!=null),p(t(r.value?e[1]:e[0])),p(s(r.value?e[2]:e[1])),t(r.value?e[3]:e[2])],([e,t,r,i],a,o)=>{if(!e?.length||!t?.length||!r?.length)return;let s=f(i)?{...i}:i,c=e.flatMap(e=>t.flatMap(t=>r.map(r=>n(e,t,r,s))));o(()=>{c.forEach(e=>e())})},{flush:`post`})}var v=Object.assign(c({__name:`DynamicIcon`,props:{name:{},size:{}},setup(e){return(t,r)=>(l(),n(o,{name:e.name,size:e.size},null,8,[`name`,`size`]))}}),{__name:`UiDynamicIcon`}),y=()=>({name:``,org:``,phone:``,message:``,website:``}),b=r(`contact`,{state:()=>({form:y(),status:`idle`,error:``}),actions:{async submit(){this.status=`loading`,this.error=``;try{await e().$api(`/public/contact`,{method:`POST`,body:this.form}),this.status=`success`}catch(e){let t=e;this.error=t.statusCode===429?`تعداد درخواستها زیاد است؛ لطفاً چند دقیقه بعد دوباره تلاش کنید.`:t.data?.message??`ارسال درخواست انجام نشد؛ لطفاً دوباره تلاش کنید یا تماس بگیرید.`,this.status=`error`}},prefill(e){this.status===`success`&&this.reset(),this.form.message=e},reset(){this.form=y(),this.status=`idle`,this.error=``}}});export{_ as i,v as n,g as r,b as t}; |