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I,KAAM,CACFsI,OAAQnN,KAAKqK,KACb+C,SAAU,4EAEdC,SAAUrN,KAAKgM,KACfsB,QAAQ,EACRC,sBAAsB,EACtBC,cAAe,CACX,oBAAqB,CACjBC,cAAe/B,EAASvF,KAAK,qBAIzCnG,KAAK0N,gBACR,M,8EAAA,EA5NgBvD,GCDrBjE,GAAE,WACA9B,OAAOD,eAAegG,qBAAuB/F,OAAOD,eAAegG,sBAAwB,IAAIA,EAC/F/F,OAAOD,eAAewJ,4BAA8BvJ,OAAOD,eAAewJ,6BAA+B,IAAIxD,EAG7G,IAAMyD,EAAU1H,EAAE,gCACZ2H,EAAW3H,EAAE,oEACf6G,EAAQ,KACRa,EAAQtN,SACV8D,OAAOD,eAAegG,qBAAqB2D,KAAKF,GAChDb,EAAQ3I,OAAOD,eAAegG,qBAAqBuB,SAASiB,QAAQ,SAElEkB,EAASvN,SACX8D,OAAOD,eAAewJ,4BAA4BG,KAAKD,GAClDd,IACHA,EAAQ3I,OAAOD,eAAewJ,4BAA4BjC,SAASiB,QAAQ,UAI3EI,GACFA,EAAMlJ,GAAG,UAAU,SAACiC,GACdA,EAAIhE,OAAOiM,iBAETH,EAAQtN,QACV8D,OAAOD,eAAegG,qBAAqB6D,YAEzCH,EAASvN,QACX8D,OAAOD,eAAewJ,4BAA4BK,cAGpDlI,EAAImI,iBACJnI,EAAIhE,OAAOoM,iBAXf,GApBH,G","sources":["webpack://app/../usr/local/bundle/gems/decidim-core-0.27.4/app/packs/src/decidim/editor/linebreak_module.js","webpack://app/./app/packs/src/decidim/decidim_awesome/editors/editor.js","webpack://app/../usr/local/bundle/bundler/gems/decidim-module-decidim_awesome-b9aae42bc835/app/packs/src/decidim/decidim_awesome/forms/rich_text_plugin.js","webpack://app/./app/packs/src/decidim/decidim_awesome/forms/custom_fields_renderer.js","webpack://app/../usr/local/bundle/bundler/gems/decidim-module-decidim_awesome-b9aae42bc835/app/packs/src/decidim/decidim_awesome/proposals/custom_fields.js"],"sourcesContent":["/* eslint-disable require-jsdoc */\n\nimport addEnterBindings from \"src/decidim/editor/modified_enter\"\nimport backspaceBindingsRangeAny from \"src/decidim/editor/modified_backspace_offset_any\"\nimport backspaceBindings from \"src/decidim/editor/modified_backspace_offset1\"\nimport HistoryOverride from \"src/decidim/editor/history_override\"\n\n// Disable warning messages from overwritting modules\nQuill.debug(\"error\");\n\n// It all started with these snippets of code: https://github.com/quilljs/quill/issues/252\nconst Delta = Quill.import(\"delta\");\nconst Break = Quill.import(\"blots/break\");\nconst Embed = Quill.import(\"blots/embed\");\nconst Scroll = Quill.import(\"blots/scroll\");\nconst Parchment = Quill.import(\"parchment\");\nQuill.register({\"modules/history\": HistoryOverride}, true);\nlet icons = Quill.import(\"ui/icons\");\nicons.linebreak = \"⏎\";\n\nclass SmartBreak extends Break {\n  length() {\n    return 1;\n  }\n\n  value() {\n    return \"\\n\";\n  }\n\n  insertInto(parent, ref) {\n    // Embed.prototype.insertInto.call(this, parent, ref);\n    Reflect.apply(Embed.prototype.insertInto, this, [parent, ref]);\n  }\n}\nQuill.register(SmartBreak);\n\n// Override quill/blots/scroll.js\nclass ScrollOvderride extends Scroll {\n  optimize(mutations = [], context = {}) {\n    if (this.batch === true) {\n      return;\n    }\n\n    this.parchmentOptimize(mutations, context);\n\n    if (mutations.length > 0) {\n      // quill/core/emitter.js, Emitter.events.SCROLL_OPTIMIZE = \"scroll-optimize\"\n      this.emitter.emit(\"scroll-optimize\", mutations, context);\n    }\n  }\n\n  // Override parchment/src/blot/scroll.ts\n  parchmentOptimize(mutations = [], context = {}) {\n    // super.optimize(context);\n    Reflect.apply(Parchment.Container.prototype.optimize, this, [context]);\n\n    // We must modify mutations directly, cannot make copy and then modify\n    // let records = [].slice.call(this.observer.takeRecords());\n    let records = [...this.observer.takeRecords()];\n    // Array.push currently seems to be implemented by a non-tail recursive function\n    // so we cannot just mutations.push.apply(mutations, this.observer.takeRecords());\n    while (records.length > 0) {\n      mutations.push(records.pop());\n    }\n    let mark = (blot, markParent) => {\n      if (!blot || blot === this) {\n        return;\n      }\n      if (!blot.domNode.parentNode) {\n        return;\n      }\n      if (blot.domNode.__blot && blot.domNode.__blot.mutations === null) {\n        blot.domNode.__blot.mutations = [];\n      }\n      if (markParent) {\n        mark(blot.parent);\n      }\n    };\n    let optimize = (blot) => {\n      // Post-order traversal\n      if (!blot.domNode.__blot) {\n        return;\n      }\n\n      if (blot instanceof Parchment.Container) {\n        blot.children.forEach(optimize);\n      }\n      blot.optimize(context);\n    };\n    let remaining = mutations;\n    for (let ind = 0; remaining.length > 0; ind += 1) {\n      // MAX_OPTIMIZE_ITERATIONS = 100\n      if (ind >= 100) {\n        throw new Error(\"[Parchment] Maximum optimize iterations reached\");\n      }\n      remaining.forEach((mutation) => {\n        let blot = Parchment.find(mutation.target, true);\n        if (!blot) {\n          return;\n        }\n        if (blot.domNode === mutation.target) {\n          if (mutation.type === \"childList\") {\n            mark(Parchment.find(mutation.previousSibling, false));\n\n            mutation.addedNodes.forEach((node) => {\n              let child = Parchment.find(node, false);\n              mark(child, false);\n              if (child instanceof Parchment.Container) {\n                child.children.forEach(function(grandChild) {\n                  mark(grandChild, false);\n                });\n              }\n            });\n          } else if (mutation.type === \"attributes\") {\n            mark(blot.prev);\n          }\n        }\n        mark(blot);\n      });\n      this.children.forEach(optimize);\n      remaining = [...this.observer.takeRecords()];\n      records = remaining.slice();\n      while (records.length > 0) {\n        mutations.push(records.pop());\n      }\n    }\n  }\n};\nQuill.register(\"blots/scroll\", ScrollOvderride, true);\nParchment.register(ScrollOvderride);\n\nexport default function lineBreakButtonHandler(quill) {\n  let range = quill.selection.getRange()[0];\n  let currentLeaf = quill.getLeaf(range.index)[0];\n  let nextLeaf = quill.getLeaf(range.index + 1)[0];\n  const previousChar = quill.getText(range.index - 1, 1);\n\n  // Insert a second break if:\n  // At the end of the editor, OR next leaf has a different parent (<p>)\n  if (nextLeaf === null || (currentLeaf.parent !== nextLeaf.parent)) {\n    quill.insertEmbed(range.index, \"break\", true, \"user\");\n    quill.insertEmbed(range.index, \"break\", true, \"user\");\n  } else if (previousChar === \"\\n\") {\n    const delta = new Delta().retain(range.index).insert(\"\\n\");\n    quill.updateContents(delta, Quill.sources.USER);\n  } else {\n    quill.insertEmbed(range.index, \"break\", true, \"user\");\n  }\n\n  // Now that we've inserted a line break, move the cursor forward\n  quill.setSelection(range.index + 1, Quill.sources.SILENT);\n}\n\nQuill.register(\"modules/linebreak\", (quill) => {\n  quill.getModule(\"toolbar\").addHandler(\"linebreak\", () => {\n    lineBreakButtonHandler(quill);\n  });\n\n  quill.emitter.on(\"editor-ready\", () => {\n    const length = quill.getLength();\n    const text = quill.getText(length - 2, 2);\n\n    // Remove extraneous new lines\n    if (text === \"\\n\\n\") {\n      quill.deleteText(quill.getLength() - 2, 2);\n    }\n  });\n\n  addEnterBindings(quill);\n  backspaceBindingsRangeAny(quill);\n  backspaceBindings(quill);\n\n  return;\n});\n\n","/* eslint-disable require-jsdoc, func-style */\n\n/*\n* Since version 0.25 we follow a different strategy and opt to destroy and override completely the original editor\n* That's because editors are instantiated directly instead of creating a global function to instantiate them\n*/\n\nimport lineBreakButtonHandler from \"src/decidim/editor/linebreak_module\"\nimport InscrybMDE from \"inscrybmde\"\nimport Europa from \"europa\"\nimport \"inline-attachment/src/inline-attachment\";\nimport \"inline-attachment/src/codemirror-4.inline-attachment\";\nimport \"inline-attachment/src/jquery.inline-attachment\";\nimport hljs from \"highlight.js\";\nimport \"highlight.js/styles/github.css\";\nimport \"src/decidim/editor/clipboard_override\"\nimport \"src/decidim/vendor/image-resize.min\"\nimport \"src/decidim/vendor/image-upload.min\"\nimport { marked } from \"marked\";\n\nconst DecidimAwesome = window.DecidimAwesome || {};\nconst quillFormats = [\"bold\", \"italic\", \"link\", \"underline\", \"header\", \"list\", \"video\", \"image\", \"alt\", \"break\", \"width\", \"style\", \"code\", \"blockquote\", \"indent\"];\n\n// A tricky way to destroy the quill editor\nexport function destroyQuillEditor(container) {\n    if (container) {\n        const content = $(container).find(\".ql-editor\").html();\n        $(container).html(content);\n        $(container).siblings(\".ql-toolbar\").remove();\n        $(container).find(\"*[class*='ql-']\").removeClass((index, className) => (className.match(/(^|\\s)ql-\\S+/g) || []).join(\" \"));\n        $(container).removeClass((index, className) => (className.match(/(^|\\s)ql-\\S+/g) || []).join(\" \"));\n        if ($(container).next().is(\"p.help-text\")) {\n            $(container).next().remove();\n        }\n    }\n    else {\n        console.error(`editor [${container}] not exists`);\n    }\n}\n\nexport function createQuillEditor(container) {\n    const toolbar = $(container).data(\"toolbar\");\n    const disabled = $(container).data(\"disabled\");\n    const allowedEmptyContentSelector = \"iframe,img\";\n\n    let quillToolbar = [\n        [\"bold\", \"italic\", \"underline\", \"linebreak\"],\n        [{ list: \"ordered\" }, { list: \"bullet\" }],\n        [\"link\", \"clean\"],\n        [\"code\", \"blockquote\"],\n        [{ \"indent\": \"-1\"}, { \"indent\": \"+1\" }]\n    ];\n\n    let addImage = false;\n\n    if (toolbar === \"full\") {\n        quillToolbar = [\n            [{ header: [2, 3, 4, 5, 6, false] }],\n            ...quillToolbar\n        ];\n        if (DecidimAwesome.allow_images_in_full_editor) {\n            quillToolbar.push([\"video\", \"image\"]);\n            addImage = true;\n        } else {\n            quillToolbar.push([\"video\"]);\n        }\n    } else if (toolbar === \"basic\") {\n        if (DecidimAwesome.allow_images_in_small_editor) {\n            quillToolbar.push([\"video\", \"image\"]);\n            addImage = true;\n        } else {\n            quillToolbar.push([\"video\"]);\n        }\n    } else if (DecidimAwesome.allow_images_in_small_editor) {\n        quillToolbar.push([\"image\"]);\n        addImage = true;\n    }\n\n    let modules = {\n        linebreak: {},\n        toolbar: {\n            container: quillToolbar,\n            handlers: {\n                \"linebreak\": lineBreakButtonHandler\n            }\n        }\n    };\n\n    const $input = $(container).siblings('input[type=\"hidden\"]');\n    container.innerHTML = $input.val() || \"\";\n    const token = $('meta[name=\"csrf-token\"]').attr(\"content\");\n    if (addImage) {\n        modules.imageResize = {\n            modules: [\"Resize\", \"DisplaySize\"]\n        }\n        modules.imageUpload = {\n            url: DecidimAwesome.editor_uploader_path,\n            method: \"POST\",\n            name: \"image\",\n            withCredentials: false,\n            headers: { \"X-CSRF-Token\": token },\n            callbackOK: (serverResponse, next) => {\n                $(\"div.ql-toolbar\").last().removeClass(\"editor-loading\")\n                next(serverResponse.url);\n            },\n            callbackKO: (serverError) => {\n                $(\"div.ql-toolbar\").last().removeClass(\"editor-loading\")\n                let msg = serverError && serverError.body;\n                try {\n                    msg = JSON.parse(msg).message;\n                } catch (evt) { console.error(\"Parsing error\", evt); }\n                console.error(`Image upload error: ${msg}`);\n                let $p = $(`<p class=\"text-alert help-text\">${msg}</p>`);\n                $(container).after($p)\n                setTimeout(() => {\n                    $p.fadeOut(1000, () => {\n                        $p.destroy();\n                    });\n                }, 3000);\n            },\n            checkBeforeSend: (file, next) => {\n                $(\"div.ql-toolbar\").last().addClass(\"editor-loading\")\n                next(file);\n            }\n        }\n    }\n    const quill = new Quill(container, {\n        modules: modules,\n        formats: quillFormats,\n        theme: \"snow\"\n    });\n\n    if (disabled) {\n        quill.disable();\n    }\n\n    quill.on(\"text-change\", () => {\n        const text = quill.getText();\n\n        // Triggers CustomEvent with the cursor position\n        // It is required in input_mentions.js\n        let event = new CustomEvent(\"quill-position\", {\n            detail: quill.getSelection()\n        });\n        container.dispatchEvent(event);\n\n        if ((text === \"\\n\" || text === \"\\n\\n\") && quill.root.querySelectorAll(allowedEmptyContentSelector).length === 0\n            && !$input.val().match(/img/)) {\n            $input.val(\"\");\n        } else {\n            const emptyParagraph = \"<p><br></p>\";\n            const cleanHTML = quill.root.innerHTML.replace(\n                new RegExp(`^${emptyParagraph}|${emptyParagraph}$`, \"g\"),\n                \"\"\n            );\n            $input.val(cleanHTML);\n        }\n    });\n    // After editor is ready, linebreak_module deletes two extraneous new lines\n    quill.emitter.emit(\"editor-ready\");\n\n    if (addImage) {\n        const text = $(container).data(\"dragAndDropHelpText\") || DecidimAwesome.texts.drag_and_drop_image;\n        $(container).after(`<p class=\"help-text\" style=\"margin-top:-1.5rem;\">${text}</p>`);\n    }\n\n    // After editor is ready, linebreak_module deletes two extraneous new lines\n    quill.emitter.emit(\"editor-ready\");\n\n    return quill;\n}\n\nexport function createMarkdownEditor(container) {\n    const text = DecidimAwesome.texts.drag_and_drop_image;\n    const token = $('meta[name=\"csrf-token\"]').attr(\"content\");\n    const $input = $(container).siblings('input[type=\"hidden\"]');\n    const $faker = $('<textarea name=\"faker-inscrybmde\"/>');\n    const $form = $(container).closest(\"form\");\n    const europa = new Europa();\n    $faker.val(europa.convert($input.val()));\n    $faker.insertBefore($(container));\n    $(container).hide();\n    const inscrybmde = new InscrybMDE({\n        element: $faker[0],\n        spellChecker: false,\n        renderingConfig: {\n            codeSyntaxHighlighting: true,\n            hljs: hljs\n        }\n    });\n    $faker[0].InscrybMDE = inscrybmde;\n\n    // Allow image upload\n    if (DecidimAwesome.allow_images_in_markdown_editor) {\n        $(inscrybmde.gui.statusbar).prepend(`<span class=\"help-text\" style=\"float:left;margin:0;text-align:left;\">${text}</span>`);\n        window.inlineAttachment.editors.codemirror4.attach(inscrybmde.codemirror, {\n            uploadUrl: DecidimAwesome.editor_uploader_path,\n            uploadFieldName: \"image\",\n            jsonFieldName: \"url\",\n            extraHeaders: { \"X-CSRF-Token\": token }\n        });\n    }\n\n    // Allow linebreaks\n    marked.setOptions({\n        breaks: true\n    });\n\n    // convert to html on submit\n    $form.on(\"submit\", () => {\n        // e.preventDefault();\n        $input.val(marked(inscrybmde.value()));\n    });\n}\n","/**\n * Decidim rich text editor control plugin\n * Renders standard Decidim WYSIWYG editor\n *\n * Registers Decidim Richtext as a subtype for the textarea control\n */\nimport {createQuillEditor} from \"src/decidim/decidim_awesome/editors/editor\"\n\n// configure the class for runtime loading\nif (!window.fbControls) {\n  window.fbControls = []\n}\nwindow.fbControls.push(function(controlClass, allControlClasses) {\n  const controlTextarea = allControlClasses.textarea\n\n  /**\n   * DecidimRichtext control class\n   *\n   * NOTE: I haven't found a way to set the userData value using this plugin\n   *       For this reason the value of the field must be collected manually\n   *       from the hidden input name same as the field with the suffix '-input'\n   */\n  class controlRichtext extends controlTextarea {\n\n    /**\n     * Class configuration - return the icons & label related to this control\n     * @return {JSON} definition object\n     */\n    static get definition() {\n      return {\n        icon: \"📝\",\n        i18n: {\n          default: \"Rich Text Editor\"\n        }\n      }\n    }\n\n    /**\n     * configure the richtext editor requirements\n     * @return {void}\n     */\n    configure() {\n      window.fbEditors.richtext = {};\n    }\n\n    /**\n     * build a div DOM element & convert to a richtext editor\n     * @return {DOMElement} DOM Element to be injected into the form.\n     */\n    build() {\n      const { value, userData, ...attrs } = this.config;\n\n      // hidden input for storing the current HTML value of the div\n      this.inputId = `${this.id}-input`;\n      // console.log(\"build plugin: this\",this)\n      this.input = this.markup(\"input\", null, {\n        name: name,\n        id: this.inputId,\n        type: \"hidden\",\n        value: (userData && userData[0]) || value || \"\"\n      });\n\n      const css = this.markup(\n        \"style\",\n        `\n        #${attrs.id} { height: auto; min-height: 6rem; padding-left: 0; padding-right: 0; }\n        #${attrs.id} div.ql-container { height: ${attrs.rows || 1}rem; }\n        #${attrs.id} p.help-text { margin-top: .5rem; }\n        `,\n        { type: \"text/css\" }\n      );\n      const wrapperAttrs = {...attrs, \"data-toolbar\": \"full\" };\n      // console.log(\"build value\", value, \"userData\", userData, \"attrs\", attrs, attrs.id, \"wrapperAttrs\", wrapperAttrs);\n      this.wrapper = this.markup(\"div\", null, wrapperAttrs);\n      return this.markup(\"div\", [css, this.input, this.wrapper], attrs);\n    }\n\n    /**\n     * When the element is rendered into the DOM, execute the following code to initialise it\n     * @param {Object} evt - event\n     * @return {Object} evt - event\n     */\n    onRender(evt) {\n      // const value = this.config.value || '';\n      if (window.fbEditors.richtext[this.id]) {\n        // console.log(\"todo destroy\", window.fbEditors.richtext[this.id]);\n        // window.fbEditors.richtext[this.id].richtext('destroy')\n      }\n\n      window.fbEditors.quill[this.id] = {};\n      const editor = window.fbEditors.quill[this.id];\n      // createQuillEditor does all the job to update the hidden input wrapper\n      editor.instance = createQuillEditor(this.wrapper);\n      // editor.data = new Delta();\n      // if (value) {\n      //   editor.instance.setContents(window.JSON.parse(this.parsedHtml(value)));\n      // }\n      // editor.instance.on('text-change', function(delta) {\n      //   console.log(\"text-change\", \"delta\", delta, \"editor\", editor);\n      // //   // editor.data = editor.data.compose(delta);\n      // });\n\n      // console.log(\"render! editor\", editor, \"this\", this, \"value\", value);\n      return evt;\n    }\n  }\n\n  // register Decidim richtext as a richtext control\n  controlTextarea.register(\"richtext\", controlRichtext, \"textarea\");\n})\n","import \"formBuilder/dist/form-render.min.js\";\nimport \"src/decidim/decidim_awesome/forms/rich_text_plugin\"\n\nexport default class CustomFieldsRenderer { // eslint-disable-line no-unused-vars\n    constructor(containerSelector) {\n        this.containerSelector = containerSelector || \".proposal_custom_field:last\";\n        this.lang = this.getLang(window.DecidimAwesome.currentLocale);\n    }\n\n    getLang(lang) {\n        const langs = {\n            // ar: 'ar-SA', // Not in decidim yet\n            \"ar\": \"ar-TN\",\n            \"ca\": \"ca-ES\",\n            \"cs\": \"cs-CZ\",\n            \"da\": \"da-DK\",\n            \"de\": \"de-DE\",\n            \"el\": \"el-GR\",\n            \"en\": \"en-US\",\n            \"es\": \"es-ES\",\n            \"fa\": \"fa-IR\",\n            \"fi\": \"fi-FI\",\n            \"fr\": \"fr-FR\",\n            \"he\": \"he-IL\",\n            \"hu\": \"hu-HU\",\n            \"it\": \"it-IT\",\n            \"ja\": \"ja-JP\",\n            \"my\": \"my-MM\",\n            \"nb\": \"nb-NO\",\n            \"nl\": \"nl-NL\",\n            \"pl\": \"pl-PL\",\n            \"pt\": \"pt-BR\",\n            \"qz\": \"qz-MM\",\n            \"ro\": \"ro-RO\",\n            \"ru\": \"ru-RU\",\n            \"sl\": \"sl-SI\",\n            \"th\": \"th-TH\",\n            \"tr\": \"tr-TR\",\n            \"uk\": \"uk-UA\",\n            \"vi\": \"vi-VN\",\n            \"zh-TW\": \"zh-TW\",\n            \"zh\": \"zh-CN\"\n        };\n        if (langs[lang]) {\n            return langs[lang];\n        }\n        if (langs[lang.substr(0, 2)]) {\n            return langs[lang.substr(0, 2)];\n        }\n        return \"en-US\";\n    }\n\n    /*\n    * Creates an XML document with a subset of html-compatible dl/dd/dt elements\n    * to store the custom fields answers\n    */\n    dataToXML(data) {\n        const $dl = $(\"<dl/>\");\n        let $dd = null,\n            $div = null,\n            $dt = null,\n            datum = null,\n            key = null,\n            label = null,\n            text = null,\n            val = null;\n        $dl.attr(\"class\", \"decidim_awesome-custom_fields\");\n        $dl.attr(\"data-generator\", \"decidim_awesome\");\n        $dl.attr(\"data-version\", window.DecidimAwesome.version);\n        for (key in data) { // eslint-disable-line guard-for-in\n            // console.log(\"get the data!\", key, data[key]);\n            // Richtext plugin does not saves userdata, so we get it from the hidden input\n            if (data[key].type === \"textarea\" && data[key].subtype === \"richtext\") {\n                data[key].userData = [$(`#${data[key].name}-input`).val()];\n            }\n            if (data[key].userData && data[key].userData.length) {\n                $dt = $(\"<dt/>\");\n                $dt.text(data[key].label);\n                $dt.attr(\"name\", data[key].name);\n                $dd = $(\"<dd/>\");\n                // console.log(\"data for\", key, data[key].name, data[key])\n                for (val in data[key].userData) { // eslint-disable-line guard-for-in\n                    $div = $(\"<div/>\");\n                    label = data[key].userData[val];\n                    text = null;\n                    if (data[key].values) {\n                        datum = data[key].values.find((obj) => obj.value === label); // eslint-disable-line no-loop-func\n                        if (datum) { // eslint-disable-line max-depth\n                            text = label;\n                            label = datum.label;\n                        }\n                    } else if (data[key].type === \"date\" && label) {\n                        datum = new Date(label).toLocaleDateString();\n                        if (datum) { // eslint-disable-line max-depth\n                            text = label;\n                            label = datum;\n                        }\n                    }\n                    // console.log(\"userData\", text, \"label\", label, 'key', key, 'data', data)\n                    if (data[key].type === \"textarea\" && data[key].subtype === \"richtext\") {\n                        $div.html(label);\n                    } else {\n                        $div.text(label);\n                    }\n                    if (text) {\n                        $div.attr(\"alt\", text);\n                    }\n                    $dd.append($div);\n                }\n                $dd.attr(\"id\", data[key].name);\n                $dd.attr(\"name\", data[key].type);\n                $dl.append($dt);\n                $dl.append($dd);\n            }\n        }\n        return `<xml>${$dl[0].outerHTML}</xml>`;\n    }\n\n    fixBuggyFields() {\n        if (!this.$element) {\n            return false;\n        }\n\n        /**\n         * Hack to fix required checkboxes being reset\n         * Issue: https://github.com/decidim-ice/decidim-module-decidim_awesome/issues/82\n         */\n        this.$element.find(\".formbuilder-checkbox-group\").each((_key, group) => {\n            const inputs = $(\".formbuilder-checkbox input\", group);\n            const $label = $(group).find(\"label\");\n            const data = this.spec.find((obj) => obj.type === \"checkbox-group\" && obj.name === $label.attr(\"for\"));\n            let values = data.userData;\n            if (!inputs.length || !data || !values) {\n                return;\n            }\n\n            inputs.each((_idx, input) => {\n                let index = values.indexOf(input.value);\n                if (index >= 0) {\n                    values.splice(index, 1)\n                    // setting checked=true do not makes the browser aware that the form is valid if the field is required\n                    if (!input.checked)\n                    {$(input).click();}\n                } else if (input.checked)\n                {$(input).click();}\n            });\n\n            // Fill \"other\" option\n            const otherOption = $(\".other-option\", inputs.parent())[0];\n            const otherVal = $(\".other-val\", inputs.parent())[0];\n            const otherText = values.join(\" \");\n\n            if (otherOption) {\n                if (otherText) {\n                    otherOption.checked = true;\n                    otherOption.value = otherText;\n                    otherVal.value = otherText;\n                } else {\n                    otherOption.checked = false;\n                    otherOption.value = \"\";\n                    otherVal.value = \"\";\n                }\n            }\n        });\n\n        /**\n         * Hack to fix required radio buttons \"other\" value\n         * Issue: https://github.com/decidim-ice/decidim-module-decidim_awesome/issues/133\n         */\n        this.$element.find(\".formbuilder-radio input.other-val\").on(\"input\", (input) => {\n            const $input = $(input.currentTarget);\n            const $group = $input.closest(\".formbuilder-radio-group\");\n            $group.find(\"input\").each((_key, radio) => {\n                const name = $(radio).attr(\"name\");\n                if (name && name.endsWith(\"[]\")) {\n                    $(radio).attr(\"name\", name.slice(0, -2));\n                }\n            });\n        });\n        return this;\n    }\n\n    // Saves xml to the hidden input\n    storeData() {\n        if (!this.$element) {\n            return false;\n        }\n        const $form = this.$element.closest(\"form\");\n        const $body = $form.find(`input[name=\"${this.$element.data(\"name\")}\"]`);\n        if ($body.length && this.instance) {\n            this.spec = this.instance.userData;\n            console.log(\"Spec data:\", this.spec);\n            $body.val(this.dataToXML(this.spec));\n            this.$element.data(\"spec\", this.spec);\n        }\n        // console.log(\"storeData spec\", this.spec, \"$body\", $body,\"$form\",$form,\"this\",this);\n        return this;\n    }\n\n    init($element) {\n        console.log(\"CustomFieldsRenderer init\");\n        this.$element = $element;\n        console.log(\"Element for rendering:\", $element);\n\n        this.spec = $element.data(\"spec\");\n        console.log(\"Spec data:\", this.spec);\n        // console.log(\"init\", $element, \"this\", this)\n        // in case of multilang tabs we only render one form due a limitation in the library for handling several instances\n        this.instance = $element.formRender({\n            i18n: {\n                locale: this.lang,\n                location: \"https://decidim.storage.opensourcepolitics.eu/osp-cdn/form_builder/1.1.0\"\n            },\n            formData: this.spec,\n            render: true,\n            disableInjectedStyle: true,\n            controlConfig: {\n                \"textarea.richtext\": {\n                    editorOptions: $element.data(\"editorOptions\")\n                }\n            }\n        });\n        this.fixBuggyFields();\n    }\n}\n","import CustomFieldsRenderer from \"src/decidim/decidim_awesome/forms/custom_fields_renderer\"\n\n$(() => {\n  window.DecidimAwesome.CustomFieldsRenderer = window.DecidimAwesome.CustomFieldsRenderer || new CustomFieldsRenderer();\n  window.DecidimAwesome.PrivateCustomFieldsRenderer = window.DecidimAwesome.PrivateCustomFieldsRenderer || new CustomFieldsRenderer();\n\n  // use admin multilang specs if exists\n  const $public = $(\".proposal_custom_field:first\");\n  const $private = $(\".proposal_custom_field.proposal_custom_field--private_body:first\");\n  let $form = null;\n  if ($public.length) {\n    window.DecidimAwesome.CustomFieldsRenderer.init($public);\n    $form = window.DecidimAwesome.CustomFieldsRenderer.$element.closest(\"form\");\n  }\n  if ($private.length) {\n    window.DecidimAwesome.PrivateCustomFieldsRenderer.init($private);\n    if (!$form) {\n      $form = window.DecidimAwesome.PrivateCustomFieldsRenderer.$element.closest(\"form\");\n    }\n  }\n\n  if ($form) {\n    $form.on(\"submit\", (evt) => {\n      if (evt.target.checkValidity()) {\n        // save current editors\n        if ($public.length) {\n          window.DecidimAwesome.CustomFieldsRenderer.storeData();\n        }\n        if ($private.length) {\n          window.DecidimAwesome.PrivateCustomFieldsRenderer.storeData();\n        }\n      } else {\n        evt.preventDefault();\n        evt.target.reportValidity();\n      }\n    });\n  }\n});\n"],"names":["Quill","debug","Delta","Break","Embed","Scroll","Parchment","register","HistoryOverride","linebreak","icons","SmartBreak","parent","ref","Reflect","apply","prototype","insertInto","this","ScrollOvderride","mutations","context","batch","parchmentOptimize","length","emitter","emit","Container","optimize","records","observer","takeRecords","push","pop","mark","blot","markParent","_this","domNode","parentNode","__blot","children","forEach","remaining","ind","Error","mutation","find","target","type","previousSibling","addedNodes","node","child","grandChild","prev","slice","lineBreakButtonHandler","quill","range","selection","getRange","currentLeaf","getLeaf","index","nextLeaf","previousChar","getText","insertEmbed","delta","retain","insert","updateContents","sources","USER","setSelection","SILENT","getModule","addHandler","on","getLength","deleteText","addEnterBindings","backspaceBindingsRangeAny","backspaceBindings","DecidimAwesome","window","quillFormats","fbControls","controlClass","allControlClasses","controlTextarea","textarea","controlRichtext","icon","i18n","default","fbEditors","richtext","config","value","userData","attrs","inputId","id","input","markup","name","css","rows","wrapperAttrs","wrapper","evt","instance","container","toolbar","$","data","disabled","quillToolbar","list","addImage","header","allow_images_in_full_editor","allow_images_in_small_editor","modules","handlers","$input","siblings","innerHTML","val","token","attr","imageResize","imageUpload","url","editor_uploader_path","method","withCredentials","headers","callbackOK","serverResponse","next","last","removeClass","callbackKO","serverError","msg","body","JSON","parse","message","console","error","$p","after","setTimeout","fadeOut","destroy","checkBeforeSend","file","addClass","formats","theme","disable","text","event","CustomEvent","detail","getSelection","dispatchEvent","root","querySelectorAll","match","emptyParagraph","cleanHTML","replace","RegExp","texts","drag_and_drop_image","createQuillEditor","CustomFieldsRenderer","containerSelector","lang","getLang","currentLocale","langs","substr","$dl","$dd","$div","$dt","datum","key","label","version","subtype","values","obj","Date","toLocaleDateString","html","append","outerHTML","$element","each","_key","group","inputs","$label","spec","_idx","indexOf","splice","checked","click","otherOption","otherVal","otherText","join","currentTarget","closest","radio","endsWith","$body","$form","log","dataToXML","formRender","locale","location","formData","render","disableInjectedStyle","controlConfig","editorOptions","fixBuggyFields","PrivateCustomFieldsRenderer","$public","$private","init","checkValidity","storeData","preventDefault","reportValidity"],"sourceRoot":""}