@deslop/auth 0.1.1267 → 0.1.1268

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.
Files changed (38) hide show
  1. package/dist/client/assets/(home)-BLuYq_h1.js +1 -0
  2. package/dist/client/assets/components-Bx1uCZyq.js +1 -0
  3. package/dist/client/assets/effect-V75jGeti.js +17 -0
  4. package/dist/client/assets/index-BM5yYMs1.css +2 -0
  5. package/dist/client/assets/index-CEEhXt-I.js +2 -0
  6. package/dist/client/assets/jetbrains-mono-cyrillic-wght-normal-D73BlboJ.woff2 +0 -0
  7. package/dist/client/assets/jetbrains-mono-greek-wght-normal-Bw9x6K1M.woff2 +0 -0
  8. package/dist/client/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2 +0 -0
  9. package/dist/client/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2 +0 -0
  10. package/dist/client/assets/jetbrains-mono-vietnamese-wght-normal-Bt-aOZkq.woff2 +0 -0
  11. package/dist/client/assets/people-Wv54k1IM.js +1 -0
  12. package/dist/client/assets/route-DcZfRjNs.js +1 -0
  13. package/dist/client/assets/useValueChanged-D2gwkWrL.js +1 -0
  14. package/dist/client/assets/utils-rpEN58iN.js +2 -0
  15. package/dist/client/index.html +4 -4
  16. package/dist/server.js +157 -19
  17. package/package.json +2 -2
  18. package/dist/client/assets/(home)-zPVOH7Wu.js +0 -20
  19. package/dist/client/assets/Check.es-C9l513Ch.js +0 -1
  20. package/dist/client/assets/components-CxZlmD_H.js +0 -1
  21. package/dist/client/assets/dialog-DbVw_5V8.js +0 -1
  22. package/dist/client/assets/effect-CarHrcH-.js +0 -17
  23. package/dist/client/assets/geist-cyrillic-ext-wght-normal-DjL33-gN.woff2 +0 -0
  24. package/dist/client/assets/geist-cyrillic-wght-normal-BEAKL7Jp.woff2 +0 -0
  25. package/dist/client/assets/geist-latin-ext-wght-normal-DC-KSUi6.woff2 +0 -0
  26. package/dist/client/assets/geist-latin-wght-normal-BgDaEnEv.woff2 +0 -0
  27. package/dist/client/assets/geist-mono-cyrillic-ext-wght-normal-X_5orZeX.woff2 +0 -0
  28. package/dist/client/assets/geist-mono-cyrillic-wght-normal-DiZS0aHC.woff2 +0 -0
  29. package/dist/client/assets/geist-mono-latin-ext-wght-normal-Bwz-egvJ.woff2 +0 -0
  30. package/dist/client/assets/geist-mono-latin-wght-normal-XN7g48iV.woff2 +0 -0
  31. package/dist/client/assets/geist-mono-symbols2-wght-normal-CO5SzqOn.woff2 +0 -0
  32. package/dist/client/assets/geist-mono-vietnamese-wght-normal-DadHysG0.woff2 +0 -0
  33. package/dist/client/assets/geist-vietnamese-wght-normal-6IgcOCM7.woff2 +0 -0
  34. package/dist/client/assets/index-D_zkN1kq.css +0 -2
  35. package/dist/client/assets/index-RSMneHpz.js +0 -2
  36. package/dist/client/assets/people-BeIXWDuU.js +0 -1
  37. package/dist/client/assets/route-CPuCWB2A.js +0 -41
  38. package/dist/client/assets/utils-BepQ-yTS.js +0 -2
@@ -15,12 +15,12 @@
15
15
  <link rel="manifest" href="/manifest.webmanifest" />
16
16
 
17
17
  <title>Auth</title>
18
- <script type="module" crossorigin src="/assets/index-RSMneHpz.js"></script>
18
+ <script type="module" crossorigin src="/assets/index-CEEhXt-I.js"></script>
19
19
  <link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-WkwZ5CU-.js">
20
- <link rel="modulepreload" crossorigin href="/assets/effect-CarHrcH-.js">
20
+ <link rel="modulepreload" crossorigin href="/assets/effect-V75jGeti.js">
21
21
  <link rel="modulepreload" crossorigin href="/assets/react-COyt-gOi.js">
22
- <link rel="modulepreload" crossorigin href="/assets/utils-BepQ-yTS.js">
23
- <link rel="stylesheet" crossorigin href="/assets/index-D_zkN1kq.css">
22
+ <link rel="modulepreload" crossorigin href="/assets/utils-rpEN58iN.js">
23
+ <link rel="stylesheet" crossorigin href="/assets/index-BM5yYMs1.css">
24
24
  </head>
25
25
  <body>
26
26
  <div id="root"></div>
