@macrostrat/feedback-components 1.0.1 → 1.1.1

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 (105) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/esm/feedback-components.3b3a5357.js +137 -0
  3. package/dist/esm/feedback-components.3b3a5357.js.map +1 -0
  4. package/dist/esm/feedback-components.46a7a347.js +269 -0
  5. package/dist/esm/feedback-components.46a7a347.js.map +1 -0
  6. package/dist/esm/{node.28634e40.js → feedback-components.5509fab3.js} +11 -6
  7. package/dist/esm/feedback-components.5509fab3.js.map +1 -0
  8. package/dist/esm/feedback-components.586103e8.js +578 -0
  9. package/dist/esm/feedback-components.586103e8.js.map +1 -0
  10. package/dist/esm/{extractions.65bb73cc.js → feedback-components.5df2a926.js} +46 -18
  11. package/dist/esm/feedback-components.5df2a926.js.map +1 -0
  12. package/dist/esm/{main.module.cd706d67.js → feedback-components.6d32ee91.js} +1 -1
  13. package/dist/esm/{main.module.cd706d67.js.map → feedback-components.6d32ee91.js.map} +1 -1
  14. package/dist/esm/feedback-components.95dbe7d7.js +82 -0
  15. package/dist/esm/feedback-components.95dbe7d7.js.map +1 -0
  16. package/dist/esm/{type-selector.6e8952d6.js → feedback-components.ad9f284e.js} +6 -5
  17. package/dist/esm/feedback-components.ad9f284e.js.map +1 -0
  18. package/dist/esm/{main.module.8d366b6e.css → feedback-components.bf93773c.css} +1 -1
  19. package/dist/esm/{main.module.8d366b6e.css.map → feedback-components.bf93773c.css.map} +1 -1
  20. package/dist/esm/{main.module.2f2972c8.css → feedback-components.e273ed5b.css} +1 -1
  21. package/dist/esm/{main.module.2f2972c8.css.map → feedback-components.e273ed5b.css.map} +1 -1
  22. package/dist/esm/{main.module.d2fbdf09.js → feedback-components.f9850d85.js} +1 -1
  23. package/dist/esm/{main.module.d2fbdf09.js.map → feedback-components.f9850d85.js.map} +1 -1
  24. package/dist/esm/{edit-state.c39d8466.js → feedback-components.fa1d3641.js} +125 -7
  25. package/dist/esm/feedback-components.fa1d3641.js.map +1 -0
  26. package/dist/esm/feedback-components.fb60c70d.css +180 -0
  27. package/dist/esm/feedback-components.fb60c70d.css.map +1 -0
  28. package/dist/esm/index.d.ts +10 -64
  29. package/dist/esm/index.d.ts.map +1 -1
  30. package/dist/esm/index.js +2 -2
  31. package/dist/node/feedback-components.2f391fa4.js +2 -0
  32. package/dist/node/feedback-components.2f391fa4.js.map +1 -0
  33. package/dist/node/feedback-components.561466ac.js +2 -0
  34. package/dist/node/feedback-components.561466ac.js.map +1 -0
  35. package/dist/node/feedback-components.571ee23c.js +2 -0
  36. package/dist/node/feedback-components.571ee23c.js.map +1 -0
  37. package/dist/node/{main.module.ebdf985b.js → feedback-components.794f429b.js} +2 -2
  38. package/dist/node/feedback-components.794f429b.js.map +1 -0
  39. package/dist/node/{main.module.1fdfe813.css → feedback-components.83c21466.css} +1 -1
  40. package/dist/node/feedback-components.83c21466.css.map +1 -0
  41. package/dist/node/feedback-components.8b03e8be.js +2 -0
  42. package/dist/node/feedback-components.8b03e8be.js.map +1 -0
  43. package/dist/node/{main.module.6bc7d51b.css → feedback-components.9eb1d41a.css} +1 -1
  44. package/dist/node/feedback-components.9eb1d41a.css.map +1 -0
  45. package/dist/node/feedback-components.a39f7653.js +2 -0
  46. package/dist/node/feedback-components.a39f7653.js.map +1 -0
  47. package/dist/node/feedback-components.acac789b.js +2 -0
  48. package/dist/node/feedback-components.acac789b.js.map +1 -0
  49. package/dist/node/feedback-components.b7946db4.js +2 -0
  50. package/dist/node/feedback-components.b7946db4.js.map +1 -0
  51. package/dist/node/feedback-components.c459cc27.js +2 -0
  52. package/dist/node/feedback-components.c459cc27.js.map +1 -0
  53. package/dist/node/feedback-components.c88cb37f.css +2 -0
  54. package/dist/node/feedback-components.c88cb37f.css.map +1 -0
  55. package/dist/node/feedback-components.ec54a1e7.js +2 -0
  56. package/dist/node/feedback-components.ec54a1e7.js.map +1 -0
  57. package/dist/node/index.js +1 -1
  58. package/dist/node/index.js.map +1 -1
  59. package/package.json +7 -6
  60. package/src/extractions/index.ts +76 -21
  61. package/src/extractions/types.ts +6 -1
  62. package/src/feedback/edit-state.ts +184 -16
  63. package/src/feedback/feedback.module.sass +121 -9
  64. package/src/feedback/graph.ts +90 -32
  65. package/src/feedback/index.ts +553 -146
  66. package/src/feedback/node.ts +7 -1
  67. package/src/feedback/text-visualizer.ts +286 -49
  68. package/src/feedback/type-selector/index.ts +4 -2
  69. package/dist/esm/edit-state.c39d8466.js.map +0 -1
  70. package/dist/esm/extractions.65bb73cc.js.map +0 -1
  71. package/dist/esm/feedback.5c86878e.js +0 -252
  72. package/dist/esm/feedback.5c86878e.js.map +0 -1
  73. package/dist/esm/feedback.module.55921afe.css +0 -44
  74. package/dist/esm/feedback.module.55921afe.css.map +0 -1
  75. package/dist/esm/feedback.module.765b1e58.js +0 -28
  76. package/dist/esm/feedback.module.765b1e58.js.map +0 -1
  77. package/dist/esm/graph.f4f65d79.js +0 -83
  78. package/dist/esm/graph.f4f65d79.js.map +0 -1
  79. package/dist/esm/node.28634e40.js.map +0 -1
  80. package/dist/esm/text-visualizer.198e27ff.js +0 -101
  81. package/dist/esm/text-visualizer.198e27ff.js.map +0 -1
  82. package/dist/esm/type-selector.6e8952d6.js.map +0 -1
  83. package/dist/node/edit-state.f50ca728.js +0 -2
  84. package/dist/node/edit-state.f50ca728.js.map +0 -1
  85. package/dist/node/extractions.e6ea2eb9.js +0 -2
  86. package/dist/node/extractions.e6ea2eb9.js.map +0 -1
  87. package/dist/node/feedback.8d3d1219.js +0 -2
  88. package/dist/node/feedback.8d3d1219.js.map +0 -1
  89. package/dist/node/feedback.module.a8744203.js +0 -2
  90. package/dist/node/feedback.module.a8744203.js.map +0 -1
  91. package/dist/node/feedback.module.c4eab97d.css +0 -2
  92. package/dist/node/feedback.module.c4eab97d.css.map +0 -1
  93. package/dist/node/graph.ca5b649f.js +0 -2
  94. package/dist/node/graph.ca5b649f.js.map +0 -1
  95. package/dist/node/main.module.1857be22.js +0 -2
  96. package/dist/node/main.module.1857be22.js.map +0 -1
  97. package/dist/node/main.module.1fdfe813.css.map +0 -1
  98. package/dist/node/main.module.6bc7d51b.css.map +0 -1
  99. package/dist/node/main.module.ebdf985b.js.map +0 -1
  100. package/dist/node/node.33108ccc.js +0 -2
  101. package/dist/node/node.33108ccc.js.map +0 -1
  102. package/dist/node/text-visualizer.1e770afa.js +0 -2
  103. package/dist/node/text-visualizer.1e770afa.js.map +0 -1
  104. package/dist/node/type-selector.0035ef7d.js +0 -2
  105. package/dist/node/type-selector.0035ef7d.js.map +0 -1
