var _=Object.defineProperty;var p=Object.getOwnPropertySymbols;var w=Object.prototype.hasOwnProperty,I=Object.prototype.propertyIsEnumerable;var m=(e,t,a)=>t in e?_(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a,l=(e,t)=>{for(var a in t||(t={}))w.call(t,a)&&m(e,a,t[a]);if(p)for(var a of p(t))I.call(t,a)&&m(e,a,t[a]);return e};import{_ as s,b,q as k}from"./bi.394.85.js";const S=(e,t,a,d,o,c,n,i,h)=>{let r=l({},t);if(n){const f=l({},i);f[e.target.name]="",h(l({},f))}r[e.target.name]=e.target.value,a(l({},r))},z=(e,t,a,d,o)=>{d(!0);const c={formID:e,clientId:t.clientId,accessToken:t.tokenDetails.access_token,clientSecret:t.clientSecret,refreshToken:t.tokenDetails.refresh_token,tokenDetails:t.tokenDetails};b(c,"zoom_webinar_fetch_all_webinar").then(n=>{if(n&&n.success){const i=l({},t);i.default||(i.default={}),n.data.allWebinar&&(i.default.allWebinar=n.data.allWebinar),o({show:!0,msg:s("Webinar list refreshed","bit-integrations")}),a(l({},i))}else n&&n.data&&n.data.data||!n.success&&typeof n.data=="string"?o({show:!0,msg:k(s("All Webinar list refresh failed Cause: %s. please try again","bit-integrations"),n.data.data||n.data)}):o({show:!0,msg:s("All Webinar list failed. please try again","bit-integrations")});d(!1)}).catch(()=>d(!1))},A=(e,t,a,d,o,c)=>{if(!e.clientId||!e.clientSecret){a({clientId:e.clientId?"":s("Client ID cann't be empty","bit-integrations"),clientSecret:e.clientSecret?"":s("Secret key cann't be empty","bit-integrations")});return}o(!0);const n=`https://zoom.us/oauth/authorize?response_type=code&client_id=${e.clientId}&state=${encodeURIComponent(window.location.href)}/redirect&redirect_uri=${encodeURIComponent(`${btcbi.api.base}/redirect`)}`,i=window.open(n,"zoom","width=400,height=609,toolbar=off"),h=setInterval(()=>{if(i.closed){clearInterval(h);let r={},f=!1;const u=localStorage.getItem("__zoom");if(u&&(f=!0,r=JSON.parse(u),localStorage.removeItem("__zoom")),!r.code||r.error||!r||!f){const g=r.error?`Cause: ${r.error}`:"";c({show:!0,msg:`${s("Authorization failed","bit-integrations")} ${g}. ${s("please try again","bit-integrations")}`}),o(!1)}else{const g=l({},e);g.accountServer=r["accounts-server"],y(r,g,t,d,o,c)}}},500)},y=(e,t,a,d,o,c)=>{const n=l({},e);n.clientId=t.clientId,n.clientSecret=t.clientSecret,n.redirectURI=`${btcbi.api.base}/redirect`,b(n,"zoom_webinar_generate_token").then(i=>i).then(i=>{if(i&&i.success){const h=l({},t);h.tokenDetails=i.data,a(h),d(!0),c({show:!0,msg:s("Authorized Successfully","bit-integrations")})}else i&&i.data&&i.data.data||!i.success&&typeof i.data=="string"?c({show:!0,msg:`${s("Authorization failed Cause:","bit-integrations")}${i.data.data||i.data}. ${s("please try again","bit-integrations")}`}):c({show:!0,msg:s("Authorization failed. please try again","bit-integrations")});o(!1)})},R=e=>!((e.field_map?e.field_map.filter(a=>!a.formField&&!a.zoomWebinarConf):[]).length>0),D=e=>{const t=e==null?void 0:e.zoomWebinarFields.filter(a=>a.required===!0);return t.length>0?t.map(a=>({formField:"",zoomField:a.key})):[{formField:"",zoomField:""}]};export{A as a,R as c,D as g,S as h,z};