package/dist/server.js CHANGED
@@ -7699,6 +7699,56 @@ const containsWith = (isEquivalent) => dual(2, (self, a) => {
7699
7699
  * @since 2.0.0
7700
7700
  */
7701
7701
  const contains = /*#__PURE__*/ containsWith(/*#__PURE__*/ asEquivalence());
7702
+ /**
7703
+ * Groups elements into a record by a key-returning function. Each key maps
7704
+ * to a `NonEmptyArray` of elements that produced that key.
7705
+ *
7706
+ * **When to use**
7707
+ *
7708
+ * Use to build buckets of elements indexed by a computed string or symbol key.
7709
+ *
7710
+ * **Details**
7711
+ *
7712
+ * Unlike `group` and `groupWith`, elements do not need to be adjacent to be
7713
+ * grouped together. The key function must return a `string` or `symbol`.
7714
+ *
7715
+ * **Gotchas**
7716
+ *
7717
+ * When the key function returns a finite union of string literals or unique
7718
+ * symbols, the result preserves those keys as optional properties because the
7719
+ * input may not produce every key. Open `string` and `symbol` key types retain
7720
+ * their record index signatures.
7721
+ *
7722
+ * **Example** (Grouping by a property)
7723
+ *
7724
+ * ```ts import.meta.vitest
7725
+ * import { Array } from "effect"
7726
+ *
7727
+ * const people = [
7728
+ * { name: "Alice", group: "A" },
7729
+ * { name: "Bob", group: "B" },
7730
+ * { name: "Charlie", group: "A" }
7731
+ * ]
7732
+ *
7733
+ * Object.keys(Array.groupBy(people, (person) => person.group)).join(",") // => "A,B"
7734
+ * ```
7735
+ *
7736
+ * @see {@link group} — group adjacent equal elements
7737
+ * @see {@link groupWith} — group adjacent elements by custom equality
7738
+ *
7739
+ * @stability stable
7740
+ * @category grouping
7741
+ * @since 2.0.0
7742
+ */
7743
+ const groupBy = /*#__PURE__*/ dual(2, (self, f) => {
7744
+ const out = {};
7745
+ for (const a of self) {
7746
+ const k = f(a);
7747
+ if (Object.hasOwn(out, k)) out[k].push(a);
7748
+ else assignProperty(out, k, [a]);
7749
+ }
7750
+ return out;
7751
+ });
7702
7752
  const hashBucketsAdd = (buckets, value) => {
7703
7753
  const hash$6 = hash(value);
7704
7754
  const bucket = buckets.get(hash$6);
@@ -28314,6 +28364,26 @@ const mkUint8Array$1 = (self) => map$5(runFold(self, () => ({
28314
28364
  return result;
28315
28365
  });
28316
28366
  /**
28367
+ * Runs a channel until the first output element is available, returning it in
28368
+ * an `Option`.
28369
+ *
28370
+ * **Details**
28371
+ *
28372
+ * Returns `Option.some` with the first output element, or `Option.none` if the
28373
+ * channel completes without emitting output.
28374
+ *
28375
+ * @stability stable
28376
+ * @category running
28377
+ * @since 4.0.0
28378
+ */
28379
+ const runHead$1 = (self) => suspend$2(() => {
28380
+ let head = none();
28381
+ return runWith$1(self, (pull) => pull.pipe(asSome, flatMap$2((head_) => {
28382
+ head = head_;
28383
+ return done$1();
28384
+ })), () => succeed$5(head));
28385
+ });
28386
+ /**
28317
28387
  * Runs a channel to completion and returns the last output element in an
28318
28388
  * `Option`.
28319
28389
  *
@@ -30401,6 +30471,27 @@ const runFoldEffect = /*#__PURE__*/ dual(3, (self, initial, f) => runFoldEffect$
30401
30471
  }), () => s);
30402
30472
  }));
