import*as e from"django-prose-editor/editor";function t(e,t,r,n,o,i,l){try{var u=e[i](l),a=u.value}catch(e){r(e);return}u.done?t(a):Promise.resolve(a).then(n,o)}function r(e){return function(){var r=this,n=arguments;return new Promise(function(o,i){var l=e.apply(r,n);function u(e){t(l,o,i,u,a,"next",e)}function a(e){t(l,o,i,u,a,"throw",e)}u(void 0)})}}let n="data-django-prose-editor-configurable",o=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}({},e),i=new Map,l=new WeakMap;function u(t,a=null){if(l.has(t))return l.get(t);let c=(function(t,l=null){return r(function*(){var u,a;if(t.closest(".prose-editor"))return null;(null==(u=(l=l||JSON.parse(t.getAttribute(n)||"{}")).js_modules)?void 0:u.length)&&(yield(a=l.js_modules,r(function*(){if(!a||!a.length)return;let e=a.map(e=>{if(i.has(e))return i.get(e);let t=import(e).then(e=>{Object.assign(o,e)}).catch(t=>{console.error(`Error loading extension module from ${e}:`,t),i.delete(e)});return i.set(e,t),t});yield Promise.all(e)})()));let c=[];for(let[e,t]of Object.entries(l.extensions)){let r=o[e];r&&("object"==typeof t?c.push(r.configure(t)):c.push(r))}return(0,e.createTextareaEditor)(t,c)})()})(t,a).then(e=>{if(e){let r=new CustomEvent("prose-editor:ready",{detail:{editor:e,textarea:t},bubbles:!0});t.dispatchEvent(r)}return l.delete(t),e}).catch(e=>(console.error("Error initializing prose editor:",e),l.delete(t),null));return l.set(t,c),c}(0,e.initializeEditors)(u,`[${n}]`);export{u as createEditor};
//# sourceMappingURL=configurable.js.map