@inkandswitch/patchwork-pkg-base 0.0.101 → 0.0.103

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 (94) hide show
  1. package/module-settings-url +1 -1
  2. package/package.json +1 -1
  3. package/packages/account/dist/{AccountPicker-A2PAS5CG.js → AccountPicker-DCX77HQI.js} +7 -3
  4. package/packages/account/dist/AccountPicker-DCX77HQI.js.map +7 -0
  5. package/packages/account/dist/index.css +70 -34
  6. package/packages/account/dist/index.css.map +2 -2
  7. package/packages/account/dist/index.js +1 -1
  8. package/packages/account-history/dist/assets/HistoryRecorder-_3PrVW6n.js +1 -1
  9. package/packages/account-history/dist/assets/HistoryViewer-BmG0rAfK.js +1 -1
  10. package/packages/account-history/dist/assets/NotebookViewer-DZ_ZQU5x.js +37 -37
  11. package/packages/add-doc-to-sidebar-button/styles.css +2 -2
  12. package/packages/chat/dist/{ChatRoot-BYmq4SXi.js → ChatRoot-1d-658Rr.js} +2 -2
  13. package/packages/chat/dist/{context-tool-Bob-FZ_T.js → context-tool-iP64Oz6H.js} +2 -2
  14. package/packages/chat/dist/{index-wkaHcVCz.js → index-Dm_2jZcu.js} +3 -3
  15. package/packages/chat/dist/index.js +2 -2
  16. package/packages/chat/dist/{tool-DCOdh_fx.js → tool-BmNd5mrj.js} +1 -1
  17. package/packages/codemirror-base/dist/{chunk-QRT4ZVQ4.js → chunk-A2WBDY3J.js} +5 -5
  18. package/packages/codemirror-base/dist/{chunk-QRT4ZVQ4.js.map → chunk-A2WBDY3J.js.map} +1 -1
  19. package/packages/codemirror-base/dist/lib/codemirror.js +1 -1
  20. package/packages/codemirror-base/dist/tool.js +3 -3
  21. package/packages/codemirror-base/dist/tool.js.map +1 -1
  22. package/packages/codemirror-markdown/dist/extensions/embed.js +1 -1
  23. package/packages/codemirror-markdown/dist/extensions/embed.js.map +1 -1
  24. package/packages/codemirror-markdown/dist/extensions/links.js +1 -1
  25. package/packages/codemirror-markdown/dist/extensions/links.js.map +1 -1
  26. package/packages/codemirror-markdown/dist/extensions/markdown.js +6 -6
  27. package/packages/codemirror-markdown/dist/extensions/markdown.js.map +1 -1
  28. package/packages/commands/dist/main.js +1 -1
  29. package/packages/commands/dist/main.js.map +1 -1
  30. package/packages/comments-view/dist/assets/main-wSSvAVfi.js +1 -1
  31. package/packages/doc-openwith/doc-openwith.js +5 -5
  32. package/packages/doc-presence/doc-presence.js +1 -1
  33. package/packages/drafts/dist/assets/main-CG9HOCai.js +31 -31
  34. package/packages/embed/dist/assets/tool-D58NGTZ7.js +1 -1
  35. package/packages/file/dist/index.js +2 -2
  36. package/packages/file/dist/{new-file-tool-DGKllnzw.js → new-file-tool-BolBDUrL.js} +27 -27
  37. package/packages/file/dist/new-file-tool-BolBDUrL.js.map +1 -0
  38. package/packages/file/dist/{tool-UKWDK93W.js → tool-Bt8I8T2-.js} +4 -4
  39. package/packages/file/dist/tool-Bt8I8T2-.js.map +1 -0
  40. package/packages/file/dist/{typescript-language-server-BgBx0vSF.js → typescript-language-server-Db4173Y5.js} +2 -2
  41. package/packages/file/dist/{typescript-language-server-BgBx0vSF.js.map → typescript-language-server-Db4173Y5.js.map} +1 -1
  42. package/packages/folder/dist/index.js +1 -1
  43. package/packages/folder/dist/{tool-WAWTPB4A.js → tool-5E3YPGES.js} +2 -2
  44. package/packages/folder/dist/{tool-WAWTPB4A.js.map → tool-5E3YPGES.js.map} +1 -1
  45. package/packages/history-view/dist/assets/{HistoryTimeline-COYNGORP.js → HistoryTimeline-Bo-BTf2A.js} +6 -6
  46. package/packages/history-view/dist/assets/{HistoryTimeline-COYNGORP.js.map → HistoryTimeline-Bo-BTf2A.js.map} +1 -1
  47. package/packages/history-view/dist/assets/{index-C1gYt7m5.js → index-B5Afrk9Y.js} +2 -2
  48. package/packages/history-view/dist/assets/{index-C1gYt7m5.js.map → index-B5Afrk9Y.js.map} +1 -1
  49. package/packages/history-view/dist/index.js +1 -1
  50. package/packages/llm-host/dist/{LlmConfigTray-DdZHZT4F.js → LlmConfigTray-CjW04jeT.js} +108 -108
  51. package/packages/llm-host/dist/index.js +1 -1
  52. package/packages/packages/dist/index.js +46 -46
  53. package/packages/raw/raw-editor.js +22 -22
  54. package/packages/settings/dist/assets/FrameConfigurator-DVRBzIR-.js +1 -1
  55. package/packages/sideboard/dist/index.css +1 -1
  56. package/packages/sideboard/dist/index.css.map +2 -2
  57. package/packages/sideboard/dist/index.js +1 -1
  58. package/packages/sync-indicator/dist/assets/{SyncIndicator-B2ag1OoZ.js → SyncIndicator-oVMcVRXg.js} +3 -3
  59. package/packages/sync-indicator/dist/assets/{SyncIndicator-B2ag1OoZ.js.map → SyncIndicator-oVMcVRXg.js.map} +1 -1
  60. package/packages/sync-indicator/dist/index.js +1 -1
  61. package/packages/tasks/dist/assets/index-BbuRtBN3.js +1 -1
  62. package/packages/theming/dist/{active-theme-BMSIQXBV.js → active-theme-CC3CS64F.js} +2 -2
  63. package/packages/theming/dist/{chunk-Z3JB7ERH.js → chunk-DH4YUYFJ.js} +2 -2
  64. package/packages/theming/dist/chunk-VJZ4NPK4.js +136 -0
  65. package/packages/theming/dist/chunk-VJZ4NPK4.js.map +7 -0
  66. package/packages/theming/dist/main.js +4 -4
  67. package/packages/theming/dist/{theme-7OG2K56L.css → theme-HE7ECLIW.css} +212 -58
  68. package/packages/theming/dist/{theme-editor-datatype-TMYH7U2S.js → theme-editor-datatype-TJ6LYT2U.js} +2 -2
  69. package/packages/theming/dist/theme-editor.js +35 -25
  70. package/packages/theming/dist/theme-editor.js.map +2 -2
  71. package/packages/theming/dist/{theme-titlebar-YIFJINPJ.js → theme-titlebar-BO2Y2GRN.js} +2 -2
  72. package/packages/theming/dist/{theme-tray-7J247NRY.js → theme-tray-V6BEXQWR.js} +15 -15
  73. package/packages/theming/dist/theme-tray-V6BEXQWR.js.map +7 -0
  74. package/packages/theming/dist/tool.js +9 -9
  75. package/packages/theming/dist/tool.js.map +1 -1
  76. package/packages/threepane/dist/IsolatedDocumentArea-IZWZ74TV.js +2 -0
  77. package/packages/threepane/dist/{PatchworkFrame-GEEBBGCS.js → PatchworkFrame-UNWWAISP.js} +2 -2
  78. package/packages/threepane/dist/{chunk-YC5AHP5G.js → chunk-MSZ7JVNB.js} +31 -31
  79. package/packages/threepane/dist/{chunk-YC5AHP5G.js.map → chunk-MSZ7JVNB.js.map} +3 -3
  80. package/packages/threepane/dist/index.js +1 -1
  81. package/plugin-registry-url +1 -1
  82. package/packages/account/dist/AccountPicker-A2PAS5CG.js.map +0 -7
  83. package/packages/file/dist/new-file-tool-DGKllnzw.js.map +0 -1
  84. package/packages/file/dist/tool-UKWDK93W.js.map +0 -1
  85. package/packages/theming/dist/chunk-GIPQLUDU.js +0 -86
  86. package/packages/theming/dist/chunk-GIPQLUDU.js.map +0 -7
  87. package/packages/theming/dist/theme-tray-7J247NRY.js.map +0 -7
  88. package/packages/threepane/dist/IsolatedDocumentArea-G3V7KYHJ.js +0 -2
  89. /package/packages/theming/dist/{active-theme-BMSIQXBV.js.map → active-theme-CC3CS64F.js.map} +0 -0
  90. /package/packages/theming/dist/{chunk-Z3JB7ERH.js.map → chunk-DH4YUYFJ.js.map} +0 -0
  91. /package/packages/theming/dist/{theme-editor-datatype-TMYH7U2S.js.map → theme-editor-datatype-TJ6LYT2U.js.map} +0 -0
  92. /package/packages/theming/dist/{theme-titlebar-YIFJINPJ.js.map → theme-titlebar-BO2Y2GRN.js.map} +0 -0
  93. /package/packages/threepane/dist/{IsolatedDocumentArea-G3V7KYHJ.js.map → IsolatedDocumentArea-IZWZ74TV.js.map} +0 -0
  94. /package/packages/threepane/dist/{PatchworkFrame-GEEBBGCS.js.map → PatchworkFrame-UNWWAISP.js.map} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"SyncIndicator-B2ag1OoZ.js","sources":["../../node_modules/.pnpm/ms@2.1.3/node_modules/ms/index.js","../../node_modules/.pnpm/debug@4.4.3/node_modules/debug/src/common.js","../../node_modules/.pnpm/debug@4.4.3/node_modules/debug/src/browser.js","../../node_modules/.pnpm/cabbages@0.2.10/node_modules/cabbages/output/cabbages.js","../../node_modules/.pnpm/solid-automerge@2.0.2_@automerge+automerge-repo@2.6.0-subduction.39_solid-js@1.9.11/node_modules/solid-automerge/out/context.js","../../node_modules/.pnpm/solid-automerge@2.0.2_@automerge+automerge-repo@2.6.0-subduction.39_solid-js@1.9.11/node_modules/solid-automerge/out/useRepo.js","../../src/lib/relative-time.ts","../../src/lib/ui/Button.tsx","../../src/lib/ui/Popover.tsx","../../src/SyncIcon.tsx","../../src/CopyIcon.tsx","../../src/SyncIndicator.tsx"],"sourcesContent":["/**\n * Helpers.\n */\n\nvar s = 1000;\nvar m = s * 60;\nvar h = m * 60;\nvar d = h * 24;\nvar w = d * 7;\nvar y = d * 365.25;\n\n/**\n * Parse or format the given `val`.\n *\n * Options:\n *\n * - `long` verbose formatting [false]\n *\n * @param {String|Number} val\n * @param {Object} [options]\n * @throws {Error} throw an error if val is not a non-empty string or a number\n * @return {String|Number}\n * @api public\n */\n\nmodule.exports = function (val, options) {\n options = options || {};\n var type = typeof val;\n if (type === 'string' && val.length > 0) {\n return parse(val);\n } else if (type === 'number' && isFinite(val)) {\n return options.long ? fmtLong(val) : fmtShort(val);\n }\n throw new Error(\n 'val is not a non-empty string or a valid number. val=' +\n JSON.stringify(val)\n );\n};\n\n/**\n * Parse the given `str` and return milliseconds.\n *\n * @param {String} str\n * @return {Number}\n * @api private\n */\n\nfunction parse(str) {\n str = String(str);\n if (str.length > 100) {\n return;\n }\n var match = /^(-?(?:\\d+)?\\.?\\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(\n str\n );\n if (!match) {\n return;\n }\n var n = parseFloat(match[1]);\n var type = (match[2] || 'ms').toLowerCase();\n switch (type) {\n case 'years':\n case 'year':\n case 'yrs':\n case 'yr':\n case 'y':\n return n * y;\n case 'weeks':\n case 'week':\n case 'w':\n return n * w;\n case 'days':\n case 'day':\n case 'd':\n return n * d;\n case 'hours':\n case 'hour':\n case 'hrs':\n case 'hr':\n case 'h':\n return n * h;\n case 'minutes':\n case 'minute':\n case 'mins':\n case 'min':\n case 'm':\n return n * m;\n case 'seconds':\n case 'second':\n case 'secs':\n case 'sec':\n case 's':\n return n * s;\n case 'milliseconds':\n case 'millisecond':\n case 'msecs':\n case 'msec':\n case 'ms':\n return n;\n default:\n return undefined;\n }\n}\n\n/**\n * Short format for `ms`.\n *\n * @param {Number} ms\n * @return {String}\n * @api private\n */\n\nfunction fmtShort(ms) {\n var msAbs = Math.abs(ms);\n if (msAbs >= d) {\n return Math.round(ms / d) + 'd';\n }\n if (msAbs >= h) {\n return Math.round(ms / h) + 'h';\n }\n if (msAbs >= m) {\n return Math.round(ms / m) + 'm';\n }\n if (msAbs >= s) {\n return Math.round(ms / s) + 's';\n }\n return ms + 'ms';\n}\n\n/**\n * Long format for `ms`.\n *\n * @param {Number} ms\n * @return {String}\n * @api private\n */\n\nfunction fmtLong(ms) {\n var msAbs = Math.abs(ms);\n if (msAbs >= d) {\n return plural(ms, msAbs, d, 'day');\n }\n if (msAbs >= h) {\n return plural(ms, msAbs, h, 'hour');\n }\n if (msAbs >= m) {\n return plural(ms, msAbs, m, 'minute');\n }\n if (msAbs >= s) {\n return plural(ms, msAbs, s, 'second');\n }\n return ms + ' ms';\n}\n\n/**\n * Pluralization helper.\n */\n\nfunction plural(ms, msAbs, n, name) {\n var isPlural = msAbs >= n * 1.5;\n return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');\n}\n","\n/**\n * This is the common logic for both the Node.js and web browser\n * implementations of `debug()`.\n */\n\nfunction setup(env) {\n\tcreateDebug.debug = createDebug;\n\tcreateDebug.default = createDebug;\n\tcreateDebug.coerce = coerce;\n\tcreateDebug.disable = disable;\n\tcreateDebug.enable = enable;\n\tcreateDebug.enabled = enabled;\n\tcreateDebug.humanize = require('ms');\n\tcreateDebug.destroy = destroy;\n\n\tObject.keys(env).forEach(key => {\n\t\tcreateDebug[key] = env[key];\n\t});\n\n\t/**\n\t* The currently active debug mode names, and names to skip.\n\t*/\n\n\tcreateDebug.names = [];\n\tcreateDebug.skips = [];\n\n\t/**\n\t* Map of special \"%n\" handling functions, for the debug \"format\" argument.\n\t*\n\t* Valid key names are a single, lower or upper-case letter, i.e. \"n\" and \"N\".\n\t*/\n\tcreateDebug.formatters = {};\n\n\t/**\n\t* Selects a color for a debug namespace\n\t* @param {String} namespace The namespace string for the debug instance to be colored\n\t* @return {Number|String} An ANSI color code for the given namespace\n\t* @api private\n\t*/\n\tfunction selectColor(namespace) {\n\t\tlet hash = 0;\n\n\t\tfor (let i = 0; i < namespace.length; i++) {\n\t\t\thash = ((hash << 5) - hash) + namespace.charCodeAt(i);\n\t\t\thash |= 0; // Convert to 32bit integer\n\t\t}\n\n\t\treturn createDebug.colors[Math.abs(hash) % createDebug.colors.length];\n\t}\n\tcreateDebug.selectColor = selectColor;\n\n\t/**\n\t* Create a debugger with the given `namespace`.\n\t*\n\t* @param {String} namespace\n\t* @return {Function}\n\t* @api public\n\t*/\n\tfunction createDebug(namespace) {\n\t\tlet prevTime;\n\t\tlet enableOverride = null;\n\t\tlet namespacesCache;\n\t\tlet enabledCache;\n\n\t\tfunction debug(...args) {\n\t\t\t// Disabled?\n\t\t\tif (!debug.enabled) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst self = debug;\n\n\t\t\t// Set `diff` timestamp\n\t\t\tconst curr = Number(new Date());\n\t\t\tconst ms = curr - (prevTime || curr);\n\t\t\tself.diff = ms;\n\t\t\tself.prev = prevTime;\n\t\t\tself.curr = curr;\n\t\t\tprevTime = curr;\n\n\t\t\targs[0] = createDebug.coerce(args[0]);\n\n\t\t\tif (typeof args[0] !== 'string') {\n\t\t\t\t// Anything else let's inspect with %O\n\t\t\t\targs.unshift('%O');\n\t\t\t}\n\n\t\t\t// Apply any `formatters` transformations\n\t\t\tlet index = 0;\n\t\t\targs[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {\n\t\t\t\t// If we encounter an escaped % then don't increase the array index\n\t\t\t\tif (match === '%%') {\n\t\t\t\t\treturn '%';\n\t\t\t\t}\n\t\t\t\tindex++;\n\t\t\t\tconst formatter = createDebug.formatters[format];\n\t\t\t\tif (typeof formatter === 'function') {\n\t\t\t\t\tconst val = args[index];\n\t\t\t\t\tmatch = formatter.call(self, val);\n\n\t\t\t\t\t// Now we need to remove `args[index]` since it's inlined in the `format`\n\t\t\t\t\targs.splice(index, 1);\n\t\t\t\t\tindex--;\n\t\t\t\t}\n\t\t\t\treturn match;\n\t\t\t});\n\n\t\t\t// Apply env-specific formatting (colors, etc.)\n\t\t\tcreateDebug.formatArgs.call(self, args);\n\n\t\t\tconst logFn = self.log || createDebug.log;\n\t\t\tlogFn.apply(self, args);\n\t\t}\n\n\t\tdebug.namespace = namespace;\n\t\tdebug.useColors = createDebug.useColors();\n\t\tdebug.color = createDebug.selectColor(namespace);\n\t\tdebug.extend = extend;\n\t\tdebug.destroy = createDebug.destroy; // XXX Temporary. Will be removed in the next major release.\n\n\t\tObject.defineProperty(debug, 'enabled', {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: false,\n\t\t\tget: () => {\n\t\t\t\tif (enableOverride !== null) {\n\t\t\t\t\treturn enableOverride;\n\t\t\t\t}\n\t\t\t\tif (namespacesCache !== createDebug.namespaces) {\n\t\t\t\t\tnamespacesCache = createDebug.namespaces;\n\t\t\t\t\tenabledCache = createDebug.enabled(namespace);\n\t\t\t\t}\n\n\t\t\t\treturn enabledCache;\n\t\t\t},\n\t\t\tset: v => {\n\t\t\t\tenableOverride = v;\n\t\t\t}\n\t\t});\n\n\t\t// Env-specific initialization logic for debug instances\n\t\tif (typeof createDebug.init === 'function') {\n\t\t\tcreateDebug.init(debug);\n\t\t}\n\n\t\treturn debug;\n\t}\n\n\tfunction extend(namespace, delimiter) {\n\t\tconst newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);\n\t\tnewDebug.log = this.log;\n\t\treturn newDebug;\n\t}\n\n\t/**\n\t* Enables a debug mode by namespaces. This can include modes\n\t* separated by a colon and wildcards.\n\t*\n\t* @param {String} namespaces\n\t* @api public\n\t*/\n\tfunction enable(namespaces) {\n\t\tcreateDebug.save(namespaces);\n\t\tcreateDebug.namespaces = namespaces;\n\n\t\tcreateDebug.names = [];\n\t\tcreateDebug.skips = [];\n\n\t\tconst split = (typeof namespaces === 'string' ? namespaces : '')\n\t\t\t.trim()\n\t\t\t.replace(/\\s+/g, ',')\n\t\t\t.split(',')\n\t\t\t.filter(Boolean);\n\n\t\tfor (const ns of split) {\n\t\t\tif (ns[0] === '-') {\n\t\t\t\tcreateDebug.skips.push(ns.slice(1));\n\t\t\t} else {\n\t\t\t\tcreateDebug.names.push(ns);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Checks if the given string matches a namespace template, honoring\n\t * asterisks as wildcards.\n\t *\n\t * @param {String} search\n\t * @param {String} template\n\t * @return {Boolean}\n\t */\n\tfunction matchesTemplate(search, template) {\n\t\tlet searchIndex = 0;\n\t\tlet templateIndex = 0;\n\t\tlet starIndex = -1;\n\t\tlet matchIndex = 0;\n\n\t\twhile (searchIndex < search.length) {\n\t\t\tif (templateIndex < template.length && (template[templateIndex] === search[searchIndex] || template[templateIndex] === '*')) {\n\t\t\t\t// Match character or proceed with wildcard\n\t\t\t\tif (template[templateIndex] === '*') {\n\t\t\t\t\tstarIndex = templateIndex;\n\t\t\t\t\tmatchIndex = searchIndex;\n\t\t\t\t\ttemplateIndex++; // Skip the '*'\n\t\t\t\t} else {\n\t\t\t\t\tsearchIndex++;\n\t\t\t\t\ttemplateIndex++;\n\t\t\t\t}\n\t\t\t} else if (starIndex !== -1) { // eslint-disable-line no-negated-condition\n\t\t\t\t// Backtrack to the last '*' and try to match more characters\n\t\t\t\ttemplateIndex = starIndex + 1;\n\t\t\t\tmatchIndex++;\n\t\t\t\tsearchIndex = matchIndex;\n\t\t\t} else {\n\t\t\t\treturn false; // No match\n\t\t\t}\n\t\t}\n\n\t\t// Handle trailing '*' in template\n\t\twhile (templateIndex < template.length && template[templateIndex] === '*') {\n\t\t\ttemplateIndex++;\n\t\t}\n\n\t\treturn templateIndex === template.length;\n\t}\n\n\t/**\n\t* Disable debug output.\n\t*\n\t* @return {String} namespaces\n\t* @api public\n\t*/\n\tfunction disable() {\n\t\tconst namespaces = [\n\t\t\t...createDebug.names,\n\t\t\t...createDebug.skips.map(namespace => '-' + namespace)\n\t\t].join(',');\n\t\tcreateDebug.enable('');\n\t\treturn namespaces;\n\t}\n\n\t/**\n\t* Returns true if the given mode name is enabled, false otherwise.\n\t*\n\t* @param {String} name\n\t* @return {Boolean}\n\t* @api public\n\t*/\n\tfunction enabled(name) {\n\t\tfor (const skip of createDebug.skips) {\n\t\t\tif (matchesTemplate(name, skip)) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\tfor (const ns of createDebug.names) {\n\t\t\tif (matchesTemplate(name, ns)) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}\n\n\t/**\n\t* Coerce `val`.\n\t*\n\t* @param {Mixed} val\n\t* @return {Mixed}\n\t* @api private\n\t*/\n\tfunction coerce(val) {\n\t\tif (val instanceof Error) {\n\t\t\treturn val.stack || val.message;\n\t\t}\n\t\treturn val;\n\t}\n\n\t/**\n\t* XXX DO NOT USE. This is a temporary stub function.\n\t* XXX It WILL be removed in the next major release.\n\t*/\n\tfunction destroy() {\n\t\tconsole.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');\n\t}\n\n\tcreateDebug.enable(createDebug.load());\n\n\treturn createDebug;\n}\n\nmodule.exports = setup;\n","/* eslint-env browser */\n\n/**\n * This is the web browser implementation of `debug()`.\n */\n\nexports.formatArgs = formatArgs;\nexports.save = save;\nexports.load = load;\nexports.useColors = useColors;\nexports.storage = localstorage();\nexports.destroy = (() => {\n\tlet warned = false;\n\n\treturn () => {\n\t\tif (!warned) {\n\t\t\twarned = true;\n\t\t\tconsole.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');\n\t\t}\n\t};\n})();\n\n/**\n * Colors.\n */\n\nexports.colors = [\n\t'#0000CC',\n\t'#0000FF',\n\t'#0033CC',\n\t'#0033FF',\n\t'#0066CC',\n\t'#0066FF',\n\t'#0099CC',\n\t'#0099FF',\n\t'#00CC00',\n\t'#00CC33',\n\t'#00CC66',\n\t'#00CC99',\n\t'#00CCCC',\n\t'#00CCFF',\n\t'#3300CC',\n\t'#3300FF',\n\t'#3333CC',\n\t'#3333FF',\n\t'#3366CC',\n\t'#3366FF',\n\t'#3399CC',\n\t'#3399FF',\n\t'#33CC00',\n\t'#33CC33',\n\t'#33CC66',\n\t'#33CC99',\n\t'#33CCCC',\n\t'#33CCFF',\n\t'#6600CC',\n\t'#6600FF',\n\t'#6633CC',\n\t'#6633FF',\n\t'#66CC00',\n\t'#66CC33',\n\t'#9900CC',\n\t'#9900FF',\n\t'#9933CC',\n\t'#9933FF',\n\t'#99CC00',\n\t'#99CC33',\n\t'#CC0000',\n\t'#CC0033',\n\t'#CC0066',\n\t'#CC0099',\n\t'#CC00CC',\n\t'#CC00FF',\n\t'#CC3300',\n\t'#CC3333',\n\t'#CC3366',\n\t'#CC3399',\n\t'#CC33CC',\n\t'#CC33FF',\n\t'#CC6600',\n\t'#CC6633',\n\t'#CC9900',\n\t'#CC9933',\n\t'#CCCC00',\n\t'#CCCC33',\n\t'#FF0000',\n\t'#FF0033',\n\t'#FF0066',\n\t'#FF0099',\n\t'#FF00CC',\n\t'#FF00FF',\n\t'#FF3300',\n\t'#FF3333',\n\t'#FF3366',\n\t'#FF3399',\n\t'#FF33CC',\n\t'#FF33FF',\n\t'#FF6600',\n\t'#FF6633',\n\t'#FF9900',\n\t'#FF9933',\n\t'#FFCC00',\n\t'#FFCC33'\n];\n\n/**\n * Currently only WebKit-based Web Inspectors, Firefox >= v31,\n * and the Firebug extension (any Firefox version) are known\n * to support \"%c\" CSS customizations.\n *\n * TODO: add a `localStorage` variable to explicitly enable/disable colors\n */\n\n// eslint-disable-next-line complexity\nfunction useColors() {\n\t// NB: In an Electron preload script, document will be defined but not fully\n\t// initialized. Since we know we're in Chrome, we'll just detect this case\n\t// explicitly\n\tif (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {\n\t\treturn true;\n\t}\n\n\t// Internet Explorer and Edge do not support colors.\n\tif (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\\/(\\d+)/)) {\n\t\treturn false;\n\t}\n\n\tlet m;\n\n\t// Is webkit? http://stackoverflow.com/a/16459606/376773\n\t// document is undefined in react-native: https://github.com/facebook/react-native/pull/1632\n\t// eslint-disable-next-line no-return-assign\n\treturn (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||\n\t\t// Is firebug? http://stackoverflow.com/a/398120/376773\n\t\t(typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||\n\t\t// Is firefox >= v31?\n\t\t// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages\n\t\t(typeof navigator !== 'undefined' && navigator.userAgent && (m = navigator.userAgent.toLowerCase().match(/firefox\\/(\\d+)/)) && parseInt(m[1], 10) >= 31) ||\n\t\t// Double check webkit in userAgent just in case we are in a worker\n\t\t(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\\/(\\d+)/));\n}\n\n/**\n * Colorize log arguments if enabled.\n *\n * @api public\n */\n\nfunction formatArgs(args) {\n\targs[0] = (this.useColors ? '%c' : '') +\n\t\tthis.namespace +\n\t\t(this.useColors ? ' %c' : ' ') +\n\t\targs[0] +\n\t\t(this.useColors ? '%c ' : ' ') +\n\t\t'+' + module.exports.humanize(this.diff);\n\n\tif (!this.useColors) {\n\t\treturn;\n\t}\n\n\tconst c = 'color: ' + this.color;\n\targs.splice(1, 0, c, 'color: inherit');\n\n\t// The final \"%c\" is somewhat tricky, because there could be other\n\t// arguments passed either before or after the %c, so we need to\n\t// figure out the correct index to insert the CSS into\n\tlet index = 0;\n\tlet lastC = 0;\n\targs[0].replace(/%[a-zA-Z%]/g, match => {\n\t\tif (match === '%%') {\n\t\t\treturn;\n\t\t}\n\t\tindex++;\n\t\tif (match === '%c') {\n\t\t\t// We only are interested in the *last* %c\n\t\t\t// (the user may have provided their own)\n\t\t\tlastC = index;\n\t\t}\n\t});\n\n\targs.splice(lastC, 0, c);\n}\n\n/**\n * Invokes `console.debug()` when available.\n * No-op when `console.debug` is not a \"function\".\n * If `console.debug` is not available, falls back\n * to `console.log`.\n *\n * @api public\n */\nexports.log = console.debug || console.log || (() => {});\n\n/**\n * Save `namespaces`.\n *\n * @param {String} namespaces\n * @api private\n */\nfunction save(namespaces) {\n\ttry {\n\t\tif (namespaces) {\n\t\t\texports.storage.setItem('debug', namespaces);\n\t\t} else {\n\t\t\texports.storage.removeItem('debug');\n\t\t}\n\t} catch (error) {\n\t\t// Swallow\n\t\t// XXX (@Qix-) should we be logging these?\n\t}\n}\n\n/**\n * Load `namespaces`.\n *\n * @return {String} returns the previously persisted debug modes\n * @api private\n */\nfunction load() {\n\tlet r;\n\ttry {\n\t\tr = exports.storage.getItem('debug') || exports.storage.getItem('DEBUG') ;\n\t} catch (error) {\n\t\t// Swallow\n\t\t// XXX (@Qix-) should we be logging these?\n\t}\n\n\t// If debug isn't set in LS, and we're in Electron, try to load $DEBUG\n\tif (!r && typeof process !== 'undefined' && 'env' in process) {\n\t\tr = process.env.DEBUG;\n\t}\n\n\treturn r;\n}\n\n/**\n * Localstorage attempts to return the localstorage.\n *\n * This is necessary because safari throws\n * when a user disables cookies/localstorage\n * and you attempt to access it.\n *\n * @return {LocalStorage}\n * @api private\n */\n\nfunction localstorage() {\n\ttry {\n\t\t// TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context\n\t\t// The Browser also has localStorage in the global context.\n\t\treturn localStorage;\n\t} catch (error) {\n\t\t// Swallow\n\t\t// XXX (@Qix-) should we be logging these?\n\t}\n}\n\nmodule.exports = require('./common')(exports);\n\nconst {formatters} = module.exports;\n\n/**\n * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.\n */\n\nformatters.j = function (v) {\n\ttry {\n\t\treturn JSON.stringify(v);\n\t} catch (error) {\n\t\treturn '[UnexpectedJSONParseError]: ' + error.message;\n\t}\n};\n","// cabbages.ts\nimport debug from \"debug\";\nvar log = debug(\"cabbages\");\nfunction pojo(target) {\n return typeof target == \"object\" && typeof target != null && Object.getPrototypeOf(target) == Object.prototype;\n}\nvar BLOCK_MARKER = \"\\uFFFC\";\nfunction apply(target, ...rest) {\n if (rest.length == 0) {\n log(\"empty patch\");\n return;\n }\n const [path, range, val] = rest;\n let p = [...path];\n while (true) {\n let key = p.shift();\n if (!p.length) {\n const RANGE_ARRAY = Array.isArray(range);\n if (pojo(target) && RANGE_ARRAY && typeof key == \"undefined\" && typeof range[0] == \"string\") {\n delete target[range[0]];\n return;\n }\n if (RANGE_ARRAY || typeof range == \"number\") {\n if (typeof key == \"undefined\") {\n throw new Error(\"cant treat top level as a seq\");\n }\n key = key;\n let [start, end] = Array.isArray(range) ? range : [range, range + 1];\n const ZERO_LENGTH = Array.isArray(range) && range.length == 0;\n if (!ZERO_LENGTH && (start == null || end == null)) {\n throw new RangeError(\"it's all or nothing, no half measures\");\n }\n const DELETE = typeof val == \"undefined\";\n const INSERT = start === end && !DELETE;\n const APPEND = ZERO_LENGTH && !DELETE;\n const REPLACE = !INSERT && !DELETE && !APPEND;\n if (typeof target[key] == \"undefined\") {\n if (typeof target == \"string\") {\n return;\n } else if (typeof val == \"string\") {\n target[key] = \"\";\n } else {\n target[key] = [];\n }\n }\n let seq = target[key];\n if (Array.isArray(seq)) {\n if (APPEND) {\n Array.isArray(val) ? seq.push(...val) : seq.push(val);\n return;\n }\n if (INSERT || REPLACE) {\n Array.isArray(val) ? seq.splice(start, end - start, ...val) : seq.splice(start, end - start, val);\n return;\n }\n if (DELETE) {\n seq.splice(start, end - start);\n return;\n }\n throw new Error(\"i don't know what happened\");\n }\n if (typeof seq == \"string\") {\n if (APPEND) {\n target[key] = seq + val;\n return;\n }\n if (REPLACE || INSERT) {\n target[key] = seq.slice(0, start) + (typeof val == \"string\" ? val : val.map(\n (n) => typeof n == \"string\" ? n : BLOCK_MARKER\n ).join(\"\")) + seq.slice(end);\n return;\n }\n if (DELETE) {\n target[key] = seq.slice(0, start) + seq.slice(end);\n return;\n }\n throw new Error(\"i don't know what happened\");\n }\n if (pojo(seq) && RANGE_ARRAY && typeof range[0] == \"string\") {\n delete seq[range[0]];\n return;\n }\n throw new Error(\"not implemented\");\n }\n if (typeof key == \"undefined\") {\n if (typeof range != \"string\") {\n throw new Error(`can't index top-level map with ${range}`);\n }\n if (typeof val == \"undefined\") {\n delete target[range];\n } else {\n target[range] = val;\n }\n return;\n }\n if (typeof target[key] == \"undefined\") {\n target[key] = {};\n }\n if (RANGE_ARRAY) {\n let [a, b] = range;\n if (a != null && b != null) {\n if (typeof val == \"undefined\" && a != null && b != null) {\n delete target[key][a || b];\n } else {\n target[key][a || b] = val;\n }\n }\n } else {\n if (typeof val == \"undefined\") {\n delete target[key][range];\n } else if (typeof target[key] == \"string\") {\n return;\n } else {\n target[key][range] = val;\n }\n }\n return;\n }\n if (typeof key == \"undefined\") {\n throw new Error(\"cant treat top level as a seq\");\n }\n key = key;\n let nextkey = p[0];\n if (typeof target[key] == \"undefined\") {\n if (typeof nextkey == \"string\") {\n target[key] = {};\n } else if (typeof nextkey == \"number\") {\n target[key] = [];\n } else {\n throw new Error(`can't go down this road ${target}.${key}.${nextkey}`);\n }\n }\n target = target[key];\n }\n}\nvar patch = apply;\nfunction get(obj, key) {\n for (let p = 0; p < key.length; p++) {\n obj = obj ? obj[key[p]] : void 0;\n }\n return obj;\n}\nfunction fromAutomerge(autopatch, payload) {\n const path = autopatch.path.slice(0, -1);\n const key = autopatch.path[autopatch.path.length - 1];\n switch (autopatch.action) {\n case \"mark\":\n case \"unmark\":\n log(\n `skipping ${autopatch.action} because it doesn't affect material reality`\n );\n return [];\n case \"inc\":\n if (payload) {\n return [path, key, get(payload.patchInfo.after, autopatch.path)];\n } else {\n throw new Error(\n `can't apply ${autopatch.action} without payload argument`\n );\n }\n case \"conflict\":\n if (payload) {\n return [path, key, get(payload.patchInfo.after, autopatch.path)];\n } else {\n throw new Error(\n `can't apply ${autopatch.action} without payload argument`\n );\n }\n case \"del\": {\n return typeof key == \"string\" ? [path, key] : [path, [key, key + (autopatch.length || 1)]];\n }\n case \"insert\": {\n return [\n path,\n [key, key],\n structuredClone(autopatch.values)\n ];\n }\n case \"splice\": {\n return [path, [key, key], [autopatch.value]];\n }\n case \"put\": {\n return [path, key, structuredClone(autopatch.value)];\n }\n }\n}\nexport {\n apply,\n fromAutomerge,\n patch,\n pojo\n};\n","\"use strict\";\nimport { createContext } from \"solid-js\";\nexport const RepoContext = createContext(\n null\n);\n//# sourceMappingURL=context.js.map\n","\"use strict\";\nimport { RepoContext } from \"./context.js\";\nimport { useContext } from \"solid-js\";\nexport default function useRepo() {\n const repo = useContext(RepoContext);\n if (!repo) throw new Error(\"Please wrap me in a <RepoContext value={repo}>\");\n return repo;\n}\n//# sourceMappingURL=useRepo.js.map\n","/**\n * Converts a timestamp to a relative time string (e.g. \"2 minutes ago\")\n */\nexport const getRelativeTimeString = (timestamp: number): string => {\n const now = Date.now();\n const diff = now - timestamp;\n\n const seconds = Math.floor(diff / 1000);\n const minutes = Math.floor(seconds / 60);\n const hours = Math.floor(minutes / 60);\n const days = Math.floor(hours / 24);\n const weeks = Math.floor(days / 7);\n const months = Math.floor(days / 30);\n const years = Math.floor(days / 365);\n\n if (seconds < 60) {\n return \"just now\";\n } else if (minutes < 60) {\n return `${minutes} minute${minutes === 1 ? \"\" : \"s\"} ago`;\n } else if (hours < 24) {\n return `${hours} hour${hours === 1 ? \"\" : \"s\"} ago`;\n } else if (days < 7) {\n return `${days} day${days === 1 ? \"\" : \"s\"} ago`;\n } else if (weeks < 4) {\n return `${weeks} week${weeks === 1 ? \"\" : \"s\"} ago`;\n } else if (months < 12) {\n return `${months} month${months === 1 ? \"\" : \"s\"} ago`;\n } else {\n return `${years} year${years === 1 ? \"\" : \"s\"} ago`;\n }\n};\n","import type { JSX } from \"solid-js\";\n\ninterface ButtonProps extends JSX.ButtonHTMLAttributes<HTMLButtonElement> {\n variant?: \"default\" | \"ghost\";\n size?: \"default\" | \"sm\";\n}\n\nexport function Button(props: ButtonProps) {\n return (\n <button\n {...props}\n class={`sync-copy-btn ${props.class ?? \"\"}`}\n >\n {props.children}\n </button>\n );\n}\n","import {\n type JSX,\n createSignal,\n createContext,\n useContext,\n onCleanup,\n createEffect,\n on,\n} from \"solid-js\";\nimport { Portal } from \"solid-js/web\";\n\ninterface PopoverContextValue {\n open: () => boolean;\n setOpen: (v: boolean) => void;\n triggerRef: () => HTMLButtonElement | undefined;\n setTriggerRef: (el: HTMLButtonElement) => void;\n}\n\nconst PopoverContext = createContext<PopoverContextValue>();\n\nexport function Popover(props: {\n open?: boolean;\n onOpenChange?: (open: boolean) => void;\n children: JSX.Element;\n}) {\n const [internalOpen, setInternalOpen] = createSignal(false);\n const [triggerRef, setTriggerRef] = createSignal<HTMLButtonElement>();\n\n const isOpen = () =>\n props.open !== undefined ? props.open : internalOpen();\n\n const setOpen = (v: boolean) => {\n if (props.open === undefined) {\n setInternalOpen(v);\n }\n props.onOpenChange?.(v);\n };\n\n return (\n <PopoverContext.Provider\n value={{ open: isOpen, setOpen, triggerRef, setTriggerRef }}\n >\n <div class=\"sync-popover-wrapper\">{props.children}</div>\n </PopoverContext.Provider>\n );\n}\n\nexport function PopoverTrigger(props: {\n class?: string;\n children: JSX.Element;\n}) {\n const ctx = useContext(PopoverContext)!;\n\n return (\n <button\n ref={(el) => ctx.setTriggerRef(el)}\n type=\"button\"\n class={props.class ?? \"\"}\n onClick={() => ctx.setOpen(!ctx.open())}\n >\n {props.children}\n </button>\n );\n}\n\nexport function PopoverContent(props: {\n class?: string;\n children: JSX.Element;\n}) {\n const ctx = useContext(PopoverContext)!;\n let contentRef!: HTMLDivElement;\n const [position, setPosition] = createSignal({ top: 0, left: 0 });\n\n const updatePosition = () => {\n const trigger = ctx.triggerRef();\n if (!trigger) return;\n const rect = trigger.getBoundingClientRect();\n setPosition({\n top: rect.bottom + 8,\n left: Math.max(0, rect.right - 288),\n });\n };\n\n createEffect(\n on(ctx.open, (open) => {\n if (!open) return;\n\n updatePosition();\n\n const handleClickOutside = (event: MouseEvent) => {\n const target = event.target as Node;\n if (\n contentRef &&\n !contentRef.contains(target) &&\n ctx.triggerRef() &&\n !ctx.triggerRef()!.contains(target)\n ) {\n ctx.setOpen(false);\n }\n };\n\n const handleEscape = (event: KeyboardEvent) => {\n if (event.key === \"Escape\") {\n ctx.setOpen(false);\n }\n };\n\n document.addEventListener(\"mousedown\", handleClickOutside);\n document.addEventListener(\"keydown\", handleEscape);\n window.addEventListener(\"resize\", updatePosition);\n window.addEventListener(\"scroll\", updatePosition, true);\n\n onCleanup(() => {\n document.removeEventListener(\"mousedown\", handleClickOutside);\n document.removeEventListener(\"keydown\", handleEscape);\n window.removeEventListener(\"resize\", updatePosition);\n window.removeEventListener(\"scroll\", updatePosition, true);\n });\n })\n );\n\n return (\n <>\n {ctx.open() && (\n <Portal>\n <div\n ref={contentRef}\n class=\"sync-popover\"\n style={{\n top: `${position().top}px`,\n left: `${position().left}px`,\n }}\n >\n {props.children}\n </div>\n </Portal>\n )}\n </>\n );\n}\n","interface SyncIconProps {\n size?: number;\n class?: string;\n state?: \"synced\" | \"syncing\" | \"error\" | \"unknown\";\n}\n\nexport function SyncIcon(props: SyncIconProps) {\n const s = () => props.size ?? 20;\n const state = () => props.state ?? \"synced\";\n\n return (\n <svg\n width={s()}\n height={s()}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n class={props.class ?? \"\"}\n >\n <circle\n cx=\"12\"\n cy=\"12\"\n r=\"8\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n fill=\"currentColor\"\n fill-opacity={state() === \"synced\" ? 1 : 0}\n style={{\n transition: state() === \"synced\"\n ? \"fill-opacity 0s\"\n : \"fill-opacity 2s ease-out\",\n }}\n />\n {state() === \"error\" && (\n <circle cx=\"12\" cy=\"12\" r=\"2.5\" fill=\"currentColor\" />\n )}\n {state() === \"unknown\" && (\n <text\n x=\"12\"\n y=\"12\"\n text-anchor=\"middle\"\n dominant-baseline=\"central\"\n fill=\"currentColor\"\n font-size=\"11\"\n font-weight=\"bold\"\n >\n ?\n </text>\n )}\n </svg>\n );\n}\n","interface CopyIconProps {\n size?: number;\n}\n\nexport function CopyIcon(props: CopyIconProps) {\n const s = () => props.size ?? 14;\n return (\n <svg\n width={s()}\n height={s()}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n >\n <rect x=\"9\" y=\"9\" width=\"13\" height=\"13\" rx=\"2\" ry=\"2\" />\n <path d=\"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1\" />\n </svg>\n );\n}\n","import Debug from \"debug\";\nimport * as A from \"@automerge/automerge/slim\";\nimport {\n type DocHandle,\n type StorageId,\n type UrlHeads,\n type PeerId,\n} from \"@automerge/automerge-repo/slim\";\nimport { useRepo, RepoContext } from \"solid-automerge\";\nimport {\n createSignal,\n createMemo,\n createEffect,\n on,\n onCleanup,\n untrack,\n Show,\n For,\n} from \"solid-js\";\nimport { createStore, reconcile } from \"solid-js/store\";\nimport { render } from \"solid-js/web\";\nimport type { ToolImplementation } from \"@inkandswitch/patchwork-plugins\";\nimport { getRelativeTimeString } from \"./lib/relative-time\";\nimport { Button, Popover, PopoverTrigger, PopoverContent } from \"./lib/ui\";\nimport { SyncIcon } from \"./SyncIcon\";\nimport { CopyIcon } from \"./CopyIcon\";\nimport \"./styles.css\";\n\nconst log = Debug(\"patchwork:sync-indicator\");\n\nexport { RepoContext };\n\ninterface PeerSyncInfo {\n id: string;\n name: string;\n storageId: StorageId | undefined;\n heads: UrlHeads | undefined;\n lastSyncTimestamp: number | undefined;\n inSync: boolean;\n}\n\nfunction peerName(peerId: PeerId): string {\n if (\n peerId.startsWith(\"shared-worker\") ||\n peerId.startsWith(\"automerge-worker\")\n )\n return \"Shared Worker\";\n if (peerId.startsWith(\"service-worker\")) return \"Service Worker\";\n if (peerId.startsWith(\"storage-server\")) return \"Sync Server\";\n return String(peerId);\n}\n\nexport function SyncIndicator(props: { handle: DocHandle<unknown> }) {\n const repo = useRepo();\n const [isPopoverOpen, setIsPopoverOpen] = createSignal(false);\n const [now, setNow] = createSignal(Date.now());\n const [ownHeads, setOwnHeads] = createSignal<UrlHeads | undefined>();\n\n // The tab's repo talks to the sync server itself over a Subduction websocket,\n // so connection state and server heads come straight off the repo.\n const [connected, setConnected] = createSignal(repo.isSubductionConnected());\n const [serverPeerIds, setServerPeerIds] = createSignal<string[]>([]);\n\n const [syncServerHeads, setSyncServerHeads] = createSignal<\n UrlHeads | undefined\n >();\n const [syncServerTimestamp, setSyncServerTimestamp] = createSignal<\n number | undefined\n >();\n const [syncServerStorageId, setSyncServerStorageId] = createSignal<\n StorageId | undefined\n >();\n\n // classic automerge-sync peers (other tabs, workers)\n const [peers, setPeers] = createStore<PeerSyncInfo[]>([]);\n\n // The server advertises Subduction *sedimentree* heads, NOT the Automerge\n // frontier, so they can't be compared to ours with A.equals. Ask the handle\n // whether we already hold everything the server advertises instead.\n const containsServerHeads = (heads: UrlHeads | undefined): boolean => {\n if (!heads || heads.length === 0) return false;\n try {\n return props.handle.containsHeads(heads);\n } catch {\n return false;\n }\n };\n\n /**\n * Trim the sync server's advertised heads for display: drop heads we already\n * hold in our history, keeping our current frontier tip(s) plus any head we\n * genuinely lack. Display only; the synced verdict considers the full set.\n */\n function trimSeenServerHeads(\n heads: UrlHeads | undefined\n ): UrlHeads | undefined {\n if (!heads) return heads;\n\n let frontier: Set<string>;\n try {\n frontier = new Set<string>([...props.handle.heads()]);\n } catch {\n return heads;\n }\n\n return heads.filter((h) => {\n if (frontier.has(h)) return true;\n try {\n return !props.handle.containsHeads([h] as UrlHeads);\n } catch {\n return true;\n }\n }) as UrlHeads;\n }\n\n createEffect(\n on(isPopoverOpen, (open) => {\n if (!open) return;\n untrack(refreshPeers);\n const interval = setInterval(() => setNow(Date.now()), 1000);\n onCleanup(() => clearInterval(interval));\n })\n );\n\n const refreshServerPeerIds = () => {\n repo\n .connectedSubductionPeerIds()\n .then(setServerPeerIds)\n .catch((err) => log(\"connectedSubductionPeerIds failed\", err));\n };\n\n createEffect(() => {\n const onConnection = ({ connected }: { connected: boolean }) => {\n setConnected(connected);\n if (connected) refreshServerPeerIds();\n else setServerPeerIds([]);\n };\n repo.on(\"subduction-connection\", onConnection);\n setConnected(repo.isSubductionConnected());\n refreshServerPeerIds();\n onCleanup(() => repo.off(\"subduction-connection\", onConnection));\n });\n\n function applySyncServerUpdate(\n storageId: StorageId,\n heads: UrlHeads,\n timestamp: number\n ) {\n setSyncServerStorageId(storageId);\n setSyncServerHeads(heads);\n setSyncServerTimestamp(timestamp);\n }\n\n createEffect(() => {\n const h = props.handle;\n\n setOwnHeads(h.heads());\n\n const onChange = () => {\n if (h.doc()) setOwnHeads(h.heads());\n };\n\n const updatePeerRow = (idx: number, heads: UrlHeads, timestamp: number) => {\n const currentHeads = ownHeads();\n setPeers(idx, {\n heads,\n lastSyncTimestamp: timestamp,\n inSync: currentHeads ? A.equals(currentHeads, heads) : false,\n });\n };\n\n const onRemoteHeads = ({\n storageId,\n heads,\n timestamp,\n }: {\n storageId: StorageId;\n heads: UrlHeads;\n timestamp: number;\n }) => {\n log(\"remote-heads\", { storageId, heads, timestamp });\n const idx = peers.findIndex((p) => p.storageId === storageId);\n if (idx >= 0) updatePeerRow(idx, heads, timestamp);\n };\n\n const onSubductionHeads = (payload: {\n documentId: string;\n storageId: StorageId;\n heads: UrlHeads;\n timestamp: number;\n }) => {\n if (payload.documentId !== h.documentId) return;\n log(\"subduction-remote-heads\", payload);\n const ids = serverPeerIds();\n if (ids.length && !ids.includes(payload.storageId)) return;\n applySyncServerUpdate(payload.storageId, payload.heads, payload.timestamp);\n };\n\n h.on(\"change\", onChange);\n h.on(\"remote-heads\", onRemoteHeads);\n repo.on(\"subduction-remote-heads\", onSubductionHeads);\n\n untrack(refreshPeers);\n\n onCleanup(() => {\n h.off(\"change\", onChange);\n h.off(\"remote-heads\", onRemoteHeads);\n repo.off(\"subduction-remote-heads\", onSubductionHeads);\n });\n });\n\n // Whatever the repo already knows about the server's heads for this doc\n // (persisted sync info survives reload).\n createEffect(() => {\n const h = props.handle;\n for (const sid of serverPeerIds()) {\n const info = h.getSyncInfo(sid as StorageId);\n if (info?.lastHeads) {\n applySyncServerUpdate(\n sid as StorageId,\n info.lastHeads,\n info.lastSyncTimestamp\n );\n }\n }\n });\n\n function refreshPeers() {\n const h = props.handle;\n const currentHeads = h.heads();\n const peerList: PeerSyncInfo[] = repo.peers.map((peerId) => {\n const storageId = repo.getStorageIdOfPeer(peerId);\n const syncInfo = storageId ? h.getSyncInfo(storageId) : undefined;\n return {\n id: peerId,\n name: peerName(peerId),\n storageId,\n heads: syncInfo?.lastHeads,\n lastSyncTimestamp: syncInfo?.lastSyncTimestamp,\n inSync:\n syncInfo?.lastHeads && currentHeads\n ? A.equals(currentHeads, syncInfo.lastHeads)\n : false,\n };\n });\n\n peerList.push({\n id: \"sync-server\",\n name: \"Sync Server\",\n storageId: syncServerStorageId(),\n heads: syncServerHeads(),\n lastSyncTimestamp: syncServerTimestamp(),\n inSync: containsServerHeads(syncServerHeads()),\n });\n\n const peerOrder = (p: PeerSyncInfo) =>\n p.name === \"Shared Worker\" ? 0 : p.name === \"Sync Server\" ? 2 : 1;\n peerList.sort((a, b) => peerOrder(a) - peerOrder(b));\n\n log(\"peers\", peerList);\n setPeers(reconcile(peerList));\n }\n\n createEffect(() => {\n const currentHeads = ownHeads();\n if (!currentHeads) return;\n for (let i = 0; i < peers.length; i++) {\n const peer = peers[i];\n const inSync =\n peer.name === \"Sync Server\"\n ? containsServerHeads(peer.heads)\n : peer.heads\n ? A.equals(currentHeads, peer.heads)\n : false;\n if (peer.inSync !== inSync) {\n setPeers(i, \"inSync\", inSync);\n }\n }\n });\n\n // Single source of truth for \"are we up to date with the sync server\"; both\n // the icon and the Sync Server row read this memo.\n const syncedToServer = createMemo(() => {\n ownHeads();\n return containsServerHeads(syncServerHeads());\n });\n\n const syncServerKnown = () => !!syncServerHeads();\n\n const peerStatusLabel = (peer: PeerSyncInfo) => {\n const inSync = peer.name === \"Sync Server\" ? syncedToServer() : peer.inSync;\n return inSync ? \"synced\" : peer.heads ? \"behind\" : \"unknown\";\n };\n\n const serverRowHeads = () => {\n ownHeads();\n return trimSeenServerHeads(syncServerHeads());\n };\n\n const serverRowTimestamp = () => syncServerTimestamp();\n\n const displayHeads = (peer: PeerSyncInfo) =>\n peer.name === \"Sync Server\" ? serverRowHeads() : peer.heads;\n\n const displayTimestamp = (peer: PeerSyncInfo) =>\n peer.name === \"Sync Server\" ? serverRowTimestamp() : peer.lastSyncTimestamp;\n\n const iconState = (): \"synced\" | \"syncing\" | \"error\" | \"unknown\" => {\n if (!connected()) return \"error\";\n if (!syncServerKnown()) return \"unknown\";\n return syncedToServer() ? \"synced\" : \"syncing\";\n };\n\n const statusText = () => {\n if (!connected()) return \"Offline\";\n if (!syncServerKnown()) return \"Connecting…\";\n return syncedToServer() ? \"Synced to server\" : \"Syncing…\";\n };\n\n const onCopy = async () => {\n const data = {\n ownHeads: ownHeads(),\n connected: connected(),\n serverPeerIds: serverPeerIds(),\n syncServer: {\n storageId: syncServerStorageId(),\n heads: syncServerHeads(),\n lastSyncTimestamp: syncServerTimestamp(),\n inSync: syncedToServer(),\n },\n peers: peers.map((p) => ({\n name: p.name,\n id: p.id,\n storageId: p.storageId,\n heads: p.heads,\n lastSyncTimestamp: p.lastSyncTimestamp,\n inSync: p.inSync,\n })),\n };\n try {\n await navigator.clipboard.writeText(JSON.stringify(data, null, 2));\n log(\"copied sync state to clipboard\", data);\n } catch (err) {\n log(\"failed to copy sync state:\", err);\n }\n };\n\n const relativeTime = (ts: number | undefined) => {\n void now();\n return ts ? getRelativeTimeString(ts) : \"-\";\n };\n\n const copyHeads = async (heads: UrlHeads | undefined) => {\n if (!heads) return;\n try {\n await navigator.clipboard.writeText(JSON.stringify(heads));\n } catch (err) {\n log(\"failed to copy heads:\", err);\n }\n };\n\n return (\n <Popover open={isPopoverOpen()} onOpenChange={setIsPopoverOpen}>\n <PopoverTrigger\n class={connected() ? \"sync-trigger\" : \"sync-trigger-offline\"}\n >\n <SyncIcon size={20} state={iconState()} />\n </PopoverTrigger>\n <PopoverContent>\n <div class=\"sync-popover-body\">\n <div class=\"sync-status-header\">{statusText()}</div>\n\n <div class=\"sync-peers\">\n <div\n class=\"sync-peer sync-peer-clickable\"\n onClick={() => copyHeads(ownHeads())}\n >\n <div class=\"sync-peer-header\">\n <span class=\"sync-peer-name\">Tab</span>\n </div>\n <div class=\"sync-peer-detail\">\n heads:{\" \"}\n {JSON.stringify((ownHeads() ?? []).map((h) => h.slice(0, 6)))}\n </div>\n </div>\n\n <For each={peers}>\n {(peer) => (\n <div\n class=\"sync-peer sync-peer-clickable\"\n onClick={() => copyHeads(displayHeads(peer))}\n >\n <div class=\"sync-peer-header\">\n <span class=\"sync-peer-name\">{peer.name}</span>\n <span class=\"sync-peer-status\">\n {peerStatusLabel(peer)}\n </span>\n </div>\n <Show when={displayHeads(peer)}>\n {(heads) => (\n <div class=\"sync-peer-detail\">\n heads:{\" \"}\n {JSON.stringify(heads().map((h) => h.slice(0, 6)))}\n </div>\n )}\n </Show>\n <Show when={displayTimestamp(peer)}>\n <div class=\"sync-peer-detail\">\n {relativeTime(displayTimestamp(peer))}\n </div>\n </Show>\n </div>\n )}\n </For>\n </div>\n\n <div class=\"sync-footer\">\n <Button onClick={onCopy}>\n <CopyIcon size={14} />\n </Button>\n </div>\n </div>\n </PopoverContent>\n </Popover>\n );\n}\n\nexport const renderSyncIndicator: ToolImplementation = (handle, element) => {\n element.style.width = \"fit-content\";\n element.style.zIndex = \"10\";\n\n const dispose = render(\n () => (\n <RepoContext.Provider value={element.repo}>\n <SyncIndicator handle={handle} />\n </RepoContext.Provider>\n ),\n element\n );\n return () => dispose();\n};\n"],"names":["s","m","h","d","w","y","ms","val","options","type","parse","fmtLong","fmtShort","str","match","n","msAbs","plural","name","isPlural","setup","env","createDebug","coerce","disable","enable","enabled","require$$0","destroy","key","selectColor","namespace","hash","i","prevTime","enableOverride","namespacesCache","enabledCache","debug","args","self","curr","index","format","formatter","extend","v","delimiter","newDebug","namespaces","split","ns","matchesTemplate","search","template","searchIndex","templateIndex","starIndex","matchIndex","skip","common","exports","formatArgs","save","load","useColors","localstorage","warned","module","lastC","r","define_process_env_default","formatters","error","RepoContext","createContext","useRepo","repo","useContext","getRelativeTimeString","timestamp","diff","seconds","minutes","hours","days","weeks","months","years","Button","props","_el$","_tmpl$","_$spread","_$mergeProps","class","_$insert","children","PopoverContext","Popover","internalOpen","setInternalOpen","createSignal","triggerRef","setTriggerRef","isOpen","open","undefined","setOpen","onOpenChange","_$createComponent","Provider","value","PopoverTrigger","ctx","_el$2","_tmpl$2","$$click","_$use","el","_$effect","_$className","PopoverContent","contentRef","position","setPosition","top","left","updatePosition","trigger","rect","getBoundingClientRect","bottom","Math","max","right","createEffect","on","handleClickOutside","event","target","contains","handleEscape","document","addEventListener","window","onCleanup","removeEventListener","_$memo","Portal","_el$3","_tmpl$3","_ref$","_p$","_v$","_v$2","e","_$setStyleProperty","t","_$delegateEvents","SyncIcon","size","state","firstChild","_c$","_c$2","_v$3","_v$4","_v$5","_$setAttribute","a","o","CopyIcon","log","Debug","peerName","peerId","startsWith","String","SyncIndicator","isPopoverOpen","setIsPopoverOpen","now","setNow","Date","ownHeads","setOwnHeads","connected","setConnected","isSubductionConnected","serverPeerIds","setServerPeerIds","syncServerHeads","setSyncServerHeads","syncServerTimestamp","setSyncServerTimestamp","syncServerStorageId","setSyncServerStorageId","peers","setPeers","createStore","containsServerHeads","heads","length","handle","containsHeads","trimSeenServerHeads","frontier","Set","filter","has","untrack","refreshPeers","interval","setInterval","clearInterval","refreshServerPeerIds","connectedSubductionPeerIds","then","catch","err","onConnection","off","applySyncServerUpdate","storageId","onChange","doc","updatePeerRow","idx","currentHeads","lastSyncTimestamp","inSync","A","equals","onRemoteHeads","findIndex","p","onSubductionHeads","payload","documentId","ids","includes","sid","info","getSyncInfo","lastHeads","peerList","map","getStorageIdOfPeer","syncInfo","id","push","peerOrder","sort","b","reconcile","peer","syncedToServer","createMemo","syncServerKnown","peerStatusLabel","serverRowHeads","serverRowTimestamp","displayHeads","displayTimestamp","iconState","statusText","onCopy","data","syncServer","navigator","clipboard","writeText","JSON","stringify","relativeTime","ts","copyHeads","nextSibling","_el$4","_el$5","_el$6","_el$9","slice","For","each","_el$0","_el$1","_el$10","_el$11","Show","when","_el$13","_tmpl$4","_el$12","onClick","renderSyncIndicator","element","style","width","zIndex","dispose","render"],"mappings":"ysBAIA,IAAIA,EAAI,IACJC,EAAID,EAAI,GACRE,EAAID,EAAI,GACRE,EAAID,EAAI,GACRE,EAAID,EAAI,EACRE,EAAIF,EAAI,OAgBZG,EAAiB,SAAUC,EAAKC,EAAS,CACvCA,EAAUA,GAAW,CAAA,EACrB,IAAIC,EAAO,OAAOF,EAClB,GAAIE,IAAS,UAAYF,EAAI,OAAS,EACpC,OAAOG,EAAMH,CAAG,EACX,GAAIE,IAAS,UAAY,SAASF,CAAG,EAC1C,OAAOC,EAAQ,KAAOG,EAAQJ,CAAG,EAAIK,EAASL,CAAG,EAEnD,MAAM,IAAI,MACR,wDACE,KAAK,UAAUA,CAAG,EAExB,EAUA,SAASG,EAAMG,EAAK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,CAAA,CAI5C,EAAA,IAAA,EAAA9L,EAAA0L,EAAA5K,EAKFrB,GAAM,CAAC8M,QAAS5B,GAAM,IAAA1K,UAAA,CAAA,OAAAa,EACpB8D,GAAQ,CAACX,KAAM,EAAA,CAAE,CAAA,CAAA,CAAA,CAAA,EAAAtE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAOhC,CAEO,MAAM6M,GAA0CA,CAAC5F,EAAQ6F,IAAY,CAC1EA,EAAQC,MAAMC,MAAQ,cACtBF,EAAQC,MAAME,OAAS,KAEvB,MAAMC,EAAUC,GACd,IAAAhM,EACGpC,GAAYqC,SAAQ,CAAA,IAACC,OAAK,CAAA,OAAEyL,EAAQ5N,IAAI,EAAA,IAAAoB,UAAA,CAAA,OAAAa,EACtCqE,GAAa,CAACyB,OAAAA,CAAAA,CAAc,CAAA,CAAA,CAAA,EAGjC6F,CACF,EACA,MAAO,IAAMI,EAAAA,CACf,EAAE9I,GAAA,CAAA,OAAA,CAAA","x_google_ignoreList":[0,1,2,3,4,5]}