30403
30473
  /**
30474
+ * Runs the stream and returns the first element as an `Option`.
30475
+ *
30476
+ * **Example** (Getting the first stream value)
30477
+ *
30478
+ * ```ts import.meta.vitest
30479
+ * import { Effect, Option, Stream } from "effect"
30480
+ *
30481
+ * const program = Effect.gen(function*() {
30482
+ * const head = yield* Stream.runHead(Stream.make(1, 2, 3))
30483
+ * Option.getOrThrow(head) // => 1
30484
+ * })
30485
+ *
30486
+ * await Effect.runPromise(program)
30487
+ * ```
30488
+ *
30489
+ * @stability stable
30490
+ * @category destructors
30491
+ * @since 2.0.0
30492
+ */
30493
+ const runHead = (self) => map$5(runHead$1(self.channel), map$11(getUnsafe$1(0)));
30494
+ /**
30404
30495
  * Runs the stream and returns the last element as an `Option`.
30405
30496
  *
30406
30497
  * **When to use**
@@ -92620,7 +92711,7 @@ const SignedInApp = Struct({
92620
92711
  lastActive: Finite,
92621
92712
  parent: optionalKey(NonEmptyString)
92622
92713
  });
92623
- const FamilyParams = Struct({ family: NonEmptyString });
92714
+ Struct({ family: NonEmptyString });
92624
92715
  const RevokeParams = Struct({
92625
92716
  client_id: NonEmptyString,
92626
92717
  token: NonEmptyString
@@ -92662,7 +92753,7 @@ const AdmitParams = Struct({
92662
92753
  allow: Boolean$5,
92663
92754
  id: NonEmptyString
92664
92755
  });
92665
- const PersonParams = Struct({ id: NonEmptyString });
92756
+ Struct({ id: NonEmptyString });
92666
92757
  // src/services/github/service.ts
92667
92758
  const HEADERS = {
92668
92759
  accept: "application/vnd.github+json",
@@ -114384,6 +114475,17 @@ function signedInApps(grants, now, owner) {
114384
114475
  })
114385
114476
  })), sort(flip$1(mapInput(Number$6, (app) => app.lastActive))));
114386
114477
  }
114478
+ function withChildActivity(signIns) {
114479
+ const children = groupBy(filter$6(signIns, (signIn) => signIn.parent !== void 0), (signIn) => signIn.parent ?? "");
114480
+ return map$8(filter$6(signIns, (signIn) => signIn.parent === void 0), (signIn) => {
114481
+ const latest = reduce(getOrElse(get$13(children, signIn.family), () => []), signIn, max$2(mapInput(Number$6, (app) => app.lastActive)));
114482
+ return {
114483
+ ...omit(signIn, ["address"]),
114484
+ lastActive: latest.lastActive,
114485
+ ...pick(latest, ["address"])
114486
+ };
114487
+ });
114488
+ }
114387
114489
  function parsedAddress(address) {
114388
114490
  return pipe(getSuccess(ipFromString(address)), map$11((ip) => {
114389
114491
  if (isIpv6Address(ip)) return getOrElse(fromIpv4Mapped(ip), () => ip);
@@ -114751,10 +114853,6 @@ var RpcContracts = class extends make$31(make$35("auth.lookup", {
114751
114853
  error: AuthError,
114752
114854
  payload: AdmitParams,
114753
114855
  success: Person
114754
- }), make$35("auth.remove", {
114755
- error: AuthError,
114756
- payload: PersonParams,
114757
- success: Person
114758
114856
  }), make$35("auth.apps", {
114759
114857
  error: AuthError,
114760
114858
  stream: true,
@@ -114763,9 +114861,6 @@ var RpcContracts = class extends make$31(make$35("auth.lookup", {
114763
114861
  error: AuthError,
114764
114862
  stream: true,
114765
114863
  success: Catalog
114766
- }), make$35("auth.disconnect", {
114767
- error: AuthError,
114768
- payload: FamilyParams
114769
114864
  }), make$35("auth.passkeys", {
114770
114865
  error: AuthError,
114771
114866
  stream: true,
@@ -123207,18 +123302,12 @@ const RpcHandlers = RpcContracts.toLayer(gen(function* () {
123207
123302
  }),
123208
123303
  "auth.apps": () => unwrap$4(map$5(CurrentOwner, tokens.apps)),
123209
123304
  "auth.catalog": () => apps.catalog,
123210
- "auth.disconnect": fnUntraced(function* (input) {
123211
- return yield* tokens.disconnect(input.family, yield* CurrentOwner);
123212
- }),
123213
123305
  "auth.lookup": (input) => signIns.lookup(input.code),
123214
123306
  "auth.passkeyOptions": fnUntraced(function* (_, options) {
123215
123307
  return yield* passkeys.registration(yield* CurrentOwner, yield* tokens.sessionVia(options.headers));
123216
123308
  }),
123217
123309
  "auth.passkeys": () => unwrap$4(map$5(CurrentOwner, passkeys.list)),
123218
123310
  "auth.people": () => unwrap$4(map$5(CurrentUser, people.people)),
123219
- "auth.remove": fnUntraced(function* (input) {
123220
- return yield* people.remove(input.id, yield* CurrentUser);
123221
- }),
123222
123311
  "auth.removePasskey": fnUntraced(function* (input) {
123223
123312
  yield* passkeys.remove(input.id, yield* CurrentOwner);
123224
123313
  }),
@@ -123235,7 +123324,31 @@ const Tools = make$15(make$16("answer_request", {
123235
123324
  request: NonEmptyString.check(isMaxLength(20))
123236
123325
  }),
123237
123326
  success: Struct({ clientName: String$6 })
123238
- }).annotate(Destructive, false));
123327
+ }).annotate(Destructive, false), make$16("list_sessions", {
123328
+ dependencies: [CurrentOwner],
123329
+ description: "Each signed-in client of yours with its id, device, last activity and address; sign one out with sign_out_session.",
123330
+ failure: AuthError,
123331
+ parameters: EmptyParams,
123332
+ success: Struct({ sessions: ArraySchema(Struct({
123333
+ address: optionalKey(String$6),
123334
+ client: String$6,
123335
+ device: String$6,
123336
+ id: NonEmptyString,
123337
+ lastActive: Finite
123338
+ })) })
123339
+ }).annotate(Readonly, true), make$16("sign_out_session", {
123340
+ dependencies: [CurrentOwner],
123341
+ description: "Sign a client out of every app by the id list_sessions returns.",
123342
+ failure: AuthError,
123343
+ parameters: Struct({ id: NonEmptyString }),
123344
+ success: Struct({ id: NonEmptyString })
123345
+ }).annotate(Destructive, true), make$16("remove_person", {
123346
+ dependencies: [CurrentOwner],
123347
+ description: "Remove a member by their GitHub login; admins cannot be removed.",
123348
+ failure: AuthError,
123349
+ parameters: Struct({ login: NonEmptyString }),
123350
+ success: Person
123351
+ }).annotate(Destructive, true));
123239
123352
  // src/tools/handlers.ts
123240
123353
  const layerMcpOwner = unwrap$7(gen(function* () {
123241
123354
  const tokens = yield* Tokens;
@@ -123256,10 +123369,35 @@ const layerMcpOwner = unwrap$7(gen(function* () {
123256
123369
  })), (owner) => provideService(effect, CurrentOwner, owner))).layer;
123257
123370
  }));
123258
123371
  const ToolHandlers = Tools.toLayer(gen(function* () {
123372
+ const people = yield* People;
123259
123373
  const signIns = yield* SignIns;
123260
- return Tools.of({ answer_request: fnUntraced(function* (input) {
123261
- return yield* signIns.answer(input, yield* CurrentOwner, "Token");
123262
- }) });
123374
+ const tokens = yield* Tokens;
123375
+ return Tools.of({
123376
+ answer_request: fnUntraced(function* (input) {
123377
+ return yield* signIns.answer(input, yield* CurrentOwner, "Token");
123378
+ }),
123379
+ list_sessions: fnUntraced(function* () {
123380
+ return { sessions: map$8(withChildActivity(getOrElse(yield* runHead(tokens.apps(yield* CurrentOwner)), () => [])), (app) => ({
123381
+ ...pick(app, [
123382
+ "address",
123383
+ "client",
123384
+ "device",
123385
+ "lastActive"
123386
+ ]),
123387
+ id: app.family
123388
+ })) };
123389
+ }),
123390
+ remove_person: fnUntraced(function* (input) {
123391
+ const owner = yield* CurrentOwner;
123392
+ const wanted = toLowerCase(input.login);
123393
+ const person = yield* pipe(yield* people.list(owner.user), findFirst((row) => toLowerCase(row.name) === wanted), fromOption, mapError$2(() => AuthError.make({ message: `No GitHub account ${input.login} is listed in Auth` })));
123394
+ return yield* people.remove(person.id, owner.user);
123395
+ }),
123396
+ sign_out_session: fnUntraced(function* (input) {
123397
+ yield* tokens.disconnect(input.id, yield* CurrentOwner);
123398
+ return { id: input.id };
123399
+ })
123400
+ });
123263
123401
  }));
123264
123402
  // src/main.server.ts
123265
123403
  const layerServices = pipe(mergeAll$1(SignIns.layer, layer$2), provideMerge(People.layer), provideMerge(mergeAll$1(Tokens.layer, Passkeys.layer, GitHub.layer, Apps.layer, layerStoreMemory)), provide$2(layerDataStore), provide$2(succeed$6(RequestInit, { redirect: "error" })));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deslop/auth",
3
- "version": "0.1.1267",
3
+ "version": "0.1.1268",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/MP281X/deslop.git",
@@ -33,5 +33,5 @@
33
33
  "engines": {
34
34
  "node": ">=26"
35
35
  },
36
- "fingerprint": "c4214e2d9585d35652c74f006c33383554ff034f2855d3a0524d28d11e5a202c"
36
+ "fingerprint": "2b8408c5450fe9a2198134d5f6a5119fcd487eb9206a7309a8f473c3a70c7783"
37
37
  }
@@ -1,20 +0,0 @@
1
- import{n as e}from"./rolldown-runtime-WkwZ5CU-.js";import{a as t,n,o as r}from"./react-COyt-gOi.js";import{H as i,I as a,K as o,L as s,R as c,U as l,i as u,z as d}from"./components-CxZlmD_H.js";import{$a as f,Ba as p,L as m,La as h,Na as g,Qi as _,R as v,Ua as y,Va as b,_ as x,ba as S,ia as C,va as w,z as T}from"./effect-CarHrcH-.js";import{t as E}from"./Check.es-C9l513Ch.js";import{F as D,I as O,L as k,N as A,R as j,cr as M,d as N,ir as P,m as F,or as I,y as L}from"./utils-BepQ-yTS.js";import{t as R}from"./index-RSMneHpz.js";var z=e(r(),1),B=new Map([[`bold`,z.createElement(z.Fragment,null,z.createElement(`path`,{d:`M228,128a12,12,0,0,1-12,12H40a12,12,0,0,1,0-24H216A12,12,0,0,1,228,128Z`}))],[`duotone`,z.createElement(z.Fragment,null,z.createElement(`path`,{d:`M216,56V200a16,16,0,0,1-16,16H56a16,16,0,0,1-16-16V56A16,16,0,0,1,56,40H200A16,16,0,0,1,216,56Z`,opacity:`0.2`}),z.createElement(`path`,{d:`M224,128a8,8,0,0,1-8,8H40a8,8,0,0,1,0-16H216A8,8,0,0,1,224,128Z`}))],[`fill`,z.createElement(z.Fragment,null,z.createElement(`path`,{d:`M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM184,136H72a8,8,0,0,1,0-16H184a8,8,0,0,1,0,16Z`}))],[`light`,z.createElement(z.Fragment,null,z.createElement(`path`,{d:`M222,128a6,6,0,0,1-6,6H40a6,6,0,0,1,0-12H216A6,6,0,0,1,222,128Z`}))],[`regular`,z.createElement(z.Fragment,null,z.createElement(`path`,{d:`M224,128a8,8,0,0,1-8,8H40a8,8,0,0,1,0-16H216A8,8,0,0,1,224,128Z`}))],[`thin`,z.createElement(z.Fragment,null,z.createElement(`path`,{d:`M220,128a4,4,0,0,1-4,4H40a4,4,0,0,1,0-8H216A4,4,0,0,1,220,128Z`}))]]),V=z.forwardRef((e,t)=>z.createElement(M,{ref:t,...e,weights:B}));V.displayName=`MinusIcon`;var H=e=>{let t=U(z.useMemo(()=>ee(e.machine,e.path),[e.machine,e.path]));if(m(t))throw _(t.cause);return v(t)?e.pending??null:h(t.value)?e.children(t.value.value):e.inactive??null},ee=(e,t)=>O(e)?k(e,t):j(e,t),U=e=>te(z.useContext(o),e),te=(e,t)=>{let n=z.useMemo(()=>{let n,r,i=e=>T(e)?(n=e,e):v(e)&&n!==void 0?n:e;return{subscribe:n=>e.subscribe(t,n),snapshot:()=>i(e.get(t)),serverSnapshot:()=>r??=i(x(t,e))}},[e,t]);return z.useSyncExternalStore(n.subscribe,n.snapshot,n.serverSnapshot)},W=H,G=n(),ne=Object.defineProperty,re=Object.defineProperties,ie=Object.getOwnPropertyDescriptors,K=Object.getOwnPropertySymbols,q=Object.prototype.hasOwnProperty,J=Object.prototype.propertyIsEnumerable,Y=(e,t,n)=>t in e?ne(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ae=(e,t)=>{for(var n in t||={})q.call(t,n)&&Y(e,n,t[n]);if(K)for(var n of K(t))J.call(t,n)&&Y(e,n,t[n]);return e},oe=(e,t)=>re(e,ie(t)),se=(e,t)=>{var n={};for(var r in e)q.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&K)for(var r of K(e))t.indexOf(r)<0&&J.call(e,r)&&(n[r]=e[r]);return n};function ce(e){return[setTimeout(e,0),setTimeout(e,10),setTimeout(e,50)]}function le(e){let t=z.useRef();return z.useEffect(()=>{t.current=e}),t.current}var ue=18,X=40,de=`${X}px`;function fe(e){let t=e.getBoundingClientRect().right,n=e;for(;n;){if(getComputedStyle(n).overflowX!==`visible`)return n.getBoundingClientRect().left+n.clientLeft+n.clientWidth-t;n=n.parentElement}return document.documentElement.clientWidth-t}var pe=`[data-lastpass-icon-root],com-1password-button,[data-dashlanecreated],[style$="2147483647 !important;"]`;function me({containerRef:e,inputRef:t,pushPasswordManagerStrategy:n,isFocused:r}){let[i,a]=z.useState(!1),[o,s]=z.useState(!1),[c,l]=z.useState(!1),u=z.useMemo(()=>n!==`none`&&(n===`increase-width`||n===`experimental-no-flickering`)&&i&&o,[i,o,n]),d=z.useCallback(()=>{let r=e.current,i=t.current;if(!r||!i||c||n===`none`)return;let o=r,u=o.getBoundingClientRect().left+o.offsetWidth,d=o.getBoundingClientRect().top+o.offsetHeight/2,f=u-ue,p=d;document.querySelectorAll(pe).length===0&&document.elementFromPoint(f,p)===r||(s(fe(r)>=X),a(!0),l(!0))},[e,t,c,n]);return z.useEffect(()=>{let t=e.current;if(!t||n===`none`)return;function r(){s(fe(t)>=X)}r();let i=setInterval(r,1e3);return()=>{clearInterval(i)}},[e,n]),z.useEffect(()=>{let e=r||document.activeElement===t.current;if(n===`none`||!e)return;let i=setTimeout(d,0),a=setTimeout(d,2e3),o=setTimeout(d,5e3),s=setTimeout(()=>{l(!0)},6e3);return()=>{clearTimeout(i),clearTimeout(a),clearTimeout(o),clearTimeout(s)}},[t,r,n,d]),{hasPWMBadge:i,willPushPWMBadge:u,PWM_BADGE_SPACE_WIDTH:de}}var he=z.createContext({}),ge=z.forwardRef((e,t)=>{var n=e,{value:r,onChange:i,maxLength:a,textAlign:o=`left`,pattern:s,placeholder:c,inputMode:l=`numeric`,onComplete:u,pushPasswordManagerStrategy:d=`increase-width`,pasteTransformer:f,containerClassName:p,noScriptCSSFallback:m=_e,nonce:h,render:g,children:_}=n,v=se(n,[`value`,`onChange`,`maxLength`,`textAlign`,`pattern`,`placeholder`,`inputMode`,`onComplete`,`pushPasswordManagerStrategy`,`pasteTransformer`,`containerClassName`,`noScriptCSSFallback`,`nonce`,`render`,`children`]),y;let[b,x]=z.useState(typeof v.defaultValue==`string`?v.defaultValue:``),S=r??b,C=le(S),w=z.useCallback(e=>{i?.(e),x(e)},[i]),T=z.useMemo(()=>s?typeof s==`string`?new RegExp(s):s:null,[s]),E=z.useRef(null),D=z.useRef(null),O=z.useRef({value:S,onChange:w,isIOS:typeof window<`u`&&((y=window==null?void 0:window.CSS)?.supports)?.call(y,`-webkit-touch-callout`,`none`)}),k=z.useRef({prev:[E.current?.selectionStart,E.current?.selectionEnd,E.current?.selectionDirection]});z.useImperativeHandle(t,()=>E.current,[]),z.useEffect(()=>{let e=E.current,t=D.current;if(!e||!t)return;O.current.value!==e.value&&O.current.onChange(e.value),k.current.prev=[e.selectionStart,e.selectionEnd,e.selectionDirection];function n(){if(document.activeElement!==e){F(null),L(null);return}let t=e.selectionStart,n=e.selectionEnd,r=e.selectionDirection,i=e.maxLength,a=e.value,o=k.current.prev,s=-1,c=-1,l;if(a.length!==0&&t!==null&&n!==null){let r=t===n,u=t===a.length&&a.length<i;if(r&&!u){let e=t;if(e===0)s=0,c=1,l=`forward`;else if(e===i)s=e-1,c=e,l=`backward`;else if(i>1&&a.length>1){let t=0;if(o[0]!==null&&o[1]!==null){l=e<o[1]?`backward`:`forward`;let n=o[0]===o[1]&&o[0]<i;l===`backward`&&!n&&(t=-1)}s=t+e,c=t+e+1}}s!==-1&&c!==-1&&s!==c&&e.setSelectionRange(s,c,l)}let u=s===-1?t:s,d=c===-1?n:c,f=l??r;F(u),L(d),k.current.prev=[u,d,f]}if(document.addEventListener(`selectionchange`,n,{capture:!0}),n(),document.activeElement===e&&N(!0),!document.getElementById(`input-otp-style`)){let e=document.createElement(`style`);if(e.id=`input-otp-style`,h&&e.setAttribute(`nonce`,h),document.head.appendChild(e),e.sheet){let t=`background: transparent !important; color: transparent !important; border-color: transparent !important; opacity: 0 !important; box-shadow: none !important; -webkit-box-shadow: none !important; -webkit-text-fill-color: transparent !important;`;Z(e.sheet,`[data-input-otp]::selection { background: transparent !important; color: transparent !important; }`),Z(e.sheet,`[data-input-otp]:autofill { ${t} }`),Z(e.sheet,`[data-input-otp]:-webkit-autofill { ${t} }`),Z(e.sheet,`@supports (-webkit-touch-callout: none) { [data-input-otp] { letter-spacing: -.6em !important; font-weight: 100 !important; font-stretch: ultra-condensed; font-optical-sizing: none !important; left: -1px !important; right: 1px !important; } }`),Z(e.sheet,`[data-input-otp] + * { pointer-events: all !important; }`)}}let r=()=>{t&&t.style.setProperty(`--root-height`,`${e.clientHeight}px`)};r();let i=typeof ResizeObserver>`u`?null:new ResizeObserver(r);return i?.observe(e),()=>{document.removeEventListener(`selectionchange`,n,{capture:!0}),i?.disconnect()}},[]);let[A,j]=z.useState(!1),[M,N]=z.useState(!1),[P,F]=z.useState(null),[I,L]=z.useState(null);z.useEffect(()=>{let e=ce(()=>{var e;(e=E.current)==null||e.dispatchEvent(new Event(`input`));let t=E.current?.selectionStart,n=E.current?.selectionEnd,r=E.current?.selectionDirection;t!==null&&n!==null&&(F(t),L(n),k.current.prev=[t,n,r])});return()=>{e.forEach(e=>clearTimeout(e))}},[S,M]),z.useEffect(()=>{C!==void 0&&S!==C&&C.length<a&&S.length===a&&u?.(S)},[a,u,C,S]);let R=me({containerRef:D,inputRef:E,pushPasswordManagerStrategy:d,isFocused:M}),B=z.useCallback(e=>{let t=e.currentTarget.value.slice(0,a);t.length>0&&T&&!T.test(t)?e.preventDefault():(typeof C==`string`&&t.length<C.length&&document.dispatchEvent(new Event(`selectionchange`)),w(t))},[a,w,C,T]),V=z.useCallback(()=>{var e;if(E.current){let t=Math.min(E.current.value.length,a-1),n=E.current.value.length;(e=E.current)==null||e.setSelectionRange(t,n),F(t),L(n)}N(!0)},[a]),H=z.useCallback(e=>{let t=E.current;if(!f&&(!O.current.isIOS||!e.clipboardData||!t))return;let n=e.clipboardData.getData(`text/plain`),r=f?f(n):n;e.preventDefault();let i=E.current?.selectionStart,o=E.current?.selectionEnd,s=(i===o?S.slice(0,i)+r+S.slice(i):S.slice(0,i)+r+S.slice(o)).slice(0,a);if(s.length>0&&T&&!T.test(s))return;t.value=s,w(s);let c=Math.min(s.length,a-1),l=s.length;t.setSelectionRange(c,l),F(c),L(l)},[a,w,f,T,S]),ee=z.useMemo(()=>({position:`relative`,cursor:v.disabled?`default`:`text`,userSelect:`none`,WebkitUserSelect:`none`,pointerEvents:`none`}),[v.disabled]),U=z.useMemo(()=>({position:`absolute`,inset:0,width:R.willPushPWMBadge?`calc(100% + ${R.PWM_BADGE_SPACE_WIDTH})`:`100%`,clipPath:R.willPushPWMBadge?`inset(0 ${R.PWM_BADGE_SPACE_WIDTH} 0 0)`:void 0,height:`100%`,display:`flex`,textAlign:o,opacity:`1`,color:`transparent`,pointerEvents:`all`,background:`transparent`,caretColor:`transparent`,border:`0 solid transparent`,outline:`0 solid transparent`,boxShadow:`none`,lineHeight:`1`,letterSpacing:`-.5em`,fontSize:`var(--root-height, 16px)`,fontFamily:`monospace`,fontVariantNumeric:`tabular-nums`}),[R.PWM_BADGE_SPACE_WIDTH,R.willPushPWMBadge,o]),te=z.useMemo(()=>z.createElement(`input`,oe(ae({autoComplete:v.autoComplete||`one-time-code`},v),{"data-input-otp":!0,"data-input-otp-placeholder-shown":S.length===0||void 0,"data-input-otp-mss":P,"data-input-otp-mse":I,inputMode:l,pattern:T?.source,"aria-placeholder":c,style:U,maxLength:a,value:S,ref:E,spellCheck:v.spellCheck??!1,onPaste:e=>{var t;H(e),(t=v.onPaste)==null||t.call(v,e)},onChange:B,onMouseOver:e=>{var t;j(!0),(t=v.onMouseOver)==null||t.call(v,e)},onMouseLeave:e=>{var t;j(!1),(t=v.onMouseLeave)==null||t.call(v,e)},onFocus:e=>{var t;V(),(t=v.onFocus)==null||t.call(v,e)},onBlur:e=>{var t;N(!1),(t=v.onBlur)==null||t.call(v,e)}})),[B,V,H,l,U,a,I,P,c,v,T?.source,S]),W=z.useMemo(()=>({slots:Array.from({length:a}).map((e,t)=>{let n=M&&P!==null&&I!==null&&(P===I&&t===P||t>=P&&t<I),r=S[t]===void 0?null:S[t];return{char:r,placeholderChar:S[0]===void 0?c?.[t]??null:null,isActive:n,hasFakeCaret:n&&r===null}}),isFocused:M,isHovering:!v.disabled&&A}),[M,A,a,I,P,c,v.disabled,S]),G=z.useMemo(()=>g?g(W):z.createElement(he.Provider,{value:W},_),[_,W,g]);return z.createElement(z.Fragment,null,m!==null&&z.createElement(`noscript`,null,z.createElement(`style`,null,m)),z.createElement(`div`,{ref:D,"data-input-otp-container":!0,translate:`no`,style:ee,className:p},G,z.createElement(`div`,{style:{position:`absolute`,inset:0,pointerEvents:`none`}},te)))});ge.displayName=`Input`;function Z(e,t){try{e.insertRule(t)}catch{console.warn(`input-otp could not insert CSS rule:`,t)}}var _e=`
2
- [data-input-otp] {
3
- --nojs-bg: white !important;
4
- --nojs-fg: black !important;
5
-
6
- background-color: var(--nojs-bg) !important;
7
- color: var(--nojs-fg) !important;
8
- caret-color: var(--nojs-fg) !important;
9
- letter-spacing: .25em !important;
10
- text-align: center !important;
11
- border: 1px solid var(--nojs-fg) !important;
12
- border-radius: 4px !important;
13
- width: 100% !important;
14
- }
15
- @media (prefers-color-scheme: dark) {
16
- [data-input-otp] {
17
- --nojs-bg: black !important;
18
- --nojs-fg: white !important;
19
- }
20
- }`,Q=t();function ve(e){let t=(0,G.c)(12),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,containerClassName:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===r?a=t[5]:(a=P(`cn-input-otp flex items-center has-disabled:opacity-50`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=P(`disabled:cursor-not-allowed`,n),t[6]=n,t[7]=o);let s;return t[8]!==i||t[9]!==a||t[10]!==o?(s=(0,Q.jsx)(ge,{"data-slot":`input-otp`,containerClassName:a,spellCheck:!1,className:o,...i}),t[8]=i,t[9]=a,t[10]=o,t[11]=s):s=t[11],s}function ye(e){let t=(0,G.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=P(`flex items-center gap-1 rounded-none has-aria-invalid:border-b-destructive dark:has-aria-invalid:border-b-destructive/50`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Q.jsx)(`div`,{"data-slot":`input-otp-group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function be(e){let t=(0,G.c)(17),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({index:r,className:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=z.useContext(he),o;t[4]!==r||t[5]!==a?(o=a?.slots[r]??{},t[4]=r,t[5]=a,t[6]=o):o=t[6];let{char:s,hasFakeCaret:c,isActive:l}=o,u;t[7]===n?u=t[8]:(u=P(`relative flex size-10 items-center justify-center border border-transparent border-b-input bg-transparent text-sm transition-[color,border-color] outline-none first:rounded-none last:rounded-none aria-invalid:border-b-destructive data-[active=true]:z-10 data-[active=true]:border-b-ring dark:aria-invalid:border-b-destructive/50`,n),t[7]=n,t[8]=u);let d;t[9]===c?d=t[10]:(d=c&&(0,Q.jsx)(`div`,{className:`pointer-events-none absolute inset-0 flex items-center justify-center`,children:(0,Q.jsx)(`div`,{className:`h-4 w-px animate-caret-blink bg-foreground duration-1000`})}),t[9]=c,t[10]=d);let f;return t[11]!==s||t[12]!==l||t[13]!==i||t[14]!==u||t[15]!==d?(f=(0,Q.jsxs)(`div`,{"data-slot":`input-otp-slot`,"data-active":l,className:u,...i,children:[s,d]}),t[11]=s,t[12]=l,t[13]=i,t[14]=u,t[15]=d,t[16]=f):f=t[16],f}function xe(e){let t=(0,G.c)(5),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Q.jsx)(V,{}),t[2]=r):r=t[2];let i;return t[3]===n?i=t[4]:(i=(0,Q.jsx)(`div`,{"data-slot":`input-otp-separator`,className:`flex items-center [&_svg:not([class*='size-'])]:size-3.5`,role:`separator`,...n,children:r}),t[3]=n,t[4]=i),i}var Se=R(`/(home)/`);function Ce(e){let t=(0,G.c)(42),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n={select:Ee},t[0]=n):n=t[0];let r=Se.useSearch(n),i;t[1]===e.state?i=t[2]:(i=e.state===`Missing`||f(e.state),t[1]=e.state,t[2]=i);let o=i,l=e.typed,u;t[3]===e?u=t[4]:(u=t=>{e.onType(D(t))},t[3]=e,t[4]=u);let d=e.state===`Checking`,m=e.state===`Missing`&&`animate-refuse motion-reduce:animate-none`,h;t[5]===m?h=t[6]:(h=P(`gap-2`,m),t[5]=m,t[6]=h);let g;t[7]===o?g=t[8]:(g=w(S(0,3),e=>(0,Q.jsx)(be,{index:e,"aria-invalid":o,className:`h-11 flex-1`},e)),t[7]=o,t[8]=g);let _;t[9]===g?_=t[10]:(_=(0,Q.jsx)(ye,{className:`flex-1`,children:g}),t[9]=g,t[10]=_);let v;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Q.jsx)(xe,{}),t[11]=v):v=t[11];let y;t[12]===o?y=t[13]:(y=w(S(4,7),e=>(0,Q.jsx)(be,{index:e,"aria-invalid":o,className:`h-11 flex-1`},e)),t[12]=o,t[13]=y);let b;t[14]===y?b=t[15]:(b=(0,Q.jsx)(ye,{className:`flex-1`,children:y}),t[14]=y,t[15]=b);let x;t[16]!==o||t[17]!==r||t[18]!==e.typed||t[19]!==b||t[20]!==u||t[21]!==d||t[22]!==h||t[23]!==_?(x=(0,Q.jsxs)(ve,{id:`code`,"aria-label":`Code of a sign-in to approve`,maxLength:8,value:l,onChange:u,pasteTransformer:D,pattern:`^[A-Za-z]+$`,inputMode:`text`,autoFocus:r,autoComplete:`off`,autoCapitalize:`characters`,disabled:d,"aria-invalid":o,"aria-describedby":`code-error`,containerClassName:h,children:[_,v,b]}),t[16]=o,t[17]=r,t[18]=e.typed,t[19]=b,t[20]=u,t[21]=d,t[22]=h,t[23]=_,t[24]=x):x=t[24];let C;t[25]===e.state?C=t[26]:(C=e.state===`Checking`&&(0,Q.jsxs)(`p`,{role:`status`,className:`text-muted-foreground flex items-center gap-1.5 text-xs`,children:[(0,Q.jsx)(a,{}),`Checking…`]}),t[25]=e.state,t[26]=C);let T;t[27]===e.state?T=t[28]:(T=e.state===`Missing`&&(0,Q.jsx)(c,{id:`code-error`,children:`No waiting sign-in has this code.`}),t[27]=e.state,t[28]=T);let E;t[29]===e.state?E=t[30]:(E=f(e.state)&&(0,Q.jsx)(c,{id:`code-error`,children:e.state.failed}),t[29]=e.state,t[30]=E);let O;t[31]!==o||t[32]!==x||t[33]!==C||t[34]!==T||t[35]!==E?(O=(0,Q.jsxs)(s,{"data-invalid":o,children:[x,C,T,E]}),t[31]=o,t[32]=x,t[33]=C,t[34]=T,t[35]=E,t[36]=O):O=t[36];let k;t[37]===e.answered?k=t[38]:(k=p(e.answered,{onNone:Te,onSome:we}),t[37]=e.answered,t[38]=k);let A;return t[39]!==O||t[40]!==k?(A=(0,Q.jsxs)(`section`,{className:`flex w-full flex-col gap-4`,children:[O,k]}),t[39]=O,t[40]=k,t[41]=A):A=t[41],A}function we(e){return(0,Q.jsx)(`p`,{className:`text-muted-foreground animate-settle-in flex items-center gap-1.5 text-xs motion-reduce:animate-none`,role:`status`,children:C(e.accept,{onFalse:()=>(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(I,{className:`size-3.5`}),A(e.request.clientName,e.request.device),` denied`]}),onTrue:()=>(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(E,{className:`text-primary size-3.5`}),A(e.request.clientName,e.request.device),` approved`]})})})}function Te(){return null}function Ee(e){return e.code!==void 0}function $(e){let t=(0,G.c)(12),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Q.jsx)(`h1`,{className:`sr-only`,children:`Auth`}),t[0]=n):n=t[0];let r;t[1]!==e.answered||t[2]!==e.onType||t[3]!==e.state||t[4]!==e.typed?(r=(0,Q.jsx)(Ce,{answered:e.answered,onType:e.onType,state:e.state,typed:e.typed}),t[1]=e.answered,t[2]=e.onType,t[3]=e.state,t[4]=e.typed,t[5]=r):r=t[5];let i;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Q.jsx)(d,{label:`Signed in`,media:!0,rows:9}),t[6]=i):i=t[6];let a;t[7]===e.pending?a=t[8]:(a=(0,Q.jsx)(z.Suspense,{fallback:i,children:(0,Q.jsx)(u,{pending:e.pending})}),t[7]=e.pending,t[8]=a);let o;return t[9]!==r||t[10]!==a?(o=(0,Q.jsxs)(`div`,{className:`m-auto flex w-full max-w-xl flex-col gap-6 py-6`,children:[n,r,a]}),t[9]=r,t[10]=a,t[11]=o):o=t[11],o}function De(){let e=(0,G.c)(12),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={select:Oe},e[0]=t):t=e[0];let n=Se.useSearch(t),r;e[1]===n?r=e[2]:(r=L(n),e[1]=n,e[2]=r),i(r),i(F);let a=l(N.send),o;e[3]===a?o=e[4]:(o=function(e){a({_tag:`Typed`,typed:e})},e[3]=a,e[4]=o);let s=o,c;e[5]===s?c=e[6]:(c=(0,Q.jsx)(W,{machine:N,path:`Typing`,children:e=>(0,Q.jsx)($,{answered:g(e.value.answered),onType:s,pending:b(),state:`Typing`,typed:e.value.typed})}),e[5]=s,e[6]=c);let u;e[7]===s?u=e[8]:(u=(0,Q.jsx)(W,{machine:N,path:`Code`,children:e=>(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(W,{machine:N,path:`Code.Looking`,children:()=>(0,Q.jsx)($,{answered:b(),onType:s,pending:b(),state:`Checking`,typed:e.value.code})}),(0,Q.jsx)(W,{machine:N,path:`Code.Found`,children:t=>(0,Q.jsx)($,{answered:b(),onType:s,pending:y(t.value.request),state:`Found`,typed:e.value.code})}),(0,Q.jsx)(W,{machine:N,path:`Code.Failed`,children:t=>(0,Q.jsx)($,{answered:b(),onType:s,pending:b(),state:{failed:t.value.message},typed:e.value.code})}),(0,Q.jsx)(W,{machine:N,path:`Code.Missing`,children:()=>(0,Q.jsx)($,{answered:b(),onType:s,pending:b(),state:`Missing`,typed:e.value.code})})]})}),e[7]=s,e[8]=u);let d;return e[9]!==c||e[10]!==u?(d=(0,Q.jsxs)(Q.Fragment,{children:[c,u]}),e[9]=c,e[10]=u,e[11]=d):d=e[11],d}function Oe(e){return e.code??``}export{De as component};
@@ -1 +0,0 @@
1
- import{n as e}from"./rolldown-runtime-WkwZ5CU-.js";import{o as t}from"./react-COyt-gOi.js";import{cr as n}from"./utils-BepQ-yTS.js";var r=e(t(),1),i=new Map([[`bold`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M232.49,80.49l-128,128a12,12,0,0,1-17,0l-56-56a12,12,0,1,1,17-17L96,183,215.51,63.51a12,12,0,0,1,17,17Z`}))],[`duotone`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M232,56V200a16,16,0,0,1-16,16H40a16,16,0,0,1-16-16V56A16,16,0,0,1,40,40H216A16,16,0,0,1,232,56Z`,opacity:`0.2`}),r.createElement(`path`,{d:`M205.66,85.66l-96,96a8,8,0,0,1-11.32,0l-40-40a8,8,0,0,1,11.32-11.32L104,164.69l90.34-90.35a8,8,0,0,1,11.32,11.32Z`}))],[`fill`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40ZM205.66,85.66l-96,96a8,8,0,0,1-11.32,0l-40-40a8,8,0,0,1,11.32-11.32L104,164.69l90.34-90.35a8,8,0,0,1,11.32,11.32Z`}))],[`light`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M228.24,76.24l-128,128a6,6,0,0,1-8.48,0l-56-56a6,6,0,0,1,8.48-8.48L96,191.51,219.76,67.76a6,6,0,0,1,8.48,8.48Z`}))],[`regular`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M229.66,77.66l-128,128a8,8,0,0,1-11.32,0l-56-56a8,8,0,0,1,11.32-11.32L96,188.69,218.34,66.34a8,8,0,0,1,11.32,11.32Z`}))],[`thin`,r.createElement(r.Fragment,null,r.createElement(`path`,{d:`M226.83,74.83l-128,128a4,4,0,0,1-5.66,0l-56-56a4,4,0,0,1,5.66-5.66L96,194.34,221.17,69.17a4,4,0,1,1,5.66,5.66Z`}))]]),a=r.forwardRef((e,t)=>r.createElement(n,{ref:t,...e,weights:i}));a.displayName=`CheckIcon`;export{a as t};