1import{P as X,j as S,B as Ie,r as o,R as $,u as Se,a as ve,b as Ee,c as je,d as Le,A as se,C as Z,L as Pe,F as Re,e as Ne,f as Te,g as Ae,T as pe,h as W,i as we,G as Ge,n as Oe}from"./index-3d3bd5ca.js";import{l as ee}from"./index-7212db54.js";import{L as ze}from"./ongphra-brown-86d74b16.js";import{S as Be}from"./index.esm-99a7b604.js";import{C as Fe}from"./index-693d658e.js";import{R as De,C as be}from"./row-65a5c8ed.js";import{F as _e}from"./index-05ad7cf1.js";import{S as Ue}from"./index-7b3af9cd.js";import"./tslib.es6-3487a61c.js";import"./isEqual-90d117b2.js";import"./gapSize-a2278ff3.js";const re=({children:e,icon:i=null,backgroundColor:s,fontColor:d=null,onClick:w=()=>{},loading:p=!1,disable:I=!1,style:y={}})=>S.jsx(Ie,{block:!0,type:"primary",size:"large",icon:i,style:{alignItems:"center",display:"flex",backgroundColor:s,color:d,fontWeight:500,lineHeight:0,boxShadow:"1px 2px 10px #53434033",...y},onClick:w,loading:p,disabled:I,children:e});re.propTypes={children:X.node,icon:X.node,backgroundColor:X.string,onClick:X.func,loading:X.bool,disable:X.bool,fontColor:X.string,style:X.object};const Me="/assets/preview-sign-in-page-2e089929.png";function U(){return(U=Object.assign||function(e){for(var i=1;i<arguments.length;i++){var s=arguments[i];for(var d in s)Object.prototype.hasOwnProperty.call(s,d)&&(e[d]=s[d])}return e}).apply(this,arguments)}function ye(e,i){(i==null||i>e.length)&&(i=e.length);for(var s=0,d=new Array(i);s<i;s++)d[s]=e[s];return d}var me=window;o.memo(function(e){var i=e.state,s=i===void 0?"":i,d=e.client_id,w=e.className,p=e.redirect_uri,I=e.scope,y=I===void 0?"profile":I,T=e.isOnlyGetToken,x=T!==void 0&&T,N=e.scope_data,L=N===void 0?{profile:{essential:!0}}:N,P=e.response_type,l=P===void 0?"token":P,j=e.children,h=e.onReject,g=e.onResolve,m=e.onLoginStart,v=o.useRef(null),k=o.useState(!1),c=k[0],b=k[1];o.useEffect(function(){!c&&r()},[c]),o.useEffect(function(){return function(){v.current&&v.current.remove()}},[]);var f=o.useCallback(function(){return!!document.getElementById("amazon-login")},[]),u=o.useCallback(function(_,E,M,K,R){E===void 0&&(E="script");var A=_.createElement(E);A.id=M,A.src=K,A.async=!0,A.defer=!0;var G=document.getElementsByTagName("script")[0];v.current=A,G&&G.parentNode&&G.parentNode.insertBefore(A,G),A.onload=R},[]),a=o.useCallback(function(_){try{return fetch("https://api.amazon.com/user/profile",{headers:{Authorization:"Bearer "+_.access_token}}).then(function(E){return E.json()}).then(function(E){g({provider:"amazon",data:U({},E,_)})}).catch(function(E){h(E)}).finally(function(){}),Promise.resolve()}catch(E){return Promise.reject(E)}},[h,g]),n=o.useCallback(function(_){x?g({provider:"amazon",data:U({},_)}):a(_)},[a,g,x]),t=o.useCallback(function(_){h(_)},[h]),r=o.useCallback(function(){f()?b(!0):u(document,"script","amazon-login","https://assets.loginwithamazon.com/sdk/na/login1.js",function(){me.amazon.Login.setClientId(d),b(!0)})}
1,[f,d,u]),C=o.useCallback(function(){c&&(me.amazon?(m&&m(),me.amazon.Login.authorize({scope:y,scope_data:L,response_type:l,redirect_uri:p,state:s},function(_){_.error?t(_.error):n(_)})):(r(),h("Google SDK isn't loaded!")))},[r,y,s,h,L,c,t,m,p,l,n]);return $.createElement("div",{className:w,onClick:C},j)});var he=window,Ke=o.memo(function(e){var i=e.appId,s=e.scope,d=s===void 0?"email,public_profile":s,w=e.state,p=w===void 0||w,I=e.xfbml,y=I===void 0||I,T=e.cookie,x=T===void 0||T,N=e.version,L=N===void 0?"v2.7":N,P=e.language,l=P===void 0?"en_EN":P,j=e.auth_type,h=j===void 0?"":j,g=e.className,m=e.onLoginStart,v=e.onReject,k=e.onResolve,c=e.redirect_uri,b=e.fieldsProfile,f=b===void 0?"id,first_name,last_name,middle_name,name,name_format,picture,short_name,email,gender":b,u=e.response_type,a=u===void 0?"code":u,n=e.return_scopes,t=n===void 0||n,r=e.isOnlyGetToken,C=r!==void 0&&r,_=e.children,E=o.useRef(null),M=o.useState(!1),K=M[0],R=M[1],A=o.useState(!1),G=A[0],z=A[1];o.useEffect(function(){!K&&te()},[K]),o.useEffect(function(){return function(){E.current&&E.current.remove()}},[]);var B=o.useCallback(function(F,Y){var J=F.createElement("script");J.id="facebook-jssdk",J.src="https://connect.facebook.net/en_EN/sdk.js";var O=F.getElementsByTagName("script")[0];O&&O.parentNode&&O.parentNode.insertBefore(J,O),Y()},[]),Q=o.useCallback(function(){return!!document.getElementById("facebook-jssdk")},[]),H=o.useCallback(function(F,Y){var J=window;J.fbAsyncInit=function(){J.FB&&J.FB.init(U({},F)),R(!0);var O=Y.getElementById("fb-root");O||((O=Y.createElement("div")).id="fb-root",Y.body.appendChild(O)),E.current=O}},[]),ie=o.useCallback(function(F){he.FB.api("/me",{locale:l,fields:f},function(Y){k({provider:"facebook",data:U({},F,Y)})})},[f,l,k]),ae=o.useCallback(function(F){console.log("ð ~ file: index.tsx:127 ~ response:",F),F.authResponse?C?k({provider:"facebook",data:U({},F.authResponse)}):ie(F.authResponse):v(F),z(!1)},[ie,C,v,k]),te=o.useCallback(function(){Q()?R(!0):B(document,function(){H({appId:i,xfbml:y,version:L,state:p,cookie:x,redirect_uri:c,response_type:a},document)})},[p,i,y,x,L,H,c,a,B,Q]),ne=o.useCallback(function(){K&&!G&&(he.FB?(z(!0),m&&m(),he.FB.login(ae,{scope:d,return_scopes:t,auth_type:h})):(te(),v("Fb isn't loaded!"),z(!1)))},[te,d,v,h,K,m,G,t,ae]);return $.createElement("div",{className:g,onClick:ne},_)}),q="875c0462-6309-4ddf-9889-5227b1acc82c",le=window,We=o.memo(function(e){var i=e.client_id,s=e.scope,d=s===void 0?"https://www.googleapis.com/auth/userinfo.profile":s,w=e.prompt,p=w===void 0?"select_account":w,I=e.typeResponse,y=I===void 0?"accessToken":I,T=e.ux_mode,x=e.className,N=x===void 0?"":x,L=e.login_hint,P=L===void 0?"":L,l=e.access_type,j=l===void 0?"online":l,h=e.onLoginStart,g=e.onReject,m=e.onResolve,v=e.redirect_uri,k=v===void 0?"/":v,c=e.auto_select,b=c!==void 0&&c,f=e.isOnlyGetToken,u=f!==void 0&&f,a=e.cookie_policy,n=a===void 0?"single_host_origin":a,t=e.hosted_domain,r=t===void 0?"":t,C=e.discoveryDocs,_=C===void 0?"":C,E=e.children,M=e.fetch_basic_profile,K=M===void 0||M,R=o.useRef(null),A=o.useState(!1),G=A[0],z=A[1],B=o.useState(null),Q=B[0],H=B[1];o.useEffect(function(){!G&&Y()},[G]),o.useEffect(function(){return function(){R.current&&R.current.remove()}},[]);var ie=o.useCallback(function(){return!!document.getElementById("google-login")},[]),ae=o.useCallback(function(O,V,D,ce,xe){V===void 0&&(V="script");var oe=O.createElement(V);oe.id=D,oe.src=ce,oe.async=!0,oe.defer=!0;var de=document.getElementsByTagName("script")[0];R.current=oe,de&&de.parentNode&&de.parentNode.insertBefore(oe,de),oe.onload=xe},[]),te=o.useCallback(function(O){if(y==="accessToken"){var V=new Headers({"Content-Type":"application/x-www-form-urlencoded","x-cors-grida-api-key":q,Authorization:"Bearer "+O.access_token});fetch("https://cors.bridged.cc/https://www.googleapis.com/oauth2/v3/userinfo?alt=json",{method:"GET",headers:V}).then(function(D){return D.json()}).then(function(D){var ce=U({},O,D);m({provider:"google",data:ce})}).catch(function(D){g(D)})}else fetch("https://www.googleapis.com/oauth2/v3/tokeninfo?id_token="+O.credential,{method:"GET"}).then(function(D){return D.json()}).then(function(D){var ce=U({},O,D);m({provider:"google",data:ce})}).catch(function(D){g(D)})},[y,g,m]),ne=o.useCallback(function(O){O&&j==="offline"||u?m({provider:"google",data:O}):te(O)},[j,u,te,m]),F=o.useCallback(function(O){g({provider:"google",data:O})},[g]),Y=o.useCallback(function(){ie()?z(!0):ae(document,"script","google-login","https://accounts.google.com/gsi/client",function(){var O={client_id:i,ux_mode:T},V=null;if(y==="idToken")le.google.accounts.id.initialize(U({},O,{auto_select:b,prompt:"select_account",login_uri:k,callback:ne,native_callback:ne,error_callback:F}));else{var D=U({},O,{scope:d,prompt:p,login_hint:P,access_type:j,hosted_domain:r,redirect_uri:k,cookie_policy:n,discoveryDocs:_,immediate:!0,fetch_basic_profile:K,callback:ne,error_callback:F});V=j==="offline"?le.google.accounts.oauth2.initCodeClient(D):le.google.accounts.oauth2.initTokenClient(D)}V&&H(V),z(!0)})},[d,p,T,i,P,b,j,k,y,_,n,r,ne,F,K,ae,ie]),J=o.useCallback(function(){G&&(le.google?(h&&h(),Q?j==="offline"?Q.requestCode():Q.requestAccessToken():le.google.accounts.id.prompt()):(Y(),g("Google SDK isn't loaded!")))},[j,Q,G,Y,h,g]);return $.createElement("div",{className:N,onClick:J},E)});o.memo(function(e){var i=e.state,s=i===void 0?"":i,d=e.scope,w=d===void 0?"repo,gist":d,p=e.client_id,I=e.client_secret,y=e.className,T=y===void 0?"":y,x=e.redirect_uri,N=e.allow_signup,L=N!==void 0&&N,P=e.isOnlyGetToken,l=P!==void 0&&P,j=e.isOnlyGetCode,h=j!==void 0&&j,g=e.children,m=e.onReject,v=e.onResolve,k=e.onLoginStart;o.useEffect(function(){var n=new URL(window.location.href),t=n.searchParams.get("code"),r=n.searchParams.get("state");r!=null&&r.includes("_github")&&t&&(localStorage.setItem("github",t),window.close())},[]);var c=o.useCallback(function(n){fetch("https://cors.bridged.cc/https://api.github.com//user",{method:"GET",headers:{Authorization:"token "+n.access_token,"x-cors-grida-api-key":q}}).then(function(t){return t.json()}).then(function(t){v({provider:"github",data:U({},t,n)})}).catch(function(t){m(t)})},[m,v]),b=o.useCallback(function(n){if(h)v({provider:"github",data:{code:n}});else{var t={code:n,state:s,redirect_uri:x,client_id:p,client_secret:I},r=new Headers({"Content-Type":"application/x-www-form-urlencoded","x-cors-grida-api-key":q});fetch("https://cors.bridged.cc/https://github.com/login/oauth/access_token",{method:"POST",headers:r,body:new URLSearchParams(t)}).then(function(C){return C.text()}).then(function(C){for(var _,E={},M=function(R,A){var G;if(typeof Symbol>
1"u"||R[Symbol.iterator]==null){if(Array.isArray(R)||(G=function(B,Q){if(B){if(typeof B=="string")return ye(B,void 0);var H=Object.prototype.toString.call(B).slice(8,-1);return H==="Object"&&B.constructor&&(H=B.constructor.name),H==="Map"||H==="Set"?Array.from(B):H==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(H)?ye(B,void 0):void 0}}(R))){G&&(R=G);var z=0;return function(){return z>=R.length?{done:!0}:{done:!1,value:R[z++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. 2In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}return(G=R[Symbol.iterator]()).next.bind(G)}(new URLSearchParams(C));!(_=M()).done;){var K=_.value;E[K[0]]=K[1]}E.access_token?l?v({provider:"github",data:E}):c(E):m("no data")}).catch(function(C){m(C)})}},[s,m,c,v,p,x,I,h,l]),f=o.useCallback(function(n){var t=n.type,r=n.code,C=n.provider;try{return Promise.resolve(t==="code"&&C==="github"&&r&&b(r))}catch(_){return Promise.reject(_)}},[b]),u=o.useCallback(function(){window.removeEventListener("storage",u,!1);var n=localStorage.getItem("github");n&&(f({provider:"github",type:"code",code:n}),localStorage.removeItem("github"))},[f]),a=o.useCallback(function(){k&&k(),window.addEventListener("storage",u,!1);var n=window.screen.width/2-225,t=window.screen.height/2-365;window.open("https://github.com/login/oauth/authorize?client_id="+p+"&scope="+w+"&state="+s+"_github&redirect_uri="+x+"&allow_signup="+L,"Github","menubar=no,location=no,resizable=no,scrollbars=no,status=no, width=450, height=730, top="+t+", left="+n)},[w,s,p,x,L,k,u]);return $.createElement("div",{className:T,onClick:a},g)});o.memo(function(e){var i=e.state,s=i===void 0?"":i,d=e.client_id,w=e.client_secret,p=e.className,I=e.redirect_uri,y=e.fields,T=y===void 0?"id,username,account_type,media_count":y,x=e.scope,N=x===void 0?"user_profile,user_media":x,L=e.response_type,P=L===void 0?"code":L,l=e.isOnlyGetCode,j=l!==void 0&&l,h=e.isOnlyGetToken,g=h!==void 0&&h,m=e.children,v=e.onReject,k=e.onResolve,c=e.onLoginStart;o.useEffect(function(){var t=new URL(window.location.href),r=t.searchParams.get("code"),C=t.searchParams.get("state");C!=null&&C.includes("_instagram")&&r&&(localStorage.setItem("instagram",r),window.close())},[]);var b=o.useCallback(function(t){fetch("https://cors.bridged.cc/https://graph.instagram.com//me?fields="+T+"&access_token="+t.access_token,{method:"GET",headers:{"x-cors-grida-api-key":q}}).then(function(r){return r.json()}).then(function(r){k({provider:"instagram",data:U({},r,t)})}).catch(function(r){v(r)})},[T,v,k]),f=o.useCallback(function(t){if(j)k({provider:"instagram",data:{code:t}});else{var r={grant_type:"authorization_code",code:t,redirect_uri:I,client_id:d,client_secret:w},C=new Headers({"Content-Type":"application/x-www-form-urlencoded","x-cors-grida-api-key":q});fetch("https://cors.bridged.cc/https://api.instagram.com/oauth/access_token",{method:"POST",headers:C,body:new URLSearchParams(r)}).then(function(_){return _.json()}).then(function(_){_.access_token?g?k({provider:"instagram",data:_}):b(_):v("no data")}).catch(function(_){v(_)}).finally(function(){})}},[v,k,b,d,I,w,j,g]),u=o.useCallback(function(t){var r=t.type,C=t.code,_=t.provider;try{return Promise.resolve(r==="code"&&_==="instagram"&&C&&f(C))}catch(E){return Promise.reject(E)}},[f]),a=o.useCallback(function(){window.removeEventListener("storage",a,!1);var t=localStorage.getItem("instagram");t&&(u({provider:"instagram",type:"code",code:t}),localStorage.removeItem("instagram"))},[u]),n=o.useCallback(function(){c&&c(),window.addEventListener("storage",a,!1);var t=window.screen.width/2-225,r=window.screen.height/2-365;window.open("https://api.instagram.com/oauth/authorize?response_type="+P+"&client_id="+d+"&scope="+N+"&state="+s+"_instagram&redirect_uri="+I,"Instagram","menubar=no,location=no,resizable=no,scrollbars=no,status=no, width=450, height=730, top="+r+", left="+t)},[N,s,d,I,c,P,a]);return $.createElement("div",{className:p,onClick:n},m)});o.memo(function(e){var i=e.tenant,s=i===void 0?"common":i,d=e.state,w=d===void 0?"":d,p=e.client_id,I=e.className,y=e.redirect_uri,T=e.scope,x=T===void 0?"profile openid email":T,N=e.response_type,L=N===void 0?"code":N,P=e.response_mode,l=P===void 0?"query":P,j=e.children,h=e.code_challenge,g=h===void 0?"19cfc47c216dacba8ca23eeee817603e2ba34fe0976378662ba31688ed302fa9":h,m=e.code_challenge_method,v=m===void 0?"plain":m,k=e.prompt,c=k===void 0?"select_account":k,b=e.isOnlyGetCode,f=b!==void 0&&b,u=e.isOnlyGetToken,a=u!==void 0&&u,n=e.onLoginStart,t=e.onReject,r=e.onResolve;o.useEffect(function(){var R=new URL(window.location.href),A=R.searchParams.get("code"),G=R.searchParams.get("state");G!=null&&G.includes("_microsoft")&&A&&(localStorage.setItem("microsoft",A),window.close())},[]);var C=o.useCallback(function(R){fetch("https://graph.microsoft.com/v1.0/me",{method:"GET",headers:{Authorization:"Bearer "+R.access_token}}).then(function(A){return A.json()}).then(function(A){r({provider:"microsoft",data:U({},A,R)})}).catch(function(A){t(A)})},[t,r]),_=o.useCallback(function(R){if(f)r({provider:"microsoft",data:{code:R}});else{var A={code:R,scope:x,client_id:p,redirect_uri:y,code_verifier:g,grant_type:"authorization_code"},G=new Headers({"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8"});fetch("https://login.microsoftonline.com/"+s+"/oauth2/v2.0/token",{method:"POST",headers:G,body:new URLSearchParams(A)}).then(function(z){return z.json()}).then(function(z){z.access_token?a?r({provider:"microsoft",data:z}):C(z):t("no data")}
2).catch(function(z){t(z)})}},[x,s,t,C,p,r,y,g,f,a]),E=o.useCallback(function(R){var A=R.type,G=R.code,z=R.provider;try{return Promise.resolve(A==="code"&&z==="microsoft"&&G&&_(G))}catch(B){return Promise.reject(B)}},[_]),M=o.useCallback(function(){window.removeEventListener("storage",M,!1);var R=localStorage.getItem("microsoft");R&&(E({provider:"microsoft",type:"code",code:R}),localStorage.removeItem("microsoft"))},[E]),K=o.useCallback(function(){n&&n(),window.addEventListener("storage",M,!1);var R=window.screen.width/2-225,A=window.screen.height/2-365;window.open("https://login.microsoftonline.com/"+s+"/oauth2/v2.0/authorize?client_id="+p+` 3 &response_type=`+L+` 4 &redirect_uri=`+y+` 5 &response_mode=`+l+` 6 &scope=`+x+` 7 &state=`+w+`_microsoft 8 &prompt=`+c+` 9 &code_challenge=`+g+` 10 &code_challenge_method=`+v,"Microsoft","menubar=no,location=no,resizable=no,scrollbars=no,status=no, width=450, height=730, top="+A+", left="+R)},[x,w,c,s,p,n,y,l,L,g,M,v]);return $.createElement("div",{className:I,onClick:K},j)});o.memo(function(e){var i=e.state,s=i===void 0?"":i,d=e.scope,w=d===void 0?"r_liteprofile":d,p=e.client_id,I=e.client_secret,y=e.className,T=y===void 0?"":y,x=e.redirect_uri,N=e.response_type,L=N===void 0?"code":N,P=e.isOnlyGetCode,l=P!==void 0&&P,j=e.isOnlyGetToken,h=j!==void 0&&j,g=e.children,m=e.onLoginStart,v=e.onReject,k=e.onResolve;o.useEffect(function(){var n=new URL(window.location.href),t=n.searchParams.get("code"),r=n.searchParams.get("state");r!=null&&r.includes("_linkedin")&&t&&(localStorage.setItem("linkedin",t),window.close())},[]);var c=o.useCallback(function(n){fetch("https://api.allorigins.win/get?url="+encodeURIComponent("https://api.linkedin.com/v2/me?oauth2_access_token="+n.access_token+"&projection=(id,profilePicture(displayImage~digitalmediaAsset:playableStreams),localizedLastName, firstName,lastName,localizedFirstName)"),{method:"GET"}).then(function(t){return t.json()}).then(function(t){var r=U({},n);if(t.contents){var C=JSON.parse(t.contents);typeof n=="object"&&Object.entries(C).map(function(_){r[_[0]]=_[1]})}k({provider:"linkedin",data:r})}).catch(function(t){v(t)})},[v,k]),b=o.useCallback(function(n){if(l)k({provider:"linkedin",data:{code:n}});else{var t={code:n,grant_type:"authorization_code",redirect_uri:x,client_id:p,client_secret:I},r=new Headers({"Content-Type":"application/x-www-form-urlencoded","x-cors-grida-api-key":q});fetch("https://cors.bridged.cc/https://www.linkedin.com/oauth/v2/accessToken",{method:"POST",headers:r,body:new URLSearchParams(t)}).then(function(C){return C.json()}).then(function(C){h?k({provider:"linkedin",data:C}):c(C)}).catch(function(C){v(C)})}},[v,k,p,c,x,I,l,h]),f=o.useCallback(function(n){var t=n.type,r=n.code,C=n.provider;try{return Promise.resolve(t==="code"&&C==="linkedin"&&r&&b(r))}catch(_){return Promise.reject(_)}},[b]),u=o.useCallback(function(){window.removeEventListener("storage",u,!1);var n=localStorage.getItem("linkedin");n&&(f({provider:"linkedin",type:"code",code:n}),localStorage.removeItem("linkedin"))},[f]),a=o.useCallback(function(){m&&m(),window.addEventListener("storage",u,!1);var n=window.screen.width/2-225,t=window.screen.height/2-365;window.open("https://www.linkedin.com/oauth/v2/authorization?response_type="+L+"&client_id="+p+"&scope="+w+"&state="+s+"_linkedin&redirect_uri="+x,"Linkedin","menubar=no,location=no,resizable=no,scrollbars=no,status=no, width=450, height=730, top="+t+", left="+n)},[m,u,L,p,w,s,x]);return $.createElement("div",{className:T,onClick:a},g)});o.memo(function(e){var i=e.state,s=i===void 0?"":i,d=e.scope,w=d===void 0?"boards:read,pins:read,user_accounts:read":d,p=e.client_id,I=e.client_secret,y=e.className,T=y===void 0?"":y,x=e.redirect_uri,N=e.isOnlyGetCode,L=N!==void 0&&N,P=e.isOnlyGetToken,l=P!==void 0&&P,j=e.children,h=e.onLoginStart,g=e.onReject,m=e.onResolve;o.useEffect(function(){var u=new URL(window.location.href),a=u.searchParams.get("code"),n=u.searchParams.get("state");n!=null&&n.includes("_pinterest")&&a&&(localStorage.setItem("pinterest",a),window.close())},[]);var v=o.useCallback(function(u){fetch("https://cors.bridged.cc/https://api.pinterest.com/v5/user_account",{method:"GET",headers:{Authorization:"Bearer "+u.access_token,"x-cors-grida-api-key":q}}).then(function(a){return a.json()}).then(function(a){m({provider:"pinterest",data:U({},u,a)})}).catch(function(a){return g(a)})},[g,m]),k=o.useCallback(function(u){try{var a=function(){if(!L){var n={code:u,redirect_uri:x,grant_type:"authorization_code"},t=[];for(var r in n){var C=encodeURIComponent(r),_=encodeURIComponent(n[r]);t.push(C+"="+_)}return t=t.join("&"),Promise.resolve(fetch("https://cors.bridged.cc/https://api.pinterest.com/v5/oauth/token",{method:"POST",headers:{Authorization:"Basic "+btoa(p+":"+I),"Content-Type":"application/x-www-form-urlencoded","x-cors-grida-api-key":q},body:t}).then(function(E){return E.json()}).catch(function(E){return g(E)})).then(function(E){E.access_token&&(l?m({provider:"pinterest",data:E}):v(E))})}m({provider:"pinterest",data:{code:u}})}();return Promise.resolve(a&&a.then?a.then(function(){}):void 0)}catch(n){return Promise.reject(n)}},[g,p,v,m,x,I,L,l]),c=o.useCallback(function(u){var a=u.type,n=u.code,t=u.provider;try{return Promise.resolve(a==="code"&&t==="pinterest"&&n&&k(n))}catch(r){return Promise.reject(r)}},[k]),b=o.useCallback(function(){window.removeEventListener("storage",b,!1);var u=localStorage.getItem("pinterest");u&&(c({provider:"pinterest",type:"code",code:u}),localStorage.removeItem("pinterest"))},[c]),f=o.useCallback(function(){h&&h(),window.addEventListener("storage",b,!1);var u=window.screen.width/2-225,a=window.screen.height/2-365;window.open("https://www.pinterest.com/oauth/?client_id="+p+"&scope="+w+"&state="+s+"_pinterest&redirect_uri="+x+"&response_type=code","Pinterest","menubar=no,location=no,resizable=no,scrollbars=no,status=no, width=450, height=730, top="+a+", left
10="+u)},[w,s,p,x,h,b]);return $.createElement("div",{className:T,onClick:f},j)});o.memo(function(e){var i=e.client_id,s=e.className,d=s===void 0?"":s,w=e.redirect_uri,p=e.children,I=e.fields,y=I===void 0?"created_at,description,entities,id,location,name,pinned_tweet_id,profile_image_url,protected,public_metrics,url,username,verified,withheld":I,T=e.state,x=T===void 0?"state":T,N=e.scope,L=N===void 0?"users.read%20tweet.read":N,P=e.isOnlyGetCode,l=P!==void 0&&P,j=e.isOnlyGetToken,h=j!==void 0&&j,g=e.onLoginStart,m=e.onReject,v=e.onResolve;o.useEffect(function(){var a=new URL(window.location.href),n=a.searchParams.get("code");a.searchParams.get("state")&&n&&(localStorage.setItem("twitter",""+n),window.close())},[]);var k=o.useCallback(function(a){fetch("https://cors.bridged.cc/https://api.twitter.com/2/users/me?user.fields="+y,{method:"GET",headers:{Authorization:"Bearer "+a.access_token,"x-cors-grida-api-key":q}}).then(function(n){return n.json()}).then(function(n){v({provider:"twitter",data:U({},a,n.data)})}).catch(function(n){return m(n)})},[y,m,v]),c=o.useCallback(function(a){try{var n=function(){if(!l){var t=new URLSearchParams({code:a,redirect_uri:w,client_id:i,grant_type:"authorization_code",code_verifier:"challenge"});return Promise.resolve(fetch("https://cors.bridged.cc/https://api.twitter.com/2/oauth2/token",{method:"POST",body:t,headers:{"Content-Type":"application/x-www-form-urlencoded","x-cors-grida-api-key":q}}).then(function(r){return r.json()}).catch(function(r){return m(r)})).then(function(r){r.access_token&&(h?v({provider:"twitter",data:r}):k(r))})}v({provider:"twitter",data:{code:a}})}();return Promise.resolve(n&&n.then?n.then(function(){}):void 0)}catch(t){return Promise.reject(t)}},[m,k,v,i,w,l,h]),b=o.useCallback(function(a){var n=a.type,t=a.code,r=a.provider;try{return Promise.resolve(n==="code"&&r==="twitter"&&t&&c(t))}catch(C){return Promise.reject(C)}},[c]),f=o.useCallback(function(){window.removeEventListener("storage",f,!1);var a=localStorage.getItem("twitter");a&&(b({provider:"twitter",type:"code",code:a}),localStorage.removeItem("twitter"))},[b]),u=o.useCallback(function(){try{g&&g(),window.addEventListener("storage",f,!1);var a=window.screen.width/2-225,n=window.screen.height/2-365;return window.open("https://twitter.com/i/oauth2/authorize?response_type=code&client_id="+i+"&redirect_uri="+w+"&scope="+L+"&state="+x+"&code_challenge=challenge&code_challenge_method=plain","twitter","menubar=no,location=no,resizable=no,scrollbars=no,status=no, width=450, height=730, top="+n+", left="+a),Promise.resolve()}catch(t){return Promise.reject(t)}},[L,x,i,g,w,f]);return $.createElement("div",{className:d,onClick:u},p)});typeof Symbol<"u"&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator"))),typeof Symbol<"u"&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));var fe=window,He=o.memo(function(e){var i=e.client_id,s=e.scope,d=s===void 0?"name email":s,w=e.className,p=w===void 0?"":w,I=e.onLoginStart,y=e.onReject,T=e.onResolve,x=e.redirect_uri,N=x===void 0?"/":x,L=e.children,P=o.useRef(null),l=o.useState(!1),j=l[0],h=l[1];o.useEffect(function(){!j&&k()},[j]),o.useEffect(function(){return function(){P.current&&P.current.remove()}},[]);var g=o.useCallback(function(){return!!document.getElementById("apple-login")},[]),m=o.useCallback(function(b,f,u,a,n){f===void 0&&(f="script");var t=b.createElement(f);t.id=u,t.src=a,t.async=!0,t.defer=!0;var r=document.getElementsByTagName("script")[0];P.current=t,r&&r.parentNode&&r.parentNode.insertBefore(t,r),t.onload=n},[]),v=o.useCallback(function(b){T({provider:"apple",data:b})},[T]),k=o.useCallback(function(){g()?h(!0):m(document,"script","apple-login","https://appleid.cdn-apple.com/appleauth/static/jsapi/appleid/1/en_US/appleid.auth.js",function(){fe.AppleID.auth.init({clientId:i,scope:d,redirectURI:N,state:"origin:web",usePopup:!0}),h(!0)})},[d,i,N,m,g]),c=o.useCallback(function(){try{if(!j)return Promise.resolve();var b=function(){if(fe.AppleID){I&&I();var f=function(u,a){try{var n=Promise.resolve(fe.AppleID.auth.signIn()).then(function(t){v(t)})}catch(t){return a(t)}return n&&n.then?n.then(void 0,a):n}(0,function(u){y({err:u})});if(f&&f.then)return f.then(function(){})}else k(),y("Apple SDK isn't loaded!")}();return Promise.resolve(b&&b.then?b.then(function(){}):void 0)}catch(f){return Promise.reject(f)}},[v,j,k,I,y]);return $.createElement("div",{className:p,onClick:c},L)});o.memo(function(e){var i=e.state,s=i===void 0?"":i,d=e.scope,w=d===void 0?"user.info.basic":d,p=e.client_key,I=e.className,y=I===void 0?"":I,T=e.redirect_uri,x=e.children,N=e.onResolve,L=e.onLoginStart;o.useEffect(function(){var h=new URL(window.location.href),g=h.searchParams.get("code"),m=h.searchParams.get("state");m!=null&&m.includes("_tiktok")&&g&&(localStorage.setItem("tiktok",g),window.close())},[]);var P=o.useCallback(function(h){var g=h.type,m=h.code,v=h.provider;try{return Promise.resolve(g==="code"&&v==="tiktok"&&m&&N({provider:"tiktok",data:{code:m}}))}catch(k){return Promise.reject(k)}},[N]),l=o.useCallback(function(){window.removeEventListener("storage",l,!1);var h=localStorage.getItem("tiktok");h&&(P({provider:"tiktok",type:"code",code:h}),localStorage.removeItem("instagram"))},[P]),j=o.useCallback(function(){L&&L(),window.addEventListener("storage",l,!1);var h=window.screen.width/2-225,g=window.screen.height/2-365;window.open("https://www.tiktok.com/auth/authorize?client_key="+p+"&scope="+w+"&state="+s+"_tiktok&redirect_uri="+T+"&response_type=code","Github","menubar=no,location=no,resizable=no,scrollbars=no,status=no, width=450, height=730, top="+g+", left="+h)},[w,s,p,T,L,l]);return $.createElement("div",{className:y,onClick:j},x)});function ge(e){this.message=e}ge.prototype=new Error,ge.prototype.name="InvalidCharacterError";var ke=typeof window<"u"&&window.atob&&window.atob.bind(window)||function(e){var i=String(e).replace(/=+$/,"");if(i.length%4==1)throw new ge("'atob' failed: The string to be decoded is not correctly encoded.");for(var s,d,w=0,p=0,I="";d=i.charAt(p++);~d&&(s=w%4?64*s+d:d,w++%4)?I+=String.fromCharCode(255&s>>(-2*w&6)):0)d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
10+/=".indexOf(d);return I};function Ye(e){var i=e.replace(/-/g,"+").replace(/_/g,"/");switch(i.length%4){case 0:break;case 2:i+="==";break;case 3:i+="=";break;default:throw"Illegal base64url string!"}try{return function(s){return decodeURIComponent(ke(s).replace(/(.)/g,function(d,w){var p=w.charCodeAt(0).toString(16).toUpperCase();return p.length<2&&(p="0"+p),"%"+p}))}(i)}catch{return ke(i)}}function ue(e){this.message=e}function $e(e,i){if(typeof e!="string")throw new ue("Invalid token specified");var s=(i=i||{}).header===!0?0:1;try{return JSON.parse(Ye(e.split(".")[s]))}catch(d){throw new ue("Invalid token specified: "+d.message)}}ue.prototype=new Error,ue.prototype.name="InvalidTokenError";const Ce=`${window.location.origin}/sign-in`;function io(){const[e,i]=o.useState(!1),[s,d]=o.useState(!0),{serverLogin:w,loading:p}=Se(),{imagePreviewSignInScreen:I}=ve(),{t:y}=Ee(),T=je(),x=o.useRef(!0),[N]=Le(),{isDarkMode:L}=ve(),{useBreakpoint:P}=Ge,l=P(),j=async c=>{const b={...c,provider:"facebook",access_token:c.accessToken};i(!1),await w(b)},h=async({data:c})=>{const b={...c,first_name:c.given_name,last_name:c.family_name,accessToken:c.access_token,id:c.sub,provider:"google"};await w(b),i(!1)},g=async()=>{d(!1);try{i(!0);const c=await ee.getProfile(),b=ee.getAccessToken();let f=ee.getDecodedIDToken().email;f||(f=`${c.userId}@line.com`);const u={email:f,first_name:c.displayName,last_name:c.displayName,name:c.displayName,id:c.userId,provider:"line",accessToken:b};await w(u),ee.logout(),i(!1)}catch{}},m=()=>{try{ee.logout(),ee.login()}catch{Oe.error(y(W.SIGN_IN_PAGE.ALERT_LINE_LOGIN_FAILED_TITLE.i18nKey,W.SIGN_IN_PAGE.ALERT_LINE_LOGIN_FAILED_TITLE.fallback),{details:y(W.SIGN_IN_PAGE.ALERT_LINE_LOGIN_FAILED_DETAIL.i18nKey,W.SIGN_IN_PAGE.ALERT_LINE_LOGIN_FAILED_DETAIL.fallback)})}},v=async({data:c})=>{var r,C,_,E;const{authorization:b}=c,f=$e(b.id_token);let u="",a="",n="";c!=null&&c.user&&(u=((C=(r=c.user)==null?void 0:r.name)==null?void 0:C.firstName)||"",a=((E=(_=c.user)==null?void 0:_.name)==null?void 0:E.lastName)||"",u&&a&&(n=`${u} ${a}`));const t={id:f.sub,email:f.email,first_name:u,last_name:a,name:n,accessToken:"",authorizationCode:b.id_token,provider:"apple"};try{await w(t)}catch{}finally{i(!1)}};o.useEffect(()=>{const c=async()=>{try{await ee.init({liffId:"1657555211-APnGnom8"}),ee.isLoggedIn()?await g():d(!1)}catch{}},b=()=>{const f=N.get("historyFrom");f&&f.startsWith("/wallpapers")&&localStorage.setItem("redirectTo",f)};x.current&&(x.current=!1,c(),b())},[]);const k=l.sm||l.md||l.lg||l.xl||l.xxl?"0px 20px 20px 0px":"20px 20px 0px 0px";return S.jsx("div",{style:{display:"flex",alignItems:"center",minHeight:"100vh"},children:S.jsx(Fe,{className:"custom-card_login",style:{width:"100%",backgroundColor:se.PRIMARY,border:"none",borderRadius:l.sm||l.md||l.lg||l.xl||l.xxl?20:0},children:S.jsxs(De,{style:{height:l.sm||l.md||l.lg||l.xl||l.xxl?"100%":"100vh",overflowY:"auto"},children:[S.jsx(be,{xs:24,sm:12,children:S.jsx(_e,{justify:"center",align:"center",flex:1,children:S.jsx("img",{src:I||Me,alt:"welcome preview image",style:{height:l.md||l.lg||l.xl||l.xxl?600:400,padding:20}})})}),S.jsx(be,{xs:24,sm:12,children:S.jsxs(_e,{vertical:!0,style:{height:"100%",padding:"0 20px 0 20px",backgroundColor:L?"#303030":Z.WHITE,borderRadius:k},flex:1,justify:"space-between",align:"center",children:[S.jsxs(Ue,{direction:"vertical",size:[0,8],style:{width:"100%",maxWidth:"300px",marginTop:20,marginBottom:40},children:[l.md||l.lg||l.xl||l.xxl?S.jsx("div",{style:{justifyContent:"center",display:"flex",alignItems:"center"},children:S.jsx("img",{src:L?Pe:ze,alt:"ongphra",style:{height:150}})}):null,S.jsx(re,{icon:S.jsx("div",{style:{backgroundColor:"white",padding:5,borderRadius:7},children:S.jsx(Re,{size:"1rem",color:se.PRIMARY})}),style:{borderRadius:10,boxShadow:"none",backgroundColor:se.PRIMARY,justifyContent:"start"},loading:e||p,onClick:()=>T("/sign-in/phone"),children:"Continue With Phone"}),S.jsx(Ke,{appId:"1464801727250793",onLoginStart:()=>i(!0),onResolve:({data:c})=>{j(c)},onReject:()=>{i(!1)},children:S.jsx(re,{backgroundColor:Z.FACEBOOK,icon:S.jsx("div",{style:{backgroundColor:"white",padding:5,borderRadius:7},children:S.jsx(Ne,{size:"1rem",color:Z.FACEBOOK})}),style:{borderRadius:10,boxShadow:"none",justifyContent:"start"},loading:e||p,children:"Continue With Facebook"})}),S.jsx(He,{client_id:"com.web.ongphrawallpaper.service",onLoginStart:()=>{i(!0)},onResolve:v,onReject:()=>{i(!1)},redirect_uri:Ce,children:S.jsx(re,{backgroundColor:"#b5b5b5",fontColor:Z.WHITE,icon:S.jsx("div",{style:{backgroundColor:"white",padding:5,borderRadius:7},children:S.jsx(Te,{size:"1rem",color:"#b5b5b5"})}),style:{borderRadius:10,boxShadow:"none",justifyContent:"start"},loading:e||p,children:"Continue With Apple"})}),S.jsx(We,{client_id:"178055092554-hvtkcjcfo3dvdkskjooibls9i1lar1gt.apps.googleusercontent.com",scope:"openid profile email",discoveryDocs:"claims_supported",redirect_uri:Ce,onLoginStart:()=>i(!0),onResolve:h,onReject:()=>{i(!1)},ux_mode:"redirect",children:S.jsx(re,{backgroundColor:Z.GOOGLE,icon:S.jsx("div",{style:{backgroundColor:"white",padding:5,borderRadius:7},children:S.jsx(Ae,{size:"1rem",color:Z.GOOGLE})}),style:{borderRadius:10,boxShadow:"none",justifyContent:"start"},loading:e||p,children:"Continue With Google"})}),S.jsx(re,{backgroundColor:Z.LINE,icon:S.jsx("div",{style:{backgroundColor:"white",padding:5,borderRadius:7},children:S.jsx(Be,{size:"1rem",color:Z.LINE})}),style:{borderRadius:10,boxShadow:"none",justifyContent:"start"},loading:e||p,disable:s,onClick:m,children:"Continue With Line"})]}),S.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[S.jsx(pe.Text,{style:{textAlign:"center",fontSize:"0.8rem"},children:y(W.SIGN_IN_PAGE.LOGIN_ACCEPT.i18nKey,W.SIGN_IN_PAGE.LOGIN_ACCEPT.fallback)}),S.jsxs(pe.Text,{style:{textAlign:"center",fontSize:"0.8rem"},children:[S.jsx(we,{to:"/term",style:{color:se.PRIMARY},children:y(W.COMMON.TERM_OF_USE.i18nKey,W.COMMON.TERM_OF_USE.fallback)})," ",y(W.SIGN_IN_PAGE.AND.i18nKey,W.SIGN_IN_PAGE.AND.fallback),S.jsxs(we,{to:"/privacy",style:{color:se.PRIMARY},children:[" ",y(W.COMMON.PRIVACY.i18nKey,W.COMMON.PRIVACY.fallback)]})]}),S.jsx(pe.Text,{style:{textAlign:"center",fontSize:"0.8rem",marginTop:"0.2rem"},children:"Copyright 2022 Jinda789 Co.,Ltd. All rights reserved"}),S.jsxs("div",{style:{margin:"0.5rem 0",display:"flex",alignItems:"center",justifyContent:"center",flexWrap:"wrap"},children:[S.jsx("a",{href:"https://play.google.com/store/apps/details?id=com.ongphrawallpaper&pcampaignid=pcampaignidMKT-Other-global-all-co-prtnr-py-PartBadge-Mar2515-1",target:"_blank",rel:"noreferrer",children:S.jsx("img",{alt:"Get it on Google Play",src:"https://play.google.com/intl/en_us/badges/static/images/badges/en_badge_web_generic.png",style:{width:120}})}),S.jsx("a",{href:"https://apps.apple.com/us/app/ongphra-wallpaper/id1627531894?itsct=apps_box_badge&itscg=30200",target:"_blank",rel:"noreferrer",children:S.jsx("img",{src:"https://tools.applemediaservices.com/api/badges/download-on-the-app-store/black/en-us?size=250x83&releaseDate=1655164800&h=6b5999e8713f6e64b6dd9ee1db7d00d0",alt:"Download on the App Store",style:{width:100}})})]})]})]})})]})})})}export{io 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.