@snagset/server 0.1.32 → 0.1.34

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 (77) hide show
  1. package/dist/db/migrations/0013_drop_derived_counts.sql +54 -0
  2. package/dist/projects.js +2 -6
  3. package/dist/projects.js.map +1 -1
  4. package/dist/routes/activity.js +8 -6
  5. package/dist/routes/activity.js.map +1 -1
  6. package/dist/routes/assignees.js +2 -2
  7. package/dist/routes/sites.js +1 -1
  8. package/dist/routes/threads.js +47 -26
  9. package/dist/routes/threads.js.map +1 -1
  10. package/dist/routes/widget.js +94 -21
  11. package/dist/routes/widget.js.map +1 -1
  12. package/package.json +1 -1
  13. package/static/dashboard/assets/{CompositeItem-H1Z2RNQW.js → CompositeItem-DOjAZOIw.js} +1 -1
  14. package/static/dashboard/assets/{ConfirmDialog-B_HO7qAV.js → ConfirmDialog-YHdRCMuk.js} +1 -1
  15. package/static/dashboard/assets/{CopyButton-BcFPdquT.js → CopyButton-BPFFhzYZ.js} +1 -1
  16. package/static/dashboard/assets/{FieldItemContext-D0Q4rB94.js → FieldItemContext-CvuTIqbu.js} +1 -1
  17. package/static/dashboard/assets/{InstallTag-wMa_lFPt.js → InstallTag-Dyle6Z7u.js} +1 -1
  18. package/static/dashboard/assets/{SaveState-DbiBWPbj.js → SaveState-zx4IRIWV.js} +1 -1
  19. package/static/dashboard/assets/{_app-CFqEeTw9.js → _app-BT2PvVrr.js} +1 -1
  20. package/static/dashboard/assets/{_app-CwVAgS6y.js → _app-CATs1X1F.js} +1 -1
  21. package/static/dashboard/assets/{activity-CRFVOJcj.js → activity-Ja8jqvTl.js} +1 -1
  22. package/static/dashboard/assets/{arrow-left-SbuaKLN8.js → arrow-left-D-J1WDaF.js} +1 -1
  23. package/static/dashboard/assets/{avatar-CyWjapbD.js → avatar-JYCiU767.js} +1 -1
  24. package/static/dashboard/assets/{badge-DZ45gt2t.js → badge-NV2UvVlq.js} +1 -1
  25. package/static/dashboard/assets/{card-rZNT8AAn.js → card-PWIpee1m.js} +1 -1
  26. package/static/dashboard/assets/{check-DFzW0E5F.js → check-fUN7a3GX.js} +1 -1
  27. package/static/dashboard/assets/{chevron-right-DNlmYM1H.js → chevron-right-D_gtsnlu.js} +1 -1
  28. package/static/dashboard/assets/{copy-CkgrfFiF.js → copy-ZBdagSqO.js} +1 -1
  29. package/static/dashboard/assets/{dialog-cAVg5CWG.js → dialog-B_kwIiUp.js} +1 -1
  30. package/static/dashboard/assets/{dropdown-menu-CROz9CD7.js → dropdown-menu-D5UGpMWY.js} +1 -1
  31. package/static/dashboard/assets/{image-off-dbox0Nj9.js → image-off-kQWiBpm4.js} +1 -1
  32. package/static/dashboard/assets/{index-NqrbvfSo.js → index-BCjjK9dr.js} +3 -3
  33. package/static/dashboard/assets/index-D6Jv0m8R.css +1 -0
  34. package/static/dashboard/assets/{invite-D3vU1POj.js → invite-Cn7ntzp8.js} +1 -1
  35. package/static/dashboard/assets/{label-CZtxPKnA.js → label-CU7jvj5k.js} +1 -1
  36. package/static/dashboard/assets/{layout-grid-CpSrFghR.js → layout-grid-DgutVVEL.js} +1 -1
  37. package/static/dashboard/assets/me-ttfbX4Cb.js +1 -0
  38. package/static/dashboard/assets/{parts-CMVHppEZ.js → parts-Oxy1krsw.js} +1 -1
  39. package/static/dashboard/assets/{plus-DvNJzVbr.js → plus-Cl722ZH_.js} +1 -1
  40. package/static/dashboard/assets/s._site-DI7lRsnw.js +1 -0
  41. package/static/dashboard/assets/s._site.comments-BLiaZNHo.js +54 -0
  42. package/static/dashboard/assets/{s._site.reviewers-sTkqblNS.js → s._site.reviewers-BuxVEObS.js} +1 -1
  43. package/static/dashboard/assets/{s._site.settings-BSKudlWC.js → s._site.settings-BLyC2Ix8.js} +1 -1
  44. package/static/dashboard/assets/{setup-ByemjiPq.js → setup-BUjOodJm.js} +1 -1
  45. package/static/dashboard/assets/{sign-in-C79cXPom.js → sign-in-CppGynIo.js} +1 -1
  46. package/static/dashboard/assets/{sign-up-Dg-EW0Ud.js → sign-up-BGy3UTxi.js} +1 -1
  47. package/static/dashboard/assets/{sites-DhF1WGvp.js → sites-CzRwDpMY.js} +1 -1
  48. package/static/dashboard/assets/studio-BJa7hKy2.js +1 -0
  49. package/static/dashboard/assets/{studio-oojSa61E.js → studio-DepK2GJ4.js} +1 -1
  50. package/static/dashboard/assets/{studio.index-CfkqMX5I.js → studio.index-C4hVZYkE.js} +1 -1
  51. package/static/dashboard/assets/{studio.integrations-C8ze7wcK.js → studio.integrations-2-WJQjiK.js} +1 -1
  52. package/static/dashboard/assets/{studio.members-BIR4VTee.js → studio.members-CMxEJYg1.js} +1 -1
  53. package/static/dashboard/assets/{sun-CCV5_Xwg.js → sun-DDSRise2.js} +1 -1
  54. package/static/dashboard/assets/{switch-pKWkWBSh.js → switch-L2_Pf-6w.js} +1 -1
  55. package/static/dashboard/assets/{table-BSlgpUtG.js → table-fR4tWQ4-.js} +1 -1
  56. package/static/dashboard/assets/{useAriaLabelledBy-BSt0Y1vn.js → useAriaLabelledBy-Bk7BENOF.js} +1 -1
  57. package/static/dashboard/assets/{useBaseQuery-BQZrcHmw.js → useBaseQuery-CoqlgX-x.js} +1 -1
  58. package/static/dashboard/assets/useQuery-6QR_MT4t.js +1 -0
  59. package/static/dashboard/assets/useRender-BybHPfHo.js +1 -0
  60. package/static/dashboard/assets/{useValueChanged-DKD8Vs7J.js → useValueChanged-BhvEiD3-.js} +1 -1
  61. package/static/dashboard/assets/{users-BH5_IfoG.js → users-STxJg0L8.js} +1 -1
  62. package/static/dashboard/assets/{welcome-BJqfqWXr.js → welcome-D7-mGhDy.js} +1 -1
  63. package/static/dashboard/assets/{widget-signin-D6LOaizs.js → widget-signin-jj3P3IbD.js} +1 -1
  64. package/static/dashboard/assets/{you-Bf2lJYxa.js → you-BMCOM6zE.js} +1 -1
  65. package/static/dashboard/assets/{zod-B-woswyx.js → zod-DbWDuTiO.js} +1 -1
  66. package/static/dashboard/index.html +2 -2
  67. package/static/widget/build.json +4 -0
  68. package/static/widget/snag.dock.js +4 -4
  69. package/static/widget/snag.js +1 -1
  70. package/static/widget/snag.runtime.js +2 -2
  71. package/static/dashboard/assets/index-BzWDSuyB.css +0 -1
  72. package/static/dashboard/assets/me-DuZzYTr0.js +0 -1
  73. package/static/dashboard/assets/s._site-1B1JBClP.js +0 -1
  74. package/static/dashboard/assets/s._site.comments-Pt7LgqE2.js +0 -54
  75. package/static/dashboard/assets/studio-D2RgHnii.js +0 -1
  76. package/static/dashboard/assets/useQuery-Ce8K2e88.js +0 -1
  77. package/static/dashboard/assets/useRender-CLH8yHqZ.js +0 -1
@@ -6,24 +6,93 @@ import { fileURLToPath } from "node:url";
6
6
  /** `1` from `1.4.2`; `0` while the package is pre-1.0. */
7
7
  const majorOf = (version) => version.split(".")[0] ?? "0";
