{"version":3,"file":"footnote.js","names":["define","_exports","_pluginApi","_discourseI18n","_richEditorExtension","Object","defineProperty","value","default","name","initialize","withPluginApi","api","registerRichEditorExtension","addComposerToolbarPopupMenuOption","action","event","addText","i18n","group","icon","label","_core","_iconLibrary","inlineFootnotePopper","footnoteEventHandler","tooltip","document","getElementById","displayedFootnoteId","dataset","footnoteId","expandableFootnote","target","destroy","removeAttribute","classList","contains","preventDefault","stopPropagation","footnoteContent","querySelector","cooked","closest","refPostId","newContent","innerHTML","show","createPopper","modifiers","options","element","altAxis","padding","offset","container","lookup","display_footnotes_inline","body","append","template","createElement","trim","content","firstChild","buildTooltip","window","addEventListener","decorateCookedElement","elem","footnoteRefs","querySelectorAll","forEach","footnoteRef","refLink","add","iconHTML","href","role","getAttribute","after","length","applyInlineFootnotes","onlyStream","id","onPageChange","teardown","removeEventListener","remove","setup","helper","registerOptions","opts","siteSettings","features","markdownitFootnote","enable_markdown_footnotes","allowList","custom","tag","match","registerPlugin","extension","nodeViews","footnote","_ref","pmView","EditorView","pmState","EditorState","pmTransform","StepMap","constructor","node","view","getPos","this","outerView","dom","className","innerView","selectNode","open","deselectNode","close","appendChild","style","setProperty","getFootnoteCounterValue","state","create","doc","plugins","filter","plugin","test","key","dispatchTransaction","dispatchInner","bind","handleDOMEvents","mousedown","hasFocus","focus","footnotes","Array","from","indexOf","textContent","tr","transactions","applyTransaction","updateState","getMeta","outerTr","offsetMap","i","steps","j","step","map","docChanged","dispatch","update","sameMarkup","start","findDiffStart","a","endA","b","endB","findDiffEnd","overlap","Math","min","replace","slice","setMeta","stopEvent","ignoreMutation","nodeSpec","attrs","inline","atom","draggable","parseDOM","toDOM","class","parse","_ref2","pmModel","Slice","Fragment","footnote_ref","getAttrs","token","meta","footnote_block","ignore","footnote_open","tokens","top","innerTokens","footnoteCloseIndex","findIndex","t","type","pos","replacements","descendants","child","childPos","stack","openNode","schema","nodes","parseTokens","closeNode","push","to","splice","footnote_anchor","noCloseToken","serializeNode","write","renderContent","contents","footnoteContents","afterSerialize","oldDelim","delim","inputRules","handler","end","paragraph","replaceWith"],"sources":["discourse/plugins/footnote/initializers/composer.js","discourse/plugins/footnote/initializers/inline-footnotes.js","discourse/plugins/footnote/lib/discourse-markdown/footnotes.js","discourse/plugins/footnote/lib/rich-editor-extension.js"],"sourcesContent":["define(\"discourse/plugins/footnote/initializers/composer\", [\"exports\", \"discourse/lib/plugin-api\", \"discourse-i18n\", \"discourse/plugins/footnote/lib/rich-editor-extension\"], function (_exports, _pluginApi, _discourseI18n, _richEditorExtension) {\n  \"use strict\";\n\n  Object.defineProperty(_exports, \"__esModule\", {\n    value: true\n  });\n  _exports.default = void 0;\n  var _default = _exports.default = {\n    name: \"footnotes-composer\",\n    initialize() {\n      (0, _pluginApi.withPluginApi)(api => {\n        api.registerRichEditorExtension(_richEditorExtension.default);\n        api.addComposerToolbarPopupMenuOption({\n          action(event) {\n            event.addText(`^[${(0, _discourseI18n.i18n)(\"footnote.title\")}]`);\n          },\n          group: \"insertions\",\n          icon: \"asterisk\",\n          label: \"footnote.add\"\n        });\n      });\n    }\n  };\n});","define(\"discourse/plugins/footnote/initializers/inline-footnotes\", [\"exports\", \"@popperjs/core\", \"discourse/lib/icon-library\", \"discourse/lib/plugin-api\"], function (_exports, _core, _iconLibrary, _pluginApi) {\n  \"use strict\";\n\n  Object.defineProperty(_exports, \"__esModule\", {\n    value: true\n  });\n  _exports.default = void 0;\n  let inlineFootnotePopper;\n  function applyInlineFootnotes(elem) {\n    const footnoteRefs = elem.querySelectorAll(\"sup.footnote-ref\");\n    footnoteRefs.forEach(footnoteRef => {\n      const refLink = footnoteRef.querySelector(\"a\");\n      if (!refLink) {\n        return;\n      }\n      const expandableFootnote = document.createElement(\"a\");\n      expandableFootnote.classList.add(\"expand-footnote\");\n      expandableFootnote.innerHTML = (0, _iconLibrary.iconHTML)(\"ellipsis\");\n      expandableFootnote.href = \"\";\n      expandableFootnote.role = \"button\";\n      expandableFootnote.dataset.footnoteId = refLink.getAttribute(\"href\");\n      footnoteRef.after(expandableFootnote);\n    });\n    if (footnoteRefs.length) {\n      elem.classList.add(\"inline-footnotes\");\n    }\n  }\n  function buildTooltip() {\n    const template = document.createElement(\"template\");\n    template.innerHTML = `\n    <div id=\"footnote-tooltip\" role=\"tooltip\">\n      <div class=\"footnote-tooltip-content\"></div>\n      <div id=\"arrow\" data-popper-arrow></div>\n    </div>\n  `.trim();\n    return template.content.firstChild;\n  }\n  function footnoteEventHandler(event) {\n    const tooltip = document.getElementById(\"footnote-tooltip\");\n    const displayedFootnoteId = tooltip?.dataset.footnoteId;\n    const expandableFootnote = event.target;\n    const footnoteId = expandableFootnote.dataset.footnoteId;\n    inlineFootnotePopper?.destroy();\n    tooltip?.removeAttribute(\"data-show\");\n    tooltip?.removeAttribute(\"data-footnote-id\");\n    if (!event.target.classList.contains(\"expand-footnote\")) {\n      // dismissing the tooltip by clicking outside\n      return;\n    }\n    event.preventDefault();\n    event.stopPropagation();\n    if (displayedFootnoteId === footnoteId) {\n      // dismissing the tooltip by clicking the footnote button\n      return;\n    }\n\n    // append footnote to tooltip body\n    const footnoteContent = tooltip.querySelector(\".footnote-tooltip-content\");\n    let cooked = expandableFootnote.closest(\".cooked\");\n    if (cooked.dataset.refPostId != null) {\n      // For full screen tables, redirect\n      cooked = document.querySelector(`article[data-post-id=\"${cooked.dataset.refPostId}\"] .cooked`);\n    }\n    const newContent = cooked.querySelector(footnoteId);\n    footnoteContent.innerHTML = newContent.innerHTML;\n\n    // display tooltip\n    tooltip.dataset.show = \"\";\n    tooltip.dataset.footnoteId = footnoteId;\n\n    // setup popper\n    inlineFootnotePopper?.destroy();\n    inlineFootnotePopper = (0, _core.createPopper)(expandableFootnote, tooltip, {\n      modifiers: [{\n        name: \"arrow\",\n        options: {\n          element: tooltip.querySelector(\"#arrow\")\n        }\n      }, {\n        name: \"preventOverflow\",\n        options: {\n          altAxis: true,\n          padding: 5\n        }\n      }, {\n        name: \"offset\",\n        options: {\n          offset: [0, 12]\n        }\n      }]\n    });\n  }\n  var _default = _exports.default = {\n    name: \"inline-footnotes\",\n    initialize(container) {\n      if (!container.lookup(\"service:site-settings\").display_footnotes_inline) {\n        return;\n      }\n      document.body.append(buildTooltip());\n      window.addEventListener(\"click\", footnoteEventHandler, true);\n      (0, _pluginApi.withPluginApi)(\"0.8.9\", api => {\n        api.decorateCookedElement(elem => applyInlineFootnotes(elem), {\n          onlyStream: true,\n          id: \"inline-footnotes\"\n        });\n        api.onPageChange(() => {\n          inlineFootnotePopper?.destroy();\n          const tooltip = document.getElementById(\"footnote-tooltip\");\n          tooltip?.removeAttribute(\"data-show\");\n          tooltip?.removeAttribute(\"data-footnote-id\");\n        });\n      });\n    },\n    teardown() {\n      inlineFootnotePopper?.destroy();\n      window.removeEventListener(\"click\", footnoteEventHandler);\n      document.getElementById(\"footnote-tooltip\")?.remove();\n    }\n  };\n});","define(\"discourse/plugins/footnote/lib/discourse-markdown/footnotes\", [\"exports\"], function (_exports) {\n  \"use strict\";\n\n  Object.defineProperty(_exports, \"__esModule\", {\n    value: true\n  });\n  _exports.setup = setup;\n  function setup(helper) {\n    helper.registerOptions((opts, siteSettings) => {\n      opts.features[\"footnotes\"] = window.markdownitFootnote && !!siteSettings.enable_markdown_footnotes;\n    });\n    helper.allowList([\"ol.footnotes-list\", \"hr.footnotes-sep\", \"li.footnote-item\", \"a.footnote-backref\", \"sup.footnote-ref\"]);\n    helper.allowList({\n      custom(tag, name, value) {\n        if ((tag === \"a\" || tag === \"li\") && name === \"id\") {\n          return !!value.match(/^fn(ref)?\\d+$/);\n        }\n      }\n    });\n    if (window.markdownitFootnote) {\n      helper.registerPlugin(window.markdownitFootnote);\n    }\n  }\n});","define(\"discourse/plugins/footnote/lib/rich-editor-extension\", [\"exports\"], function (_exports) {\n  \"use strict\";\n\n  Object.defineProperty(_exports, \"__esModule\", {\n    value: true\n  });\n  _exports.default = void 0;\n  function createFootnoteNodeView(_ref) {\n    let {\n      pmView: {\n        EditorView\n      },\n      pmState: {\n        EditorState\n      },\n      pmTransform: {\n        StepMap\n      }\n    } = _ref;\n    // from https://prosemirror.net/examples/footnote/\n    return class FootnoteNodeView {\n      constructor(node, view, getPos) {\n        this.node = node;\n        this.outerView = view;\n        this.getPos = getPos;\n        this.dom = document.createElement(\"div\");\n        this.dom.className = \"footnote\";\n        this.innerView = null;\n      }\n      selectNode() {\n        this.dom.classList.add(\"ProseMirror-selectednode\");\n        if (!this.innerView) {\n          this.open();\n        }\n      }\n      deselectNode() {\n        this.dom.classList.remove(\"ProseMirror-selectednode\");\n        if (this.innerView) {\n          this.close();\n        }\n      }\n      open() {\n        const tooltip = this.dom.appendChild(document.createElement(\"div\"));\n        tooltip.style.setProperty(\"--footnote-counter\", `\"${this.#getFootnoteCounterValue()}\"`);\n        tooltip.className = \"footnote-tooltip\";\n        this.innerView = new EditorView(tooltip, {\n          state: EditorState.create({\n            doc: this.node,\n            plugins: this.outerView.state.plugins.filter(plugin => !/^(placeholder|trailing-paragraph)\\$.*/.test(plugin.key))\n          }),\n          dispatchTransaction: this.dispatchInner.bind(this),\n          handleDOMEvents: {\n            mousedown: () => {\n              // Kludge to prevent issues due to the fact that the whole\n              // footnote is node-selected (and thus DOM-selected) when\n              // the parent editor is focused.\n              if (this.outerView.hasFocus()) {\n                this.innerView.focus();\n              }\n            }\n          }\n        });\n      }\n      #getFootnoteCounterValue() {\n        const footnotes = this.dom.closest(\".ProseMirror\")?.querySelectorAll(\".footnote\");\n        return Array.from(footnotes).indexOf(this.dom) + 1;\n      }\n      close() {\n        this.innerView.destroy();\n        this.innerView = null;\n        this.dom.textContent = \"\";\n      }\n      dispatchInner(tr) {\n        const {\n          state,\n          transactions\n        } = this.innerView.state.applyTransaction(tr);\n        this.innerView.updateState(state);\n        if (!tr.getMeta(\"fromOutside\")) {\n          const outerTr = this.outerView.state.tr,\n            offsetMap = StepMap.offset(this.getPos() + 1);\n          for (let i = 0; i < transactions.length; i++) {\n            const steps = transactions[i].steps;\n            for (let j = 0; j < steps.length; j++) {\n              outerTr.step(steps[j].map(offsetMap));\n            }\n          }\n          if (outerTr.docChanged) {\n            this.outerView.dispatch(outerTr);\n          }\n        }\n      }\n      update(node) {\n        if (!node.sameMarkup(this.node)) {\n          return false;\n        }\n        this.node = node;\n        if (this.innerView) {\n          const state = this.innerView.state;\n          const start = node.content.findDiffStart(state.doc.content);\n          if (start != null) {\n            let {\n              a: endA,\n              b: endB\n            } = node.content.findDiffEnd(state.doc.content);\n            let overlap = start - Math.min(endA, endB);\n            if (overlap > 0) {\n              endA += overlap;\n              endB += overlap;\n            }\n            this.innerView.dispatch(state.tr.replace(start, endB, node.slice(start, endA)).setMeta(\"fromOutside\", true));\n          }\n        }\n        return true;\n      }\n      destroy() {\n        if (this.innerView) {\n          this.close();\n        }\n      }\n      stopEvent(event) {\n        return this.innerView && this.innerView.dom.contains(event.target);\n      }\n      ignoreMutation() {\n        return true;\n      }\n    };\n  }\n\n  /** @type {RichEditorExtension} */\n  const extension = {\n    nodeViews: {\n      footnote: createFootnoteNodeView\n    },\n    nodeSpec: {\n      footnote: {\n        attrs: {\n          id: {}\n        },\n        group: \"inline\",\n        content: \"block*\",\n        inline: true,\n        atom: true,\n        draggable: false,\n        parseDOM: [{\n          tag: \"div.footnote\"\n        }],\n        toDOM: () => [\"div\", {\n          class: \"footnote\"\n        }, 0]\n      }\n    },\n    parse(_ref2) {\n      let {\n        pmModel: {\n          Slice,\n          Fragment\n        }\n      } = _ref2;\n      return {\n        footnote_ref: {\n          node: \"footnote\",\n          getAttrs: token => {\n            return {\n              id: token.meta.id\n            };\n          }\n        },\n        footnote_block: {\n          ignore: true\n        },\n        footnote_open(state, token, tokens, i) {\n          // footnote_open should be at the root level\n          const doc = state.top();\n          const id = token.meta.id;\n          let innerTokens = tokens.slice(i + 1, tokens.length - 1);\n          const footnoteCloseIndex = innerTokens.findIndex(t => t.type === \"footnote_close\");\n          innerTokens = innerTokens.slice(0, footnoteCloseIndex);\n          doc.content.forEach((node, pos) => {\n            const replacements = [];\n            node.descendants((child, childPos) => {\n              if (child.type.name !== \"footnote\" || child.attrs.id !== id) {\n                return;\n              }\n\n              // this is a trick to parse this subset of tokens having the footnote as parent\n              state.stack = [];\n              state.openNode(state.schema.nodes.footnote);\n              state.parseTokens(innerTokens);\n              const footnote = state.closeNode();\n              state.stack = [doc];\n              // then we restore the stack as it was before\n\n              const slice = new Slice(Fragment.from(footnote), 0, 0);\n              replacements.push({\n                from: childPos,\n                to: childPos + 2,\n                slice\n              });\n            });\n            for (const {\n              from,\n              to,\n              slice\n            } of replacements) {\n              doc.content[pos] = doc.content[pos].replace(from, to, slice);\n            }\n          });\n\n          // remove the inner tokens + footnote_close from the tokens stream\n          tokens.splice(i + 1, innerTokens.length + 1);\n        },\n        footnote_anchor: {\n          ignore: true,\n          noCloseToken: true\n        }\n      };\n    },\n    serializeNode: {\n      footnote(state, node) {\n        if (node.content.content.length === 1 && node.content.firstChild.type.name === \"paragraph\") {\n          state.write(`^[`);\n          state.renderContent(node.content.firstChild);\n          state.write(`]`);\n        } else {\n          const contents = state.footnoteContents ??= [];\n          contents.push(node.content);\n          state.write(`[^${contents.length}]`);\n        }\n      },\n      afterSerialize(state) {\n        const contents = state.footnoteContents;\n        if (!contents) {\n          return;\n        }\n        for (let i = 0; i < contents.length; i++) {\n          const oldDelim = state.delim;\n          state.write(`[^${i + 1}]: `);\n          state.delim += \"    \";\n          state.renderContent(contents[i]);\n          state.delim = oldDelim;\n        }\n      }\n    },\n    inputRules: [{\n      match: /\\^\\[(.*?)]$/,\n      handler: (state, match, start, end) => {\n        const content = state.doc.slice(start + 2, end).content;\n        const paragraph = state.schema.nodes.paragraph.create(null, content);\n        const footnote = state.schema.nodes.footnote.create(null, paragraph);\n        return state.tr.replaceWith(start, end, footnote);\n      }\n    }]\n  };\n  var _default = _exports.default = extension;\n});"],"mappings":"AAAAA,OAAA,2KAAAC,EAAAC,EAAAC,EAAAC,GACA;AAEAC,OAAAC,eAAAL,EAAA,cACAM,OAAA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