1
+ {"version":3,"file":"SyncIndicator-oVMcVRXg.js","sources":["../../node_modules/.pnpm/ms@2.1.3/node_modules/ms/index.js","../../node_modules/.pnpm/debug@4.4.3/node_modules/debug/src/common.js","../../node_modules/.pnpm/debug@4.4.3/node_modules/debug/src/browser.js","../../node_modules/.pnpm/cabbages@0.2.10/node_modules/cabbages/output/cabbages.js","../../node_modules/.pnpm/solid-automerge@2.0.2_@automerge+automerge-repo@2.6.0-subduction.39_solid-js@1.9.11/node_modules/solid-automerge/out/context.js","../../node_modules/.pnpm/solid-automerge@2.0.2_@automerge+automerge-repo@2.6.0-subduction.39_solid-js@1.9.11/node_modules/solid-automerge/out/useRepo.js","../../src/lib/relative-time.ts","../../src/lib/ui/Button.tsx","../../src/lib/ui/Popover.tsx","../../src/SyncIcon.tsx","../../src/CopyIcon.tsx","../../src/SyncIndicator.tsx"],"sourcesContent":["/**\n * Helpers.\n */\n\nvar s = 1000;\nvar m = s * 60;\nvar h = m * 60;\nvar d = h * 24;\nvar w = d * 7;\nvar y = d * 365.25;\n\n/**\n * Parse or format the given `val`.\n *\n * Options:\n *\n * - `long` verbose formatting [false]\n *\n * @param {String|Number} val\n * @param {Object} [options]\n * @throws {Error} throw an error if val is not a non-empty string or a number\n * @return {String|Number}\n * @api public\n */\n\nmodule.exports = function (val, options) {\n options = options || {};\n var type = typeof val;\n if (type === 'string' && val.length > 0) {\n return parse(val);\n } else if (type === 'number' && isFinite(val)) {\n return options.long ? fmtLong(val) : fmtShort(val);\n }\n throw new Error(\n 'val is not a non-empty string or a valid number. val=' +\n JSON.stringify(val)\n );\n};\n\n/**\n * Parse the given `str` and return milliseconds.\n *\n * @param {String} str\n * @return {Number}\n * @api private\n */\n\nfunction parse(str) {\n str = String(str);\n if (str.length > 100) {\n return;\n }\n var match = /^(-?(?:\\d+)?\\.?\\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(\n str\n );\n if (!match) {\n return;\n }\n var n = parseFloat(match[1]);\n var type = (match[2] || 'ms').toLowerCase();\n switch (type) {\n case 'years':\n case 'year':\n case 'yrs':\n case 'yr':\n case 'y':\n return n * y;\n case 'weeks':\n case 'week':\n case 'w':\n return n * w;\n case 'days':\n case 'day':\n case 'd':\n return n * d;\n case 'hours':\n case 'hour':\n case 'hrs':\n case 'hr':\n case 'h':\n return n * h;\n case 'minutes':\n case 'minute':\n case 'mins':\n case 'min':\n case 'm':\n return n * m;\n case 'seconds':\n case 'second':\n case 'secs':\n case 'sec':\n case 's':\n return n * s;\n case 'milliseconds':\n case 'millisecond':\n case 'msecs':\n case 'msec':\n case 'ms':\n return n;\n default:\n return undefined;\n }\n}\n\n/**\n * Short format for `ms`.\n *\n * @param {Number} ms\n * @return {String}\n * @api private\n */\n\nfunction fmtShort(ms) {\n var msAbs = Math.abs(ms);\n if (msAbs >= d) {\n return Math.round(ms / d) + 'd';\n }\n if (msAbs >= h) {\n return Math.round(ms / h) + 'h';\n }\n if (msAbs >= m) {\n return Math.round(ms / m) + 'm';\n }\n if (msAbs >= s) {\n return Math.round(ms / s) + 's';\n }\n return ms + 'ms';\n}\n\n/**\n * Long format for `ms`.\n *\n * @param {Number} ms\n * @return {String}\n * @api private\n */\n\nfunction fmtLong(ms) {\n var msAbs = Math.abs(ms);\n if (msAbs >= d) {\n return plural(ms, msAbs, d, 'day');\n }\n if (msAbs >= h) {\n return plural(ms, msAbs, h, 'hour');\n }\n if (msAbs >= m) {\n return plural(ms, msAbs, m, 'minute');\n }\n if (msAbs >= s) {\n return plural(ms, msAbs, s, 'second');\n }\n return ms + ' ms';\n}\n\n/**\n * Pluralization helper.\n */\n\nfunction plural(ms, msAbs, n, name) {\n var isPlural = msAbs >= n * 1.5;\n return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');\n}\n","\n/**\n * This is the common logic for both the Node.js and web browser\n * implementations of `debug()`.\n */\n\nfunction setup(env) {\n\tcreateDebug.debug = createDebug;\n\tcreateDebug.default = createDebug;\n\tcreateDebug.coerce = coerce;\n\tcreateDebug.disable = disable;\n\tcreateDebug.enable = enable;\n\tcreateDebug.enabled = enabled;\n\tcreateDebug.humanize = require('ms');\n\tcreateDebug.destroy = destroy;\n\n\tObject.keys(env).forEach(key => {\n\t\tcreateDebug[key] = env[key];\n\t});\n\n\t/**\n\t* The currently active debug mode names, and names to skip.\n\t*/\n\n\tcreateDebug.names = [];\n\tcreateDebug.skips = [];\n\n\t/**\n\t* Map of special \"%n\" handling functions, for the debug \"format\" argument.\n\t*\n\t* Valid key names are a single, lower or upper-case letter, i.e. \"n\" and \"N\".\n\t*/\n\tcreateDebug.formatters = {};\n\n\t/**\n\t* Selects a color for a debug namespace\n\t* @param {String} namespace The namespace string for the debug instance to be colored\n\t* @return {Number|String} An ANSI color code for the given namespace\n\t* @api private\n\t*/\n\tfunction selectColor(namespace) {\n\t\tlet hash = 0;\n\n\t\tfor (let i = 0; i < namespace.length; i++) {\n\t\t\thash = ((hash << 5) - hash) + namespace.charCodeAt(i);\n\t\t\thash |= 0; // Convert to 32bit integer\n\t\t}\n\n\t\treturn createDebug.colors[Math.abs(hash) % createDebug.colors.length];\n\t}\n\tcreateDebug.selectColor = selectColor;\n\n\t/**\n\t* Create a debugger with the given `namespace`.\n\t*\n\t* @param {String} namespace\n\t* @return {Function}\n\t* @api public\n\t*/\n\tfunction createDebug(namespace) {\n\t\tlet prevTime;\n\t\tlet enableOverride = null;\n\t\tlet namespacesCache;\n\t\tlet enabledCache;\n\n\t\tfunction debug(...args) {\n\t\t\t// Disabled?\n\t\t\tif (!debug.enabled) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst self = debug;\n\n\t\t\t// Set `diff` timestamp\n\t\t\tconst curr = Number(new Date());\n\t\t\tconst ms = curr - (prevTime || curr);\n\t\t\tself.diff = ms;\n\t\t\tself.prev = prevTime;\n\t\t\tself.curr = curr;\n\t\t\tprevTime = curr;\n\n\t\t\targs[0] = createDebug.coerce(args[0]);\n\n\t\t\tif (typeof args[0] !== 'string') {\n\t\t\t\t// Anything else let's inspect with %O\n\t\t\t\targs.unshift('%O');\n\t\t\t}\n\n\t\t\t// Apply any `formatters` transformations\n\t\t\tlet index = 0;\n\t\t\targs[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {\n\t\t\t\t// If we encounter an escaped % then don't increase the array index\n\t\t\t\tif (match === '%%') {\n\t\t\t\t\treturn '%';\n\t\t\t\t}\n\t\t\t\tindex++;\n\t\t\t\tconst formatter = createDebug.formatters[format];\n\t\t\t\tif (typeof formatter === 'function') {\n\t\t\t\t\tconst val = args[index];\n\t\t\t\t\tmatch = formatter.call(self, val);\n\n\t\t\t\t\t// Now we need to remove `args[index]` since it's inlined in the `format`\n\t\t\t\t\targs.splice(index, 1);\n\t\t\t\t\tindex--;\n\t\t\t\t}\n\t\t\t\treturn match;\n\t\t\t});\n\n\t\t\t// Apply env-specific formatting (colors, etc.)\n\t\t\tcreateDebug.formatArgs.call(self, args);\n\n\t\t\tconst logFn = self.log || createDebug.log;\n\t\t\tlogFn.apply(self, args);\n\t\t}\n\n\t\tdebug.namespace = namespace;\n\t\tdebug.useColors = createDebug.useColors();\n\t\tdebug.color = createDebug.selectColor(namespace);\n\t\tdebug.extend = extend;\n\t\tdebug.destroy = createDebug.destroy; // XXX Temporary. Will be removed in the next major release.\n\n\t\tObject.defineProperty(debug, 'enabled', {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: false,\n\t\t\tget: () => {\n\t\t\t\tif (enableOverride !== null) {\n\t\t\t\t\treturn enableOverride;\n\t\t\t\t}\n\t\t\t\tif (namespacesCache !== createDebug.namespaces) {\n\t\t\t\t\tnamespacesCache = createDebug.namespaces;\n\t\t\t\t\tenabledCache = createDebug.enabled(namespace);\n\t\t\t\t}\n\n\t\t\t\treturn enabledCache;\n\t\t\t},\n\t\t\tset: v => {\n\t\t\t\tenableOverride = v;\n\t\t\t}\n\t\t});\n\n\t\t// Env-specific initialization logic for debug instances\n\t\tif (typeof createDebug.init === 'function') {\n\t\t\tcreateDebug.init(debug);\n\t\t}\n\n\t\treturn debug;\n\t}\n\n\tfunction extend(namespace, delimiter) {\n\t\tconst newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);\n\t\tnewDebug.log = this.log;\n\t\treturn newDebug;\n\t}\n\n\t/**\n\t* Enables a debug mode by namespaces. This can include modes\n\t* separated by a colon and wildcards.\n\t*\n\t* @param {String} namespaces\n\t* @api public\n\t*/\n\tfunction enable(namespaces) {\n\t\tcreateDebug.save(namespaces);\n\t\tcreateDebug.namespaces = namespaces;\n\n\t\tcreateDebug.names = [];\n\t\tcreateDebug.skips = [];\n\n\t\tconst split = (typeof namespaces === 'string' ? namespaces : '')\n\t\t\t.trim()\n\t\t\t.replace(/\\s+/g, ',')\n\t\t\t.split(',')\n\t\t\t.filter(Boolean);\n\n\t\tfor (const ns of split) {\n\t\t\tif (ns[0] === '-') {\n\t\t\t\tcreateDebug.skips.push(ns.slice(1));\n\t\t\t} else {\n\t\t\t\tcreateDebug.names.push(ns);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Checks if the given string matches a namespace template, honoring\n\t * asterisks as wildcards.\n\t *\n\t * @param {String} search\n\t * @param {String} template\n\t * @return {Boolean}\n\t */\n\tfunction matchesTemplate(search, template) {\n\t\tlet searchIndex = 0;\n\t\tlet templateIndex = 0;\n\t\tlet starIndex = -1;\n\t\tlet matchIndex = 0;\n\n\t\twhile (searchIndex < search.length) {\n\t\t\tif (templateIndex < template.length && (template[templateIndex] === search[searchIndex] || template[templateIndex] === '*')) {\n\t\t\t\t// Match character or proceed with wildcard\n\t\t\t\tif (template[templateIndex] === '*') {\n\t\t\t\t\tstarIndex = templateIndex;\n\t\t\t\t\tmatchIndex = searchIndex;\n\t\t\t\t\ttemplateIndex++; // Skip the '*'\n\t\t\t\t} else {\n\t\t\t\t\tsearchIndex++;\n\t\t\t\t\ttemplateIndex++;\n\t\t\t\t}\n\t\t\t} else if (starIndex !== -1) { // eslint-disable-line no-negated-condition\n\t\t\t\t// Backtrack to the last '*' and try to match more characters\n\t\t\t\ttemplateIndex = starIndex + 1;\n\t\t\t\tmatchIndex++;\n\t\t\t\tsearchIndex = matchIndex;\n\t\t\t} else {\n\t\t\t\treturn false; // No match\n\t\t\t}\n\t\t}\n\n\t\t// Handle trailing '*' in template\n\t\twhile (templateIndex < template.length && template[templateIndex] === '*') {\n\t\t\ttemplateIndex++;\n\t\t}\n\n\t\treturn templateIndex === template.length;\n\t}\n\n\t/**\n\t* Disable debug output.\n\t*\n\t* @return {String} namespaces\n\t* @api public\n\t*/\n\tfunction disable() {\n\t\tconst namespaces = [\n\t\t\t...createDebug.names,\n\t\t\t...createDebug.skips.map(namespace => '-' + namespace)\n\t\t].join(',');\n\t\tcreateDebug.enable('');\n\t\treturn namespaces;\n\t}\n\n\t/**\n\t* Returns true if the given mode name is enabled, false otherwise.\n\t*\n\t* @param {String} name\n\t* @return {Boolean}\n\t* @api public\n\t*/\n\tfunction enabled(name) {\n\t\tfor (const skip of createDebug.skips) {\n\t\t\tif (matchesTemplate(name, skip)) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\tfor (const ns of createDebug.names) {\n\t\t\tif (matchesTemplate(name, ns)) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}\n\n\t/**\n\t* Coerce `val`.\n\t*\n\t* @param {Mixed} val\n\t* @return {Mixed}\n\t* @api private\n\t*/\n\tfunction coerce(val) {\n\t\tif (val instanceof Error) {\n\t\t\treturn val.stack || val.message;\n\t\t}\n\t\treturn val;\n\t}\n\n\t/**\n\t* XXX DO NOT USE. This is a temporary stub function.\n\t* XXX It WILL be removed in the next major release.\n\t*/\n\tfunction destroy() {\n\t\tconsole.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');\n\t}\n\n\tcreateDebug.enable(createDebug.load());\n\n\treturn createDebug;\n}\n\nmodule.exports = setup;\n","/* eslint-env browser */\n\n/**\n * This is the web browser implementation of `debug()`.\n */\n\nexports.formatArgs = formatArgs;\nexports.save = save;\nexports.load = load;\nexports.useColors = useColors;\nexports.storage = localstorage();\nexports.destroy = (() => {\n\tlet warned = false;\n\n\treturn () => {\n\t\tif (!warned) {\n\t\t\twarned = true;\n\t\t\tconsole.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');\n\t\t}\n\t};\n})();\n\n/**\n * Colors.\n */\n\nexports.colors = [\n\t'#0000CC',\n\t'#0000FF',\n\t'#0033CC',\n\t'#0033FF',\n\t'#0066CC',\n\t'#0066FF',\n\t'#0099CC',\n\t'#0099FF',\n\t'#00CC00',\n\t'#00CC33',\n\t'#00CC66',\n\t'#00CC99',\n\t'#00CCCC',\n\t'#00CCFF',\n\t'#3300CC',\n\t'#3300FF',\n\t'#3333CC',\n\t'#3333FF',\n\t'#3366CC',\n\t'#3366FF',\n\t'#3399CC',\n\t'#3399FF',\n\t'#33CC00',\n\t'#33CC33',\n\t'#33CC66',\n\t'#33CC99',\n\t'#33CCCC',\n\t'#33CCFF',\n\t'#6600CC',\n\t'#6600FF',\n\t'#6633CC',\n\t'#6633FF',\n\t'#66CC00',\n\t'#66CC33',\n\t'#9900CC',\n\t'#9900FF',\n\t'#9933CC',\n\t'#9933FF',\n\t'#99CC00',\n\t'#99CC33',\n\t'#CC0000',\n\t'#CC0033',\n\t'#CC0066',\n\t'#CC0099',\n\t'#CC00CC',\n\t'#CC00FF',\n\t'#CC3300',\n\t'#CC3333',\n\t'#CC3366',\n\t'#CC3399',\n\t'#CC33CC',\n\t'#CC33FF',\n\t'#CC6600',\n\t'#CC6633',\n\t'#CC9900',\n\t'#CC9933',\n\t'#CCCC00',\n\t'#CCCC33',\n\t'#FF0000',\n\t'#FF0033',\n\t'#FF0066',\n\t'#FF0099',\n\t'#FF00CC',\n\t'#FF00FF',\n\t'#FF3300',\n\t'#FF3333',\n\t'#FF3366',\n\t'#FF3399',\n\t'#FF33CC',\n\t'#FF33FF',\n\t'#FF6600',\n\t'#FF6633',\n\t'#FF9900',\n\t'#FF9933',\n\t'#FFCC00',\n\t'#FFCC33'\n];\n\n/**\n * Currently only WebKit-based Web Inspectors, Firefox >= v31,\n * and the Firebug extension (any Firefox version) are known\n * to support \"%c\" CSS customizations.\n *\n * TODO: add a `localStorage` variable to explicitly enable/disable colors\n */\n\n// eslint-disable-next-line complexity\nfunction useColors() {\n\t// NB: In an Electron preload script, document will be defined but not fully\n\t// initialized. Since we know we're in Chrome, we'll just detect this case\n\t// explicitly\n\tif (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {\n\t\treturn true;\n\t}\n\n\t// Internet Explorer and Edge do not support colors.\n\tif (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\\/(\\d+)/)) {\n\t\treturn false;\n\t}\n\n\tlet m;\n\n\t// Is webkit? http://stackoverflow.com/a/16459606/376773\n\t// document is undefined in react-native: https://github.com/facebook/react-native/pull/1632\n\t// eslint-disable-next-line no-return-assign\n\treturn (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||\n\t\t// Is firebug? http://stackoverflow.com/a/398120/376773\n\t\t(typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||\n\t\t// Is firefox >= v31?\n\t\t// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages\n\t\t(typeof navigator !== 'undefined' && navigator.userAgent && (m = navigator.userAgent.toLowerCase().match(/firefox\\/(\\d+)/)) && parseInt(m[1], 10) >= 31) ||\n\t\t// Double check webkit in userAgent just in case we are in a worker\n\t\t(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\\/(\\d+)/));\n}\n\n/**\n * Colorize log arguments if enabled.\n *\n * @api public\n */\n\nfunction formatArgs(args) {\n\targs[0] = (this.useColors ? '%c' : '') +\n\t\tthis.namespace +\n\t\t(this.useColors ? ' %c' : ' ') +\n\t\targs[0] +\n\t\t(this.useColors ? '%c ' : ' ') +\n\t\t'+' + module.exports.humanize(this.diff);\n\n\tif (!this.useColors) {\n\t\treturn;\n\t}\n\n\tconst c = 'color: ' + this.color;\n\targs.splice(1, 0, c, 'color: inherit');\n\n\t// The final \"%c\" is somewhat tricky, because there could be other\n\t// arguments passed either before or after the %c, so we need to\n\t// figure out the correct index to insert the CSS into\n\tlet index = 0;\n\tlet lastC = 0;\n\targs[0].replace(/%[a-zA-Z%]/g, match => {\n\t\tif (match === '%%') {\n\t\t\treturn;\n\t\t}\n\t\tindex++;\n\t\tif (match === '%c') {\n\t\t\t// We only are interested in the *last* %c\n\t\t\t// (the user may have provided their own)\n\t\t\tlastC = index;\n\t\t}\n\t});\n\n\targs.splice(lastC, 0, c);\n}\n\n/**\n * Invokes `console.debug()` when available.\n * No-op when `console.debug` is not a \"function\".\n * If `console.debug` is not available, falls back\n * to `console.log`.\n *\n * @api public\n */\nexports.log = console.debug || console.log || (() => {});\n\n/**\n * Save `namespaces`.\n *\n * @param {String} namespaces\n * @api private\n */\nfunction save(namespaces) {\n\ttry {\n\t\tif (namespaces) {\n\t\t\texports.storage.setItem('debug', namespaces);\n\t\t} else {\n\t\t\texports.storage.removeItem('debug');\n\t\t}\n\t} catch (error) {\n\t\t// Swallow\n\t\t// XXX (@Qix-) should we be logging these?\n\t}\n}\n\n/**\n * Load `namespaces`.\n *\n * @return {String} returns the previously persisted debug modes\n * @api private\n */\nfunction load() {\n\tlet r;\n\ttry {\n\t\tr = exports.storage.getItem('debug') || exports.storage.getItem('DEBUG') ;\n\t} catch (error) {\n\t\t// Swallow\n\t\t// XXX (@Qix-) should we be logging these?\n\t}\n\n\t// If debug isn't set in LS, and we're in Electron, try to load $DEBUG\n\tif (!r && typeof process !== 'undefined' && 'env' in process) {\n\t\tr = process.env.DEBUG;\n\t}\n\n\treturn r;\n}\n\n/**\n * Localstorage attempts to return the localstorage.\n *\n * This is necessary because safari throws\n * when a user disables cookies/localstorage\n * and you attempt to access it.\n *\n * @return {LocalStorage}\n * @api private\n */\n\nfunction localstorage() {\n\ttry {\n\t\t// TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context\n\t\t// The Browser also has localStorage in the global context.\n\t\treturn localStorage;\n\t} catch (error) {\n\t\t// Swallow\n\t\t// XXX (@Qix-) should we be logging these?\n\t}\n}\n\nmodule.exports = require('./common')(exports);\n\nconst {formatters} = module.exports;\n\n/**\n * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.\n */\n\nformatters.j = function (v) {\n\ttry {\n\t\treturn JSON.stringify(v);\n\t} catch (error) {\n\t\treturn '[UnexpectedJSONParseError]: ' + error.message;\n\t}\n};\n","// cabbages.ts\nimport debug from \"debug\";\nvar log = debug(\"cabbages\");\nfunction pojo(target) {\n return typeof target == \"object\" && typeof target != null && Object.getPrototypeOf(target) == Object.prototype;\n}\nvar BLOCK_MARKER = \"\\uFFFC\";\nfunction apply(target, ...rest) {\n if (rest.length == 0) {\n log(\"empty patch\");\n return;\n }\n const [path, range, val] = rest;\n let p = [...path];\n while (true) {\n let key = p.shift();\n if (!p.length) {\n const RANGE_ARRAY = Array.isArray(range);\n if (pojo(target) && RANGE_ARRAY && typeof key == \"undefined\" && typeof range[0] == \"string\") {\n delete target[range[0]];\n return;\n }\n if (RANGE_ARRAY || typeof range == \"number\") {\n if (typeof key == \"undefined\") {\n throw new Error(\"cant treat top level as a seq\");\n }\n key = key;\n let [start, end] = Array.isArray(range) ? range : [range, range + 1];\n const ZERO_LENGTH = Array.isArray(range) && range.length == 0;\n if (!ZERO_LENGTH && (start == null || end == null)) {\n throw new RangeError(\"it's all or nothing, no half measures\");\n }\n const DELETE = typeof val == \"undefined\";\n const INSERT = start === end && !DELETE;\n const APPEND = ZERO_LENGTH && !DELETE;\n const REPLACE = !INSERT && !DELETE && !APPEND;\n if (typeof target[key] == \"undefined\") {\n if (typeof target == \"string\") {\n return;\n } else if (typeof val == \"string\") {\n target[key] = \"\";\n } else {\n target[key] = [];\n }\n }\n let seq = target[key];\n if (Array.isArray(seq)) {\n if (APPEND) {\n Array.isArray(val) ? seq.push(...val) : seq.push(val);\n return;\n }\n if (INSERT || REPLACE) {\n Array.isArray(val) ? seq.splice(start, end - start, ...val) : seq.splice(start, end - start, val);\n return;\n }\n if (DELETE) {\n seq.splice(start, end - start);\n return;\n }\n throw new Error(\"i don't know what happened\");\n }\n if (typeof seq == \"string\") {\n if (APPEND) {\n target[key] = seq + val;\n return;\n }\n if (REPLACE || INSERT) {\n target[key] = seq.slice(0, start) + (typeof val == \"string\" ? val : val.map(\n (n) => typeof n == \"string\" ? n : BLOCK_MARKER\n ).join(\"\")) + seq.slice(end);\n return;\n }\n if (DELETE) {\n target[key] = seq.slice(0, start) + seq.slice(end);\n return;\n }\n throw new Error(\"i don't know what happened\");\n }\n if (pojo(seq) && RANGE_ARRAY && typeof range[0] == \"string\") {\n delete seq[range[0]];\n return;\n }\n throw new Error(\"not implemented\");\n }\n if (typeof key == \"undefined\") {\n if (typeof range != \"string\") {\n throw new Error(`can't index top-level map with ${range}`);\n }\n if (typeof val == \"undefined\") {\n delete target[range];\n } else {\n target[range] = val;\n }\n return;\n }\n if (typeof target[key] == \"undefined\") {\n target[key] = {};\n }\n if (RANGE_ARRAY) {\n let [a, b] = range;\n if (a != null && b != null) {\n if (typeof val == \"undefined\" && a != null && b != null) {\n delete target[key][a || b];\n } else {\n target[key][a || b] = val;\n }\n }\n } else {\n if (typeof val == \"undefined\") {\n delete target[key][range];\n } else if (typeof target[key] == \"string\") {\n return;\n } else {\n target[key][range] = val;\n }\n }\n return;\n }\n if (typeof key == \"undefined\") {\n throw new Error(\"cant treat top level as a seq\");\n }\n key = key;\n let nextkey = p[0];\n if (typeof target[key] == \"undefined\") {\n if (typeof nextkey == \"string\") {\n target[key] = {};\n } else if (typeof nextkey == \"number\") {\n target[key] = [];\n } else {\n throw new Error(`can't go down this road ${target}.${key}.${nextkey}`);\n }\n }\n target = target[key];\n }\n}\nvar patch = apply;\nfunction get(obj, key) {\n for (let p = 0; p < key.length; p++) {\n obj = obj ? obj[key[p]] : void 0;\n }\n return obj;\n}\nfunction fromAutomerge(autopatch, payload) {\n const path = autopatch.path.slice(0, -1);\n const key = autopatch.path[autopatch.path.length - 1];\n switch (autopatch.action) {\n case \"mark\":\n case \"unmark\":\n log(\n `skipping ${autopatch.action} because it doesn't affect material reality`\n );\n return [];\n case \"inc\":\n if (payload) {\n return [path, key, get(payload.patchInfo.after, autopatch.path)];\n } else {\n throw new Error(\n `can't apply ${autopatch.action} without payload argument`\n );\n }\n case \"conflict\":\n if (payload) {\n return [path, key, get(payload.patchInfo.after, autopatch.path)];\n } else {\n throw new Error(\n `can't apply ${autopatch.action} without payload argument`\n );\n }\n case \"del\": {\n return typeof key == \"string\" ? [path, key] : [path, [key, key + (autopatch.length || 1)]];\n }\n case \"insert\": {\n return [\n path,\n [key, key],\n structuredClone(autopatch.values)\n ];\n }\n case \"splice\": {\n return [path, [key, key], [autopatch.value]];\n }\n case \"put\": {\n return [path, key, structuredClone(autopatch.value)];\n }\n }\n}\nexport {\n apply,\n fromAutomerge,\n patch,\n pojo\n};\n","\"use strict\";\nimport { createContext } from \"solid-js\";\nexport const RepoContext = createContext(\n null\n);\n//# sourceMappingURL=context.js.map\n","\"use strict\";\nimport { RepoContext } from \"./context.js\";\nimport { useContext } from \"solid-js\";\nexport default function useRepo() {\n const repo = useContext(RepoContext);\n if (!repo) throw new Error(\"Please wrap me in a <RepoContext value={repo}>\");\n return repo;\n}\n//# sourceMappingURL=useRepo.js.map\n","/**\n * Converts a timestamp to a relative time string (e.g. \"2 minutes ago\")\n */\nexport const getRelativeTimeString = (timestamp: number): string => {\n const now = Date.now();\n const diff = now - timestamp;\n\n const seconds = Math.floor(diff / 1000);\n const minutes = Math.floor(seconds / 60);\n const hours = Math.floor(minutes / 60);\n const days = Math.floor(hours / 24);\n const weeks = Math.floor(days / 7);\n const months = Math.floor(days / 30);\n const years = Math.floor(days / 365);\n\n if (seconds < 60) {\n return \"just now\";\n } else if (minutes < 60) {\n return `${minutes} minute${minutes === 1 ? \"\" : \"s\"} ago`;\n } else if (hours < 24) {\n return `${hours} hour${hours === 1 ? \"\" : \"s\"} ago`;\n } else if (days < 7) {\n return `${days} day${days === 1 ? \"\" : \"s\"} ago`;\n } else if (weeks < 4) {\n return `${weeks} week${weeks === 1 ? \"\" : \"s\"} ago`;\n } else if (months < 12) {\n return `${months} month${months === 1 ? \"\" : \"s\"} ago`;\n } else {\n return `${years} year${years === 1 ? \"\" : \"s\"} ago`;\n }\n};\n","import type { JSX } from \"solid-js\";\n\ninterface ButtonProps extends JSX.ButtonHTMLAttributes<HTMLButtonElement> {\n variant?: \"default\" | \"ghost\";\n size?: \"default\" | \"sm\";\n}\n\nexport function Button(props: ButtonProps) {\n return (\n <button\n {...props}\n class={`sync-copy-btn ${props.class ?? \"\"}`}\n >\n {props.children}\n </button>\n );\n}\n","import {\n type JSX,\n createSignal,\n createContext,\n useContext,\n onCleanup,\n createEffect,\n on,\n} from \"solid-js\";\nimport { Portal } from \"solid-js/web\";\n\ninterface PopoverContextValue {\n open: () => boolean;\n setOpen: (v: boolean) => void;\n triggerRef: () => HTMLButtonElement | undefined;\n setTriggerRef: (el: HTMLButtonElement) => void;\n}\n\nconst PopoverContext = createContext<PopoverContextValue>();\n\nexport function Popover(props: {\n open?: boolean;\n onOpenChange?: (open: boolean) => void;\n children: JSX.Element;\n}) {\n const [internalOpen, setInternalOpen] = createSignal(false);\n const [triggerRef, setTriggerRef] = createSignal<HTMLButtonElement>();\n\n const isOpen = () =>\n props.open !== undefined ? props.open : internalOpen();\n\n const setOpen = (v: boolean) => {\n if (props.open === undefined) {\n setInternalOpen(v);\n }\n props.onOpenChange?.(v);\n };\n\n return (\n <PopoverContext.Provider\n value={{ open: isOpen, setOpen, triggerRef, setTriggerRef }}\n >\n <div class=\"sync-popover-wrapper\">{props.children}</div>\n </PopoverContext.Provider>\n );\n}\n\nexport function PopoverTrigger(props: {\n class?: string;\n children: JSX.Element;\n}) {\n const ctx = useContext(PopoverContext)!;\n\n return (\n <button\n ref={(el) => ctx.setTriggerRef(el)}\n type=\"button\"\n class={props.class ?? \"\"}\n onClick={() => ctx.setOpen(!ctx.open())}\n >\n {props.children}\n </button>\n );\n}\n\nexport function PopoverContent(props: {\n class?: string;\n children: JSX.Element;\n}) {\n const ctx = useContext(PopoverContext)!;\n let contentRef!: HTMLDivElement;\n const [position, setPosition] = createSignal({ top: 0, left: 0 });\n\n const updatePosition = () => {\n const trigger = ctx.triggerRef();\n if (!trigger) return;\n const rect = trigger.getBoundingClientRect();\n setPosition({\n top: rect.bottom + 8,\n left: Math.max(0, rect.right - 288),\n });\n };\n\n createEffect(\n on(ctx.open, (open) => {\n if (!open) return;\n\n updatePosition();\n\n const handleClickOutside = (event: MouseEvent) => {\n const target = event.target as Node;\n if (\n contentRef &&\n !contentRef.contains(target) &&\n ctx.triggerRef() &&\n !ctx.triggerRef()!.contains(target)\n ) {\n ctx.setOpen(false);\n }\n };\n\n const handleEscape = (event: KeyboardEvent) => {\n if (event.key === \"Escape\") {\n ctx.setOpen(false);\n }\n };\n\n document.addEventListener(\"mousedown\", handleClickOutside);\n document.addEventListener(\"keydown\", handleEscape);\n window.addEventListener(\"resize\", updatePosition);\n window.addEventListener(\"scroll\", updatePosition, true);\n\n onCleanup(() => {\n document.removeEventListener(\"mousedown\", handleClickOutside);\n document.removeEventListener(\"keydown\", handleEscape);\n window.removeEventListener(\"resize\", updatePosition);\n window.removeEventListener(\"scroll\", updatePosition, true);\n });\n })\n );\n\n return (\n <>\n {ctx.open() && (\n <Portal>\n <div\n ref={contentRef}\n class=\"sync-popover\"\n style={{\n top: `${position().top}px`,\n left: `${position().left}px`,\n }}\n >\n {props.children}\n </div>\n </Portal>\n )}\n </>\n );\n}\n","interface SyncIconProps {\n size?: number;\n class?: string;\n state?: \"synced\" | \"syncing\" | \"error\" | \"unknown\";\n}\n\nexport function SyncIcon(props: SyncIconProps) {\n const s = () => props.size ?? 20;\n const state = () => props.state ?? \"synced\";\n\n return (\n <svg\n width={s()}\n height={s()}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n class={props.class ?? \"\"}\n >\n <circle\n cx=\"12\"\n cy=\"12\"\n r=\"8\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n fill=\"currentColor\"\n fill-opacity={state() === \"synced\" ? 1 : 0}\n style={{\n transition: state() === \"synced\"\n ? \"fill-opacity 0s\"\n : \"fill-opacity 2s ease-out\",\n }}\n />\n {state() === \"error\" && (\n <circle cx=\"12\" cy=\"12\" r=\"2.5\" fill=\"currentColor\" />\n )}\n {state() === \"unknown\" && (\n <text\n x=\"12\"\n y=\"12\"\n text-anchor=\"middle\"\n dominant-baseline=\"central\"\n fill=\"currentColor\"\n font-size=\"11\"\n font-weight=\"bold\"\n >\n ?\n </text>\n )}\n </svg>\n );\n}\n","interface CopyIconProps {\n size?: number;\n}\n\nexport function CopyIcon(props: CopyIconProps) {\n const s = () => props.size ?? 14;\n return (\n <svg\n width={s()}\n height={s()}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n >\n <rect x=\"9\" y=\"9\" width=\"13\" height=\"13\" rx=\"2\" ry=\"2\" />\n <path d=\"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1\" />\n </svg>\n );\n}\n","import Debug from \"debug\";\nimport * as A from \"@automerge/automerge/slim\";\nimport {\n type DocHandle,\n type StorageId,\n type UrlHeads,\n type PeerId,\n} from \"@automerge/automerge-repo/slim\";\nimport { useRepo, RepoContext } from \"solid-automerge\";\nimport {\n createSignal,\n createMemo,\n createEffect,\n on,\n onCleanup,\n untrack,\n Show,\n For,\n} from \"solid-js\";\nimport { createStore, reconcile } from \"solid-js/store\";\nimport { render } from \"solid-js/web\";\nimport type { ToolImplementation } from \"@inkandswitch/patchwork-plugins\";\nimport { getRelativeTimeString } from \"./lib/relative-time\";\nimport { Button, Popover, PopoverTrigger, PopoverContent } from \"./lib/ui\";\nimport { SyncIcon } from \"./SyncIcon\";\nimport { CopyIcon } from \"./CopyIcon\";\nimport \"./styles.css\";\n\nconst log = Debug(\"patchwork:sync-indicator\");\n\nexport { RepoContext };\n\ninterface PeerSyncInfo {\n id: string;\n name: string;\n storageId: StorageId | undefined;\n heads: UrlHeads | undefined;\n lastSyncTimestamp: number | undefined;\n inSync: boolean;\n}\n\nfunction peerName(peerId: PeerId): string {\n if (\n peerId.startsWith(\"shared-worker\") ||\n peerId.startsWith(\"automerge-worker\")\n )\n return \"Shared Worker\";\n if (peerId.startsWith(\"service-worker\")) return \"Service Worker\";\n if (peerId.startsWith(\"storage-server\")) return \"Sync Server\";\n return String(peerId);\n}\n\nexport function SyncIndicator(props: { handle: DocHandle<unknown> }) {\n const repo = useRepo();\n const [isPopoverOpen, setIsPopoverOpen] = createSignal(false);\n const [now, setNow] = createSignal(Date.now());\n const [ownHeads, setOwnHeads] = createSignal<UrlHeads | undefined>();\n\n // The tab's repo talks to the sync server itself over a Subduction websocket,\n // so connection state and server heads come straight off the repo.\n const [connected, setConnected] = createSignal(repo.isSubductionConnected());\n const [serverPeerIds, setServerPeerIds] = createSignal<string[]>([]);\n\n const [syncServerHeads, setSyncServerHeads] = createSignal<\n UrlHeads | undefined\n >();\n const [syncServerTimestamp, setSyncServerTimestamp] = createSignal<\n number | undefined\n >();\n const [syncServerStorageId, setSyncServerStorageId] = createSignal<\n StorageId | undefined\n >();\n\n // classic automerge-sync peers (other tabs, workers)\n const [peers, setPeers] = createStore<PeerSyncInfo[]>([]);\n\n // The server advertises Subduction *sedimentree* heads, NOT the Automerge\n // frontier, so they can't be compared to ours with A.equals. Ask the handle\n // whether we already hold everything the server advertises instead.\n const containsServerHeads = (heads: UrlHeads | undefined): boolean => {\n if (!heads || heads.length === 0) return false;\n try {\n return props.handle.containsHeads(heads);\n } catch {\n return false;\n }\n };\n\n /**\n * Trim the sync server's advertised heads for display: drop heads we already\n * hold in our history, keeping our current frontier tip(s) plus any head we\n * genuinely lack. Display only; the synced verdict considers the full set.\n */\n function trimSeenServerHeads(\n heads: UrlHeads | undefined\n ): UrlHeads | undefined {\n if (!heads) return heads;\n\n let frontier: Set<string>;\n try {\n frontier = new Set<string>([...props.handle.heads()]);\n } catch {\n return heads;\n }\n\n return heads.filter((h) => {\n if (frontier.has(h)) return true;\n try {\n return !props.handle.containsHeads([h] as UrlHeads);\n } catch {\n return true;\n }\n }) as UrlHeads;\n }\n\n createEffect(\n on(isPopoverOpen, (open) => {\n if (!open) return;\n untrack(refreshPeers);\n const interval = setInterval(() => setNow(Date.now()), 1000);\n onCleanup(() => clearInterval(interval));\n })\n );\n\n const refreshServerPeerIds = () => {\n repo\n .connectedSubductionPeerIds()\n .then(setServerPeerIds)\n .catch((err) => log(\"connectedSubductionPeerIds failed\", err));\n };\n\n createEffect(() => {\n const onConnection = ({ connected }: { connected: boolean }) => {\n setConnected(connected);\n if (connected) refreshServerPeerIds();\n else setServerPeerIds([]);\n };\n repo.on(\"subduction-connection\", onConnection);\n setConnected(repo.isSubductionConnected());\n refreshServerPeerIds();\n onCleanup(() => repo.off(\"subduction-connection\", onConnection));\n });\n\n function applySyncServerUpdate(\n storageId: StorageId,\n heads: UrlHeads,\n timestamp: number\n ) {\n setSyncServerStorageId(storageId);\n setSyncServerHeads(heads);\n setSyncServerTimestamp(timestamp);\n }\n\n createEffect(() => {\n const h = props.handle;\n\n setOwnHeads(h.heads());\n\n const onChange = () => {\n if (h.doc()) setOwnHeads(h.heads());\n };\n\n const updatePeerRow = (idx: number, heads: UrlHeads, timestamp: number) => {\n const currentHeads = ownHeads();\n setPeers(idx, {\n heads,\n lastSyncTimestamp: timestamp,\n inSync: currentHeads ? A.equals(currentHeads, heads) : false,\n });\n };\n\n const onRemoteHeads = ({\n storageId,\n heads,\n timestamp,\n }: {\n storageId: StorageId;\n heads: UrlHeads;\n timestamp: number;\n }) => {\n log(\"remote-heads\", { storageId, heads, timestamp });\n const idx = peers.findIndex((p) => p.storageId === storageId);\n if (idx >= 0) updatePeerRow(idx, heads, timestamp);\n };\n\n const onSubductionHeads = (payload: {\n documentId: string;\n storageId: StorageId;\n heads: UrlHeads;\n timestamp: number;\n }) => {\n if (payload.documentId !== h.documentId) return;\n log(\"subduction-remote-heads\", payload);\n const ids = serverPeerIds();\n if (ids.length && !ids.includes(payload.storageId)) return;\n applySyncServerUpdate(payload.storageId, payload.heads, payload.timestamp);\n };\n\n h.on(\"change\", onChange);\n h.on(\"remote-heads\", onRemoteHeads);\n repo.on(\"subduction-remote-heads\", onSubductionHeads);\n\n untrack(refreshPeers);\n\n onCleanup(() => {\n h.off(\"change\", onChange);\n h.off(\"remote-heads\", onRemoteHeads);\n repo.off(\"subduction-remote-heads\", onSubductionHeads);\n });\n });\n\n // Whatever the repo already knows about the server's heads for this doc\n // (persisted sync info survives reload).\n createEffect(() => {\n const h = props.handle;\n for (const sid of serverPeerIds()) {\n const info = h.getSyncInfo(sid as StorageId);\n if (info?.lastHeads) {\n applySyncServerUpdate(\n sid as StorageId,\n info.lastHeads,\n info.lastSyncTimestamp\n );\n }\n }\n });\n\n function refreshPeers() {\n const h = props.handle;\n const currentHeads = h.heads();\n const peerList: PeerSyncInfo[] = repo.peers.map((peerId) => {\n const storageId = repo.getStorageIdOfPeer(peerId);\n const syncInfo = storageId ? h.getSyncInfo(storageId) : undefined;\n return {\n id: peerId,\n name: peerName(peerId),\n storageId,\n heads: syncInfo?.lastHeads,\n lastSyncTimestamp: syncInfo?.lastSyncTimestamp,\n inSync:\n syncInfo?.lastHeads && currentHeads\n ? A.equals(currentHeads, syncInfo.lastHeads)\n : false,\n };\n });\n\n peerList.push({\n id: \"sync-server\",\n name: \"Sync Server\",\n storageId: syncServerStorageId(),\n heads: syncServerHeads(),\n lastSyncTimestamp: syncServerTimestamp(),\n inSync: containsServerHeads(syncServerHeads()),\n });\n\n const peerOrder = (p: PeerSyncInfo) =>\n p.name === \"Shared Worker\" ? 0 : p.name === \"Sync Server\" ? 2 : 1;\n peerList.sort((a, b) => peerOrder(a) - peerOrder(b));\n\n log(\"peers\", peerList);\n setPeers(reconcile(peerList));\n }\n\n createEffect(() => {\n const currentHeads = ownHeads();\n if (!currentHeads) return;\n for (let i = 0; i < peers.length; i++) {\n const peer = peers[i];\n const inSync =\n peer.name === \"Sync Server\"\n ? containsServerHeads(peer.heads)\n : peer.heads\n ? A.equals(currentHeads, peer.heads)\n : false;\n if (peer.inSync !== inSync) {\n setPeers(i, \"inSync\", inSync);\n }\n }\n });\n\n // Single source of truth for \"are we up to date with the sync server\"; both\n // the icon and the Sync Server row read this memo.\n const syncedToServer = createMemo(() => {\n ownHeads();\n return containsServerHeads(syncServerHeads());\n });\n\n const syncServerKnown = () => !!syncServerHeads();\n\n const peerStatusLabel = (peer: PeerSyncInfo) => {\n const inSync = peer.name === \"Sync Server\" ? syncedToServer() : peer.inSync;\n return inSync ? \"synced\" : peer.heads ? \"behind\" : \"unknown\";\n };\n\n const serverRowHeads = () => {\n ownHeads();\n return trimSeenServerHeads(syncServerHeads());\n };\n\n const serverRowTimestamp = () => syncServerTimestamp();\n\n const displayHeads = (peer: PeerSyncInfo) =>\n peer.name === \"Sync Server\" ? serverRowHeads() : peer.heads;\n\n const displayTimestamp = (peer: PeerSyncInfo) =>\n peer.name === \"Sync Server\" ? serverRowTimestamp() : peer.lastSyncTimestamp;\n\n const iconState = (): \"synced\" | \"syncing\" | \"error\" | \"unknown\" => {\n if (!connected()) return \"error\";\n if (!syncServerKnown()) return \"unknown\";\n return syncedToServer() ? \"synced\" : \"syncing\";\n };\n\n const statusText = () => {\n if (!connected()) return \"Offline\";\n if (!syncServerKnown()) return \"Connecting…\";\n return syncedToServer() ? \"Synced to server\" : \"Syncing…\";\n };\n\n const onCopy = async () => {\n const data = {\n ownHeads: ownHeads(),\n connected: connected(),\n serverPeerIds: serverPeerIds(),\n syncServer: {\n storageId: syncServerStorageId(),\n heads: syncServerHeads(),\n lastSyncTimestamp: syncServerTimestamp(),\n inSync: syncedToServer(),\n },\n peers: peers.map((p) => ({\n name: p.name,\n id: p.id,\n storageId: p.storageId,\n heads: p.heads,\n lastSyncTimestamp: p.lastSyncTimestamp,\n inSync: p.inSync,\n })),\n };\n try {\n await navigator.clipboard.writeText(JSON.stringify(data, null, 2));\n log(\"copied sync state to clipboard\", data);\n } catch (err) {\n log(\"failed to copy sync state:\", err);\n }\n };\n\n const relativeTime = (ts: number | undefined) => {\n void now();\n return ts ? getRelativeTimeString(ts) : \"-\";\n };\n\n const copyHeads = async (heads: UrlHeads | undefined) => {\n if (!heads) return;\n try {\n await navigator.clipboard.writeText(JSON.stringify(heads));\n } catch (err) {\n log(\"failed to copy heads:\", err);\n }\n };\n\n return (\n <Popover open={isPopoverOpen()} onOpenChange={setIsPopoverOpen}>\n <PopoverTrigger\n class={connected() ? \"sync-trigger\" : \"sync-trigger-offline\"}\n >\n <SyncIcon size={20} state={iconState()} />\n </PopoverTrigger>\n <PopoverContent>\n <div class=\"sync-popover-body\">\n <div class=\"sync-status-header\">{statusText()}</div>\n\n <div class=\"sync-peers\">\n <div\n class=\"sync-peer sync-peer-clickable\"\n onClick={() => copyHeads(ownHeads())}\n >\n <div class=\"sync-peer-header\">\n <span class=\"sync-peer-name\">Tab</span>\n </div>\n <div class=\"sync-peer-detail\">\n heads:{\" \"}\n {JSON.stringify((ownHeads() ?? []).map((h) => h.slice(0, 6)))}\n </div>\n </div>\n\n <For each={peers}>\n {(peer) => (\n <div\n class=\"sync-peer sync-peer-clickable\"\n onClick={() => copyHeads(displayHeads(peer))}\n >\n <div class=\"sync-peer-header\">\n <span class=\"sync-peer-name\">{peer.name}</span>\n <span class=\"sync-peer-status\">\n {peerStatusLabel(peer)}\n </span>\n </div>\n <Show when={displayHeads(peer)}>\n {(heads) => (\n <div class=\"sync-peer-detail\">\n heads:{\" \"}\n {JSON.stringify(heads().map((h) => h.slice(0, 6)))}\n </div>\n )}\n </Show>\n <Show when={displayTimestamp(peer)}>\n <div class=\"sync-peer-detail\">\n {relativeTime(displayTimestamp(peer))}\n </div>\n </Show>\n </div>\n )}\n </For>\n </div>\n\n <div class=\"sync-footer\">\n <Button onClick={onCopy}>\n <CopyIcon size={14} />\n </Button>\n </div>\n </div>\n </PopoverContent>\n </Popover>\n );\n}\n\nexport const renderSyncIndicator: ToolImplementation = (handle, element) => {\n element.style.width = \"fit-content\";\n element.style.zIndex = \"var(--studio-layer-raised, 10)\";\n\n const dispose = render(\n () => (\n <RepoContext.Provider value={element.repo}>\n <SyncIndicator handle={handle} />\n </RepoContext.Provider>\n ),\n element\n );\n return () => dispose();\n};\n"],"names":["s","m","h","d","w","y","ms","val","options","type","parse","fmtLong","fmtShort","str","match","n","msAbs","plural","name","isPlural","setup","env","createDebug","coerce","disable","enable","enabled","require$$0","destroy","key","selectColor","namespace","hash","i","prevTime","enableOverride","namespacesCache","enabledCache","debug","args","self","curr","index","format","formatter","extend","v","delimiter","newDebug","namespaces","split","ns","matchesTemplate","search","template","searchIndex","templateIndex","starIndex","matchIndex","skip","common","exports","formatArgs","save","load","useColors","localstorage","warned","module","lastC","r","define_process_env_default","formatters","error","RepoContext","createContext","useRepo","repo","useContext","getRelativeTimeString","timestamp","diff","seconds","minutes","hours","days","weeks","months","years","Button","props","_el$","_tmpl$","_$spread","_$mergeProps","class","_$insert","children","PopoverContext","Popover","internalOpen","setInternalOpen","createSignal","triggerRef","setTriggerRef","isOpen","open","undefined","setOpen","onOpenChange","_$createComponent","Provider","value","PopoverTrigger","ctx","_el$2","_tmpl$2","$$click","_$use","el","_$effect","_$className","PopoverContent","contentRef","position","setPosition","top","left","updatePosition","trigger","rect","getBoundingClientRect","bottom","Math","max","right","createEffect","on","handleClickOutside","event","target","contains","handleEscape","document","addEventListener","window","onCleanup","removeEventListener","_$memo","Portal","_el$3","_tmpl$3","_ref$","_p$","_v$","_v$2","e","_$setStyleProperty","t","_$delegateEvents","SyncIcon","size","state","firstChild","_c$","_c$2","_v$3","_v$4","_v$5","_$setAttribute","a","o","CopyIcon","log","Debug","peerName","peerId","startsWith","String","SyncIndicator","isPopoverOpen","setIsPopoverOpen","now","setNow","Date","ownHeads","setOwnHeads","connected","setConnected","isSubductionConnected","serverPeerIds","setServerPeerIds","syncServerHeads","setSyncServerHeads","syncServerTimestamp","setSyncServerTimestamp","syncServerStorageId","setSyncServerStorageId","peers","setPeers","createStore","containsServerHeads","heads","length","handle","containsHeads","trimSeenServerHeads","frontier","Set","filter","has","untrack","refreshPeers","interval","setInterval","clearInterval","refreshServerPeerIds","connectedSubductionPeerIds","then","catch","err","onConnection","off","applySyncServerUpdate","storageId","onChange","doc","updatePeerRow","idx","currentHeads","lastSyncTimestamp","inSync","A","equals","onRemoteHeads","findIndex","p","onSubductionHeads","payload","documentId","ids","includes","sid","info","getSyncInfo","lastHeads","peerList","map","getStorageIdOfPeer","syncInfo","id","push","peerOrder","sort","b","reconcile","peer","syncedToServer","createMemo","syncServerKnown","peerStatusLabel","serverRowHeads","serverRowTimestamp","displayHeads","displayTimestamp","iconState","statusText","onCopy","data","syncServer","navigator","clipboard","writeText","JSON","stringify","relativeTime","ts","copyHeads","nextSibling","_el$4","_el$5","_el$6","_el$9","slice","For","each","_el$0","_el$1","_el$10","_el$11","Show","when","_el$13","_tmpl$4","_el$12","onClick","renderSyncIndicator","element","style","width","zIndex","dispose","render"],"mappings":"ysBAIA,IAAIA,EAAI,IACJC,EAAID,EAAI,GACRE,EAAID,EAAI,GACRE,EAAID,EAAI,GACRE,EAAID,EAAI,EACRE,EAAIF,EAAI,OAgBZG,EAAiB,SAAUC,EAAKC,EAAS,CACvCA,EAAUA,GAAW,CAAA,EACrB,IAAIC,EAAO,OAAOF,EAClB,GAAIE,IAAS,UAAYF,EAAI,OAAS,EACpC,OAAOG,EAAMH,CAAG,EACX,GAAIE,IAAS,UAAY,SAASF,CAAG,EAC1C,OAAOC,EAAQ,KAAOG,EAAQJ,CAAG,EAAIK,EAASL,CAAG,EAEnD,MAAM,IAAI,MACR,wDACE,KAAK,UAAUA,CAAG,EAExB,EAUA,SAASG,EAAMG,EAAK,CAElB,GADAA,EAAM,OAAOA,CAAG,EACZ,EAAAA,EAAI,OAAS,KAGjB,KAAIC,EAAQ,mIAAmI,KAC7ID,GAEF,GAAKC,EAGL,KAAIC,EAAI,WAAWD,EAAM,CAAC,CAAC,EACvBL,GAAQK,EAAM,CAAC,GAAK,MAAM,YAAW,EACzC,OAAQL,EAAI,CACV,IAAK,QACL,IAAK,OACL,IAAK,MACL,IAAK,KACL,IAAK,IACH,OAAOM,EAAIV,EACb,IAAK,QACL,IAAK,OACL,IAAK,IACH,OAAOU,EAAIX,EACb,IAAK,OACL,IAAK,MACL,IAAK,IACH,OAAOW,EAAIZ,EACb,IAAK,QACL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C,OAAK,CAAA,OAAEyL,EAAQ5N,IAAI,EAAA,IAAAoB,UAAA,CAAA,OAAAa,EACtCqE,GAAa,CAACyB,OAAAA,CAAAA,CAAc,CAAA,CAAA,CAAA,EAGjC6F,CACF,EACA,MAAO,IAAMI,EAAAA,CACf,EAAE9I,GAAA,CAAA,OAAA,CAAA","x_google_ignoreList":[0,1,2,3,4,5]}
@@ -59,7 +59,7 @@ let __tla = (async ()=>{
59
59
  forTitleBar: !0,
60
60
  async load () {
61
61
  const { renderSyncIndicator: l } = await w(async ()=>{
62
- const { renderSyncIndicator: s } = await import("./assets/SyncIndicator-B2ag1OoZ.js");
62
+ const { renderSyncIndicator: s } = await import("./assets/SyncIndicator-oVMcVRXg.js");
63
63
  return {
64
64
  renderSyncIndicator: s
65
65
  };
@@ -1,4 +1,4 @@
1
- (function(){"use strict";try{if(typeof document<"u"){var r=document.createElement("style");r.appendChild(document.createTextNode("@layer package{:root,:host,[theme]{--task-fg: var(--editor-line, black);--task-bg: var(--editor-fill, white);--task-muted: var(--editor-line-offset-50, #999);--task-border: var(--editor-fill-offset-20, #ccc);--task-family: var(--editor-family-sans, system-ui, sans-serif);--task-family-code: var(--editor-family-code, ui-monospace, monospace);--task-radius: var(--studio-radius-sm, 4px);--task-danger: var(--studio-danger, #ff6a90);--task-success: var(--studio-added, #35f7ca)}}.task-browser{margin:4pt;font-family:var(--task-family);color:var(--task-fg)}.task-browser-layout{display:flex;flex-direction:column;align-items:flex-start;height:100%;overflow-y:auto}.task-browser-form{margin-bottom:1rem;display:flex;flex-direction:column}.task-browser-textarea{font-family:var(--task-family-code);padding:.5rem;border:1px solid var(--task-border);border-radius:var(--task-radius);width:100%;height:100%}.task-browser-submit{padding:.5rem 1rem;background:var(--task-fg);color:var(--task-bg);border-radius:var(--task-radius);border:none;cursor:pointer}.task-browser-section{margin-bottom:1rem}.task-browser-section-title{font-size:1.5rem}.task-item{margin:1rem;padding:1rem;border:1px solid var(--task-border);border-left-width:8px}.task-item--pending{border-left-color:var(--task-muted)}.task-item--failed{border-left-color:var(--task-danger)}.task-item--success{border-left-color:var(--task-success)}.task-run{background:var(--task-fg);color:var(--task-bg);padding-left:.5rem;margin-bottom:.5rem}.task-muted{color:var(--task-muted)}.task-router{margin:1rem}.task-worker{margin:1rem;padding:.5rem}.task-titlebar{display:flex;gap:.25em;align-items:center;height:100%}patchwork-view[tool-id=contact-inline]{display:inline-block;width:auto}")),document.head.appendChild(r)}}catch(a){console.error("vite-plugin-css-injected-by-js",a)}})();
1
+ (function(){"use strict";try{if(typeof document<"u"){var r=document.createElement("style");r.appendChild(document.createTextNode("@layer package{:root,:host,[theme]{--task-fg: var(--editor-line, black);--task-bg: var(--editor-fill, white);--task-muted: var(--editor-line-offset-50, #999);--task-border: var(--editor-fill-offset-20, #ccc);--task-family: var(--editor-family-sans, system-ui, sans-serif);--task-family-code: var(--editor-family-code, ui-monospace, monospace);--task-radius: var(--studio-radius-sm, 4px);--task-danger: var(--studio-danger, #ff6a90);--task-success: var(--studio-added, #35f7ca)}}.task-browser{margin:4pt;font-family:var(--task-family);color:var(--task-fg)}.task-browser-layout{display:flex;flex-direction:column;align-items:flex-start;height:100%;overflow-y:auto}.task-browser-form{margin-bottom:1rem;display:flex;flex-direction:column}.task-browser-textarea{font-family:var(--task-family-code);padding:.5rem;border:var(--studio-border-width, 1px) var(--studio-border-style, solid) var(--task-border);border-radius:var(--task-radius);width:100%;height:100%}.task-browser-submit{padding:.5rem 1rem;background:var(--task-fg);color:var(--task-bg);border-radius:var(--task-radius);border:none;cursor:var(--studio-cursor-pointer, pointer)}.task-browser-section{margin-bottom:1rem}.task-browser-section-title{font-size:1.5rem}.task-item{margin:1rem;padding:1rem;border:var(--studio-border-width, 1px) var(--studio-border-style, solid) var(--task-border);border-left-width:8px}.task-item--pending{border-left-color:var(--task-muted)}.task-item--failed{border-left-color:var(--task-danger)}.task-item--success{border-left-color:var(--task-success)}.task-run{background:var(--task-fg);color:var(--task-bg);padding-left:.5rem;margin-bottom:.5rem}.task-muted{color:var(--task-muted)}.task-router{margin:1rem}.task-worker{margin:1rem;padding:.5rem}.task-titlebar{display:flex;gap:.25em;align-items:center;height:100%}patchwork-view[tool-id=contact-inline]{display:inline-block;width:auto}")),document.head.appendChild(r)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();
2
2
  var Wa = { exports: {} }, ei = {}, Qa = { exports: {} }, K = {};
3
3
  /**
4
4
  * @license React
@@ -9,7 +9,7 @@ import {
9
9
  setThemeForMode,
10
10
  startActiveTheme,
11
11
  startActiveThemeFromProvider
12
- } from "./chunk-Z3JB7ERH.js";
12
+ } from "./chunk-DH4YUYFJ.js";
13
13
  import "./chunk-L7WQSSFT.js";
14
14
  export {
15
15
  CURRENT_THEME_SELECTOR,
@@ -23,4 +23,4 @@ export {
23
23
  startActiveTheme,
24
24
  startActiveThemeFromProvider
25
25
  };
26
- //# sourceMappingURL=active-theme-BMSIQXBV.js.map
26
+ //# sourceMappingURL=active-theme-CC3CS64F.js.map
@@ -7,7 +7,7 @@ import {
7
7
  import { getRegistry } from "@inkandswitch/patchwork-plugins";
8
8
 
9
9
  // src/theme.css
10
- var theme_default = "./theme-7OG2K56L.css";
10
+ var theme_default = "./theme-HE7ECLIW.css";
11
11
 
12
12
  // src/active-theme.ts
13
13
  var CURRENT_THEME_SELECTOR = "patchwork:current-theme";
@@ -285,4 +285,4 @@ export {
285
285
  hasThemePreferences,
286
286
  onActiveThemeChange
287
287
  };
288
- //# sourceMappingURL=chunk-Z3JB7ERH.js.map
288
+ //# sourceMappingURL=chunk-DH4YUYFJ.js.map
@@ -0,0 +1,136 @@
1
+ // src/theme-editor-datatype.ts
2
+ var EDITABLE_VARIABLES = [
3
+ { group: "Base", vars: [
4
+ { key: "--studio-fill", label: "Fill (background)", type: "color" },
5
+ { key: "--studio-line", label: "Line (foreground)", type: "color" }
6
+ ] },
7
+ { group: "Accents", vars: [
8
+ { key: "--studio-primary", label: "Primary", type: "color" },
9
+ { key: "--studio-secondary", label: "Secondary", type: "color" },
10
+ { key: "--studio-danger", label: "Danger", type: "color" },
11
+ { key: "--studio-warning", label: "Warning", type: "color" },
12
+ { key: "--studio-success", label: "Success", type: "text", placeholder: "var(--studio-added)" },
13
+ { key: "--studio-info", label: "Info", type: "text", placeholder: "var(--studio-secondary)" }
14
+ ] },
15
+ { group: "Semantic", vars: [
16
+ { key: "--studio-added", label: "Added", type: "color" },
17
+ { key: "--studio-deleted", label: "Deleted", type: "color" },
18
+ { key: "--studio-modified", label: "Modified", type: "color" },
19
+ { key: "--studio-link", label: "Link", type: "color" }
20
+ ] },
21
+ { group: "Selection", vars: [
22
+ { key: "--studio-selection-fill", label: "Selection fill", type: "color" }
23
+ ] },
24
+ { group: "Chrome", vars: [
25
+ // derived by default (see theme.css); kept as text so the var() default
26
+ // survives unless the user types a concrete value.
27
+ { key: "--studio-chrome-fill", label: "Chrome fill", type: "text" },
28
+ { key: "--studio-chrome-line", label: "Chrome line", type: "text" }
29
+ ] },
30
+ { group: "Sideboard", vars: [
31
+ { key: "--sideboard-primary", label: "Sideboard primary", type: "text" },
32
+ { key: "--sideboard-fill", label: "Sideboard fill", type: "text" }
33
+ ] },
34
+ { group: "Typography", vars: [
35
+ { key: "--studio-family-sans", label: "Sans font", type: "text" },
36
+ { key: "--studio-family-code", label: "Code font", type: "text" },
37
+ { key: "--studio-family", label: "Default font", type: "text" },
38
+ { key: "--studio-family-ui", label: "UI font", type: "text" },
39
+ { key: "--studio-family-serif", label: "Serif font", type: "text", placeholder: "Iowan Old Style, Palatino, Georgia, serif" },
40
+ { key: "--studio-font-size", label: "Font size", type: "text" },
41
+ { key: "--studio-font-weight", label: "Font weight", type: "text", placeholder: "400" },
42
+ { key: "--studio-line-height", label: "Line height", type: "text" },
43
+ { key: "--studio-letter-spacing", label: "Letter spacing", type: "text", placeholder: "normal (e.g. 0.01em)" },
44
+ { key: "--studio-chrome-letter-spacing", label: "Chrome label spacing", type: "text", placeholder: "each tool's own" },
45
+ { key: "--studio-font-features", label: "Font features", type: "text", placeholder: 'normal (e.g. "ss01", "zero")' },
46
+ { key: "--studio-font-variation", label: "Font variation", type: "text", placeholder: 'normal (e.g. "wght" 420)' },
47
+ { key: "--studio-heading-family", label: "Heading font", type: "text", placeholder: "each tool's own" },
48
+ { key: "--studio-heading-weight", label: "Heading weight", type: "text", placeholder: "each tool's own" },
49
+ { key: "--studio-font-scale", label: "Heading scale ratio", type: "text", placeholder: "each tool's own (e.g. 1.25)" }
50
+ ] },
51
+ { group: "Shape & density", vars: [
52
+ { key: "--studio-density", label: "Density", type: "text", placeholder: "1 (0.75 compact, 1.25 roomy)" },
53
+ { key: "--studio-radius-scale", label: "Corner scale", type: "text", placeholder: "1 (0 square, 1.5 soft)" },
54
+ { key: "--studio-border-width", label: "Border width", type: "text", placeholder: "1px" },
55
+ { key: "--studio-border-style", label: "Border style", type: "text", placeholder: "solid (dashed, dotted)" }
56
+ ] },
57
+ { group: "Depth", vars: [
58
+ { key: "--studio-shadow-strength", label: "Shadow strength", type: "text", placeholder: "1 (0 flat, 3 heavy)" },
59
+ { key: "--studio-shadow-color", label: "Shadow colour", type: "text", placeholder: "the line, tinted" },
60
+ { key: "--studio-backdrop", label: "Backdrop", type: "text", placeholder: "each tool's own" },
61
+ { key: "--studio-backdrop-blur", label: "Backdrop blur", type: "text", placeholder: "each tool's own (e.g. blur(8px))" }
62
+ ] },
63
+ { group: "Motion", vars: [
64
+ { key: "--studio-motion-scale", label: "Motion scale", type: "text", placeholder: "1 (0 off, 2 slow)" },
65
+ { key: "--studio-ease", label: "Easing", type: "text", placeholder: "ease" }
66
+ ] },
67
+ { group: "Focus & interaction", vars: [
68
+ { key: "--studio-focus-ring", label: "Focus ring", type: "text", placeholder: "each tool's own (e.g. 3px solid hotpink)" },
69
+ { key: "--studio-focus-ring-offset", label: "Focus ring offset", type: "text", placeholder: "each tool's own (e.g. 2px)" },
70
+ { key: "--studio-hover-fill", label: "Hover fill", type: "text", placeholder: "each tool's own" },
71
+ { key: "--studio-active-fill", label: "Pressed fill", type: "text", placeholder: "each tool's own" },
72
+ { key: "--studio-chrome-hover-fill", label: "Chrome hover fill", type: "text", placeholder: "each tool's own" },
73
+ { key: "--studio-chrome-active-fill", label: "Chrome pressed fill", type: "text", placeholder: "each tool's own" },
74
+ { key: "--studio-disabled-opacity", label: "Disabled opacity", type: "text", placeholder: "0.5" }
75
+ ] },
76
+ { group: "Cursors", vars: [
77
+ { key: "--studio-cursor-default", label: "Default", type: "text", placeholder: "default" },
78
+ { key: "--studio-cursor-pointer", label: "Pointer", type: "text", placeholder: "pointer (e.g. url(hand.svg) 4 0, pointer)" },
79
+ { key: "--studio-cursor-text", label: "Text", type: "text", placeholder: "text" },
80
+ { key: "--studio-cursor-grab", label: "Grab", type: "text", placeholder: "grab" }
81
+ ] },
82
+ { group: "Scrollbars", vars: [
83
+ { key: "--studio-scrollbar-color", label: "Scrollbar colour", type: "text", placeholder: "browser default (thumb track)" },
84
+ { key: "--studio-scrollbar-width", label: "Scrollbar width", type: "text", placeholder: "auto (thin, none)" }
85
+ ] },
86
+ { group: "Swatches", vars: [
87
+ { key: "--studio-swatch-lightness", label: "Swatch lightness", type: "text", placeholder: "0.7" },
88
+ { key: "--studio-swatch-chroma", label: "Swatch chroma", type: "text", placeholder: "0.15" }
89
+ ] }
90
+ ];
91
+ var DEFAULT_VALUES = {
92
+ "--studio-fill": "#ffffff",
93
+ "--studio-line": "#000000",
94
+ "--studio-primary": "#35f7ca",
95
+ "--studio-secondary": "#33ccf8",
96
+ "--studio-danger": "#ff6a90",
97
+ "--studio-warning": "#f8c43b",
98
+ "--studio-added": "#35f7ca",
99
+ "--studio-deleted": "#ff6a90",
100
+ "--studio-modified": "#f8c43b",
101
+ "--studio-link": "#3366ee",
102
+ "--studio-selection-fill": "#ffee8888",
103
+ // derived defaults — mirror the var() chains in theme.css so editing the
104
+ // source (fill/primary/sans) cascades unless overridden here.
105
+ "--studio-chrome-fill": "var(--studio-fill-offset-10)",
106
+ "--studio-chrome-line": "var(--studio-line)",
107
+ "--sideboard-primary": "var(--studio-primary)",
108
+ "--sideboard-fill": "var(--studio-chrome-fill)",
109
+ "--studio-family-sans": '"Jost*", "Jost", system-ui, -apple-system, sans-serif',
110
+ "--studio-family-code": '"IBM Plex Mono", ui-monospace, monospace',
111
+ "--studio-family": "var(--studio-family-sans)",
112
+ "--studio-family-ui": "var(--studio-family-sans)",
113
+ "--studio-font-size": "16px",
114
+ "--studio-line-height": "1.5"
115
+ };
116
+ var CustomThemeDatatype = {
117
+ init(doc) {
118
+ doc.name = "Custom Theme";
119
+ doc.mode = "light";
120
+ doc.variables = { ...DEFAULT_VALUES };
121
+ doc.customCss = "";
122
+ },
123
+ getTitle(doc) {
124
+ return doc.name || "Custom Theme";
125
+ },
126
+ setTitle(doc, title) {
127
+ doc.name = title;
128
+ }
129
+ };
130
+
131
+ export {
132
+ EDITABLE_VARIABLES,
133
+ DEFAULT_VALUES,
134
+ CustomThemeDatatype
135
+ };
136
+ //# sourceMappingURL=chunk-VJZ4NPK4.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/theme-editor-datatype.ts"],
4
+ "sourcesContent": ["export interface CustomThemeDoc {\n\tname: string\n\tmode: \"light\" | \"dark\"\n\tvariables: Record<string, string>\n\tcustomCss: string\n}\n\nexport interface EditableVariable {\n\tkey: string\n\tlabel: string\n\ttype: \"color\" | \"text\"\n\t/** shown when the field is empty. blank fields are left unset, so the\n\t theme.css default (or, for opt-in tokens, each tool's own value) applies. */\n\tplaceholder?: string\n}\n\nexport const EDITABLE_VARIABLES: {group: string; vars: EditableVariable[]}[] = [\n\t{group: \"Base\", vars: [\n\t\t{key: \"--studio-fill\", label: \"Fill (background)\", type: \"color\"},\n\t\t{key: \"--studio-line\", label: \"Line (foreground)\", type: \"color\"},\n\t]},\n\t{group: \"Accents\", vars: [\n\t\t{key: \"--studio-primary\", label: \"Primary\", type: \"color\"},\n\t\t{key: \"--studio-secondary\", label: \"Secondary\", type: \"color\"},\n\t\t{key: \"--studio-danger\", label: \"Danger\", type: \"color\"},\n\t\t{key: \"--studio-warning\", label: \"Warning\", type: \"color\"},\n\t\t{key: \"--studio-success\", label: \"Success\", type: \"text\", placeholder: \"var(--studio-added)\"},\n\t\t{key: \"--studio-info\", label: \"Info\", type: \"text\", placeholder: \"var(--studio-secondary)\"},\n\t]},\n\t{group: \"Semantic\", vars: [\n\t\t{key: \"--studio-added\", label: \"Added\", type: \"color\"},\n\t\t{key: \"--studio-deleted\", label: \"Deleted\", type: \"color\"},\n\t\t{key: \"--studio-modified\", label: \"Modified\", type: \"color\"},\n\t\t{key: \"--studio-link\", label: \"Link\", type: \"color\"},\n\t]},\n\t{group: \"Selection\", vars: [\n\t\t{key: \"--studio-selection-fill\", label: \"Selection fill\", type: \"color\"},\n\t]},\n\t{group: \"Chrome\", vars: [\n\t\t// derived by default (see theme.css); kept as text so the var() default\n\t\t// survives unless the user types a concrete value.\n\t\t{key: \"--studio-chrome-fill\", label: \"Chrome fill\", type: \"text\"},\n\t\t{key: \"--studio-chrome-line\", label: \"Chrome line\", type: \"text\"},\n\t]},\n\t{group: \"Sideboard\", vars: [\n\t\t{key: \"--sideboard-primary\", label: \"Sideboard primary\", type: \"text\"},\n\t\t{key: \"--sideboard-fill\", label: \"Sideboard fill\", type: \"text\"},\n\t]},\n\t{group: \"Typography\", vars: [\n\t\t{key: \"--studio-family-sans\", label: \"Sans font\", type: \"text\"},\n\t\t{key: \"--studio-family-code\", label: \"Code font\", type: \"text\"},\n\t\t{key: \"--studio-family\", label: \"Default font\", type: \"text\"},\n\t\t{key: \"--studio-family-ui\", label: \"UI font\", type: \"text\"},\n\t\t{key: \"--studio-family-serif\", label: \"Serif font\", type: \"text\", placeholder: \"Iowan Old Style, Palatino, Georgia, serif\"},\n\t\t{key: \"--studio-font-size\", label: \"Font size\", type: \"text\"},\n\t\t{key: \"--studio-font-weight\", label: \"Font weight\", type: \"text\", placeholder: \"400\"},\n\t\t{key: \"--studio-line-height\", label: \"Line height\", type: \"text\"},\n\t\t{key: \"--studio-letter-spacing\", label: \"Letter spacing\", type: \"text\", placeholder: \"normal (e.g. 0.01em)\"},\n\t\t{key: \"--studio-chrome-letter-spacing\", label: \"Chrome label spacing\", type: \"text\", placeholder: \"each tool's own\"},\n\t\t{key: \"--studio-font-features\", label: \"Font features\", type: \"text\", placeholder: \"normal (e.g. \\\"ss01\\\", \\\"zero\\\")\"},\n\t\t{key: \"--studio-font-variation\", label: \"Font variation\", type: \"text\", placeholder: \"normal (e.g. \\\"wght\\\" 420)\"},\n\t\t{key: \"--studio-heading-family\", label: \"Heading font\", type: \"text\", placeholder: \"each tool's own\"},\n\t\t{key: \"--studio-heading-weight\", label: \"Heading weight\", type: \"text\", placeholder: \"each tool's own\"},\n\t\t{key: \"--studio-font-scale\", label: \"Heading scale ratio\", type: \"text\", placeholder: \"each tool's own (e.g. 1.25)\"},\n\t]},\n\t{group: \"Shape & density\", vars: [\n\t\t{key: \"--studio-density\", label: \"Density\", type: \"text\", placeholder: \"1 (0.75 compact, 1.25 roomy)\"},\n\t\t{key: \"--studio-radius-scale\", label: \"Corner scale\", type: \"text\", placeholder: \"1 (0 square, 1.5 soft)\"},\n\t\t{key: \"--studio-border-width\", label: \"Border width\", type: \"text\", placeholder: \"1px\"},\n\t\t{key: \"--studio-border-style\", label: \"Border style\", type: \"text\", placeholder: \"solid (dashed, dotted)\"},\n\t]},\n\t{group: \"Depth\", vars: [\n\t\t{key: \"--studio-shadow-strength\", label: \"Shadow strength\", type: \"text\", placeholder: \"1 (0 flat, 3 heavy)\"},\n\t\t{key: \"--studio-shadow-color\", label: \"Shadow colour\", type: \"text\", placeholder: \"the line, tinted\"},\n\t\t{key: \"--studio-backdrop\", label: \"Backdrop\", type: \"text\", placeholder: \"each tool's own\"},\n\t\t{key: \"--studio-backdrop-blur\", label: \"Backdrop blur\", type: \"text\", placeholder: \"each tool's own (e.g. blur(8px))\"},\n\t]},\n\t{group: \"Motion\", vars: [\n\t\t{key: \"--studio-motion-scale\", label: \"Motion scale\", type: \"text\", placeholder: \"1 (0 off, 2 slow)\"},\n\t\t{key: \"--studio-ease\", label: \"Easing\", type: \"text\", placeholder: \"ease\"},\n\t]},\n\t{group: \"Focus & interaction\", vars: [\n\t\t{key: \"--studio-focus-ring\", label: \"Focus ring\", type: \"text\", placeholder: \"each tool's own (e.g. 3px solid hotpink)\"},\n\t\t{key: \"--studio-focus-ring-offset\", label: \"Focus ring offset\", type: \"text\", placeholder: \"each tool's own (e.g. 2px)\"},\n\t\t{key: \"--studio-hover-fill\", label: \"Hover fill\", type: \"text\", placeholder: \"each tool's own\"},\n\t\t{key: \"--studio-active-fill\", label: \"Pressed fill\", type: \"text\", placeholder: \"each tool's own\"},\n\t\t{key: \"--studio-chrome-hover-fill\", label: \"Chrome hover fill\", type: \"text\", placeholder: \"each tool's own\"},\n\t\t{key: \"--studio-chrome-active-fill\", label: \"Chrome pressed fill\", type: \"text\", placeholder: \"each tool's own\"},\n\t\t{key: \"--studio-disabled-opacity\", label: \"Disabled opacity\", type: \"text\", placeholder: \"0.5\"},\n\t]},\n\t{group: \"Cursors\", vars: [\n\t\t{key: \"--studio-cursor-default\", label: \"Default\", type: \"text\", placeholder: \"default\"},\n\t\t{key: \"--studio-cursor-pointer\", label: \"Pointer\", type: \"text\", placeholder: \"pointer (e.g. url(hand.svg) 4 0, pointer)\"},\n\t\t{key: \"--studio-cursor-text\", label: \"Text\", type: \"text\", placeholder: \"text\"},\n\t\t{key: \"--studio-cursor-grab\", label: \"Grab\", type: \"text\", placeholder: \"grab\"},\n\t]},\n\t{group: \"Scrollbars\", vars: [\n\t\t{key: \"--studio-scrollbar-color\", label: \"Scrollbar colour\", type: \"text\", placeholder: \"browser default (thumb track)\"},\n\t\t{key: \"--studio-scrollbar-width\", label: \"Scrollbar width\", type: \"text\", placeholder: \"auto (thin, none)\"},\n\t]},\n\t{group: \"Swatches\", vars: [\n\t\t{key: \"--studio-swatch-lightness\", label: \"Swatch lightness\", type: \"text\", placeholder: \"0.7\"},\n\t\t{key: \"--studio-swatch-chroma\", label: \"Swatch chroma\", type: \"text\", placeholder: \"0.15\"},\n\t]},\n]\n\nexport const DEFAULT_VALUES: Record<string, string> = {\n\t\"--studio-fill\": \"#ffffff\",\n\t\"--studio-line\": \"#000000\",\n\t\"--studio-primary\": \"#35f7ca\",\n\t\"--studio-secondary\": \"#33ccf8\",\n\t\"--studio-danger\": \"#ff6a90\",\n\t\"--studio-warning\": \"#f8c43b\",\n\t\"--studio-added\": \"#35f7ca\",\n\t\"--studio-deleted\": \"#ff6a90\",\n\t\"--studio-modified\": \"#f8c43b\",\n\t\"--studio-link\": \"#3366ee\",\n\t\"--studio-selection-fill\": \"#ffee8888\",\n\t// derived defaults \u2014 mirror the var() chains in theme.css so editing the\n\t// source (fill/primary/sans) cascades unless overridden here.\n\t\"--studio-chrome-fill\": \"var(--studio-fill-offset-10)\",\n\t\"--studio-chrome-line\": \"var(--studio-line)\",\n\t\"--sideboard-primary\": \"var(--studio-primary)\",\n\t\"--sideboard-fill\": \"var(--studio-chrome-fill)\",\n\t\"--studio-family-sans\": '\"Jost*\", \"Jost\", system-ui, -apple-system, sans-serif',\n\t\"--studio-family-code\": '\"IBM Plex Mono\", ui-monospace, monospace',\n\t\"--studio-family\": \"var(--studio-family-sans)\",\n\t\"--studio-family-ui\": \"var(--studio-family-sans)\",\n\t\"--studio-font-size\": \"16px\",\n\t\"--studio-line-height\": \"1.5\",\n}\n\nexport const CustomThemeDatatype = {\n\tinit(doc: any) {\n\t\tdoc.name = \"Custom Theme\"\n\t\tdoc.mode = \"light\"\n\t\tdoc.variables = {...DEFAULT_VALUES}\n\t\tdoc.customCss = \"\"\n\t},\n\tgetTitle(doc: any) {\n\t\treturn doc.name || \"Custom Theme\"\n\t},\n\tsetTitle(doc: any, title: string) {\n\t\tdoc.name = title\n\t},\n}\n"],
5
+ "mappings": ";AAgBO,IAAM,qBAAkE;AAAA,EAC9E,EAAC,OA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