@jam-comments/server-utilities 0.0.2 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
- export { default as log } from "./log";
2
- export { default as CommentFetcher } from './CommentFetcher';
1
+ import { markupFetcher } from "./markupFetcher";
2
+ export { log, logError } from "./log";
3
3
  export * from './utils';
4
+ export { markupFetcher };
package/dist/index.es.js CHANGED
@@ -17,6 +17,41 @@ var __spreadValues = (a, b) => {
17
17
  return a;
18
18
  };
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
+ const getBaseUrl = () => {
21
+ var _a;
22
+ if (typeof process !== "undefined" && ((_a = process.env) == null ? void 0 : _a.JAM_COMMENTS_BASE_URL)) {
23
+ return process.env["JAM_COMMENTS_BASE_URL"];
24
+ }
25
+ return "https://go.jamcomments.com";
26
+ };
27
+ const markupFetcher = (platform) => {
28
+ return async ({
29
+ path,
30
+ domain,
31
+ apiKey
32
+ }) => {
33
+ const params = new URLSearchParams({
34
+ path,
35
+ domain,
36
+ force_embed: "1"
37
+ });
38
+ const response = await fetch(`${getBaseUrl()}/api/markup?${params}`, {
39
+ method: "GET",
40
+ headers: {
41
+ Authorization: `Bearer ${apiKey}`,
42
+ Accept: "application/json",
43
+ "X-Platform": platform
44
+ }
45
+ });
46
+ if (response.status === 401) {
47
+ throw `Unauthorized! Are your domain and API key set correctly?`;
48
+ }
49
+ if (!response.ok) {
50
+ throw `Request failed! Status code: ${response.status}, message: ${response.statusText}`;
51
+ }
52
+ return await response.text();
53
+ };
54
+ };
20
55
  var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
21
56
  var ansiStyles$1 = { exports: {} };