8
8
  /**
9
- * Immutable for a version path, five minutes for the major alias.
9
+ * Three cache policies, and which one a response gets is decided by WHAT IS
10
+ * ASKED FOR, never by the path alone. And own the table; the
11
+ * reasoning is here because it is subtle and it was wrong.
10
12
  *
11
- * The design sets both, and the asymmetry is the whole point of having two paths:
12
- * a client who pins gets bytes that can be cached forever and hashed for SRI,
13
- * and a client who never touches the tag again gets a fix within five minutes.
13
+ * ── HOW IT WAS WRONG ──
14
14
  *
15
- * `s-maxage` says the same to a SHARED cache, which reads only that: on Vercel
16
- * every path is the function, and a widget chunk fetched by a reviewer in
17
- * Seoul crossed to the function's region on every page load past the five
18
- * minutes. With it the nearest edge answers, for the same five minutes — and
19
- * a deploy starts that cache afresh.
15
+ * The alias and `/snag.js` were `max-age=300`, and every chunk URL carried
16
+ * `?cv=0.0.0` — a cache-buster that was a constant. So after a release a
17
+ * reviewer ran the previous widget until five minutes had passed since THEIR
18
+ * last load, or until they hard-refreshed: the browser's copy of
19
+ * `snag.runtime.js?cv=0.0.0` was still fresh, and nothing about the URL had
20
+ * changed. The fix is in two halves, and this file is the second.
21
+ *
22
+ * ── THE THREE ──
23
+ *
24
+ * `ENTRY` — the stub on every unversioned path (`/snag.js`, `/widget/snag.js`,
25
+ * `/widget/v1/snag.js`) and the manifest. These URLs cannot change, because
26
+ * they are what a client pasted. A minute in the browser is how fast a release
27
+ * reaches a reviewer; five at the edge, which a Vercel deploy empties anyway
28
+ * (the deployment is part of its cache key), bounds what any other shared
29
+ * cache can hold. Vercel strips `s-maxage` before the browser sees it. No
30
+ * `stale-while-revalidate`: browsers honour it too, and on a self-hosted
31
+ * instance with no CDN it would hand the reviewer the old stub one more time,
32
+ * which is the bug. No ETag either: this stub runs on every page view of the
33
+ * client's site, and a 304 round trip per view is not cheaper than a 4.5 KB
34
+ * body a minute — and Vercel's edge has already been seen answering
35
+ * conditional requests with 304s that drop the CORS headers.
36
+ *
37
+ * `IMMUTABLE` — a chunk whose `?cv=` is THIS build's id (dist/build.json,
38
+ * written by widget-core's scripts/build-id.mjs), and the stub on the version
39
+ * path that matches this server. The id changes whenever any byte does, so a
40
+ * URL that names it names these bytes forever; a year is safe and a reload
41
+ * costs nothing. The edge's cache key includes the query string for function
42
+ * responses — on Vercel every path here IS the function (vercel.json rewrites
43
+ * them all) — so each id is its own entry.
44
+ *
45
+ * `NO_STORE` — everything else: a chunk asked for under another build's id, or
46
+ * no id, and anything under a version path that is not this server's. The bytes
47
+ * still go out, because a page that loaded a stub a moment before the deploy
48
+ * should still get a widget rather than a 404. But they are THIS build's bytes,
49
+ * not the ones that URL named, so they must not be kept under that URL: cached
50
+ * immutable they would pin new bytes to an old name for a year, and cached
51
+ * briefly they would still let a rollback be answered from the wrong build.
52
+ * Only stale pages ask for these, so the cost is a handful of uncached requests
53
+ * in the minute after a release.
20
54
  */
21
55
  const IMMUTABLE = "public, max-age=31536000, s-maxage=31536000, immutable";
22
- const ALIAS = "public, max-age=300, s-maxage=300";
56
+ const ENTRY = "public, max-age=60, s-maxage=300";
57
+ const NO_STORE = "no-store";
58
+ /** Exported for the route test, which asserts the table rather than re-deriving it. */
59
+ export const WIDGET_CACHE = { IMMUTABLE, ENTRY, NO_STORE };
60
+ const STUB = "snag.js";
61
+ /**
62
+ * This build's id from `build.json`, or null — a directory without one (a
63
+ * dev watcher's output, an older package) has no id that can be current, so
64
+ * every chunk is served `no-store`. Slower, never stale.
65
+ */
66
+ function readBuildId(root) {
67
+ try {
68
+ const cv = JSON.parse(readFileSync(join(root, "build.json"), "utf8")).cv;
69
+ return typeof cv === "string" && cv ? cv : null;
70
+ }
71
+ catch {
72
+ return null;
73
+ }
74
+ }
23
75
  export function widgetRoutes(deps) {
24
76
  const app = new Hono();
25
77
  const root = deps.dir ?? join(dirname(fileURLToPath(import.meta.url)), "..", "..", "static", "widget");
26
78
  const major = majorOf(deps.version);
79
+ const build = readBuildId(root);
80
+ /**
81
+ * The policy for one request — see the block above. `pinned` is the
82
+ * version segment when the path has one: a version that is not this
83
+ * server's is answered, never cached.
84
+ */
85
+ const policy = (c, name, pinned) => {
86
+ if (pinned !== undefined && pinned !== deps.version)
87
+ return NO_STORE;
88
+ if (name === STUB)
89
+ return pinned !== undefined ? IMMUTABLE : ENTRY;
90
+ // The id is `<release>+<hash>`, and the loader sends the `+` as `%2B`. A
91
+ // proxy that decodes it hands us a literal `+`, which form-decoding reads
92
+ // as a space — the same id, so it is read back as one.
93
+ const cv = c.req.query("cv")?.replace(/ /g, "+");
94
+ return build !== null && cv === build ? IMMUTABLE : NO_STORE;
95
+ };
27
96
  /** One artefact, or null when the name escapes the directory or is absent. */
28
97
  const read = (name) => {
29
98
  // `..` cannot escape: the join is resolved and checked against the root.
@@ -34,8 +103,10 @@ export function widgetRoutes(deps) {
34
103
  return null;
35
104
  return readFileSync(full);
36
105
  };
37
- const serve = (c, name, cache) => {
38
- const body = read(name);
106
+ const serve = (c, name, pinned) => {
107
+ // Scripts and their maps only: `build.json` sits in the same directory and
108
+ // is the server's to read, not a widget artefact to hand out as JavaScript.
109
+ const body = /\.(?:js|map)$/.test(name) ? read(name) : null;
39
110
  if (!body) {
40
111
  // 404 and a sentence, never the SPA shell. An operator who mistypes a
41
112
  // path should learn that here rather than from a browser console saying
@@ -47,7 +118,7 @@ export function widgetRoutes(deps) {
47
118
  }, 404);
48
119
  }
49
120
  c.header("Content-Type", name.endsWith(".map") ? "application/json" : "text/javascript; charset=utf-8");
50
- c.header("Cache-Control", cache);
121
+ c.header("Cache-Control", policy(c, name, pinned));
51
122
  // The widget is loaded BY OTHER ORIGINS — that is the entire product — so
52
123
  // these bytes are explicitly cross-origin readable. Without it a client's
53
124
  // site cannot fetch the module at all.
@@ -86,9 +157,9 @@ export function widgetRoutes(deps) {
86
157
  integrity: `sha384-${createHash("sha384").update(body).digest("base64")}`,
87
158
  };
88
159
  });
89
- c.header("Cache-Control", ALIAS);
160
+ c.header("Cache-Control", ENTRY);
90
161
  c.header("Access-Control-Allow-Origin", "*");
91
- return c.json({ version: deps.version, major: `v${major}`, assets });
162
+ return c.json({ version: deps.version, major: `v${major}`, build, assets });
92
163
  });
93
164
  // `/widget/v1/snag.js` — the major-pinned alias, and the path the dashboard
94
165
  // prints. Registered before the version route so `v1` is not read as one.
