@tempots/beatui 0.81.0 → 0.82.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{ar-DwHLVgKj.cjs → ar-D7CXDmVZ.cjs} +1 -1
- package/dist/{ar-Bo_FZZi7.js → ar-nOSKXpIW.js} +1 -1
- package/dist/auth/index.cjs.js +1 -1
- package/dist/auth/index.es.js +101 -99
- package/dist/beatui.css +393 -0
- package/dist/beatui.tailwind.css +393 -0
- package/dist/{de-zI5mdV4M.cjs → de-WzsOu9Gn.cjs} +1 -1
- package/dist/{de-CCqwOkqN.js → de-f2xcEb34.js} +1 -1
- package/dist/{deep-merge-1uN6CG6K.js → deep-merge-CiOwVWn8.js} +269 -284
- package/dist/deep-merge-DxZqCkE5.cjs +1 -0
- package/dist/{duration-input-C9kpsw-t.js → duration-input-B3vnnwBZ.js} +30 -29
- package/dist/duration-input-Dg5SX3lM.cjs +1 -0
- package/dist/{es-BF02UrPL.js → es-CDqqzpCw.js} +1 -1
- package/dist/{es-Cw90CAbu.cjs → es-Ds2Xf3wV.cjs} +1 -1
- package/dist/{fa-DPQV4YB8.js → fa-C7tE_hR3.js} +1 -1
- package/dist/{fa-B4lssnzR.cjs → fa-Ct1UtDB7.cjs} +1 -1
- package/dist/{fr-1Kd6z1F-.cjs → fr-CzAkRFed.cjs} +1 -1
- package/dist/{fr-dmxPhwkD.js → fr-yOW_68YY.js} +1 -1
- package/dist/{he-BtQbrVt3.js → he-D2oUloCJ.js} +1 -1
- package/dist/{he-CJ3XnuPm.cjs → he-DlXALrK7.cjs} +1 -1
- package/dist/{hi-BpfnFKHp.cjs → hi-3dBhLwDs.cjs} +1 -1
- package/dist/{hi-D_Le4Yka.js → hi-D5ZlZoQq.js} +1 -1
- package/dist/{index-CfaWytS2.cjs → index-C5YCCgnn.cjs} +1 -1
- package/dist/{index-K6u33-GC.cjs → index-ChsRjiIp.cjs} +17 -17
- package/dist/{index-CGEzILlC.js → index-CiAVfKIZ.js} +1 -1
- package/dist/{index-YtW7SCWB.js → index-DT6-HMMz.js} +8 -7
- package/dist/index.cjs.js +4 -4
- package/dist/index.es.js +296 -291
- package/dist/{it-DyHjSuHN.js → it-6e6X-4BB.js} +1 -1
- package/dist/{it-COCZ9NyB.cjs → it-DohtcWi9.cjs} +1 -1
- package/dist/{ja-X43lABza.js → ja-BxNuNo2H.js} +1 -1
- package/dist/{ja--NdggLU9.cjs → ja-eyTArrgS.cjs} +1 -1
- package/dist/json-schema/index.cjs.js +1 -8
- package/dist/json-schema/index.es.js +1358 -7608
- package/dist/json-schema-display/index.cjs.js +1 -0
- package/dist/json-schema-display/index.es.js +846 -0
- package/dist/json-structure/index.cjs.js +1 -1
- package/dist/json-structure/index.es.js +89 -87
- package/dist/{ko-BUvb0ggK.cjs → ko-BFLCDMMs.cjs} +1 -1
- package/dist/{ko-B9g9iw99.js → ko-Ch0jFsBV.js} +1 -1
- package/dist/modal-D2xE47kr.cjs +1 -0
- package/dist/{modal-CSHIhHvI.js → modal-hkQD1bqZ.js} +22 -21
- package/dist/{nl-0S25Gsld.cjs → nl-Bx2ACvr4.cjs} +1 -1
- package/dist/{nl-Ew5jnSsT.js → nl-NuTdZO1s.js} +1 -1
- package/dist/notice-C0SmlheE.cjs +1 -0
- package/dist/{notice-C-964yaY.js → notice-CZHWWwOQ.js} +52 -51
- package/dist/oneof-branch-detection-BVNoKU9d.js +6281 -0
- package/dist/oneof-branch-detection-C8g3eWnx.cjs +8 -0
- package/dist/{pl-C9f6UBSe.js → pl-Bs4nLJ__.js} +1 -1
- package/dist/{pl-B3k-K3S4.cjs → pl-QHl6sl8f.cjs} +1 -1
- package/dist/prosemirror/index.cjs.js +1 -1
- package/dist/prosemirror/index.es.js +1 -1
- package/dist/{pt-DYtAvbrw.js → pt-BETjHZrL.js} +1 -1
- package/dist/{pt-CKoikRO5.cjs → pt-DZGw2Z-1.cjs} +1 -1
- package/dist/{ru-ZexN-b8V.js → ru-Bi1_DEKM.js} +1 -1
- package/dist/{ru-COb7RSDt.cjs → ru-D03IuLqh.cjs} +1 -1
- package/dist/stack-BJgsPJ9A.js +873 -0
- package/dist/stack-DcZ_u50f.cjs +1 -0
- package/dist/string-B9vVyfq3.cjs +1 -0
- package/dist/string-DYyMxBl-.js +19 -0
- package/dist/text-input-CByq5OIo.cjs +1 -0
- package/dist/text-input-CFJntP7G.js +287 -0
- package/dist/{toolbar-DNpBIoJo.js → toolbar-DR2Zd4Oo.js} +1 -1
- package/dist/toolbar-TPWYzoiF.cjs +1 -0
- package/dist/{tr-tO_EH-Y2.cjs → tr-B_-_1wua.cjs} +1 -1
- package/dist/{tr-BDvn05-H.js → tr-DiYB-FwX.js} +1 -1
- package/dist/translations-B4-Zd2LM.cjs +1 -0
- package/dist/translations-Cq8bUKJP.js +584 -0
- package/dist/{translations-DwGC_94w.cjs → translations-D62qqNV9.cjs} +1 -1
- package/dist/{translations-CfWR4loD.js → translations-DPr6c05Z.js} +1 -1
- package/dist/types/components/json-schema-display/display-widget-customization.d.ts +61 -0
- package/dist/types/components/json-schema-display/display-wrapper.d.ts +14 -0
- package/dist/types/components/json-schema-display/displays/any-display.d.ts +14 -0
- package/dist/types/components/json-schema-display/displays/array-display.d.ts +13 -0
- package/dist/types/components/json-schema-display/displays/boolean-display.d.ts +13 -0
- package/dist/types/components/json-schema-display/displays/composition-display.d.ts +14 -0
- package/dist/types/components/json-schema-display/displays/enum-const-display.d.ts +13 -0
- package/dist/types/components/json-schema-display/displays/generic-display.d.ts +18 -0
- package/dist/types/components/json-schema-display/displays/null-display.d.ts +13 -0
- package/dist/types/components/json-schema-display/displays/number-display.d.ts +13 -0
- package/dist/types/components/json-schema-display/displays/object-display.d.ts +13 -0
- package/dist/types/components/json-schema-display/displays/string-display.d.ts +14 -0
- package/dist/types/components/json-schema-display/index.d.ts +14 -0
- package/dist/types/components/json-schema-display/json-schema-display.d.ts +25 -0
- package/dist/types/components/json-schema-display/mismatch.d.ts +14 -0
- package/dist/types/json-schema-display/index.d.ts +1 -0
- package/dist/{ur-DbEqQgS6.js → ur-B69X-xNs.js} +1 -1
- package/dist/{ur-BbnYJ3HS.cjs → ur-DyUSmIbo.cjs} +1 -1
- package/dist/use-form-CgZyrACX.js +864 -0
- package/dist/use-form-JjeKCINk.cjs +2 -0
- package/dist/utils-DEbsp9Q9.js +129 -0
- package/dist/utils-DIUEhA-Z.cjs +1 -0
- package/dist/{vi-CpZUeuSj.js → vi-BdzxA60L.js} +1 -1
- package/dist/{vi-ByBwvGQY.cjs → vi-CBmPaHxg.cjs} +1 -1
- package/dist/widget-customization-DRA7E9Zf.js +1072 -0
- package/dist/widget-customization-G-QLB1rw.cjs +1 -0
- package/dist/{zh-DnxK0ieB.cjs → zh-Cb1b8uik.cjs} +1 -1
- package/dist/{zh-DJyhKO0I.js → zh-Dn1UJiZa.js} +1 -1
- package/package.json +13 -7
- package/dist/deep-merge-CBIkQM4E.cjs +0 -1
- package/dist/duration-input-DHWhQJnn.cjs +0 -1
- package/dist/modal-cc8Ehngz.cjs +0 -1
- package/dist/notice-C_BWqu2K.cjs +0 -1
- package/dist/toolbar-D5FcnRju.cjs +0 -1
- package/dist/translations-0tLX4x7M.js +0 -866
- package/dist/translations-WPN3ibDg.cjs +0 -1
- package/dist/use-form-D4JFOcjo.cjs +0 -2
- package/dist/use-form-D4rqJkvG.js +0 -1731
- package/dist/widget-customization-BSjJz3_Y.js +0 -1195
- package/dist/widget-customization-CrFVrt4V.cjs +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./translations-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./translations-B4-Zd2LM.cjs"),a={loadingExtended:"جاري التحميل، يرجى الانتظار",loadingShort:"جاري التحميل...",locale:"اللغة",iconDescription:"أيقونة",loadingIcon:"أيقونة التحميل",failedToLoadIcon:"فشل في تحميل الأيقونة",editLabel:"تحرير",selectOne:"اختر واحد",selectNone:"لا شيء",selectMany:"اختر عدة",noResults:"لا نتائج",passwordPlaceholderText:"كلمة المرور السرية",togglePasswordVisibility:"إظهار/إخفاء كلمة المرور",toggleMenu:"تبديل القائمة",toggleAside:"تبديل اللوحة الجانبية",mainNavigation:"القائمة الرئيسية",sidebar:"الشريط الجانبي",closeDrawer:"إغلاق الدرج",closeModal:"إغلاق النافذة المنبثقة",confirm:"تأكيد",cancel:"إلغاء",addLabel:"إضافة",removeItem:"إزالة العنصر",currentLocale:"العربية",ar:"العربية",de:"الألمانية",en:"الإنجليزية",es:"الأسبانية",fr:"الفرنسية",hi:"الهندية",it:"الإيطالية",ja:"اليابانية",ko:"الكورية",nl:"الهولندية",pl:"البولندية",pt:"البرتغالية",ru:"الروسية",tr:"التركية",vi:"الفيتنامية",zh:"الصينية",he:"العبرية",fa:"الفارسية",ur:"الأردية",emailPlaceholderText:"بريدك الإلكتروني",incrementValue:"زيادة القيمة",decrementValue:"تقليل القيمة",dropZoneInstructions:e=>e?"انقر للاختيار أو اسحب الملفات هنا، أو اضغط Enter أو Space لفتح محدد الملفات":"اسحب الملفات هنا",fileSizeUnits:["بايت","ك.ب","م.ب","ج.ب","ت.ب"],removeFile:"إزالة الملف",clearAllFiles:"مسح كل الملفات",clearValue:"مسح القيمة",unknownType:"نوع غير معروف",filesInputInstructions:(e,o,t)=>{let n=e==null||e>1?"انقر للاختيار أو اسحب الملفات هنا":"انقر للاختيار أو اسحب ملف هنا";if(e||o){const l=[];if(e!=null&&e>1&&l.push(`حتى ${e} ملفات`),o&&t){const i=r.formatFileSize(o,{units:t});l.push(`حد أقصى ${i} لكل ملف`)}l.length>0&&(n+=` (${l.join("، ")})`)}return n},prosemirror:{bold:"Bold",italic:"Italic",code:"Code",link:"Link",removeLink:"Remove Link",heading:e=>`Heading ${e}`,bulletList:"Bullet List",orderedList:"Ordered List",blockquote:"Blockquote",codeBlock:"Code Block",horizontalRule:"Horizontal Rule",linkUrlPlaceholder:"https://example.com"},pdfPageViewer:{loading:"Loading PDF...",loadFailed:"Failed to load PDF",invalidPdf:"Invalid PDF file",pageOutOfRange:(e,o)=>`Page ${e} is out of range (1-${o})`,renderFailed:"Failed to render PDF page"}};exports.default=a;
|
package/dist/auth/index.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("@tempots/dom"),p=require("../use-form-D4JFOcjo.cjs"),g=require("../modal-cc8Ehngz.cjs"),y=require("../translations-DwGC_94w.cjs"),P=require("../notice-C_BWqu2K.cjs"),q=require("../translations-WPN3ibDg.cjs"),J=require("@tempots/ui"),T={google:{name:"Google",icon:"logos:google-icon",color:"#4285f4"},github:{name:"GitHub",icon:"logos:github-icon",color:"#333"},apple:{name:"Apple",icon:"logos:apple",color:"#000"},facebook:{name:"Facebook",icon:"logos:facebook",color:"#1877f2"},twitter:{name:"Twitter",icon:"logos:twitter",color:"#1da1f2"},microsoft:{name:"Microsoft",icon:"logos:microsoft-icon",color:"#00a4ef"},discord:{name:"Discord",icon:"logos:discord-icon",color:"#5865f2"},linkedin:{name:"LinkedIn",icon:"logos:linkedin-icon",color:"#0077b5"},instagram:{name:"Instagram",icon:"logos:instagram-icon",color:"#e4405f"},tiktok:{name:"TikTok",icon:"logos:tiktok-icon",color:"#000"},snapchat:{name:"Snapchat",icon:"logos:snapchat-icon",color:"#fffc00"},reddit:{name:"Reddit",icon:"logos:reddit-icon",color:"#ff4500"},pinterest:{name:"Pinterest",icon:"logos:pinterest-icon",color:"#bd081c"},twitch:{name:"Twitch",icon:"logos:twitch",color:"#9146ff"},steam:{name:"Steam",icon:"logos:steam-icon",color:"#000"},epic:{name:"Epic Games",icon:"simple-icons:epicgames",color:"#313131"},playstation:{name:"PlayStation",icon:"logos:playstation-icon",color:"#003791"},xbox:{name:"Xbox",icon:"logos:xbox-icon",color:"#107c10"},whatsapp:{name:"WhatsApp",icon:"logos:whatsapp-icon",color:"#25d366"},wechat:{name:"WeChat",icon:"logos:wechat-icon",color:"#1aad19"},amazon:{name:"Amazon",icon:"logos:amazon-icon",color:"#ff9900"},yahoo:{name:"Yahoo",icon:"logos:yahoo-icon",color:"#720e9e"},paypal:{name:"PayPal",icon:"logos:paypal",color:"#0070ba"},x:{name:"X",icon:"simple-icons:x",color:"#000"}};function N(e){return T[e]?.name||e}function K(e){return T[e]?.icon||"mdi:account"}function Q(e){return T[e]?.color||"#666"}function tt(e,o="Continue with {provider}"){return o.replace("{provider}",N(e))}const B={minLength:8,requireUppercase:!0,requireLowercase:!0,requireNumbers:!0,requireSymbols:!1};function et(e){return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e)}function D(e=32){const o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";let i="";for(let l=0;l<e;l++)i+=o.charAt(Math.floor(Math.random()*o.length));return i}function ot(e,o,i,l=[],c={}){const n={google:"https://accounts.google.com/oauth/authorize",github:"https://github.com/login/oauth/authorize",apple:"https://appleid.apple.com/auth/authorize",facebook:"https://www.facebook.com/v18.0/dialog/oauth",twitter:"https://twitter.com/i/oauth2/authorize",microsoft:"https://login.microsoftonline.com/common/oauth2/v2.0/authorize",discord:"https://discord.com/api/oauth2/authorize",linkedin:"https://www.linkedin.com/oauth/v2/authorization",instagram:"https://api.instagram.com/oauth/authorize",tiktok:"https://www.tiktok.com/v2/auth/authorize",snapchat:"https://accounts.snapchat.com/accounts/oauth2/authorize",reddit:"https://www.reddit.com/api/v1/authorize",pinterest:"https://api.pinterest.com/oauth/",twitch:"https://id.twitch.tv/oauth2/authorize",steam:"https://steamcommunity.com/oauth/authorize",epic:"https://auth.epicgames.com/authorize",playstation:"https://auth.api.sonyentertainmentnetwork.com/oauth/authorize",xbox:"https://login.live.com/oauth20_authorize.srf",whatsapp:"https://web.whatsapp.com/oauth/authorize",wechat:"https://open.weixin.qq.com/connect/qrconnect",amazon:"https://www.amazon.com/ap/oa",yahoo:"https://api.login.yahoo.com/oauth2/request_auth",paypal:"https://www.paypal.com/signin/authorize",x:"https://api.twitter.com/oauth2/authorize"},m={google:["openid","email","profile"],github:["user:email"],apple:["email","name"],facebook:["email"],twitter:["users.read"],microsoft:["openid","email","profile"],discord:["identify","email"],linkedin:["r_liteprofile","r_emailaddress"],instagram:["user_profile","user_media"],tiktok:["user.info.basic","user.external.id"],snapchat:["user.info.basic","user.external.id"],reddit:["identity","email"],pinterest:["read_public","read_relationships"],twitch:["openid","email","profile"],steam:["openid","email","profile"],epic:["openid","email","profile"],playstation:["openid","email","profile"],xbox:["openid","email","profile"],whatsapp:["openid","email","profile"],wechat:["openid","email","profile"],amazon:["openid","email","profile"],yahoo:["openid","email","profile"],paypal:["openid","email","profile"],x:["openid","email","profile"]},a=n[e];if(!a)throw new Error(`Unsupported provider: ${e}`);const r=l.length>0?l:m[e],s=D(),h=new URLSearchParams({client_id:o,redirect_uri:i,scope:r.join(" "),state:s,response_type:"code",...c});return`${a}?${h.toString()}`}function at(e,o,i,l){const c=window.open(e,`${o}_login`,"width=500,height=600,scrollbars=yes,resizable=yes");if(!c){l?.(new Error("Failed to open popup window"));return}const n=setInterval(()=>{c.closed&&(clearInterval(n),l?.(new Error("Login cancelled")))},1e3),m=a=>{a.origin===window.location.origin&&(a.data.type==="SOCIAL_LOGIN_SUCCESS"?(clearInterval(n),c.close(),window.removeEventListener("message",m),i?.(a.data.result)):a.data.type==="SOCIAL_LOGIN_ERROR"&&(clearInterval(n),c.close(),window.removeEventListener("message",m),l?.(new Error(a.data.error))))};window.addEventListener("message",m)}function nt(e){return e instanceof Error?e.message:typeof e=="string"?e:e&&typeof e=="object"&&"message"in e?String(e.message):"An unexpected error occurred"}function rt(){return typeof window<"u"&&typeof document<"u"}function $({task:e,message:o,onStart:i,onEnd:l}){return async c=>{i?.();const n=await p.taskToValidation({task:e!=null?()=>e(c):async()=>null,errorMessage:o,errorPath:["root"],validation:m=>m!=null?p.i.invalid({message:m}):p.i.valid});return l?.(),n}}function z(e=B){let o=g.string();return e.minLength&&(o=o.min(e.minLength,`Password must be at least ${e.minLength} characters`)),e.requireUppercase&&(o=o.regex(/[A-Z]/,"Password must contain at least one uppercase letter")),e.requireLowercase&&(o=o.regex(/[a-z]/,"Password must contain at least one lowercase letter")),e.requireNumbers&&(o=o.regex(/[0-9]/,"Password must contain at least one number")),e.requireSymbols&&(o=o.regex(/[!@#$%^&*()_+\-=[\]{};':"\\|,.<>/?]/,"Password must contain at least one special character")),e.customValidation&&(o=o.refine(i=>e.customValidation(i))),o}const x=g.string().min(1,"Email is required").email("Please enter a valid email address");function E(e){const o=e?z(e):g.string().refine(i=>i.length>0?null:"Password is required");return g.object({email:x,password:o,rememberMe:g.boolean().default(!1)}).schema()}function O(e=B,o){const i=z(e),l=o?.showNameField!==!1,c=o?.showConfirmPassword!==!1,n=o?.showAcceptTermsAndConditions!==!1,m={name:l?g.string().min(1,"Name is required").optional():g.string().optional(),email:x,password:i,confirmPassword:c?g.string().min(1,"Please confirm your password"):g.string(),acceptTerms:n?g.boolean().refine(r=>r===!0,"You must accept the terms and conditions"):g.boolean().default(!0)},a=g.object(m);return c?a.refine(r=>r.password===r.confirmPassword?null:"Passwords don't match",{path:["confirmPassword"]}).schema():a.schema()}const R=g.object({email:x}).schema(),st=E(),it=O(),ct={signIn:E,signUp:O,resetPassword:()=>R};function lt(e){const o=x.validate(e);return o.success?null:o.errors[0]?.message||"Invalid email"}function mt(e,o=B){const l=z(o).validate(e);return l.success?null:l.errors[0]?.message||"Invalid password"}function U(e,o=B){const i={length:e.length>=(o.minLength||8),uppercase:/[A-Z]/.test(e),lowercase:/[a-z]/.test(e),numbers:/[0-9]/.test(e),symbols:/[!@#$%^&*()_+\-=[\]{};':"\\|,.<>/?]/.test(e),custom:o.customValidation?o.customValidation(e)===null:e.length>0},l=[!0,o.requireUppercase,o.requireLowercase,o.requireNumbers,o.requireSymbols,!!o.customValidation].filter(Boolean).length,c=[i.length,o.requireUppercase?i.uppercase:null,o.requireLowercase?i.lowercase:null,o.requireNumbers?i.numbers:null,o.requireSymbols?i.symbols:null,o.customValidation?i.custom:null].filter(a=>a===!0).length,n=l>0?Math.round(c/l*100):0;let m;return n<40?m="weak":n<60?m="fair":n<80?m="good":m="strong",{strength:m,score:n,checks:i}}const M=()=>t.localStorageProp({key:"bui_auth_email",defaultValue:null});function G({onSignIn:e,passwordRules:o,labels:i,showRememberMe:l}){const c=t.prop(!1),n=M(),m=E(o),a=p.useForm({schema:m,onSubmit:$({task:e,message:"Reset password failed",onStart:()=>{c.set(!0),a.controller.disable()},onEnd:()=>{c.set(!1),a.controller.enable()}}),initialValue:{email:"",password:""}}),{controller:r,submit:s}=a;c.on(r.setDisabled);const h=r.field("email"),f=r.field("password");return n.on(b=>{b!=null&&h.change(b)}),h.signal.on(b=>{n.value!=null&&(n.value=b)}),t.Use(y.AuthI18n,b=>t.html.form(t.attr.class("bc-auth-form__form"),t.on.submit(s),p.Stack(t.attr.class("bc-auth-form__fields"),t.Ensure(r.error,L=>P.Notice({variant:"danger",tone:"prominent",role:"alert"},t.html.div(L))),p.Control(P.EmailInput,{controller:h,label:t.coalesce(i?.emailLabel,b.$.emailLabel)}),p.Control(P.PasswordInput,{controller:f,label:t.coalesce(i?.passwordLabel,b.$.passwordLabel)}),t.When(l??!0,()=>t.html.div(t.attr.class("bc-auth-form__remember-me"),t.html.label(t.attr.class("bc-auth-form__checkbox-label"),p.CheckboxInput({value:n.map(L=>L!=null),after:t.html.span(t.coalesce(i?.rememberMeLabel,b.$.rememberMeLabel)),onChange:L=>{L?n.value=h.signal.value??"":n.value=null}}))))),q.Button({type:"submit",variant:"filled",color:"primary",loading:c,disabled:r.disabledOrHasErrors},t.attr.class("bc-auth-form__submit"),t.coalesce(i?.signInButton,b.$.signInButton))))}function j({password:e,rules:o=B,showLabel:i=!0,className:l}){const c=t.computedOf(e)(s=>!s||s.length===0?{strength:"weak",score:0,checks:{length:!1,uppercase:!1,lowercase:!1,numbers:!1,symbols:!1,custom:!1}}:U(s,o)),n=c.map(s=>s.strength),m=c.map(s=>s.score),a=c.map(s=>s.checks),r=t.computedOf(n,l)((s,h)=>["bc-password-strength",`bc-password-strength--${s}`,h].filter(Boolean).join(" "));return t.html.div(t.attr.class(r),t.html.div(t.attr.class("bc-password-strength__bar"),t.html.div(t.attr.class("bc-password-strength__fill"),t.attr.style(m.map(s=>`width: ${s}%`)))),t.When(i,()=>t.Use(y.AuthI18n,s=>t.html.div(t.attr.class("bc-password-strength__label"),t.computedOf(n,s)((h,f)=>{switch(h){case"weak":return f.passwordStrengthWeak;case"fair":return f.passwordStrengthFair;case"good":return f.passwordStrengthGood;case"strong":return f.passwordStrengthStrong;default:return f.passwordStrengthWeak}})))),t.html.div(t.attr.class("bc-password-strength__requirements"),t.When(o.minLength!==void 0,()=>t.html.div(t.attr.class("bc-password-strength__requirement"),t.attr.class(t.computedOf(a)(s=>s.length?"bc-password-strength__requirement--met":"")),t.html.span(t.attr.class("bc-password-strength__requirement-icon"),t.computedOf(a)(s=>s.length?"✓":"○")),t.html.span(t.attr.class("bc-password-strength__requirement-text"),`At least ${o.minLength} characters`))),t.When(o.requireUppercase===!0,()=>t.html.div(t.attr.class("bc-password-strength__requirement"),t.attr.class(t.computedOf(a)(s=>s.uppercase?"bc-password-strength__requirement--met":"")),t.html.span(t.attr.class("bc-password-strength__requirement-icon"),t.computedOf(a)(s=>s.uppercase?"✓":"○")),t.html.span(t.attr.class("bc-password-strength__requirement-text"),"One uppercase letter"))),t.When(o.requireLowercase===!0,()=>t.html.div(t.attr.class("bc-password-strength__requirement"),t.attr.class(t.computedOf(a)(s=>s.lowercase?"bc-password-strength__requirement--met":"")),t.html.span(t.attr.class("bc-password-strength__requirement-icon"),t.computedOf(a)(s=>s.lowercase?"✓":"○")),t.html.span(t.attr.class("bc-password-strength__requirement-text"),"One lowercase letter"))),t.When(o.requireNumbers===!0,()=>t.html.div(t.attr.class("bc-password-strength__requirement"),t.attr.class(t.computedOf(a)(s=>s.numbers?"bc-password-strength__requirement--met":"")),t.html.span(t.attr.class("bc-password-strength__requirement-icon"),t.computedOf(a)(s=>s.numbers?"✓":"○")),t.html.span(t.attr.class("bc-password-strength__requirement-text"),"One number"))),t.When(o.requireSymbols===!0,()=>t.html.div(t.attr.class("bc-password-strength__requirement"),t.attr.class(t.computedOf(a)(s=>s.symbols?"bc-password-strength__requirement--met":"")),t.html.span(t.attr.class("bc-password-strength__requirement-icon"),t.computedOf(a)(s=>s.symbols?"✓":"○")),t.html.span(t.attr.class("bc-password-strength__requirement-text"),"One special character")))))}function ut({password:e,rules:o=B,className:i}){const l=t.computedOf(e)(a=>!a||a.length===0?{strength:"weak",score:0}:U(a,o)),c=l.map(a=>a.strength),n=l.map(a=>a.score),m=t.computedOf(c,i)((a,r)=>["bc-password-strength-bar",`bc-password-strength-bar--${a}`,r].filter(Boolean).join(" "));return t.html.div(t.attr.class(m),t.html.div(t.attr.class("bc-password-strength-bar__fill"),t.attr.style(n.map(a=>`width: ${a}%`))))}function dt({password:e,rules:o=B,className:i}){const l=t.computedOf(e)(n=>!n||n.length===0?"weak":U(n,o).strength),c=t.computedOf(l,i)((n,m)=>["bc-password-strength-text",`bc-password-strength-text--${n}`,m].filter(Boolean).join(" "));return t.Fragment(t.Use(y.AuthI18n,n=>t.html.span(t.attr.class(c),t.computedOf(l,n)((m,a)=>{switch(m){case"weak":return a.passwordStrengthWeak;case"fair":return a.passwordStrengthFair;case"good":return a.passwordStrengthGood;case"strong":return a.passwordStrengthStrong;default:return a.passwordStrengthWeak}}))))}function H({passwordRules:e,labels:o,initialEmail:i,initialName:l,showPasswordStrength:c,onSignUp:n,showNameField:m,showConfirmPassword:a,showAcceptTermsAndConditions:r,termsAndConditions:s}){const h=t.prop(!1),f=e||B,b=O(f,{showNameField:m!==!1,showConfirmPassword:a!==!1,showAcceptTermsAndConditions:r!==!1}),L=p.useForm({schema:b,onSubmit:$({task:n!=null?_=>n({email:_.email,password:_.password,name:_.name,acceptTerms:_.acceptTerms}):void 0,message:"Reset password failed",onStart:()=>{h.set(!0),L.controller.disable()},onEnd:()=>{h.set(!1),L.controller.enable()}}),initialValue:{name:l??"",email:i??"",password:"",confirmPassword:"",acceptTerms:!1}}),{controller:k,submit:I}=L;h.on(k.setDisabled);const v=k.field("name"),A=k.field("email"),C=k.field("password"),W=k.field("confirmPassword"),S=k.field("acceptTerms");return t.Use(y.AuthI18n,_=>t.html.form(t.attr.class("bc-auth-form__form"),t.on.submit(I),p.Stack(t.attr.class("bc-auth-form__fields"),t.Ensure(k.error,w=>P.Notice({variant:"danger",tone:"prominent",role:"alert"},t.html.div(w))),t.When(m!==!1,()=>p.Control(q.TextInput,{controller:v.transform(w=>w??"",w=>w===""?void 0:w),label:t.coalesce(o?.nameLabel,_.$.nameLabel)})),p.Control(P.EmailInput,{controller:A,label:t.coalesce(o?.emailLabel,_.$.emailLabel)}),p.Control(P.PasswordInput,{controller:C,label:t.coalesce(o?.passwordLabel,_.$.passwordLabel)}),t.When(c??!1,()=>j({password:C.signal,rules:f,showLabel:!0})),t.When(a??!1,()=>p.Control(P.PasswordInput,{controller:W,label:t.coalesce(o?.confirmPasswordLabel,_.$.confirmPasswordLabel)})),t.When(r??!1,()=>t.html.div(t.attr.class("bc-auth-form__terms"),t.html.label(t.attr.class("bc-auth-form__checkbox-label"),p.CheckboxInput({value:S.signal.map(w=>w??!1),onChange:w=>S.change(w)}),t.html.span(s||t.coalesce(o?.acceptTermsLabel,_.$.acceptTermsLabel))),t.When(S.errorVisible,()=>t.html.div(t.attr.class("bc-auth-form__field-error"),S.error.map(w=>w||"")))))),q.Button({type:"submit",variant:"filled",color:"primary",loading:h,disabled:k.disabledOrHasErrors},t.attr.class("bc-auth-form__submit"),t.coalesce(o?.signUpButton,_.$.signUpButton))))}function X({onResetPassword:e,labels:o={}}){const i=M(),l=t.prop(!1),c=p.useForm({schema:R,onSubmit:$({task:e,message:"Reset password failed",onStart:()=>{l.set(!0),c.controller.disable()},onEnd:()=>{l.set(!1),c.controller.enable()}}),initialValue:{email:""}}),{controller:n,submit:m}=c;l.on(n.setDisabled);const a=n.field("email");return i.on(r=>{r!=null&&a.change(r)}),t.Use(y.AuthI18n,r=>t.html.form(t.attr.class("bc-auth-form__form"),t.Ensure(n.error,s=>P.Notice({variant:"danger",tone:"prominent",role:"alert"},t.html.div(s))),t.html.p(t.attr.class("bc-auth-form__description"),t.coalesce(o?.resetPasswordDescription,r.$.resetPasswordDescription)),t.on.submit(m),p.Stack(t.attr.class("bc-auth-form__fields"),p.Control(P.EmailInput,{controller:a,label:t.coalesce(o?.emailLabel,r.$.emailLabel)})),q.Button({loading:l,type:"submit",variant:"filled",color:"primary",disabled:n.disabledOrHasErrors},t.attr.class("bc-auth-form__submit"),t.coalesce(o?.resetPasswordButton,r.$.resetPasswordButton))))}function d({provider:e,onClick:o,size:i="md",name:l,icon:c,color:n,flow:m,labels:a}){const r=async()=>{if(o)try{m==="popup"?await o():await o()}catch(s){console.error(`Social login error for ${e} (${m||"redirect"} flow):`,s)}};return q.Button({type:"button",variant:"filled",size:i,color:n,onClick:r,roundedness:"full"},t.attr.class("bc-social-login-button"),t.attr.class(t.computedOf(e)(s=>`bc-social-login-button--${s}`)),t.html.span(t.attr.class("bc-social-login-button__inner"),t.html.span(t.attr.class("bc-social-login-button__icon"),q.Icon({icon:c,size:i},t.attr.class("bc-social-login-button__icon-inner"))),t.Use(y.AuthI18n,s=>t.html.span(t.attr.class("bc-social-login-button__label"),t.bind(t.coalesce(a?.continueWithProvider,s.$.continueWithProvider))(l)))))}function Y({providers:e,onProviderClick:o,size:i="md",className:l}){return p.Stack(t.attr.class("bc-social-login-buttons"),t.attr.class(l),t.ForEach(e,c=>d({provider:c.$.provider,flow:c.$.flow,color:c.map(({provider:n})=>u[n].color),name:c.map(({provider:n})=>u[n].name),icon:c.map(({provider:n})=>u[n].icon),onClick:async()=>{o&&await o(c.$.provider.value)},size:i})))}const u={google:{name:"Google",icon:"logos:google-icon",color:"red"},github:{name:"GitHub",icon:"logos:github-icon",color:"black"},apple:{name:"Apple",icon:"logos:apple",color:"stone"},facebook:{name:"Facebook",icon:"logos:facebook",color:"blue"},twitter:{name:"Twitter",icon:"logos:twitter",color:"sky"},x:{name:"X",icon:"logos:x",color:"zinc"},microsoft:{name:"Microsoft",icon:"logos:microsoft-icon",color:"amber"},discord:{name:"Discord",icon:"logos:discord-icon",color:"indigo"},linkedin:{name:"LinkedIn",icon:"logos:linkedin-icon",color:"cyan"},instagram:{name:"Instagram",icon:"logos:instagram-icon",color:"fuchsia"},tiktok:{name:"TikTok",icon:"logos:tiktok-icon",color:"teal"},snapchat:{name:"Snapchat",icon:"simple-icons:snapchat",color:"yellow"},reddit:{name:"Reddit",icon:"logos:reddit-icon",color:"orange"},pinterest:{name:"Pinterest",icon:"logos:pinterest",color:"rose"},twitch:{name:"Twitch",icon:"logos:twitch",color:"purple"},steam:{name:"Steam",icon:"logos:steam",color:"slate"},epic:{name:"Epic Games",icon:"simple-icons:epicgames",color:"neutral"},playstation:{name:"PlayStation",icon:"simple-icons:playstation",color:"violet"},xbox:{name:"Xbox",icon:"simple-icons:xbox",color:"green"},whatsapp:{name:"WhatsApp",icon:"logos:whatsapp-icon",color:"emerald"},wechat:{name:"WeChat",icon:"simple-icons:wechat",color:"lime"},amazon:{name:"Amazon",icon:"simple-icons:amazon",color:"red"},yahoo:{name:"Yahoo",icon:"logos:yahoo",color:"rose"},paypal:{name:"PayPal",icon:"logos:paypal",color:"blue"}},pt=e=>d({...e,...u.google,provider:"google"}),ht=e=>d({...e,...u.github,provider:"github"}),gt=e=>d({...e,...u.apple,provider:"apple"}),ft=e=>d({...e,...u.facebook,provider:"facebook"}),bt=e=>d({...e,...u.x,provider:"x"}),wt=e=>d({...e,...u.twitter,provider:"twitter"}),Lt=e=>d({...e,...u.microsoft,provider:"microsoft"}),_t=e=>d({...e,...u.discord,provider:"discord"}),kt=e=>d({...e,...u.linkedin,provider:"linkedin"}),vt=e=>d({...e,...u.instagram,provider:"instagram"}),St=e=>d({...e,...u.tiktok,provider:"tiktok"}),Pt=e=>d({...e,...u.snapchat,provider:"snapchat"}),yt=e=>d({...e,...u.reddit,provider:"reddit"}),Bt=e=>d({...e,...u.pinterest,provider:"pinterest"}),It=e=>d({...e,...u.twitch,provider:"twitch"}),qt=e=>d({...e,...u.steam,provider:"steam"}),xt=e=>d({...e,...u.epic,provider:"epic"}),At=e=>d({...e,...u.playstation,provider:"playstation"}),Ct=e=>d({...e,...u.xbox,provider:"xbox"}),Tt=e=>d({...e,...u.whatsapp,provider:"whatsapp"}),$t=e=>d({...e,...u.wechat,provider:"wechat"}),zt=e=>d({...e,...u.amazon,provider:"amazon"}),Et=e=>d({...e,...u.yahoo,provider:"yahoo"}),Ot=e=>d({...e,...u.paypal,provider:"paypal"});function F({providers:e}){return p.Stack(Y({providers:e}))}function Z({mode:e,socialProviders:o,initialName:i,initialEmail:l,passwordRules:c,showRememberMe:n,showSocialDivider:m,showPasswordStrength:a,labels:r,onSignIn:s,onSignUp:h,onResetPassword:f,onModeChange:b,showContainer:L},...k){const I=e!=null?t.Value.deriveProp(e):t.prop("signin");return I.on(v=>b?.(v)),t.Use(y.AuthI18n,v=>{function A(){const S=t.coalesce(r?.hasAccountLink,v.$.hasAccountLink);return t.html.button(t.attr.type("button"),t.attr.class("bc-auth-form__link"),t.on.click(()=>I.set("signin")),S)}function C(){return t.html.button(t.attr.type("button"),t.attr.class("bc-auth-form__link"),t.on.click(()=>I.set("signup")),t.coalesce(r?.noAccountLink,v.$.noAccountLink))}function W(){return t.html.button(t.attr.type("button"),t.attr.class("bc-auth-form__link"),t.on.click(()=>I.set("reset-password")),t.coalesce(r?.forgotPasswordLink,v.$.forgotPasswordLink))}return t.html.div(J.classes({"bc-auth-container":!0,"bc-auth-container--styled":t.Value.map(L??!0,S=>S)}),t.attr.class(I.map(S=>`bc-auth-container--${S}`)),t.attr.class("bc-auth-form"),t.OneOfValue(I,{signin:()=>t.Fragment(t.html.h2(t.attr.class("bc-auth-form__title"),t.coalesce(r?.signInTitle,v.$.signInTitle)),o!=null?t.Fragment(F({providers:o}),t.When(m??!1,V)):null,G({onSignIn:s,showRememberMe:n,passwordRules:c,labels:{emailLabel:r?.emailLabel,passwordLabel:r?.passwordLabel,rememberMeLabel:r?.rememberMeLabel,signInButton:r?.signInButton,forgotPasswordLink:r?.forgotPasswordLink,noAccountLink:r?.noAccountLink}}),p.Stack(t.attr.class("bc-auth-form__footer"),C(),W())),signup:()=>t.Fragment(t.html.h2(t.attr.class("bc-auth-form__title"),t.coalesce(r?.signUpTitle,v.$.signUpTitle)),o!=null?t.Fragment(F({providers:o}),t.When(m??!1,V)):null,H({labels:{nameLabel:r?.nameLabel,emailLabel:r?.emailLabel,passwordLabel:r?.passwordLabel,confirmPasswordLabel:r?.confirmPasswordLabel,acceptTermsLabel:r?.acceptTermsLabel,signUpButton:r?.signUpButton,hasAccountLink:r?.hasAccountLink},initialEmail:l,initialName:i,onSignUp:h,passwordRules:c,showPasswordStrength:a}),p.Stack(t.attr.class("bc-auth-form__footer"),A())),"reset-password":()=>t.Fragment(t.html.h2(t.attr.class("bc-auth-form__title"),t.coalesce(r?.resetPasswordTitle,v.$.resetPasswordTitle)),X({labels:{backToSignInLink:r?.backToSignInLink,emailLabel:r?.emailLabel,resetPasswordButton:r?.resetPasswordButton,resetPasswordDescription:r?.resetPasswordDescription},onResetPassword:f}),p.Stack(t.attr.class("bc-auth-form__footer"),A()))}),...k)})}function Ut(e){return g.Modal({size:"sm",dismissable:!0,showCloseButton:!0},(o,i)=>e(l=>o({body:Z({showContainer:!1,...l}),header:t.Use(y.AuthI18n,c=>t.coalesce(l.modalTitle,c.$.authenticationTitle))})))}function V({labels:e,className:o}={}){return t.html.div(t.attr.class("bc-auth-divider"),t.attr.class(o),t.html.div(t.attr.class("bc-auth-divider__line")),t.Use(y.AuthI18n,i=>t.html.span(t.attr.class("bc-auth-divider__text"),t.coalesce(e?.text,i.$.orDivider))),t.html.div(t.attr.class("bc-auth-divider__line")))}exports.AmazonLoginButton=zt;exports.AppleLoginButton=gt;exports.AuthContainer=Z;exports.AuthDivider=V;exports.AuthModal=Ut;exports.DiscordLoginButton=_t;exports.EpicLoginButton=xt;exports.FacebookLoginButton=ft;exports.GitHubLoginButton=ht;exports.GoogleLoginButton=pt;exports.InstagramLoginButton=vt;exports.LinkedInLoginButton=kt;exports.MicrosoftLoginButton=Lt;exports.PasswordStrengthBar=ut;exports.PasswordStrengthIndicator=j;exports.PasswordStrengthText=dt;exports.PayPalLoginButton=Ot;exports.PinterestLoginButton=Bt;exports.PlayStationLoginButton=At;exports.RedditLoginButton=yt;exports.ResetPasswordForm=X;exports.SignInForm=G;exports.SignUpForm=H;exports.SnapchatLoginButton=Pt;exports.SocialLoginButton=d;exports.SocialLoginButtons=Y;exports.SocialProviders=F;exports.SteamLoginButton=qt;exports.TiktokLoginButton=St;exports.TwitchLoginButton=It;exports.TwitterLoginButton=wt;exports.WeChatLoginButton=$t;exports.WhatsAppLoginButton=Tt;exports.XLoginButtin=bt;exports.XboxLoginButton=Ct;exports.YahooLoginButton=Et;exports.authSchemas=ct;exports.calculatePasswordStrength=U;exports.createPasswordSchema=z;exports.createSignInSchema=E;exports.createSignUpSchema=O;exports.createSocialLoginUrl=ot;exports.defaultPasswordRules=B;exports.defaultSignInSchema=st;exports.defaultSignUpSchema=it;exports.emailSchema=x;exports.formatAuthError=nt;exports.formatProviderName=N;exports.formatSocialLoginText=tt;exports.generateRandomString=D;exports.getProviderColor=Q;exports.getProviderIcon=K;exports.isBrowser=rt;exports.isValidEmail=et;exports.openSocialLoginPopup=at;exports.providerInfo=T;exports.requestToControllerValidation=$;exports.resetPasswordSchema=R;exports.socialProviderInfo=u;exports.useAuthEmailProp=M;exports.validateEmail=lt;exports.validatePassword=mt;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("@tempots/dom"),P=require("../stack-DcZ_u50f.cjs"),b=require("../use-form-JjeKCINk.cjs"),h=require("../modal-D2xE47kr.cjs"),B=require("../translations-D62qqNV9.cjs"),y=require("../notice-C0SmlheE.cjs"),x=require("../text-input-CByq5OIo.cjs"),K=require("../translations-B4-Zd2LM.cjs"),Q=require("@tempots/ui"),$={google:{name:"Google",icon:"logos:google-icon",color:"#4285f4"},github:{name:"GitHub",icon:"logos:github-icon",color:"#333"},apple:{name:"Apple",icon:"logos:apple",color:"#000"},facebook:{name:"Facebook",icon:"logos:facebook",color:"#1877f2"},twitter:{name:"Twitter",icon:"logos:twitter",color:"#1da1f2"},microsoft:{name:"Microsoft",icon:"logos:microsoft-icon",color:"#00a4ef"},discord:{name:"Discord",icon:"logos:discord-icon",color:"#5865f2"},linkedin:{name:"LinkedIn",icon:"logos:linkedin-icon",color:"#0077b5"},instagram:{name:"Instagram",icon:"logos:instagram-icon",color:"#e4405f"},tiktok:{name:"TikTok",icon:"logos:tiktok-icon",color:"#000"},snapchat:{name:"Snapchat",icon:"logos:snapchat-icon",color:"#fffc00"},reddit:{name:"Reddit",icon:"logos:reddit-icon",color:"#ff4500"},pinterest:{name:"Pinterest",icon:"logos:pinterest-icon",color:"#bd081c"},twitch:{name:"Twitch",icon:"logos:twitch",color:"#9146ff"},steam:{name:"Steam",icon:"logos:steam-icon",color:"#000"},epic:{name:"Epic Games",icon:"simple-icons:epicgames",color:"#313131"},playstation:{name:"PlayStation",icon:"logos:playstation-icon",color:"#003791"},xbox:{name:"Xbox",icon:"logos:xbox-icon",color:"#107c10"},whatsapp:{name:"WhatsApp",icon:"logos:whatsapp-icon",color:"#25d366"},wechat:{name:"WeChat",icon:"logos:wechat-icon",color:"#1aad19"},amazon:{name:"Amazon",icon:"logos:amazon-icon",color:"#ff9900"},yahoo:{name:"Yahoo",icon:"logos:yahoo-icon",color:"#720e9e"},paypal:{name:"PayPal",icon:"logos:paypal",color:"#0070ba"},x:{name:"X",icon:"simple-icons:x",color:"#000"}};function D(e){return $[e]?.name||e}function tt(e){return $[e]?.icon||"mdi:account"}function et(e){return $[e]?.color||"#666"}function ot(e,o="Continue with {provider}"){return o.replace("{provider}",D(e))}const I={minLength:8,requireUppercase:!0,requireLowercase:!0,requireNumbers:!0,requireSymbols:!1};function nt(e){return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e)}function G(e=32){const o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";let i="";for(let l=0;l<e;l++)i+=o.charAt(Math.floor(Math.random()*o.length));return i}function at(e,o,i,l=[],c={}){const a={google:"https://accounts.google.com/oauth/authorize",github:"https://github.com/login/oauth/authorize",apple:"https://appleid.apple.com/auth/authorize",facebook:"https://www.facebook.com/v18.0/dialog/oauth",twitter:"https://twitter.com/i/oauth2/authorize",microsoft:"https://login.microsoftonline.com/common/oauth2/v2.0/authorize",discord:"https://discord.com/api/oauth2/authorize",linkedin:"https://www.linkedin.com/oauth/v2/authorization",instagram:"https://api.instagram.com/oauth/authorize",tiktok:"https://www.tiktok.com/v2/auth/authorize",snapchat:"https://accounts.snapchat.com/accounts/oauth2/authorize",reddit:"https://www.reddit.com/api/v1/authorize",pinterest:"https://api.pinterest.com/oauth/",twitch:"https://id.twitch.tv/oauth2/authorize",steam:"https://steamcommunity.com/oauth/authorize",epic:"https://auth.epicgames.com/authorize",playstation:"https://auth.api.sonyentertainmentnetwork.com/oauth/authorize",xbox:"https://login.live.com/oauth20_authorize.srf",whatsapp:"https://web.whatsapp.com/oauth/authorize",wechat:"https://open.weixin.qq.com/connect/qrconnect",amazon:"https://www.amazon.com/ap/oa",yahoo:"https://api.login.yahoo.com/oauth2/request_auth",paypal:"https://www.paypal.com/signin/authorize",x:"https://api.twitter.com/oauth2/authorize"},m={google:["openid","email","profile"],github:["user:email"],apple:["email","name"],facebook:["email"],twitter:["users.read"],microsoft:["openid","email","profile"],discord:["identify","email"],linkedin:["r_liteprofile","r_emailaddress"],instagram:["user_profile","user_media"],tiktok:["user.info.basic","user.external.id"],snapchat:["user.info.basic","user.external.id"],reddit:["identity","email"],pinterest:["read_public","read_relationships"],twitch:["openid","email","profile"],steam:["openid","email","profile"],epic:["openid","email","profile"],playstation:["openid","email","profile"],xbox:["openid","email","profile"],whatsapp:["openid","email","profile"],wechat:["openid","email","profile"],amazon:["openid","email","profile"],yahoo:["openid","email","profile"],paypal:["openid","email","profile"],x:["openid","email","profile"]},n=a[e];if(!n)throw new Error(`Unsupported provider: ${e}`);const r=l.length>0?l:m[e],s=G(),p=new URLSearchParams({client_id:o,redirect_uri:i,scope:r.join(" "),state:s,response_type:"code",...c});return`${n}?${p.toString()}`}function rt(e,o,i,l){const c=window.open(e,`${o}_login`,"width=500,height=600,scrollbars=yes,resizable=yes");if(!c){l?.(new Error("Failed to open popup window"));return}const a=setInterval(()=>{c.closed&&(clearInterval(a),l?.(new Error("Login cancelled")))},1e3),m=n=>{n.origin===window.location.origin&&(n.data.type==="SOCIAL_LOGIN_SUCCESS"?(clearInterval(a),c.close(),window.removeEventListener("message",m),i?.(n.data.result)):n.data.type==="SOCIAL_LOGIN_ERROR"&&(clearInterval(a),c.close(),window.removeEventListener("message",m),l?.(new Error(n.data.error))))};window.addEventListener("message",m)}function st(e){return e instanceof Error?e.message:typeof e=="string"?e:e&&typeof e=="object"&&"message"in e?String(e.message):"An unexpected error occurred"}function it(){return typeof window<"u"&&typeof document<"u"}function z({task:e,message:o,onStart:i,onEnd:l}){return async c=>{i?.();const a=await b.taskToValidation({task:e!=null?()=>e(c):async()=>null,errorMessage:o,errorPath:["root"],validation:m=>m!=null?P.i.invalid({message:m}):P.i.valid});return l?.(),a}}function E(e=I){let o=h.string();return e.minLength&&(o=o.min(e.minLength,`Password must be at least ${e.minLength} characters`)),e.requireUppercase&&(o=o.regex(/[A-Z]/,"Password must contain at least one uppercase letter")),e.requireLowercase&&(o=o.regex(/[a-z]/,"Password must contain at least one lowercase letter")),e.requireNumbers&&(o=o.regex(/[0-9]/,"Password must contain at least one number")),e.requireSymbols&&(o=o.regex(/[!@#$%^&*()_+\-=[\]{};':"\\|,.<>/?]/,"Password must contain at least one special character")),e.customValidation&&(o=o.refine(i=>e.customValidation(i))),o}const A=h.string().min(1,"Email is required").email("Please enter a valid email address");function O(e){const o=e?E(e):h.string().refine(i=>i.length>0?null:"Password is required");return h.object({email:A,password:o,rememberMe:h.boolean().default(!1)}).schema()}function U(e=I,o){const i=E(e),l=o?.showNameField!==!1,c=o?.showConfirmPassword!==!1,a=o?.showAcceptTermsAndConditions!==!1,m={name:l?h.string().min(1,"Name is required").optional():h.string().optional(),email:A,password:i,confirmPassword:c?h.string().min(1,"Please confirm your password"):h.string(),acceptTerms:a?h.boolean().refine(r=>r===!0,"You must accept the terms and conditions"):h.boolean().default(!0)},n=h.object(m);return c?n.refine(r=>r.password===r.confirmPassword?null:"Passwords don't match",{path:["confirmPassword"]}).schema():n.schema()}const M=h.object({email:A}).schema(),ct=O(),lt=U(),mt={signIn:O,signUp:U,resetPassword:()=>M};function ut(e){const o=A.validate(e);return o.success?null:o.errors[0]?.message||"Invalid email"}function dt(e,o=I){const l=E(o).validate(e);return l.success?null:l.errors[0]?.message||"Invalid password"}function W(e,o=I){const i={length:e.length>=(o.minLength||8),uppercase:/[A-Z]/.test(e),lowercase:/[a-z]/.test(e),numbers:/[0-9]/.test(e),symbols:/[!@#$%^&*()_+\-=[\]{};':"\\|,.<>/?]/.test(e),custom:o.customValidation?o.customValidation(e)===null:e.length>0},l=[!0,o.requireUppercase,o.requireLowercase,o.requireNumbers,o.requireSymbols,!!o.customValidation].filter(Boolean).length,c=[i.length,o.requireUppercase?i.uppercase:null,o.requireLowercase?i.lowercase:null,o.requireNumbers?i.numbers:null,o.requireSymbols?i.symbols:null,o.customValidation?i.custom:null].filter(n=>n===!0).length,a=l>0?Math.round(c/l*100):0;let m;return a<40?m="weak":a<60?m="fair":a<80?m="good":m="strong",{strength:m,score:a,checks:i}}const N=()=>t.localStorageProp({key:"bui_auth_email",defaultValue:null});function j({onSignIn:e,passwordRules:o,labels:i,showRememberMe:l}){const c=t.prop(!1),a=N(),m=O(o),n=b.useForm({schema:m,onSubmit:z({task:e,message:"Reset password failed",onStart:()=>{c.set(!0),n.controller.disable()},onEnd:()=>{c.set(!1),n.controller.enable()}}),initialValue:{email:"",password:""}}),{controller:r,submit:s}=n;c.on(r.setDisabled);const p=r.field("email"),g=r.field("password");return a.on(f=>{f!=null&&p.change(f)}),p.signal.on(f=>{a.value!=null&&(a.value=f)}),t.Use(B.AuthI18n,f=>t.html.form(t.attr.class("bc-auth-form__form"),t.on.submit(s),P.Stack(t.attr.class("bc-auth-form__fields"),t.Ensure(r.error,L=>y.Notice({variant:"danger",tone:"prominent",role:"alert"},t.html.div(L))),b.Control(y.EmailInput,{controller:p,label:t.coalesce(i?.emailLabel,f.$.emailLabel)}),b.Control(y.PasswordInput,{controller:g,label:t.coalesce(i?.passwordLabel,f.$.passwordLabel)}),t.When(l??!0,()=>t.html.div(t.attr.class("bc-auth-form__remember-me"),t.html.label(t.attr.class("bc-auth-form__checkbox-label"),b.CheckboxInput({value:a.map(L=>L!=null),after:t.html.span(t.coalesce(i?.rememberMeLabel,f.$.rememberMeLabel)),onChange:L=>{L?a.value=p.signal.value??"":a.value=null}}))))),x.Button({type:"submit",variant:"filled",color:"primary",loading:c,disabled:r.disabledOrHasErrors},t.attr.class("bc-auth-form__submit"),t.coalesce(i?.signInButton,f.$.signInButton))))}function H({password:e,rules:o=I,showLabel:i=!0,className:l}){const c=t.computedOf(e)(s=>!s||s.length===0?{strength:"weak",score:0,checks:{length:!1,uppercase:!1,lowercase:!1,numbers:!1,symbols:!1,custom:!1}}:W(s,o)),a=c.map(s=>s.strength),m=c.map(s=>s.score),n=c.map(s=>s.checks),r=t.computedOf(a,l)((s,p)=>["bc-password-strength",`bc-password-strength--${s}`,p].filter(Boolean).join(" "));return t.html.div(t.attr.class(r),t.html.div(t.attr.class("bc-password-strength__bar"),t.html.div(t.attr.class("bc-password-strength__fill"),t.attr.style(m.map(s=>`width: ${s}%`)))),t.When(i,()=>t.Use(B.AuthI18n,s=>t.html.div(t.attr.class("bc-password-strength__label"),t.computedOf(a,s)((p,g)=>{switch(p){case"weak":return g.passwordStrengthWeak;case"fair":return g.passwordStrengthFair;case"good":return g.passwordStrengthGood;case"strong":return g.passwordStrengthStrong;default:return g.passwordStrengthWeak}})))),t.html.div(t.attr.class("bc-password-strength__requirements"),t.When(o.minLength!==void 0,()=>t.html.div(t.attr.class("bc-password-strength__requirement"),t.attr.class(t.computedOf(n)(s=>s.length?"bc-password-strength__requirement--met":"")),t.html.span(t.attr.class("bc-password-strength__requirement-icon"),t.computedOf(n)(s=>s.length?"✓":"○")),t.html.span(t.attr.class("bc-password-strength__requirement-text"),`At least ${o.minLength} characters`))),t.When(o.requireUppercase===!0,()=>t.html.div(t.attr.class("bc-password-strength__requirement"),t.attr.class(t.computedOf(n)(s=>s.uppercase?"bc-password-strength__requirement--met":"")),t.html.span(t.attr.class("bc-password-strength__requirement-icon"),t.computedOf(n)(s=>s.uppercase?"✓":"○")),t.html.span(t.attr.class("bc-password-strength__requirement-text"),"One uppercase letter"))),t.When(o.requireLowercase===!0,()=>t.html.div(t.attr.class("bc-password-strength__requirement"),t.attr.class(t.computedOf(n)(s=>s.lowercase?"bc-password-strength__requirement--met":"")),t.html.span(t.attr.class("bc-password-strength__requirement-icon"),t.computedOf(n)(s=>s.lowercase?"✓":"○")),t.html.span(t.attr.class("bc-password-strength__requirement-text"),"One lowercase letter"))),t.When(o.requireNumbers===!0,()=>t.html.div(t.attr.class("bc-password-strength__requirement"),t.attr.class(t.computedOf(n)(s=>s.numbers?"bc-password-strength__requirement--met":"")),t.html.span(t.attr.class("bc-password-strength__requirement-icon"),t.computedOf(n)(s=>s.numbers?"✓":"○")),t.html.span(t.attr.class("bc-password-strength__requirement-text"),"One number"))),t.When(o.requireSymbols===!0,()=>t.html.div(t.attr.class("bc-password-strength__requirement"),t.attr.class(t.computedOf(n)(s=>s.symbols?"bc-password-strength__requirement--met":"")),t.html.span(t.attr.class("bc-password-strength__requirement-icon"),t.computedOf(n)(s=>s.symbols?"✓":"○")),t.html.span(t.attr.class("bc-password-strength__requirement-text"),"One special character")))))}function pt({password:e,rules:o=I,className:i}){const l=t.computedOf(e)(n=>!n||n.length===0?{strength:"weak",score:0}:W(n,o)),c=l.map(n=>n.strength),a=l.map(n=>n.score),m=t.computedOf(c,i)((n,r)=>["bc-password-strength-bar",`bc-password-strength-bar--${n}`,r].filter(Boolean).join(" "));return t.html.div(t.attr.class(m),t.html.div(t.attr.class("bc-password-strength-bar__fill"),t.attr.style(a.map(n=>`width: ${n}%`))))}function ht({password:e,rules:o=I,className:i}){const l=t.computedOf(e)(a=>!a||a.length===0?"weak":W(a,o).strength),c=t.computedOf(l,i)((a,m)=>["bc-password-strength-text",`bc-password-strength-text--${a}`,m].filter(Boolean).join(" "));return t.Fragment(t.Use(B.AuthI18n,a=>t.html.span(t.attr.class(c),t.computedOf(l,a)((m,n)=>{switch(m){case"weak":return n.passwordStrengthWeak;case"fair":return n.passwordStrengthFair;case"good":return n.passwordStrengthGood;case"strong":return n.passwordStrengthStrong;default:return n.passwordStrengthWeak}}))))}function X({passwordRules:e,labels:o,initialEmail:i,initialName:l,showPasswordStrength:c,onSignUp:a,showNameField:m,showConfirmPassword:n,showAcceptTermsAndConditions:r,termsAndConditions:s}){const p=t.prop(!1),g=e||I,f=U(g,{showNameField:m!==!1,showConfirmPassword:n!==!1,showAcceptTermsAndConditions:r!==!1}),L=b.useForm({schema:f,onSubmit:z({task:a!=null?_=>a({email:_.email,password:_.password,name:_.name,acceptTerms:_.acceptTerms}):void 0,message:"Reset password failed",onStart:()=>{p.set(!0),L.controller.disable()},onEnd:()=>{p.set(!1),L.controller.enable()}}),initialValue:{name:l??"",email:i??"",password:"",confirmPassword:"",acceptTerms:!1}}),{controller:k,submit:q}=L;p.on(k.setDisabled);const v=k.field("name"),C=k.field("email"),T=k.field("password"),F=k.field("confirmPassword"),S=k.field("acceptTerms");return t.Use(B.AuthI18n,_=>t.html.form(t.attr.class("bc-auth-form__form"),t.on.submit(q),P.Stack(t.attr.class("bc-auth-form__fields"),t.Ensure(k.error,w=>y.Notice({variant:"danger",tone:"prominent",role:"alert"},t.html.div(w))),t.When(m!==!1,()=>b.Control(x.TextInput,{controller:v.transform(w=>w??"",w=>w===""?void 0:w),label:t.coalesce(o?.nameLabel,_.$.nameLabel)})),b.Control(y.EmailInput,{controller:C,label:t.coalesce(o?.emailLabel,_.$.emailLabel)}),b.Control(y.PasswordInput,{controller:T,label:t.coalesce(o?.passwordLabel,_.$.passwordLabel)}),t.When(c??!1,()=>H({password:T.signal,rules:g,showLabel:!0})),t.When(n??!1,()=>b.Control(y.PasswordInput,{controller:F,label:t.coalesce(o?.confirmPasswordLabel,_.$.confirmPasswordLabel)})),t.When(r??!1,()=>t.html.div(t.attr.class("bc-auth-form__terms"),t.html.label(t.attr.class("bc-auth-form__checkbox-label"),b.CheckboxInput({value:S.signal.map(w=>w??!1),onChange:w=>S.change(w)}),t.html.span(s||t.coalesce(o?.acceptTermsLabel,_.$.acceptTermsLabel))),t.When(S.errorVisible,()=>t.html.div(t.attr.class("bc-auth-form__field-error"),S.error.map(w=>w||"")))))),x.Button({type:"submit",variant:"filled",color:"primary",loading:p,disabled:k.disabledOrHasErrors},t.attr.class("bc-auth-form__submit"),t.coalesce(o?.signUpButton,_.$.signUpButton))))}function Y({onResetPassword:e,labels:o={}}){const i=N(),l=t.prop(!1),c=b.useForm({schema:M,onSubmit:z({task:e,message:"Reset password failed",onStart:()=>{l.set(!0),c.controller.disable()},onEnd:()=>{l.set(!1),c.controller.enable()}}),initialValue:{email:""}}),{controller:a,submit:m}=c;l.on(a.setDisabled);const n=a.field("email");return i.on(r=>{r!=null&&n.change(r)}),t.Use(B.AuthI18n,r=>t.html.form(t.attr.class("bc-auth-form__form"),t.Ensure(a.error,s=>y.Notice({variant:"danger",tone:"prominent",role:"alert"},t.html.div(s))),t.html.p(t.attr.class("bc-auth-form__description"),t.coalesce(o?.resetPasswordDescription,r.$.resetPasswordDescription)),t.on.submit(m),P.Stack(t.attr.class("bc-auth-form__fields"),b.Control(y.EmailInput,{controller:n,label:t.coalesce(o?.emailLabel,r.$.emailLabel)})),x.Button({loading:l,type:"submit",variant:"filled",color:"primary",disabled:a.disabledOrHasErrors},t.attr.class("bc-auth-form__submit"),t.coalesce(o?.resetPasswordButton,r.$.resetPasswordButton))))}function d({provider:e,onClick:o,size:i="md",name:l,icon:c,color:a,flow:m,labels:n}){const r=async()=>{if(o)try{m==="popup"?await o():await o()}catch(s){console.error(`Social login error for ${e} (${m||"redirect"} flow):`,s)}};return x.Button({type:"button",variant:"filled",size:i,color:a,onClick:r,roundedness:"full"},t.attr.class("bc-social-login-button"),t.attr.class(t.computedOf(e)(s=>`bc-social-login-button--${s}`)),t.html.span(t.attr.class("bc-social-login-button__inner"),t.html.span(t.attr.class("bc-social-login-button__icon"),K.Icon({icon:c,size:i},t.attr.class("bc-social-login-button__icon-inner"))),t.Use(B.AuthI18n,s=>t.html.span(t.attr.class("bc-social-login-button__label"),t.bind(t.coalesce(n?.continueWithProvider,s.$.continueWithProvider))(l)))))}function Z({providers:e,onProviderClick:o,size:i="md",className:l}){return P.Stack(t.attr.class("bc-social-login-buttons"),t.attr.class(l),t.ForEach(e,c=>d({provider:c.$.provider,flow:c.$.flow,color:c.map(({provider:a})=>u[a].color),name:c.map(({provider:a})=>u[a].name),icon:c.map(({provider:a})=>u[a].icon),onClick:async()=>{o&&await o(c.$.provider.value)},size:i})))}const u={google:{name:"Google",icon:"logos:google-icon",color:"red"},github:{name:"GitHub",icon:"logos:github-icon",color:"black"},apple:{name:"Apple",icon:"logos:apple",color:"stone"},facebook:{name:"Facebook",icon:"logos:facebook",color:"blue"},twitter:{name:"Twitter",icon:"logos:twitter",color:"sky"},x:{name:"X",icon:"logos:x",color:"zinc"},microsoft:{name:"Microsoft",icon:"logos:microsoft-icon",color:"amber"},discord:{name:"Discord",icon:"logos:discord-icon",color:"indigo"},linkedin:{name:"LinkedIn",icon:"logos:linkedin-icon",color:"cyan"},instagram:{name:"Instagram",icon:"logos:instagram-icon",color:"fuchsia"},tiktok:{name:"TikTok",icon:"logos:tiktok-icon",color:"teal"},snapchat:{name:"Snapchat",icon:"simple-icons:snapchat",color:"yellow"},reddit:{name:"Reddit",icon:"logos:reddit-icon",color:"orange"},pinterest:{name:"Pinterest",icon:"logos:pinterest",color:"rose"},twitch:{name:"Twitch",icon:"logos:twitch",color:"purple"},steam:{name:"Steam",icon:"logos:steam",color:"slate"},epic:{name:"Epic Games",icon:"simple-icons:epicgames",color:"neutral"},playstation:{name:"PlayStation",icon:"simple-icons:playstation",color:"violet"},xbox:{name:"Xbox",icon:"simple-icons:xbox",color:"green"},whatsapp:{name:"WhatsApp",icon:"logos:whatsapp-icon",color:"emerald"},wechat:{name:"WeChat",icon:"simple-icons:wechat",color:"lime"},amazon:{name:"Amazon",icon:"simple-icons:amazon",color:"red"},yahoo:{name:"Yahoo",icon:"logos:yahoo",color:"rose"},paypal:{name:"PayPal",icon:"logos:paypal",color:"blue"}},gt=e=>d({...e,...u.google,provider:"google"}),ft=e=>d({...e,...u.github,provider:"github"}),bt=e=>d({...e,...u.apple,provider:"apple"}),wt=e=>d({...e,...u.facebook,provider:"facebook"}),Lt=e=>d({...e,...u.x,provider:"x"}),_t=e=>d({...e,...u.twitter,provider:"twitter"}),kt=e=>d({...e,...u.microsoft,provider:"microsoft"}),vt=e=>d({...e,...u.discord,provider:"discord"}),St=e=>d({...e,...u.linkedin,provider:"linkedin"}),Pt=e=>d({...e,...u.instagram,provider:"instagram"}),yt=e=>d({...e,...u.tiktok,provider:"tiktok"}),Bt=e=>d({...e,...u.snapchat,provider:"snapchat"}),It=e=>d({...e,...u.reddit,provider:"reddit"}),qt=e=>d({...e,...u.pinterest,provider:"pinterest"}),xt=e=>d({...e,...u.twitch,provider:"twitch"}),At=e=>d({...e,...u.steam,provider:"steam"}),Ct=e=>d({...e,...u.epic,provider:"epic"}),Tt=e=>d({...e,...u.playstation,provider:"playstation"}),$t=e=>d({...e,...u.xbox,provider:"xbox"}),zt=e=>d({...e,...u.whatsapp,provider:"whatsapp"}),Et=e=>d({...e,...u.wechat,provider:"wechat"}),Ot=e=>d({...e,...u.amazon,provider:"amazon"}),Ut=e=>d({...e,...u.yahoo,provider:"yahoo"}),Wt=e=>d({...e,...u.paypal,provider:"paypal"});function V({providers:e}){return P.Stack(Z({providers:e}))}function J({mode:e,socialProviders:o,initialName:i,initialEmail:l,passwordRules:c,showRememberMe:a,showSocialDivider:m,showPasswordStrength:n,labels:r,onSignIn:s,onSignUp:p,onResetPassword:g,onModeChange:f,showContainer:L},...k){const q=e!=null?t.Value.deriveProp(e):t.prop("signin");return q.on(v=>f?.(v)),t.Use(B.AuthI18n,v=>{function C(){const S=t.coalesce(r?.hasAccountLink,v.$.hasAccountLink);return t.html.button(t.attr.type("button"),t.attr.class("bc-auth-form__link"),t.on.click(()=>q.set("signin")),S)}function T(){return t.html.button(t.attr.type("button"),t.attr.class("bc-auth-form__link"),t.on.click(()=>q.set("signup")),t.coalesce(r?.noAccountLink,v.$.noAccountLink))}function F(){return t.html.button(t.attr.type("button"),t.attr.class("bc-auth-form__link"),t.on.click(()=>q.set("reset-password")),t.coalesce(r?.forgotPasswordLink,v.$.forgotPasswordLink))}return t.html.div(Q.classes({"bc-auth-container":!0,"bc-auth-container--styled":t.Value.map(L??!0,S=>S)}),t.attr.class(q.map(S=>`bc-auth-container--${S}`)),t.attr.class("bc-auth-form"),t.OneOfValue(q,{signin:()=>t.Fragment(t.html.h2(t.attr.class("bc-auth-form__title"),t.coalesce(r?.signInTitle,v.$.signInTitle)),o!=null?t.Fragment(V({providers:o}),t.When(m??!1,R)):null,j({onSignIn:s,showRememberMe:a,passwordRules:c,labels:{emailLabel:r?.emailLabel,passwordLabel:r?.passwordLabel,rememberMeLabel:r?.rememberMeLabel,signInButton:r?.signInButton,forgotPasswordLink:r?.forgotPasswordLink,noAccountLink:r?.noAccountLink}}),P.Stack(t.attr.class("bc-auth-form__footer"),T(),F())),signup:()=>t.Fragment(t.html.h2(t.attr.class("bc-auth-form__title"),t.coalesce(r?.signUpTitle,v.$.signUpTitle)),o!=null?t.Fragment(V({providers:o}),t.When(m??!1,R)):null,X({labels:{nameLabel:r?.nameLabel,emailLabel:r?.emailLabel,passwordLabel:r?.passwordLabel,confirmPasswordLabel:r?.confirmPasswordLabel,acceptTermsLabel:r?.acceptTermsLabel,signUpButton:r?.signUpButton,hasAccountLink:r?.hasAccountLink},initialEmail:l,initialName:i,onSignUp:p,passwordRules:c,showPasswordStrength:n}),P.Stack(t.attr.class("bc-auth-form__footer"),C())),"reset-password":()=>t.Fragment(t.html.h2(t.attr.class("bc-auth-form__title"),t.coalesce(r?.resetPasswordTitle,v.$.resetPasswordTitle)),Y({labels:{backToSignInLink:r?.backToSignInLink,emailLabel:r?.emailLabel,resetPasswordButton:r?.resetPasswordButton,resetPasswordDescription:r?.resetPasswordDescription},onResetPassword:g}),P.Stack(t.attr.class("bc-auth-form__footer"),C()))}),...k)})}function Ft(e){return h.Modal({size:"sm",dismissable:!0,showCloseButton:!0},(o,i)=>e(l=>o({body:J({showContainer:!1,...l}),header:t.Use(B.AuthI18n,c=>t.coalesce(l.modalTitle,c.$.authenticationTitle))})))}function R({labels:e,className:o}={}){return t.html.div(t.attr.class("bc-auth-divider"),t.attr.class(o),t.html.div(t.attr.class("bc-auth-divider__line")),t.Use(B.AuthI18n,i=>t.html.span(t.attr.class("bc-auth-divider__text"),t.coalesce(e?.text,i.$.orDivider))),t.html.div(t.attr.class("bc-auth-divider__line")))}exports.AmazonLoginButton=Ot;exports.AppleLoginButton=bt;exports.AuthContainer=J;exports.AuthDivider=R;exports.AuthModal=Ft;exports.DiscordLoginButton=vt;exports.EpicLoginButton=Ct;exports.FacebookLoginButton=wt;exports.GitHubLoginButton=ft;exports.GoogleLoginButton=gt;exports.InstagramLoginButton=Pt;exports.LinkedInLoginButton=St;exports.MicrosoftLoginButton=kt;exports.PasswordStrengthBar=pt;exports.PasswordStrengthIndicator=H;exports.PasswordStrengthText=ht;exports.PayPalLoginButton=Wt;exports.PinterestLoginButton=qt;exports.PlayStationLoginButton=Tt;exports.RedditLoginButton=It;exports.ResetPasswordForm=Y;exports.SignInForm=j;exports.SignUpForm=X;exports.SnapchatLoginButton=Bt;exports.SocialLoginButton=d;exports.SocialLoginButtons=Z;exports.SocialProviders=V;exports.SteamLoginButton=At;exports.TiktokLoginButton=yt;exports.TwitchLoginButton=xt;exports.TwitterLoginButton=_t;exports.WeChatLoginButton=Et;exports.WhatsAppLoginButton=zt;exports.XLoginButtin=Lt;exports.XboxLoginButton=$t;exports.YahooLoginButton=Ut;exports.authSchemas=mt;exports.calculatePasswordStrength=W;exports.createPasswordSchema=E;exports.createSignInSchema=O;exports.createSignUpSchema=U;exports.createSocialLoginUrl=at;exports.defaultPasswordRules=I;exports.defaultSignInSchema=ct;exports.defaultSignUpSchema=lt;exports.emailSchema=A;exports.formatAuthError=st;exports.formatProviderName=D;exports.formatSocialLoginText=ot;exports.generateRandomString=G;exports.getProviderColor=et;exports.getProviderIcon=tt;exports.isBrowser=it;exports.isValidEmail=nt;exports.openSocialLoginPopup=rt;exports.providerInfo=$;exports.requestToControllerValidation=z;exports.resetPasswordSchema=M;exports.socialProviderInfo=u;exports.useAuthEmailProp=N;exports.validateEmail=ut;exports.validatePassword=dt;
|
package/dist/auth/index.es.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { localStorageProp as ie, prop as V, Use as x, html as i, attr as t, on as z, When as b, coalesce as h, Ensure as D, computedOf as g, Fragment as C, bind as ce, ForEach as le, Value as ee, OneOfValue as me } from "@tempots/dom";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
2
|
+
import { i as oe, S as $ } from "../stack-BJgsPJ9A.js";
|
|
3
|
+
import { t as ue, u as W, a as se, b as T } from "../use-form-CgZyrACX.js";
|
|
4
|
+
import { s as A, o as G, b as N, M as pe } from "../modal-hkQD1bqZ.js";
|
|
5
|
+
import { AuthI18n as q } from "../translations-DPr6c05Z.js";
|
|
6
|
+
import { P as R, E as H, N as j } from "../notice-CZHWWwOQ.js";
|
|
7
|
+
import { B as F, T as de } from "../text-input-CFJntP7G.js";
|
|
8
|
+
import { I as he } from "../translations-Cq8bUKJP.js";
|
|
7
9
|
import { classes as ge } from "@tempots/ui";
|
|
8
10
|
const X = {
|
|
9
11
|
google: { name: "Google", icon: "logos:google-icon", color: "#4285f4" },
|
|
@@ -54,23 +56,23 @@ const X = {
|
|
|
54
56
|
function fe(e) {
|
|
55
57
|
return X[e]?.name || e;
|
|
56
58
|
}
|
|
57
|
-
function
|
|
59
|
+
function Ce(e) {
|
|
58
60
|
return X[e]?.icon || "mdi:account";
|
|
59
61
|
}
|
|
60
|
-
function
|
|
62
|
+
function ze(e) {
|
|
61
63
|
return X[e]?.color || "#666";
|
|
62
64
|
}
|
|
63
|
-
function
|
|
65
|
+
function Ee(e, o = "Continue with {provider}") {
|
|
64
66
|
return o.replace("{provider}", fe(e));
|
|
65
67
|
}
|
|
66
|
-
const
|
|
68
|
+
const I = {
|
|
67
69
|
minLength: 8,
|
|
68
70
|
requireUppercase: !0,
|
|
69
71
|
requireLowercase: !0,
|
|
70
72
|
requireNumbers: !0,
|
|
71
73
|
requireSymbols: !1
|
|
72
74
|
};
|
|
73
|
-
function
|
|
75
|
+
function Ue(e) {
|
|
74
76
|
return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e);
|
|
75
77
|
}
|
|
76
78
|
function be(e = 32) {
|
|
@@ -80,7 +82,7 @@ function be(e = 32) {
|
|
|
80
82
|
c += o.charAt(Math.floor(Math.random() * o.length));
|
|
81
83
|
return c;
|
|
82
84
|
}
|
|
83
|
-
function
|
|
85
|
+
function Ve(e, o, c, m = [], l = {}) {
|
|
84
86
|
const s = {
|
|
85
87
|
google: "https://accounts.google.com/oauth/authorize",
|
|
86
88
|
github: "https://github.com/login/oauth/authorize",
|
|
@@ -144,7 +146,7 @@ function Ee(e, o, c, m = [], l = {}) {
|
|
|
144
146
|
});
|
|
145
147
|
return `${n}?${f.toString()}`;
|
|
146
148
|
}
|
|
147
|
-
function
|
|
149
|
+
function Fe(e, o, c, m) {
|
|
148
150
|
const l = window.open(
|
|
149
151
|
e,
|
|
150
152
|
`${o}_login`,
|
|
@@ -161,10 +163,10 @@ function Ue(e, o, c, m) {
|
|
|
161
163
|
};
|
|
162
164
|
window.addEventListener("message", u);
|
|
163
165
|
}
|
|
164
|
-
function
|
|
166
|
+
function Me(e) {
|
|
165
167
|
return e instanceof Error ? e.message : typeof e == "string" ? e : e && typeof e == "object" && "message" in e ? String(e.message) : "An unexpected error occurred";
|
|
166
168
|
}
|
|
167
|
-
function
|
|
169
|
+
function Oe() {
|
|
168
170
|
return typeof window < "u" && typeof document < "u";
|
|
169
171
|
}
|
|
170
172
|
function Y({
|
|
@@ -184,7 +186,7 @@ function Y({
|
|
|
184
186
|
return m?.(), s;
|
|
185
187
|
};
|
|
186
188
|
}
|
|
187
|
-
function Z(e =
|
|
189
|
+
function Z(e = I) {
|
|
188
190
|
let o = A();
|
|
189
191
|
return e.minLength && (o = o.min(
|
|
190
192
|
e.minLength,
|
|
@@ -214,7 +216,7 @@ function J(e) {
|
|
|
214
216
|
rememberMe: N().default(!1)
|
|
215
217
|
}).schema();
|
|
216
218
|
}
|
|
217
|
-
function K(e =
|
|
219
|
+
function K(e = I, o) {
|
|
218
220
|
const c = Z(e), m = o?.showNameField !== !1, l = o?.showConfirmPassword !== !1, s = o?.showAcceptTermsAndConditions !== !1, u = {
|
|
219
221
|
name: m ? A().min(1, "Name is required").optional() : A().optional(),
|
|
220
222
|
email: M,
|
|
@@ -236,20 +238,20 @@ function K(e = T, o) {
|
|
|
236
238
|
}
|
|
237
239
|
const ae = G({
|
|
238
240
|
email: M
|
|
239
|
-
}).schema(),
|
|
241
|
+
}).schema(), Ne = J(), Re = K(), De = {
|
|
240
242
|
signIn: J,
|
|
241
243
|
signUp: K,
|
|
242
244
|
resetPassword: () => ae
|
|
243
245
|
};
|
|
244
|
-
function
|
|
246
|
+
function We(e) {
|
|
245
247
|
const o = M.validate(e);
|
|
246
248
|
return o.success ? null : o.errors[0]?.message || "Invalid email";
|
|
247
249
|
}
|
|
248
|
-
function
|
|
250
|
+
function Ge(e, o = I) {
|
|
249
251
|
const m = Z(o).validate(e);
|
|
250
252
|
return m.success ? null : m.errors[0]?.message || "Invalid password";
|
|
251
253
|
}
|
|
252
|
-
function Q(e, o =
|
|
254
|
+
function Q(e, o = I) {
|
|
253
255
|
const c = {
|
|
254
256
|
length: e.length >= (o.minLength || 8),
|
|
255
257
|
uppercase: /[A-Z]/.test(e),
|
|
@@ -327,12 +329,12 @@ function we({
|
|
|
327
329
|
)
|
|
328
330
|
),
|
|
329
331
|
// Email field
|
|
330
|
-
|
|
332
|
+
T(H, {
|
|
331
333
|
controller: f,
|
|
332
334
|
label: h(c?.emailLabel, _.$.emailLabel)
|
|
333
335
|
}),
|
|
334
336
|
// Password field
|
|
335
|
-
|
|
337
|
+
T(R, {
|
|
336
338
|
controller: w,
|
|
337
339
|
label: h(c?.passwordLabel, _.$.passwordLabel)
|
|
338
340
|
}),
|
|
@@ -374,7 +376,7 @@ function we({
|
|
|
374
376
|
}
|
|
375
377
|
function _e({
|
|
376
378
|
password: e,
|
|
377
|
-
rules: o =
|
|
379
|
+
rules: o = I,
|
|
378
380
|
showLabel: c = !0,
|
|
379
381
|
className: m
|
|
380
382
|
}) {
|
|
@@ -540,9 +542,9 @@ function _e({
|
|
|
540
542
|
)
|
|
541
543
|
);
|
|
542
544
|
}
|
|
543
|
-
function
|
|
545
|
+
function He({
|
|
544
546
|
password: e,
|
|
545
|
-
rules: o =
|
|
547
|
+
rules: o = I,
|
|
546
548
|
className: c
|
|
547
549
|
}) {
|
|
548
550
|
const m = g(e)((n) => !n || n.length === 0 ? { strength: "weak", score: 0 } : Q(n, o)), l = m.map((n) => n.strength), s = m.map((n) => n.score), u = g(
|
|
@@ -561,9 +563,9 @@ function We({
|
|
|
561
563
|
)
|
|
562
564
|
);
|
|
563
565
|
}
|
|
564
|
-
function
|
|
566
|
+
function je({
|
|
565
567
|
password: e,
|
|
566
|
-
rules: o =
|
|
568
|
+
rules: o = I,
|
|
567
569
|
className: c
|
|
568
570
|
}) {
|
|
569
571
|
const m = g(e)((s) => !s || s.length === 0 ? "weak" : Q(s, o).strength), l = g(
|
|
@@ -612,7 +614,7 @@ function Le({
|
|
|
612
614
|
showAcceptTermsAndConditions: r,
|
|
613
615
|
termsAndConditions: a
|
|
614
616
|
}) {
|
|
615
|
-
const f = V(!1), w = e ||
|
|
617
|
+
const f = V(!1), w = e || I, _ = K(w, {
|
|
616
618
|
showNameField: u !== !1,
|
|
617
619
|
showConfirmPassword: n !== !1,
|
|
618
620
|
showAcceptTermsAndConditions: r !== !1
|
|
@@ -662,7 +664,7 @@ function Le({
|
|
|
662
664
|
// Name field (optional)
|
|
663
665
|
b(
|
|
664
666
|
u !== !1,
|
|
665
|
-
() =>
|
|
667
|
+
() => T(de, {
|
|
666
668
|
controller: S.transform(
|
|
667
669
|
(L) => L ?? "",
|
|
668
670
|
(L) => L === "" ? void 0 : L
|
|
@@ -671,12 +673,12 @@ function Le({
|
|
|
671
673
|
})
|
|
672
674
|
),
|
|
673
675
|
// Email field
|
|
674
|
-
|
|
676
|
+
T(H, {
|
|
675
677
|
controller: E,
|
|
676
678
|
label: h(o?.emailLabel, v.$.emailLabel)
|
|
677
679
|
}),
|
|
678
680
|
// Password field
|
|
679
|
-
|
|
681
|
+
T(R, {
|
|
680
682
|
controller: U,
|
|
681
683
|
label: h(o?.passwordLabel, v.$.passwordLabel)
|
|
682
684
|
}),
|
|
@@ -692,7 +694,7 @@ function Le({
|
|
|
692
694
|
// Confirm password field
|
|
693
695
|
b(
|
|
694
696
|
n ?? !1,
|
|
695
|
-
() =>
|
|
697
|
+
() => T(R, {
|
|
696
698
|
controller: O,
|
|
697
699
|
label: h(
|
|
698
700
|
o?.confirmPasswordLabel,
|
|
@@ -787,7 +789,7 @@ function ke({
|
|
|
787
789
|
$(
|
|
788
790
|
t.class("bc-auth-form__fields"),
|
|
789
791
|
// Email field
|
|
790
|
-
|
|
792
|
+
T(H, {
|
|
791
793
|
controller: n,
|
|
792
794
|
label: h(o?.emailLabel, r.$.emailLabel)
|
|
793
795
|
})
|
|
@@ -1017,99 +1019,99 @@ const p = {
|
|
|
1017
1019
|
color: "blue"
|
|
1018
1020
|
// distinct deep blue tone (not Facebook’s exact blue)
|
|
1019
1021
|
}
|
|
1020
|
-
},
|
|
1022
|
+
}, Xe = (e) => d({
|
|
1021
1023
|
...e,
|
|
1022
1024
|
...p.google,
|
|
1023
1025
|
provider: "google"
|
|
1024
|
-
}),
|
|
1026
|
+
}), Ye = (e) => d({
|
|
1025
1027
|
...e,
|
|
1026
1028
|
...p.github,
|
|
1027
1029
|
provider: "github"
|
|
1028
|
-
}),
|
|
1030
|
+
}), Ze = (e) => d({
|
|
1029
1031
|
...e,
|
|
1030
1032
|
...p.apple,
|
|
1031
1033
|
provider: "apple"
|
|
1032
|
-
}),
|
|
1034
|
+
}), Je = (e) => d({
|
|
1033
1035
|
...e,
|
|
1034
1036
|
...p.facebook,
|
|
1035
1037
|
provider: "facebook"
|
|
1036
|
-
}),
|
|
1038
|
+
}), Ke = (e) => d({
|
|
1037
1039
|
...e,
|
|
1038
1040
|
...p.x,
|
|
1039
1041
|
provider: "x"
|
|
1040
|
-
}),
|
|
1042
|
+
}), Qe = (e) => d({
|
|
1041
1043
|
...e,
|
|
1042
1044
|
...p.twitter,
|
|
1043
1045
|
provider: "twitter"
|
|
1044
|
-
}),
|
|
1046
|
+
}), eo = (e) => d({
|
|
1045
1047
|
...e,
|
|
1046
1048
|
...p.microsoft,
|
|
1047
1049
|
provider: "microsoft"
|
|
1048
|
-
}),
|
|
1050
|
+
}), oo = (e) => d({
|
|
1049
1051
|
...e,
|
|
1050
1052
|
...p.discord,
|
|
1051
1053
|
provider: "discord"
|
|
1052
|
-
}),
|
|
1054
|
+
}), to = (e) => d({
|
|
1053
1055
|
...e,
|
|
1054
1056
|
...p.linkedin,
|
|
1055
1057
|
provider: "linkedin"
|
|
1056
|
-
}),
|
|
1058
|
+
}), no = (e) => d({
|
|
1057
1059
|
...e,
|
|
1058
1060
|
...p.instagram,
|
|
1059
1061
|
provider: "instagram"
|
|
1060
|
-
}),
|
|
1062
|
+
}), so = (e) => d({
|
|
1061
1063
|
...e,
|
|
1062
1064
|
...p.tiktok,
|
|
1063
1065
|
provider: "tiktok"
|
|
1064
|
-
}),
|
|
1066
|
+
}), ao = (e) => d({
|
|
1065
1067
|
...e,
|
|
1066
1068
|
...p.snapchat,
|
|
1067
1069
|
provider: "snapchat"
|
|
1068
|
-
}),
|
|
1070
|
+
}), ro = (e) => d({
|
|
1069
1071
|
...e,
|
|
1070
1072
|
...p.reddit,
|
|
1071
1073
|
provider: "reddit"
|
|
1072
|
-
}),
|
|
1074
|
+
}), io = (e) => d({
|
|
1073
1075
|
...e,
|
|
1074
1076
|
...p.pinterest,
|
|
1075
1077
|
provider: "pinterest"
|
|
1076
|
-
}),
|
|
1078
|
+
}), co = (e) => d({
|
|
1077
1079
|
...e,
|
|
1078
1080
|
...p.twitch,
|
|
1079
1081
|
provider: "twitch"
|
|
1080
|
-
}),
|
|
1082
|
+
}), lo = (e) => d({
|
|
1081
1083
|
...e,
|
|
1082
1084
|
...p.steam,
|
|
1083
1085
|
provider: "steam"
|
|
1084
|
-
}),
|
|
1086
|
+
}), mo = (e) => d({
|
|
1085
1087
|
...e,
|
|
1086
1088
|
...p.epic,
|
|
1087
1089
|
provider: "epic"
|
|
1088
|
-
}),
|
|
1090
|
+
}), uo = (e) => d({
|
|
1089
1091
|
...e,
|
|
1090
1092
|
...p.playstation,
|
|
1091
1093
|
provider: "playstation"
|
|
1092
|
-
}),
|
|
1094
|
+
}), po = (e) => d({
|
|
1093
1095
|
...e,
|
|
1094
1096
|
...p.xbox,
|
|
1095
1097
|
provider: "xbox"
|
|
1096
|
-
}),
|
|
1098
|
+
}), ho = (e) => d({
|
|
1097
1099
|
...e,
|
|
1098
1100
|
...p.whatsapp,
|
|
1099
1101
|
provider: "whatsapp"
|
|
1100
|
-
}),
|
|
1102
|
+
}), go = (e) => d({
|
|
1101
1103
|
...e,
|
|
1102
1104
|
...p.wechat,
|
|
1103
1105
|
provider: "wechat"
|
|
1104
|
-
}),
|
|
1106
|
+
}), fo = (e) => d({
|
|
1105
1107
|
...e,
|
|
1106
1108
|
...p.amazon,
|
|
1107
1109
|
provider: "amazon"
|
|
1108
|
-
}),
|
|
1110
|
+
}), bo = (e) => d({
|
|
1109
1111
|
...e,
|
|
1110
1112
|
...p.yahoo,
|
|
1111
1113
|
provider: "yahoo"
|
|
1112
|
-
}),
|
|
1114
|
+
}), wo = (e) => d({
|
|
1113
1115
|
...e,
|
|
1114
1116
|
...p.paypal,
|
|
1115
1117
|
provider: "paypal"
|
|
@@ -1249,7 +1251,7 @@ function ye({
|
|
|
1249
1251
|
);
|
|
1250
1252
|
});
|
|
1251
1253
|
}
|
|
1252
|
-
function
|
|
1254
|
+
function _o(e) {
|
|
1253
1255
|
return pe(
|
|
1254
1256
|
{
|
|
1255
1257
|
size: "sm",
|
|
@@ -1286,66 +1288,66 @@ function ne({
|
|
|
1286
1288
|
);
|
|
1287
1289
|
}
|
|
1288
1290
|
export {
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
+
fo as AmazonLoginButton,
|
|
1292
|
+
Ze as AppleLoginButton,
|
|
1291
1293
|
ye as AuthContainer,
|
|
1292
1294
|
ne as AuthDivider,
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1295
|
+
_o as AuthModal,
|
|
1296
|
+
oo as DiscordLoginButton,
|
|
1297
|
+
mo as EpicLoginButton,
|
|
1298
|
+
Je as FacebookLoginButton,
|
|
1299
|
+
Ye as GitHubLoginButton,
|
|
1300
|
+
Xe as GoogleLoginButton,
|
|
1301
|
+
no as InstagramLoginButton,
|
|
1302
|
+
to as LinkedInLoginButton,
|
|
1303
|
+
eo as MicrosoftLoginButton,
|
|
1304
|
+
He as PasswordStrengthBar,
|
|
1303
1305
|
_e as PasswordStrengthIndicator,
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1306
|
+
je as PasswordStrengthText,
|
|
1307
|
+
wo as PayPalLoginButton,
|
|
1308
|
+
io as PinterestLoginButton,
|
|
1309
|
+
uo as PlayStationLoginButton,
|
|
1310
|
+
ro as RedditLoginButton,
|
|
1309
1311
|
ke as ResetPasswordForm,
|
|
1310
1312
|
we as SignInForm,
|
|
1311
1313
|
Le as SignUpForm,
|
|
1312
|
-
|
|
1314
|
+
ao as SnapchatLoginButton,
|
|
1313
1315
|
d as SocialLoginButton,
|
|
1314
1316
|
ve as SocialLoginButtons,
|
|
1315
1317
|
te as SocialProviders,
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1318
|
+
lo as SteamLoginButton,
|
|
1319
|
+
so as TiktokLoginButton,
|
|
1320
|
+
co as TwitchLoginButton,
|
|
1321
|
+
Qe as TwitterLoginButton,
|
|
1322
|
+
go as WeChatLoginButton,
|
|
1323
|
+
ho as WhatsAppLoginButton,
|
|
1324
|
+
Ke as XLoginButtin,
|
|
1325
|
+
po as XboxLoginButton,
|
|
1326
|
+
bo as YahooLoginButton,
|
|
1327
|
+
De as authSchemas,
|
|
1326
1328
|
Q as calculatePasswordStrength,
|
|
1327
1329
|
Z as createPasswordSchema,
|
|
1328
1330
|
J as createSignInSchema,
|
|
1329
1331
|
K as createSignUpSchema,
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1332
|
+
Ve as createSocialLoginUrl,
|
|
1333
|
+
I as defaultPasswordRules,
|
|
1334
|
+
Ne as defaultSignInSchema,
|
|
1335
|
+
Re as defaultSignUpSchema,
|
|
1334
1336
|
M as emailSchema,
|
|
1335
|
-
|
|
1337
|
+
Me as formatAuthError,
|
|
1336
1338
|
fe as formatProviderName,
|
|
1337
|
-
|
|
1339
|
+
Ee as formatSocialLoginText,
|
|
1338
1340
|
be as generateRandomString,
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1341
|
+
ze as getProviderColor,
|
|
1342
|
+
Ce as getProviderIcon,
|
|
1343
|
+
Oe as isBrowser,
|
|
1344
|
+
Ue as isValidEmail,
|
|
1345
|
+
Fe as openSocialLoginPopup,
|
|
1344
1346
|
X as providerInfo,
|
|
1345
1347
|
Y as requestToControllerValidation,
|
|
1346
1348
|
ae as resetPasswordSchema,
|
|
1347
1349
|
p as socialProviderInfo,
|
|
1348
1350
|
re as useAuthEmailProp,
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
+
We as validateEmail,
|
|
1352
|
+
Ge as validatePassword
|
|
1351
1353
|
};
|