@@ -1 +0,0 @@
1
- {"mappings":"A,M,Y,A,O,mB,A,O,yB,A,Q,M,mB,C,I,E,E,W,E,C,E,E,C,E,E,E,iB,A,O,I,A,C,E,S,C,E,G,K,E,O,C,C,E,C,O,C,G,K,E,C,I,E,C,C,E,A,Q,C,C,E,C,I,E,C,G,E,Q,C,C,E,O,C,C,E,C,E,E,I,C,E,O,C,E,E,O,E,E,O,A,C,I,E,A,M,uB,E,I,O,E,I,C,mB,C,C,E,Q,C,S,C,C,C,E,C,C,E,C,C,E,E,iB,C,G,E,Q,C,I,E,C,EEAA,EAAiB,AAAA,EAAA,SAAA,YAAA,CAA6C,SAAW,4CDU/D,AAAA,EAAM,MAAM,C,C,EAAC,I,E,U,C,E,O,C","sources":["<anon>","packages/feedback-components/src/extractions/index.ts","../../../../.yarn/berry/cache/@parcel-runtime-js-npm-2.13.3-f44fec8492-10c0.zip/node_modules/@parcel/runtime-js/lib/runtime-49425f4027e5bc0b.js"],"sourcesContent":["import $78C1X$classnames from \"classnames\";\nimport {Tag as $78C1X$Tag} from \"@blueprintjs/core\";\nimport {asChromaColor as $78C1X$asChromaColor} from \"@macrostrat/color-utils\";\nimport $78C1X$macrostrathyper from \"@macrostrat/hyper\";\n\n\nfunction $parcel$interopDefault(a) {\n return a && a.__esModule ? a.default : a;\n}\n\n var $parcel$global = globalThis;\n \nvar $parcel$modules = {};\nvar $parcel$inits = {};\n\nvar parcelRequire = $parcel$global[\"parcelRequire94c2\"];\n\nif (parcelRequire == null) {\n parcelRequire = function(id) {\n if (id in $parcel$modules) {\n return $parcel$modules[id].exports;\n }\n if (id in $parcel$inits) {\n var init = $parcel$inits[id];\n delete $parcel$inits[id];\n var module = {id: id, exports: {}};\n $parcel$modules[id] = module;\n init.call(module.exports, module, module.exports);\n return module.exports;\n }\n var err = new Error(\"Cannot find module '\" + id + \"'\");\n err.code = 'MODULE_NOT_FOUND';\n throw err;\n };\n\n parcelRequire.register = function register(id, init) {\n $parcel$inits[id] = init;\n };\n\n $parcel$global[\"parcelRequire94c2\"] = parcelRequire;\n}\n\nvar parcelRegister = parcelRequire.register;\nvar $6458604d63891312$exports = {};\n\n$6458604d63891312$exports = (parcelRequire(\"daZiC\")).getBundleURL('78C1X') + \"main.module.1fdfe813.css\";\n\n\n\n\n\n\nconst $8c534c0378e15a46$var$h = (0, $78C1X$macrostrathyper).styled((0, (/*@__PURE__*/$parcel$interopDefault($6458604d63891312$exports))));\nfunction $8c534c0378e15a46$export$c4b91360064ad200(entities, parent) {\n let highlights = [];\n let parents = [];\n if (parent != null) parents = [\n parent.id,\n ...parent.parents ?? []\n ];\n for (const entity of entities){\n highlights.push({\n start: entity.indices[0],\n end: entity.indices[1],\n text: entity.name,\n backgroundColor: entity.type.color ?? \"#ddd\",\n tag: entity.type.name,\n id: entity.id,\n parents: parents\n });\n highlights.push(...$8c534c0378e15a46$export$c4b91360064ad200(entity.children ?? [], entity));\n }\n return highlights;\n}\nfunction $8c534c0378e15a46$export$d60b563f571177d(extractionData, models, entityTypes) {\n return {\n ...extractionData,\n model: models.get(extractionData.model_id),\n entities: extractionData.entities?.map((d)=>$8c534c0378e15a46$var$enhanceEntity(d, entityTypes))\n };\n}\nfunction $8c534c0378e15a46$export$35baa338324d8550(baseColor, options) {\n const _baseColor = (0, $78C1X$asChromaColor)(baseColor ?? \"#ddd\");\n const { highlighted: highlighted = true, inDarkMode: inDarkMode = false, active: active = false } = options;\n let mixAmount = highlighted ? 0.8 : 0.5;\n let backgroundAlpha = highlighted ? 0.8 : 0.2;\n if (active) {\n mixAmount = 1;\n backgroundAlpha = 1;\n }\n const mixTarget = inDarkMode ? \"white\" : \"black\";\n const color = _baseColor.mix(mixTarget, mixAmount).css();\n const borderColor = highlighted ? _baseColor.mix(mixTarget, mixAmount / 2).css() : \"transparent\";\n return {\n color: color,\n backgroundColor: _baseColor.alpha(backgroundAlpha).css(),\n boxSizing: \"border-box\",\n borderStyle: \"solid\",\n borderColor: borderColor,\n borderWidth: \"1px\",\n fontWeight: active ? \"bold\" : \"normal\"\n };\n}\nfunction $8c534c0378e15a46$var$enhanceEntity(entity, entityTypes) {\n return {\n ...entity,\n type: $8c534c0378e15a46$var$addColor(entityTypes.get(entity.type), entity.match != null),\n children: entity.children?.map((d)=>$8c534c0378e15a46$var$enhanceEntity(d, entityTypes))\n };\n}\nfunction $8c534c0378e15a46$var$addColor(entityType, match = false) {\n const color = (0, $78C1X$asChromaColor)(entityType.color ?? \"#ddd\").brighten(match ? 1 : 2);\n return {\n ...entityType,\n color: color.css()\n };\n}\nfunction $8c534c0378e15a46$export$2b07158757c249e0({ data: data, entityTypes: entityTypes, matchComponent: matchComponent }) {\n const highlights = $8c534c0378e15a46$export$c4b91360064ad200(data.entities, null);\n return $8c534c0378e15a46$var$h(\"div\", [\n $8c534c0378e15a46$var$h(\"p\", $8c534c0378e15a46$var$h($8c534c0378e15a46$var$HighlightedText, {\n text: data.paragraph_text,\n highlights: highlights\n })),\n $8c534c0378e15a46$var$h($8c534c0378e15a46$export$4eb2a0ce903ce967, {\n data: data.model\n }),\n $8c534c0378e15a46$var$h(\"ul.entities\", data.entities.map((d)=>$8c534c0378e15a46$var$h($8c534c0378e15a46$var$ExtractionInfo, {\n data: d,\n matchComponent: matchComponent\n })))\n ]);\n}\nfunction $8c534c0378e15a46$export$4eb2a0ce903ce967({ data: data }) {\n return $8c534c0378e15a46$var$h(\"p.model-name\", [\n \"Model: \",\n $8c534c0378e15a46$var$h(\"code.bp5-code\", data.name)\n ]);\n}\nfunction $8c534c0378e15a46$export$117e56c71b172cde({ data: data, highlighted: highlighted = true, active: active = false, onClickType: onClickType, matchComponent: matchComponent = null }) {\n const { name: name, type: type, match: match } = data;\n const className = (0, $78C1X$classnames)({\n matched: match != null,\n type: data.type.name\n }, \"entity\");\n const style = $8c534c0378e15a46$export$35baa338324d8550(type.color ?? \"#aaaaaa\", {\n highlighted: highlighted,\n active: active\n });\n let _matchLink = null;\n if (match != null && matchComponent != null) _matchLink = $8c534c0378e15a46$var$h(matchComponent, {\n data: match\n });\n return $8c534c0378e15a46$var$h((0, $78C1X$Tag), {\n style: style,\n className: className\n }, [\n $8c534c0378e15a46$var$h(\"span.entity-name\", name),\n \" \",\n $8c534c0378e15a46$var$h(\"code.entity-type.bp5-code\", {\n onClick (evt) {\n if (active && onClickType != null) {\n onClickType(type);\n evt.stopPropagation();\n }\n }\n }, [\n type.name,\n _matchLink\n ])\n ]);\n}\nfunction $8c534c0378e15a46$var$ExtractionInfo({ data: data, matchComponent: matchComponent = null }) {\n const children = data.children ?? [];\n return $8c534c0378e15a46$var$h(\"li.entity-row\", [\n $8c534c0378e15a46$var$h($8c534c0378e15a46$export$117e56c71b172cde, {\n data: data,\n matchComponent: matchComponent\n }),\n $8c534c0378e15a46$var$h.if(children.length > 0)([\n $8c534c0378e15a46$var$h(\"ul.children\", children.map((d)=>$8c534c0378e15a46$var$h($8c534c0378e15a46$var$ExtractionInfo, {\n data: d,\n matchComponent: matchComponent\n })))\n ])\n ]);\n}\nfunction $8c534c0378e15a46$var$HighlightedText(props) {\n const { text: text, highlights: highlights = [] } = props;\n const parts = [];\n let start = 0;\n const sortedHighlights = highlights.sort((a, b)=>a.start - b.start);\n const deconflictedHighlights = sortedHighlights.map((highlight, i)=>{\n if (i === 0) return highlight;\n const prev = sortedHighlights[i - 1];\n if (highlight.start < prev.end) highlight.start = prev.end;\n return highlight;\n });\n for (const highlight of deconflictedHighlights){\n const { start: s, end: end, ...rest } = highlight;\n parts.push(text.slice(start, s));\n parts.push($8c534c0378e15a46$var$h(\"span.highlight\", {\n style: rest\n }, text.slice(s, end)));\n start = end;\n }\n parts.push(text.slice(start));\n return $8c534c0378e15a46$var$h(\"span\", parts);\n}\n\n\n//# sourceMappingURL=extractions.e6ea2eb9.js.map\n","import styles from \"./main.module.sass\";\nimport classNames from \"classnames\";\nimport { Tag } from \"@blueprintjs/core\";\nimport type { Entity, EntityExt, Highlight, EntityType } from \"./types\";\nimport { CSSProperties } from \"react\";\nimport { asChromaColor } from \"@macrostrat/color-utils\";\nimport hyper from \"@macrostrat/hyper\";\n\nexport type { Entity, EntityExt };\n\nconst h = hyper.styled(styles);\n\nexport function buildHighlights(\n entities: EntityExt[],\n parent: EntityExt | null\n): Highlight[] {\n let highlights = [];\n let parents = [];\n if (parent != null) {\n parents = [parent.id, ...(parent.parents ?? [])];\n }\n\n for (const entity of entities) {\n highlights.push({\n start: entity.indices[0],\n end: entity.indices[1],\n text: entity.name,\n backgroundColor: entity.type.color ?? \"#ddd\",\n tag: entity.type.name,\n id: entity.id,\n parents,\n });\n highlights.push(...buildHighlights(entity.children ?? [], entity));\n }\n return highlights;\n}\n\nexport function enhanceData(extractionData, models, entityTypes) {\n return {\n ...extractionData,\n model: models.get(extractionData.model_id),\n entities: extractionData.entities?.map((d) =>\n enhanceEntity(d, entityTypes)\n ),\n };\n}\n\nexport function getTagStyle(\n baseColor: string,\n options: { highlighted?: boolean; inDarkMode?: boolean; active?: boolean }\n): CSSProperties {\n const _baseColor = asChromaColor(baseColor ?? \"#ddd\");\n const { highlighted = true, inDarkMode = false, active = false } = options;\n\n let mixAmount = highlighted ? 0.8 : 0.5;\n let backgroundAlpha = highlighted ? 0.8 : 0.2;\n\n if (active) {\n mixAmount = 1;\n backgroundAlpha = 1;\n }\n\n const mixTarget = inDarkMode ? \"white\" : \"black\";\n\n const color = _baseColor.mix(mixTarget, mixAmount).css();\n const borderColor = highlighted\n ? _baseColor.mix(mixTarget, mixAmount / 2).css()\n : \"transparent\";\n\n return {\n color,\n backgroundColor: _baseColor.alpha(backgroundAlpha).css(),\n boxSizing: \"border-box\",\n borderStyle: \"solid\",\n borderColor,\n borderWidth: \"1px\",\n fontWeight: active ? \"bold\" : \"normal\",\n };\n}\n\nfunction enhanceEntity(\n entity: Entity,\n entityTypes: Map<number, EntityType>\n): EntityExt {\n return {\n ...entity,\n type: addColor(entityTypes.get(entity.type), entity.match != null),\n children: entity.children?.map((d) => enhanceEntity(d, entityTypes)),\n };\n}\n\nfunction addColor(entityType: EntityType, match = false) {\n const color = asChromaColor(entityType.color ?? \"#ddd\").brighten(\n match ? 1 : 2\n );\n\n return { ...entityType, color: color.css() };\n}\n\nexport function ExtractionContext({\n data,\n entityTypes,\n matchComponent,\n}: {\n data: any;\n entityTypes: Map<number, EntityType>;\n matchComponent: MatchComponent;\n}) {\n const highlights = buildHighlights(data.entities, null);\n\n return h(\"div\", [\n h(\"p\", h(HighlightedText, { text: data.paragraph_text, highlights })),\n h(ModelInfo, { data: data.model }),\n h(\n \"ul.entities\",\n data.entities.map((d) => h(ExtractionInfo, { data: d, matchComponent }))\n ),\n ]);\n}\n\nexport function ModelInfo({ data }) {\n return h(\"p.model-name\", [\"Model: \", h(\"code.bp5-code\", data.name)]);\n}\n\nexport type MatchComponent = (props: { data: any }) => any;\n\ntype EntityTagProps = {\n data: EntityExt;\n highlighted?: boolean;\n active?: boolean;\n onClickType?: (type: EntityType) => void;\n matchComponent?: MatchComponent;\n};\n\nexport function EntityTag({\n data,\n highlighted = true,\n active = false,\n onClickType,\n matchComponent = null,\n}: EntityTagProps) {\n const { name, type, match } = data;\n const className = classNames(\n {\n matched: match != null,\n type: data.type.name,\n },\n \"entity\"\n );\n\n const style = getTagStyle(type.color ?? \"#aaaaaa\", { highlighted, active });\n\n let _matchLink = null;\n if (match != null && matchComponent != null) {\n _matchLink = h(matchComponent, { data: match });\n }\n\n return h(Tag, { style, className }, [\n h(\"span.entity-name\", name),\n \" \",\n h(\n \"code.entity-type.bp5-code\",\n {\n onClick(evt) {\n if (active && onClickType != null) {\n onClickType(type);\n evt.stopPropagation();\n }\n },\n },\n [type.name, _matchLink]\n ),\n ]);\n}\n\nfunction ExtractionInfo({\n data,\n matchComponent = null,\n}: {\n data: EntityExt;\n matchComponent: MatchComponent;\n}) {\n const children = data.children ?? [];\n\n return h(\"li.entity-row\", [\n h(EntityTag, { data, matchComponent }),\n h.if(children.length > 0)([\n h(\n \"ul.children\",\n children.map((d) => h(ExtractionInfo, { data: d, matchComponent }))\n ),\n ]),\n ]);\n}\n\nfunction HighlightedText(props: { text: string; highlights: Highlight[] }) {\n const { text, highlights = [] } = props;\n const parts = [];\n let start = 0;\n\n const sortedHighlights = highlights.sort((a, b) => a.start - b.start);\n const deconflictedHighlights = sortedHighlights.map((highlight, i) => {\n if (i === 0) return highlight;\n const prev = sortedHighlights[i - 1];\n if (highlight.start < prev.end) {\n highlight.start = prev.end;\n }\n return highlight;\n });\n\n for (const highlight of deconflictedHighlights) {\n const { start: s, end, ...rest } = highlight;\n parts.push(text.slice(start, s));\n parts.push(h(\"span.highlight\", { style: rest }, text.slice(s, end)));\n start = end;\n }\n parts.push(text.slice(start));\n return h(\"span\", parts);\n}\n","module.exports = require('./helpers/bundle-url').getBundleURL('78C1X') + \"main.module.1fdfe813.css\";"],"names":["$78C1X$macrostrathyper","a","$parcel$global","globalThis","$parcel$modules","$parcel$inits","parcelRequire","id","exports","init","module","call","err","Error","code","register","$6458604d63891312$exports","getBundleURL","styled","__esModule","default"],"version":3,"file":"extractions.e6ea2eb9.js.map","sourceRoot":"../../../../"}
@@ -1,2 +0,0 @@
1
- import e from"@macrostrat/hyper";import"react-arborist";import"react";import"@blueprintjs/core";import"@macrostrat/ui-components";import"use-element-dimensions";var r,t=globalThis,a={},i={},o=t.parcelRequire94c2;null==o&&((o=function(e){if(e in a)return a[e].exports;if(e in i){var r=i[e];delete i[e];var t={id:e,exports:{}};return a[e]=t,r.call(t.exports,t,t.exports),t.exports}var o=Error("Cannot find module '"+e+"'");throw o.code="MODULE_NOT_FOUND",o}).register=function(e,r){i[e]=r},t.parcelRequire94c2=o),o.register;var d={};d=o("daZiC").getBundleURL("ajJMX")+"feedback.module.c4eab97d.css",o("daZiC").getBundleURL("ajJMX"),o("daZiC").getBundleURL("ajJMX"),o("edvRb"),o("eedTh"),o("daZiC").getBundleURL("ajJMX"),o("daZiC").getBundleURL("ajJMX"),e.styled((r=d)&&r.__esModule?r.default:r);
2
- //# sourceMappingURL=feedback.8d3d1219.js.map
@@ -1 +0,0 @@
1
- {"mappings":"A,O,M,mB,A,O,gB,A,O,O,A,O,mB,A,O,2B,A,O,wB,C,I,E,E,W,E,C,E,E,C,E,E,E,iB,A,O,I,A,C,E,S,C,E,G,K,E,O,C,C,E,C,O,C,G,K,E,C,I,E,C,C,E,A,Q,C,C,E,C,I,E,C,G,E,Q,C,C,E,O,C,C,E,C,E,E,I,C,E,O,C,E,E,O,E,E,O,A,C,I,E,A,M,uB,E,I,O,E,I,C,mB,C,C,E,Q,C,S,C,C,C,E,C,C,E,C,C,E,E,iB,C,G,E,Q,C,I,E,C,EEAA,EAAiB,AAAA,EAAA,SAAA,YAAA,CAA6C,SAAW,gDCAxD,AAAA,EAAA,SAAA,YAAA,CAA6C,SCA7C,AAAA,EAAA,SAAA,YAAA,CAA6C,S,E,S,E,SCA7C,AAAA,EAAA,SAAA,YAAA,CAA6C,SCA7C,AAAA,EAAA,SAAA,YAAA,CAA6C,SLgCpD,AAAA,EAAM,MAAM,C,C,EAAC,I,E,U,C,E,O,C","sources":["<anon>","packages/feedback-components/src/feedback/index.ts","../../../../.yarn/berry/cache/@parcel-runtime-js-npm-2.13.3-f44fec8492-10c0.zip/node_modules/@parcel/runtime-js/lib/runtime-48e9df14db6e0616.js","../../../../.yarn/berry/cache/@parcel-runtime-js-npm-2.13.3-f44fec8492-10c0.zip/node_modules/@parcel/runtime-js/lib/runtime-7a4060e4b11f34dc.js","../../../../.yarn/berry/cache/@parcel-runtime-js-npm-2.13.3-f44fec8492-10c0.zip/node_modules/@parcel/runtime-js/lib/runtime-e7e5dd3982ba69dc.js","../../../../.yarn/berry/cache/@parcel-runtime-js-npm-2.13.3-f44fec8492-10c0.zip/node_modules/@parcel/runtime-js/lib/runtime-058c2ef41b7519dc.js","../../../../.yarn/berry/cache/@parcel-runtime-js-npm-2.13.3-f44fec8492-10c0.zip/node_modules/@parcel/runtime-js/lib/runtime-10f2bc332c68d134.js"],"sourcesContent":["import $ajJMX$macrostrathyper from \"@macrostrat/hyper\";\nimport {Tree as $ajJMX$Tree} from \"react-arborist\";\nimport {useRef as $ajJMX$useRef, useCallback as $ajJMX$useCallback, useEffect as $ajJMX$useEffect} from \"react\";\nimport {SegmentedControl as $ajJMX$SegmentedControl, Card as $ajJMX$Card, ButtonGroup as $ajJMX$ButtonGroup} from \"@blueprintjs/core\";\nimport {FlexRow as $ajJMX$FlexRow, CancelButton as $ajJMX$CancelButton, SaveButton as $ajJMX$SaveButton, DataField as $ajJMX$DataField} from \"@macrostrat/ui-components\";\nimport $ajJMX$useelementdimensions from \"use-element-dimensions\";\n\n\nfunction $parcel$interopDefault(a) {\n return a && a.__esModule ? a.default : a;\n}\n\n var $parcel$global = globalThis;\n \nvar $parcel$modules = {};\nvar $parcel$inits = {};\n\nvar parcelRequire = $parcel$global[\"parcelRequire94c2\"];\n\nif (parcelRequire == null) {\n parcelRequire = function(id) {\n if (id in $parcel$modules) {\n return $parcel$modules[id].exports;\n }\n if (id in $parcel$inits) {\n var init = $parcel$inits[id];\n delete $parcel$inits[id];\n var module = {id: id, exports: {}};\n $parcel$modules[id] = module;\n init.call(module.exports, module, module.exports);\n return module.exports;\n }\n var err = new Error(\"Cannot find module '\" + id + \"'\");\n err.code = 'MODULE_NOT_FOUND';\n throw err;\n };\n\n parcelRequire.register = function register(id, init) {\n $parcel$inits[id] = init;\n };\n\n $parcel$global[\"parcelRequire94c2\"] = parcelRequire;\n}\n\nvar parcelRegister = parcelRequire.register;\nvar $8e7fa15260c024b8$exports = {};\n\n$8e7fa15260c024b8$exports = (parcelRequire(\"daZiC\")).getBundleURL('ajJMX') + \"feedback.module.c4eab97d.css\";\n\n\n\n\nvar $7d518355fc256b3f$exports = {};\n\n$7d518355fc256b3f$exports = (parcelRequire(\"daZiC\")).getBundleURL('ajJMX') + \"node.33108ccc.js\";\n\n\nvar $625b25e9ec34848f$exports = {};\n\n$625b25e9ec34848f$exports = (parcelRequire(\"daZiC\")).getBundleURL('ajJMX') + \"text-visualizer.1e770afa.js\";\n\n\n\nvar $edvRb = parcelRequire(\"edvRb\");\n\nvar $eedTh = parcelRequire(\"eedTh\");\n\n\nvar $9dde9e77df32d024$exports = {};\n\n$9dde9e77df32d024$exports = (parcelRequire(\"daZiC\")).getBundleURL('ajJMX') + \"type-selector.0035ef7d.js\";\n\n\n\n\nvar $d5ed517fac59fa65$exports = {};\n\n$d5ed517fac59fa65$exports = (parcelRequire(\"daZiC\")).getBundleURL('ajJMX') + \"graph.ca5b649f.js\";\n\n\nconst $2c86488f2f3c1edd$var$h = (0, $ajJMX$macrostrathyper).styled((0, (/*@__PURE__*/$parcel$interopDefault($8e7fa15260c024b8$exports))));\nfunction $2c86488f2f3c1edd$var$setsAreTheSame(a, b) {\n if (a.size !== b.size) return false;\n for (const item of a){\n if (!b.has(item)) return false;\n }\n return true;\n}\nfunction $2c86488f2f3c1edd$export$a90600c9da52b40c({ entities: entities = [], text: text, model: model, entityTypes: entityTypes, matchComponent: matchComponent, onSave: onSave }) {\n // Get the input arguments\n const [state, dispatch] = (0, $eedTh.useUpdatableTree)(entities.map($2c86488f2f3c1edd$var$processEntity), entityTypes);\n const { selectedNodes: selectedNodes, tree: tree, selectedEntityType: selectedEntityType, isSelectingEntityType: isSelectingEntityType } = state;\n const [{ width: width, height: height }, ref] = (0, $ajJMX$useelementdimensions)();\n return $2c86488f2f3c1edd$var$h((0, $eedTh.TreeDispatchContext).Provider, {\n value: dispatch\n }, [\n $2c86488f2f3c1edd$var$h((0, $625b25e9ec34848f$exports.FeedbackText), {\n text: text,\n dispatch: dispatch,\n // @ts-ignore\n nodes: tree,\n selectedNodes: selectedNodes\n }),\n $2c86488f2f3c1edd$var$h((0, $ajJMX$FlexRow), {\n alignItems: \"baseline\",\n justifyContent: \"space-between\"\n }, [\n $2c86488f2f3c1edd$var$h((0, $edvRb.ModelInfo), {\n data: model\n }),\n $2c86488f2f3c1edd$var$h((0, $ajJMX$SegmentedControl), {\n options: [\n {\n label: \"Tree\",\n value: \"tree\"\n },\n {\n label: \"Graph\",\n value: \"graph\"\n }\n ],\n value: state.viewMode,\n small: true,\n onValueChange (value) {\n console.log(\"Setting view mode\", value);\n dispatch({\n type: \"set-view-mode\",\n payload: value\n });\n }\n })\n ]),\n $2c86488f2f3c1edd$var$h(\"div.entity-panel\", {\n ref: ref\n }, [\n $2c86488f2f3c1edd$var$h((0, $ajJMX$Card), {\n className: \"control-panel\"\n }, [\n $2c86488f2f3c1edd$var$h((0, $ajJMX$ButtonGroup), {\n vertical: true,\n fill: true,\n minimal: true,\n alignText: \"left\"\n }, [\n $2c86488f2f3c1edd$var$h((0, $ajJMX$CancelButton), {\n icon: \"trash\",\n disabled: state.initialTree == state.tree,\n onClick () {\n dispatch({\n type: \"reset\"\n });\n }\n }, \"Reset\"),\n $2c86488f2f3c1edd$var$h((0, $ajJMX$SaveButton), {\n onClick () {\n onSave(state.tree);\n },\n disabled: state.initialTree == state.tree\n }, \"Save\")\n ]),\n $2c86488f2f3c1edd$var$h($2c86488f2f3c1edd$var$EntityTypeSelector, {\n entityTypes: entityTypes,\n selected: selectedEntityType,\n onChange (payload) {\n dispatch({\n type: \"select-entity-type\",\n payload: payload\n });\n },\n isOpen: isSelectingEntityType,\n setOpen: (isOpen)=>dispatch({\n type: \"toggle-entity-type-selector\",\n payload: isOpen\n })\n })\n ]),\n $2c86488f2f3c1edd$var$h.if(state.viewMode == \"tree\")($2c86488f2f3c1edd$var$ManagedSelectionTree, {\n selectedNodes: selectedNodes,\n dispatch: dispatch,\n tree: tree,\n width: width,\n height: height,\n matchComponent: matchComponent\n }),\n $2c86488f2f3c1edd$var$h.if(state.viewMode == \"graph\")((0, $d5ed517fac59fa65$exports.GraphView), {\n tree: tree,\n width: width,\n height: height\n })\n ])\n ]);\n}\nfunction $2c86488f2f3c1edd$var$processEntity(entity) {\n // @ts-ignore\n return {\n ...entity,\n // @ts-ignore\n term_type: entity.type.name,\n txt_range: [\n entity.indices\n ],\n children: entity.children?.map($2c86488f2f3c1edd$var$processEntity) ?? []\n };\n}\nfunction $2c86488f2f3c1edd$var$EntityTypeSelector({ entityTypes: entityTypes, selected: selected, isOpen: isOpen, setOpen: setOpen, onChange: onChange }) {\n // Show all entity types when selected is null\n const _selected = selected != null ? selected : undefined;\n return $2c86488f2f3c1edd$var$h((0, $ajJMX$DataField), {\n label: \"Entity type\",\n inline: true\n }, [\n $2c86488f2f3c1edd$var$h(\"code.bp5-code\", {\n onClick () {\n setOpen((d)=>!d);\n }\n }, selected.name),\n $2c86488f2f3c1edd$var$h((0, $9dde9e77df32d024$exports.OmniboxSelector), {\n isOpen: isOpen,\n items: Array.from(entityTypes.values()),\n selectedItem: _selected,\n onSelectItem (item) {\n setOpen(false);\n onChange(item);\n },\n onClose () {\n setOpen(false);\n }\n })\n ]);\n}\nfunction $2c86488f2f3c1edd$var$ManagedSelectionTree(props) {\n const { selectedNodes: selectedNodes, dispatch: dispatch, tree: tree, height: height, width: width, matchComponent: matchComponent, ...rest } = props;\n const ref = (0, $ajJMX$useRef)();\n const _Node = (0, $ajJMX$useCallback)((props)=>$2c86488f2f3c1edd$var$h((0, (/*@__PURE__*/$parcel$interopDefault($7d518355fc256b3f$exports))), {\n ...props,\n matchComponent: matchComponent\n }), [\n matchComponent\n ]);\n (0, $ajJMX$useEffect)(()=>{\n if (ref.current == null) return;\n // Check if selection matches current\n const selection = new Set(selectedNodes.map((d)=>d.toString()));\n const currentSelection = ref.current.selectedIds;\n if ($2c86488f2f3c1edd$var$setsAreTheSame(selection, currentSelection)) return;\n // If the selection is the same, do nothing\n // Set selection\n ref.current.setSelection({\n ids: selectedNodes.map((d)=>d.toString()),\n anchor: null,\n mostRecent: null\n });\n }, [\n selectedNodes\n ]);\n return $2c86488f2f3c1edd$var$h((0, $ajJMX$Tree), {\n className: \"selection-tree\",\n height: height,\n width: width,\n ref: ref,\n data: tree,\n onMove ({ dragIds: dragIds, parentId: parentId, index: index }) {\n dispatch({\n type: \"move-node\",\n payload: {\n dragIds: dragIds.map((d)=>parseInt(d)),\n parentId: parentId ? parseInt(parentId) : null,\n index: index\n }\n });\n },\n onDelete ({ ids: ids }) {\n dispatch({\n type: \"delete-node\",\n payload: {\n ids: ids.map((d)=>parseInt(d))\n }\n });\n },\n onSelect (nodes) {\n let ids = nodes.map((d)=>parseInt(d.id));\n if (ids.length == 1 && ids[0] == selectedNodes[0]) // Deselect\n ids = [];\n dispatch({\n type: \"select-node\",\n payload: {\n ids: ids\n }\n });\n },\n children: _Node,\n idAccessor (d) {\n return d.id.toString();\n }\n });\n}\n\n\n//# sourceMappingURL=feedback.8d3d1219.js.map\n","import styles from \"./feedback.module.sass\";\nimport hyper from \"@macrostrat/hyper\";\n\nimport { Tree, TreeApi } from \"react-arborist\";\nimport Node from \"./node\";\nimport { FeedbackText } from \"./text-visualizer\";\nimport type { InternalEntity, TreeData } from \"./types\";\nimport type { Entity } from \"../extractions\";\nimport { ModelInfo } from \"../extractions\";\nimport {\n TreeDispatchContext,\n treeToGraph,\n useUpdatableTree,\n ViewMode,\n} from \"./edit-state\";\nimport { useCallback, useEffect, useRef } from \"react\";\nimport { ButtonGroup, Card, SegmentedControl } from \"@blueprintjs/core\";\nimport { OmniboxSelector } from \"./type-selector\";\nimport {\n CancelButton,\n DataField,\n FlexBox,\n FlexRow,\n SaveButton,\n} from \"@macrostrat/ui-components\";\nimport useElementDimensions from \"use-element-dimensions\";\nimport { GraphView } from \"./graph\";\n\nexport type { GraphData } from \"./edit-state\";\nexport { treeToGraph } from \"./edit-state\";\nexport type { TreeData } from \"./types\";\n\nconst h = hyper.styled(styles);\n\nfunction setsAreTheSame<T>(a: Set<T>, b: Set<T>) {\n if (a.size !== b.size) return false;\n for (const item of a) {\n if (!b.has(item)) return false;\n }\n return true;\n}\n\nexport function FeedbackComponent({\n entities = [],\n text,\n model,\n entityTypes,\n matchComponent,\n onSave,\n}) {\n // Get the input arguments\n\n const [state, dispatch] = useUpdatableTree(\n entities.map(processEntity) as any,\n entityTypes\n );\n\n const { selectedNodes, tree, selectedEntityType, isSelectingEntityType } =\n state;\n\n const [{ width, height }, ref] = useElementDimensions();\n\n return h(TreeDispatchContext.Provider, { value: dispatch }, [\n h(FeedbackText, {\n text,\n dispatch,\n // @ts-ignore\n nodes: tree,\n selectedNodes,\n }),\n h(FlexRow, { alignItems: \"baseline\", justifyContent: \"space-between\" }, [\n h(ModelInfo, { data: model }),\n h(SegmentedControl, {\n options: [\n { label: \"Tree\", value: \"tree\" },\n { label: \"Graph\", value: \"graph\" },\n ],\n value: state.viewMode,\n small: true,\n onValueChange(value: ViewMode) {\n console.log(\"Setting view mode\", value);\n dispatch({ type: \"set-view-mode\", payload: value });\n },\n }),\n ]),\n h(\n \"div.entity-panel\",\n {\n ref,\n },\n [\n h(Card, { className: \"control-panel\" }, [\n h(\n ButtonGroup,\n {\n vertical: true,\n fill: true,\n minimal: true,\n alignText: \"left\",\n },\n [\n h(\n CancelButton,\n {\n icon: \"trash\",\n disabled: state.initialTree == state.tree,\n onClick() {\n dispatch({ type: \"reset\" });\n },\n },\n \"Reset\"\n ),\n h(\n SaveButton,\n {\n onClick() {\n onSave(state.tree);\n },\n disabled: state.initialTree == state.tree,\n },\n \"Save\"\n ),\n ]\n ),\n h(EntityTypeSelector, {\n entityTypes,\n selected: selectedEntityType,\n onChange(payload) {\n dispatch({ type: \"select-entity-type\", payload });\n },\n isOpen: isSelectingEntityType,\n setOpen: (isOpen: boolean) =>\n dispatch({\n type: \"toggle-entity-type-selector\",\n payload: isOpen,\n }),\n }),\n ]),\n h.if(state.viewMode == \"tree\")(ManagedSelectionTree, {\n selectedNodes,\n dispatch,\n tree,\n width,\n height,\n matchComponent,\n }),\n h.if(state.viewMode == \"graph\")(GraphView, {\n tree,\n width,\n height,\n }),\n ]\n ),\n ]);\n}\n\nfunction processEntity(entity: Entity): InternalEntity {\n // @ts-ignore\n return {\n ...entity,\n // @ts-ignore\n term_type: entity.type.name,\n txt_range: [entity.indices],\n children: entity.children?.map(processEntity) ?? [],\n };\n}\n\nfunction EntityTypeSelector({\n entityTypes,\n selected,\n isOpen,\n setOpen,\n onChange,\n}) {\n // Show all entity types when selected is null\n const _selected = selected != null ? selected : undefined;\n return h(DataField, { label: \"Entity type\", inline: true }, [\n h(\n \"code.bp5-code\",\n {\n onClick() {\n setOpen((d) => !d);\n },\n },\n selected.name\n ),\n h(OmniboxSelector, {\n isOpen,\n items: Array.from(entityTypes.values()),\n selectedItem: _selected,\n onSelectItem(item) {\n setOpen(false);\n onChange(item);\n },\n onClose() {\n setOpen(false);\n },\n }),\n ]);\n}\n\nfunction ManagedSelectionTree(props) {\n const {\n selectedNodes,\n dispatch,\n tree,\n height,\n width,\n matchComponent,\n ...rest\n } = props;\n\n const ref = useRef<TreeApi<TreeData>>();\n\n const _Node = useCallback(\n (props) => h(Node, { ...props, matchComponent }),\n [matchComponent]\n );\n\n useEffect(() => {\n if (ref.current == null) return;\n // Check if selection matches current\n const selection = new Set(selectedNodes.map((d) => d.toString()));\n const currentSelection = ref.current.selectedIds;\n if (setsAreTheSame(selection, currentSelection)) return;\n // If the selection is the same, do nothing\n\n // Set selection\n ref.current.setSelection({\n ids: selectedNodes.map((d) => d.toString()),\n anchor: null,\n mostRecent: null,\n });\n }, [selectedNodes]);\n\n return h(Tree, {\n className: \"selection-tree\",\n height,\n width,\n ref,\n data: tree,\n onMove({ dragIds, parentId, index }) {\n dispatch({\n type: \"move-node\",\n payload: {\n dragIds: dragIds.map((d) => parseInt(d)),\n parentId: parentId ? parseInt(parentId) : null,\n index,\n },\n });\n },\n onDelete({ ids }) {\n dispatch({\n type: \"delete-node\",\n payload: { ids: ids.map((d) => parseInt(d)) },\n });\n },\n onSelect(nodes) {\n let ids = nodes.map((d) => parseInt(d.id));\n if (ids.length == 1 && ids[0] == selectedNodes[0]) {\n // Deselect\n ids = [];\n }\n dispatch({ type: \"select-node\", payload: { ids } });\n },\n children: _Node,\n idAccessor(d: TreeData) {\n return d.id.toString();\n },\n });\n}\n","module.exports = require('./helpers/bundle-url').getBundleURL('ajJMX') + \"feedback.module.c4eab97d.css\";","module.exports = require('./helpers/bundle-url').getBundleURL('ajJMX') + \"node.33108ccc.js\";","module.exports = require('./helpers/bundle-url').getBundleURL('ajJMX') + \"text-visualizer.1e770afa.js\";","module.exports = require('./helpers/bundle-url').getBundleURL('ajJMX') + \"type-selector.0035ef7d.js\";","module.exports = require('./helpers/bundle-url').getBundleURL('ajJMX') + \"graph.ca5b649f.js\";"],"names":["$ajJMX$macrostrathyper","a","$parcel$global","globalThis","$parcel$modules","$parcel$inits","parcelRequire","id","exports","init","module","call","err","Error","code","register","$8e7fa15260c024b8$exports","getBundleURL","styled","__esModule","default"],"version":3,"file":"feedback.8d3d1219.js.map","sourceRoot":"../../../../"}
@@ -1,2 +0,0 @@
1
- function e(e,n,o,t){Object.defineProperty(e,n,{get:o,set:t,enumerable:!0,configurable:!0})}var n,o,t,c,a,l,r={};e(r,"control-panel",()=>n,e=>n=e),e(r,"entity-panel",()=>o,e=>o=e),e(r,"feedback-component",()=>t,e=>t=e),e(r,"feedback-text",()=>c,e=>c=e),e(r,"node",()=>a,e=>a=e),e(r,"selection-tree",()=>l,e=>l=e),n="QoX8-W_control-panel",o="QoX8-W_entity-panel",t="QoX8-W_feedback-component",c="QoX8-W_feedback-text",a="QoX8-W_node",l="QoX8-W_selection-tree";
2
- //# sourceMappingURL=feedback.module.a8744203.js.map
@@ -1 +0,0 @@
1
- {"mappings":"A,S,E,C,C,C,C,C,C,C,E,O,c,C,E,E,C,I,E,I,E,W,C,E,a,C,C,E,C,ICAA,EACA,EACA,EACA,EACA,EACA,E,E,C,E,E,E,gB,I,E,A,G,E,G,E,E,e,I,E,A,G,E,G,E,E,qB,I,E,A,G,E,G,E,E,gB,I,E,A,G,E,G,E,E,O,I,E,A,G,E,G,E,E,iB,I,E,A,G,E,GALA,EAAkC,uBAClC,EAAiC,sBACjC,EAAuC,4BACvC,EAAkC,uBAClC,EAAyB,cACzB,EAAmC","sources":["<anon>","packages/feedback-components/src/feedback/feedback.module.sass"],"sourcesContent":["\nfunction $parcel$export(e, n, v, s) {\n Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});\n}\nvar $01ca2f1f49a3a114$exports = {};\n\n$parcel$export($01ca2f1f49a3a114$exports, \"control-panel\", () => $01ca2f1f49a3a114$export$a0a23f31d5562853, (v) => $01ca2f1f49a3a114$export$a0a23f31d5562853 = v);\n$parcel$export($01ca2f1f49a3a114$exports, \"entity-panel\", () => $01ca2f1f49a3a114$export$38f2cd12e45697e, (v) => $01ca2f1f49a3a114$export$38f2cd12e45697e = v);\n$parcel$export($01ca2f1f49a3a114$exports, \"feedback-component\", () => $01ca2f1f49a3a114$export$579bd45c78bf5510, (v) => $01ca2f1f49a3a114$export$579bd45c78bf5510 = v);\n$parcel$export($01ca2f1f49a3a114$exports, \"feedback-text\", () => $01ca2f1f49a3a114$export$890489be1870bed5, (v) => $01ca2f1f49a3a114$export$890489be1870bed5 = v);\n$parcel$export($01ca2f1f49a3a114$exports, \"node\", () => $01ca2f1f49a3a114$export$35059013cd4a06db, (v) => $01ca2f1f49a3a114$export$35059013cd4a06db = v);\n$parcel$export($01ca2f1f49a3a114$exports, \"selection-tree\", () => $01ca2f1f49a3a114$export$3ae1b51693c80a9c, (v) => $01ca2f1f49a3a114$export$3ae1b51693c80a9c = v);\nvar $01ca2f1f49a3a114$export$a0a23f31d5562853;\nvar $01ca2f1f49a3a114$export$38f2cd12e45697e;\nvar $01ca2f1f49a3a114$export$579bd45c78bf5510;\nvar $01ca2f1f49a3a114$export$890489be1870bed5;\nvar $01ca2f1f49a3a114$export$35059013cd4a06db;\nvar $01ca2f1f49a3a114$export$3ae1b51693c80a9c;\n$01ca2f1f49a3a114$export$a0a23f31d5562853 = `QoX8-W_control-panel`;\n$01ca2f1f49a3a114$export$38f2cd12e45697e = `QoX8-W_entity-panel`;\n$01ca2f1f49a3a114$export$579bd45c78bf5510 = `QoX8-W_feedback-component`;\n$01ca2f1f49a3a114$export$890489be1870bed5 = `QoX8-W_feedback-text`;\n$01ca2f1f49a3a114$export$35059013cd4a06db = `QoX8-W_node`;\n$01ca2f1f49a3a114$export$3ae1b51693c80a9c = `QoX8-W_selection-tree`;\n\n\n//# sourceMappingURL=feedback.module.a8744203.js.map\n",null],"names":["$parcel$export","e","n","v","s","Object","defineProperty","get","set","enumerable","configurable","$01ca2f1f49a3a114$export$a0a23f31d5562853","$01ca2f1f49a3a114$export$38f2cd12e45697e","$01ca2f1f49a3a114$export$579bd45c78bf5510","$01ca2f1f49a3a114$export$890489be1870bed5","$01ca2f1f49a3a114$export$35059013cd4a06db","$01ca2f1f49a3a114$export$3ae1b51693c80a9c","$01ca2f1f49a3a114$exports"],"version":3,"file":"feedback.module.a8744203.js.map","sourceRoot":"../../../../"}
@@ -1,2 +0,0 @@
1
- .QoX8-W_feedback-component{width:800px;position:relative}.QoX8-W_feedback-component>svg{width:800px}.QoX8-W_node{cursor:pointer}.QoX8-W_feedback-text{margin-bottom:2em}.QoX8-W_entity-panel{max-height:600px;position:relative}.QoX8-W_control-panel{max-width:15em;padding:.2em .5em;position:absolute;top:1em;right:1em}.QoX8-W_entity-panel{background:var(--panel-secondary-background-color);min-height:100px;box-shadow:0 0 0 1px var(--panel-border-color)inset;border-radius:4px;flex:1;padding:1em}.QoX8-W_selection-tree{margin:-1em 0;padding:1em 0}
2
- /*# sourceMappingURL=feedback.module.c4eab97d.css.map */
@@ -1 +0,0 @@
1
- {"mappings":"ACAA,yDAIE,2CAGF,4BAIA,wCAGA,wDAIA,2FAOA,kLASA","sources":["feedback.module.c4eab97d.css","packages/feedback-components/src/feedback/feedback.module.sass"],"sourcesContent":[".QoX8-W_feedback-component {\n width: 800px;\n position: relative;\n}\n\n.QoX8-W_feedback-component > svg {\n width: 800px;\n}\n\n.QoX8-W_node {\n cursor: pointer;\n}\n\n.QoX8-W_feedback-text {\n margin-bottom: 2em;\n}\n\n.QoX8-W_entity-panel {\n max-height: 600px;\n position: relative;\n}\n\n.QoX8-W_control-panel {\n max-width: 15em;\n padding: .2em .5em;\n position: absolute;\n top: 1em;\n right: 1em;\n}\n\n.QoX8-W_entity-panel {\n background: var(--panel-secondary-background-color);\n min-height: 100px;\n box-shadow: 0 0 0 1px var(--panel-border-color) inset;\n border-radius: 4px;\n flex: 1;\n padding: 1em;\n}\n\n.QoX8-W_selection-tree {\n margin: -1em 0;\n padding: 1em 0;\n}\n/*# sourceMappingURL=feedback.module.c4eab97d.css.map */\n",".feedback-component\n position: relative\n width: 800px\n\n & > svg\n width: 800px\n\n.node\n cursor: pointer\n\n\n.feedback-text\n margin-bottom: 2em\n\n.entity-panel\n position: relative\n max-height: 600px\n\n.control-panel\n max-width: 15em\n position: absolute\n top: 1em\n right: 1em\n padding: 0.2em 0.5em\n\n.entity-panel\n flex: 1\n min-height: 100px\n padding: 1em\n background: var(--panel-secondary-background-color)\n border-radius: 4px\n // Inset box shadow\n box-shadow: 0 0 0 1px var(--panel-border-color) inset\n\n.selection-tree\n margin: -1em 0\n padding: 1em 0\n"],"names":[],"version":3,"file":"feedback.module.c4eab97d.css.map","sourceRoot":"../../../../"}
@@ -1,2 +0,0 @@
1
- import"@macrostrat/hyper";import"d3-force";import"react";import"@blueprintjs/core";var r=globalThis,e={},t={},o=r.parcelRequire94c2;null==o&&((o=function(r){if(r in e)return e[r].exports;if(r in t){var o=t[r];delete t[r];var i={id:r,exports:{}};return e[r]=i,o.call(i.exports,i,i.exports),i.exports}var n=Error("Cannot find module '"+r+"'");throw n.code="MODULE_NOT_FOUND",n}).register=function(r,e){t[r]=e},r.parcelRequire94c2=o),o.register,o("eedTh");
2
- //# sourceMappingURL=graph.ca5b649f.js.map
@@ -1 +0,0 @@
1
- {"mappings":"A,M,mB,A,O,U,A,O,O,A,O,mB,C,I,E,W,E,C,E,E,C,E,E,E,iB,A,O,I,A,C,E,S,C,E,G,K,E,O,C,C,E,C,O,C,G,K,E,C,I,E,C,C,E,A,Q,C,C,E,C,I,E,C,G,E,Q,C,C,E,O,C,C,E,C,E,E,I,C,E,O,C,E,E,O,E,E,O,A,C,I,E,A,M,uB,E,I,O,E,I,C,mB,C,C,E,Q,C,S,C,C,C,E,C,C,E,C,C,E,E,iB,C,G,E,Q,C,E","sources":["<anon>","packages/feedback-components/src/feedback/graph.ts"],"sourcesContent":["import $9bqpz$macrostrathyper from \"@macrostrat/hyper\";\nimport {forceSimulation as $9bqpz$forceSimulation, forceLink as $9bqpz$forceLink, forceManyBody as $9bqpz$forceManyBody, forceCenter as $9bqpz$forceCenter, forceCollide as $9bqpz$forceCollide} from \"d3-force\";\nimport {useState as $9bqpz$useState, useEffect as $9bqpz$useEffect} from \"react\";\nimport {Spinner as $9bqpz$Spinner} from \"@blueprintjs/core\";\n\n\n var $parcel$global = globalThis;\n \nvar $parcel$modules = {};\nvar $parcel$inits = {};\n\nvar parcelRequire = $parcel$global[\"parcelRequire94c2\"];\n\nif (parcelRequire == null) {\n parcelRequire = function(id) {\n if (id in $parcel$modules) {\n return $parcel$modules[id].exports;\n }\n if (id in $parcel$inits) {\n var init = $parcel$inits[id];\n delete $parcel$inits[id];\n var module = {id: id, exports: {}};\n $parcel$modules[id] = module;\n init.call(module.exports, module, module.exports);\n return module.exports;\n }\n var err = new Error(\"Cannot find module '\" + id + \"'\");\n err.code = 'MODULE_NOT_FOUND';\n throw err;\n };\n\n parcelRequire.register = function register(id, init) {\n $parcel$inits[id] = init;\n };\n\n $parcel$global[\"parcelRequire94c2\"] = parcelRequire;\n}\n\nvar parcelRegister = parcelRequire.register;\n\nvar $eedTh = parcelRequire(\"eedTh\");\n\n\n\n\nfunction $8732cb0ae0ae3dfd$export$6a7fe3ef90e8d566(props) {\n // A graph view with react-flow\n // Get positions of nodes using force simulation\n const { tree: tree, width: width, height: height } = props;\n const [nodes, setNodes] = (0, $9bqpz$useState)(null);\n const [links, setLinks] = (0, $9bqpz$useState)(null);\n (0, $9bqpz$useEffect)(()=>{\n const { nodes: nodes, edges: edges } = (0, $eedTh.treeToGraph)(tree);\n const nodesMap = new Map(nodes.map((d)=>[\n d.id,\n d\n ]));\n const links = edges.map((d)=>{\n return {\n source: nodesMap.get(d.source),\n target: nodesMap.get(d.dest),\n strength: 1\n };\n });\n const simulation = (0, $9bqpz$forceSimulation)(nodes).force(\"link\", (0, $9bqpz$forceLink)(links)).force(\"charge\", (0, $9bqpz$forceManyBody)().strength(-50)).force(\"center\", (0, $9bqpz$forceCenter)(width / 2, height / 2)).force(\"collide\", (0, $9bqpz$forceCollide)().radius(20)).on(\"tick\", ()=>{\n // Update the positions of the nodes\n // setNodes(nodes);\n console.log(\"Simulation tick\");\n }).on(\"end\", ()=>{\n // Update the positions of the nodes\n setNodes(nodes);\n setLinks(links);\n });\n return ()=>{\n simulation.stop();\n };\n }, [\n tree,\n width,\n height\n ]);\n if (nodes == null || links == null) return (0, $9bqpz$macrostrathyper)((0, $9bqpz$Spinner));\n console.log(\"Graph\", nodes, links);\n return (0, $9bqpz$macrostrathyper)(\"div.graph-view\", {\n style: {\n width: width,\n height: height\n }\n }, [\n (0, $9bqpz$macrostrathyper)(\"svg\", {\n width: width,\n height: height\n }, [\n (0, $9bqpz$macrostrathyper)(\"g.nodes\", nodes.map((d)=>{\n return (0, $9bqpz$macrostrathyper)(\"circle\", {\n cx: d.x,\n cy: d.y,\n r: 5,\n fill: \"blue\"\n });\n })),\n (0, $9bqpz$macrostrathyper)(\"g.links\", links.map((d)=>{\n return (0, $9bqpz$macrostrathyper)(\"line\", {\n x1: d.source.x,\n y1: d.source.y,\n x2: d.target.x,\n y2: d.target.y,\n stroke: \"black\"\n });\n }))\n ])\n ]);\n}\n\n\n//# sourceMappingURL=graph.ca5b649f.js.map\n","import { TreeData } from \"./types\";\nimport { treeToGraph } from \"./edit-state\";\nimport h from \"@macrostrat/hyper\";\n\nimport {\n forceSimulation,\n SimulationNodeDatum,\n SimulationLinkDatum,\n forceCenter,\n forceLink,\n forceManyBody,\n forceCollide,\n} from \"d3-force\";\nimport { useEffect, useState } from \"react\";\nimport { Spinner } from \"@blueprintjs/core\";\n\nexport function GraphView(props: {\n tree: TreeData[];\n width: number;\n height: number;\n}) {\n // A graph view with react-flow\n // Get positions of nodes using force simulation\n const { tree, width, height } = props;\n\n const [nodes, setNodes] = useState<SimulationNodeDatum[]>(null);\n const [links, setLinks] = useState<SimulationLinkDatum[]>(null);\n\n useEffect(() => {\n const { nodes, edges } = treeToGraph(tree);\n\n const nodesMap = new Map<number, SimulationNodeDatum>(\n nodes.map((d) => [d.id, d])\n );\n\n const links = edges.map((d) => {\n return {\n source: nodesMap.get(d.source),\n target: nodesMap.get(d.dest),\n strength: 1,\n };\n });\n\n const simulation = forceSimulation(nodes)\n .force(\"link\", forceLink(links))\n .force(\"charge\", forceManyBody().strength(-50))\n .force(\"center\", forceCenter(width / 2, height / 2))\n .force(\"collide\", forceCollide().radius(20))\n .on(\"tick\", () => {\n // Update the positions of the nodes\n // setNodes(nodes);\n console.log(\"Simulation tick\");\n })\n .on(\"end\", () => {\n // Update the positions of the nodes\n setNodes(nodes);\n setLinks(links);\n });\n\n return () => {\n simulation.stop();\n };\n }, [tree, width, height]);\n\n if (nodes == null || links == null) {\n return h(Spinner);\n }\n\n console.log(\"Graph\", nodes, links);\n\n return h(\"div.graph-view\", { style: { width, height } }, [\n h(\"svg\", { width, height }, [\n h(\n \"g.nodes\",\n nodes.map((d) => {\n return h(\"circle\", {\n cx: d.x,\n cy: d.y,\n r: 5,\n fill: \"blue\",\n });\n })\n ),\n h(\n \"g.links\",\n links.map((d) => {\n return h(\"line\", {\n x1: d.source.x,\n y1: d.source.y,\n x2: d.target.x,\n y2: d.target.y,\n stroke: \"black\",\n });\n })\n ),\n ]),\n ]);\n}\n"],"names":["$parcel$global","globalThis","$parcel$modules","$parcel$inits","parcelRequire","id","exports","init","module","call","err","Error","code","register"],"version":3,"file":"graph.ca5b649f.js.map","sourceRoot":"../../../../"}
@@ -1,2 +0,0 @@
1
- function e(e,t,a,c){Object.defineProperty(e,t,{get:a,set:c,enumerable:!0,configurable:!0})}var t,a,c,n={};e(n,"item-container",()=>t,e=>t=e),e(n,"selected",()=>a,e=>a=e),e(n,"swatch",()=>c,e=>c=e),t="WofFTa_item-container",a="WofFTa_selected",c="WofFTa_swatch";
2
- //# sourceMappingURL=main.module.1857be22.js.map
@@ -1 +0,0 @@
1
- {"mappings":"A,S,E,C,C,C,C,C,C,C,E,O,c,C,E,E,C,I,E,I,E,W,C,E,a,C,C,E,C,ICAA,EACA,EACA,E,E,C,E,E,E,iB,I,E,A,G,E,G,E,E,W,I,E,A,G,E,G,E,E,S,I,E,A,G,E,GAFA,EAAmC,wBACnC,EAA6B,kBAC7B,EAA2B","sources":["<anon>","packages/feedback-components/src/feedback/type-selector/main.module.sass"],"sourcesContent":["\nfunction $parcel$export(e, n, v, s) {\n Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});\n}\nvar $f57561eafb1aa284$exports = {};\n\n$parcel$export($f57561eafb1aa284$exports, \"item-container\", () => $f57561eafb1aa284$export$68a2d1df2d976de8, (v) => $f57561eafb1aa284$export$68a2d1df2d976de8 = v);\n$parcel$export($f57561eafb1aa284$exports, \"selected\", () => $f57561eafb1aa284$export$d90250155de6d7e7, (v) => $f57561eafb1aa284$export$d90250155de6d7e7 = v);\n$parcel$export($f57561eafb1aa284$exports, \"swatch\", () => $f57561eafb1aa284$export$c672d9950c40fe0a, (v) => $f57561eafb1aa284$export$c672d9950c40fe0a = v);\nvar $f57561eafb1aa284$export$68a2d1df2d976de8;\nvar $f57561eafb1aa284$export$d90250155de6d7e7;\nvar $f57561eafb1aa284$export$c672d9950c40fe0a;\n$f57561eafb1aa284$export$68a2d1df2d976de8 = `WofFTa_item-container`;\n$f57561eafb1aa284$export$d90250155de6d7e7 = `WofFTa_selected`;\n$f57561eafb1aa284$export$c672d9950c40fe0a = `WofFTa_swatch`;\n\n\n//# sourceMappingURL=main.module.1857be22.js.map\n",null],"names":["$parcel$export","e","n","v","s","Object","defineProperty","get","set","enumerable","configurable","$f57561eafb1aa284$export$68a2d1df2d976de8","$f57561eafb1aa284$export$d90250155de6d7e7","$f57561eafb1aa284$export$c672d9950c40fe0a","$f57561eafb1aa284$exports"],"version":3,"file":"main.module.1857be22.js.map","sourceRoot":"../../../../"}
@@ -1 +0,0 @@
1
- {"mappings":"ACAA,gDAIE,qDAGF","sources":["main.module.1fdfe813.css","packages/feedback-components/src/extractions/main.module.sass"],"sourcesContent":[".UZr1Jq_entities {\n padding-left: 0;\n list-style: none;\n}\n\n.UZr1Jq_entities .UZr1Jq_entities ul {\n list-style: none;\n}\n\n.UZr1Jq_entity {\n margin: .2em 0 .5em;\n padding-right: 3px;\n}\n/*# sourceMappingURL=main.module.1fdfe813.css.map */\n",".entities\n list-style: none\n padding-left: 0\n\n .entities ul\n list-style: none\n\n.entity\n margin: 0.2em 0 0.5em\n padding-right: 3px\n"],"names":[],"version":3,"file":"main.module.1fdfe813.css.map","sourceRoot":"../../../../"}
@@ -1 +0,0 @@
1
- {"mappings":"ACAA,+EAME,sFAGF","sources":["main.module.6bc7d51b.css","packages/feedback-components/src/feedback/type-selector/main.module.sass"],"sourcesContent":[".WofFTa_item-container {\n align-items: center;\n gap: 1em;\n min-height: 40px;\n display: flex;\n}\n\n.WofFTa_item-container.WofFTa_selected {\n background-color: var(--panel-background-color);\n}\n\n.WofFTa_swatch {\n border-radius: 4px;\n width: 30px;\n height: 30px;\n}\n/*# sourceMappingURL=main.module.6bc7d51b.css.map */\n",".item-container\n min-height: 40px\n display: flex\n align-items: center\n gap: 1em\n\n &.selected\n background-color: var(--panel-background-color)\n\n.swatch\n width: 30px\n height: 30px\n border-radius: 4px\n"],"names":[],"version":3,"file":"main.module.6bc7d51b.css.map","sourceRoot":"../../../../"}
@@ -1 +0,0 @@
1
- {"mappings":"A,S,E,C,C,C,C,C,C,C,E,O,c,C,E,E,C,I,E,I,E,W,C,E,a,C,C,E,C,ICAA,EACA,E,E,C,E,E,E,W,I,E,A,G,E,G,E,E,S,I,E,A,G,E,GADA,EAA6B,kBAC7B,EAA2B","sources":["<anon>","packages/feedback-components/src/extractions/main.module.sass"],"sourcesContent":["\nfunction $parcel$export(e, n, v, s) {\n Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});\n}\nvar $1c152ab3b3d783a7$exports = {};\n\n$parcel$export($1c152ab3b3d783a7$exports, \"entities\", () => $1c152ab3b3d783a7$export$5345fd892b40e1f6, (v) => $1c152ab3b3d783a7$export$5345fd892b40e1f6 = v);\n$parcel$export($1c152ab3b3d783a7$exports, \"entity\", () => $1c152ab3b3d783a7$export$4b5127edceda427d, (v) => $1c152ab3b3d783a7$export$4b5127edceda427d = v);\nvar $1c152ab3b3d783a7$export$5345fd892b40e1f6;\nvar $1c152ab3b3d783a7$export$4b5127edceda427d;\n$1c152ab3b3d783a7$export$5345fd892b40e1f6 = `UZr1Jq_entities`;\n$1c152ab3b3d783a7$export$4b5127edceda427d = `UZr1Jq_entity`;\n\n\n//# sourceMappingURL=main.module.ebdf985b.js.map\n",null],"names":["$parcel$export","e","n","v","s","Object","defineProperty","get","set","enumerable","configurable","$1c152ab3b3d783a7$export$5345fd892b40e1f6","$1c152ab3b3d783a7$export$4b5127edceda427d","$1c152ab3b3d783a7$exports"],"version":3,"file":"main.module.ebdf985b.js.map","sourceRoot":"../../../../"}
@@ -1,2 +0,0 @@
1
- import r from"@macrostrat/hyper";var e=globalThis,t={},o={},i=e.parcelRequire94c2;null==i&&((i=function(r){if(r in t)return t[r].exports;if(r in o){var e=o[r];delete o[r];var i={id:r,exports:{}};return t[r]=i,e.call(i.exports,i,i.exports),i.exports}var a=Error("Cannot find module '"+r+"'");throw a.code="MODULE_NOT_FOUND",a}).register=function(r,e){o[r]=e},e.parcelRequire94c2=i),i.register,i("edvRb"),i("daZiC").getBundleURL("hPIF3");var a=i("9wFEx");r.styled(a&&a.__esModule?a.default:a);
2
- //# sourceMappingURL=node.33108ccc.js.map
@@ -1 +0,0 @@
1
- {"mappings":"A,O,M,mB,C,I,E,W,E,C,E,E,C,E,E,E,iB,A,O,I,A,C,E,S,C,E,G,K,E,O,C,C,E,C,O,C,G,K,E,C,I,E,C,C,E,A,Q,C,C,E,C,I,E,C,G,E,Q,C,C,E,O,C,C,E,C,E,E,I,C,E,O,C,E,E,O,E,E,O,A,C,I,E,A,M,uB,E,I,O,E,I,C,mB,C,C,E,Q,C,S,C,C,C,E,C,C,E,C,C,E,E,iB,C,G,E,Q,C,E,SEAiB,AAAA,EAAA,SAAA,YAAA,CAA6C,S,I,E,E,SDOpD,AAAA,EAAM,MAAM,C,AAAC,G,AAAA,E,U,C,AAAA,E,O,CAAA","sources":["<anon>","packages/feedback-components/src/feedback/node.ts","../../../../.yarn/berry/cache/@parcel-runtime-js-npm-2.13.3-f44fec8492-10c0.zip/node_modules/@parcel/runtime-js/lib/runtime-be5b24876b77195e.js"],"sourcesContent":["import $hPIF3$macrostrathyper from \"@macrostrat/hyper\";\n\n\nfunction $parcel$interopDefault(a) {\n return a && a.__esModule ? a.default : a;\n}\n\n var $parcel$global = globalThis;\n \nvar $parcel$modules = {};\nvar $parcel$inits = {};\n\nvar parcelRequire = $parcel$global[\"parcelRequire94c2\"];\n\nif (parcelRequire == null) {\n parcelRequire = function(id) {\n if (id in $parcel$modules) {\n return $parcel$modules[id].exports;\n }\n if (id in $parcel$inits) {\n var init = $parcel$inits[id];\n delete $parcel$inits[id];\n var module = {id: id, exports: {}};\n $parcel$modules[id] = module;\n init.call(module.exports, module, module.exports);\n return module.exports;\n }\n var err = new Error(\"Cannot find module '\" + id + \"'\");\n err.code = 'MODULE_NOT_FOUND';\n throw err;\n };\n\n parcelRequire.register = function register(id, init) {\n $parcel$inits[id] = init;\n };\n\n $parcel$global[\"parcelRequire94c2\"] = parcelRequire;\n}\n\nvar parcelRegister = parcelRequire.register;\n\nvar $edvRb = parcelRequire(\"edvRb\");\nvar $d834190537e68c62$exports = {};\n\n$d834190537e68c62$exports = (parcelRequire(\"daZiC\")).getBundleURL('hPIF3') + \"edit-state.f50ca728.js\";\n\n\n\nvar $9wFEx = parcelRequire(\"9wFEx\");\n\nconst $2e9ede27ff2a3eea$var$h = (0, $hPIF3$macrostrathyper).styled((0, (/*@__PURE__*/$parcel$interopDefault($9wFEx))));\nfunction $2e9ede27ff2a3eea$var$isSelected(searchNode, treeNode) {\n return searchNode.id == treeNode.id;\n// We could also select children of the search node here if we wanted to\n}\nfunction $2e9ede27ff2a3eea$var$isNodeHighlighted(node, tree) {\n // We treat no selection as all nodes being active. We may add some nuance later\n if (tree.selectedNodes.length == 0) return true;\n for (const selectedNode of tree.selectedNodes){\n if ($2e9ede27ff2a3eea$var$isSelected(node.data, selectedNode.data)) return true;\n }\n // Check if the parent node is highlighted\n if (node.parent != null && $2e9ede27ff2a3eea$var$isNodeHighlighted(node.parent, tree)) return true;\n return false;\n}\nfunction $2e9ede27ff2a3eea$var$isNodeActive(node, tree) {\n for (const selectedNode of tree.selectedNodes){\n if ($2e9ede27ff2a3eea$var$isSelected(node.data, selectedNode.data)) return true;\n }\n return false;\n}\nfunction $2e9ede27ff2a3eea$var$Node({ node: node, style: style, dragHandle: dragHandle, tree: tree, matchComponent: matchComponent }) {\n let highlighted = $2e9ede27ff2a3eea$var$isNodeHighlighted(node, tree);\n let active = $2e9ede27ff2a3eea$var$isNodeActive(node, tree);\n const dispatch = (0, $d834190537e68c62$exports.useTreeDispatch)();\n return $2e9ede27ff2a3eea$var$h(\"div.node\", {\n style: style,\n ref: dragHandle\n }, $2e9ede27ff2a3eea$var$h((0, $edvRb.EntityTag), {\n data: node.data,\n active: active,\n highlighted: highlighted,\n matchComponent: matchComponent,\n onClickType () {\n dispatch({\n type: \"toggle-entity-type-selector\"\n });\n }\n }));\n}\nvar $2e9ede27ff2a3eea$export$2e2bcd8739ae039 = $2e9ede27ff2a3eea$var$Node;\n\n\n//# sourceMappingURL=node.33108ccc.js.map\n","import { NodeApi, TreeApi } from \"react-arborist\";\nimport { TreeData } from \"./types\";\nimport { EntityTag } from \"../extractions\";\nimport { useTreeDispatch } from \"./edit-state\";\nimport styles from \"./feedback.module.sass\";\nimport hyper from \"@macrostrat/hyper\";\n\nconst h = hyper.styled(styles);\n\nfunction isSelected(searchNode: TreeData, treeNode: TreeData) {\n return searchNode.id == treeNode.id;\n // We could also select children of the search node here if we wanted to\n}\n\nfunction isNodeHighlighted(node: NodeApi<TreeData>, tree: TreeApi<TreeData>) {\n // We treat no selection as all nodes being active. We may add some nuance later\n if (tree.selectedNodes.length == 0) {\n return true;\n }\n\n for (const selectedNode of tree.selectedNodes) {\n if (isSelected(node.data, selectedNode.data)) {\n return true;\n }\n }\n\n // Check if the parent node is highlighted\n if (node.parent != null && isNodeHighlighted(node.parent, tree)) {\n return true;\n }\n\n return false;\n}\n\nfunction isNodeActive(node: NodeApi<TreeData>, tree: TreeApi<TreeData>) {\n for (const selectedNode of tree.selectedNodes) {\n if (isSelected(node.data, selectedNode.data)) {\n return true;\n }\n }\n return false;\n}\n\nfunction Node({ node, style, dragHandle, tree, matchComponent }: any) {\n let highlighted: boolean = isNodeHighlighted(node, tree);\n let active: boolean = isNodeActive(node, tree);\n\n const dispatch = useTreeDispatch();\n\n return h(\n \"div.node\",\n { style, ref: dragHandle },\n h(EntityTag, {\n data: node.data,\n active,\n highlighted,\n matchComponent,\n onClickType() {\n dispatch({ type: \"toggle-entity-type-selector\" });\n },\n })\n );\n}\n\nexport default Node;\n","module.exports = require('./helpers/bundle-url').getBundleURL('hPIF3') + \"edit-state.f50ca728.js\";"],"names":["$hPIF3$macrostrathyper","$parcel$global","globalThis","$parcel$modules","$parcel$inits","parcelRequire","id","exports","init","module","call","err","Error","code","register","getBundleURL","$9wFEx","styled","a","__esModule","default"],"version":3,"file":"node.33108ccc.js.map","sourceRoot":"../../../../"}
@@ -1,2 +0,0 @@
1
- import"react-text-annotate-blend";import r from"@macrostrat/hyper";import"react";var e=globalThis,t={},o={},a=e.parcelRequire94c2;null==a&&((a=function(r){if(r in t)return t[r].exports;if(r in o){var e=o[r];delete o[r];var a={id:r,exports:{}};return t[r]=a,e.call(a.exports,a,a.exports),a.exports}var i=Error("Cannot find module '"+r+"'");throw i.code="MODULE_NOT_FOUND",i}).register=function(r,e){o[r]=e},e.parcelRequire94c2=a),a.register;var i=a("9wFEx");a("edvRb"),r.styled(i&&i.__esModule?i.default:i);
2
- //# sourceMappingURL=text-visualizer.1e770afa.js.map
@@ -1 +0,0 @@
1
- {"mappings":"A,M,2B,A,Q,M,mB,A,O,O,C,I,E,W,E,C,E,E,C,E,E,E,iB,A,O,I,A,C,E,S,C,E,G,K,E,O,C,C,E,C,O,C,G,K,E,C,I,E,C,C,E,A,Q,C,C,E,C,I,E,C,G,E,Q,C,C,E,O,C,C,E,C,E,E,I,C,E,O,C,E,E,O,E,E,O,A,C,I,E,A,M,uB,E,I,O,E,I,C,mB,C,C,E,Q,C,S,C,C,C,E,C,C,E,C,C,E,E,iB,C,G,E,Q,C,I,E,E,S,E,SCSU,AAAA,EAAM,MAAM,C,AAAC,G,AAAA,E,U,C,AAAA,E,O,CAAA","sources":["<anon>","packages/feedback-components/src/feedback/text-visualizer.ts"],"sourcesContent":["import {TextAnnotateBlend as $h8ona$TextAnnotateBlend} from \"react-text-annotate-blend\";\nimport $h8ona$macrostrathyper from \"@macrostrat/hyper\";\nimport {useCallback as $h8ona$useCallback} from \"react\";\n\n\nfunction $parcel$interopDefault(a) {\n return a && a.__esModule ? a.default : a;\n}\n\n var $parcel$global = globalThis;\n \nvar $parcel$modules = {};\nvar $parcel$inits = {};\n\nvar parcelRequire = $parcel$global[\"parcelRequire94c2\"];\n\nif (parcelRequire == null) {\n parcelRequire = function(id) {\n if (id in $parcel$modules) {\n return $parcel$modules[id].exports;\n }\n if (id in $parcel$inits) {\n var init = $parcel$inits[id];\n delete $parcel$inits[id];\n var module = {id: id, exports: {}};\n $parcel$modules[id] = module;\n init.call(module.exports, module, module.exports);\n return module.exports;\n }\n var err = new Error(\"Cannot find module '\" + id + \"'\");\n err.code = 'MODULE_NOT_FOUND';\n throw err;\n };\n\n parcelRequire.register = function register(id, init) {\n $parcel$inits[id] = init;\n };\n\n $parcel$global[\"parcelRequire94c2\"] = parcelRequire;\n}\n\nvar parcelRegister = parcelRequire.register;\n\n\nvar $9wFEx = parcelRequire(\"9wFEx\");\n\n\nvar $edvRb = parcelRequire(\"edvRb\");\n\nconst $d6cf457c7790c03a$var$h = (0, $h8ona$macrostrathyper).styled((0, (/*@__PURE__*/$parcel$interopDefault($9wFEx))));\nfunction $d6cf457c7790c03a$var$buildTags(highlights, selectedNodes) {\n let tags = [];\n // If entity ID has already been seen, don't add it again\n const entities = new Set();\n for (const highlight of highlights){\n // Don't add multiply-linked entities multiple times\n if (entities.has(highlight.id)) continue;\n const highlighted = $d6cf457c7790c03a$var$isHighlighted(highlight, selectedNodes);\n const active = $d6cf457c7790c03a$var$isActive(highlight, selectedNodes);\n tags.push({\n markStyle: {\n ...(0, $edvRb.getTagStyle)(highlight.backgroundColor, {\n highlighted: highlighted,\n active: active\n }),\n borderRadius: \"0.2em\",\n padding: \"0.1em\",\n borderWidth: \"1.5px\",\n cursor: \"pointer\"\n },\n tagStyle: {\n display: \"none\"\n },\n ...highlight\n });\n entities.add(highlight.id);\n }\n return tags;\n}\nfunction $d6cf457c7790c03a$var$isActive(tag, selectedNodes) {\n return selectedNodes.includes(tag.id);\n}\nfunction $d6cf457c7790c03a$var$isHighlighted(tag, selectedNodes) {\n if (selectedNodes.length === 0) return true;\n return (selectedNodes.includes(tag.id) || tag.parents?.some((d)=>selectedNodes.includes(d))) ?? false;\n}\nfunction $d6cf457c7790c03a$export$6e107db9091b8219(props) {\n // Convert input to tags\n const { text: text, selectedNodes: selectedNodes, nodes: nodes, dispatch: dispatch } = props;\n let allTags = $d6cf457c7790c03a$var$buildTags((0, $edvRb.buildHighlights)(nodes, null), selectedNodes);\n const onChange = (0, $h8ona$useCallback)((tags)=>{\n // New tags\n console.log(tags);\n const newTags = tags.filter((d)=>!(\"id\" in d));\n if (newTags.length > 0) {\n const { start: start, end: end } = newTags[0];\n const payload = {\n start: start,\n end: end,\n text: text.slice(start, end)\n };\n dispatch({\n type: \"create-node\",\n payload: payload\n });\n return;\n }\n const tagIDs = new Set(tags.map((d)=>d.id));\n const removedIds = allTags.map((d)=>d.id).filter((d)=>!tagIDs.has(d));\n /* Find the id that was removed: that is the one that will be selected\n (we are hijacking the 'click to delete' functionality to select instead) */ if (removedIds.length > 0) dispatch({\n type: \"toggle-node-selected\",\n payload: {\n ids: removedIds\n }\n });\n }, [\n allTags,\n text\n ]);\n return $d6cf457c7790c03a$var$h((0, $h8ona$TextAnnotateBlend), {\n style: {\n fontSize: \"1.2em\"\n },\n className: \"feedback-text\",\n content: text,\n onChange: onChange,\n value: allTags\n });\n}\n\n\n//# sourceMappingURL=text-visualizer.1e770afa.js.map\n","import { AnnotateBlendTag, TextAnnotateBlend } from \"react-text-annotate-blend\";\nimport { InternalEntity } from \"./types\";\nimport { TreeDispatch } from \"./edit-state\";\nimport styles from \"./feedback.module.sass\";\nimport hyper from \"@macrostrat/hyper\";\nimport { buildHighlights, getTagStyle } from \"../extractions\";\nimport { Highlight } from \"../extractions/types\";\nimport { useCallback } from \"react\";\n\nconst h = hyper.styled(styles);\n\nexport interface FeedbackTextProps {\n text: string;\n selectedNodes: number[];\n nodes: InternalEntity[];\n updateNodes: (nodes: string[]) => void;\n dispatch: TreeDispatch;\n}\n\nfunction buildTags(\n highlights: Highlight[],\n selectedNodes: number[]\n): AnnotateBlendTag[] {\n let tags: AnnotateBlendTag[] = [];\n\n // If entity ID has already been seen, don't add it again\n const entities = new Set<number>();\n\n for (const highlight of highlights) {\n // Don't add multiply-linked entities multiple times\n if (entities.has(highlight.id)) continue;\n\n const highlighted = isHighlighted(highlight, selectedNodes);\n const active = isActive(highlight, selectedNodes);\n\n tags.push({\n markStyle: {\n ...getTagStyle(highlight.backgroundColor, {\n highlighted,\n active,\n }),\n borderRadius: \"0.2em\",\n padding: \"0.1em\",\n borderWidth: \"1.5px\",\n cursor: \"pointer\",\n },\n tagStyle: {\n display: \"none\",\n },\n ...highlight,\n });\n\n entities.add(highlight.id);\n }\n\n return tags;\n}\n\nfunction isActive(tag: Highlight, selectedNodes: number[]) {\n return selectedNodes.includes(tag.id);\n}\n\nfunction isHighlighted(tag: Highlight, selectedNodes: number[]) {\n if (selectedNodes.length === 0) return true;\n return (\n (selectedNodes.includes(tag.id) ||\n tag.parents?.some((d) => selectedNodes.includes(d))) ??\n false\n );\n}\n\nexport function FeedbackText(props: FeedbackTextProps) {\n // Convert input to tags\n const { text, selectedNodes, nodes, dispatch } = props;\n let allTags: AnnotateBlendTag[] = buildTags(\n buildHighlights(nodes, null),\n selectedNodes\n );\n\n const onChange = useCallback(\n (tags) => {\n // New tags\n console.log(tags);\n const newTags = tags.filter((d) => !(\"id\" in d));\n if (newTags.length > 0) {\n const { start, end } = newTags[0];\n const payload = { start, end, text: text.slice(start, end) };\n dispatch({ type: \"create-node\", payload });\n return;\n }\n\n const tagIDs = new Set(tags.map((d) => d.id));\n const removedIds = allTags.map((d) => d.id).filter((d) => !tagIDs.has(d));\n\n /* Find the id that was removed: that is the one that will be selected\n (we are hijacking the 'click to delete' functionality to select instead) */\n if (removedIds.length > 0) {\n dispatch({\n type: \"toggle-node-selected\",\n payload: { ids: removedIds },\n });\n }\n },\n [allTags, text]\n );\n\n return h(TextAnnotateBlend, {\n style: {\n fontSize: \"1.2em\",\n },\n className: \"feedback-text\",\n content: text,\n onChange,\n value: allTags,\n });\n}\n"],"names":["$h8ona$macrostrathyper","$parcel$global","globalThis","$parcel$modules","$parcel$inits","parcelRequire","id","exports","init","module","call","err","Error","code","register","$9wFEx","styled","a","__esModule","default"],"version":3,"file":"text-visualizer.1e770afa.js.map","sourceRoot":"../../../../"}
@@ -1,2 +0,0 @@
1
- import e from"@macrostrat/hyper";import"classnames";import"@blueprintjs/select";import"@blueprintjs/select/lib/css/blueprint-select.css";var r,t=globalThis,s={},i={},l=t.parcelRequire94c2;null==l&&((l=function(e){if(e in s)return s[e].exports;if(e in i){var r=i[e];delete i[e];var t={id:e,exports:{}};return s[e]=t,r.call(t.exports,t,t.exports),t.exports}var l=Error("Cannot find module '"+e+"'");throw l.code="MODULE_NOT_FOUND",l}).register=function(e,r){i[e]=r},t.parcelRequire94c2=l),l.register;var o={};o=l("daZiC").getBundleURL("16Zb4")+"main.module.6bc7d51b.css",e.styled((r=o)&&r.__esModule?r.default:r);
2
- //# sourceMappingURL=type-selector.0035ef7d.js.map
@@ -1 +0,0 @@
1
- {"mappings":"A,O,M,mB,A,O,Y,A,O,qB,A,O,kD,C,I,E,E,W,E,C,E,E,C,E,E,E,iB,A,O,I,A,C,E,S,C,E,G,K,E,O,C,C,E,C,O,C,G,K,E,C,I,E,C,C,E,A,Q,C,C,E,C,I,E,C,G,E,Q,C,C,E,O,C,C,E,C,E,E,I,C,E,O,C,E,E,O,E,E,O,A,C,I,E,A,M,uB,E,I,O,E,I,C,mB,C,C,E,Q,C,S,C,C,C,E,C,C,E,C,C,E,E,iB,C,G,E,Q,C,I,E,C,EEAA,EAAiB,AAAA,EAAA,SAAA,YAAA,CAA6C,SAAW,4CDY/D,AAAA,EAAM,MAAM,C,C,EAAC,I,E,U,C,E,O,C","sources":["<anon>","packages/feedback-components/src/feedback/type-selector/index.ts","../../../../.yarn/berry/cache/@parcel-runtime-js-npm-2.13.3-f44fec8492-10c0.zip/node_modules/@parcel/runtime-js/lib/runtime-d2adba764022ad20.js"],"sourcesContent":["import $16Zb4$macrostrathyper from \"@macrostrat/hyper\";\nimport $16Zb4$classnames from \"classnames\";\nimport {Omnibar as $16Zb4$Omnibar} from \"@blueprintjs/select\";\nimport \"@blueprintjs/select/lib/css/blueprint-select.css\";\n\n\nfunction $parcel$interopDefault(a) {\n return a && a.__esModule ? a.default : a;\n}\n\n var $parcel$global = globalThis;\n \nvar $parcel$modules = {};\nvar $parcel$inits = {};\n\nvar parcelRequire = $parcel$global[\"parcelRequire94c2\"];\n\nif (parcelRequire == null) {\n parcelRequire = function(id) {\n if (id in $parcel$modules) {\n return $parcel$modules[id].exports;\n }\n if (id in $parcel$inits) {\n var init = $parcel$inits[id];\n delete $parcel$inits[id];\n var module = {id: id, exports: {}};\n $parcel$modules[id] = module;\n init.call(module.exports, module, module.exports);\n return module.exports;\n }\n var err = new Error(\"Cannot find module '\" + id + \"'\");\n err.code = 'MODULE_NOT_FOUND';\n throw err;\n };\n\n parcelRequire.register = function register(id, init) {\n $parcel$inits[id] = init;\n };\n\n $parcel$global[\"parcelRequire94c2\"] = parcelRequire;\n}\n\nvar parcelRegister = parcelRequire.register;\n/**\n * Entity type selector\n */ var $40e2e1c28f0230c6$exports = {};\n\n$40e2e1c28f0230c6$exports = (parcelRequire(\"daZiC\")).getBundleURL('16Zb4') + \"main.module.6bc7d51b.css\";\n\n\n\n\n\n\nconst $48d99b99dde7627d$var$h = (0, $16Zb4$macrostrathyper).styled((0, (/*@__PURE__*/$parcel$interopDefault($40e2e1c28f0230c6$exports))));\nconst $48d99b99dde7627d$var$TagListItem = (props)=>{\n /** Render a tag for the omnibox list */ let { active: active, selected: selected, className: className, onSelect: onSelect, item: item, children: children } = props;\n className = (0, $16Zb4$classnames)({\n active: active,\n selected: selected\n }, className);\n const onClick = ()=>onSelect(item);\n return $48d99b99dde7627d$var$h(\"div.item-container\", {\n key: item.id,\n className: className,\n onClick: onClick\n }, [\n $48d99b99dde7627d$var$h(\"div.swatch\", {\n style: {\n backgroundColor: item.color\n }\n }),\n $48d99b99dde7627d$var$h(\"div.item\", {}, item.name)\n ]);\n};\nfunction $48d99b99dde7627d$export$d8660660a589068c(props) {\n /** A general omnibox for annotation types */ const { onSelectItem: onSelectItem, items: items, isOpen: isOpen, onClose: onClose } = props;\n return $48d99b99dde7627d$var$h((0, $16Zb4$Omnibar), {\n onItemSelect: onSelectItem,\n items: items,\n resetOnSelect: false,\n isOpen: isOpen,\n onClose: onClose,\n itemRenderer (item, { handleClick: handleClick, modifiers: modifiers }) {\n return $48d99b99dde7627d$var$h($48d99b99dde7627d$var$TagListItem, {\n key: item.id,\n item: item,\n onSelect: handleClick,\n active: modifiers.active,\n selected: modifiers.active\n });\n }\n });\n}\n\n\n//# sourceMappingURL=type-selector.0035ef7d.js.map\n","/**\n * Entity type selector\n */\n\nimport styles from \"./main.module.sass\";\nimport hyper from \"@macrostrat/hyper\";\n\nimport classNames from \"classnames\";\nimport React from \"react\";\nimport { Omnibar, OmnibarProps } from \"@blueprintjs/select\";\nimport \"@blueprintjs/select/lib/css/blueprint-select.css\";\n\nconst h = hyper.styled(styles);\n\ninterface TagItemProps<T> {\n selected: boolean;\n active: boolean;\n className?: string;\n item: T;\n\n onSelect(t: T): void;\n\n children?: React.ReactElement;\n}\n\nconst TagListItem: React.ComponentType<TagItemProps<T>> = (props) => {\n /** Render a tag for the omnibox list */\n let { active, selected, className, onSelect, item, children } = props;\n className = classNames({ active, selected }, className);\n const onClick = () => onSelect(item);\n\n return h(\n \"div.item-container\",\n {\n key: item.id,\n className,\n onClick,\n },\n [\n h(\"div.swatch\", { style: { backgroundColor: item.color } }),\n h(\"div.item\", {}, item.name),\n ]\n );\n};\n\ntype BoxLifecycleProps<T> = Pick<OmnibarProps<T>, \"onClose\" | \"isOpen\">;\n\ninterface OmniboxProps<T> extends BoxLifecycleProps<T> {\n items: T[];\n selectedItem: T;\n onSelectItem: (t: T) => void;\n listItemComponent?: React.ComponentType<TagItemProps<T>>;\n}\n\nexport function OmniboxSelector<T>(props: OmniboxProps<T>) {\n /** A general omnibox for annotation types */\n const { onSelectItem, items, isOpen, onClose } = props;\n\n return h(Omnibar, {\n onItemSelect: onSelectItem,\n items,\n resetOnSelect: false,\n isOpen,\n onClose,\n itemRenderer(item: T, { handleClick, modifiers }) {\n return h(TagListItem, {\n key: item.id,\n item,\n onSelect: handleClick,\n active: modifiers.active,\n selected: modifiers.active,\n });\n },\n });\n}\n","module.exports = require('./helpers/bundle-url').getBundleURL('16Zb4') + \"main.module.6bc7d51b.css\";"],"names":["$16Zb4$macrostrathyper","a","$parcel$global","globalThis","$parcel$modules","$parcel$inits","parcelRequire","id","exports","init","module","call","err","Error","code","register","$40e2e1c28f0230c6$exports","getBundleURL","styled","__esModule","default"],"version":3,"file":"type-selector.0035ef7d.js.map","sourceRoot":"../../../../"}