@@ -97,12 +168,14 @@ export function widgetRoutes(deps) {
97
168
  // own pattern also allowed one — which matched nothing and fell through to
98
169
  // the dashboard's catch-all, i.e. straight back into the bug this router
99
170
  // exists to fix. Caught because the check asserted the content type.
100
- app.get("/widget/:major{v[0-9]+}/:name", (c) => serve(c, c.req.param("name"), ALIAS));
171
+ app.get("/widget/:major{v[0-9]+}/:name", (c) => serve(c, c.req.param("name")));
101
172
  // `/widget/1.4.2/snag.js` — immutable, and what an SRI hash is taken against.
102
- app.get("/widget/:version{[0-9]+\\.[0-9]+\\.[0-9]+}/:name", (c) => serve(c, c.req.param("name"), IMMUTABLE));
173
+ // Only when 1.4.2 is what this server IS: it used to answer any version
174
+ // with the current bytes and cache them for a year under the old name.
175
+ app.get("/widget/:version{[0-9]+\\.[0-9]+\\.[0-9]+}/:name", (c) => serve(c, c.req.param("name"), c.req.param("version")));
103
176
  // `/widget/snag.js` — unversioned, the shortest thing to paste. Same cache
104
177
  // policy as the alias: it can change under a client who never revisits.
105
- app.get("/widget/:name", (c) => serve(c, c.req.param("name"), ALIAS));
178
+ app.get("/widget/:name", (c) => serve(c, c.req.param("name")));
106
179
  /**
107
180
  * `/snag.js` AND ITS SIBLINGS — the convenience path. **Serves bytes,
108
181
  * never a 302**: a redirect costs a round trip on the critical path of every
@@ -129,10 +202,10 @@ export function widgetRoutes(deps) {
129
202
  * cannot become a second catch-all: `serve()` still confines every name to
130
203
  * the widget directory, and anything not on disk 404s with a sentence.
131
204
  */
132
- app.get("/:name{snag\\.js}", (c) => serve(c, c.req.param("name"), ALIAS));
133
- app.get("/:name{snag\\.[a-z0-9-]+\\.js}", (c) => serve(c, c.req.param("name"), ALIAS));
205
+ app.get("/:name{snag\\.js}", (c) => serve(c, c.req.param("name")));
206
+ app.get("/:name{snag\\.[a-z0-9-]+\\.js}", (c) => serve(c, c.req.param("name")));
134
207
  // The source maps the chunks reference, on the same terms.
135
- app.get("/:name{snag\\.[a-z0-9.-]+\\.map}", (c) => serve(c, c.req.param("name"), ALIAS));
208
+ app.get("/:name{snag\\.[a-z0-9.-]+\\.map}", (c) => serve(c, c.req.param("name")));
136
209
  return app;
137
210
  }
138
211
  //# sourceMappingURL=widget.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"widget.js","sourceRoot":"","sources":["../../src/routes/widget.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAgB,MAAM,MAAM,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC1E,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAiCzC,0DAA0D;AAC1D,MAAM,OAAO,GAAG,CAAC,OAAe,EAAU,EAAE,CAAC,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AG,CAAC,gCAAgC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IAChF,2DAA2D;IAC3D,GAAG,CAAC,GAAG,CAAC,kCAAkC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IAElF,OAAO,GAAG,CAAC;AACb,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@snagset/server",
