wiki-security-social 0.1.0-rc.8 → 0.1.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.
@@ -1,4 +1,4 @@
1
- /* wiki-security-social - 0.1.0-rc.8 - Mon, 07 Sep 2026 11:18:56 GMT */
1
+ /* wiki-security-social - 0.1.0 - Mon, 14 Sep 2026 10:58:44 GMT */
2
2
  (()=>{var K=Symbol.for("better-auth:broadcast-channel"),qe=()=>Math.floor(Date.now()/1e3),$e=class{listeners=new Set;name;constructor(e="better-auth.message"){this.name=e}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}post(e){if(!(typeof window>"u"))try{localStorage.setItem(this.name,JSON.stringify({...e,timestamp:qe()}))}catch{}}setup(){if(typeof window>"u"||typeof window.addEventListener>"u")return()=>{};let e=t=>{if(t.key!==this.name)return;let r=JSON.parse(t.newValue??"{}");r?.event!=="session"||!r?.data||this.listeners.forEach(n=>n(r))};return window.addEventListener("storage",e),()=>{window.removeEventListener("storage",e)}}};function H(e="better-auth.message"){return globalThis[K]||(globalThis[K]=new $e(e)),globalThis[K]}var _=[],x=0,q=null,X=4,Ve=globalThis.nanostoresGlobal||={epoch:0},We=()=>{let e,t;for(;x<_.length;){t=x,x+=X;try{_[t](_[t+1].value,_[t+2],_[t+3])}catch(r){e=r}}if(_.length=x=0,e)throw e};var $=e=>{let t=[],r={eq:Object.is,get(){return r.lc||r.listen(()=>{})(),r.value},init:e,lc:0,listen(n){return r.lc=t.push(n),()=>{for(let i=x;i<_.length;)_[i]===n?_.splice(i,X):i+=X;let o=t.indexOf(n);~o&&(t.splice(o,1),--r.lc||r.off())}},notify(n,o){Ve.epoch++;let i=!_.length&&!q;for(let a of t)q?.has(a)||(q?.add(a),_.push(a,r,n,q?void 0:o));i&&We()},off(){},set(n){let o=r.value;r.eq(o,n)||(r.value=n,r.notify(o))},subscribe(n){let o=r.listen(n);return n(r.value),o},value:e};return r};var Ge=2;var ze=5,V=6,W=10,ce=(e,t,r,n)=>(e.events=e.events||{},e.events[r+W]||(e.events[r+W]=n(o=>{e.events[r].reduceRight((i,a)=>(a(i),i),{shared:{},...o})})),e.events[r]=e.events[r]||[],e.events[r].push(t),()=>{let o=e.events[r],i=o.indexOf(t);~i&&(o.splice(i,1),o.length||(e.events[r+W](),delete e.events[r+W]))});var Z=(e,t)=>ce(e,t,Ge,r=>{let n=e.set,o=e.setKey;return e.setKey&&(e.setKey=(i,a)=>{let u;if(r({abort:()=>{u=!0},changed:i,newValue:{...e.value,[i]:a}}),!u)return o(i,a)}),e.set=i=>{let a;if(r({abort:()=>{a=!0},newValue:i}),!a)return n(i)},()=>{e.set=n,e.setKey=o}});var G=1e3,ee=(e,t)=>ce(e,n=>{let o=t(n);o&&e.events[V].push(o)},ze,n=>{let o=e.listen;e.listen=(...a)=>(!e.lc&&!e.active&&(e.active=!0,n()),o(...a));let i=e.off;return e.events[V]=[],e.off=()=>{i(),setTimeout(()=>{if(e.active&&!e.lc){e.active=!1;for(let a of e.events[V])a();e.events[V]=[]}},G)},()=>{e.listen=o,e.off=i}});function fe(e){if(typeof e!="object"||e===null)return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function k(e,t){if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(!k(e[r],t[r]))return!1;return!0}if(fe(e)&&fe(t)){let r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(let o of r)if(!(o in t)||!k(e[o],t[o]))return!1;return!0}return!1}function de(e,t){return Z(e,({newValue:r,abort:n})=>{t(e.value,r)&&n()})}var te=Symbol.for("better-auth:focus-manager"),Ye=class{listeners=new Set;subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}setFocused(e){this.listeners.forEach(t=>t(e))}setup(){if(typeof window>"u"||typeof document>"u"||typeof window.addEventListener>"u")return()=>{};let e=()=>{document.visibilityState==="visible"&&this.setFocused(!0)};return document.addEventListener("visibilitychange",e,!1),()=>{document.removeEventListener("visibilitychange",e,!1)}}};function re(){return globalThis[te]||(globalThis[te]=new Ye),globalThis[te]}var ne=Symbol.for("better-auth:online-manager"),Je=class{listeners=new Set;isOnline=typeof navigator<"u"?navigator.onLine:!0;subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}setOnline(e){this.isOnline=e,this.listeners.forEach(t=>t(e))}setup(){if(typeof window>"u"||typeof window.addEventListener>"u")return()=>{};let e=()=>this.setOnline(!0),t=()=>this.setOnline(!1);return window.addEventListener("online",e,!1),window.addEventListener("offline",t,!1),()=>{window.removeEventListener("online",e,!1),window.removeEventListener("offline",t,!1)}}};function z(){return globalThis[ne]||(globalThis[ne]=new Je),globalThis[ne]}var Qe={proto:/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,constructor:/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,protoShort:/"__proto__"\s*:/,constructorShort:/"constructor"\s*:/},Ke=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/,pe={true:!0,false:!1,null:null,undefined:void 0,nan:NaN,infinity:Number.POSITIVE_INFINITY,"-infinity":Number.NEGATIVE_INFINITY},Xe=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.(\d{1,7}))?(?:Z|([+-])(\d{2}):(\d{2}))$/;function Ze(e){return e instanceof Date&&!isNaN(e.getTime())}function et(e){let t=Xe.exec(e);if(!t)return null;let[,r,n,o,i,a,u,s,c,l,m]=t,p=new Date(Date.UTC(parseInt(r,10),parseInt(n,10)-1,parseInt(o,10),parseInt(i,10),parseInt(a,10),parseInt(u,10),s?parseInt(s.padEnd(3,"0"),10):0));if(c){let d=(parseInt(l,10)*60+parseInt(m,10))*(c==="+"?-1:1);p.setUTCMinutes(p.getUTCMinutes()+d)}return Ze(p)?p:null}function tt(e,t={}){let{strict:r=!1,warnings:n=!1,reviver:o,parseDates:i=!0}=t;if(typeof e!="string")return e;let a=e.trim(),u=a.toLowerCase();if(u.length<=9&&u in pe)return pe[u];if(!Ke.test(a)){if(r)throw new SyntaxError("[better-json] Invalid JSON");return e}if(Object.entries(Qe).some(([s,c])=>{let l=c.test(a);return l&&n&&console.warn(`[better-json] Detected potential prototype pollution attempt using ${s} pattern`),l})&&r)throw new Error("[better-json] Potential prototype pollution attempt detected");try{return JSON.parse(a,(c,l)=>{if(c==="__proto__"||c==="constructor"&&l&&typeof l=="object"&&"prototype"in l){n&&console.warn(`[better-json] Dropping "${c}" key to prevent prototype pollution`);return}if(i&&typeof l=="string"){let m=et(l);if(m)return m}return o?o(c,l):l})}catch(s){if(r)throw s;return e}}function he(e,t={strict:!0}){return tt(e,t)}var oe=()=>Math.floor(Date.now()/1e3),rt=5;function me(e){let{fetchSession:t,shouldPollSession:r=()=>!0,sessionSignal:n,options:o={}}=e,i=o.sessionOptions?.refetchInterval??0,a=o.sessionOptions?.refetchOnWindowFocus??!0,u=o.sessionOptions?.refetchWhenOffline??!1,s={isInitialized:!1,lastSessionRequest:0},c=()=>u||z().isOnline,l=v=>{if(c()){if(v?.event==="storage"){t();return}if(v?.event==="poll"){s.lastSessionRequest=oe(),t();return}if(v?.event==="visibilitychange"){if(oe()-s.lastSessionRequest<rt)return;s.lastSessionRequest=oe(),t();return}t()}},m=v=>{H().post({event:"session",data:{trigger:v},clientId:Math.random().toString(36).substring(7)})},p=()=>{i&&i>0&&(s.pollInterval=setInterval(()=>{r()&&l({event:"poll"})},i*1e3))},d=()=>{s.unsubscribeBroadcast=H().subscribe(()=>{l({event:"storage"})})},E=()=>{a&&(s.unsubscribeFocus=re().subscribe(()=>{l({event:"visibilitychange"})}))},y=()=>{s.unsubscribeOnline=z().subscribe(v=>{v&&l({event:"visibilitychange"})})},T=()=>{s.unsubscribeSignal=n.listen(()=>{t()})};return{init:()=>{s.isInitialized||(s.isInitialized=!0,p(),d(),E(),y(),T(),s.cleanupBroadcastSetup=H().setup(),s.cleanupFocusSetup=re().setup(),s.cleanupOnlineSetup=z().setup())},cleanup:()=>{s.isInitialized&&(s.pollInterval&&(clearInterval(s.pollInterval),s.pollInterval=void 0),s.unsubscribeBroadcast&&(s.unsubscribeBroadcast(),s.unsubscribeBroadcast=void 0),s.unsubscribeFocus&&(s.unsubscribeFocus(),s.unsubscribeFocus=void 0),s.unsubscribeOnline&&(s.unsubscribeOnline(),s.unsubscribeOnline=void 0),s.unsubscribeSignal&&(s.unsubscribeSignal(),s.unsubscribeSignal=void 0),s.cleanupBroadcastSetup&&(s.cleanupBroadcastSetup(),s.cleanupBroadcastSetup=void 0),s.cleanupFocusSetup&&(s.cleanupFocusSetup(),s.cleanupFocusSetup=void 0),s.cleanupOnlineSetup&&(s.cleanupOnlineSetup(),s.cleanupOnlineSetup=void 0),s.isInitialized=!1,s.lastSessionRequest=0)},triggerRefetch:l,broadcastSessionUpdate:m}}var Y=Object.create(null),M=e=>globalThis.process?.env||globalThis.Deno?.env.toObject()||globalThis.__env__||(e?Y:globalThis),L=new Proxy(Y,{get(e,t){return M()[t]??Y[t]},has(e,t){return t in M()||t in Y},set(e,t,r){let n=M(!0);return n[t]=r,!0},deleteProperty(e,t){if(!t)return!1;let r=M(!0);return delete r[t],!0},ownKeys(){let e=M(!0);return Object.keys(e)}});var nt=L.NODE_ENV??"";function N(e,t){return typeof process<"u"&&process.env?process.env[e]??t:typeof Deno<"u"?Deno.env.get(e)??t:typeof Bun<"u"?Bun.env[e]??t:t}var ot=Object.freeze({get BETTER_AUTH_SECRET(){return N("BETTER_AUTH_SECRET")},get AUTH_SECRET(){return N("AUTH_SECRET")},get BETTER_AUTH_TELEMETRY(){return N("BETTER_AUTH_TELEMETRY")},get BETTER_AUTH_TELEMETRY_ID(){return N("BETTER_AUTH_TELEMETRY_ID")},get NODE_ENV(){return N("NODE_ENV","development")},get PACKAGE_VERSION(){return N("PACKAGE_VERSION","0.0.0")},get BETTER_AUTH_TELEMETRY_ENDPOINT(){return N("BETTER_AUTH_TELEMETRY_ENDPOINT","")}});function st(){let e=Object.getOwnPropertyDescriptor(Error,"stackTraceLimit");return e===void 0?Object.isExtensible(Error):Object.prototype.hasOwnProperty.call(e,"writable")?e.writable:e.set!==void 0}function it(e){let t=e.split(`
3
3
  at `);return t.length<=1?e:(t.splice(1,1),t.join(`
4
4
  at `))}function at(e,t){class r extends e{#e;constructor(...o){if(st()){let a=Error.stackTraceLimit;Error.stackTraceLimit=0,super(...o),Error.stackTraceLimit=a}else super(...o);let i=new Error().stack;i&&(this.#e=it(i.replace(/^Error/,this.name)))}get errorStack(){return this.#e}}return Object.defineProperty(r.prototype,"constructor",{get(){return t},enumerable:!1,configurable:!0}),r}var lt={OK:200,CREATED:201,ACCEPTED:202,NO_CONTENT:204,MULTIPLE_CHOICES:300,MOVED_PERMANENTLY:301,FOUND:302,SEE_OTHER:303,NOT_MODIFIED:304,TEMPORARY_REDIRECT:307,BAD_REQUEST:400,UNAUTHORIZED:401,PAYMENT_REQUIRED:402,FORBIDDEN:403,NOT_FOUND:404,METHOD_NOT_ALLOWED:405,NOT_ACCEPTABLE:406,PROXY_AUTHENTICATION_REQUIRED:407,REQUEST_TIMEOUT:408,CONFLICT:409,GONE:410,LENGTH_REQUIRED:411,PRECONDITION_FAILED:412,PAYLOAD_TOO_LARGE:413,URI_TOO_LONG:414,UNSUPPORTED_MEDIA_TYPE:415,RANGE_NOT_SATISFIABLE:416,EXPECTATION_FAILED:417,"I'M_A_TEAPOT":418,MISDIRECTED_REQUEST:421,UNPROCESSABLE_ENTITY:422,LOCKED:423,FAILED_DEPENDENCY:424,TOO_EARLY:425,UPGRADE_REQUIRED:426,PRECONDITION_REQUIRED:428,TOO_MANY_REQUESTS:429,REQUEST_HEADER_FIELDS_TOO_LARGE:431,UNAVAILABLE_FOR_LEGAL_REASONS:451,INTERNAL_SERVER_ERROR:500,NOT_IMPLEMENTED:501,BAD_GATEWAY:502,SERVICE_UNAVAILABLE:503,GATEWAY_TIMEOUT:504,HTTP_VERSION_NOT_SUPPORTED:505,VARIANT_ALSO_NEGOTIATES:506,INSUFFICIENT_STORAGE:507,LOOP_DETECTED:508,NOT_EXTENDED:510,NETWORK_AUTHENTICATION_REQUIRED:511},ut=class extends Error{status;body;headers;statusCode;constructor(e="INTERNAL_SERVER_ERROR",t=void 0,r={},n=typeof e=="number"?e:lt[e]){super(t?.message,t?.cause?{cause:t.cause}:void 0),this.status=e,this.body=t,this.headers=r,this.statusCode=n,this.name="APIError",this.status=e,this.headers=r,this.statusCode=n,this.body=t}};var ct=at(ut,Error);var C=class extends Error{constructor(e,t){super(e,t),this.name="BetterAuthError",this.message=e,this.stack=""}};var ft=47;function ge(e){let t=e.length;for(;t>0&&e.charCodeAt(t-1)===ft;)t--;return t===e.length?e:e.slice(0,t)}function dt(e){try{return(ge(new URL(e).pathname)||"/")!=="/"}catch{throw new C(`Invalid base URL: ${e}. Please provide a valid base URL.`)}}function pt(e){try{let t=new URL(e);if(t.protocol!=="http:"&&t.protocol!=="https:")throw new C(`Invalid base URL: ${e}. URL must include 'http://' or 'https://'`)}catch(t){throw t instanceof C?t:new C(`Invalid base URL: ${e}. Please provide a valid base URL.`,{cause:t})}}function F(e,t="/api/auth"){if(pt(e),dt(e))return e;let r=ge(e);return!t||t==="/"?r:(t=t.startsWith("/")?t:`/${t}`,`${r}${t}`)}function Ee(e,t){return!e||e.trim()===""?!1:t==="proto"?e==="http"||e==="https":t==="host"?[/\.\./,/\0/,/[\s]/,/^[.]/,/[<>'"]/,/javascript:/i,/file:/i,/data:/i].some(r=>r.test(e))?!1:/^[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(\.[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*(:[0-9]{1,5})?$/.test(e)||/^(\d{1,3}\.){3}\d{1,3}(:[0-9]{1,5})?$/.test(e)||/^\[[0-9a-fA-F:]+\](:[0-9]{1,5})?$/.test(e)||/^localhost(:[0-9]{1,5})?$/i.test(e):!1}function ye(e,t,r,n,o){if(e)return F(e,t);if(n!==!1){let u=L.BETTER_AUTH_URL||L.NEXT_PUBLIC_BETTER_AUTH_URL||L.PUBLIC_BETTER_AUTH_URL||L.NUXT_PUBLIC_BETTER_AUTH_URL||L.NUXT_PUBLIC_AUTH_URL||(L.BASE_URL!=="/"?L.BASE_URL:void 0);if(u)return F(u,t)}let i=r?.headers.get("x-forwarded-host"),a=r?.headers.get("x-forwarded-proto");if(i&&a&&o&&Ee(a,"proto")&&Ee(i,"host"))try{return F(`${a}://${i}`,t)}catch{}if(r){let u=ht(r.url);if(!u)throw new C("Could not get origin from request. Please provide a valid base URL.");return F(u,t)}if(typeof window<"u"&&window.location)return F(window.location.origin,t)}function ht(e){try{let t=new URL(e);return t.origin==="null"?null:t.origin}catch{return null}}var mt=["javascript:","data:","vbscript:"];function Te(e){let t;try{t=new URL(e)}catch{return!0}return!mt.includes(t.protocol)}var ve={id:"redirect",name:"Redirect",hooks:{onSuccess(e){if(e.data?.url&&e.data?.redirect&&Te(e.data.url)&&typeof window<"u"&&window.location&&window.location)try{window.location.href=e.data.url}catch{}}}};var Et=()=>typeof window>"u",gt=G;function be(e,t){if(typeof window>"u")return;let r=e.get();r.data!==null||t===null||e.set({...r,data:t,error:null,isPending:!1})}function Re(e){return typeof e=="object"&&e!==null&&"data"in e&&"error"in e?e:{data:e,error:null}}function yt(e){return!e||e.session===null&&e.user===null?null:e}function Tt(e,t){return k(e.data,t.data)&&e.error===t.error&&e.isPending===t.isPending&&e.isRefetching===t.isRefetching&&e.refetch===t.refetch}function Se(e,t){let r=$(!1),n,o=0,i=0;r.listen(()=>{i++,o=0});let a=d=>l(d),u=$({data:null,error:null,isPending:!0,isRefetching:!1,refetch:a});de(u,Tt);let s=async(d,E)=>{let y=u.value;if(u.set({...y,isPending:y.data===null,isRefetching:!0,error:null,refetch:a}),d.aborted)return"aborted";try{let T=await e("/get-session",{method:"GET",query:E?.query,signal:d});if(d.aborted)return"aborted";let{data:R,error:w}=Re(T),v="fresh";if(R?.needsRefresh)try{let f=await e("/get-session",{method:"POST",signal:d});if(d.aborted)return"aborted";({data:R,error:w}=Re(f))}catch{if(d.aborted)return"aborted";v="stale"}if(w){let f=u.value,D=w?.status===401;return u.set({data:D?null:f.data,error:w,isPending:!1,isRefetching:!1,refetch:a}),"failed"}let g=yt(R),S=u.value,h=S.data!=null&&g!=null&&k(S.data,g)?S.data:g;return u.set({data:h,error:null,isPending:!1,isRefetching:!1,refetch:a}),v}catch(T){if(d.aborted)return"aborted";let R=u.value;return u.set({data:R.data,error:T,isPending:!1,isRefetching:!1,refetch:a}),"failed"}},c=()=>{let d=u.value.data?.session?.expiresAt,E=d instanceof Date?d.getTime():Number.POSITIVE_INFINITY;return Math.min(Date.now()+gt,E)},l=d=>{o=0,n?.cancel();let E=new AbortController,y={cancel:()=>E.abort(),promise:Promise.resolve().then(()=>E.signal.aborted?"aborted":s(E.signal,d)),revision:i};n=y;let T=R=>{n===y&&(n=void 0,R==="fresh"&&y.revision===i&&(o=c()))};return y.promise.then(T,()=>T("failed")),y.promise.then(()=>{})},m=()=>n?.revision===i?n.promise.then(()=>{}):Date.now()<o?Promise.resolve():l(),p=()=>{};return ee(u,()=>{let d;Et()||(d=setTimeout(()=>{m()},0));let E=me({fetchSession:l,shouldPollSession:()=>u.value.data!=null,sessionSignal:r,options:t});return E.init(),p=E.broadcastSessionUpdate,()=>{d&&clearTimeout(d),E.cleanup()}}),{session:u,$sessionSignal:r,broadcastSessionUpdate:d=>p(d)}}function se(e){if(e===null||typeof e!="object")return!1;let t=Object.getPrototypeOf(e);return t!==null&&t!==Object.prototype&&Object.getPrototypeOf(t)!==null||Symbol.iterator in e?!1:Symbol.toStringTag in e?Object.prototype.toString.call(e)==="[object Module]":!0}function ie(e,t,r=".",n){if(!se(t))return ie(e,{},r,n);let o={...t};for(let i of Object.keys(e)){if(i==="__proto__"||i==="constructor")continue;let a=e[i];a!=null&&(n&&n(o,i,a,r)||(Array.isArray(a)&&Array.isArray(o[i])?o[i]=[...a,...o[i]]:se(a)&&se(o[i])?o[i]=ie(a,o[i],(r?`${r}.`:"")+i.toString(),n):o[i]=a))}return o}function ae(e){return(...t)=>t.reduce((r,n)=>ie(r,n,"",e),{})}var we=ae(),qr=ae((e,t,r)=>{if(e[t]!==void 0&&typeof r=="function")return e[t]=r(e[t]),!0}),$r=ae((e,t,r)=>{if(Array.isArray(e[t])&&typeof r=="function")return e[t]=r(e[t]),!0});var vt=Object.defineProperty,Rt=Object.defineProperties,bt=Object.getOwnPropertyDescriptors,Oe=Object.getOwnPropertySymbols,St=Object.prototype.hasOwnProperty,wt=Object.prototype.propertyIsEnumerable,_e=(e,t,r)=>t in e?vt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,A=(e,t)=>{for(var r in t||(t={}))St.call(t,r)&&_e(e,r,t[r]);if(Oe)for(var r of Oe(t))wt.call(t,r)&&_e(e,r,t[r]);return e},U=(e,t)=>Rt(e,bt(t)),Ot=class extends Error{constructor(e,t,r){super(t||e.toString(),{cause:r}),this.status=e,this.statusText=t,this.error=r,Error.captureStackTrace(this,this.constructor)}},_t=async(e,t)=>{var r,n,o,i,a,u;let s=t||{},c={onRequest:[t?.onRequest],onResponse:[t?.onResponse],onSuccess:[t?.onSuccess],onError:[t?.onError],onRetry:[t?.onRetry]};if(!t||!t?.plugins)return{url:e,options:s,hooks:c};for(let l of t?.plugins||[]){if(l.init){let m=await((r=l.init)==null?void 0:r.call(l,e.toString(),t));s=m.options||s,e=m.url}c.onRequest.push((n=l.hooks)==null?void 0:n.onRequest),c.onResponse.push((o=l.hooks)==null?void 0:o.onResponse),c.onSuccess.push((i=l.hooks)==null?void 0:i.onSuccess),c.onError.push((a=l.hooks)==null?void 0:a.onError),c.onRetry.push((u=l.hooks)==null?void 0:u.onRetry)}return{url:e,options:s,hooks:c}},Ae=class{constructor(e){this.options=e}shouldAttemptRetry(e,t){return this.options.shouldRetry?Promise.resolve(e<this.options.attempts&&this.options.shouldRetry(t)):Promise.resolve(e<this.options.attempts)}getDelay(){return this.options.delay}},At=class{constructor(e){this.options=e}shouldAttemptRetry(e,t){return this.options.shouldRetry?Promise.resolve(e<this.options.attempts&&this.options.shouldRetry(t)):Promise.resolve(e<this.options.attempts)}getDelay(e){return Math.min(this.options.maxDelay,this.options.baseDelay*2**e)}};function Lt(e){if(typeof e=="number")return new Ae({type:"linear",attempts:e,delay:1e3});switch(e.type){case"linear":return new Ae(e);case"exponential":return new At(e);default:throw new Error("Invalid retry strategy")}}var Ut=async e=>{let t={},r=async n=>typeof n=="function"?await n():n;if(e?.auth){if(e.auth.type==="Bearer"){let n=await r(e.auth.token);if(!n)return t;t.authorization=`Bearer ${n}`}else if(e.auth.type==="Basic"){let[n,o]=await Promise.all([r(e.auth.username),r(e.auth.password)]);if(!n||!o)return t;t.authorization=`Basic ${btoa(`${n}:${o}`)}`}else if(e.auth.type==="Custom"){let[n,o]=await Promise.all([r(e.auth.prefix),r(e.auth.value)]);if(!o)return t;t.authorization=`${n??""} ${o}`}}return t},Pt=/^application\/(?:[\w!#$%&*.^`~-]*\+)?json(;.+)?$/i;function It(e){let t=e.headers.get("content-type"),r=new Set(["image/svg","application/xml","application/xhtml","application/html"]);if(!t)return"json";let n=t.split(";").shift()||"";return Pt.test(n)?"json":r.has(n)||n.startsWith("text/")?"text":"blob"}function Nt(e){try{return JSON.parse(e),!0}catch{return!1}}function Pe(e){if(e===void 0)return!1;let t=typeof e;return t==="string"||t==="number"||t==="boolean"||t===null?!0:t!=="object"?!1:Array.isArray(e)?!0:e.buffer?!1:e.constructor&&e.constructor.name==="Object"||typeof e.toJSON=="function"}function Le(e){try{return JSON.parse(e)}catch{return e}}function Ue(e){return typeof e=="function"}function Ct(e){if(e?.customFetchImpl)return e.customFetchImpl;if(typeof globalThis<"u"&&Ue(globalThis.fetch))return globalThis.fetch;if(typeof window<"u"&&Ue(window.fetch))return window.fetch;throw new Error("No fetch implementation found")}function Ie(...e){let t={};for(let r of e)if(r)if(r instanceof Headers)r.forEach((n,o)=>{t[o]=n});else{let n=Array.isArray(r)?r:Object.entries(r);for(let[o,i]of n)i!=null&&(t[o]=i)}return t}async function Dt(e){let t=new Headers(Ie(e?.headers,await Ut(e)));if(!t.has("content-type")){let r=xt(e?.body);r&&t.set("content-type",r)}return t}function xt(e){return Pe(e)?"application/json":null}function kt(e){let t=e.get("content-type");return t?t.split(";")[0].trim().toLowerCase():null}function Mt(e,t){let{body:r}=e;return r?!Pe(r)||typeof r=="string"?r:kt(t)==="application/x-www-form-urlencoded"?new URLSearchParams(r).toString():JSON.stringify(r):null}function Ft(e,t){var r;if(t?.method)return t.method.toUpperCase();if(e.startsWith("@")){let n=(r=e.split("@")[1])==null?void 0:r.split("/")[0];return Ce.includes(n)?n.toUpperCase():t?.body?"POST":"GET"}return t?.body?"POST":"GET"}function Bt(e,t){let r;return!e?.signal&&e?.timeout&&(r=setTimeout(()=>t?.abort(),e?.timeout)),{abortTimeout:r,clearTimeout:()=>{r&&clearTimeout(r)}}}var jt=class Ne extends Error{constructor(t,r){super(r||JSON.stringify(t,null,2)),this.issues=t,Object.setPrototypeOf(this,Ne.prototype)}};async function B(e,t){let r=await e["~standard"].validate(t);if(r.issues)throw new jt(r.issues);return r.value}var Ce=["get","post","put","patch","delete"];var Ht=e=>({id:"apply-schema",name:"Apply Schema",version:"1.0.0",async init(t,r){var n,o,i,a;let u=((o=(n=e.plugins)==null?void 0:n.find(s=>{var c;return(c=s.schema)!=null&&c.config?t.startsWith(s.schema.config.baseURL||"")||t.startsWith(s.schema.config.prefix||""):!1}))==null?void 0:o.schema)||e.schema;if(u){let s=t;(i=u.config)!=null&&i.prefix&&s.startsWith(u.config.prefix)&&(s=s.replace(u.config.prefix,""),u.config.baseURL&&(t=t.replace(u.config.prefix,u.config.baseURL))),(a=u.config)!=null&&a.baseURL&&s.startsWith(u.config.baseURL)&&(s=s.replace(u.config.baseURL,"")),s.startsWith("/")&&s.charAt(1)==="@"&&(s=s.substring(1));let c=u.schema[s];if(c){let l=r?.headers;if(c.headers&&!r?.disableValidation){let p={};if(r?.headers){if(r.headers instanceof Headers)r.headers.forEach((y,T)=>{p[T.toLowerCase()]=y});else if(typeof r.headers=="object")for(let[y,T]of Object.entries(r.headers))T!=null&&(p[y.toLowerCase()]=T)}let d=await B(c.headers,p),E={};for(let[y,T]of Object.entries(d))E[y.toLowerCase()]=T;l=E}let m=U(A({},r),{method:c.method,output:c.output,headers:l});return r?.disableValidation||(m=U(A({},m),{body:c.input?await B(c.input,r?.body):r?.body,params:c.params?await B(c.params,r?.params):r?.params,query:c.query?await B(c.query,r?.query):r?.query})),{url:t,options:m}}}return{url:t,options:r}}}),De=e=>{async function t(r,n){let o=U(A(A({},e),n),{headers:Ie(e?.headers,n?.headers),plugins:[...e?.plugins||[],Ht(e||{}),...n?.plugins||[]]});if(e?.catchAllError)try{return await le(r,o)}catch(i){return{data:null,error:{status:500,statusText:"Fetch Error",message:"Fetch related error. Captured by catchAllError option. See error property for more details.",error:i}}}return await le(r,o)}return t},qt=e=>e==="."||e==="..";function $t(e,t){let r=e;for(let[n,o]of t)r=r.replace(n,o);if(qt(r))throw new TypeError("Path parameters cannot be reserved path segments");return encodeURIComponent(r)}function Vt(e,t){let{baseURL:r,params:n,query:o}=t||{query:{},params:{},baseURL:""},i=e.startsWith("http")?e.split("/").slice(0,3).join("/"):r||"";if(e.startsWith("@")){let p=e.toString().split("@")[1].split("/")[0];Ce.includes(p)&&(e=e.replace(`@${p}/`,"/"))}i.endsWith("/")||(i+="/");let[a,u]=e.replace(i,"").split("?"),s=new URLSearchParams(u);for(let[p,d]of Object.entries(o||{})){if(d==null)continue;let E;if(typeof d=="string")E=d;else if(Array.isArray(d)){for(let y of d)s.append(p,y);continue}else E=JSON.stringify(d);s.set(p,E)}let c=new Map;if(n)if(Array.isArray(n)){let p=a.split("/").filter(d=>d.startsWith(":"));for(let[d,E]of p.entries()){let y=n[d];c.set(E,String(y))}}else for(let[p,d]of Object.entries(n))c.set(`:${p}`,String(d));a=a.split("/").map(p=>$t(p,c)).join("/"),a=a.replace(/^\/+/,"");let l=s.toString();return l=l.length>0?`?${l}`.replace(/\+/g,"%20"):"",i.startsWith("http")?new URL(`${a}${l}`,i):`${i}${a}${l}`}var le=async(e,t)=>{var r,n,o,i,a,u,s,c;let{hooks:l,url:m,options:p}=await _t(e,t),d=Ct(p),E=new AbortController,y=(r=p.signal)!=null?r:E.signal,T=Vt(m,p),R=await Dt(p),w=Mt(p,R),v=Ft(m,p),g=U(A({},p),{url:T,headers:R,body:w,method:v,signal:y});for(let O of l.onRequest)if(O){let b=await O(g);typeof b=="object"&&b!==null&&Object.assign(g,b)}("pipeTo"in g&&typeof g.pipeTo=="function"||typeof((n=t?.body)==null?void 0:n.pipe)=="function")&&("duplex"in g||(g.duplex="half"));let{clearTimeout:S}=Bt(p,E),h=await d(g.url,g);S();let f={response:h,request:g};for(let O of l.onResponse)if(O){let b=await O(U(A({},f),{response:(o=t?.hookOptions)!=null&&o.cloneResponse?h.clone():h}));b instanceof Response?h=b:typeof b=="object"&&b!==null&&(h=b.response)}if(h.ok){if(!(g.method!=="HEAD"))return{data:"",error:null};let b=It(h),P={data:null,response:h,request:g};if(b==="json"||b==="text"){let I=await h.text(),He=(i=g.jsonParser)!=null?i:Le;P.data=await He(I)}else P.data=await h[b]();g?.output&&g.output&&!g.disableValidation&&(P.data=await B(g.output,P.data));for(let I of l.onSuccess)I&&await I(U(A({},P),{response:(a=t?.hookOptions)!=null&&a.cloneResponse?h.clone():h}));return t?.throw?P.data:{data:P.data,error:null}}let D=(u=t?.jsonParser)!=null?u:Le,j=await h.text(),ue=Nt(j),Q=ue?await D(j):null,je={response:h,responseText:j,request:g,error:U(A({},Q),{status:h.status,statusText:h.statusText})};for(let O of l.onError)O&&await O(U(A({},je),{response:(s=t?.hookOptions)!=null&&s.cloneResponse?h.clone():h}));if(t?.retry){let O=Lt(t.retry),b=(c=t.retryAttempt)!=null?c:0;if(await O.shouldAttemptRetry(b,h)){for(let I of l.onRetry)I&&await I(f);let P=O.getDelay(b);return await new Promise(I=>setTimeout(I,P)),await le(e,U(A({},t),{retryAttempt:b+1}))}}if(t?.throw)throw new Ot(h.status,h.statusText,ue?Q:j);return{data:null,error:U(A({},Q),{status:h.status,statusText:h.statusText})}};var Wt=e=>{if(typeof process>"u")return;let t=e??"/api/auth";if(process.env.NEXT_PUBLIC_AUTH_URL)return process.env.NEXT_PUBLIC_AUTH_URL;if(typeof window>"u"){if(process.env.NEXTAUTH_URL)try{return process.env.NEXTAUTH_URL}catch{}if(process.env.VERCEL_URL)try{let r=process.env.VERCEL_URL.startsWith("http")?"":"https://";return`${new URL(`${r}${process.env.VERCEL_URL}`).origin}${t}`}catch{}}},xe=(e,t)=>{let r="credentials"in Request.prototype,n=ye(e?.baseURL,e?.basePath,void 0,t)??Wt(e?.basePath)??"/api/auth",o=e?.plugins?.flatMap(f=>f.fetchPlugins).filter(f=>f!==void 0)||[],i={id:"lifecycle-hooks",name:"lifecycle-hooks",hooks:{onSuccess:e?.fetchOptions?.onSuccess,onError:e?.fetchOptions?.onError,onRequest:e?.fetchOptions?.onRequest,onResponse:e?.fetchOptions?.onResponse}},{onSuccess:a,onError:u,onRequest:s,onResponse:c,...l}=e?.fetchOptions||{},m=De({baseURL:n,...r?{credentials:"include"}:{},method:"GET",jsonParser(f){return f?he(f,{strict:!1}):null},customFetchImpl:fetch,...l,plugins:[i,...l.plugins||[],...e?.disableDefaultFetchPlugins?[]:[ve],...o]}),{$sessionSignal:p,session:d,broadcastSessionUpdate:E}=Se(m,e),y=!1,T=f=>{y||f===null||(y=!0,be(d,f))},R=e?.plugins||[],w={},v={$sessionSignal:p,session:d},g={"/sign-out":"POST","/revoke-sessions":"POST","/revoke-other-sessions":"POST","/delete-user":"POST"},S=[{signal:"$sessionSignal",matcher(f){return f==="/sign-out"||f==="/update-user"||f==="/update-session"||f==="/sign-up/email"||f==="/sign-in/email"||f==="/delete-user"||f==="/verify-email"||f==="/revoke-sessions"||f==="/revoke-session"||f==="/revoke-other-sessions"||f==="/change-email"||f==="/change-password"},callback(f){f==="/sign-out"?E("signout"):(f==="/update-user"||f==="/update-session")&&E("updateUser")}}];for(let f of R)f.getAtoms&&Object.assign(v,f.getAtoms?.(m)),f.pathMethods&&Object.assign(g,f.pathMethods),f.atomListeners&&S.push(...f.atomListeners);let h={notify:f=>{v[f].set(!v[f].get())},listen:(f,D)=>{v[f].subscribe(D)},atoms:v};for(let f of R)f.getActions&&(w=we(f.getActions?.(m,h,e)??{},w));return{get baseURL(){return n},pluginsActions:w,pluginsAtoms:v,pluginPathMethods:g,atomListeners:S,hydrateSession:T,$sessionSignal:p,$fetch:m,$store:h}};function ke(e){return typeof e=="object"&&e!==null&&"get"in e&&typeof e.get=="function"&&"lc"in e&&typeof e.lc=="number"}function Me(e){return e.charAt(0).toUpperCase()+e.slice(1)}var Gt=/[\p{Ll}\d]+|\p{Lu}+(?!\p{Ll})|\p{Lu}[\p{Ll}\d]+|\p{Lo}+/gu,zt=/['\u2019]/g;function Yt(e){return e.replace(zt,"").match(Gt)??[]}function Fe(e){return Yt(e).map(t=>t.toLowerCase()).join("-")}function Jt(e,t,r){let n=t[e],{fetchOptions:o,query:i,...a}=r||{};return n||(o?.method?o.method:a&&Object.keys(a).length>0?"POST":"GET")}function Be(e,t,r,n,o){function i(a=[]){return new Proxy(function(){},{get(u,s){if(typeof s!="string"||s==="then"||s==="catch"||s==="finally")return;let c=[...a,s],l=e;for(let m of c)if(l&&typeof l=="object"&&m in l)l=l[m];else{l=void 0;break}return typeof l=="function"||ke(l)?l:i(c)},apply:async(u,s,c)=>{let l="/"+a.map(Fe).join("/"),m=c[0]||{},p=c[1]||{},{query:d,fetchOptions:E,...y}=m,T={...p,...E},R=Jt(l,r,m);return await t(l,{...T,body:R==="GET"?void 0:{...y,...T?.body||{}},query:d||T?.query,method:R,async onSuccess(w){if(await T?.onSuccess?.(w),!o||T.disableSignal)return;let v=o.filter(S=>S.matcher(l));if(!v.length)return;let g=new Set;for(let S of v){let h=n[S.signal];if(!h)return;if(g.has(S.signal))continue;g.add(S.signal);let f=h.get();setTimeout(()=>{h.set(!f)},10),S.callback?.(l)}}})}})}return i()}function J(e){let{pluginPathMethods:t,pluginsActions:r,pluginsAtoms:n,hydrateSession:o,$fetch:i,atomListeners:a,$store:u}=xe(e),s={};for(let[c,l]of Object.entries(n))s[`use${Me(c)}`]=l;return Be({...r,...s,hydrateSession:o,$fetch:i,$store:u},i,t,n,a)}var Qt=async e=>{switch(e){case"oauth2":{let t=J({baseURL:window.location.origin,basePath:"/auth"}),{data:r,error:n}=await t.signIn.social({provider:e,callbackURL:"/auth/loginDone",errorCallbackURL:"/auth/loginDialog"});break}case"github":case"google":{let t=J({baseURL:window.location.origin+"/auth"}),{data:r,error:n}=await t.signIn.social({provider:e,callbackURL:"/auth/loginDone",errorCallbackURL:"/auth/loginDialog"});break}default:console.log(`Provider ${e} not recognised.`)}};window.signIn=Qt;})();
@@ -1,4 +1,4 @@
1
- /* wiki-security-social - 0.1.0-rc.8 - Mon, 07 Sep 2026 11:18:56 GMT */
1
+ /* wiki-security-social - 0.1.0 - Mon, 14 Sep 2026 10:58:43 GMT */
2
2
  (()=>{var Z=Symbol.for("better-auth:broadcast-channel"),Ve=()=>Math.floor(Date.now()/1e3),Ge=class{listeners=new Set;name;constructor(e="better-auth.message"){this.name=e}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}post(e){if(!(typeof window>"u"))try{localStorage.setItem(this.name,JSON.stringify({...e,timestamp:Ve()}))}catch{}}setup(){if(typeof window>"u"||typeof window.addEventListener>"u")return()=>{};let e=t=>{if(t.key!==this.name)return;let r=JSON.parse(t.newValue??"{}");r?.event!=="session"||!r?.data||this.listeners.forEach(n=>n(r))};return window.addEventListener("storage",e),()=>{window.removeEventListener("storage",e)}}};function q(e="better-auth.message"){return globalThis[Z]||(globalThis[Z]=new Ge(e)),globalThis[Z]}var _=[],x=0,W=null,ee=4,ze=globalThis.nanostoresGlobal||={epoch:0},Ye=()=>{let e,t;for(;x<_.length;){t=x,x+=ee;try{_[t](_[t+1].value,_[t+2],_[t+3])}catch(r){e=r}}if(_.length=x=0,e)throw e};var V=e=>{let t=[],r={eq:Object.is,get(){return r.lc||r.listen(()=>{})(),r.value},init:e,lc:0,listen(n){return r.lc=t.push(n),()=>{for(let i=x;i<_.length;)_[i]===n?_.splice(i,ee):i+=ee;let o=t.indexOf(n);~o&&(t.splice(o,1),--r.lc||r.off())}},notify(n,o){ze.epoch++;let i=!_.length&&!W;for(let a of t)W?.has(a)||(W?.add(a),_.push(a,r,n,W?void 0:o));i&&Ye()},off(){},set(n){let o=r.value;r.eq(o,n)||(r.value=n,r.notify(o))},subscribe(n){let o=r.listen(n);return n(r.value),o},value:e};return r};var Je=2;var Qe=5,G=6,z=10,he=(e,t,r,n)=>(e.events=e.events||{},e.events[r+z]||(e.events[r+z]=n(o=>{e.events[r].reduceRight((i,a)=>(a(i),i),{shared:{},...o})})),e.events[r]=e.events[r]||[],e.events[r].push(t),()=>{let o=e.events[r],i=o.indexOf(t);~i&&(o.splice(i,1),o.length||(e.events[r+z](),delete e.events[r+z]))});var te=(e,t)=>he(e,t,Je,r=>{let n=e.set,o=e.setKey;return e.setKey&&(e.setKey=(i,a)=>{let c;if(r({abort:()=>{c=!0},changed:i,newValue:{...e.value,[i]:a}}),!c)return o(i,a)}),e.set=i=>{let a;if(r({abort:()=>{a=!0},newValue:i}),!a)return n(i)},()=>{e.set=n,e.setKey=o}});var Y=1e3,re=(e,t)=>he(e,n=>{let o=t(n);o&&e.events[G].push(o)},Qe,n=>{let o=e.listen;e.listen=(...a)=>(!e.lc&&!e.active&&(e.active=!0,n()),o(...a));let i=e.off;return e.events[G]=[],e.off=()=>{i(),setTimeout(()=>{if(e.active&&!e.lc){e.active=!1;for(let a of e.events[G])a();e.events[G]=[]}},Y)},()=>{e.listen=o,e.off=i}});function pe(e){if(typeof e!="object"||e===null)return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function M(e,t){if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(!M(e[r],t[r]))return!1;return!0}if(pe(e)&&pe(t)){let r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(let o of r)if(!(o in t)||!M(e[o],t[o]))return!1;return!0}return!1}function me(e,t){return te(e,({newValue:r,abort:n})=>{t(e.value,r)&&n()})}var ne=Symbol.for("better-auth:focus-manager"),Ke=class{listeners=new Set;subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}setFocused(e){this.listeners.forEach(t=>t(e))}setup(){if(typeof window>"u"||typeof document>"u"||typeof window.addEventListener>"u")return()=>{};let e=()=>{document.visibilityState==="visible"&&this.setFocused(!0)};return document.addEventListener("visibilitychange",e,!1),()=>{document.removeEventListener("visibilitychange",e,!1)}}};function oe(){return globalThis[ne]||(globalThis[ne]=new Ke),globalThis[ne]}var se=Symbol.for("better-auth:online-manager"),Xe=class{listeners=new Set;isOnline=typeof navigator<"u"?navigator.onLine:!0;subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}setOnline(e){this.isOnline=e,this.listeners.forEach(t=>t(e))}setup(){if(typeof window>"u"||typeof window.addEventListener>"u")return()=>{};let e=()=>this.setOnline(!0),t=()=>this.setOnline(!1);return window.addEventListener("online",e,!1),window.addEventListener("offline",t,!1),()=>{window.removeEventListener("online",e,!1),window.removeEventListener("offline",t,!1)}}};function J(){return globalThis[se]||(globalThis[se]=new Xe),globalThis[se]}var Ze={proto:/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,constructor:/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,protoShort:/"__proto__"\s*:/,constructorShort:/"constructor"\s*:/},et=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/,ge={true:!0,false:!1,null:null,undefined:void 0,nan:NaN,infinity:Number.POSITIVE_INFINITY,"-infinity":Number.NEGATIVE_INFINITY},tt=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.(\d{1,7}))?(?:Z|([+-])(\d{2}):(\d{2}))$/;function rt(e){return e instanceof Date&&!isNaN(e.getTime())}function nt(e){let t=tt.exec(e);if(!t)return null;let[,r,n,o,i,a,c,s,u,l,m]=t,h=new Date(Date.UTC(parseInt(r,10),parseInt(n,10)-1,parseInt(o,10),parseInt(i,10),parseInt(a,10),parseInt(c,10),s?parseInt(s.padEnd(3,"0"),10):0));if(u){let d=(parseInt(l,10)*60+parseInt(m,10))*(u==="+"?-1:1);h.setUTCMinutes(h.getUTCMinutes()+d)}return rt(h)?h:null}function ot(e,t={}){let{strict:r=!1,warnings:n=!1,reviver:o,parseDates:i=!0}=t;if(typeof e!="string")return e;let a=e.trim(),c=a.toLowerCase();if(c.length<=9&&c in ge)return ge[c];if(!et.test(a)){if(r)throw new SyntaxError("[better-json] Invalid JSON");return e}if(Object.entries(Ze).some(([s,u])=>{let l=u.test(a);return l&&n&&console.warn(`[better-json] Detected potential prototype pollution attempt using ${s} pattern`),l})&&r)throw new Error("[better-json] Potential prototype pollution attempt detected");try{return JSON.parse(a,(u,l)=>{if(u==="__proto__"||u==="constructor"&&l&&typeof l=="object"&&"prototype"in l){n&&console.warn(`[better-json] Dropping "${u}" key to prevent prototype pollution`);return}if(i&&typeof l=="string"){let m=nt(l);if(m)return m}return o?o(u,l):l})}catch(s){if(r)throw s;return e}}function Ee(e,t={strict:!0}){return ot(e,t)}var ie=()=>Math.floor(Date.now()/1e3),st=5;function ye(e){let{fetchSession:t,shouldPollSession:r=()=>!0,sessionSignal:n,options:o={}}=e,i=o.sessionOptions?.refetchInterval??0,a=o.sessionOptions?.refetchOnWindowFocus??!0,c=o.sessionOptions?.refetchWhenOffline??!1,s={isInitialized:!1,lastSessionRequest:0},u=()=>c||J().isOnline,l=T=>{if(u()){if(T?.event==="storage"){t();return}if(T?.event==="poll"){s.lastSessionRequest=ie(),t();return}if(T?.event==="visibilitychange"){if(ie()-s.lastSessionRequest<st)return;s.lastSessionRequest=ie(),t();return}t()}},m=T=>{q().post({event:"session",data:{trigger:T},clientId:Math.random().toString(36).substring(7)})},h=()=>{i&&i>0&&(s.pollInterval=setInterval(()=>{r()&&l({event:"poll"})},i*1e3))},d=()=>{s.unsubscribeBroadcast=q().subscribe(()=>{l({event:"storage"})})},g=()=>{a&&(s.unsubscribeFocus=oe().subscribe(()=>{l({event:"visibilitychange"})}))},y=()=>{s.unsubscribeOnline=J().subscribe(T=>{T&&l({event:"visibilitychange"})})},w=()=>{s.unsubscribeSignal=n.listen(()=>{t()})};return{init:()=>{s.isInitialized||(s.isInitialized=!0,h(),d(),g(),y(),w(),s.cleanupBroadcastSetup=q().setup(),s.cleanupFocusSetup=oe().setup(),s.cleanupOnlineSetup=J().setup())},cleanup:()=>{s.isInitialized&&(s.pollInterval&&(clearInterval(s.pollInterval),s.pollInterval=void 0),s.unsubscribeBroadcast&&(s.unsubscribeBroadcast(),s.unsubscribeBroadcast=void 0),s.unsubscribeFocus&&(s.unsubscribeFocus(),s.unsubscribeFocus=void 0),s.unsubscribeOnline&&(s.unsubscribeOnline(),s.unsubscribeOnline=void 0),s.unsubscribeSignal&&(s.unsubscribeSignal(),s.unsubscribeSignal=void 0),s.cleanupBroadcastSetup&&(s.cleanupBroadcastSetup(),s.cleanupBroadcastSetup=void 0),s.cleanupFocusSetup&&(s.cleanupFocusSetup(),s.cleanupFocusSetup=void 0),s.cleanupOnlineSetup&&(s.cleanupOnlineSetup(),s.cleanupOnlineSetup=void 0),s.isInitialized=!1,s.lastSessionRequest=0)},triggerRefetch:l,broadcastSessionUpdate:m}}var Q=Object.create(null),F=e=>globalThis.process?.env||globalThis.Deno?.env.toObject()||globalThis.__env__||(e?Q:globalThis),U=new Proxy(Q,{get(e,t){return F()[t]??Q[t]},has(e,t){return t in F()||t in Q},set(e,t,r){let n=F(!0);return n[t]=r,!0},deleteProperty(e,t){if(!t)return!1;let r=F(!0);return delete r[t],!0},ownKeys(){let e=F(!0);return Object.keys(e)}});var it=U.NODE_ENV??"";function C(e,t){return typeof process<"u"&&process.env?process.env[e]??t:typeof Deno<"u"?Deno.env.get(e)??t:typeof Bun<"u"?Bun.env[e]??t:t}var at=Object.freeze({get BETTER_AUTH_SECRET(){return C("BETTER_AUTH_SECRET")},get AUTH_SECRET(){return C("AUTH_SECRET")},get BETTER_AUTH_TELEMETRY(){return C("BETTER_AUTH_TELEMETRY")},get BETTER_AUTH_TELEMETRY_ID(){return C("BETTER_AUTH_TELEMETRY_ID")},get NODE_ENV(){return C("NODE_ENV","development")},get PACKAGE_VERSION(){return C("PACKAGE_VERSION","0.0.0")},get BETTER_AUTH_TELEMETRY_ENDPOINT(){return C("BETTER_AUTH_TELEMETRY_ENDPOINT","")}});function lt(){let e=Object.getOwnPropertyDescriptor(Error,"stackTraceLimit");return e===void 0?Object.isExtensible(Error):Object.prototype.hasOwnProperty.call(e,"writable")?e.writable:e.set!==void 0}function ct(e){let t=e.split(`
3
3
  at `);return t.length<=1?e:(t.splice(1,1),t.join(`
4
4
  at `))}function ut(e,t){class r extends e{#e;constructor(...o){if(lt()){let a=Error.stackTraceLimit;Error.stackTraceLimit=0,super(...o),Error.stackTraceLimit=a}else super(...o);let i=new Error().stack;i&&(this.#e=ct(i.replace(/^Error/,this.name)))}get errorStack(){return this.#e}}return Object.defineProperty(r.prototype,"constructor",{get(){return t},enumerable:!1,configurable:!0}),r}var ft={OK:200,CREATED:201,ACCEPTED:202,NO_CONTENT:204,MULTIPLE_CHOICES:300,MOVED_PERMANENTLY:301,FOUND:302,SEE_OTHER:303,NOT_MODIFIED:304,TEMPORARY_REDIRECT:307,BAD_REQUEST:400,UNAUTHORIZED:401,PAYMENT_REQUIRED:402,FORBIDDEN:403,NOT_FOUND:404,METHOD_NOT_ALLOWED:405,NOT_ACCEPTABLE:406,PROXY_AUTHENTICATION_REQUIRED:407,REQUEST_TIMEOUT:408,CONFLICT:409,GONE:410,LENGTH_REQUIRED:411,PRECONDITION_FAILED:412,PAYLOAD_TOO_LARGE:413,URI_TOO_LONG:414,UNSUPPORTED_MEDIA_TYPE:415,RANGE_NOT_SATISFIABLE:416,EXPECTATION_FAILED:417,"I'M_A_TEAPOT":418,MISDIRECTED_REQUEST:421,UNPROCESSABLE_ENTITY:422,LOCKED:423,FAILED_DEPENDENCY:424,TOO_EARLY:425,UPGRADE_REQUIRED:426,PRECONDITION_REQUIRED:428,TOO_MANY_REQUESTS:429,REQUEST_HEADER_FIELDS_TOO_LARGE:431,UNAVAILABLE_FOR_LEGAL_REASONS:451,INTERNAL_SERVER_ERROR:500,NOT_IMPLEMENTED:501,BAD_GATEWAY:502,SERVICE_UNAVAILABLE:503,GATEWAY_TIMEOUT:504,HTTP_VERSION_NOT_SUPPORTED:505,VARIANT_ALSO_NEGOTIATES:506,INSUFFICIENT_STORAGE:507,LOOP_DETECTED:508,NOT_EXTENDED:510,NETWORK_AUTHENTICATION_REQUIRED:511},dt=class extends Error{status;body;headers;statusCode;constructor(e="INTERNAL_SERVER_ERROR",t=void 0,r={},n=typeof e=="number"?e:ft[e]){super(t?.message,t?.cause?{cause:t.cause}:void 0),this.status=e,this.body=t,this.headers=r,this.statusCode=n,this.name="APIError",this.status=e,this.headers=r,this.statusCode=n,this.body=t}};var ht=ut(dt,Error);var D=class extends Error{constructor(e,t){super(e,t),this.name="BetterAuthError",this.message=e,this.stack=""}};var pt=47;function Te(e){let t=e.length;for(;t>0&&e.charCodeAt(t-1)===pt;)t--;return t===e.length?e:e.slice(0,t)}function mt(e){try{return(Te(new URL(e).pathname)||"/")!=="/"}catch{throw new D(`Invalid base URL: ${e}. Please provide a valid base URL.`)}}function gt(e){try{let t=new URL(e);if(t.protocol!=="http:"&&t.protocol!=="https:")throw new D(`Invalid base URL: ${e}. URL must include 'http://' or 'https://'`)}catch(t){throw t instanceof D?t:new D(`Invalid base URL: ${e}. Please provide a valid base URL.`,{cause:t})}}function j(e,t="/api/auth"){if(gt(e),mt(e))return e;let r=Te(e);return!t||t==="/"?r:(t=t.startsWith("/")?t:`/${t}`,`${r}${t}`)}function we(e,t){return!e||e.trim()===""?!1:t==="proto"?e==="http"||e==="https":t==="host"?[/\.\./,/\0/,/[\s]/,/^[.]/,/[<>'"]/,/javascript:/i,/file:/i,/data:/i].some(r=>r.test(e))?!1:/^[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(\.[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*(:[0-9]{1,5})?$/.test(e)||/^(\d{1,3}\.){3}\d{1,3}(:[0-9]{1,5})?$/.test(e)||/^\[[0-9a-fA-F:]+\](:[0-9]{1,5})?$/.test(e)||/^localhost(:[0-9]{1,5})?$/i.test(e):!1}function ve(e,t,r,n,o){if(e)return j(e,t);if(n!==!1){let c=U.BETTER_AUTH_URL||U.NEXT_PUBLIC_BETTER_AUTH_URL||U.PUBLIC_BETTER_AUTH_URL||U.NUXT_PUBLIC_BETTER_AUTH_URL||U.NUXT_PUBLIC_AUTH_URL||(U.BASE_URL!=="/"?U.BASE_URL:void 0);if(c)return j(c,t)}let i=r?.headers.get("x-forwarded-host"),a=r?.headers.get("x-forwarded-proto");if(i&&a&&o&&we(a,"proto")&&we(i,"host"))try{return j(`${a}://${i}`,t)}catch{}if(r){let c=Et(r.url);if(!c)throw new D("Could not get origin from request. Please provide a valid base URL.");return j(c,t)}if(typeof window<"u"&&window.location)return j(window.location.origin,t)}function Et(e){try{let t=new URL(e);return t.origin==="null"?null:t.origin}catch{return null}}var yt=["javascript:","data:","vbscript:"];function Re(e){let t;try{t=new URL(e)}catch{return!0}return!yt.includes(t.protocol)}var be={id:"redirect",name:"Redirect",hooks:{onSuccess(e){if(e.data?.url&&e.data?.redirect&&Re(e.data.url)&&typeof window<"u"&&window.location&&window.location)try{window.location.href=e.data.url}catch{}}}};var wt=()=>typeof window>"u",Tt=Y;function Oe(e,t){if(typeof window>"u")return;let r=e.get();r.data!==null||t===null||e.set({...r,data:t,error:null,isPending:!1})}function Se(e){return typeof e=="object"&&e!==null&&"data"in e&&"error"in e?e:{data:e,error:null}}function vt(e){return!e||e.session===null&&e.user===null?null:e}function Rt(e,t){return M(e.data,t.data)&&e.error===t.error&&e.isPending===t.isPending&&e.isRefetching===t.isRefetching&&e.refetch===t.refetch}function _e(e,t){let r=V(!1),n,o=0,i=0;r.listen(()=>{i++,o=0});let a=d=>l(d),c=V({data:null,error:null,isPending:!0,isRefetching:!1,refetch:a});me(c,Rt);let s=async(d,g)=>{let y=c.value;if(c.set({...y,isPending:y.data===null,isRefetching:!0,error:null,refetch:a}),d.aborted)return"aborted";try{let w=await e("/get-session",{method:"GET",query:g?.query,signal:d});if(d.aborted)return"aborted";let{data:v,error:S}=Se(w),T="fresh";if(v?.needsRefresh)try{let f=await e("/get-session",{method:"POST",signal:d});if(d.aborted)return"aborted";({data:v,error:S}=Se(f))}catch{if(d.aborted)return"aborted";T="stale"}if(S){let f=c.value,k=S?.status===401;return c.set({data:k?null:f.data,error:S,isPending:!1,isRefetching:!1,refetch:a}),"failed"}let E=vt(v),b=c.value,p=b.data!=null&&E!=null&&M(b.data,E)?b.data:E;return c.set({data:p,error:null,isPending:!1,isRefetching:!1,refetch:a}),T}catch(w){if(d.aborted)return"aborted";let v=c.value;return c.set({data:v.data,error:w,isPending:!1,isRefetching:!1,refetch:a}),"failed"}},u=()=>{let d=c.value.data?.session?.expiresAt,g=d instanceof Date?d.getTime():Number.POSITIVE_INFINITY;return Math.min(Date.now()+Tt,g)},l=d=>{o=0,n?.cancel();let g=new AbortController,y={cancel:()=>g.abort(),promise:Promise.resolve().then(()=>g.signal.aborted?"aborted":s(g.signal,d)),revision:i};n=y;let w=v=>{n===y&&(n=void 0,v==="fresh"&&y.revision===i&&(o=u()))};return y.promise.then(w,()=>w("failed")),y.promise.then(()=>{})},m=()=>n?.revision===i?n.promise.then(()=>{}):Date.now()<o?Promise.resolve():l(),h=()=>{};return re(c,()=>{let d;wt()||(d=setTimeout(()=>{m()},0));let g=ye({fetchSession:l,shouldPollSession:()=>c.value.data!=null,sessionSignal:r,options:t});return g.init(),h=g.broadcastSessionUpdate,()=>{d&&clearTimeout(d),g.cleanup()}}),{session:c,$sessionSignal:r,broadcastSessionUpdate:d=>h(d)}}function ae(e){if(e===null||typeof e!="object")return!1;let t=Object.getPrototypeOf(e);return t!==null&&t!==Object.prototype&&Object.getPrototypeOf(t)!==null||Symbol.iterator in e?!1:Symbol.toStringTag in e?Object.prototype.toString.call(e)==="[object Module]":!0}function le(e,t,r=".",n){if(!ae(t))return le(e,{},r,n);let o={...t};for(let i of Object.keys(e)){if(i==="__proto__"||i==="constructor")continue;let a=e[i];a!=null&&(n&&n(o,i,a,r)||(Array.isArray(a)&&Array.isArray(o[i])?o[i]=[...a,...o[i]]:ae(a)&&ae(o[i])?o[i]=le(a,o[i],(r?`${r}.`:"")+i.toString(),n):o[i]=a))}return o}function ce(e){return(...t)=>t.reduce((r,n)=>le(r,n,"",e),{})}var Ae=ce(),Yr=ce((e,t,r)=>{if(e[t]!==void 0&&typeof r=="function")return e[t]=r(e[t]),!0}),Jr=ce((e,t,r)=>{if(Array.isArray(e[t])&&typeof r=="function")return e[t]=r(e[t]),!0});var bt=Object.defineProperty,St=Object.defineProperties,Ot=Object.getOwnPropertyDescriptors,Le=Object.getOwnPropertySymbols,_t=Object.prototype.hasOwnProperty,At=Object.prototype.propertyIsEnumerable,Ue=(e,t,r)=>t in e?bt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,A=(e,t)=>{for(var r in t||(t={}))_t.call(t,r)&&Ue(e,r,t[r]);if(Le)for(var r of Le(t))At.call(t,r)&&Ue(e,r,t[r]);return e},P=(e,t)=>St(e,Ot(t)),Lt=class extends Error{constructor(e,t,r){super(t||e.toString(),{cause:r}),this.status=e,this.statusText=t,this.error=r,Error.captureStackTrace(this,this.constructor)}},Ut=async(e,t)=>{var r,n,o,i,a,c;let s=t||{},u={onRequest:[t?.onRequest],onResponse:[t?.onResponse],onSuccess:[t?.onSuccess],onError:[t?.onError],onRetry:[t?.onRetry]};if(!t||!t?.plugins)return{url:e,options:s,hooks:u};for(let l of t?.plugins||[]){if(l.init){let m=await((r=l.init)==null?void 0:r.call(l,e.toString(),t));s=m.options||s,e=m.url}u.onRequest.push((n=l.hooks)==null?void 0:n.onRequest),u.onResponse.push((o=l.hooks)==null?void 0:o.onResponse),u.onSuccess.push((i=l.hooks)==null?void 0:i.onSuccess),u.onError.push((a=l.hooks)==null?void 0:a.onError),u.onRetry.push((c=l.hooks)==null?void 0:c.onRetry)}return{url:e,options:s,hooks:u}},Pe=class{constructor(e){this.options=e}shouldAttemptRetry(e,t){return this.options.shouldRetry?Promise.resolve(e<this.options.attempts&&this.options.shouldRetry(t)):Promise.resolve(e<this.options.attempts)}getDelay(){return this.options.delay}},Pt=class{constructor(e){this.options=e}shouldAttemptRetry(e,t){return this.options.shouldRetry?Promise.resolve(e<this.options.attempts&&this.options.shouldRetry(t)):Promise.resolve(e<this.options.attempts)}getDelay(e){return Math.min(this.options.maxDelay,this.options.baseDelay*2**e)}};function Nt(e){if(typeof e=="number")return new Pe({type:"linear",attempts:e,delay:1e3});switch(e.type){case"linear":return new Pe(e);case"exponential":return new Pt(e);default:throw new Error("Invalid retry strategy")}}var It=async e=>{let t={},r=async n=>typeof n=="function"?await n():n;if(e?.auth){if(e.auth.type==="Bearer"){let n=await r(e.auth.token);if(!n)return t;t.authorization=`Bearer ${n}`}else if(e.auth.type==="Basic"){let[n,o]=await Promise.all([r(e.auth.username),r(e.auth.password)]);if(!n||!o)return t;t.authorization=`Basic ${btoa(`${n}:${o}`)}`}else if(e.auth.type==="Custom"){let[n,o]=await Promise.all([r(e.auth.prefix),r(e.auth.value)]);if(!o)return t;t.authorization=`${n??""} ${o}`}}return t},Ct=/^application\/(?:[\w!#$%&*.^`~-]*\+)?json(;.+)?$/i;function Dt(e){let t=e.headers.get("content-type"),r=new Set(["image/svg","application/xml","application/xhtml","application/html"]);if(!t)return"json";let n=t.split(";").shift()||"";return Ct.test(n)?"json":r.has(n)||n.startsWith("text/")?"text":"blob"}function kt(e){try{return JSON.parse(e),!0}catch{return!1}}function Ce(e){if(e===void 0)return!1;let t=typeof e;return t==="string"||t==="number"||t==="boolean"||t===null?!0:t!=="object"?!1:Array.isArray(e)?!0:e.buffer?!1:e.constructor&&e.constructor.name==="Object"||typeof e.toJSON=="function"}function Ne(e){try{return JSON.parse(e)}catch{return e}}function Ie(e){return typeof e=="function"}function xt(e){if(e?.customFetchImpl)return e.customFetchImpl;if(typeof globalThis<"u"&&Ie(globalThis.fetch))return globalThis.fetch;if(typeof window<"u"&&Ie(window.fetch))return window.fetch;throw new Error("No fetch implementation found")}function De(...e){let t={};for(let r of e)if(r)if(r instanceof Headers)r.forEach((n,o)=>{t[o]=n});else{let n=Array.isArray(r)?r:Object.entries(r);for(let[o,i]of n)i!=null&&(t[o]=i)}return t}async function Mt(e){let t=new Headers(De(e?.headers,await It(e)));if(!t.has("content-type")){let r=Ft(e?.body);r&&t.set("content-type",r)}return t}function Ft(e){return Ce(e)?"application/json":null}function jt(e){let t=e.get("content-type");return t?t.split(";")[0].trim().toLowerCase():null}function Bt(e,t){let{body:r}=e;return r?!Ce(r)||typeof r=="string"?r:jt(t)==="application/x-www-form-urlencoded"?new URLSearchParams(r).toString():JSON.stringify(r):null}function Ht(e,t){var r;if(t?.method)return t.method.toUpperCase();if(e.startsWith("@")){let n=(r=e.split("@")[1])==null?void 0:r.split("/")[0];return xe.includes(n)?n.toUpperCase():t?.body?"POST":"GET"}return t?.body?"POST":"GET"}function $t(e,t){let r;return!e?.signal&&e?.timeout&&(r=setTimeout(()=>t?.abort(),e?.timeout)),{abortTimeout:r,clearTimeout:()=>{r&&clearTimeout(r)}}}var qt=class ke extends Error{constructor(t,r){super(r||JSON.stringify(t,null,2)),this.issues=t,Object.setPrototypeOf(this,ke.prototype)}};async function B(e,t){let r=await e["~standard"].validate(t);if(r.issues)throw new qt(r.issues);return r.value}var xe=["get","post","put","patch","delete"];var Wt=e=>({id:"apply-schema",name:"Apply Schema",version:"1.0.0",async init(t,r){var n,o,i,a;let c=((o=(n=e.plugins)==null?void 0:n.find(s=>{var u;return(u=s.schema)!=null&&u.config?t.startsWith(s.schema.config.baseURL||"")||t.startsWith(s.schema.config.prefix||""):!1}))==null?void 0:o.schema)||e.schema;if(c){let s=t;(i=c.config)!=null&&i.prefix&&s.startsWith(c.config.prefix)&&(s=s.replace(c.config.prefix,""),c.config.baseURL&&(t=t.replace(c.config.prefix,c.config.baseURL))),(a=c.config)!=null&&a.baseURL&&s.startsWith(c.config.baseURL)&&(s=s.replace(c.config.baseURL,"")),s.startsWith("/")&&s.charAt(1)==="@"&&(s=s.substring(1));let u=c.schema[s];if(u){let l=r?.headers;if(u.headers&&!r?.disableValidation){let h={};if(r?.headers){if(r.headers instanceof Headers)r.headers.forEach((y,w)=>{h[w.toLowerCase()]=y});else if(typeof r.headers=="object")for(let[y,w]of Object.entries(r.headers))w!=null&&(h[y.toLowerCase()]=w)}let d=await B(u.headers,h),g={};for(let[y,w]of Object.entries(d))g[y.toLowerCase()]=w;l=g}let m=P(A({},r),{method:u.method,output:u.output,headers:l});return r?.disableValidation||(m=P(A({},m),{body:u.input?await B(u.input,r?.body):r?.body,params:u.params?await B(u.params,r?.params):r?.params,query:u.query?await B(u.query,r?.query):r?.query})),{url:t,options:m}}}return{url:t,options:r}}}),Me=e=>{async function t(r,n){let o=P(A(A({},e),n),{headers:De(e?.headers,n?.headers),plugins:[...e?.plugins||[],Wt(e||{}),...n?.plugins||[]]});if(e?.catchAllError)try{return await ue(r,o)}catch(i){return{data:null,error:{status:500,statusText:"Fetch Error",message:"Fetch related error. Captured by catchAllError option. See error property for more details.",error:i}}}return await ue(r,o)}return t},Vt=e=>e==="."||e==="..";function Gt(e,t){let r=e;for(let[n,o]of t)r=r.replace(n,o);if(Vt(r))throw new TypeError("Path parameters cannot be reserved path segments");return encodeURIComponent(r)}function zt(e,t){let{baseURL:r,params:n,query:o}=t||{query:{},params:{},baseURL:""},i=e.startsWith("http")?e.split("/").slice(0,3).join("/"):r||"";if(e.startsWith("@")){let h=e.toString().split("@")[1].split("/")[0];xe.includes(h)&&(e=e.replace(`@${h}/`,"/"))}i.endsWith("/")||(i+="/");let[a,c]=e.replace(i,"").split("?"),s=new URLSearchParams(c);for(let[h,d]of Object.entries(o||{})){if(d==null)continue;let g;if(typeof d=="string")g=d;else if(Array.isArray(d)){for(let y of d)s.append(h,y);continue}else g=JSON.stringify(d);s.set(h,g)}let u=new Map;if(n)if(Array.isArray(n)){let h=a.split("/").filter(d=>d.startsWith(":"));for(let[d,g]of h.entries()){let y=n[d];u.set(g,String(y))}}else for(let[h,d]of Object.entries(n))u.set(`:${h}`,String(d));a=a.split("/").map(h=>Gt(h,u)).join("/"),a=a.replace(/^\/+/,"");let l=s.toString();return l=l.length>0?`?${l}`.replace(/\+/g,"%20"):"",i.startsWith("http")?new URL(`${a}${l}`,i):`${i}${a}${l}`}var ue=async(e,t)=>{var r,n,o,i,a,c,s,u;let{hooks:l,url:m,options:h}=await Ut(e,t),d=xt(h),g=new AbortController,y=(r=h.signal)!=null?r:g.signal,w=zt(m,h),v=await Mt(h),S=Bt(h,v),T=Ht(m,h),E=P(A({},h),{url:w,headers:v,body:S,method:T,signal:y});for(let O of l.onRequest)if(O){let R=await O(E);typeof R=="object"&&R!==null&&Object.assign(E,R)}("pipeTo"in E&&typeof E.pipeTo=="function"||typeof((n=t?.body)==null?void 0:n.pipe)=="function")&&("duplex"in E||(E.duplex="half"));let{clearTimeout:b}=$t(h,g),p=await d(E.url,E);b();let f={response:p,request:E};for(let O of l.onResponse)if(O){let R=await O(P(A({},f),{response:(o=t?.hookOptions)!=null&&o.cloneResponse?p.clone():p}));R instanceof Response?p=R:typeof R=="object"&&R!==null&&(p=R.response)}if(p.ok){if(!(E.method!=="HEAD"))return{data:"",error:null};let R=Dt(p),N={data:null,response:p,request:E};if(R==="json"||R==="text"){let I=await p.text(),We=(i=E.jsonParser)!=null?i:Ne;N.data=await We(I)}else N.data=await p[R]();E?.output&&E.output&&!E.disableValidation&&(N.data=await B(E.output,N.data));for(let I of l.onSuccess)I&&await I(P(A({},N),{response:(a=t?.hookOptions)!=null&&a.cloneResponse?p.clone():p}));return t?.throw?N.data:{data:N.data,error:null}}let k=(c=t?.jsonParser)!=null?c:Ne,H=await p.text(),de=kt(H),X=de?await k(H):null,qe={response:p,responseText:H,request:E,error:P(A({},X),{status:p.status,statusText:p.statusText})};for(let O of l.onError)O&&await O(P(A({},qe),{response:(s=t?.hookOptions)!=null&&s.cloneResponse?p.clone():p}));if(t?.retry){let O=Nt(t.retry),R=(u=t.retryAttempt)!=null?u:0;if(await O.shouldAttemptRetry(R,p)){for(let I of l.onRetry)I&&await I(f);let N=O.getDelay(R);return await new Promise(I=>setTimeout(I,N)),await ue(e,P(A({},t),{retryAttempt:R+1}))}}if(t?.throw)throw new Lt(p.status,p.statusText,de?X:H);return{data:null,error:P(A({},X),{status:p.status,statusText:p.statusText})}};var Yt=e=>{if(typeof process>"u")return;let t=e??"/api/auth";if(process.env.NEXT_PUBLIC_AUTH_URL)return process.env.NEXT_PUBLIC_AUTH_URL;if(typeof window>"u"){if(process.env.NEXTAUTH_URL)try{return process.env.NEXTAUTH_URL}catch{}if(process.env.VERCEL_URL)try{let r=process.env.VERCEL_URL.startsWith("http")?"":"https://";return`${new URL(`${r}${process.env.VERCEL_URL}`).origin}${t}`}catch{}}},Fe=(e,t)=>{let r="credentials"in Request.prototype,n=ve(e?.baseURL,e?.basePath,void 0,t)??Yt(e?.basePath)??"/api/auth",o=e?.plugins?.flatMap(f=>f.fetchPlugins).filter(f=>f!==void 0)||[],i={id:"lifecycle-hooks",name:"lifecycle-hooks",hooks:{onSuccess:e?.fetchOptions?.onSuccess,onError:e?.fetchOptions?.onError,onRequest:e?.fetchOptions?.onRequest,onResponse:e?.fetchOptions?.onResponse}},{onSuccess:a,onError:c,onRequest:s,onResponse:u,...l}=e?.fetchOptions||{},m=Me({baseURL:n,...r?{credentials:"include"}:{},method:"GET",jsonParser(f){return f?Ee(f,{strict:!1}):null},customFetchImpl:fetch,...l,plugins:[i,...l.plugins||[],...e?.disableDefaultFetchPlugins?[]:[be],...o]}),{$sessionSignal:h,session:d,broadcastSessionUpdate:g}=_e(m,e),y=!1,w=f=>{y||f===null||(y=!0,Oe(d,f))},v=e?.plugins||[],S={},T={$sessionSignal:h,session:d},E={"/sign-out":"POST","/revoke-sessions":"POST","/revoke-other-sessions":"POST","/delete-user":"POST"},b=[{signal:"$sessionSignal",matcher(f){return f==="/sign-out"||f==="/update-user"||f==="/update-session"||f==="/sign-up/email"||f==="/sign-in/email"||f==="/delete-user"||f==="/verify-email"||f==="/revoke-sessions"||f==="/revoke-session"||f==="/revoke-other-sessions"||f==="/change-email"||f==="/change-password"},callback(f){f==="/sign-out"?g("signout"):(f==="/update-user"||f==="/update-session")&&g("updateUser")}}];for(let f of v)f.getAtoms&&Object.assign(T,f.getAtoms?.(m)),f.pathMethods&&Object.assign(E,f.pathMethods),f.atomListeners&&b.push(...f.atomListeners);let p={notify:f=>{T[f].set(!T[f].get())},listen:(f,k)=>{T[f].subscribe(k)},atoms:T};for(let f of v)f.getActions&&(S=Ae(f.getActions?.(m,p,e)??{},S));return{get baseURL(){return n},pluginsActions:S,pluginsAtoms:T,pluginPathMethods:E,atomListeners:b,hydrateSession:w,$sessionSignal:h,$fetch:m,$store:p}};function je(e){return typeof e=="object"&&e!==null&&"get"in e&&typeof e.get=="function"&&"lc"in e&&typeof e.lc=="number"}function Be(e){return e.charAt(0).toUpperCase()+e.slice(1)}var Jt=/[\p{Ll}\d]+|\p{Lu}+(?!\p{Ll})|\p{Lu}[\p{Ll}\d]+|\p{Lo}+/gu,Qt=/['\u2019]/g;function Kt(e){return e.replace(Qt,"").match(Jt)??[]}function He(e){return Kt(e).map(t=>t.toLowerCase()).join("-")}function Xt(e,t,r){let n=t[e],{fetchOptions:o,query:i,...a}=r||{};return n||(o?.method?o.method:a&&Object.keys(a).length>0?"POST":"GET")}function $e(e,t,r,n,o){function i(a=[]){return new Proxy(function(){},{get(c,s){if(typeof s!="string"||s==="then"||s==="catch"||s==="finally")return;let u=[...a,s],l=e;for(let m of u)if(l&&typeof l=="object"&&m in l)l=l[m];else{l=void 0;break}return typeof l=="function"||je(l)?l:i(u)},apply:async(c,s,u)=>{let l="/"+a.map(He).join("/"),m=u[0]||{},h=u[1]||{},{query:d,fetchOptions:g,...y}=m,w={...h,...g},v=Xt(l,r,m);return await t(l,{...w,body:v==="GET"?void 0:{...y,...w?.body||{}},query:d||w?.query,method:v,async onSuccess(S){if(await w?.onSuccess?.(S),!o||w.disableSignal)return;let T=o.filter(b=>b.matcher(l));if(!T.length)return;let E=new Set;for(let b of T){let p=n[b.signal];if(!p)return;if(E.has(b.signal))continue;E.add(b.signal);let f=p.get();setTimeout(()=>{p.set(!f)},10),b.callback?.(l)}}})}})}return i()}function fe(e){let{pluginPathMethods:t,pluginsActions:r,pluginsAtoms:n,hydrateSession:o,$fetch:i,atomListeners:a,$store:c}=Fe(e),s={};for(let[u,l]of Object.entries(n))s[`use${Be(u)}`]=l;return $e({...r,...s,hydrateSession:o,$fetch:i,$store:c},i,t,n,a)}var Zt=fe({baseURL:window.location.origin+"/auth"}),L={},er=async()=>{let e="width=700,height=375,resizable=1,scrollbars=1",t=new URL(L.dialogURL).origin,r=()=>new Promise((n,o)=>{let i=window.open(L.dialogURL,"_blank",e);if(!i)return o(new Error("Popup blocked"));let a=s=>{if(s.origin!==t){console.warn("Received message from untrusted origin:",s.origin);return}s.data?.type==="AUTHENTICATION_RESPONSE"&&(window.removeEventListener("message",a),i.close(),n(s.data.payload))};window.addEventListener("message",a);let c=setInterval(()=>{i.closed&&(clearInterval(c),window.removeEventListener("message",a),o(new Error("User closed the dialog")))},500)});try{let n=await r();window.isAuthenticated=!0,isClaimed?(console.log("*** wiki already claimed"),location.reload()):console.log("*** wiki not claimed yet.")}catch(n){console.log(n)}},tr=e=>{$("link[href='/security/style.css']").length||$('<link rel="stylesheet" href="/security/style.css">').appendTo("head"),cookieStore.addEventListener("change",({changed:t})=>{for(let{name:r,value:n}of t)if(r==="state"){switch(n){case"loggedIn":window.isAuthenticated=!0;break;case"loggedOut":window.isAuthenticated=!1;break;default:console.log("--- Unexpect state cookie value",n)}fetch("/auth/client-settings.json",{method:"GET",cache:"no-cache",mode:"same-origin"}).then(o=>o.json()).then(o=>{window.isOwner=o.isOwner,K(ownerName,isAuthenticated)}).catch(o=>{console.log("Unable to fetch client settings: ",o)})}}),fetch("/auth/client-settings.json",{method:"GET",cache:"no-cache",mode:"same-origin"}).then(t=>t.json()).then(t=>{window.isOwner=t.isOwner,L=t;let r=L.wikiHost?L.wikiHost:window.location.hostname;L.cookieDomain=r;let n=window.location.port?`${r}:${window.location.port}`:r,o=L.useHttps?"https:":window.location.protocol;L.dialogURL="".concat(o,"//",n,"/auth/loginDialog"),K(ownerName,isAuthenticated)}).catch(t=>{console.log("Unable to fetch client settings: ",t)})},rr=()=>{isClaimed||fetch("/auth/claim-wiki",{method:"GET",cache:"no-cache",mode:"same-origin",credentials:"include"}).then(e=>{e.ok?e.json().then(t=>{wiki.lineup.bestTitle()=="Login Required"?location.reload():(ownerName=t.ownerName,window.isClaimed=!0,window.isOwner=!0,K(ownerName,!0))}):console.log("Attempt to claim site failed",e)})},K=(e,t)=>{if(console.log("*** update_footer",{ownerName:e,isAuthenticated:t,settings:L}),e&&$("footer > #site-owner").html(`Wiki by: <span id='site-owner'>${e}</span>`),$("footer > #security").empty(),t){let r={};isOwner?(r.title="Sign-out",r.iconClass=""):(r.title="Not Owner : Sign-out",r.iconClass="notOwner"),$("footer > #security").append(`<a href='#' id='logout' class='footer-item' title='${r.title}'><img src='/security/lock_open.svg' height=15 width=15 class='${r.iconClass}'></a>`),$("footer > #security > #logout").on("click",async n=>{n.preventDefault(),await Zt.signOut({fetchOptions:{onSuccess:()=>{document.cookie=`state=loggedOut ;domain=.${L.cookieDomain} ;path=/; max-age=60 ;sameSite=Strict;`,location.reload()}}})}),isClaimed||($("footer > #security").append("<a href='#' id='claim' class='footer-item' title='Claim this Wiki'><img src='/security/key.svg' height=15 width=15></a>"),$("footer > #security > #claim").on("click",n=>{n.preventDefault(),rr()}))}else{let r;isClaimed?r="Wiki Owner Sign-on":r="Sign-on to Claim Wiki",$("footer > #security").append(`<a href='#' id='show-security-dialog' class='footer-item' title='${r}'><img src='/security/lock.svg' height=15 width=15></a>`),$("footer > #security > #show-security-dialog").on("click",n=>{n.preventDefault(),document.cookie=`wikiName=${window.location.host} ;domain=${L.cookieDomain} ;path=/ ;max-age=300 ;sameSite=Strict;`,er()})}};window.plugins.security={setup:tr,update_footer:K};})();
@@ -1 +1 @@
1
- {"inputs":{"node_modules/better-auth/dist/package.mjs":{"bytes":79,"imports":[],"format":"esm"},"node_modules/better-auth/dist/version.mjs":{"bytes":140,"imports":[{"path":"node_modules/better-auth/dist/package.mjs","kind":"import-statement","original":"./package.mjs"}],"format":"esm"},"node_modules/better-auth/dist/client/broadcast-channel.mjs":{"bytes":1388,"imports":[],"format":"esm"},"node_modules/better-auth/node_modules/nanostores/task/index.js":{"bytes":750,"imports":[],"format":"esm"},"node_modules/better-auth/node_modules/nanostores/clean-stores/index.js":{"bytes":437,"imports":[{"path":"node_modules/better-auth/node_modules/nanostores/task/index.js","kind":"import-statement","original":"../task/index.js"}],"format":"esm"},"node_modules/better-auth/node_modules/nanostores/atom/index.js":{"bytes":3221,"imports":[{"path":"node_modules/better-auth/node_modules/nanostores/clean-stores/index.js","kind":"import-statement","original":"../clean-stores/index.js"}],"format":"esm"},"node_modules/better-auth/node_modules/nanostores/lifecycle/index.js":{"bytes":4243,"imports":[{"path":"node_modules/better-auth/node_modules/nanostores/clean-stores/index.js","kind":"import-statement","original":"../clean-stores/index.js"}],"format":"esm"},"node_modules/better-auth/node_modules/nanostores/warn/index.js":{"bytes":290,"imports":[],"format":"esm"},"node_modules/better-auth/node_modules/nanostores/computed/index.js":{"bytes":2027,"imports":[{"path":"node_modules/better-auth/node_modules/nanostores/atom/index.js","kind":"import-statement","original":"../atom/index.js"},{"path":"node_modules/better-auth/node_modules/nanostores/clean-stores/index.js","kind":"import-statement","original":"../clean-stores/index.js"},{"path":"node_modules/better-auth/node_modules/nanostores/lifecycle/index.js","kind":"import-statement","original":"../lifecycle/index.js"},{"path":"node_modules/better-auth/node_modules/nanostores/warn/index.js","kind":"import-statement","original":"../warn/index.js"}],"format":"esm"},"node_modules/better-auth/node_modules/nanostores/deep-map/path.js":{"bytes":1418,"imports":[],"format":"esm"},"node_modules/better-auth/node_modules/nanostores/deep-map/index.js":{"bytes":795,"imports":[{"path":"node_modules/better-auth/node_modules/nanostores/atom/index.js","kind":"import-statement","original":"../atom/index.js"},{"path":"node_modules/better-auth/node_modules/nanostores/warn/index.js","kind":"import-statement","original":"../warn/index.js"},{"path":"node_modules/better-auth/node_modules/nanostores/deep-map/path.js","kind":"import-statement","original":"./path.js"},{"path":"node_modules/better-auth/node_modules/nanostores/deep-map/path.js","kind":"import-statement","original":"./path.js"}],"format":"esm"},"node_modules/better-auth/node_modules/nanostores/effect/index.js":{"bytes":448,"imports":[],"format":"esm"},"node_modules/better-auth/node_modules/nanostores/keep-mount/index.js":{"bytes":65,"imports":[],"format":"esm"},"node_modules/better-auth/node_modules/nanostores/listen-keys/index.js":{"bytes":923,"imports":[{"path":"node_modules/better-auth/node_modules/nanostores/deep-map/path.js","kind":"import-statement","original":"../deep-map/path.js"}],"format":"esm"},"node_modules/better-auth/node_modules/nanostores/map/index.js":{"bytes":576,"imports":[{"path":"node_modules/better-auth/node_modules/nanostores/atom/index.js","kind":"import-statement","original":"../atom/index.js"}],"format":"esm"},"node_modules/better-auth/node_modules/nanostores/map-creator/index.js":{"bytes":894,"imports":[{"path":"node_modules/better-auth/node_modules/nanostores/clean-stores/index.js","kind":"import-statement","original":"../clean-stores/index.js"},{"path":"node_modules/better-auth/node_modules/nanostores/lifecycle/index.js","kind":"import-statement","original":"../lifecycle/index.js"},{"path":"node_modules/better-auth/node_modules/nanostores/map/index.js","kind":"import-statement","original":"../map/index.js"}],"format":"esm"},"node_modules/better-auth/node_modules/nanostores/index.js":{"bytes":704,"imports":[{"path":"node_modules/better-auth/node_modules/nanostores/atom/index.js","kind":"import-statement","original":"./atom/index.js"},{"path":"node_modules/better-auth/node_modules/nanostores/clean-stores/index.js","kind":"import-statement","original":"./clean-stores/index.js"},{"path":"node_modules/better-auth/node_modules/nanostores/computed/index.js","kind":"import-statement","original":"./computed/index.js"},{"path":"node_modules/better-auth/node_modules/nanostores/deep-map/index.js","kind":"import-statement","original":"./deep-map/index.js"},{"path":"node_modules/better-auth/node_modules/nanostores/effect/index.js","kind":"import-statement","original":"./effect/index.js"},{"path":"node_modules/better-auth/node_modules/nanostores/keep-mount/index.js","kind":"import-statement","original":"./keep-mount/index.js"},{"path":"node_modules/better-auth/node_modules/nanostores/lifecycle/index.js","kind":"import-statement","original":"./lifecycle/index.js"},{"path":"node_modules/better-auth/node_modules/nanostores/listen-keys/index.js","kind":"import-statement","original":"./listen-keys/index.js"},{"path":"node_modules/better-auth/node_modules/nanostores/map-creator/index.js","kind":"import-statement","original":"./map-creator/index.js"},{"path":"node_modules/better-auth/node_modules/nanostores/map/index.js","kind":"import-statement","original":"./map/index.js"},{"path":"node_modules/better-auth/node_modules/nanostores/task/index.js","kind":"import-statement","original":"./task/index.js"}],"format":"esm"},"node_modules/better-auth/dist/client/equality.mjs":{"bytes":1440,"imports":[{"path":"node_modules/better-auth/node_modules/nanostores/index.js","kind":"import-statement","original":"nanostores"}],"format":"esm"},"node_modules/better-auth/dist/client/focus-manager.mjs":{"bytes":1039,"imports":[],"format":"esm"},"node_modules/better-auth/dist/client/online-manager.mjs":{"bytes":1169,"imports":[],"format":"esm"},"node_modules/better-auth/dist/client/parser.mjs":{"bytes":3086,"imports":[],"format":"esm"},"node_modules/better-auth/dist/client/query.mjs":{"bytes":3638,"imports":[{"path":"node_modules/better-auth/dist/client/equality.mjs","kind":"import-statement","original":"./equality.mjs"},{"path":"node_modules/better-auth/node_modules/nanostores/index.js","kind":"import-statement","original":"nanostores"}],"format":"esm"},"node_modules/better-auth/dist/client/session-refresh.mjs":{"bytes":4017,"imports":[{"path":"node_modules/better-auth/dist/client/broadcast-channel.mjs","kind":"import-statement","original":"./broadcast-channel.mjs"},{"path":"node_modules/better-auth/dist/client/focus-manager.mjs","kind":"import-statement","original":"./focus-manager.mjs"},{"path":"node_modules/better-auth/dist/client/online-manager.mjs","kind":"import-statement","original":"./online-manager.mjs"}],"format":"esm"},"node_modules/better-auth/dist/utils/wildcard.mjs":{"bytes":4299,"imports":[],"format":"esm"},"node_modules/better-auth/node_modules/@better-auth/core/dist/env/env-impl.mjs":{"bytes":2467,"imports":[],"format":"esm"},"node_modules/better-auth/node_modules/@better-auth/core/dist/env/color-depth.mjs":{"bytes":2723,"imports":[{"path":"node_modules/better-auth/node_modules/@better-auth/core/dist/env/env-impl.mjs","kind":"import-statement","original":"./env-impl.mjs"}],"format":"esm"},"node_modules/better-auth/node_modules/@better-auth/core/dist/context/global.mjs":{"bytes":1108,"imports":[],"format":"esm"},"node_modules/better-auth/node_modules/@better-auth/core/dist/env/logger.mjs":{"bytes":3059,"imports":[{"path":"node_modules/better-auth/node_modules/@better-auth/core/dist/context/global.mjs","kind":"import-statement","original":"../context/global.mjs"},{"path":"node_modules/better-auth/node_modules/@better-auth/core/dist/env/color-depth.mjs","kind":"import-statement","original":"./color-depth.mjs"}],"format":"esm"},"node_modules/better-auth/node_modules/@better-auth/core/dist/env/index.mjs":{"bytes":431,"imports":[{"path":"node_modules/better-auth/node_modules/@better-auth/core/dist/env/env-impl.mjs","kind":"import-statement","original":"./env-impl.mjs"},{"path":"node_modules/better-auth/node_modules/@better-auth/core/dist/env/color-depth.mjs","kind":"import-statement","original":"./color-depth.mjs"},{"path":"node_modules/better-auth/node_modules/@better-auth/core/dist/env/logger.mjs","kind":"import-statement","original":"./logger.mjs"}],"format":"esm"},"node_modules/better-auth/node_modules/@better-auth/core/dist/utils/error-codes.mjs":{"bytes":253,"imports":[],"format":"esm"},"node_modules/better-auth/node_modules/@better-auth/core/dist/error/codes.mjs":{"bytes":2838,"imports":[{"path":"node_modules/better-auth/node_modules/@better-auth/core/dist/utils/error-codes.mjs","kind":"import-statement","original":"../utils/error-codes.mjs"}],"format":"esm"},"node_modules/better-auth/node_modules/better-call/dist/error.mjs":{"bytes":3780,"imports":[],"format":"esm"},"node_modules/better-auth/node_modules/@better-auth/core/dist/error/index.mjs":{"bytes":686,"imports":[{"path":"node_modules/better-auth/node_modules/@better-auth/core/dist/error/codes.mjs","kind":"import-statement","original":"./codes.mjs"},{"path":"node_modules/better-auth/node_modules/better-call/dist/error.mjs","kind":"import-statement","original":"better-call/error"}],"format":"esm"},"node_modules/better-auth/dist/utils/url.mjs":{"bytes":10626,"imports":[{"path":"node_modules/better-auth/dist/utils/wildcard.mjs","kind":"import-statement","original":"./wildcard.mjs"},{"path":"node_modules/better-auth/node_modules/@better-auth/core/dist/env/index.mjs","kind":"import-statement","original":"@better-auth/core/env"},{"path":"node_modules/better-auth/node_modules/@better-auth/core/dist/error/index.mjs","kind":"import-statement","original":"@better-auth/core/error"}],"format":"esm"},"node_modules/better-auth/node_modules/@better-auth/core/dist/utils/url.mjs":{"bytes":3353,"imports":[],"format":"esm"},"node_modules/better-auth/dist/client/fetch-plugins.mjs":{"bytes":491,"imports":[{"path":"node_modules/better-auth/node_modules/@better-auth/core/dist/utils/url.mjs","kind":"import-statement","original":"@better-auth/core/utils/url"}],"format":"esm"},"node_modules/better-auth/dist/client/session-atom.mjs":{"bytes":5304,"imports":[{"path":"node_modules/better-auth/dist/client/equality.mjs","kind":"import-statement","original":"./equality.mjs"},{"path":"node_modules/better-auth/dist/client/session-refresh.mjs","kind":"import-statement","original":"./session-refresh.mjs"},{"path":"node_modules/better-auth/node_modules/nanostores/index.js","kind":"import-statement","original":"nanostores"}],"format":"esm"},"node_modules/better-auth/node_modules/defu/dist/defu.mjs":{"bytes":2053,"imports":[],"format":"esm"},"node_modules/better-auth/node_modules/@better-fetch/fetch/dist/index.js":{"bytes":24232,"imports":[],"format":"esm"},"node_modules/better-auth/dist/client/config.mjs":{"bytes":4193,"imports":[{"path":"node_modules/better-auth/dist/utils/url.mjs","kind":"import-statement","original":"../utils/url.mjs"},{"path":"node_modules/better-auth/dist/client/parser.mjs","kind":"import-statement","original":"./parser.mjs"},{"path":"node_modules/better-auth/dist/client/fetch-plugins.mjs","kind":"import-statement","original":"./fetch-plugins.mjs"},{"path":"node_modules/better-auth/dist/client/session-atom.mjs","kind":"import-statement","original":"./session-atom.mjs"},{"path":"node_modules/better-auth/node_modules/defu/dist/defu.mjs","kind":"import-statement","original":"defu"},{"path":"node_modules/better-auth/node_modules/@better-fetch/fetch/dist/index.js","kind":"import-statement","original":"@better-fetch/fetch"}],"format":"esm"},"node_modules/better-auth/dist/utils/is-atom.mjs":{"bytes":245,"imports":[],"format":"esm"},"node_modules/better-auth/node_modules/@better-auth/core/dist/utils/string.mjs":{"bytes":982,"imports":[],"format":"esm"},"node_modules/better-auth/dist/client/proxy.mjs":{"bytes":2562,"imports":[{"path":"node_modules/better-auth/dist/utils/is-atom.mjs","kind":"import-statement","original":"../utils/is-atom.mjs"},{"path":"node_modules/better-auth/node_modules/@better-auth/core/dist/utils/string.mjs","kind":"import-statement","original":"@better-auth/core/utils/string"}],"format":"esm"},"node_modules/better-auth/dist/client/vanilla.mjs":{"bytes":737,"imports":[{"path":"node_modules/better-auth/dist/client/config.mjs","kind":"import-statement","original":"./config.mjs"},{"path":"node_modules/better-auth/dist/client/proxy.mjs","kind":"import-statement","original":"./proxy.mjs"},{"path":"node_modules/better-auth/node_modules/@better-auth/core/dist/utils/string.mjs","kind":"import-statement","original":"@better-auth/core/utils/string"}],"format":"esm"},"node_modules/better-auth/dist/client/index.mjs":{"bytes":929,"imports":[{"path":"node_modules/better-auth/dist/version.mjs","kind":"import-statement","original":"../version.mjs"},{"path":"node_modules/better-auth/dist/client/broadcast-channel.mjs","kind":"import-statement","original":"./broadcast-channel.mjs"},{"path":"node_modules/better-auth/dist/client/equality.mjs","kind":"import-statement","original":"./equality.mjs"},{"path":"node_modules/better-auth/dist/client/focus-manager.mjs","kind":"import-statement","original":"./focus-manager.mjs"},{"path":"node_modules/better-auth/dist/client/online-manager.mjs","kind":"import-statement","original":"./online-manager.mjs"},{"path":"node_modules/better-auth/dist/client/parser.mjs","kind":"import-statement","original":"./parser.mjs"},{"path":"node_modules/better-auth/dist/client/query.mjs","kind":"import-statement","original":"./query.mjs"},{"path":"node_modules/better-auth/dist/client/session-refresh.mjs","kind":"import-statement","original":"./session-refresh.mjs"},{"path":"node_modules/better-auth/dist/client/vanilla.mjs","kind":"import-statement","original":"./vanilla.mjs"}],"format":"esm"},"src/client/auth-dialog.js":{"bytes":1136,"imports":[{"path":"node_modules/better-auth/dist/client/index.mjs","kind":"import-statement","original":"better-auth/client"}],"format":"esm"}},"outputs":{"client/auth-dialog.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":144957},"client/auth-dialog.js":{"imports":[],"exports":[],"entryPoint":"src/client/auth-dialog.js","inputs":{"node_modules/better-auth/dist/client/broadcast-channel.mjs":{"bytesInOutput":758},"node_modules/better-auth/node_modules/nanostores/atom/index.js":{"bytesInOutput":679},"node_modules/better-auth/node_modules/nanostores/index.js":{"bytesInOutput":0},"node_modules/better-auth/node_modules/nanostores/lifecycle/index.js":{"bytesInOutput":909},"node_modules/better-auth/dist/client/equality.mjs":{"bytesInOutput":522},"node_modules/better-auth/dist/client/focus-manager.mjs":{"bytesInOutput":558},"node_modules/better-auth/dist/client/online-manager.mjs":{"bytesInOutput":645},"node_modules/better-auth/dist/client/parser.mjs":{"bytesInOutput":1940},"node_modules/better-auth/dist/client/session-refresh.mjs":{"bytesInOutput":1911},"node_modules/better-auth/node_modules/@better-auth/core/dist/env/env-impl.mjs":{"bytesInOutput":974},"node_modules/better-auth/node_modules/better-call/dist/error.mjs":{"bytesInOutput":2060},"node_modules/better-auth/node_modules/@better-auth/core/dist/error/index.mjs":{"bytesInOutput":113},"node_modules/better-auth/dist/utils/url.mjs":{"bytesInOutput":1783},"node_modules/better-auth/node_modules/@better-auth/core/dist/utils/url.mjs":{"bytesInOutput":127},"node_modules/better-auth/dist/client/fetch-plugins.mjs":{"bytesInOutput":207},"node_modules/better-auth/dist/client/session-atom.mjs":{"bytesInOutput":2298},"node_modules/better-auth/node_modules/defu/dist/defu.mjs":{"bytesInOutput":823},"node_modules/better-auth/node_modules/@better-fetch/fetch/dist/index.js":{"bytesInOutput":9505},"node_modules/better-auth/dist/client/config.mjs":{"bytesInOutput":2197},"node_modules/better-auth/dist/utils/is-atom.mjs":{"bytesInOutput":121},"node_modules/better-auth/node_modules/@better-auth/core/dist/utils/string.mjs":{"bytesInOutput":257},"node_modules/better-auth/dist/client/proxy.mjs":{"bytesInOutput":957},"node_modules/better-auth/dist/client/vanilla.mjs":{"bytesInOutput":251},"src/client/auth-dialog.js":{"bytesInOutput":501}},"bytes":30220}}}
1
+ {"inputs":{"node_modules/better-auth/dist/package.mjs":{"bytes":79,"imports":[],"format":"esm"},"node_modules/better-auth/dist/version.mjs":{"bytes":140,"imports":[{"path":"node_modules/better-auth/dist/package.mjs","kind":"import-statement","original":"./package.mjs"}],"format":"esm"},"node_modules/better-auth/dist/client/broadcast-channel.mjs":{"bytes":1388,"imports":[],"format":"esm"},"node_modules/better-auth/node_modules/nanostores/task/index.js":{"bytes":750,"imports":[],"format":"esm"},"node_modules/better-auth/node_modules/nanostores/clean-stores/index.js":{"bytes":437,"imports":[{"path":"node_modules/better-auth/node_modules/nanostores/task/index.js","kind":"import-statement","original":"../task/index.js"}],"format":"esm"},"node_modules/better-auth/node_modules/nanostores/atom/index.js":{"bytes":3221,"imports":[{"path":"node_modules/better-auth/node_modules/nanostores/clean-stores/index.js","kind":"import-statement","original":"../clean-stores/index.js"}],"format":"esm"},"node_modules/better-auth/node_modules/nanostores/lifecycle/index.js":{"bytes":4243,"imports":[{"path":"node_modules/better-auth/node_modules/nanostores/clean-stores/index.js","kind":"import-statement","original":"../clean-stores/index.js"}],"format":"esm"},"node_modules/better-auth/node_modules/nanostores/warn/index.js":{"bytes":290,"imports":[],"format":"esm"},"node_modules/better-auth/node_modules/nanostores/computed/index.js":{"bytes":2027,"imports":[{"path":"node_modules/better-auth/node_modules/nanostores/atom/index.js","kind":"import-statement","original":"../atom/index.js"},{"path":"node_modules/better-auth/node_modules/nanostores/clean-stores/index.js","kind":"import-statement","original":"../clean-stores/index.js"},{"path":"node_modules/better-auth/node_modules/nanostores/lifecycle/index.js","kind":"import-statement","original":"../lifecycle/index.js"},{"path":"node_modules/better-auth/node_modules/nanostores/warn/index.js","kind":"import-statement","original":"../warn/index.js"}],"format":"esm"},"node_modules/better-auth/node_modules/nanostores/deep-map/path.js":{"bytes":1418,"imports":[],"format":"esm"},"node_modules/better-auth/node_modules/nanostores/deep-map/index.js":{"bytes":795,"imports":[{"path":"node_modules/better-auth/node_modules/nanostores/atom/index.js","kind":"import-statement","original":"../atom/index.js"},{"path":"node_modules/better-auth/node_modules/nanostores/warn/index.js","kind":"import-statement","original":"../warn/index.js"},{"path":"node_modules/better-auth/node_modules/nanostores/deep-map/path.js","kind":"import-statement","original":"./path.js"},{"path":"node_modules/better-auth/node_modules/nanostores/deep-map/path.js","kind":"import-statement","original":"./path.js"}],"format":"esm"},"node_modules/better-auth/node_modules/nanostores/effect/index.js":{"bytes":448,"imports":[],"format":"esm"},"node_modules/better-auth/node_modules/nanostores/keep-mount/index.js":{"bytes":65,"imports":[],"format":"esm"},"node_modules/better-auth/node_modules/nanostores/listen-keys/index.js":{"bytes":923,"imports":[{"path":"node_modules/better-auth/node_modules/nanostores/deep-map/path.js","kind":"import-statement","original":"../deep-map/path.js"}],"format":"esm"},"node_modules/better-auth/node_modules/nanostores/map/index.js":{"bytes":576,"imports":[{"path":"node_modules/better-auth/node_modules/nanostores/atom/index.js","kind":"import-statement","original":"../atom/index.js"}],"format":"esm"},"node_modules/better-auth/node_modules/nanostores/map-creator/index.js":{"bytes":894,"imports":[{"path":"node_modules/better-auth/node_modules/nanostores/clean-stores/index.js","kind":"import-statement","original":"../clean-stores/index.js"},{"path":"node_modules/better-auth/node_modules/nanostores/lifecycle/index.js","kind":"import-statement","original":"../lifecycle/index.js"},{"path":"node_modules/better-auth/node_modules/nanostores/map/index.js","kind":"import-statement","original":"../map/index.js"}],"format":"esm"},"node_modules/better-auth/node_modules/nanostores/index.js":{"bytes":704,"imports":[{"path":"node_modules/better-auth/node_modules/nanostores/atom/index.js","kind":"import-statement","original":"./atom/index.js"},{"path":"node_modules/better-auth/node_modules/nanostores/clean-stores/index.js","kind":"import-statement","original":"./clean-stores/index.js"},{"path":"node_modules/better-auth/node_modules/nanostores/computed/index.js","kind":"import-statement","original":"./computed/index.js"},{"path":"node_modules/better-auth/node_modules/nanostores/deep-map/index.js","kind":"import-statement","original":"./deep-map/index.js"},{"path":"node_modules/better-auth/node_modules/nanostores/effect/index.js","kind":"import-statement","original":"./effect/index.js"},{"path":"node_modules/better-auth/node_modules/nanostores/keep-mount/index.js","kind":"import-statement","original":"./keep-mount/index.js"},{"path":"node_modules/better-auth/node_modules/nanostores/lifecycle/index.js","kind":"import-statement","original":"./lifecycle/index.js"},{"path":"node_modules/better-auth/node_modules/nanostores/listen-keys/index.js","kind":"import-statement","original":"./listen-keys/index.js"},{"path":"node_modules/better-auth/node_modules/nanostores/map-creator/index.js","kind":"import-statement","original":"./map-creator/index.js"},{"path":"node_modules/better-auth/node_modules/nanostores/map/index.js","kind":"import-statement","original":"./map/index.js"},{"path":"node_modules/better-auth/node_modules/nanostores/task/index.js","kind":"import-statement","original":"./task/index.js"}],"format":"esm"},"node_modules/better-auth/dist/client/equality.mjs":{"bytes":1440,"imports":[{"path":"node_modules/better-auth/node_modules/nanostores/index.js","kind":"import-statement","original":"nanostores"}],"format":"esm"},"node_modules/better-auth/dist/client/focus-manager.mjs":{"bytes":1039,"imports":[],"format":"esm"},"node_modules/better-auth/dist/client/online-manager.mjs":{"bytes":1169,"imports":[],"format":"esm"},"node_modules/better-auth/dist/client/parser.mjs":{"bytes":3086,"imports":[],"format":"esm"},"node_modules/better-auth/dist/client/query.mjs":{"bytes":3638,"imports":[{"path":"node_modules/better-auth/dist/client/equality.mjs","kind":"import-statement","original":"./equality.mjs"},{"path":"node_modules/better-auth/node_modules/nanostores/index.js","kind":"import-statement","original":"nanostores"}],"format":"esm"},"node_modules/better-auth/dist/client/session-refresh.mjs":{"bytes":4017,"imports":[{"path":"node_modules/better-auth/dist/client/broadcast-channel.mjs","kind":"import-statement","original":"./broadcast-channel.mjs"},{"path":"node_modules/better-auth/dist/client/focus-manager.mjs","kind":"import-statement","original":"./focus-manager.mjs"},{"path":"node_modules/better-auth/dist/client/online-manager.mjs","kind":"import-statement","original":"./online-manager.mjs"}],"format":"esm"},"node_modules/better-auth/dist/utils/wildcard.mjs":{"bytes":4299,"imports":[],"format":"esm"},"node_modules/better-auth/node_modules/@better-auth/core/dist/env/env-impl.mjs":{"bytes":2467,"imports":[],"format":"esm"},"node_modules/better-auth/node_modules/@better-auth/core/dist/env/color-depth.mjs":{"bytes":2723,"imports":[{"path":"node_modules/better-auth/node_modules/@better-auth/core/dist/env/env-impl.mjs","kind":"import-statement","original":"./env-impl.mjs"}],"format":"esm"},"node_modules/better-auth/node_modules/@better-auth/core/dist/context/global.mjs":{"bytes":1108,"imports":[],"format":"esm"},"node_modules/better-auth/node_modules/@better-auth/core/dist/env/logger.mjs":{"bytes":3059,"imports":[{"path":"node_modules/better-auth/node_modules/@better-auth/core/dist/context/global.mjs","kind":"import-statement","original":"../context/global.mjs"},{"path":"node_modules/better-auth/node_modules/@better-auth/core/dist/env/color-depth.mjs","kind":"import-statement","original":"./color-depth.mjs"}],"format":"esm"},"node_modules/better-auth/node_modules/@better-auth/core/dist/env/index.mjs":{"bytes":431,"imports":[{"path":"node_modules/better-auth/node_modules/@better-auth/core/dist/env/env-impl.mjs","kind":"import-statement","original":"./env-impl.mjs"},{"path":"node_modules/better-auth/node_modules/@better-auth/core/dist/env/color-depth.mjs","kind":"import-statement","original":"./color-depth.mjs"},{"path":"node_modules/better-auth/node_modules/@better-auth/core/dist/env/logger.mjs","kind":"import-statement","original":"./logger.mjs"}],"format":"esm"},"node_modules/better-auth/node_modules/@better-auth/core/dist/utils/error-codes.mjs":{"bytes":253,"imports":[],"format":"esm"},"node_modules/better-auth/node_modules/@better-auth/core/dist/error/codes.mjs":{"bytes":2838,"imports":[{"path":"node_modules/better-auth/node_modules/@better-auth/core/dist/utils/error-codes.mjs","kind":"import-statement","original":"../utils/error-codes.mjs"}],"format":"esm"},"node_modules/better-auth/node_modules/better-call/dist/error.mjs":{"bytes":3780,"imports":[],"format":"esm"},"node_modules/better-auth/node_modules/@better-auth/core/dist/error/index.mjs":{"bytes":686,"imports":[{"path":"node_modules/better-auth/node_modules/@better-auth/core/dist/error/codes.mjs","kind":"import-statement","original":"./codes.mjs"},{"path":"node_modules/better-auth/node_modules/better-call/dist/error.mjs","kind":"import-statement","original":"better-call/error"}],"format":"esm"},"node_modules/better-auth/dist/utils/url.mjs":{"bytes":10626,"imports":[{"path":"node_modules/better-auth/dist/utils/wildcard.mjs","kind":"import-statement","original":"./wildcard.mjs"},{"path":"node_modules/better-auth/node_modules/@better-auth/core/dist/env/index.mjs","kind":"import-statement","original":"@better-auth/core/env"},{"path":"node_modules/better-auth/node_modules/@better-auth/core/dist/error/index.mjs","kind":"import-statement","original":"@better-auth/core/error"}],"format":"esm"},"node_modules/better-auth/node_modules/@better-auth/core/dist/utils/url.mjs":{"bytes":3353,"imports":[],"format":"esm"},"node_modules/better-auth/dist/client/fetch-plugins.mjs":{"bytes":491,"imports":[{"path":"node_modules/better-auth/node_modules/@better-auth/core/dist/utils/url.mjs","kind":"import-statement","original":"@better-auth/core/utils/url"}],"format":"esm"},"node_modules/better-auth/dist/client/session-atom.mjs":{"bytes":5304,"imports":[{"path":"node_modules/better-auth/dist/client/equality.mjs","kind":"import-statement","original":"./equality.mjs"},{"path":"node_modules/better-auth/dist/client/session-refresh.mjs","kind":"import-statement","original":"./session-refresh.mjs"},{"path":"node_modules/better-auth/node_modules/nanostores/index.js","kind":"import-statement","original":"nanostores"}],"format":"esm"},"node_modules/better-auth/node_modules/defu/dist/defu.mjs":{"bytes":2053,"imports":[],"format":"esm"},"node_modules/better-auth/node_modules/@better-fetch/fetch/dist/index.js":{"bytes":24232,"imports":[],"format":"esm"},"node_modules/better-auth/dist/client/config.mjs":{"bytes":4193,"imports":[{"path":"node_modules/better-auth/dist/utils/url.mjs","kind":"import-statement","original":"../utils/url.mjs"},{"path":"node_modules/better-auth/dist/client/parser.mjs","kind":"import-statement","original":"./parser.mjs"},{"path":"node_modules/better-auth/dist/client/fetch-plugins.mjs","kind":"import-statement","original":"./fetch-plugins.mjs"},{"path":"node_modules/better-auth/dist/client/session-atom.mjs","kind":"import-statement","original":"./session-atom.mjs"},{"path":"node_modules/better-auth/node_modules/defu/dist/defu.mjs","kind":"import-statement","original":"defu"},{"path":"node_modules/better-auth/node_modules/@better-fetch/fetch/dist/index.js","kind":"import-statement","original":"@better-fetch/fetch"}],"format":"esm"},"node_modules/better-auth/dist/utils/is-atom.mjs":{"bytes":245,"imports":[],"format":"esm"},"node_modules/better-auth/node_modules/@better-auth/core/dist/utils/string.mjs":{"bytes":982,"imports":[],"format":"esm"},"node_modules/better-auth/dist/client/proxy.mjs":{"bytes":2562,"imports":[{"path":"node_modules/better-auth/dist/utils/is-atom.mjs","kind":"import-statement","original":"../utils/is-atom.mjs"},{"path":"node_modules/better-auth/node_modules/@better-auth/core/dist/utils/string.mjs","kind":"import-statement","original":"@better-auth/core/utils/string"}],"format":"esm"},"node_modules/better-auth/dist/client/vanilla.mjs":{"bytes":737,"imports":[{"path":"node_modules/better-auth/dist/client/config.mjs","kind":"import-statement","original":"./config.mjs"},{"path":"node_modules/better-auth/dist/client/proxy.mjs","kind":"import-statement","original":"./proxy.mjs"},{"path":"node_modules/better-auth/node_modules/@better-auth/core/dist/utils/string.mjs","kind":"import-statement","original":"@better-auth/core/utils/string"}],"format":"esm"},"node_modules/better-auth/dist/client/index.mjs":{"bytes":929,"imports":[{"path":"node_modules/better-auth/dist/version.mjs","kind":"import-statement","original":"../version.mjs"},{"path":"node_modules/better-auth/dist/client/broadcast-channel.mjs","kind":"import-statement","original":"./broadcast-channel.mjs"},{"path":"node_modules/better-auth/dist/client/equality.mjs","kind":"import-statement","original":"./equality.mjs"},{"path":"node_modules/better-auth/dist/client/focus-manager.mjs","kind":"import-statement","original":"./focus-manager.mjs"},{"path":"node_modules/better-auth/dist/client/online-manager.mjs","kind":"import-statement","original":"./online-manager.mjs"},{"path":"node_modules/better-auth/dist/client/parser.mjs","kind":"import-statement","original":"./parser.mjs"},{"path":"node_modules/better-auth/dist/client/query.mjs","kind":"import-statement","original":"./query.mjs"},{"path":"node_modules/better-auth/dist/client/session-refresh.mjs","kind":"import-statement","original":"./session-refresh.mjs"},{"path":"node_modules/better-auth/dist/client/vanilla.mjs","kind":"import-statement","original":"./vanilla.mjs"}],"format":"esm"},"src/client/auth-dialog.js":{"bytes":1136,"imports":[{"path":"node_modules/better-auth/dist/client/index.mjs","kind":"import-statement","original":"better-auth/client"}],"format":"esm"}},"outputs":{"client/auth-dialog.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":144957},"client/auth-dialog.js":{"imports":[],"exports":[],"entryPoint":"src/client/auth-dialog.js","inputs":{"node_modules/better-auth/dist/client/broadcast-channel.mjs":{"bytesInOutput":758},"node_modules/better-auth/node_modules/nanostores/atom/index.js":{"bytesInOutput":679},"node_modules/better-auth/node_modules/nanostores/index.js":{"bytesInOutput":0},"node_modules/better-auth/node_modules/nanostores/lifecycle/index.js":{"bytesInOutput":909},"node_modules/better-auth/dist/client/equality.mjs":{"bytesInOutput":522},"node_modules/better-auth/dist/client/focus-manager.mjs":{"bytesInOutput":558},"node_modules/better-auth/dist/client/online-manager.mjs":{"bytesInOutput":645},"node_modules/better-auth/dist/client/parser.mjs":{"bytesInOutput":1940},"node_modules/better-auth/dist/client/session-refresh.mjs":{"bytesInOutput":1911},"node_modules/better-auth/node_modules/@better-auth/core/dist/env/env-impl.mjs":{"bytesInOutput":974},"node_modules/better-auth/node_modules/better-call/dist/error.mjs":{"bytesInOutput":2060},"node_modules/better-auth/node_modules/@better-auth/core/dist/error/index.mjs":{"bytesInOutput":113},"node_modules/better-auth/dist/utils/url.mjs":{"bytesInOutput":1783},"node_modules/better-auth/node_modules/@better-auth/core/dist/utils/url.mjs":{"bytesInOutput":127},"node_modules/better-auth/dist/client/fetch-plugins.mjs":{"bytesInOutput":207},"node_modules/better-auth/dist/client/session-atom.mjs":{"bytesInOutput":2298},"node_modules/better-auth/node_modules/defu/dist/defu.mjs":{"bytesInOutput":823},"node_modules/better-auth/node_modules/@better-fetch/fetch/dist/index.js":{"bytesInOutput":9505},"node_modules/better-auth/dist/client/config.mjs":{"bytesInOutput":2197},"node_modules/better-auth/dist/utils/is-atom.mjs":{"bytesInOutput":121},"node_modules/better-auth/node_modules/@better-auth/core/dist/utils/string.mjs":{"bytesInOutput":257},"node_modules/better-auth/dist/client/proxy.mjs":{"bytesInOutput":957},"node_modules/better-auth/dist/client/vanilla.mjs":{"bytesInOutput":251},"src/client/auth-dialog.js":{"bytesInOutput":501}},"bytes":30215}}}
package/meta-server.json CHANGED
@@ -1 +1 @@
1
- {"inputs":{"src/server/social.js":{"bytes":14951,"imports":[],"format":"esm"}},"outputs":{"server/social.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":23548},"server/social.js":{"imports":[{"path":"node:url","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"better-auth","kind":"import-statement","external":true},{"path":"better-auth/plugins","kind":"import-statement","external":true},{"path":"better-auth/node","kind":"import-statement","external":true},{"path":"express-handlebars","kind":"import-statement","external":true}],"exports":["default"],"entryPoint":"src/server/social.js","inputs":{"src/server/social.js":{"bytesInOutput":7624}},"bytes":7732}}}
1
+ {"inputs":{"src/server/social.js":{"bytes":14951,"imports":[],"format":"esm"}},"outputs":{"server/social.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":23548},"server/social.js":{"imports":[{"path":"node:url","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"better-auth","kind":"import-statement","external":true},{"path":"better-auth/plugins","kind":"import-statement","external":true},{"path":"better-auth/node","kind":"import-statement","external":true},{"path":"express-handlebars","kind":"import-statement","external":true}],"exports":["default"],"entryPoint":"src/server/social.js","inputs":{"src/server/social.js":{"bytesInOutput":7624}},"bytes":7727}}}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wiki-security-social",
3
- "version": "0.1.0-rc.8",
3
+ "version": "0.1.0",
4
4
  "description": "Social Authentication Security plugin for Federated Wiki.",
5
5
  "license": "MIT",
6
6
  "author": "Paul Rodwell <paul.rodwell@btinternet.com>",
package/server/social.js CHANGED
@@ -1,4 +1,4 @@
1
- /* wiki-security-social - 0.1.0-rc.8 - Mon, 07 Sep 2026 11:18:56 GMT */
1
+ /* wiki-security-social - 0.1.0 - Mon, 14 Sep 2026 10:58:44 GMT */
2
2
  import h from"node:url";import f from"node:fs";import p from"node:path";import{betterAuth as O}from"better-auth";import{genericOAuth as H}from"better-auth/plugins";import{fromNodeHeaders as _,toNodeHandler as N}from"better-auth/node";import{create as I}from"express-handlebars";console.log("*** security social starting");export default(A,F,e)=>{let k;const i={owner:"",ownerName:"",wikiName:e.url,wikiHost:e.wiki_domain?e.wiki_domain:null,admin:e.admin,statusDir:e.status,idFile:e.id,useHttps:e.security_useHttps??!0,callbackProtocol:e.security_useHttps??!0?"https:":h.parse(e.url).protocol,providers:[]};i.callbackHost=i.wikiHost?h.parse(e.url).port?`${i.wikiHost}:${h.parse(e.url).port}`:i.wikiHost:h.parse(e.url).host;const c={};c.retrieveOwner=s=>{f.access(i.idFile,f.constants.F_OK,a=>{a?(i.owner="",s()):f.readFile(i.idFile,(u,d)=>{if(u)return s(u);try{i.owner=JSON.parse(d)}catch(l){console.log(`*** OWNER FILE PROBLEM
3
3
  *** Owner File: ${i.idFile}
4
4
  *** Error: ${l.message}`),i.owner={name:"unparsable"}}i.ownerName=i.owner.name,s()})})};const g=c.getOwner=()=>i.owner.name||"",b=c.setOwner=(s,a)=>{f.access(i.idFile,f.constants.F_OK,u=>{u?f.writeFile(i.idFile,JSON.stringify(s),d=>{if(d)return a(d);console.log(`Claiming wiki ${i.wikiName} for ${s.name}`),i.owner=s,i.ownerName=s.name,a()}):a("Already Claimed")})};c.getUser=s=>s.user;const y=c.isAuthorized=s=>{if(i.owner==="")return!0;if(s.user){const a=Object.keys(s.user.social);return a.some(u=>i.owner.hasOwnProperty(u))?i.owner[a].id.toString()===s.user.social[a].id.toString():!1}else return!1};return c.isAdmin=s=>{if(typeof i.admin>"u")return!1;try{if(!s.user)return!1}catch{return!1}const a=Object.keys(s.user.social)[0];return i.admin[a]===void 0?(console.log("admin not defined for",a),!1):["github","google","oauth2"].includes(a)?i.admin[a].toString()===s.user.social[a].id.toString():!1},c.defineRoutes=(s,a,u)=>{const d=I({extname:".html",layoutsDir:p.join(p.dirname(h.fileURLToPath(import.meta.url)),"..","views"),defaultLayout:"securityDialog"}),l={baseURL:`${i.callbackProtocol}//${i.callbackHost}/auth`,basePath:"/auth",socialProviders:{},plugins:[],secret:e.cookieSecret,session:{strategy:"compact",expiresIn:e.session_duration*24*60*60,updateAge:3600*24,cookieCache:{enabled:!0,maxAge:e.session_duration*24*60*60}},cookie:{maxAge:e.session_duration*24*60*60},user:{additionalFields:{social:{type:"object",returned:!0}}},advanced:{crossSubDomainCookies:{enabled:!0},cookiePrefix:"fedwiki",useSecureCookies:i.useHttps},trustedOrigins:[`${i.callbackProtocol}//*.${i.callbackHost}`]};if(["github_clientID","github_clientSecret"].every(t=>t in e)&&(e.auth_Prompt&&!e.auth_Prompt==="select_account"&&(e.auth_Prompt=null),l.socialProviders.github={clientId:e.github_clientID,clientSecret:e.github_clientSecret,...e.auth_Prompt?{prompt:e.auth_Prompt}:{},mapProfileToUser:async t=>({social:{github:{username:t.login,id:t.id}}})}),["google_clientID","google_clientSecret"].every(t=>t in e)&&(e.auth_Prompt&&(["consent","select_account"].includes(e.auth_Prompt)||(e.auth_Prompt=null)),l.socialProviders.google={clientId:e.google_clientID,clientSecret:e.google_clientSecret,...e.auth_Prompt?{prompt:e.auth_Prompt}:{},mapProfileToUser:async t=>({social:{google:{username:t.name,id:t.sub}}})}),["oauth2_clientID","oauth2_clientSecret","oauth2_discoveryUrl"].every(t=>t in e)&&(e.auth_Prompt&&(["login","consent","none","select_account"].includes(e.auth_Prompt)||(e.auth_Prompt=null)),l.account={storeAccountCookie:!1},l.plugins.push(H({config:[{providerId:"oauth2",clientId:e.oauth2_clientID,clientSecret:e.oauth2_clientSecret,...e.auth_Prompt?{prompt:e.auth_Prompt}:{},discoveryUrl:e.oauth2_discoveryUrl,scopes:["openid","profile","email"],mapProfileToUser:async t=>({name:t[e.oauth2_DisplayNameField]||t.preferred_username,social:{oauth2:{id:t[e.oauth2_IdField]||t.sub,username:t[e.oauth2_UsernameField]||t.preferred_username}}})}]}))),k=O(l),s.use(async(t,o,n)=>{const r=await k.api.getSession({headers:_(t.headers)});r?t.user=r.user:t.user="",n()}),s.get("/auth/client-settings.json",(t,o)=>{const n={useHttps:i.useHttps};i.wikiHost&&(n.wikiHost=i.wikiHost),y(t)&&i.owner!=""?n.isOwner=!0:n.isOwner=!1,o.json(n)}),s.get("/auth/loginDialog",(t,o)=>{const n=t.cookies,r=[];l.socialProviders.github&&r.push({button:`<a href='#' onclick='window.resizeBy(0,+500); signIn("github")' class='scheme-button github-button'><span>Github</span></a>`}),l.socialProviders.google&&r.push({button:`<a href='#' onclick='window.resizeBy(0,+300); signIn("google")' class='scheme-button google-button'><span>Google</span></a>`}),l.plugins.some(m=>m.id==="generic-oauth"&&m.options.config[0].providerId==="oauth2")&&r.push({button:`<a href='#' onclick='window.resizeBy(0,+300); signIn("oauth2")' class='scheme-button'><span>OAuth2</span></a>`});const w={wikiName:n.wikiName,wikiHostName:i.wikiHost?"part of "+t.hostname+" wiki farm":"a federated wiki site",title:"Federated Wiki: Site Owner Sign-on",loginText:"Sign in to",schemes:r};d.render(p.join(p.dirname(h.fileURLToPath(import.meta.url)),"..","views","securityDialog.html"),w).then(m=>o.send(m))}),s.get("/auth/loginDone",async(t,o)=>{const n=await k.api.getSession({headers:_(t.headers)}),w={wikiName:t.cookies.wikiName,wikiHostName:i.wikiHost?`part of ${t.hostname} wiki farm`:"a federated wiki site",title:i.owner?"Wiki Site Owner Sign-on":"Sign-on to claim Wiki site",owner:g(),authMessage:"You are now logged in. If this window hasn't closed, you can close it."};d.render(p.join(p.dirname(h.fileURLToPath(import.meta.url)),"..","views","done.html"),w).then(m=>o.send(m))}),e.restricted){const t=o=>{if(e.allowed_domains)if(Array.isArray(e.allowed_domains)){const n=o.user.email?.split("@")[1]?.toLowerCase();if(n&&e.allowed_domains.includes(n))return!0}else console.warn("argv.allowed_domains exists, but its value is not an array.");if(e.allowed_ids)if(Array.isArray(e.allowed_ids)){const n=e.allowed_ids.length===1&&e.allowed_ids[0]==="*",r=Object.keys(o.user?.social??{})[0];if(r&&(n||e.allowed_ids.map(String).includes(String(o.user.social[r].id))))return!0}else console.log("argv.allowed_ids exists, but its value is not an array.");return!1};s.all("*splat",(o,n,r)=>{if(["json","html"].every(S=>!o.path.endsWith(S))&&!o.path.startsWith("/asset")&&(o.path!=="/auth/claim-wiki"||t(o))||(n.header("Access-Control-Allow-Origin",o.get("Origin")||"*"),n.header("Access-Control-Allow-Credentials","true"),y(o)&&i.owner!==""||t(o)))return r();if(o.path.endsWith(".html"))return n.redirect(`/view${o.path.slice(0,-5)}`);if(["/system/sitemap.json","/system/site-index.json"].includes(o.path))return n.json({});const m="This is a restricted wiki requires users to login to view pages. You do not have to be the site owner but you do need to login with a participating email address.";let P=`[${e.details||"http://ward.asia.wiki.org/login-to-view.html"} details]`;return n.status(200).json({title:"Login Required",story:[{type:"paragraph",id:"55d44b367ed64875",text:`${m} ${P}`}]})})}s.get("/auth/claim-wiki",(t,o)=>{if(i.owner)console.log("Claim Request Ignored: Wiki already has owner - ",i.wikiName),o.sendStatus(403);else{const n=t.user;n?.social||(console.log("Claim Request Ignored: User not authenticated - ",(void 0).wikiName),o.sendStatus(401));const r=Object.assign({name:n.name},n.social);b(r,w=>{w&&(console.log("Failed to claim wiki ",t.hostname," for ",r),o.sendStatus(500)),u(g()),o.json({ownerName:r.name})})}}),s.get("/logout",async(t,o)=>{t.session.reset(),o.send("OK")}),s.all("/auth/*splat",async(t,o)=>(t.body&&t.body.provider&&(t.body.providerId=t.body.provider),await N(k)(t,o),{body:t.body}))},c};