pillardash-ui-react 0.1.22 → 0.1.24
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.
- package/dist/index.d.ts +6 -2
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -1
package/dist/index.mjs
CHANGED
|
@@ -47,5 +47,5 @@ var S={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24"
|
|
|
47
47
|
*
|
|
48
48
|
* This source code is licensed under the MIT license found in the
|
|
49
49
|
* LICENSE file in the root directory of this source tree.
|
|
50
|
-
*/"production"===process.env.NODE_ENV?Sa.exports=function(){if(wa)return Ca;wa=1;var e=r,t=fa,n="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},o=t.useSyncExternalStore,i=e.useRef,s=e.useEffect,l=e.useMemo,a=e.useDebugValue;return Ca.useSyncExternalStoreWithSelector=function(e,t,r,c,d){var h=i(null);if(null===h.current){var u={hasValue:!1,value:null};h.current=u}else u=h.current;h=l((function(){function e(e){if(!s){if(s=!0,o=e,e=c(e),void 0!==d&&u.hasValue){var t=u.value;if(d(t,e))return i=t}return i=e}if(t=i,n(o,e))return t;var r=c(e);return void 0!==d&&d(t,r)?t:(o=e,i=r)}var o,i,s=!1,l=void 0===r?null:r;return[function(){return e(t())},null===l?void 0:function(){return e(l())}]}),[t,r,c,d]);var p=o(e,h[0],h[1]);return s((function(){u.hasValue=!0,u.value=p}),[p]),a(p),p},Ca}():Sa.exports=(Ma||(Ma=1,"production"!==process.env.NODE_ENV&&function(){"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error);var e=r,t=fa,n="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},o=t.useSyncExternalStore,i=e.useRef,s=e.useEffect,l=e.useMemo,a=e.useDebugValue;Oa.useSyncExternalStoreWithSelector=function(e,t,r,c,d){var h,u=i(null);null===u.current?(h={hasValue:!1,value:null},u.current=h):h=u.current;var p=l((function(){var e,o,i=!1,s=function(t){if(!i){i=!0,e=t;var r=c(t);if(void 0!==d&&h.hasValue){var s=h.value;if(d(s,r))return o=s,s}return o=r,r}var l=o;if(n(e,t))return l;var a=c(t);return void 0!==d&&d(l,a)?l:(e=t,o=a,a)},l=void 0===r?null:r;return[function(){return s(t())},null===l?void 0:function(){return s(l())}]}),[t,r,c,d]),f=p[0],m=p[1],g=o(e,f,m);return s((function(){h.hasValue=!0,h.value=g}),[g]),a(g),g},"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}()),Oa);var Na=Sa.exports;const Ta="undefined"!=typeof window?d:a;class Ea{constructor(e){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=e,this.lastSnapshot={editor:e,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber||(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber}),this.lastSnapshot}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(e){return this.subscribers.add(e),()=>{this.subscribers.delete(e)}}watch(e){if(this.editor=e,this.editor){const e=()=>{this.transactionNumber+=1,this.subscribers.forEach((e=>e()))},t=this.editor;return t.on("transaction",e),()=>{t.off("transaction",e)}}}}const Aa="production"!==process.env.NODE_ENV,Da="undefined"==typeof window,Ia=Da||Boolean("undefined"!=typeof window&&window.next);class Ra{constructor(e){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId="",this.options=e,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(e){this.editor=e,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach((e=>e()))}getInitialEditor(){if(void 0===this.options.current.immediatelyRender)return Da||Ia?(Aa&&console.warn("Tiptap Error: SSR has been detected, please set `immediatelyRender` explicitly to `false` to avoid hydration mismatches."),null):this.createEditor();if(this.options.current.immediatelyRender&&Da&&Aa)throw new Error("Tiptap Error: SSR has been detected, and `immediatelyRender` has been set to `true` this is an unsupported configuration that may result in errors, explicitly set `immediatelyRender` to `false` to avoid hydration mismatches.");return this.options.current.immediatelyRender?this.createEditor():null}createEditor(){const e={...this.options.current,onBeforeCreate:(...e)=>{var t,n;return null===(n=(t=this.options.current).onBeforeCreate)||void 0===n?void 0:n.call(t,...e)},onBlur:(...e)=>{var t,n;return null===(n=(t=this.options.current).onBlur)||void 0===n?void 0:n.call(t,...e)},onCreate:(...e)=>{var t,n;return null===(n=(t=this.options.current).onCreate)||void 0===n?void 0:n.call(t,...e)},onDestroy:(...e)=>{var t,n;return null===(n=(t=this.options.current).onDestroy)||void 0===n?void 0:n.call(t,...e)},onFocus:(...e)=>{var t,n;return null===(n=(t=this.options.current).onFocus)||void 0===n?void 0:n.call(t,...e)},onSelectionUpdate:(...e)=>{var t,n;return null===(n=(t=this.options.current).onSelectionUpdate)||void 0===n?void 0:n.call(t,...e)},onTransaction:(...e)=>{var t,n;return null===(n=(t=this.options.current).onTransaction)||void 0===n?void 0:n.call(t,...e)},onUpdate:(...e)=>{var t,n;return null===(n=(t=this.options.current).onUpdate)||void 0===n?void 0:n.call(t,...e)},onContentError:(...e)=>{var t,n;return null===(n=(t=this.options.current).onContentError)||void 0===n?void 0:n.call(t,...e)},onDrop:(...e)=>{var t,n;return null===(n=(t=this.options.current).onDrop)||void 0===n?void 0:n.call(t,...e)},onPaste:(...e)=>{var t,n;return null===(n=(t=this.options.current).onPaste)||void 0===n?void 0:n.call(t,...e)}};return new zl(e)}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,t){return Object.keys(e).every((n=>!!["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(n)||("extensions"===n&&e.extensions&&t.extensions?e.extensions.length===t.extensions.length&&e.extensions.every(((e,n)=>{var r;return e===(null===(r=t.extensions)||void 0===r?void 0:r[n])})):e[n]===t[n])))}onRender(e){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&0===e.length?Ra.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(e),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){if(null===this.previousDeps)return void(this.previousDeps=e);if(this.previousDeps.length===e.length&&this.previousDeps.every(((t,n)=>t===e[n])))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){const e=this.instanceId,t=this.editor;this.scheduledDestructionTimeout=setTimeout((()=>{this.isComponentMounted&&this.instanceId===e?t&&t.setOptions(this.options.current):t&&!t.isDestroyed&&(t.destroy(),this.instanceId===e&&this.setEditor(null))}),1)}}function Pa(e={},t=[]){const n=l(e);n.current=e;const[r]=s((()=>new Ra(n))),o=fa.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return c(o),a(r.onRender(t)),function(e){var t;const[n]=s((()=>new Ea(e.editor))),r=Na.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getServerSnapshot,e.selector,null!==(t=e.equalityFn)&&void 0!==t?t:ka);Ta((()=>n.watch(e.editor)),[e.editor,n]),c(r)}({editor:o,selector:({transactionNumber:t})=>!1===e.shouldRerenderOnTransaction?null:e.immediatelyRender&&0===t?0:t+1}),o}h({editor:null}).Consumer;const za=h({onDragStart:void 0});r.forwardRef(((e,t)=>{const{onDragStart:n}=u(za),o=e.as||"div";return r.createElement(o,{...e,ref:t,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...e.style}})}));const La=/^\s*>\s$/,Ba=Vl.create({name:"blockquote",addOptions:()=>({HTMLAttributes:{}}),content:"block+",group:"block",defining:!0,parseHTML:()=>[{tag:"blockquote"}],renderHTML({HTMLAttributes:e}){return["blockquote",Os(this.options.HTMLAttributes,e),0]},addCommands(){return{setBlockquote:()=>({commands:e})=>e.wrapIn(this.name),toggleBlockquote:()=>({commands:e})=>e.toggleWrap(this.name),unsetBlockquote:()=>({commands:e})=>e.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[$l({find:La,type:this.type})]}}),$a=/(^|[^`])`([^`]+)`(?!`)/,Va=/(^|[^`])`([^`]+)`(?!`)/g,Fa=_s.create({name:"code",addOptions:()=>({HTMLAttributes:{}}),excludes:"_",code:!0,exitable:!0,parseHTML:()=>[{tag:"code"}],renderHTML({HTMLAttributes:e}){return["code",Os(this.options.HTMLAttributes,e),0]},addCommands(){return{setCode:()=>({commands:e})=>e.setMark(this.name),toggleCode:()=>({commands:e})=>e.toggleMark(this.name),unsetCode:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[Ll({find:$a,type:this.type})]},addPasteRules(){return[Fl({find:Va,type:this.type})]}}),_a=/^```([a-z]+)?[\s\n]$/,ja=/^~~~([a-z]+)?[\s\n]$/,Ha=Vl.create({name:"codeBlock",addOptions:()=>({languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,HTMLAttributes:{}}),content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:e=>{var t;const{languageClassPrefix:n}=this.options,r=[...(null===(t=e.firstElementChild)||void 0===t?void 0:t.classList)||[]].filter((e=>e.startsWith(n))).map((e=>e.replace(n,"")))[0];return r||null},rendered:!1}}},parseHTML:()=>[{tag:"pre",preserveWhitespace:"full"}],renderHTML({node:e,HTMLAttributes:t}){return["pre",Os(this.options.HTMLAttributes,t),["code",{class:e.attrs.language?this.options.languageClassPrefix+e.attrs.language:null},0]]},addCommands(){return{setCodeBlock:e=>({commands:t})=>t.setNode(this.name,e),toggleCodeBlock:e=>({commands:t})=>t.toggleNode(this.name,"paragraph",e)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:e,$anchor:t}=this.editor.state.selection,n=1===t.pos;return!(!e||t.parent.type.name!==this.name)&&(!(!n&&t.parent.textContent.length)&&this.editor.commands.clearNodes())},Enter:({editor:e})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:t}=e,{selection:n}=t,{$from:r,empty:o}=n;if(!o||r.parent.type!==this.type)return!1;const i=r.parentOffset===r.parent.nodeSize-2,s=r.parent.textContent.endsWith("\n\n");return!(!i||!s)&&e.chain().command((({tr:e})=>(e.delete(r.pos-2,r.pos),!0))).exitCode().run()},ArrowDown:({editor:e})=>{if(!this.options.exitOnArrowDown)return!1;const{state:t}=e,{selection:n,doc:r}=t,{$from:o,empty:i}=n;if(!i||o.parent.type!==this.type)return!1;if(!(o.parentOffset===o.parent.nodeSize-2))return!1;const s=o.after();if(void 0===s)return!1;return r.nodeAt(s)?e.commands.command((({tr:e})=>(e.setSelection(Xt.near(r.resolve(s))),!0))):e.commands.exitCode()}}},addInputRules(){return[Bl({find:_a,type:this.type,getAttributes:e=>({language:e[1]})}),Bl({find:ja,type:this.type,getAttributes:e=>({language:e[1]})})]},addProseMirrorPlugins(){return[new gn({key:new bn("codeBlockVSCodeHandler"),props:{handlePaste:(e,t)=>{if(!t.clipboardData)return!1;if(this.editor.isActive(this.type.name))return!1;const n=t.clipboardData.getData("text/plain"),r=t.clipboardData.getData("vscode-editor-data"),o=r?JSON.parse(r):void 0,i=null==o?void 0:o.mode;if(!n||!i)return!1;const{tr:s,schema:l}=e.state,a=l.text(n.replace(/\r\n?/g,"\n"));return s.replaceSelectionWith(this.type.create({language:i},a)),s.selection.$from.parent.type!==this.type&&s.setSelection(en.near(s.doc.resolve(Math.max(0,s.selection.from-2)))),s.setMeta("paste",!0),e.dispatch(s),!0}}})]}});function Wa(e={}){return new gn({view:t=>new qa(t,e)})}class qa{constructor(e,t){var n;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=null!==(n=t.width)&&void 0!==n?n:1,this.color=!1===t.color?void 0:t.color||"black",this.class=t.class,this.handlers=["dragover","dragend","drop","dragleave"].map((t=>{let n=e=>{this[t](e)};return e.dom.addEventListener(t,n),{name:t,handler:n}}))}destroy(){this.handlers.forEach((({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t)))}update(e,t){null!=this.cursorPos&&t.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,null==e?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e,t=this.editorView.state.doc.resolve(this.cursorPos),n=!t.parent.inlineContent,r=this.editorView.dom,o=r.getBoundingClientRect(),i=o.width/r.offsetWidth,s=o.height/r.offsetHeight;if(n){let n=t.nodeBefore,r=t.nodeAfter;if(n||r){let t=this.editorView.nodeDOM(this.cursorPos-(n?n.nodeSize:0));if(t){let o=t.getBoundingClientRect(),i=n?o.bottom:o.top;n&&r&&(i=(i+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let l=this.width/2*s;e={left:o.left,right:o.right,top:i-l,bottom:i+l}}}}if(!e){let t=this.editorView.coordsAtPos(this.cursorPos),n=this.width/2*i;e={left:t.left-n,right:t.left+n,top:t.top,bottom:t.bottom}}let l,a,c=this.editorView.dom.offsetParent;if(this.element||(this.element=c.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n),!c||c==document.body&&"static"==getComputedStyle(c).position)l=-pageXOffset,a=-pageYOffset;else{let e=c.getBoundingClientRect(),t=e.width/c.offsetWidth,n=e.height/c.offsetHeight;l=e.left-c.scrollLeft*t,a=e.top-c.scrollTop*n}this.element.style.left=(e.left-l)/i+"px",this.element.style.top=(e.top-a)/s+"px",this.element.style.width=(e.right-e.left)/i+"px",this.element.style.height=(e.bottom-e.top)/s+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout((()=>this.setCursor(null)),e)}dragover(e){if(!this.editorView.editable)return;let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),n=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),r=n&&n.type.spec.disableDropCursor,o="function"==typeof r?r(this.editorView,t,e):r;if(t&&!o){let e=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let t=Pt(this.editorView.state.doc,e,this.editorView.dragging.slice);null!=t&&(e=t)}this.setCursor(e),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}const Ja=Ks.create({name:"dropCursor",addOptions:()=>({color:"currentColor",width:1,class:void 0}),addProseMirrorPlugins(){return[Wa(this.options)]}});class Ka extends Xt{constructor(e){super(e,e)}map(e,t){let n=e.resolve(t.map(this.head));return Ka.valid(n)?new Ka(n):Xt.near(n)}content(){return se.empty}eq(e){return e instanceof Ka&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,t){if("number"!=typeof t.pos)throw new RangeError("Invalid input for GapCursor.fromJSON");return new Ka(e.resolve(t.pos))}getBookmark(){return new Ua(this.anchor)}static valid(e){let t=e.parent;if(t.isTextblock||!function(e){for(let t=e.depth;t>=0;t--){let n=e.index(t),r=e.node(t);if(0!=n)for(let e=r.child(n-1);;e=e.lastChild){if(0==e.childCount&&!e.inlineContent||e.isAtom||e.type.spec.isolating)return!0;if(e.inlineContent)return!1}else if(r.type.spec.isolating)return!0}return!0}(e)||!function(e){for(let t=e.depth;t>=0;t--){let n=e.indexAfter(t),r=e.node(t);if(n!=r.childCount)for(let e=r.child(n);;e=e.firstChild){if(0==e.childCount&&!e.inlineContent||e.isAtom||e.type.spec.isolating)return!0;if(e.inlineContent)return!1}else if(r.type.spec.isolating)return!0}return!0}(e))return!1;let n=t.type.spec.allowGapCursor;if(null!=n)return n;let r=t.contentMatchAt(e.index()).defaultType;return r&&r.isTextblock}static findGapCursorFrom(e,t,n=!1){e:for(;;){if(!n&&Ka.valid(e))return e;let r=e.pos,o=null;for(let n=e.depth;;n--){let i=e.node(n);if(t>0?e.indexAfter(n)<i.childCount:e.index(n)>0){o=i.child(t>0?e.indexAfter(n):e.index(n)-1);break}if(0==n)return null;r+=t;let s=e.doc.resolve(r);if(Ka.valid(s))return s}for(;;){let i=t>0?o.firstChild:o.lastChild;if(!i){if(o.isAtom&&!o.isText&&!nn.isSelectable(o)){e=e.doc.resolve(r+o.nodeSize*t),n=!1;continue e}break}o=i,r+=t;let s=e.doc.resolve(r);if(Ka.valid(s))return s}return null}}}Ka.prototype.visible=!1,Ka.findFrom=Ka.findGapCursorFrom,Xt.jsonID("gapcursor",Ka);class Ua{constructor(e){this.pos=e}map(e){return new Ua(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return Ka.valid(t)?new Ka(t):Xt.near(t)}}const Ga=Ki({ArrowLeft:Xa("horiz",-1),ArrowRight:Xa("horiz",1),ArrowUp:Xa("vert",-1),ArrowDown:Xa("vert",1)});function Xa(e,t){const n="vert"==e?t>0?"down":"up":t>0?"right":"left";return function(e,r,o){let i=e.selection,s=t>0?i.$to:i.$from,l=i.empty;if(i instanceof en){if(!o.endOfTextblock(n)||0==s.depth)return!1;l=!1,s=e.doc.resolve(t>0?s.after():s.before())}let a=Ka.findGapCursorFrom(s,t,l);return!!a&&(r&&r(e.tr.setSelection(new Ka(a))),!0)}}function Ya(e,t,n){if(!e||!e.editable)return!1;let r=e.state.doc.resolve(t);if(!Ka.valid(r))return!1;let o=e.posAtCoords({left:n.clientX,top:n.clientY});return!(o&&o.inside>-1&&nn.isSelectable(e.state.doc.nodeAt(o.inside)))&&(e.dispatch(e.state.tr.setSelection(new Ka(r))),!0)}function Za(e,t){if("insertCompositionText"!=t.inputType||!(e.state.selection instanceof Ka))return!1;let{$from:n}=e.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(e.state.schema.nodes.text);if(!r)return!1;let o=ee.empty;for(let e=r.length-1;e>=0;e--)o=ee.from(r[e].createAndFill(null,o));let i=e.state.tr.replace(n.pos,n.pos,new se(o,0,0));return i.setSelection(en.near(i.doc.resolve(n.pos+1))),e.dispatch(i),!1}function Qa(e){if(!(e.selection instanceof Ka))return null;let t=document.createElement("div");return t.className="ProseMirror-gapcursor",si.create(e.doc,[ri.widget(e.selection.head,t,{key:"gapcursor"})])}const ec=Ks.create({name:"gapCursor",addProseMirrorPlugins:()=>[new gn({props:{decorations:Qa,createSelectionBetween:(e,t,n)=>t.pos==n.pos&&Ka.valid(n)?new Ka(n):null,handleClick:Ya,handleKeyDown:Ga,handleDOMEvents:{beforeinput:Za}}})],extendNodeSchema(e){var t;return{allowGapCursor:null!==(t=Es(ks(e,"allowGapCursor",{name:e.name,options:e.options,storage:e.storage})))&&void 0!==t?t:null}}}),tc=Vl.create({name:"hardBreak",addOptions:()=>({keepMarks:!0,HTMLAttributes:{}}),inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML:()=>[{tag:"br"}],renderHTML({HTMLAttributes:e}){return["br",Os(this.options.HTMLAttributes,e)]},renderText:()=>"\n",addCommands(){return{setHardBreak:()=>({commands:e,chain:t,state:n,editor:r})=>e.first([()=>e.exitCode(),()=>e.command((()=>{const{selection:e,storedMarks:o}=n;if(e.$from.parent.type.spec.isolating)return!1;const{keepMarks:i}=this.options,{splittableMarks:s}=r.extensionManager,l=o||e.$to.parentOffset&&e.$from.marks();return t().insertContent({type:this.name}).command((({tr:e,dispatch:t})=>{if(t&&l&&i){const t=l.filter((e=>s.includes(e.type.name)));e.ensureMarks(t)}return!0})).run()}))])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),nc=Vl.create({name:"heading",addOptions:()=>({levels:[1,2,3,4,5,6],HTMLAttributes:{}}),content:"inline*",group:"block",defining:!0,addAttributes:()=>({level:{default:1,rendered:!1}}),parseHTML(){return this.options.levels.map((e=>({tag:`h${e}`,attrs:{level:e}})))},renderHTML({node:e,HTMLAttributes:t}){return[`h${this.options.levels.includes(e.attrs.level)?e.attrs.level:this.options.levels[0]}`,Os(this.options.HTMLAttributes,t),0]},addCommands(){return{setHeading:e=>({commands:t})=>!!this.options.levels.includes(e.level)&&t.setNode(this.name,e),toggleHeading:e=>({commands:t})=>!!this.options.levels.includes(e.level)&&t.toggleNode(this.name,"paragraph",e)}},addKeyboardShortcuts(){return this.options.levels.reduce(((e,t)=>({...e,[`Mod-Alt-${t}`]:()=>this.editor.commands.toggleHeading({level:t})})),{})},addInputRules(){return this.options.levels.map((e=>Bl({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${e}})\\s$`),type:this.type,getAttributes:{level:e}})))}});var rc=200,oc=function(){};oc.prototype.append=function(e){return e.length?(e=oc.from(e),!this.length&&e||e.length<rc&&this.leafAppend(e)||this.length<rc&&e.leafPrepend(this)||this.appendInner(e)):this},oc.prototype.prepend=function(e){return e.length?oc.from(e).append(this):this},oc.prototype.appendInner=function(e){return new sc(this,e)},oc.prototype.slice=function(e,t){return void 0===e&&(e=0),void 0===t&&(t=this.length),e>=t?oc.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},oc.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},oc.prototype.forEach=function(e,t,n){void 0===t&&(t=0),void 0===n&&(n=this.length),t<=n?this.forEachInner(e,t,n,0):this.forEachInvertedInner(e,t,n,0)},oc.prototype.map=function(e,t,n){void 0===t&&(t=0),void 0===n&&(n=this.length);var r=[];return this.forEach((function(t,n){return r.push(e(t,n))}),t,n),r},oc.from=function(e){return e instanceof oc?e:e&&e.length?new ic(e):oc.empty};var ic=function(e){function t(t){e.call(this),this.values=t}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(e,n){return 0==e&&n==this.length?this:new t(this.values.slice(e,n))},t.prototype.getInner=function(e){return this.values[e]},t.prototype.forEachInner=function(e,t,n,r){for(var o=t;o<n;o++)if(!1===e(this.values[o],r+o))return!1},t.prototype.forEachInvertedInner=function(e,t,n,r){for(var o=t-1;o>=n;o--)if(!1===e(this.values[o],r+o))return!1},t.prototype.leafAppend=function(e){if(this.length+e.length<=rc)return new t(this.values.concat(e.flatten()))},t.prototype.leafPrepend=function(e){if(this.length+e.length<=rc)return new t(e.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(t.prototype,n),t}(oc);oc.empty=new ic([]);var sc=function(e){function t(t,n){e.call(this),this.left=t,this.right=n,this.length=t.length+n.length,this.depth=Math.max(t.depth,n.depth)+1}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.prototype.getInner=function(e){return e<this.left.length?this.left.get(e):this.right.get(e-this.left.length)},t.prototype.forEachInner=function(e,t,n,r){var o=this.left.length;return!(t<o&&!1===this.left.forEachInner(e,t,Math.min(n,o),r))&&(!(n>o&&!1===this.right.forEachInner(e,Math.max(t-o,0),Math.min(this.length,n)-o,r+o))&&void 0)},t.prototype.forEachInvertedInner=function(e,t,n,r){var o=this.left.length;return!(t>o&&!1===this.right.forEachInvertedInner(e,t-o,Math.max(n,o)-o,r+o))&&(!(n<o&&!1===this.left.forEachInvertedInner(e,Math.min(t,o),n,r))&&void 0)},t.prototype.sliceInner=function(e,t){if(0==e&&t==this.length)return this;var n=this.left.length;return t<=n?this.left.slice(e,t):e>=n?this.right.slice(e-n,t-n):this.left.slice(e,n).append(this.right.slice(0,t-n))},t.prototype.leafAppend=function(e){var n=this.right.leafAppend(e);if(n)return new t(this.left,n)},t.prototype.leafPrepend=function(e){var n=this.left.leafPrepend(e);if(n)return new t(n,this.right)},t.prototype.appendInner=function(e){return this.left.depth>=Math.max(this.right.depth,e.depth)+1?new t(this.left,new t(this.right,e)):new t(this,e)},t}(oc);class lc{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(0==this.eventCount)return null;let n,r,o=this.items.length;for(;;o--){if(this.items.get(o-1).selection){--o;break}}t&&(n=this.remapping(o,this.items.length),r=n.maps.length);let i,s,l=e.tr,a=[],c=[];return this.items.forEach(((e,t)=>{if(!e.step)return n||(n=this.remapping(o,t+1),r=n.maps.length),r--,void c.push(e);if(n){c.push(new ac(e.map));let t,o=e.step.map(n.slice(r));o&&l.maybeStep(o).doc&&(t=l.mapping.maps[l.mapping.maps.length-1],a.push(new ac(t,void 0,void 0,a.length+c.length))),r--,t&&n.appendMap(t,r)}else l.maybeStep(e.step);return e.selection?(i=n?e.selection.map(n.slice(r)):e.selection,s=new lc(this.items.slice(0,o).append(c.reverse().concat(a)),this.eventCount-1),!1):void 0}),this.items.length,0),{remaining:s,transform:l,selection:i}}addTransform(e,t,n,r){let o=[],i=this.eventCount,s=this.items,l=!r&&s.length?s.get(s.length-1):null;for(let n=0;n<e.steps.length;n++){let a,c=e.steps[n].invert(e.docs[n]),d=new ac(e.mapping.maps[n],c,t);(a=l&&l.merge(d))&&(d=a,n?o.pop():s=s.slice(0,s.length-1)),o.push(d),t&&(i++,t=void 0),r||(l=d)}let a=i-n.depth;return a>dc&&(s=function(e,t){let n;return e.forEach(((e,r)=>{if(e.selection&&0==t--)return n=r,!1})),e.slice(n)}(s,a),i-=a),new lc(s.append(o),i)}remapping(e,t){let n=new ht;return this.items.forEach(((t,r)=>{let o=null!=t.mirrorOffset&&r-t.mirrorOffset>=e?n.maps.length-t.mirrorOffset:void 0;n.appendMap(t.map,o)}),e,t),n}addMaps(e){return 0==this.eventCount?this:new lc(this.items.append(e.map((e=>new ac(e)))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let n=[],r=Math.max(0,this.items.length-t),o=e.mapping,i=e.steps.length,s=this.eventCount;this.items.forEach((e=>{e.selection&&s--}),r);let l=t;this.items.forEach((t=>{let r=o.getMirror(--l);if(null==r)return;i=Math.min(i,r);let a=o.maps[r];if(t.step){let i=e.steps[r].invert(e.docs[r]),c=t.selection&&t.selection.map(o.slice(l+1,r));c&&s++,n.push(new ac(a,i,c))}else n.push(new ac(a))}),r);let a=[];for(let e=t;e<i;e++)a.push(new ac(o.maps[e]));let c=this.items.slice(0,r).append(a).append(n),d=new lc(c,s);return d.emptyItemCount()>500&&(d=d.compress(this.items.length-n.length)),d}emptyItemCount(){let e=0;return this.items.forEach((t=>{t.step||e++})),e}compress(e=this.items.length){let t=this.remapping(0,e),n=t.maps.length,r=[],o=0;return this.items.forEach(((i,s)=>{if(s>=e)r.push(i),i.selection&&o++;else if(i.step){let e=i.step.map(t.slice(n)),s=e&&e.getMap();if(n--,s&&t.appendMap(s,n),e){let l=i.selection&&i.selection.map(t.slice(n));l&&o++;let a,c=new ac(s.invert(),e,l),d=r.length-1;(a=r.length&&r[d].merge(c))?r[d]=a:r.push(c)}}else i.map&&n--}),this.items.length,0),new lc(oc.from(r.reverse()),o)}}lc.empty=new lc(oc.empty,0);class ac{constructor(e,t,n,r){this.map=e,this.step=t,this.selection=n,this.mirrorOffset=r}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new ac(t.getMap().invert(),t,this.selection)}}}class cc{constructor(e,t,n,r,o){this.done=e,this.undone=t,this.prevRanges=n,this.prevTime=r,this.prevComposition=o}}const dc=20;function hc(e){let t=[];for(let n=e.length-1;n>=0&&0==t.length;n--)e[n].forEach(((e,n,r,o)=>t.push(r,o)));return t}function uc(e,t){if(!e)return null;let n=[];for(let r=0;r<e.length;r+=2){let o=t.map(e[r],1),i=t.map(e[r+1],-1);o<=i&&n.push(o,i)}return n}let pc=!1,fc=null;function mc(e){let t=e.plugins;if(fc!=t){pc=!1,fc=t;for(let e=0;e<t.length;e++)if(t[e].spec.historyPreserveItems){pc=!0;break}}return pc}const gc=new bn("history"),yc=new bn("closeHistory");function vc(e={}){return e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},new gn({key:gc,state:{init:()=>new cc(lc.empty,lc.empty,null,0,-1),apply:(t,n,r)=>function(e,t,n,r){let o,i=n.getMeta(gc);if(i)return i.historyState;n.getMeta(yc)&&(e=new cc(e.done,e.undone,null,0,-1));let s=n.getMeta("appendedTransaction");if(0==n.steps.length)return e;if(s&&s.getMeta(gc))return s.getMeta(gc).redo?new cc(e.done.addTransform(n,void 0,r,mc(t)),e.undone,hc(n.mapping.maps),e.prevTime,e.prevComposition):new cc(e.done,e.undone.addTransform(n,void 0,r,mc(t)),null,e.prevTime,e.prevComposition);if(!1===n.getMeta("addToHistory")||s&&!1===s.getMeta("addToHistory"))return(o=n.getMeta("rebased"))?new cc(e.done.rebased(n,o),e.undone.rebased(n,o),uc(e.prevRanges,n.mapping),e.prevTime,e.prevComposition):new cc(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),uc(e.prevRanges,n.mapping),e.prevTime,e.prevComposition);{let o=n.getMeta("composition"),i=0==e.prevTime||!s&&e.prevComposition!=o&&(e.prevTime<(n.time||0)-r.newGroupDelay||!function(e,t){if(!t)return!1;if(!e.docChanged)return!0;let n=!1;return e.mapping.maps[0].forEach(((e,r)=>{for(let o=0;o<t.length;o+=2)e<=t[o+1]&&r>=t[o]&&(n=!0)})),n}(n,e.prevRanges)),l=s?uc(e.prevRanges,n.mapping):hc(n.mapping.maps);return new cc(e.done.addTransform(n,i?t.selection.getBookmark():void 0,r,mc(t)),lc.empty,l,n.time,null==o?e.prevComposition:o)}}(n,r,t,e)},config:e,props:{handleDOMEvents:{beforeinput(e,t){let n=t.inputType,r="historyUndo"==n?wc:"historyRedo"==n?xc:null;return!!r&&(t.preventDefault(),r(e.state,e.dispatch))}}}})}function bc(e,t){return(n,r)=>{let o=gc.getState(n);if(!o||0==(e?o.undone:o.done).eventCount)return!1;if(r){let i=function(e,t,n){let r=mc(t),o=gc.get(t).spec.config,i=(n?e.undone:e.done).popEvent(t,r);if(!i)return null;let s=i.selection.resolve(i.transform.doc),l=(n?e.done:e.undone).addTransform(i.transform,t.selection.getBookmark(),o,r),a=new cc(n?l:i.remaining,n?i.remaining:l,null,0,-1);return i.transform.setSelection(s).setMeta(gc,{redo:n,historyState:a})}(o,n,e);i&&r(t?i.scrollIntoView():i)}return!0}}const wc=bc(!1,!0),xc=bc(!0,!0),kc=Ks.create({name:"history",addOptions:()=>({depth:100,newGroupDelay:500}),addCommands:()=>({undo:()=>({state:e,dispatch:t})=>wc(e,t),redo:()=>({state:e,dispatch:t})=>xc(e,t)}),addProseMirrorPlugins(){return[vc(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),Sc=Vl.create({name:"horizontalRule",addOptions:()=>({HTMLAttributes:{}}),group:"block",parseHTML:()=>[{tag:"hr"}],renderHTML({HTMLAttributes:e}){return["hr",Os(this.options.HTMLAttributes,e)]},addCommands(){return{setHorizontalRule:()=>({chain:e,state:t})=>{const{selection:n}=t,{$from:r,$to:o}=n,i=e();return 0===r.parentOffset?i.insertContentAt({from:Math.max(r.pos-1,0),to:o.pos},{type:this.name}):n instanceof nn?i.insertContentAt(o.pos,{type:this.name}):i.insertContent({type:this.name}),i.command((({tr:e,dispatch:t})=>{var n;if(t){const{$to:t}=e.selection,r=t.end();if(t.nodeAfter)t.nodeAfter.isTextblock?e.setSelection(en.create(e.doc,t.pos+1)):t.nodeAfter.isBlock?e.setSelection(nn.create(e.doc,t.pos)):e.setSelection(en.create(e.doc,t.pos));else{const o=null===(n=t.parent.type.contentMatch.defaultType)||void 0===n?void 0:n.create();o&&(e.insert(r,o),e.setSelection(en.create(e.doc,r+1)))}e.scrollIntoView()}return!0})).run()}}},addInputRules(){return[(e={find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type},new Ls({find:e.find,handler:({state:t,range:n,match:r})=>{const o=Es(e.getAttributes,void 0,r)||{},{tr:i}=t,s=n.from;let l=n.to;const a=e.type.create(o);if(r[1]){let e=s+r[0].lastIndexOf(r[1]);e>l?e=l:l=e+r[1].length;const t=r[0][r[0].length-1];i.insertText(t,s+r[0].length-1),i.replaceWith(e,l,a)}else if(r[0]){const t=e.type.isInline?s:s-1;i.insert(t,e.type.create(o)).delete(i.mapping.map(s),i.mapping.map(l))}i.scrollIntoView()}}))];var e}}),Cc=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,Mc=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,Oc=_s.create({name:"strike",addOptions:()=>({HTMLAttributes:{}}),parseHTML:()=>[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:e=>!!e.includes("line-through")&&{}}],renderHTML({HTMLAttributes:e}){return["s",Os(this.options.HTMLAttributes,e),0]},addCommands(){return{setStrike:()=>({commands:e})=>e.setMark(this.name),toggleStrike:()=>({commands:e})=>e.toggleMark(this.name),unsetStrike:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[Ll({find:Cc,type:this.type})]},addPasteRules(){return[Fl({find:Mc,type:this.type})]}}),Nc=Ks.create({name:"starterKit",addExtensions(){const e=[];return!1!==this.options.bold&&e.push(ql.configure(this.options.bold)),!1!==this.options.blockquote&&e.push(Ba.configure(this.options.blockquote)),!1!==this.options.bulletList&&e.push(Ul.configure(this.options.bulletList)),!1!==this.options.code&&e.push(Fa.configure(this.options.code)),!1!==this.options.codeBlock&&e.push(Ha.configure(this.options.codeBlock)),!1!==this.options.document&&e.push(Gl.configure(this.options.document)),!1!==this.options.dropcursor&&e.push(Ja.configure(this.options.dropcursor)),!1!==this.options.gapcursor&&e.push(ec.configure(this.options.gapcursor)),!1!==this.options.hardBreak&&e.push(tc.configure(this.options.hardBreak)),!1!==this.options.heading&&e.push(nc.configure(this.options.heading)),!1!==this.options.history&&e.push(kc.configure(this.options.history)),!1!==this.options.horizontalRule&&e.push(Sc.configure(this.options.horizontalRule)),!1!==this.options.italic&&e.push(ea.configure(this.options.italic)),!1!==this.options.listItem&&e.push(ta.configure(this.options.listItem)),!1!==this.options.orderedList&&e.push(oa.configure(this.options.orderedList)),!1!==this.options.paragraph&&e.push(ia.configure(this.options.paragraph)),!1!==this.options.strike&&e.push(Oc.configure(this.options.strike)),!1!==this.options.text&&e.push(sa.configure(this.options.text)),e}});function Tc(t){var n=t.size,r=void 0===n?18:n;return e("svg",{width:r,height:r,viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e("path",{d:"M6.75 3.75H15.75M2.25 3.75H3.75M6.75 9H15.75M2.25 9H3.75M6.75 14.25H15.75M2.25 14.25H3.75",stroke:"#27272A",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function Ec(t){var n=t.size,r=void 0===n?18:n;return e("svg",{width:r,height:r,viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e("path",{d:"M8.25 4.5H15.75M8.25 9H15.75M8.25 13.5H15.75M2.25 11.25H3.375C3.58425 11.25 3.6885 11.25 3.7755 11.2672C3.95012 11.302 4.11053 11.3877 4.23642 11.5136C4.36231 11.6395 4.44804 11.7999 4.48275 11.9745C4.5 12.0615 4.5 12.165 4.5 12.375C4.5 12.585 4.5 12.6885 4.48275 12.7755C4.44804 12.9501 4.36231 13.1105 4.23642 13.2364C4.11053 13.3623 3.95012 13.448 3.7755 13.4827C3.6885 13.5 3.585 13.5 3.375 13.5C3.165 13.5 3.0615 13.5 2.9745 13.5173C2.79988 13.552 2.63947 13.6377 2.51358 13.7636C2.38769 13.8895 2.30196 14.0499 2.26725 14.2245C2.25 14.3115 2.25 14.415 2.25 14.625V15.3C2.25 15.5122 2.25 15.618 2.316 15.684C2.382 15.75 2.4885 15.75 2.7 15.75H4.5M2.25 2.25H3.15C3.20967 2.25 3.2669 2.27371 3.3091 2.3159C3.35129 2.3581 3.375 2.41533 3.375 2.475V6.75M3.375 6.75H2.25M3.375 6.75H4.5",stroke:"#27272A",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}var Ac=function(n){var r=n.initialContent,o=void 0===r?"":r,i=n.onUpdate,s=Pa({extensions:[Nc,Gl,ia,sa,ql,ea,la,Ul,oa,ta],content:o,onUpdate:function(e){var t=e.editor;i(t.getHTML())}});return t("div",{className:"rounded-lg border",children:[t("div",{className:"flex gap-4 border-b bg-gray-50 p-2",children:[e("button",{onClick:function(){return null==s?void 0:s.chain().focus().toggleBold().run()},className:"mx-1 p-1 ".concat((null==s?void 0:s.isActive("bold"))?"rounded bg-gray-200":""),type:"button",children:e(O,{size:18})}),e("button",{onClick:function(){return null==s?void 0:s.chain().focus().toggleItalic().run()},className:"mx-1 p-1 ".concat((null==s?void 0:s.isActive("italic"))?"rounded bg-gray-200":""),type:"button",children:e(L,{size:18})}),e("button",{onClick:function(){return null==s?void 0:s.chain().focus().toggleUnderline().run()},className:"mx-1 p-1 ".concat((null==s?void 0:s.isActive("underline"))?"rounded bg-gray-200":""),type:"button",children:e($,{size:18})}),e("span",{className:"mx-2 h-6 border-r"}),e("button",{onClick:function(){return null==s?void 0:s.chain().focus().toggleBulletList().run()},className:"mx-1 p-1 ".concat((null==s?void 0:s.isActive("bulletList"))?"rounded bg-gray-200":""),type:"button",children:e(Tc,{})}),e("button",{onClick:function(){return null==s?void 0:s.chain().focus().toggleOrderedList().run()},className:"mx-1 p-1 ".concat((null==s?void 0:s.isActive("orderedList"))?"rounded bg-gray-200":""),type:"button",children:e(Ec,{})})]}),e(ba,{editor:s,className:"min-h-32 p-4"})]})};function Dc(n){var r=n.options,o=n.placeholder,i=void 0===o?"Select an option":o,l=n.onChange,a=n.value,c=n.size,d=void 0===c?"md":c,h=n.className,u=void 0===h?"":h,p=n.name,f=n.id,m=n.disabled,g=void 0!==m&&m,y=n.label,v=n.required,b=s(!1),w=b[0],x=b[1],k=s(a&&r.find((function(e){return e.value===a}))||null),S=k[0],C=k[1];return t("div",{className:"relative inline-block",children:[y&&t("label",{htmlFor:f,className:"mb-1 block text-sm font-medium text-gray-700",children:[y,v&&e("span",{className:"ml-1 text-red-500",children:"*"})]}),t("button",{type:"button",className:"flex w-full items-center justify-between rounded-md border border-gray-200 bg-white shadow-sm ".concat({sm:"px-3 py-2 text-sm",md:"px-4 py-2.5 text-base"}[d]," text-gray-700 hover:bg-gray-50 focus:outline-none ").concat(g?"cursor-not-allowed opacity-50":""," ").concat(u),onClick:function(){return!g&&x(!w)},disabled:g,id:f,children:[e("span",{className:"truncate",children:S?(null==S?void 0:S.label)||S.value:i}),e(T,{className:"ml-2 h-4 w-4 ".concat(w?"rotate-180 transform":"")})]}),w&&e("div",{className:"absolute z-10 mt-1 max-h-60 w-full min-w-[200px] p-1 font-medium text-sm overflow-auto rounded-lg bg-white shadow-xl",children:r.map((function(n){return t("div",{className:"cursor-pointer px-3 py-2 hover:bg-gray-100 rounded-lg flex justify-between item-center ".concat((null==S?void 0:S.value)===n.value?"bg-gray-50 text-black":"text-gray-900"),onClick:function(){return function(e){C(e),l(e.value),x(!1)}(n)},children:[e("div",{children:n.label||n.value}),(null==S?void 0:S.value)===n.value&&e("div",{children:e(N,{size:15,className:"text-primary"})})]},n.value)}))}),p&&e("input",{type:"hidden",name:p,value:(null==S?void 0:S.value)||""})]})}var Ic=function(n){var r=n.message,o=n.description,i=n.type,l=void 0===i?"info":i,c=n.duration,d=void 0===c?5e3:c,h=n.onClose,u=s(!0),p=u[0],f=u[1],m=s(100),g=m[0],y=m[1],v={success:{icon:e(A,{className:"h-5 w-5"}),bgColor:"bg-primary-50",borderColor:"border-primary-300",textColor:"text-primary-800",iconColor:"text-primary-500",progressColor:"bg-primary-500"},error:{icon:e(E,{className:"h-5 w-5"}),bgColor:"bg-rose-50",borderColor:"border-rose-300",textColor:"text-rose-800",iconColor:"text-rose-500",progressColor:"bg-rose-500"},info:{icon:e(z,{className:"h-5 w-5"}),bgColor:"bg-sky-50",borderColor:"border-sky-300 ",textColor:"text-sky-800 ",iconColor:"text-sky-500",progressColor:"bg-sky-500"},warning:{icon:e(B,{className:"h-5 w-5"}),bgColor:"bg-amber-50 ",borderColor:"border-amber-300 ",textColor:"text-amber-800",iconColor:"text-amber-500",progressColor:"bg-amber-500"}};a((function(){var e=setTimeout((function(){f(!1),setTimeout((function(){null==h||h()}),300)}),d),t=setInterval((function(){y((function(e){var t=e-100/(d/100);return t<=0?0:t}))}),100);return function(){clearTimeout(e),clearInterval(t)}}),[d,h]);var b=v[l],w=b.icon,x=b.bgColor,k=b.borderColor,S=b.textColor,C=b.iconColor,M=b.progressColor;return e("div",{className:"fixed right-4 top-4 z-50 transform transition-all duration-300 ".concat(p?"translate-x-0 opacity-100":"translate-x-full opacity-0"),children:t("div",{className:"flex w-72 rounded-lg border shadow-lg md:w-96 ".concat(k," ").concat(x," p-4"),children:[e("div",{className:"flex-shrink-0 ".concat(C),children:w}),t("div",{className:"ml-3 w-full",children:[t("div",{className:"flex items-start justify-between",children:[e("p",{className:"text-md font-semibold ".concat(S),children:r}),e("button",{onClick:function(){f(!1),setTimeout((function(){null==h||h()}),300)},className:"text-gray-600 hover:text-gray-600 focus:outline-none",children:e(V,{className:"h-4 w-4"})})]}),o&&e("p",{className:"mt-1 text-sm ".concat(S," opacity-80"),children:o}),e("div",{className:"mt-2 h-1 w-full rounded-full bg-gray-200",children:e("div",{className:"".concat(M," h-1 rounded-full transition-all duration-100 ease-linear"),style:{width:"".concat(g,"%")}})})]})]})})},Rc=h(void 0),Pc=function(n){var r=n.children,o=s([]),i=o[0],l=o[1],a=p((function(e){l((function(t){return t.filter((function(t){return t.id!==e}))}))}),[]),c=p((function(e){var t=Math.random().toString(36).substring(2,9),n=J(J({},e),{id:t,onClose:function(){return a(t)}});l((function(e){return K(K([],e,!0),[n],!1)}))}),[a]),d=p((function(e){return function(t,n){c({message:t,description:n,type:e})}}),[c]),h={showAlert:c,success:d("success"),error:d("error"),info:d("info"),warning:d("warning")};return t(Rc.Provider,{value:h,children:[r,e("div",{className:"toast-container",children:i.map((function(t){return e(Ic,J({},t),t.id)}))})]})},zc=function(){var e=u(Rc);if(void 0===e)throw new Error("useAlert must be used within a AlertProvider");return e},Lc=function(n){var r=n.isOpen,o=n.onClose,i=n.title,s=n.children,c=n.size,d=void 0===c?"md":c,h=n.position,u=void 0===h?"right":h,p=n.showCloseButton,f=void 0===p||p,m=n.closeOnOverlayClick,g=void 0===m||m,y=n.closeOnEscape,v=void 0===y||y,b=n.className,w=void 0===b?"":b,x=n.overlayClassName,k=void 0===x?"":x,S=n.contentClassName,C=void 0===S?"":S,M=n.headerClassName,O=void 0===M?"":M,N=n.footer,T=n.footerClassName,E=void 0===T?"":T,A=n.maxHeight,D=void 0!==A&&A,I=l(null),R=l(null);a((function(){var e;return r?(R.current=document.activeElement,null===(e=I.current)||void 0===e||e.focus(),document.body.style.overflow="hidden"):(document.body.style.overflow="unset",R.current&&R.current.focus()),function(){document.body.style.overflow="unset"}}),[r]),a((function(){var e=function(e){"Escape"===e.key&&v&&o()};return r&&document.addEventListener("keydown",e),function(){document.removeEventListener("keydown",e)}}),[r,v,o]);var P=function(e){e.target===e.currentTarget&&g&&o()};return r?t("div",{className:"fixed inset-0 z-50 ".concat(k),role:"dialog","aria-modal":"true","aria-labelledby":i?"modal-title":void 0,children:[e("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm transition-opacity duration-700",onClick:P}),e("div",{className:"fixed inset-0 flex p-4 ".concat({left:"items-start justify-start",right:"items-start justify-end",center:"items-center justify-center"}[u]),onClick:P,children:t("div",{ref:I,tabIndex:-1,className:"\n relative w-full ".concat({xs:"max-w-xs",sm:"max-w-sm",md:"max-w-md",lg:"max-w-lg",xl:"max-w-xl","2xl":"max-w-2xl",full:"max-w-full mx-4"}[d]," bg-white shadow-2xl transform transition-all duration-700 ease-out flex flex-col\n ").concat("left"===u||"right"===u?"h-full ".concat(D?"max-h-screen":""," rounded-none ").concat("left"===u?"rounded-r-2xl":"rounded-l-2xl"):"rounded-2xl ".concat(D?"max-h-[90vh] overflow-hidden":""),"\n ").concat("center"===u?"animate-in fade-in-0 zoom-in-95":"left"===u?"animate-in slide-in-from-left-full":"animate-in slide-in-from-right-full","\n ").concat(w,"\n "),onClick:function(e){return e.stopPropagation()},children:[(i||f)&&t("div",{className:"flex items-center justify-between p-6 border-b border-gray-200 flex-shrink-0 ".concat(O),children:[i&&e("h2",{id:"modal-title",className:"text-xl font-semibold text-gray-900 truncate pr-4",children:i}),f&&e("button",{onClick:o,className:"flex items-center justify-center w-8 h-8 rounded-full text-gray-400 hover:text-gray-600 hover:bg-gray-100 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2","aria-label":"Close modal",children:e(V,{size:20})})]}),e("div",{className:"flex-1 min-h-0 ".concat(D?"overflow-y-auto":""," ").concat(C),children:e("div",!D||"left"!==u&&"right"!==u?{className:"p-6",children:s}:{className:"p-6 min-h-0 flex-1",children:s})}),N&&e("div",{className:"px-6 py-4 border-t border-gray-200 bg-gray-50 flex-shrink-0 rounded-2xl ".concat(E),children:N})]})})]}):null},Bc=function(){var n=r.useState(!1),o=n[0],i=n[1],s=r.useState("left"),l=s[0],a=s[1],c=r.useState("md"),d=c[0],h=c[1],u=t("div",{className:"flex justify-end space-x-3",children:[e("button",{onClick:function(){return i(!1)},className:"px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-lg hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 transition-colors duration-200",children:"Cancel"}),e("button",{onClick:function(){return i(!1)},className:"px-4 py-2 text-sm font-medium text-white bg-blue-600 rounded-lg hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 transition-colors duration-200",children:"Save Changes"})]});return t("div",{className:"p-8 space-y-4",children:[t("div",{className:"flex flex-wrap gap-4 mb-6",children:[t("div",{children:[e("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Position"}),t("select",{value:l,onChange:function(e){return a(e.target.value)},className:"border border-gray-300 rounded-md px-3 py-2 text-sm",children:[e("option",{value:"left",children:"Left"}),e("option",{value:"right",children:"Right"}),e("option",{value:"center",children:"Center"})]})]}),t("div",{children:[e("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Size"}),t("select",{value:d,onChange:function(e){return h(e.target.value)},className:"border border-gray-300 rounded-md px-3 py-2 text-sm",children:[e("option",{value:"xs",children:"Extra Small"}),e("option",{value:"sm",children:"Small"}),e("option",{value:"md",children:"Medium"}),e("option",{value:"lg",children:"Large"}),e("option",{value:"xl",children:"Extra Large"}),e("option",{value:"2xl",children:"2X Large"}),e("option",{value:"full",children:"Full Width"})]})]})]}),e("button",{onClick:function(){return i(!0)},className:"px-6 py-3 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors duration-200 font-medium",children:"Open Modal"}),e(Lc,{isOpen:o,onClose:function(){return i(!1)},title:"Example Modal",size:d,position:l,footer:u,maxHeight:"center"!==l,children:t("div",{className:"space-y-4",children:[e("p",{className:"text-gray-600",children:"This is an example of the multipurpose modal component. It supports different sizes, positions, and configurations."}),t("div",{className:"bg-gray-50 p-4 rounded-lg",children:[e("h4",{className:"font-medium text-gray-900 mb-2",children:"Features:"}),t("ul",{className:"text-sm text-gray-600 space-y-1 list-disc list-inside",children:[e("li",{children:"Multiple sizes (xs, sm, md, lg, xl, 2xl, full)"}),e("li",{children:"Three positions (left, right, center)"}),e("li",{children:"Customizable styling with className props"}),e("li",{children:"Keyboard navigation and accessibility"}),e("li",{children:"Click outside to close"}),e("li",{children:"Smooth animations"}),e("li",{children:"Optional footer with actions"})]})]}),("left"===l||"right"===l)&&e("div",{className:"space-y-2",children:Array.from({length:20},(function(e,n){return t("p",{className:"text-gray-600",children:["This is paragraph ",n+1," to demonstrate scrolling in side panels."]},n)}))})]})})]})};export{Pc as AlertProvider,b as Button,j as Card,W as CheckBox,H as EmptyStateCard,_ as ExportButton,q as FileUpload,U as Input,Lc as Modal,Bc as ModalExample,G as Search,X as Select,Dc as SelectButton,Ac as TextEditor,zc as useAlert};
|
|
50
|
+
*/"production"===process.env.NODE_ENV?Sa.exports=function(){if(wa)return Ca;wa=1;var e=r,t=fa,n="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},o=t.useSyncExternalStore,i=e.useRef,s=e.useEffect,l=e.useMemo,a=e.useDebugValue;return Ca.useSyncExternalStoreWithSelector=function(e,t,r,c,d){var h=i(null);if(null===h.current){var u={hasValue:!1,value:null};h.current=u}else u=h.current;h=l((function(){function e(e){if(!s){if(s=!0,o=e,e=c(e),void 0!==d&&u.hasValue){var t=u.value;if(d(t,e))return i=t}return i=e}if(t=i,n(o,e))return t;var r=c(e);return void 0!==d&&d(t,r)?t:(o=e,i=r)}var o,i,s=!1,l=void 0===r?null:r;return[function(){return e(t())},null===l?void 0:function(){return e(l())}]}),[t,r,c,d]);var p=o(e,h[0],h[1]);return s((function(){u.hasValue=!0,u.value=p}),[p]),a(p),p},Ca}():Sa.exports=(Ma||(Ma=1,"production"!==process.env.NODE_ENV&&function(){"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error);var e=r,t=fa,n="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},o=t.useSyncExternalStore,i=e.useRef,s=e.useEffect,l=e.useMemo,a=e.useDebugValue;Oa.useSyncExternalStoreWithSelector=function(e,t,r,c,d){var h,u=i(null);null===u.current?(h={hasValue:!1,value:null},u.current=h):h=u.current;var p=l((function(){var e,o,i=!1,s=function(t){if(!i){i=!0,e=t;var r=c(t);if(void 0!==d&&h.hasValue){var s=h.value;if(d(s,r))return o=s,s}return o=r,r}var l=o;if(n(e,t))return l;var a=c(t);return void 0!==d&&d(l,a)?l:(e=t,o=a,a)},l=void 0===r?null:r;return[function(){return s(t())},null===l?void 0:function(){return s(l())}]}),[t,r,c,d]),f=p[0],m=p[1],g=o(e,f,m);return s((function(){h.hasValue=!0,h.value=g}),[g]),a(g),g},"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}()),Oa);var Na=Sa.exports;const Ta="undefined"!=typeof window?d:a;class Ea{constructor(e){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=e,this.lastSnapshot={editor:e,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber||(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber}),this.lastSnapshot}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(e){return this.subscribers.add(e),()=>{this.subscribers.delete(e)}}watch(e){if(this.editor=e,this.editor){const e=()=>{this.transactionNumber+=1,this.subscribers.forEach((e=>e()))},t=this.editor;return t.on("transaction",e),()=>{t.off("transaction",e)}}}}const Aa="production"!==process.env.NODE_ENV,Da="undefined"==typeof window,Ia=Da||Boolean("undefined"!=typeof window&&window.next);class Ra{constructor(e){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId="",this.options=e,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(e){this.editor=e,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach((e=>e()))}getInitialEditor(){if(void 0===this.options.current.immediatelyRender)return Da||Ia?(Aa&&console.warn("Tiptap Error: SSR has been detected, please set `immediatelyRender` explicitly to `false` to avoid hydration mismatches."),null):this.createEditor();if(this.options.current.immediatelyRender&&Da&&Aa)throw new Error("Tiptap Error: SSR has been detected, and `immediatelyRender` has been set to `true` this is an unsupported configuration that may result in errors, explicitly set `immediatelyRender` to `false` to avoid hydration mismatches.");return this.options.current.immediatelyRender?this.createEditor():null}createEditor(){const e={...this.options.current,onBeforeCreate:(...e)=>{var t,n;return null===(n=(t=this.options.current).onBeforeCreate)||void 0===n?void 0:n.call(t,...e)},onBlur:(...e)=>{var t,n;return null===(n=(t=this.options.current).onBlur)||void 0===n?void 0:n.call(t,...e)},onCreate:(...e)=>{var t,n;return null===(n=(t=this.options.current).onCreate)||void 0===n?void 0:n.call(t,...e)},onDestroy:(...e)=>{var t,n;return null===(n=(t=this.options.current).onDestroy)||void 0===n?void 0:n.call(t,...e)},onFocus:(...e)=>{var t,n;return null===(n=(t=this.options.current).onFocus)||void 0===n?void 0:n.call(t,...e)},onSelectionUpdate:(...e)=>{var t,n;return null===(n=(t=this.options.current).onSelectionUpdate)||void 0===n?void 0:n.call(t,...e)},onTransaction:(...e)=>{var t,n;return null===(n=(t=this.options.current).onTransaction)||void 0===n?void 0:n.call(t,...e)},onUpdate:(...e)=>{var t,n;return null===(n=(t=this.options.current).onUpdate)||void 0===n?void 0:n.call(t,...e)},onContentError:(...e)=>{var t,n;return null===(n=(t=this.options.current).onContentError)||void 0===n?void 0:n.call(t,...e)},onDrop:(...e)=>{var t,n;return null===(n=(t=this.options.current).onDrop)||void 0===n?void 0:n.call(t,...e)},onPaste:(...e)=>{var t,n;return null===(n=(t=this.options.current).onPaste)||void 0===n?void 0:n.call(t,...e)}};return new zl(e)}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,t){return Object.keys(e).every((n=>!!["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(n)||("extensions"===n&&e.extensions&&t.extensions?e.extensions.length===t.extensions.length&&e.extensions.every(((e,n)=>{var r;return e===(null===(r=t.extensions)||void 0===r?void 0:r[n])})):e[n]===t[n])))}onRender(e){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&0===e.length?Ra.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(e),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){if(null===this.previousDeps)return void(this.previousDeps=e);if(this.previousDeps.length===e.length&&this.previousDeps.every(((t,n)=>t===e[n])))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){const e=this.instanceId,t=this.editor;this.scheduledDestructionTimeout=setTimeout((()=>{this.isComponentMounted&&this.instanceId===e?t&&t.setOptions(this.options.current):t&&!t.isDestroyed&&(t.destroy(),this.instanceId===e&&this.setEditor(null))}),1)}}function Pa(e={},t=[]){const n=l(e);n.current=e;const[r]=s((()=>new Ra(n))),o=fa.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return c(o),a(r.onRender(t)),function(e){var t;const[n]=s((()=>new Ea(e.editor))),r=Na.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getServerSnapshot,e.selector,null!==(t=e.equalityFn)&&void 0!==t?t:ka);Ta((()=>n.watch(e.editor)),[e.editor,n]),c(r)}({editor:o,selector:({transactionNumber:t})=>!1===e.shouldRerenderOnTransaction?null:e.immediatelyRender&&0===t?0:t+1}),o}h({editor:null}).Consumer;const za=h({onDragStart:void 0});r.forwardRef(((e,t)=>{const{onDragStart:n}=u(za),o=e.as||"div";return r.createElement(o,{...e,ref:t,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...e.style}})}));const La=/^\s*>\s$/,Ba=Vl.create({name:"blockquote",addOptions:()=>({HTMLAttributes:{}}),content:"block+",group:"block",defining:!0,parseHTML:()=>[{tag:"blockquote"}],renderHTML({HTMLAttributes:e}){return["blockquote",Os(this.options.HTMLAttributes,e),0]},addCommands(){return{setBlockquote:()=>({commands:e})=>e.wrapIn(this.name),toggleBlockquote:()=>({commands:e})=>e.toggleWrap(this.name),unsetBlockquote:()=>({commands:e})=>e.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[$l({find:La,type:this.type})]}}),$a=/(^|[^`])`([^`]+)`(?!`)/,Va=/(^|[^`])`([^`]+)`(?!`)/g,Fa=_s.create({name:"code",addOptions:()=>({HTMLAttributes:{}}),excludes:"_",code:!0,exitable:!0,parseHTML:()=>[{tag:"code"}],renderHTML({HTMLAttributes:e}){return["code",Os(this.options.HTMLAttributes,e),0]},addCommands(){return{setCode:()=>({commands:e})=>e.setMark(this.name),toggleCode:()=>({commands:e})=>e.toggleMark(this.name),unsetCode:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[Ll({find:$a,type:this.type})]},addPasteRules(){return[Fl({find:Va,type:this.type})]}}),_a=/^```([a-z]+)?[\s\n]$/,ja=/^~~~([a-z]+)?[\s\n]$/,Ha=Vl.create({name:"codeBlock",addOptions:()=>({languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,HTMLAttributes:{}}),content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:e=>{var t;const{languageClassPrefix:n}=this.options,r=[...(null===(t=e.firstElementChild)||void 0===t?void 0:t.classList)||[]].filter((e=>e.startsWith(n))).map((e=>e.replace(n,"")))[0];return r||null},rendered:!1}}},parseHTML:()=>[{tag:"pre",preserveWhitespace:"full"}],renderHTML({node:e,HTMLAttributes:t}){return["pre",Os(this.options.HTMLAttributes,t),["code",{class:e.attrs.language?this.options.languageClassPrefix+e.attrs.language:null},0]]},addCommands(){return{setCodeBlock:e=>({commands:t})=>t.setNode(this.name,e),toggleCodeBlock:e=>({commands:t})=>t.toggleNode(this.name,"paragraph",e)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:e,$anchor:t}=this.editor.state.selection,n=1===t.pos;return!(!e||t.parent.type.name!==this.name)&&(!(!n&&t.parent.textContent.length)&&this.editor.commands.clearNodes())},Enter:({editor:e})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:t}=e,{selection:n}=t,{$from:r,empty:o}=n;if(!o||r.parent.type!==this.type)return!1;const i=r.parentOffset===r.parent.nodeSize-2,s=r.parent.textContent.endsWith("\n\n");return!(!i||!s)&&e.chain().command((({tr:e})=>(e.delete(r.pos-2,r.pos),!0))).exitCode().run()},ArrowDown:({editor:e})=>{if(!this.options.exitOnArrowDown)return!1;const{state:t}=e,{selection:n,doc:r}=t,{$from:o,empty:i}=n;if(!i||o.parent.type!==this.type)return!1;if(!(o.parentOffset===o.parent.nodeSize-2))return!1;const s=o.after();if(void 0===s)return!1;return r.nodeAt(s)?e.commands.command((({tr:e})=>(e.setSelection(Xt.near(r.resolve(s))),!0))):e.commands.exitCode()}}},addInputRules(){return[Bl({find:_a,type:this.type,getAttributes:e=>({language:e[1]})}),Bl({find:ja,type:this.type,getAttributes:e=>({language:e[1]})})]},addProseMirrorPlugins(){return[new gn({key:new bn("codeBlockVSCodeHandler"),props:{handlePaste:(e,t)=>{if(!t.clipboardData)return!1;if(this.editor.isActive(this.type.name))return!1;const n=t.clipboardData.getData("text/plain"),r=t.clipboardData.getData("vscode-editor-data"),o=r?JSON.parse(r):void 0,i=null==o?void 0:o.mode;if(!n||!i)return!1;const{tr:s,schema:l}=e.state,a=l.text(n.replace(/\r\n?/g,"\n"));return s.replaceSelectionWith(this.type.create({language:i},a)),s.selection.$from.parent.type!==this.type&&s.setSelection(en.near(s.doc.resolve(Math.max(0,s.selection.from-2)))),s.setMeta("paste",!0),e.dispatch(s),!0}}})]}});function Wa(e={}){return new gn({view:t=>new qa(t,e)})}class qa{constructor(e,t){var n;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=null!==(n=t.width)&&void 0!==n?n:1,this.color=!1===t.color?void 0:t.color||"black",this.class=t.class,this.handlers=["dragover","dragend","drop","dragleave"].map((t=>{let n=e=>{this[t](e)};return e.dom.addEventListener(t,n),{name:t,handler:n}}))}destroy(){this.handlers.forEach((({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t)))}update(e,t){null!=this.cursorPos&&t.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,null==e?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e,t=this.editorView.state.doc.resolve(this.cursorPos),n=!t.parent.inlineContent,r=this.editorView.dom,o=r.getBoundingClientRect(),i=o.width/r.offsetWidth,s=o.height/r.offsetHeight;if(n){let n=t.nodeBefore,r=t.nodeAfter;if(n||r){let t=this.editorView.nodeDOM(this.cursorPos-(n?n.nodeSize:0));if(t){let o=t.getBoundingClientRect(),i=n?o.bottom:o.top;n&&r&&(i=(i+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let l=this.width/2*s;e={left:o.left,right:o.right,top:i-l,bottom:i+l}}}}if(!e){let t=this.editorView.coordsAtPos(this.cursorPos),n=this.width/2*i;e={left:t.left-n,right:t.left+n,top:t.top,bottom:t.bottom}}let l,a,c=this.editorView.dom.offsetParent;if(this.element||(this.element=c.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n),!c||c==document.body&&"static"==getComputedStyle(c).position)l=-pageXOffset,a=-pageYOffset;else{let e=c.getBoundingClientRect(),t=e.width/c.offsetWidth,n=e.height/c.offsetHeight;l=e.left-c.scrollLeft*t,a=e.top-c.scrollTop*n}this.element.style.left=(e.left-l)/i+"px",this.element.style.top=(e.top-a)/s+"px",this.element.style.width=(e.right-e.left)/i+"px",this.element.style.height=(e.bottom-e.top)/s+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout((()=>this.setCursor(null)),e)}dragover(e){if(!this.editorView.editable)return;let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),n=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),r=n&&n.type.spec.disableDropCursor,o="function"==typeof r?r(this.editorView,t,e):r;if(t&&!o){let e=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let t=Pt(this.editorView.state.doc,e,this.editorView.dragging.slice);null!=t&&(e=t)}this.setCursor(e),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}const Ja=Ks.create({name:"dropCursor",addOptions:()=>({color:"currentColor",width:1,class:void 0}),addProseMirrorPlugins(){return[Wa(this.options)]}});class Ka extends Xt{constructor(e){super(e,e)}map(e,t){let n=e.resolve(t.map(this.head));return Ka.valid(n)?new Ka(n):Xt.near(n)}content(){return se.empty}eq(e){return e instanceof Ka&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,t){if("number"!=typeof t.pos)throw new RangeError("Invalid input for GapCursor.fromJSON");return new Ka(e.resolve(t.pos))}getBookmark(){return new Ua(this.anchor)}static valid(e){let t=e.parent;if(t.isTextblock||!function(e){for(let t=e.depth;t>=0;t--){let n=e.index(t),r=e.node(t);if(0!=n)for(let e=r.child(n-1);;e=e.lastChild){if(0==e.childCount&&!e.inlineContent||e.isAtom||e.type.spec.isolating)return!0;if(e.inlineContent)return!1}else if(r.type.spec.isolating)return!0}return!0}(e)||!function(e){for(let t=e.depth;t>=0;t--){let n=e.indexAfter(t),r=e.node(t);if(n!=r.childCount)for(let e=r.child(n);;e=e.firstChild){if(0==e.childCount&&!e.inlineContent||e.isAtom||e.type.spec.isolating)return!0;if(e.inlineContent)return!1}else if(r.type.spec.isolating)return!0}return!0}(e))return!1;let n=t.type.spec.allowGapCursor;if(null!=n)return n;let r=t.contentMatchAt(e.index()).defaultType;return r&&r.isTextblock}static findGapCursorFrom(e,t,n=!1){e:for(;;){if(!n&&Ka.valid(e))return e;let r=e.pos,o=null;for(let n=e.depth;;n--){let i=e.node(n);if(t>0?e.indexAfter(n)<i.childCount:e.index(n)>0){o=i.child(t>0?e.indexAfter(n):e.index(n)-1);break}if(0==n)return null;r+=t;let s=e.doc.resolve(r);if(Ka.valid(s))return s}for(;;){let i=t>0?o.firstChild:o.lastChild;if(!i){if(o.isAtom&&!o.isText&&!nn.isSelectable(o)){e=e.doc.resolve(r+o.nodeSize*t),n=!1;continue e}break}o=i,r+=t;let s=e.doc.resolve(r);if(Ka.valid(s))return s}return null}}}Ka.prototype.visible=!1,Ka.findFrom=Ka.findGapCursorFrom,Xt.jsonID("gapcursor",Ka);class Ua{constructor(e){this.pos=e}map(e){return new Ua(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return Ka.valid(t)?new Ka(t):Xt.near(t)}}const Ga=Ki({ArrowLeft:Xa("horiz",-1),ArrowRight:Xa("horiz",1),ArrowUp:Xa("vert",-1),ArrowDown:Xa("vert",1)});function Xa(e,t){const n="vert"==e?t>0?"down":"up":t>0?"right":"left";return function(e,r,o){let i=e.selection,s=t>0?i.$to:i.$from,l=i.empty;if(i instanceof en){if(!o.endOfTextblock(n)||0==s.depth)return!1;l=!1,s=e.doc.resolve(t>0?s.after():s.before())}let a=Ka.findGapCursorFrom(s,t,l);return!!a&&(r&&r(e.tr.setSelection(new Ka(a))),!0)}}function Ya(e,t,n){if(!e||!e.editable)return!1;let r=e.state.doc.resolve(t);if(!Ka.valid(r))return!1;let o=e.posAtCoords({left:n.clientX,top:n.clientY});return!(o&&o.inside>-1&&nn.isSelectable(e.state.doc.nodeAt(o.inside)))&&(e.dispatch(e.state.tr.setSelection(new Ka(r))),!0)}function Za(e,t){if("insertCompositionText"!=t.inputType||!(e.state.selection instanceof Ka))return!1;let{$from:n}=e.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(e.state.schema.nodes.text);if(!r)return!1;let o=ee.empty;for(let e=r.length-1;e>=0;e--)o=ee.from(r[e].createAndFill(null,o));let i=e.state.tr.replace(n.pos,n.pos,new se(o,0,0));return i.setSelection(en.near(i.doc.resolve(n.pos+1))),e.dispatch(i),!1}function Qa(e){if(!(e.selection instanceof Ka))return null;let t=document.createElement("div");return t.className="ProseMirror-gapcursor",si.create(e.doc,[ri.widget(e.selection.head,t,{key:"gapcursor"})])}const ec=Ks.create({name:"gapCursor",addProseMirrorPlugins:()=>[new gn({props:{decorations:Qa,createSelectionBetween:(e,t,n)=>t.pos==n.pos&&Ka.valid(n)?new Ka(n):null,handleClick:Ya,handleKeyDown:Ga,handleDOMEvents:{beforeinput:Za}}})],extendNodeSchema(e){var t;return{allowGapCursor:null!==(t=Es(ks(e,"allowGapCursor",{name:e.name,options:e.options,storage:e.storage})))&&void 0!==t?t:null}}}),tc=Vl.create({name:"hardBreak",addOptions:()=>({keepMarks:!0,HTMLAttributes:{}}),inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML:()=>[{tag:"br"}],renderHTML({HTMLAttributes:e}){return["br",Os(this.options.HTMLAttributes,e)]},renderText:()=>"\n",addCommands(){return{setHardBreak:()=>({commands:e,chain:t,state:n,editor:r})=>e.first([()=>e.exitCode(),()=>e.command((()=>{const{selection:e,storedMarks:o}=n;if(e.$from.parent.type.spec.isolating)return!1;const{keepMarks:i}=this.options,{splittableMarks:s}=r.extensionManager,l=o||e.$to.parentOffset&&e.$from.marks();return t().insertContent({type:this.name}).command((({tr:e,dispatch:t})=>{if(t&&l&&i){const t=l.filter((e=>s.includes(e.type.name)));e.ensureMarks(t)}return!0})).run()}))])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),nc=Vl.create({name:"heading",addOptions:()=>({levels:[1,2,3,4,5,6],HTMLAttributes:{}}),content:"inline*",group:"block",defining:!0,addAttributes:()=>({level:{default:1,rendered:!1}}),parseHTML(){return this.options.levels.map((e=>({tag:`h${e}`,attrs:{level:e}})))},renderHTML({node:e,HTMLAttributes:t}){return[`h${this.options.levels.includes(e.attrs.level)?e.attrs.level:this.options.levels[0]}`,Os(this.options.HTMLAttributes,t),0]},addCommands(){return{setHeading:e=>({commands:t})=>!!this.options.levels.includes(e.level)&&t.setNode(this.name,e),toggleHeading:e=>({commands:t})=>!!this.options.levels.includes(e.level)&&t.toggleNode(this.name,"paragraph",e)}},addKeyboardShortcuts(){return this.options.levels.reduce(((e,t)=>({...e,[`Mod-Alt-${t}`]:()=>this.editor.commands.toggleHeading({level:t})})),{})},addInputRules(){return this.options.levels.map((e=>Bl({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${e}})\\s$`),type:this.type,getAttributes:{level:e}})))}});var rc=200,oc=function(){};oc.prototype.append=function(e){return e.length?(e=oc.from(e),!this.length&&e||e.length<rc&&this.leafAppend(e)||this.length<rc&&e.leafPrepend(this)||this.appendInner(e)):this},oc.prototype.prepend=function(e){return e.length?oc.from(e).append(this):this},oc.prototype.appendInner=function(e){return new sc(this,e)},oc.prototype.slice=function(e,t){return void 0===e&&(e=0),void 0===t&&(t=this.length),e>=t?oc.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},oc.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},oc.prototype.forEach=function(e,t,n){void 0===t&&(t=0),void 0===n&&(n=this.length),t<=n?this.forEachInner(e,t,n,0):this.forEachInvertedInner(e,t,n,0)},oc.prototype.map=function(e,t,n){void 0===t&&(t=0),void 0===n&&(n=this.length);var r=[];return this.forEach((function(t,n){return r.push(e(t,n))}),t,n),r},oc.from=function(e){return e instanceof oc?e:e&&e.length?new ic(e):oc.empty};var ic=function(e){function t(t){e.call(this),this.values=t}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(e,n){return 0==e&&n==this.length?this:new t(this.values.slice(e,n))},t.prototype.getInner=function(e){return this.values[e]},t.prototype.forEachInner=function(e,t,n,r){for(var o=t;o<n;o++)if(!1===e(this.values[o],r+o))return!1},t.prototype.forEachInvertedInner=function(e,t,n,r){for(var o=t-1;o>=n;o--)if(!1===e(this.values[o],r+o))return!1},t.prototype.leafAppend=function(e){if(this.length+e.length<=rc)return new t(this.values.concat(e.flatten()))},t.prototype.leafPrepend=function(e){if(this.length+e.length<=rc)return new t(e.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(t.prototype,n),t}(oc);oc.empty=new ic([]);var sc=function(e){function t(t,n){e.call(this),this.left=t,this.right=n,this.length=t.length+n.length,this.depth=Math.max(t.depth,n.depth)+1}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.prototype.getInner=function(e){return e<this.left.length?this.left.get(e):this.right.get(e-this.left.length)},t.prototype.forEachInner=function(e,t,n,r){var o=this.left.length;return!(t<o&&!1===this.left.forEachInner(e,t,Math.min(n,o),r))&&(!(n>o&&!1===this.right.forEachInner(e,Math.max(t-o,0),Math.min(this.length,n)-o,r+o))&&void 0)},t.prototype.forEachInvertedInner=function(e,t,n,r){var o=this.left.length;return!(t>o&&!1===this.right.forEachInvertedInner(e,t-o,Math.max(n,o)-o,r+o))&&(!(n<o&&!1===this.left.forEachInvertedInner(e,Math.min(t,o),n,r))&&void 0)},t.prototype.sliceInner=function(e,t){if(0==e&&t==this.length)return this;var n=this.left.length;return t<=n?this.left.slice(e,t):e>=n?this.right.slice(e-n,t-n):this.left.slice(e,n).append(this.right.slice(0,t-n))},t.prototype.leafAppend=function(e){var n=this.right.leafAppend(e);if(n)return new t(this.left,n)},t.prototype.leafPrepend=function(e){var n=this.left.leafPrepend(e);if(n)return new t(n,this.right)},t.prototype.appendInner=function(e){return this.left.depth>=Math.max(this.right.depth,e.depth)+1?new t(this.left,new t(this.right,e)):new t(this,e)},t}(oc);class lc{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(0==this.eventCount)return null;let n,r,o=this.items.length;for(;;o--){if(this.items.get(o-1).selection){--o;break}}t&&(n=this.remapping(o,this.items.length),r=n.maps.length);let i,s,l=e.tr,a=[],c=[];return this.items.forEach(((e,t)=>{if(!e.step)return n||(n=this.remapping(o,t+1),r=n.maps.length),r--,void c.push(e);if(n){c.push(new ac(e.map));let t,o=e.step.map(n.slice(r));o&&l.maybeStep(o).doc&&(t=l.mapping.maps[l.mapping.maps.length-1],a.push(new ac(t,void 0,void 0,a.length+c.length))),r--,t&&n.appendMap(t,r)}else l.maybeStep(e.step);return e.selection?(i=n?e.selection.map(n.slice(r)):e.selection,s=new lc(this.items.slice(0,o).append(c.reverse().concat(a)),this.eventCount-1),!1):void 0}),this.items.length,0),{remaining:s,transform:l,selection:i}}addTransform(e,t,n,r){let o=[],i=this.eventCount,s=this.items,l=!r&&s.length?s.get(s.length-1):null;for(let n=0;n<e.steps.length;n++){let a,c=e.steps[n].invert(e.docs[n]),d=new ac(e.mapping.maps[n],c,t);(a=l&&l.merge(d))&&(d=a,n?o.pop():s=s.slice(0,s.length-1)),o.push(d),t&&(i++,t=void 0),r||(l=d)}let a=i-n.depth;return a>dc&&(s=function(e,t){let n;return e.forEach(((e,r)=>{if(e.selection&&0==t--)return n=r,!1})),e.slice(n)}(s,a),i-=a),new lc(s.append(o),i)}remapping(e,t){let n=new ht;return this.items.forEach(((t,r)=>{let o=null!=t.mirrorOffset&&r-t.mirrorOffset>=e?n.maps.length-t.mirrorOffset:void 0;n.appendMap(t.map,o)}),e,t),n}addMaps(e){return 0==this.eventCount?this:new lc(this.items.append(e.map((e=>new ac(e)))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let n=[],r=Math.max(0,this.items.length-t),o=e.mapping,i=e.steps.length,s=this.eventCount;this.items.forEach((e=>{e.selection&&s--}),r);let l=t;this.items.forEach((t=>{let r=o.getMirror(--l);if(null==r)return;i=Math.min(i,r);let a=o.maps[r];if(t.step){let i=e.steps[r].invert(e.docs[r]),c=t.selection&&t.selection.map(o.slice(l+1,r));c&&s++,n.push(new ac(a,i,c))}else n.push(new ac(a))}),r);let a=[];for(let e=t;e<i;e++)a.push(new ac(o.maps[e]));let c=this.items.slice(0,r).append(a).append(n),d=new lc(c,s);return d.emptyItemCount()>500&&(d=d.compress(this.items.length-n.length)),d}emptyItemCount(){let e=0;return this.items.forEach((t=>{t.step||e++})),e}compress(e=this.items.length){let t=this.remapping(0,e),n=t.maps.length,r=[],o=0;return this.items.forEach(((i,s)=>{if(s>=e)r.push(i),i.selection&&o++;else if(i.step){let e=i.step.map(t.slice(n)),s=e&&e.getMap();if(n--,s&&t.appendMap(s,n),e){let l=i.selection&&i.selection.map(t.slice(n));l&&o++;let a,c=new ac(s.invert(),e,l),d=r.length-1;(a=r.length&&r[d].merge(c))?r[d]=a:r.push(c)}}else i.map&&n--}),this.items.length,0),new lc(oc.from(r.reverse()),o)}}lc.empty=new lc(oc.empty,0);class ac{constructor(e,t,n,r){this.map=e,this.step=t,this.selection=n,this.mirrorOffset=r}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new ac(t.getMap().invert(),t,this.selection)}}}class cc{constructor(e,t,n,r,o){this.done=e,this.undone=t,this.prevRanges=n,this.prevTime=r,this.prevComposition=o}}const dc=20;function hc(e){let t=[];for(let n=e.length-1;n>=0&&0==t.length;n--)e[n].forEach(((e,n,r,o)=>t.push(r,o)));return t}function uc(e,t){if(!e)return null;let n=[];for(let r=0;r<e.length;r+=2){let o=t.map(e[r],1),i=t.map(e[r+1],-1);o<=i&&n.push(o,i)}return n}let pc=!1,fc=null;function mc(e){let t=e.plugins;if(fc!=t){pc=!1,fc=t;for(let e=0;e<t.length;e++)if(t[e].spec.historyPreserveItems){pc=!0;break}}return pc}const gc=new bn("history"),yc=new bn("closeHistory");function vc(e={}){return e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},new gn({key:gc,state:{init:()=>new cc(lc.empty,lc.empty,null,0,-1),apply:(t,n,r)=>function(e,t,n,r){let o,i=n.getMeta(gc);if(i)return i.historyState;n.getMeta(yc)&&(e=new cc(e.done,e.undone,null,0,-1));let s=n.getMeta("appendedTransaction");if(0==n.steps.length)return e;if(s&&s.getMeta(gc))return s.getMeta(gc).redo?new cc(e.done.addTransform(n,void 0,r,mc(t)),e.undone,hc(n.mapping.maps),e.prevTime,e.prevComposition):new cc(e.done,e.undone.addTransform(n,void 0,r,mc(t)),null,e.prevTime,e.prevComposition);if(!1===n.getMeta("addToHistory")||s&&!1===s.getMeta("addToHistory"))return(o=n.getMeta("rebased"))?new cc(e.done.rebased(n,o),e.undone.rebased(n,o),uc(e.prevRanges,n.mapping),e.prevTime,e.prevComposition):new cc(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),uc(e.prevRanges,n.mapping),e.prevTime,e.prevComposition);{let o=n.getMeta("composition"),i=0==e.prevTime||!s&&e.prevComposition!=o&&(e.prevTime<(n.time||0)-r.newGroupDelay||!function(e,t){if(!t)return!1;if(!e.docChanged)return!0;let n=!1;return e.mapping.maps[0].forEach(((e,r)=>{for(let o=0;o<t.length;o+=2)e<=t[o+1]&&r>=t[o]&&(n=!0)})),n}(n,e.prevRanges)),l=s?uc(e.prevRanges,n.mapping):hc(n.mapping.maps);return new cc(e.done.addTransform(n,i?t.selection.getBookmark():void 0,r,mc(t)),lc.empty,l,n.time,null==o?e.prevComposition:o)}}(n,r,t,e)},config:e,props:{handleDOMEvents:{beforeinput(e,t){let n=t.inputType,r="historyUndo"==n?wc:"historyRedo"==n?xc:null;return!!r&&(t.preventDefault(),r(e.state,e.dispatch))}}}})}function bc(e,t){return(n,r)=>{let o=gc.getState(n);if(!o||0==(e?o.undone:o.done).eventCount)return!1;if(r){let i=function(e,t,n){let r=mc(t),o=gc.get(t).spec.config,i=(n?e.undone:e.done).popEvent(t,r);if(!i)return null;let s=i.selection.resolve(i.transform.doc),l=(n?e.done:e.undone).addTransform(i.transform,t.selection.getBookmark(),o,r),a=new cc(n?l:i.remaining,n?i.remaining:l,null,0,-1);return i.transform.setSelection(s).setMeta(gc,{redo:n,historyState:a})}(o,n,e);i&&r(t?i.scrollIntoView():i)}return!0}}const wc=bc(!1,!0),xc=bc(!0,!0),kc=Ks.create({name:"history",addOptions:()=>({depth:100,newGroupDelay:500}),addCommands:()=>({undo:()=>({state:e,dispatch:t})=>wc(e,t),redo:()=>({state:e,dispatch:t})=>xc(e,t)}),addProseMirrorPlugins(){return[vc(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),Sc=Vl.create({name:"horizontalRule",addOptions:()=>({HTMLAttributes:{}}),group:"block",parseHTML:()=>[{tag:"hr"}],renderHTML({HTMLAttributes:e}){return["hr",Os(this.options.HTMLAttributes,e)]},addCommands(){return{setHorizontalRule:()=>({chain:e,state:t})=>{const{selection:n}=t,{$from:r,$to:o}=n,i=e();return 0===r.parentOffset?i.insertContentAt({from:Math.max(r.pos-1,0),to:o.pos},{type:this.name}):n instanceof nn?i.insertContentAt(o.pos,{type:this.name}):i.insertContent({type:this.name}),i.command((({tr:e,dispatch:t})=>{var n;if(t){const{$to:t}=e.selection,r=t.end();if(t.nodeAfter)t.nodeAfter.isTextblock?e.setSelection(en.create(e.doc,t.pos+1)):t.nodeAfter.isBlock?e.setSelection(nn.create(e.doc,t.pos)):e.setSelection(en.create(e.doc,t.pos));else{const o=null===(n=t.parent.type.contentMatch.defaultType)||void 0===n?void 0:n.create();o&&(e.insert(r,o),e.setSelection(en.create(e.doc,r+1)))}e.scrollIntoView()}return!0})).run()}}},addInputRules(){return[(e={find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type},new Ls({find:e.find,handler:({state:t,range:n,match:r})=>{const o=Es(e.getAttributes,void 0,r)||{},{tr:i}=t,s=n.from;let l=n.to;const a=e.type.create(o);if(r[1]){let e=s+r[0].lastIndexOf(r[1]);e>l?e=l:l=e+r[1].length;const t=r[0][r[0].length-1];i.insertText(t,s+r[0].length-1),i.replaceWith(e,l,a)}else if(r[0]){const t=e.type.isInline?s:s-1;i.insert(t,e.type.create(o)).delete(i.mapping.map(s),i.mapping.map(l))}i.scrollIntoView()}}))];var e}}),Cc=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,Mc=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,Oc=_s.create({name:"strike",addOptions:()=>({HTMLAttributes:{}}),parseHTML:()=>[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:e=>!!e.includes("line-through")&&{}}],renderHTML({HTMLAttributes:e}){return["s",Os(this.options.HTMLAttributes,e),0]},addCommands(){return{setStrike:()=>({commands:e})=>e.setMark(this.name),toggleStrike:()=>({commands:e})=>e.toggleMark(this.name),unsetStrike:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[Ll({find:Cc,type:this.type})]},addPasteRules(){return[Fl({find:Mc,type:this.type})]}}),Nc=Ks.create({name:"starterKit",addExtensions(){const e=[];return!1!==this.options.bold&&e.push(ql.configure(this.options.bold)),!1!==this.options.blockquote&&e.push(Ba.configure(this.options.blockquote)),!1!==this.options.bulletList&&e.push(Ul.configure(this.options.bulletList)),!1!==this.options.code&&e.push(Fa.configure(this.options.code)),!1!==this.options.codeBlock&&e.push(Ha.configure(this.options.codeBlock)),!1!==this.options.document&&e.push(Gl.configure(this.options.document)),!1!==this.options.dropcursor&&e.push(Ja.configure(this.options.dropcursor)),!1!==this.options.gapcursor&&e.push(ec.configure(this.options.gapcursor)),!1!==this.options.hardBreak&&e.push(tc.configure(this.options.hardBreak)),!1!==this.options.heading&&e.push(nc.configure(this.options.heading)),!1!==this.options.history&&e.push(kc.configure(this.options.history)),!1!==this.options.horizontalRule&&e.push(Sc.configure(this.options.horizontalRule)),!1!==this.options.italic&&e.push(ea.configure(this.options.italic)),!1!==this.options.listItem&&e.push(ta.configure(this.options.listItem)),!1!==this.options.orderedList&&e.push(oa.configure(this.options.orderedList)),!1!==this.options.paragraph&&e.push(ia.configure(this.options.paragraph)),!1!==this.options.strike&&e.push(Oc.configure(this.options.strike)),!1!==this.options.text&&e.push(sa.configure(this.options.text)),e}});function Tc(t){var n=t.size,r=void 0===n?18:n;return e("svg",{width:r,height:r,viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e("path",{d:"M6.75 3.75H15.75M2.25 3.75H3.75M6.75 9H15.75M2.25 9H3.75M6.75 14.25H15.75M2.25 14.25H3.75",stroke:"#27272A",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function Ec(t){var n=t.size,r=void 0===n?18:n;return e("svg",{width:r,height:r,viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e("path",{d:"M8.25 4.5H15.75M8.25 9H15.75M8.25 13.5H15.75M2.25 11.25H3.375C3.58425 11.25 3.6885 11.25 3.7755 11.2672C3.95012 11.302 4.11053 11.3877 4.23642 11.5136C4.36231 11.6395 4.44804 11.7999 4.48275 11.9745C4.5 12.0615 4.5 12.165 4.5 12.375C4.5 12.585 4.5 12.6885 4.48275 12.7755C4.44804 12.9501 4.36231 13.1105 4.23642 13.2364C4.11053 13.3623 3.95012 13.448 3.7755 13.4827C3.6885 13.5 3.585 13.5 3.375 13.5C3.165 13.5 3.0615 13.5 2.9745 13.5173C2.79988 13.552 2.63947 13.6377 2.51358 13.7636C2.38769 13.8895 2.30196 14.0499 2.26725 14.2245C2.25 14.3115 2.25 14.415 2.25 14.625V15.3C2.25 15.5122 2.25 15.618 2.316 15.684C2.382 15.75 2.4885 15.75 2.7 15.75H4.5M2.25 2.25H3.15C3.20967 2.25 3.2669 2.27371 3.3091 2.3159C3.35129 2.3581 3.375 2.41533 3.375 2.475V6.75M3.375 6.75H2.25M3.375 6.75H4.5",stroke:"#27272A",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}var Ac=function(n){var r=n.initialContent,o=void 0===r?"":r,i=n.onUpdate,s=Pa({extensions:[Nc,Gl,ia,sa,ql,ea,la,Ul,oa,ta],content:o,onUpdate:function(e){var t=e.editor;i(t.getHTML())}});return t("div",{className:"rounded-lg border",children:[t("div",{className:"flex gap-4 border-b bg-gray-50 p-2",children:[e("button",{onClick:function(){return null==s?void 0:s.chain().focus().toggleBold().run()},className:"mx-1 p-1 ".concat((null==s?void 0:s.isActive("bold"))?"rounded bg-gray-200":""),type:"button",children:e(O,{size:18})}),e("button",{onClick:function(){return null==s?void 0:s.chain().focus().toggleItalic().run()},className:"mx-1 p-1 ".concat((null==s?void 0:s.isActive("italic"))?"rounded bg-gray-200":""),type:"button",children:e(L,{size:18})}),e("button",{onClick:function(){return null==s?void 0:s.chain().focus().toggleUnderline().run()},className:"mx-1 p-1 ".concat((null==s?void 0:s.isActive("underline"))?"rounded bg-gray-200":""),type:"button",children:e($,{size:18})}),e("span",{className:"mx-2 h-6 border-r"}),e("button",{onClick:function(){return null==s?void 0:s.chain().focus().toggleBulletList().run()},className:"mx-1 p-1 ".concat((null==s?void 0:s.isActive("bulletList"))?"rounded bg-gray-200":""),type:"button",children:e(Tc,{})}),e("button",{onClick:function(){return null==s?void 0:s.chain().focus().toggleOrderedList().run()},className:"mx-1 p-1 ".concat((null==s?void 0:s.isActive("orderedList"))?"rounded bg-gray-200":""),type:"button",children:e(Ec,{})})]}),e(ba,{editor:s,className:"min-h-32 p-4"})]})};function Dc(n){var r=n.options,o=n.placeholder,i=void 0===o?"Select an option":o,l=n.onChange,a=n.value,c=n.size,d=void 0===c?"md":c,h=n.className,u=void 0===h?"":h,p=n.name,f=n.id,m=n.disabled,g=void 0!==m&&m,y=n.label,v=n.required,b=s(!1),w=b[0],x=b[1],k=s(a&&r.find((function(e){return e.value===a}))||null),S=k[0],C=k[1];return t("div",{className:"relative inline-block",children:[y&&t("label",{htmlFor:f,className:"mb-1 block text-sm font-medium text-gray-700",children:[y,v&&e("span",{className:"ml-1 text-red-500",children:"*"})]}),t("button",{type:"button",className:"flex w-full items-center justify-between rounded-md border border-gray-200 bg-white shadow-sm ".concat({sm:"px-3 py-2 text-sm",md:"px-4 py-2.5 text-base"}[d]," text-gray-700 hover:bg-gray-50 focus:outline-none ").concat(g?"cursor-not-allowed opacity-50":""," ").concat(u),onClick:function(){return!g&&x(!w)},disabled:g,id:f,children:[e("span",{className:"truncate",children:S?(null==S?void 0:S.label)||S.value:i}),e(T,{className:"ml-2 h-4 w-4 ".concat(w?"rotate-180 transform":"")})]}),w&&e("div",{className:"absolute z-10 mt-1 max-h-60 w-full min-w-[200px] p-1 font-medium text-sm overflow-auto rounded-lg bg-white shadow-xl",children:r.map((function(n){return t("div",{className:"cursor-pointer px-3 py-2 hover:bg-gray-100 rounded-lg flex justify-between item-center ".concat((null==S?void 0:S.value)===n.value?"bg-gray-50 text-black":"text-gray-900"),onClick:function(){return function(e){C(e),l(e.value),x(!1)}(n)},children:[e("div",{children:n.label||n.value}),(null==S?void 0:S.value)===n.value&&e("div",{children:e(N,{size:15,className:"text-primary"})})]},n.value)}))}),p&&e("input",{type:"hidden",name:p,value:(null==S?void 0:S.value)||""})]})}var Ic=function(n){var r=n.message,o=n.description,i=n.type,l=void 0===i?"info":i,c=n.duration,d=void 0===c?5e3:c,h=n.onClose,u=s(!0),p=u[0],f=u[1],m=s(100),g=m[0],y=m[1],v={success:{icon:e(A,{className:"h-5 w-5"}),bgColor:"bg-primary-50",borderColor:"border-primary-300",textColor:"text-primary-800",iconColor:"text-primary-500",progressColor:"bg-primary-500"},error:{icon:e(E,{className:"h-5 w-5"}),bgColor:"bg-rose-50",borderColor:"border-rose-300",textColor:"text-rose-800",iconColor:"text-rose-500",progressColor:"bg-rose-500"},info:{icon:e(z,{className:"h-5 w-5"}),bgColor:"bg-sky-50",borderColor:"border-sky-300 ",textColor:"text-sky-800 ",iconColor:"text-sky-500",progressColor:"bg-sky-500"},warning:{icon:e(B,{className:"h-5 w-5"}),bgColor:"bg-amber-50 ",borderColor:"border-amber-300 ",textColor:"text-amber-800",iconColor:"text-amber-500",progressColor:"bg-amber-500"}};a((function(){var e=setTimeout((function(){f(!1),setTimeout((function(){null==h||h()}),300)}),d),t=setInterval((function(){y((function(e){var t=e-100/(d/100);return t<=0?0:t}))}),100);return function(){clearTimeout(e),clearInterval(t)}}),[d,h]);var b=v[l],w=b.icon,x=b.bgColor,k=b.borderColor,S=b.textColor,C=b.iconColor,M=b.progressColor;return e("div",{className:"fixed right-4 top-4 z-50 transform transition-all duration-300 ".concat(p?"translate-x-0 opacity-100":"translate-x-full opacity-0"),children:t("div",{className:"flex w-72 rounded-lg border shadow-lg md:w-96 ".concat(k," ").concat(x," p-4"),children:[e("div",{className:"flex-shrink-0 ".concat(C),children:w}),t("div",{className:"ml-3 w-full",children:[t("div",{className:"flex items-start justify-between",children:[e("p",{className:"text-md font-semibold ".concat(S),children:r}),e("button",{onClick:function(){f(!1),setTimeout((function(){null==h||h()}),300)},className:"text-gray-600 hover:text-gray-600 focus:outline-none",children:e(V,{className:"h-4 w-4"})})]}),o&&e("p",{className:"mt-1 text-sm ".concat(S," opacity-80"),children:o}),e("div",{className:"mt-2 h-1 w-full rounded-full bg-gray-200",children:e("div",{className:"".concat(M," h-1 rounded-full transition-all duration-100 ease-linear"),style:{width:"".concat(g,"%")}})})]})]})})},Rc=h(void 0),Pc=function(n){var r=n.children,o=s([]),i=o[0],l=o[1],a=p((function(e){l((function(t){return t.filter((function(t){return t.id!==e}))}))}),[]),c=p((function(e){var t=Math.random().toString(36).substring(2,9),n=J(J({},e),{id:t,onClose:function(){return a(t)}});l((function(e){return K(K([],e,!0),[n],!1)}))}),[a]),d=p((function(e){return function(t,n){c({message:t,description:n,type:e})}}),[c]),h={showAlert:c,success:d("success"),error:d("error"),info:d("info"),warning:d("warning")};return t(Rc.Provider,{value:h,children:[r,e("div",{className:"toast-container",children:i.map((function(t){return e(Ic,J({},t),t.id)}))})]})},zc=function(){var e=u(Rc);if(void 0===e)throw new Error("useAlert must be used within a AlertProvider");return e},Lc=function(n){var r=n.isOpen,o=n.onClose,i=n.title,s=n.children,c=n.size,d=void 0===c?"md":c,h=n.position,u=void 0===h?"right":h,p=n.showCloseButton,f=void 0===p||p,m=n.closeOnOverlayClick,g=void 0===m||m,y=n.closeOnEscape,v=void 0===y||y,b=n.className,w=void 0===b?"":b,x=n.overlayClassName,k=void 0===x?"":x,S=n.contentClassName,C=void 0===S?"":S,M=n.headerClassName,O=void 0===M?"":M,N=n.footer,T=n.footerClassName,E=void 0===T?"":T,A=n.maxHeight,D=void 0!==A&&A,I=l(null),R=l(null);a((function(){var e;return r?(R.current=document.activeElement,null===(e=I.current)||void 0===e||e.focus(),document.body.style.overflow="hidden"):(document.body.style.overflow="unset",R.current&&R.current.focus()),function(){document.body.style.overflow="unset"}}),[r]),a((function(){var e=function(e){"Escape"===e.key&&v&&o()};return r&&document.addEventListener("keydown",e),function(){document.removeEventListener("keydown",e)}}),[r,v,o]);var P=function(e){e.target===e.currentTarget&&g&&o()};return r?t("div",{className:"fixed inset-0 z-50 ".concat(k),role:"dialog","aria-modal":"true","aria-labelledby":i?"modal-title":void 0,children:[e("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm transition-opacity duration-700",onClick:P}),e("div",{className:"fixed inset-0 flex p-4 ".concat({left:"items-start justify-start",right:"items-start justify-end",center:"items-center justify-center"}[u]),onClick:P,children:t("div",{ref:I,tabIndex:-1,className:"\n relative w-full ".concat({xs:"max-w-xs",sm:"max-w-sm",md:"max-w-md",lg:"max-w-lg",xl:"max-w-xl","2xl":"max-w-2xl",full:"max-w-full mx-4"}[d]," bg-white shadow-2xl transform transition-all duration-700 ease-out flex flex-col\n ").concat("left"===u||"right"===u?"h-full ".concat(D?"max-h-screen":""," rounded-2xl"):"rounded-2xl ".concat(D?"max-h-[90vh] overflow-hidden":""),"\n ").concat("center"===u?"animate-in fade-in-0 zoom-in-95":"left"===u?"animate-in slide-in-from-left-full":"animate-in slide-in-from-right-full","\n ").concat(w,"\n "),onClick:function(e){return e.stopPropagation()},children:[(i||f)&&t("div",{className:"flex items-center justify-between p-6 border-b border-gray-200 flex-shrink-0 ".concat(O),children:[i&&e("h2",{id:"modal-title",className:"text-xl font-semibold text-gray-900 truncate pr-4",children:i}),f&&e("button",{onClick:o,className:"flex items-center justify-center w-8 h-8 rounded-full text-gray-400 hover:text-gray-600 hover:bg-gray-100 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2","aria-label":"Close modal",children:e(V,{size:20})})]}),e("div",{className:"flex-1 min-h-0 ".concat(D?"overflow-y-auto":""," ").concat(C),children:e("div",!D||"left"!==u&&"right"!==u?{className:"p-6",children:s}:{className:"p-6 min-h-0 flex-1",children:s})}),N&&e("div",{className:"px-6 py-4 border-t border-gray-200 bg-gray-50 flex-shrink-0 rounded-2xl ".concat(E),children:N})]})})]}):null},Bc=function(){var n=r.useState(!1),o=n[0],i=n[1],s=r.useState("left"),l=s[0],a=s[1],c=r.useState("md"),d=c[0],h=c[1],u=t("div",{className:"flex justify-end space-x-3",children:[e("button",{onClick:function(){return i(!1)},className:"px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-lg hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 transition-colors duration-200",children:"Cancel"}),e("button",{onClick:function(){return i(!1)},className:"px-4 py-2 text-sm font-medium text-white bg-blue-600 rounded-lg hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 transition-colors duration-200",children:"Save Changes"})]});return t("div",{className:"p-8 space-y-4",children:[t("div",{className:"flex flex-wrap gap-4 mb-6",children:[t("div",{children:[e("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Position"}),t("select",{value:l,onChange:function(e){return a(e.target.value)},className:"border border-gray-300 rounded-md px-3 py-2 text-sm",children:[e("option",{value:"left",children:"Left"}),e("option",{value:"right",children:"Right"}),e("option",{value:"center",children:"Center"})]})]}),t("div",{children:[e("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Size"}),t("select",{value:d,onChange:function(e){return h(e.target.value)},className:"border border-gray-300 rounded-md px-3 py-2 text-sm",children:[e("option",{value:"xs",children:"Extra Small"}),e("option",{value:"sm",children:"Small"}),e("option",{value:"md",children:"Medium"}),e("option",{value:"lg",children:"Large"}),e("option",{value:"xl",children:"Extra Large"}),e("option",{value:"2xl",children:"2X Large"}),e("option",{value:"full",children:"Full Width"})]})]})]}),e("button",{onClick:function(){return i(!0)},className:"px-6 py-3 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors duration-200 font-medium",children:"Open Modal"}),e(Lc,{isOpen:o,onClose:function(){return i(!1)},title:"Example Modal",size:d,position:l,footer:u,maxHeight:"center"!==l,children:t("div",{className:"space-y-4",children:[e("p",{className:"text-gray-600",children:"This is an example of the multipurpose modal component. It supports different sizes, positions, and configurations."}),t("div",{className:"bg-gray-50 p-4 rounded-lg",children:[e("h4",{className:"font-medium text-gray-900 mb-2",children:"Features:"}),t("ul",{className:"text-sm text-gray-600 space-y-1 list-disc list-inside",children:[e("li",{children:"Multiple sizes (xs, sm, md, lg, xl, 2xl, full)"}),e("li",{children:"Three positions (left, right, center)"}),e("li",{children:"Customizable styling with className props"}),e("li",{children:"Keyboard navigation and accessibility"}),e("li",{children:"Click outside to close"}),e("li",{children:"Smooth animations"}),e("li",{children:"Optional footer with actions"})]})]}),("left"===l||"right"===l)&&e("div",{className:"space-y-2",children:Array.from({length:20},(function(e,n){return t("p",{className:"text-gray-600",children:["This is paragraph ",n+1," to demonstrate scrolling in side panels."]},n)}))})]})})]})};export{Rc as AlertContext,Pc as AlertProvider,b as Button,j as Card,W as CheckBox,H as EmptyStateCard,_ as ExportButton,q as FileUpload,U as Input,Lc as Modal,Bc as ModalExample,G as Search,X as Select,Dc as SelectButton,Ac as TextEditor,zc as useAlert};
|
|
51
51
|
//# sourceMappingURL=index.mjs.map
|