3
- "version": "0.1.32",
3
+ "version": "0.1.34",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "The Snagset server: API, dashboard and widget in one package. Node and Postgres, or Vercel.",
@@ -1 +1 @@
1
- import{r as l,d as O,e as M,a4 as w,j as T,aH as H,a7 as _,E as j,aG as S,i as k}from"./index-NqrbvfSo.js";const Y=l.createContext(void 0);function K(){return l.useContext(Y)?.direction??"ltr"}const y=l.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},nextIndexRef:{current:0}});function B(){return l.useContext(y)}function F(s={}){const{guess:o,label:e,metadata:r,textRef:f,index:t}=s,{register:i,unregister:u,subscribeMapChange:d,nextIndexRef:h}=B(),c=l.useRef(-1),[g,C]=l.useState(t==null&&o?()=>{if(c.current===-1){const x=h.current;h.current+=1,c.current=x}return c.current}:-1),v=t??g,R=l.useRef(null),E=l.useCallback(x=>{const b=R.current;b&&u(b),R.current=x,x&&i(x,{metadata:r??null,index:t??null,label:e,textRef:f})},[t,i,u,r,e,f]);return O(()=>{if(t==null)return d(x=>{const b=R.current?x.get(R.current)?.index:null;b!=null&&C(b)})},[t,d]),{ref:E,index:v}}function Q(s){const{children:o,elementsRef:e,labelsRef:r,onMapChange:f}=s,t=M(f),[,i]=l.useState(!1),u=w(U).current,d=w(G).current,h=l.useRef(0),c=l.useRef(!0),g=l.useRef([]),C=l.useRef(null),v=M(()=>{c.current||(c.current=!0,i(n=>!n))}),R=M((n,p)=>{d.set(n,p),v()}),E=M(n=>{d.delete(n),v()}),x=M(n=>{const p=new Map;return e.current.length=0,r&&(r.current.length=0),n.forEach(a=>{p.set(a.element,{...a.registration.metadata??{},index:a.index}),e.current[a.index]=a.element,r&&(r.current[a.index]=a.registration.label!==void 0?a.registration.label:a.registration.textRef?.current?.textContent??a.element.textContent)}),h.current=e.current.length,p});function b(n){if(C.current?.disconnect(),C.current=null,typeof MutationObserver!="function"||n.length<2)return;const p=new MutationObserver(m=>{if(!J(m))return;let I=null;for(const L of n)if(L.isConnected){if(I&&D(I,L)>0){p.disconnect(),v();return}I=L}});C.current=p;const a=new Set;for(let m=1;m<n.length;m+=1){const I=z(n[m-1],n[m]);I&&a.add(I)}a.forEach(m=>p.observe(m,{childList:!0}))}const N=M(()=>{const[n,p]=W(d),a=x(n);b(p),g.current=n,c.current=!1,u.forEach(m=>m(a)),t(a)});O(()=>(c.current||x(g.current),()=>{e.current=[],r&&(r.current=[])}),[e,r,x]),O(()=>{c.current&&N()}),O(()=>()=>{C.current?.disconnect(),c.current=!0},[]);const P=M(n=>(u.add(n),()=>{u.delete(n)})),A=l.useMemo(()=>({register:R,unregister:E,subscribeMapChange:P,nextIndexRef:h}),[R,E,P,h]);return T.jsx(y.Provider,{value:A,children:o})}function G(){return new Map}function U(){return new Set}function W(s){const o=new Set,e=[],r=[];s.forEach((t,i)=>{if(!i.isConnected)return;const u=t.index,d={index:u??-1,element:i,registration:t};u===null?r.push(d):u>=0&&(o.add(u),e.push(d))});let f=0;return r.sort((t,i)=>D(t.element,i.element)),r.forEach(t=>{for(;o.has(f);)f+=1;t.index=f,e.push(t),f+=1}),o.size>0&&e.sort((t,i)=>t.index-i.index),[e,r.map(t=>t.element)]}function z(s,o){let e=s.parentElement;for(;e&&!e.contains(o);)e=e.parentElement;return e}function J(s){for(const o of s)for(let e=0;e<o.removedNodes.length;e+=1)if(o.removedNodes[e].isConnected)return!0;return!1}function D(s,o){return s.compareDocumentPosition(o)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}function V(s={}){const{highlightItemOnHover:o,highlightedIndex:e,onHighlightedIndexChange:r}=H(),{ref:f,index:t}=F(s),i=e===t,u=l.useRef(null),d=_(f,u);return{compositeProps:{tabIndex:i?0:-1,onFocus(){r(t)},onMouseMove(){const c=u.current;if(!o||!c)return;const g=c.hasAttribute("disabled")||c.ariaDisabled==="true";!i&&!g&&c.focus()}},compositeRef:d,index:t}}function X(s){const{render:o,className:e,style:r,state:f=j,props:t=S,refs:i=S,metadata:u,stateAttributesMapping:d,tag:h="div",...c}=s,{compositeProps:g,compositeRef:C}=V({metadata:u});return k(h,s,{state:f,ref:[C,...i],props:[g,...t,c],stateAttributesMapping:d})}export{Q as C,F as a,X as b,K as u};
1
+ import{r as l,d as O,e as M,a4 as w,j as T,aH as H,a7 as _,E as j,aG as S,i as k}from"./index-BCjjK9dr.js";const Y=l.createContext(void 0);function K(){return l.useContext(Y)?.direction??"ltr"}const y=l.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},nextIndexRef:{current:0}});function B(){return l.useContext(y)}function F(s={}){const{guess:o,label:e,metadata:r,textRef:f,index:t}=s,{register:i,unregister:u,subscribeMapChange:d,nextIndexRef:h}=B(),c=l.useRef(-1),[g,C]=l.useState(t==null&&o?()=>{if(c.current===-1){const x=h.current;h.current+=1,c.current=x}return c.current}:-1),v=t??g,R=l.useRef(null),E=l.useCallback(x=>{const b=R.current;b&&u(b),R.current=x,x&&i(x,{metadata:r??null,index:t??null,label:e,textRef:f})},[t,i,u,r,e,f]);return O(()=>{if(t==null)return d(x=>{const b=R.current?x.get(R.current)?.index:null;b!=null&&C(b)})},[t,d]),{ref:E,index:v}}function Q(s){const{children:o,elementsRef:e,labelsRef:r,onMapChange:f}=s,t=M(f),[,i]=l.useState(!1),u=w(U).current,d=w(G).current,h=l.useRef(0),c=l.useRef(!0),g=l.useRef([]),C=l.useRef(null),v=M(()=>{c.current||(c.current=!0,i(n=>!n))}),R=M((n,p)=>{d.set(n,p),v()}),E=M(n=>{d.delete(n),v()}),x=M(n=>{const p=new Map;return e.current.length=0,r&&(r.current.length=0),n.forEach(a=>{p.set(a.element,{...a.registration.metadata??{},index:a.index}),e.current[a.index]=a.element,r&&(r.current[a.index]=a.registration.label!==void 0?a.registration.label:a.registration.textRef?.current?.textContent??a.element.textContent)}),h.current=e.current.length,p});function b(n){if(C.current?.disconnect(),C.current=null,typeof MutationObserver!="function"||n.length<2)return;const p=new MutationObserver(m=>{if(!J(m))return;let I=null;for(const L of n)if(L.isConnected){if(I&&D(I,L)>0){p.disconnect(),v();return}I=L}});C.current=p;const a=new Set;for(let m=1;m<n.length;m+=1){const I=z(n[m-1],n[m]);I&&a.add(I)}a.forEach(m=>p.observe(m,{childList:!0}))}const N=M(()=>{const[n,p]=W(d),a=x(n);b(p),g.current=n,c.current=!1,u.forEach(m=>m(a)),t(a)});O(()=>(c.current||x(g.current),()=>{e.current=[],r&&(r.current=[])}),[e,r,x]),O(()=>{c.current&&N()}),O(()=>()=>{C.current?.disconnect(),c.current=!0},[]);const P=M(n=>(u.add(n),()=>{u.delete(n)})),A=l.useMemo(()=>({register:R,unregister:E,subscribeMapChange:P,nextIndexRef:h}),[R,E,P,h]);return T.jsx(y.Provider,{value:A,children:o})}function G(){return new Map}function U(){return new Set}function W(s){const o=new Set,e=[],r=[];s.forEach((t,i)=>{if(!i.isConnected)return;const u=t.index,d={index:u??-1,element:i,registration:t};u===null?r.push(d):u>=0&&(o.add(u),e.push(d))});let f=0;return r.sort((t,i)=>D(t.element,i.element)),r.forEach(t=>{for(;o.has(f);)f+=1;t.index=f,e.push(t),f+=1}),o.size>0&&e.sort((t,i)=>t.index-i.index),[e,r.map(t=>t.element)]}function z(s,o){let e=s.parentElement;for(;e&&!e.contains(o);)e=e.parentElement;return e}function J(s){for(const o of s)for(let e=0;e<o.removedNodes.length;e+=1)if(o.removedNodes[e].isConnected)return!0;return!1}function D(s,o){return s.compareDocumentPosition(o)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}function V(s={}){const{highlightItemOnHover:o,highlightedIndex:e,onHighlightedIndexChange:r}=H(),{ref:f,index:t}=F(s),i=e===t,u=l.useRef(null),d=_(f,u);return{compositeProps:{tabIndex:i?0:-1,onFocus(){r(t)},onMouseMove(){const c=u.current;if(!o||!c)return;const g=c.hasAttribute("disabled")||c.ariaDisabled==="true";!i&&!g&&c.focus()}},compositeRef:d,index:t}}function X(s){const{render:o,className:e,style:r,state:f=j,props:t=S,refs:i=S,metadata:u,stateAttributesMapping:d,tag:h="div",...c}=s,{compositeProps:g,compositeRef:C}=V({metadata:u});return k(h,s,{state:f,ref:[C,...i],props:[g,...t,c],stateAttributesMapping:d})}export{Q as C,F as a,X as b,K as u};
@@ -1 +1 @@
1
- import{r as i,j as e,B as x}from"./index-NqrbvfSo.js";import{E as u,G as g,I as C,H as D,J as v,K as b}from"./dialog-cAVg5CWG.js";import{L as E,I}from"./label-CZtxPKnA.js";function T({open:t,onOpenChange:o,title:m,description:r,children:h,confirmLabel:j,confirmWord:l,busy:s=!1,onConfirm:p}){const[n,c]=i.useState(""),d=i.useId();i.useEffect(()=>{t&&c("")},[t]);const f=!l||n.trim()===l;return e.jsx(u,{open:t,onOpenChange:a=>{!a&&s||o(a)},children:e.jsx(g,{showCloseButton:!1,children:e.jsxs("form",{className:"flex flex-col gap-4",onSubmit:a=>{a.preventDefault(),f&&!s&&p()},children:[e.jsxs(C,{children:[e.jsx(D,{children:m}),r&&e.jsx(v,{children:r})]}),h,l&&e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs(E,{htmlFor:d,children:["Type ",e.jsx("b",{className:"font-semibold text-foreground",children:l})," to confirm"]}),e.jsx(I,{id:d,value:n,autoComplete:"off",spellCheck:!1,disabled:s,onChange:a=>c(a.target.value)})]}),e.jsxs(b,{children:[e.jsx(x,{type:"button",variant:"outline",disabled:s,onClick:()=>o(!1),children:"Cancel"}),e.jsx(x,{type:"submit",variant:"destructive",loading:s,disabled:!f,children:s?"Working…":j})]})]})})})}export{T as C};
1
+ import{r as i,j as e,B as x}from"./index-BCjjK9dr.js";import{E as u,G as g,I as C,H as D,J as v,K as b}from"./dialog-B_kwIiUp.js";import{L as E,I}from"./label-CU7jvj5k.js";function T({open:t,onOpenChange:o,title:m,description:r,children:h,confirmLabel:j,confirmWord:l,busy:s=!1,onConfirm:p}){const[n,c]=i.useState(""),d=i.useId();i.useEffect(()=>{t&&c("")},[t]);const f=!l||n.trim()===l;return e.jsx(u,{open:t,onOpenChange:a=>{!a&&s||o(a)},children:e.jsx(g,{showCloseButton:!1,children:e.jsxs("form",{className:"flex flex-col gap-4",onSubmit:a=>{a.preventDefault(),f&&!s&&p()},children:[e.jsxs(C,{children:[e.jsx(D,{children:m}),r&&e.jsx(v,{children:r})]}),h,l&&e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs(E,{htmlFor:d,children:["Type ",e.jsx("b",{className:"font-semibold text-foreground",children:l})," to confirm"]}),e.jsx(I,{id:d,value:n,autoComplete:"off",spellCheck:!1,disabled:s,onChange:a=>c(a.target.value)})]}),e.jsxs(b,{children:[e.jsx(x,{type:"button",variant:"outline",disabled:s,onClick:()=>o(!1),children:"Cancel"}),e.jsx(x,{type:"submit",variant:"destructive",loading:s,disabled:!f,children:s?"Working…":j})]})]})})})}export{T as C};
@@ -1 +1 @@
1
- import{r as n,j as t,B as c}from"./index-NqrbvfSo.js";import{C}from"./check-DFzW0E5F.js";import{C as m}from"./copy-CkgrfFiF.js";function l({text:r,label:e="Copy",withText:s=!1,size:a="icon-sm",className:p}){const[o,i]=n.useState(!1);return t.jsxs(c,{type:"button",variant:"outline",size:s?"sm":a,className:p,"aria-label":o?"Copied":e,onClick:()=>{navigator.clipboard?.writeText(r).catch(()=>{}),i(!0),setTimeout(()=>i(!1),1500)},children:[o?t.jsx(C,{}):t.jsx(m,{}),s&&(o?"Copied":e)]})}export{l as C};
1
+ import{r as n,j as t,B as c}from"./index-BCjjK9dr.js";import{C}from"./check-fUN7a3GX.js";import{C as m}from"./copy-ZBdagSqO.js";function l({text:r,label:e="Copy",withText:s=!1,size:a="icon-sm",className:p}){const[o,i]=n.useState(!1);return t.jsxs(c,{type:"button",variant:"outline",size:s?"sm":a,className:p,"aria-label":o?"Copied":e,onClick:()=>{navigator.clipboard?.writeText(r).catch(()=>{}),i(!0),setTimeout(()=>i(!1),1500)},children:[o?t.jsx(C,{}):t.jsx(m,{}),s&&(o?"Copied":e)]})}export{l as C};
@@ -1 +1 @@
1
- import{r as t}from"./index-NqrbvfSo.js";const e=t.createContext({disabled:!1});function r(){return t.useContext(e)}export{r as u};
1
+ import{r as t}from"./index-BCjjK9dr.js";const e=t.createContext({disabled:!1});function r(){return t.useContext(e)}export{r as u};
@@ -1 +1 @@
1
- import{r as o,j as e,B as i,aT as n}from"./index-NqrbvfSo.js";import{C as c}from"./check-DFzW0E5F.js";import{C as l}from"./copy-CkgrfFiF.js";function p(t){return`<script src="${location.origin}/snag.js" ${n("site")}="${t}" defer><\/script>`}function g({uid:t}){const[r,a]=o.useState(!1),s=p(t);return e.jsxs("div",{className:"relative rounded-md border border-border bg-background px-3 py-2.5 pr-11 font-mono text-[12.5px] leading-relaxed",children:[e.jsx("code",{className:"whitespace-pre-wrap break-all",children:s}),e.jsx(i,{variant:"ghost",size:"icon-sm",className:"absolute right-1.5 top-1.5","aria-label":r?"Copied":"Copy the tag",onClick:()=>{navigator.clipboard?.writeText(s),a(!0),setTimeout(()=>a(!1),1500)},children:r?e.jsx(c,{}):e.jsx(l,{})})]})}export{g as I};
1
+ import{r as o,j as e,B as i,aT as n}from"./index-BCjjK9dr.js";import{C as c}from"./check-fUN7a3GX.js";import{C as l}from"./copy-ZBdagSqO.js";function p(t){return`<script src="${location.origin}/snag.js" ${n("site")}="${t}" defer><\/script>`}function g({uid:t}){const[r,a]=o.useState(!1),s=p(t);return e.jsxs("div",{className:"relative rounded-md border border-border bg-background px-3 py-2.5 pr-11 font-mono text-[12.5px] leading-relaxed",children:[e.jsx("code",{className:"whitespace-pre-wrap break-all",children:s}),e.jsx(i,{variant:"ghost",size:"icon-sm",className:"absolute right-1.5 top-1.5","aria-label":r?"Copied":"Copy the tag",onClick:()=>{navigator.clipboard?.writeText(s),a(!0),setTimeout(()=>a(!1),1500)},children:r?e.jsx(c,{}):e.jsx(l,{})})]})}export{g as I};
@@ -1 +1 @@
1
- import{r,j as e,aS as o}from"./index-NqrbvfSo.js";function l({saving:s,savedAt:t}){const[i,a]=r.useState(!1);return r.useEffect(()=>{if(!t)return;a(!0);const n=setTimeout(()=>a(!1),1800);return()=>clearTimeout(n)},[t]),s?e.jsxs("span",{className:"inline-flex items-center gap-1.5 text-[12.5px] text-muted-foreground","aria-live":"polite",children:[e.jsx(o,{className:"size-3.5 animate-spin","aria-hidden":"true"}),"Saving"]}):e.jsx("span",{className:"text-[12.5px] text-muted-foreground","aria-live":"polite",children:i?"Saved":""})}export{l as S};
1
+ import{r,j as e,aS as o}from"./index-BCjjK9dr.js";function l({saving:s,savedAt:t}){const[i,a]=r.useState(!1);return r.useEffect(()=>{if(!t)return;a(!0);const n=setTimeout(()=>a(!1),1800);return()=>clearTimeout(n)},[t]),s?e.jsxs("span",{className:"inline-flex items-center gap-1.5 text-[12.5px] text-muted-foreground","aria-live":"polite",children:[e.jsx(o,{className:"size-3.5 animate-spin","aria-hidden":"true"}),"Saving"]}):e.jsx("span",{className:"text-[12.5px] text-muted-foreground","aria-live":"polite",children:i?"Saved":""})}export{l as S};
@@ -1 +1 @@
1
- import{j as e,u as n,G as a,B as r}from"./index-NqrbvfSo.js";function i({error:s}){const t=n(),o=s instanceof Error?s.message:"Something went wrong.";return e.jsx(a,{children:e.jsxs("div",{className:"flex flex-col items-start gap-3",children:[e.jsx("h1",{className:"m-0 text-lg font-semibold",children:"Could not load the dashboard"}),e.jsx("p",{className:"m-0 text-muted-foreground",children:o}),e.jsx(r,{variant:"outline",size:"sm",onClick:()=>void t.invalidate(),children:"Try again"})]})})}const m=({error:s})=>e.jsx(i,{error:s});export{m as errorComponent};
1
+ import{j as e,u as n,G as a,B as r}from"./index-BCjjK9dr.js";function i({error:s}){const t=n(),o=s instanceof Error?s.message:"Something went wrong.";return e.jsx(a,{children:e.jsxs("div",{className:"flex flex-col items-start gap-3",children:[e.jsx("h1",{className:"m-0 text-lg font-semibold",children:"Could not load the dashboard"}),e.jsx("p",{className:"m-0 text-muted-foreground",children:o}),e.jsx(r,{variant:"outline",size:"sm",onClick:()=>void t.invalidate(),children:"Try again"})]})})}const m=({error:s})=>e.jsx(i,{error:s});export{m as errorComponent};
@@ -1,4 +1,4 @@
1
- import{u as pt,a as gt,b as ht,c as I,r as o,d as z,e as le,g as ft,j as e,B as J,f as w,h as se,m as be,E as xt,i as ve,k as ge,l as mt,n as bt,o as ne,S as vt,p as Z,q as jt,L as _,s as yt,t as _e,M as St,v as wt,w as Nt,x as Ct,y as kt,O as Tt}from"./index-NqrbvfSo.js";import{u as He}from"./useQuery-Ce8K2e88.js";import{T as Pt,i as ze,a as Rt,D as Mt,b as Et,c as Ot,X as Dt,d as It,e as At,f as _t,g as Ht,R as zt,p as Lt,h as $t,j as Bt,k as Ft,P as Ut,l as qt,u as Gt,m as Vt,n as Kt,o as Yt,q as Wt,r as Xt,s as Qt,t as Jt,v as Zt,w as es,x as ts,y as ss,z as ns,A as as,F as rs,B as os,C as is,E as Le,G as $e,H as Be,I as ls,J as ds,K as cs}from"./dialog-cAVg5CWG.js";import{c as B,n as Fe,g as us,a as he,t as ps,d as gs,i as hs,u as fs,b as de,L as xs,I as ms}from"./label-CZtxPKnA.js";import{g as fe,u as bs,a as vs,b as js,s as ys,c as Ss,d as ws,e as Ns,f as Cs,h as ks,S as Ue,E as Q,D as ae,i as re,j as oe,k as je,l as ee,m as D,n as V,o as Ts,p as ce}from"./dropdown-menu-CROz9CD7.js";import{u as qe}from"./useRender-CLH8yHqZ.js";import{A as Ps,a as Rs}from"./avatar-CyWjapbD.js";import{S as Ms,i as Es,a as Os}from"./labels--UUyt9uB.js";import{u as Ge}from"./me-DuZzYTr0.js";import{L as te}from"./layout-grid-CpSrFghR.js";import{U as xe}from"./users-BH5_IfoG.js";import{c as Ds}from"./update-duXzIzFS.js";import{P as Ve}from"./plus-DvNJzVbr.js";import{M as Is,S as As,a as _s}from"./sun-CCV5_Xwg.js";import"./useBaseQuery-BQZrcHmw.js";import"./check-DFzW0E5F.js";import"./CompositeItem-H1Z2RNQW.js";import"./useValueChanged-DKD8Vs7J.js";function Hs(t){const s=pt({warn:t?.router===void 0}),n=t?.router||s;return gt(n.stores.__store,ht(t,n))}/**
1
+ import{u as pt,a as gt,b as ht,c as I,r as o,d as z,e as le,g as ft,j as e,B as J,f as w,h as se,m as be,E as xt,i as ve,k as ge,l as mt,n as bt,o as ne,S as vt,p as Z,q as jt,L as _,s as yt,t as _e,M as St,v as wt,w as Nt,x as Ct,y as kt,O as Tt}from"./index-BCjjK9dr.js";import{u as He}from"./useQuery-6QR_MT4t.js";import{T as Pt,i as ze,a as Rt,D as Mt,b as Et,c as Ot,X as Dt,d as It,e as At,f as _t,g as Ht,R as zt,p as Lt,h as $t,j as Bt,k as Ft,P as Ut,l as qt,u as Gt,m as Vt,n as Kt,o as Yt,q as Wt,r as Xt,s as Qt,t as Jt,v as Zt,w as es,x as ts,y as ss,z as ns,A as as,F as rs,B as os,C as is,E as Le,G as $e,H as Be,I as ls,J as ds,K as cs}from"./dialog-B_kwIiUp.js";import{c as B,n as Fe,g as us,a as he,t as ps,d as gs,i as hs,u as fs,b as de,L as xs,I as ms}from"./label-CU7jvj5k.js";import{g as fe,u as bs,a as vs,b as js,s as ys,c as Ss,d as ws,e as Ns,f as Cs,h as ks,S as Ue,E as Q,D as ae,i as re,j as oe,k as je,l as ee,m as D,n as V,o as Ts,p as ce}from"./dropdown-menu-D5UGpMWY.js";import{u as qe}from"./useRender-BybHPfHo.js";import{A as Ps,a as Rs}from"./avatar-JYCiU767.js";import{S as Ms,i as Es,a as Os}from"./labels--UUyt9uB.js";import{u as Ge}from"./me-ttfbX4Cb.js";import{L as te}from"./layout-grid-DgutVVEL.js";import{U as xe}from"./users-STxJg0L8.js";import{c as Ds}from"./update-duXzIzFS.js";import{P as Ve}from"./plus-Cl722ZH_.js";import{M as Is,S as As,a as _s}from"./sun-DDSRise2.js";import"./useBaseQuery-CoqlgX-x.js";import"./check-fUN7a3GX.js";import"./CompositeItem-DOjAZOIw.js";import"./useValueChanged-BhvEiD3-.js";function Hs(t){const s=pt({warn:t?.router===void 0}),n=t?.router||s;return gt(n.stores.__store,ht(t,n))}/**
2
2
  * @license lucide-react v1.39.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1 +1 @@
1
- import{Q as g,T as f,U as p,o as v,j as e,B as m,V as N,L as j,W as P}from"./index-NqrbvfSo.js";import{Q as y,u as b}from"./useBaseQuery-BQZrcHmw.js";import{P as w,S}from"./parts-CMVHppEZ.js";import{b as R,c as E,S as k}from"./labels--UUyt9uB.js";import{u as F}from"./me-DuZzYTr0.js";import"./card-rZNT8AAn.js";var M=class extends y{constructor(s,r){super(s,r)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(s){s._type="infinite",super.setOptions(s)}getOptimisticResult(s){return s._type="infinite",super.getOptimisticResult(s)}fetchNextPage(s){return this.fetch({...s,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(s){return this.fetch({...s,meta:{fetchMore:{direction:"backward"}}})}createResult(s,r){const{state:i}=s,l=super.createResult(s,r),{isFetching:o,isRefetching:n,isError:u,isRefetchError:d}=l,t=i.fetchMeta?.fetchMore?.direction,c=u&&t==="forward",a=o&&t==="forward",h=u&&t==="backward",x=o&&t==="backward";return{...l,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:f(r,i.data),hasPreviousPage:g(r,i.data),isFetchNextPageError:c,isFetchingNextPage:a,isFetchPreviousPageError:h,isFetchingPreviousPage:x,isRefetchError:d&&!c&&!h,isRefetching:n&&!a&&!x}}};function A(s,r){return b(s,M)}const T=[{value:"unresolved",label:"Needs attention"},...E.map(s=>({value:s,label:k[s]})),{value:"all",label:"Everything"}];function C(s,r=new Date){const i=new Date(s),l=n=>new Date(n.getFullYear(),n.getMonth(),n.getDate()).getTime(),o=Math.round((l(r)-l(i))/864e5);return o<=0?"Today":o===1?"Yesterday":o<7?i.toLocaleDateString(void 0,{weekday:"long"}):i.toLocaleDateString(void 0,{day:"numeric",month:"long"})}function U(){const s=F(),{status:r="unresolved",site:i}=p.useSearch(),l=v({from:"/activity"}),o=t=>void l({search:c=>({...c,...t}),replace:!0}),n=A(P(r,i)),u=n.data?.pages.flatMap(t=>t.data)??[],d=[];for(const t of u){const c=C(t.updatedAt),a=d[d.length-1];a?.day===c?a.rows.push(t):d.push({day:c,rows:[t]})}return e.jsxs("div",{className:"flex flex-col gap-5 p-7",children:[e.jsx(w,{title:"Activity",sub:`Every site, newest first${i?"":" — all of them"}`}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[T.map(t=>e.jsx(m,{size:"sm",variant:r===t.value?"default":"outline",onClick:()=>o({status:t.value}),children:t.label},t.value)),e.jsx("div",{className:"flex-1"}),e.jsxs("label",{className:"flex items-center gap-2 text-[13px] text-muted-foreground",children:["Site",e.jsxs("select",{"aria-label":"Site",value:i??"",onChange:t=>o({site:t.target.value||void 0}),className:"h-8 rounded-md border border-input bg-background px-2.5 text-[13px] text-foreground",children:[e.jsx("option",{value:"",children:"All sites"}),s.projects.map(t=>e.jsx("option",{value:t.uid,children:t.name},t.uid))]})]})]}),n.isPending&&e.jsx(N,{rows:4}),n.isError&&e.jsx("p",{className:"m-0 text-[13px] text-destructive",children:"Could not read the feed. Reload to try again."}),n.isSuccess&&u.length===0&&e.jsx("p",{className:"m-0 text-[13px] text-muted-foreground",children:r==="resolved"?"Nothing has been resolved yet — this is where finished comments go.":r==="unresolved"?"Nothing needs attention. Every comment on every site is resolved.":"No comments yet on any site."}),d.map(({day:t,rows:c})=>e.jsxs("section",{className:"flex flex-col gap-2",children:[e.jsx("h2",{className:"m-0 text-[12px] font-medium uppercase tracking-wide text-muted-foreground",children:t}),e.jsx("ul",{className:"m-0 flex list-none flex-col gap-1.5 p-0",children:c.map(a=>e.jsx("li",{children:e.jsxs(j,{to:"/s/$site/comments",params:{site:a.site.uid},search:{thread:a.key},className:"flex flex-col gap-1 rounded-md border border-border px-3 py-2.5 no-underline transition-colors hover:bg-muted/60",children:[e.jsxs("span",{className:"flex flex-wrap items-center gap-x-2.5 gap-y-1 text-[13px]",children:[e.jsx(S,{status:a.status}),e.jsx("span",{className:"font-medium text-foreground",children:a.site.name}),e.jsx("code",{className:"font-mono text-[12px] text-muted-foreground",children:a.route}),e.jsx("span",{className:"flex-1"}),e.jsx("span",{className:"text-[12px] text-muted-foreground",children:R(a.updatedAt)})]}),a.latest?.body&&e.jsxs("span",{className:"line-clamp-2 text-[13px] text-foreground",children:[e.jsxs("span",{className:"text-muted-foreground",children:[a.latest.author??a.createdBy.name,": "]}),a.latest.body]}),e.jsxs("span",{className:"flex flex-wrap items-center gap-x-2 text-[12px] text-muted-foreground",children:[e.jsx("span",{className:"font-mono",children:a.key}),e.jsx("span",{children:"·"}),e.jsxs("span",{children:[a.commentCount," ",a.commentCount===1?"comment":"comments"]}),a.assignee&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"·"}),e.jsx("span",{children:a.assignee})]})]})]})},a.id))})]},t)),n.hasNextPage&&e.jsx("div",{children:e.jsx(m,{variant:"outline",size:"sm",disabled:n.isFetchingNextPage,onClick:()=>void n.fetchNextPage(),children:n.isFetchingNextPage?"Reading…":"Show older"})})]})}export{U as component};
1
+ import{Q as g,T as f,U as p,o as v,j as e,B as m,V as N,L as j,W as P}from"./index-BCjjK9dr.js";import{Q as y,u as b}from"./useBaseQuery-CoqlgX-x.js";import{P as w,S}from"./parts-Oxy1krsw.js";import{b as R,c as E,S as k}from"./labels--UUyt9uB.js";import{u as F}from"./me-ttfbX4Cb.js";import"./card-PWIpee1m.js";var M=class extends y{constructor(s,r){super(s,r)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(s){s._type="infinite",super.setOptions(s)}getOptimisticResult(s){return s._type="infinite",super.getOptimisticResult(s)}fetchNextPage(s){return this.fetch({...s,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(s){return this.fetch({...s,meta:{fetchMore:{direction:"backward"}}})}createResult(s,r){const{state:i}=s,l=super.createResult(s,r),{isFetching:o,isRefetching:n,isError:u,isRefetchError:d}=l,t=i.fetchMeta?.fetchMore?.direction,c=u&&t==="forward",a=o&&t==="forward",h=u&&t==="backward",x=o&&t==="backward";return{...l,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:f(r,i.data),hasPreviousPage:g(r,i.data),isFetchNextPageError:c,isFetchingNextPage:a,isFetchPreviousPageError:h,isFetchingPreviousPage:x,isRefetchError:d&&!c&&!h,isRefetching:n&&!a&&!x}}};function A(s,r){return b(s,M)}const T=[{value:"unresolved",label:"Needs attention"},...E.map(s=>({value:s,label:k[s]})),{value:"all",label:"Everything"}];function C(s,r=new Date){const i=new Date(s),l=n=>new Date(n.getFullYear(),n.getMonth(),n.getDate()).getTime(),o=Math.round((l(r)-l(i))/864e5);return o<=0?"Today":o===1?"Yesterday":o<7?i.toLocaleDateString(void 0,{weekday:"long"}):i.toLocaleDateString(void 0,{day:"numeric",month:"long"})}function U(){const s=F(),{status:r="unresolved",site:i}=p.useSearch(),l=v({from:"/activity"}),o=t=>void l({search:c=>({...c,...t}),replace:!0}),n=A(P(r,i)),u=n.data?.pages.flatMap(t=>t.data)??[],d=[];for(const t of u){const c=C(t.updatedAt),a=d[d.length-1];a?.day===c?a.rows.push(t):d.push({day:c,rows:[t]})}return e.jsxs("div",{className:"flex flex-col gap-5 p-7",children:[e.jsx(w,{title:"Activity",sub:`Every site, newest first${i?"":" — all of them"}`}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[T.map(t=>e.jsx(m,{size:"sm",variant:r===t.value?"default":"outline",onClick:()=>o({status:t.value}),children:t.label},t.value)),e.jsx("div",{className:"flex-1"}),e.jsxs("label",{className:"flex items-center gap-2 text-[13px] text-muted-foreground",children:["Site",e.jsxs("select",{"aria-label":"Site",value:i??"",onChange:t=>o({site:t.target.value||void 0}),className:"h-8 rounded-md border border-input bg-background px-2.5 text-[13px] text-foreground",children:[e.jsx("option",{value:"",children:"All sites"}),s.projects.map(t=>e.jsx("option",{value:t.uid,children:t.name},t.uid))]})]})]}),n.isPending&&e.jsx(N,{rows:4}),n.isError&&e.jsx("p",{className:"m-0 text-[13px] text-destructive",children:"Could not read the feed. Reload to try again."}),n.isSuccess&&u.length===0&&e.jsx("p",{className:"m-0 text-[13px] text-muted-foreground",children:r==="resolved"?"Nothing has been resolved yet — this is where finished comments go.":r==="unresolved"?"Nothing needs attention. Every comment on every site is resolved.":"No comments yet on any site."}),d.map(({day:t,rows:c})=>e.jsxs("section",{className:"flex flex-col gap-2",children:[e.jsx("h2",{className:"m-0 text-[12px] font-medium uppercase tracking-wide text-muted-foreground",children:t}),e.jsx("ul",{className:"m-0 flex list-none flex-col gap-1.5 p-0",children:c.map(a=>e.jsx("li",{children:e.jsxs(j,{to:"/s/$site/comments",params:{site:a.site.uid},search:{thread:a.key},className:"flex flex-col gap-1 rounded-md border border-border px-3 py-2.5 no-underline transition-colors hover:bg-muted/60",children:[e.jsxs("span",{className:"flex flex-wrap items-center gap-x-2.5 gap-y-1 text-[13px]",children:[e.jsx(S,{status:a.status}),e.jsx("span",{className:"font-medium text-foreground",children:a.site.name}),e.jsx("code",{className:"font-mono text-[12px] text-muted-foreground",children:a.route}),e.jsx("span",{className:"flex-1"}),e.jsx("span",{className:"text-[12px] text-muted-foreground",children:R(a.updatedAt)})]}),a.latest?.body&&e.jsxs("span",{className:"line-clamp-2 text-[13px] text-foreground",children:[e.jsxs("span",{className:"text-muted-foreground",children:[a.latest.author??a.createdBy.name,": "]}),a.latest.body]}),e.jsxs("span",{className:"flex flex-wrap items-center gap-x-2 text-[12px] text-muted-foreground",children:[e.jsx("span",{className:"font-mono",children:a.key}),e.jsx("span",{children:"·"}),e.jsxs("span",{children:[a.commentCount," ",a.commentCount===1?"comment":"comments"]}),a.assignee&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"·"}),e.jsx("span",{children:a.assignee})]})]})]})},a.id))})]},t)),n.hasNextPage&&e.jsx("div",{children:e.jsx(m,{variant:"outline",size:"sm",disabled:n.isFetchingNextPage,onClick:()=>void n.fetchNextPage(),children:n.isFetchingNextPage?"Reading…":"Show older"})})]})}export{U as component};
@@ -1,4 +1,4 @@
1
- import{c as o}from"./index-NqrbvfSo.js";/**
1
+ import{c as o}from"./index-BCjjK9dr.js";/**
2
2
  * @license lucide-react v1.39.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1 +1 @@
1
- import{r as a,h as b,i as f,j as d,f as m}from"./index-NqrbvfSo.js";import{w as A}from"./dialog-cAVg5CWG.js";const x=a.createContext(void 0);function z(){const e=a.useContext(x);if(e===void 0)throw new Error(b(13));return e}const g={imageLoadingStatus:()=>null},R=a.forwardRef(function(t,r){const{className:v,render:p,style:s,...c}=t,[n,o]=a.useState("idle"),i={imageLoadingStatus:n},u=a.useMemo(()=>({imageLoadingStatus:n,setImageLoadingStatus:o}),[n,o]),l=f("span",t,{state:i,ref:r,props:c,stateAttributesMapping:g});return d.jsx(x.Provider,{value:u,children:l})}),k=a.forwardRef(function(t,r){const{className:v,render:p,delay:s=0,style:c,...n}=t,{imageLoadingStatus:o}=z(),[i,u]=a.useState(s===0),l=A();return a.useEffect(()=>(s>0?l.start(s,()=>u(!0)):u(!0),l.clear),[l,s]),f("span",t,{state:{imageLoadingStatus:o},ref:r,props:n,stateAttributesMapping:g,enabled:o!=="loaded"&&(s===0||i)})});function h({className:e,size:t="default",...r}){return d.jsx(R,{"data-slot":"avatar","data-size":t,className:m("group/avatar relative flex size-8 shrink-0 rounded-full select-none after:absolute after:inset-0 after:rounded-full after:border after:border-border after:mix-blend-darken data-[size=lg]:size-10 data-[size=sm]:size-6 dark:after:mix-blend-lighten",e),...r})}function w({className:e,...t}){return d.jsx(k,{"data-slot":"avatar-fallback",className:m("flex size-full items-center justify-center rounded-full bg-muted text-sm text-muted-foreground group-data-[size=sm]/avatar:text-xs",e),...t})}export{h as A,w as a};
1
+ import{r as a,h as b,i as f,j as d,f as m}from"./index-BCjjK9dr.js";import{w as A}from"./dialog-B_kwIiUp.js";const x=a.createContext(void 0);function z(){const e=a.useContext(x);if(e===void 0)throw new Error(b(13));return e}const g={imageLoadingStatus:()=>null},R=a.forwardRef(function(t,r){const{className:v,render:p,style:s,...c}=t,[n,o]=a.useState("idle"),i={imageLoadingStatus:n},u=a.useMemo(()=>({imageLoadingStatus:n,setImageLoadingStatus:o}),[n,o]),l=f("span",t,{state:i,ref:r,props:c,stateAttributesMapping:g});return d.jsx(x.Provider,{value:u,children:l})}),k=a.forwardRef(function(t,r){const{className:v,render:p,delay:s=0,style:c,...n}=t,{imageLoadingStatus:o}=z(),[i,u]=a.useState(s===0),l=A();return a.useEffect(()=>(s>0?l.start(s,()=>u(!0)):u(!0),l.clear),[l,s]),f("span",t,{state:{imageLoadingStatus:o},ref:r,props:n,stateAttributesMapping:g,enabled:o!=="loaded"&&(s===0||i)})});function h({className:e,size:t="default",...r}){return d.jsx(R,{"data-slot":"avatar","data-size":t,className:m("group/avatar relative flex size-8 shrink-0 rounded-full select-none after:absolute after:inset-0 after:rounded-full after:border after:border-border after:mix-blend-darken data-[size=lg]:size-10 data-[size=sm]:size-6 dark:after:mix-blend-lighten",e),...r})}function w({className:e,...t}){return d.jsx(k,{"data-slot":"avatar-fallback",className:m("flex size-full items-center justify-center rounded-full bg-muted text-sm text-muted-foreground group-data-[size=sm]/avatar:text-xs",e),...t})}export{h as A,w as a};
@@ -1 +1 @@
1
- import{m as a,f as n,n as o}from"./index-NqrbvfSo.js";import{u as d}from"./useRender-CLH8yHqZ.js";const s=o("group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",secondary:"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",destructive:"bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",outline:"border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",ghost:"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",link:"text-primary underline-offset-4 hover:underline"}},defaultVariants:{variant:"default"}});function v({className:r,variant:e="default",render:t,...i}){return d({defaultTagName:"span",props:a({className:n(s({variant:e}),r)},i),render:t,state:{slot:"badge",variant:e}})}export{v as B};
1
+ import{m as a,f as n,n as o}from"./index-BCjjK9dr.js";import{u as d}from"./useRender-BybHPfHo.js";const s=o("group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",secondary:"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",destructive:"bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",outline:"border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",ghost:"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",link:"text-primary underline-offset-4 hover:underline"}},defaultVariants:{variant:"default"}});function v({className:r,variant:e="default",render:t,...i}){return d({defaultTagName:"span",props:a({className:n(s({variant:e}),r)},i),render:t,state:{slot:"badge",variant:e}})}export{v as B};
@@ -1 +1 @@
1
- import{j as s,f as t}from"./index-NqrbvfSo.js";function c({className:a,size:d="default",...r}){return s.jsx("div",{"data-slot":"card","data-size":d,className:t("group/card flex flex-col gap-(--card-spacing) overflow-hidden rounded-xl bg-card py-(--card-spacing) text-sm text-card-foreground ring-1 ring-foreground/10 [--card-spacing:--spacing(4)] has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:[--card-spacing:--spacing(3)] data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl",a),...r})}export{c as C};
1
+ import{j as s,f as t}from"./index-BCjjK9dr.js";function c({className:a,size:d="default",...r}){return s.jsx("div",{"data-slot":"card","data-size":d,className:t("group/card flex flex-col gap-(--card-spacing) overflow-hidden rounded-xl bg-card py-(--card-spacing) text-sm text-card-foreground ring-1 ring-foreground/10 [--card-spacing:--spacing(4)] has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:[--card-spacing:--spacing(3)] data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl",a),...r})}export{c as C};
@@ -1,4 +1,4 @@
1
- import{c}from"./index-NqrbvfSo.js";/**
1
+ import{c}from"./index-BCjjK9dr.js";/**
2
2
  * @license lucide-react v1.39.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c as o}from"./index-NqrbvfSo.js";/**
1
+ import{c as o}from"./index-BCjjK9dr.js";/**
2
2
  * @license lucide-react v1.39.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c}from"./index-NqrbvfSo.js";/**
1
+ import{c}from"./index-BCjjK9dr.js";/**
2
2
  * @license lucide-react v1.39.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c as zn,at as Z,k as Pe,au as mt,aB as oe,aU as bt,r as l,aG as Jn,a4 as ke,e as q,l as Ze,d as N,h as zt,i as Ae,a5 as Qn,j as I,a6 as Jt,E as ve,aV as Zn,a7 as Pt,g as et,ax as ot,aw as er,aW as tr,aX as Qt,aY as nr,aC as rr,B as Zt,f as Fe}from"./index-NqrbvfSo.js";import{a as A,o as U,m as ge,c as Se,B as or,u as en,s as tn,y as yt,b as nn,w as rn,g as Ee,t as on,q as sn,n as sr,p as ir,i as ar}from"./label-CZtxPKnA.js";/**
1
+ import{c as zn,at as Z,k as Pe,au as mt,aB as oe,aU as bt,r as l,aG as Jn,a4 as ke,e as q,l as Ze,d as N,h as zt,i as Ae,a5 as Qn,j as I,a6 as Jt,E as ve,aV as Zn,a7 as Pt,g as et,ax as ot,aw as er,aW as tr,aX as Qt,aY as nr,aC as rr,B as Zt,f as Fe}from"./index-BCjjK9dr.js";import{a as A,o as U,m as ge,c as Se,B as or,u as en,s as tn,y as yt,b as nn,w as rn,g as Ee,t as on,q as sn,n as sr,p as ir,i as ar}from"./label-CU7jvj5k.js";/**
2
2
  * @license lucide-react v1.39.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c as zn,r as u,i as Fe,E as tt,ar as qt,k as se,as as $e,g as Pe,at as ke,au as We,av as on,aw as lt,ax as Et,ay as Vo,az as Un,aA as Wo,aB as rn,aC as Kn,aD as Dt,aE as Gn,aF as En,l as Ct,a6 as Yn,d as de,a4 as Xn,e as pe,aG as qn,h as ze,a8 as jo,a5 as Qn,m as it,a7 as $o,j as Q,aH as zo,f as ut}from"./index-NqrbvfSo.js";import{C as Uo}from"./check-DFzW0E5F.js";import{i as Je,Q as Qt,w as _e,S as Jn,U as Zn,V as Ko,W as ft,Y as Tt,Z as eo,_ as to,a as Te,$ as Go,a0 as Mt,a1 as Yo,a2 as Xo,T as Jt,a3 as Lt,a4 as qo,a5 as Zt,v as Re,a6 as Qo,a7 as Jo,a8 as Zo,a9 as Cn,aa as Ut,ab as Tn,ac as Ne,ad as mt,ae as er,af as Nt,ag as Ht,ah as no,ai as sn,aj as tr,ak as nr,al as or,am as rr,C as sr,O as ir,A as oo,an as cr,B as ar,ao as lr,ap as ur,aq as fr,ar as dr,as as pr,z as gr,at as mr,au as hr,av as xr,N as yr,R as vr,p as Rr,aw as ro,j as br,P as wr,l as Er,ax as so,m as Cr,n as Tr,ay as Mr,az as Or,aA as Sr,q as Pr,aB as Ir,F as Ar,r as kr,o as Fr,aC as Dr,aD as Lr,aE as Nr,aF as Hr,aG as Br,aH as _r,s as Vr,t as Wr,aI as Mn,aJ as On,aK as jr}from"./dialog-cAVg5CWG.js";import{t as cn,g as nt,c as ie,m as ct,o as Se,a as le,p as at,q as io,b as be,r as en,s as Ot,v as an,u as Bt,w as $r,x as st,k as zr,y as Sn,i as Ur,z as Kr}from"./label-CZtxPKnA.js";import{u as co,a as ao,C as Gr,b as Yr}from"./CompositeItem-H1Z2RNQW.js";import{u as Xr}from"./useValueChanged-DKD8Vs7J.js";/**
1
+ import{c as zn,r as u,i as Fe,E as tt,ar as qt,k as se,as as $e,g as Pe,at as ke,au as We,av as on,aw as lt,ax as Et,ay as Vo,az as Un,aA as Wo,aB as rn,aC as Kn,aD as Dt,aE as Gn,aF as En,l as Ct,a6 as Yn,d as de,a4 as Xn,e as pe,aG as qn,h as ze,a8 as jo,a5 as Qn,m as it,a7 as $o,j as Q,aH as zo,f as ut}from"./index-BCjjK9dr.js";import{C as Uo}from"./check-fUN7a3GX.js";import{i as Je,Q as Qt,w as _e,S as Jn,U as Zn,V as Ko,W as ft,Y as Tt,Z as eo,_ as to,a as Te,$ as Go,a0 as Mt,a1 as Yo,a2 as Xo,T as Jt,a3 as Lt,a4 as qo,a5 as Zt,v as Re,a6 as Qo,a7 as Jo,a8 as Zo,a9 as Cn,aa as Ut,ab as Tn,ac as Ne,ad as mt,ae as er,af as Nt,ag as Ht,ah as no,ai as sn,aj as tr,ak as nr,al as or,am as rr,C as sr,O as ir,A as oo,an as cr,B as ar,ao as lr,ap as ur,aq as fr,ar as dr,as as pr,z as gr,at as mr,au as hr,av as xr,N as yr,R as vr,p as Rr,aw as ro,j as br,P as wr,l as Er,ax as so,m as Cr,n as Tr,ay as Mr,az as Or,aA as Sr,q as Pr,aB as Ir,F as Ar,r as kr,o as Fr,aC as Dr,aD as Lr,aE as Nr,aF as Hr,aG as Br,aH as _r,s as Vr,t as Wr,aI as Mn,aJ as On,aK as jr}from"./dialog-B_kwIiUp.js";import{t as cn,g as nt,c as ie,m as ct,o as Se,a as le,p as at,q as io,b as be,r as en,s as Ot,v as an,u as Bt,w as $r,x as st,k as zr,y as Sn,i as Ur,z as Kr}from"./label-CU7jvj5k.js";import{u as co,a as ao,C as Gr,b as Yr}from"./CompositeItem-DOjAZOIw.js";import{u as Xr}from"./useValueChanged-BhvEiD3-.js";/**
2
2
  * @license lucide-react v1.39.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c as e}from"./index-NqrbvfSo.js";/**
1
+ import{c as e}from"./index-BCjjK9dr.js";/**
2
2
  * @license lucide-react v1.39.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.