reactjs-tiptap-editor-pro 0.2.39 → 0.2.40

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.
@@ -118,7 +118,7 @@ img.ProseMirror-separator {
118
118
  *
119
119
  * This source code is licensed under the MIT license found in the
120
120
  * LICENSE file in the root directory of this source tree.
121
- */var yd;function sw(){return yd||(yd=1,process.env.NODE_ENV!=="production"&&function(){typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error);var n=x,e=yi;function t(u,d){return u===d&&(u!==0||1/u===1/d)||u!==u&&d!==d}var r=typeof Object.is=="function"?Object.is:t,o=e.useSyncExternalStore,i=n.useRef,s=n.useEffect,l=n.useMemo,a=n.useDebugValue;function c(u,d,f,h,m){var g=i(null),y;g.current===null?(y={hasValue:!1,value:null},g.current=y):y=g.current;var b=l(function(){var O=!1,C,N,E=function(I){if(!O){O=!0,C=I;var D=h(I);if(m!==void 0&&y.hasValue){var j=y.value;if(m(j,D))return N=j,j}return N=D,D}var P=C,J=N;if(r(P,I))return J;var Q=h(I);return m!==void 0&&m(J,Q)?J:(C=I,N=Q,Q)},k=f===void 0?null:f,A=function(){return E(d())},L=k===null?void 0:function(){return E(k())};return[A,L]},[d,f,h,m]),w=b[0],v=b[1],S=o(u,w,v);return s(function(){y.hasValue=!0,y.value=S},[S]),a(S),S}ss.useSyncExternalStoreWithSelector=c,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}()),ss}process.env.NODE_ENV==="production"?Na.exports=iw():Na.exports=sw();var lw=Na.exports;const aw=typeof window<"u"?x.useLayoutEffect:x.useEffect;class cw{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.lastSnapshot:(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 t=()=>{this.transactionNumber+=1,this.subscribers.forEach(o=>o())},r=this.editor;return r.on("transaction",t),()=>{r.off("transaction",t)}}}}function uw(n){var e;const[t]=x.useState(()=>new cw(n.editor)),r=lw.useSyncExternalStoreWithSelector(t.subscribe,t.getSnapshot,t.getServerSnapshot,n.selector,(e=n.equalityFn)!==null&&e!==void 0?e:ow);return aw(()=>t.watch(n.editor),[n.editor,t]),x.useDebugValue(r),r}const bd=process.env.NODE_ENV!=="production",Ra=typeof window>"u",dw=Ra||!!(typeof window<"u"&&window.next);class bc{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(t=>t())}getInitialEditor(){if(this.options.current.immediatelyRender===void 0)return Ra||dw?(bd&&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&&Ra&&bd)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:(...r)=>{var o,i;return(i=(o=this.options.current).onBeforeCreate)===null||i===void 0?void 0:i.call(o,...r)},onBlur:(...r)=>{var o,i;return(i=(o=this.options.current).onBlur)===null||i===void 0?void 0:i.call(o,...r)},onCreate:(...r)=>{var o,i;return(i=(o=this.options.current).onCreate)===null||i===void 0?void 0:i.call(o,...r)},onDestroy:(...r)=>{var o,i;return(i=(o=this.options.current).onDestroy)===null||i===void 0?void 0:i.call(o,...r)},onFocus:(...r)=>{var o,i;return(i=(o=this.options.current).onFocus)===null||i===void 0?void 0:i.call(o,...r)},onSelectionUpdate:(...r)=>{var o,i;return(i=(o=this.options.current).onSelectionUpdate)===null||i===void 0?void 0:i.call(o,...r)},onTransaction:(...r)=>{var o,i;return(i=(o=this.options.current).onTransaction)===null||i===void 0?void 0:i.call(o,...r)},onUpdate:(...r)=>{var o,i;return(i=(o=this.options.current).onUpdate)===null||i===void 0?void 0:i.call(o,...r)},onContentError:(...r)=>{var o,i;return(i=(o=this.options.current).onContentError)===null||i===void 0?void 0:i.call(o,...r)},onDrop:(...r)=>{var o,i;return(i=(o=this.options.current).onDrop)===null||i===void 0?void 0:i.call(o,...r)},onPaste:(...r)=>{var o,i;return(i=(o=this.options.current).onPaste)===null||i===void 0?void 0:i.call(o,...r)}};return new zx(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(r=>["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(r)?!0:r==="extensions"&&e.extensions&&t.extensions?e.extensions.length!==t.extensions.length?!1:e.extensions.every((o,i)=>{var s;return o===((s=t.extensions)===null||s===void 0?void 0:s[i])}):e[r]===t[r])}onRender(e){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&e.length===0?bc.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(this.previousDeps===null){this.previousDeps=e;return}if(this.previousDeps.length===e.length&&this.previousDeps.every((r,o)=>r===e[o]))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(()=>{if(this.isComponentMounted&&this.instanceId===e){t&&t.setOptions(this.options.current);return}t&&!t.isDestroyed&&(t.destroy(),this.instanceId===e&&this.setEditor(null))},1)}}function fw(n={},e=[]){const t=x.useRef(n);t.current=n;const[r]=x.useState(()=>new bc(t)),o=yi.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return x.useDebugValue(o),x.useEffect(r.onRender(e)),uw({editor:o,selector:({transactionNumber:i})=>n.shouldRerenderOnTransaction===!1?null:n.immediatelyRender&&i===0?0:i+1}),o}const hw=x.createContext({editor:null}),pw=()=>x.useContext(hw),mw=n=>{const[e,t]=x.useState(null),{editor:r}=pw();return x.useEffect(()=>{var o;if(!e||!((o=n.editor)===null||o===void 0)&&o.isDestroyed||r!=null&&r.isDestroyed)return;const{pluginKey:i="bubbleMenu",editor:s,tippyOptions:l={},updateDelay:a,shouldShow:c=null}=n,u=s||r;if(!u){console.warn("BubbleMenu component is not rendered inside of an editor component or does not have editor prop.");return}const d=Pm({updateDelay:a,editor:u,element:e,pluginKey:i,shouldShow:c,tippyOptions:l});return u.registerPlugin(d),()=>{u.unregisterPlugin(i)}},[n.editor,r,e]),x.createElement("div",{ref:t,className:n.className,style:{visibility:"hidden"}},n.children)},Lm=x.createContext({onDragStart:void 0}),Bm=()=>x.useContext(Lm),gw=n=>{const e=n.as||"div",{nodeViewContentRef:t}=Bm();return x.createElement(e,{...n,ref:t,"data-node-view-content":"",style:{whiteSpace:"pre-wrap",...n.style}})},hn=x.forwardRef((n,e)=>{const{onDragStart:t}=Bm(),r=n.as||"div";return x.createElement(r,{...n,ref:e,"data-node-view-wrapper":"",onDragStart:t,style:{whiteSpace:"normal",...n.style}})});function yw(n){return!!(typeof n=="function"&&n.prototype&&n.prototype.isReactComponent)}function bw(n){var e;return typeof n=="object"&&((e=n.$$typeof)===null||e===void 0?void 0:e.toString())==="Symbol(react.forward_ref)"}class zm{constructor(e,{editor:t,props:r={},as:o="div",className:i=""}){this.ref=null,this.id=Math.floor(Math.random()*4294967295).toString(),this.component=e,this.editor=t,this.props=r,this.element=document.createElement(o),this.element.classList.add("react-renderer"),i&&this.element.classList.add(...i.split(" ")),this.editor.isInitialized?Yh.flushSync(()=>{this.render()}):this.render()}render(){var e;const t=this.component,r=this.props,o=this.editor;(yw(t)||bw(t))&&(r.ref=i=>{this.ref=i}),this.reactElement=x.createElement(t,{...r}),(e=o==null?void 0:o.contentComponent)===null||e===void 0||e.setRenderer(this.id,this)}updateProps(e={}){this.props={...this.props,...e},this.render()}destroy(){var e;const t=this.editor;(e=t==null?void 0:t.contentComponent)===null||e===void 0||e.removeRenderer(this.id)}updateAttributes(e){Object.keys(e).forEach(t=>{this.element.setAttribute(t,e[t])})}}class vw extends Vx{mount(){const e={editor:this.editor,node:this.node,decorations:this.decorations,innerDecorations:this.innerDecorations,view:this.view,selected:!1,extension:this.extension,HTMLAttributes:this.HTMLAttributes,getPos:()=>this.getPos(),updateAttributes:(c={})=>this.updateAttributes(c),deleteNode:()=>this.deleteNode()};if(!this.component.displayName){const c=u=>u.charAt(0).toUpperCase()+u.substring(1);this.component.displayName=c(this.extension.name)}const o={onDragStart:this.onDragStart.bind(this),nodeViewContentRef:c=>{c&&this.contentDOMElement&&c.firstChild!==this.contentDOMElement&&c.appendChild(this.contentDOMElement)}},i=this.component,s=x.memo(c=>x.createElement(Lm.Provider,{value:o},x.createElement(i,c)));s.displayName="ReactNodeView",this.node.isLeaf?this.contentDOMElement=null:this.options.contentDOMElementTag?this.contentDOMElement=document.createElement(this.options.contentDOMElementTag):this.contentDOMElement=document.createElement(this.node.isInline?"span":"div"),this.contentDOMElement&&(this.contentDOMElement.dataset.nodeViewContentReact="",this.contentDOMElement.style.whiteSpace="inherit");let l=this.node.isInline?"span":"div";this.options.as&&(l=this.options.as);const{className:a=""}=this.options;this.handleSelectionUpdate=this.handleSelectionUpdate.bind(this),this.renderer=new zm(s,{editor:this.editor,props:e,as:l,className:`node-${this.node.type.name} ${a}`.trim()}),this.editor.on("selectionUpdate",this.handleSelectionUpdate),this.updateElementAttributes()}get dom(){var e;if(this.renderer.element.firstElementChild&&!(!((e=this.renderer.element.firstElementChild)===null||e===void 0)&&e.hasAttribute("data-node-view-wrapper")))throw Error("Please use the NodeViewWrapper component for your node view.");return this.renderer.element}get contentDOM(){return this.node.isLeaf?null:this.contentDOMElement}handleSelectionUpdate(){const{from:e,to:t}=this.editor.state.selection,r=this.getPos();if(typeof r=="number")if(e<=r&&t>=r+this.node.nodeSize){if(this.renderer.props.selected)return;this.selectNode()}else{if(!this.renderer.props.selected)return;this.deselectNode()}}update(e,t,r){const o=i=>{this.renderer.updateProps(i),typeof this.options.attrs=="function"&&this.updateElementAttributes()};if(e.type!==this.node.type)return!1;if(typeof this.options.update=="function"){const i=this.node,s=this.decorations,l=this.innerDecorations;return this.node=e,this.decorations=t,this.innerDecorations=r,this.options.update({oldNode:i,oldDecorations:s,newNode:e,newDecorations:t,oldInnerDecorations:l,innerDecorations:r,updateProps:()=>o({node:e,decorations:t,innerDecorations:r})})}return e===this.node&&this.decorations===t&&this.innerDecorations===r||(this.node=e,this.decorations=t,this.innerDecorations=r,o({node:e,decorations:t,innerDecorations:r})),!0}selectNode(){this.renderer.updateProps({selected:!0}),this.renderer.element.classList.add("ProseMirror-selectednode")}deselectNode(){this.renderer.updateProps({selected:!1}),this.renderer.element.classList.remove("ProseMirror-selectednode")}destroy(){this.renderer.destroy(),this.editor.off("selectionUpdate",this.handleSelectionUpdate),this.contentDOMElement=null}updateElementAttributes(){if(this.options.attrs){let e={};if(typeof this.options.attrs=="function"){const t=this.editor.extensionManager.attributes,r=Jo(this.node,t);e=this.options.attrs({node:this.node,HTMLAttributes:r})}else e=this.options.attrs;this.renderer.updateAttributes(e)}}}function pn(n,e){return t=>t.editor.contentComponent?new vw(n,t,e):{}}var $m=typeof global=="object"&&global&&global.Object===Object&&global,xw=typeof self=="object"&&self&&self.Object===Object&&self,vc=$m||xw||Function("return this")(),Vr=vc.Symbol,Fm=Object.prototype,ww=Fm.hasOwnProperty,Sw=Fm.toString,br=Vr?Vr.toStringTag:void 0;function Cw(n){var e=ww.call(n,br),t=n[br];try{n[br]=void 0;var r=!0}catch{}var o=Sw.call(n);return r&&(e?n[br]=t:delete n[br]),o}var kw=Object.prototype,Tw=kw.toString;function Mw(n){return Tw.call(n)}var Ew="[object Null]",Ow="[object Undefined]",vd=Vr?Vr.toStringTag:void 0;function xc(n){return n==null?n===void 0?Ow:Ew:vd&&vd in Object(n)?Cw(n):Mw(n)}function wc(n){return n!=null&&typeof n=="object"}var Aw="[object Symbol]";function qm(n){return typeof n=="symbol"||wc(n)&&xc(n)==Aw}var Nw=/\s/;function Rw(n){for(var e=n.length;e--&&Nw.test(n.charAt(e)););return e}var Iw=/^\s+/;function _w(n){return n&&n.slice(0,Rw(n)+1).replace(Iw,"")}function Hr(n){var e=typeof n;return n!=null&&(e=="object"||e=="function")}var xd=NaN,Dw=/^[-+]0x[0-9a-f]+$/i,jw=/^0b[01]+$/i,Pw=/^0o[0-7]+$/i,Lw=parseInt;function nr(n){if(typeof n=="number")return n;if(qm(n))return xd;if(Hr(n)){var e=typeof n.valueOf=="function"?n.valueOf():n;n=Hr(e)?e+"":e}if(typeof n!="string")return n===0?n:+n;n=_w(n);var t=jw.test(n);return t||Pw.test(n)?Lw(n.slice(2),t?2:8):Dw.test(n)?xd:+n}function Bw(n,e,t){return n===n&&(t!==void 0&&(n=n<=t?n:t),e!==void 0&&(n=n>=e?n:e)),n}function Vm(n,e,t){return t===void 0&&(t=e,e=void 0),t!==void 0&&(t=nr(t),t=t===t?t:0),e!==void 0&&(e=nr(e),e=e===e?e:0),Bw(nr(n),e,t)}var ls=function(){return vc.Date.now()},zw="Expected a function",$w=Math.max,Fw=Math.min;function bi(n,e,t){var r,o,i,s,l,a,c=0,u=!1,d=!1,f=!0;if(typeof n!="function")throw new TypeError(zw);e=nr(e)||0,Hr(t)&&(u=!!t.leading,d="maxWait"in t,i=d?$w(nr(t.maxWait)||0,e):i,f="trailing"in t?!!t.trailing:f);function h(C){var N=r,E=o;return r=o=void 0,c=C,s=n.apply(E,N),s}function m(C){return c=C,l=setTimeout(b,e),u?h(C):s}function g(C){var N=C-a,E=C-c,k=e-N;return d?Fw(k,i-E):k}function y(C){var N=C-a,E=C-c;return a===void 0||N>=e||N<0||d&&E>=i}function b(){var C=ls();if(y(C))return w(C);l=setTimeout(b,g(C))}function w(C){return l=void 0,f&&r?h(C):(r=o=void 0,s)}function v(){l!==void 0&&clearTimeout(l),c=0,r=a=o=l=void 0}function S(){return l===void 0?s:w(ls())}function O(){var C=ls(),N=y(C);if(r=arguments,o=this,a=C,N){if(l===void 0)return m(a);if(d)return clearTimeout(l),l=setTimeout(b,e),h(a)}return l===void 0&&(l=setTimeout(b,e)),s}return O.cancel=v,O.flush=S,O}var qw="[object Number]";function Zo(n){return typeof n=="number"||wc(n)&&xc(n)==qw}var Vw="Expected a function";function qt(n,e,t){var r=!0,o=!0;if(typeof n!="function")throw new TypeError(Vw);return Hr(t)&&(r="leading"in t?!!t.leading:r,o="trailing"in t?!!t.trailing:o),bi(n,e,{leading:r,maxWait:e,trailing:o})}function Hm(n){var e,t,r="";if(typeof n=="string"||typeof n=="number")r+=n;else if(typeof n=="object")if(Array.isArray(n)){var o=n.length;for(e=0;e<o;e++)n[e]&&(t=Hm(n[e]))&&(r&&(r+=" "),r+=t)}else for(t in n)n[t]&&(r&&(r+=" "),r+=t);return r}function yt(){for(var n,e,t=0,r="",o=arguments.length;t<o;t++)(n=arguments[t])&&(e=Hm(n))&&(r&&(r+=" "),r+=e);return r}const Sc="-",Hw=n=>{const e=Uw(n),{conflictingClassGroups:t,conflictingClassGroupModifiers:r}=n;return{getClassGroupId:s=>{const l=s.split(Sc);return l[0]===""&&l.length!==1&&l.shift(),Wm(l,e)||Ww(s)},getConflictingClassGroupIds:(s,l)=>{const a=t[s]||[];return l&&r[s]?[...a,...r[s]]:a}}},Wm=(n,e)=>{var s;if(n.length===0)return e.classGroupId;const t=n[0],r=e.nextPart.get(t),o=r?Wm(n.slice(1),r):void 0;if(o)return o;if(e.validators.length===0)return;const i=n.join(Sc);return(s=e.validators.find(({validator:l})=>l(i)))==null?void 0:s.classGroupId},wd=/^\[(.+)\]$/,Ww=n=>{if(wd.test(n)){const e=wd.exec(n)[1],t=e==null?void 0:e.substring(0,e.indexOf(":"));if(t)return"arbitrary.."+t}},Uw=n=>{const{theme:e,prefix:t}=n,r={nextPart:new Map,validators:[]};return Kw(Object.entries(n.classGroups),t).forEach(([i,s])=>{Ia(s,r,i,e)}),r},Ia=(n,e,t,r)=>{n.forEach(o=>{if(typeof o=="string"){const i=o===""?e:Sd(e,o);i.classGroupId=t;return}if(typeof o=="function"){if(Gw(o)){Ia(o(r),e,t,r);return}e.validators.push({validator:o,classGroupId:t});return}Object.entries(o).forEach(([i,s])=>{Ia(s,Sd(e,i),t,r)})})},Sd=(n,e)=>{let t=n;return e.split(Sc).forEach(r=>{t.nextPart.has(r)||t.nextPart.set(r,{nextPart:new Map,validators:[]}),t=t.nextPart.get(r)}),t},Gw=n=>n.isThemeGetter,Kw=(n,e)=>e?n.map(([t,r])=>{const o=r.map(i=>typeof i=="string"?e+i:typeof i=="object"?Object.fromEntries(Object.entries(i).map(([s,l])=>[e+s,l])):i);return[t,o]}):n,Jw=n=>{if(n<1)return{get:()=>{},set:()=>{}};let e=0,t=new Map,r=new Map;const o=(i,s)=>{t.set(i,s),e++,e>n&&(e=0,r=t,t=new Map)};return{get(i){let s=t.get(i);if(s!==void 0)return s;if((s=r.get(i))!==void 0)return o(i,s),s},set(i,s){t.has(i)?t.set(i,s):o(i,s)}}},Um="!",Xw=n=>{const{separator:e,experimentalParseClassName:t}=n,r=e.length===1,o=e[0],i=e.length,s=l=>{const a=[];let c=0,u=0,d;for(let y=0;y<l.length;y++){let b=l[y];if(c===0){if(b===o&&(r||l.slice(y,y+i)===e)){a.push(l.slice(u,y)),u=y+i;continue}if(b==="/"){d=y;continue}}b==="["?c++:b==="]"&&c--}const f=a.length===0?l:l.substring(u),h=f.startsWith(Um),m=h?f.substring(1):f,g=d&&d>u?d-u:void 0;return{modifiers:a,hasImportantModifier:h,baseClassName:m,maybePostfixModifierPosition:g}};return t?l=>t({className:l,parseClassName:s}):s},Yw=n=>{if(n.length<=1)return n;const e=[];let t=[];return n.forEach(r=>{r[0]==="["?(e.push(...t.sort(),r),t=[]):t.push(r)}),e.push(...t.sort()),e},Zw=n=>({cache:Jw(n.cacheSize),parseClassName:Xw(n),...Hw(n)}),Qw=/\s+/,eS=(n,e)=>{const{parseClassName:t,getClassGroupId:r,getConflictingClassGroupIds:o}=e,i=[],s=n.trim().split(Qw);let l="";for(let a=s.length-1;a>=0;a-=1){const c=s[a],{modifiers:u,hasImportantModifier:d,baseClassName:f,maybePostfixModifierPosition:h}=t(c);let m=!!h,g=r(m?f.substring(0,h):f);if(!g){if(!m){l=c+(l.length>0?" "+l:l);continue}if(g=r(f),!g){l=c+(l.length>0?" "+l:l);continue}m=!1}const y=Yw(u).join(":"),b=d?y+Um:y,w=b+g;if(i.includes(w))continue;i.push(w);const v=o(g,m);for(let S=0;S<v.length;++S){const O=v[S];i.push(b+O)}l=c+(l.length>0?" "+l:l)}return l};function tS(){let n=0,e,t,r="";for(;n<arguments.length;)(e=arguments[n++])&&(t=Gm(e))&&(r&&(r+=" "),r+=t);return r}const Gm=n=>{if(typeof n=="string")return n;let e,t="";for(let r=0;r<n.length;r++)n[r]&&(e=Gm(n[r]))&&(t&&(t+=" "),t+=e);return t};function nS(n,...e){let t,r,o,i=s;function s(a){const c=e.reduce((u,d)=>d(u),n());return t=Zw(c),r=t.cache.get,o=t.cache.set,i=l,l(a)}function l(a){const c=r(a);if(c)return c;const u=eS(a,t);return o(a,u),u}return function(){return i(tS.apply(null,arguments))}}const ke=n=>{const e=t=>t[n]||[];return e.isThemeGetter=!0,e},Km=/^\[(?:([a-z-]+):)?(.+)\]$/i,rS=/^\d+\/\d+$/,oS=new Set(["px","full","screen"]),iS=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,sS=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,lS=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,aS=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,cS=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Dt=n=>rr(n)||oS.has(n)||rS.test(n),Ut=n=>ur(n,"length",yS),rr=n=>!!n&&!Number.isNaN(Number(n)),as=n=>ur(n,"number",rr),vr=n=>!!n&&Number.isInteger(Number(n)),uS=n=>n.endsWith("%")&&rr(n.slice(0,-1)),le=n=>Km.test(n),Gt=n=>iS.test(n),dS=new Set(["length","size","percentage"]),fS=n=>ur(n,dS,Jm),hS=n=>ur(n,"position",Jm),pS=new Set(["image","url"]),mS=n=>ur(n,pS,vS),gS=n=>ur(n,"",bS),xr=()=>!0,ur=(n,e,t)=>{const r=Km.exec(n);return r?r[1]?typeof e=="string"?r[1]===e:e.has(r[1]):t(r[2]):!1},yS=n=>sS.test(n)&&!lS.test(n),Jm=()=>!1,bS=n=>aS.test(n),vS=n=>cS.test(n),xS=()=>{const n=ke("colors"),e=ke("spacing"),t=ke("blur"),r=ke("brightness"),o=ke("borderColor"),i=ke("borderRadius"),s=ke("borderSpacing"),l=ke("borderWidth"),a=ke("contrast"),c=ke("grayscale"),u=ke("hueRotate"),d=ke("invert"),f=ke("gap"),h=ke("gradientColorStops"),m=ke("gradientColorStopPositions"),g=ke("inset"),y=ke("margin"),b=ke("opacity"),w=ke("padding"),v=ke("saturate"),S=ke("scale"),O=ke("sepia"),C=ke("skew"),N=ke("space"),E=ke("translate"),k=()=>["auto","contain","none"],A=()=>["auto","hidden","clip","visible","scroll"],L=()=>["auto",le,e],I=()=>[le,e],D=()=>["",Dt,Ut],j=()=>["auto",rr,le],P=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],J=()=>["solid","dashed","dotted","double","none"],Q=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],pe=()=>["start","end","center","between","around","evenly","stretch"],ce=()=>["","0",le],ut=()=>["auto","avoid","all","avoid-page","page","left","right","column"],Me=()=>[rr,le];return{cacheSize:500,separator:":",theme:{colors:[xr],spacing:[Dt,Ut],blur:["none","",Gt,le],brightness:Me(),borderColor:[n],borderRadius:["none","","full",Gt,le],borderSpacing:I(),borderWidth:D(),contrast:Me(),grayscale:ce(),hueRotate:Me(),invert:ce(),gap:I(),gradientColorStops:[n],gradientColorStopPositions:[uS,Ut],inset:L(),margin:L(),opacity:Me(),padding:I(),saturate:Me(),scale:Me(),sepia:ce(),skew:Me(),space:I(),translate:I()},classGroups:{aspect:[{aspect:["auto","square","video",le]}],container:["container"],columns:[{columns:[Gt]}],"break-after":[{"break-after":ut()}],"break-before":[{"break-before":ut()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...P(),le]}],overflow:[{overflow:A()}],"overflow-x":[{"overflow-x":A()}],"overflow-y":[{"overflow-y":A()}],overscroll:[{overscroll:k()}],"overscroll-x":[{"overscroll-x":k()}],"overscroll-y":[{"overscroll-y":k()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[g]}],"inset-x":[{"inset-x":[g]}],"inset-y":[{"inset-y":[g]}],start:[{start:[g]}],end:[{end:[g]}],top:[{top:[g]}],right:[{right:[g]}],bottom:[{bottom:[g]}],left:[{left:[g]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",vr,le]}],basis:[{basis:L()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",le]}],grow:[{grow:ce()}],shrink:[{shrink:ce()}],order:[{order:["first","last","none",vr,le]}],"grid-cols":[{"grid-cols":[xr]}],"col-start-end":[{col:["auto",{span:["full",vr,le]},le]}],"col-start":[{"col-start":j()}],"col-end":[{"col-end":j()}],"grid-rows":[{"grid-rows":[xr]}],"row-start-end":[{row:["auto",{span:[vr,le]},le]}],"row-start":[{"row-start":j()}],"row-end":[{"row-end":j()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",le]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",le]}],gap:[{gap:[f]}],"gap-x":[{"gap-x":[f]}],"gap-y":[{"gap-y":[f]}],"justify-content":[{justify:["normal",...pe()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...pe(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...pe(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[w]}],px:[{px:[w]}],py:[{py:[w]}],ps:[{ps:[w]}],pe:[{pe:[w]}],pt:[{pt:[w]}],pr:[{pr:[w]}],pb:[{pb:[w]}],pl:[{pl:[w]}],m:[{m:[y]}],mx:[{mx:[y]}],my:[{my:[y]}],ms:[{ms:[y]}],me:[{me:[y]}],mt:[{mt:[y]}],mr:[{mr:[y]}],mb:[{mb:[y]}],ml:[{ml:[y]}],"space-x":[{"space-x":[N]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[N]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",le,e]}],"min-w":[{"min-w":[le,e,"min","max","fit"]}],"max-w":[{"max-w":[le,e,"none","full","min","max","fit","prose",{screen:[Gt]},Gt]}],h:[{h:[le,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[le,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[le,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[le,e,"auto","min","max","fit"]}],"font-size":[{text:["base",Gt,Ut]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",as]}],"font-family":[{font:[xr]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",le]}],"line-clamp":[{"line-clamp":["none",rr,as]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Dt,le]}],"list-image":[{"list-image":["none",le]}],"list-style-type":[{list:["none","disc","decimal",le]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[n]}],"placeholder-opacity":[{"placeholder-opacity":[b]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[n]}],"text-opacity":[{"text-opacity":[b]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...J(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Dt,Ut]}],"underline-offset":[{"underline-offset":["auto",Dt,le]}],"text-decoration-color":[{decoration:[n]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:I()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",le]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",le]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[b]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...P(),hS]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",fS]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},mS]}],"bg-color":[{bg:[n]}],"gradient-from-pos":[{from:[m]}],"gradient-via-pos":[{via:[m]}],"gradient-to-pos":[{to:[m]}],"gradient-from":[{from:[h]}],"gradient-via":[{via:[h]}],"gradient-to":[{to:[h]}],rounded:[{rounded:[i]}],"rounded-s":[{"rounded-s":[i]}],"rounded-e":[{"rounded-e":[i]}],"rounded-t":[{"rounded-t":[i]}],"rounded-r":[{"rounded-r":[i]}],"rounded-b":[{"rounded-b":[i]}],"rounded-l":[{"rounded-l":[i]}],"rounded-ss":[{"rounded-ss":[i]}],"rounded-se":[{"rounded-se":[i]}],"rounded-ee":[{"rounded-ee":[i]}],"rounded-es":[{"rounded-es":[i]}],"rounded-tl":[{"rounded-tl":[i]}],"rounded-tr":[{"rounded-tr":[i]}],"rounded-br":[{"rounded-br":[i]}],"rounded-bl":[{"rounded-bl":[i]}],"border-w":[{border:[l]}],"border-w-x":[{"border-x":[l]}],"border-w-y":[{"border-y":[l]}],"border-w-s":[{"border-s":[l]}],"border-w-e":[{"border-e":[l]}],"border-w-t":[{"border-t":[l]}],"border-w-r":[{"border-r":[l]}],"border-w-b":[{"border-b":[l]}],"border-w-l":[{"border-l":[l]}],"border-opacity":[{"border-opacity":[b]}],"border-style":[{border:[...J(),"hidden"]}],"divide-x":[{"divide-x":[l]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[l]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[b]}],"divide-style":[{divide:J()}],"border-color":[{border:[o]}],"border-color-x":[{"border-x":[o]}],"border-color-y":[{"border-y":[o]}],"border-color-s":[{"border-s":[o]}],"border-color-e":[{"border-e":[o]}],"border-color-t":[{"border-t":[o]}],"border-color-r":[{"border-r":[o]}],"border-color-b":[{"border-b":[o]}],"border-color-l":[{"border-l":[o]}],"divide-color":[{divide:[o]}],"outline-style":[{outline:["",...J()]}],"outline-offset":[{"outline-offset":[Dt,le]}],"outline-w":[{outline:[Dt,Ut]}],"outline-color":[{outline:[n]}],"ring-w":[{ring:D()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[n]}],"ring-opacity":[{"ring-opacity":[b]}],"ring-offset-w":[{"ring-offset":[Dt,Ut]}],"ring-offset-color":[{"ring-offset":[n]}],shadow:[{shadow:["","inner","none",Gt,gS]}],"shadow-color":[{shadow:[xr]}],opacity:[{opacity:[b]}],"mix-blend":[{"mix-blend":[...Q(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":Q()}],filter:[{filter:["","none"]}],blur:[{blur:[t]}],brightness:[{brightness:[r]}],contrast:[{contrast:[a]}],"drop-shadow":[{"drop-shadow":["","none",Gt,le]}],grayscale:[{grayscale:[c]}],"hue-rotate":[{"hue-rotate":[u]}],invert:[{invert:[d]}],saturate:[{saturate:[v]}],sepia:[{sepia:[O]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[t]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[a]}],"backdrop-grayscale":[{"backdrop-grayscale":[c]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[u]}],"backdrop-invert":[{"backdrop-invert":[d]}],"backdrop-opacity":[{"backdrop-opacity":[b]}],"backdrop-saturate":[{"backdrop-saturate":[v]}],"backdrop-sepia":[{"backdrop-sepia":[O]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[s]}],"border-spacing-x":[{"border-spacing-x":[s]}],"border-spacing-y":[{"border-spacing-y":[s]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",le]}],duration:[{duration:Me()}],ease:[{ease:["linear","in","out","in-out",le]}],delay:[{delay:Me()}],animate:[{animate:["none","spin","ping","pulse","bounce",le]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[S]}],"scale-x":[{"scale-x":[S]}],"scale-y":[{"scale-y":[S]}],rotate:[{rotate:[vr,le]}],"translate-x":[{"translate-x":[E]}],"translate-y":[{"translate-y":[E]}],"skew-x":[{"skew-x":[C]}],"skew-y":[{"skew-y":[C]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",le]}],accent:[{accent:["auto",n]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",le]}],"caret-color":[{caret:[n]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":I()}],"scroll-mx":[{"scroll-mx":I()}],"scroll-my":[{"scroll-my":I()}],"scroll-ms":[{"scroll-ms":I()}],"scroll-me":[{"scroll-me":I()}],"scroll-mt":[{"scroll-mt":I()}],"scroll-mr":[{"scroll-mr":I()}],"scroll-mb":[{"scroll-mb":I()}],"scroll-ml":[{"scroll-ml":I()}],"scroll-p":[{"scroll-p":I()}],"scroll-px":[{"scroll-px":I()}],"scroll-py":[{"scroll-py":I()}],"scroll-ps":[{"scroll-ps":I()}],"scroll-pe":[{"scroll-pe":I()}],"scroll-pt":[{"scroll-pt":I()}],"scroll-pr":[{"scroll-pr":I()}],"scroll-pb":[{"scroll-pb":I()}],"scroll-pl":[{"scroll-pl":I()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",le]}],fill:[{fill:[n,"none"]}],"stroke-w":[{stroke:[Dt,Ut,as]}],stroke:[{stroke:[n,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},wS=nS(xS);function H(...n){return wS(yt(n))}let cs;function us(){return cs===void 0&&(cs=navigator.platform.includes("Mac")),cs}function Xm(n){return`${n}`.toLowerCase()==="mod"?us()?"⌘":"Ctrl":`${n}`.toLowerCase()==="alt"?us()?"⌥":"Alt":`${n}`.toLowerCase()==="shift"?us()?"⇧":"Shift":n}function Ym(n){return n.map(Xm).join(" ")}const St=x.forwardRef((n,e)=>{const{icon:t=void 0,tooltip:r=void 0,disabled:o=!1,customClass:i="",loading:s=void 0,shortcutKeys:l=void 0,tooltipOptions:a={},action:c=void 0,isActive:u=void 0,children:d,asChild:f=!1,upload:h=!1,...m}=n,g=f?Zh.Slot:Ec;return p.jsxs(ug,{children:[p.jsx(dg,{asChild:!0,children:p.jsxs(g,{"data-state":u!=null&&u()?"on":"off",onClick:c,ref:e,size:"sm",className:H("w-[32px] h-[32px]",i),disabled:o,...m,children:[t&&p.jsx(Rn,{name:t,className:"size-4"}),d]})}),r&&p.jsx(Oc,{...a,children:p.jsxs("div",{className:"flex max-w-24 flex-col items-center text-center",children:[p.jsx("div",{children:r}),!!(l!=null&&l.length)&&p.jsx("span",{children:Ym(l)})]})})]})});function vi(n){function e(){const i=x.useRef(n),s=x.useCallback(()=>i.current,[]),l=x.useRef(new Set),a=x.useCallback(u=>{i.current={...i.current,...u},l.current.forEach(d=>d())},[]),c=x.useCallback(u=>(l.current.add(u),()=>l.current.delete(u)),[]);return{get:s,set:a,subscribe:c}}const t=x.createContext(null);function r({children:i}){return p.jsx(t.Provider,{value:e(),children:i})}function o(i){const s=x.useContext(t);if(!s)throw new Error("Store not found");return[x.useSyncExternalStore(s.subscribe,()=>i(s.get()),()=>i(n)),s.set]}return{Provider:r,useStore:o}}vi({value:!1});vi({value:!1});const{Provider:SS,useStore:Zm}=vi({value:!1}),{Provider:CS,useStore:Qm}=vi({value:"light"});oe.d("0");function Cc(n,e){return window.addEventListener(n,e),()=>{window.removeEventListener(n,e)}}function xi(n,e){window.dispatchEvent(new CustomEvent(n,{detail:e}))}const dr={UPLOAD_IMAGE:n=>`UPLOAD_IMAGE-${n}`,UPLOAD_VIDEO:n=>`UPLOAD_VIDEO-${n}`,EDIT:n=>`EDIT-${n}`,UPDATE_THEME:n=>`UPDATE_THEME-${n}`,SEARCH_REPLCE:"SEARCH_REPLACE"};function eg(){const[n]=Zm(e=>e.value);return n}const kS={setDisable:(n,e)=>{xi(dr.EDIT(n),e)}};function TS(n,e){const{state:t}=e,r=t.selection.$anchor;let o=!1;if(r.depth)for(let i=r.depth;i>0;i--)r.node(i).type.name===n&&(e.dispatchTransaction&&e.dispatchTransaction(t.tr.delete(r.before(i),r.after(i)).scrollIntoView()),o=!0);else{const i=t.selection.node;i&&i.type.name===n&&(e.chain().deleteSelection().run(),o=!0)}if(!o){const i=r.pos;if(i){const s=t.tr.doc.nodeAt(i);s&&s.type.name===n&&(e.dispatchTransaction&&e.dispatchTransaction(t.tr.delete(i,i+s.nodeSize)),o=!0)}}return o}function tg(n,e,t){return n<e?e:n>t?t:n}const MS=n=>typeof n=="number",ES=n=>typeof n=="string",OS=n=>typeof n=="function";function AS(n,e="px"){if(!n)return n;const t=MS(n)?String(n):n,r=Number.parseFloat(t),o=t.match(/[%a-z]+$/i),i=o?o[0]:e;return Number.isNaN(r)?n:r+i}function NS(n,e){if(!n)return!1;const{extensions:t=[]}=(n==null?void 0:n.extensionManager)??{};return!!t.find(o=>o.name===e)}function RS(n){return n.map(e=>ES(e)?{value:e,name:e}:e)}const Cd=n=>typeof n=="boolean"?`${n}`:n===0?"0":n,kd=yt,wi=(n,e)=>t=>{var r;if((e==null?void 0:e.variants)==null)return kd(n,t==null?void 0:t.class,t==null?void 0:t.className);const{variants:o,defaultVariants:i}=e,s=Object.keys(o).map(c=>{const u=t==null?void 0:t[c],d=i==null?void 0:i[c];if(u===null)return null;const f=Cd(u)||Cd(d);return o[c][f]}),l=t&&Object.entries(t).reduce((c,u)=>{let[d,f]=u;return f===void 0||(c[d]=f),c},{}),a=e==null||(r=e.compoundVariants)===null||r===void 0?void 0:r.reduce((c,u)=>{let{class:d,className:f,...h}=u;return Object.entries(h).every(m=>{let[g,y]=m;return Array.isArray(y)?y.includes({...i,...l}[g]):{...i,...l}[g]===y})?[...c,d,f]:c},[]);return kd(n,s,a,t==null?void 0:t.class,t==null?void 0:t.className)},IS=wi("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"!bg-primary !text-primary-foreground hover:!bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),Ve=we.forwardRef(({className:n,variant:e,size:t,asChild:r=!1,...o},i)=>{const s=r?Zh.Slot:"button";return p.jsx(s,{className:H(IS({variant:e,size:t,className:n})),ref:i,...o})});Ve.displayName="Button";const _S=Oe.Root,DS=Oe.Trigger,jS=Oe.Portal,PS=Oe.Sub,ng=we.forwardRef(({className:n,inset:e,children:t,...r},o)=>p.jsxs(Oe.SubTrigger,{ref:o,className:H("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",e&&"pl-8",n),...r,children:[t,p.jsx(B.ChevronRight,{className:"ml-auto size-4"})]}));ng.displayName=Oe.SubTrigger.displayName;const rg=we.forwardRef(({className:n,...e},t)=>p.jsx(Oe.SubContent,{ref:t,className:H("z-50 min-w-[8rem] overflow-hidden rounded-md !border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",n),...e}));rg.displayName=Oe.SubContent.displayName;const og=we.forwardRef(({className:n,sideOffset:e=4,container:t,...r},o)=>p.jsx(Oe.Portal,{container:t,children:p.jsx(Oe.Content,{ref:o,sideOffset:e,className:H("z-50 min-w-[8rem] overflow-hidden rounded-md !border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",n),...r})}));og.displayName=Oe.Content.displayName;const ig=we.forwardRef(({className:n,inset:e,...t},r)=>p.jsx(Oe.Item,{ref:r,className:H("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e&&"pl-8",n),...t}));ig.displayName=Oe.Item.displayName;const sg=we.forwardRef(({className:n,children:e,checked:t,...r},o)=>p.jsxs(Oe.CheckboxItem,{checked:t,ref:o,className:H("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",n),...r,children:[p.jsx("span",{className:"absolute left-2 flex size-3.5 items-center justify-center",children:p.jsx(Oe.ItemIndicator,{children:p.jsx(B.Check,{className:"size-4"})})}),e]}));sg.displayName=Oe.CheckboxItem.displayName;const LS=we.forwardRef(({className:n,children:e,...t},r)=>p.jsxs(Oe.RadioItem,{ref:r,className:H("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",n),...t,children:[p.jsx("span",{className:"absolute left-2 flex size-3.5 items-center justify-center",children:p.jsx(Oe.ItemIndicator,{children:p.jsx(B.Circle,{className:"size-2 fill-current"})})}),e]}));LS.displayName=Oe.RadioItem.displayName;const BS=we.forwardRef(({className:n,inset:e,...t},r)=>p.jsx(Oe.Label,{ref:r,className:H("px-2 py-1.5 text-sm font-semibold",e&&"pl-8",n),...t}));BS.displayName=Oe.Label.displayName;const lg=we.forwardRef(({className:n,...e},t)=>p.jsx(Oe.Separator,{className:H("-mx-1 my-1 h-px bg-muted",n),ref:t,...e}));lg.displayName=Oe.Separator.displayName;function ag({className:n,...e}){return p.jsx("span",{className:H("ml-auto text-xs tracking-widest opacity-60",n),...e})}ag.displayName="DropdownMenuShortcut";const Rt=we.forwardRef(({className:n,type:e,...t},r)=>p.jsx("input",{type:e,className:H("flex h-10 w-full rounded-md !border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50",n),ref:r,...t}));Rt.displayName="Input";const zS=wi("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),ln=we.forwardRef(({className:n,...e},t)=>p.jsx(Qh.Root,{ref:t,className:H(zS(),n),...e}));ln.displayName=Qh.Root.displayName;const Pn=Rr.Root,Ln=Rr.Trigger,mn=we.forwardRef(({className:n,align:e="center",sideOffset:t=4,...r},o)=>p.jsx(Rr.Portal,{children:p.jsx(Rr.Content,{ref:o,align:e,sideOffset:t,className:H("z-50 w-72 rounded-md !border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",n),...r})}));mn.displayName=Rr.Content.displayName;const kc=we.forwardRef(({className:n,orientation:e="horizontal",decorative:t=!0,...r},o)=>p.jsx(tp.Root,{ref:o,decorative:t,orientation:e,className:H("shrink-0 bg-border",e==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",n),...r}));kc.displayName=tp.Root.displayName;const Tc=we.forwardRef(({className:n,...e},t)=>p.jsx(aa.Root,{className:H("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",n),...e,ref:t,children:p.jsx(aa.Thumb,{className:H("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));Tc.displayName=aa.Root.displayName;const cg=_n.Root,Mc=we.forwardRef(({className:n,...e},t)=>p.jsx(_n.List,{ref:t,className:H("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",n),...e}));Mc.displayName=_n.List.displayName;const Wr=we.forwardRef(({className:n,...e},t)=>p.jsx(_n.Trigger,{ref:t,className:H("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",n),...e}));Wr.displayName=_n.Trigger.displayName;const Ur=we.forwardRef(({className:n,...e},t)=>p.jsx(_n.Content,{ref:t,className:H("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",n),...e}));Ur.displayName=_n.Content.displayName;const $S=wi("inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors hover:bg-muted hover:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent hover:bg-accent hover:text-accent-foreground"},size:{default:"h-10 px-3",sm:"h-9 px-2",lg:"h-11 px-5"}},defaultVariants:{variant:"default",size:"default"}}),Ec=we.forwardRef(({className:n,variant:e,size:t,...r},o)=>p.jsx(ep.Root,{ref:o,className:H($S({variant:e,size:t,className:n})),...r}));Ec.displayName=ep.Root.displayName;const FS=Xr.Provider,ug=Xr.Root,dg=Xr.Trigger,Oc=we.forwardRef(({className:n,sideOffset:e=4,...t},r)=>p.jsx(Xr.Content,{ref:r,sideOffset:e,className:H("z-50 overflow-hidden rounded-md !border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",n),...t}));Oc.displayName=Xr.Content.displayName;const qS=1,VS=1e6;let ds=0;function HS(){return ds=(ds+1)%Number.MAX_SAFE_INTEGER,ds.toString()}const fs=new Map;function Td(n){if(fs.has(n))return;const e=setTimeout(()=>{fs.delete(n),Nr({type:"REMOVE_TOAST",toastId:n})},VS);fs.set(n,e)}function WS(n,e){switch(e.type){case"ADD_TOAST":return{...n,toasts:[e.toast,...n.toasts].slice(0,qS)};case"UPDATE_TOAST":return{...n,toasts:n.toasts.map(t=>t.id===e.toast.id?{...t,...e.toast}:t)};case"DISMISS_TOAST":{const{toastId:t}=e;return t?Td(t):n.toasts.forEach(r=>{Td(r.id)}),{...n,toasts:n.toasts.map(r=>r.id===t||t===void 0?{...r,open:!1}:r)}}case"REMOVE_TOAST":return e.toastId===void 0?{...n,toasts:[]}:{...n,toasts:n.toasts.filter(t=>t.id!==e.toastId)}}}const Do=[];let jo={toasts:[]};function Nr(n){jo=WS(jo,n),Do.forEach(e=>{e(jo)})}function US({...n}){const e=HS(),t=o=>Nr({type:"UPDATE_TOAST",toast:{...o,id:e}}),r=()=>Nr({type:"DISMISS_TOAST",toastId:e});return Nr({type:"ADD_TOAST",toast:{...n,id:e,open:!0,onOpenChange:o=>{o||r()}}}),{id:e,dismiss:r,update:t}}function GS(){const[n,e]=we.useState(jo);return we.useEffect(()=>(Do.push(e),()=>{const t=Do.indexOf(e);t>-1&&Do.splice(t,1)}),[n]),{...n,toast:US,dismiss:t=>Nr({type:"DISMISS_TOAST",toastId:t})}}const fg=we.forwardRef(({className:n,...e},t)=>p.jsx(ca.Root,{ref:t,className:H("!peer !h-4 !w-4 !p-0 !shrink-0 !rounded-sm !border !border-primary !ring-offset-background focus-visible:!outline-none focus-visible:!ring-2 focus-visible:!ring-ring focus-visible:!ring-offset-2 disabled:!cursor-not-allowed disabled:!opacity-50 data-[state=checked]:!bg-primary data-[state=checked]:!text-primary-foreground",n),...e,children:p.jsx(ca.Indicator,{className:H("!flex !p-0 !items-center !justify-center !text-current"),children:p.jsx(B.Check,{className:"!h-4 !w-4"})})}));fg.displayName=ca.Root.displayName;function KS(n){return p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",...n,children:p.jsx("path",{fill:"currentColor",d:"M19 12h-2v3h-3v2h5zM7 9h3V7H5v5h2zm14-6H3a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h18a2 2 0 0 0 2-2V5a2 2 0 0 0-2-2m0 16H3V5h18z"})})}function JS(n){return p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",...n,children:p.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M6 15h15m0 4H6m9-8h6m0-4h-6M9 9h1a1 1 0 1 1-1 1V7.5a2 2 0 0 1 2-2M3 9h1a1 1 0 1 1-1 1V7.5a2 2 0 0 1 2-2"})})}function XS(){return p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",className:"w-4 h-4",width:"1em",height:"1em",viewBox:"0 0 24 24",children:p.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",d:"M5.5 3c1.404 0 2.107 0 2.611.38c.219.164.406.375.552.62C9 4.568 9 5.358 9 6.938v10.125c0 1.58 0 2.37-.337 2.937a2.1 2.1 0 0 1-.552.621c-.504.38-1.207.38-2.611.38s-2.107 0-2.611-.38a2.1 2.1 0 0 1-.552-.62C2 19.432 2 18.642 2 17.062V6.938c0-1.58 0-2.37.337-2.938a2.1 2.1 0 0 1 .552-.62C3.393 3 4.096 3 5.5 3M20 11.938v5.124c0 1.58 0 2.37-.337 2.938a2.1 2.1 0 0 1-.552.62c-.504.38-1.207.38-2.611.38s-2.107 0-2.611-.38a2.1 2.1 0 0 1-.552-.62C13 19.433 13 18.642 13 17.063V6.938c0-1.58 0-2.37.337-2.938M22 9l-6-6m6 0l-6 6",color:"currentColor"})})}function YS(){return p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",className:"w-4 h-4",width:"1em",height:"1em",viewBox:"0 0 24 24",children:p.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",d:"M21 18.5c0 1.404 0 2.107-.38 2.611a2.1 2.1 0 0 1-.62.552c-.567.337-1.358.337-2.937.337H6.938c-1.58 0-2.37 0-2.938-.337a2.1 2.1 0 0 1-.62-.552C3 20.607 3 19.904 3 18.5s0-2.107.38-2.611c.163-.218.374-.406.62-.552C4.567 15 5.357 15 6.938 15h10.125c1.58 0 2.37 0 2.937.337c.246.146.457.334.62.552c.38.504.38 1.207.38 2.611M12.063 4H6.937C5.358 4 4.568 4 4 4.337a2.1 2.1 0 0 0-.62.552C3 5.393 3 6.096 3 7.5s0 2.107.38 2.611c.163.218.374.406.62.552C4.567 11 5.357 11 6.938 11h10.125c1.58 0 2.37 0 2.937-.337M21 8l-6-6m6 0l-6 6",color:"currentColor"})})}function ZS(n){return p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",...n,children:p.jsx("path",{fill:"currentColor",d:"M14 2H6a2 2 0 0 0-2 2v16c0 1.11.89 2 2 2h12c1.11 0 2-.89 2-2V8zm4 18H6V4h7v5h5zm-.65-10l-2.1 9h-1.4l-1.8-6.79l-1.8 6.79h-1.4l-2.2-9h1.5l1.4 6.81l1.8-6.81h1.3l1.8 6.81l1.4-6.81z"})})}function Rn(n){const e=gg[n.name];return e?p.jsx(e,{className:`size-4 ${(n==null?void 0:n.className)||""}`,onClick:n==null?void 0:n.onClick}):p.jsx($1.DynamicIcon,{className:`size-4 ${(n==null?void 0:n.className)||""}`,name:n.name,onClick:n==null?void 0:n.onClick})}function QS(n){return p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",...n,children:p.jsx("path",{fill:"currentColor",d:"M21 22H3v-2h18zm0-18H3V2h18zm-11 9.7h4l-2-5.4zM11.2 6h1.7l4.7 12h-2l-.9-2.6H9.4L8.5 18h-2z"})})}function hg(n){return p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 48 48",...n,children:p.jsx("path",{fill:"currentColor",stroke:"currentColor",strokeLinejoin:"round",strokeWidth:4,d:"M36 19L24 31L12 19z"})})}function e2(n){return p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",...n,children:p.jsx("path",{fill:"currentColor",d:"M9 7v10h6v-2h-4V7z"})})}function t2(n){return p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",...n,children:p.jsx("path",{fill:"currentColor",d:"M9 7c-1.1 0-2 .9-2 2v8h2V9h2v7h2V9h2v8h2V9a2 2 0 0 0-2-2z"})})}function n2(n){return p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",...n,children:p.jsx("path",{fill:"currentColor",d:"M11 7c-1.1 0-2 .9-2 2v2a2 2 0 0 0 2 2h2v2H9v2h4c1.11 0 2-.89 2-2v-2a2 2 0 0 0-2-2h-2V9h4V7z"})})}function r2(){return p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",children:p.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M14 4h4a1 1 0 0 1 1 1v14a1 1 0 0 1-1 1h-4a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1m-9 8h4m-2-2v4"})})}function o2(){return p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",children:p.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M6 4h4a1 1 0 0 1 1 1v14a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1m9 8h4m-2-2v4"})})}function i2(){return p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",children:p.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M12 21v-4m0-4V9m0-4V3m-2 18h4M8 5v4h11l2-2l-2-2zm6 8v4H6l-2-2l2-2z"})})}function s2(){return p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",children:p.jsx("path",{fill:"currentColor",d:"M23.943 19.806a.2.2 0 0 0-.168-.034c-1.26-1.855-2.873-3.61-4.419-5.315l-.252-.284c-.001-.073-.067-.12-.134-.15l-.084-.084c-.05-.1-.169-.167-.286-.1c-.47.234-.907.585-1.327.919c-.554.434-1.109.87-1.63 1.354a5 5 0 0 0-.588.618c-.084.117-.017.217.084.267c-.37.368-.74.736-1.109 1.12a.2.2 0 0 0-.05.134c0 .05.033.1.067.117l.655.502v.016c.924.92 2.554 2.173 4.285 3.527c.251.201.52.402.773.602c.117.134.234.285.335.418c.05.066.169.084.236.033c.033.034.084.067.118.1a.24.24 0 0 0 .1.034a.15.15 0 0 0 .135-.066a.24.24 0 0 0 .033-.1c.017 0 .017.016.034.016a.2.2 0 0 0 .134-.05l3.058-3.327c.12-.116.014-.267 0-.267m-7.628-.134l-1.546-1.17l-.15-.1c-.035-.017-.068-.05-.102-.067l-.117-.1c.66-.66 1.33-1.308 2-1.956c-.488.484-1.463 1.906-1.261 2.373c.002 0 .018.042.067.084zm4.1 3.126l-1.277-.97a27 27 0 0 0-1.58-1.504c.69.518 1.277.97 1.361 1.053c.673.585.638.485 1.093.87l.554.4c-.074.103-.151.148-.151.151m.336.25l-.034-.016a1 1 0 0 0 .152-.117zM.588 3.476c.033.217.084.435.117.636c.201 1.103.403 2.106.772 2.858l.152.568c.05.217.134.485.219.552a67 67 0 0 0 3.578 2.942a.18.18 0 0 0 .219 0s0 .016.016.016a.15.15 0 0 0 .118.05a.2.2 0 0 0 .134-.05c1.798-1.989 3.142-3.627 4.1-4.998c.068-.066.084-.167.084-.25c.067-.067.118-.151.185-.201c.067-.067.067-.184 0-.235l-.017-.016c0-.033-.017-.084-.05-.1c-.42-.401-.722-.685-1.042-.986a94 94 0 0 1-2.352-2.273c-.017-.017-.034-.034-.067-.034c-.336-.117-1.025-.234-1.882-.385c-1.277-.216-3.008-.517-4.57-.986c0 0-.101 0-.118.017l-.05.05C.05.714.022.707 0 .718c.017.1.017.167.05.284c0 .033.068.301.068.334zm7.19 4.78l-.033.034a.036.036 0 0 1 .033-.034M6.553 2.238c.101.1.521.502.622.585c-.437-.2-1.529-.702-2.034-.869c.505.1 1.194.201 1.412.284M.79 1.403c.252.434.454 1.939.655 3.41c-.118-.469-.201-.936-.302-1.372C.992 2.673.84 1.988.638 1.386c.124 0 .152.021.152.017m-.286-.369c0-.016 0-.033-.017-.033c.085 0 .135.017.202.05c0 .006-.145-.017-.185-.017m23.17-.217c.017-.066-.336-.367-.219-.384c.253-.017.253-.401 0-.401c-.335.017-.688.1-1.008.15c-.587.117-1.192.234-1.78.367a80 80 0 0 0-3.949.937c-.403.117-.857.2-1.243.401c-.135.067-.118.2-.05.284c-.034.017-.051.017-.085.034c-.117.017-.218.034-.335.05c-.102.017-.152.1-.135.2c0 .017.017.05.017.067c-.706.936-1.496 1.923-2.353 2.976c-.84.969-1.73 1.989-2.62 3.042c-2.84 3.31-6.05 7.07-9.594 10.38a.16.16 0 0 0 0 .234c.016.016.033.033.05.033c-.05.05-.101.085-.152.134q-.05.05-.05.1a.4.4 0 0 0-.067.084c-.067.067-.067.184.017.234c.067.066.185.066.235-.017c.017-.017.017-.033.033-.033a.265.265 0 0 1 .37 0c.202.217.404.435.588.618l-.42-.35c-.067-.067-.184-.05-.234.016c-.068.066-.051.184.016.234l4.469 3.727c.034.034.067.034.118.034a.15.15 0 0 0 .117-.05l.101-.1c.017.016.05.016.067.016c.05 0 .084-.016.118-.05c6.049-6.05 10.922-10.614 16.5-14.693c.05-.033.067-.1.067-.15c.067 0 .118-.05.15-.117c1.026-3.125 1.228-5.9 1.295-7.27c0-.059.016-.038.016-.068c.017-.033.017-.05.017-.05a.98.98 0 0 0-.067-.619m-10.82 4.915c.268-.301.537-.619.806-.903c-1.73 2.273-4.603 5.767-8.67 9.929c2.773-3.059 5.562-6.218 7.864-9.026M5.14 23.466c-.016-.017-.016-.017 0-.017zm2.504-2.156c.135-.15.27-.284.42-.434c0 0 0 .016.017.016c-.224.198-.433.418-.437.418m.69-.668c.099-.1.14-.173.284-.318c.992-1.02 2.017-2.04 3.059-3.076l.016-.016c.252-.2.555-.418.824-.619a228 228 0 0 0-4.184 4.029M14.852 3.91c-.554.719-1.176 1.671-1.697 2.423c-1.646 2.374-6.94 8.174-7.057 8.274a1190 1190 0 0 1-4.839 4.597l-.1.1c-.085-.1-.085-.25.016-.334C8.652 11.966 13.19 6.133 15.021 3.576c-.05.116-.084.216-.168.334zm2.906 3.427c-.671-.386-.99-.987-.806-1.572l.05-.2a.8.8 0 0 1 .085-.167a1.9 1.9 0 0 1 .756-.703c.016 0 .033 0 .05-.016c-.017-.034-.017-.084-.017-.134c.017-.1.085-.167.202-.167c.202 0 .824.184 1.059.384c.067.05.134.117.202.184c.084.1.218.268.285.401c.034.017.067.184.118.268c.033.134.067.284.05.418c-.017.016 0 .116-.017.116a1.6 1.6 0 0 1-.218.619c-.03.03.006.012-.05.067a1.2 1.2 0 0 1-.32.334a1.49 1.49 0 0 1-1.26.234a2 2 0 0 0-.169-.066m4.37 1.403c0 .017-.017.05 0 .067c-.034 0-.05.017-.085.034a110 110 0 0 0-3.915 3.025c1.11-.986 2.218-1.989 3.378-2.975c.336-.301.571-.686.638-1.12l.168-1.003v-.033c.085-.201.404-.118.353.1c-.004-.001-.173.795-.537 1.905"})})}function pg(){return p.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 32 32",children:[p.jsx("path",{fill:"currentColor",d:"M30 18v-2h-6v10h2v-4h3v-2h-3v-2zm-11 8h-4V16h4a3.003 3.003 0 0 1 3 3v4a3.003 3.003 0 0 1-3 3m-2-2h2a1 1 0 0 0 1-1v-4a1 1 0 0 0-1-1h-2zm-6-8H6v10h2v-3h3a2.003 2.003 0 0 0 2-2v-3a2 2 0 0 0-2-2m-3 5v-3h3l.001 3z"}),p.jsx("path",{fill:"currentColor",d:"M22 14v-4a.91.91 0 0 0-.3-.7l-7-7A.9.9 0 0 0 14 2H4a2.006 2.006 0 0 0-2 2v24a2 2 0 0 0 2 2h16v-2H4V4h8v6a2.006 2.006 0 0 0 2 2h6v2Zm-8-4V4.4l5.6 5.6Z"})]})}function mg(){return p.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",className:"icon",viewBox:"0 0 1024 1024",children:[p.jsx("path",{fill:"currentColor",d:"M679.253 402.364 618.77 561.015l-60.348-158.651a30.04 30.04 0 0 0-30.447-18.637 29.76 29.76 0 0 0-30.447 18.637l-60.416 158.651-60.416-158.651a30.515 30.515 0 0 0-38.843-17.272 28.945 28.945 0 0 0-17.954 37.547l88.815 233.267c4.369 11.469 15.7 19.115 28.398 19.115a30.31 30.31 0 0 0 28.468-19.115l62.395-163.908 62.396 163.84c4.437 11.605 15.701 19.183 28.4 19.183a30.31 30.31 0 0 0 28.466-19.115l88.747-233.267a28.945 28.945 0 0 0-17.886-37.547 30.447 30.447 0 0 0-38.912 17.272zm219.478 395.605-51.883-29.218c-28.672-16.18-52.224-3.072-52.224 29.082v.273H643.209a29.833 29.833 0 0 0-30.31 29.354c0 16.18 13.584 29.218 30.31 29.218h151.825c1.092 30.516 24.03 43.077 52.224 27.648l51.063-27.989c29.013-15.906 29.15-42.189.41-58.368"}),p.jsx("path",{fill:"currentColor",d:"m810.667 913.135-.478.068H201.796c-19.865 0-36.727-11.673-36.727-25.6v-618.36h154.965c51.268 0 92.911-39.39 92.911-87.858v-87.86H810.19c19.797 0 36.522 11.742 36.522 25.669V739.26h61.987V119.262c0-46.421-44.169-84.241-98.51-84.241H328.364l-225.28 194.56v658.09c0 46.285 44.236 84.105 98.713 84.105H810.19c43.759 0 80.554-24.713 93.32-58.573h-92.842zM350.89 94.89v86.562c0 16.11-13.858 29.286-30.925 29.286H216.815L350.959 94.891z"})]})}function l2(){return p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",children:p.jsxs("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",color:"currentColor",children:[p.jsx("path",{d:"M14.86 22h-4.312c-3.291 0-4.937 0-6.08-.798a4.2 4.2 0 0 1-.863-.805c-.855-1.066-.855-2.6-.855-5.67v-2.545c0-2.963 0-4.445.473-5.628c.761-1.903 2.37-3.403 4.41-4.113C8.9 2 10.49 2 13.667 2c1.816 0 2.723 0 3.448.252c1.166.406 2.085 1.263 2.52 2.35c.27.676.27 1.523.27 3.216V10"}),p.jsx("path",{d:"M2.75 12c0-1.84 1.506-3.333 3.364-3.333c.672 0 1.464.116 2.117-.057a1.67 1.67 0 0 0 1.19-1.179c.174-.647.057-1.432.057-2.098C9.478 3.493 10.984 2 12.84 2m.002 16h2.523m-4.949-4.15c-.126-.8-.281-.801-1.61-.85h-1.01c-.557 0-1.009.448-1.009 1v3c0 .552.452 1 1.01 1h1.816c.39 0 .803-.313.803-.7v-1.1c0-.11-.113-.304-.224-.304H9.068M12.842 13h1.261m0 0h1.262m-1.262 0v4.875M21.251 13h-2.523c-.557 0-1.009.448-1.009 1v1.5m0 0V18m0-2.5h2.523"})]})})}function a2(){return p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 20 20",children:p.jsx("path",{fill:"currentColor",d:"M6.5 3a.75.75 0 0 1 .697.471l3 7.5a.75.75 0 0 1-1.393.557L7.992 9.5H5.008l-.811 2.028a.75.75 0 0 1-1.393-.556l3-7.5A.75.75 0 0 1 6.5 3m0 2.77L5.608 8h1.784zm8.28-1.55a.75.75 0 1 0-1.06 1.06l.72.72h-3.69a.75.75 0 0 0 0 1.5h3.69l-.72.72a.75.75 0 0 0 1.06 1.06l2-2a.75.75 0 0 0 0-1.06zm0 7.5a.75.75 0 1 0-1.06 1.06l.72.72H3.75a.75.75 0 0 0 0 1.5h10.69l-.72.72a.75.75 0 1 0 1.06 1.06l2-2a.75.75 0 0 0 0-1.06z"})})}function c2(){return p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 48 48",children:p.jsxs("g",{fill:"none",stroke:"currentColor",strokeWidth:"4",children:[p.jsx("circle",{cx:"10",cy:"24",r:"4"}),p.jsx("circle",{cx:"38",cy:"10",r:"4"}),p.jsx("circle",{cx:"38",cy:"24",r:"4"}),p.jsx("circle",{cx:"38",cy:"38",r:"4"}),p.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M34 38H22V10h12M14 24h20"})]})})}function u2(){return p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 20 20",children:p.jsx("path",{fill:"currentColor",d:"M13.5 3a.75.75 0 0 0-.697.471l-3 7.5a.75.75 0 0 0 1.393.557l.812-2.028h2.984l.811 2.028a.75.75 0 0 0 1.393-.556l-3-7.5A.75.75 0 0 0 13.5 3m0 2.77L14.392 8h-1.784zM5.22 4.22a.75.75 0 0 1 1.06 1.06L5.56 6h3.69a.75.75 0 0 1 0 1.5H5.56l.72.72a.75.75 0 0 1-1.06 1.06l-2-2a.75.75 0 0 1 0-1.06zm0 7.5a.75.75 0 0 1 1.06 1.06l-.72.72h10.69a.75.75 0 0 1 0 1.5H5.56l.72.72a.75.75 0 1 1-1.06 1.06l-2-2a.75.75 0 0 1 0-1.06z"})})}function d2(){return p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",children:p.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",d:"m3 21l7.548-7.548M21 3l-7.548 7.548m0 0L8 3H3l7.548 10.452m2.904-2.904L21 21h-5l-5.452-7.548",color:"currentColor"})})}function f2(){return p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",children:p.jsx("path",{fill:"currentColor",d:"M14 2H6a2 2 0 0 0-2 2v16c0 1.11.89 2 2 2h12c1.11 0 2-.89 2-2V8zm4 18H6V4h7v5h5zm-.65-10l-2.1 9h-1.4l-1.8-6.79l-1.8 6.79h-1.4l-2.2-9h1.5l1.4 6.81l1.8-6.81h1.3l1.8 6.81l1.4-6.81z"})})}const gg={Bold:B.Bold,LoaderCircle:B.LoaderCircle,Italic:B.Italic,Underline:B.Underline,Quote:B.Quote,TextQuote:JS,Strikethrough:B.Strikethrough,Minus:B.Minus,Eraser:B.Eraser,PaintRoller:B.PaintRoller,Redo2:B.Redo2,Undo2:B.Undo2,AlignCenter:so.TextAlignCenterIcon,AlignJustify:so.TextAlignJustifyIcon,AlignLeft:so.TextAlignLeftIcon,AlignRight:so.TextAlignRightIcon,ChevronDown:B.ChevronDown,Subscript:B.Subscript,Superscript:B.Superscript,Code:B.Code,Code2:B.CodeXml,Type:B.Type,IndentIncrease:B.IndentIncrease,IndentDecrease:B.IndentDecrease,List:B.List,ListOrdered:B.ListOrdered,ListTodo:B.ListTodo,Link:B.Link,ImageUp:B.ImageUp,Video:B.Video,Maximize:B.Maximize,Minimize:B.Minimize,Table:B.Table,Sparkles:B.Sparkles,Pencil:B.Pencil,Unlink:B.Unlink,BetweenHorizonalEnd:B.BetweenHorizonalEnd,BetweenHorizonalStart:B.BetweenHorizonalStart,BetweenVerticalStart:B.BetweenVerticalStart,BetweenVerticalEnd:B.BetweenVerticalEnd,TableCellsMerge:B.TableCellsMerge,TableCellsSplit:B.TableCellsSplit,Trash2:B.Trash2,Trash:B.Trash,Replace:B.Replace,ChevronsUpDown:B.ChevronsUpDown,LineHeight:QS,Word:ZS,Heading1:B.Heading1,Heading2:B.Heading2,Heading3:B.Heading3,Heading4:B.Heading4,Heading5:B.Heading5,Heading6:B.Heading6,Columns2:B.Columns2,Columns3:B.Columns3,Columns4:B.Columns4,Plus:B.Plus,Grip:B.GripVertical,Copy:B.Copy,Clipboard:B.Clipboard,PanelLeft:B.PanelLeft,PanelRight:B.PanelRight,Columns:B.Columns2,Iframe:B.Frame,MenuDown:hg,SizeS:n2,SizeM:t2,SizeL:e2,AspectRatio:KS,Emoji:B.SmilePlus,DeleteColumn:XS,DeleteRow:YS,SearchAndReplace:B.Replace,EmojiIcon:B.SmilePlusIcon,KatexIcon:B.Sigma,ExportPdf:pg,ExportWord:mg,ImportWord:f2,ColumnAddLeft:r2,ColumnAddRight:o2,BookMarked:B.BookMarked,Excalidraw:s2,ZoomIn:B.ZoomIn,ZoomOut:B.ZoomOut,Settings:B.Settings,Eye:B.Eye,TextDirection:i2,LeftToRight:a2,RightToLeft:u2,Attachment:B.Paperclip,GifIcon:l2,ChevronUp:B.ChevronUp,Crop:B.CropIcon,Mermaid:c2,Twitter:d2,FlipX:B.FlipVertical,FlipY:B.FlipHorizontal,PencilRuler:B.PencilRuler};function h2({fill:n}){return p.jsx("svg",{width:"18px",height:"18px",viewBox:"0 0 256 256",version:"1.1",xmlns:"http://www.w3.org/2000/svg",children:p.jsx("g",{id:"icon/填充色",stroke:"none",strokeWidth:1,fill:"none",fillRule:"evenodd",children:p.jsxs("g",{id:"icon/背景颜色",children:[p.jsx("g",{id:"编组",fill:"currentColor",children:p.jsxs("g",{transform:"translate(119.502295, 137.878331) rotate(-135.000000) translate(-119.502295, -137.878331) translate(48.002295, 31.757731)",id:"矩形",children:[p.jsx("path",{d:"M100.946943,60.8084699 L43.7469427,60.8084699 C37.2852111,60.8084699 32.0469427,66.0467383 32.0469427,72.5084699 L32.0469427,118.70847 C32.0469427,125.170201 37.2852111,130.40847 43.7469427,130.40847 L100.946943,130.40847 C107.408674,130.40847 112.646943,125.170201 112.646943,118.70847 L112.646943,72.5084699 C112.646943,66.0467383 107.408674,60.8084699 100.946943,60.8084699 Z M93.646,79.808 L93.646,111.408 L51.046,111.408 L51.046,79.808 L93.646,79.808 Z",fillRule:"nonzero"}),p.jsx("path",{d:"M87.9366521,16.90916 L87.9194966,68.2000001 C87.9183543,69.4147389 86.9334998,70.399264 85.7187607,70.4 L56.9423078,70.4 C55.7272813,70.4 54.7423078,69.4150264 54.7423078,68.2 L54.7423078,39.4621057 C54.7423078,37.2523513 55.5736632,35.1234748 57.0711706,33.4985176 L76.4832996,12.4342613 C78.9534987,9.75382857 83.1289108,9.5834005 85.8093436,12.0535996 C87.1658473,13.303709 87.9372691,15.0644715 87.9366521,16.90916 Z",fillRule:"evenodd"}),p.jsx("path",{d:"M131.3,111.241199 L11.7,111.241199 C5.23826843,111.241199 0,116.479467 0,122.941199 L0,200.541199 C0,207.002931 5.23826843,212.241199 11.7,212.241199 L131.3,212.241199 C137.761732,212.241199 143,207.002931 143,200.541199 L143,122.941199 C143,116.479467 137.761732,111.241199 131.3,111.241199 Z M124,130.241 L124,193.241 L19,193.241 L19,130.241 L124,130.241 Z",fillRule:"nonzero"})]})}),p.jsx("path",{d:"M51,218 L205,218 C211.075132,218 216,222.924868 216,229 C216,235.075132 211.075132,240 205,240 L51,240 C44.9248678,240 40,235.075132 40,229 C40,222.924868 44.9248678,218 51,218 Z",id:"矩形",fill:n||"#FBDE28"})]})})})}function p2(n){const[e,t]=x.useState(void 0);function r(s){var l;(l=n.action)==null||l.call(n,s)}function o(){var s;(s=n.action)==null||s.call(n,e)}const i=x.useCallback(bi(s=>{t(s)},350),[]);return p.jsxs("div",{className:"flex items-center h-[32px]",children:[p.jsx(St,{tooltip:n==null?void 0:n.tooltip,disabled:n==null?void 0:n.disabled,action:o,tooltipOptions:n==null?void 0:n.tooltipOptions,shortcutKeys:n==null?void 0:n.shortcutKeys,children:p.jsx("span",{className:"flex items-center justify-center text-sm",children:p.jsx(h2,{fill:e})})}),p.jsx(k1,{selectedColor:e,setSelectedColor:i,onChange:r,highlight:!0,disabled:n==null?void 0:n.disabled,children:p.jsx(Ve,{variant:"ghost",size:"icon",className:"!w-3 !h-[32px]",disabled:n==null?void 0:n.disabled,children:p.jsx(Rn,{className:"!w-3 !h-3 text-zinc-500",name:"MenuDown"})})})]})}function m2(n){const{t:e}=oe.useLocale(),[t,r]=x.useState({text:"",link:""}),[o,i]=x.useState(!1);x.useEffect(()=>{var l;if(n!=null&&n.editor){const{href:a,target:c}=(l=n.editor)==null?void 0:l.getAttributes("link"),{from:u,to:d}=n.editor.state.selection,f=n.editor.state.doc.textBetween(u,d," ");r({link:a,text:f}),i(c==="_blank")}},[n==null?void 0:n.editor]);function s(l){l.preventDefault(),l.stopPropagation(),n==null||n.onSetLink(t.link,t.text,o)}return p.jsx("div",{className:"border-neutral-200 rounded-lg !border bg-white p-2 shadow-sm dark:border-neutral-800 dark:bg-black",children:p.jsxs("form",{className:"flex flex-col gap-2",onSubmit:s,children:[p.jsx(ln,{className:"mb-[6px]",children:e("editor.link.dialog.text")}),p.jsx("div",{className:"mb-[10px] flex w-full max-w-sm items-center gap-1.5",children:p.jsx("div",{className:"relative w-full max-w-sm items-center",children:p.jsx(Rt,{className:"w-80",onChange:l=>r({...t,text:l.target.value}),placeholder:"Text",required:!0,type:"text",value:t.text})})}),p.jsx(ln,{className:"mb-[6px]",children:e("editor.link.dialog.link")}),p.jsx("div",{className:"flex w-full max-w-sm items-center gap-1.5",children:p.jsxs("div",{className:"relative w-full max-w-sm items-center",children:[p.jsx(Rt,{className:"pl-10",onChange:l=>r({...t,link:l.target.value}),required:!0,type:"url",value:t.link}),p.jsx("span",{className:"absolute inset-y-0 start-0 flex items-center justify-center px-2",children:p.jsx(Rn,{className:"size-5 text-muted-foreground",name:"Link"})})]})}),p.jsxs("div",{className:"flex items-center space-x-2",children:[p.jsx(ln,{children:e("editor.link.dialog.openInNewTab")}),p.jsx(Tc,{checked:o,onCheckedChange:l=>{i(l)}})]}),p.jsx(Ve,{className:"mt-2 self-end",type:"submit",children:e("editor.link.dialog.button.apply")})]})})}function g2(n,e,t=null){return t?n.createChecked({index:e},t):n.createAndFill({index:e})}function y2(n){if(n.cached.columnsNodeTypes)return n.cached.columnsNodeTypes;const e={columns:n.nodes.columns,column:n.nodes.column};return n.cached.columnsNodeTypes=e,e}function b2(n,e,t=null){const r=y2(n),o=[];for(let i=0;i<e;i+=1){const s=g2(r.column,i,t);s&&o.push(s)}return r.columns.createChecked({cols:e},o)}function hs({state:n,dispatch:e,type:t}){const r=cn(i=>i.type.name===Ac.name)(n.selection),o=cn(i=>i.type.name===Nc.name)(n.selection);if(e&&r&&o){const i=r.node,s=o.node.attrs.index,l=i.toJSON();let a=s;t==="delete"?(a=s-1,l.content.splice(s,1)):(a=t==="addBefore"?s:s+1,l.content.splice(a,0,{type:"column",attrs:{index:s},content:[{type:"paragraph"}]})),l.attrs.cols=l.content.length,l.content.forEach((f,h)=>{f.attrs.index=h});const c=$t.fromJSON(n.schema,l);let u=r.pos;c.content.forEach((f,h,m)=>{m<a&&(u+=f.nodeSize)});const d=n.tr.setTime(Date.now());d.replaceWith(r.pos,r.pos+r.node.nodeSize,c).setSelection(K.near(d.doc.resolve(u))),e(d)}return!0}function Md({state:n,dispatch:e,type:t}){const r=cn(i=>i.type.name===Ac.name)(n.selection),o=cn(i=>i.type.name===Nc.name)(n.selection);if(e&&r&&o){const i=r.node,s=o.node.attrs.index;let l=0;t==="before"?l=(s-1+i.attrs.cols)%i.attrs.cols:l=(s+1)%i.attrs.cols;let a=r.pos;i.content.forEach((u,d,f)=>{f<l&&(a+=u.nodeSize)});const c=n.tr.setTime(Date.now());return c.setSelection(K.near(c.doc.resolve(a))),e(c),!0}return!1}const v2=200,Ac=et.create({name:"columns",group:"block",defining:!0,isolating:!0,allowGapCursor:!1,content:"column{1,}",priority:v2,addOptions(){return{HTMLAttributes:{class:"columns"}}},addAttributes(){return{cols:{default:2,parseHTML:n=>n.getAttribute("cols")}}},parseHTML(){return[{tag:"div[class=grid]"}]},renderHTML({HTMLAttributes:n}){return["div",Ke(this.options.HTMLAttributes,n),0]},addCommands(){return{insertColumns:n=>({tr:e,dispatch:t,editor:r})=>{const o=b2(r.schema,n&&n.cols||3);if(t){const i=e.selection.anchor+1;e.replaceSelectionWith(o).scrollIntoView().setSelection(K.near(e.doc.resolve(i)))}return!0},addColBefore:()=>({dispatch:n,state:e})=>hs({dispatch:n,state:e,type:"addBefore"}),addColAfter:()=>({dispatch:n,state:e})=>hs({dispatch:n,state:e,type:"addAfter"}),deleteCol:()=>({dispatch:n,state:e})=>hs({dispatch:n,state:e,type:"delete"})}},addKeyboardShortcuts(){return{"Mod-Alt-G":()=>this.editor.commands.insertColumns(),Tab:()=>Md({state:this.editor.state,dispatch:this.editor.view.dispatch,type:"after"}),"Shift-Tab":()=>Md({state:this.editor.state,dispatch:this.editor.view.dispatch,type:"before"})}}}),Nc=et.create({name:"column",content:"block+",isolating:!0,addOptions(){return{HTMLAttributes:{class:"column"}}},addAttributes(){return{index:{default:0,parseHTML:n=>n.getAttribute("index")}}},parseHTML(){return[{tag:"div[class=column]"}]},renderHTML({HTMLAttributes:n}){return["div",Ke(this.options.HTMLAttributes,n),0]}});var yg=(n=>(n[n.max=7]="max",n[n.min=0]="min",n[n.more=1]="more",n[n.less=-1]="less",n))(yg||{});function x2(n,e,t){return n<e?e:n>t?t:n}function w2(n,e,t,r){const{doc:o,selection:i}=n;if(!o||!i||!(i instanceof K||i instanceof nt))return n;const{from:s,to:l}=i;return o.nodesBetween(s,l,(a,c)=>{const u=a.type;return t.includes(u.name)?(n=bg(n,c,e),!1):!Oa(a.type.name,r.extensionManager.extensions)}),n}function bg(n,e,t){if(!n.doc)return n;const r=n.doc.nodeAt(e);if(!r)return n;const s=x2((r.attrs.indent||0)+t,0,7);if(s===r.attrs.indent)return n;const l={...r.attrs,indent:s};return n.setNodeMarkup(e,r.type,l,r.marks)}function S2({delta:n,types:e}){return({state:t,dispatch:r,editor:o})=>{const{selection:i}=t;let{tr:s}=t;return s=s.setSelection(i),s=w2(s,n,e,o),s.docChanged?(r&&r(s),!0):!1}}const vg={setOpen:(n,e)=>{xi(dr.UPLOAD_IMAGE(n),e)}},C2=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,Si=et.create({name:"image",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{}}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:n}){return["img",Ke(this.options.HTMLAttributes,n)]},addCommands(){return{setImage:n=>({commands:e})=>e.insertContent({type:this.name,attrs:n})}},addInputRules(){return[gi({find:C2,type:this.type,getAttributes:n=>{const[,,e,t,r]=n;return{src:t,alt:e,title:r}}})]}}),fr=bt.Root,hr=bt.Trigger,k2=bt.Portal,xg=we.forwardRef(({className:n,...e},t)=>p.jsx(bt.Overlay,{ref:t,className:H("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",n),...e}));xg.displayName=bt.Overlay.displayName;const Bn=we.forwardRef(({className:n,children:e,...t},r)=>p.jsxs(k2,{children:[p.jsx(xg,{}),p.jsxs(bt.Content,{ref:r,className:H("dialog-content fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",n),...t,children:[e,p.jsxs(bt.Close,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[p.jsx(B.X,{className:"h-4 w-4"}),p.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Bn.displayName=bt.Content.displayName;function wg({className:n,...e}){return p.jsx("div",{className:H("flex flex-col space-y-1.5 text-center sm:text-left",n),...e})}wg.displayName="DialogHeader";function eo({className:n,...e}){return p.jsx("div",{className:H("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",n),...e})}eo.displayName="DialogFooter";const zn=we.forwardRef(({className:n,...e},t)=>p.jsx(bt.Title,{ref:t,className:H("text-lg font-semibold leading-none tracking-tight",n),...e}));zn.displayName=bt.Title.displayName;const T2=we.forwardRef(({className:n,...e},t)=>p.jsx(bt.Description,{ref:t,className:H("text-sm text-muted-foreground",n),...e}));T2.displayName=bt.Description.displayName;function M2(n){return n.replace(/^.*\/|\..+$/g,"")}function E2(n){return n.split(".").pop()}function O2(n){return n<1024?`${n} Byte`:n<1024*1024?`${(n/1024).toFixed(2)} KB`:`${(n/1024/1024).toFixed(2)} MB`}function A2(n){return n?n==="application/pdf"?"pdf":n.startsWith("application/")&&[".document","word"].some(e=>n.includes(e))?"word":n.startsWith("application/")&&["presentation"].some(e=>n.includes(e))?"excel":n.startsWith("application/")&&["sheet"].some(e=>n.includes(e))?"ppt":n.startsWith("image")?"image":n.startsWith("audio")?"audio":n.startsWith("video")?"video":"file":"file"}function N2(n){return new Promise(e=>{const t=new FileReader;t.addEventListener("load",()=>{e({alt:n.name,src:t.result})},!1),t.readAsDataURL(n)})}function Ci(n,e){const t=n.split(","),r=t[0].match(/:(.*?);/)[1],o=atob(t[t.length-1]);let i=o.length;const s=new Uint8Array(i);for(;i--;)s[i]=o.charCodeAt(i);return new File([s],e,{type:r})}function R2({editor:n,imageInline:e,onClose:t}){const{t:r}=oe.useLocale(),[o,i]=x.useState(!1),s=x.useRef(null),[l,a]=x.useState(),[c,u]=x.useState(""),d=x.useRef(null),[f,h]=x.useState({src:"",file:null});function m(v){if(s.current&&v.width&&v.height){const S=g(s.current,v);u(S)}}function g(v,S){const O=document.createElement("canvas"),C=v.naturalWidth/v.width,N=v.naturalHeight/v.height;O.width=S.width*C,O.height=S.height*N;const E=O.getContext("2d");return E&&(E.imageSmoothingEnabled=!1,E.drawImage(v,S.x*C,S.y*N,S.width*C,S.height*N,0,0,S.width*C,S.height*N)),O.toDataURL("image/png",1)}async function y(){var v,S;try{const O=Ci(c,((v=f==null?void 0:f.file)==null?void 0:v.name)||"image.png"),C=(S=n.extensionManager.extensions.find(E=>E.name===Qo.name))==null?void 0:S.options;let N="";C.upload?N=await C.upload(O):N=URL.createObjectURL(O),n.chain().focus().setImageInline({src:N,inline:e}).run(),i(!1),h({src:"",file:null}),t()}catch(O){console.log("Error cropping image",O)}}function b(v){var S;v.preventDefault(),(S=d.current)==null||S.click()}const w=async v=>{var N;const S=(N=v==null?void 0:v.target)==null?void 0:N.files;if(!n||n.isDestroyed||S.length===0)return;const O=S[0],C=await N2(O);i(!0),h({src:C.src,file:O})};return p.jsxs(p.Fragment,{children:[p.jsx(Ve,{className:"mt-1 w-full",onClick:b,size:"sm",children:r("editor.image.dialog.tab.uploadCrop")}),p.jsxs(fr,{open:o,children:[p.jsx(hr,{}),p.jsxs(Bn,{children:[p.jsx(zn,{children:r("editor.image.dialog.tab.uploadCrop")}),p.jsx("div",{children:f.src&&p.jsx(I1,{className:"w-full",crop:l,onChange:v=>a(v),onComplete:v=>m(v),children:p.jsx("img",{alt:"Crop me",ref:s,src:f.src})})}),p.jsxs(eo,{children:[p.jsxs(Ve,{onClick:()=>{i(!1),h({src:"",file:null})},children:[r("editor.imageUpload.cancel"),p.jsx(Rn,{className:"ml-[4px]",name:"Trash2"})]}),p.jsxs(Ve,{className:"w-fit",onClick:y,children:[r("editor.imageUpload.crop"),p.jsx(Rn,{className:"ml-[4px]",name:"Crop"})]})]})]})]}),p.jsx("input",{accept:"image/*",multiple:!0,onChange:w,ref:d,type:"file",style:{display:"none"}})]})}function I2(n){var m;const{t:e}=oe.useLocale(),[t,r]=x.useState(!1),o=g=>{r(g.detail)},[i,s]=x.useState(""),l=x.useRef(null),[a,c]=x.useState(((m=n.editor.extensionManager.extensions.find(g=>g.name===Qo.name))==null?void 0:m.options.defaultInline)||!1),u=x.useMemo(()=>{var y;return(y=n.editor.extensionManager.extensions.find(b=>b.name===Qo.name))==null?void 0:y.options},[n.editor]);x.useEffect(()=>{const g=Cc(dr.UPLOAD_IMAGE(n.editor.id),o);return()=>{g()}},[]);async function d(g){var v;const y=(v=g==null?void 0:g.target)==null?void 0:v.files;if(!n.editor||n.editor.isDestroyed||y.length===0)return;const b=y[0];let w="";u.upload?w=await u.upload(b):w=URL.createObjectURL(b),n.editor.chain().focus().setImageInline({src:w,inline:a}).run(),r(!1),c(!1)}function f(g){g.preventDefault(),g.stopPropagation(),n.editor.chain().focus().setImageInline({src:i,inline:a}).run(),r(!1),c(!1),s("")}function h(g){var y;g.preventDefault(),(y=l.current)==null||y.click()}return p.jsxs(fr,{onOpenChange:r,open:t,children:[p.jsx(hr,{asChild:!0,children:p.jsx(St,{action:()=>r(!0),icon:n.icon,tooltip:n.tooltip})}),p.jsxs(Bn,{children:[p.jsx(zn,{children:e("editor.image.dialog.title")}),p.jsxs(cg,{activationMode:"manual",defaultValue:u.resourceImage==="both"||u.resourceImage==="upload"?"upload":"link",children:[p.jsxs(Mc,{className:"grid w-full grid-cols-2",children:[u.resourceImage==="both"||u.resourceImage==="upload"?p.jsx(Wr,{value:"upload",children:e("editor.image.dialog.tab.upload")}):p.jsx(p.Fragment,{}),u.resourceImage==="both"||u.resourceImage==="link"?p.jsx(Wr,{value:"link",children:e("editor.image.dialog.tab.url")}):p.jsx(p.Fragment,{})]}),p.jsxs("div",{className:"my-[10px] flex items-center gap-[4px]",children:[p.jsx(fg,{checked:a,onCheckedChange:g=>{c(g)}}),p.jsx(ln,{children:e("editor.link.dialog.inline")})]}),p.jsxs(Ur,{value:"upload",children:[p.jsxs("div",{className:"flex items-center gap-[10px]",children:[p.jsx(Ve,{className:"mt-1 w-full",onClick:h,size:"sm",children:e("editor.image.dialog.tab.upload")}),p.jsx(R2,{editor:n.editor,imageInline:a,onClose:()=>vg.setOpen(n.editor.id,!1)})]}),p.jsx("input",{accept:"image/*",multiple:!0,onChange:d,ref:l,type:"file",style:{display:"none"}})]}),p.jsx(Ur,{value:"link",children:p.jsx("form",{onSubmit:f,children:p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(Rt,{autoFocus:!0,onChange:g=>s(g.target.value),placeholder:e("editor.image.dialog.placeholder"),required:!0,type:"url",value:i}),p.jsx(Ve,{type:"submit",children:e("editor.image.dialog.button.apply")})]})})})]})]})]})}const po={TOP_LEFT:"tl",TOP_RIGHT:"tr",BOTTOM_LEFT:"bl",BOTTOM_RIGHT:"br"};function _2(n){var N,E;const[e,t]=x.useState({width:oe.IMAGE_MAX_SIZE,height:oe.IMAGE_MAX_SIZE}),[r,o]=x.useState({width:0,height:0}),[i]=x.useState([po.TOP_LEFT,po.TOP_RIGHT,po.BOTTOM_LEFT,po.BOTTOM_RIGHT]),[s,l]=x.useState(!1),[a,c]=x.useState({x:0,y:0,w:0,h:0,dir:""}),{align:u,inline:d}=(N=n==null?void 0:n.node)==null?void 0:N.attrs,f=x.useMemo(()=>{var ce;const{src:k,alt:A,width:L,height:I,flipX:D,flipY:j}=(ce=n==null?void 0:n.node)==null?void 0:ce.attrs,P=Zo(L)?`${L}px`:L,J=Zo(I)?`${I}px`:I,Q=[];D&&Q.push("rotateX(180deg)"),j&&Q.push("rotateY(180deg)");const pe=Q.join(" ");return{src:k||void 0,alt:A||void 0,style:{width:P||void 0,height:J||void 0,transform:pe||"none"}}},[(E=n==null?void 0:n.node)==null?void 0:E.attrs]),h=x.useMemo(()=>{const{style:{width:k}}=f;return{width:k==="100%"?k:void 0}},[f]);function m(k){o({width:k.target.width,height:k.target.height})}function g(){const{editor:k,getPos:A}=n;k.commands.setNodeSelection(A())}const y=x.useCallback(qt(()=>{const{editor:k}=n,{width:A}=getComputedStyle(k.view.dom);t(L=>({...L,width:Number.parseInt(A,10)}))},oe.IMAGE_THROTTLE_WAIT_TIME),[n==null?void 0:n.editor]);function b(k,A){k.preventDefault(),k.stopPropagation();const L=r.width,I=r.height,D=L/I;let j=Number(n.node.attrs.width),P=Number(n.node.attrs.height);const J=e.width;j&&!P?(j=j>J?J:j,P=Math.round(j/D)):P&&!j?(j=Math.round(P*D),j=j>J?J:j):!j&&!P?(j=L>J?J:L,P=Math.round(j/D)):j=j>J?J:j,l(!0),c({x:k.clientX,y:k.clientY,w:j,h:P,dir:A})}const w=x.useCallback(qt(k=>{if(k.preventDefault(),k.stopPropagation(),!s)return;const{x:A,w:L,dir:I}=a,D=(k.clientX-A)*(/l/.test(I)?-1:1),j=Vm(L+D,oe.IMAGE_MIN_SIZE,e.width);n.updateAttributes({width:j,height:null})},oe.IMAGE_THROTTLE_WAIT_TIME),[s,a,e,n.updateAttributes]),v=x.useCallback(k=>{k.preventDefault(),k.stopPropagation(),s&&(c({x:0,y:0,w:0,h:0,dir:""}),l(!1),g())},[s,g]),S=x.useCallback(()=>{document==null||document.addEventListener("mousemove",w,!0),document==null||document.addEventListener("mouseup",v,!0)},[w,v]),O=x.useCallback(()=>{document==null||document.removeEventListener("mousemove",w,!0),document==null||document.removeEventListener("mouseup",v,!0)},[w,v]);x.useEffect(()=>(s?S():O(),()=>{O()}),[s,S,O]);const C=x.useMemo(()=>new ResizeObserver(()=>y()),[y]);return x.useEffect(()=>(C.observe(n.editor.view.dom),()=>{C.disconnect()}),[n.editor.view.dom,C]),p.jsx(hn,{as:d?"span":"div",className:"image-view",style:{...h,textAlign:u,display:d?"inline":"block"},children:p.jsxs("div",{"data-drag-handle":!0,draggable:"true",style:h,className:`image-view__body ${n!=null&&n.selected?"image-view__body--focused":""} ${s?"image-view__body--resizing":""}`,children:[p.jsx("img",{alt:f.alt,className:"image-view__body__image block",height:"auto",onClick:g,onLoad:m,src:f.src,style:f.style}),(n==null?void 0:n.editor.view.editable)&&((n==null?void 0:n.selected)||s)&&p.jsx("div",{className:"image-resizer",children:i==null?void 0:i.map(k=>p.jsx("span",{className:`image-resizer__handler image-resizer__handler--${k}`,onMouseDown:A=>b(A,k)},`image-dir-${k}`))})]})})}const or=new ct("upload-image");function D2(){return new Pe({key:or,state:{init(){return ve.empty},apply(n,e){e=e.map(n.mapping,n.doc);const t=n.getMeta(or);if(t!=null&&t.add)for(const{id:r,pos:o,src:i}of t.add){const s=j2(i),l=_e.widget(o,s,{id:r});e=e.add(n.doc,[l])}else if(t!=null&&t.remove)for(const r of t.remove)e=e.remove(e.find(void 0,void 0,o=>o.id===r));return e}},props:{decorations(n){return this.getState(n)}}})}function j2(n){const e=document.createElement("div"),t=document.createElement("img");return t.setAttribute("class","opacity-50"),t.src=n,t.addEventListener("load",()=>{e.setAttribute("class","img-placeholder")}),e.append(t),e}function P2(n,e){var o;const r=or.getState(n).find(void 0,void 0,i=>i.id===e);return r.length>0?(o=r[0])==null?void 0:o.from:null}function L2({validateFn:n,onUpload:e,postUpload:t,defaultInline:r=!1}){return(o,i,s)=>{for(const l of o){if(n&&!n(l))continue;const a=Date.now().toString(),c=i.state.tr;c.selection.empty||c.deleteSelection();const u=URL.createObjectURL(l);c.setMeta(or,{add:[{id:a,pos:s,src:u}]}),i.dispatch(c),e(l).then(async d=>{var w;t&&typeof d=="string"&&(d=await t(d));const{schema:f}=i.state;let h=P2(i.state,a);if(h===null)return;const m=typeof d=="object"?u:d,g=(w=f.nodes.image)==null?void 0:w.create({src:m,inline:r});if(!g)return;const{doc:y}=i.state;h>y.content.size&&(h=y.content.size-1);const b=i.state.tr.replaceWith(h,h,g).setMeta(or,{remove:[a]});i.dispatch(b)},()=>{const d=i.state.tr.delete(s,s).setMeta(or,{remove:[a]});i.dispatch(d)})}}}function B2(n,e,t){var o;const r=[...((o=e.clipboardData)==null?void 0:o.files)||[]];if(r.length>0){e.preventDefault();const i=n.state.selection.from;return t(r,n,i+1),!0}return!1}function z2(n,e,t,r){var i;const o=[...((i=e.dataTransfer)==null?void 0:i.files)||[]];if(!t&&o.length>0){e.preventDefault();const s=n.posAtCoords({left:e.clientX,top:e.clientY});if(s)return r(o,n,s.pos+1),!0}return!1}const $2={acceptMimes:["image/jpeg","image/gif","image/png","image/jpg"],maxSize:1024*1024*5,resourceImage:"both",defaultInline:!1},Qo=Si.extend({group:"inline",inline:!0,defining:!0,draggable:!0,selectable:!0,addOptions(){var n;return{...$2,...(n=this.parent)==null?void 0:n.call(this),upload:()=>Promise.reject("Image Upload Function"),button:({editor:e,extension:t,t:r})=>{var o,i;return{component:I2,componentProps:{action:()=>!0,upload:t.options.upload,disabled:!((i=(o=e.can()).setImage)!=null&&i.call(o,{})),icon:"ImageUp",tooltip:r("editor.image.tooltip"),editor:e}}}}},addAttributes(){var n;return{...(n=this.parent)==null?void 0:n.call(this),flipX:{default:!1},flipY:{default:!1},width:{default:null,parseHTML:e=>{const t=e.style.width||e.getAttribute("width")||null;return t?Number.parseInt(t,10):null},renderHTML:e=>({width:e.width})},align:{default:"center",parseHTML:e=>e.getAttribute("align"),renderHTML:e=>({align:e.align})},inline:{default:!1,parseHTML:e=>!!e.getAttribute("inline"),renderHTML:e=>({inline:e.inline})}}},addNodeView(){return pn(_2)},addCommands(){var n;return{...(n=this.parent)==null?void 0:n.call(this),setImageInline:e=>({commands:t})=>t.insertContent({type:this.name,attrs:{...e,inline:e.inline??this.options.defaultInline}}),updateImage:e=>({commands:t})=>t.updateAttributes(this.name,e),setAlignImage:e=>({commands:t})=>t.updateAttributes(this.name,{align:e})}},renderHTML({HTMLAttributes:n}){const{flipX:e,flipY:t,align:r,inline:o}=n,i=e||t?`transform: rotateX(${e?"180":"0"}deg) rotateY(${t?"180":"0"}deg);`:"",s=r?`text-align: ${r};`:"";return[o?"span":"div",{style:s,class:"image"},["img",Ke({height:"auto",style:i},this.options.HTMLAttributes,n)]]},parseHTML(){return[{tag:"span.image img",getAttrs:n=>{var i;const e=n==null?void 0:n.parentElement,t=n==null?void 0:n.getAttribute("width"),r=(n==null?void 0:n.getAttribute("flipx"))||!1,o=(n==null?void 0:n.getAttribute("flipy"))||!1;return{src:n==null?void 0:n.getAttribute("src"),alt:n==null?void 0:n.getAttribute("alt"),caption:n==null?void 0:n.getAttribute("caption"),width:t?Number.parseInt(t,10):null,align:(n==null?void 0:n.getAttribute("align"))||((i=e==null?void 0:e.style)==null?void 0:i.textAlign)||null,inline:(n==null?void 0:n.getAttribute("inline"))||!1,flipX:r==="true",flipY:o==="true"}}},{tag:"div[class=image]",getAttrs:n=>{const e=n.querySelector("img"),t=e==null?void 0:e.getAttribute("width"),r=(e==null?void 0:e.getAttribute("flipx"))||!1,o=(e==null?void 0:e.getAttribute("flipy"))||!1;return{src:e==null?void 0:e.getAttribute("src"),alt:e==null?void 0:e.getAttribute("alt"),caption:e==null?void 0:e.getAttribute("caption"),width:t?Number.parseInt(t,10):null,align:(e==null?void 0:e.getAttribute("align"))||n.style.textAlign||null,inline:(e==null?void 0:e.getAttribute("inline"))||!1,flipX:r==="true",flipY:o==="true"}}}]},addProseMirrorPlugins(){const e=L2({validateFn:t=>!(!this.options.acceptMimes.includes(t.type)||t.size>this.options.maxSize),onUpload:this.options.upload,defaultInline:this.options.defaultInline});return[new Pe({props:{handlePaste:(t,r)=>!r.clipboardData||[...r.clipboardData.files||[]].some(i=>i.type==="text/html")?!1:B2(t,r,e),handleDrop:(t,r,o,i)=>(!(r instanceof DragEvent)||!r.dataTransfer||z2(t,r,i,e),!1)}}),D2()]}});function F2(n){return/\.(?:mp4|webm|ogg|mov)$/i.test(n)}function q2(n){const{t:e}=oe.useLocale(),[t,r]=x.useState(""),o=x.useRef(null),[i,s]=x.useState(""),[l,a]=x.useState(!1),c=m=>{a(m.detail)};x.useEffect(()=>{const m=Cc(dr.UPLOAD_VIDEO(n.editor.id),c);return()=>{m()}},[]);const u=x.useMemo(()=>{var g;return(g=n.editor.extensionManager.extensions.find(y=>y.name===Sg.name))==null?void 0:g.options},[n.editor]);async function d(m){var w;const g=(w=m==null?void 0:m.target)==null?void 0:w.files;if(!n.editor||n.editor.isDestroyed||g.length===0)return;const y=g[0];let b="";u.upload?b=await u.upload(y):b=URL.createObjectURL(y),n.editor.chain().focus().setVideo({src:b,width:"100%"}).run(),a(!1)}function f(m){m.preventDefault(),m.stopPropagation(),t&&(n.editor.chain().focus().setVideo({src:t,width:"100%"}).run(),a(!1))}function h(m){var g;m.preventDefault(),(g=o.current)==null||g.click()}return p.jsxs(fr,{onOpenChange:a,open:l,children:[p.jsx(hr,{asChild:!0,children:p.jsx(St,{action:()=>a(!0),icon:n.icon,tooltip:n.tooltip})}),p.jsxs(Bn,{children:[p.jsx(zn,{children:e("editor.video.dialog.title")}),p.jsxs(cg,{activationMode:"manual",defaultValue:(u==null?void 0:u.resourceVideo)==="both"||(u==null?void 0:u.resourceVideo)==="upload"?"upload":"link",children:[p.jsxs(Mc,{className:"grid w-full grid-cols-2",children:[((u==null?void 0:u.resourceVideo)==="both"||(u==null?void 0:u.resourceVideo)==="upload")&&p.jsx(Wr,{value:"upload",children:e("editor.video.dialog.tab.upload")}),((u==null?void 0:u.resourceVideo)==="both"||(u==null?void 0:u.resourceVideo)==="link")&&p.jsx(Wr,{value:"link",children:e("editor.video.dialog.link")})]}),p.jsxs(Ur,{value:"upload",children:[p.jsx("div",{className:"flex items-center gap-[10px]",children:p.jsx(Ve,{className:"mt-1 w-full",onClick:h,size:"sm",children:e("editor.video.dialog.tab.upload")})}),p.jsx("input",{accept:"video/*",multiple:!0,onChange:d,ref:o,type:"file",style:{display:"none"}})]}),p.jsxs(Ur,{value:"link",children:[p.jsx("form",{onSubmit:f,children:p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(Rt,{autoFocus:!0,placeholder:e("editor.video.dialog.placeholder"),required:!0,type:"url",value:t,onChange:m=>{const g=m.target.value;if(!F2(g)){s("Invalid video URL"),r("");return}s(""),r(g)}}),p.jsx(Ve,{type:"submit",children:e("editor.video.dialog.button.apply")})]})}),i&&p.jsx("div",{className:"my-[5px] text-red-500",children:i})]})]})]})]})}function V2(n){return n=n.replace("https://youtu.be/","https://www.youtube.com/watch?v=").replace("watch?v=","embed/"),n=n.replace("https://vimeo.com/","https://player.vimeo.com/video/"),/^https?:\/\/www.bilibili.com\/video\/.*/i.test(n)&&(n=n.replace(/\?.*$/,"").replace("https://www.bilibili.com/video/","https://player.bilibili.com/player.html?bvid=")),n.includes("drive.google.com")&&(n=n.replace("/view","/preview")),n}const Sg=et.create({name:"video",group:"block",atom:!0,draggable:!0,addOptions(){return{divider:!1,spacer:!1,allowFullscreen:!0,upload:void 0,frameborder:!1,resourceVideo:"both",width:oe.VIDEO_SIZE["size-medium"],HTMLAttributes:{class:"iframe-wrapper",style:"display: flex;justify-content: center;"},button:({editor:n,t:e})=>{var t,r;return{component:q2,componentProps:{action:()=>{},isActive:()=>n.isActive("video")||!1,disabled:!((r=(t=n.can()).setVideo)!=null&&r.call(t,{})),icon:"Video",tooltip:e("editor.video.tooltip"),editor:n}}}}},addAttributes(){return{src:{default:null,renderHTML:({src:n})=>({src:n?V2(n):null})},width:{default:this.options.width,renderHTML:({width:n})=>({width:AS(n)})},frameborder:{default:this.options.frameborder?1:0,parseHTML:()=>this.options.frameborder?1:0},allowfullscreen:{default:this.options.allowFullscreen,parseHTML:()=>this.options.allowFullscreen}}},parseHTML(){return[{tag:"div[data-video] iframe"}]},renderHTML({HTMLAttributes:n}){const{width:e="100%"}=n??{},t={...n,width:"100%",height:"100%"},r=`position: relative;overflow: hidden;display: flex;flex: 1;max-width: ${e};`,o=`flex: 1;padding-bottom: ${9/16*100}%;`,l=["div",{style:r},["div",{style:o}],["iframe",t]];return["div",{...this.options.HTMLAttributes,"data-video":""},l]},addCommands(){return{setVideo:n=>({commands:e})=>e.insertContent({type:this.name,attrs:n}),updateVideo:n=>({commands:e})=>e.updateAttributes(this.name,n)}}}),H2=et.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:n}){return["tr",Ke(this.options.HTMLAttributes,n),0]}});var _a,Da;if(typeof WeakMap<"u"){let n=new WeakMap;_a=e=>n.get(e),Da=(e,t)=>(n.set(e,t),t)}else{const n=[];let t=0;_a=r=>{for(let o=0;o<n.length;o+=2)if(n[o]==r)return n[o+1]},Da=(r,o)=>(t==10&&(t=0),n[t++]=r,n[t++]=o)}var me=class{constructor(n,e,t,r){this.width=n,this.height=e,this.map=t,this.problems=r}findCell(n){for(let e=0;e<this.map.length;e++){const t=this.map[e];if(t!=n)continue;const r=e%this.width,o=e/this.width|0;let i=r+1,s=o+1;for(let l=1;i<this.width&&this.map[e+l]==t;l++)i++;for(let l=1;s<this.height&&this.map[e+this.width*l]==t;l++)s++;return{left:r,top:o,right:i,bottom:s}}throw new RangeError(`No cell with offset ${n} found`)}colCount(n){for(let e=0;e<this.map.length;e++)if(this.map[e]==n)return e%this.width;throw new RangeError(`No cell with offset ${n} found`)}nextCell(n,e,t){const{left:r,right:o,top:i,bottom:s}=this.findCell(n);return e=="horiz"?(t<0?r==0:o==this.width)?null:this.map[i*this.width+(t<0?r-1:o)]:(t<0?i==0:s==this.height)?null:this.map[r+this.width*(t<0?i-1:s)]}rectBetween(n,e){const{left:t,right:r,top:o,bottom:i}=this.findCell(n),{left:s,right:l,top:a,bottom:c}=this.findCell(e);return{left:Math.min(t,s),top:Math.min(o,a),right:Math.max(r,l),bottom:Math.max(i,c)}}cellsInRect(n){const e=[],t={};for(let r=n.top;r<n.bottom;r++)for(let o=n.left;o<n.right;o++){const i=r*this.width+o,s=this.map[i];t[s]||(t[s]=!0,!(o==n.left&&o&&this.map[i-1]==s||r==n.top&&r&&this.map[i-this.width]==s)&&e.push(s))}return e}positionAt(n,e,t){for(let r=0,o=0;;r++){const i=o+t.child(r).nodeSize;if(r==n){let s=e+n*this.width;const l=(n+1)*this.width;for(;s<l&&this.map[s]<o;)s++;return s==l?i-1:this.map[s]}o=i}}static get(n){return _a(n)||Da(n,W2(n))}};function W2(n){if(n.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+n.type.name);const e=U2(n),t=n.childCount,r=[];let o=0,i=null;const s=[];for(let c=0,u=e*t;c<u;c++)r[c]=0;for(let c=0,u=0;c<t;c++){const d=n.child(c);u++;for(let m=0;;m++){for(;o<r.length&&r[o]!=0;)o++;if(m==d.childCount)break;const g=d.child(m),{colspan:y,rowspan:b,colwidth:w}=g.attrs;for(let v=0;v<b;v++){if(v+c>=t){(i||(i=[])).push({type:"overlong_rowspan",pos:u,n:b-v});break}const S=o+v*e;for(let O=0;O<y;O++){r[S+O]==0?r[S+O]=u:(i||(i=[])).push({type:"collision",row:c,pos:u,n:y-O});const C=w&&w[O];if(C){const N=(S+O)%e*2,E=s[N];E==null||E!=C&&s[N+1]==1?(s[N]=C,s[N+1]=1):E==C&&s[N+1]++}}}o+=y,u+=g.nodeSize}const f=(c+1)*e;let h=0;for(;o<f;)r[o++]==0&&h++;h&&(i||(i=[])).push({type:"missing",row:c,n:h}),u++}(e===0||t===0)&&(i||(i=[])).push({type:"zero_sized"});const l=new me(e,t,r,i);let a=!1;for(let c=0;!a&&c<s.length;c+=2)s[c]!=null&&s[c+1]<t&&(a=!0);return a&&G2(l,s,n),l}function U2(n){let e=-1,t=!1;for(let r=0;r<n.childCount;r++){const o=n.child(r);let i=0;if(t)for(let s=0;s<r;s++){const l=n.child(s);for(let a=0;a<l.childCount;a++){const c=l.child(a);s+c.attrs.rowspan>r&&(i+=c.attrs.colspan)}}for(let s=0;s<o.childCount;s++){const l=o.child(s);i+=l.attrs.colspan,l.attrs.rowspan>1&&(t=!0)}e==-1?e=i:e!=i&&(e=Math.max(e,i))}return e}function G2(n,e,t){n.problems||(n.problems=[]);const r={};for(let o=0;o<n.map.length;o++){const i=n.map[o];if(r[i])continue;r[i]=!0;const s=t.nodeAt(i);if(!s)throw new RangeError(`No cell with offset ${i} found`);let l=null;const a=s.attrs;for(let c=0;c<a.colspan;c++){const u=(o+c)%n.width,d=e[u*2];d!=null&&(!a.colwidth||a.colwidth[c]!=d)&&((l||(l=K2(a)))[c]=d)}l&&n.problems.unshift({type:"colwidth mismatch",pos:i,colwidth:l})}}function K2(n){if(n.colwidth)return n.colwidth.slice();const e=[];for(let t=0;t<n.colspan;t++)e.push(0);return e}function Ue(n){let e=n.cached.tableNodeTypes;if(!e){e=n.cached.tableNodeTypes={};for(const t in n.nodes){const r=n.nodes[t],o=r.spec.tableRole;o&&(e[o]=r)}}return e}var Yt=new ct("selectingCells");function pr(n){for(let e=n.depth-1;e>0;e--)if(n.node(e).type.spec.tableRole=="row")return n.node(0).resolve(n.before(e+1));return null}function J2(n){for(let e=n.depth;e>0;e--){const t=n.node(e).type.spec.tableRole;if(t==="cell"||t==="header_cell")return n.node(e)}return null}function Ct(n){const e=n.selection.$head;for(let t=e.depth;t>0;t--)if(e.node(t).type.spec.tableRole=="row")return!0;return!1}function ki(n){const e=n.selection;if("$anchorCell"in e&&e.$anchorCell)return e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell;if("node"in e&&e.node&&e.node.type.spec.tableRole=="cell")return e.$anchor;const t=pr(e.$head)||X2(e.$head);if(t)return t;throw new RangeError(`No cell found around position ${e.head}`)}function X2(n){for(let e=n.nodeAfter,t=n.pos;e;e=e.firstChild,t++){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return n.doc.resolve(t)}for(let e=n.nodeBefore,t=n.pos;e;e=e.lastChild,t--){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return n.doc.resolve(t-e.nodeSize)}}function ja(n){return n.parent.type.spec.tableRole=="row"&&!!n.nodeAfter}function Y2(n){return n.node(0).resolve(n.pos+n.nodeAfter.nodeSize)}function Rc(n,e){return n.depth==e.depth&&n.pos>=e.start(-1)&&n.pos<=e.end(-1)}function Cg(n,e,t){const r=n.node(-1),o=me.get(r),i=n.start(-1),s=o.nextCell(n.pos-i,e,t);return s==null?null:n.node(0).resolve(i+s)}function In(n,e,t=1){const r={...n,colspan:n.colspan-t};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(e,t),r.colwidth.some(o=>o>0)||(r.colwidth=null)),r}function kg(n,e,t=1){const r={...n,colspan:n.colspan+t};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let o=0;o<t;o++)r.colwidth.splice(e,0,0)}return r}function Z2(n,e,t){const r=Ue(e.type.schema).header_cell;for(let o=0;o<n.height;o++)if(e.nodeAt(n.map[t+o*n.width]).type!=r)return!1;return!0}var ge=class jt extends ee{constructor(e,t=e){const r=e.node(-1),o=me.get(r),i=e.start(-1),s=o.rectBetween(e.pos-i,t.pos-i),l=e.node(0),a=o.cellsInRect(s).filter(u=>u!=t.pos-i);a.unshift(t.pos-i);const c=a.map(u=>{const d=r.nodeAt(u);if(!d)throw RangeError(`No cell with offset ${u} found`);const f=i+u+1;return new ec(l.resolve(f),l.resolve(f+d.content.size))});super(c[0].$from,c[0].$to,c),this.$anchorCell=e,this.$headCell=t}map(e,t){const r=e.resolve(t.map(this.$anchorCell.pos)),o=e.resolve(t.map(this.$headCell.pos));if(ja(r)&&ja(o)&&Rc(r,o)){const i=this.$anchorCell.node(-1)!=r.node(-1);return i&&this.isRowSelection()?jt.rowSelection(r,o):i&&this.isColSelection()?jt.colSelection(r,o):new jt(r,o)}return K.between(r,o)}content(){const e=this.$anchorCell.node(-1),t=me.get(e),r=this.$anchorCell.start(-1),o=t.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),i={},s=[];for(let a=o.top;a<o.bottom;a++){const c=[];for(let u=a*t.width+o.left,d=o.left;d<o.right;d++,u++){const f=t.map[u];if(i[f])continue;i[f]=!0;const h=t.findCell(f);let m=e.nodeAt(f);if(!m)throw RangeError(`No cell with offset ${f} found`);const g=o.left-h.left,y=h.right-o.right;if(g>0||y>0){let b=m.attrs;if(g>0&&(b=In(b,0,g)),y>0&&(b=In(b,b.colspan-y,y)),h.left<o.left){if(m=m.type.createAndFill(b),!m)throw RangeError(`Could not create cell with attrs ${JSON.stringify(b)}`)}else m=m.type.create(b,m.content)}if(h.top<o.top||h.bottom>o.bottom){const b={...m.attrs,rowspan:Math.min(h.bottom,o.bottom)-Math.max(h.top,o.top)};h.top<o.top?m=m.type.createAndFill(b):m=m.type.create(b,m.content)}c.push(m)}s.push(e.child(a).copy(R.from(c)))}const l=this.isColSelection()&&this.isRowSelection()?e:s;return new z(R.from(l),1,1)}replace(e,t=z.empty){const r=e.steps.length,o=this.ranges;for(let s=0;s<o.length;s++){const{$from:l,$to:a}=o[s],c=e.mapping.slice(r);e.replace(c.map(l.pos),c.map(a.pos),s?z.empty:t)}const i=ee.findFrom(e.doc.resolve(e.mapping.slice(r).map(this.to)),-1);i&&e.setSelection(i)}replaceWith(e,t){this.replace(e,new z(R.from(t),0,0))}forEachCell(e){const t=this.$anchorCell.node(-1),r=me.get(t),o=this.$anchorCell.start(-1),i=r.cellsInRect(r.rectBetween(this.$anchorCell.pos-o,this.$headCell.pos-o));for(let s=0;s<i.length;s++)e(t.nodeAt(i[s]),o+i[s])}isColSelection(){const e=this.$anchorCell.index(-1),t=this.$headCell.index(-1);if(Math.min(e,t)>0)return!1;const r=e+this.$anchorCell.nodeAfter.attrs.rowspan,o=t+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(r,o)==this.$headCell.node(-1).childCount}static colSelection(e,t=e){const r=e.node(-1),o=me.get(r),i=e.start(-1),s=o.findCell(e.pos-i),l=o.findCell(t.pos-i),a=e.node(0);return s.top<=l.top?(s.top>0&&(e=a.resolve(i+o.map[s.left])),l.bottom<o.height&&(t=a.resolve(i+o.map[o.width*(o.height-1)+l.right-1]))):(l.top>0&&(t=a.resolve(i+o.map[l.left])),s.bottom<o.height&&(e=a.resolve(i+o.map[o.width*(o.height-1)+s.right-1]))),new jt(e,t)}isRowSelection(){const e=this.$anchorCell.node(-1),t=me.get(e),r=this.$anchorCell.start(-1),o=t.colCount(this.$anchorCell.pos-r),i=t.colCount(this.$headCell.pos-r);if(Math.min(o,i)>0)return!1;const s=o+this.$anchorCell.nodeAfter.attrs.colspan,l=i+this.$headCell.nodeAfter.attrs.colspan;return Math.max(s,l)==t.width}eq(e){return e instanceof jt&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,t=e){const r=e.node(-1),o=me.get(r),i=e.start(-1),s=o.findCell(e.pos-i),l=o.findCell(t.pos-i),a=e.node(0);return s.left<=l.left?(s.left>0&&(e=a.resolve(i+o.map[s.top*o.width])),l.right<o.width&&(t=a.resolve(i+o.map[o.width*(l.top+1)-1]))):(l.left>0&&(t=a.resolve(i+o.map[l.top*o.width])),s.right<o.width&&(e=a.resolve(i+o.map[o.width*(s.top+1)-1]))),new jt(e,t)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,t){return new jt(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,r=t){return new jt(e.resolve(t),e.resolve(r))}getBookmark(){return new Q2(this.$anchorCell.pos,this.$headCell.pos)}};ge.prototype.visible=!1;ee.jsonID("cell",ge);var Q2=class Tg{constructor(e,t){this.anchor=e,this.head=t}map(e){return new Tg(e.map(this.anchor),e.map(this.head))}resolve(e){const t=e.resolve(this.anchor),r=e.resolve(this.head);return t.parent.type.spec.tableRole=="row"&&r.parent.type.spec.tableRole=="row"&&t.index()<t.parent.childCount&&r.index()<r.parent.childCount&&Rc(t,r)?new ge(t,r):ee.near(r,1)}};function eC(n){if(!(n.selection instanceof ge))return null;const e=[];return n.selection.forEachCell((t,r)=>{e.push(_e.node(r,r+t.nodeSize,{class:"selectedCell"}))}),ve.create(n.doc,e)}function tC({$from:n,$to:e}){if(n.pos==e.pos||n.pos<e.pos-6)return!1;let t=n.pos,r=e.pos,o=n.depth;for(;o>=0&&!(n.after(o+1)<n.end(o));o--,t++);for(let i=e.depth;i>=0&&!(e.before(i+1)>e.start(i));i--,r--);return t==r&&/row|table/.test(n.node(o).type.spec.tableRole)}function nC({$from:n,$to:e}){let t,r;for(let o=n.depth;o>0;o--){const i=n.node(o);if(i.type.spec.tableRole==="cell"||i.type.spec.tableRole==="header_cell"){t=i;break}}for(let o=e.depth;o>0;o--){const i=e.node(o);if(i.type.spec.tableRole==="cell"||i.type.spec.tableRole==="header_cell"){r=i;break}}return t!==r&&e.parentOffset===0}function rC(n,e,t){const r=(e||n).selection,o=(e||n).doc;let i,s;if(r instanceof U&&(s=r.node.type.spec.tableRole)){if(s=="cell"||s=="header_cell")i=ge.create(o,r.from);else if(s=="row"){const l=o.resolve(r.from+1);i=ge.rowSelection(l,l)}else if(!t){const l=me.get(r.node),a=r.from+1,c=a+l.map[l.width*l.height-1];i=ge.create(o,a+1,c)}}else r instanceof K&&tC(r)?i=K.create(o,r.from):r instanceof K&&nC(r)&&(i=K.create(o,r.$from.start(),r.$from.end()));return i&&(e||(e=n.tr)).setSelection(i),e}var oC=new ct("fix-tables");function Mg(n,e,t,r){const o=n.childCount,i=e.childCount;e:for(let s=0,l=0;s<i;s++){const a=e.child(s);for(let c=l,u=Math.min(o,s+3);c<u;c++)if(n.child(c)==a){l=c+1,t+=a.nodeSize;continue e}r(a,t),l<o&&n.child(l).sameMarkup(a)?Mg(n.child(l),a,t+1,r):a.nodesBetween(0,a.content.size,r,t+1),t+=a.nodeSize}}function Eg(n,e){let t;const r=(o,i)=>{o.type.spec.tableRole=="table"&&(t=iC(n,o,i,t))};return e?e.doc!=n.doc&&Mg(e.doc,n.doc,0,r):n.doc.descendants(r),t}function iC(n,e,t,r){const o=me.get(e);if(!o.problems)return r;r||(r=n.tr);const i=[];for(let a=0;a<o.height;a++)i.push(0);for(let a=0;a<o.problems.length;a++){const c=o.problems[a];if(c.type=="collision"){const u=e.nodeAt(c.pos);if(!u)continue;const d=u.attrs;for(let f=0;f<d.rowspan;f++)i[c.row+f]+=c.n;r.setNodeMarkup(r.mapping.map(t+1+c.pos),null,In(d,d.colspan-c.n,c.n))}else if(c.type=="missing")i[c.row]+=c.n;else if(c.type=="overlong_rowspan"){const u=e.nodeAt(c.pos);if(!u)continue;r.setNodeMarkup(r.mapping.map(t+1+c.pos),null,{...u.attrs,rowspan:u.attrs.rowspan-c.n})}else if(c.type=="colwidth mismatch"){const u=e.nodeAt(c.pos);if(!u)continue;r.setNodeMarkup(r.mapping.map(t+1+c.pos),null,{...u.attrs,colwidth:c.colwidth})}else if(c.type=="zero_sized"){const u=r.mapping.map(t);r.delete(u,u+e.nodeSize)}}let s,l;for(let a=0;a<i.length;a++)i[a]&&(s==null&&(s=a),l=a);for(let a=0,c=t+1;a<o.height;a++){const u=e.child(a),d=c+u.nodeSize,f=i[a];if(f>0){let h="cell";u.firstChild&&(h=u.firstChild.type.spec.tableRole);const m=[];for(let y=0;y<f;y++){const b=Ue(n.schema)[h].createAndFill();b&&m.push(b)}const g=(a==0||s==a-1)&&l==a?c+1:d-1;r.insert(r.mapping.map(g),m)}c=d}return r.setMeta(oC,{fixTables:!0})}function It(n){const e=n.selection,t=ki(n),r=t.node(-1),o=t.start(-1),i=me.get(r);return{...e instanceof ge?i.rectBetween(e.$anchorCell.pos-o,e.$headCell.pos-o):i.findCell(t.pos-o),tableStart:o,map:i,table:r}}function Og(n,{map:e,tableStart:t,table:r},o){let i=o>0?-1:0;Z2(e,r,o+i)&&(i=o==0||o==e.width?null:0);for(let s=0;s<e.height;s++){const l=s*e.width+o;if(o>0&&o<e.width&&e.map[l-1]==e.map[l]){const a=e.map[l],c=r.nodeAt(a);n.setNodeMarkup(n.mapping.map(t+a),null,kg(c.attrs,o-e.colCount(a))),s+=c.attrs.rowspan-1}else{const a=i==null?Ue(r.type.schema).cell:r.nodeAt(e.map[l+i]).type,c=e.positionAt(s,o,r);n.insert(n.mapping.map(t+c),a.createAndFill())}}return n}function sC(n,e){if(!Ct(n))return!1;if(e){const t=It(n);e(Og(n.tr,t,t.left))}return!0}function lC(n,e){if(!Ct(n))return!1;if(e){const t=It(n);e(Og(n.tr,t,t.right))}return!0}function aC(n,{map:e,table:t,tableStart:r},o){const i=n.mapping.maps.length;for(let s=0;s<e.height;){const l=s*e.width+o,a=e.map[l],c=t.nodeAt(a),u=c.attrs;if(o>0&&e.map[l-1]==a||o<e.width-1&&e.map[l+1]==a)n.setNodeMarkup(n.mapping.slice(i).map(r+a),null,In(u,o-e.colCount(a)));else{const d=n.mapping.slice(i).map(r+a);n.delete(d,d+c.nodeSize)}s+=u.rowspan}}function cC(n,e){if(!Ct(n))return!1;if(e){const t=It(n),r=n.tr;if(t.left==0&&t.right==t.map.width)return!1;for(let o=t.right-1;aC(r,t,o),o!=t.left;o--){const i=t.tableStart?r.doc.nodeAt(t.tableStart-1):r.doc;if(!i)throw RangeError("No table found");t.table=i,t.map=me.get(i)}e(r)}return!0}function uC(n,e,t){var r;const o=Ue(e.type.schema).header_cell;for(let i=0;i<n.width;i++)if(((r=e.nodeAt(n.map[i+t*n.width]))==null?void 0:r.type)!=o)return!1;return!0}function Ag(n,{map:e,tableStart:t,table:r},o){var i;let s=t;for(let c=0;c<o;c++)s+=r.child(c).nodeSize;const l=[];let a=o>0?-1:0;uC(e,r,o+a)&&(a=o==0||o==e.height?null:0);for(let c=0,u=e.width*o;c<e.width;c++,u++)if(o>0&&o<e.height&&e.map[u]==e.map[u-e.width]){const d=e.map[u],f=r.nodeAt(d).attrs;n.setNodeMarkup(t+d,null,{...f,rowspan:f.rowspan+1}),c+=f.colspan-1}else{const d=a==null?Ue(r.type.schema).cell:(i=r.nodeAt(e.map[u+a*e.width]))==null?void 0:i.type,f=d==null?void 0:d.createAndFill();f&&l.push(f)}return n.insert(s,Ue(r.type.schema).row.create(null,l)),n}function dC(n,e){if(!Ct(n))return!1;if(e){const t=It(n);e(Ag(n.tr,t,t.top))}return!0}function fC(n,e){if(!Ct(n))return!1;if(e){const t=It(n);e(Ag(n.tr,t,t.bottom))}return!0}function hC(n,{map:e,table:t,tableStart:r},o){let i=0;for(let c=0;c<o;c++)i+=t.child(c).nodeSize;const s=i+t.child(o).nodeSize,l=n.mapping.maps.length;n.delete(i+r,s+r);const a=new Set;for(let c=0,u=o*e.width;c<e.width;c++,u++){const d=e.map[u];if(!a.has(d)){if(a.add(d),o>0&&d==e.map[u-e.width]){const f=t.nodeAt(d).attrs;n.setNodeMarkup(n.mapping.slice(l).map(d+r),null,{...f,rowspan:f.rowspan-1}),c+=f.colspan-1}else if(o<e.height&&d==e.map[u+e.width]){const f=t.nodeAt(d),h=f.attrs,m=f.type.create({...h,rowspan:f.attrs.rowspan-1},f.content),g=e.positionAt(o+1,c,t);n.insert(n.mapping.slice(l).map(r+g),m),c+=h.colspan-1}}}}function pC(n,e){if(!Ct(n))return!1;if(e){const t=It(n),r=n.tr;if(t.top==0&&t.bottom==t.map.height)return!1;for(let o=t.bottom-1;hC(r,t,o),o!=t.top;o--){const i=t.tableStart?r.doc.nodeAt(t.tableStart-1):r.doc;if(!i)throw RangeError("No table found");t.table=i,t.map=me.get(t.table)}e(r)}return!0}function Ed(n){const e=n.content;return e.childCount==1&&e.child(0).isTextblock&&e.child(0).childCount==0}function mC({width:n,height:e,map:t},r){let o=r.top*n+r.left,i=o,s=(r.bottom-1)*n+r.left,l=o+(r.right-r.left-1);for(let a=r.top;a<r.bottom;a++){if(r.left>0&&t[i]==t[i-1]||r.right<n&&t[l]==t[l+1])return!0;i+=n,l+=n}for(let a=r.left;a<r.right;a++){if(r.top>0&&t[o]==t[o-n]||r.bottom<e&&t[s]==t[s+n])return!0;o++,s++}return!1}function Od(n,e){const t=n.selection;if(!(t instanceof ge)||t.$anchorCell.pos==t.$headCell.pos)return!1;const r=It(n),{map:o}=r;if(mC(o,r))return!1;if(e){const i=n.tr,s={};let l=R.empty,a,c;for(let u=r.top;u<r.bottom;u++)for(let d=r.left;d<r.right;d++){const f=o.map[u*o.width+d],h=r.table.nodeAt(f);if(!(s[f]||!h))if(s[f]=!0,a==null)a=f,c=h;else{Ed(h)||(l=l.append(h.content));const m=i.mapping.map(f+r.tableStart);i.delete(m,m+h.nodeSize)}}if(a==null||c==null)return!0;if(i.setNodeMarkup(a+r.tableStart,null,{...kg(c.attrs,c.attrs.colspan,r.right-r.left-c.attrs.colspan),rowspan:r.bottom-r.top}),l.size){const u=a+1+c.content.size,d=Ed(c)?a+1:u;i.replaceWith(d+r.tableStart,u+r.tableStart,l)}i.setSelection(new ge(i.doc.resolve(a+r.tableStart))),e(i)}return!0}function Ad(n,e){const t=Ue(n.schema);return gC(({node:r})=>t[r.type.spec.tableRole])(n,e)}function gC(n){return(e,t)=>{var r;const o=e.selection;let i,s;if(o instanceof ge){if(o.$anchorCell.pos!=o.$headCell.pos)return!1;i=o.$anchorCell.nodeAfter,s=o.$anchorCell.pos}else{if(i=J2(o.$from),!i)return!1;s=(r=pr(o.$from))==null?void 0:r.pos}if(i==null||s==null||i.attrs.colspan==1&&i.attrs.rowspan==1)return!1;if(t){let l=i.attrs;const a=[],c=l.colwidth;l.rowspan>1&&(l={...l,rowspan:1}),l.colspan>1&&(l={...l,colspan:1});const u=It(e),d=e.tr;for(let h=0;h<u.right-u.left;h++)a.push(c?{...l,colwidth:c&&c[h]?[c[h]]:null}:l);let f;for(let h=u.top;h<u.bottom;h++){let m=u.map.positionAt(h,u.left,u.table);h==u.top&&(m+=i.nodeSize);for(let g=u.left,y=0;g<u.right;g++,y++)g==u.left&&h==u.top||d.insert(f=d.mapping.map(m+u.tableStart,1),n({node:i,row:h,col:g}).createAndFill(a[y]))}d.setNodeMarkup(s,n({node:i,row:u.top,col:u.left}),a[0]),o instanceof ge&&d.setSelection(new ge(d.doc.resolve(o.$anchorCell.pos),f?d.doc.resolve(f):void 0)),t(d)}return!0}}function yC(n,e){return function(t,r){if(!Ct(t))return!1;const o=ki(t);if(o.nodeAfter.attrs[n]===e)return!1;if(r){const i=t.tr;t.selection instanceof ge?t.selection.forEachCell((s,l)=>{s.attrs[n]!==e&&i.setNodeMarkup(l,null,{...s.attrs,[n]:e})}):i.setNodeMarkup(o.pos,null,{...o.nodeAfter.attrs,[n]:e}),r(i)}return!0}}function bC(n){return function(e,t){if(!Ct(e))return!1;if(t){const r=Ue(e.schema),o=It(e),i=e.tr,s=o.map.cellsInRect(n=="column"?{left:o.left,top:0,right:o.right,bottom:o.map.height}:n=="row"?{left:0,top:o.top,right:o.map.width,bottom:o.bottom}:o),l=s.map(a=>o.table.nodeAt(a));for(let a=0;a<s.length;a++)l[a].type==r.header_cell&&i.setNodeMarkup(o.tableStart+s[a],r.cell,l[a].attrs);if(i.steps.length==0)for(let a=0;a<s.length;a++)i.setNodeMarkup(o.tableStart+s[a],r.header_cell,l[a].attrs);t(i)}return!0}}function Nd(n,e,t){const r=e.map.cellsInRect({left:0,top:0,right:n=="row"?e.map.width:1,bottom:n=="column"?e.map.height:1});for(let o=0;o<r.length;o++){const i=e.table.nodeAt(r[o]);if(i&&i.type!==t.header_cell)return!1}return!0}function Gr(n,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?bC(n):function(t,r){if(!Ct(t))return!1;if(r){const o=Ue(t.schema),i=It(t),s=t.tr,l=Nd("row",i,o),a=Nd("column",i,o),u=(n==="column"?l:n==="row"?a:!1)?1:0,d=n=="column"?{left:0,top:u,right:1,bottom:i.map.height}:n=="row"?{left:u,top:0,right:i.map.width,bottom:1}:i,f=n=="column"?a?o.cell:o.header_cell:n=="row"?l?o.cell:o.header_cell:o.cell;i.map.cellsInRect(d).forEach(h=>{const m=h+i.tableStart,g=s.doc.nodeAt(m);g&&s.setNodeMarkup(m,f,g.attrs)}),r(s)}return!0}}Gr("row",{useDeprecatedLogic:!0});Gr("column",{useDeprecatedLogic:!0});var vC=Gr("cell",{useDeprecatedLogic:!0});function xC(n,e){if(e<0){const t=n.nodeBefore;if(t)return n.pos-t.nodeSize;for(let r=n.index(-1)-1,o=n.before();r>=0;r--){const i=n.node(-1).child(r),s=i.lastChild;if(s)return o-1-s.nodeSize;o-=i.nodeSize}}else{if(n.index()<n.parent.childCount-1)return n.pos+n.nodeAfter.nodeSize;const t=n.node(-1);for(let r=n.indexAfter(-1),o=n.after();r<t.childCount;r++){const i=t.child(r);if(i.childCount)return o+1;o+=i.nodeSize}}return null}function Rd(n){return function(e,t){if(!Ct(e))return!1;const r=xC(ki(e),n);if(r==null)return!1;if(t){const o=e.doc.resolve(r);t(e.tr.setSelection(K.between(o,Y2(o))).scrollIntoView())}return!0}}function wC(n,e){const t=n.selection.$anchor;for(let r=t.depth;r>0;r--)if(t.node(r).type.spec.tableRole=="table")return e&&e(n.tr.delete(t.before(r),t.after(r)).scrollIntoView()),!0;return!1}function mo(n,e){const t=n.selection;if(!(t instanceof ge))return!1;if(e){const r=n.tr,o=Ue(n.schema).cell.createAndFill().content;t.forEachCell((i,s)=>{i.content.eq(o)||r.replace(r.mapping.map(s+1),r.mapping.map(s+i.nodeSize-1),new z(o,0,0))}),r.docChanged&&e(r)}return!0}function SC(n){if(!n.size)return null;let{content:e,openStart:t,openEnd:r}=n;for(;e.childCount==1&&(t>0&&r>0||e.child(0).type.spec.tableRole=="table");)t--,r--,e=e.child(0).content;const o=e.child(0),i=o.type.spec.tableRole,s=o.type.schema,l=[];if(i=="row")for(let a=0;a<e.childCount;a++){let c=e.child(a).content;const u=a?0:Math.max(0,t-1),d=a<e.childCount-1?0:Math.max(0,r-1);(u||d)&&(c=Pa(Ue(s).row,new z(c,u,d)).content),l.push(c)}else if(i=="cell"||i=="header_cell")l.push(t||r?Pa(Ue(s).row,new z(e,t,r)).content:e);else return null;return CC(s,l)}function CC(n,e){const t=[];for(let o=0;o<e.length;o++){const i=e[o];for(let s=i.childCount-1;s>=0;s--){const{rowspan:l,colspan:a}=i.child(s).attrs;for(let c=o;c<o+l;c++)t[c]=(t[c]||0)+a}}let r=0;for(let o=0;o<t.length;o++)r=Math.max(r,t[o]);for(let o=0;o<t.length;o++)if(o>=e.length&&e.push(R.empty),t[o]<r){const i=Ue(n).cell.createAndFill(),s=[];for(let l=t[o];l<r;l++)s.push(i);e[o]=e[o].append(R.from(s))}return{height:e.length,width:r,rows:e}}function Pa(n,e){const t=n.createAndFill();return new Qa(t).replace(0,t.content.size,e).doc}function kC({width:n,height:e,rows:t},r,o){if(n!=r){const i=[],s=[];for(let l=0;l<t.length;l++){const a=t[l],c=[];for(let u=i[l]||0,d=0;u<r;d++){let f=a.child(d%a.childCount);u+f.attrs.colspan>r&&(f=f.type.createChecked(In(f.attrs,f.attrs.colspan,u+f.attrs.colspan-r),f.content)),c.push(f),u+=f.attrs.colspan;for(let h=1;h<f.attrs.rowspan;h++)i[l+h]=(i[l+h]||0)+f.attrs.colspan}s.push(R.from(c))}t=s,n=r}if(e!=o){const i=[];for(let s=0,l=0;s<o;s++,l++){const a=[],c=t[l%e];for(let u=0;u<c.childCount;u++){let d=c.child(u);s+d.attrs.rowspan>o&&(d=d.type.create({...d.attrs,rowspan:Math.max(1,o-d.attrs.rowspan)},d.content)),a.push(d)}i.push(R.from(a))}t=i,e=o}return{width:n,height:e,rows:t}}function TC(n,e,t,r,o,i,s){const l=n.doc.type.schema,a=Ue(l);let c,u;if(o>e.width)for(let d=0,f=0;d<e.height;d++){const h=t.child(d);f+=h.nodeSize;const m=[];let g;h.lastChild==null||h.lastChild.type==a.cell?g=c||(c=a.cell.createAndFill()):g=u||(u=a.header_cell.createAndFill());for(let y=e.width;y<o;y++)m.push(g);n.insert(n.mapping.slice(s).map(f-1+r),m)}if(i>e.height){const d=[];for(let m=0,g=(e.height-1)*e.width;m<Math.max(e.width,o);m++){const y=m>=e.width?!1:t.nodeAt(e.map[g+m]).type==a.header_cell;d.push(y?u||(u=a.header_cell.createAndFill()):c||(c=a.cell.createAndFill()))}const f=a.row.create(null,R.from(d)),h=[];for(let m=e.height;m<i;m++)h.push(f);n.insert(n.mapping.slice(s).map(r+t.nodeSize-2),h)}return!!(c||u)}function Id(n,e,t,r,o,i,s,l){if(s==0||s==e.height)return!1;let a=!1;for(let c=o;c<i;c++){const u=s*e.width+c,d=e.map[u];if(e.map[u-e.width]==d){a=!0;const f=t.nodeAt(d),{top:h,left:m}=e.findCell(d);n.setNodeMarkup(n.mapping.slice(l).map(d+r),null,{...f.attrs,rowspan:s-h}),n.insert(n.mapping.slice(l).map(e.positionAt(s,m,t)),f.type.createAndFill({...f.attrs,rowspan:h+f.attrs.rowspan-s})),c+=f.attrs.colspan-1}}return a}function _d(n,e,t,r,o,i,s,l){if(s==0||s==e.width)return!1;let a=!1;for(let c=o;c<i;c++){const u=c*e.width+s,d=e.map[u];if(e.map[u-1]==d){a=!0;const f=t.nodeAt(d),h=e.colCount(d),m=n.mapping.slice(l).map(d+r);n.setNodeMarkup(m,null,In(f.attrs,s-h,f.attrs.colspan-(s-h))),n.insert(m+f.nodeSize,f.type.createAndFill(In(f.attrs,0,s-h))),c+=f.attrs.rowspan-1}}return a}function Dd(n,e,t,r,o){let i=t?n.doc.nodeAt(t-1):n.doc;if(!i)throw new Error("No table found");let s=me.get(i);const{top:l,left:a}=r,c=a+o.width,u=l+o.height,d=n.tr;let f=0;function h(){if(i=t?d.doc.nodeAt(t-1):d.doc,!i)throw new Error("No table found");s=me.get(i),f=d.mapping.maps.length}TC(d,s,i,t,c,u,f)&&h(),Id(d,s,i,t,a,c,l,f)&&h(),Id(d,s,i,t,a,c,u,f)&&h(),_d(d,s,i,t,l,u,a,f)&&h(),_d(d,s,i,t,l,u,c,f)&&h();for(let m=l;m<u;m++){const g=s.positionAt(m,a,i),y=s.positionAt(m,c,i);d.replace(d.mapping.slice(f).map(g+t),d.mapping.slice(f).map(y+t),new z(o.rows[m-l],0,0))}h(),d.setSelection(new ge(d.doc.resolve(t+s.positionAt(l,a,i)),d.doc.resolve(t+s.positionAt(u-1,c-1,i)))),e(d)}var MC=dc({ArrowLeft:go("horiz",-1),ArrowRight:go("horiz",1),ArrowUp:go("vert",-1),ArrowDown:go("vert",1),"Shift-ArrowLeft":yo("horiz",-1),"Shift-ArrowRight":yo("horiz",1),"Shift-ArrowUp":yo("vert",-1),"Shift-ArrowDown":yo("vert",1),Backspace:mo,"Mod-Backspace":mo,Delete:mo,"Mod-Delete":mo});function Po(n,e,t){return t.eq(n.selection)?!1:(e&&e(n.tr.setSelection(t).scrollIntoView()),!0)}function go(n,e){return(t,r,o)=>{if(!o)return!1;const i=t.selection;if(i instanceof ge)return Po(t,r,ee.near(i.$headCell,e));if(n!="horiz"&&!i.empty)return!1;const s=Ng(o,n,e);if(s==null)return!1;if(n=="horiz")return Po(t,r,ee.near(t.doc.resolve(i.head+e),e));{const l=t.doc.resolve(s),a=Cg(l,n,e);let c;return a?c=ee.near(a,1):e<0?c=ee.near(t.doc.resolve(l.before(-1)),-1):c=ee.near(t.doc.resolve(l.after(-1)),1),Po(t,r,c)}}}function yo(n,e){return(t,r,o)=>{if(!o)return!1;const i=t.selection;let s;if(i instanceof ge)s=i;else{const a=Ng(o,n,e);if(a==null)return!1;s=new ge(t.doc.resolve(a))}const l=Cg(s.$headCell,n,e);return l?Po(t,r,new ge(s.$anchorCell,l)):!1}}function EC(n,e){const t=n.state.doc,r=pr(t.resolve(e));return r?(n.dispatch(n.state.tr.setSelection(new ge(r))),!0):!1}function OC(n,e,t){if(!Ct(n.state))return!1;let r=SC(t);const o=n.state.selection;if(o instanceof ge){r||(r={width:1,height:1,rows:[R.from(Pa(Ue(n.state.schema).cell,t))]});const i=o.$anchorCell.node(-1),s=o.$anchorCell.start(-1),l=me.get(i).rectBetween(o.$anchorCell.pos-s,o.$headCell.pos-s);return r=kC(r,l.right-l.left,l.bottom-l.top),Dd(n.state,n.dispatch,s,l,r),!0}else if(r){const i=ki(n.state),s=i.start(-1);return Dd(n.state,n.dispatch,s,me.get(i.node(-1)).findCell(i.pos-s),r),!0}else return!1}function AC(n,e){var t;if(e.ctrlKey||e.metaKey)return;const r=jd(n,e.target);let o;if(e.shiftKey&&n.state.selection instanceof ge)i(n.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(o=pr(n.state.selection.$anchor))!=null&&((t=ps(n,e))==null?void 0:t.pos)!=o.pos)i(o,e),e.preventDefault();else if(!r)return;function i(a,c){let u=ps(n,c);const d=Yt.getState(n.state)==null;if(!u||!Rc(a,u))if(d)u=a;else return;const f=new ge(a,u);if(d||!n.state.selection.eq(f)){const h=n.state.tr.setSelection(f);d&&h.setMeta(Yt,a.pos),n.dispatch(h)}}function s(){n.root.removeEventListener("mouseup",s),n.root.removeEventListener("dragstart",s),n.root.removeEventListener("mousemove",l),Yt.getState(n.state)!=null&&n.dispatch(n.state.tr.setMeta(Yt,-1))}function l(a){const c=a,u=Yt.getState(n.state);let d;if(u!=null)d=n.state.doc.resolve(u);else if(jd(n,c.target)!=r&&(d=ps(n,e),!d))return s();d&&i(d,c)}n.root.addEventListener("mouseup",s),n.root.addEventListener("dragstart",s),n.root.addEventListener("mousemove",l)}function Ng(n,e,t){if(!(n.state.selection instanceof K))return null;const{$head:r}=n.state.selection;for(let o=r.depth-1;o>=0;o--){const i=r.node(o);if((t<0?r.index(o):r.indexAfter(o))!=(t<0?0:i.childCount))return null;if(i.type.spec.tableRole=="cell"||i.type.spec.tableRole=="header_cell"){const l=r.before(o),a=e=="vert"?t>0?"down":"up":t>0?"right":"left";return n.endOfTextblock(a)?l:null}}return null}function jd(n,e){for(;e&&e!=n.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function ps(n,e){const t=n.posAtCoords({left:e.clientX,top:e.clientY});return t&&t?pr(n.state.doc.resolve(t.pos)):null}var NC=class{constructor(e,t){this.node=e,this.defaultCellMinWidth=t,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${t}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),La(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!=this.node.type?!1:(this.node=e,La(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function La(n,e,t,r,o,i){var s;let l=0,a=!0,c=e.firstChild;const u=n.firstChild;if(u){for(let d=0,f=0;d<u.childCount;d++){const{colspan:h,colwidth:m}=u.child(d).attrs;for(let g=0;g<h;g++,f++){const y=o==f?i:m&&m[g],b=y?y+"px":"";if(l+=y||r,y||(a=!1),c)c.style.width!=b&&(c.style.width=b),c=c.nextSibling;else{const w=document.createElement("col");w.style.width=b,e.appendChild(w)}}}for(;c;){const d=c.nextSibling;(s=c.parentNode)==null||s.removeChild(c),c=d}a?(t.style.width=l+"px",t.style.minWidth=""):(t.style.width="",t.style.minWidth=l+"px")}}var at=new ct("tableColumnResizing");function RC({handleWidth:n=5,cellMinWidth:e=25,defaultCellMinWidth:t=100,View:r=NC,lastColumnResizable:o=!0}={}){const i=new Pe({key:at,state:{init(s,l){var a,c;const u=(c=(a=i.spec)==null?void 0:a.props)==null?void 0:c.nodeViews,d=Ue(l.schema).table.name;return r&&u&&(u[d]=(f,h)=>new r(f,t,h)),new IC(-1,!1)},apply(s,l){return l.apply(s)}},props:{attributes:s=>{const l=at.getState(s);return l&&l.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(s,l)=>{_C(s,l,n,o)},mouseleave:s=>{DC(s)},mousedown:(s,l)=>{jC(s,l,e,t)}},decorations:s=>{const l=at.getState(s);if(l&&l.activeHandle>-1)return $C(s,l.activeHandle)},nodeViews:{}}});return i}var IC=class Lo{constructor(e,t){this.activeHandle=e,this.dragging=t}apply(e){const t=this,r=e.getMeta(at);if(r&&r.setHandle!=null)return new Lo(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new Lo(t.activeHandle,r.setDragging);if(t.activeHandle>-1&&e.docChanged){let o=e.mapping.map(t.activeHandle,-1);return ja(e.doc.resolve(o))||(o=-1),new Lo(o,t.dragging)}return t}};function _C(n,e,t,r){if(!n.editable)return;const o=at.getState(n.state);if(o&&!o.dragging){const i=LC(e.target);let s=-1;if(i){const{left:l,right:a}=i.getBoundingClientRect();e.clientX-l<=t?s=Pd(n,e,"left",t):a-e.clientX<=t&&(s=Pd(n,e,"right",t))}if(s!=o.activeHandle){if(!r&&s!==-1){const l=n.state.doc.resolve(s),a=l.node(-1),c=me.get(a),u=l.start(-1);if(c.colCount(l.pos-u)+l.nodeAfter.attrs.colspan-1==c.width-1)return}Rg(n,s)}}}function DC(n){if(!n.editable)return;const e=at.getState(n.state);e&&e.activeHandle>-1&&!e.dragging&&Rg(n,-1)}function jC(n,e,t,r){var o;if(!n.editable)return!1;const i=(o=n.dom.ownerDocument.defaultView)!=null?o:window,s=at.getState(n.state);if(!s||s.activeHandle==-1||s.dragging)return!1;const l=n.state.doc.nodeAt(s.activeHandle),a=PC(n,s.activeHandle,l.attrs);n.dispatch(n.state.tr.setMeta(at,{setDragging:{startX:e.clientX,startWidth:a}}));function c(d){i.removeEventListener("mouseup",c),i.removeEventListener("mousemove",u);const f=at.getState(n.state);f!=null&&f.dragging&&(BC(n,f.activeHandle,Ld(f.dragging,d,t)),n.dispatch(n.state.tr.setMeta(at,{setDragging:null})))}function u(d){if(!d.which)return c(d);const f=at.getState(n.state);if(f&&f.dragging){const h=Ld(f.dragging,d,t);Bd(n,f.activeHandle,h,r)}}return Bd(n,s.activeHandle,a,r),i.addEventListener("mouseup",c),i.addEventListener("mousemove",u),e.preventDefault(),!0}function PC(n,e,{colspan:t,colwidth:r}){const o=r&&r[r.length-1];if(o)return o;const i=n.domAtPos(e);let l=i.node.childNodes[i.offset].offsetWidth,a=t;if(r)for(let c=0;c<t;c++)r[c]&&(l-=r[c],a--);return l/a}function LC(n){for(;n&&n.nodeName!="TD"&&n.nodeName!="TH";)n=n.classList&&n.classList.contains("ProseMirror")?null:n.parentNode;return n}function Pd(n,e,t,r){const o=t=="right"?-r:r,i=n.posAtCoords({left:e.clientX+o,top:e.clientY});if(!i)return-1;const{pos:s}=i,l=pr(n.state.doc.resolve(s));if(!l)return-1;if(t=="right")return l.pos;const a=me.get(l.node(-1)),c=l.start(-1),u=a.map.indexOf(l.pos-c);return u%a.width==0?-1:c+a.map[u-1]}function Ld(n,e,t){const r=e.clientX-n.startX;return Math.max(t,n.startWidth+r)}function Rg(n,e){n.dispatch(n.state.tr.setMeta(at,{setHandle:e}))}function BC(n,e,t){const r=n.state.doc.resolve(e),o=r.node(-1),i=me.get(o),s=r.start(-1),l=i.colCount(r.pos-s)+r.nodeAfter.attrs.colspan-1,a=n.state.tr;for(let c=0;c<i.height;c++){const u=c*i.width+l;if(c&&i.map[u]==i.map[u-i.width])continue;const d=i.map[u],f=o.nodeAt(d).attrs,h=f.colspan==1?0:l-i.colCount(d);if(f.colwidth&&f.colwidth[h]==t)continue;const m=f.colwidth?f.colwidth.slice():zC(f.colspan);m[h]=t,a.setNodeMarkup(s+d,null,{...f,colwidth:m})}a.docChanged&&n.dispatch(a)}function Bd(n,e,t,r){const o=n.state.doc.resolve(e),i=o.node(-1),s=o.start(-1),l=me.get(i).colCount(o.pos-s)+o.nodeAfter.attrs.colspan-1;let a=n.domAtPos(o.start(-1)).node;for(;a&&a.nodeName!="TABLE";)a=a.parentNode;a&&La(i,a.firstChild,a,r,l,t)}function zC(n){return Array(n).fill(0)}function $C(n,e){var t;const r=[],o=n.doc.resolve(e),i=o.node(-1);if(!i)return ve.empty;const s=me.get(i),l=o.start(-1),a=s.colCount(o.pos-l)+o.nodeAfter.attrs.colspan-1;for(let c=0;c<s.height;c++){const u=a+c*s.width;if((a==s.width-1||s.map[u]!=s.map[u+1])&&(c==0||s.map[u]!=s.map[u-s.width])){const d=s.map[u],f=l+d+i.nodeAt(d).nodeSize-1,h=document.createElement("div");h.className="column-resize-handle",(t=at.getState(n))!=null&&t.dragging&&r.push(_e.node(l+d,l+d+i.nodeAt(d).nodeSize,{class:"column-resize-dragging"})),r.push(_e.widget(f,h))}}return ve.create(n.doc,r)}function FC({allowTableNodeSelection:n=!1}={}){return new Pe({key:Yt,state:{init(){return null},apply(e,t){const r=e.getMeta(Yt);if(r!=null)return r==-1?null:r;if(t==null||!e.docChanged)return t;const{deleted:o,pos:i}=e.mapping.mapResult(t);return o?null:i}},props:{decorations:eC,handleDOMEvents:{mousedown:AC},createSelectionBetween(e){return Yt.getState(e.state)!=null?e.state.selection:null},handleTripleClick:EC,handleKeyDown:MC,handlePaste:OC},appendTransaction(e,t,r){return rC(r,Eg(r,t),n)}})}function Ba(n,e){return e?["width",`${Math.max(e,n)}px`]:["min-width",`${n}px`]}function zd(n,e,t,r,o,i){var s;let l=0,a=!0,c=e.firstChild;const u=n.firstChild;if(u!==null)for(let d=0,f=0;d<u.childCount;d+=1){const{colspan:h,colwidth:m}=u.child(d).attrs;for(let g=0;g<h;g+=1,f+=1){const y=o===f?i:m&&m[g],b=y?`${y}px`:"";if(l+=y||r,y||(a=!1),c){if(c.style.width!==b){const[w,v]=Ba(r,y);c.style.setProperty(w,v)}c=c.nextSibling}else{const w=document.createElement("col"),[v,S]=Ba(r,y);w.style.setProperty(v,S),e.appendChild(w)}}}for(;c;){const d=c.nextSibling;(s=c.parentNode)===null||s===void 0||s.removeChild(c),c=d}a?(t.style.width=`${l}px`,t.style.minWidth=""):(t.style.width="",t.style.minWidth=`${l}px`)}class qC{constructor(e,t){this.node=e,this.cellMinWidth=t,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.colgroup=this.table.appendChild(document.createElement("colgroup")),zd(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!==this.node.type?!1:(this.node=e,zd(e,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(e){return e.type==="attributes"&&(e.target===this.table||this.colgroup.contains(e.target))}}function VC(n,e,t,r){let o=0,i=!0;const s=[],l=n.firstChild;if(!l)return{};for(let d=0,f=0;d<l.childCount;d+=1){const{colspan:h,colwidth:m}=l.child(d).attrs;for(let g=0;g<h;g+=1,f+=1){const y=t===f?r:m&&m[g];o+=y||e,y||(i=!1);const[b,w]=Ba(e,y);s.push(["col",{style:`${b}: ${w}`}])}}const a=i?`${o}px`:"",c=i?"":`${o}px`;return{colgroup:["colgroup",{},...s],tableWidth:a,tableMinWidth:c}}function $d(n,e){return n.createAndFill()}function HC(n){if(n.cached.tableNodeTypes)return n.cached.tableNodeTypes;const e={};return Object.keys(n.nodes).forEach(t=>{const r=n.nodes[t];r.spec.tableRole&&(e[r.spec.tableRole]=r)}),n.cached.tableNodeTypes=e,e}function WC(n,e,t,r,o){const i=HC(n),s=[],l=[];for(let c=0;c<t;c+=1){const u=$d(i.cell);if(u&&l.push(u),r){const d=$d(i.header_cell);d&&s.push(d)}}const a=[];for(let c=0;c<e;c+=1)a.push(i.row.createChecked(null,r&&c===0?s:l));return i.table.createChecked(null,a)}function UC(n){return n instanceof ge}const bo=({editor:n})=>{const{selection:e}=n.state;if(!UC(e))return!1;let t=0;const r=Im(e.ranges[0].$from,i=>i.type.name==="table");return r==null||r.node.descendants(i=>{if(i.type.name==="table")return!1;["tableCell","tableHeader"].includes(i.type.name)&&(t+=1)}),t===e.ranges.length?(n.commands.deleteTable(),!0):!1},GC=et.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,handleWidth:5,cellMinWidth:25,View:qC,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML(){return[{tag:"table"}]},renderHTML({node:n,HTMLAttributes:e}){const{colgroup:t,tableWidth:r,tableMinWidth:o}=VC(n,this.options.cellMinWidth);return["table",Ke(this.options.HTMLAttributes,e,{style:r?`width: ${r}`:`min-width: ${o}`}),t,["tbody",0]]},addCommands(){return{insertTable:({rows:n=3,cols:e=3,withHeaderRow:t=!0}={})=>({tr:r,dispatch:o,editor:i})=>{const s=WC(i.schema,n,e,t);if(o){const l=r.selection.from+1;r.replaceSelectionWith(s).scrollIntoView().setSelection(K.near(r.doc.resolve(l)))}return!0},addColumnBefore:()=>({state:n,dispatch:e})=>sC(n,e),addColumnAfter:()=>({state:n,dispatch:e})=>lC(n,e),deleteColumn:()=>({state:n,dispatch:e})=>cC(n,e),addRowBefore:()=>({state:n,dispatch:e})=>dC(n,e),addRowAfter:()=>({state:n,dispatch:e})=>fC(n,e),deleteRow:()=>({state:n,dispatch:e})=>pC(n,e),deleteTable:()=>({state:n,dispatch:e})=>wC(n,e),mergeCells:()=>({state:n,dispatch:e})=>Od(n,e),splitCell:()=>({state:n,dispatch:e})=>Ad(n,e),toggleHeaderColumn:()=>({state:n,dispatch:e})=>Gr("column")(n,e),toggleHeaderRow:()=>({state:n,dispatch:e})=>Gr("row")(n,e),toggleHeaderCell:()=>({state:n,dispatch:e})=>vC(n,e),mergeOrSplit:()=>({state:n,dispatch:e})=>Od(n,e)?!0:Ad(n,e),setCellAttribute:(n,e)=>({state:t,dispatch:r})=>yC(n,e)(t,r),goToNextCell:()=>({state:n,dispatch:e})=>Rd(1)(n,e),goToPreviousCell:()=>({state:n,dispatch:e})=>Rd(-1)(n,e),fixTables:()=>({state:n,dispatch:e})=>(e&&Eg(n),!0),setCellSelection:n=>({tr:e,dispatch:t})=>{if(t){const r=ge.create(e.doc,n.anchorCell,n.headCell);e.setSelection(r)}return!0}}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.goToNextCell()?!0:this.editor.can().addRowAfter()?this.editor.chain().addRowAfter().goToNextCell().run():!1,"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:bo,"Mod-Backspace":bo,Delete:bo,"Mod-Delete":bo}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[RC({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],FC({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(n){const e={name:n.name,options:n.options,storage:n.storage};return{tableRole:se(F(n,"tableRole",e))}}}),KC=/(android|bb\d+|meego).+mobile|armv7l|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series[46]0|samsungbrowser.*mobile|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i,JC=/CrOS/,XC=/android|ipad|playbook|silk/i;function Fd(n={}){let e=n.ua||typeof navigator<"u"&&navigator.userAgent;return e&&typeof e=="object"&&e.headers&&typeof e.headers["user-agent"]=="string"&&(e=e.headers["user-agent"]),typeof e!="string"?!1:!!(KC.test(e)&&!JC.test(e)||n.tablet&&XC.test(e)||n.tablet&&n.featureDetect&&navigator&&navigator.maxTouchPoints>1&&e.includes("Macintosh")&&e.includes("Safari"))}const qd=n=>Array.from({length:n}).map((e,t)=>t+1);function YC(n){var u;const[e,t]=x.useState(!0),[r,o]=x.useState({rows:Fd()?oe.TABLE_MAX_GRID_SIZE:oe.TABLE_INIT_GRID_SIZE,cols:Fd()?oe.TABLE_MAX_GRID_SIZE:oe.TABLE_INIT_GRID_SIZE}),[i,s]=x.useState({rows:oe.TABLE_DEFAULT_SELECTED_GRID_SIZE,cols:oe.TABLE_DEFAULT_SELECTED_GRID_SIZE});function l(d,f){d===r.rows&&o(h=>({...h,rows:Math.min(d+1,oe.TABLE_MAX_GRID_SIZE)})),f===r.cols&&o(h=>({...h,cols:Math.min(f+1,oe.TABLE_MAX_GRID_SIZE)})),s({rows:d,cols:f})}function a(d,f){n==null||n.createTable({rows:d,cols:f,withHeaderRow:e}),c()}function c(){t(!1),o({rows:oe.TABLE_INIT_GRID_SIZE,cols:oe.TABLE_INIT_GRID_SIZE}),s({rows:oe.TABLE_DEFAULT_SELECTED_GRID_SIZE,cols:oe.TABLE_DEFAULT_SELECTED_GRID_SIZE})}return p.jsxs(Pn,{modal:!0,children:[p.jsx(Ln,{asChild:!0,children:n==null?void 0:n.children}),p.jsx(mn,{align:"start",className:"w-full !p-2",side:"bottom",children:p.jsxs("div",{className:"table-grid-size-editor p-0",children:[p.jsx("div",{className:"flex flex-col flex-wrap justify-between gap-1",children:(u=qd(r==null?void 0:r.rows))==null?void 0:u.map(d=>{var f;return p.jsx("div",{className:"flex gap-1",children:(f=qd(r==null?void 0:r.cols))==null?void 0:f.map(h=>p.jsx("div",{onMouseDown:()=>a(d,h),onMouseOver:()=>l(d,h),className:`cursor-pointer border-border ${h<=i.cols&&d<=i.rows&&"tableCellActive !bg-foreground"}`,children:p.jsx("div",{className:"box-border size-4 rounded-[2px] !border border-solid !border-border p-1"})},`c-${h}`))},`r-${d}`)})}),p.jsxs("div",{className:"mt-2 text-center text-sm text-zinc-600",children:[i.rows,"x",i.cols]})]})})]})}function ZC(n){function e(t){n.disabled||n.editor.chain().focus().insertTable({...t,withHeaderRow:!1}).run()}return p.jsx(YC,{createTable:e,children:p.jsx(St,{icon:n==null?void 0:n.icon,tooltip:n==null?void 0:n.tooltip,disabled:n==null?void 0:n.disabled,color:n==null?void 0:n.color,action:n==null?void 0:n.action,isActive:n==null?void 0:n.isActive})})}function Ic(n){return e=>{const t=me.get(e.$anchorCell.node(-1)),r=e.$anchorCell.start(-1),o=t.cellsInRect(n),i=t.cellsInRect(t.rectBetween(e.$anchorCell.pos-r,e.$headCell.pos-r));for(let s=0,l=o.length;s<l;s+=1)if(!i.includes(o[s]))return!1;return!0}}function _c(n){return cn(e=>e.type.spec.tableRole&&e.type.spec.tableRole==="table")(n)}function Dc(n){return n instanceof ge}function QC(n){return e=>{if(Dc(e)){const t=me.get(e.$anchorCell.node(-1));return Ic({left:n,right:n+1,top:0,bottom:t.height})(e)}return!1}}function ek(n){return e=>{if(Dc(e)){const t=me.get(e.$anchorCell.node(-1));return Ic({left:0,right:t.width,top:n,bottom:n+1})(e)}return!1}}function Ig(n){if(Dc(n)){const e=me.get(n.$anchorCell.node(-1));return Ic({left:0,right:e.width,top:0,bottom:e.height})(n)}return!1}function tk(n){return e=>{const t=_c(e);if(t){const r=me.get(t.node);return(Array.isArray(n)?n:Array.from([n])).reduce((i,s)=>{if(s>=0&&s<=r.width-1){const l=r.cellsInRect({left:s,right:s+1,top:0,bottom:r.height});return i.concat(l.map(a=>{const c=t.node.nodeAt(a),u=a+t.start;return{pos:u,start:u+1,node:c}}))}return i},[])}return null}}function nk(n){return e=>{const t=_c(e);if(t){const r=me.get(t.node);return(Array.isArray(n)?n:Array.from([n])).reduce((i,s)=>{if(s>=0&&s<=r.height-1){const l=r.cellsInRect({left:0,right:r.width,top:s,bottom:s+1});return i.concat(l.map(a=>{const c=t.node.nodeAt(a),u=a+t.start;return{pos:u,start:u+1,node:c}}))}return i},[])}return null}}function _g(n){return e=>t=>{const r=_c(t.selection),o=n==="row";if(r){const i=me.get(r.node);if(e>=0&&e<(o?i.height:i.width)){const s=o?0:e,l=o?e:0,a=o?i.width:e+1,c=o?e+1:i.height,u=i.cellsInRect({left:s,top:l,right:o?a:s+1,bottom:o?l+1:c}),d=c-l===1?u:i.cellsInRect({left:o?s:a-1,top:o?c-1:l,right:a,bottom:c}),f=r.start+u[0],h=r.start+d[d.length-1],m=t.doc.resolve(f),g=t.doc.resolve(h);return t.setSelection(new ge(g,m))}}return t}}const rk=_g("column"),ok=_g("row");function ik({editor:n,view:e,state:t,from:r}){const o=e.domAtPos(r).node,s=e.nodeDOM(r)||o;if(!n.isActive(jc.name)||!s||Ig(t.selection))return!1;let l=s;for(;l&&!["TD","TH"].includes(l.tagName);)l=l.parentElement;return!!(l&&l.querySelector&&l.querySelector("a.grip-column.selected"))}function sk({editor:n,view:e,state:t,from:r}){const o=e.domAtPos(r).node,s=e.nodeDOM(r)||o;if(!n.isActive(jc.name)||!s||Ig(t.selection))return!1;let l=s;for(;l&&!["TD","TH"].includes(l.tagName);)l=l.parentElement;return!!(l&&l.querySelector&&l.querySelector("a.grip-row.selected"))}const lk=et.create({name:"tableCell",content:"block+",tableRole:"cell",isolating:!0,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:n}){return["td",Ke(this.options.HTMLAttributes,n),0]},addAttributes(){return{colspan:{default:1,parseHTML:n=>{const e=n.getAttribute("colspan");return e?Number.parseInt(e,10):1}},rowspan:{default:1,parseHTML:n=>{const e=n.getAttribute("rowspan");return e?Number.parseInt(e,10):1}},colwidth:{default:null,parseHTML:n=>{const e=n.getAttribute("colwidth");return e?[Number.parseInt(e,10)]:null}},style:{default:null}}},addProseMirrorPlugins(){const{isEditable:n}=this.editor;return[new Pe({props:{decorations:e=>{if(!n)return ve.empty;const{doc:t,selection:r}=e,o=[],i=tk(0)(r);return i&&i.forEach(({pos:s},l)=>{o.push(_e.widget(s+1,()=>{const a=ek(l)(r);let c="grip-row";a&&(c+=" selected"),l===0&&(c+=" first"),l===i.length-1&&(c+=" last");const u=document.createElement("a");return u.className=c,u.addEventListener("mousedown",d=>{d.preventDefault(),d.stopImmediatePropagation(),this.editor.view.dispatch(ok(l)(this.editor.state.tr))}),u}))}),ve.create(t,o)}}})]}});function ak(n,e,t){if(!n.doc)return n;const r=n.doc.nodeAt(e);if(!r||t===r.attrs.backgroundColor)return n;const o={...r.attrs,backgroundColor:t};return n.setNodeMarkup(e,r.type,o,r.marks)}function ck(n,e,t){const{doc:r,selection:o}=n;return!r||!o||!(o instanceof ge)||o.forEachCell((i,s)=>{n=ak(n,s,t)}),n}function Vd(n,e){return({tr:t,state:r,dispatch:o})=>{const{selection:i}=r;return t=t.setSelection(i),t=ck(t,e,n),t.docChanged?(o==null||o(t),!0):!1}}const uk=ot.create({name:"tableCellBackground",addOptions(){return{types:["tableCell"],HTMLAttributes:{}}},addGlobalAttributes(){return[{types:this.options.types,attributes:{backgroundColor:{parseHTML:n=>n.style.backgroundColor||"",renderHTML:n=>!n.backgroundColor||n.backgroundColor===""?{}:{style:`background-color: ${n.backgroundColor}`}}}}]},addCommands(){return{setTableCellBackground:n=>Vd(n,this.options),unsetTableCellBackground:()=>Vd("",this.options)}}}),dk=et.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:n=>{const e=n.getAttribute("colwidth");return e?e.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th"}]},renderHTML({HTMLAttributes:n}){return["th",Ke(this.options.HTMLAttributes,n),0]}}),fk=dk.extend({addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:n=>{const e=n.getAttribute("colwidth");return e?e.split(",").map(r=>Number.parseInt(r,10)):null}},style:{default:null}}},addProseMirrorPlugins(){const{isEditable:n}=this.editor;return[new Pe({props:{decorations:e=>{if(!n)return ve.empty;const{doc:t,selection:r}=e,o=[],i=nk(0)(r);return i&&i.forEach(({pos:s},l)=>{o.push(_e.widget(s+1,()=>{const a=QC(l)(r);let c="grip-column";a&&(c+=" selected"),l===0&&(c+=" first"),l===i.length-1&&(c+=" last");const u=document.createElement("a");return u.className=c,u.addEventListener("mousedown",d=>{d.preventDefault(),d.stopImmediatePropagation(),this.editor.view.dispatch(rk(l)(this.editor.state.tr))}),u}))}),ve.create(t,o)}}})]}}),hk=H2.extend({allowGapCursor:!1,content:"tableCell*"}),jc=GC.extend({addOptions(){var n;return{...(n=this.parent)==null?void 0:n.call(this),resizable:!0,lastColumnResizable:!1,allowTableNodeSelection:!1,button:({editor:e,t})=>({component:ZC,componentProps:{disabled:e.isActive("table")||!1,icon:"Table",tooltip:t("editor.table.tooltip"),editor:e}})}},addExtensions(){return[hk.configure(this.options.tableRow),fk.configure(this.options.tableHeader),lk.configure(this.options.tableCell),uk.configure(this.options.tableCellBackground)]}}),pk="_wrap_5y04w_1",mk="_innerWrap_5y04w_15",Hd={wrap:pk,innerWrap:mk};function gk({editor:n,node:e,updateAttributes:t}){const r=eg(),{url:o,width:i,height:s}=e.attrs,[l,a]=x.useState("");function c(){l&&n.chain().updateAttributes(Dg.name,{url:l}).setNodeSelection(n.state.selection.from).focus().run()}const u=x.useCallback(d=>{t({width:d.width,height:d.height})},[t]);return p.jsxs(hn,{children:[!o&&p.jsxs("div",{className:"mx-auto my-[12px] flex max-w-[600px] items-center justify-center gap-[10px] rounded-[12px] border border-solid border-[#ccc] p-[10px]",children:[p.jsx(Rt,{autoFocus:!0,className:"flex-1",onInput:d=>a(d.target.value),placeholder:"Enter link",type:"url",value:l}),p.jsx(Ve,{className:"w-[60px]",onClick:c,children:"OK"})]}),o&&p.jsx(j1.Resizable,{size:{width:Number.parseInt(i),height:Number.parseInt(s)},onResizeStop:(d,f,h,m)=>{u({width:Number.parseInt(i)+m.width,height:Number.parseInt(s)+m.height})},children:p.jsx("div",{className:yt(Hd.wrap,"render-wrapper"),children:p.jsx("div",{className:Hd.innerWrap,style:{pointerEvents:r?"none":"auto"},children:p.jsx("iframe",{className:"my-[12px] ",src:o})})})})]})}function Bo(n,e=!1){return t=>{const r=n.startsWith("data-")?n:`data-${n}`;let o=decodeURIComponent(t.getAttribute(r));if(o==null||typeof o=="string"&&o==="null")try{const l=t.outerHTML.match(/([\S\s])+?="([\S\s])+?"/g);l&&l.length>0&&(o=(l.map(c=>c.trim()).reduce((c,u)=>{const d=u.indexOf("="),f=[u.slice(0,d),u.slice(d+1).slice(1,-1)];return c[f[0]]=f[1],c},{})[n.toLowerCase()]||"").replaceAll("&quot;",'"'))}catch(s){console.error("Error getDatasetAttribute ",s.message,t)}if(e)try{return JSON.parse(o)}catch{return{}}if(o.includes("%")||o.includes("auto"))return o;const i=Number.parseInt(o);return i!==i?o:i}}const Dg=et.create({name:"iframe",content:"",marks:"",group:"block",selectable:!0,atom:!0,draggable:!0,addOptions(){var n;return{...(n=this.parent)==null?void 0:n.call(this),HTMLAttributes:{class:"iframe"},button:({editor:e,extension:t,t:r})=>({component:St,componentProps:{action:o=>e.commands.setIframe(o),upload:t.options.upload,disabled:!e.can().setIframe({}),icon:"Iframe",tooltip:r("editor.iframe.tooltip")}})}},addAttributes(){return{width:{default:600,parseHTML:Bo("width")},height:{default:300,parseHTML:Bo("height")},url:{default:null,parseHTML:Bo("url")},defaultShowPicker:{default:!1},frameborder:{default:0},allowfullscreen:{default:this.options.allowFullscreen,parseHTML:()=>this.options.allowFullscreen}}},parseHTML(){return[{tag:"iframe"}]},renderHTML({HTMLAttributes:n}){return["iframe",Ke(this.options.HTMLAttributes,n)]},addCommands(){return{setIframe:n=>({tr:e,commands:t,chain:r})=>{var i,s,l;if(((l=(s=(i=e.selection)==null?void 0:i.node)==null?void 0:s.type)==null?void 0:l.name)==this.name)return t.updateAttributes(this.name,n);const o=n||{url:""};return r().insertContent({type:this.name,attrs:o}).run()}}},addInputRules(){return[gi({find:/^\$iframe\$$/,type:this.type,getAttributes:()=>({width:"100%"})})]},addNodeView(){return pn(gk)}});var Kr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function jg(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}function Pg(n){if(Object.prototype.hasOwnProperty.call(n,"__esModule"))return n;var e=n.default;if(typeof e=="function"){var t=function r(){return this instanceof r?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(n).forEach(function(r){var o=Object.getOwnPropertyDescriptor(n,r);Object.defineProperty(t,r,o.get?o:{enumerable:!0,get:function(){return n[r]}})}),t}var ms,Wd;function Lg(){if(Wd)return ms;Wd=1;var n=Object.prototype.toString;return ms=function(t){var r=n.call(t),o=r==="[object Arguments]";return o||(o=r!=="[object Array]"&&t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&n.call(t.callee)==="[object Function]"),o},ms}var gs,Ud;function yk(){if(Ud)return gs;Ud=1;var n;if(!Object.keys){var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,r=Lg(),o=Object.prototype.propertyIsEnumerable,i=!o.call({toString:null},"toString"),s=o.call(function(){},"prototype"),l=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],a=function(f){var h=f.constructor;return h&&h.prototype===f},c={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},u=function(){if(typeof window>"u")return!1;for(var f in window)try{if(!c["$"+f]&&e.call(window,f)&&window[f]!==null&&typeof window[f]=="object")try{a(window[f])}catch{return!0}}catch{return!0}return!1}(),d=function(f){if(typeof window>"u"||!u)return a(f);try{return a(f)}catch{return!1}};n=function(h){var m=h!==null&&typeof h=="object",g=t.call(h)==="[object Function]",y=r(h),b=m&&t.call(h)==="[object String]",w=[];if(!m&&!g&&!y)throw new TypeError("Object.keys called on a non-object");var v=s&&g;if(b&&h.length>0&&!e.call(h,0))for(var S=0;S<h.length;++S)w.push(String(S));if(y&&h.length>0)for(var O=0;O<h.length;++O)w.push(String(O));else for(var C in h)!(v&&C==="prototype")&&e.call(h,C)&&w.push(String(C));if(i)for(var N=d(h),E=0;E<l.length;++E)!(N&&l[E]==="constructor")&&e.call(h,l[E])&&w.push(l[E]);return w}}return gs=n,gs}var ys,Gd;function Pc(){if(Gd)return ys;Gd=1;var n=Array.prototype.slice,e=Lg(),t=Object.keys,r=t?function(s){return t(s)}:yk(),o=Object.keys;return r.shim=function(){if(Object.keys){var s=function(){var l=Object.keys(arguments);return l&&l.length===arguments.length}(1,2);s||(Object.keys=function(a){return e(a)?o(n.call(a)):o(a)})}else Object.keys=r;return Object.keys||r},ys=r,ys}var bs,Kd;function Ti(){if(Kd)return bs;Kd=1;var n=Object.defineProperty||!1;if(n)try{n({},"a",{value:1})}catch{n=!1}return bs=n,bs}var vs,Jd;function Lc(){return Jd||(Jd=1,vs=SyntaxError),vs}var xs,Xd;function vt(){return Xd||(Xd=1,xs=TypeError),xs}var ws,Yd;function bk(){return Yd||(Yd=1,ws=Object.getOwnPropertyDescriptor),ws}var Ss,Zd;function $n(){if(Zd)return Ss;Zd=1;var n=bk();if(n)try{n([],"length")}catch{n=null}return Ss=n,Ss}var Cs,Qd;function Bc(){if(Qd)return Cs;Qd=1;var n=Ti(),e=Lc(),t=vt(),r=$n();return Cs=function(i,s,l){if(!i||typeof i!="object"&&typeof i!="function")throw new t("`obj` must be an object or a function`");if(typeof s!="string"&&typeof s!="symbol")throw new t("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new t("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new t("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new t("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new t("`loose`, if provided, must be a boolean");var a=arguments.length>3?arguments[3]:null,c=arguments.length>4?arguments[4]:null,u=arguments.length>5?arguments[5]:null,d=arguments.length>6?arguments[6]:!1,f=!!r&&r(i,s);if(n)n(i,s,{configurable:u===null&&f?f.configurable:!u,enumerable:a===null&&f?f.enumerable:!a,value:l,writable:c===null&&f?f.writable:!c});else if(d||!a&&!c&&!u)i[s]=l;else throw new e("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},Cs}var ks,ef;function zc(){if(ef)return ks;ef=1;var n=Ti(),e=function(){return!!n};return e.hasArrayLengthDefineBug=function(){if(!n)return null;try{return n([],"length",{value:1}).length!==1}catch{return!0}},ks=e,ks}var Ts,tf;function Fn(){if(tf)return Ts;tf=1;var n=Pc(),e=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",t=Object.prototype.toString,r=Array.prototype.concat,o=Bc(),i=function(c){return typeof c=="function"&&t.call(c)==="[object Function]"},s=zc()(),l=function(c,u,d,f){if(u in c){if(f===!0){if(c[u]===d)return}else if(!i(f)||!f())return}s?o(c,u,d,!0):o(c,u,d)},a=function(c,u){var d=arguments.length>2?arguments[2]:{},f=n(u);e&&(f=r.call(f,Object.getOwnPropertySymbols(u)));for(var h=0;h<f.length;h+=1)l(c,f[h],u[f[h]],d[f[h]])};return a.supportsDescriptors=!!s,Ts=a,Ts}var Ms={exports:{}},Es,nf;function $c(){return nf||(nf=1,Es=Object),Es}var Os,rf;function Bg(){return rf||(rf=1,Os=Error),Os}var As,of;function vk(){return of||(of=1,As=EvalError),As}var Ns,sf;function xk(){return sf||(sf=1,Ns=RangeError),Ns}var Rs,lf;function wk(){return lf||(lf=1,Rs=ReferenceError),Rs}var Is,af;function Sk(){return af||(af=1,Is=URIError),Is}var _s,cf;function Ck(){return cf||(cf=1,_s=Math.abs),_s}var Ds,uf;function kk(){return uf||(uf=1,Ds=Math.floor),Ds}var js,df;function Tk(){return df||(df=1,js=Math.max),js}var Ps,ff;function Mk(){return ff||(ff=1,Ps=Math.min),Ps}var Ls,hf;function Ek(){return hf||(hf=1,Ls=Math.pow),Ls}var Bs,pf;function Ok(){return pf||(pf=1,Bs=Math.round),Bs}var zs,mf;function Ak(){return mf||(mf=1,zs=Number.isNaN||function(e){return e!==e}),zs}var $s,gf;function Nk(){if(gf)return $s;gf=1;var n=Ak();return $s=function(t){return n(t)||t===0?t:t<0?-1:1},$s}var Fs,yf;function Mi(){return yf||(yf=1,Fs=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},t=Symbol("test"),r=Object(t);if(typeof t=="string"||Object.prototype.toString.call(t)!=="[object Symbol]"||Object.prototype.toString.call(r)!=="[object Symbol]")return!1;var o=42;e[t]=o;for(var i in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var s=Object.getOwnPropertySymbols(e);if(s.length!==1||s[0]!==t||!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var l=Object.getOwnPropertyDescriptor(e,t);if(l.value!==o||l.enumerable!==!0)return!1}return!0}),Fs}var qs,bf;function Fc(){if(bf)return qs;bf=1;var n=typeof Symbol<"u"&&Symbol,e=Mi();return qs=function(){return typeof n!="function"||typeof Symbol!="function"||typeof n("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:e()},qs}var Vs,vf;function zg(){return vf||(vf=1,Vs=typeof Reflect<"u"&&Reflect.getPrototypeOf||null),Vs}var Hs,xf;function $g(){if(xf)return Hs;xf=1;var n=$c();return Hs=n.getPrototypeOf||null,Hs}var Ws,wf;function Rk(){if(wf)return Ws;wf=1;var n="Function.prototype.bind called on incompatible ",e=Object.prototype.toString,t=Math.max,r="[object Function]",o=function(a,c){for(var u=[],d=0;d<a.length;d+=1)u[d]=a[d];for(var f=0;f<c.length;f+=1)u[f+a.length]=c[f];return u},i=function(a,c){for(var u=[],d=c,f=0;d<a.length;d+=1,f+=1)u[f]=a[d];return u},s=function(l,a){for(var c="",u=0;u<l.length;u+=1)c+=l[u],u+1<l.length&&(c+=a);return c};return Ws=function(a){var c=this;if(typeof c!="function"||e.apply(c)!==r)throw new TypeError(n+c);for(var u=i(arguments,1),d,f=function(){if(this instanceof d){var b=c.apply(this,o(u,arguments));return Object(b)===b?b:this}return c.apply(a,o(u,arguments))},h=t(0,c.length-u.length),m=[],g=0;g<h;g++)m[g]="$"+g;if(d=Function("binder","return function ("+s(m,",")+"){ return binder.apply(this,arguments); }")(f),c.prototype){var y=function(){};y.prototype=c.prototype,d.prototype=new y,y.prototype=null}return d},Ws}var Us,Sf;function to(){if(Sf)return Us;Sf=1;var n=Rk();return Us=Function.prototype.bind||n,Us}var Gs,Cf;function qc(){return Cf||(Cf=1,Gs=Function.prototype.call),Gs}var Ks,kf;function Vc(){return kf||(kf=1,Ks=Function.prototype.apply),Ks}var Js,Tf;function Ik(){return Tf||(Tf=1,Js=typeof Reflect<"u"&&Reflect&&Reflect.apply),Js}var Xs,Mf;function Fg(){if(Mf)return Xs;Mf=1;var n=to(),e=Vc(),t=qc(),r=Ik();return Xs=r||n.call(t,e),Xs}var Ys,Ef;function Hc(){if(Ef)return Ys;Ef=1;var n=to(),e=vt(),t=qc(),r=Fg();return Ys=function(i){if(i.length<1||typeof i[0]!="function")throw new e("a function is required");return r(n,t,i)},Ys}var Zs,Of;function _k(){if(Of)return Zs;Of=1;var n=Hc(),e=$n(),t;try{t=[].__proto__===Array.prototype}catch(s){if(!s||typeof s!="object"||!("code"in s)||s.code!=="ERR_PROTO_ACCESS")throw s}var r=!!t&&e&&e(Object.prototype,"__proto__"),o=Object,i=o.getPrototypeOf;return Zs=r&&typeof r.get=="function"?n([r.get]):typeof i=="function"?function(l){return i(l==null?l:o(l))}:!1,Zs}var Qs,Af;function qg(){if(Af)return Qs;Af=1;var n=zg(),e=$g(),t=_k();return Qs=n?function(o){return n(o)}:e?function(o){if(!o||typeof o!="object"&&typeof o!="function")throw new TypeError("getProto: not an object");return e(o)}:t?function(o){return t(o)}:null,Qs}var el,Nf;function Wc(){if(Nf)return el;Nf=1;var n=Function.prototype.call,e=Object.prototype.hasOwnProperty,t=to();return el=t.call(n,e),el}var tl,Rf;function Vt(){if(Rf)return tl;Rf=1;var n,e=$c(),t=Bg(),r=vk(),o=xk(),i=wk(),s=Lc(),l=vt(),a=Sk(),c=Ck(),u=kk(),d=Tk(),f=Mk(),h=Ek(),m=Ok(),g=Nk(),y=Function,b=function(Z){try{return y('"use strict"; return ('+Z+").constructor;")()}catch{}},w=$n(),v=Ti(),S=function(){throw new l},O=w?function(){try{return S}catch{try{return w(arguments,"callee").get}catch{return S}}}():S,C=Fc()(),N=qg(),E=$g(),k=zg(),A=Vc(),L=qc(),I={},D=typeof Uint8Array>"u"||!N?n:N(Uint8Array),j={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?n:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?n:ArrayBuffer,"%ArrayIteratorPrototype%":C&&N?N([][Symbol.iterator]()):n,"%AsyncFromSyncIteratorPrototype%":n,"%AsyncFunction%":I,"%AsyncGenerator%":I,"%AsyncGeneratorFunction%":I,"%AsyncIteratorPrototype%":I,"%Atomics%":typeof Atomics>"u"?n:Atomics,"%BigInt%":typeof BigInt>"u"?n:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?n:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?n:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?n:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":t,"%eval%":eval,"%EvalError%":r,"%Float32Array%":typeof Float32Array>"u"?n:Float32Array,"%Float64Array%":typeof Float64Array>"u"?n:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?n:FinalizationRegistry,"%Function%":y,"%GeneratorFunction%":I,"%Int8Array%":typeof Int8Array>"u"?n:Int8Array,"%Int16Array%":typeof Int16Array>"u"?n:Int16Array,"%Int32Array%":typeof Int32Array>"u"?n:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":C&&N?N(N([][Symbol.iterator]())):n,"%JSON%":typeof JSON=="object"?JSON:n,"%Map%":typeof Map>"u"?n:Map,"%MapIteratorPrototype%":typeof Map>"u"||!C||!N?n:N(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":e,"%Object.getOwnPropertyDescriptor%":w,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?n:Promise,"%Proxy%":typeof Proxy>"u"?n:Proxy,"%RangeError%":o,"%ReferenceError%":i,"%Reflect%":typeof Reflect>"u"?n:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?n:Set,"%SetIteratorPrototype%":typeof Set>"u"||!C||!N?n:N(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?n:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":C&&N?N(""[Symbol.iterator]()):n,"%Symbol%":C?Symbol:n,"%SyntaxError%":s,"%ThrowTypeError%":O,"%TypedArray%":D,"%TypeError%":l,"%Uint8Array%":typeof Uint8Array>"u"?n:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?n:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?n:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?n:Uint32Array,"%URIError%":a,"%WeakMap%":typeof WeakMap>"u"?n:WeakMap,"%WeakRef%":typeof WeakRef>"u"?n:WeakRef,"%WeakSet%":typeof WeakSet>"u"?n:WeakSet,"%Function.prototype.call%":L,"%Function.prototype.apply%":A,"%Object.defineProperty%":v,"%Object.getPrototypeOf%":E,"%Math.abs%":c,"%Math.floor%":u,"%Math.max%":d,"%Math.min%":f,"%Math.pow%":h,"%Math.round%":m,"%Math.sign%":g,"%Reflect.getPrototypeOf%":k},P=function Z(Y){var X;if(Y==="%AsyncFunction%")X=b("async function () {}");else if(Y==="%GeneratorFunction%")X=b("function* () {}");else if(Y==="%AsyncGeneratorFunction%")X=b("async function* () {}");else if(Y==="%AsyncGenerator%"){var G=Z("%AsyncGeneratorFunction%");G&&(X=G.prototype)}else if(Y==="%AsyncIteratorPrototype%"){var W=Z("%AsyncGenerator%");W&&N&&(X=N(W.prototype))}return j[Y]=X,X},J={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},Q=to(),pe=Wc(),ce=Q.call(L,Array.prototype.concat),ut=Q.call(A,Array.prototype.splice),Me=Q.call(L,String.prototype.replace),Le=Q.call(L,String.prototype.slice),kt=Q.call(L,RegExp.prototype.exec),_=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,$=/\\(\\)?/g,ne=function(Y){var X=Le(Y,0,1),G=Le(Y,-1);if(X==="%"&&G!=="%")throw new s("invalid intrinsic syntax, expected closing `%`");if(G==="%"&&X!=="%")throw new s("invalid intrinsic syntax, expected opening `%`");var W=[];return Me(Y,_,function(q,ie,re,de){W[W.length]=re?Me(de,$,"$1"):ie||q}),W},te=function(Y,X){var G=Y,W;if(pe(J,G)&&(W=J[G],G="%"+W[0]+"%"),pe(j,G)){var q=j[G];if(q===I&&(q=P(G)),typeof q>"u"&&!X)throw new l("intrinsic "+Y+" exists, but is not available. Please file an issue!");return{alias:W,name:G,value:q}}throw new s("intrinsic "+Y+" does not exist!")};return tl=function(Y,X){if(typeof Y!="string"||Y.length===0)throw new l("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof X!="boolean")throw new l('"allowMissing" argument must be a boolean');if(kt(/^%?[^%]*%?$/,Y)===null)throw new s("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var G=ne(Y),W=G.length>0?G[0]:"",q=te("%"+W+"%",X),ie=q.name,re=q.value,de=!1,be=q.alias;be&&(W=be[0],ut(G,ce([0,1],be)));for(var Ee=1,ye=!0;Ee<G.length;Ee+=1){var fe=G[Ee],Ne=Le(fe,0,1),dt=Le(fe,-1);if((Ne==='"'||Ne==="'"||Ne==="`"||dt==='"'||dt==="'"||dt==="`")&&Ne!==dt)throw new s("property names with quotes must have matching quotes");if((fe==="constructor"||!ye)&&(de=!0),W+="."+fe,ie="%"+W+"%",pe(j,ie))re=j[ie];else if(re!=null){if(!(fe in re)){if(!X)throw new l("base intrinsic for "+Y+" exists, but the property is not available.");return}if(w&&Ee+1>=G.length){var ft=w(re,fe);ye=!!ft,ye&&"get"in ft&&!("originalValue"in ft.get)?re=ft.get:re=re[fe]}else ye=pe(re,fe),re=re[fe];ye&&!de&&(j[ie]=re)}}return re},tl}var nl,If;function Dk(){if(If)return nl;If=1;var n=Vt(),e=Bc(),t=zc()(),r=$n(),o=vt(),i=n("%Math.floor%");return nl=function(l,a){if(typeof l!="function")throw new o("`fn` is not a function");if(typeof a!="number"||a<0||a>4294967295||i(a)!==a)throw new o("`length` must be a positive 32-bit integer");var c=arguments.length>2&&!!arguments[2],u=!0,d=!0;if("length"in l&&r){var f=r(l,"length");f&&!f.configurable&&(u=!1),f&&!f.writable&&(d=!1)}return(u||d||!c)&&(t?e(l,"length",a,!0,!0):e(l,"length",a)),l},nl}var rl,_f;function jk(){if(_f)return rl;_f=1;var n=to(),e=Vc(),t=Fg();return rl=function(){return t(n,e,arguments)},rl}var Df;function mr(){return Df||(Df=1,function(n){var e=Dk(),t=Ti(),r=Hc(),o=jk();n.exports=function(s){var l=r(arguments),a=s.length-(arguments.length-1);return e(l,1+(a>0?a:0),!0)},t?t(n.exports,"apply",{value:o}):n.exports.apply=o}(Ms)),Ms.exports}var ol,jf;function Je(){if(jf)return ol;jf=1;var n=Vt(),e=Hc(),t=e([n("%String.prototype.indexOf%")]);return ol=function(o,i){var s=n(o,!!i);return typeof s=="function"&&t(o,".prototype.")>-1?e([s]):s},ol}var il,Pf;function Vg(){if(Pf)return il;Pf=1;var n=Pc(),e=Mi()(),t=Je(),r=$c(),o=t("Array.prototype.push"),i=t("Object.prototype.propertyIsEnumerable"),s=e?r.getOwnPropertySymbols:null;return il=function(a,c){if(a==null)throw new TypeError("target must be an object");var u=r(a);if(arguments.length===1)return u;for(var d=1;d<arguments.length;++d){var f=r(arguments[d]),h=n(f),m=e&&(r.getOwnPropertySymbols||s);if(m)for(var g=m(f),y=0;y<g.length;++y){var b=g[y];i(f,b)&&o(h,b)}for(var w=0;w<h.length;++w){var v=h[w];if(i(f,v)){var S=f[v];u[v]=S}}}return u},il}var sl,Lf;function Hg(){if(Lf)return sl;Lf=1;var n=Vg(),e=function(){if(!Object.assign)return!1;for(var r="abcdefghijklmnopqrst",o=r.split(""),i={},s=0;s<o.length;++s)i[o[s]]=o[s];var l=Object.assign({},i),a="";for(var c in l)a+=c;return r!==a},t=function(){if(!Object.assign||!Object.preventExtensions)return!1;var r=Object.preventExtensions({1:2});try{Object.assign(r,"xy")}catch{return r[1]==="y"}return!1};return sl=function(){return!Object.assign||e()||t()?n:Object.assign},sl}var ll,Bf;function Pk(){if(Bf)return ll;Bf=1;var n=Fn(),e=Hg();return ll=function(){var r=e();return n(Object,{assign:r},{assign:function(){return Object.assign!==r}}),r},ll}var al,zf;function Lk(){if(zf)return al;zf=1;var n=Fn(),e=mr(),t=Vg(),r=Hg(),o=Pk(),i=e.apply(r()),s=function(a,c){return i(Object,arguments)};return n(s,{getPolyfill:r,implementation:t,shim:o}),al=s,al}var cl,$f;function Wg(){if($f)return cl;$f=1;var n=Vt(),e=mr(),t=e(n("String.prototype.indexOf"));return cl=function(o,i){var s=n(o,!!i);return typeof s=="function"&&t(o,".prototype.")>-1?e(s):s},cl}var ul,Ff;function Bk(){if(Ff)return ul;Ff=1;var n=function(){return typeof(function(){}).name=="string"},e=Object.getOwnPropertyDescriptor;n.functionsHaveConfigurableNames=function(){if(!n()||!e)return!1;var o=e(function(){},"name");return!!o&&!!o.configurable};var t=Function.prototype.bind;return n.boundFunctionsHaveNames=function(){return n()&&typeof t=="function"&&(function(){}).bind().name!==""},ul=n,ul}var dl,qf;function zk(){if(qf)return dl;qf=1;var n=Bc(),e=zc()(),t=Bk().functionsHaveConfigurableNames(),r=vt();return dl=function(i,s){if(typeof i!="function")throw new r("`fn` is not a function");var l=arguments.length>2&&!!arguments[2];return(!l||t)&&(e?n(i,"name",s,!0,!0):n(i,"name",s)),i},dl}var fl,Vf;function Ug(){if(Vf)return fl;Vf=1;var n=zk(),e=vt(),t=Object;return fl=n(function(){if(this==null||this!==t(this))throw new e("RegExp.prototype.flags getter called on non-object");var o="";return this.hasIndices&&(o+="d"),this.global&&(o+="g"),this.ignoreCase&&(o+="i"),this.multiline&&(o+="m"),this.dotAll&&(o+="s"),this.unicode&&(o+="u"),this.unicodeSets&&(o+="v"),this.sticky&&(o+="y"),o},"get flags",!0),fl}var hl,Hf;function Gg(){if(Hf)return hl;Hf=1;var n=Ug(),e=Fn().supportsDescriptors,t=Object.getOwnPropertyDescriptor;return hl=function(){if(e&&/a/mig.flags==="gim"){var o=t(RegExp.prototype,"flags");if(o&&typeof o.get=="function"&&"dotAll"in RegExp.prototype&&"hasIndices"in RegExp.prototype){var i="",s={};if(Object.defineProperty(s,"hasIndices",{get:function(){i+="d"}}),Object.defineProperty(s,"sticky",{get:function(){i+="y"}}),o.get.call(s),i==="dy")return o.get}}return n},hl}var pl,Wf;function $k(){if(Wf)return pl;Wf=1;var n=Fn().supportsDescriptors,e=Gg(),t=$n(),r=Object.defineProperty,o=Bg(),i=qg(),s=/a/;return pl=function(){if(!n||!i)throw new o("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var a=e(),c=i(s),u=t(c,"flags");return(!u||u.get!==a)&&r(c,"flags",{configurable:!0,enumerable:!1,get:a}),a},pl}var ml,Uf;function Fk(){if(Uf)return ml;Uf=1;var n=Fn(),e=mr(),t=Ug(),r=Gg(),o=$k(),i=e(r());return n(i,{getPolyfill:r,implementation:t,shim:o}),ml=i,ml}var wr={exports:{}},gl,Gf;function qn(){if(Gf)return gl;Gf=1;var n=Mi();return gl=function(){return n()&&!!Symbol.toStringTag},gl}var yl,Kf;function Kg(){if(Kf)return yl;Kf=1;var n=qn()(),e=Je(),t=e("Object.prototype.toString"),r=function(l){return n&&l&&typeof l=="object"&&Symbol.toStringTag in l?!1:t(l)==="[object Arguments]"},o=function(l){return r(l)?!0:l!==null&&typeof l=="object"&&"length"in l&&typeof l.length=="number"&&l.length>=0&&t(l)!=="[object Array]"&&"callee"in l&&t(l.callee)==="[object Function]"},i=function(){return r(arguments)}();return r.isLegacyArguments=o,yl=i?r:o,yl}const qk={},Vk=Object.freeze(Object.defineProperty({__proto__:null,default:qk},Symbol.toStringTag,{value:"Module"})),Hk=Pg(Vk);var bl,Jf;function Ei(){if(Jf)return bl;Jf=1;var n=typeof Map=="function"&&Map.prototype,e=Object.getOwnPropertyDescriptor&&n?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,t=n&&e&&typeof e.get=="function"?e.get:null,r=n&&Map.prototype.forEach,o=typeof Set=="function"&&Set.prototype,i=Object.getOwnPropertyDescriptor&&o?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,s=o&&i&&typeof i.get=="function"?i.get:null,l=o&&Set.prototype.forEach,a=typeof WeakMap=="function"&&WeakMap.prototype,c=a?WeakMap.prototype.has:null,u=typeof WeakSet=="function"&&WeakSet.prototype,d=u?WeakSet.prototype.has:null,f=typeof WeakRef=="function"&&WeakRef.prototype,h=f?WeakRef.prototype.deref:null,m=Boolean.prototype.valueOf,g=Object.prototype.toString,y=Function.prototype.toString,b=String.prototype.match,w=String.prototype.slice,v=String.prototype.replace,S=String.prototype.toUpperCase,O=String.prototype.toLowerCase,C=RegExp.prototype.test,N=Array.prototype.concat,E=Array.prototype.join,k=Array.prototype.slice,A=Math.floor,L=typeof BigInt=="function"?BigInt.prototype.valueOf:null,I=Object.getOwnPropertySymbols,D=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,j=typeof Symbol=="function"&&typeof Symbol.iterator=="object",P=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===j||!0)?Symbol.toStringTag:null,J=Object.prototype.propertyIsEnumerable,Q=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(T){return T.__proto__}:null);function pe(T,M){if(T===1/0||T===-1/0||T!==T||T&&T>-1e3&&T<1e3||C.call(/e/,M))return M;var he=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof T=="number"){var Se=T<0?-A(-T):A(T);if(Se!==T){var Ce=String(Se),ae=w.call(M,Ce.length+1);return v.call(Ce,he,"$&_")+"."+v.call(v.call(ae,/([0-9]{3})/g,"$&_"),/_$/,"")}}return v.call(M,he,"$&_")}var ce=Hk,ut=ce.custom,Me=ie(ut)?ut:null,Le={__proto__:null,double:'"',single:"'"},kt={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};bl=function T(M,he,Se,Ce){var ae=he||{};if(be(ae,"quoteStyle")&&!be(Le,ae.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(be(ae,"maxStringLength")&&(typeof ae.maxStringLength=="number"?ae.maxStringLength<0&&ae.maxStringLength!==1/0:ae.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var Ht=be(ae,"customInspect")?ae.customInspect:!0;if(typeof Ht!="boolean"&&Ht!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(be(ae,"indent")&&ae.indent!==null&&ae.indent!==" "&&!(parseInt(ae.indent,10)===ae.indent&&ae.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(be(ae,"numericSeparator")&&typeof ae.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var bn=ae.numericSeparator;if(typeof M>"u")return"undefined";if(M===null)return"null";if(typeof M=="boolean")return M?"true":"false";if(typeof M=="string")return Tt(M,ae);if(typeof M=="number"){if(M===0)return 1/0/M>0?"0":"-0";var it=String(M);return bn?pe(M,it):it}if(typeof M=="bigint"){var Wt=String(M)+"n";return bn?pe(M,Wt):Wt}var Ri=typeof ae.depth>"u"?5:ae.depth;if(typeof Se>"u"&&(Se=0),Se>=Ri&&Ri>0&&typeof M=="object")return te(M)?"[Array]":"[Object]";var Vn=M1(ae,Se);if(typeof Ce>"u")Ce=[];else if(fe(Ce,M)>=0)return"[Circular]";function xt(Hn,io,O1){if(io&&(Ce=k.call(Ce),Ce.push(io)),O1){var su={depth:ae.depth};return be(ae,"quoteStyle")&&(su.quoteStyle=ae.quoteStyle),T(Hn,su,Se+1,Ce)}return T(Hn,ae,Se+1,Ce)}if(typeof M=="function"&&!Y(M)){var Qc=ye(M),eu=ro(M,xt);return"[Function"+(Qc?": "+Qc:" (anonymous)")+"]"+(eu.length>0?" { "+E.call(eu,", ")+" }":"")}if(ie(M)){var tu=j?v.call(String(M),/^(Symbol\(.*\))_[^)]*$/,"$1"):D.call(M);return typeof M=="object"&&!j?ht(tu):tu}if(Re(M)){for(var gr="<"+O.call(String(M.nodeName)),Ii=M.attributes||[],oo=0;oo<Ii.length;oo++)gr+=" "+Ii[oo].name+"="+_($(Ii[oo].value),"double",ae);return gr+=">",M.childNodes&&M.childNodes.length&&(gr+="..."),gr+="</"+O.call(String(M.nodeName))+">",gr}if(te(M)){if(M.length===0)return"[]";var _i=ro(M,xt);return Vn&&!T1(_i)?"["+Ni(_i,Vn)+"]":"[ "+E.call(_i,", ")+" ]"}if(X(M)){var Di=ro(M,xt);return!("cause"in Error.prototype)&&"cause"in M&&!J.call(M,"cause")?"{ ["+String(M)+"] "+E.call(N.call("[cause]: "+xt(M.cause),Di),", ")+" }":Di.length===0?"["+String(M)+"]":"{ ["+String(M)+"] "+E.call(Di,", ")+" }"}if(typeof M=="object"&&Ht){if(Me&&typeof M[Me]=="function"&&ce)return ce(M,{depth:Ri-Se});if(Ht!=="symbol"&&typeof M.inspect=="function")return M.inspect()}if(Ne(M)){var nu=[];return r&&r.call(M,function(Hn,io){nu.push(xt(io,M,!0)+" => "+xt(Hn,M))}),Zc("Map",t.call(M),nu,Vn)}if(gn(M)){var ru=[];return l&&l.call(M,function(Hn){ru.push(xt(Hn,M))}),Zc("Set",s.call(M),ru,Vn)}if(dt(M))return Ai("WeakMap");if(Be(M))return Ai("WeakSet");if(ft(M))return Ai("WeakRef");if(W(M))return ht(xt(Number(M)));if(re(M))return ht(xt(L.call(M)));if(q(M))return ht(m.call(M));if(G(M))return ht(xt(String(M)));if(typeof window<"u"&&M===window)return"{ [object Window] }";if(typeof globalThis<"u"&&M===globalThis||typeof Kr<"u"&&M===Kr)return"{ [object globalThis] }";if(!Z(M)&&!Y(M)){var ji=ro(M,xt),ou=Q?Q(M)===Object.prototype:M instanceof Object||M.constructor===Object,Pi=M instanceof Object?"":"null prototype",iu=!ou&&P&&Object(M)===M&&P in M?w.call(Ee(M),8,-1):Pi?"Object":"",E1=ou||typeof M.constructor!="function"?"":M.constructor.name?M.constructor.name+" ":"",Li=E1+(iu||Pi?"["+E.call(N.call([],iu||[],Pi||[]),": ")+"] ":"");return ji.length===0?Li+"{}":Vn?Li+"{"+Ni(ji,Vn)+"}":Li+"{ "+E.call(ji,", ")+" }"}return String(M)};function _(T,M,he){var Se=he.quoteStyle||M,Ce=Le[Se];return Ce+T+Ce}function $(T){return v.call(String(T),/"/g,"&quot;")}function ne(T){return!P||!(typeof T=="object"&&(P in T||typeof T[P]<"u"))}function te(T){return Ee(T)==="[object Array]"&&ne(T)}function Z(T){return Ee(T)==="[object Date]"&&ne(T)}function Y(T){return Ee(T)==="[object RegExp]"&&ne(T)}function X(T){return Ee(T)==="[object Error]"&&ne(T)}function G(T){return Ee(T)==="[object String]"&&ne(T)}function W(T){return Ee(T)==="[object Number]"&&ne(T)}function q(T){return Ee(T)==="[object Boolean]"&&ne(T)}function ie(T){if(j)return T&&typeof T=="object"&&T instanceof Symbol;if(typeof T=="symbol")return!0;if(!T||typeof T!="object"||!D)return!1;try{return D.call(T),!0}catch{}return!1}function re(T){if(!T||typeof T!="object"||!L)return!1;try{return L.call(T),!0}catch{}return!1}var de=Object.prototype.hasOwnProperty||function(T){return T in this};function be(T,M){return de.call(T,M)}function Ee(T){return g.call(T)}function ye(T){if(T.name)return T.name;var M=b.call(y.call(T),/^function\s*([\w$]+)/);return M?M[1]:null}function fe(T,M){if(T.indexOf)return T.indexOf(M);for(var he=0,Se=T.length;he<Se;he++)if(T[he]===M)return he;return-1}function Ne(T){if(!t||!T||typeof T!="object")return!1;try{t.call(T);try{s.call(T)}catch{return!0}return T instanceof Map}catch{}return!1}function dt(T){if(!c||!T||typeof T!="object")return!1;try{c.call(T,c);try{d.call(T,d)}catch{return!0}return T instanceof WeakMap}catch{}return!1}function ft(T){if(!h||!T||typeof T!="object")return!1;try{return h.call(T),!0}catch{}return!1}function gn(T){if(!s||!T||typeof T!="object")return!1;try{s.call(T);try{t.call(T)}catch{return!0}return T instanceof Set}catch{}return!1}function Be(T){if(!d||!T||typeof T!="object")return!1;try{d.call(T,d);try{c.call(T,c)}catch{return!0}return T instanceof WeakSet}catch{}return!1}function Re(T){return!T||typeof T!="object"?!1:typeof HTMLElement<"u"&&T instanceof HTMLElement?!0:typeof T.nodeName=="string"&&typeof T.getAttribute=="function"}function Tt(T,M){if(T.length>M.maxStringLength){var he=T.length-M.maxStringLength,Se="... "+he+" more character"+(he>1?"s":"");return Tt(w.call(T,0,M.maxStringLength),M)+Se}var Ce=kt[M.quoteStyle||"single"];Ce.lastIndex=0;var ae=v.call(v.call(T,Ce,"\\$1"),/[\x00-\x1f]/g,yn);return _(ae,"single",M)}function yn(T){var M=T.charCodeAt(0),he={8:"b",9:"t",10:"n",12:"f",13:"r"}[M];return he?"\\"+he:"\\x"+(M<16?"0":"")+S.call(M.toString(16))}function ht(T){return"Object("+T+")"}function Ai(T){return T+" { ? }"}function Zc(T,M,he,Se){var Ce=Se?Ni(he,Se):E.call(he,", ");return T+" ("+M+") {"+Ce+"}"}function T1(T){for(var M=0;M<T.length;M++)if(fe(T[M],`
121
+ */var yd;function sw(){return yd||(yd=1,process.env.NODE_ENV!=="production"&&function(){typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error);var n=x,e=yi;function t(u,d){return u===d&&(u!==0||1/u===1/d)||u!==u&&d!==d}var r=typeof Object.is=="function"?Object.is:t,o=e.useSyncExternalStore,i=n.useRef,s=n.useEffect,l=n.useMemo,a=n.useDebugValue;function c(u,d,f,h,m){var g=i(null),y;g.current===null?(y={hasValue:!1,value:null},g.current=y):y=g.current;var b=l(function(){var O=!1,C,N,E=function(I){if(!O){O=!0,C=I;var D=h(I);if(m!==void 0&&y.hasValue){var j=y.value;if(m(j,D))return N=j,j}return N=D,D}var P=C,J=N;if(r(P,I))return J;var Q=h(I);return m!==void 0&&m(J,Q)?J:(C=I,N=Q,Q)},k=f===void 0?null:f,A=function(){return E(d())},L=k===null?void 0:function(){return E(k())};return[A,L]},[d,f,h,m]),w=b[0],v=b[1],S=o(u,w,v);return s(function(){y.hasValue=!0,y.value=S},[S]),a(S),S}ss.useSyncExternalStoreWithSelector=c,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}()),ss}process.env.NODE_ENV==="production"?Na.exports=iw():Na.exports=sw();var lw=Na.exports;const aw=typeof window<"u"?x.useLayoutEffect:x.useEffect;class cw{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.lastSnapshot:(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 t=()=>{this.transactionNumber+=1,this.subscribers.forEach(o=>o())},r=this.editor;return r.on("transaction",t),()=>{r.off("transaction",t)}}}}function uw(n){var e;const[t]=x.useState(()=>new cw(n.editor)),r=lw.useSyncExternalStoreWithSelector(t.subscribe,t.getSnapshot,t.getServerSnapshot,n.selector,(e=n.equalityFn)!==null&&e!==void 0?e:ow);return aw(()=>t.watch(n.editor),[n.editor,t]),x.useDebugValue(r),r}const bd=process.env.NODE_ENV!=="production",Ra=typeof window>"u",dw=Ra||!!(typeof window<"u"&&window.next);class bc{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(t=>t())}getInitialEditor(){if(this.options.current.immediatelyRender===void 0)return Ra||dw?(bd&&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&&Ra&&bd)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:(...r)=>{var o,i;return(i=(o=this.options.current).onBeforeCreate)===null||i===void 0?void 0:i.call(o,...r)},onBlur:(...r)=>{var o,i;return(i=(o=this.options.current).onBlur)===null||i===void 0?void 0:i.call(o,...r)},onCreate:(...r)=>{var o,i;return(i=(o=this.options.current).onCreate)===null||i===void 0?void 0:i.call(o,...r)},onDestroy:(...r)=>{var o,i;return(i=(o=this.options.current).onDestroy)===null||i===void 0?void 0:i.call(o,...r)},onFocus:(...r)=>{var o,i;return(i=(o=this.options.current).onFocus)===null||i===void 0?void 0:i.call(o,...r)},onSelectionUpdate:(...r)=>{var o,i;return(i=(o=this.options.current).onSelectionUpdate)===null||i===void 0?void 0:i.call(o,...r)},onTransaction:(...r)=>{var o,i;return(i=(o=this.options.current).onTransaction)===null||i===void 0?void 0:i.call(o,...r)},onUpdate:(...r)=>{var o,i;return(i=(o=this.options.current).onUpdate)===null||i===void 0?void 0:i.call(o,...r)},onContentError:(...r)=>{var o,i;return(i=(o=this.options.current).onContentError)===null||i===void 0?void 0:i.call(o,...r)},onDrop:(...r)=>{var o,i;return(i=(o=this.options.current).onDrop)===null||i===void 0?void 0:i.call(o,...r)},onPaste:(...r)=>{var o,i;return(i=(o=this.options.current).onPaste)===null||i===void 0?void 0:i.call(o,...r)}};return new zx(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(r=>["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(r)?!0:r==="extensions"&&e.extensions&&t.extensions?e.extensions.length!==t.extensions.length?!1:e.extensions.every((o,i)=>{var s;return o===((s=t.extensions)===null||s===void 0?void 0:s[i])}):e[r]===t[r])}onRender(e){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&e.length===0?bc.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(this.previousDeps===null){this.previousDeps=e;return}if(this.previousDeps.length===e.length&&this.previousDeps.every((r,o)=>r===e[o]))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(()=>{if(this.isComponentMounted&&this.instanceId===e){t&&t.setOptions(this.options.current);return}t&&!t.isDestroyed&&(t.destroy(),this.instanceId===e&&this.setEditor(null))},1)}}function fw(n={},e=[]){const t=x.useRef(n);t.current=n;const[r]=x.useState(()=>new bc(t)),o=yi.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return x.useDebugValue(o),x.useEffect(r.onRender(e)),uw({editor:o,selector:({transactionNumber:i})=>n.shouldRerenderOnTransaction===!1?null:n.immediatelyRender&&i===0?0:i+1}),o}const hw=x.createContext({editor:null}),pw=()=>x.useContext(hw),mw=n=>{const[e,t]=x.useState(null),{editor:r}=pw();return x.useEffect(()=>{var o;if(!e||!((o=n.editor)===null||o===void 0)&&o.isDestroyed||r!=null&&r.isDestroyed)return;const{pluginKey:i="bubbleMenu",editor:s,tippyOptions:l={},updateDelay:a,shouldShow:c=null}=n,u=s||r;if(!u){console.warn("BubbleMenu component is not rendered inside of an editor component or does not have editor prop.");return}const d=Pm({updateDelay:a,editor:u,element:e,pluginKey:i,shouldShow:c,tippyOptions:l});return u.registerPlugin(d),()=>{u.unregisterPlugin(i)}},[n.editor,r,e]),x.createElement("div",{ref:t,className:n.className,style:{visibility:"hidden"}},n.children)},Lm=x.createContext({onDragStart:void 0}),Bm=()=>x.useContext(Lm),gw=n=>{const e=n.as||"div",{nodeViewContentRef:t}=Bm();return x.createElement(e,{...n,ref:t,"data-node-view-content":"",style:{whiteSpace:"pre-wrap",...n.style}})},hn=x.forwardRef((n,e)=>{const{onDragStart:t}=Bm(),r=n.as||"div";return x.createElement(r,{...n,ref:e,"data-node-view-wrapper":"",onDragStart:t,style:{whiteSpace:"normal",...n.style}})});function yw(n){return!!(typeof n=="function"&&n.prototype&&n.prototype.isReactComponent)}function bw(n){var e;return typeof n=="object"&&((e=n.$$typeof)===null||e===void 0?void 0:e.toString())==="Symbol(react.forward_ref)"}class zm{constructor(e,{editor:t,props:r={},as:o="div",className:i=""}){this.ref=null,this.id=Math.floor(Math.random()*4294967295).toString(),this.component=e,this.editor=t,this.props=r,this.element=document.createElement(o),this.element.classList.add("react-renderer"),i&&this.element.classList.add(...i.split(" ")),this.editor.isInitialized?Yh.flushSync(()=>{this.render()}):this.render()}render(){var e;const t=this.component,r=this.props,o=this.editor;(yw(t)||bw(t))&&(r.ref=i=>{this.ref=i}),this.reactElement=x.createElement(t,{...r}),(e=o==null?void 0:o.contentComponent)===null||e===void 0||e.setRenderer(this.id,this)}updateProps(e={}){this.props={...this.props,...e},this.render()}destroy(){var e;const t=this.editor;(e=t==null?void 0:t.contentComponent)===null||e===void 0||e.removeRenderer(this.id)}updateAttributes(e){Object.keys(e).forEach(t=>{this.element.setAttribute(t,e[t])})}}class vw extends Vx{mount(){const e={editor:this.editor,node:this.node,decorations:this.decorations,innerDecorations:this.innerDecorations,view:this.view,selected:!1,extension:this.extension,HTMLAttributes:this.HTMLAttributes,getPos:()=>this.getPos(),updateAttributes:(c={})=>this.updateAttributes(c),deleteNode:()=>this.deleteNode()};if(!this.component.displayName){const c=u=>u.charAt(0).toUpperCase()+u.substring(1);this.component.displayName=c(this.extension.name)}const o={onDragStart:this.onDragStart.bind(this),nodeViewContentRef:c=>{c&&this.contentDOMElement&&c.firstChild!==this.contentDOMElement&&c.appendChild(this.contentDOMElement)}},i=this.component,s=x.memo(c=>x.createElement(Lm.Provider,{value:o},x.createElement(i,c)));s.displayName="ReactNodeView",this.node.isLeaf?this.contentDOMElement=null:this.options.contentDOMElementTag?this.contentDOMElement=document.createElement(this.options.contentDOMElementTag):this.contentDOMElement=document.createElement(this.node.isInline?"span":"div"),this.contentDOMElement&&(this.contentDOMElement.dataset.nodeViewContentReact="",this.contentDOMElement.style.whiteSpace="inherit");let l=this.node.isInline?"span":"div";this.options.as&&(l=this.options.as);const{className:a=""}=this.options;this.handleSelectionUpdate=this.handleSelectionUpdate.bind(this),this.renderer=new zm(s,{editor:this.editor,props:e,as:l,className:`node-${this.node.type.name} ${a}`.trim()}),this.editor.on("selectionUpdate",this.handleSelectionUpdate),this.updateElementAttributes()}get dom(){var e;if(this.renderer.element.firstElementChild&&!(!((e=this.renderer.element.firstElementChild)===null||e===void 0)&&e.hasAttribute("data-node-view-wrapper")))throw Error("Please use the NodeViewWrapper component for your node view.");return this.renderer.element}get contentDOM(){return this.node.isLeaf?null:this.contentDOMElement}handleSelectionUpdate(){const{from:e,to:t}=this.editor.state.selection,r=this.getPos();if(typeof r=="number")if(e<=r&&t>=r+this.node.nodeSize){if(this.renderer.props.selected)return;this.selectNode()}else{if(!this.renderer.props.selected)return;this.deselectNode()}}update(e,t,r){const o=i=>{this.renderer.updateProps(i),typeof this.options.attrs=="function"&&this.updateElementAttributes()};if(e.type!==this.node.type)return!1;if(typeof this.options.update=="function"){const i=this.node,s=this.decorations,l=this.innerDecorations;return this.node=e,this.decorations=t,this.innerDecorations=r,this.options.update({oldNode:i,oldDecorations:s,newNode:e,newDecorations:t,oldInnerDecorations:l,innerDecorations:r,updateProps:()=>o({node:e,decorations:t,innerDecorations:r})})}return e===this.node&&this.decorations===t&&this.innerDecorations===r||(this.node=e,this.decorations=t,this.innerDecorations=r,o({node:e,decorations:t,innerDecorations:r})),!0}selectNode(){this.renderer.updateProps({selected:!0}),this.renderer.element.classList.add("ProseMirror-selectednode")}deselectNode(){this.renderer.updateProps({selected:!1}),this.renderer.element.classList.remove("ProseMirror-selectednode")}destroy(){this.renderer.destroy(),this.editor.off("selectionUpdate",this.handleSelectionUpdate),this.contentDOMElement=null}updateElementAttributes(){if(this.options.attrs){let e={};if(typeof this.options.attrs=="function"){const t=this.editor.extensionManager.attributes,r=Jo(this.node,t);e=this.options.attrs({node:this.node,HTMLAttributes:r})}else e=this.options.attrs;this.renderer.updateAttributes(e)}}}function pn(n,e){return t=>t.editor.contentComponent?new vw(n,t,e):{}}var $m=typeof global=="object"&&global&&global.Object===Object&&global,xw=typeof self=="object"&&self&&self.Object===Object&&self,vc=$m||xw||Function("return this")(),Vr=vc.Symbol,Fm=Object.prototype,ww=Fm.hasOwnProperty,Sw=Fm.toString,br=Vr?Vr.toStringTag:void 0;function Cw(n){var e=ww.call(n,br),t=n[br];try{n[br]=void 0;var r=!0}catch{}var o=Sw.call(n);return r&&(e?n[br]=t:delete n[br]),o}var kw=Object.prototype,Tw=kw.toString;function Mw(n){return Tw.call(n)}var Ew="[object Null]",Ow="[object Undefined]",vd=Vr?Vr.toStringTag:void 0;function xc(n){return n==null?n===void 0?Ow:Ew:vd&&vd in Object(n)?Cw(n):Mw(n)}function wc(n){return n!=null&&typeof n=="object"}var Aw="[object Symbol]";function qm(n){return typeof n=="symbol"||wc(n)&&xc(n)==Aw}var Nw=/\s/;function Rw(n){for(var e=n.length;e--&&Nw.test(n.charAt(e)););return e}var Iw=/^\s+/;function _w(n){return n&&n.slice(0,Rw(n)+1).replace(Iw,"")}function Hr(n){var e=typeof n;return n!=null&&(e=="object"||e=="function")}var xd=NaN,Dw=/^[-+]0x[0-9a-f]+$/i,jw=/^0b[01]+$/i,Pw=/^0o[0-7]+$/i,Lw=parseInt;function nr(n){if(typeof n=="number")return n;if(qm(n))return xd;if(Hr(n)){var e=typeof n.valueOf=="function"?n.valueOf():n;n=Hr(e)?e+"":e}if(typeof n!="string")return n===0?n:+n;n=_w(n);var t=jw.test(n);return t||Pw.test(n)?Lw(n.slice(2),t?2:8):Dw.test(n)?xd:+n}function Bw(n,e,t){return n===n&&(t!==void 0&&(n=n<=t?n:t),e!==void 0&&(n=n>=e?n:e)),n}function Vm(n,e,t){return t===void 0&&(t=e,e=void 0),t!==void 0&&(t=nr(t),t=t===t?t:0),e!==void 0&&(e=nr(e),e=e===e?e:0),Bw(nr(n),e,t)}var ls=function(){return vc.Date.now()},zw="Expected a function",$w=Math.max,Fw=Math.min;function bi(n,e,t){var r,o,i,s,l,a,c=0,u=!1,d=!1,f=!0;if(typeof n!="function")throw new TypeError(zw);e=nr(e)||0,Hr(t)&&(u=!!t.leading,d="maxWait"in t,i=d?$w(nr(t.maxWait)||0,e):i,f="trailing"in t?!!t.trailing:f);function h(C){var N=r,E=o;return r=o=void 0,c=C,s=n.apply(E,N),s}function m(C){return c=C,l=setTimeout(b,e),u?h(C):s}function g(C){var N=C-a,E=C-c,k=e-N;return d?Fw(k,i-E):k}function y(C){var N=C-a,E=C-c;return a===void 0||N>=e||N<0||d&&E>=i}function b(){var C=ls();if(y(C))return w(C);l=setTimeout(b,g(C))}function w(C){return l=void 0,f&&r?h(C):(r=o=void 0,s)}function v(){l!==void 0&&clearTimeout(l),c=0,r=a=o=l=void 0}function S(){return l===void 0?s:w(ls())}function O(){var C=ls(),N=y(C);if(r=arguments,o=this,a=C,N){if(l===void 0)return m(a);if(d)return clearTimeout(l),l=setTimeout(b,e),h(a)}return l===void 0&&(l=setTimeout(b,e)),s}return O.cancel=v,O.flush=S,O}var qw="[object Number]";function Zo(n){return typeof n=="number"||wc(n)&&xc(n)==qw}var Vw="Expected a function";function qt(n,e,t){var r=!0,o=!0;if(typeof n!="function")throw new TypeError(Vw);return Hr(t)&&(r="leading"in t?!!t.leading:r,o="trailing"in t?!!t.trailing:o),bi(n,e,{leading:r,maxWait:e,trailing:o})}function Hm(n){var e,t,r="";if(typeof n=="string"||typeof n=="number")r+=n;else if(typeof n=="object")if(Array.isArray(n)){var o=n.length;for(e=0;e<o;e++)n[e]&&(t=Hm(n[e]))&&(r&&(r+=" "),r+=t)}else for(t in n)n[t]&&(r&&(r+=" "),r+=t);return r}function yt(){for(var n,e,t=0,r="",o=arguments.length;t<o;t++)(n=arguments[t])&&(e=Hm(n))&&(r&&(r+=" "),r+=e);return r}const Sc="-",Hw=n=>{const e=Uw(n),{conflictingClassGroups:t,conflictingClassGroupModifiers:r}=n;return{getClassGroupId:s=>{const l=s.split(Sc);return l[0]===""&&l.length!==1&&l.shift(),Wm(l,e)||Ww(s)},getConflictingClassGroupIds:(s,l)=>{const a=t[s]||[];return l&&r[s]?[...a,...r[s]]:a}}},Wm=(n,e)=>{var s;if(n.length===0)return e.classGroupId;const t=n[0],r=e.nextPart.get(t),o=r?Wm(n.slice(1),r):void 0;if(o)return o;if(e.validators.length===0)return;const i=n.join(Sc);return(s=e.validators.find(({validator:l})=>l(i)))==null?void 0:s.classGroupId},wd=/^\[(.+)\]$/,Ww=n=>{if(wd.test(n)){const e=wd.exec(n)[1],t=e==null?void 0:e.substring(0,e.indexOf(":"));if(t)return"arbitrary.."+t}},Uw=n=>{const{theme:e,prefix:t}=n,r={nextPart:new Map,validators:[]};return Kw(Object.entries(n.classGroups),t).forEach(([i,s])=>{Ia(s,r,i,e)}),r},Ia=(n,e,t,r)=>{n.forEach(o=>{if(typeof o=="string"){const i=o===""?e:Sd(e,o);i.classGroupId=t;return}if(typeof o=="function"){if(Gw(o)){Ia(o(r),e,t,r);return}e.validators.push({validator:o,classGroupId:t});return}Object.entries(o).forEach(([i,s])=>{Ia(s,Sd(e,i),t,r)})})},Sd=(n,e)=>{let t=n;return e.split(Sc).forEach(r=>{t.nextPart.has(r)||t.nextPart.set(r,{nextPart:new Map,validators:[]}),t=t.nextPart.get(r)}),t},Gw=n=>n.isThemeGetter,Kw=(n,e)=>e?n.map(([t,r])=>{const o=r.map(i=>typeof i=="string"?e+i:typeof i=="object"?Object.fromEntries(Object.entries(i).map(([s,l])=>[e+s,l])):i);return[t,o]}):n,Jw=n=>{if(n<1)return{get:()=>{},set:()=>{}};let e=0,t=new Map,r=new Map;const o=(i,s)=>{t.set(i,s),e++,e>n&&(e=0,r=t,t=new Map)};return{get(i){let s=t.get(i);if(s!==void 0)return s;if((s=r.get(i))!==void 0)return o(i,s),s},set(i,s){t.has(i)?t.set(i,s):o(i,s)}}},Um="!",Xw=n=>{const{separator:e,experimentalParseClassName:t}=n,r=e.length===1,o=e[0],i=e.length,s=l=>{const a=[];let c=0,u=0,d;for(let y=0;y<l.length;y++){let b=l[y];if(c===0){if(b===o&&(r||l.slice(y,y+i)===e)){a.push(l.slice(u,y)),u=y+i;continue}if(b==="/"){d=y;continue}}b==="["?c++:b==="]"&&c--}const f=a.length===0?l:l.substring(u),h=f.startsWith(Um),m=h?f.substring(1):f,g=d&&d>u?d-u:void 0;return{modifiers:a,hasImportantModifier:h,baseClassName:m,maybePostfixModifierPosition:g}};return t?l=>t({className:l,parseClassName:s}):s},Yw=n=>{if(n.length<=1)return n;const e=[];let t=[];return n.forEach(r=>{r[0]==="["?(e.push(...t.sort(),r),t=[]):t.push(r)}),e.push(...t.sort()),e},Zw=n=>({cache:Jw(n.cacheSize),parseClassName:Xw(n),...Hw(n)}),Qw=/\s+/,eS=(n,e)=>{const{parseClassName:t,getClassGroupId:r,getConflictingClassGroupIds:o}=e,i=[],s=n.trim().split(Qw);let l="";for(let a=s.length-1;a>=0;a-=1){const c=s[a],{modifiers:u,hasImportantModifier:d,baseClassName:f,maybePostfixModifierPosition:h}=t(c);let m=!!h,g=r(m?f.substring(0,h):f);if(!g){if(!m){l=c+(l.length>0?" "+l:l);continue}if(g=r(f),!g){l=c+(l.length>0?" "+l:l);continue}m=!1}const y=Yw(u).join(":"),b=d?y+Um:y,w=b+g;if(i.includes(w))continue;i.push(w);const v=o(g,m);for(let S=0;S<v.length;++S){const O=v[S];i.push(b+O)}l=c+(l.length>0?" "+l:l)}return l};function tS(){let n=0,e,t,r="";for(;n<arguments.length;)(e=arguments[n++])&&(t=Gm(e))&&(r&&(r+=" "),r+=t);return r}const Gm=n=>{if(typeof n=="string")return n;let e,t="";for(let r=0;r<n.length;r++)n[r]&&(e=Gm(n[r]))&&(t&&(t+=" "),t+=e);return t};function nS(n,...e){let t,r,o,i=s;function s(a){const c=e.reduce((u,d)=>d(u),n());return t=Zw(c),r=t.cache.get,o=t.cache.set,i=l,l(a)}function l(a){const c=r(a);if(c)return c;const u=eS(a,t);return o(a,u),u}return function(){return i(tS.apply(null,arguments))}}const ke=n=>{const e=t=>t[n]||[];return e.isThemeGetter=!0,e},Km=/^\[(?:([a-z-]+):)?(.+)\]$/i,rS=/^\d+\/\d+$/,oS=new Set(["px","full","screen"]),iS=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,sS=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,lS=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,aS=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,cS=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Dt=n=>rr(n)||oS.has(n)||rS.test(n),Ut=n=>ur(n,"length",yS),rr=n=>!!n&&!Number.isNaN(Number(n)),as=n=>ur(n,"number",rr),vr=n=>!!n&&Number.isInteger(Number(n)),uS=n=>n.endsWith("%")&&rr(n.slice(0,-1)),le=n=>Km.test(n),Gt=n=>iS.test(n),dS=new Set(["length","size","percentage"]),fS=n=>ur(n,dS,Jm),hS=n=>ur(n,"position",Jm),pS=new Set(["image","url"]),mS=n=>ur(n,pS,vS),gS=n=>ur(n,"",bS),xr=()=>!0,ur=(n,e,t)=>{const r=Km.exec(n);return r?r[1]?typeof e=="string"?r[1]===e:e.has(r[1]):t(r[2]):!1},yS=n=>sS.test(n)&&!lS.test(n),Jm=()=>!1,bS=n=>aS.test(n),vS=n=>cS.test(n),xS=()=>{const n=ke("colors"),e=ke("spacing"),t=ke("blur"),r=ke("brightness"),o=ke("borderColor"),i=ke("borderRadius"),s=ke("borderSpacing"),l=ke("borderWidth"),a=ke("contrast"),c=ke("grayscale"),u=ke("hueRotate"),d=ke("invert"),f=ke("gap"),h=ke("gradientColorStops"),m=ke("gradientColorStopPositions"),g=ke("inset"),y=ke("margin"),b=ke("opacity"),w=ke("padding"),v=ke("saturate"),S=ke("scale"),O=ke("sepia"),C=ke("skew"),N=ke("space"),E=ke("translate"),k=()=>["auto","contain","none"],A=()=>["auto","hidden","clip","visible","scroll"],L=()=>["auto",le,e],I=()=>[le,e],D=()=>["",Dt,Ut],j=()=>["auto",rr,le],P=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],J=()=>["solid","dashed","dotted","double","none"],Q=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],pe=()=>["start","end","center","between","around","evenly","stretch"],ce=()=>["","0",le],ut=()=>["auto","avoid","all","avoid-page","page","left","right","column"],Me=()=>[rr,le];return{cacheSize:500,separator:":",theme:{colors:[xr],spacing:[Dt,Ut],blur:["none","",Gt,le],brightness:Me(),borderColor:[n],borderRadius:["none","","full",Gt,le],borderSpacing:I(),borderWidth:D(),contrast:Me(),grayscale:ce(),hueRotate:Me(),invert:ce(),gap:I(),gradientColorStops:[n],gradientColorStopPositions:[uS,Ut],inset:L(),margin:L(),opacity:Me(),padding:I(),saturate:Me(),scale:Me(),sepia:ce(),skew:Me(),space:I(),translate:I()},classGroups:{aspect:[{aspect:["auto","square","video",le]}],container:["container"],columns:[{columns:[Gt]}],"break-after":[{"break-after":ut()}],"break-before":[{"break-before":ut()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...P(),le]}],overflow:[{overflow:A()}],"overflow-x":[{"overflow-x":A()}],"overflow-y":[{"overflow-y":A()}],overscroll:[{overscroll:k()}],"overscroll-x":[{"overscroll-x":k()}],"overscroll-y":[{"overscroll-y":k()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[g]}],"inset-x":[{"inset-x":[g]}],"inset-y":[{"inset-y":[g]}],start:[{start:[g]}],end:[{end:[g]}],top:[{top:[g]}],right:[{right:[g]}],bottom:[{bottom:[g]}],left:[{left:[g]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",vr,le]}],basis:[{basis:L()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",le]}],grow:[{grow:ce()}],shrink:[{shrink:ce()}],order:[{order:["first","last","none",vr,le]}],"grid-cols":[{"grid-cols":[xr]}],"col-start-end":[{col:["auto",{span:["full",vr,le]},le]}],"col-start":[{"col-start":j()}],"col-end":[{"col-end":j()}],"grid-rows":[{"grid-rows":[xr]}],"row-start-end":[{row:["auto",{span:[vr,le]},le]}],"row-start":[{"row-start":j()}],"row-end":[{"row-end":j()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",le]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",le]}],gap:[{gap:[f]}],"gap-x":[{"gap-x":[f]}],"gap-y":[{"gap-y":[f]}],"justify-content":[{justify:["normal",...pe()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...pe(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...pe(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[w]}],px:[{px:[w]}],py:[{py:[w]}],ps:[{ps:[w]}],pe:[{pe:[w]}],pt:[{pt:[w]}],pr:[{pr:[w]}],pb:[{pb:[w]}],pl:[{pl:[w]}],m:[{m:[y]}],mx:[{mx:[y]}],my:[{my:[y]}],ms:[{ms:[y]}],me:[{me:[y]}],mt:[{mt:[y]}],mr:[{mr:[y]}],mb:[{mb:[y]}],ml:[{ml:[y]}],"space-x":[{"space-x":[N]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[N]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",le,e]}],"min-w":[{"min-w":[le,e,"min","max","fit"]}],"max-w":[{"max-w":[le,e,"none","full","min","max","fit","prose",{screen:[Gt]},Gt]}],h:[{h:[le,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[le,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[le,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[le,e,"auto","min","max","fit"]}],"font-size":[{text:["base",Gt,Ut]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",as]}],"font-family":[{font:[xr]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",le]}],"line-clamp":[{"line-clamp":["none",rr,as]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Dt,le]}],"list-image":[{"list-image":["none",le]}],"list-style-type":[{list:["none","disc","decimal",le]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[n]}],"placeholder-opacity":[{"placeholder-opacity":[b]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[n]}],"text-opacity":[{"text-opacity":[b]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...J(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Dt,Ut]}],"underline-offset":[{"underline-offset":["auto",Dt,le]}],"text-decoration-color":[{decoration:[n]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:I()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",le]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",le]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[b]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...P(),hS]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",fS]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},mS]}],"bg-color":[{bg:[n]}],"gradient-from-pos":[{from:[m]}],"gradient-via-pos":[{via:[m]}],"gradient-to-pos":[{to:[m]}],"gradient-from":[{from:[h]}],"gradient-via":[{via:[h]}],"gradient-to":[{to:[h]}],rounded:[{rounded:[i]}],"rounded-s":[{"rounded-s":[i]}],"rounded-e":[{"rounded-e":[i]}],"rounded-t":[{"rounded-t":[i]}],"rounded-r":[{"rounded-r":[i]}],"rounded-b":[{"rounded-b":[i]}],"rounded-l":[{"rounded-l":[i]}],"rounded-ss":[{"rounded-ss":[i]}],"rounded-se":[{"rounded-se":[i]}],"rounded-ee":[{"rounded-ee":[i]}],"rounded-es":[{"rounded-es":[i]}],"rounded-tl":[{"rounded-tl":[i]}],"rounded-tr":[{"rounded-tr":[i]}],"rounded-br":[{"rounded-br":[i]}],"rounded-bl":[{"rounded-bl":[i]}],"border-w":[{border:[l]}],"border-w-x":[{"border-x":[l]}],"border-w-y":[{"border-y":[l]}],"border-w-s":[{"border-s":[l]}],"border-w-e":[{"border-e":[l]}],"border-w-t":[{"border-t":[l]}],"border-w-r":[{"border-r":[l]}],"border-w-b":[{"border-b":[l]}],"border-w-l":[{"border-l":[l]}],"border-opacity":[{"border-opacity":[b]}],"border-style":[{border:[...J(),"hidden"]}],"divide-x":[{"divide-x":[l]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[l]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[b]}],"divide-style":[{divide:J()}],"border-color":[{border:[o]}],"border-color-x":[{"border-x":[o]}],"border-color-y":[{"border-y":[o]}],"border-color-s":[{"border-s":[o]}],"border-color-e":[{"border-e":[o]}],"border-color-t":[{"border-t":[o]}],"border-color-r":[{"border-r":[o]}],"border-color-b":[{"border-b":[o]}],"border-color-l":[{"border-l":[o]}],"divide-color":[{divide:[o]}],"outline-style":[{outline:["",...J()]}],"outline-offset":[{"outline-offset":[Dt,le]}],"outline-w":[{outline:[Dt,Ut]}],"outline-color":[{outline:[n]}],"ring-w":[{ring:D()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[n]}],"ring-opacity":[{"ring-opacity":[b]}],"ring-offset-w":[{"ring-offset":[Dt,Ut]}],"ring-offset-color":[{"ring-offset":[n]}],shadow:[{shadow:["","inner","none",Gt,gS]}],"shadow-color":[{shadow:[xr]}],opacity:[{opacity:[b]}],"mix-blend":[{"mix-blend":[...Q(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":Q()}],filter:[{filter:["","none"]}],blur:[{blur:[t]}],brightness:[{brightness:[r]}],contrast:[{contrast:[a]}],"drop-shadow":[{"drop-shadow":["","none",Gt,le]}],grayscale:[{grayscale:[c]}],"hue-rotate":[{"hue-rotate":[u]}],invert:[{invert:[d]}],saturate:[{saturate:[v]}],sepia:[{sepia:[O]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[t]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[a]}],"backdrop-grayscale":[{"backdrop-grayscale":[c]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[u]}],"backdrop-invert":[{"backdrop-invert":[d]}],"backdrop-opacity":[{"backdrop-opacity":[b]}],"backdrop-saturate":[{"backdrop-saturate":[v]}],"backdrop-sepia":[{"backdrop-sepia":[O]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[s]}],"border-spacing-x":[{"border-spacing-x":[s]}],"border-spacing-y":[{"border-spacing-y":[s]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",le]}],duration:[{duration:Me()}],ease:[{ease:["linear","in","out","in-out",le]}],delay:[{delay:Me()}],animate:[{animate:["none","spin","ping","pulse","bounce",le]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[S]}],"scale-x":[{"scale-x":[S]}],"scale-y":[{"scale-y":[S]}],rotate:[{rotate:[vr,le]}],"translate-x":[{"translate-x":[E]}],"translate-y":[{"translate-y":[E]}],"skew-x":[{"skew-x":[C]}],"skew-y":[{"skew-y":[C]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",le]}],accent:[{accent:["auto",n]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",le]}],"caret-color":[{caret:[n]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":I()}],"scroll-mx":[{"scroll-mx":I()}],"scroll-my":[{"scroll-my":I()}],"scroll-ms":[{"scroll-ms":I()}],"scroll-me":[{"scroll-me":I()}],"scroll-mt":[{"scroll-mt":I()}],"scroll-mr":[{"scroll-mr":I()}],"scroll-mb":[{"scroll-mb":I()}],"scroll-ml":[{"scroll-ml":I()}],"scroll-p":[{"scroll-p":I()}],"scroll-px":[{"scroll-px":I()}],"scroll-py":[{"scroll-py":I()}],"scroll-ps":[{"scroll-ps":I()}],"scroll-pe":[{"scroll-pe":I()}],"scroll-pt":[{"scroll-pt":I()}],"scroll-pr":[{"scroll-pr":I()}],"scroll-pb":[{"scroll-pb":I()}],"scroll-pl":[{"scroll-pl":I()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",le]}],fill:[{fill:[n,"none"]}],"stroke-w":[{stroke:[Dt,Ut,as]}],stroke:[{stroke:[n,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},wS=nS(xS);function H(...n){return wS(yt(n))}let cs;function us(){return cs===void 0&&(cs=navigator.platform.includes("Mac")),cs}function Xm(n){return`${n}`.toLowerCase()==="mod"?us()?"⌘":"Ctrl":`${n}`.toLowerCase()==="alt"?us()?"⌥":"Alt":`${n}`.toLowerCase()==="shift"?us()?"⇧":"Shift":n}function Ym(n){return n.map(Xm).join(" ")}const St=x.forwardRef((n,e)=>{const{icon:t=void 0,tooltip:r=void 0,disabled:o=!1,customClass:i="",loading:s=void 0,shortcutKeys:l=void 0,tooltipOptions:a={},action:c=void 0,isActive:u=void 0,children:d,asChild:f=!1,upload:h=!1,...m}=n,g=f?Zh.Slot:Ec;return p.jsxs(ug,{children:[p.jsx(dg,{asChild:!0,children:p.jsxs(g,{"data-state":u!=null&&u()?"on":"off",onClick:c,ref:e,size:"sm",className:H("w-[32px] h-[32px]",i),disabled:o,...m,children:[t&&p.jsx(Rn,{name:t,className:"size-4"}),d]})}),r&&p.jsx(Oc,{...a,children:p.jsxs("div",{className:"flex max-w-24 flex-col items-center text-center",children:[p.jsx("div",{children:r}),!!(l!=null&&l.length)&&p.jsx("span",{children:Ym(l)})]})})]})});function vi(n){function e(){const i=x.useRef(n),s=x.useCallback(()=>i.current,[]),l=x.useRef(new Set),a=x.useCallback(u=>{i.current={...i.current,...u},l.current.forEach(d=>d())},[]),c=x.useCallback(u=>(l.current.add(u),()=>l.current.delete(u)),[]);return{get:s,set:a,subscribe:c}}const t=x.createContext(null);function r({children:i}){return p.jsx(t.Provider,{value:e(),children:i})}function o(i){const s=x.useContext(t);if(!s)throw new Error("Store not found");return[x.useSyncExternalStore(s.subscribe,()=>i(s.get()),()=>i(n)),s.set]}return{Provider:r,useStore:o}}vi({value:!1});vi({value:!1});const{Provider:SS,useStore:Zm}=vi({value:!1}),{Provider:CS,useStore:Qm}=vi({value:"light"});oe.d("0");function Cc(n,e){return window.addEventListener(n,e),()=>{window.removeEventListener(n,e)}}function xi(n,e){window.dispatchEvent(new CustomEvent(n,{detail:e}))}const dr={UPLOAD_IMAGE:n=>`UPLOAD_IMAGE-${n}`,UPLOAD_VIDEO:n=>`UPLOAD_VIDEO-${n}`,EDIT:n=>`EDIT-${n}`,UPDATE_THEME:n=>`UPDATE_THEME-${n}`,SEARCH_REPLCE:"SEARCH_REPLACE"};function eg(){const[n]=Zm(e=>e.value);return n}const kS={setDisable:(n,e)=>{xi(dr.EDIT(n),e)}};function TS(n,e){const{state:t}=e,r=t.selection.$anchor;let o=!1;if(r.depth)for(let i=r.depth;i>0;i--)r.node(i).type.name===n&&(e.dispatchTransaction&&e.dispatchTransaction(t.tr.delete(r.before(i),r.after(i)).scrollIntoView()),o=!0);else{const i=t.selection.node;i&&i.type.name===n&&(e.chain().deleteSelection().run(),o=!0)}if(!o){const i=r.pos;if(i){const s=t.tr.doc.nodeAt(i);s&&s.type.name===n&&(e.dispatchTransaction&&e.dispatchTransaction(t.tr.delete(i,i+s.nodeSize)),o=!0)}}return o}function tg(n,e,t){return n<e?e:n>t?t:n}const MS=n=>typeof n=="number",ES=n=>typeof n=="string",OS=n=>typeof n=="function";function AS(n,e="px"){if(!n)return n;const t=MS(n)?String(n):n,r=Number.parseFloat(t),o=t.match(/[%a-z]+$/i),i=o?o[0]:e;return Number.isNaN(r)?n:r+i}function NS(n,e){if(!n)return!1;const{extensions:t=[]}=(n==null?void 0:n.extensionManager)??{};return!!t.find(o=>o.name===e)}function RS(n){return n.map(e=>ES(e)?{value:e,name:e}:e)}const Cd=n=>typeof n=="boolean"?`${n}`:n===0?"0":n,kd=yt,wi=(n,e)=>t=>{var r;if((e==null?void 0:e.variants)==null)return kd(n,t==null?void 0:t.class,t==null?void 0:t.className);const{variants:o,defaultVariants:i}=e,s=Object.keys(o).map(c=>{const u=t==null?void 0:t[c],d=i==null?void 0:i[c];if(u===null)return null;const f=Cd(u)||Cd(d);return o[c][f]}),l=t&&Object.entries(t).reduce((c,u)=>{let[d,f]=u;return f===void 0||(c[d]=f),c},{}),a=e==null||(r=e.compoundVariants)===null||r===void 0?void 0:r.reduce((c,u)=>{let{class:d,className:f,...h}=u;return Object.entries(h).every(m=>{let[g,y]=m;return Array.isArray(y)?y.includes({...i,...l}[g]):{...i,...l}[g]===y})?[...c,d,f]:c},[]);return kd(n,s,a,t==null?void 0:t.class,t==null?void 0:t.className)},IS=wi("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"!bg-primary !text-primary-foreground hover:!bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),Ve=we.forwardRef(({className:n,variant:e,size:t,asChild:r=!1,...o},i)=>{const s=r?Zh.Slot:"button";return p.jsx(s,{className:H(IS({variant:e,size:t,className:n})),ref:i,...o})});Ve.displayName="Button";const _S=Oe.Root,DS=Oe.Trigger,jS=Oe.Portal,PS=Oe.Sub,ng=we.forwardRef(({className:n,inset:e,children:t,...r},o)=>p.jsxs(Oe.SubTrigger,{ref:o,className:H("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",e&&"pl-8",n),...r,children:[t,p.jsx(B.ChevronRight,{className:"ml-auto size-4"})]}));ng.displayName=Oe.SubTrigger.displayName;const rg=we.forwardRef(({className:n,...e},t)=>p.jsx(Oe.SubContent,{ref:t,className:H("z-50 min-w-[8rem] overflow-hidden rounded-md !border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",n),...e}));rg.displayName=Oe.SubContent.displayName;const og=we.forwardRef(({className:n,sideOffset:e=4,container:t,...r},o)=>p.jsx(Oe.Portal,{container:t,children:p.jsx(Oe.Content,{ref:o,sideOffset:e,className:H("z-50 min-w-[8rem] overflow-hidden rounded-md !border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",n),...r})}));og.displayName=Oe.Content.displayName;const ig=we.forwardRef(({className:n,inset:e,...t},r)=>p.jsx(Oe.Item,{ref:r,className:H("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e&&"pl-8",n),...t}));ig.displayName=Oe.Item.displayName;const sg=we.forwardRef(({className:n,children:e,checked:t,...r},o)=>p.jsxs(Oe.CheckboxItem,{checked:t,ref:o,className:H("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",n),...r,children:[p.jsx("span",{className:"absolute left-2 flex size-3.5 items-center justify-center",children:p.jsx(Oe.ItemIndicator,{children:p.jsx(B.Check,{className:"size-4"})})}),e]}));sg.displayName=Oe.CheckboxItem.displayName;const LS=we.forwardRef(({className:n,children:e,...t},r)=>p.jsxs(Oe.RadioItem,{ref:r,className:H("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",n),...t,children:[p.jsx("span",{className:"absolute left-2 flex size-3.5 items-center justify-center",children:p.jsx(Oe.ItemIndicator,{children:p.jsx(B.Circle,{className:"size-2 fill-current"})})}),e]}));LS.displayName=Oe.RadioItem.displayName;const BS=we.forwardRef(({className:n,inset:e,...t},r)=>p.jsx(Oe.Label,{ref:r,className:H("px-2 py-1.5 text-sm font-semibold",e&&"pl-8",n),...t}));BS.displayName=Oe.Label.displayName;const lg=we.forwardRef(({className:n,...e},t)=>p.jsx(Oe.Separator,{className:H("-mx-1 my-1 h-px bg-muted",n),ref:t,...e}));lg.displayName=Oe.Separator.displayName;function ag({className:n,...e}){return p.jsx("span",{className:H("ml-auto text-xs tracking-widest opacity-60",n),...e})}ag.displayName="DropdownMenuShortcut";const Rt=we.forwardRef(({className:n,type:e,...t},r)=>p.jsx("input",{type:e,className:H("flex h-10 w-full rounded-md !border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50",n),ref:r,...t}));Rt.displayName="Input";const zS=wi("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),ln=we.forwardRef(({className:n,...e},t)=>p.jsx(Qh.Root,{ref:t,className:H(zS(),n),...e}));ln.displayName=Qh.Root.displayName;const Pn=Rr.Root,Ln=Rr.Trigger,mn=we.forwardRef(({className:n,align:e="center",sideOffset:t=4,...r},o)=>p.jsx(Rr.Portal,{children:p.jsx(Rr.Content,{ref:o,align:e,sideOffset:t,className:H("z-50 w-72 rounded-md !border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",n),...r})}));mn.displayName=Rr.Content.displayName;const kc=we.forwardRef(({className:n,orientation:e="horizontal",decorative:t=!0,...r},o)=>p.jsx(tp.Root,{ref:o,decorative:t,orientation:e,className:H("shrink-0 bg-border",e==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",n),...r}));kc.displayName=tp.Root.displayName;const Tc=we.forwardRef(({className:n,...e},t)=>p.jsx(aa.Root,{className:H("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",n),...e,ref:t,children:p.jsx(aa.Thumb,{className:H("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));Tc.displayName=aa.Root.displayName;const cg=_n.Root,Mc=we.forwardRef(({className:n,...e},t)=>p.jsx(_n.List,{ref:t,className:H("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",n),...e}));Mc.displayName=_n.List.displayName;const Wr=we.forwardRef(({className:n,...e},t)=>p.jsx(_n.Trigger,{ref:t,className:H("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",n),...e}));Wr.displayName=_n.Trigger.displayName;const Ur=we.forwardRef(({className:n,...e},t)=>p.jsx(_n.Content,{ref:t,className:H("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",n),...e}));Ur.displayName=_n.Content.displayName;const $S=wi("inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors hover:bg-muted hover:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent hover:bg-accent hover:text-accent-foreground"},size:{default:"h-10 px-3",sm:"h-9 px-2",lg:"h-11 px-5"}},defaultVariants:{variant:"default",size:"default"}}),Ec=we.forwardRef(({className:n,variant:e,size:t,...r},o)=>p.jsx(ep.Root,{ref:o,className:H($S({variant:e,size:t,className:n})),...r}));Ec.displayName=ep.Root.displayName;const FS=Xr.Provider,ug=Xr.Root,dg=Xr.Trigger,Oc=we.forwardRef(({className:n,sideOffset:e=4,...t},r)=>p.jsx(Xr.Content,{ref:r,sideOffset:e,className:H("z-50 overflow-hidden rounded-md !border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",n),...t}));Oc.displayName=Xr.Content.displayName;const qS=1,VS=1e6;let ds=0;function HS(){return ds=(ds+1)%Number.MAX_SAFE_INTEGER,ds.toString()}const fs=new Map;function Td(n){if(fs.has(n))return;const e=setTimeout(()=>{fs.delete(n),Nr({type:"REMOVE_TOAST",toastId:n})},VS);fs.set(n,e)}function WS(n,e){switch(e.type){case"ADD_TOAST":return{...n,toasts:[e.toast,...n.toasts].slice(0,qS)};case"UPDATE_TOAST":return{...n,toasts:n.toasts.map(t=>t.id===e.toast.id?{...t,...e.toast}:t)};case"DISMISS_TOAST":{const{toastId:t}=e;return t?Td(t):n.toasts.forEach(r=>{Td(r.id)}),{...n,toasts:n.toasts.map(r=>r.id===t||t===void 0?{...r,open:!1}:r)}}case"REMOVE_TOAST":return e.toastId===void 0?{...n,toasts:[]}:{...n,toasts:n.toasts.filter(t=>t.id!==e.toastId)}}}const Do=[];let jo={toasts:[]};function Nr(n){jo=WS(jo,n),Do.forEach(e=>{e(jo)})}function US({...n}){const e=HS(),t=o=>Nr({type:"UPDATE_TOAST",toast:{...o,id:e}}),r=()=>Nr({type:"DISMISS_TOAST",toastId:e});return Nr({type:"ADD_TOAST",toast:{...n,id:e,open:!0,onOpenChange:o=>{o||r()}}}),{id:e,dismiss:r,update:t}}function GS(){const[n,e]=we.useState(jo);return we.useEffect(()=>(Do.push(e),()=>{const t=Do.indexOf(e);t>-1&&Do.splice(t,1)}),[n]),{...n,toast:US,dismiss:t=>Nr({type:"DISMISS_TOAST",toastId:t})}}const fg=we.forwardRef(({className:n,...e},t)=>p.jsx(ca.Root,{ref:t,className:H("!peer !h-4 !w-4 !p-0 !shrink-0 !rounded-sm !border !border-primary !ring-offset-background focus-visible:!outline-none focus-visible:!ring-2 focus-visible:!ring-ring focus-visible:!ring-offset-2 disabled:!cursor-not-allowed disabled:!opacity-50 data-[state=checked]:!bg-primary data-[state=checked]:!text-primary-foreground",n),...e,children:p.jsx(ca.Indicator,{className:H("!flex !p-0 !items-center !justify-center !text-current"),children:p.jsx(B.Check,{className:"!h-4 !w-4"})})}));fg.displayName=ca.Root.displayName;function KS(n){return p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",...n,children:p.jsx("path",{fill:"currentColor",d:"M19 12h-2v3h-3v2h5zM7 9h3V7H5v5h2zm14-6H3a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h18a2 2 0 0 0 2-2V5a2 2 0 0 0-2-2m0 16H3V5h18z"})})}function JS(n){return p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",...n,children:p.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M6 15h15m0 4H6m9-8h6m0-4h-6M9 9h1a1 1 0 1 1-1 1V7.5a2 2 0 0 1 2-2M3 9h1a1 1 0 1 1-1 1V7.5a2 2 0 0 1 2-2"})})}function XS(){return p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",className:"w-4 h-4",width:"1em",height:"1em",viewBox:"0 0 24 24",children:p.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",d:"M5.5 3c1.404 0 2.107 0 2.611.38c.219.164.406.375.552.62C9 4.568 9 5.358 9 6.938v10.125c0 1.58 0 2.37-.337 2.937a2.1 2.1 0 0 1-.552.621c-.504.38-1.207.38-2.611.38s-2.107 0-2.611-.38a2.1 2.1 0 0 1-.552-.62C2 19.432 2 18.642 2 17.062V6.938c0-1.58 0-2.37.337-2.938a2.1 2.1 0 0 1 .552-.62C3.393 3 4.096 3 5.5 3M20 11.938v5.124c0 1.58 0 2.37-.337 2.938a2.1 2.1 0 0 1-.552.62c-.504.38-1.207.38-2.611.38s-2.107 0-2.611-.38a2.1 2.1 0 0 1-.552-.62C13 19.433 13 18.642 13 17.063V6.938c0-1.58 0-2.37.337-2.938M22 9l-6-6m6 0l-6 6",color:"currentColor"})})}function YS(){return p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",className:"w-4 h-4",width:"1em",height:"1em",viewBox:"0 0 24 24",children:p.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",d:"M21 18.5c0 1.404 0 2.107-.38 2.611a2.1 2.1 0 0 1-.62.552c-.567.337-1.358.337-2.937.337H6.938c-1.58 0-2.37 0-2.938-.337a2.1 2.1 0 0 1-.62-.552C3 20.607 3 19.904 3 18.5s0-2.107.38-2.611c.163-.218.374-.406.62-.552C4.567 15 5.357 15 6.938 15h10.125c1.58 0 2.37 0 2.937.337c.246.146.457.334.62.552c.38.504.38 1.207.38 2.611M12.063 4H6.937C5.358 4 4.568 4 4 4.337a2.1 2.1 0 0 0-.62.552C3 5.393 3 6.096 3 7.5s0 2.107.38 2.611c.163.218.374.406.62.552C4.567 11 5.357 11 6.938 11h10.125c1.58 0 2.37 0 2.937-.337M21 8l-6-6m6 0l-6 6",color:"currentColor"})})}function ZS(n){return p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",...n,children:p.jsx("path",{fill:"currentColor",d:"M14 2H6a2 2 0 0 0-2 2v16c0 1.11.89 2 2 2h12c1.11 0 2-.89 2-2V8zm4 18H6V4h7v5h5zm-.65-10l-2.1 9h-1.4l-1.8-6.79l-1.8 6.79h-1.4l-2.2-9h1.5l1.4 6.81l1.8-6.81h1.3l1.8 6.81l1.4-6.81z"})})}function Rn(n){const e=gg[n.name];return e?p.jsx(e,{className:`size-4 ${(n==null?void 0:n.className)||""}`,onClick:n==null?void 0:n.onClick}):p.jsx($1.DynamicIcon,{className:`size-4 ${(n==null?void 0:n.className)||""}`,name:n.name,onClick:n==null?void 0:n.onClick})}function QS(n){return p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",...n,children:p.jsx("path",{fill:"currentColor",d:"M21 22H3v-2h18zm0-18H3V2h18zm-11 9.7h4l-2-5.4zM11.2 6h1.7l4.7 12h-2l-.9-2.6H9.4L8.5 18h-2z"})})}function hg(n){return p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 48 48",...n,children:p.jsx("path",{fill:"currentColor",stroke:"currentColor",strokeLinejoin:"round",strokeWidth:4,d:"M36 19L24 31L12 19z"})})}function e2(n){return p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",...n,children:p.jsx("path",{fill:"currentColor",d:"M9 7v10h6v-2h-4V7z"})})}function t2(n){return p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",...n,children:p.jsx("path",{fill:"currentColor",d:"M9 7c-1.1 0-2 .9-2 2v8h2V9h2v7h2V9h2v8h2V9a2 2 0 0 0-2-2z"})})}function n2(n){return p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",...n,children:p.jsx("path",{fill:"currentColor",d:"M11 7c-1.1 0-2 .9-2 2v2a2 2 0 0 0 2 2h2v2H9v2h4c1.11 0 2-.89 2-2v-2a2 2 0 0 0-2-2h-2V9h4V7z"})})}function r2(){return p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",children:p.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M14 4h4a1 1 0 0 1 1 1v14a1 1 0 0 1-1 1h-4a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1m-9 8h4m-2-2v4"})})}function o2(){return p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",children:p.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M6 4h4a1 1 0 0 1 1 1v14a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1m9 8h4m-2-2v4"})})}function i2(){return p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",children:p.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M12 21v-4m0-4V9m0-4V3m-2 18h4M8 5v4h11l2-2l-2-2zm6 8v4H6l-2-2l2-2z"})})}function s2(){return p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",children:p.jsx("path",{fill:"currentColor",d:"M23.943 19.806a.2.2 0 0 0-.168-.034c-1.26-1.855-2.873-3.61-4.419-5.315l-.252-.284c-.001-.073-.067-.12-.134-.15l-.084-.084c-.05-.1-.169-.167-.286-.1c-.47.234-.907.585-1.327.919c-.554.434-1.109.87-1.63 1.354a5 5 0 0 0-.588.618c-.084.117-.017.217.084.267c-.37.368-.74.736-1.109 1.12a.2.2 0 0 0-.05.134c0 .05.033.1.067.117l.655.502v.016c.924.92 2.554 2.173 4.285 3.527c.251.201.52.402.773.602c.117.134.234.285.335.418c.05.066.169.084.236.033c.033.034.084.067.118.1a.24.24 0 0 0 .1.034a.15.15 0 0 0 .135-.066a.24.24 0 0 0 .033-.1c.017 0 .017.016.034.016a.2.2 0 0 0 .134-.05l3.058-3.327c.12-.116.014-.267 0-.267m-7.628-.134l-1.546-1.17l-.15-.1c-.035-.017-.068-.05-.102-.067l-.117-.1c.66-.66 1.33-1.308 2-1.956c-.488.484-1.463 1.906-1.261 2.373c.002 0 .018.042.067.084zm4.1 3.126l-1.277-.97a27 27 0 0 0-1.58-1.504c.69.518 1.277.97 1.361 1.053c.673.585.638.485 1.093.87l.554.4c-.074.103-.151.148-.151.151m.336.25l-.034-.016a1 1 0 0 0 .152-.117zM.588 3.476c.033.217.084.435.117.636c.201 1.103.403 2.106.772 2.858l.152.568c.05.217.134.485.219.552a67 67 0 0 0 3.578 2.942a.18.18 0 0 0 .219 0s0 .016.016.016a.15.15 0 0 0 .118.05a.2.2 0 0 0 .134-.05c1.798-1.989 3.142-3.627 4.1-4.998c.068-.066.084-.167.084-.25c.067-.067.118-.151.185-.201c.067-.067.067-.184 0-.235l-.017-.016c0-.033-.017-.084-.05-.1c-.42-.401-.722-.685-1.042-.986a94 94 0 0 1-2.352-2.273c-.017-.017-.034-.034-.067-.034c-.336-.117-1.025-.234-1.882-.385c-1.277-.216-3.008-.517-4.57-.986c0 0-.101 0-.118.017l-.05.05C.05.714.022.707 0 .718c.017.1.017.167.05.284c0 .033.068.301.068.334zm7.19 4.78l-.033.034a.036.036 0 0 1 .033-.034M6.553 2.238c.101.1.521.502.622.585c-.437-.2-1.529-.702-2.034-.869c.505.1 1.194.201 1.412.284M.79 1.403c.252.434.454 1.939.655 3.41c-.118-.469-.201-.936-.302-1.372C.992 2.673.84 1.988.638 1.386c.124 0 .152.021.152.017m-.286-.369c0-.016 0-.033-.017-.033c.085 0 .135.017.202.05c0 .006-.145-.017-.185-.017m23.17-.217c.017-.066-.336-.367-.219-.384c.253-.017.253-.401 0-.401c-.335.017-.688.1-1.008.15c-.587.117-1.192.234-1.78.367a80 80 0 0 0-3.949.937c-.403.117-.857.2-1.243.401c-.135.067-.118.2-.05.284c-.034.017-.051.017-.085.034c-.117.017-.218.034-.335.05c-.102.017-.152.1-.135.2c0 .017.017.05.017.067c-.706.936-1.496 1.923-2.353 2.976c-.84.969-1.73 1.989-2.62 3.042c-2.84 3.31-6.05 7.07-9.594 10.38a.16.16 0 0 0 0 .234c.016.016.033.033.05.033c-.05.05-.101.085-.152.134q-.05.05-.05.1a.4.4 0 0 0-.067.084c-.067.067-.067.184.017.234c.067.066.185.066.235-.017c.017-.017.017-.033.033-.033a.265.265 0 0 1 .37 0c.202.217.404.435.588.618l-.42-.35c-.067-.067-.184-.05-.234.016c-.068.066-.051.184.016.234l4.469 3.727c.034.034.067.034.118.034a.15.15 0 0 0 .117-.05l.101-.1c.017.016.05.016.067.016c.05 0 .084-.016.118-.05c6.049-6.05 10.922-10.614 16.5-14.693c.05-.033.067-.1.067-.15c.067 0 .118-.05.15-.117c1.026-3.125 1.228-5.9 1.295-7.27c0-.059.016-.038.016-.068c.017-.033.017-.05.017-.05a.98.98 0 0 0-.067-.619m-10.82 4.915c.268-.301.537-.619.806-.903c-1.73 2.273-4.603 5.767-8.67 9.929c2.773-3.059 5.562-6.218 7.864-9.026M5.14 23.466c-.016-.017-.016-.017 0-.017zm2.504-2.156c.135-.15.27-.284.42-.434c0 0 0 .016.017.016c-.224.198-.433.418-.437.418m.69-.668c.099-.1.14-.173.284-.318c.992-1.02 2.017-2.04 3.059-3.076l.016-.016c.252-.2.555-.418.824-.619a228 228 0 0 0-4.184 4.029M14.852 3.91c-.554.719-1.176 1.671-1.697 2.423c-1.646 2.374-6.94 8.174-7.057 8.274a1190 1190 0 0 1-4.839 4.597l-.1.1c-.085-.1-.085-.25.016-.334C8.652 11.966 13.19 6.133 15.021 3.576c-.05.116-.084.216-.168.334zm2.906 3.427c-.671-.386-.99-.987-.806-1.572l.05-.2a.8.8 0 0 1 .085-.167a1.9 1.9 0 0 1 .756-.703c.016 0 .033 0 .05-.016c-.017-.034-.017-.084-.017-.134c.017-.1.085-.167.202-.167c.202 0 .824.184 1.059.384c.067.05.134.117.202.184c.084.1.218.268.285.401c.034.017.067.184.118.268c.033.134.067.284.05.418c-.017.016 0 .116-.017.116a1.6 1.6 0 0 1-.218.619c-.03.03.006.012-.05.067a1.2 1.2 0 0 1-.32.334a1.49 1.49 0 0 1-1.26.234a2 2 0 0 0-.169-.066m4.37 1.403c0 .017-.017.05 0 .067c-.034 0-.05.017-.085.034a110 110 0 0 0-3.915 3.025c1.11-.986 2.218-1.989 3.378-2.975c.336-.301.571-.686.638-1.12l.168-1.003v-.033c.085-.201.404-.118.353.1c-.004-.001-.173.795-.537 1.905"})})}function pg(){return p.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 32 32",children:[p.jsx("path",{fill:"currentColor",d:"M30 18v-2h-6v10h2v-4h3v-2h-3v-2zm-11 8h-4V16h4a3.003 3.003 0 0 1 3 3v4a3.003 3.003 0 0 1-3 3m-2-2h2a1 1 0 0 0 1-1v-4a1 1 0 0 0-1-1h-2zm-6-8H6v10h2v-3h3a2.003 2.003 0 0 0 2-2v-3a2 2 0 0 0-2-2m-3 5v-3h3l.001 3z"}),p.jsx("path",{fill:"currentColor",d:"M22 14v-4a.91.91 0 0 0-.3-.7l-7-7A.9.9 0 0 0 14 2H4a2.006 2.006 0 0 0-2 2v24a2 2 0 0 0 2 2h16v-2H4V4h8v6a2.006 2.006 0 0 0 2 2h6v2Zm-8-4V4.4l5.6 5.6Z"})]})}function mg(){return p.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",className:"icon",viewBox:"0 0 1024 1024",children:[p.jsx("path",{fill:"currentColor",d:"M679.253 402.364 618.77 561.015l-60.348-158.651a30.04 30.04 0 0 0-30.447-18.637 29.76 29.76 0 0 0-30.447 18.637l-60.416 158.651-60.416-158.651a30.515 30.515 0 0 0-38.843-17.272 28.945 28.945 0 0 0-17.954 37.547l88.815 233.267c4.369 11.469 15.7 19.115 28.398 19.115a30.31 30.31 0 0 0 28.468-19.115l62.395-163.908 62.396 163.84c4.437 11.605 15.701 19.183 28.4 19.183a30.31 30.31 0 0 0 28.466-19.115l88.747-233.267a28.945 28.945 0 0 0-17.886-37.547 30.447 30.447 0 0 0-38.912 17.272zm219.478 395.605-51.883-29.218c-28.672-16.18-52.224-3.072-52.224 29.082v.273H643.209a29.833 29.833 0 0 0-30.31 29.354c0 16.18 13.584 29.218 30.31 29.218h151.825c1.092 30.516 24.03 43.077 52.224 27.648l51.063-27.989c29.013-15.906 29.15-42.189.41-58.368"}),p.jsx("path",{fill:"currentColor",d:"m810.667 913.135-.478.068H201.796c-19.865 0-36.727-11.673-36.727-25.6v-618.36h154.965c51.268 0 92.911-39.39 92.911-87.858v-87.86H810.19c19.797 0 36.522 11.742 36.522 25.669V739.26h61.987V119.262c0-46.421-44.169-84.241-98.51-84.241H328.364l-225.28 194.56v658.09c0 46.285 44.236 84.105 98.713 84.105H810.19c43.759 0 80.554-24.713 93.32-58.573h-92.842zM350.89 94.89v86.562c0 16.11-13.858 29.286-30.925 29.286H216.815L350.959 94.891z"})]})}function l2(){return p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",children:p.jsxs("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",color:"currentColor",children:[p.jsx("path",{d:"M14.86 22h-4.312c-3.291 0-4.937 0-6.08-.798a4.2 4.2 0 0 1-.863-.805c-.855-1.066-.855-2.6-.855-5.67v-2.545c0-2.963 0-4.445.473-5.628c.761-1.903 2.37-3.403 4.41-4.113C8.9 2 10.49 2 13.667 2c1.816 0 2.723 0 3.448.252c1.166.406 2.085 1.263 2.52 2.35c.27.676.27 1.523.27 3.216V10"}),p.jsx("path",{d:"M2.75 12c0-1.84 1.506-3.333 3.364-3.333c.672 0 1.464.116 2.117-.057a1.67 1.67 0 0 0 1.19-1.179c.174-.647.057-1.432.057-2.098C9.478 3.493 10.984 2 12.84 2m.002 16h2.523m-4.949-4.15c-.126-.8-.281-.801-1.61-.85h-1.01c-.557 0-1.009.448-1.009 1v3c0 .552.452 1 1.01 1h1.816c.39 0 .803-.313.803-.7v-1.1c0-.11-.113-.304-.224-.304H9.068M12.842 13h1.261m0 0h1.262m-1.262 0v4.875M21.251 13h-2.523c-.557 0-1.009.448-1.009 1v1.5m0 0V18m0-2.5h2.523"})]})})}function a2(){return p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 20 20",children:p.jsx("path",{fill:"currentColor",d:"M6.5 3a.75.75 0 0 1 .697.471l3 7.5a.75.75 0 0 1-1.393.557L7.992 9.5H5.008l-.811 2.028a.75.75 0 0 1-1.393-.556l3-7.5A.75.75 0 0 1 6.5 3m0 2.77L5.608 8h1.784zm8.28-1.55a.75.75 0 1 0-1.06 1.06l.72.72h-3.69a.75.75 0 0 0 0 1.5h3.69l-.72.72a.75.75 0 0 0 1.06 1.06l2-2a.75.75 0 0 0 0-1.06zm0 7.5a.75.75 0 1 0-1.06 1.06l.72.72H3.75a.75.75 0 0 0 0 1.5h10.69l-.72.72a.75.75 0 1 0 1.06 1.06l2-2a.75.75 0 0 0 0-1.06z"})})}function c2(){return p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 48 48",children:p.jsxs("g",{fill:"none",stroke:"currentColor",strokeWidth:"4",children:[p.jsx("circle",{cx:"10",cy:"24",r:"4"}),p.jsx("circle",{cx:"38",cy:"10",r:"4"}),p.jsx("circle",{cx:"38",cy:"24",r:"4"}),p.jsx("circle",{cx:"38",cy:"38",r:"4"}),p.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M34 38H22V10h12M14 24h20"})]})})}function u2(){return p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 20 20",children:p.jsx("path",{fill:"currentColor",d:"M13.5 3a.75.75 0 0 0-.697.471l-3 7.5a.75.75 0 0 0 1.393.557l.812-2.028h2.984l.811 2.028a.75.75 0 0 0 1.393-.556l-3-7.5A.75.75 0 0 0 13.5 3m0 2.77L14.392 8h-1.784zM5.22 4.22a.75.75 0 0 1 1.06 1.06L5.56 6h3.69a.75.75 0 0 1 0 1.5H5.56l.72.72a.75.75 0 0 1-1.06 1.06l-2-2a.75.75 0 0 1 0-1.06zm0 7.5a.75.75 0 0 1 1.06 1.06l-.72.72h10.69a.75.75 0 0 1 0 1.5H5.56l.72.72a.75.75 0 1 1-1.06 1.06l-2-2a.75.75 0 0 1 0-1.06z"})})}function d2(){return p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",children:p.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",d:"m3 21l7.548-7.548M21 3l-7.548 7.548m0 0L8 3H3l7.548 10.452m2.904-2.904L21 21h-5l-5.452-7.548",color:"currentColor"})})}function f2(){return p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",children:p.jsx("path",{fill:"currentColor",d:"M14 2H6a2 2 0 0 0-2 2v16c0 1.11.89 2 2 2h12c1.11 0 2-.89 2-2V8zm4 18H6V4h7v5h5zm-.65-10l-2.1 9h-1.4l-1.8-6.79l-1.8 6.79h-1.4l-2.2-9h1.5l1.4 6.81l1.8-6.81h1.3l1.8 6.81l1.4-6.81z"})})}const gg={Bold:B.Bold,LoaderCircle:B.LoaderCircle,Italic:B.Italic,Underline:B.Underline,Quote:B.Quote,TextQuote:JS,Strikethrough:B.Strikethrough,Minus:B.Minus,Eraser:B.Eraser,PaintRoller:B.PaintRoller,Redo2:B.Redo2,Undo2:B.Undo2,AlignCenter:so.TextAlignCenterIcon,AlignJustify:so.TextAlignJustifyIcon,AlignLeft:so.TextAlignLeftIcon,AlignRight:so.TextAlignRightIcon,ChevronDown:B.ChevronDown,Subscript:B.Subscript,Superscript:B.Superscript,Code:B.Code,Code2:B.CodeXml,Type:B.Type,IndentIncrease:B.IndentIncrease,IndentDecrease:B.IndentDecrease,List:B.List,ListOrdered:B.ListOrdered,ListTodo:B.ListTodo,Link:B.Link,ImageUp:B.ImageUp,Video:B.Video,Maximize:B.Maximize,Minimize:B.Minimize,Table:B.Table,Sparkles:B.Sparkles,Pencil:B.Pencil,Unlink:B.Unlink,BetweenHorizonalEnd:B.BetweenHorizonalEnd,BetweenHorizonalStart:B.BetweenHorizonalStart,BetweenVerticalStart:B.BetweenVerticalStart,BetweenVerticalEnd:B.BetweenVerticalEnd,TableCellsMerge:B.TableCellsMerge,TableCellsSplit:B.TableCellsSplit,Trash2:B.Trash2,Trash:B.Trash,Replace:B.Replace,ChevronsUpDown:B.ChevronsUpDown,LineHeight:QS,Word:ZS,Heading1:B.Heading1,Heading2:B.Heading2,Heading3:B.Heading3,Heading4:B.Heading4,Heading5:B.Heading5,Heading6:B.Heading6,Columns2:B.Columns2,Columns3:B.Columns3,Columns4:B.Columns4,Plus:B.Plus,Grip:B.GripVertical,Copy:B.Copy,Clipboard:B.Clipboard,PanelLeft:B.PanelLeft,PanelRight:B.PanelRight,Columns:B.Columns2,Iframe:B.Frame,MenuDown:hg,SizeS:n2,SizeM:t2,SizeL:e2,AspectRatio:KS,Emoji:B.SmilePlus,DeleteColumn:XS,DeleteRow:YS,SearchAndReplace:B.Replace,EmojiIcon:B.SmilePlusIcon,KatexIcon:B.Sigma,ExportPdf:pg,ExportWord:mg,ImportWord:f2,ColumnAddLeft:r2,ColumnAddRight:o2,BookMarked:B.BookMarked,Excalidraw:s2,ZoomIn:B.ZoomIn,ZoomOut:B.ZoomOut,Settings:B.Settings,Eye:B.Eye,TextDirection:i2,LeftToRight:a2,RightToLeft:u2,Attachment:B.Paperclip,GifIcon:l2,ChevronUp:B.ChevronUp,Crop:B.CropIcon,Mermaid:c2,Twitter:d2,FlipX:B.FlipVertical,FlipY:B.FlipHorizontal,PencilRuler:B.PencilRuler};function h2({fill:n}){return p.jsx("svg",{width:"18px",height:"18px",viewBox:"0 0 256 256",version:"1.1",xmlns:"http://www.w3.org/2000/svg",children:p.jsx("g",{id:"icon/填充色",stroke:"none",strokeWidth:1,fill:"none",fillRule:"evenodd",children:p.jsxs("g",{id:"icon/背景颜色",children:[p.jsx("g",{id:"编组",fill:"currentColor",children:p.jsxs("g",{transform:"translate(119.502295, 137.878331) rotate(-135.000000) translate(-119.502295, -137.878331) translate(48.002295, 31.757731)",id:"矩形",children:[p.jsx("path",{d:"M100.946943,60.8084699 L43.7469427,60.8084699 C37.2852111,60.8084699 32.0469427,66.0467383 32.0469427,72.5084699 L32.0469427,118.70847 C32.0469427,125.170201 37.2852111,130.40847 43.7469427,130.40847 L100.946943,130.40847 C107.408674,130.40847 112.646943,125.170201 112.646943,118.70847 L112.646943,72.5084699 C112.646943,66.0467383 107.408674,60.8084699 100.946943,60.8084699 Z M93.646,79.808 L93.646,111.408 L51.046,111.408 L51.046,79.808 L93.646,79.808 Z",fillRule:"nonzero"}),p.jsx("path",{d:"M87.9366521,16.90916 L87.9194966,68.2000001 C87.9183543,69.4147389 86.9334998,70.399264 85.7187607,70.4 L56.9423078,70.4 C55.7272813,70.4 54.7423078,69.4150264 54.7423078,68.2 L54.7423078,39.4621057 C54.7423078,37.2523513 55.5736632,35.1234748 57.0711706,33.4985176 L76.4832996,12.4342613 C78.9534987,9.75382857 83.1289108,9.5834005 85.8093436,12.0535996 C87.1658473,13.303709 87.9372691,15.0644715 87.9366521,16.90916 Z",fillRule:"evenodd"}),p.jsx("path",{d:"M131.3,111.241199 L11.7,111.241199 C5.23826843,111.241199 0,116.479467 0,122.941199 L0,200.541199 C0,207.002931 5.23826843,212.241199 11.7,212.241199 L131.3,212.241199 C137.761732,212.241199 143,207.002931 143,200.541199 L143,122.941199 C143,116.479467 137.761732,111.241199 131.3,111.241199 Z M124,130.241 L124,193.241 L19,193.241 L19,130.241 L124,130.241 Z",fillRule:"nonzero"})]})}),p.jsx("path",{d:"M51,218 L205,218 C211.075132,218 216,222.924868 216,229 C216,235.075132 211.075132,240 205,240 L51,240 C44.9248678,240 40,235.075132 40,229 C40,222.924868 44.9248678,218 51,218 Z",id:"矩形",fill:n||"#FBDE28"})]})})})}function p2(n){const[e,t]=x.useState(void 0);function r(s){var l;(l=n.action)==null||l.call(n,s)}function o(){var s;(s=n.action)==null||s.call(n,e)}const i=x.useCallback(bi(s=>{t(s)},350),[]);return p.jsxs("div",{className:"flex items-center h-[32px]",children:[p.jsx(St,{tooltip:n==null?void 0:n.tooltip,disabled:n==null?void 0:n.disabled,action:o,tooltipOptions:n==null?void 0:n.tooltipOptions,shortcutKeys:n==null?void 0:n.shortcutKeys,children:p.jsx("span",{className:"flex items-center justify-center text-sm",children:p.jsx(h2,{fill:e})})}),p.jsx(k1,{selectedColor:e,setSelectedColor:i,onChange:r,highlight:!0,disabled:n==null?void 0:n.disabled,children:p.jsx(Ve,{variant:"ghost",size:"icon",className:"!w-3 !h-[32px]",disabled:n==null?void 0:n.disabled,children:p.jsx(Rn,{className:"!w-3 !h-3 text-zinc-500",name:"MenuDown"})})})]})}function m2(n){const{t:e}=oe.useLocale(),[t,r]=x.useState({text:"",link:""}),[o,i]=x.useState(!1);x.useEffect(()=>{var l;if(n!=null&&n.editor){const{href:a,target:c}=(l=n.editor)==null?void 0:l.getAttributes("link"),{from:u,to:d}=n.editor.state.selection,f=n.editor.state.doc.textBetween(u,d," ");r({link:a,text:f}),i(c==="_blank")}},[n==null?void 0:n.editor]);function s(l){l.preventDefault(),l.stopPropagation(),n==null||n.onSetLink(t.link,t.text,o)}return p.jsx("div",{className:"border-neutral-200 rounded-lg !border bg-white p-2 shadow-sm dark:border-neutral-800 dark:bg-black",children:p.jsxs("form",{className:"flex flex-col gap-2",onSubmit:s,children:[p.jsx(ln,{className:"mb-[6px]",children:e("editor.link.dialog.text")}),p.jsx("div",{className:"mb-[10px] flex w-full max-w-sm items-center gap-1.5",children:p.jsx("div",{className:"relative w-full max-w-sm items-center",children:p.jsx(Rt,{className:"w-80",onChange:l=>r({...t,text:l.target.value}),placeholder:"Text",required:!0,type:"text",value:t.text})})}),p.jsx(ln,{className:"mb-[6px]",children:e("editor.link.dialog.link")}),p.jsx("div",{className:"flex w-full max-w-sm items-center gap-1.5",children:p.jsxs("div",{className:"relative w-full max-w-sm items-center",children:[p.jsx(Rt,{className:"pl-10",onChange:l=>r({...t,link:l.target.value}),required:!0,type:"url",value:t.link}),p.jsx("span",{className:"absolute inset-y-0 start-0 flex items-center justify-center px-2",children:p.jsx(Rn,{className:"size-5 text-muted-foreground",name:"Link"})})]})}),p.jsxs("div",{className:"flex items-center space-x-2",children:[p.jsx(ln,{children:e("editor.link.dialog.openInNewTab")}),p.jsx(Tc,{checked:o,onCheckedChange:l=>{i(l)}})]}),p.jsx(Ve,{className:"mt-2 self-end",type:"submit",children:e("editor.link.dialog.button.apply")})]})})}function g2(n,e,t=null){return t?n.createChecked({index:e},t):n.createAndFill({index:e})}function y2(n){if(n.cached.columnsNodeTypes)return n.cached.columnsNodeTypes;const e={columns:n.nodes.columns,column:n.nodes.column};return n.cached.columnsNodeTypes=e,e}function b2(n,e,t=null){const r=y2(n),o=[];for(let i=0;i<e;i+=1){const s=g2(r.column,i,t);s&&o.push(s)}return r.columns.createChecked({cols:e},o)}function hs({state:n,dispatch:e,type:t}){const r=cn(i=>i.type.name===Ac.name)(n.selection),o=cn(i=>i.type.name===Nc.name)(n.selection);if(e&&r&&o){const i=r.node,s=o.node.attrs.index,l=i.toJSON();let a=s;t==="delete"?(a=s-1,l.content.splice(s,1)):(a=t==="addBefore"?s:s+1,l.content.splice(a,0,{type:"column",attrs:{index:s},content:[{type:"paragraph"}]})),l.attrs.cols=l.content.length,l.content.forEach((f,h)=>{f.attrs.index=h});const c=$t.fromJSON(n.schema,l);let u=r.pos;c.content.forEach((f,h,m)=>{m<a&&(u+=f.nodeSize)});const d=n.tr.setTime(Date.now());d.replaceWith(r.pos,r.pos+r.node.nodeSize,c).setSelection(K.near(d.doc.resolve(u))),e(d)}return!0}function Md({state:n,dispatch:e,type:t}){const r=cn(i=>i.type.name===Ac.name)(n.selection),o=cn(i=>i.type.name===Nc.name)(n.selection);if(e&&r&&o){const i=r.node,s=o.node.attrs.index;let l=0;t==="before"?l=(s-1+i.attrs.cols)%i.attrs.cols:l=(s+1)%i.attrs.cols;let a=r.pos;i.content.forEach((u,d,f)=>{f<l&&(a+=u.nodeSize)});const c=n.tr.setTime(Date.now());return c.setSelection(K.near(c.doc.resolve(a))),e(c),!0}return!1}const v2=200,Ac=et.create({name:"columns",group:"block",defining:!0,isolating:!0,allowGapCursor:!1,content:"column{1,}",priority:v2,addOptions(){return{HTMLAttributes:{class:"columns"}}},addAttributes(){return{cols:{default:2,parseHTML:n=>n.getAttribute("cols")}}},parseHTML(){return[{tag:"div[class=grid]"}]},renderHTML({HTMLAttributes:n}){return["div",Ke(this.options.HTMLAttributes,n),0]},addCommands(){return{insertColumns:n=>({tr:e,dispatch:t,editor:r})=>{const o=b2(r.schema,n&&n.cols||3);if(t){const i=e.selection.anchor+1;e.replaceSelectionWith(o).scrollIntoView().setSelection(K.near(e.doc.resolve(i)))}return!0},addColBefore:()=>({dispatch:n,state:e})=>hs({dispatch:n,state:e,type:"addBefore"}),addColAfter:()=>({dispatch:n,state:e})=>hs({dispatch:n,state:e,type:"addAfter"}),deleteCol:()=>({dispatch:n,state:e})=>hs({dispatch:n,state:e,type:"delete"})}},addKeyboardShortcuts(){return{"Mod-Alt-G":()=>this.editor.commands.insertColumns(),Tab:()=>Md({state:this.editor.state,dispatch:this.editor.view.dispatch,type:"after"}),"Shift-Tab":()=>Md({state:this.editor.state,dispatch:this.editor.view.dispatch,type:"before"})}}}),Nc=et.create({name:"column",content:"block+",isolating:!0,addOptions(){return{HTMLAttributes:{class:"column"}}},addAttributes(){return{index:{default:0,parseHTML:n=>n.getAttribute("index")}}},parseHTML(){return[{tag:"div[class=column]"}]},renderHTML({HTMLAttributes:n}){return["div",Ke(this.options.HTMLAttributes,n),0]}});var yg=(n=>(n[n.max=7]="max",n[n.min=0]="min",n[n.more=1]="more",n[n.less=-1]="less",n))(yg||{});function x2(n,e,t){return n<e?e:n>t?t:n}function w2(n,e,t,r){const{doc:o,selection:i}=n;if(!o||!i||!(i instanceof K||i instanceof nt))return n;const{from:s,to:l}=i;return o.nodesBetween(s,l,(a,c)=>{const u=a.type;return t.includes(u.name)?(n=bg(n,c,e),!1):!Oa(a.type.name,r.extensionManager.extensions)}),n}function bg(n,e,t){if(!n.doc)return n;const r=n.doc.nodeAt(e);if(!r)return n;const s=x2((r.attrs.indent||0)+t,0,7);if(s===r.attrs.indent)return n;const l={...r.attrs,indent:s};return n.setNodeMarkup(e,r.type,l,r.marks)}function S2({delta:n,types:e}){return({state:t,dispatch:r,editor:o})=>{const{selection:i}=t;let{tr:s}=t;return s=s.setSelection(i),s=w2(s,n,e,o),s.docChanged?(r&&r(s),!0):!1}}const vg={setOpen:(n,e)=>{xi(dr.UPLOAD_IMAGE(n),e)}},C2=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,Si=et.create({name:"image",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{}}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:n}){return["img",Ke(this.options.HTMLAttributes,n)]},addCommands(){return{setImage:n=>({commands:e})=>e.insertContent({type:this.name,attrs:n})}},addInputRules(){return[gi({find:C2,type:this.type,getAttributes:n=>{const[,,e,t,r]=n;return{src:t,alt:e,title:r}}})]}}),fr=bt.Root,hr=bt.Trigger,k2=bt.Portal,xg=we.forwardRef(({className:n,...e},t)=>p.jsx(bt.Overlay,{ref:t,className:H("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",n),...e}));xg.displayName=bt.Overlay.displayName;const Bn=we.forwardRef(({className:n,children:e,...t},r)=>p.jsxs(k2,{children:[p.jsx(xg,{}),p.jsxs(bt.Content,{ref:r,className:H("dialog-content fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",n),...t,children:[e,p.jsxs(bt.Close,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[p.jsx(B.X,{className:"h-4 w-4"}),p.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Bn.displayName=bt.Content.displayName;function wg({className:n,...e}){return p.jsx("div",{className:H("flex flex-col space-y-1.5 text-center sm:text-left",n),...e})}wg.displayName="DialogHeader";function eo({className:n,...e}){return p.jsx("div",{className:H("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",n),...e})}eo.displayName="DialogFooter";const zn=we.forwardRef(({className:n,...e},t)=>p.jsx(bt.Title,{ref:t,className:H("text-lg font-semibold leading-none tracking-tight",n),...e}));zn.displayName=bt.Title.displayName;const T2=we.forwardRef(({className:n,...e},t)=>p.jsx(bt.Description,{ref:t,className:H("text-sm text-muted-foreground",n),...e}));T2.displayName=bt.Description.displayName;function M2(n){return n.replace(/^.*\/|\..+$/g,"")}function E2(n){return n.split(".").pop()}function O2(n){return n<1024?`${n} Byte`:n<1024*1024?`${(n/1024).toFixed(2)} KB`:`${(n/1024/1024).toFixed(2)} MB`}function A2(n){return n?n==="application/pdf"?"pdf":n.startsWith("application/")&&[".document","word"].some(e=>n.includes(e))?"word":n.startsWith("application/")&&["presentation"].some(e=>n.includes(e))?"excel":n.startsWith("application/")&&["sheet"].some(e=>n.includes(e))?"ppt":n.startsWith("image")?"image":n.startsWith("audio")?"audio":n.startsWith("video")?"video":"file":"file"}function N2(n){return new Promise(e=>{const t=new FileReader;t.addEventListener("load",()=>{e({alt:n.name,src:t.result})},!1),t.readAsDataURL(n)})}function Ci(n,e){const t=n.split(","),r=t[0].match(/:(.*?);/)[1],o=atob(t[t.length-1]);let i=o.length;const s=new Uint8Array(i);for(;i--;)s[i]=o.charCodeAt(i);return new File([s],e,{type:r})}function R2({editor:n,imageInline:e,onClose:t}){const{t:r}=oe.useLocale(),[o,i]=x.useState(!1),s=x.useRef(null),[l,a]=x.useState(),[c,u]=x.useState(""),d=x.useRef(null),[f,h]=x.useState({src:"",file:null});function m(v){if(s.current&&v.width&&v.height){const S=g(s.current,v);u(S)}}function g(v,S){const O=document.createElement("canvas"),C=v.naturalWidth/v.width,N=v.naturalHeight/v.height;O.width=S.width*C,O.height=S.height*N;const E=O.getContext("2d");return E&&(E.imageSmoothingEnabled=!1,E.drawImage(v,S.x*C,S.y*N,S.width*C,S.height*N,0,0,S.width*C,S.height*N)),O.toDataURL("image/png",1)}async function y(){var v,S;try{const O=Ci(c,((v=f==null?void 0:f.file)==null?void 0:v.name)||"image.png"),C=(S=n.extensionManager.extensions.find(E=>E.name===Qo.name))==null?void 0:S.options;let N="";C.upload?N=await C.upload(O):N=URL.createObjectURL(O),n.chain().focus().setImageInline({src:N,inline:e}).run(),i(!1),h({src:"",file:null}),t()}catch(O){console.log("Error cropping image",O)}}function b(v){var S;v.preventDefault(),(S=d.current)==null||S.click()}const w=async v=>{var N;const S=(N=v==null?void 0:v.target)==null?void 0:N.files;if(!n||n.isDestroyed||S.length===0)return;const O=S[0],C=await N2(O);i(!0),h({src:C.src,file:O})};return p.jsxs(p.Fragment,{children:[p.jsx(Ve,{className:"mt-1 w-full",onClick:b,size:"sm",children:r("editor.image.dialog.tab.uploadCrop")}),p.jsxs(fr,{open:o,children:[p.jsx(hr,{}),p.jsxs(Bn,{children:[p.jsx(zn,{children:r("editor.image.dialog.tab.uploadCrop")}),p.jsx("div",{children:f.src&&p.jsx(I1,{className:"w-full",crop:l,onChange:v=>a(v),onComplete:v=>m(v),children:p.jsx("img",{alt:"Crop me",ref:s,src:f.src})})}),p.jsxs(eo,{children:[p.jsxs(Ve,{onClick:()=>{i(!1),h({src:"",file:null})},children:[r("editor.imageUpload.cancel"),p.jsx(Rn,{className:"ml-[4px]",name:"Trash2"})]}),p.jsxs(Ve,{className:"w-fit",onClick:y,children:[r("editor.imageUpload.crop"),p.jsx(Rn,{className:"ml-[4px]",name:"Crop"})]})]})]})]}),p.jsx("input",{accept:"image/*",multiple:!0,onChange:w,ref:d,type:"file",style:{display:"none"}})]})}function I2(n){var m;const{t:e}=oe.useLocale(),[t,r]=x.useState(!1),o=g=>{r(g.detail)},[i,s]=x.useState(""),l=x.useRef(null),[a,c]=x.useState(((m=n.editor.extensionManager.extensions.find(g=>g.name===Qo.name))==null?void 0:m.options.defaultInline)||!1),u=x.useMemo(()=>{var y;return(y=n.editor.extensionManager.extensions.find(b=>b.name===Qo.name))==null?void 0:y.options},[n.editor]);x.useEffect(()=>{const g=Cc(dr.UPLOAD_IMAGE(n.editor.id),o);return()=>{g()}},[]);async function d(g){var v;const y=(v=g==null?void 0:g.target)==null?void 0:v.files;if(!n.editor||n.editor.isDestroyed||y.length===0)return;const b=y[0];let w="";u.upload?w=await u.upload(b):w=URL.createObjectURL(b),n.editor.chain().focus().setImageInline({src:w,inline:a}).run(),r(!1),c(!1)}function f(g){g.preventDefault(),g.stopPropagation(),n.editor.chain().focus().setImageInline({src:i,inline:a}).run(),r(!1),c(!1),s("")}function h(g){var y;g.preventDefault(),(y=l.current)==null||y.click()}return p.jsxs(fr,{onOpenChange:r,open:t,children:[p.jsx(hr,{asChild:!0,children:p.jsx(St,{action:()=>r(!0),icon:n.icon,tooltip:n.tooltip})}),p.jsxs(Bn,{children:[p.jsx(zn,{children:e("editor.image.dialog.title")}),p.jsxs(cg,{activationMode:"manual",defaultValue:u.resourceImage==="both"||u.resourceImage==="upload"?"upload":"link",children:[p.jsxs(Mc,{className:"grid w-full grid-cols-2",children:[u.resourceImage==="both"||u.resourceImage==="upload"?p.jsx(Wr,{value:"upload",children:e("editor.image.dialog.tab.upload")}):p.jsx(p.Fragment,{}),u.resourceImage==="both"||u.resourceImage==="link"?p.jsx(Wr,{value:"link",children:e("editor.image.dialog.tab.url")}):p.jsx(p.Fragment,{})]}),p.jsxs("div",{className:"my-[10px] flex items-center gap-[4px]",children:[p.jsx(fg,{checked:a,onCheckedChange:g=>{c(g)}}),p.jsx(ln,{children:e("editor.link.dialog.inline")})]}),p.jsxs(Ur,{value:"upload",children:[p.jsxs("div",{className:"flex items-center gap-[10px]",children:[p.jsx(Ve,{className:"mt-1 w-full",onClick:h,size:"sm",children:e("editor.image.dialog.tab.upload")}),p.jsx(R2,{editor:n.editor,imageInline:a,onClose:()=>vg.setOpen(n.editor.id,!1)})]}),p.jsx("input",{accept:"image/*",multiple:!0,onChange:d,ref:l,type:"file",style:{display:"none"}})]}),p.jsx(Ur,{value:"link",children:p.jsx("form",{onSubmit:f,children:p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(Rt,{autoFocus:!0,onChange:g=>s(g.target.value),placeholder:e("editor.image.dialog.placeholder"),required:!0,type:"url",value:i}),p.jsx(Ve,{type:"submit",children:e("editor.image.dialog.button.apply")})]})})})]})]})]})}const po={TOP_LEFT:"tl",TOP_RIGHT:"tr",BOTTOM_LEFT:"bl",BOTTOM_RIGHT:"br"};function _2(n){var N,E;const[e,t]=x.useState({width:oe.IMAGE_MAX_SIZE,height:oe.IMAGE_MAX_SIZE}),[r,o]=x.useState({width:0,height:0}),[i]=x.useState([po.TOP_LEFT,po.TOP_RIGHT,po.BOTTOM_LEFT,po.BOTTOM_RIGHT]),[s,l]=x.useState(!1),[a,c]=x.useState({x:0,y:0,w:0,h:0,dir:""}),{align:u,inline:d}=(N=n==null?void 0:n.node)==null?void 0:N.attrs,f=x.useMemo(()=>{var ce;const{src:k,alt:A,width:L,height:I,flipX:D,flipY:j}=(ce=n==null?void 0:n.node)==null?void 0:ce.attrs,P=Zo(L)?`${L}px`:L,J=Zo(I)?`${I}px`:I,Q=[];D&&Q.push("rotateX(180deg)"),j&&Q.push("rotateY(180deg)");const pe=Q.join(" ");return{src:k||void 0,alt:A||void 0,style:{width:P||void 0,height:J||void 0,transform:pe||"none"}}},[(E=n==null?void 0:n.node)==null?void 0:E.attrs]),h=x.useMemo(()=>{const{style:{width:k}}=f;return{width:k==="100%"?k:void 0}},[f]);function m(k){o({width:k.target.width,height:k.target.height})}function g(){const{editor:k,getPos:A}=n;k.commands.setNodeSelection(A())}const y=x.useCallback(qt(()=>{const{editor:k}=n,{width:A}=getComputedStyle(k.view.dom);t(L=>({...L,width:Number.parseInt(A,10)}))},oe.IMAGE_THROTTLE_WAIT_TIME),[n==null?void 0:n.editor]);function b(k,A){k.preventDefault(),k.stopPropagation();const L=r.width,I=r.height,D=L/I;let j=Number(n.node.attrs.width),P=Number(n.node.attrs.height);const J=e.width;j&&!P?(j=j>J?J:j,P=Math.round(j/D)):P&&!j?(j=Math.round(P*D),j=j>J?J:j):!j&&!P?(j=L>J?J:L,P=Math.round(j/D)):j=j>J?J:j,l(!0),c({x:k.clientX,y:k.clientY,w:j,h:P,dir:A})}const w=x.useCallback(qt(k=>{if(k.preventDefault(),k.stopPropagation(),!s)return;const{x:A,w:L,dir:I}=a,D=(k.clientX-A)*(/l/.test(I)?-1:1),j=Vm(L+D,oe.IMAGE_MIN_SIZE,e.width);n.updateAttributes({width:j,height:null})},oe.IMAGE_THROTTLE_WAIT_TIME),[s,a,e,n.updateAttributes]),v=x.useCallback(k=>{k.preventDefault(),k.stopPropagation(),s&&(c({x:0,y:0,w:0,h:0,dir:""}),l(!1),g())},[s,g]),S=x.useCallback(()=>{document==null||document.addEventListener("mousemove",w,!0),document==null||document.addEventListener("mouseup",v,!0)},[w,v]),O=x.useCallback(()=>{document==null||document.removeEventListener("mousemove",w,!0),document==null||document.removeEventListener("mouseup",v,!0)},[w,v]);x.useEffect(()=>(s?S():O(),()=>{O()}),[s,S,O]);const C=x.useMemo(()=>new ResizeObserver(()=>y()),[y]);return x.useEffect(()=>(C.observe(n.editor.view.dom),()=>{C.disconnect()}),[n.editor.view.dom,C]),p.jsx(hn,{as:d?"span":"div",className:"image-view",style:{...h,textAlign:u,display:d?"inline":"block"},children:p.jsxs("div",{"data-drag-handle":!0,draggable:"true",style:h,className:`image-view__body ${n!=null&&n.selected?"image-view__body--focused":""} ${s?"image-view__body--resizing":""}`,children:[p.jsx("img",{alt:f.alt,className:"image-view__body__image block",height:"auto",onClick:g,onLoad:m,src:f.src,style:f.style}),(n==null?void 0:n.editor.view.editable)&&((n==null?void 0:n.selected)||s)&&p.jsx("div",{className:"image-resizer",children:i==null?void 0:i.map(k=>p.jsx("span",{className:`image-resizer__handler image-resizer__handler--${k}`,onMouseDown:A=>b(A,k)},`image-dir-${k}`))})]})})}const or=new ct("upload-image");function D2(){return new Pe({key:or,state:{init(){return ve.empty},apply(n,e){e=e.map(n.mapping,n.doc);const t=n.getMeta(or);if(t!=null&&t.add)for(const{id:r,pos:o,src:i}of t.add){const s=j2(i),l=_e.widget(o,s,{id:r});e=e.add(n.doc,[l])}else if(t!=null&&t.remove)for(const r of t.remove)e=e.remove(e.find(void 0,void 0,o=>o.id===r));return e}},props:{decorations(n){return this.getState(n)}}})}function j2(n){const e=document.createElement("div"),t=document.createElement("img");return t.setAttribute("class","opacity-50"),t.src=n,t.addEventListener("load",()=>{e.setAttribute("class","img-placeholder")}),e.append(t),e}function P2(n,e){var o;const r=or.getState(n).find(void 0,void 0,i=>i.id===e);return r.length>0?(o=r[0])==null?void 0:o.from:null}function L2({validateFn:n,onUpload:e,postUpload:t,defaultInline:r=!1}){return(o,i,s)=>{for(const l of o){if(n&&!n(l))continue;const a=Date.now().toString(),c=i.state.tr;c.selection.empty||c.deleteSelection();const u=URL.createObjectURL(l);c.setMeta(or,{add:[{id:a,pos:s,src:u}]}),i.dispatch(c),e(l).then(async d=>{var w;t&&typeof d=="string"&&(d=await t(d));const{schema:f}=i.state;let h=P2(i.state,a);if(h===null)return;const m=typeof d=="object"?u:d,g=(w=f.nodes.image)==null?void 0:w.create({src:m,inline:r});if(!g)return;const{doc:y}=i.state;h>y.content.size&&(h=y.content.size-1);const b=i.state.tr.replaceWith(h,h,g).setMeta(or,{remove:[a]});i.dispatch(b)},()=>{const d=i.state.tr.delete(s,s).setMeta(or,{remove:[a]});i.dispatch(d)})}}}function B2(n,e,t){var o;const r=[...((o=e.clipboardData)==null?void 0:o.files)||[]];if(r.length>0){e.preventDefault();const i=n.state.selection.from;return t(r,n,i+1),!0}return!1}function z2(n,e,t,r){var i;const o=[...((i=e.dataTransfer)==null?void 0:i.files)||[]];if(!t&&o.length>0){e.preventDefault();const s=n.posAtCoords({left:e.clientX,top:e.clientY});if(s)return r(o,n,s.pos+1),!0}return!1}const $2={acceptMimes:["image/jpeg","image/gif","image/png","image/jpg"],maxSize:1024*1024*5,resourceImage:"both",defaultInline:!1},Qo=Si.extend({group:"inline",inline:!0,defining:!0,draggable:!0,selectable:!0,addOptions(){var n;return{...$2,...(n=this.parent)==null?void 0:n.call(this),upload:()=>Promise.reject("Image Upload Function"),button:({editor:e,extension:t,t:r})=>{var o,i;return{component:I2,componentProps:{action:()=>!0,upload:t.options.upload,disabled:!((i=(o=e.can()).setImage)!=null&&i.call(o,{})),icon:"ImageUp",tooltip:r("editor.image.tooltip"),editor:e}}}}},addAttributes(){var n;return{...(n=this.parent)==null?void 0:n.call(this),flipX:{default:!1},flipY:{default:!1},width:{default:null,parseHTML:e=>{const t=e.style.width||e.getAttribute("width")||null;return t?Number.parseInt(t,10):null},renderHTML:e=>({width:e.width})},align:{default:"center",parseHTML:e=>e.getAttribute("align"),renderHTML:e=>({align:e.align})},inline:{default:!1,parseHTML:e=>!!e.getAttribute("inline"),renderHTML:e=>({inline:e.inline})}}},addNodeView(){return pn(_2)},addCommands(){var n;return{...(n=this.parent)==null?void 0:n.call(this),setImageInline:e=>({commands:t})=>t.insertContent({type:this.name,attrs:{...e,inline:e.inline??this.options.defaultInline}}),updateImage:e=>({commands:t})=>t.updateAttributes(this.name,e),setAlignImage:e=>({commands:t})=>t.updateAttributes(this.name,{align:e})}},renderHTML({HTMLAttributes:n}){const{flipX:e,flipY:t,align:r,inline:o}=n,i=e||t?`transform: rotateX(${e?"180":"0"}deg) rotateY(${t?"180":"0"}deg);`:"",s=r?`text-align: ${r};`:"";return[o?"span":"div",{style:s,class:"image"},["img",Ke({height:"auto",style:i},this.options.HTMLAttributes,n)]]},parseHTML(){return[{tag:"span.image img",getAttrs:n=>{var i;const e=n==null?void 0:n.parentElement,t=n==null?void 0:n.getAttribute("width"),r=(n==null?void 0:n.getAttribute("flipx"))||!1,o=(n==null?void 0:n.getAttribute("flipy"))||!1;return{src:n==null?void 0:n.getAttribute("src"),alt:n==null?void 0:n.getAttribute("alt"),caption:n==null?void 0:n.getAttribute("caption"),width:t?Number.parseInt(t,10):null,align:(n==null?void 0:n.getAttribute("align"))||((i=e==null?void 0:e.style)==null?void 0:i.textAlign)||null,inline:(n==null?void 0:n.getAttribute("inline"))||!1,flipX:r==="true",flipY:o==="true"}}},{tag:"div[class=image]",getAttrs:n=>{const e=n.querySelector("img"),t=e==null?void 0:e.getAttribute("width"),r=(e==null?void 0:e.getAttribute("flipx"))||!1,o=(e==null?void 0:e.getAttribute("flipy"))||!1;return{src:e==null?void 0:e.getAttribute("src"),alt:e==null?void 0:e.getAttribute("alt"),caption:e==null?void 0:e.getAttribute("caption"),width:t?Number.parseInt(t,10):null,align:(e==null?void 0:e.getAttribute("align"))||n.style.textAlign||null,inline:(e==null?void 0:e.getAttribute("inline"))||!1,flipX:r==="true",flipY:o==="true"}}}]},addProseMirrorPlugins(){const e=L2({validateFn:t=>!(!this.options.acceptMimes.includes(t.type)||t.size>this.options.maxSize),onUpload:this.options.upload,defaultInline:this.options.defaultInline});return[new Pe({props:{handlePaste:(t,r)=>!r.clipboardData||[...r.clipboardData.files||[]].some(i=>i.type==="text/html")?!1:B2(t,r,e),handleDrop:(t,r,o,i)=>(!(r instanceof DragEvent)||!r.dataTransfer||z2(t,r,i,e),!1)}}),D2()]}});function F2(n){return/\.(?:mp4|webm|ogg|mov)$/i.test(n)}function q2(n){const{t:e}=oe.useLocale(),[t,r]=x.useState(""),o=x.useRef(null),[i,s]=x.useState(""),[l,a]=x.useState(!1),c=m=>{a(m.detail)};x.useEffect(()=>{const m=Cc(dr.UPLOAD_VIDEO(n.editor.id),c);return()=>{m()}},[]);const u=x.useMemo(()=>{var g;return(g=n.editor.extensionManager.extensions.find(y=>y.name===Sg.name))==null?void 0:g.options},[n.editor]);async function d(m){var w;const g=(w=m==null?void 0:m.target)==null?void 0:w.files;if(!n.editor||n.editor.isDestroyed||g.length===0)return;const y=g[0];let b="";u.upload?b=await u.upload(y):b=URL.createObjectURL(y),n.editor.chain().focus().setVideo({src:b,width:"100%"}).run(),a(!1)}function f(m){m.preventDefault(),m.stopPropagation(),t&&(n.editor.chain().focus().setVideo({src:t,width:"100%"}).run(),a(!1))}function h(m){var g;m.preventDefault(),(g=o.current)==null||g.click()}return p.jsxs(fr,{onOpenChange:a,open:l,children:[p.jsx(hr,{asChild:!0,children:p.jsx(St,{action:()=>a(!0),icon:n.icon,tooltip:n.tooltip})}),p.jsxs(Bn,{children:[p.jsx(zn,{children:e("editor.video.dialog.title")}),p.jsxs(cg,{activationMode:"manual",defaultValue:(u==null?void 0:u.resourceVideo)==="both"||(u==null?void 0:u.resourceVideo)==="upload"?"upload":"link",children:[p.jsxs(Mc,{className:"grid w-full grid-cols-2",children:[((u==null?void 0:u.resourceVideo)==="both"||(u==null?void 0:u.resourceVideo)==="upload")&&p.jsx(Wr,{value:"upload",children:e("editor.video.dialog.tab.upload")}),((u==null?void 0:u.resourceVideo)==="both"||(u==null?void 0:u.resourceVideo)==="link")&&p.jsx(Wr,{value:"link",children:e("editor.video.dialog.link")})]}),p.jsxs(Ur,{value:"upload",children:[p.jsx("div",{className:"flex items-center gap-[10px]",children:p.jsx(Ve,{className:"mt-1 w-full",onClick:h,size:"sm",children:e("editor.video.dialog.tab.upload")})}),p.jsx("input",{accept:"video/*",multiple:!0,onChange:d,ref:o,type:"file",style:{display:"none"}})]}),p.jsxs(Ur,{value:"link",children:[p.jsx("form",{onSubmit:f,children:p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(Rt,{autoFocus:!0,placeholder:e("editor.video.dialog.placeholder"),required:!0,type:"url",value:t,onChange:m=>{const g=m.target.value;if(!F2(g)){s("Invalid video URL"),r("");return}s(""),r(g)}}),p.jsx(Ve,{type:"submit",children:e("editor.video.dialog.button.apply")})]})}),i&&p.jsx("div",{className:"my-[5px] text-red-500",children:i})]})]})]})]})}function V2(n){return n=n.replace("https://youtu.be/","https://www.youtube.com/watch?v=").replace("watch?v=","embed/"),n=n.replace("https://vimeo.com/","https://player.vimeo.com/video/"),/^https?:\/\/www.bilibili.com\/video\/.*/i.test(n)&&(n=n.replace(/\?.*$/,"").replace("https://www.bilibili.com/video/","https://player.bilibili.com/player.html?bvid=")),n.includes("drive.google.com")&&(n=n.replace("/view","/preview")),n}const Sg=et.create({name:"video",group:"block",atom:!0,draggable:!0,addOptions(){return{divider:!1,spacer:!1,allowFullscreen:!0,upload:void 0,frameborder:!1,resourceVideo:"both",width:oe.VIDEO_SIZE["size-medium"],HTMLAttributes:{class:"iframe-wrapper",style:"display: flex;justify-content: center;"},button:({editor:n,t:e})=>{var t,r;return{component:q2,componentProps:{action:()=>{},isActive:()=>n.isActive("video")||!1,disabled:!((r=(t=n.can()).setVideo)!=null&&r.call(t,{})),icon:"Video",tooltip:e("editor.video.tooltip"),editor:n}}}}},addAttributes(){return{src:{default:null,renderHTML:({src:n})=>({src:n?V2(n):null})},width:{default:this.options.width,renderHTML:({width:n})=>({width:AS(n)})},frameborder:{default:this.options.frameborder?1:0,parseHTML:()=>this.options.frameborder?1:0},allowfullscreen:{default:this.options.allowFullscreen,parseHTML:()=>this.options.allowFullscreen}}},parseHTML(){return[{tag:"div[data-video] iframe"}]},renderHTML({HTMLAttributes:n}){const{width:e="100%"}=n??{},t={...n,width:"100%",height:"100%"},r=`position: relative;overflow: hidden;display: flex;flex: 1;max-width: ${e};`,o=`flex: 1;padding-bottom: ${9/16*100}%;`,l=["div",{style:r},["div",{style:o}],["iframe",t]];return["div",{...this.options.HTMLAttributes,"data-video":""},l]},addCommands(){return{setVideo:n=>({commands:e})=>e.insertContent({type:this.name,attrs:n}),updateVideo:n=>({commands:e})=>e.updateAttributes(this.name,n)}}}),H2=et.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:n}){return["tr",Ke(this.options.HTMLAttributes,n),0]}});var _a,Da;if(typeof WeakMap<"u"){let n=new WeakMap;_a=e=>n.get(e),Da=(e,t)=>(n.set(e,t),t)}else{const n=[];let t=0;_a=r=>{for(let o=0;o<n.length;o+=2)if(n[o]==r)return n[o+1]},Da=(r,o)=>(t==10&&(t=0),n[t++]=r,n[t++]=o)}var me=class{constructor(n,e,t,r){this.width=n,this.height=e,this.map=t,this.problems=r}findCell(n){for(let e=0;e<this.map.length;e++){const t=this.map[e];if(t!=n)continue;const r=e%this.width,o=e/this.width|0;let i=r+1,s=o+1;for(let l=1;i<this.width&&this.map[e+l]==t;l++)i++;for(let l=1;s<this.height&&this.map[e+this.width*l]==t;l++)s++;return{left:r,top:o,right:i,bottom:s}}throw new RangeError(`No cell with offset ${n} found`)}colCount(n){for(let e=0;e<this.map.length;e++)if(this.map[e]==n)return e%this.width;throw new RangeError(`No cell with offset ${n} found`)}nextCell(n,e,t){const{left:r,right:o,top:i,bottom:s}=this.findCell(n);return e=="horiz"?(t<0?r==0:o==this.width)?null:this.map[i*this.width+(t<0?r-1:o)]:(t<0?i==0:s==this.height)?null:this.map[r+this.width*(t<0?i-1:s)]}rectBetween(n,e){const{left:t,right:r,top:o,bottom:i}=this.findCell(n),{left:s,right:l,top:a,bottom:c}=this.findCell(e);return{left:Math.min(t,s),top:Math.min(o,a),right:Math.max(r,l),bottom:Math.max(i,c)}}cellsInRect(n){const e=[],t={};for(let r=n.top;r<n.bottom;r++)for(let o=n.left;o<n.right;o++){const i=r*this.width+o,s=this.map[i];t[s]||(t[s]=!0,!(o==n.left&&o&&this.map[i-1]==s||r==n.top&&r&&this.map[i-this.width]==s)&&e.push(s))}return e}positionAt(n,e,t){for(let r=0,o=0;;r++){const i=o+t.child(r).nodeSize;if(r==n){let s=e+n*this.width;const l=(n+1)*this.width;for(;s<l&&this.map[s]<o;)s++;return s==l?i-1:this.map[s]}o=i}}static get(n){return _a(n)||Da(n,W2(n))}};function W2(n){if(n.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+n.type.name);const e=U2(n),t=n.childCount,r=[];let o=0,i=null;const s=[];for(let c=0,u=e*t;c<u;c++)r[c]=0;for(let c=0,u=0;c<t;c++){const d=n.child(c);u++;for(let m=0;;m++){for(;o<r.length&&r[o]!=0;)o++;if(m==d.childCount)break;const g=d.child(m),{colspan:y,rowspan:b,colwidth:w}=g.attrs;for(let v=0;v<b;v++){if(v+c>=t){(i||(i=[])).push({type:"overlong_rowspan",pos:u,n:b-v});break}const S=o+v*e;for(let O=0;O<y;O++){r[S+O]==0?r[S+O]=u:(i||(i=[])).push({type:"collision",row:c,pos:u,n:y-O});const C=w&&w[O];if(C){const N=(S+O)%e*2,E=s[N];E==null||E!=C&&s[N+1]==1?(s[N]=C,s[N+1]=1):E==C&&s[N+1]++}}}o+=y,u+=g.nodeSize}const f=(c+1)*e;let h=0;for(;o<f;)r[o++]==0&&h++;h&&(i||(i=[])).push({type:"missing",row:c,n:h}),u++}(e===0||t===0)&&(i||(i=[])).push({type:"zero_sized"});const l=new me(e,t,r,i);let a=!1;for(let c=0;!a&&c<s.length;c+=2)s[c]!=null&&s[c+1]<t&&(a=!0);return a&&G2(l,s,n),l}function U2(n){let e=-1,t=!1;for(let r=0;r<n.childCount;r++){const o=n.child(r);let i=0;if(t)for(let s=0;s<r;s++){const l=n.child(s);for(let a=0;a<l.childCount;a++){const c=l.child(a);s+c.attrs.rowspan>r&&(i+=c.attrs.colspan)}}for(let s=0;s<o.childCount;s++){const l=o.child(s);i+=l.attrs.colspan,l.attrs.rowspan>1&&(t=!0)}e==-1?e=i:e!=i&&(e=Math.max(e,i))}return e}function G2(n,e,t){n.problems||(n.problems=[]);const r={};for(let o=0;o<n.map.length;o++){const i=n.map[o];if(r[i])continue;r[i]=!0;const s=t.nodeAt(i);if(!s)throw new RangeError(`No cell with offset ${i} found`);let l=null;const a=s.attrs;for(let c=0;c<a.colspan;c++){const u=(o+c)%n.width,d=e[u*2];d!=null&&(!a.colwidth||a.colwidth[c]!=d)&&((l||(l=K2(a)))[c]=d)}l&&n.problems.unshift({type:"colwidth mismatch",pos:i,colwidth:l})}}function K2(n){if(n.colwidth)return n.colwidth.slice();const e=[];for(let t=0;t<n.colspan;t++)e.push(0);return e}function Ue(n){let e=n.cached.tableNodeTypes;if(!e){e=n.cached.tableNodeTypes={};for(const t in n.nodes){const r=n.nodes[t],o=r.spec.tableRole;o&&(e[o]=r)}}return e}var Yt=new ct("selectingCells");function pr(n){for(let e=n.depth-1;e>0;e--)if(n.node(e).type.spec.tableRole=="row")return n.node(0).resolve(n.before(e+1));return null}function J2(n){for(let e=n.depth;e>0;e--){const t=n.node(e).type.spec.tableRole;if(t==="cell"||t==="header_cell")return n.node(e)}return null}function Ct(n){const e=n.selection.$head;for(let t=e.depth;t>0;t--)if(e.node(t).type.spec.tableRole=="row")return!0;return!1}function ki(n){const e=n.selection;if("$anchorCell"in e&&e.$anchorCell)return e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell;if("node"in e&&e.node&&e.node.type.spec.tableRole=="cell")return e.$anchor;const t=pr(e.$head)||X2(e.$head);if(t)return t;throw new RangeError(`No cell found around position ${e.head}`)}function X2(n){for(let e=n.nodeAfter,t=n.pos;e;e=e.firstChild,t++){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return n.doc.resolve(t)}for(let e=n.nodeBefore,t=n.pos;e;e=e.lastChild,t--){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return n.doc.resolve(t-e.nodeSize)}}function ja(n){return n.parent.type.spec.tableRole=="row"&&!!n.nodeAfter}function Y2(n){return n.node(0).resolve(n.pos+n.nodeAfter.nodeSize)}function Rc(n,e){return n.depth==e.depth&&n.pos>=e.start(-1)&&n.pos<=e.end(-1)}function Cg(n,e,t){const r=n.node(-1),o=me.get(r),i=n.start(-1),s=o.nextCell(n.pos-i,e,t);return s==null?null:n.node(0).resolve(i+s)}function In(n,e,t=1){const r={...n,colspan:n.colspan-t};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(e,t),r.colwidth.some(o=>o>0)||(r.colwidth=null)),r}function kg(n,e,t=1){const r={...n,colspan:n.colspan+t};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let o=0;o<t;o++)r.colwidth.splice(e,0,0)}return r}function Z2(n,e,t){const r=Ue(e.type.schema).header_cell;for(let o=0;o<n.height;o++)if(e.nodeAt(n.map[t+o*n.width]).type!=r)return!1;return!0}var ge=class jt extends ee{constructor(e,t=e){const r=e.node(-1),o=me.get(r),i=e.start(-1),s=o.rectBetween(e.pos-i,t.pos-i),l=e.node(0),a=o.cellsInRect(s).filter(u=>u!=t.pos-i);a.unshift(t.pos-i);const c=a.map(u=>{const d=r.nodeAt(u);if(!d)throw RangeError(`No cell with offset ${u} found`);const f=i+u+1;return new ec(l.resolve(f),l.resolve(f+d.content.size))});super(c[0].$from,c[0].$to,c),this.$anchorCell=e,this.$headCell=t}map(e,t){const r=e.resolve(t.map(this.$anchorCell.pos)),o=e.resolve(t.map(this.$headCell.pos));if(ja(r)&&ja(o)&&Rc(r,o)){const i=this.$anchorCell.node(-1)!=r.node(-1);return i&&this.isRowSelection()?jt.rowSelection(r,o):i&&this.isColSelection()?jt.colSelection(r,o):new jt(r,o)}return K.between(r,o)}content(){const e=this.$anchorCell.node(-1),t=me.get(e),r=this.$anchorCell.start(-1),o=t.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),i={},s=[];for(let a=o.top;a<o.bottom;a++){const c=[];for(let u=a*t.width+o.left,d=o.left;d<o.right;d++,u++){const f=t.map[u];if(i[f])continue;i[f]=!0;const h=t.findCell(f);let m=e.nodeAt(f);if(!m)throw RangeError(`No cell with offset ${f} found`);const g=o.left-h.left,y=h.right-o.right;if(g>0||y>0){let b=m.attrs;if(g>0&&(b=In(b,0,g)),y>0&&(b=In(b,b.colspan-y,y)),h.left<o.left){if(m=m.type.createAndFill(b),!m)throw RangeError(`Could not create cell with attrs ${JSON.stringify(b)}`)}else m=m.type.create(b,m.content)}if(h.top<o.top||h.bottom>o.bottom){const b={...m.attrs,rowspan:Math.min(h.bottom,o.bottom)-Math.max(h.top,o.top)};h.top<o.top?m=m.type.createAndFill(b):m=m.type.create(b,m.content)}c.push(m)}s.push(e.child(a).copy(R.from(c)))}const l=this.isColSelection()&&this.isRowSelection()?e:s;return new z(R.from(l),1,1)}replace(e,t=z.empty){const r=e.steps.length,o=this.ranges;for(let s=0;s<o.length;s++){const{$from:l,$to:a}=o[s],c=e.mapping.slice(r);e.replace(c.map(l.pos),c.map(a.pos),s?z.empty:t)}const i=ee.findFrom(e.doc.resolve(e.mapping.slice(r).map(this.to)),-1);i&&e.setSelection(i)}replaceWith(e,t){this.replace(e,new z(R.from(t),0,0))}forEachCell(e){const t=this.$anchorCell.node(-1),r=me.get(t),o=this.$anchorCell.start(-1),i=r.cellsInRect(r.rectBetween(this.$anchorCell.pos-o,this.$headCell.pos-o));for(let s=0;s<i.length;s++)e(t.nodeAt(i[s]),o+i[s])}isColSelection(){const e=this.$anchorCell.index(-1),t=this.$headCell.index(-1);if(Math.min(e,t)>0)return!1;const r=e+this.$anchorCell.nodeAfter.attrs.rowspan,o=t+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(r,o)==this.$headCell.node(-1).childCount}static colSelection(e,t=e){const r=e.node(-1),o=me.get(r),i=e.start(-1),s=o.findCell(e.pos-i),l=o.findCell(t.pos-i),a=e.node(0);return s.top<=l.top?(s.top>0&&(e=a.resolve(i+o.map[s.left])),l.bottom<o.height&&(t=a.resolve(i+o.map[o.width*(o.height-1)+l.right-1]))):(l.top>0&&(t=a.resolve(i+o.map[l.left])),s.bottom<o.height&&(e=a.resolve(i+o.map[o.width*(o.height-1)+s.right-1]))),new jt(e,t)}isRowSelection(){const e=this.$anchorCell.node(-1),t=me.get(e),r=this.$anchorCell.start(-1),o=t.colCount(this.$anchorCell.pos-r),i=t.colCount(this.$headCell.pos-r);if(Math.min(o,i)>0)return!1;const s=o+this.$anchorCell.nodeAfter.attrs.colspan,l=i+this.$headCell.nodeAfter.attrs.colspan;return Math.max(s,l)==t.width}eq(e){return e instanceof jt&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,t=e){const r=e.node(-1),o=me.get(r),i=e.start(-1),s=o.findCell(e.pos-i),l=o.findCell(t.pos-i),a=e.node(0);return s.left<=l.left?(s.left>0&&(e=a.resolve(i+o.map[s.top*o.width])),l.right<o.width&&(t=a.resolve(i+o.map[o.width*(l.top+1)-1]))):(l.left>0&&(t=a.resolve(i+o.map[l.top*o.width])),s.right<o.width&&(e=a.resolve(i+o.map[o.width*(s.top+1)-1]))),new jt(e,t)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,t){return new jt(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,r=t){return new jt(e.resolve(t),e.resolve(r))}getBookmark(){return new Q2(this.$anchorCell.pos,this.$headCell.pos)}};ge.prototype.visible=!1;ee.jsonID("cell",ge);var Q2=class Tg{constructor(e,t){this.anchor=e,this.head=t}map(e){return new Tg(e.map(this.anchor),e.map(this.head))}resolve(e){const t=e.resolve(this.anchor),r=e.resolve(this.head);return t.parent.type.spec.tableRole=="row"&&r.parent.type.spec.tableRole=="row"&&t.index()<t.parent.childCount&&r.index()<r.parent.childCount&&Rc(t,r)?new ge(t,r):ee.near(r,1)}};function eC(n){if(!(n.selection instanceof ge))return null;const e=[];return n.selection.forEachCell((t,r)=>{e.push(_e.node(r,r+t.nodeSize,{class:"selectedCell"}))}),ve.create(n.doc,e)}function tC({$from:n,$to:e}){if(n.pos==e.pos||n.pos<e.pos-6)return!1;let t=n.pos,r=e.pos,o=n.depth;for(;o>=0&&!(n.after(o+1)<n.end(o));o--,t++);for(let i=e.depth;i>=0&&!(e.before(i+1)>e.start(i));i--,r--);return t==r&&/row|table/.test(n.node(o).type.spec.tableRole)}function nC({$from:n,$to:e}){let t,r;for(let o=n.depth;o>0;o--){const i=n.node(o);if(i.type.spec.tableRole==="cell"||i.type.spec.tableRole==="header_cell"){t=i;break}}for(let o=e.depth;o>0;o--){const i=e.node(o);if(i.type.spec.tableRole==="cell"||i.type.spec.tableRole==="header_cell"){r=i;break}}return t!==r&&e.parentOffset===0}function rC(n,e,t){const r=(e||n).selection,o=(e||n).doc;let i,s;if(r instanceof U&&(s=r.node.type.spec.tableRole)){if(s=="cell"||s=="header_cell")i=ge.create(o,r.from);else if(s=="row"){const l=o.resolve(r.from+1);i=ge.rowSelection(l,l)}else if(!t){const l=me.get(r.node),a=r.from+1,c=a+l.map[l.width*l.height-1];i=ge.create(o,a+1,c)}}else r instanceof K&&tC(r)?i=K.create(o,r.from):r instanceof K&&nC(r)&&(i=K.create(o,r.$from.start(),r.$from.end()));return i&&(e||(e=n.tr)).setSelection(i),e}var oC=new ct("fix-tables");function Mg(n,e,t,r){const o=n.childCount,i=e.childCount;e:for(let s=0,l=0;s<i;s++){const a=e.child(s);for(let c=l,u=Math.min(o,s+3);c<u;c++)if(n.child(c)==a){l=c+1,t+=a.nodeSize;continue e}r(a,t),l<o&&n.child(l).sameMarkup(a)?Mg(n.child(l),a,t+1,r):a.nodesBetween(0,a.content.size,r,t+1),t+=a.nodeSize}}function Eg(n,e){let t;const r=(o,i)=>{o.type.spec.tableRole=="table"&&(t=iC(n,o,i,t))};return e?e.doc!=n.doc&&Mg(e.doc,n.doc,0,r):n.doc.descendants(r),t}function iC(n,e,t,r){const o=me.get(e);if(!o.problems)return r;r||(r=n.tr);const i=[];for(let a=0;a<o.height;a++)i.push(0);for(let a=0;a<o.problems.length;a++){const c=o.problems[a];if(c.type=="collision"){const u=e.nodeAt(c.pos);if(!u)continue;const d=u.attrs;for(let f=0;f<d.rowspan;f++)i[c.row+f]+=c.n;r.setNodeMarkup(r.mapping.map(t+1+c.pos),null,In(d,d.colspan-c.n,c.n))}else if(c.type=="missing")i[c.row]+=c.n;else if(c.type=="overlong_rowspan"){const u=e.nodeAt(c.pos);if(!u)continue;r.setNodeMarkup(r.mapping.map(t+1+c.pos),null,{...u.attrs,rowspan:u.attrs.rowspan-c.n})}else if(c.type=="colwidth mismatch"){const u=e.nodeAt(c.pos);if(!u)continue;r.setNodeMarkup(r.mapping.map(t+1+c.pos),null,{...u.attrs,colwidth:c.colwidth})}else if(c.type=="zero_sized"){const u=r.mapping.map(t);r.delete(u,u+e.nodeSize)}}let s,l;for(let a=0;a<i.length;a++)i[a]&&(s==null&&(s=a),l=a);for(let a=0,c=t+1;a<o.height;a++){const u=e.child(a),d=c+u.nodeSize,f=i[a];if(f>0){let h="cell";u.firstChild&&(h=u.firstChild.type.spec.tableRole);const m=[];for(let y=0;y<f;y++){const b=Ue(n.schema)[h].createAndFill();b&&m.push(b)}const g=(a==0||s==a-1)&&l==a?c+1:d-1;r.insert(r.mapping.map(g),m)}c=d}return r.setMeta(oC,{fixTables:!0})}function It(n){const e=n.selection,t=ki(n),r=t.node(-1),o=t.start(-1),i=me.get(r);return{...e instanceof ge?i.rectBetween(e.$anchorCell.pos-o,e.$headCell.pos-o):i.findCell(t.pos-o),tableStart:o,map:i,table:r}}function Og(n,{map:e,tableStart:t,table:r},o){let i=o>0?-1:0;Z2(e,r,o+i)&&(i=o==0||o==e.width?null:0);for(let s=0;s<e.height;s++){const l=s*e.width+o;if(o>0&&o<e.width&&e.map[l-1]==e.map[l]){const a=e.map[l],c=r.nodeAt(a);n.setNodeMarkup(n.mapping.map(t+a),null,kg(c.attrs,o-e.colCount(a))),s+=c.attrs.rowspan-1}else{const a=i==null?Ue(r.type.schema).cell:r.nodeAt(e.map[l+i]).type,c=e.positionAt(s,o,r);n.insert(n.mapping.map(t+c),a.createAndFill())}}return n}function sC(n,e){if(!Ct(n))return!1;if(e){const t=It(n);e(Og(n.tr,t,t.left))}return!0}function lC(n,e){if(!Ct(n))return!1;if(e){const t=It(n);e(Og(n.tr,t,t.right))}return!0}function aC(n,{map:e,table:t,tableStart:r},o){const i=n.mapping.maps.length;for(let s=0;s<e.height;){const l=s*e.width+o,a=e.map[l],c=t.nodeAt(a),u=c.attrs;if(o>0&&e.map[l-1]==a||o<e.width-1&&e.map[l+1]==a)n.setNodeMarkup(n.mapping.slice(i).map(r+a),null,In(u,o-e.colCount(a)));else{const d=n.mapping.slice(i).map(r+a);n.delete(d,d+c.nodeSize)}s+=u.rowspan}}function cC(n,e){if(!Ct(n))return!1;if(e){const t=It(n),r=n.tr;if(t.left==0&&t.right==t.map.width)return!1;for(let o=t.right-1;aC(r,t,o),o!=t.left;o--){const i=t.tableStart?r.doc.nodeAt(t.tableStart-1):r.doc;if(!i)throw RangeError("No table found");t.table=i,t.map=me.get(i)}e(r)}return!0}function uC(n,e,t){var r;const o=Ue(e.type.schema).header_cell;for(let i=0;i<n.width;i++)if(((r=e.nodeAt(n.map[i+t*n.width]))==null?void 0:r.type)!=o)return!1;return!0}function Ag(n,{map:e,tableStart:t,table:r},o){var i;let s=t;for(let c=0;c<o;c++)s+=r.child(c).nodeSize;const l=[];let a=o>0?-1:0;uC(e,r,o+a)&&(a=o==0||o==e.height?null:0);for(let c=0,u=e.width*o;c<e.width;c++,u++)if(o>0&&o<e.height&&e.map[u]==e.map[u-e.width]){const d=e.map[u],f=r.nodeAt(d).attrs;n.setNodeMarkup(t+d,null,{...f,rowspan:f.rowspan+1}),c+=f.colspan-1}else{const d=a==null?Ue(r.type.schema).cell:(i=r.nodeAt(e.map[u+a*e.width]))==null?void 0:i.type,f=d==null?void 0:d.createAndFill();f&&l.push(f)}return n.insert(s,Ue(r.type.schema).row.create(null,l)),n}function dC(n,e){if(!Ct(n))return!1;if(e){const t=It(n);e(Ag(n.tr,t,t.top))}return!0}function fC(n,e){if(!Ct(n))return!1;if(e){const t=It(n);e(Ag(n.tr,t,t.bottom))}return!0}function hC(n,{map:e,table:t,tableStart:r},o){let i=0;for(let c=0;c<o;c++)i+=t.child(c).nodeSize;const s=i+t.child(o).nodeSize,l=n.mapping.maps.length;n.delete(i+r,s+r);const a=new Set;for(let c=0,u=o*e.width;c<e.width;c++,u++){const d=e.map[u];if(!a.has(d)){if(a.add(d),o>0&&d==e.map[u-e.width]){const f=t.nodeAt(d).attrs;n.setNodeMarkup(n.mapping.slice(l).map(d+r),null,{...f,rowspan:f.rowspan-1}),c+=f.colspan-1}else if(o<e.height&&d==e.map[u+e.width]){const f=t.nodeAt(d),h=f.attrs,m=f.type.create({...h,rowspan:f.attrs.rowspan-1},f.content),g=e.positionAt(o+1,c,t);n.insert(n.mapping.slice(l).map(r+g),m),c+=h.colspan-1}}}}function pC(n,e){if(!Ct(n))return!1;if(e){const t=It(n),r=n.tr;if(t.top==0&&t.bottom==t.map.height)return!1;for(let o=t.bottom-1;hC(r,t,o),o!=t.top;o--){const i=t.tableStart?r.doc.nodeAt(t.tableStart-1):r.doc;if(!i)throw RangeError("No table found");t.table=i,t.map=me.get(t.table)}e(r)}return!0}function Ed(n){const e=n.content;return e.childCount==1&&e.child(0).isTextblock&&e.child(0).childCount==0}function mC({width:n,height:e,map:t},r){let o=r.top*n+r.left,i=o,s=(r.bottom-1)*n+r.left,l=o+(r.right-r.left-1);for(let a=r.top;a<r.bottom;a++){if(r.left>0&&t[i]==t[i-1]||r.right<n&&t[l]==t[l+1])return!0;i+=n,l+=n}for(let a=r.left;a<r.right;a++){if(r.top>0&&t[o]==t[o-n]||r.bottom<e&&t[s]==t[s+n])return!0;o++,s++}return!1}function Od(n,e){const t=n.selection;if(!(t instanceof ge)||t.$anchorCell.pos==t.$headCell.pos)return!1;const r=It(n),{map:o}=r;if(mC(o,r))return!1;if(e){const i=n.tr,s={};let l=R.empty,a,c;for(let u=r.top;u<r.bottom;u++)for(let d=r.left;d<r.right;d++){const f=o.map[u*o.width+d],h=r.table.nodeAt(f);if(!(s[f]||!h))if(s[f]=!0,a==null)a=f,c=h;else{Ed(h)||(l=l.append(h.content));const m=i.mapping.map(f+r.tableStart);i.delete(m,m+h.nodeSize)}}if(a==null||c==null)return!0;if(i.setNodeMarkup(a+r.tableStart,null,{...kg(c.attrs,c.attrs.colspan,r.right-r.left-c.attrs.colspan),rowspan:r.bottom-r.top}),l.size){const u=a+1+c.content.size,d=Ed(c)?a+1:u;i.replaceWith(d+r.tableStart,u+r.tableStart,l)}i.setSelection(new ge(i.doc.resolve(a+r.tableStart))),e(i)}return!0}function Ad(n,e){const t=Ue(n.schema);return gC(({node:r})=>t[r.type.spec.tableRole])(n,e)}function gC(n){return(e,t)=>{var r;const o=e.selection;let i,s;if(o instanceof ge){if(o.$anchorCell.pos!=o.$headCell.pos)return!1;i=o.$anchorCell.nodeAfter,s=o.$anchorCell.pos}else{if(i=J2(o.$from),!i)return!1;s=(r=pr(o.$from))==null?void 0:r.pos}if(i==null||s==null||i.attrs.colspan==1&&i.attrs.rowspan==1)return!1;if(t){let l=i.attrs;const a=[],c=l.colwidth;l.rowspan>1&&(l={...l,rowspan:1}),l.colspan>1&&(l={...l,colspan:1});const u=It(e),d=e.tr;for(let h=0;h<u.right-u.left;h++)a.push(c?{...l,colwidth:c&&c[h]?[c[h]]:null}:l);let f;for(let h=u.top;h<u.bottom;h++){let m=u.map.positionAt(h,u.left,u.table);h==u.top&&(m+=i.nodeSize);for(let g=u.left,y=0;g<u.right;g++,y++)g==u.left&&h==u.top||d.insert(f=d.mapping.map(m+u.tableStart,1),n({node:i,row:h,col:g}).createAndFill(a[y]))}d.setNodeMarkup(s,n({node:i,row:u.top,col:u.left}),a[0]),o instanceof ge&&d.setSelection(new ge(d.doc.resolve(o.$anchorCell.pos),f?d.doc.resolve(f):void 0)),t(d)}return!0}}function yC(n,e){return function(t,r){if(!Ct(t))return!1;const o=ki(t);if(o.nodeAfter.attrs[n]===e)return!1;if(r){const i=t.tr;t.selection instanceof ge?t.selection.forEachCell((s,l)=>{s.attrs[n]!==e&&i.setNodeMarkup(l,null,{...s.attrs,[n]:e})}):i.setNodeMarkup(o.pos,null,{...o.nodeAfter.attrs,[n]:e}),r(i)}return!0}}function bC(n){return function(e,t){if(!Ct(e))return!1;if(t){const r=Ue(e.schema),o=It(e),i=e.tr,s=o.map.cellsInRect(n=="column"?{left:o.left,top:0,right:o.right,bottom:o.map.height}:n=="row"?{left:0,top:o.top,right:o.map.width,bottom:o.bottom}:o),l=s.map(a=>o.table.nodeAt(a));for(let a=0;a<s.length;a++)l[a].type==r.header_cell&&i.setNodeMarkup(o.tableStart+s[a],r.cell,l[a].attrs);if(i.steps.length==0)for(let a=0;a<s.length;a++)i.setNodeMarkup(o.tableStart+s[a],r.header_cell,l[a].attrs);t(i)}return!0}}function Nd(n,e,t){const r=e.map.cellsInRect({left:0,top:0,right:n=="row"?e.map.width:1,bottom:n=="column"?e.map.height:1});for(let o=0;o<r.length;o++){const i=e.table.nodeAt(r[o]);if(i&&i.type!==t.header_cell)return!1}return!0}function Gr(n,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?bC(n):function(t,r){if(!Ct(t))return!1;if(r){const o=Ue(t.schema),i=It(t),s=t.tr,l=Nd("row",i,o),a=Nd("column",i,o),u=(n==="column"?l:n==="row"?a:!1)?1:0,d=n=="column"?{left:0,top:u,right:1,bottom:i.map.height}:n=="row"?{left:u,top:0,right:i.map.width,bottom:1}:i,f=n=="column"?a?o.cell:o.header_cell:n=="row"?l?o.cell:o.header_cell:o.cell;i.map.cellsInRect(d).forEach(h=>{const m=h+i.tableStart,g=s.doc.nodeAt(m);g&&s.setNodeMarkup(m,f,g.attrs)}),r(s)}return!0}}Gr("row",{useDeprecatedLogic:!0});Gr("column",{useDeprecatedLogic:!0});var vC=Gr("cell",{useDeprecatedLogic:!0});function xC(n,e){if(e<0){const t=n.nodeBefore;if(t)return n.pos-t.nodeSize;for(let r=n.index(-1)-1,o=n.before();r>=0;r--){const i=n.node(-1).child(r),s=i.lastChild;if(s)return o-1-s.nodeSize;o-=i.nodeSize}}else{if(n.index()<n.parent.childCount-1)return n.pos+n.nodeAfter.nodeSize;const t=n.node(-1);for(let r=n.indexAfter(-1),o=n.after();r<t.childCount;r++){const i=t.child(r);if(i.childCount)return o+1;o+=i.nodeSize}}return null}function Rd(n){return function(e,t){if(!Ct(e))return!1;const r=xC(ki(e),n);if(r==null)return!1;if(t){const o=e.doc.resolve(r);t(e.tr.setSelection(K.between(o,Y2(o))).scrollIntoView())}return!0}}function wC(n,e){const t=n.selection.$anchor;for(let r=t.depth;r>0;r--)if(t.node(r).type.spec.tableRole=="table")return e&&e(n.tr.delete(t.before(r),t.after(r)).scrollIntoView()),!0;return!1}function mo(n,e){const t=n.selection;if(!(t instanceof ge))return!1;if(e){const r=n.tr,o=Ue(n.schema).cell.createAndFill().content;t.forEachCell((i,s)=>{i.content.eq(o)||r.replace(r.mapping.map(s+1),r.mapping.map(s+i.nodeSize-1),new z(o,0,0))}),r.docChanged&&e(r)}return!0}function SC(n){if(!n.size)return null;let{content:e,openStart:t,openEnd:r}=n;for(;e.childCount==1&&(t>0&&r>0||e.child(0).type.spec.tableRole=="table");)t--,r--,e=e.child(0).content;const o=e.child(0),i=o.type.spec.tableRole,s=o.type.schema,l=[];if(i=="row")for(let a=0;a<e.childCount;a++){let c=e.child(a).content;const u=a?0:Math.max(0,t-1),d=a<e.childCount-1?0:Math.max(0,r-1);(u||d)&&(c=Pa(Ue(s).row,new z(c,u,d)).content),l.push(c)}else if(i=="cell"||i=="header_cell")l.push(t||r?Pa(Ue(s).row,new z(e,t,r)).content:e);else return null;return CC(s,l)}function CC(n,e){const t=[];for(let o=0;o<e.length;o++){const i=e[o];for(let s=i.childCount-1;s>=0;s--){const{rowspan:l,colspan:a}=i.child(s).attrs;for(let c=o;c<o+l;c++)t[c]=(t[c]||0)+a}}let r=0;for(let o=0;o<t.length;o++)r=Math.max(r,t[o]);for(let o=0;o<t.length;o++)if(o>=e.length&&e.push(R.empty),t[o]<r){const i=Ue(n).cell.createAndFill(),s=[];for(let l=t[o];l<r;l++)s.push(i);e[o]=e[o].append(R.from(s))}return{height:e.length,width:r,rows:e}}function Pa(n,e){const t=n.createAndFill();return new Qa(t).replace(0,t.content.size,e).doc}function kC({width:n,height:e,rows:t},r,o){if(n!=r){const i=[],s=[];for(let l=0;l<t.length;l++){const a=t[l],c=[];for(let u=i[l]||0,d=0;u<r;d++){let f=a.child(d%a.childCount);u+f.attrs.colspan>r&&(f=f.type.createChecked(In(f.attrs,f.attrs.colspan,u+f.attrs.colspan-r),f.content)),c.push(f),u+=f.attrs.colspan;for(let h=1;h<f.attrs.rowspan;h++)i[l+h]=(i[l+h]||0)+f.attrs.colspan}s.push(R.from(c))}t=s,n=r}if(e!=o){const i=[];for(let s=0,l=0;s<o;s++,l++){const a=[],c=t[l%e];for(let u=0;u<c.childCount;u++){let d=c.child(u);s+d.attrs.rowspan>o&&(d=d.type.create({...d.attrs,rowspan:Math.max(1,o-d.attrs.rowspan)},d.content)),a.push(d)}i.push(R.from(a))}t=i,e=o}return{width:n,height:e,rows:t}}function TC(n,e,t,r,o,i,s){const l=n.doc.type.schema,a=Ue(l);let c,u;if(o>e.width)for(let d=0,f=0;d<e.height;d++){const h=t.child(d);f+=h.nodeSize;const m=[];let g;h.lastChild==null||h.lastChild.type==a.cell?g=c||(c=a.cell.createAndFill()):g=u||(u=a.header_cell.createAndFill());for(let y=e.width;y<o;y++)m.push(g);n.insert(n.mapping.slice(s).map(f-1+r),m)}if(i>e.height){const d=[];for(let m=0,g=(e.height-1)*e.width;m<Math.max(e.width,o);m++){const y=m>=e.width?!1:t.nodeAt(e.map[g+m]).type==a.header_cell;d.push(y?u||(u=a.header_cell.createAndFill()):c||(c=a.cell.createAndFill()))}const f=a.row.create(null,R.from(d)),h=[];for(let m=e.height;m<i;m++)h.push(f);n.insert(n.mapping.slice(s).map(r+t.nodeSize-2),h)}return!!(c||u)}function Id(n,e,t,r,o,i,s,l){if(s==0||s==e.height)return!1;let a=!1;for(let c=o;c<i;c++){const u=s*e.width+c,d=e.map[u];if(e.map[u-e.width]==d){a=!0;const f=t.nodeAt(d),{top:h,left:m}=e.findCell(d);n.setNodeMarkup(n.mapping.slice(l).map(d+r),null,{...f.attrs,rowspan:s-h}),n.insert(n.mapping.slice(l).map(e.positionAt(s,m,t)),f.type.createAndFill({...f.attrs,rowspan:h+f.attrs.rowspan-s})),c+=f.attrs.colspan-1}}return a}function _d(n,e,t,r,o,i,s,l){if(s==0||s==e.width)return!1;let a=!1;for(let c=o;c<i;c++){const u=c*e.width+s,d=e.map[u];if(e.map[u-1]==d){a=!0;const f=t.nodeAt(d),h=e.colCount(d),m=n.mapping.slice(l).map(d+r);n.setNodeMarkup(m,null,In(f.attrs,s-h,f.attrs.colspan-(s-h))),n.insert(m+f.nodeSize,f.type.createAndFill(In(f.attrs,0,s-h))),c+=f.attrs.rowspan-1}}return a}function Dd(n,e,t,r,o){let i=t?n.doc.nodeAt(t-1):n.doc;if(!i)throw new Error("No table found");let s=me.get(i);const{top:l,left:a}=r,c=a+o.width,u=l+o.height,d=n.tr;let f=0;function h(){if(i=t?d.doc.nodeAt(t-1):d.doc,!i)throw new Error("No table found");s=me.get(i),f=d.mapping.maps.length}TC(d,s,i,t,c,u,f)&&h(),Id(d,s,i,t,a,c,l,f)&&h(),Id(d,s,i,t,a,c,u,f)&&h(),_d(d,s,i,t,l,u,a,f)&&h(),_d(d,s,i,t,l,u,c,f)&&h();for(let m=l;m<u;m++){const g=s.positionAt(m,a,i),y=s.positionAt(m,c,i);d.replace(d.mapping.slice(f).map(g+t),d.mapping.slice(f).map(y+t),new z(o.rows[m-l],0,0))}h(),d.setSelection(new ge(d.doc.resolve(t+s.positionAt(l,a,i)),d.doc.resolve(t+s.positionAt(u-1,c-1,i)))),e(d)}var MC=dc({ArrowLeft:go("horiz",-1),ArrowRight:go("horiz",1),ArrowUp:go("vert",-1),ArrowDown:go("vert",1),"Shift-ArrowLeft":yo("horiz",-1),"Shift-ArrowRight":yo("horiz",1),"Shift-ArrowUp":yo("vert",-1),"Shift-ArrowDown":yo("vert",1),Backspace:mo,"Mod-Backspace":mo,Delete:mo,"Mod-Delete":mo});function Po(n,e,t){return t.eq(n.selection)?!1:(e&&e(n.tr.setSelection(t).scrollIntoView()),!0)}function go(n,e){return(t,r,o)=>{if(!o)return!1;const i=t.selection;if(i instanceof ge)return Po(t,r,ee.near(i.$headCell,e));if(n!="horiz"&&!i.empty)return!1;const s=Ng(o,n,e);if(s==null)return!1;if(n=="horiz")return Po(t,r,ee.near(t.doc.resolve(i.head+e),e));{const l=t.doc.resolve(s),a=Cg(l,n,e);let c;return a?c=ee.near(a,1):e<0?c=ee.near(t.doc.resolve(l.before(-1)),-1):c=ee.near(t.doc.resolve(l.after(-1)),1),Po(t,r,c)}}}function yo(n,e){return(t,r,o)=>{if(!o)return!1;const i=t.selection;let s;if(i instanceof ge)s=i;else{const a=Ng(o,n,e);if(a==null)return!1;s=new ge(t.doc.resolve(a))}const l=Cg(s.$headCell,n,e);return l?Po(t,r,new ge(s.$anchorCell,l)):!1}}function EC(n,e){const t=n.state.doc,r=pr(t.resolve(e));return r?(n.dispatch(n.state.tr.setSelection(new ge(r))),!0):!1}function OC(n,e,t){if(!Ct(n.state))return!1;let r=SC(t);const o=n.state.selection;if(o instanceof ge){r||(r={width:1,height:1,rows:[R.from(Pa(Ue(n.state.schema).cell,t))]});const i=o.$anchorCell.node(-1),s=o.$anchorCell.start(-1),l=me.get(i).rectBetween(o.$anchorCell.pos-s,o.$headCell.pos-s);return r=kC(r,l.right-l.left,l.bottom-l.top),Dd(n.state,n.dispatch,s,l,r),!0}else if(r){const i=ki(n.state),s=i.start(-1);return Dd(n.state,n.dispatch,s,me.get(i.node(-1)).findCell(i.pos-s),r),!0}else return!1}function AC(n,e){var t;if(e.ctrlKey||e.metaKey)return;const r=jd(n,e.target);let o;if(e.shiftKey&&n.state.selection instanceof ge)i(n.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(o=pr(n.state.selection.$anchor))!=null&&((t=ps(n,e))==null?void 0:t.pos)!=o.pos)i(o,e),e.preventDefault();else if(!r)return;function i(a,c){let u=ps(n,c);const d=Yt.getState(n.state)==null;if(!u||!Rc(a,u))if(d)u=a;else return;const f=new ge(a,u);if(d||!n.state.selection.eq(f)){const h=n.state.tr.setSelection(f);d&&h.setMeta(Yt,a.pos),n.dispatch(h)}}function s(){n.root.removeEventListener("mouseup",s),n.root.removeEventListener("dragstart",s),n.root.removeEventListener("mousemove",l),Yt.getState(n.state)!=null&&n.dispatch(n.state.tr.setMeta(Yt,-1))}function l(a){const c=a,u=Yt.getState(n.state);let d;if(u!=null)d=n.state.doc.resolve(u);else if(jd(n,c.target)!=r&&(d=ps(n,e),!d))return s();d&&i(d,c)}n.root.addEventListener("mouseup",s),n.root.addEventListener("dragstart",s),n.root.addEventListener("mousemove",l)}function Ng(n,e,t){if(!(n.state.selection instanceof K))return null;const{$head:r}=n.state.selection;for(let o=r.depth-1;o>=0;o--){const i=r.node(o);if((t<0?r.index(o):r.indexAfter(o))!=(t<0?0:i.childCount))return null;if(i.type.spec.tableRole=="cell"||i.type.spec.tableRole=="header_cell"){const l=r.before(o),a=e=="vert"?t>0?"down":"up":t>0?"right":"left";return n.endOfTextblock(a)?l:null}}return null}function jd(n,e){for(;e&&e!=n.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function ps(n,e){const t=n.posAtCoords({left:e.clientX,top:e.clientY});return t&&t?pr(n.state.doc.resolve(t.pos)):null}var NC=class{constructor(e,t){this.node=e,this.defaultCellMinWidth=t,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${t}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),La(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!=this.node.type?!1:(this.node=e,La(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function La(n,e,t,r,o,i){var s;let l=0,a=!0,c=e.firstChild;const u=n.firstChild;if(u){for(let d=0,f=0;d<u.childCount;d++){const{colspan:h,colwidth:m}=u.child(d).attrs;for(let g=0;g<h;g++,f++){const y=o==f?i:m&&m[g],b=y?y+"px":"";if(l+=y||r,y||(a=!1),c)c.style.width!=b&&(c.style.width=b),c=c.nextSibling;else{const w=document.createElement("col");w.style.width=b,e.appendChild(w)}}}for(;c;){const d=c.nextSibling;(s=c.parentNode)==null||s.removeChild(c),c=d}a?(t.style.width=l+"px",t.style.minWidth=""):(t.style.width="",t.style.minWidth=l+"px")}}var at=new ct("tableColumnResizing");function RC({handleWidth:n=5,cellMinWidth:e=25,defaultCellMinWidth:t=100,View:r=NC,lastColumnResizable:o=!0}={}){const i=new Pe({key:at,state:{init(s,l){var a,c;const u=(c=(a=i.spec)==null?void 0:a.props)==null?void 0:c.nodeViews,d=Ue(l.schema).table.name;return r&&u&&(u[d]=(f,h)=>new r(f,t,h)),new IC(-1,!1)},apply(s,l){return l.apply(s)}},props:{attributes:s=>{const l=at.getState(s);return l&&l.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(s,l)=>{_C(s,l,n,o)},mouseleave:s=>{DC(s)},mousedown:(s,l)=>{jC(s,l,e,t)}},decorations:s=>{const l=at.getState(s);if(l&&l.activeHandle>-1)return $C(s,l.activeHandle)},nodeViews:{}}});return i}var IC=class Lo{constructor(e,t){this.activeHandle=e,this.dragging=t}apply(e){const t=this,r=e.getMeta(at);if(r&&r.setHandle!=null)return new Lo(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new Lo(t.activeHandle,r.setDragging);if(t.activeHandle>-1&&e.docChanged){let o=e.mapping.map(t.activeHandle,-1);return ja(e.doc.resolve(o))||(o=-1),new Lo(o,t.dragging)}return t}};function _C(n,e,t,r){if(!n.editable)return;const o=at.getState(n.state);if(o&&!o.dragging){const i=LC(e.target);let s=-1;if(i){const{left:l,right:a}=i.getBoundingClientRect();e.clientX-l<=t?s=Pd(n,e,"left",t):a-e.clientX<=t&&(s=Pd(n,e,"right",t))}if(s!=o.activeHandle){if(!r&&s!==-1){const l=n.state.doc.resolve(s),a=l.node(-1),c=me.get(a),u=l.start(-1);if(c.colCount(l.pos-u)+l.nodeAfter.attrs.colspan-1==c.width-1)return}Rg(n,s)}}}function DC(n){if(!n.editable)return;const e=at.getState(n.state);e&&e.activeHandle>-1&&!e.dragging&&Rg(n,-1)}function jC(n,e,t,r){var o;if(!n.editable)return!1;const i=(o=n.dom.ownerDocument.defaultView)!=null?o:window,s=at.getState(n.state);if(!s||s.activeHandle==-1||s.dragging)return!1;const l=n.state.doc.nodeAt(s.activeHandle),a=PC(n,s.activeHandle,l.attrs);n.dispatch(n.state.tr.setMeta(at,{setDragging:{startX:e.clientX,startWidth:a}}));function c(d){i.removeEventListener("mouseup",c),i.removeEventListener("mousemove",u);const f=at.getState(n.state);f!=null&&f.dragging&&(BC(n,f.activeHandle,Ld(f.dragging,d,t)),n.dispatch(n.state.tr.setMeta(at,{setDragging:null})))}function u(d){if(!d.which)return c(d);const f=at.getState(n.state);if(f&&f.dragging){const h=Ld(f.dragging,d,t);Bd(n,f.activeHandle,h,r)}}return Bd(n,s.activeHandle,a,r),i.addEventListener("mouseup",c),i.addEventListener("mousemove",u),e.preventDefault(),!0}function PC(n,e,{colspan:t,colwidth:r}){const o=r&&r[r.length-1];if(o)return o;const i=n.domAtPos(e);let l=i.node.childNodes[i.offset].offsetWidth,a=t;if(r)for(let c=0;c<t;c++)r[c]&&(l-=r[c],a--);return l/a}function LC(n){for(;n&&n.nodeName!="TD"&&n.nodeName!="TH";)n=n.classList&&n.classList.contains("ProseMirror")?null:n.parentNode;return n}function Pd(n,e,t,r){const o=t=="right"?-r:r,i=n.posAtCoords({left:e.clientX+o,top:e.clientY});if(!i)return-1;const{pos:s}=i,l=pr(n.state.doc.resolve(s));if(!l)return-1;if(t=="right")return l.pos;const a=me.get(l.node(-1)),c=l.start(-1),u=a.map.indexOf(l.pos-c);return u%a.width==0?-1:c+a.map[u-1]}function Ld(n,e,t){const r=e.clientX-n.startX;return Math.max(t,n.startWidth+r)}function Rg(n,e){n.dispatch(n.state.tr.setMeta(at,{setHandle:e}))}function BC(n,e,t){const r=n.state.doc.resolve(e),o=r.node(-1),i=me.get(o),s=r.start(-1),l=i.colCount(r.pos-s)+r.nodeAfter.attrs.colspan-1,a=n.state.tr;for(let c=0;c<i.height;c++){const u=c*i.width+l;if(c&&i.map[u]==i.map[u-i.width])continue;const d=i.map[u],f=o.nodeAt(d).attrs,h=f.colspan==1?0:l-i.colCount(d);if(f.colwidth&&f.colwidth[h]==t)continue;const m=f.colwidth?f.colwidth.slice():zC(f.colspan);m[h]=t,a.setNodeMarkup(s+d,null,{...f,colwidth:m})}a.docChanged&&n.dispatch(a)}function Bd(n,e,t,r){const o=n.state.doc.resolve(e),i=o.node(-1),s=o.start(-1),l=me.get(i).colCount(o.pos-s)+o.nodeAfter.attrs.colspan-1;let a=n.domAtPos(o.start(-1)).node;for(;a&&a.nodeName!="TABLE";)a=a.parentNode;a&&La(i,a.firstChild,a,r,l,t)}function zC(n){return Array(n).fill(0)}function $C(n,e){var t;const r=[],o=n.doc.resolve(e),i=o.node(-1);if(!i)return ve.empty;const s=me.get(i),l=o.start(-1),a=s.colCount(o.pos-l)+o.nodeAfter.attrs.colspan-1;for(let c=0;c<s.height;c++){const u=a+c*s.width;if((a==s.width-1||s.map[u]!=s.map[u+1])&&(c==0||s.map[u]!=s.map[u-s.width])){const d=s.map[u],f=l+d+i.nodeAt(d).nodeSize-1,h=document.createElement("div");h.className="column-resize-handle",(t=at.getState(n))!=null&&t.dragging&&r.push(_e.node(l+d,l+d+i.nodeAt(d).nodeSize,{class:"column-resize-dragging"})),r.push(_e.widget(f,h))}}return ve.create(n.doc,r)}function FC({allowTableNodeSelection:n=!1}={}){return new Pe({key:Yt,state:{init(){return null},apply(e,t){const r=e.getMeta(Yt);if(r!=null)return r==-1?null:r;if(t==null||!e.docChanged)return t;const{deleted:o,pos:i}=e.mapping.mapResult(t);return o?null:i}},props:{decorations:eC,handleDOMEvents:{mousedown:AC},createSelectionBetween(e){return Yt.getState(e.state)!=null?e.state.selection:null},handleTripleClick:EC,handleKeyDown:MC,handlePaste:OC},appendTransaction(e,t,r){return rC(r,Eg(r,t),n)}})}function Ba(n,e){return e?["width",`${Math.max(e,n)}px`]:["min-width",`${n}px`]}function zd(n,e,t,r,o,i){var s;let l=0,a=!0,c=e.firstChild;const u=n.firstChild;if(u!==null)for(let d=0,f=0;d<u.childCount;d+=1){const{colspan:h,colwidth:m}=u.child(d).attrs;for(let g=0;g<h;g+=1,f+=1){const y=o===f?i:m&&m[g],b=y?`${y}px`:"";if(l+=y||r,y||(a=!1),c){if(c.style.width!==b){const[w,v]=Ba(r,y);c.style.setProperty(w,v)}c=c.nextSibling}else{const w=document.createElement("col"),[v,S]=Ba(r,y);w.style.setProperty(v,S),e.appendChild(w)}}}for(;c;){const d=c.nextSibling;(s=c.parentNode)===null||s===void 0||s.removeChild(c),c=d}a?(t.style.width=`${l}px`,t.style.minWidth=""):(t.style.width="",t.style.minWidth=`${l}px`)}class qC{constructor(e,t){this.node=e,this.cellMinWidth=t,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.colgroup=this.table.appendChild(document.createElement("colgroup")),zd(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!==this.node.type?!1:(this.node=e,zd(e,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(e){return e.type==="attributes"&&(e.target===this.table||this.colgroup.contains(e.target))}}function VC(n,e,t,r){let o=0,i=!0;const s=[],l=n.firstChild;if(!l)return{};for(let d=0,f=0;d<l.childCount;d+=1){const{colspan:h,colwidth:m}=l.child(d).attrs;for(let g=0;g<h;g+=1,f+=1){const y=t===f?r:m&&m[g];o+=y||e,y||(i=!1);const[b,w]=Ba(e,y);s.push(["col",{style:`${b}: ${w}`}])}}const a=i?`${o}px`:"",c=i?"":`${o}px`;return{colgroup:["colgroup",{},...s],tableWidth:a,tableMinWidth:c}}function $d(n,e){return n.createAndFill()}function HC(n){if(n.cached.tableNodeTypes)return n.cached.tableNodeTypes;const e={};return Object.keys(n.nodes).forEach(t=>{const r=n.nodes[t];r.spec.tableRole&&(e[r.spec.tableRole]=r)}),n.cached.tableNodeTypes=e,e}function WC(n,e,t,r,o){const i=HC(n),s=[],l=[];for(let c=0;c<t;c+=1){const u=$d(i.cell);if(u&&l.push(u),r){const d=$d(i.header_cell);d&&s.push(d)}}const a=[];for(let c=0;c<e;c+=1)a.push(i.row.createChecked(null,r&&c===0?s:l));return i.table.createChecked(null,a)}function UC(n){return n instanceof ge}const bo=({editor:n})=>{const{selection:e}=n.state;if(!UC(e))return!1;let t=0;const r=Im(e.ranges[0].$from,i=>i.type.name==="table");return r==null||r.node.descendants(i=>{if(i.type.name==="table")return!1;["tableCell","tableHeader"].includes(i.type.name)&&(t+=1)}),t===e.ranges.length?(n.commands.deleteTable(),!0):!1},GC=et.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,handleWidth:5,cellMinWidth:25,View:qC,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML(){return[{tag:"table"}]},renderHTML({node:n,HTMLAttributes:e}){const{colgroup:t,tableWidth:r,tableMinWidth:o}=VC(n,this.options.cellMinWidth);return["table",Ke(this.options.HTMLAttributes,e,{style:r?`width: ${r}`:`min-width: ${o}`}),t,["tbody",0]]},addCommands(){return{insertTable:({rows:n=3,cols:e=3,withHeaderRow:t=!0}={})=>({tr:r,dispatch:o,editor:i})=>{const s=WC(i.schema,n,e,t);if(o){const l=r.selection.from+1;r.replaceSelectionWith(s).scrollIntoView().setSelection(K.near(r.doc.resolve(l)))}return!0},addColumnBefore:()=>({state:n,dispatch:e})=>sC(n,e),addColumnAfter:()=>({state:n,dispatch:e})=>lC(n,e),deleteColumn:()=>({state:n,dispatch:e})=>cC(n,e),addRowBefore:()=>({state:n,dispatch:e})=>dC(n,e),addRowAfter:()=>({state:n,dispatch:e})=>fC(n,e),deleteRow:()=>({state:n,dispatch:e})=>pC(n,e),deleteTable:()=>({state:n,dispatch:e})=>wC(n,e),mergeCells:()=>({state:n,dispatch:e})=>Od(n,e),splitCell:()=>({state:n,dispatch:e})=>Ad(n,e),toggleHeaderColumn:()=>({state:n,dispatch:e})=>Gr("column")(n,e),toggleHeaderRow:()=>({state:n,dispatch:e})=>Gr("row")(n,e),toggleHeaderCell:()=>({state:n,dispatch:e})=>vC(n,e),mergeOrSplit:()=>({state:n,dispatch:e})=>Od(n,e)?!0:Ad(n,e),setCellAttribute:(n,e)=>({state:t,dispatch:r})=>yC(n,e)(t,r),goToNextCell:()=>({state:n,dispatch:e})=>Rd(1)(n,e),goToPreviousCell:()=>({state:n,dispatch:e})=>Rd(-1)(n,e),fixTables:()=>({state:n,dispatch:e})=>(e&&Eg(n),!0),setCellSelection:n=>({tr:e,dispatch:t})=>{if(t){const r=ge.create(e.doc,n.anchorCell,n.headCell);e.setSelection(r)}return!0}}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.goToNextCell()?!0:this.editor.can().addRowAfter()?this.editor.chain().addRowAfter().goToNextCell().run():!1,"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:bo,"Mod-Backspace":bo,Delete:bo,"Mod-Delete":bo}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[RC({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],FC({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(n){const e={name:n.name,options:n.options,storage:n.storage};return{tableRole:se(F(n,"tableRole",e))}}}),KC=/(android|bb\d+|meego).+mobile|armv7l|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series[46]0|samsungbrowser.*mobile|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i,JC=/CrOS/,XC=/android|ipad|playbook|silk/i;function Fd(n={}){let e=n.ua||typeof navigator<"u"&&navigator.userAgent;return e&&typeof e=="object"&&e.headers&&typeof e.headers["user-agent"]=="string"&&(e=e.headers["user-agent"]),typeof e!="string"?!1:!!(KC.test(e)&&!JC.test(e)||n.tablet&&XC.test(e)||n.tablet&&n.featureDetect&&navigator&&navigator.maxTouchPoints>1&&e.includes("Macintosh")&&e.includes("Safari"))}const qd=n=>Array.from({length:n}).map((e,t)=>t+1);function YC(n){var u;const[e,t]=x.useState(!0),[r,o]=x.useState({rows:Fd()?oe.TABLE_MAX_GRID_SIZE:oe.TABLE_INIT_GRID_SIZE,cols:Fd()?oe.TABLE_MAX_GRID_SIZE:oe.TABLE_INIT_GRID_SIZE}),[i,s]=x.useState({rows:oe.TABLE_DEFAULT_SELECTED_GRID_SIZE,cols:oe.TABLE_DEFAULT_SELECTED_GRID_SIZE});function l(d,f){d===r.rows&&o(h=>({...h,rows:Math.min(d+1,oe.TABLE_MAX_GRID_SIZE)})),f===r.cols&&o(h=>({...h,cols:Math.min(f+1,oe.TABLE_MAX_GRID_SIZE)})),s({rows:d,cols:f})}function a(d,f){n==null||n.createTable({rows:d,cols:f,withHeaderRow:e}),c()}function c(){t(!1),o({rows:oe.TABLE_INIT_GRID_SIZE,cols:oe.TABLE_INIT_GRID_SIZE}),s({rows:oe.TABLE_DEFAULT_SELECTED_GRID_SIZE,cols:oe.TABLE_DEFAULT_SELECTED_GRID_SIZE})}return p.jsxs(Pn,{modal:!0,children:[p.jsx(Ln,{asChild:!0,children:n==null?void 0:n.children}),p.jsx(mn,{align:"start",className:"w-full !p-2",side:"bottom",children:p.jsxs("div",{className:"table-grid-size-editor p-0",children:[p.jsx("div",{className:"flex flex-col flex-wrap justify-between gap-1",children:(u=qd(r==null?void 0:r.rows))==null?void 0:u.map(d=>{var f;return p.jsx("div",{className:"flex gap-1",children:(f=qd(r==null?void 0:r.cols))==null?void 0:f.map(h=>p.jsx("div",{onMouseDown:()=>a(d,h),onMouseOver:()=>l(d,h),className:`cursor-pointer border-border ${h<=i.cols&&d<=i.rows&&"tableCellActive !bg-foreground"}`,children:p.jsx("div",{className:"box-border size-4 rounded-[2px] !border border-solid !border-border p-1"})},`c-${h}`))},`r-${d}`)})}),p.jsxs("div",{className:"mt-2 text-center text-sm text-zinc-600",children:[i.rows,"x",i.cols]})]})})]})}function ZC(n){function e(t){n.disabled||n.editor.chain().focus().insertTable({...t,withHeaderRow:!1}).run()}return p.jsx(YC,{createTable:e,children:p.jsx(St,{icon:n==null?void 0:n.icon,tooltip:n==null?void 0:n.tooltip,disabled:n==null?void 0:n.disabled,color:n==null?void 0:n.color,action:n==null?void 0:n.action,isActive:n==null?void 0:n.isActive})})}function Ic(n){return e=>{const t=me.get(e.$anchorCell.node(-1)),r=e.$anchorCell.start(-1),o=t.cellsInRect(n),i=t.cellsInRect(t.rectBetween(e.$anchorCell.pos-r,e.$headCell.pos-r));for(let s=0,l=o.length;s<l;s+=1)if(!i.includes(o[s]))return!1;return!0}}function _c(n){return cn(e=>e.type.spec.tableRole&&e.type.spec.tableRole==="table")(n)}function Dc(n){return n instanceof ge}function QC(n){return e=>{if(Dc(e)){const t=me.get(e.$anchorCell.node(-1));return Ic({left:n,right:n+1,top:0,bottom:t.height})(e)}return!1}}function ek(n){return e=>{if(Dc(e)){const t=me.get(e.$anchorCell.node(-1));return Ic({left:0,right:t.width,top:n,bottom:n+1})(e)}return!1}}function Ig(n){if(Dc(n)){const e=me.get(n.$anchorCell.node(-1));return Ic({left:0,right:e.width,top:0,bottom:e.height})(n)}return!1}function tk(n){return e=>{const t=_c(e);if(t){const r=me.get(t.node);return(Array.isArray(n)?n:Array.from([n])).reduce((i,s)=>{if(s>=0&&s<=r.width-1){const l=r.cellsInRect({left:s,right:s+1,top:0,bottom:r.height});return i.concat(l.map(a=>{const c=t.node.nodeAt(a),u=a+t.start;return{pos:u,start:u+1,node:c}}))}return i},[])}return null}}function nk(n){return e=>{const t=_c(e);if(t){const r=me.get(t.node);return(Array.isArray(n)?n:Array.from([n])).reduce((i,s)=>{if(s>=0&&s<=r.height-1){const l=r.cellsInRect({left:0,right:r.width,top:s,bottom:s+1});return i.concat(l.map(a=>{const c=t.node.nodeAt(a),u=a+t.start;return{pos:u,start:u+1,node:c}}))}return i},[])}return null}}function _g(n){return e=>t=>{const r=_c(t.selection),o=n==="row";if(r){const i=me.get(r.node);if(e>=0&&e<(o?i.height:i.width)){const s=o?0:e,l=o?e:0,a=o?i.width:e+1,c=o?e+1:i.height,u=i.cellsInRect({left:s,top:l,right:o?a:s+1,bottom:o?l+1:c}),d=c-l===1?u:i.cellsInRect({left:o?s:a-1,top:o?c-1:l,right:a,bottom:c}),f=r.start+u[0],h=r.start+d[d.length-1],m=t.doc.resolve(f),g=t.doc.resolve(h);return t.setSelection(new ge(g,m))}}return t}}const rk=_g("column"),ok=_g("row");function ik({editor:n,view:e,state:t,from:r}){const o=e.domAtPos(r).node,s=e.nodeDOM(r)||o;if(!n.isActive(jc.name)||!s||Ig(t.selection))return!1;let l=s;for(;l&&!["TD","TH"].includes(l.tagName);)l=l.parentElement;return!!(l&&l.querySelector&&l.querySelector("a.grip-column.selected"))}function sk({editor:n,view:e,state:t,from:r}){const o=e.domAtPos(r).node,s=e.nodeDOM(r)||o;if(!n.isActive(jc.name)||!s||Ig(t.selection))return!1;let l=s;for(;l&&!["TD","TH"].includes(l.tagName);)l=l.parentElement;return!!(l&&l.querySelector&&l.querySelector("a.grip-row.selected"))}const lk=et.create({name:"tableCell",content:"block*",tableRole:"cell",isolating:!0,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:n}){return["td",Ke(this.options.HTMLAttributes,n),0]},addAttributes(){return{colspan:{default:1,parseHTML:n=>{const e=n.getAttribute("colspan");return e?Number.parseInt(e,10):1}},rowspan:{default:1,parseHTML:n=>{const e=n.getAttribute("rowspan");return e?Number.parseInt(e,10):1}},colwidth:{default:null,parseHTML:n=>{const e=n.getAttribute("colwidth");return e?[Number.parseInt(e,10)]:null}},style:{default:null}}},addProseMirrorPlugins(){const{isEditable:n}=this.editor;return[new Pe({props:{decorations:e=>{if(!n)return ve.empty;const{doc:t,selection:r}=e,o=[],i=tk(0)(r);return i&&i.forEach(({pos:s},l)=>{o.push(_e.widget(s+1,()=>{const a=ek(l)(r);let c="grip-row";a&&(c+=" selected"),l===0&&(c+=" first"),l===i.length-1&&(c+=" last");const u=document.createElement("a");return u.className=c,u.addEventListener("mousedown",d=>{d.preventDefault(),d.stopImmediatePropagation(),this.editor.view.dispatch(ok(l)(this.editor.state.tr))}),u}))}),ve.create(t,o)}}})]}});function ak(n,e,t){if(!n.doc)return n;const r=n.doc.nodeAt(e);if(!r||t===r.attrs.backgroundColor)return n;const o={...r.attrs,backgroundColor:t};return n.setNodeMarkup(e,r.type,o,r.marks)}function ck(n,e,t){const{doc:r,selection:o}=n;return!r||!o||!(o instanceof ge)||o.forEachCell((i,s)=>{n=ak(n,s,t)}),n}function Vd(n,e){return({tr:t,state:r,dispatch:o})=>{const{selection:i}=r;return t=t.setSelection(i),t=ck(t,e,n),t.docChanged?(o==null||o(t),!0):!1}}const uk=ot.create({name:"tableCellBackground",addOptions(){return{types:["tableCell"],HTMLAttributes:{}}},addGlobalAttributes(){return[{types:this.options.types,attributes:{backgroundColor:{parseHTML:n=>n.style.backgroundColor||"",renderHTML:n=>!n.backgroundColor||n.backgroundColor===""?{}:{style:`background-color: ${n.backgroundColor}`}}}}]},addCommands(){return{setTableCellBackground:n=>Vd(n,this.options),unsetTableCellBackground:()=>Vd("",this.options)}}}),dk=et.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:n=>{const e=n.getAttribute("colwidth");return e?e.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th"}]},renderHTML({HTMLAttributes:n}){return["th",Ke(this.options.HTMLAttributes,n),0]}}),fk=dk.extend({addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:n=>{const e=n.getAttribute("colwidth");return e?e.split(",").map(r=>Number.parseInt(r,10)):null}},style:{default:null}}},addProseMirrorPlugins(){const{isEditable:n}=this.editor;return[new Pe({props:{decorations:e=>{if(!n)return ve.empty;const{doc:t,selection:r}=e,o=[],i=nk(0)(r);return i&&i.forEach(({pos:s},l)=>{o.push(_e.widget(s+1,()=>{const a=QC(l)(r);let c="grip-column";a&&(c+=" selected"),l===0&&(c+=" first"),l===i.length-1&&(c+=" last");const u=document.createElement("a");return u.className=c,u.addEventListener("mousedown",d=>{d.preventDefault(),d.stopImmediatePropagation(),this.editor.view.dispatch(rk(l)(this.editor.state.tr))}),u}))}),ve.create(t,o)}}})]}}),hk=H2.extend({allowGapCursor:!1,content:"tableCell*"}),jc=GC.extend({addOptions(){var n;return{...(n=this.parent)==null?void 0:n.call(this),resizable:!0,lastColumnResizable:!1,allowTableNodeSelection:!1,button:({editor:e,t})=>({component:ZC,componentProps:{disabled:e.isActive("table")||!1,icon:"Table",tooltip:t("editor.table.tooltip"),editor:e}})}},addExtensions(){return[hk.configure(this.options.tableRow),fk.configure(this.options.tableHeader),lk.configure(this.options.tableCell),uk.configure(this.options.tableCellBackground)]}}),pk="_wrap_5y04w_1",mk="_innerWrap_5y04w_15",Hd={wrap:pk,innerWrap:mk};function gk({editor:n,node:e,updateAttributes:t}){const r=eg(),{url:o,width:i,height:s}=e.attrs,[l,a]=x.useState("");function c(){l&&n.chain().updateAttributes(Dg.name,{url:l}).setNodeSelection(n.state.selection.from).focus().run()}const u=x.useCallback(d=>{t({width:d.width,height:d.height})},[t]);return p.jsxs(hn,{children:[!o&&p.jsxs("div",{className:"mx-auto my-[12px] flex max-w-[600px] items-center justify-center gap-[10px] rounded-[12px] border border-solid border-[#ccc] p-[10px]",children:[p.jsx(Rt,{autoFocus:!0,className:"flex-1",onInput:d=>a(d.target.value),placeholder:"Enter link",type:"url",value:l}),p.jsx(Ve,{className:"w-[60px]",onClick:c,children:"OK"})]}),o&&p.jsx(j1.Resizable,{size:{width:Number.parseInt(i),height:Number.parseInt(s)},onResizeStop:(d,f,h,m)=>{u({width:Number.parseInt(i)+m.width,height:Number.parseInt(s)+m.height})},children:p.jsx("div",{className:yt(Hd.wrap,"render-wrapper"),children:p.jsx("div",{className:Hd.innerWrap,style:{pointerEvents:r?"none":"auto"},children:p.jsx("iframe",{className:"my-[12px] ",src:o})})})})]})}function Bo(n,e=!1){return t=>{const r=n.startsWith("data-")?n:`data-${n}`;let o=decodeURIComponent(t.getAttribute(r));if(o==null||typeof o=="string"&&o==="null")try{const l=t.outerHTML.match(/([\S\s])+?="([\S\s])+?"/g);l&&l.length>0&&(o=(l.map(c=>c.trim()).reduce((c,u)=>{const d=u.indexOf("="),f=[u.slice(0,d),u.slice(d+1).slice(1,-1)];return c[f[0]]=f[1],c},{})[n.toLowerCase()]||"").replaceAll("&quot;",'"'))}catch(s){console.error("Error getDatasetAttribute ",s.message,t)}if(e)try{return JSON.parse(o)}catch{return{}}if(o.includes("%")||o.includes("auto"))return o;const i=Number.parseInt(o);return i!==i?o:i}}const Dg=et.create({name:"iframe",content:"",marks:"",group:"block",selectable:!0,atom:!0,draggable:!0,addOptions(){var n;return{...(n=this.parent)==null?void 0:n.call(this),HTMLAttributes:{class:"iframe"},button:({editor:e,extension:t,t:r})=>({component:St,componentProps:{action:o=>e.commands.setIframe(o),upload:t.options.upload,disabled:!e.can().setIframe({}),icon:"Iframe",tooltip:r("editor.iframe.tooltip")}})}},addAttributes(){return{width:{default:600,parseHTML:Bo("width")},height:{default:300,parseHTML:Bo("height")},url:{default:null,parseHTML:Bo("url")},defaultShowPicker:{default:!1},frameborder:{default:0},allowfullscreen:{default:this.options.allowFullscreen,parseHTML:()=>this.options.allowFullscreen}}},parseHTML(){return[{tag:"iframe"}]},renderHTML({HTMLAttributes:n}){return["iframe",Ke(this.options.HTMLAttributes,n)]},addCommands(){return{setIframe:n=>({tr:e,commands:t,chain:r})=>{var i,s,l;if(((l=(s=(i=e.selection)==null?void 0:i.node)==null?void 0:s.type)==null?void 0:l.name)==this.name)return t.updateAttributes(this.name,n);const o=n||{url:""};return r().insertContent({type:this.name,attrs:o}).run()}}},addInputRules(){return[gi({find:/^\$iframe\$$/,type:this.type,getAttributes:()=>({width:"100%"})})]},addNodeView(){return pn(gk)}});var Kr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function jg(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}function Pg(n){if(Object.prototype.hasOwnProperty.call(n,"__esModule"))return n;var e=n.default;if(typeof e=="function"){var t=function r(){return this instanceof r?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(n).forEach(function(r){var o=Object.getOwnPropertyDescriptor(n,r);Object.defineProperty(t,r,o.get?o:{enumerable:!0,get:function(){return n[r]}})}),t}var ms,Wd;function Lg(){if(Wd)return ms;Wd=1;var n=Object.prototype.toString;return ms=function(t){var r=n.call(t),o=r==="[object Arguments]";return o||(o=r!=="[object Array]"&&t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&n.call(t.callee)==="[object Function]"),o},ms}var gs,Ud;function yk(){if(Ud)return gs;Ud=1;var n;if(!Object.keys){var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,r=Lg(),o=Object.prototype.propertyIsEnumerable,i=!o.call({toString:null},"toString"),s=o.call(function(){},"prototype"),l=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],a=function(f){var h=f.constructor;return h&&h.prototype===f},c={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},u=function(){if(typeof window>"u")return!1;for(var f in window)try{if(!c["$"+f]&&e.call(window,f)&&window[f]!==null&&typeof window[f]=="object")try{a(window[f])}catch{return!0}}catch{return!0}return!1}(),d=function(f){if(typeof window>"u"||!u)return a(f);try{return a(f)}catch{return!1}};n=function(h){var m=h!==null&&typeof h=="object",g=t.call(h)==="[object Function]",y=r(h),b=m&&t.call(h)==="[object String]",w=[];if(!m&&!g&&!y)throw new TypeError("Object.keys called on a non-object");var v=s&&g;if(b&&h.length>0&&!e.call(h,0))for(var S=0;S<h.length;++S)w.push(String(S));if(y&&h.length>0)for(var O=0;O<h.length;++O)w.push(String(O));else for(var C in h)!(v&&C==="prototype")&&e.call(h,C)&&w.push(String(C));if(i)for(var N=d(h),E=0;E<l.length;++E)!(N&&l[E]==="constructor")&&e.call(h,l[E])&&w.push(l[E]);return w}}return gs=n,gs}var ys,Gd;function Pc(){if(Gd)return ys;Gd=1;var n=Array.prototype.slice,e=Lg(),t=Object.keys,r=t?function(s){return t(s)}:yk(),o=Object.keys;return r.shim=function(){if(Object.keys){var s=function(){var l=Object.keys(arguments);return l&&l.length===arguments.length}(1,2);s||(Object.keys=function(a){return e(a)?o(n.call(a)):o(a)})}else Object.keys=r;return Object.keys||r},ys=r,ys}var bs,Kd;function Ti(){if(Kd)return bs;Kd=1;var n=Object.defineProperty||!1;if(n)try{n({},"a",{value:1})}catch{n=!1}return bs=n,bs}var vs,Jd;function Lc(){return Jd||(Jd=1,vs=SyntaxError),vs}var xs,Xd;function vt(){return Xd||(Xd=1,xs=TypeError),xs}var ws,Yd;function bk(){return Yd||(Yd=1,ws=Object.getOwnPropertyDescriptor),ws}var Ss,Zd;function $n(){if(Zd)return Ss;Zd=1;var n=bk();if(n)try{n([],"length")}catch{n=null}return Ss=n,Ss}var Cs,Qd;function Bc(){if(Qd)return Cs;Qd=1;var n=Ti(),e=Lc(),t=vt(),r=$n();return Cs=function(i,s,l){if(!i||typeof i!="object"&&typeof i!="function")throw new t("`obj` must be an object or a function`");if(typeof s!="string"&&typeof s!="symbol")throw new t("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new t("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new t("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new t("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new t("`loose`, if provided, must be a boolean");var a=arguments.length>3?arguments[3]:null,c=arguments.length>4?arguments[4]:null,u=arguments.length>5?arguments[5]:null,d=arguments.length>6?arguments[6]:!1,f=!!r&&r(i,s);if(n)n(i,s,{configurable:u===null&&f?f.configurable:!u,enumerable:a===null&&f?f.enumerable:!a,value:l,writable:c===null&&f?f.writable:!c});else if(d||!a&&!c&&!u)i[s]=l;else throw new e("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},Cs}var ks,ef;function zc(){if(ef)return ks;ef=1;var n=Ti(),e=function(){return!!n};return e.hasArrayLengthDefineBug=function(){if(!n)return null;try{return n([],"length",{value:1}).length!==1}catch{return!0}},ks=e,ks}var Ts,tf;function Fn(){if(tf)return Ts;tf=1;var n=Pc(),e=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",t=Object.prototype.toString,r=Array.prototype.concat,o=Bc(),i=function(c){return typeof c=="function"&&t.call(c)==="[object Function]"},s=zc()(),l=function(c,u,d,f){if(u in c){if(f===!0){if(c[u]===d)return}else if(!i(f)||!f())return}s?o(c,u,d,!0):o(c,u,d)},a=function(c,u){var d=arguments.length>2?arguments[2]:{},f=n(u);e&&(f=r.call(f,Object.getOwnPropertySymbols(u)));for(var h=0;h<f.length;h+=1)l(c,f[h],u[f[h]],d[f[h]])};return a.supportsDescriptors=!!s,Ts=a,Ts}var Ms={exports:{}},Es,nf;function $c(){return nf||(nf=1,Es=Object),Es}var Os,rf;function Bg(){return rf||(rf=1,Os=Error),Os}var As,of;function vk(){return of||(of=1,As=EvalError),As}var Ns,sf;function xk(){return sf||(sf=1,Ns=RangeError),Ns}var Rs,lf;function wk(){return lf||(lf=1,Rs=ReferenceError),Rs}var Is,af;function Sk(){return af||(af=1,Is=URIError),Is}var _s,cf;function Ck(){return cf||(cf=1,_s=Math.abs),_s}var Ds,uf;function kk(){return uf||(uf=1,Ds=Math.floor),Ds}var js,df;function Tk(){return df||(df=1,js=Math.max),js}var Ps,ff;function Mk(){return ff||(ff=1,Ps=Math.min),Ps}var Ls,hf;function Ek(){return hf||(hf=1,Ls=Math.pow),Ls}var Bs,pf;function Ok(){return pf||(pf=1,Bs=Math.round),Bs}var zs,mf;function Ak(){return mf||(mf=1,zs=Number.isNaN||function(e){return e!==e}),zs}var $s,gf;function Nk(){if(gf)return $s;gf=1;var n=Ak();return $s=function(t){return n(t)||t===0?t:t<0?-1:1},$s}var Fs,yf;function Mi(){return yf||(yf=1,Fs=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},t=Symbol("test"),r=Object(t);if(typeof t=="string"||Object.prototype.toString.call(t)!=="[object Symbol]"||Object.prototype.toString.call(r)!=="[object Symbol]")return!1;var o=42;e[t]=o;for(var i in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var s=Object.getOwnPropertySymbols(e);if(s.length!==1||s[0]!==t||!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var l=Object.getOwnPropertyDescriptor(e,t);if(l.value!==o||l.enumerable!==!0)return!1}return!0}),Fs}var qs,bf;function Fc(){if(bf)return qs;bf=1;var n=typeof Symbol<"u"&&Symbol,e=Mi();return qs=function(){return typeof n!="function"||typeof Symbol!="function"||typeof n("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:e()},qs}var Vs,vf;function zg(){return vf||(vf=1,Vs=typeof Reflect<"u"&&Reflect.getPrototypeOf||null),Vs}var Hs,xf;function $g(){if(xf)return Hs;xf=1;var n=$c();return Hs=n.getPrototypeOf||null,Hs}var Ws,wf;function Rk(){if(wf)return Ws;wf=1;var n="Function.prototype.bind called on incompatible ",e=Object.prototype.toString,t=Math.max,r="[object Function]",o=function(a,c){for(var u=[],d=0;d<a.length;d+=1)u[d]=a[d];for(var f=0;f<c.length;f+=1)u[f+a.length]=c[f];return u},i=function(a,c){for(var u=[],d=c,f=0;d<a.length;d+=1,f+=1)u[f]=a[d];return u},s=function(l,a){for(var c="",u=0;u<l.length;u+=1)c+=l[u],u+1<l.length&&(c+=a);return c};return Ws=function(a){var c=this;if(typeof c!="function"||e.apply(c)!==r)throw new TypeError(n+c);for(var u=i(arguments,1),d,f=function(){if(this instanceof d){var b=c.apply(this,o(u,arguments));return Object(b)===b?b:this}return c.apply(a,o(u,arguments))},h=t(0,c.length-u.length),m=[],g=0;g<h;g++)m[g]="$"+g;if(d=Function("binder","return function ("+s(m,",")+"){ return binder.apply(this,arguments); }")(f),c.prototype){var y=function(){};y.prototype=c.prototype,d.prototype=new y,y.prototype=null}return d},Ws}var Us,Sf;function to(){if(Sf)return Us;Sf=1;var n=Rk();return Us=Function.prototype.bind||n,Us}var Gs,Cf;function qc(){return Cf||(Cf=1,Gs=Function.prototype.call),Gs}var Ks,kf;function Vc(){return kf||(kf=1,Ks=Function.prototype.apply),Ks}var Js,Tf;function Ik(){return Tf||(Tf=1,Js=typeof Reflect<"u"&&Reflect&&Reflect.apply),Js}var Xs,Mf;function Fg(){if(Mf)return Xs;Mf=1;var n=to(),e=Vc(),t=qc(),r=Ik();return Xs=r||n.call(t,e),Xs}var Ys,Ef;function Hc(){if(Ef)return Ys;Ef=1;var n=to(),e=vt(),t=qc(),r=Fg();return Ys=function(i){if(i.length<1||typeof i[0]!="function")throw new e("a function is required");return r(n,t,i)},Ys}var Zs,Of;function _k(){if(Of)return Zs;Of=1;var n=Hc(),e=$n(),t;try{t=[].__proto__===Array.prototype}catch(s){if(!s||typeof s!="object"||!("code"in s)||s.code!=="ERR_PROTO_ACCESS")throw s}var r=!!t&&e&&e(Object.prototype,"__proto__"),o=Object,i=o.getPrototypeOf;return Zs=r&&typeof r.get=="function"?n([r.get]):typeof i=="function"?function(l){return i(l==null?l:o(l))}:!1,Zs}var Qs,Af;function qg(){if(Af)return Qs;Af=1;var n=zg(),e=$g(),t=_k();return Qs=n?function(o){return n(o)}:e?function(o){if(!o||typeof o!="object"&&typeof o!="function")throw new TypeError("getProto: not an object");return e(o)}:t?function(o){return t(o)}:null,Qs}var el,Nf;function Wc(){if(Nf)return el;Nf=1;var n=Function.prototype.call,e=Object.prototype.hasOwnProperty,t=to();return el=t.call(n,e),el}var tl,Rf;function Vt(){if(Rf)return tl;Rf=1;var n,e=$c(),t=Bg(),r=vk(),o=xk(),i=wk(),s=Lc(),l=vt(),a=Sk(),c=Ck(),u=kk(),d=Tk(),f=Mk(),h=Ek(),m=Ok(),g=Nk(),y=Function,b=function(Z){try{return y('"use strict"; return ('+Z+").constructor;")()}catch{}},w=$n(),v=Ti(),S=function(){throw new l},O=w?function(){try{return S}catch{try{return w(arguments,"callee").get}catch{return S}}}():S,C=Fc()(),N=qg(),E=$g(),k=zg(),A=Vc(),L=qc(),I={},D=typeof Uint8Array>"u"||!N?n:N(Uint8Array),j={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?n:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?n:ArrayBuffer,"%ArrayIteratorPrototype%":C&&N?N([][Symbol.iterator]()):n,"%AsyncFromSyncIteratorPrototype%":n,"%AsyncFunction%":I,"%AsyncGenerator%":I,"%AsyncGeneratorFunction%":I,"%AsyncIteratorPrototype%":I,"%Atomics%":typeof Atomics>"u"?n:Atomics,"%BigInt%":typeof BigInt>"u"?n:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?n:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?n:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?n:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":t,"%eval%":eval,"%EvalError%":r,"%Float32Array%":typeof Float32Array>"u"?n:Float32Array,"%Float64Array%":typeof Float64Array>"u"?n:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?n:FinalizationRegistry,"%Function%":y,"%GeneratorFunction%":I,"%Int8Array%":typeof Int8Array>"u"?n:Int8Array,"%Int16Array%":typeof Int16Array>"u"?n:Int16Array,"%Int32Array%":typeof Int32Array>"u"?n:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":C&&N?N(N([][Symbol.iterator]())):n,"%JSON%":typeof JSON=="object"?JSON:n,"%Map%":typeof Map>"u"?n:Map,"%MapIteratorPrototype%":typeof Map>"u"||!C||!N?n:N(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":e,"%Object.getOwnPropertyDescriptor%":w,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?n:Promise,"%Proxy%":typeof Proxy>"u"?n:Proxy,"%RangeError%":o,"%ReferenceError%":i,"%Reflect%":typeof Reflect>"u"?n:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?n:Set,"%SetIteratorPrototype%":typeof Set>"u"||!C||!N?n:N(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?n:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":C&&N?N(""[Symbol.iterator]()):n,"%Symbol%":C?Symbol:n,"%SyntaxError%":s,"%ThrowTypeError%":O,"%TypedArray%":D,"%TypeError%":l,"%Uint8Array%":typeof Uint8Array>"u"?n:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?n:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?n:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?n:Uint32Array,"%URIError%":a,"%WeakMap%":typeof WeakMap>"u"?n:WeakMap,"%WeakRef%":typeof WeakRef>"u"?n:WeakRef,"%WeakSet%":typeof WeakSet>"u"?n:WeakSet,"%Function.prototype.call%":L,"%Function.prototype.apply%":A,"%Object.defineProperty%":v,"%Object.getPrototypeOf%":E,"%Math.abs%":c,"%Math.floor%":u,"%Math.max%":d,"%Math.min%":f,"%Math.pow%":h,"%Math.round%":m,"%Math.sign%":g,"%Reflect.getPrototypeOf%":k},P=function Z(Y){var X;if(Y==="%AsyncFunction%")X=b("async function () {}");else if(Y==="%GeneratorFunction%")X=b("function* () {}");else if(Y==="%AsyncGeneratorFunction%")X=b("async function* () {}");else if(Y==="%AsyncGenerator%"){var G=Z("%AsyncGeneratorFunction%");G&&(X=G.prototype)}else if(Y==="%AsyncIteratorPrototype%"){var W=Z("%AsyncGenerator%");W&&N&&(X=N(W.prototype))}return j[Y]=X,X},J={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},Q=to(),pe=Wc(),ce=Q.call(L,Array.prototype.concat),ut=Q.call(A,Array.prototype.splice),Me=Q.call(L,String.prototype.replace),Le=Q.call(L,String.prototype.slice),kt=Q.call(L,RegExp.prototype.exec),_=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,$=/\\(\\)?/g,ne=function(Y){var X=Le(Y,0,1),G=Le(Y,-1);if(X==="%"&&G!=="%")throw new s("invalid intrinsic syntax, expected closing `%`");if(G==="%"&&X!=="%")throw new s("invalid intrinsic syntax, expected opening `%`");var W=[];return Me(Y,_,function(q,ie,re,de){W[W.length]=re?Me(de,$,"$1"):ie||q}),W},te=function(Y,X){var G=Y,W;if(pe(J,G)&&(W=J[G],G="%"+W[0]+"%"),pe(j,G)){var q=j[G];if(q===I&&(q=P(G)),typeof q>"u"&&!X)throw new l("intrinsic "+Y+" exists, but is not available. Please file an issue!");return{alias:W,name:G,value:q}}throw new s("intrinsic "+Y+" does not exist!")};return tl=function(Y,X){if(typeof Y!="string"||Y.length===0)throw new l("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof X!="boolean")throw new l('"allowMissing" argument must be a boolean');if(kt(/^%?[^%]*%?$/,Y)===null)throw new s("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var G=ne(Y),W=G.length>0?G[0]:"",q=te("%"+W+"%",X),ie=q.name,re=q.value,de=!1,be=q.alias;be&&(W=be[0],ut(G,ce([0,1],be)));for(var Ee=1,ye=!0;Ee<G.length;Ee+=1){var fe=G[Ee],Ne=Le(fe,0,1),dt=Le(fe,-1);if((Ne==='"'||Ne==="'"||Ne==="`"||dt==='"'||dt==="'"||dt==="`")&&Ne!==dt)throw new s("property names with quotes must have matching quotes");if((fe==="constructor"||!ye)&&(de=!0),W+="."+fe,ie="%"+W+"%",pe(j,ie))re=j[ie];else if(re!=null){if(!(fe in re)){if(!X)throw new l("base intrinsic for "+Y+" exists, but the property is not available.");return}if(w&&Ee+1>=G.length){var ft=w(re,fe);ye=!!ft,ye&&"get"in ft&&!("originalValue"in ft.get)?re=ft.get:re=re[fe]}else ye=pe(re,fe),re=re[fe];ye&&!de&&(j[ie]=re)}}return re},tl}var nl,If;function Dk(){if(If)return nl;If=1;var n=Vt(),e=Bc(),t=zc()(),r=$n(),o=vt(),i=n("%Math.floor%");return nl=function(l,a){if(typeof l!="function")throw new o("`fn` is not a function");if(typeof a!="number"||a<0||a>4294967295||i(a)!==a)throw new o("`length` must be a positive 32-bit integer");var c=arguments.length>2&&!!arguments[2],u=!0,d=!0;if("length"in l&&r){var f=r(l,"length");f&&!f.configurable&&(u=!1),f&&!f.writable&&(d=!1)}return(u||d||!c)&&(t?e(l,"length",a,!0,!0):e(l,"length",a)),l},nl}var rl,_f;function jk(){if(_f)return rl;_f=1;var n=to(),e=Vc(),t=Fg();return rl=function(){return t(n,e,arguments)},rl}var Df;function mr(){return Df||(Df=1,function(n){var e=Dk(),t=Ti(),r=Hc(),o=jk();n.exports=function(s){var l=r(arguments),a=s.length-(arguments.length-1);return e(l,1+(a>0?a:0),!0)},t?t(n.exports,"apply",{value:o}):n.exports.apply=o}(Ms)),Ms.exports}var ol,jf;function Je(){if(jf)return ol;jf=1;var n=Vt(),e=Hc(),t=e([n("%String.prototype.indexOf%")]);return ol=function(o,i){var s=n(o,!!i);return typeof s=="function"&&t(o,".prototype.")>-1?e([s]):s},ol}var il,Pf;function Vg(){if(Pf)return il;Pf=1;var n=Pc(),e=Mi()(),t=Je(),r=$c(),o=t("Array.prototype.push"),i=t("Object.prototype.propertyIsEnumerable"),s=e?r.getOwnPropertySymbols:null;return il=function(a,c){if(a==null)throw new TypeError("target must be an object");var u=r(a);if(arguments.length===1)return u;for(var d=1;d<arguments.length;++d){var f=r(arguments[d]),h=n(f),m=e&&(r.getOwnPropertySymbols||s);if(m)for(var g=m(f),y=0;y<g.length;++y){var b=g[y];i(f,b)&&o(h,b)}for(var w=0;w<h.length;++w){var v=h[w];if(i(f,v)){var S=f[v];u[v]=S}}}return u},il}var sl,Lf;function Hg(){if(Lf)return sl;Lf=1;var n=Vg(),e=function(){if(!Object.assign)return!1;for(var r="abcdefghijklmnopqrst",o=r.split(""),i={},s=0;s<o.length;++s)i[o[s]]=o[s];var l=Object.assign({},i),a="";for(var c in l)a+=c;return r!==a},t=function(){if(!Object.assign||!Object.preventExtensions)return!1;var r=Object.preventExtensions({1:2});try{Object.assign(r,"xy")}catch{return r[1]==="y"}return!1};return sl=function(){return!Object.assign||e()||t()?n:Object.assign},sl}var ll,Bf;function Pk(){if(Bf)return ll;Bf=1;var n=Fn(),e=Hg();return ll=function(){var r=e();return n(Object,{assign:r},{assign:function(){return Object.assign!==r}}),r},ll}var al,zf;function Lk(){if(zf)return al;zf=1;var n=Fn(),e=mr(),t=Vg(),r=Hg(),o=Pk(),i=e.apply(r()),s=function(a,c){return i(Object,arguments)};return n(s,{getPolyfill:r,implementation:t,shim:o}),al=s,al}var cl,$f;function Wg(){if($f)return cl;$f=1;var n=Vt(),e=mr(),t=e(n("String.prototype.indexOf"));return cl=function(o,i){var s=n(o,!!i);return typeof s=="function"&&t(o,".prototype.")>-1?e(s):s},cl}var ul,Ff;function Bk(){if(Ff)return ul;Ff=1;var n=function(){return typeof(function(){}).name=="string"},e=Object.getOwnPropertyDescriptor;n.functionsHaveConfigurableNames=function(){if(!n()||!e)return!1;var o=e(function(){},"name");return!!o&&!!o.configurable};var t=Function.prototype.bind;return n.boundFunctionsHaveNames=function(){return n()&&typeof t=="function"&&(function(){}).bind().name!==""},ul=n,ul}var dl,qf;function zk(){if(qf)return dl;qf=1;var n=Bc(),e=zc()(),t=Bk().functionsHaveConfigurableNames(),r=vt();return dl=function(i,s){if(typeof i!="function")throw new r("`fn` is not a function");var l=arguments.length>2&&!!arguments[2];return(!l||t)&&(e?n(i,"name",s,!0,!0):n(i,"name",s)),i},dl}var fl,Vf;function Ug(){if(Vf)return fl;Vf=1;var n=zk(),e=vt(),t=Object;return fl=n(function(){if(this==null||this!==t(this))throw new e("RegExp.prototype.flags getter called on non-object");var o="";return this.hasIndices&&(o+="d"),this.global&&(o+="g"),this.ignoreCase&&(o+="i"),this.multiline&&(o+="m"),this.dotAll&&(o+="s"),this.unicode&&(o+="u"),this.unicodeSets&&(o+="v"),this.sticky&&(o+="y"),o},"get flags",!0),fl}var hl,Hf;function Gg(){if(Hf)return hl;Hf=1;var n=Ug(),e=Fn().supportsDescriptors,t=Object.getOwnPropertyDescriptor;return hl=function(){if(e&&/a/mig.flags==="gim"){var o=t(RegExp.prototype,"flags");if(o&&typeof o.get=="function"&&"dotAll"in RegExp.prototype&&"hasIndices"in RegExp.prototype){var i="",s={};if(Object.defineProperty(s,"hasIndices",{get:function(){i+="d"}}),Object.defineProperty(s,"sticky",{get:function(){i+="y"}}),o.get.call(s),i==="dy")return o.get}}return n},hl}var pl,Wf;function $k(){if(Wf)return pl;Wf=1;var n=Fn().supportsDescriptors,e=Gg(),t=$n(),r=Object.defineProperty,o=Bg(),i=qg(),s=/a/;return pl=function(){if(!n||!i)throw new o("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var a=e(),c=i(s),u=t(c,"flags");return(!u||u.get!==a)&&r(c,"flags",{configurable:!0,enumerable:!1,get:a}),a},pl}var ml,Uf;function Fk(){if(Uf)return ml;Uf=1;var n=Fn(),e=mr(),t=Ug(),r=Gg(),o=$k(),i=e(r());return n(i,{getPolyfill:r,implementation:t,shim:o}),ml=i,ml}var wr={exports:{}},gl,Gf;function qn(){if(Gf)return gl;Gf=1;var n=Mi();return gl=function(){return n()&&!!Symbol.toStringTag},gl}var yl,Kf;function Kg(){if(Kf)return yl;Kf=1;var n=qn()(),e=Je(),t=e("Object.prototype.toString"),r=function(l){return n&&l&&typeof l=="object"&&Symbol.toStringTag in l?!1:t(l)==="[object Arguments]"},o=function(l){return r(l)?!0:l!==null&&typeof l=="object"&&"length"in l&&typeof l.length=="number"&&l.length>=0&&t(l)!=="[object Array]"&&"callee"in l&&t(l.callee)==="[object Function]"},i=function(){return r(arguments)}();return r.isLegacyArguments=o,yl=i?r:o,yl}const qk={},Vk=Object.freeze(Object.defineProperty({__proto__:null,default:qk},Symbol.toStringTag,{value:"Module"})),Hk=Pg(Vk);var bl,Jf;function Ei(){if(Jf)return bl;Jf=1;var n=typeof Map=="function"&&Map.prototype,e=Object.getOwnPropertyDescriptor&&n?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,t=n&&e&&typeof e.get=="function"?e.get:null,r=n&&Map.prototype.forEach,o=typeof Set=="function"&&Set.prototype,i=Object.getOwnPropertyDescriptor&&o?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,s=o&&i&&typeof i.get=="function"?i.get:null,l=o&&Set.prototype.forEach,a=typeof WeakMap=="function"&&WeakMap.prototype,c=a?WeakMap.prototype.has:null,u=typeof WeakSet=="function"&&WeakSet.prototype,d=u?WeakSet.prototype.has:null,f=typeof WeakRef=="function"&&WeakRef.prototype,h=f?WeakRef.prototype.deref:null,m=Boolean.prototype.valueOf,g=Object.prototype.toString,y=Function.prototype.toString,b=String.prototype.match,w=String.prototype.slice,v=String.prototype.replace,S=String.prototype.toUpperCase,O=String.prototype.toLowerCase,C=RegExp.prototype.test,N=Array.prototype.concat,E=Array.prototype.join,k=Array.prototype.slice,A=Math.floor,L=typeof BigInt=="function"?BigInt.prototype.valueOf:null,I=Object.getOwnPropertySymbols,D=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,j=typeof Symbol=="function"&&typeof Symbol.iterator=="object",P=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===j||!0)?Symbol.toStringTag:null,J=Object.prototype.propertyIsEnumerable,Q=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(T){return T.__proto__}:null);function pe(T,M){if(T===1/0||T===-1/0||T!==T||T&&T>-1e3&&T<1e3||C.call(/e/,M))return M;var he=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof T=="number"){var Se=T<0?-A(-T):A(T);if(Se!==T){var Ce=String(Se),ae=w.call(M,Ce.length+1);return v.call(Ce,he,"$&_")+"."+v.call(v.call(ae,/([0-9]{3})/g,"$&_"),/_$/,"")}}return v.call(M,he,"$&_")}var ce=Hk,ut=ce.custom,Me=ie(ut)?ut:null,Le={__proto__:null,double:'"',single:"'"},kt={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};bl=function T(M,he,Se,Ce){var ae=he||{};if(be(ae,"quoteStyle")&&!be(Le,ae.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(be(ae,"maxStringLength")&&(typeof ae.maxStringLength=="number"?ae.maxStringLength<0&&ae.maxStringLength!==1/0:ae.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var Ht=be(ae,"customInspect")?ae.customInspect:!0;if(typeof Ht!="boolean"&&Ht!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(be(ae,"indent")&&ae.indent!==null&&ae.indent!==" "&&!(parseInt(ae.indent,10)===ae.indent&&ae.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(be(ae,"numericSeparator")&&typeof ae.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var bn=ae.numericSeparator;if(typeof M>"u")return"undefined";if(M===null)return"null";if(typeof M=="boolean")return M?"true":"false";if(typeof M=="string")return Tt(M,ae);if(typeof M=="number"){if(M===0)return 1/0/M>0?"0":"-0";var it=String(M);return bn?pe(M,it):it}if(typeof M=="bigint"){var Wt=String(M)+"n";return bn?pe(M,Wt):Wt}var Ri=typeof ae.depth>"u"?5:ae.depth;if(typeof Se>"u"&&(Se=0),Se>=Ri&&Ri>0&&typeof M=="object")return te(M)?"[Array]":"[Object]";var Vn=M1(ae,Se);if(typeof Ce>"u")Ce=[];else if(fe(Ce,M)>=0)return"[Circular]";function xt(Hn,io,O1){if(io&&(Ce=k.call(Ce),Ce.push(io)),O1){var su={depth:ae.depth};return be(ae,"quoteStyle")&&(su.quoteStyle=ae.quoteStyle),T(Hn,su,Se+1,Ce)}return T(Hn,ae,Se+1,Ce)}if(typeof M=="function"&&!Y(M)){var Qc=ye(M),eu=ro(M,xt);return"[Function"+(Qc?": "+Qc:" (anonymous)")+"]"+(eu.length>0?" { "+E.call(eu,", ")+" }":"")}if(ie(M)){var tu=j?v.call(String(M),/^(Symbol\(.*\))_[^)]*$/,"$1"):D.call(M);return typeof M=="object"&&!j?ht(tu):tu}if(Re(M)){for(var gr="<"+O.call(String(M.nodeName)),Ii=M.attributes||[],oo=0;oo<Ii.length;oo++)gr+=" "+Ii[oo].name+"="+_($(Ii[oo].value),"double",ae);return gr+=">",M.childNodes&&M.childNodes.length&&(gr+="..."),gr+="</"+O.call(String(M.nodeName))+">",gr}if(te(M)){if(M.length===0)return"[]";var _i=ro(M,xt);return Vn&&!T1(_i)?"["+Ni(_i,Vn)+"]":"[ "+E.call(_i,", ")+" ]"}if(X(M)){var Di=ro(M,xt);return!("cause"in Error.prototype)&&"cause"in M&&!J.call(M,"cause")?"{ ["+String(M)+"] "+E.call(N.call("[cause]: "+xt(M.cause),Di),", ")+" }":Di.length===0?"["+String(M)+"]":"{ ["+String(M)+"] "+E.call(Di,", ")+" }"}if(typeof M=="object"&&Ht){if(Me&&typeof M[Me]=="function"&&ce)return ce(M,{depth:Ri-Se});if(Ht!=="symbol"&&typeof M.inspect=="function")return M.inspect()}if(Ne(M)){var nu=[];return r&&r.call(M,function(Hn,io){nu.push(xt(io,M,!0)+" => "+xt(Hn,M))}),Zc("Map",t.call(M),nu,Vn)}if(gn(M)){var ru=[];return l&&l.call(M,function(Hn){ru.push(xt(Hn,M))}),Zc("Set",s.call(M),ru,Vn)}if(dt(M))return Ai("WeakMap");if(Be(M))return Ai("WeakSet");if(ft(M))return Ai("WeakRef");if(W(M))return ht(xt(Number(M)));if(re(M))return ht(xt(L.call(M)));if(q(M))return ht(m.call(M));if(G(M))return ht(xt(String(M)));if(typeof window<"u"&&M===window)return"{ [object Window] }";if(typeof globalThis<"u"&&M===globalThis||typeof Kr<"u"&&M===Kr)return"{ [object globalThis] }";if(!Z(M)&&!Y(M)){var ji=ro(M,xt),ou=Q?Q(M)===Object.prototype:M instanceof Object||M.constructor===Object,Pi=M instanceof Object?"":"null prototype",iu=!ou&&P&&Object(M)===M&&P in M?w.call(Ee(M),8,-1):Pi?"Object":"",E1=ou||typeof M.constructor!="function"?"":M.constructor.name?M.constructor.name+" ":"",Li=E1+(iu||Pi?"["+E.call(N.call([],iu||[],Pi||[]),": ")+"] ":"");return ji.length===0?Li+"{}":Vn?Li+"{"+Ni(ji,Vn)+"}":Li+"{ "+E.call(ji,", ")+" }"}return String(M)};function _(T,M,he){var Se=he.quoteStyle||M,Ce=Le[Se];return Ce+T+Ce}function $(T){return v.call(String(T),/"/g,"&quot;")}function ne(T){return!P||!(typeof T=="object"&&(P in T||typeof T[P]<"u"))}function te(T){return Ee(T)==="[object Array]"&&ne(T)}function Z(T){return Ee(T)==="[object Date]"&&ne(T)}function Y(T){return Ee(T)==="[object RegExp]"&&ne(T)}function X(T){return Ee(T)==="[object Error]"&&ne(T)}function G(T){return Ee(T)==="[object String]"&&ne(T)}function W(T){return Ee(T)==="[object Number]"&&ne(T)}function q(T){return Ee(T)==="[object Boolean]"&&ne(T)}function ie(T){if(j)return T&&typeof T=="object"&&T instanceof Symbol;if(typeof T=="symbol")return!0;if(!T||typeof T!="object"||!D)return!1;try{return D.call(T),!0}catch{}return!1}function re(T){if(!T||typeof T!="object"||!L)return!1;try{return L.call(T),!0}catch{}return!1}var de=Object.prototype.hasOwnProperty||function(T){return T in this};function be(T,M){return de.call(T,M)}function Ee(T){return g.call(T)}function ye(T){if(T.name)return T.name;var M=b.call(y.call(T),/^function\s*([\w$]+)/);return M?M[1]:null}function fe(T,M){if(T.indexOf)return T.indexOf(M);for(var he=0,Se=T.length;he<Se;he++)if(T[he]===M)return he;return-1}function Ne(T){if(!t||!T||typeof T!="object")return!1;try{t.call(T);try{s.call(T)}catch{return!0}return T instanceof Map}catch{}return!1}function dt(T){if(!c||!T||typeof T!="object")return!1;try{c.call(T,c);try{d.call(T,d)}catch{return!0}return T instanceof WeakMap}catch{}return!1}function ft(T){if(!h||!T||typeof T!="object")return!1;try{return h.call(T),!0}catch{}return!1}function gn(T){if(!s||!T||typeof T!="object")return!1;try{s.call(T);try{t.call(T)}catch{return!0}return T instanceof Set}catch{}return!1}function Be(T){if(!d||!T||typeof T!="object")return!1;try{d.call(T,d);try{c.call(T,c)}catch{return!0}return T instanceof WeakSet}catch{}return!1}function Re(T){return!T||typeof T!="object"?!1:typeof HTMLElement<"u"&&T instanceof HTMLElement?!0:typeof T.nodeName=="string"&&typeof T.getAttribute=="function"}function Tt(T,M){if(T.length>M.maxStringLength){var he=T.length-M.maxStringLength,Se="... "+he+" more character"+(he>1?"s":"");return Tt(w.call(T,0,M.maxStringLength),M)+Se}var Ce=kt[M.quoteStyle||"single"];Ce.lastIndex=0;var ae=v.call(v.call(T,Ce,"\\$1"),/[\x00-\x1f]/g,yn);return _(ae,"single",M)}function yn(T){var M=T.charCodeAt(0),he={8:"b",9:"t",10:"n",12:"f",13:"r"}[M];return he?"\\"+he:"\\x"+(M<16?"0":"")+S.call(M.toString(16))}function ht(T){return"Object("+T+")"}function Ai(T){return T+" { ? }"}function Zc(T,M,he,Se){var Ce=Se?Ni(he,Se):E.call(he,", ");return T+" ("+M+") {"+Ce+"}"}function T1(T){for(var M=0;M<T.length;M++)if(fe(T[M],`
122
122
  `)>=0)return!1;return!0}function M1(T,M){var he;if(T.indent===" ")he=" ";else if(typeof T.indent=="number"&&T.indent>0)he=E.call(Array(T.indent+1)," ");else return null;return{base:he,prev:E.call(Array(M+1),he)}}function Ni(T,M){if(T.length===0)return"";var he=`
123
123
  `+M.prev+M.base;return he+E.call(T,","+he)+`
124
124
  `+M.prev}function ro(T,M){var he=te(T),Se=[];if(he){Se.length=T.length;for(var Ce=0;Ce<T.length;Ce++)Se[Ce]=be(T,Ce)?M(T[Ce],T):""}var ae=typeof I=="function"?I(T):[],Ht;if(j){Ht={};for(var bn=0;bn<ae.length;bn++)Ht["$"+ae[bn]]=ae[bn]}for(var it in T)be(T,it)&&(he&&String(Number(it))===it&&it<T.length||j&&Ht["$"+it]instanceof Symbol||(C.call(/[^\w$]/,it)?Se.push(M(it,T)+": "+M(T[it],T)):Se.push(it+": "+M(T[it],T))));if(typeof I=="function")for(var Wt=0;Wt<ae.length;Wt++)J.call(T,ae[Wt])&&Se.push("["+M(ae[Wt])+"]: "+M(T[ae[Wt]],T));return Se}return bl}var vl,Xf;function Wk(){if(Xf)return vl;Xf=1;var n=Ei(),e=vt(),t=function(l,a,c){for(var u=l,d;(d=u.next)!=null;u=d)if(d.key===a)return u.next=d.next,c||(d.next=l.next,l.next=d),d},r=function(l,a){if(l){var c=t(l,a);return c&&c.value}},o=function(l,a,c){var u=t(l,a);u?u.value=c:l.next={key:a,next:l.next,value:c}},i=function(l,a){return l?!!t(l,a):!1},s=function(l,a){if(l)return t(l,a,!0)};return vl=function(){var a,c={assert:function(u){if(!c.has(u))throw new e("Side channel does not contain "+n(u))},delete:function(u){var d=a&&a.next,f=s(a,u);return f&&d&&d===f&&(a=void 0),!!f},get:function(u){return r(a,u)},has:function(u){return i(a,u)},set:function(u,d){a||(a={next:void 0}),o(a,u,d)}};return c},vl}var xl,Yf;function Jg(){if(Yf)return xl;Yf=1;var n=Vt(),e=Je(),t=Ei(),r=vt(),o=n("%Map%",!0),i=e("Map.prototype.get",!0),s=e("Map.prototype.set",!0),l=e("Map.prototype.has",!0),a=e("Map.prototype.delete",!0),c=e("Map.prototype.size",!0);return xl=!!o&&function(){var d,f={assert:function(h){if(!f.has(h))throw new r("Side channel does not contain "+t(h))},delete:function(h){if(d){var m=a(d,h);return c(d)===0&&(d=void 0),m}return!1},get:function(h){if(d)return i(d,h)},has:function(h){return d?l(d,h):!1},set:function(h,m){d||(d=new o),s(d,h,m)}};return f},xl}var wl,Zf;function Uk(){if(Zf)return wl;Zf=1;var n=Vt(),e=Je(),t=Ei(),r=Jg(),o=vt(),i=n("%WeakMap%",!0),s=e("WeakMap.prototype.get",!0),l=e("WeakMap.prototype.set",!0),a=e("WeakMap.prototype.has",!0),c=e("WeakMap.prototype.delete",!0);return wl=i?function(){var d,f,h={assert:function(m){if(!h.has(m))throw new o("Side channel does not contain "+t(m))},delete:function(m){if(i&&m&&(typeof m=="object"||typeof m=="function")){if(d)return c(d,m)}else if(r&&f)return f.delete(m);return!1},get:function(m){return i&&m&&(typeof m=="object"||typeof m=="function")&&d?s(d,m):f&&f.get(m)},has:function(m){return i&&m&&(typeof m=="object"||typeof m=="function")&&d?a(d,m):!!f&&f.has(m)},set:function(m,g){i&&m&&(typeof m=="object"||typeof m=="function")?(d||(d=new i),l(d,m,g)):r&&(f||(f=r()),f.set(m,g))}};return h}:r,wl}var Sl,Qf;function Xg(){if(Qf)return Sl;Qf=1;var n=vt(),e=Ei(),t=Wk(),r=Jg(),o=Uk(),i=o||r||t;return Sl=function(){var l,a={assert:function(c){if(!a.has(c))throw new n("Side channel does not contain "+e(c))},delete:function(c){return!!l&&l.delete(c)},get:function(c){return l&&l.get(c)},has:function(c){return!!l&&l.has(c)},set:function(c,u){l||(l=i()),l.set(c,u)}};return a},Sl}var Cl,eh;function Gk(){if(eh)return Cl;eh=1;var n=Wc(),e=Xg()(),t=vt(),r={assert:function(o,i){if(!o||typeof o!="object"&&typeof o!="function")throw new t("`O` is not an object");if(typeof i!="string")throw new t("`slot` must be a string");if(e.assert(o),!r.has(o,i))throw new t("`"+i+"` is not present on `O`")},get:function(o,i){if(!o||typeof o!="object"&&typeof o!="function")throw new t("`O` is not an object");if(typeof i!="string")throw new t("`slot` must be a string");var s=e.get(o);return s&&s["$"+i]},has:function(o,i){if(!o||typeof o!="object"&&typeof o!="function")throw new t("`O` is not an object");if(typeof i!="string")throw new t("`slot` must be a string");var s=e.get(o);return!!s&&n(s,"$"+i)},set:function(o,i,s){if(!o||typeof o!="object"&&typeof o!="function")throw new t("`O` is not an object");if(typeof i!="string")throw new t("`slot` must be a string");var l=e.get(o);l||(l={},e.set(o,l)),l["$"+i]=s}};return Object.freeze&&Object.freeze(r),Cl=r,Cl}var kl,th;function Kk(){if(th)return kl;th=1;var n=Gk(),e=Lc(),t=typeof StopIteration=="object"?StopIteration:null;return kl=function(o){if(!t)throw new e("this environment lacks StopIteration");n.set(o,"[[Done]]",!1);var i={next:function(){var l=n.get(this,"[[Iterator]]"),a=!!n.get(l,"[[Done]]");try{return{done:a,value:a?void 0:l.next()}}catch(c){if(n.set(l,"[[Done]]",!0),c!==t)throw c;return{done:!0,value:void 0}}}};return n.set(i,"[[Iterator]]",o),i},kl}var Tl,nh;function Yg(){if(nh)return Tl;nh=1;var n={}.toString;return Tl=Array.isArray||function(e){return n.call(e)=="[object Array]"},Tl}var Ml,rh;function Zg(){if(rh)return Ml;rh=1;var n=Je(),e=n("String.prototype.valueOf"),t=function(l){try{return e(l),!0}catch{return!1}},r=n("Object.prototype.toString"),o="[object String]",i=qn()();return Ml=function(l){return typeof l=="string"?!0:!l||typeof l!="object"?!1:i?t(l):r(l)===o},Ml}var El,oh;function Qg(){if(oh)return El;oh=1;var n=typeof Map=="function"&&Map.prototype?Map:null,e=typeof Set=="function"&&Set.prototype?Set:null,t;n||(t=function(s){return!1});var r=n?Map.prototype.has:null,o=e?Set.prototype.has:null;return!t&&!r&&(t=function(s){return!1}),El=t||function(s){if(!s||typeof s!="object")return!1;try{if(r.call(s),o)try{o.call(s)}catch{return!0}return s instanceof n}catch{}return!1},El}var Ol,ih;function e1(){if(ih)return Ol;ih=1;var n=typeof Map=="function"&&Map.prototype?Map:null,e=typeof Set=="function"&&Set.prototype?Set:null,t;e||(t=function(s){return!1});var r=n?Map.prototype.has:null,o=e?Set.prototype.has:null;return!t&&!o&&(t=function(s){return!1}),Ol=t||function(s){if(!s||typeof s!="object")return!1;try{if(o.call(s),r)try{r.call(s)}catch{return!0}return s instanceof e}catch{}return!1},Ol}var sh;function Jk(){if(sh)return wr.exports;sh=1;var n=Kg(),e=Kk();if(Fc()()||Mi()()){var t=Symbol.iterator;wr.exports=function(k){if(k!=null&&typeof k[t]<"u")return k[t]();if(n(k))return Array.prototype[t].call(k)}}else{var r=Yg(),o=Zg(),i=Vt(),s=i("%Map%",!0),l=i("%Set%",!0),a=Wg(),c=a("Array.prototype.push"),u=a("String.prototype.charCodeAt"),d=a("String.prototype.slice"),f=function(k,A){var L=k.length;if(A+1>=L)return A+1;var I=u(k,A);if(I<55296||I>56319)return A+1;var D=u(k,A+1);return D<56320||D>57343?A+1:A+2},h=function(k){var A=0;return{next:function(){var I=A>=k.length,D;return I||(D=k[A],A+=1),{done:I,value:D}}}},m=function(k,A){if(r(k)||n(k))return h(k);if(o(k)){var L=0;return{next:function(){var D=f(k,L),j=d(k,L,D);return L=D,{done:D>k.length,value:j}}}}if(A&&typeof k["_es6-shim iterator_"]<"u")return k["_es6-shim iterator_"]()};if(!s&&!l)wr.exports=function(k){if(k!=null)return m(k,!0)};else{var g=Qg(),y=e1(),b=a("Map.prototype.forEach",!0),w=a("Set.prototype.forEach",!0);if(typeof process>"u"||!process.versions||!process.versions.node)var v=a("Map.prototype.iterator",!0),S=a("Set.prototype.iterator",!0);var O=a("Map.prototype.@@iterator",!0)||a("Map.prototype._es6-shim iterator_",!0),C=a("Set.prototype.@@iterator",!0)||a("Set.prototype._es6-shim iterator_",!0),N=function(k){if(g(k)){if(v)return e(v(k));if(O)return O(k);if(b){var A=[];return b(k,function(I,D){c(A,[D,I])}),h(A)}}if(y(k)){if(S)return e(S(k));if(C)return C(k);if(w){var L=[];return w(k,function(I){c(L,I)}),h(L)}}};wr.exports=function(k){return N(k)||m(k)}}}return wr.exports}var Al,lh;function t1(){if(lh)return Al;lh=1;var n=function(e){return e!==e};return Al=function(t,r){return t===0&&r===0?1/t===1/r:!!(t===r||n(t)&&n(r))},Al}var Nl,ah;function n1(){if(ah)return Nl;ah=1;var n=t1();return Nl=function(){return typeof Object.is=="function"?Object.is:n},Nl}var Rl,ch;function Xk(){if(ch)return Rl;ch=1;var n=n1(),e=Fn();return Rl=function(){var r=n();return e(Object,{is:r},{is:function(){return Object.is!==r}}),r},Rl}var Il,uh;function Yk(){if(uh)return Il;uh=1;var n=Fn(),e=mr(),t=t1(),r=n1(),o=Xk(),i=e(r(),Object);return n(i,{getPolyfill:r,implementation:t,shim:o}),Il=i,Il}var _l,dh;function r1(){if(dh)return _l;dh=1;var n=mr(),e=Je(),t=Vt(),r=t("%ArrayBuffer%",!0),o=e("ArrayBuffer.prototype.byteLength",!0),i=e("Object.prototype.toString"),s=!!r&&!o&&new r(0).slice,l=!!s&&n(s);return _l=o||l?function(c){if(!c||typeof c!="object")return!1;try{return o?o(c):l(c,0),!0}catch{return!1}}:r?function(c){return i(c)==="[object ArrayBuffer]"}:function(c){return!1},_l}var Dl,fh;function Zk(){if(fh)return Dl;fh=1;var n=Je(),e=n("Date.prototype.getDay"),t=function(l){try{return e(l),!0}catch{return!1}},r=n("Object.prototype.toString"),o="[object Date]",i=qn()();return Dl=function(l){return typeof l!="object"||l===null?!1:i?t(l):r(l)===o},Dl}var jl,hh;function o1(){if(hh)return jl;hh=1;var n=Je(),e=qn()(),t=Wc(),r=$n(),o;if(e){var i=n("RegExp.prototype.exec"),s={},l=function(){throw s},a={toString:l,valueOf:l};typeof Symbol.toPrimitive=="symbol"&&(a[Symbol.toPrimitive]=l),o=function(f){if(!f||typeof f!="object")return!1;var h=r(f,"lastIndex"),m=h&&t(h,"value");if(!m)return!1;try{i(f,a)}catch(g){return g===s}}}else{var c=n("Object.prototype.toString"),u="[object RegExp]";o=function(f){return!f||typeof f!="object"&&typeof f!="function"?!1:c(f)===u}}return jl=o,jl}var Pl,ph;function Qk(){if(ph)return Pl;ph=1;var n=Je(),e=n("SharedArrayBuffer.prototype.byteLength",!0);return Pl=e?function(r){if(!r||typeof r!="object")return!1;try{return e(r),!0}catch{return!1}}:function(r){return!1},Pl}var Ll,mh;function eT(){if(mh)return Ll;mh=1;var n=Je(),e=n("Number.prototype.toString"),t=function(l){try{return e(l),!0}catch{return!1}},r=n("Object.prototype.toString"),o="[object Number]",i=qn()();return Ll=function(l){return typeof l=="number"?!0:!l||typeof l!="object"?!1:i?t(l):r(l)===o},Ll}var Bl,gh;function tT(){if(gh)return Bl;gh=1;var n=Je(),e=n("Boolean.prototype.toString"),t=n("Object.prototype.toString"),r=function(l){try{return e(l),!0}catch{return!1}},o="[object Boolean]",i=qn()();return Bl=function(l){return typeof l=="boolean"?!0:l===null||typeof l!="object"?!1:i?r(l):t(l)===o},Bl}var vo={exports:{}},zl,yh;function nT(){if(yh)return zl;yh=1;var n=Je(),e=o1(),t=n("RegExp.prototype.exec"),r=vt();return zl=function(i){if(!e(i))throw new r("`regex` must be a RegExp");return function(l){return t(i,l)!==null}},zl}var bh;function rT(){if(bh)return vo.exports;bh=1;var n=Je(),e=n("Object.prototype.toString"),t=Fc()(),r=nT();if(t){var o=n("Symbol.prototype.toString"),i=r(/^Symbol\(.*\)$/),s=function(a){return typeof a.valueOf()!="symbol"?!1:i(o(a))};vo.exports=function(a){if(typeof a=="symbol")return!0;if(!a||typeof a!="object"||e(a)!=="[object Symbol]")return!1;try{return s(a)}catch{return!1}}}else vo.exports=function(a){return!1};return vo.exports}var xo={exports:{}},$l,vh;function oT(){if(vh)return $l;vh=1;var n=typeof BigInt<"u"&&BigInt;return $l=function(){return typeof n=="function"&&typeof BigInt=="function"&&typeof n(42)=="bigint"&&typeof BigInt(42)=="bigint"},$l}var xh;function iT(){if(xh)return xo.exports;xh=1;var n=oT()();if(n){var e=BigInt.prototype.valueOf,t=function(o){try{return e.call(o),!0}catch{}return!1};xo.exports=function(o){return o===null||typeof o>"u"||typeof o=="boolean"||typeof o=="string"||typeof o=="number"||typeof o=="symbol"||typeof o=="function"?!1:typeof o=="bigint"?!0:t(o)}}else xo.exports=function(o){return!1};return xo.exports}var Fl,wh;function sT(){if(wh)return Fl;wh=1;var n=Zg(),e=eT(),t=tT(),r=rT(),o=iT();return Fl=function(s){if(s==null||typeof s!="object"&&typeof s!="function")return null;if(n(s))return"String";if(e(s))return"Number";if(t(s))return"Boolean";if(r(s))return"Symbol";if(o(s))return"BigInt"},Fl}var ql,Sh;function lT(){if(Sh)return ql;Sh=1;var n=typeof WeakMap=="function"&&WeakMap.prototype?WeakMap:null,e=typeof WeakSet=="function"&&WeakSet.prototype?WeakSet:null,t;n||(t=function(s){return!1});var r=n?n.prototype.has:null,o=e?e.prototype.has:null;return!t&&!r&&(t=function(s){return!1}),ql=t||function(s){if(!s||typeof s!="object")return!1;try{if(r.call(s,r),o)try{o.call(s,o)}catch{return!0}return s instanceof n}catch{}return!1},ql}var wo={exports:{}},Ch;function aT(){if(Ch)return wo.exports;Ch=1;var n=Vt(),e=Je(),t=n("%WeakSet%",!0),r=e("WeakSet.prototype.has",!0);if(r){var o=e("WeakMap.prototype.has",!0);wo.exports=function(s){if(!s||typeof s!="object")return!1;try{if(r(s,r),o)try{o(s,o)}catch{return!0}return s instanceof t}catch{}return!1}}else wo.exports=function(s){return!1};return wo.exports}var Vl,kh;function cT(){if(kh)return Vl;kh=1;var n=Qg(),e=e1(),t=lT(),r=aT();return Vl=function(i){if(i&&typeof i=="object"){if(n(i))return"Map";if(e(i))return"Set";if(t(i))return"WeakMap";if(r(i))return"WeakSet"}return!1},Vl}var Hl,Th;function uT(){if(Th)return Hl;Th=1;var n=Function.prototype.toString,e=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,t,r;if(typeof e=="function"&&typeof Object.defineProperty=="function")try{t=Object.defineProperty({},"length",{get:function(){throw r}}),r={},e(function(){throw 42},null,t)}catch(w){w!==r&&(e=null)}else e=null;var o=/^\s*class\b/,i=function(v){try{var S=n.call(v);return o.test(S)}catch{return!1}},s=function(v){try{return i(v)?!1:(n.call(v),!0)}catch{return!1}},l=Object.prototype.toString,a="[object Object]",c="[object Function]",u="[object GeneratorFunction]",d="[object HTMLAllCollection]",f="[object HTML document.all class]",h="[object HTMLCollection]",m=typeof Symbol=="function"&&!!Symbol.toStringTag,g=!(0 in[,]),y=function(){return!1};if(typeof document=="object"){var b=document.all;l.call(b)===l.call(document.all)&&(y=function(v){if((g||!v)&&(typeof v>"u"||typeof v=="object"))try{var S=l.call(v);return(S===d||S===f||S===h||S===a)&&v("")==null}catch{}return!1})}return Hl=e?function(v){if(y(v))return!0;if(!v||typeof v!="function"&&typeof v!="object")return!1;try{e(v,null,t)}catch(S){if(S!==r)return!1}return!i(v)&&s(v)}:function(v){if(y(v))return!0;if(!v||typeof v!="function"&&typeof v!="object")return!1;if(m)return s(v);if(i(v))return!1;var S=l.call(v);return S!==c&&S!==u&&!/^\[object HTML/.test(S)?!1:s(v)},Hl}var Wl,Mh;function dT(){if(Mh)return Wl;Mh=1;var n=uT(),e=Object.prototype.toString,t=Object.prototype.hasOwnProperty,r=function(a,c,u){for(var d=0,f=a.length;d<f;d++)t.call(a,d)&&(u==null?c(a[d],d,a):c.call(u,a[d],d,a))},o=function(a,c,u){for(var d=0,f=a.length;d<f;d++)u==null?c(a.charAt(d),d,a):c.call(u,a.charAt(d),d,a)},i=function(a,c,u){for(var d in a)t.call(a,d)&&(u==null?c(a[d],d,a):c.call(u,a[d],d,a))};function s(l){return e.call(l)==="[object Array]"}return Wl=function(a,c,u){if(!n(c))throw new TypeError("iterator must be a function");var d;arguments.length>=3&&(d=u),s(a)?r(a,c,d):typeof a=="string"?o(a,c,d):i(a,c,d)},Wl}var Ul,Eh;function fT(){return Eh||(Eh=1,Ul=["Float16Array","Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]),Ul}var Gl,Oh;function hT(){if(Oh)return Gl;Oh=1;var n=fT(),e=typeof globalThis>"u"?Kr:globalThis;return Gl=function(){for(var r=[],o=0;o<n.length;o++)typeof e[n[o]]=="function"&&(r[r.length]=n[o]);return r},Gl}var Kl,Ah;function pT(){if(Ah)return Kl;Ah=1;var n=dT(),e=hT(),t=mr(),r=Je(),o=$n(),i=r("Object.prototype.toString"),s=qn()(),l=typeof globalThis>"u"?Kr:globalThis,a=e(),c=r("String.prototype.slice"),u=Object.getPrototypeOf,d=r("Array.prototype.indexOf",!0)||function(y,b){for(var w=0;w<y.length;w+=1)if(y[w]===b)return w;return-1},f={__proto__:null};s&&o&&u?n(a,function(g){var y=new l[g];if(Symbol.toStringTag in y){var b=u(y),w=o(b,Symbol.toStringTag);if(!w){var v=u(b);w=o(v,Symbol.toStringTag)}f["$"+g]=t(w.get)}}):n(a,function(g){var y=new l[g],b=y.slice||y.set;b&&(f["$"+g]=t(b))});var h=function(y){var b=!1;return n(f,function(w,v){if(!b)try{"$"+w(y)===v&&(b=c(v,1))}catch{}}),b},m=function(y){var b=!1;return n(f,function(w,v){if(!b)try{w(y),b=c(v,1)}catch{}}),b};return Kl=function(y){if(!y||typeof y!="object")return!1;if(!s){var b=c(i(y),8,-1);return d(a,b)>-1?b:b!=="Object"?!1:m(y)}return o?h(y):null},Kl}var Jl,Nh;function mT(){if(Nh)return Jl;Nh=1;var n=Je(),e=n("ArrayBuffer.prototype.byteLength",!0),t=r1();return Jl=function(o){return t(o)?e?e(o):o.byteLength:NaN},Jl}var Xl,Rh;function gT(){if(Rh)return Xl;Rh=1;var n=Lk(),e=Wg(),t=Fk(),r=Vt(),o=Jk(),i=Xg(),s=Yk(),l=Kg(),a=Yg(),c=r1(),u=Zk(),d=o1(),f=Qk(),h=Pc(),m=sT(),g=cT(),y=pT(),b=mT(),w=e("SharedArrayBuffer.prototype.byteLength",!0),v=e("Date.prototype.getTime"),S=Object.getPrototypeOf,O=e("Object.prototype.toString"),C=r("%Set%",!0),N=e("Map.prototype.has",!0),E=e("Map.prototype.get",!0),k=e("Map.prototype.size",!0),A=e("Set.prototype.add",!0),L=e("Set.prototype.delete",!0),I=e("Set.prototype.has",!0),D=e("Set.prototype.size",!0);function j(_,$,ne,te){for(var Z=o(_),Y;(Y=Z.next())&&!Y.done;)if(ce($,Y.value,ne,te))return L(_,Y.value),!0;return!1}function P(_){if(typeof _>"u")return null;if(typeof _!="object")return typeof _=="symbol"?!1:typeof _=="string"||typeof _=="number"?+_==+_:!0}function J(_,$,ne,te,Z,Y){var X=P(ne);if(X!=null)return X;var G=E($,X),W=n({},Z,{strict:!1});return typeof G>"u"&&!N($,X)||!ce(te,G,W,Y)?!1:!N(_,X)&&ce(te,G,W,Y)}function Q(_,$,ne){var te=P(ne);return te??(I($,te)&&!I(_,te))}function pe(_,$,ne,te,Z,Y){for(var X=o(_),G,W;(G=X.next())&&!G.done;)if(W=G.value,ce(ne,W,Z,Y)&&ce(te,E($,W),Z,Y))return L(_,W),!0;return!1}function ce(_,$,ne,te){var Z=ne||{};if(Z.strict?s(_,$):_===$)return!0;var Y=m(_),X=m($);if(Y!==X)return!1;if(!_||!$||typeof _!="object"&&typeof $!="object")return Z.strict?s(_,$):_==$;var G=te.has(_),W=te.has($),q;if(G&&W){if(te.get(_)===te.get($))return!0}else q={};return G||te.set(_,q),W||te.set($,q),kt(_,$,Z,te)}function ut(_){return!_||typeof _!="object"||typeof _.length!="number"||typeof _.copy!="function"||typeof _.slice!="function"||_.length>0&&typeof _[0]!="number"?!1:!!(_.constructor&&_.constructor.isBuffer&&_.constructor.isBuffer(_))}function Me(_,$,ne,te){if(D(_)!==D($))return!1;for(var Z=o(_),Y=o($),X,G,W;(X=Z.next())&&!X.done;)if(X.value&&typeof X.value=="object")W||(W=new C),A(W,X.value);else if(!I($,X.value)){if(ne.strict||!Q(_,$,X.value))return!1;W||(W=new C),A(W,X.value)}if(W){for(;(G=Y.next())&&!G.done;)if(G.value&&typeof G.value=="object"){if(!j(W,G.value,ne.strict,te))return!1}else if(!ne.strict&&!I(_,G.value)&&!j(W,G.value,ne.strict,te))return!1;return D(W)===0}return!0}function Le(_,$,ne,te){if(k(_)!==k($))return!1;for(var Z=o(_),Y=o($),X,G,W,q,ie,re;(X=Z.next())&&!X.done;)if(q=X.value[0],ie=X.value[1],q&&typeof q=="object")W||(W=new C),A(W,q);else if(re=E($,q),typeof re>"u"&&!N($,q)||!ce(ie,re,ne,te)){if(ne.strict||!J(_,$,q,ie,ne,te))return!1;W||(W=new C),A(W,q)}if(W){for(;(G=Y.next())&&!G.done;)if(q=G.value[0],re=G.value[1],q&&typeof q=="object"){if(!pe(W,_,q,re,ne,te))return!1}else if(!ne.strict&&(!_.has(q)||!ce(E(_,q),re,ne,te))&&!pe(W,_,q,re,n({},ne,{strict:!1}),te))return!1;return D(W)===0}return!0}function kt(_,$,ne,te){var Z,Y;if(typeof _!=typeof $||_==null||$==null||O(_)!==O($)||l(_)!==l($))return!1;var X=a(_),G=a($);if(X!==G)return!1;var W=_ instanceof Error,q=$ instanceof Error;if(W!==q||(W||q)&&(_.name!==$.name||_.message!==$.message))return!1;var ie=d(_),re=d($);if(ie!==re||(ie||re)&&(_.source!==$.source||t(_)!==t($)))return!1;var de=u(_),be=u($);if(de!==be||(de||be)&&v(_)!==v($)||ne.strict&&S&&S(_)!==S($))return!1;var Ee=y(_),ye=y($);if(Ee!==ye)return!1;if(Ee||ye){if(_.length!==$.length)return!1;for(Z=0;Z<_.length;Z++)if(_[Z]!==$[Z])return!1;return!0}var fe=ut(_),Ne=ut($);if(fe!==Ne)return!1;if(fe||Ne){if(_.length!==$.length)return!1;for(Z=0;Z<_.length;Z++)if(_[Z]!==$[Z])return!1;return!0}var dt=c(_),ft=c($);if(dt!==ft)return!1;if(dt||ft)return b(_)!==b($)?!1:typeof Uint8Array=="function"&&ce(new Uint8Array(_),new Uint8Array($),ne,te);var gn=f(_),Be=f($);if(gn!==Be)return!1;if(gn||Be)return w(_)!==w($)?!1:typeof Uint8Array=="function"&&ce(new Uint8Array(_),new Uint8Array($),ne,te);if(typeof _!=typeof $)return!1;var Re=h(_),Tt=h($);if(Re.length!==Tt.length)return!1;for(Re.sort(),Tt.sort(),Z=Re.length-1;Z>=0;Z--)if(Re[Z]!=Tt[Z])return!1;for(Z=Re.length-1;Z>=0;Z--)if(Y=Re[Z],!ce(_[Y],$[Y],ne,te))return!1;var yn=g(_),ht=g($);return yn!==ht?!1:yn==="Set"||ht==="Set"?Me(_,$,ne,te):yn==="Map"?Le(_,$,ne,te):!0}return Xl=function($,ne,te){return ce($,ne,te,i())},Xl}var yT=gT();const i1=jg(yT),Oi=we.forwardRef(({className:n,...e},t)=>p.jsx("textarea",{className:H("flex min-h-[80px] w-full rounded-md !border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",n),ref:t,...e}));Oi.displayName="Textarea";function bT(n){return n}function s1(n,e,t,r){const o=bT,[i,s]=x.useState(o(t)),l=x.useRef(i);return x.useEffect(()=>{const a=()=>{const c={...t,...n.getAttributes(e)};Object.keys(c).forEach(d=>{(c[d]===null||c[d]===void 0)&&(c[d]=t?t[d]:null)});const u=o(c);i1(l.current,u)||(s(u),l.current=u)};return n.on("selectionUpdate",a),n.on("transaction",a),()=>{n.off("selectionUpdate",a),n.off("transaction",a)}},[n,t,e,o]),i}function vT({editor:n,...e}){const{t}=oe.useLocale(),r=s1(n,za.name,{text:"",defaultShowPicker:!1}),{text:o,defaultShowPicker:i}=r,[s,l]=x.useState(""),a=x.useCallback(()=>{n.chain().focus().setKatex({text:s}).run(),l("")},[n,s]);x.useEffect(()=>{i&&n.chain().updateAttributes(za.name,{defaultShowPicker:!1}).focus().run()},[n,i]);const c=x.useMemo(()=>{try{return Xh.renderToString(`${s}`)}catch{return s}},[s]),u=x.useMemo(()=>`${s}`.trim()?p.jsx("span",{contentEditable:!1,dangerouslySetInnerHTML:{__html:c||""}}):null,[s,c]);return p.jsxs(Pn,{modal:!0,children:[p.jsx(Ln,{asChild:!0,children:p.jsx(St,{icon:e==null?void 0:e.icon,tooltip:e==null?void 0:e.tooltip})}),p.jsxs(mn,{align:"start",className:"size-full p-2",hideWhenDetached:!0,side:"bottom",children:[p.jsx(ln,{className:"mb-[6px]",children:t("editor.formula.dialog.text")}),p.jsx("div",{className:"mb-[16px] flex w-full max-w-sm items-center gap-1.5",children:p.jsx("div",{className:"relative w-full max-w-sm",children:p.jsx(Oi,{autoFocus:!0,className:"w-full",defaultValue:o,onChange:d=>l(d.target.value),placeholder:"Text",required:!0,rows:3,value:s})})}),u&&p.jsx("div",{className:"my-[10px] max-w-[286px] overflow-auto whitespace-nowrap rounded-[6px] !border p-[10px]",children:u}),p.jsxs("div",{className:"flex items-center justify-between gap-[6px]",children:[p.jsx(Ve,{className:"flex-1",onClick:a,children:"Submit"}),p.jsx("a",{href:"https://katex.org/docs/supported",rel:"noreferrer noopener",target:"_blank",children:p.jsx(B.HelpCircle,{size:16})})]})]})]})}function xT(){const[n]=Qm(e=>e.value);return n}const wT={setTheme:(n,e)=>{xi(dr.UPDATE_THEME(n),e)}};function ST(n,e=1){let t=0,r=0,o=0;if(n.startsWith("rgb")){const i=n.replace(/\s/g,"").match(/rgb\((.*)\)$/)[1].split(",");t=+i[0],r=+i[1],o=+i[2]}else if(n.startsWith("#")){let i=n.replace("#","");i.length===3&&(i=`${i[0]}${i[0]}${i[1]}${i[1]}${i[2]}${i[2]}`),t=Number.parseInt(i.substring(0,2),16),r=Number.parseInt(i.substring(2,4),16),o=Number.parseInt(i.substring(4,6),16)}else return n;return e>1&&e<=100&&(e=e/100),`rgba(${t},${r},${o},${e})`}function CT({node:n}){const e=xT(),{text:t}=n.attrs,r=x.useMemo(()=>{const s="rgb(254, 242, 237)";return e==="dark"?ST(s,.75):s},[e]),o=x.useMemo(()=>{try{return Xh.renderToString(`${t}`)}catch{return t}},[t]),i=x.useMemo(()=>t.trim()?p.jsx("span",{contentEditable:!1,dangerouslySetInnerHTML:{__html:o}}):p.jsx("span",{contentEditable:!1,children:"Not enter a formula"}),[t,o]);return p.jsx(hn,{style:{display:"inline-block",backgroundColor:r},as:"span",children:i})}function kT(n){return e=>e.getAttribute(n)}const za=et.create({name:"katex",group:"inline",inline:!0,defining:!0,draggable:!0,selectable:!0,addOptions(){return{HTMLAttributes:{class:"katex"},button:({editor:n,t:e})=>({component:vT,componentProps:{editor:n,action:()=>!0,isActive:()=>!1,disabled:!1,icon:"KatexIcon",tooltip:e("editor.katex.tooltip")}})}},addAttributes(){return{text:{default:"",parseHTML:kT("text")},defaultShowPicker:{default:!1}}},parseHTML(){return[{tag:"span.katex"}]},renderHTML({HTMLAttributes:n}){return["span",Ke(this.options&&this.options.HTMLAttributes||{},n)]},addCommands(){return{setKatex:n=>({commands:e})=>e.insertContent({type:this.name,attrs:n})}},addInputRules(){return[gi({find:/^\$katex\$$/,type:this.type,getAttributes:()=>({defaultShowPicker:!0})})]},addNodeView(){return pn(CT)}});function TT({selectImage:n,giphyApiKey:e,children:t}){const[r,o]=x.useState([]),[i]=x.useState(15),s=x.useRef(null),l=(c,u="search")=>{if(!e)return;const f=`${u==="search"?`https://api.giphy.com/v1/gifs/search?q=${c}`:`https://api.giphy.com/v1/gifs/trending?q=${c}`}&limit=${i}&api_key=${e}`;fetch(f).then(h=>h.json()).then(h=>{o(h.data)}).catch(h=>{console.log(h)})};x.useEffect(()=>{l("","trend")},[]);const a=x.useCallback(bi(c=>{if(!c.target.value){l("","trend");return}l(c.target.value)},350),[]);return p.jsxs(Pn,{modal:!0,children:[p.jsx(Ln,{asChild:!0,children:t}),p.jsx(mn,{align:"start",className:"size-full p-2",hideWhenDetached:!0,side:"bottom",children:e?p.jsxs(p.Fragment,{children:[p.jsx("div",{className:"mb-[10px] w-full",children:p.jsx(Rt,{onChange:a,placeholder:"Search GIF",ref:s,type:"text"})}),p.jsx("div",{className:"max-h-[280px] overflow-y-auto",children:p.jsx("div",{className:"grid grid-cols-2 gap-1 ",children:r!=null&&r.length?r==null?void 0:r.map(c=>p.jsx("img",{alt:"giphy",className:"cursor-pointer text-center",height:c.images.fixed_width_downsampled.height,onClick:()=>n(c),src:c.images.fixed_width_downsampled.url,width:c.images.fixed_width_downsampled.width},`giphy-${c.id}`)):p.jsx("p",{children:"No GIFs found"})})})]}):p.jsx("div",{children:p.jsx("p",{children:"Missing Giphy API Key"})})})]})}function MT({editor:n,icon:e,giphyApiKey:t,...r}){const o=i=>{const{url:s}=i.images.original;n.chain().focus().setImageGif({src:s}).run()};return p.jsx(TT,{giphyApiKey:t,selectImage:o,children:p.jsx(St,{icon:e,tooltip:r==null?void 0:r.tooltip})})}const So={TOP_LEFT:"tl",TOP_RIGHT:"tr",BOTTOM_LEFT:"bl",BOTTOM_RIGHT:"br"};function ET(n){var C,N;const[e,t]=x.useState({width:oe.IMAGE_MAX_SIZE,height:oe.IMAGE_MAX_SIZE}),[r,o]=x.useState({width:0,height:0}),[i]=x.useState([So.TOP_LEFT,So.TOP_RIGHT,So.BOTTOM_LEFT,So.BOTTOM_RIGHT]),[s,l]=x.useState(!1),[a,c]=x.useState({x:0,y:0,w:0,h:0,dir:""}),{align:u}=(C=n==null?void 0:n.node)==null?void 0:C.attrs,d=x.useMemo(()=>{var j;const{src:E,alt:k,width:A,height:L}=(j=n==null?void 0:n.node)==null?void 0:j.attrs,I=Zo(A)?`${A}px`:A,D=Zo(L)?`${L}px`:L;return{src:E||void 0,alt:k||void 0,style:{width:I||void 0,height:D||void 0}}},[(N=n==null?void 0:n.node)==null?void 0:N.attrs]),f=x.useMemo(()=>{const{style:{width:E}}=d;return{width:E==="100%"?E:void 0}},[d]);function h(E){o({width:E.target.width,height:E.target.height})}function m(){const{editor:E,getPos:k}=n;E.commands.setNodeSelection(k())}const g=x.useCallback(qt(()=>{const{editor:E}=n,{width:k}=getComputedStyle(E.view.dom);t(A=>({...A,width:Number.parseInt(k,10)}))},oe.IMAGE_THROTTLE_WAIT_TIME),[n==null?void 0:n.editor]);function y(E,k){E.preventDefault(),E.stopPropagation();const A=r.width,L=r.height,I=A/L;let D=Number(n.node.attrs.width),j=Number(n.node.attrs.height);const P=e.width;D&&!j?(D=D>P?P:D,j=Math.round(D/I)):j&&!D?(D=Math.round(j*I),D=D>P?P:D):!D&&!j?(D=A>P?P:A,j=Math.round(D/I)):D=D>P?P:D,l(!0),c({x:E.clientX,y:E.clientY,w:D,h:j,dir:k})}const b=x.useCallback(qt(E=>{if(E.preventDefault(),E.stopPropagation(),!s)return;const{x:k,w:A,dir:L}=a,I=(E.clientX-k)*(/l/.test(L)?-1:1),D=Vm(A+I,oe.IMAGE_MIN_SIZE,e.width);n.updateAttributes({width:D,height:null})},oe.IMAGE_THROTTLE_WAIT_TIME),[s,a,e,n.updateAttributes]),w=x.useCallback(E=>{E.preventDefault(),E.stopPropagation(),s&&(c({x:0,y:0,w:0,h:0,dir:""}),l(!1),m())},[s,m]),v=x.useCallback(()=>{document==null||document.addEventListener("mousemove",b,!0),document==null||document.addEventListener("mouseup",w,!0)},[b,w]),S=x.useCallback(()=>{document==null||document.removeEventListener("mousemove",b,!0),document==null||document.removeEventListener("mouseup",w,!0)},[b,w]);x.useEffect(()=>(s?v():S(),()=>{S()}),[s,v,S]);const O=x.useMemo(()=>new ResizeObserver(()=>g()),[g]);return x.useEffect(()=>(O.observe(n.editor.view.dom),()=>{O.disconnect()}),[n.editor.view.dom,O]),p.jsx(hn,{className:"image-view",style:{...f,width:"100%",textAlign:u},children:p.jsxs("div",{"data-drag-handle":!0,draggable:"true",style:f,className:`image-view__body ${n!=null&&n.selected?"image-view__body--focused":""} ${s?"image-view__body--resizing":""}`,children:[p.jsx("img",{alt:d.alt,className:"image-view__body__image block",height:"auto",onClick:m,onLoad:h,src:d.src,style:d.style}),(n==null?void 0:n.editor.view.editable)&&((n==null?void 0:n.selected)||s)&&p.jsx("div",{className:"image-resizer",children:i==null?void 0:i.map(E=>p.jsx("span",{className:`image-resizer__handler image-resizer__handler--${E}`,onMouseDown:k=>y(k,E)},`image-dir-${E}`))})]})})}const OT=Si.extend({name:"imageGif",addOptions(){var n;return{...(n=this.parent)==null?void 0:n.call(this),inline:!1,content:"",marks:"",group:"block",GIPHY_API_KEY:"",draggable:!1,selectable:!0,atom:!0,button:({editor:e,extension:t,t:r})=>{var i;const o=((i=t==null?void 0:t.options)==null?void 0:i.GIPHY_API_KEY)||"";return{component:MT,componentProps:{editor:e,action:()=>{},isActive:()=>!1,disabled:!1,icon:"GifIcon",tooltip:r("editor.imageGif.tooltip"),giphyApiKey:o}}}}},addAttributes(){var n;return{...(n=this.parent)==null?void 0:n.call(this),width:{default:null,parseHTML:e=>{const t=e.style.width||e.getAttribute("width")||"10";return t===void 0?null:Number.parseInt(`${t}`,10)},renderHTML:e=>({width:e.width})},align:{default:"center",parseHTML:e=>e.getAttribute("align"),renderHTML:e=>({align:e.align})}}},addNodeView(){return pn(ET)},addCommands(){var n;return{...(n=this.parent)==null?void 0:n.call(this),setImageGif:e=>({commands:t})=>t.insertContent({type:this.name,attrs:e}),updateImageGif:e=>({commands:t})=>t.updateAttributes(this.name,e),setAlignImageGif:e=>({commands:t})=>t.updateAttributes(this.name,{align:e})}},renderHTML({HTMLAttributes:n}){const{align:e}=n;return["div",{style:e?`text-align: ${e};`:"",class:"imageGIf"},["img",Ke({height:"auto"},this.options.HTMLAttributes,n)]]},parseHTML(){return[{tag:"div[class=imageGIf]",getAttrs:n=>{const e=n.querySelector("img"),t=e==null?void 0:e.getAttribute("width");return{src:e==null?void 0:e.getAttribute("src"),alt:e==null?void 0:e.getAttribute("alt"),title:e==null?void 0:e.getAttribute("title"),width:t?Number.parseInt(t,10):null,align:(e==null?void 0:e.getAttribute("align"))||n.style.textAlign||null}}}]}}),Co="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",AT=n=>{n=n.replace(/\r\n/g,`