@fedify/cli 1.8.12 → 2.0.0-dev.1757

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 (130) hide show
  1. package/deno.json +72 -0
  2. package/dist/cache.js +17 -0
  3. package/dist/deno.js +72 -0
  4. package/dist/docloader.js +52 -0
  5. package/dist/globals.js +49 -0
  6. package/dist/imagerenderer.js +105 -0
  7. package/dist/inbox/rendercode.js +57 -0
  8. package/dist/inbox/view.js +508 -0
  9. package/dist/inbox.js +315 -0
  10. package/dist/init/action/configs.js +81 -0
  11. package/dist/init/action/deps.js +52 -0
  12. package/dist/init/action/dir.js +16 -0
  13. package/dist/init/action/env.js +13 -0
  14. package/dist/init/action/install.js +22 -0
  15. package/dist/init/action/mod.js +39 -0
  16. package/dist/init/action/notice.js +62 -0
  17. package/dist/init/action/patch.js +141 -0
  18. package/dist/init/action/precommand.js +23 -0
  19. package/dist/init/action/recommend.js +24 -0
  20. package/dist/init/action/set.js +31 -0
  21. package/dist/init/action/templates.js +57 -0
  22. package/dist/init/action/utils.js +50 -0
  23. package/dist/init/ask/dir.js +82 -0
  24. package/dist/init/ask/kv.js +33 -0
  25. package/dist/init/ask/mod.js +16 -0
  26. package/dist/init/ask/mq.js +33 -0
  27. package/dist/init/ask/pm.js +49 -0
  28. package/dist/init/ask/wf.js +29 -0
  29. package/dist/init/command.js +25 -0
  30. package/dist/init/const.js +31 -0
  31. package/dist/init/json/biome.js +24 -0
  32. package/dist/init/json/kv.js +53 -0
  33. package/dist/init/json/mq.js +72 -0
  34. package/dist/init/json/pm.js +44 -0
  35. package/dist/init/json/rt.js +39 -0
  36. package/dist/init/json/vscode-settings-for-deno.js +53 -0
  37. package/dist/init/json/vscode-settings.js +49 -0
  38. package/dist/init/lib.js +129 -0
  39. package/dist/init/mod.js +5 -0
  40. package/dist/init/webframeworks.js +133 -0
  41. package/dist/kv.bun.js +17 -0
  42. package/dist/kv.node.js +17 -0
  43. package/dist/log.js +52 -0
  44. package/dist/lookup.js +287 -0
  45. package/dist/mod.js +34 -0
  46. package/dist/nodeinfo.js +261 -0
  47. package/dist/table.js +24 -0
  48. package/dist/tempserver.js +71 -0
  49. package/dist/tunnel.js +21 -0
  50. package/dist/utils.js +67 -0
  51. package/dist/webfinger/action.js +44 -0
  52. package/dist/webfinger/command.js +20 -0
  53. package/dist/webfinger/error.js +47 -0
  54. package/dist/webfinger/lib.js +45 -0
  55. package/dist/webfinger/mod.js +5 -0
  56. package/package.json +64 -24
  57. package/scripts/pack.ts +64 -0
  58. package/src/cache.ts +17 -0
  59. package/src/docloader.ts +67 -0
  60. package/src/globals.ts +43 -0
  61. package/src/imagerenderer.ts +149 -0
  62. package/src/inbox/entry.ts +10 -0
  63. package/src/inbox/rendercode.ts +68 -0
  64. package/src/inbox/view.tsx +598 -0
  65. package/src/inbox.tsx +535 -0
  66. package/src/init/action/configs.ts +88 -0
  67. package/src/init/action/deps.ts +93 -0
  68. package/src/init/action/dir.ts +11 -0
  69. package/src/init/action/env.ts +14 -0
  70. package/src/init/action/install.ts +59 -0
  71. package/src/init/action/mod.ts +66 -0
  72. package/src/init/action/notice.ts +101 -0
  73. package/src/init/action/patch.ts +212 -0
  74. package/src/init/action/precommand.ts +22 -0
  75. package/src/init/action/recommend.ts +38 -0
  76. package/src/init/action/set.ts +78 -0
  77. package/src/init/action/templates.ts +95 -0
  78. package/src/init/action/utils.ts +64 -0
  79. package/src/init/ask/dir.ts +98 -0
  80. package/src/init/ask/kv.ts +39 -0
  81. package/src/init/ask/mod.ts +23 -0
  82. package/src/init/ask/mq.ts +37 -0
  83. package/src/init/ask/pm.ts +58 -0
  84. package/src/init/ask/wf.ts +27 -0
  85. package/src/init/command.ts +64 -0
  86. package/src/init/const.ts +4 -0
  87. package/src/init/json/biome.json +17 -0
  88. package/src/init/json/kv.json +39 -0
  89. package/src/init/json/mq.json +95 -0
  90. package/src/init/json/pm.json +47 -0
  91. package/src/init/json/rt.json +42 -0
  92. package/src/init/json/vscode-settings-for-deno.json +43 -0
  93. package/src/init/json/vscode-settings.json +41 -0
  94. package/src/init/lib.ts +220 -0
  95. package/src/init/mod.ts +2 -0
  96. package/src/init/templates/defaults/federation.ts.tpl +23 -0
  97. package/src/init/templates/defaults/logging.ts.tpl +23 -0
  98. package/src/init/templates/express/app.ts.tpl +16 -0
  99. package/src/init/templates/express/index.ts.tpl +6 -0
  100. package/src/init/templates/hono/app.tsx.tpl +14 -0
  101. package/src/init/templates/hono/index/bun.ts.tpl +10 -0
  102. package/src/init/templates/hono/index/deno.ts.tpl +13 -0
  103. package/src/init/templates/hono/index/node.ts.tpl +14 -0
  104. package/src/init/templates/next/middleware.ts.tpl +45 -0
  105. package/src/init/templates/nitro/nitro.config.ts.tpl +5 -0
  106. package/src/init/templates/nitro/server/error.ts.tpl +3 -0
  107. package/src/init/templates/nitro/server/middleware/federation.ts.tpl +8 -0
  108. package/src/init/types.ts +88 -0
  109. package/src/init/webframeworks.ts +151 -0
  110. package/src/kv.bun.ts +12 -0
  111. package/src/kv.node.ts +11 -0
  112. package/src/log.ts +64 -0
  113. package/src/lookup.test.ts +182 -0
  114. package/src/lookup.ts +558 -0
  115. package/src/mod.ts +45 -0
  116. package/src/nodeinfo.test.ts +229 -0
  117. package/src/nodeinfo.ts +447 -0
  118. package/src/table.ts +17 -0
  119. package/src/tempserver.ts +87 -0
  120. package/src/tunnel.ts +32 -0
  121. package/src/utils.ts +136 -0
  122. package/src/webfinger/action.ts +50 -0
  123. package/src/webfinger/command.ts +59 -0
  124. package/src/webfinger/error.ts +47 -0
  125. package/src/webfinger/lib.ts +37 -0
  126. package/src/webfinger/mod.test.ts +79 -0
  127. package/src/webfinger/mod.ts +2 -0
  128. package/tsdown.config.ts +24 -0
  129. package/src/install.mjs +0 -189
  130. package/src/run.mjs +0 -22