22
57
  var colorName = {
@@ -1398,137 +1433,9 @@ var source = chalk;
1398
1433
  const log = (message) => {
1399
1434
  console.log(`${source.magenta("JamComments:")} ${message}`);
1400
1435
  };
1401
- var log$1 = log;
1402
- const isDev = () => {
1403
- const processIsDefined = typeof process !== "undefined";
1404
- const env = processIsDefined && process.env && process.env["NODE_ENV"] && process.env["NODE_ENV"].toLowerCase();
1405
- return env !== "production";
1406
- };
1407
- var isDev$1 = isDev;
1408
- const DEFAULT_SERVICE_ENDPOINT = "https://service.jamcomments.com";
1409
- const DEVELOPMENT_SERVICE_ENDPOINT = "http://localhost:4000";
1410
- const getServiceEndpoint = (explicitEndpoint = null) => {
1411
- if (typeof window !== "undefined" && window["jcForceLocal"]) {
1412
- return DEVELOPMENT_SERVICE_ENDPOINT;
1413
- }
1414
- if (explicitEndpoint) {
1415
- return explicitEndpoint;
1416
- }
1417
- return process.env["NODE_ENV"] === "production" ? DEFAULT_SERVICE_ENDPOINT : DEVELOPMENT_SERVICE_ENDPOINT;
1418
- };
1419
- var getServiceEndpoint$1 = getServiceEndpoint;
1420
- var __defProp2 = Object.defineProperty;
1421
- var __getOwnPropSymbols2 = Object.getOwnPropertySymbols;
1422
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
1423
- var __propIsEnum2 = Object.prototype.propertyIsEnumerable;
1424
- var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1425
- var __spreadValues2 = (a, b) => {
1426
- for (var prop in b || (b = {}))
1427
- if (__hasOwnProp2.call(b, prop))
1428
- __defNormalProp2(a, prop, b[prop]);
1429
- if (__getOwnPropSymbols2)
1430
- for (var prop of __getOwnPropSymbols2(b)) {
1431
- if (__propIsEnum2.call(b, prop))
1432
- __defNormalProp2(a, prop, b[prop]);
1433
- }
1434
- return a;
1436
+ const logError = (message) => {
1437
+ console.error(`JamComments: ${message}`);
1435
1438
  };
1436
- function attachParamsToUrl(url, params) {
1437
- const urlObj = new URL(url);
1438
- for (const key in params) {
1439
- urlObj.searchParams.append(key, params[key]);
1440
- }
1441
- return urlObj.toString();
1442
- }
1443
- async function makeRequest({
1444
- endpoint,
1445
- fetchOptions,
1446
- query,
1447
- variables
1448
- }) {
1449
- const payload = { query, variables: JSON.stringify(variables) };
1450
- const { method = "POST", headers = {} } = fetchOptions;
1451
- const isGet = /get/i.test(method);
1452
- const preparedEndpoint = isGet ? attachParamsToUrl(endpoint, payload) : endpoint;
1453
- try {
1454
- const response = await fetch(preparedEndpoint, {
1455
- method: method.toUpperCase(),
1456
- headers: __spreadValues2({
1457
- "Content-Type": `application/${isGet ? "x-www-form-urlencoded" : "json"}`
1458
- }, headers),
1459
- body: isGet ? null : JSON.stringify(payload)
1460
- });
1461
- const { data, errors } = await response.json();
1462
- const returnPayload = { data };
1463
- if (errors) {
1464
- returnPayload.errors = errors;
1465
- }
1466
- return returnPayload;
1467
- } catch (e) {
1468
- return { errors: [e] };
1469
- }
1470
- }
1471
- function QuestClient({ endpoint, method, headers }) {
1472
- const send = async (query, variables = {}) => {
1473
- return makeRequest({
1474
- endpoint,
1475
- query,
1476
- variables,
1477
- fetchOptions: {
1478
- method,
1479
- headers
1480
- }
1481
- });
1482
- };
1483
- return { send };
1484
- }
1485
- var dummyComments = [
1486
- {
1487
- id: "1",
1488
- name: "Joanne King",
1489
- emailAddress: "joanne@example.com",
1490
- content: "<blockquote>This is some random quote.</blockquote><p>That's good stuff! Thanks for posting.</p>",
1491
- path: null,
1492
- createdAt: "1620462061499",
1493
- status: "approved"
1494
- },
1495
- {
1496
- id: "2",
1497
- name: "Jennyfer Abbott",
1498
- emailAddress: "jennyfer@example.com",
1499
- content: "Animi voluptatem quae quas eius et error id. Ipsum amet corporis. Non corrupti eum et vel harum ut mollitia rerum laborum. Sunt est id et. Beatae nobis sit id qui ut ducimus sapiente placeat. Minus atque rerum natus et. Libero velit corporis. Blanditiis enim aut enim est ex qui omnis nemo dolorem. \n\n Vel asperiores molestias qui accusamus est libero voluptas. Blanditiis doloremque sint qui facere voluptatum et possimus aliquid. Eos enim iste qui aliquid suscipit a. Et nemo rerum voluptatem quia. Accusantium non sunt velit et temporibus beatae numquam omnis magnam. Nulla facere exercitationem est fugiat incidunt architecto corporis beatae et. Modi error quod qui rem aut.",
1500
- path: null,
1501
- createdAt: "1586054668000",
1502
- status: "approved"
1503
- },
1504
- {
1505
- id: "3",
1506
- name: "Carmella Gutkowski",
1507
- emailAddress: "carmella@example.com",
1508
- content: "Dolores delectus qui id rem aut. Modi voluptate laborum dolorum suscipit optio eaque. Cum est non temporibus voluptas incidunt.",
1509
- path: null,
1510
- createdAt: "1578537868000",
1511
- status: "approved"
1512
- },
1513
- {
1514
- id: "4",
1515
- name: "Coby Sawayn",
1516
- emailAddress: "coby@example.com",
1517
- content: "Occaecati necessitatibus assumenda quia. Quam esse voluptas necessitatibus tenetur similique deleniti voluptas. Est voluptas nobis. Necessitatibus eum repellendus et commodi quasi corrupti. Cupiditate tempore quasi labore.",
1518
- path: null,
1519
- createdAt: "1602254668000",
1520
- status: "approved"
1521
- },
1522
- {
1523
- id: "5",
1524
- name: "Florence Wolf",
1525
- emailAddress: "florence@example.com",
1526
- content: "Possimus vitae adipisci dolorum adipisci quaerat ut itaque. Dolorem delectus pariatur maxime qui voluptatem.",
1527
- path: null,
1528
- createdAt: "1591713868000",
1529
- status: "approved"
1530
- }
1531
- ];
1532
1439
  var requiresPort = function required(port2, protocol) {
1533
1440
  protocol = protocol.split(":")[0];
1534
1441
  port2 = +port2;
@@ -1925,92 +1832,4 @@ const makeHtmlReady = (content) => {
1925
1832
  }
1926
1833
  return content.split(/(?:\r\n|\r|\n)/).filter((text) => !!text).map((text) => `<p>${text.trim()}</p>`).join("");
1927
1834
  };
1928
- const PER_PAGE = 50;
1929
- const COMMENTS_QUERY = `
1930
- fragment commentFields on Comment {
1931
- createdAt
1932
- name
1933
- content
1934
- path
1935
- id
1936
- }
1937
-
1938
- query Comments($domain: String!, $status: String, $skip: Int, $perPage: Int, $path: String){
1939
- comments(domain: $domain, status: $status, skip: $skip, perPage: $perPage, path: $path) {
1940
- items {
1941
- ...commentFields
1942
- children {
1943
- ...commentFields
1944
- }
1945
- }
1946
- meta {
1947
- hasMore
1948
- }
1949
- }
1950
- }`;
1951
- class CommentFetcher {
1952
- constructor({ domain, apiKey, isDev: isDev2 = isDev$1() }) {
1953
- this.isDev = isDev2;
1954
- this.domain = domain;
1955
- this.client = QuestClient({
1956
- endpoint: `${getServiceEndpoint$1()}/graphql`,
1957
- headers: {
1958
- "x-api-key": apiKey
1959
- }
1960
- });
1961
- }
1962
- async _getBatchOfComments({ skip = 0, path = "" }) {
1963
- const { data, errors } = await this.client.send(COMMENTS_QUERY, {
1964
- domain: this.domain,
1965
- status: "approved",
1966
- perPage: PER_PAGE,
1967
- path,
1968
- skip
1969
- });
1970
- if (!data && errors && errors.length) {
1971
- throw new Error(`Something went wrong with JamComments! Here's the error:
1972
-
1973
- ${JSON.stringify(errors)}`);
1974
- }
1975
- const { items, meta } = data.comments;
1976
- if (errors && errors.length) {
1977
- throw new Error(errors[0].message);
1978
- }
1979
- log$1(`Fetched a batch of ${items.length} comments.`);
1980
- return {
1981
- comments: items,
1982
- hasMore: meta.hasMore
1983
- };
1984
- }
1985
- _prepareDummyComments() {
1986
- const descendingDates = dummyComments.map((d) => d.createdAt).sort().reverse();
1987
- return dummyComments.map((comment, index) => {
1988
- comment.createdAt = descendingDates[index];
1989
- delete comment.emailAddress;
1990
- return comment;
1991
- });
1992
- }
1993
- _prepareContent(comments) {
1994
- return comments.map((c) => {
1995
- c.content = makeHtmlReady(c.content);
1996
- return c;
1997
- });
1998
- }
1999
- async getAllComments(path = "") {
2000
- if (this.isDev) {
2001
- return this._prepareContent(this._prepareDummyComments());
2002
- }
2003
- let allComments = [];
2004
- let skip = 0;
2005
- let hasMore = false;
2006
- do {
2007
- const freshFetch = await this._getBatchOfComments({ skip, path });
2008
- hasMore = freshFetch.hasMore;
2009
- skip = skip + freshFetch.comments.length;
2010
- allComments = [...allComments, ...freshFetch.comments];
2011
- } while (hasMore);
2012
- return this._prepareContent(allComments);
2013
- }
2014
- }
2015
- var CommentFetcher$1 = CommentFetcher;
2016
- export { CommentFetcher$1 as CommentFetcher, filterByUrl, log$1 as log, makeHtmlReady, parsePath };
1835
+ export { filterByUrl, log, logError, makeHtmlReady, markupFetcher, parsePath };
package/dist/index.umd.js CHANGED
@@ -1,31 +1,6 @@
1
- var wt=Object.defineProperty,vt=Object.defineProperties;var kt=Object.getOwnPropertyDescriptors;var me=Object.getOwnPropertySymbols;var Ct=Object.prototype.hasOwnProperty,Ot=Object.prototype.propertyIsEnumerable;var de=(m,d,b)=>d in m?wt(m,d,{enumerable:!0,configurable:!0,writable:!0,value:b}):m[d]=b,ge=(m,d)=>{for(var b in d||(d={}))Ct.call(d,b)&&de(m,b,d[b]);if(me)for(var b of me(d))Ot.call(d,b)&&de(m,b,d[b]);return m},be=(m,d)=>vt(m,kt(d));(function(m,d){typeof exports=="object"&&typeof module<"u"?d(exports):typeof define=="function"&&define.amd?define(["exports"],d):(m=typeof globalThis<"u"?globalThis:m||self,d(m.JamComments={}))})(this,function(m){"use strict";var d=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},b={exports:{}},ye={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};const x=ye,T={};for(const e of Object.keys(x))T[x[e]]=e;const u={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};var z=u;for(const e of Object.keys(u)){if(!("channels"in u[e]))throw new Error("missing channels property: "+e);if(!("labels"in u[e]))throw new Error("missing channel labels property: "+e);if(u[e].labels.length!==u[e].channels)throw new Error("channel and label counts mismatch: "+e);const{channels:t,labels:r}=u[e];delete u[e].channels,delete u[e].labels,Object.defineProperty(u[e],"channels",{value:t}),Object.defineProperty(u[e],"labels",{value:r})}u.rgb.hsl=function(e){const t=e[0]/255,r=e[1]/255,n=e[2]/255,o=Math.min(t,r,n),s=Math.max(t,r,n),i=s-o;let l,c;s===o?l=0:t===s?l=(r-n)/i:r===s?l=2+(n-t)/i:n===s&&(l=4+(t-r)/i),l=Math.min(l*60,360),l<0&&(l+=360);const h=(o+s)/2;return s===o?c=0:h<=.5?c=i/(s+o):c=i/(2-s-o),[l,c*100,h*100]},u.rgb.hsv=function(e){let t,r,n,o,s;const i=e[0]/255,l=e[1]/255,c=e[2]/255,h=Math.max(i,l,c),f=h-Math.min(i,l,c),a=function(p){return(h-p)/6/f+1/2};return f===0?(o=0,s=0):(s=f/h,t=a(i),r=a(l),n=a(c),i===h?o=n-r:l===h?o=1/3+t-n:c===h&&(o=2/3+r-t),o<0?o+=1:o>1&&(o-=1)),[o*360,s*100,h*100]},u.rgb.hwb=function(e){const t=e[0],r=e[1];let n=e[2];const o=u.rgb.hsl(e)[0],s=1/255*Math.min(t,Math.min(r,n));return n=1-1/255*Math.max(t,Math.max(r,n)),[o,s*100,n*100]},u.rgb.cmyk=function(e){const t=e[0]/255,r=e[1]/255,n=e[2]/255,o=Math.min(1-t,1-r,1-n),s=(1-t-o)/(1-o)||0,i=(1-r-o)/(1-o)||0,l=(1-n-o)/(1-o)||0;return[s*100,i*100,l*100,o*100]};function we(e,t){return(e[0]-t[0])**2+(e[1]-t[1])**2+(e[2]-t[2])**2}u.rgb.keyword=function(e){const t=T[e];if(t)return t;let r=1/0,n;for(const o of Object.keys(x)){const s=x[o],i=we(e,s);i<r&&(r=i,n=o)}return n},u.keyword.rgb=function(e){return x[e]},u.rgb.xyz=function(e){let t=e[0]/255,r=e[1]/255,n=e[2]/255;t=t>.04045?((t+.055)/1.055)**2.4:t/12.92,r=r>.04045?((r+.055)/1.055)**2.4:r/12.92,n=n>.04045?((n+.055)/1.055)**2.4:n/12.92;const o=t*.4124+r*.3576+n*.1805,s=t*.2126+r*.7152+n*.0722,i=t*.0193+r*.1192+n*.9505;return[o*100,s*100,i*100]},u.rgb.lab=function(e){const t=u.rgb.xyz(e);let r=t[0],n=t[1],o=t[2];r/=95.047,n/=100,o/=108.883,r=r>.008856?r**(1/3):7.787*r+16/116,n=n>.008856?n**(1/3):7.787*n+16/116,o=o>.008856?o**(1/3):7.787*o+16/116;const s=116*n-16,i=500*(r-n),l=200*(n-o);return[s,i,l]},u.hsl.rgb=function(e){const t=e[0]/360,r=e[1]/100,n=e[2]/100;let o,s,i;if(r===0)return i=n*255,[i,i,i];n<.5?o=n*(1+r):o=n+r-n*r;const l=2*n-o,c=[0,0,0];for(let h=0;h<3;h++)s=t+1/3*-(h-1),s<0&&s++,s>1&&s--,6*s<1?i=l+(o-l)*6*s:2*s<1?i=o:3*s<2?i=l+(o-l)*(2/3-s)*6:i=l,c[h]=i*255;return c},u.hsl.hsv=function(e){const t=e[0];let r=e[1]/100,n=e[2]/100,o=r;const s=Math.max(n,.01);n*=2,r*=n<=1?n:2-n,o*=s<=1?s:2-s;const i=(n+r)/2,l=n===0?2*o/(s+o):2*r/(n+r);return[t,l*100,i*100]},u.hsv.rgb=function(e){const t=e[0]/60,r=e[1]/100;let n=e[2]/100;const o=Math.floor(t)%6,s=t-Math.floor(t),i=255*n*(1-r),l=255*n*(1-r*s),c=255*n*(1-r*(1-s));switch(n*=255,o){case 0:return[n,c,i];case 1:return[l,n,i];case 2:return[i,n,c];case 3:return[i,l,n];case 4:return[c,i,n];case 5:return[n,i,l]}},u.hsv.hsl=function(e){const t=e[0],r=e[1]/100,n=e[2]/100,o=Math.max(n,.01);let s,i;i=(2-r)*n;const l=(2-r)*o;return s=r*o,s/=l<=1?l:2-l,s=s||0,i/=2,[t,s*100,i*100]},u.hwb.rgb=function(e){const t=e[0]/360;let r=e[1]/100,n=e[2]/100;const o=r+n;let s;o>1&&(r/=o,n/=o);const i=Math.floor(6*t),l=1-n;s=6*t-i,(i&1)!==0&&(s=1-s);const c=r+s*(l-r);let h,f,a;switch(i){default:case 6:case 0:h=l,f=c,a=r;break;case 1:h=c,f=l,a=r;break;case 2:h=r,f=l,a=c;break;case 3:h=r,f=c,a=l;break;case 4:h=c,f=r,a=l;break;case 5:h=l,f=r,a=c;break}return[h*255,f*255,a*255]},u.cmyk.rgb=function(e){const t=e[0]/100,r=e[1]/100,n=e[2]/100,o=e[3]/100,s=1-Math.min(1,t*(1-o)+o),i=1-Math.min(1,r*(1-o)+o),l=1-Math.min(1,n*(1-o)+o);return[s*255,i*255,l*255]},u.xyz.rgb=function(e){const t=e[0]/100,r=e[1]/100,n=e[2]/100;let o,s,i;return o=t*3.2406+r*-1.5372+n*-.4986,s=t*-.9689+r*1.8758+n*.0415,i=t*.0557+r*-.204+n*1.057,o=o>.0031308?1.055*o**(1/2.4)-.055:o*12.92,s=s>.0031308?1.055*s**(1/2.4)-.055:s*12.92,i=i>.0031308?1.055*i**(1/2.4)-.055:i*12.92,o=Math.min(Math.max(0,o),1),s=Math.min(Math.max(0,s),1),i=Math.min(Math.max(0,i),1),[o*255,s*255,i*255]},u.xyz.lab=function(e){let t=e[0],r=e[1],n=e[2];t/=95.047,r/=100,n/=108.883,t=t>.008856?t**(1/3):7.787*t+16/116,r=r>.008856?r**(1/3):7.787*r+16/116,n=n>.008856?n**(1/3):7.787*n+16/116;const o=116*r-16,s=500*(t-r),i=200*(r-n);return[o,s,i]},u.lab.xyz=function(e){const t=e[0],r=e[1],n=e[2];let o,s,i;s=(t+16)/116,o=r/500+s,i=s-n/200;const l=s**3,c=o**3,h=i**3;return s=l>.008856?l:(s-16/116)/7.787,o=c>.008856?c:(o-16/116)/7.787,i=h>.008856?h:(i-16/116)/7.787,o*=95.047,s*=100,i*=108.883,[o,s,i]},u.lab.lch=function(e){const t=e[0],r=e[1],n=e[2];let o;o=Math.atan2(n,r)*360/2/Math.PI,o<0&&(o+=360);const i=Math.sqrt(r*r+n*n);return[t,i,o]},u.lch.lab=function(e){const t=e[0],r=e[1],o=e[2]/360*2*Math.PI,s=r*Math.cos(o),i=r*Math.sin(o);return[t,s,i]},u.rgb.ansi16=function(e,t=null){const[r,n,o]=e;let s=t===null?u.rgb.hsv(e)[2]:t;if(s=Math.round(s/50),s===0)return 30;let i=30+(Math.round(o/255)<<2|Math.round(n/255)<<1|Math.round(r/255));return s===2&&(i+=60),i},u.hsv.ansi16=function(e){return u.rgb.ansi16(u.hsv.rgb(e),e[2])},u.rgb.ansi256=function(e){const t=e[0],r=e[1],n=e[2];return t===r&&r===n?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(r/255*5)+Math.round(n/255*5)},u.ansi16.rgb=function(e){let t=e%10;if(t===0||t===7)return e>50&&(t+=3.5),t=t/10.5*255,[t,t,t];const r=(~~(e>50)+1)*.5,n=(t&1)*r*255,o=(t>>1&1)*r*255,s=(t>>2&1)*r*255;return[n,o,s]},u.ansi256.rgb=function(e){if(e>=232){const s=(e-232)*10+8;return[s,s,s]}e-=16;let t;const r=Math.floor(e/36)/5*255,n=Math.floor((t=e%36)/6)/5*255,o=t%6/5*255;return[r,n,o]},u.rgb.hex=function(e){const r=(((Math.round(e[0])&255)<<16)+((Math.round(e[1])&255)<<8)+(Math.round(e[2])&255)).toString(16).toUpperCase();return"000000".substring(r.length)+r},u.hex.rgb=function(e){const t=e.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!t)return[0,0,0];let r=t[0];t[0].length===3&&(r=r.split("").map(l=>l+l).join(""));const n=parseInt(r,16),o=n>>16&255,s=n>>8&255,i=n&255;return[o,s,i]},u.rgb.hcg=function(e){const t=e[0]/255,r=e[1]/255,n=e[2]/255,o=Math.max(Math.max(t,r),n),s=Math.min(Math.min(t,r),n),i=o-s;let l,c;return i<1?l=s/(1-i):l=0,i<=0?c=0:o===t?c=(r-n)/i%6:o===r?c=2+(n-t)/i:c=4+(t-r)/i,c/=6,c%=1,[c*360,i*100,l*100]},u.hsl.hcg=function(e){const t=e[1]/100,r=e[2]/100,n=r<.5?2*t*r:2*t*(1-r);let o=0;return n<1&&(o=(r-.5*n)/(1-n)),[e[0],n*100,o*100]},u.hsv.hcg=function(e){const t=e[1]/100,r=e[2]/100,n=t*r;let o=0;return n<1&&(o=(r-n)/(1-n)),[e[0],n*100,o*100]},u.hcg.rgb=function(e){const t=e[0]/360,r=e[1]/100,n=e[2]/100;if(r===0)return[n*255,n*255,n*255];const o=[0,0,0],s=t%1*6,i=s%1,l=1-i;let c=0;switch(Math.floor(s)){case 0:o[0]=1,o[1]=i,o[2]=0;break;case 1:o[0]=l,o[1]=1,o[2]=0;break;case 2:o[0]=0,o[1]=1,o[2]=i;break;case 3:o[0]=0,o[1]=l,o[2]=1;break;case 4:o[0]=i,o[1]=0,o[2]=1;break;default:o[0]=1,o[1]=0,o[2]=l}return c=(1-r)*n,[(r*o[0]+c)*255,(r*o[1]+c)*255,(r*o[2]+c)*255]},u.hcg.hsv=function(e){const t=e[1]/100,r=e[2]/100,n=t+r*(1-t);let o=0;return n>0&&(o=t/n),[e[0],o*100,n*100]},u.hcg.hsl=function(e){const t=e[1]/100,n=e[2]/100*(1-t)+.5*t;let o=0;return n>0&&n<.5?o=t/(2*n):n>=.5&&n<1&&(o=t/(2*(1-n))),[e[0],o*100,n*100]},u.hcg.hwb=function(e){const t=e[1]/100,r=e[2]/100,n=t+r*(1-t);return[e[0],(n-t)*100,(1-n)*100]},u.hwb.hcg=function(e){const t=e[1]/100,r=e[2]/100,n=1-r,o=n-t;let s=0;return o<1&&(s=(n-o)/(1-o)),[e[0],o*100,s*100]},u.apple.rgb=function(e){return[e[0]/65535*255,e[1]/65535*255,e[2]/65535*255]},u.rgb.apple=function(e){return[e[0]/255*65535,e[1]/255*65535,e[2]/255*65535]},u.gray.rgb=function(e){return[e[0]/100*255,e[0]/100*255,e[0]/100*255]},u.gray.hsl=function(e){return[0,0,e[0]]},u.gray.hsv=u.gray.hsl,u.gray.hwb=function(e){return[0,100,e[0]]},u.gray.cmyk=function(e){return[0,0,0,e[0]]},u.gray.lab=function(e){return[e[0],0,0]},u.gray.hex=function(e){const t=Math.round(e[0]/100*255)&255,n=((t<<16)+(t<<8)+t).toString(16).toUpperCase();return"000000".substring(n.length)+n},u.rgb.gray=function(e){return[(e[0]+e[1]+e[2])/3/255*100]};const M=z;function ve(){const e={},t=Object.keys(M);for(let r=t.length,n=0;n<r;n++)e[t[n]]={distance:-1,parent:null};return e}function ke(e){const t=ve(),r=[e];for(t[e].distance=0;r.length;){const n=r.pop(),o=Object.keys(M[n]);for(let s=o.length,i=0;i<s;i++){const l=o[i],c=t[l];c.distance===-1&&(c.distance=t[n].distance+1,c.parent=n,r.unshift(l))}}return t}function Ce(e,t){return function(r){return t(e(r))}}function Oe(e,t){const r=[t[e].parent,e];let n=M[t[e].parent][e],o=t[e].parent;for(;t[o].parent;)r.unshift(t[o].parent),n=Ce(M[t[o].parent][o],n),o=t[o].parent;return n.conversion=r,n}var xe=function(e){const t=ke(e),r={},n=Object.keys(t);for(let o=n.length,s=0;s<o;s++){const i=n[s];t[i].parent!==null&&(r[i]=Oe(i,t))}return r};const A=z,Ee=xe,k={},Me=Object.keys(A);function je(e){const t=function(...r){const n=r[0];return n==null?n:(n.length>1&&(r=n),e(r))};return"conversion"in e&&(t.conversion=e.conversion),t}function qe(e){const t=function(...r){const n=r[0];if(n==null)return n;n.length>1&&(r=n);const o=e(r);if(typeof o=="object")for(let s=o.length,i=0;i<s;i++)o[i]=Math.round(o[i]);return o};return"conversion"in e&&(t.conversion=e.conversion),t}Me.forEach(e=>{k[e]={},Object.defineProperty(k[e],"channels",{value:A[e].channels}),Object.defineProperty(k[e],"labels",{value:A[e].labels});const t=Ee(e);Object.keys(t).forEach(n=>{const o=t[n];k[e][n]=qe(o),k[e][n].raw=je(o)})});var Pe=k;(function(e){const t=(f,a)=>(...p)=>`\x1B[${f(...p)+a}m`,r=(f,a)=>(...p)=>{const g=f(...p);return`\x1B[${38+a};5;${g}m`},n=(f,a)=>(...p)=>{const g=f(...p);return`\x1B[${38+a};2;${g[0]};${g[1]};${g[2]}m`},o=f=>f,s=(f,a,p)=>[f,a,p],i=(f,a,p)=>{Object.defineProperty(f,a,{get:()=>{const g=p();return Object.defineProperty(f,a,{value:g,enumerable:!0,configurable:!0}),g},enumerable:!0,configurable:!0})};let l;const c=(f,a,p,g)=>{l===void 0&&(l=Pe);const O=g?10:0,v={};for(const[L,fe]of Object.entries(l)){const pe=L==="ansi16"?"ansi":L;L===a?v[pe]=f(p,O):typeof fe=="object"&&(v[pe]=f(fe[a],O))}return v};function h(){const f=new Map,a={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};a.color.gray=a.color.blackBright,a.bgColor.bgGray=a.bgColor.bgBlackBright,a.color.grey=a.color.blackBright,a.bgColor.bgGrey=a.bgColor.bgBlackBright;for(const[p,g]of Object.entries(a)){for(const[O,v]of Object.entries(g))a[O]={open:`\x1B[${v[0]}m`,close:`\x1B[${v[1]}m`},g[O]=a[O],f.set(v[0],v[1]);Object.defineProperty(a,p,{value:g,enumerable:!1})}return Object.defineProperty(a,"codes",{value:f,enumerable:!1}),a.color.close="\x1B[39m",a.bgColor.close="\x1B[49m",i(a.color,"ansi",()=>c(t,"ansi16",o,!1)),i(a.color,"ansi256",()=>c(r,"ansi256",o,!1)),i(a.color,"ansi16m",()=>c(n,"rgb",s,!1)),i(a.bgColor,"ansi",()=>c(t,"ansi16",o,!0)),i(a.bgColor,"ansi256",()=>c(r,"ansi256",o,!0)),i(a.bgColor,"ansi16m",()=>c(n,"rgb",s,!0)),a}Object.defineProperty(e,"exports",{enumerable:!0,get:h})})(b);var Se={stdout:!1,stderr:!1},$e={stringReplaceAll:(e,t,r)=>{let n=e.indexOf(t);if(n===-1)return e;const o=t.length;let s=0,i="";do i+=e.substr(s,n-s)+t+r,s=n+o,n=e.indexOf(t,s);while(n!==-1);return i+=e.substr(s),i},stringEncaseCRLFWithFirstIndex:(e,t,r,n)=>{let o=0,s="";do{const i=e[n-1]==="\r";s+=e.substr(o,(i?n-1:n)-o)+t+(i?`\r
1
+ var ot=Object.defineProperty,st=Object.defineProperties;var lt=Object.getOwnPropertyDescriptors;var ue=Object.getOwnPropertySymbols;var ct=Object.prototype.hasOwnProperty,it=Object.prototype.propertyIsEnumerable;var fe=(p,d,m)=>d in p?ot(p,d,{enumerable:!0,configurable:!0,writable:!0,value:m}):p[d]=m,he=(p,d)=>{for(var m in d||(d={}))ct.call(d,m)&&fe(p,m,d[m]);if(ue)for(var m of ue(d))it.call(d,m)&&fe(p,m,d[m]);return p},pe=(p,d)=>st(p,lt(d));(function(p,d){typeof exports=="object"&&typeof module<"u"?d(exports):typeof define=="function"&&define.amd?define(["exports"],d):(p=typeof globalThis<"u"?globalThis:p||self,d(p.JamComments={}))})(this,function(p){"use strict";const d=()=>{var e;return typeof process<"u"&&((e=process.env)==null?void 0:e.JAM_COMMENTS_BASE_URL)?process.env.JAM_COMMENTS_BASE_URL:"https://go.jamcomments.com"},m=e=>async({path:n,domain:r,apiKey:t})=>{const o=new URLSearchParams({path:n,domain:r,force_embed:"1"}),s=await fetch(`${d()}/api/markup?${o}`,{method:"GET",headers:{Authorization:`Bearer ${t}`,Accept:"application/json","X-Platform":e}});if(s.status===401)throw"Unauthorized! Are your domain and API key set correctly?";if(!s.ok)throw`Request failed! Status code: ${s.status}, message: ${s.statusText}`;return await s.text()};var T=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},G={exports:{}},ge={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};const M=ge,W={};for(const e of Object.keys(M))W[M[e]]=e;const u={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};var J=u;for(const e of Object.keys(u)){if(!("channels"in u[e]))throw new Error("missing channels property: "+e);if(!("labels"in u[e]))throw new Error("missing channel labels property: "+e);if(u[e].labels.length!==u[e].channels)throw new Error("channel and label counts mismatch: "+e);const{channels:n,labels:r}=u[e];delete u[e].channels,delete u[e].labels,Object.defineProperty(u[e],"channels",{value:n}),Object.defineProperty(u[e],"labels",{value:r})}u.rgb.hsl=function(e){const n=e[0]/255,r=e[1]/255,t=e[2]/255,o=Math.min(n,r,t),s=Math.max(n,r,t),l=s-o;let i,a;s===o?i=0:n===s?i=(r-t)/l:r===s?i=2+(t-n)/l:t===s&&(i=4+(n-r)/l),i=Math.min(i*60,360),i<0&&(i+=360);const f=(o+s)/2;return s===o?a=0:f<=.5?a=l/(s+o):a=l/(2-s-o),[i,a*100,f*100]},u.rgb.hsv=function(e){let n,r,t,o,s;const l=e[0]/255,i=e[1]/255,a=e[2]/255,f=Math.max(l,i,a),h=f-Math.min(l,i,a),c=function(g){return(f-g)/6/h+1/2};return h===0?(o=0,s=0):(s=h/f,n=c(l),r=c(i),t=c(a),l===f?o=t-r:i===f?o=1/3+n-t:a===f&&(o=2/3+r-n),o<0?o+=1:o>1&&(o-=1)),[o*360,s*100,f*100]},u.rgb.hwb=function(e){const n=e[0],r=e[1];let t=e[2];const o=u.rgb.hsl(e)[0],s=1/255*Math.min(n,Math.min(r,t));return t=1-1/255*Math.max(n,Math.max(r,t)),[o,s*100,t*100]},u.rgb.cmyk=function(e){const n=e[0]/255,r=e[1]/255,t=e[2]/255,o=Math.min(1-n,1-r,1-t),s=(1-n-o)/(1-o)||0,l=(1-r-o)/(1-o)||0,i=(1-t-o)/(1-o)||0;return[s*100,l*100,i*100,o*100]};function de(e,n){return(e[0]-n[0])**2+(e[1]-n[1])**2+(e[2]-n[2])**2}u.rgb.keyword=function(e){const n=W[e];if(n)return n;let r=1/0,t;for(const o of Object.keys(M)){const s=M[o],l=de(e,s);l<r&&(r=l,t=o)}return t},u.keyword.rgb=function(e){return M[e]},u.rgb.xyz=function(e){let n=e[0]/255,r=e[1]/255,t=e[2]/255;n=n>.04045?((n+.055)/1.055)**2.4:n/12.92,r=r>.04045?((r+.055)/1.055)**2.4:r/12.92,t=t>.04045?((t+.055)/1.055)**2.4:t/12.92;const o=n*.4124+r*.3576+t*.1805,s=n*.2126+r*.7152+t*.0722,l=n*.0193+r*.1192+t*.9505;return[o*100,s*100,l*100]},u.rgb.lab=function(e){const n=u.rgb.xyz(e);let r=n[0],t=n[1],o=n[2];r/=95.047,t/=100,o/=108.883,r=r>.008856?r**(1/3):7.787*r+16/116,t=t>.008856?t**(1/3):7.787*t+16/116,o=o>.008856?o**(1/3):7.787*o+16/116;const s=116*t-16,l=500*(r-t),i=200*(t-o);return[s,l,i]},u.hsl.rgb=function(e){const n=e[0]/360,r=e[1]/100,t=e[2]/100;let o,s,l;if(r===0)return l=t*255,[l,l,l];t<.5?o=t*(1+r):o=t+r-t*r;const i=2*t-o,a=[0,0,0];for(let f=0;f<3;f++)s=n+1/3*-(f-1),s<0&&s++,s>1&&s--,6*s<1?l=i+(o-i)*6*s:2*s<1?l=o:3*s<2?l=i+(o-i)*(2/3-s)*6:l=i,a[f]=l*255;return a},u.hsl.hsv=function(e){const n=e[0];let r=e[1]/100,t=e[2]/100,o=r;const s=Math.max(t,.01);t*=2,r*=t<=1?t:2-t,o*=s<=1?s:2-s;const l=(t+r)/2,i=t===0?2*o/(s+o):2*r/(t+r);return[n,i*100,l*100]},u.hsv.rgb=function(e){const n=e[0]/60,r=e[1]/100;let t=e[2]/100;const o=Math.floor(n)%6,s=n-Math.floor(n),l=255*t*(1-r),i=255*t*(1-r*s),a=255*t*(1-r*(1-s));switch(t*=255,o){case 0:return[t,a,l];case 1:return[i,t,l];case 2:return[l,t,a];case 3:return[l,i,t];case 4:return[a,l,t];case 5:return[t,l,i]}},u.hsv.hsl=function(e){const n=e[0],r=e[1]/100,t=e[2]/100,o=Math.max(t,.01);let s,l;l=(2-r)*t;const i=(2-r)*o;return s=r*o,s/=i<=1?i:2-i,s=s||0,l/=2,[n,s*100,l*100]},u.hwb.rgb=function(e){const n=e[0]/360;let r=e[1]/100,t=e[2]/100;const o=r+t;let s;o>1&&(r/=o,t/=o);const l=Math.floor(6*n),i=1-t;s=6*n-l,(l&1)!==0&&(s=1-s);const a=r+s*(i-r);let f,h,c;switch(l){default:case 6:case 0:f=i,h=a,c=r;break;case 1:f=a,h=i,c=r;break;case 2:f=r,h=i,c=a;break;case 3:f=r,h=a,c=i;break;case 4:f=a,h=r,c=i;break;case 5:f=i,h=r,c=a;break}return[f*255,h*255,c*255]},u.cmyk.rgb=function(e){const n=e[0]/100,r=e[1]/100,t=e[2]/100,o=e[3]/100,s=1-Math.min(1,n*(1-o)+o),l=1-Math.min(1,r*(1-o)+o),i=1-Math.min(1,t*(1-o)+o);return[s*255,l*255,i*255]},u.xyz.rgb=function(e){const n=e[0]/100,r=e[1]/100,t=e[2]/100;let o,s,l;return o=n*3.2406+r*-1.5372+t*-.4986,s=n*-.9689+r*1.8758+t*.0415,l=n*.0557+r*-.204+t*1.057,o=o>.0031308?1.055*o**(1/2.4)-.055:o*12.92,s=s>.0031308?1.055*s**(1/2.4)-.055:s*12.92,l=l>.0031308?1.055*l**(1/2.4)-.055:l*12.92,o=Math.min(Math.max(0,o),1),s=Math.min(Math.max(0,s),1),l=Math.min(Math.max(0,l),1),[o*255,s*255,l*255]},u.xyz.lab=function(e){let n=e[0],r=e[1],t=e[2];n/=95.047,r/=100,t/=108.883,n=n>.008856?n**(1/3):7.787*n+16/116,r=r>.008856?r**(1/3):7.787*r+16/116,t=t>.008856?t**(1/3):7.787*t+16/116;const o=116*r-16,s=500*(n-r),l=200*(r-t);return[o,s,l]},u.lab.xyz=function(e){const n=e[0],r=e[1],t=e[2];let o,s,l;s=(n+16)/116,o=r/500+s,l=s-t/200;const i=s**3,a=o**3,f=l**3;return s=i>.008856?i:(s-16/116)/7.787,o=a>.008856?a:(o-16/116)/7.787,l=f>.008856?f:(l-16/116)/7.787,o*=95.047,s*=100,l*=108.883,[o,s,l]},u.lab.lch=function(e){const n=e[0],r=e[1],t=e[2];let o;o=Math.atan2(t,r)*360/2/Math.PI,o<0&&(o+=360);const l=Math.sqrt(r*r+t*t);return[n,l,o]},u.lch.lab=function(e){const n=e[0],r=e[1],o=e[2]/360*2*Math.PI,s=r*Math.cos(o),l=r*Math.sin(o);return[n,s,l]},u.rgb.ansi16=function(e,n=null){const[r,t,o]=e;let s=n===null?u.rgb.hsv(e)[2]:n;if(s=Math.round(s/50),s===0)return 30;let l=30+(Math.round(o/255)<<2|Math.round(t/255)<<1|Math.round(r/255));return s===2&&(l+=60),l},u.hsv.ansi16=function(e){return u.rgb.ansi16(u.hsv.rgb(e),e[2])},u.rgb.ansi256=function(e){const n=e[0],r=e[1],t=e[2];return n===r&&r===t?n<8?16:n>248?231:Math.round((n-8)/247*24)+232:16+36*Math.round(n/255*5)+6*Math.round(r/255*5)+Math.round(t/255*5)},u.ansi16.rgb=function(e){let n=e%10;if(n===0||n===7)return e>50&&(n+=3.5),n=n/10.5*255,[n,n,n];const r=(~~(e>50)+1)*.5,t=(n&1)*r*255,o=(n>>1&1)*r*255,s=(n>>2&1)*r*255;return[t,o,s]},u.ansi256.rgb=function(e){if(e>=232){const s=(e-232)*10+8;return[s,s,s]}e-=16;let n;const r=Math.floor(e/36)/5*255,t=Math.floor((n=e%36)/6)/5*255,o=n%6/5*255;return[r,t,o]},u.rgb.hex=function(e){const r=(((Math.round(e[0])&255)<<16)+((Math.round(e[1])&255)<<8)+(Math.round(e[2])&255)).toString(16).toUpperCase();return"000000".substring(r.length)+r},u.hex.rgb=function(e){const n=e.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!n)return[0,0,0];let r=n[0];n[0].length===3&&(r=r.split("").map(i=>i+i).join(""));const t=parseInt(r,16),o=t>>16&255,s=t>>8&255,l=t&255;return[o,s,l]},u.rgb.hcg=function(e){const n=e[0]/255,r=e[1]/255,t=e[2]/255,o=Math.max(Math.max(n,r),t),s=Math.min(Math.min(n,r),t),l=o-s;let i,a;return l<1?i=s/(1-l):i=0,l<=0?a=0:o===n?a=(r-t)/l%6:o===r?a=2+(t-n)/l:a=4+(n-r)/l,a/=6,a%=1,[a*360,l*100,i*100]},u.hsl.hcg=function(e){const n=e[1]/100,r=e[2]/100,t=r<.5?2*n*r:2*n*(1-r);let o=0;return t<1&&(o=(r-.5*t)/(1-t)),[e[0],t*100,o*100]},u.hsv.hcg=function(e){const n=e[1]/100,r=e[2]/100,t=n*r;let o=0;return t<1&&(o=(r-t)/(1-t)),[e[0],t*100,o*100]},u.hcg.rgb=function(e){const n=e[0]/360,r=e[1]/100,t=e[2]/100;if(r===0)return[t*255,t*255,t*255];const o=[0,0,0],s=n%1*6,l=s%1,i=1-l;let a=0;switch(Math.floor(s)){case 0:o[0]=1,o[1]=l,o[2]=0;break;case 1:o[0]=i,o[1]=1,o[2]=0;break;case 2:o[0]=0,o[1]=1,o[2]=l;break;case 3:o[0]=0,o[1]=i,o[2]=1;break;case 4:o[0]=l,o[1]=0,o[2]=1;break;default:o[0]=1,o[1]=0,o[2]=i}return a=(1-r)*t,[(r*o[0]+a)*255,(r*o[1]+a)*255,(r*o[2]+a)*255]},u.hcg.hsv=function(e){const n=e[1]/100,r=e[2]/100,t=n+r*(1-n);let o=0;return t>0&&(o=n/t),[e[0],o*100,t*100]},u.hcg.hsl=function(e){const n=e[1]/100,t=e[2]/100*(1-n)+.5*n;let o=0;return t>0&&t<.5?o=n/(2*t):t>=.5&&t<1&&(o=n/(2*(1-t))),[e[0],o*100,t*100]},u.hcg.hwb=function(e){const n=e[1]/100,r=e[2]/100,t=n+r*(1-n);return[e[0],(t-n)*100,(1-t)*100]},u.hwb.hcg=function(e){const n=e[1]/100,r=e[2]/100,t=1-r,o=t-n;let s=0;return o<1&&(s=(t-o)/(1-o)),[e[0],o*100,s*100]},u.apple.rgb=function(e){return[e[0]/65535*255,e[1]/65535*255,e[2]/65535*255]},u.rgb.apple=function(e){return[e[0]/255*65535,e[1]/255*65535,e[2]/255*65535]},u.gray.rgb=function(e){return[e[0]/100*255,e[0]/100*255,e[0]/100*255]},u.gray.hsl=function(e){return[0,0,e[0]]},u.gray.hsv=u.gray.hsl,u.gray.hwb=function(e){return[0,100,e[0]]},u.gray.cmyk=function(e){return[0,0,0,e[0]]},u.gray.lab=function(e){return[e[0],0,0]},u.gray.hex=function(e){const n=Math.round(e[0]/100*255)&255,t=((n<<16)+(n<<8)+n).toString(16).toUpperCase();return"000000".substring(t.length)+t},u.rgb.gray=function(e){return[(e[0]+e[1]+e[2])/3/255*100]};const O=J;function be(){const e={},n=Object.keys(O);for(let r=n.length,t=0;t<r;t++)e[n[t]]={distance:-1,parent:null};return e}function me(e){const n=be(),r=[e];for(n[e].distance=0;r.length;){const t=r.pop(),o=Object.keys(O[t]);for(let s=o.length,l=0;l<s;l++){const i=o[l],a=n[i];a.distance===-1&&(a.distance=n[t].distance+1,a.parent=t,r.unshift(i))}}return n}function ye(e,n){return function(r){return n(e(r))}}function we(e,n){const r=[n[e].parent,e];let t=O[n[e].parent][e],o=n[e].parent;for(;n[o].parent;)r.unshift(n[o].parent),t=ye(O[n[o].parent][o],t),o=n[o].parent;return t.conversion=r,t}var ve=function(e){const n=me(e),r={},t=Object.keys(n);for(let o=t.length,s=0;s<o;s++){const l=t[s];n[l].parent!==null&&(r[l]=we(l,n))}return r};const A=J,ke=ve,k={},Ce=Object.keys(A);function xe(e){const n=function(...r){const t=r[0];return t==null?t:(t.length>1&&(r=t),e(r))};return"conversion"in e&&(n.conversion=e.conversion),n}function Me(e){const n=function(...r){const t=r[0];if(t==null)return t;t.length>1&&(r=t);const o=e(r);if(typeof o=="object")for(let s=o.length,l=0;l<s;l++)o[l]=Math.round(o[l]);return o};return"conversion"in e&&(n.conversion=e.conversion),n}Ce.forEach(e=>{k[e]={},Object.defineProperty(k[e],"channels",{value:A[e].channels}),Object.defineProperty(k[e],"labels",{value:A[e].labels});const n=ke(e);Object.keys(n).forEach(t=>{const o=n[t];k[e][t]=Me(o),k[e][t].raw=xe(o)})});var je=k;(function(e){const n=(h,c)=>(...g)=>`\x1B[${h(...g)+c}m`,r=(h,c)=>(...g)=>{const b=h(...g);return`\x1B[${38+c};5;${b}m`},t=(h,c)=>(...g)=>{const b=h(...g);return`\x1B[${38+c};2;${b[0]};${b[1]};${b[2]}m`},o=h=>h,s=(h,c,g)=>[h,c,g],l=(h,c,g)=>{Object.defineProperty(h,c,{get:()=>{const b=g();return Object.defineProperty(h,c,{value:b,enumerable:!0,configurable:!0}),b},enumerable:!0,configurable:!0})};let i;const a=(h,c,g,b)=>{i===void 0&&(i=je);const x=b?10:0,v={};for(const[L,ie]of Object.entries(i)){const ae=L==="ansi16"?"ansi":L;L===c?v[ae]=h(g,x):typeof ie=="object"&&(v[ae]=h(ie[c],x))}return v};function f(){const h=new Map,c={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};c.color.gray=c.color.blackBright,c.bgColor.bgGray=c.bgColor.bgBlackBright,c.color.grey=c.color.blackBright,c.bgColor.bgGrey=c.bgColor.bgBlackBright;for(const[g,b]of Object.entries(c)){for(const[x,v]of Object.entries(b))c[x]={open:`\x1B[${v[0]}m`,close:`\x1B[${v[1]}m`},b[x]=c[x],h.set(v[0],v[1]);Object.defineProperty(c,g,{value:b,enumerable:!1})}return Object.defineProperty(c,"codes",{value:h,enumerable:!1}),c.color.close="\x1B[39m",c.bgColor.close="\x1B[49m",l(c.color,"ansi",()=>a(n,"ansi16",o,!1)),l(c.color,"ansi256",()=>a(r,"ansi256",o,!1)),l(c.color,"ansi16m",()=>a(t,"rgb",s,!1)),l(c.bgColor,"ansi",()=>a(n,"ansi16",o,!0)),l(c.bgColor,"ansi256",()=>a(r,"ansi256",o,!0)),l(c.bgColor,"ansi16m",()=>a(t,"rgb",s,!0)),c}Object.defineProperty(e,"exports",{enumerable:!0,get:f})})(G);var Oe={stdout:!1,stderr:!1},Be={stringReplaceAll:(e,n,r)=>{let t=e.indexOf(n);if(t===-1)return e;const o=n.length;let s=0,l="";do l+=e.substr(s,t-s)+n+r,s=t+o,t=e.indexOf(n,s);while(t!==-1);return l+=e.substr(s),l},stringEncaseCRLFWithFirstIndex:(e,n,r,t)=>{let o=0,s="";do{const l=e[t-1]==="\r";s+=e.substr(o,(l?t-1:t)-o)+n+(l?`\r
2
2
  `:`
3
- `)+r,o=n+1,n=e.indexOf(`
4
- `,o)}while(n!==-1);return s+=e.substr(o),s}};const Ae=/(?:\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi,G=/(?:^|\.)(\w+)(?:\(([^)]*)\))?/g,Ie=/^(['"])((?:\\.|(?!\1)[^\\])*)\1$/,Be=/\\(u(?:[a-f\d]{4}|{[a-f\d]{1,6}})|x[a-f\d]{2}|.)|([^\\])/gi,_e=new Map([["n",`
5
- `],["r","\r"],["t"," "],["b","\b"],["f","\f"],["v","\v"],["0","\0"],["\\","\\"],["e","\x1B"],["a","\x07"]]);function V(e){const t=e[0]==="u",r=e[1]==="{";return t&&!r&&e.length===5||e[0]==="x"&&e.length===3?String.fromCharCode(parseInt(e.slice(1),16)):t&&r?String.fromCodePoint(parseInt(e.slice(2,-1),16)):_e.get(e)||e}function Re(e,t){const r=[],n=t.trim().split(/\s*,\s*/g);let o;for(const s of n){const i=Number(s);if(!Number.isNaN(i))r.push(i);else if(o=s.match(Ie))r.push(o[2].replace(Be,(l,c,h)=>c?V(c):h));else throw new Error(`Invalid Chalk template style argument: ${s} (in style '${e}')`)}return r}function Fe(e){G.lastIndex=0;const t=[];let r;for(;(r=G.exec(e))!==null;){const n=r[1];if(r[2]){const o=Re(n,r[2]);t.push([n].concat(o))}else t.push([n])}return t}function J(e,t){const r={};for(const o of t)for(const s of o.styles)r[s[0]]=o.inverse?null:s.slice(1);let n=e;for(const[o,s]of Object.entries(r))if(!!Array.isArray(s)){if(!(o in n))throw new Error(`Unknown Chalk style: ${o}`);n=s.length>0?n[o](...s):n[o]}return n}var Ne=(e,t)=>{const r=[],n=[];let o=[];if(t.replace(Ae,(s,i,l,c,h,f)=>{if(i)o.push(V(i));else if(c){const a=o.join("");o=[],n.push(r.length===0?a:J(e,r)(a)),r.push({inverse:l,styles:Fe(c)})}else if(h){if(r.length===0)throw new Error("Found extraneous } in Chalk template literal");n.push(J(e,r)(o.join(""))),o=[],r.pop()}else o.push(f)}),n.push(o.join("")),r.length>0){const s=`Chalk template literal is missing ${r.length} closing bracket${r.length===1?"":"s"} (\`}\`)`;throw new Error(s)}return n.join("")};const E=b.exports,{stdout:I,stderr:B}=Se,{stringReplaceAll:Ue,stringEncaseCRLFWithFirstIndex:De}=$e,{isArray:j}=Array,W=["ansi","ansi","ansi256","ansi16m"],C=Object.create(null),Le=(e,t={})=>{if(t.level&&!(Number.isInteger(t.level)&&t.level>=0&&t.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");const r=I?I.level:0;e.level=t.level===void 0?r:t.level};class Te{constructor(t){return H(t)}}const H=e=>{const t={};return Le(t,e),t.template=(...r)=>Y(t.template,...r),Object.setPrototypeOf(t,q.prototype),Object.setPrototypeOf(t.template,t),t.template.constructor=()=>{throw new Error("`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.")},t.template.Instance=Te,t.template};function q(e){return H(e)}for(const[e,t]of Object.entries(E))C[e]={get(){const r=P(this,_(t.open,t.close,this._styler),this._isEmpty);return Object.defineProperty(this,e,{value:r}),r}};C.visible={get(){const e=P(this,this._styler,!0);return Object.defineProperty(this,"visible",{value:e}),e}};const K=["rgb","hex","keyword","hsl","hsv","hwb","ansi","ansi256"];for(const e of K)C[e]={get(){const{level:t}=this;return function(...r){const n=_(E.color[W[t]][e](...r),E.color.close,this._styler);return P(this,n,this._isEmpty)}}};for(const e of K){const t="bg"+e[0].toUpperCase()+e.slice(1);C[t]={get(){const{level:r}=this;return function(...n){const o=_(E.bgColor[W[r]][e](...n),E.bgColor.close,this._styler);return P(this,o,this._isEmpty)}}}}const ze=Object.defineProperties(()=>{},be(ge({},C),{level:{enumerable:!0,get(){return this._generator.level},set(e){this._generator.level=e}}})),_=(e,t,r)=>{let n,o;return r===void 0?(n=e,o=t):(n=r.openAll+e,o=t+r.closeAll),{open:e,close:t,openAll:n,closeAll:o,parent:r}},P=(e,t,r)=>{const n=(...o)=>j(o[0])&&j(o[0].raw)?X(n,Y(n,...o)):X(n,o.length===1?""+o[0]:o.join(" "));return Object.setPrototypeOf(n,ze),n._generator=e,n._styler=t,n._isEmpty=r,n},X=(e,t)=>{if(e.level<=0||!t)return e._isEmpty?"":t;let r=e._styler;if(r===void 0)return t;const{openAll:n,closeAll:o}=r;if(t.indexOf("\x1B")!==-1)for(;r!==void 0;)t=Ue(t,r.close,r.open),r=r.parent;const s=t.indexOf(`
6
- `);return s!==-1&&(t=De(t,o,n,s)),n+t+o};let R;const Y=(e,...t)=>{const[r]=t;if(!j(r)||!j(r.raw))return t.join(" ");const n=t.slice(1),o=[r.raw[0]];for(let s=1;s<r.length;s++)o.push(String(n[s-1]).replace(/[{}\\]/g,"\\$&"),String(r.raw[s]));return R===void 0&&(R=Ne),R(e,o.join(""))};Object.defineProperties(q.prototype,C);const S=q();S.supportsColor=I,S.stderr=q({level:B?B.level:0}),S.stderr.supportsColor=B;var Ge=S,Q=e=>{console.log(`${Ge.magenta("JamComments:")} ${e}`)},Ve=()=>(typeof process<"u"&&process.env&&process.env.NODE_ENV&&process.env.NODE_ENV.toLowerCase())!=="production";const Je="https://service.jamcomments.com",Z="http://localhost:4000";var We=(e=null)=>typeof window<"u"&&window.jcForceLocal?Z:e||(process.env.NODE_ENV==="production"?Je:Z),He=Object.defineProperty,ee=Object.getOwnPropertySymbols,Ke=Object.prototype.hasOwnProperty,Xe=Object.prototype.propertyIsEnumerable,te=(e,t,r)=>t in e?He(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Ye=(e,t)=>{for(var r in t||(t={}))Ke.call(t,r)&&te(e,r,t[r]);if(ee)for(var r of ee(t))Xe.call(t,r)&&te(e,r,t[r]);return e};function Qe(e,t){const r=new URL(e);for(const n in t)r.searchParams.append(n,t[n]);return r.toString()}async function Ze({endpoint:e,fetchOptions:t,query:r,variables:n}){const o={query:r,variables:JSON.stringify(n)},{method:s="POST",headers:i={}}=t,l=/get/i.test(s),c=l?Qe(e,o):e;try{const h=await fetch(c,{method:s.toUpperCase(),headers:Ye({"Content-Type":`application/${l?"x-www-form-urlencoded":"json"}`},i),body:l?null:JSON.stringify(o)}),{data:f,errors:a}=await h.json(),p={data:f};return a&&(p.errors=a),p}catch(h){return{errors:[h]}}}function et({endpoint:e,method:t,headers:r}){return{send:async(o,s={})=>Ze({endpoint:e,query:o,variables:s,fetchOptions:{method:t,headers:r}})}}var ne=[{id:"1",name:"Joanne King",emailAddress:"joanne@example.com",content:"<blockquote>This is some random quote.</blockquote><p>That's good stuff! Thanks for posting.</p>",path:null,createdAt:"1620462061499",status:"approved"},{id:"2",name:"Jennyfer Abbott",emailAddress:"jennyfer@example.com",content:`Animi voluptatem quae quas eius et error id. Ipsum amet corporis. Non corrupti eum et vel harum ut mollitia rerum laborum. Sunt est id et. Beatae nobis sit id qui ut ducimus sapiente placeat. Minus atque rerum natus et. Libero velit corporis. Blanditiis enim aut enim est ex qui omnis nemo dolorem.
7
-
8
- Vel asperiores molestias qui accusamus est libero voluptas. Blanditiis doloremque sint qui facere voluptatum et possimus aliquid. Eos enim iste qui aliquid suscipit a. Et nemo rerum voluptatem quia. Accusantium non sunt velit et temporibus beatae numquam omnis magnam. Nulla facere exercitationem est fugiat incidunt architecto corporis beatae et. Modi error quod qui rem aut.`,path:null,createdAt:"1586054668000",status:"approved"},{id:"3",name:"Carmella Gutkowski",emailAddress:"carmella@example.com",content:"Dolores delectus qui id rem aut. Modi voluptate laborum dolorum suscipit optio eaque. Cum est non temporibus voluptas incidunt.",path:null,createdAt:"1578537868000",status:"approved"},{id:"4",name:"Coby Sawayn",emailAddress:"coby@example.com",content:"Occaecati necessitatibus assumenda quia. Quam esse voluptas necessitatibus tenetur similique deleniti voluptas. Est voluptas nobis. Necessitatibus eum repellendus et commodi quasi corrupti. Cupiditate tempore quasi labore.",path:null,createdAt:"1602254668000",status:"approved"},{id:"5",name:"Florence Wolf",emailAddress:"florence@example.com",content:"Possimus vitae adipisci dolorum adipisci quaerat ut itaque. Dolorem delectus pariatur maxime qui voluptatem.",path:null,createdAt:"1591713868000",status:"approved"}],tt=function(t,r){if(r=r.split(":")[0],t=+t,!t)return!1;switch(r){case"http":case"ws":return t!==80;case"https":case"wss":return t!==443;case"ftp":return t!==21;case"gopher":return t!==70;case"file":return!1}return t!==0},F={},nt=Object.prototype.hasOwnProperty,rt;function re(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch{return null}}function oe(e){try{return encodeURIComponent(e)}catch{return null}}function ot(e){for(var t=/([^=?#&]+)=?([^&]*)/g,r={},n;n=t.exec(e);){var o=re(n[1]),s=re(n[2]);o===null||s===null||o in r||(r[o]=s)}return r}function st(e,t){t=t||"";var r=[],n,o;typeof t!="string"&&(t="?");for(o in e)if(nt.call(e,o)){if(n=e[o],!n&&(n===null||n===rt||isNaN(n))&&(n=""),o=oe(o),n=oe(n),o===null||n===null)continue;r.push(o+"="+n)}return r.length?t+r.join("&"):""}F.stringify=st,F.parse=ot;var se=tt,$=F,it=/^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/,ie=/[\n\r\t]/g,at=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,ae=/:\d+$/,lt=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i,ct=/^[a-zA-Z]:/;function N(e){return(e||"").toString().replace(it,"")}var U=[["#","hash"],["?","query"],function(t,r){return y(r.protocol)?t.replace(/\\/g,"/"):t},["/","pathname"],["@","auth",1],[NaN,"host",void 0,1,1],[/:(\d*)$/,"port",void 0,1],[NaN,"hostname",void 0,1,1]],le={hash:1,query:1};function ce(e){var t;typeof window<"u"?t=window:typeof d<"u"?t=d:typeof self<"u"?t=self:t={};var r=t.location||{};e=e||r;var n={},o=typeof e,s;if(e.protocol==="blob:")n=new w(unescape(e.pathname),{});else if(o==="string"){n=new w(e,{});for(s in le)delete n[s]}else if(o==="object"){for(s in e)s in le||(n[s]=e[s]);n.slashes===void 0&&(n.slashes=at.test(e.href))}return n}function y(e){return e==="file:"||e==="ftp:"||e==="http:"||e==="https:"||e==="ws:"||e==="wss:"}function ue(e,t){e=N(e),e=e.replace(ie,""),t=t||{};var r=lt.exec(e),n=r[1]?r[1].toLowerCase():"",o=!!r[2],s=!!r[3],i=0,l;return o?s?(l=r[2]+r[3]+r[4],i=r[2].length+r[3].length):(l=r[2]+r[4],i=r[2].length):s?(l=r[3]+r[4],i=r[3].length):l=r[4],n==="file:"?i>=2&&(l=l.slice(2)):y(n)?l=r[4]:n?o&&(l=l.slice(2)):i>=2&&y(t.protocol)&&(l=r[4]),{protocol:n,slashes:o||y(n),slashesCount:i,rest:l}}function ut(e,t){if(e==="")return t;for(var r=(t||"/").split("/").slice(0,-1).concat(e.split("/")),n=r.length,o=r[n-1],s=!1,i=0;n--;)r[n]==="."?r.splice(n,1):r[n]===".."?(r.splice(n,1),i++):i&&(n===0&&(s=!0),r.splice(n,1),i--);return s&&r.unshift(""),(o==="."||o==="..")&&r.push(""),r.join("/")}function w(e,t,r){if(e=N(e),e=e.replace(ie,""),!(this instanceof w))return new w(e,t,r);var n,o,s,i,l,c,h=U.slice(),f=typeof t,a=this,p=0;for(f!=="object"&&f!=="string"&&(r=t,t=null),r&&typeof r!="function"&&(r=$.parse),t=ce(t),o=ue(e||"",t),n=!o.protocol&&!o.slashes,a.slashes=o.slashes||n&&t.slashes,a.protocol=o.protocol||t.protocol||"",e=o.rest,(o.protocol==="file:"&&(o.slashesCount!==2||ct.test(e))||!o.slashes&&(o.protocol||o.slashesCount<2||!y(a.protocol)))&&(h[3]=[/(.*)/,"pathname"]);p<h.length;p++){if(i=h[p],typeof i=="function"){e=i(e,a);continue}s=i[0],c=i[1],s!==s?a[c]=e:typeof s=="string"?(l=s==="@"?e.lastIndexOf(s):e.indexOf(s),~l&&(typeof i[2]=="number"?(a[c]=e.slice(0,l),e=e.slice(l+i[2])):(a[c]=e.slice(l),e=e.slice(0,l)))):(l=s.exec(e))&&(a[c]=l[1],e=e.slice(0,l.index)),a[c]=a[c]||n&&i[3]&&t[c]||"",i[4]&&(a[c]=a[c].toLowerCase())}r&&(a.query=r(a.query)),n&&t.slashes&&a.pathname.charAt(0)!=="/"&&(a.pathname!==""||t.pathname!=="")&&(a.pathname=ut(a.pathname,t.pathname)),a.pathname.charAt(0)!=="/"&&y(a.protocol)&&(a.pathname="/"+a.pathname),se(a.port,a.protocol)||(a.host=a.hostname,a.port=""),a.username=a.password="",a.auth&&(l=a.auth.indexOf(":"),~l?(a.username=a.auth.slice(0,l),a.username=encodeURIComponent(decodeURIComponent(a.username)),a.password=a.auth.slice(l+1),a.password=encodeURIComponent(decodeURIComponent(a.password))):a.username=encodeURIComponent(decodeURIComponent(a.auth)),a.auth=a.password?a.username+":"+a.password:a.username),a.origin=a.protocol!=="file:"&&y(a.protocol)&&a.host?a.protocol+"//"+a.host:"null",a.href=a.toString()}function ht(e,t,r){var n=this;switch(e){case"query":typeof t=="string"&&t.length&&(t=(r||$.parse)(t)),n[e]=t;break;case"port":n[e]=t,se(t,n.protocol)?t&&(n.host=n.hostname+":"+t):(n.host=n.hostname,n[e]="");break;case"hostname":n[e]=t,n.port&&(t+=":"+n.port),n.host=t;break;case"host":n[e]=t,ae.test(t)?(t=t.split(":"),n.port=t.pop(),n.hostname=t.join(":")):(n.hostname=t,n.port="");break;case"protocol":n.protocol=t.toLowerCase(),n.slashes=!r;break;case"pathname":case"hash":if(t){var o=e==="pathname"?"/":"#";n[e]=t.charAt(0)!==o?o+t:t}else n[e]=t;break;case"username":case"password":n[e]=encodeURIComponent(t);break;case"auth":var s=t.indexOf(":");~s?(n.username=t.slice(0,s),n.username=encodeURIComponent(decodeURIComponent(n.username)),n.password=t.slice(s+1),n.password=encodeURIComponent(decodeURIComponent(n.password))):n.username=encodeURIComponent(decodeURIComponent(t))}for(var i=0;i<U.length;i++){var l=U[i];l[4]&&(n[l[1]]=n[l[1]].toLowerCase())}return n.auth=n.password?n.username+":"+n.password:n.username,n.origin=n.protocol!=="file:"&&y(n.protocol)&&n.host?n.protocol+"//"+n.host:"null",n.href=n.toString(),n}function ft(e){(!e||typeof e!="function")&&(e=$.stringify);var t,r=this,n=r.host,o=r.protocol;o&&o.charAt(o.length-1)!==":"&&(o+=":");var s=o+(r.protocol&&r.slashes||y(r.protocol)?"//":"");return r.username?(s+=r.username,r.password&&(s+=":"+r.password),s+="@"):r.password?(s+=":"+r.password,s+="@"):r.protocol!=="file:"&&y(r.protocol)&&!n&&r.pathname!=="/"&&(s+="@"),(n[n.length-1]===":"||ae.test(r.hostname)&&!r.port)&&(n+=":"),s+=n+r.pathname,t=typeof r.query=="object"?e(r.query):r.query,t&&(s+=t.charAt(0)!=="?"?"?"+t:t),r.hash&&(s+=r.hash),s}w.prototype={set:ht,toString:ft},w.extractProtocol=ue,w.location=ce,w.trimLeft=N,w.qs=$;var pt=w;const D=e=>(new pt(e).pathname||"").replace(/^(\/{1,})|\/{1,}$/g,""),mt=(e,t)=>{const r=D(t);return e.filter(n=>n.path?D(n.path)===r:!1)},he=e=>/(^<[a-z]+>)(.*)(<\/[a-z]+>)$/.test(e)?e:e.split(/(?:\r\n|\r|\n)/).filter(t=>!!t).map(t=>`<p>${t.trim()}</p>`).join(""),dt=50,gt=`
9
- fragment commentFields on Comment {
10
- createdAt
11
- name
12
- content
13
- path
14
- id
15
- }
16
-
17
- query Comments($domain: String!, $status: String, $skip: Int, $perPage: Int, $path: String){
18
- comments(domain: $domain, status: $status, skip: $skip, perPage: $perPage, path: $path) {
19
- items {
20
- ...commentFields
21
- children {
22
- ...commentFields
23
- }
24
- }
25
- meta {
26
- hasMore
27
- }
28
- }
29
- }`;class bt{constructor({domain:t,apiKey:r,isDev:n=Ve()}){this.isDev=n,this.domain=t,this.client=et({endpoint:`${We()}/graphql`,headers:{"x-api-key":r}})}async _getBatchOfComments({skip:t=0,path:r=""}){const{data:n,errors:o}=await this.client.send(gt,{domain:this.domain,status:"approved",perPage:dt,path:r,skip:t});if(!n&&o&&o.length)throw new Error(`Something went wrong with JamComments! Here's the error:
30
-
31
- ${JSON.stringify(o)}`);const{items:s,meta:i}=n.comments;if(o&&o.length)throw new Error(o[0].message);return Q(`Fetched a batch of ${s.length} comments.`),{comments:s,hasMore:i.hasMore}}_prepareDummyComments(){const t=ne.map(r=>r.createdAt).sort().reverse();return ne.map((r,n)=>(r.createdAt=t[n],delete r.emailAddress,r))}_prepareContent(t){return t.map(r=>(r.content=he(r.content),r))}async getAllComments(t=""){if(this.isDev)return this._prepareContent(this._prepareDummyComments());let r=[],n=0,o=!1;do{const s=await this._getBatchOfComments({skip:n,path:t});o=s.hasMore,n=n+s.comments.length,r=[...r,...s.comments]}while(o);return this._prepareContent(r)}}var yt=bt;m.CommentFetcher=yt,m.filterByUrl=mt,m.log=Q,m.makeHtmlReady=he,m.parsePath=D,Object.defineProperties(m,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
3
+ `)+r,o=t+1,t=e.indexOf(`
4
+ `,o)}while(t!==-1);return s+=e.substr(o),s}};const Ee=/(?:\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi,X=/(?:^|\.)(\w+)(?:\(([^)]*)\))?/g,$e=/^(['"])((?:\\.|(?!\1)[^\\])*)\1$/,Re=/\\(u(?:[a-f\d]{4}|{[a-f\d]{1,6}})|x[a-f\d]{2}|.)|([^\\])/gi,Se=new Map([["n",`
5
+ `],["r","\r"],["t"," "],["b","\b"],["f","\f"],["v","\v"],["0","\0"],["\\","\\"],["e","\x1B"],["a","\x07"]]);function D(e){const n=e[0]==="u",r=e[1]==="{";return n&&!r&&e.length===5||e[0]==="x"&&e.length===3?String.fromCharCode(parseInt(e.slice(1),16)):n&&r?String.fromCodePoint(parseInt(e.slice(2,-1),16)):Se.get(e)||e}function Ae(e,n){const r=[],t=n.trim().split(/\s*,\s*/g);let o;for(const s of t){const l=Number(s);if(!Number.isNaN(l))r.push(l);else if(o=s.match($e))r.push(o[2].replace(Re,(i,a,f)=>a?D(a):f));else throw new Error(`Invalid Chalk template style argument: ${s} (in style '${e}')`)}return r}function Pe(e){X.lastIndex=0;const n=[];let r;for(;(r=X.exec(e))!==null;){const t=r[1];if(r[2]){const o=Ae(t,r[2]);n.push([t].concat(o))}else n.push([t])}return n}function H(e,n){const r={};for(const o of n)for(const s of o.styles)r[s[0]]=o.inverse?null:s.slice(1);let t=e;for(const[o,s]of Object.entries(r))if(!!Array.isArray(s)){if(!(o in t))throw new Error(`Unknown Chalk style: ${o}`);t=s.length>0?t[o](...s):t[o]}return t}var Ie=(e,n)=>{const r=[],t=[];let o=[];if(n.replace(Ee,(s,l,i,a,f,h)=>{if(l)o.push(D(l));else if(a){const c=o.join("");o=[],t.push(r.length===0?c:H(e,r)(c)),r.push({inverse:i,styles:Pe(a)})}else if(f){if(r.length===0)throw new Error("Found extraneous } in Chalk template literal");t.push(H(e,r)(o.join(""))),o=[],r.pop()}else o.push(h)}),t.push(o.join("")),r.length>0){const s=`Chalk template literal is missing ${r.length} closing bracket${r.length===1?"":"s"} (\`}\`)`;throw new Error(s)}return t.join("")};const j=G.exports,{stdout:P,stderr:I}=Oe,{stringReplaceAll:qe,stringEncaseCRLFWithFirstIndex:Fe}=Be,{isArray:B}=Array,K=["ansi","ansi","ansi256","ansi16m"],C=Object.create(null),Ue=(e,n={})=>{if(n.level&&!(Number.isInteger(n.level)&&n.level>=0&&n.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");const r=P?P.level:0;e.level=n.level===void 0?r:n.level};class _e{constructor(n){return V(n)}}const V=e=>{const n={};return Ue(n,e),n.template=(...r)=>Q(n.template,...r),Object.setPrototypeOf(n,E.prototype),Object.setPrototypeOf(n.template,n),n.template.constructor=()=>{throw new Error("`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.")},n.template.Instance=_e,n.template};function E(e){return V(e)}for(const[e,n]of Object.entries(j))C[e]={get(){const r=$(this,q(n.open,n.close,this._styler),this._isEmpty);return Object.defineProperty(this,e,{value:r}),r}};C.visible={get(){const e=$(this,this._styler,!0);return Object.defineProperty(this,"visible",{value:e}),e}};const Y=["rgb","hex","keyword","hsl","hsv","hwb","ansi","ansi256"];for(const e of Y)C[e]={get(){const{level:n}=this;return function(...r){const t=q(j.color[K[n]][e](...r),j.color.close,this._styler);return $(this,t,this._isEmpty)}}};for(const e of Y){const n="bg"+e[0].toUpperCase()+e.slice(1);C[n]={get(){const{level:r}=this;return function(...t){const o=q(j.bgColor[K[r]][e](...t),j.bgColor.close,this._styler);return $(this,o,this._isEmpty)}}}}const ze=Object.defineProperties(()=>{},pe(he({},C),{level:{enumerable:!0,get(){return this._generator.level},set(e){this._generator.level=e}}})),q=(e,n,r)=>{let t,o;return r===void 0?(t=e,o=n):(t=r.openAll+e,o=n+r.closeAll),{open:e,close:n,openAll:t,closeAll:o,parent:r}},$=(e,n,r)=>{const t=(...o)=>B(o[0])&&B(o[0].raw)?Z(t,Q(t,...o)):Z(t,o.length===1?""+o[0]:o.join(" "));return Object.setPrototypeOf(t,ze),t._generator=e,t._styler=n,t._isEmpty=r,t},Z=(e,n)=>{if(e.level<=0||!n)return e._isEmpty?"":n;let r=e._styler;if(r===void 0)return n;const{openAll:t,closeAll:o}=r;if(n.indexOf("\x1B")!==-1)for(;r!==void 0;)n=qe(n,r.close,r.open),r=r.parent;const s=n.indexOf(`
6
+ `);return s!==-1&&(n=Fe(n,o,t,s)),t+n+o};let F;const Q=(e,...n)=>{const[r]=n;if(!B(r)||!B(r.raw))return n.join(" ");const t=n.slice(1),o=[r.raw[0]];for(let s=1;s<r.length;s++)o.push(String(t[s-1]).replace(/[{}\\]/g,"\\$&"),String(r.raw[s]));return F===void 0&&(F=Ie),F(e,o.join(""))};Object.defineProperties(E.prototype,C);const R=E();R.supportsColor=P,R.stderr=E({level:I?I.level:0}),R.stderr.supportsColor=I;var Ne=R;const Le=e=>{console.log(`${Ne.magenta("JamComments:")} ${e}`)},Te=e=>{console.error(`JamComments: ${e}`)};var Ge=function(n,r){if(r=r.split(":")[0],n=+n,!n)return!1;switch(r){case"http":case"ws":return n!==80;case"https":case"wss":return n!==443;case"ftp":return n!==21;case"gopher":return n!==70;case"file":return!1}return n!==0},U={},We=Object.prototype.hasOwnProperty,Je;function ee(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch{return null}}function te(e){try{return encodeURIComponent(e)}catch{return null}}function Xe(e){for(var n=/([^=?#&]+)=?([^&]*)/g,r={},t;t=n.exec(e);){var o=ee(t[1]),s=ee(t[2]);o===null||s===null||o in r||(r[o]=s)}return r}function De(e,n){n=n||"";var r=[],t,o;typeof n!="string"&&(n="?");for(o in e)if(We.call(e,o)){if(t=e[o],!t&&(t===null||t===Je||isNaN(t))&&(t=""),o=te(o),t=te(t),o===null||t===null)continue;r.push(o+"="+t)}return r.length?n+r.join("&"):""}U.stringify=De,U.parse=Xe;var ne=Ge,S=U,He=/^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/,re=/[\n\r\t]/g,Ke=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,oe=/:\d+$/,Ve=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i,Ye=/^[a-zA-Z]:/;function _(e){return(e||"").toString().replace(He,"")}var z=[["#","hash"],["?","query"],function(n,r){return y(r.protocol)?n.replace(/\\/g,"/"):n},["/","pathname"],["@","auth",1],[NaN,"host",void 0,1,1],[/:(\d*)$/,"port",void 0,1],[NaN,"hostname",void 0,1,1]],se={hash:1,query:1};function le(e){var n;typeof window<"u"?n=window:typeof T<"u"?n=T:typeof self<"u"?n=self:n={};var r=n.location||{};e=e||r;var t={},o=typeof e,s;if(e.protocol==="blob:")t=new w(unescape(e.pathname),{});else if(o==="string"){t=new w(e,{});for(s in se)delete t[s]}else if(o==="object"){for(s in e)s in se||(t[s]=e[s]);t.slashes===void 0&&(t.slashes=Ke.test(e.href))}return t}function y(e){return e==="file:"||e==="ftp:"||e==="http:"||e==="https:"||e==="ws:"||e==="wss:"}function ce(e,n){e=_(e),e=e.replace(re,""),n=n||{};var r=Ve.exec(e),t=r[1]?r[1].toLowerCase():"",o=!!r[2],s=!!r[3],l=0,i;return o?s?(i=r[2]+r[3]+r[4],l=r[2].length+r[3].length):(i=r[2]+r[4],l=r[2].length):s?(i=r[3]+r[4],l=r[3].length):i=r[4],t==="file:"?l>=2&&(i=i.slice(2)):y(t)?i=r[4]:t?o&&(i=i.slice(2)):l>=2&&y(n.protocol)&&(i=r[4]),{protocol:t,slashes:o||y(t),slashesCount:l,rest:i}}function Ze(e,n){if(e==="")return n;for(var r=(n||"/").split("/").slice(0,-1).concat(e.split("/")),t=r.length,o=r[t-1],s=!1,l=0;t--;)r[t]==="."?r.splice(t,1):r[t]===".."?(r.splice(t,1),l++):l&&(t===0&&(s=!0),r.splice(t,1),l--);return s&&r.unshift(""),(o==="."||o==="..")&&r.push(""),r.join("/")}function w(e,n,r){if(e=_(e),e=e.replace(re,""),!(this instanceof w))return new w(e,n,r);var t,o,s,l,i,a,f=z.slice(),h=typeof n,c=this,g=0;for(h!=="object"&&h!=="string"&&(r=n,n=null),r&&typeof r!="function"&&(r=S.parse),n=le(n),o=ce(e||"",n),t=!o.protocol&&!o.slashes,c.slashes=o.slashes||t&&n.slashes,c.protocol=o.protocol||n.protocol||"",e=o.rest,(o.protocol==="file:"&&(o.slashesCount!==2||Ye.test(e))||!o.slashes&&(o.protocol||o.slashesCount<2||!y(c.protocol)))&&(f[3]=[/(.*)/,"pathname"]);g<f.length;g++){if(l=f[g],typeof l=="function"){e=l(e,c);continue}s=l[0],a=l[1],s!==s?c[a]=e:typeof s=="string"?(i=s==="@"?e.lastIndexOf(s):e.indexOf(s),~i&&(typeof l[2]=="number"?(c[a]=e.slice(0,i),e=e.slice(i+l[2])):(c[a]=e.slice(i),e=e.slice(0,i)))):(i=s.exec(e))&&(c[a]=i[1],e=e.slice(0,i.index)),c[a]=c[a]||t&&l[3]&&n[a]||"",l[4]&&(c[a]=c[a].toLowerCase())}r&&(c.query=r(c.query)),t&&n.slashes&&c.pathname.charAt(0)!=="/"&&(c.pathname!==""||n.pathname!=="")&&(c.pathname=Ze(c.pathname,n.pathname)),c.pathname.charAt(0)!=="/"&&y(c.protocol)&&(c.pathname="/"+c.pathname),ne(c.port,c.protocol)||(c.host=c.hostname,c.port=""),c.username=c.password="",c.auth&&(i=c.auth.indexOf(":"),~i?(c.username=c.auth.slice(0,i),c.username=encodeURIComponent(decodeURIComponent(c.username)),c.password=c.auth.slice(i+1),c.password=encodeURIComponent(decodeURIComponent(c.password))):c.username=encodeURIComponent(decodeURIComponent(c.auth)),c.auth=c.password?c.username+":"+c.password:c.username),c.origin=c.protocol!=="file:"&&y(c.protocol)&&c.host?c.protocol+"//"+c.host:"null",c.href=c.toString()}function Qe(e,n,r){var t=this;switch(e){case"query":typeof n=="string"&&n.length&&(n=(r||S.parse)(n)),t[e]=n;break;case"port":t[e]=n,ne(n,t.protocol)?n&&(t.host=t.hostname+":"+n):(t.host=t.hostname,t[e]="");break;case"hostname":t[e]=n,t.port&&(n+=":"+t.port),t.host=n;break;case"host":t[e]=n,oe.test(n)?(n=n.split(":"),t.port=n.pop(),t.hostname=n.join(":")):(t.hostname=n,t.port="");break;case"protocol":t.protocol=n.toLowerCase(),t.slashes=!r;break;case"pathname":case"hash":if(n){var o=e==="pathname"?"/":"#";t[e]=n.charAt(0)!==o?o+n:n}else t[e]=n;break;case"username":case"password":t[e]=encodeURIComponent(n);break;case"auth":var s=n.indexOf(":");~s?(t.username=n.slice(0,s),t.username=encodeURIComponent(decodeURIComponent(t.username)),t.password=n.slice(s+1),t.password=encodeURIComponent(decodeURIComponent(t.password))):t.username=encodeURIComponent(decodeURIComponent(n))}for(var l=0;l<z.length;l++){var i=z[l];i[4]&&(t[i[1]]=t[i[1]].toLowerCase())}return t.auth=t.password?t.username+":"+t.password:t.username,t.origin=t.protocol!=="file:"&&y(t.protocol)&&t.host?t.protocol+"//"+t.host:"null",t.href=t.toString(),t}function et(e){(!e||typeof e!="function")&&(e=S.stringify);var n,r=this,t=r.host,o=r.protocol;o&&o.charAt(o.length-1)!==":"&&(o+=":");var s=o+(r.protocol&&r.slashes||y(r.protocol)?"//":"");return r.username?(s+=r.username,r.password&&(s+=":"+r.password),s+="@"):r.password?(s+=":"+r.password,s+="@"):r.protocol!=="file:"&&y(r.protocol)&&!t&&r.pathname!=="/"&&(s+="@"),(t[t.length-1]===":"||oe.test(r.hostname)&&!r.port)&&(t+=":"),s+=t+r.pathname,n=typeof r.query=="object"?e(r.query):r.query,n&&(s+=n.charAt(0)!=="?"?"?"+n:n),r.hash&&(s+=r.hash),s}w.prototype={set:Qe,toString:et},w.extractProtocol=ce,w.location=le,w.trimLeft=_,w.qs=S;var tt=w;const N=e=>(new tt(e).pathname||"").replace(/^(\/{1,})|\/{1,}$/g,""),nt=(e,n)=>{const r=N(n);return e.filter(t=>t.path?N(t.path)===r:!1)},rt=e=>/(^<[a-z]+>)(.*)(<\/[a-z]+>)$/.test(e)?e:e.split(/(?:\r\n|\r|\n)/).filter(n=>!!n).map(n=>`<p>${n.trim()}</p>`).join("");p.filterByUrl=nt,p.log=Le,p.logError=Te,p.makeHtmlReady=rt,p.markupFetcher=m,p.parsePath=N,Object.defineProperties(p,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
package/dist/log.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- declare const log: (message: any) => void;
2
- export default log;
1
+ export declare const log: (message: string) => void;
2
+ export declare const logError: (message: string) => void;
@@ -0,0 +1 @@
1
+ export declare const markupFetcher: (platform: string) => Function;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jam-comments/server-utilities",
3
- "version": "0.0.2",
3
+ "version": "1.0.0",
4
4
  "description": "Various JavaScript utilities for JamComments.",
5
5
  "main": "dist/index.umd.js",
6
6
  "module": "dist/index.es.js",
@@ -16,7 +16,8 @@
16
16
  "watch": "npm run build -- --watch",
17
17
  "build": "vite build && tsc",
18
18
  "test": "jest --config ./jest.config.js",
19
- "prettify": "prettier ./**/*.{js,md,ts} --write"
19
+ "prettify": "prettier ./**/*.{js,md,ts} --write",
20
+ "prepare": "npm run build"
20
21
  },
21
22
  "keywords": [],
22
23
  "author": "Alex MacArthur <alex@macarthur.me> (https://macarthur.me)",
@@ -1,40 +0,0 @@
1
- declare class CommentFetcher {
2
- isDev: any;
3
- domain: any;
4
- client: any;
5
- constructor({ domain, apiKey, isDev }: {
6
- domain: any;
7
- apiKey: any;
8
- isDev?: boolean;
9
- });
10
- /**
11
- * Retrieve a batch of comments.
12
- *
13
- * @param {number} skip
14
- * @returns {object}
15
- */
16
- _getBatchOfComments({ skip, path }: {
17
- skip?: number;
18
- path?: string;
19
- }): Promise<{
20
- comments: any[];
21
- hasMore: boolean;
22
- }>;
23
- _prepareDummyComments(): {
24
- id: string;
25
- name: string;
26
- emailAddress: string;
27
- content: string;
28
- path: any;
29
- createdAt: string;
30
- status: string;
31
- }[];
32
- _prepareContent(comments: any[]): any[];
33
- /**
34
- * Get all the comments until there are no more remaining.
35
- *
36
- * @returns Promise<array>
37
- */
38
- getAllComments(path?: string): Promise<any[]>;
39
- }
40
- export default CommentFetcher;