PageSourceSearch

https://schooly.co.il/assets/AdminLogin-BIB3QESJ.js

js schooly.co.il collected 2026-10-02 13:14:00 UTC 6,691 bytes, 1 lines download raw bytes

1import{s as f,o as k,r as y,K as O,j as i,q as C,B as I}from"./index-nXKekS_v.js";import{C as T,a as D,b as R,c as U}from"./card-D78MLe8Q.js";var M="authorization_response",N="/~oauth/initiate",B=["https://oauth.lovable.app","https://lovable.dev"],H="lovable://oauth-callback",F="http://127.0.0.1/iframe-oauth/callback",V=500,W=12e4;function $(e){let r;const t=new Promise(a=>{r=a}),o=a=>{if(!e.some(u=>a.origin===u))return;const n=a.data;!n||typeof n!="object"||n.type===M&&r(n.response)},l=()=>{window.removeEventListener("message",o)};return window.addEventListener("message",o),{cleanup:l,messagePromise:t}}function z(e){const r=window.screenX!==0||window.screenY!==0||!e,t=r?window.outerWidth*.5:window.screen.width*.5,o=r?window.outerHeight*.5:window.screen.height*.5,l=r?window.screenX+(window.outerWidth-t)/2:(window.screen.width-t)/2,a=r?window.screenY+(window.outerHeight-o)/2:(window.screen.height-o)/2;return{width:t,height:o,left:l,top:a}}function j(e,r){return e.state!==r?{error:new Error("State is invalid")}:e.error?e.error==="legacy_flow"?{error:new Error("This flow is not supported in Preview mode. Please open the app in a new tab to sign in.")}:{error:new Error(e.error_description??"Sign in failed")}:!e.access_token||!e.refresh_token?{error:new Error("No tokens received")}:{tokens:{access_token:e.access_token,refresh_token:e.refresh_token},error:null}}function K(){const e=navigator.userAgent;return!!(/iPhone|iPad|iPod|Android/i.test(e)||/Macintosh/i.test(e)&&navigator.maxTouchPoints>1)}function G(){return typeof crypto<"u"&&crypto.getRandomValues?[...crypto.getRandomValues(new Uint8Array(16))].map(e=>e.toString(16).padStart(2,"0")).join(""):Math.random().toString(36).substring(2)+Date.now().toString(36)}function Y(e={}){const r=e.oauthBrokerUrl??N,t=e.supportedOAuthOrigins??B;async function o(l,a={}){let s=!1;try{s=window.self!==window.top}catch{s=!0}const n=navigator.userAgent,u=/LovableApp\//.test(n),w=!u&&/lovable/i.test(n),p=G();let g=a.redirect_uri??window.location.origin;u&&s?g=H:w&&s&&(g=F);const v=new URLSearchParams({...a.extraParams,provider:l,redirect_uri:g,state:p});if(!s)return window.location.href=`${r}?${v.toString()}`,{error:null,redirected:!0};!u&&!w&&v.set("response_mode","web_message");const A=`${r}?${v.toString()}`,S=w?[...t,window.location.origin]:t,{messagePromise:P,cleanup:_}=$(S);let d;if(K())d=window.open(A,"_blank");else{const{width:c,height:m,left:h,top:b}=z(s);d=window.open(A,"oauth",`width=${c},height=${m},left=${h},top=${b}`)}if(!d&&(u||w)){let c;const m=new Promise((h,b)=>{c=setTimeout(()=>{b(new Error("OAuth timed out waiting for response"))},W)});try{const h=await Promise.race([P,m]);return j(h,p)}catch(h){return{error:h instanceof Error?h:new Error(String(h))}}finally{c&&clearTimeout(c),_()}}if(!d)return _(),{error:new Error("Popup was blocked")};let E;const L=new Promise((c,m)=>{E=setInterval(()=>{d.closed&&(clearInterval(E),m(new Error("Sign in was cancelled")))},V)});try{const c=await Promise.race([P,L]);return j(c,p)}catch(c){return{error:c instanceof Error?c:new Error(String(c))}}finally{clearInterval(E),_(),d==null||d.close()}}return{signInWithOAuth:o}}var X={name:"@lovable.dev/cloud-auth-js",version:"1.1.1",description:"Lovable Cloud Auth JS",main:"./dist/index.cjs",module:"./dist/index.js",types:"./dist/index.d.ts",type:"module",files:["dist"],scripts:{build:"tsup src/index.ts --format cjs,esm --dts --outDir dist",dev:"tsup src/index.ts --format cjs,esm --dts --watch",test:"vitest run",typecheck:"tsgo --noEmit",prepublishOnly:"npm run clean && npm run build",clean:"rimraf dist"},keywords:["lovable","oauth","authentication"],license:"MIT",devDependencies:{"@types/node":"^22",jsdom:"^26",rimraf:"^5.0.0",tsup:"^7.2.0",typescript:"^5",vitest:"^4.1.0"}};typeof window<"u"&&(window.__lovable_cloud_auth_js_version=X.version);function q(e={}){return Y(e)}const J=q(),Q={auth:{signInWithOAuth:async(e,r)=>{const t=await J.signInWithOAuth(e,{redirect_uri:r==null?void 0:r.redirect_uri,extraParams:{...r==null?void 0:r.extraParams}});if(t.redirected||t.error)return t;try{await f.auth.setSession(t.tokens)}catch(o){return{error:o instanceof Error?o:new Error(String(o))}}return t}}},x="[email protected]";function re(){const e=k(),[r,t]=y.useState(!0);y.useEffect(()=>{const l=async()=>{var n;const{data:{session:s}}=await f.auth.getSession();((n=s==null?void 0:s.user)==null?void 0:n.email)===x&&e("/admin",{replace:!0}),t(!1)},{data:{subscription:a}}=f.auth.onAuthStateChange((s,n)=>{var u,w;((u=n==null?void 0:n.user)==null?void 0:u.email)===x?e("/admin",{replace:!0}):n&&((w=n.user)==null?void 0:w.email)!==x&&(O.error("אין לך הרשאה לגשת למערכת הניהול"),f.auth.signOut())});return l(),()=>a.unsubscribe()},[e]);const o=async()=>{t(!0);const l=window.location.origin,s=!l.includes("lovable.app")&&!l.includes("lovableproject.com")?"https://schooly-splash-page.lovable.app":l,{error:n}=await Q.auth.signInWithOAuth("google",{redirect_uri:s,extraParams:{hd:"schooly.co.il",prompt:"select_account"}});n&&(O.error("שגיאה בהתחברות: "+n.message),t(!1))};return r?i.jsx("div",{dir:"rtl",className:"min-h-screen bg-background flex items-center justify-center",children:i.jsx(C,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):i.jsx("div",{dir:"rtl",className:"min-h-screen bg-background flex items-center justify-center p-4",children:i.jsxs(T,{className:"w-full max-w-sm shadow-card",children:[i.jsxs(D,{className:"text-center",children:[i.jsxs(R,{className:"text-2xl font-black",children:[i.jsx("span",{className:"text-foreground",children:"SCHOOLY"})," ",i.jsx("span",{className:"text-gradient bg-gradient-to-l from-teal to-cyan",children:"סקולי"})]}),i.jsx("p",{className:"text-muted-foreground text-sm mt-2",children:"כניסה למערכת הניהול"})]}),i.jsx(U,{children:i.jsxs(I,{onClick:o,className:"w-full",variant:"outline",size:"lg",children:[i.jsxs("svg",{className:"h-5 w-5 ml-2",viewBox:"0 0 24 24",children:[i.jsx("path",{d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92a5.06 5.06 0 0 1-2.2 3.32v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.1z",fill:"#4285F4"}),i.jsx("path",{d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z",fill:"#34A853"}),i.jsx("path",{d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z",fill:"#FBBC05"}),i.jsx("path",{d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z",fill:"#EA4335"})]}),"התחבר עם Google"]})})]})})}export{re 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.