@@ -0,0 +1,508 @@
1
+
2
+ import { Temporal } from "@js-temporal/polyfill";
3
+
4
+ import { renderActivity, renderRawActivity, renderRequest, renderResponse } from "./rendercode.js";
5
+ import { getStatusText } from "@poppanator/http-constants";
6
+ import { Fragment } from "hono/jsx";
7
+ import { getSingletonHighlighter } from "shiki";
8
+ import util from "node:util";
9
+ import { jsx, jsxs } from "hono/jsx/jsx-runtime";
10
+
11
+ //#region src/inbox/view.tsx
12
+ const Layout = (props) => {
13
+ return /* @__PURE__ */ jsxs("html", { children: [/* @__PURE__ */ jsxs("head", { children: [
14
+ /* @__PURE__ */ jsx("meta", { charset: "utf-8" }),
15
+ /* @__PURE__ */ jsx("meta", {
16
+ name: "viewport",
17
+ content: "width=device-width, initial-scale=1"
18
+ }),
19
+ /* @__PURE__ */ jsxs("title", { children: [
20
+ props.title == null ? "" : /* @__PURE__ */ jsxs(Fragment, { children: [
21
+ props.title,
22
+ " —",
23
+ " "
24
+ ] }),
25
+ "Fedify Ephemeral Inbox (",
26
+ props.handle,
27
+ ")"
28
+ ] }),
29
+ /* @__PURE__ */ jsx("link", {
30
+ href: "https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css",
31
+ rel: "stylesheet",
32
+ integrity: "sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH",
33
+ crossorigin: "anonymous"
34
+ })
35
+ ] }), /* @__PURE__ */ jsxs("body", { children: [/* @__PURE__ */ jsxs("header", {
36
+ class: "container mt-3 mb-3 text-center",
37
+ children: [
38
+ /* @__PURE__ */ jsxs("svg", {
39
+ width: "48",
40
+ height: "48",
41
+ viewBox: "0 0 112 112",
42
+ version: "1.1",
43
+ id: "svg5",
44
+ xmlns: "http://www.w3.org/2000/svg",
45
+ "xmlns:svg": "http://www.w3.org/2000/svg",
46
+ "xmlns:rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
47
+ "xmlns:cc": "http://creativecommons.org/ns#",
48
+ "xmlns:dc": "http://purl.org/dc/elements/1.1/",
49
+ children: [
50
+ /* @__PURE__ */ jsx("defs", {
51
+ id: "defs5",
52
+ children: /* @__PURE__ */ jsx("clipPath", {
53
+ clipPathUnits: "userSpaceOnUse",
54
+ id: "clipPath8",
55
+ children: /* @__PURE__ */ jsx("ellipse", {
56
+ style: "fill:#000000;stroke:#000000;stroke-width:3.02635;stroke-linejoin:miter;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal",
57
+ id: "ellipse8",
58
+ cx: "55.92646",
59
+ cy: "56.073448",
60
+ transform: "rotate(-0.07519647)",
61
+ rx: "54.486828",
62
+ ry: "54.486824"
63
+ })
64
+ })
65
+ }),
66
+ /* @__PURE__ */ jsx("title", {
67
+ id: "title1",
68
+ children: "Fedify"
69
+ }),
70
+ /* @__PURE__ */ jsx("ellipse", {
71
+ style: "fill:#ffffff;stroke:none;stroke-width:3.02635;stroke-linejoin:miter;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal",
72
+ id: "path8-2",
73
+ cx: "55.92646",
74
+ cy: "56.073448",
75
+ transform: "rotate(-0.07519647)",
76
+ rx: "54.486828",
77
+ ry: "54.486824"
78
+ }),
79
+ /* @__PURE__ */ jsxs("g", {
80
+ id: "g8",
81
+ "clip-path": "url(#clipPath8)",
82
+ children: [/* @__PURE__ */ jsxs("g", {
83
+ id: "g5",
84
+ children: [
85
+ /* @__PURE__ */ jsx("path", {
86
+ d: "M 77.4624,78.9593 C 78.2802,68.3428 73.7143,58.8833 71.3291,55.4806 L 87.6847,48.335 c 4.9066,1.6333 6.474,17.3537 6.6444,25.0098 0,0 -3.5778,0.5104 -5.6222,2.0416 -2.085,1.5616 -5.6222,5.1041 -11.2445,3.5729 z",
87
+ fill: "#ffffff",
88
+ stroke: "#84b5d9",
89
+ "stroke-width": "3",
90
+ "stroke-linecap": "round",
91
+ id: "path1"
92
+ }),
93
+ /* @__PURE__ */ jsx("path", {
94
+ d: "M 7.06239,52.159 C -5.55748,54.1782 -12.682,66.0659 -17.661,73.2769 c -0.8584,13.3918 -0.6181,41.1021 7.211,44.8111 7.82906,3.709 26.9553,1.545 35.5398,0 v 4.121 c 1.3736,0.515 5.0477,1.648 8.7562,2.06 3.7085,0.412 6.696,-1.202 7.7261,-2.06 v -9.787 c 0.5151,-0.343 2.9874,-1.957 8.7562,-5.666 7.211,-4.635 11.3315,-16.482 9.7863,-24.7229 -1.1589,-6.181 3.6055,-18.5427 6.1809,-26.7838 9.7863,2.0601 22.148,-1.0301 23.1781,-14.9369 C 90.1205,31.5801 80.7174,19.9868 63.2051,25.3752 45.6927,30.7636 48.268,52.159 41.5721,59.37 35.3913,53.1891 23.5446,49.5219 7.06239,52.159 Z",
95
+ fill: "#bae6fd",
96
+ stroke: "#0c4a6e",
97
+ "stroke-width": "3",
98
+ "stroke-linecap": "round",
99
+ id: "path3"
100
+ }),
101
+ /* @__PURE__ */ jsx("path", {
102
+ d: "M 66.2955,55.2493 C 64.5786,54.7342 60.9387,53.6011 60.1146,53.189",
103
+ stroke: "#0284c7",
104
+ "stroke-opacity": "0.37",
105
+ "stroke-width": "3",
106
+ "stroke-linecap": "round",
107
+ id: "path4",
108
+ style: "opacity:1;fill:none;stroke-width:3;stroke-linejoin:miter;stroke-dasharray:none;paint-order:normal"
109
+ }),
110
+ /* @__PURE__ */ jsx("path", {
111
+ d: "m 41.5721,59.3698 c -0.6868,0.8585 -2.6784,2.7814 -5.1507,3.6055",
112
+ stroke: "#0284c7",
113
+ "stroke-opacity": "0.37",
114
+ "stroke-width": "3",
115
+ "stroke-linecap": "round",
116
+ id: "path5",
117
+ style: "fill:none"
118
+ }),
119
+ /* @__PURE__ */ jsx("circle", {
120
+ cx: "68.870796",
121
+ cy: "42.8876",
122
+ r: "2.0602801",
123
+ fill: "#000000",
124
+ id: "circle5"
125
+ })
126
+ ]
127
+ }), /* @__PURE__ */ jsxs("g", {
128
+ id: "g2",
129
+ transform: "matrix(0.08160718,0,0,0.08160718,76.994732,53.205469)",
130
+ style: "display:inline",
131
+ children: [
132
+ /* @__PURE__ */ jsx("path", {
133
+ style: "color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#a730b8;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:41.5748;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate",
134
+ d: "m 181.13086,275.13672 a 68.892408,68.892408 0 0 1 -29.46484,29.32812 l 161.75781,162.38868 38.99805,-19.76368 z m 213.36328,214.1875 -38.99805,19.76367 81.96289,82.2832 a 68.892409,68.892409 0 0 1 29.47071,-29.33203 z",
135
+ id: "path9722",
136
+ transform: "matrix(0.26458333,0,0,0.26458333,-6.6789703,32.495842)"
137
+ }),
138
+ /* @__PURE__ */ jsx("path", {
139
+ style: "color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#5496be;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:41.5748;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate",
140
+ d: "m 581.64648,339.39062 -91.57617,46.41016 6.75196,43.18945 103.61523,-52.51367 A 68.892409,68.892409 0 0 1 581.64648,339.39062 Z M 436.9082,412.74219 220.38281,522.47656 a 68.892408,68.892408 0 0 1 18.79492,37.08985 L 443.66016,455.93359 Z",
141
+ id: "path9729",
142
+ transform: "matrix(0.26458333,0,0,0.26458333,-6.6789703,32.495842)"
143
+ }),
144
+ /* @__PURE__ */ jsx("path", {
145
+ style: "color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#ce3d1a;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:41.5748;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate",
146
+ d: "M 367.27539,142.4375 262.79492,346.4082 293.64258,377.375 404.26562,161.41797 A 68.892408,68.892408 0 0 1 367.27539,142.4375 Z m -131.6543,257.02148 -52.92187,103.31446 a 68.892409,68.892409 0 0 1 36.98633,18.97851 l 46.78125,-91.32812 z",
147
+ id: "path9713",
148
+ transform: "matrix(0.26458333,0,0,0.26458333,-6.6789703,32.495842)"
149
+ }),
150
+ /* @__PURE__ */ jsx("path", {
151
+ style: "color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#d0188f;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:41.5748;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate",
152
+ d: "m 150.76758,304.91797 a 68.892408,68.892408 0 0 1 -34.41602,7.19531 68.892408,68.892408 0 0 1 -6.65039,-0.69531 l 30.90235,197.66211 a 68.892409,68.892409 0 0 1 34.41601,-7.19531 68.892409,68.892409 0 0 1 6.64649,0.69531 z",
153
+ id: "path1015",
154
+ transform: "matrix(0.26458333,0,0,0.26458333,-6.6789703,32.495842)"
155
+ }),
156
+ /* @__PURE__ */ jsx("path", {
157
+ style: "color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#5b36e9;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:41.5748;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate",
158
+ d: "m 239.3418,560.54492 a 68.892408,68.892408 0 0 1 0.7207,13.87696 68.892408,68.892408 0 0 1 -7.26758,27.17968 l 197.62891,31.71289 a 68.892409,68.892409 0 0 1 -0.72266,-13.8789 68.892409,68.892409 0 0 1 7.26953,-27.17774 z",
159
+ id: "path1674",
160
+ transform: "matrix(0.26458333,0,0,0.26458333,-6.6789703,32.495842)"
161
+ }),
162
+ /* @__PURE__ */ jsx("path", {
163
+ style: "color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#30b873;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:41.5748;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate",
164
+ d: "m 601.13281,377.19922 -91.21875,178.08203 a 68.892408,68.892408 0 0 1 36.99414,18.98242 L 638.125,396.18359 a 68.892409,68.892409 0 0 1 -36.99219,-18.98437 z",
165
+ id: "path1676",
166
+ transform: "matrix(0.26458333,0,0,0.26458333,-6.6789703,32.495842)"
167
+ }),
168
+ /* @__PURE__ */ jsx("path", {
169
+ style: "color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#ebe305;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:41.5748;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate",
170
+ d: "m 476.72266,125.33008 a 68.892408,68.892408 0 0 1 -29.47071,29.33203 l 141.26563,141.81055 a 68.892409,68.892409 0 0 1 29.46875,-29.33204 z",
171
+ id: "path1678",
172
+ transform: "matrix(0.26458333,0,0,0.26458333,-6.6789703,32.495842)"
173
+ }),
174
+ /* @__PURE__ */ jsx("path", {
175
+ style: "color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#f47601;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:41.5748;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate",
176
+ d: "m 347.78711,104.63086 -178.57617,90.49805 a 68.892409,68.892409 0 0 1 18.79297,37.08593 l 178.57421,-90.50195 a 68.892408,68.892408 0 0 1 -18.79101,-37.08203 z",
177
+ id: "path1680",
178
+ transform: "matrix(0.26458333,0,0,0.26458333,-6.6789703,32.495842)"
179
+ }),
180
+ /* @__PURE__ */ jsx("path", {
181
+ style: "color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#57c115;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:41.5748;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate",
182
+ d: "m 446.92578,154.82617 a 68.892408,68.892408 0 0 1 -34.98242,7.48242 68.892408,68.892408 0 0 1 -6.0293,-0.63281 l 15.81836,101.29102 43.16211,6.92578 z m -16,167.02735 37.40039,239.48242 a 68.892409,68.892409 0 0 1 33.91406,-6.94336 68.892409,68.892409 0 0 1 7.20704,0.79101 L 474.08984,328.77734 Z",
183
+ id: "path9758",
184
+ transform: "matrix(0.26458333,0,0,0.26458333,-6.6789703,32.495842)"
185
+ }),
186
+ /* @__PURE__ */ jsx("path", {
187
+ style: "color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#dbb210;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:41.5748;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate",
188
+ d: "m 188.13086,232.97461 a 68.892408,68.892408 0 0 1 0.75781,14.0957 68.892408,68.892408 0 0 1 -7.16015,26.98242 l 101.36914,16.28125 19.92382,-38.9082 z m 173.73633,27.90039 -19.92578,38.91211 239.51367,38.4668 a 68.892409,68.892409 0 0 1 -0.69531,-13.71875 68.892409,68.892409 0 0 1 7.34961,-27.32422 z",
189
+ id: "path9760",
190
+ transform: "matrix(0.26458333,0,0,0.26458333,-6.6789703,32.495842)"
191
+ }),
192
+ /* @__PURE__ */ jsx("circle", {
193
+ style: "fill:#ffca00;fill-opacity:0.995968;stroke:none;stroke-width:0.264583;stroke-opacity:0.960784",
194
+ id: "path817",
195
+ cx: "106.26596",
196
+ cy: "51.535553",
197
+ r: "16.570711",
198
+ transform: "rotate(3.1178174)"
199
+ }),
200
+ /* @__PURE__ */ jsx("circle", {
201
+ id: "path819",
202
+ style: "fill:#64ff00;fill-opacity:0.995968;stroke:none;stroke-width:0.264583;stroke-opacity:0.960784",
203
+ cx: "171.42836",
204
+ cy: "110.19328",
205
+ r: "16.570711",
206
+ transform: "rotate(3.1178174)"
207
+ }),
208
+ /* @__PURE__ */ jsx("circle", {
209
+ id: "path823",
210
+ style: "fill:#00a3ff;fill-opacity:0.995968;stroke:none;stroke-width:0.264583;stroke-opacity:0.960784",
211
+ cx: "135.76379",
212
+ cy: "190.27704",
213
+ r: "16.570711",
214
+ transform: "rotate(3.1178174)"
215
+ }),
216
+ /* @__PURE__ */ jsx("circle", {
217
+ style: "fill:#9500ff;fill-opacity:0.995968;stroke:none;stroke-width:0.264583;stroke-opacity:0.960784",
218
+ id: "path825",
219
+ cx: "48.559471",
220
+ cy: "181.1138",
221
+ r: "16.570711",
222
+ transform: "rotate(3.1178174)"
223
+ }),
224
+ /* @__PURE__ */ jsx("circle", {
225
+ id: "path827",
226
+ style: "fill:#ff0000;fill-opacity:0.995968;stroke:none;stroke-width:0.264583;stroke-opacity:0.960784",
227
+ cx: "30.328812",
228
+ cy: "95.366837",
229
+ r: "16.570711",
230
+ transform: "rotate(3.1178174)"
231
+ })
232
+ ]
233
+ })]
234
+ }),
235
+ /* @__PURE__ */ jsx("circle", {
236
+ style: "opacity:1;fill:none;stroke:#84b5d9;stroke-width:4.91342;stroke-linejoin:miter;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal",
237
+ id: "path8",
238
+ cx: "55.926456",
239
+ cy: "56.073448",
240
+ transform: "rotate(-0.07519625)",
241
+ r: "53.543289"
242
+ })
243
+ ]
244
+ }),
245
+ /* @__PURE__ */ jsx("h1", {
246
+ class: "h5",
247
+ children: "Fedify Ephemeral Inbox"
248
+ }),
249
+ /* @__PURE__ */ jsx("p", {
250
+ class: "text-body-secondary",
251
+ style: "user-select: all;",
252
+ children: props.handle
253
+ })
254
+ ]
255
+ }), /* @__PURE__ */ jsx("main", {
256
+ class: "container mt-3 mb-3",
257
+ children: props.children
258
+ })] })] });
259
+ };
260
+ const Tab = ({ active, disabled, label, badge, href }) => {
261
+ return /* @__PURE__ */ jsx("li", {
262
+ class: "nav-item",
263
+ children: active ? /* @__PURE__ */ jsxs("span", {
264
+ class: "nav-link active",
265
+ style: "cursor: default;",
266
+ children: [label, badge != null ? /* @__PURE__ */ jsxs(Fragment, { children: [" ", /* @__PURE__ */ jsx("span", {
267
+ class: "badge text-bg-secondary",
268
+ children: badge
269
+ })] }) : void 0]
270
+ }) : disabled ? /* @__PURE__ */ jsx("span", {
271
+ class: "nav-link disabled",
272
+ children: label
273
+ }) : /* @__PURE__ */ jsxs("a", {
274
+ class: "nav-link",
275
+ href,
276
+ children: [label, badge != null ? /* @__PURE__ */ jsxs(Fragment, { children: [" ", /* @__PURE__ */ jsx("span", {
277
+ class: "badge text-bg-secondary",
278
+ children: badge
279
+ })] }) : void 0]
280
+ })
281
+ });
282
+ };
283
+ const TabList = ({ children }) => {
284
+ return /* @__PURE__ */ jsx("ul", {
285
+ class: "nav nav-tabs",
286
+ children
287
+ });
288
+ };
289
+ const highlighter = await getSingletonHighlighter();
290
+ await highlighter.loadTheme("github-light");
291
+ await highlighter.loadLanguage("http");
292
+ await highlighter.loadLanguage("json");
293
+ const CodeBlock = ({ language, code }) => {
294
+ const result = highlighter.codeToHtml(code, {
295
+ lang: language,
296
+ theme: "github-light"
297
+ });
298
+ return /* @__PURE__ */ jsx("div", {
299
+ dangerouslySetInnerHTML: { __html: result },
300
+ class: "m-3"
301
+ });
302
+ };
303
+ const Log = ({ log: { timestamp, category, level, message } }) => {
304
+ const listClass = level === "debug" ? "list-group-item-light" : level === "info" ? "" : level === "warning" ? "list-group-item-warning" : "list-group-item-danger";
305
+ const time = Temporal.Instant.fromEpochMilliseconds(timestamp);
306
+ return /* @__PURE__ */ jsxs("li", {
307
+ class: "list-group-item " + listClass,
308
+ children: [/* @__PURE__ */ jsxs("div", {
309
+ class: "d-flex w-100 justify-content-between",
310
+ children: [/* @__PURE__ */ jsx("p", {
311
+ class: "mb-1",
312
+ style: "white-space: pre-wrap; word-break: break-word;",
313
+ children: message.map((m, i) => i % 2 == 0 ? m : /* @__PURE__ */ jsx("code", { children: typeof m === "string" ? m : util.inspect(m) }, i))
314
+ }), /* @__PURE__ */ jsx("time", {
315
+ class: "text-body-secondary",
316
+ datetime: time.toString(),
317
+ style: "flex-shrink: 0;",
318
+ children: /* @__PURE__ */ jsx("small", { children: time.toLocaleString() })
319
+ })]
320
+ }), /* @__PURE__ */ jsx("small", {
321
+ class: "text-body-secondary",
322
+ children: category.map((c, i) => i < 1 ? c : /* @__PURE__ */ jsxs(Fragment, { children: [
323
+ " ",
324
+ "/ ",
325
+ c
326
+ ] }, i.toString()))
327
+ })]
328
+ });
329
+ };
330
+ const LogList = ({ logs }) => {
331
+ return /* @__PURE__ */ jsx("ul", {
332
+ class: "list-group mt-3",
333
+ children: logs.map((log) => /* @__PURE__ */ jsx(Log, { log }, log.timestamp))
334
+ });
335
+ };
336
+ const ActivityEntryView = async ({ tabPage, entry: { activity, request, response, logs } }) => {
337
+ return /* @__PURE__ */ jsxs("div", { children: [
338
+ /* @__PURE__ */ jsxs(TabList, { children: [
339
+ /* @__PURE__ */ jsx(Tab, {
340
+ label: "Request",
341
+ href: "?tab=request",
342
+ active: tabPage === "request"
343
+ }),
344
+ /* @__PURE__ */ jsx(Tab, {
345
+ label: "Response",
346
+ href: "?tab=response",
347
+ disabled: response == null,
348
+ active: tabPage === "response"
349
+ }),
350
+ /* @__PURE__ */ jsx(Tab, {
351
+ label: "Raw Activity",
352
+ href: "?tab=raw-activity",
353
+ disabled: activity == null,
354
+ active: tabPage === "raw-activity"
355
+ }),
356
+ /* @__PURE__ */ jsx(Tab, {
357
+ label: "Compact Activity",
358
+ href: "?tab=compact-activity",
359
+ disabled: activity == null,
360
+ active: tabPage === "compact-activity"
361
+ }),
362
+ /* @__PURE__ */ jsx(Tab, {
363
+ label: "Expanded Activity",
364
+ href: "?tab=expanded-activity",
365
+ disabled: activity == null,
366
+ active: tabPage === "expanded-activity"
367
+ }),
368
+ /* @__PURE__ */ jsx(Tab, {
369
+ label: "Logs",
370
+ href: "?tab=logs",
371
+ badge: logs.length,
372
+ active: tabPage === "logs"
373
+ })
374
+ ] }),
375
+ tabPage === "request" && /* @__PURE__ */ jsx("div", {
376
+ class: "tab-page",
377
+ children: /* @__PURE__ */ jsx(CodeBlock, {
378
+ code: await renderRequest(request),
379
+ language: "http"
380
+ })
381
+ }),
382
+ tabPage === "response" && response != null && /* @__PURE__ */ jsx("div", {
383
+ class: "tab-page",
384
+ children: /* @__PURE__ */ jsx(CodeBlock, {
385
+ code: await renderResponse(response),
386
+ language: "http"
387
+ })
388
+ }),
389
+ tabPage === "raw-activity" && /* @__PURE__ */ jsx("div", {
390
+ class: "tab-page",
391
+ children: /* @__PURE__ */ jsx(CodeBlock, {
392
+ code: await renderRawActivity(request),
393
+ language: "json"
394
+ })
395
+ }),
396
+ tabPage === "compact-activity" && activity != null && /* @__PURE__ */ jsx("div", {
397
+ class: "tab-page",
398
+ children: /* @__PURE__ */ jsx(CodeBlock, {
399
+ code: await renderActivity(activity, false),
400
+ language: "json"
401
+ })
402
+ }),
403
+ tabPage === "expanded-activity" && activity != null && /* @__PURE__ */ jsx("div", {
404
+ class: "tab-page",
405
+ children: /* @__PURE__ */ jsx(CodeBlock, {
406
+ code: await renderActivity(activity, true),
407
+ language: "json"
408
+ })
409
+ }),
410
+ tabPage === "logs" && /* @__PURE__ */ jsx("div", {
411
+ class: "tab-page",
412
+ children: /* @__PURE__ */ jsx(LogList, { logs })
413
+ })
414
+ ] });
415
+ };
416
+ const ActivityEntryPage = ({ handle, idx, entry, tabPage }) => {
417
+ return /* @__PURE__ */ jsxs(Layout, {
418
+ handle,
419
+ title: `Request #${idx}`,
420
+ children: [/* @__PURE__ */ jsx("nav", {
421
+ "aria-label": "breadcrumb",
422
+ children: /* @__PURE__ */ jsxs("ol", {
423
+ class: "breadcrumb",
424
+ children: [/* @__PURE__ */ jsx("li", {
425
+ class: "breadcrumb-item",
426
+ children: /* @__PURE__ */ jsx("a", {
427
+ href: "/r",
428
+ children: "Inbox"
429
+ })
430
+ }), /* @__PURE__ */ jsxs("li", {
431
+ class: "breadcrumb-item active",
432
+ "aria-current": "page",
433
+ children: [
434
+ "Request #",
435
+ idx,
436
+ " (",
437
+ /* @__PURE__ */ jsx("time", {
438
+ datetime: entry.timestamp.toString(),
439
+ children: entry.timestamp.toLocaleString()
440
+ }),
441
+ ")"
442
+ ]
443
+ })]
444
+ })
445
+ }), /* @__PURE__ */ jsx(ActivityEntryView, {
446
+ entry,
447
+ tabPage
448
+ })]
449
+ });
450
+ };
451
+ const ActivityList = ({ entries }) => {
452
+ return /* @__PURE__ */ jsx("div", {
453
+ class: "list-group",
454
+ children: entries.map((entry, i) => {
455
+ const failed = entry.activity == null || entry.response == null || !entry.response.ok || entry.request.method !== "POST";
456
+ const itemClass = failed ? "list-group-item-danger" : "";
457
+ const url = new URL(entry.request.url);
458
+ return /* @__PURE__ */ jsxs("a", {
459
+ class: "list-group-item list-group-item-action d-flex w-100 justify-content-between " + itemClass,
460
+ href: `/r/${i}`,
461
+ children: [/* @__PURE__ */ jsxs("span", { children: [
462
+ "Request #",
463
+ i,
464
+ ":",
465
+ " ",
466
+ /* @__PURE__ */ jsxs("code", { children: [
467
+ entry.request.method,
468
+ " ",
469
+ url.pathname + url.search
470
+ ] }),
471
+ entry.activity == null ? "" : /* @__PURE__ */ jsxs(Fragment, { children: [" · ", /* @__PURE__ */ jsx("code", { children: entry.activity.constructor.name })] }),
472
+ entry.response == null ? "" : /* @__PURE__ */ jsxs(Fragment, { children: [
473
+ " →",
474
+ " ",
475
+ /* @__PURE__ */ jsxs("code", { children: [
476
+ entry.response.status,
477
+ " ",
478
+ entry.response.statusText === "" ? getStatusText(entry.response.status) : entry.response.statusText
479
+ ] })
480
+ ] })
481
+ ] }), /* @__PURE__ */ jsx("time", {
482
+ class: "text-body-secondary",
483
+ timestamp: entry.timestamp.toString(),
484
+ children: /* @__PURE__ */ jsx("small", { children: entry.timestamp.toLocaleString() })
485
+ })]
486
+ });
487
+ }).reverse()
488
+ });
489
+ };
490
+ const ActivityListPage = ({ handle, entries }) => {
491
+ return /* @__PURE__ */ jsxs(Layout, {
492
+ handle,
493
+ children: [/* @__PURE__ */ jsx("nav", {
494
+ "aria-label": "breadcrumb",
495
+ children: /* @__PURE__ */ jsx("ol", {
496
+ class: "breadcrumb",
497
+ children: /* @__PURE__ */ jsx("li", {
498
+ class: "breadcrumb-item active",
499
+ "aria-current": "page",
500
+ children: "Inbox"
501
+ })
502
+ })
503
+ }), /* @__PURE__ */ jsx(ActivityList, { entries })]
504
+ });
505
+ };
506
+
507
+ //#endregion
508
+ export { ActivityEntryPage, ActivityListPage };