@ibiz-template-plugin/ai-chat 0.0.63 → 0.0.65
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.es.js +1818 -1810
- package/dist/index.legacy.js +1 -1
- package/dist/style.css +1 -1
- package/dist/types/components/common/switch/switch.d.ts +2 -3
- package/dist/types/entity/ai-agent/ai-agent.d.ts +3 -3
- package/dist/types/interface/i-ai-agent/i-ai-agent.d.ts +2 -2
- package/dist/types/interface/i-chat-options/i-chat-options.d.ts +2 -2
- package/package.json +2 -2
package/dist/index.legacy.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(){function e(e,n,r,i){var a=t(o(1&i?e.prototype:e),n,r);return 2&i&&"function"==typeof a?function(e){return a.apply(r,e)}:a}function t(){return t="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=o(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},t.apply(null,arguments)}function n(e){var t="function"==typeof Map?new Map:void 0;return n=function(e){if(null===e||!function(e){try{return-1!==Function.toString.call(e).indexOf("[native code]")}catch(t){return"function"==typeof e}}(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return function(e,t,n){if(i())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,t);var o=new(e.bind.apply(e,r));return n&&s(o,n.prototype),o}(e,arguments,o(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),s(n,e)},n(e)}function r(e,t,n){return t=o(t),function(e,t){if(t&&("object"==N(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,i()?Reflect.construct(t,n||[],o(e).constructor):t.apply(e,n))}function i(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(i=function(){return!!e})()}function o(e){return o=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},o(e)}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&s(e,t)}function s(e,t){return s=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},s(e,t)}function c(e){return function(e){if(Array.isArray(e))return w(e)}(e)||l(e)||k(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function l(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function u(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=k(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function d(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function h(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?d(Object(n),!0).forEach(function(t){_(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):d(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function f(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",i=n.toStringTag||"@@toStringTag";function o(n,r,i,o){var c=r&&r.prototype instanceof s?r:s,l=Object.create(c.prototype);return p(l,"_invoke",function(n,r,i){var o,s,c,l=0,u=i||[],d=!1,h={p:0,n:0,v:e,a:f,f:f.bind(e,4),d:function(t,n){return o=t,s=0,c=e,h.n=n,a}};function f(n,r){for(s=n,c=r,t=0;!d&&l&&!i&&t<u.length;t++){var i,o=u[t],f=h.p,p=o[2];n>3?(i=p===r)&&(c=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=e):o[0]<=f&&((i=n<2&&f<o[1])?(s=0,h.v=r,h.n=o[1]):f<p&&(i=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,h.n=p,s=0))}if(i||n>1)return a;throw d=!0,r}return function(i,u,p){if(l>1)throw TypeError("Generator is already running");for(d&&1===u&&f(u,p),s=u,c=p;(t=s<2?e:c)||!d;){o||(s?s<3?(s>1&&(h.n=-1),f(s,c)):h.n=c:h.v=c);try{if(l=2,o){if(s||(i="next"),t=o[i]){if(!(t=t.call(o,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,s<2&&(s=0)}else 1===s&&(t=o.return)&&t.call(o),s<2&&(c=TypeError("The iterator does not provide a '"+i+"' method"),s=1);o=e}else if((t=(d=h.n<0)?c:n.call(r,h))!==a)break}catch(t){o=e,s=1,c=t}finally{l=1}}return{value:t,done:d}}}(n,i,o),!0),l}var a={};function s(){}function c(){}function l(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(p(t={},r,function(){return this}),t),d=l.prototype=s.prototype=Object.create(u);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,l):(e.__proto__=l,p(e,i,"GeneratorFunction")),e.prototype=Object.create(d),e}return c.prototype=l,p(d,"constructor",l),p(l,"constructor",c),c.displayName="GeneratorFunction",p(l,i,"GeneratorFunction"),p(d),p(d,i,"Generator"),p(d,r,function(){return this}),p(d,"toString",function(){return"[object Generator]"}),(f=function(){return{w:o,m:h}})()}function p(e,t,n,r){var i=Object.defineProperty;try{i({},"",{})}catch(e){i=0}p=function(e,t,n,r){function o(t,n){p(e,t,function(e){return this._invoke(t,n,e)})}t?i?i(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},p(e,t,n,r)}function v(e,t,n,r,i,o,a){try{var s=e[o](a),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,i)}function m(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(e){v(o,r,i,a,s,"next",e)}function s(e){v(o,r,i,a,s,"throw",e)}a(void 0)})}}function g(e,t){return b(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,s=[],c=!0,l=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw i}}return s}}(e,t)||k(e,t)||y()}function y(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function k(e,t){if(e){if("string"==typeof e)return w(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?w(e,t):void 0}}function w(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function b(e){if(Array.isArray(e))return e}function x(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function C(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,M(r.key),r)}}function S(e,t,n){return t&&C(e.prototype,t),n&&C(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function _(e,t,n){return(t=M(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function M(e){var t=function(e,t){if("object"!=N(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=N(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==N(t)?t:t+""}function N(e){return N="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},N(e)}System.register(["interactjs","cherry-markdown","lodash-es","qx-util"],function(t,i){"use strict";var o,s,d,p;return{setters:[function(e){o=e.default},function(e){s=e.default},function(e){d=e.cloneDeep},function(e){p=e.QXEvent}],execute:function(){var i,v,w,C,M,T,O,E,A,D,I,z,R,P={},L=[],B=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,V=Array.isArray;function F(e,t){for(var n in t)e[n]=t[n];return e}function j(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function $(e,t,n){var r,o,a,s={};for(a in t)"key"==a?r=t[a]:"ref"==a?o=t[a]:s[a]=t[a];if(arguments.length>2&&(s.children=arguments.length>3?i.call(arguments,2):n),"function"==typeof e&&null!=e.defaultProps)for(a in e.defaultProps)void 0===s[a]&&(s[a]=e.defaultProps[a]);return H(e,s,r,o,null)}function H(e,t,n,r,i){var o={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:null==i?++w:i,__i:-1,__u:0};return null==i&&null!=v.vnode&&v.vnode(o),o}function W(e){return e.children}function q(e,t){this.props=e,this.context=t}function U(e,t){if(null==t)return e.__?U(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e)return n.__e;return"function"==typeof e.type?U(e):null}function K(e){var t,n;if(null!=(e=e.__)&&null!=e.__c){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e){e.__e=e.__c.base=n.__e;break}return K(e)}}function J(e){(!e.__d&&(e.__d=!0)&&M.push(e)&&!G.__r++||T!=v.debounceRendering)&&((T=v.debounceRendering)||O)(G)}function G(){for(var e,t,n,r,i,o,a,s=1;M.length;)M.length>s&&M.sort(E),e=M.shift(),s=M.length,e.__d&&(n=void 0,r=void 0,i=(r=(t=e).__v).__e,o=[],a=[],t.__P&&((n=F({},r)).__v=r.__v+1,v.vnode&&v.vnode(n),re(t.__P,n,r,t.__n,t.__P.namespaceURI,32&r.__u?[i]:null,o,null==i?U(r):i,!!(32&r.__u),a),n.__v=r.__v,n.__.__k[n.__i]=n,oe(o,n,a),r.__e=r.__=null,n.__e!=i&&K(n)));G.__r=0}function X(e,t,n,r,i,o,a,s,c,l,u){var d,h,f,p,v,m,g,y=r&&r.__k||L,k=t.length;for(c=function(e,t,n,r,i){var o,a,s,c,l,u=n.length,d=u,h=0;for(e.__k=new Array(i),o=0;o<i;o++)null!=(a=t[o])&&"boolean"!=typeof a&&"function"!=typeof a?(c=o+h,(a=e.__k[o]="string"==typeof a||"number"==typeof a||"bigint"==typeof a||a.constructor==String?H(null,a,null,null,null):V(a)?H(W,{children:a},null,null,null):null==a.constructor&&a.__b>0?H(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):a).__=e,a.__b=e.__b+1,s=null,-1!=(l=a.__i=Q(a,n,c,d))&&(d--,(s=n[l])&&(s.__u|=2)),null==s||null==s.__v?(-1==l&&(i>u?h--:i<u&&h++),"function"!=typeof a.type&&(a.__u|=4)):l!=c&&(l==c-1?h--:l==c+1?h++:(l>c?h--:h++,a.__u|=4))):e.__k[o]=null;if(d)for(o=0;o<u;o++)null!=(s=n[o])&&!(2&s.__u)&&(s.__e==r&&(r=U(s)),le(s,s));return r}(n,t,y,c,k),d=0;d<k;d++)null!=(f=n.__k[d])&&(h=-1==f.__i?P:y[f.__i]||P,f.__i=d,m=re(e,f,h,i,o,a,s,c,l,u),p=f.__e,f.ref&&h.ref!=f.ref&&(h.ref&&ce(h.ref,null,f),u.push(f.ref,f.__c||p,f)),null==v&&null!=p&&(v=p),(g=!!(4&f.__u))||h.__k===f.__k?c=Y(f,c,e,g):"function"==typeof f.type&&void 0!==m?c=m:p&&(c=p.nextSibling),f.__u&=-7);return n.__e=v,c}function Y(e,t,n,r){var i,o;if("function"==typeof e.type){for(i=e.__k,o=0;i&&o<i.length;o++)i[o]&&(i[o].__=e,t=Y(i[o],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=U(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do{t=t&&t.nextSibling}while(null!=t&&8==t.nodeType);return t}function Z(e,t){return t=t||[],null==e||"boolean"==typeof e||(V(e)?e.some(function(e){Z(e,t)}):t.push(e)),t}function Q(e,t,n,r){var i,o,a,s=e.key,c=e.type,l=t[n],u=null!=l&&!(2&l.__u);if(null===l&&null==e.key||u&&s==l.key&&c==l.type)return n;if(r>(u?1:0))for(i=n-1,o=n+1;i>=0||o<t.length;)if(null!=(l=t[a=i>=0?i--:o++])&&!(2&l.__u)&&s==l.key&&c==l.type)return a;return-1}function ee(e,t,n){"-"==t[0]?e.setProperty(t,null==n?"":n):e[t]=null==n?"":"number"!=typeof n||B.test(t)?n:n+"px"}function te(e,t,n,r,i){var o,a;e:if("style"==t)if("string"==typeof n)e.style.cssText=n;else{if("string"==typeof r&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||ee(e.style,t,"");if(n)for(t in n)r&&n[t]==r[t]||ee(e.style,t,n[t])}else if("o"==t[0]&&"n"==t[1])o=t!=(t=t.replace(A,"$1")),a=t.toLowerCase(),t=a in e||"onFocusOut"==t||"onFocusIn"==t?a.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+o]=n,n?r?n.u=r.u:(n.u=D,e.addEventListener(t,o?z:I,o)):e.removeEventListener(t,o?z:I,o);else{if("http://www.w3.org/2000/svg"==i)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!=t&&"height"!=t&&"href"!=t&&"list"!=t&&"form"!=t&&"tabIndex"!=t&&"download"!=t&&"rowSpan"!=t&&"colSpan"!=t&&"role"!=t&&"popover"!=t&&t in e)try{e[t]=null==n?"":n;break e}catch(e){}"function"==typeof n||(null==n||!1===n&&"-"!=t[4]?e.removeAttribute(t):e.setAttribute(t,"popover"==t&&1==n?"":n))}}function ne(e){return function(t){if(this.l){var n=this.l[t.type+e];if(null==t.t)t.t=D++;else if(t.t<n.u)return;return n(v.event?v.event(t):t)}}}function re(e,t,n,r,i,o,a,s,c,l){var u,d,h,f,p,m,g,y,k,w,b,x,C,S,_,M,N,T=t.type;if(null!=t.constructor)return null;128&n.__u&&(c=!!(32&n.__u),o=[s=t.__e=n.__e]),(u=v.__b)&&u(t);e:if("function"==typeof T)try{if(y=t.props,k="prototype"in T&&T.prototype.render,w=(u=T.contextType)&&r[u.__c],b=u?w?w.props.value:u.__:r,n.__c?g=(d=t.__c=n.__c).__=d.__E:(k?t.__c=d=new T(y,b):(t.__c=d=new q(y,b),d.constructor=T,d.render=ue),w&&w.sub(d),d.props=y,d.state||(d.state={}),d.context=b,d.__n=r,h=d.__d=!0,d.__h=[],d._sb=[]),k&&null==d.__s&&(d.__s=d.state),k&&null!=T.getDerivedStateFromProps&&(d.__s==d.state&&(d.__s=F({},d.__s)),F(d.__s,T.getDerivedStateFromProps(y,d.__s))),f=d.props,p=d.state,d.__v=t,h)k&&null==T.getDerivedStateFromProps&&null!=d.componentWillMount&&d.componentWillMount(),k&&null!=d.componentDidMount&&d.__h.push(d.componentDidMount);else{if(k&&null==T.getDerivedStateFromProps&&y!==f&&null!=d.componentWillReceiveProps&&d.componentWillReceiveProps(y,b),!d.__e&&null!=d.shouldComponentUpdate&&!1===d.shouldComponentUpdate(y,d.__s,b)||t.__v==n.__v){for(t.__v!=n.__v&&(d.props=y,d.state=d.__s,d.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(e){e&&(e.__=t)}),x=0;x<d._sb.length;x++)d.__h.push(d._sb[x]);d._sb=[],d.__h.length&&a.push(d);break e}null!=d.componentWillUpdate&&d.componentWillUpdate(y,d.__s,b),k&&null!=d.componentDidUpdate&&d.__h.push(function(){d.componentDidUpdate(f,p,m)})}if(d.context=b,d.props=y,d.__P=e,d.__e=!1,C=v.__r,S=0,k){for(d.state=d.__s,d.__d=!1,C&&C(t),u=d.render(d.props,d.state,d.context),_=0;_<d._sb.length;_++)d.__h.push(d._sb[_]);d._sb=[]}else do{d.__d=!1,C&&C(t),u=d.render(d.props,d.state,d.context),d.state=d.__s}while(d.__d&&++S<25);d.state=d.__s,null!=d.getChildContext&&(r=F(F({},r),d.getChildContext())),k&&!h&&null!=d.getSnapshotBeforeUpdate&&(m=d.getSnapshotBeforeUpdate(f,p)),M=u,null!=u&&u.type===W&&null==u.key&&(M=ae(u.props.children)),s=X(e,V(M)?M:[M],t,n,r,i,o,a,s,c,l),d.base=t.__e,t.__u&=-161,d.__h.length&&a.push(d),g&&(d.__E=d.__=null)}catch(e){if(t.__v=null,c||null!=o)if(e.then){for(t.__u|=c?160:128;s&&8==s.nodeType&&s.nextSibling;)s=s.nextSibling;o[o.indexOf(s)]=null,t.__e=s}else{for(N=o.length;N--;)j(o[N]);ie(t)}else t.__e=n.__e,t.__k=n.__k,e.then||ie(t);v.__e(e,t,n)}else null==o&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=se(n.__e,t,n,r,i,o,a,c,l);return(u=v.diffed)&&u(t),128&t.__u?void 0:s}function ie(e){e&&e.__c&&(e.__c.__e=!0),e&&e.__k&&e.__k.forEach(ie)}function oe(e,t,n){for(var r=0;r<n.length;r++)ce(n[r],n[++r],n[++r]);v.__c&&v.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){v.__e(e,t.__v)}})}function ae(e){return"object"!=N(e)||null==e||e.__b&&e.__b>0?e:V(e)?e.map(ae):F({},e)}function se(e,t,n,r,o,a,s,c,l){var u,d,h,f,p,m,g,y=n.props,k=t.props,w=t.type;if("svg"==w?o="http://www.w3.org/2000/svg":"math"==w?o="http://www.w3.org/1998/Math/MathML":o||(o="http://www.w3.org/1999/xhtml"),null!=a)for(u=0;u<a.length;u++)if((p=a[u])&&"setAttribute"in p==!!w&&(w?p.localName==w:3==p.nodeType)){e=p,a[u]=null;break}if(null==e){if(null==w)return document.createTextNode(k);e=document.createElementNS(o,w,k.is&&k),c&&(v.__m&&v.__m(t,a),c=!1),a=null}if(null==w)y===k||c&&e.data==k||(e.data=k);else{if(a=a&&i.call(e.childNodes),y=n.props||P,!c&&null!=a)for(y={},u=0;u<e.attributes.length;u++)y[(p=e.attributes[u]).name]=p.value;for(u in y)if(p=y[u],"children"==u);else if("dangerouslySetInnerHTML"==u)h=p;else if(!(u in k)){if("value"==u&&"defaultValue"in k||"checked"==u&&"defaultChecked"in k)continue;te(e,u,null,p,o)}for(u in k)p=k[u],"children"==u?f=p:"dangerouslySetInnerHTML"==u?d=p:"value"==u?m=p:"checked"==u?g=p:c&&"function"!=typeof p||y[u]===p||te(e,u,p,y[u],o);if(d)c||h&&(d.__html==h.__html||d.__html==e.innerHTML)||(e.innerHTML=d.__html),t.__k=[];else if(h&&(e.innerHTML=""),X("template"==t.type?e.content:e,V(f)?f:[f],t,n,r,"foreignObject"==w?"http://www.w3.org/1999/xhtml":o,a,s,a?a[0]:n.__k&&U(n,0),c,l),null!=a)for(u=a.length;u--;)j(a[u]);c||(u="value","progress"==w&&null==m?e.removeAttribute("value"):null!=m&&(m!==e[u]||"progress"==w&&!m||"option"==w&&m!=y[u])&&te(e,u,m,y[u],o),u="checked",null!=g&&g!=e[u]&&te(e,u,g,y[u],o))}return e}function ce(e,t,n){try{if("function"==typeof e){var r="function"==typeof e.__u;r&&e.__u(),r&&null==t||(e.__u=e(t))}else e.current=t}catch(e){v.__e(e,n)}}function le(e,t,n){var r,i;if(v.unmount&&v.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||ce(r,null,t)),null!=(r=e.__c)){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){v.__e(e,t)}r.base=r.__P=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&le(r[i],t,n||"function"!=typeof e.type);n||j(e.__e),e.__c=e.__=e.__e=void 0}function ue(e,t,n){return this.constructor(e,n)}function de(e,t,n){var r,o,a,s;t==document&&(t=document.documentElement),v.__&&v.__(e,t),o=(r="function"==typeof n)?null:n&&n.__k||t.__k,a=[],s=[],re(t,e=(!r&&n||t).__k=$(W,null,[e]),o||P,P,t.namespaceURI,!r&&n?[n]:o?null:t.firstChild?i.call(t.childNodes):null,a,!r&&n?n:o?o.__e:t.firstChild,r,s),oe(a,e,s)}i=L.slice,v={__e:function(e,t,n,r){for(var i,o,a;t=t.__;)if((i=t.__c)&&!i.__)try{if((o=i.constructor)&&null!=o.getDerivedStateFromError&&(i.setState(o.getDerivedStateFromError(e)),a=i.__d),null!=i.componentDidCatch&&(i.componentDidCatch(e,r||{}),a=i.__d),a)return i.__E=i}catch(t){e=t}throw e}},w=0,C=function(e){return null!=e&&null==e.constructor},q.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!=this.state?this.__s:this.__s=F({},this.state),"function"==typeof e&&(e=e(F({},n),this.props)),e&&F(n,e),null!=e&&this.__v&&(t&&this._sb.push(t),J(this))},q.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),J(this))},q.prototype.render=W,M=[],O="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,E=function(e,t){return e.__v.__b-t.__v.__b},G.__r=0,A=/(PointerCapture)$|Capture$/i,D=0,I=ne(!1),z=ne(!0),R=0;var he=0;function fe(e,t,n,r,i,o){t||(t={});var a,s,c=t;if("ref"in c)for(s in c={},t)"ref"==s?a=t[s]:c[s]=t[s];var l={type:e,props:c,key:n,ref:a,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--he,__i:-1,__u:0,__source:i,__self:o};if("function"==typeof e&&(a=e.defaultProps))for(s in a)void 0===c[s]&&(c[s]=a[s]);return v.vnode&&v.vnode(l),l}function pe(e,t,n,r,i){var o="".concat(e,"-").concat(t);return n&&(o+="-".concat(n)),r&&(o+="__".concat(r)),i&&(o+="--".concat(i)),o}var ve=function(){return S(function e(t,n){x(this,e),_(this,"namespace",void 0),this.block=t,this.namespace=n||"ibiz"},[{key:"b",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return pe(this.namespace,this.block,e,"","")}},{key:"e",value:function(e){return e?pe(this.namespace,this.block,"",e,""):""}},{key:"m",value:function(e){return e?pe(this.namespace,this.block,"","",e):""}},{key:"be",value:function(e,t){return e&&t?pe(this.namespace,this.block,e,t,""):""}},{key:"em",value:function(e,t){return e&&t?pe(this.namespace,this.block,"",e,t):""}},{key:"bm",value:function(e,t){return e&&t?pe(this.namespace,this.block,e,"",t):""}},{key:"bem",value:function(e,t,n){return e&&t&&n?pe(this.namespace,this.block,e,t,n):""}},{key:"is",value:function(e,t){return e&&t?"".concat("is-").concat(e):""}},{key:"cssVar",value:function(e){var t={};for(var n in e)e[n]&&(t[this.cssVarName(n)]=e[n]);return t}},{key:"cssVarBlock",value:function(e){var t={};for(var n in e)e[n]&&(t[this.cssVarBlockName(n)]=e[n]);return t}},{key:"cssVarName",value:function(e){return"--".concat(this.namespace,"-").concat(e)}},{key:"cssVarBlockName",value:function(e){return"--".concat(this.namespace,"-").concat(this.block,"-").concat(e)}}])}();function me(e){if("string"!=typeof e)throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}function ge(e,t){for(var n,r="",i=0,o=-1,a=0,s=0;s<=e.length;++s){if(s<e.length)n=e.charCodeAt(s);else{if(47===n)break;n=47}if(47===n){if(o===s-1||1===a);else if(o!==s-1&&2===a){if(r.length<2||2!==i||46!==r.charCodeAt(r.length-1)||46!==r.charCodeAt(r.length-2))if(r.length>2){var c=r.lastIndexOf("/");if(c!==r.length-1){-1===c?(r="",i=0):i=(r=r.slice(0,c)).length-1-r.lastIndexOf("/"),o=s,a=0;continue}}else if(2===r.length||1===r.length){r="",i=0,o=s,a=0;continue}t&&(r.length>0?r+="/..":r="..",i=2)}else r.length>0?r+="/"+e.slice(o+1,s):r=e.slice(o+1,s),i=s-o-1;o=s,a=0}else 46===n&&-1!==a?++a:a=-1}return r}var ye={resolve:function(){for(var e,t="",n=!1,r=arguments.length-1;r>=-1&&!n;r--){var i;r>=0?i=arguments[r]:(void 0===e&&(e=process.cwd()),i=e),me(i),0!==i.length&&(t=i+"/"+t,n=47===i.charCodeAt(0))}return t=ge(t,!n),n?t.length>0?"/"+t:"/":t.length>0?t:"."},normalize:function(e){if(me(e),0===e.length)return".";var t=47===e.charCodeAt(0),n=47===e.charCodeAt(e.length-1);return 0!==(e=ge(e,!t)).length||t||(e="."),e.length>0&&n&&(e+="/"),t?"/"+e:e},isAbsolute:function(e){return me(e),e.length>0&&47===e.charCodeAt(0)},join:function(){if(0===arguments.length)return".";for(var e,t=0;t<arguments.length;++t){var n=arguments[t];me(n),n.length>0&&(void 0===e?e=n:e+="/"+n)}return void 0===e?".":ye.normalize(e)},relative:function(e,t){if(me(e),me(t),e===t)return"";if((e=ye.resolve(e))===(t=ye.resolve(t)))return"";for(var n=1;n<e.length&&47===e.charCodeAt(n);++n);for(var r=e.length,i=r-n,o=1;o<t.length&&47===t.charCodeAt(o);++o);for(var a=t.length-o,s=i<a?i:a,c=-1,l=0;l<=s;++l){if(l===s){if(a>s){if(47===t.charCodeAt(o+l))return t.slice(o+l+1);if(0===l)return t.slice(o+l)}else i>s&&(47===e.charCodeAt(n+l)?c=l:0===l&&(c=0));break}var u=e.charCodeAt(n+l);if(u!==t.charCodeAt(o+l))break;47===u&&(c=l)}var d="";for(l=n+c+1;l<=r;++l)l!==r&&47!==e.charCodeAt(l)||(0===d.length?d+="..":d+="/..");return d.length>0?d+t.slice(o+c):(o+=c,47===t.charCodeAt(o)&&++o,t.slice(o))},_makeLong:function(e){return e},dirname:function(e){if(me(e),0===e.length)return".";for(var t=e.charCodeAt(0),n=47===t,r=-1,i=!0,o=e.length-1;o>=1;--o)if(47===(t=e.charCodeAt(o))){if(!i){r=o;break}}else i=!1;return-1===r?n?"/":".":n&&1===r?"//":e.slice(0,r)},basename:function(e,t){if(void 0!==t&&"string"!=typeof t)throw new TypeError('"ext" argument must be a string');me(e);var n,r=0,i=-1,o=!0;if(void 0!==t&&t.length>0&&t.length<=e.length){if(t.length===e.length&&t===e)return"";var a=t.length-1,s=-1;for(n=e.length-1;n>=0;--n){var c=e.charCodeAt(n);if(47===c){if(!o){r=n+1;break}}else-1===s&&(o=!1,s=n+1),a>=0&&(c===t.charCodeAt(a)?-1===--a&&(i=n):(a=-1,i=s))}return r===i?i=s:-1===i&&(i=e.length),e.slice(r,i)}for(n=e.length-1;n>=0;--n)if(47===e.charCodeAt(n)){if(!o){r=n+1;break}}else-1===i&&(o=!1,i=n+1);return-1===i?"":e.slice(r,i)},extname:function(e){me(e);for(var t=-1,n=0,r=-1,i=!0,o=0,a=e.length-1;a>=0;--a){var s=e.charCodeAt(a);if(47!==s)-1===r&&(i=!1,r=a+1),46===s?-1===t?t=a:1!==o&&(o=1):-1!==t&&(o=-1);else if(!i){n=a+1;break}}return-1===t||-1===r||0===o||1===o&&t===r-1&&t===n+1?"":e.slice(t,r)},format:function(e){if(null===e||"object"!==N(e))throw new TypeError('The "pathObject" argument must be of type Object. Received type '+N(e));return function(e,t){var n=t.dir||t.root,r=t.base||(t.name||"")+(t.ext||"");return n?n===t.root?n+r:n+e+r:r}("/",e)},parse:function(e){me(e);var t={root:"",dir:"",base:"",ext:"",name:""};if(0===e.length)return t;var n,r=e.charCodeAt(0),i=47===r;i?(t.root="/",n=1):n=0;for(var o=-1,a=0,s=-1,c=!0,l=e.length-1,u=0;l>=n;--l)if(47!==(r=e.charCodeAt(l)))-1===s&&(c=!1,s=l+1),46===r?-1===o?o=l:1!==u&&(u=1):-1!==o&&(u=-1);else if(!c){a=l+1;break}return-1===o||-1===s||0===u||1===u&&o===s-1&&o===a+1?-1!==s&&(t.base=t.name=0===a&&i?e.slice(1,s):e.slice(a,s)):(0===a&&i?(t.name=e.slice(1,o),t.base=e.slice(1,s)):(t.name=e.slice(a,o),t.base=e.slice(a,s)),t.ext=e.slice(o,s)),a>0?t.dir=e.slice(0,a-1):i&&(t.dir="/"),t},sep:"/",delimiter:":",win32:null,posix:null};function ke(){return(65536*(1+Math.random())|0).toString(16).substring(1)}function we(){return"".concat(ke()+ke(),"-").concat(ke(),"-").concat(ke(),"-").concat(ke(),"-").concat(ke()).concat(ke()).concat(ke())}function be(e){var t=e.lastIndexOf("@");return-1===t?e:e.substring(0,t)}ye.posix=ye;var xe=/<svg\b[^>]*>[\s\S]*?<\/svg>/;function Ce(e){return xe.test(e)}function Se(e,t){var n="";switch(e){case"TOPIC":n+="topic";break;case"INLINE":n+="inline";break;case"TEMP":n+="temp";break;default:n+="unknow"}return n+="@".concat(t||we(),"@").concat((new Date).getTime())}function _e(e){var t=new URL(e),n={},r={};if(t.searchParams.size>0){var i=t.searchParams.get("srfnavctx");if(i){try{Object.assign(n,JSON.parse(i))}catch(d){console.error("srfnavctx 参数解析失败")}t.searchParams.delete("srfnavctx")}t.searchParams.forEach(function(e,t){r[t]=e})}else if(t.search){var o=function(e){var t={};e.startsWith("?")&&(e=e.substring(1));for(var n=e.split("&"),r=0;r<n.length;r++){var i=g(n[r].split("="),2),o=i[0],a=i[1];t[o]=a}return t}(t.search),a=o.srfnavctx;if(a){try{var s=decodeURIComponent(a);Object.assign(n,JSON.parse(s))}catch(d){console.error("srfnavctx 参数解析失败")}delete o.srfnavctx}Object.keys(o).forEach(function(e){r[e]=o[e]})}var c=g((t.pathname||t.hostname).replace("//","").split("/"),2),l=c[0],u=c[1];return{context:n,params:r,typeId:u||l}}var Me=function(){return S(function e(){x(this,e)},null,[{key:"copy",value:function(e){return this.inputElement||(this.inputElement=document.createElement("input"),this.inputElement.style.position="absolute",this.inputElement.style.left="-9999px",document.body.appendChild(this.inputElement)),this.inputElement.value=e,this.inputElement.select(),document.execCommand("copy")}}])}();_(Me,"inputElement",null);var Ne=function(){function e(){x(this,e)}return S(e,null,[{key:"checkDataBaseExists",value:(u=m(f().m(function e(t){var n,r;return f().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,indexedDB.databases();case 1:return n=e.v,e.a(2,n.some(function(e){return e.name===t}));case 2:return e.p=2,r=e.v,console.error("检查数据库是否存在时出错:",r),e.a(2,!1)}},e,null,[[0,2]])})),function(e){return u.apply(this,arguments)})},{key:"deleteDatabase",value:(l=m(f().m(function t(n){var r,i;return f().w(function(t){for(;;)if(0===t.n)return e.lastLink&&(null===(r=(i=e.lastLink).close)||void 0===r||r.call(i)),t.a(2,new Promise(function(e,t){var r=indexedDB.deleteDatabase(n);r.onsuccess=function(){e(!0)},r.onerror=function(){e(!1)},r.onblocked=function(){console.warn("删除数据库 ".concat(n," 被阻塞,可能有其他连接正在使用该数据库。")),t(new Error("删除数据库 ".concat(n," 被阻塞")))}}))},t)})),function(e){return l.apply(this,arguments)})},{key:"checkTableExists",value:(c=m(f().m(function t(n,r){return f().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,e.checkDataBaseExists(n);case 1:if(t.v){t.n=2;break}return t.a(2,!1);case 2:return t.a(2,new Promise(function(t,i){var o=indexedDB.open(n);o.onupgradeneeded=function(t){e.db=t.target.result,e.version=e.db.version},o.onsuccess=function(n){e.db=n.target.result,e.lastLink=o.result;var i=e.db.objectStoreNames.contains(r);o.result.close(),t(i)},o.onerror=function(e){i(e.target.error)}}))}},t)})),function(e,t){return c.apply(this,arguments)})},{key:"createTable",value:(s=m(f().m(function t(n,r,i){var o,a=arguments;return f().w(function(t){for(;;)if(0===t.n)return o=a.length>3&&void 0!==a[3]&&a[3],t.a(2,new Promise(function(t){var a,s;e.version+=1,e.lastLink&&(null===(a=(s=e.lastLink).close)||void 0===a||a.call(s));var c=indexedDB.open(n,e.version);c.onupgradeneeded=function(t){if(e.db=t.target.result,!e.db.objectStoreNames.contains(r)){var n={};i?n.keyPath=i:o&&(n.autoIncrement=!0),e.db.createObjectStore(r,n)}},c.onsuccess=function(){e.lastLink=c.result,c.result.close(),t(!0)},c.onerror=function(){t(!1)}}))},t)})),function(e,t,n){return s.apply(this,arguments)})},{key:"deleteTable",value:(a=m(f().m(function t(n,r){return f().w(function(t){for(;;)if(0===t.n)return t.a(2,new Promise(function(t){var i,o;e.version+=1,e.lastLink&&(null===(i=(o=e.lastLink).close)||void 0===i||i.call(o));var a=indexedDB.open(n,e.version);a.onupgradeneeded=function(t){e.db=t.target.result,e.lastLink=a.result,e.db.objectStoreNames.contains(r)&&e.db.deleteObjectStore(r)},a.onsuccess=function(n){e.db=n.target.result,e.lastLink=a.result,a.result.close(),t(!0)},a.onerror=function(){a.result.close(),t(!1)}}))},t)})),function(e,t){return a.apply(this,arguments)})},{key:"addData",value:(o=m(f().m(function t(n,r,i){return f().w(function(t){for(;;)if(0===t.n)return t.a(2,new Promise(function(t,o){var a=indexedDB.open(n);a.onsuccess=function(n){if(e.db=n.target.result,e.lastLink=a.result,e.db.objectStoreNames.contains(r)){var o=e.db.transaction([r],"readwrite").objectStore(r).add(i);o.onsuccess=function(e){t(i)},o.onerror=function(){t(null)}}a.result.close()},a.onerror=function(){a.result.close(),o()}}))},t)})),function(e,t,n){return o.apply(this,arguments)})},{key:"deleteData",value:(i=m(f().m(function t(n,r,i){return f().w(function(t){for(;;)if(0===t.n)return t.a(2,new Promise(function(t,o){var a=indexedDB.open(n);a.onsuccess=function(n){if(e.db=n.target.result,e.lastLink=a.result,e.db.objectStoreNames.contains(r)){var o=e.db.transaction([r],"readwrite").objectStore(r).delete(i);o.onsuccess=function(e){t(!0)},o.onerror=function(){t(!1)}}a.result.close()},a.onerror=function(){a.result.close(),o()}}))},t)})),function(e,t,n){return i.apply(this,arguments)})},{key:"updateData",value:(r=m(f().m(function t(n,r,i){return f().w(function(t){for(;;)if(0===t.n)return t.a(2,new Promise(function(t,o){var a=indexedDB.open(n);a.onsuccess=function(n){if(e.db=n.target.result,e.lastLink=a.result,e.db.objectStoreNames.contains(r)){var o=e.db.transaction([r],"readwrite").objectStore(r).put(i);o.onsuccess=function(e){t(i)},o.onerror=function(){t(i)}}a.result.close()},a.onerror=function(){a.result.close(),o()}}))},t)})),function(e,t,n){return r.apply(this,arguments)})},{key:"getData",value:(n=m(f().m(function t(n,r,i){return f().w(function(t){for(;;)if(0===t.n)return t.a(2,new Promise(function(t,o){var a=indexedDB.open(n);a.onsuccess=function(n){if(e.db=n.target.result,e.lastLink=a.result,e.db.objectStoreNames.contains(r)){var s=e.db.transaction([r],"readonly").objectStore(r).get(i);s.onsuccess=function(e){t(s.result)},s.onerror=function(){o(new Error("未找到数据".concat(i)))}}a.result.close()},a.onerror=function(){a.result.close(),o()}}))},t)})),function(e,t,r){return n.apply(this,arguments)})},{key:"getAllData",value:(t=m(f().m(function t(n,r){return f().w(function(t){for(;;)if(0===t.n)return t.a(2,new Promise(function(t,i){var o=indexedDB.open(n);o.onsuccess=function(n){if(e.db=n.target.result,e.lastLink=o.result,e.db.objectStoreNames.contains(r)){var i=e.db.transaction([r],"readonly").objectStore(r).getAll();i.onsuccess=function(e){t(i.result)},i.onerror=function(){t([])}}o.result.close()},o.onerror=function(){o.result.close(),i()}}))},t)})),function(e,n){return t.apply(this,arguments)})}]);var t,n,r,i,o,a,s,c,l,u}();_(Ne,"version",1),_(Ne,"db",null),_(Ne,"lastLink",void 0);var Te=function(){return S(function e(t){x(this,e),_(this,"options",void 0),this.options=h({multiple:!0,accept:"*/*",maxSize:5242880},t)},[{key:"openFilePicker",value:function(){var e=this,t=document.createElement("input");t.type="file",t.multiple=this.options.multiple,t.accept=this.options.accept||"",t.onchange=function(t){var n=Array.from(t.target.files||[]);e.handleFiles(n)},t.click()}},{key:"handleFiles",value:(t=m(f().m(function e(t){var n,r,i,o=this;return f().w(function(e){for(;;)switch(e.n){case 0:if(0!==t.length){e.n=1;break}return e.a(2);case 1:return i=t.filter(function(e){var t,n;return!(o.options.maxSize&&e.size>o.options.maxSize&&(null===(t=(n=o.options).onError)||void 0===t||t.call(n,new Error("文件大小超过限制 (".concat(o.formatSize(e.size)," > ").concat(o.formatSize(o.options.maxSize),")")),e),1))}),null===(n=(r=this.options).onSelect)||void 0===n||n.call(r,i),e.n=2,Promise.all(i.map(function(e){return o.processFile(e)}));case 2:return e.a(2)}},e,this)})),function(e){return t.apply(this,arguments)})},{key:"processFile",value:(e=m(f().m(function e(t){var n,r,i,o,a,s,c,l,u,d=this;return f().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,a=function(e){var n,r;null===(n=(r=d.options).onProgress)||void 0===n||n.call(r,t,e)},e.n=1,this.options.onUpload(t,a);case 1:s=e.v,null===(n=(r=this.options).onProgress)||void 0===n||n.call(r,t,100),null===(i=(o=this.options).onSuccess)||void 0===i||i.call(o,s,t),e.n=3;break;case 2:e.p=2,u=e.v,null===(c=(l=this.options).onError)||void 0===c||c.call(l,u instanceof Error?u:new Error("上传失败"),t);case 3:return e.a(2)}},e,this,[[0,2]])})),function(t){return e.apply(this,arguments)})},{key:"formatSize",value:function(e){if(0===e)return"0 B";var t=Math.floor(Math.log(e)/Math.log(1024));return"".concat((e/Math.pow(1024,t)).toFixed(2)," ").concat(["B","KB","MB","GB"][t])}}]);var e,t}(),Oe=function(){return S(function e(){x(this,e)},null,[{key:"getCdataContent",value:function(e){if(!e)return null;var t=Array.from(e.childNodes).find(function(e){return e.nodeType===e.CDATA_SECTION_NODE});return(null==t?void 0:t.nodeValue)||e.textContent}},{key:"parse",value:function(e){var t=this,n=(new DOMParser).parseFromString(e,"text/xml");return Array.from(n.querySelectorAll("resource")).map(function(e){var n=e.getAttribute("type")||"",r=e.querySelector("data"),i=e.querySelector("metadata");try{var o=t.getCdataContent(r),a=t.getCdataContent(i),s=o?JSON.parse(o):{},c=a?JSON.parse(a):{};return{id:s.id,type:n,data:s,metadata:c}}catch(wt){throw new Error("XML 解析错误: ".concat(wt.message))}})}},{key:"parseMixedContent",value:function(e){var t=/<resources\b[^>]*>[\s\S]*?<\/resources>/i.exec(e);if(!t)return{resources:[],remainingText:e,hasResources:!1};var n=g(t,1)[0],r=t.index,i=r+n.length,o=(e.slice(0,r)+e.slice(i)).replace(/\n/g,"").replace(/(!\[[^\]]*\]\([^)]+\))/g,"\n$1\n").replace(/\n+/g,"\n").replace(/^\n|\n$/g,"");try{return{resources:this.parse(n),remainingText:o,hasResources:!0}}catch(a){return{resources:[],remainingText:o,hasResources:!0,error:"资源解析失败: ".concat(a.message)}}}},{key:"stringify",value:function(e){var t=document.implementation.createDocument(null,null,null),n=t.createElement("resources");n.setAttribute("version","1.0");var r=function(e){return"\n".concat(" ".repeat(e))};return e.forEach(function(e){n.appendChild(t.createTextNode(r(1)));var i=t.createElement("resource");i.setAttribute("type",e.type),i.setAttribute("version","1.0");var o=function(e,n){var i=t.createElement(e);i.appendChild(t.createTextNode(r(2)));var o=t.createCDATASection(JSON.stringify(n));return i.appendChild(o),i.appendChild(t.createTextNode(r(1))),i};i.appendChild(t.createTextNode(r(2))),i.appendChild(o("data",e.data)),i.appendChild(t.createTextNode(r(2))),i.appendChild(o("metadata",e.metadata)),i.appendChild(t.createTextNode(r(1))),n.appendChild(i)}),n.appendChild(t.createTextNode("\n")),t.appendChild(n),(new XMLSerializer).serializeToString(t).replace(/></g,">\n<")}}])}(),Ee=function(){return S(function e(){x(this,e)},null,[{key:"getCdataContent",value:function(e){if(!e)return null;var t=Array.from(e.childNodes).find(function(e){return e.nodeType===e.CDATA_SECTION_NODE});return(null==t?void 0:t.nodeValue)||e.textContent}},{key:"parse",value:function(e){var t=this,n=(new DOMParser).parseFromString(e,"text/xml");return Array.from(n.querySelectorAll("suggestion")).map(function(e){var n=e.getAttribute("type")||"",r=e.querySelector("data"),i=e.querySelector("metadata");try{var o=t.getCdataContent(r),a=t.getCdataContent(i);return{type:n,data:o?JSON.parse(o):{},metadata:a?JSON.parse(a):{}}}catch(wt){throw new Error("XML 解析错误: ".concat(wt.message))}})}},{key:"parseMixedContent",value:function(e){var t=/<suggestions\b[^>]*>[\s\S]*?<\/suggestions>/i.exec(e);if(!t)return{suggestions:[],remainingText:e,hasSuggestions:!1};var n=g(t,1)[0],r=t.index,i=r+n.length,o=(e.slice(0,r)+e.slice(i)).replace(/\n/g,"");try{return{suggestions:this.parse(n),remainingText:o,hasSuggestions:!0}}catch(a){return{suggestions:[],remainingText:o,hasSuggestions:!0,error:"资源解析失败: ".concat(a.message)}}}},{key:"stringify",value:function(e){var t=document.implementation.createDocument(null,null,null),n=t.createElement("suggestions");n.setAttribute("version","1.0");var r=function(e){return"\n".concat(" ".repeat(e))};return e.forEach(function(e){n.appendChild(t.createTextNode(r(1)));var i=t.createElement("suggestion");i.setAttribute("type",e.type),i.setAttribute("version","1.0");var o=function(e,n){var i=t.createElement(e);i.appendChild(t.createTextNode(r(2)));var o=t.createCDATASection(JSON.stringify(n));return i.appendChild(o),i.appendChild(t.createTextNode(r(1))),i};i.appendChild(t.createTextNode(r(2))),i.appendChild(o("data",e.data)),i.appendChild(t.createTextNode(r(2))),i.appendChild(o("metadata",e.metadata)),i.appendChild(t.createTextNode(r(1))),n.appendChild(i)}),n.appendChild(t.createTextNode("\n")),t.appendChild(n),(new XMLSerializer).serializeToString(t).replace(/></g,">\n<")}}])}();function Ae(e){return e.x>=0&&e.x<=1&&e.y>=0&&e.y<=1}function De(e,t,n,r){var i=e/window.innerWidth,o=t/window.innerHeight;return{x:Math.max(0,Math.min(i,1-n)),y:Math.max(0,Math.min(o,1-r))}}var Ie,ze,Re,Pe,Le=function(){return S(function e(){x(this,e)},null,[{key:"parse",value:function(e){var t=!0;-1!==e.indexOf("<tool_call>")&&-1===e.indexOf("</tool_call>")&&(t=!1);var n,r=new RegExp("<tool_call>\\s*({[\\s\\S]*?})\\s*</tool_call>","g"),i=[],o=u(e.matchAll(r));try{for(o.s();!(n=o.n()).done;){var a=n.value;try{var s=JSON.parse(a[1]),c={name:s.name,parameters:s.parameters,error:s.error||!1,type:s.type};if(s.result){var l=s.result;try{["desc_oss_image","fetch_chunks"].includes(s.type)&&(l=JSON.parse(s.result))}catch(d){console.error("解析 ".concat(c.type," 工具调用失败:"),d)}finally{Object.assign(c,{result:l})}}i.push(c)}catch(wt){console.error("解析工具调用失败:",wt)}}}catch(h){o.e(h)}finally{o.f()}return{completed:t,toolCalls:i}}}])}(),Be=function(){return S(function e(){x(this,e)},null,[{key:"parse",value:function(e){var t,n=(e.match(/<chatstep>/g)||[]).length===(e.match(/<\/chatstep>/g)||[]).length,r=new RegExp("<chatstep>\\s*({[\\s\\S]*?})\\s*</chatstep>","g"),i=[],o=u(e.matchAll(r));try{for(o.s();!(t=o.n()).done;){var a=t.value;try{var s=JSON.parse(a[1]),c={title:s.title,content:s.content,status:s.status||"success"};i.push(c)}catch(wt){console.error("解析完整聊天步骤失败:",wt)}}}catch(v){o.e(v)}finally{o.f()}if(!n){for(var l=[],d=0;-1!==(d=e.indexOf("<chatstep>",d));)l.push(d),d+=10;var h=[];for(d=0;-1!==(d=e.indexOf("</chatstep>",d));)h.push(d),d+=11;for(var f=l.filter(function(e){return!h.find(function(t){return t>e})}),p=0;p<f.length;p++)i.push({title:"",content:"",status:"pending"})}return i}}])}(),Ve=function(){return S(function e(){x(this,e)},null,[{key:"parse",value:function(e){var t=[],n=e.indexOf("<chatuiaction>"),r=e.indexOf("</chatuiaction>");if(-1===n||-1===r)return t;var i=e.substring(n,r+17);i=i.replace(/\\r/g,"\r").replace(/\\n/g,"\n");var o,a=new RegExp("<chatuiaction>\\s*({[\\s\\S]*?})\\s*</chatuiaction>","g"),s=u(i.matchAll(a));try{for(s.s();!(o=s.n()).done;){var l=o.value;try{var d=l[1].replace(/\\/g,"").replace(/"\[/g,"[").replace(/\]"/g,"]").replace(/\n/g,""),h=JSON.parse(d);h&&h.content&&h.content.length>0&&(t=c(h.content))}catch(wt){console.error("解析完整聊天界面操作失败:",wt)}}}catch(f){s.e(f)}finally{s.f()}return t}}])}(),Fe=0,je=[],$e=v,He=$e.__b,We=$e.__r,qe=$e.diffed,Ue=$e.__c,Ke=$e.unmount,Je=$e.__;function Ge(e,t){$e.__h&&$e.__h(ze,e,Fe||t),Fe=0;var n=ze.__H||(ze.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function Xe(e){return Fe=1,function(e,t,n){var r=Ge(Ie++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):lt(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);t!==n&&(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=ze,!ze.__f)){var i=function(e,t,n){if(!r.__c.__H)return!0;var i=r.__c.__H.__.filter(function(e){return!!e.__c});if(i.every(function(e){return!e.__N}))return!o||o.call(this,e,t,n);var a=r.__c.props!==e;return i.forEach(function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(a=!0)}}),o&&o.call(this,e,t,n)||a};ze.__f=!0;var o=ze.shouldComponentUpdate,a=ze.componentWillUpdate;ze.componentWillUpdate=function(e,t,n){if(this.__e){var r=o;o=void 0,i(e,t,n),o=r}a&&a.call(this,e,t,n)},ze.shouldComponentUpdate=i}return r.__N||r.__}(lt,e)}function Ye(e,t){var n=Ge(Ie++,3);!$e.__s&&ct(n.__H,t)&&(n.__=e,n.u=t,ze.__H.__h.push(n))}function Ze(e,t){var n=Ge(Ie++,4);!$e.__s&&ct(n.__H,t)&&(n.__=e,n.u=t,ze.__h.push(n))}function Qe(e){return Fe=5,et(function(){return{current:e}},[])}function et(e,t){var n=Ge(Ie++,7);return ct(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function tt(e,t){return Fe=8,et(function(){return e},t)}function nt(e){var t=ze.context[e.__c],n=Ge(Ie++,9);return n.c=e,t?(null==n.__&&(n.__=!0,t.sub(ze)),t.props.value):e.__}function rt(){for(var e;e=je.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(at),e.__H.__h.forEach(st),e.__H.__h=[]}catch(dt){e.__H.__h=[],$e.__e(dt,e.__v)}}$e.__b=function(e){ze=null,He&&He(e)},$e.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Je&&Je(e,t)},$e.__r=function(e){We&&We(e),Ie=0;var t=(ze=e.__c).__H;t&&(Re===ze?(t.__h=[],ze.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.forEach(at),t.__h.forEach(st),t.__h=[],Ie=0)),Re=ze},$e.diffed=function(e){qe&&qe(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==je.push(t)&&Pe===$e.requestAnimationFrame||((Pe=$e.requestAnimationFrame)||ot)(rt)),t.__H.__.forEach(function(e){e.u&&(e.__H=e.u),e.u=void 0})),Re=ze=null},$e.__c=function(e,t){t.some(function(e){try{e.__h.forEach(at),e.__h=e.__h.filter(function(e){return!e.__||st(e)})}catch(ze){t.some(function(e){e.__h&&(e.__h=[])}),t=[],$e.__e(ze,e.__v)}}),Ue&&Ue(e,t)},$e.unmount=function(e){Ke&&Ke(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(e){try{at(e)}catch(e){t=e}}),n.__H=void 0,t&&$e.__e(t,n.__v))};var it="function"==typeof requestAnimationFrame;function ot(e){var t,n=function(){clearTimeout(r),it&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);it&&(t=requestAnimationFrame(n))}function at(e){var t=ze,n=e.__c;"function"==typeof n&&(e.__c=void 0,n()),ze=t}function st(e){var t=ze;e.__c=e.__(),ze=t}function ct(e,t){return!e||e.length!==t.length||t.some(function(t,n){return t!==e[n]})}function lt(e,t){return"function"==typeof t?t(e):t}var ut=Symbol.for("preact-signals");function dt(){if(gt>1)gt--;else{for(var e,t=!1;void 0!==mt;){var n=mt;for(mt=void 0,yt++;void 0!==n;){var r=n.o;if(n.o=void 0,n.f&=-3,!(8&n.f)&&Ct(n))try{n.c()}catch(n){t||(e=n,t=!0)}n=r}}if(yt=0,gt--,t)throw e}}var ht=void 0;function ft(e){var t=ht;ht=void 0;try{return e()}finally{ht=t}}var pt,vt,mt=void 0,gt=0,yt=0,kt=0;function wt(e){if(void 0!==ht){var t=e.n;if(void 0===t||t.t!==ht)return t={i:0,S:e,p:ht.s,n:void 0,t:ht,e:void 0,x:void 0,r:t},void 0!==ht.s&&(ht.s.n=t),ht.s=t,e.n=t,32&ht.f&&e.S(t),t;if(-1===t.i)return t.i=0,void 0!==t.n&&(t.n.p=t.p,void 0!==t.p&&(t.p.n=t.n),t.p=ht.s,t.n=void 0,ht.s.n=t,ht.s=t),t}}function bt(e,t){this.v=e,this.i=0,this.n=void 0,this.t=void 0,this.W=null==t?void 0:t.watched,this.Z=null==t?void 0:t.unwatched,this.name=null==t?void 0:t.name}function xt(e,t){return new bt(e,t)}function Ct(e){for(var t=e.s;void 0!==t;t=t.n)if(t.S.i!==t.i||!t.S.h()||t.S.i!==t.i)return!0;return!1}function St(e){for(var t=e.s;void 0!==t;t=t.n){var n=t.S.n;if(void 0!==n&&(t.r=n),t.S.n=t,t.i=-1,void 0===t.n){e.s=t;break}}}function _t(e){for(var t=e.s,n=void 0;void 0!==t;){var r=t.p;-1===t.i?(t.S.U(t),void 0!==r&&(r.n=t.n),void 0!==t.n&&(t.n.p=r)):n=t,t.S.n=t.r,void 0!==t.r&&(t.r=void 0),t=r}e.s=n}function Mt(e,t){bt.call(this,void 0),this.x=e,this.s=void 0,this.g=kt-1,this.f=4,this.W=null==t?void 0:t.watched,this.Z=null==t?void 0:t.unwatched,this.name=null==t?void 0:t.name}function Nt(e,t){return new Mt(e,t)}function Tt(e){var t=e.u;if(e.u=void 0,"function"==typeof t){gt++;var n=ht;ht=void 0;try{t()}catch(dt){throw e.f&=-2,e.f|=8,Ot(e),dt}finally{ht=n,dt()}}}function Ot(e){for(var t=e.s;void 0!==t;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,Tt(e)}function Et(e){if(ht!==this)throw new Error("Out-of-order effect");_t(this),ht=e,this.f&=-2,8&this.f&&Ot(this),dt()}function At(e,t){this.x=e,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32,this.name=null==t?void 0:t.name}function Dt(e,t){var n=new At(e,t);try{n.c()}catch(e){throw n.d(),e}var r=n.d.bind(n);return r[Symbol.dispose]=r,r}function It(e,t){v[e]=t.bind(null,v[e]||function(){})}function zt(e){vt&&vt(),vt=e&&e.S()}function Rt(e){var t=this,n=e.data,r=Lt(n);r.value=n;var i=et(function(){for(var e=t.__v;e=e.__;)if(e.__c){e.__c.__$f|=4;break}return t.__$u.c=function(){var e,n=t.__$u.S(),r=i.value;n(),C(r)||3!==(null==(e=t.base)?void 0:e.nodeType)?(t.__$f|=1,t.setState({})):t.base.data=r},Nt(function(){var e=r.value.value;return 0===e?0:!0===e?"":e||""})},[]);return i.value}function Pt(e,t,n,r){var i=t in e&&void 0===e.ownerSVGElement,o=xt(n);return{o:function(e,t){o.value=e,r=t},d:Dt(function(){var n=o.value.value;r[t]!==n&&(r[t]=n,i?e[t]=n:n?e.setAttribute(t,n):e.removeAttribute(t))})}}function Lt(e){return et(function(){return xt(e)},[])}function Bt(e){var t=Qe(e);return t.current=e,pt.__$f|=4,et(function(){return Nt(function(){return t.current()})},[])}bt.prototype.brand=ut,bt.prototype.h=function(){return!0},bt.prototype.S=function(e){var t=this,n=this.t;n!==e&&void 0===e.e&&(e.x=n,this.t=e,void 0!==n?n.e=e:ft(function(){var e;null==(e=t.W)||e.call(t)}))},bt.prototype.U=function(e){var t=this;if(void 0!==this.t){var n=e.e,r=e.x;void 0!==n&&(n.x=r,e.e=void 0),void 0!==r&&(r.e=n,e.x=void 0),e===this.t&&(this.t=r,void 0===r&&ft(function(){var e;null==(e=t.Z)||e.call(t)}))}},bt.prototype.subscribe=function(e){var t=this;return Dt(function(){var n=t.value,r=ht;ht=void 0;try{e(n)}finally{ht=r}},{name:"sub"})},bt.prototype.valueOf=function(){return this.value},bt.prototype.toString=function(){return this.value+""},bt.prototype.toJSON=function(){return this.value},bt.prototype.peek=function(){var e=ht;ht=void 0;try{return this.value}finally{ht=e}},Object.defineProperty(bt.prototype,"value",{get:function(){var e=wt(this);return void 0!==e&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(yt>100)throw new Error("Cycle detected");this.v=e,this.i++,kt++,gt++;try{for(var t=this.t;void 0!==t;t=t.x)t.t.N()}finally{dt()}}}}),Mt.prototype=new bt,Mt.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if(32==(36&this.f))return!0;if(this.f&=-5,this.g===kt)return!0;if(this.g=kt,this.f|=1,this.i>0&&!Ct(this))return this.f&=-2,!0;var e=ht;try{St(this),ht=this;var t=this.x();(16&this.f||this.v!==t||0===this.i)&&(this.v=t,this.f&=-17,this.i++)}catch(e){this.v=e,this.f|=16,this.i++}return ht=e,_t(this),this.f&=-2,!0},Mt.prototype.S=function(e){if(void 0===this.t){this.f|=36;for(var t=this.s;void 0!==t;t=t.n)t.S.S(t)}bt.prototype.S.call(this,e)},Mt.prototype.U=function(e){if(void 0!==this.t&&(bt.prototype.U.call(this,e),void 0===this.t)){this.f&=-33;for(var t=this.s;void 0!==t;t=t.n)t.S.U(t)}},Mt.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var e=this.t;void 0!==e;e=e.x)e.t.N()}},Object.defineProperty(Mt.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var e=wt(this);if(this.h(),void 0!==e&&(e.i=this.i),16&this.f)throw this.v;return this.v}}),At.prototype.c=function(){var e=this.S();try{if(8&this.f)return;if(void 0===this.x)return;var t=this.x();"function"==typeof t&&(this.u=t)}finally{e()}},At.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,Tt(this),St(this),gt++;var e=ht;return ht=this,Et.bind(this,e)},At.prototype.N=function(){2&this.f||(this.f|=2,this.o=mt,mt=this)},At.prototype.d=function(){this.f|=8,1&this.f||Ot(this)},At.prototype.dispose=function(){this.d()},Rt.displayName="_st",Object.defineProperties(bt.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:Rt},props:{configurable:!0,get:function(){return{data:this}}},__b:{configurable:!0,value:1}}),It("__b",function(e,t){if("string"==typeof t.type){var n,r=t.props;for(var i in r)if("children"!==i){var o=r[i];o instanceof bt&&(n||(t.__np=n={}),n[i]=o,r[i]=o.peek())}}e(t)}),It("__r",function(e,t){zt();var n,r=t.__c;r&&(r.__$f&=-2,void 0===(n=r.__$u)&&(r.__$u=n=function(){var e;return Dt(function(){e=this}),e.c=function(){r.__$f|=1,r.setState({})},e}())),pt=r,zt(n),e(t)}),It("__e",function(e,t,n,r){zt(),pt=void 0,e(t,n,r)}),It("diffed",function(e,t){var n;if(zt(),pt=void 0,"string"==typeof t.type&&(n=t.__e)){var r=t.__np,i=t.props;if(r){var o=n.U;if(o)for(var a in o){var s=o[a];void 0===s||a in r||(s.d(),o[a]=void 0)}else n.U=o={};for(var c in r){var l=o[c],u=r[c];void 0===l?(l=Pt(n,c,u,i),o[c]=l):l.o(u,i)}}}e(t)}),It("unmount",function(e,t){if("string"==typeof t.type){var n=t.__e;if(n){var r=n.U;if(r)for(var i in n.U=void 0,r){var o=r[i];o&&o.d()}}}else{var a=t.__c;if(a){var s=a.__$u;s&&(a.__$u=void 0,s.d())}}e(t)}),It("__h",function(e,t,n,r){(r<3||9===r)&&(t.__$f|=2),e(t,n,r)}),q.prototype.shouldComponentUpdate=function(e,t){var n=this.__$u,r=n&&void 0!==n.s;for(var i in t)return!0;if(this.__f||"boolean"==typeof this.u&&!0===this.u){if(!(r||2&this.__$f||4&this.__$f))return!0;if(1&this.__$f)return!0}else{if(!(r||4&this.__$f))return!0;if(3&this.__$f)return!0}for(var o in e)if("__source"!==o&&e[o]!==this.props[o])return!0;for(var a in this.props)if(!(a in e))return!0;return!1};var Vt=function(){return fe("svg",{viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",children:fe("path",{d:"M843.904 783.573333 783.573333 843.904 512.042667 572.373333 240.512 843.904 180.181333 783.573333 451.712 512.042667 180.181333 240.512 240.512 180.181333 512.042667 451.712 783.573333 180.181333 843.904 240.512 572.373333 512.042667 843.904 783.573333Z"})})},Ft=function(){return fe("svg",{className:"icon",viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",children:fe("path",{d:"M900.64 379.808l-263.072-256.032c-36.448-35.328-105.76-35.392-142.304 0.096l-327.04 319.904c-56.416 54.72-70.72 76.704-70.72 150.976l0 143.936c0 132.768 26.976 192 186.912 192l131.872 0c81.12 0 128.448-46.656 193.952-111.264l290.016-297.696c18.592-17.984 29.248-43.968 29.248-71.264C929.504 423.36 918.976 397.6 900.64 379.808zM323.008 786.752c-52.928 0-96-43.072-96-96s43.072-96 96-96 96 43.072 96 96S375.936 786.752 323.008 786.752z"})})},jt=function(e){return fe("svg",{viewBox:"0 0 1024 1024",id:"send",className:e.className,version:"1.1",xmlns:"http://www.w3.org/2000/svg",children:fe("path",{d:"M931.4 498.9L94.9 79.5c-3.4-1.7-7.3-2.1-11-1.2-8.5 2.1-13.8 10.7-11.7 19.3l86.2 352.2c1.3 5.3 5.2 9.6 10.4 11.3l147.7 50.7-147.6 50.7c-5.2 1.8-9.1 6-10.3 11.3L72.2 926.5c-0.9 3.7-0.5 7.6 1.2 10.9 3.9 7.9 13.5 11.1 21.5 7.2l836.5-417c3.1-1.5 5.6-4.1 7.2-7.1 3.9-8 0.7-17.6-7.2-21.6zM170.8 826.3l50.3-205.6 295.2-101.3c2.3-0.8 4.2-2.6 5-5 1.4-4.2-0.8-8.7-5-10.2L221.1 403 171 198.2l628 314.9-628.2 313.2z"})})},$t=function(){return fe("svg",{viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",children:fe("path",{d:"M962 197.61H747v-60c0-55.14-44.86-100-100-100H377c-55.14 0-100 44.86-100 100v60H62c-11.05 0-20 8.95-20 20s8.95 20 20 20h60v630.57c0 66.17 53.83 120 120 120h540c66.17 0 120-53.83 120-120V237.61h60c11.05 0 20-8.95 20-20s-8.95-20-20-20zM637.34 457.66v260c0 12.01-10.72 21.63-23.06 19.77-9.84-1.48-16.94-10.25-16.94-20.2V458.09c0-9.95 7.1-18.72 16.94-20.2 12.34-1.86 23.06 7.76 23.06 19.77z m-210.68 0v260c0 11-9 20-20 20s-20-9-20-20v-260c0-11 9-20 20-20s20 9 20 20zM317 137.61c0-33.08 26.92-60 60-60h270c33.08 0 60 26.92 60 60v60H317v-60z"})})},Ht=function(){return fe("svg",{viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",children:fe("path",{d:"M511.582491 63.413262C265.134543 63.413262 64.62588 263.921925 64.62588 510.369873s200.508663 446.957635 446.957635 446.957635 446.957635-200.508663 446.957635-446.957635S758.031463 63.413262 511.582491 63.413262zM509.001713 751.859903c-98.517781 0-182.467775-62.623269-214.771505-150.056598l0.327458-0.134053c-2.007727-4.036943-3.38305-8.422833-3.38305-13.237489 0-16.647145 13.494339-30.142507 30.142507-30.142507 13.389962 0 24.358781 8.877181 28.2893 20.955264l0.422625-0.172939c23.269983 65.442478 85.645612 112.503307 158.972665 112.503307 93.106538 0 168.845523-75.738985 168.845523-168.845523s-75.738985-168.845523-168.845523-168.845523c-20.432355 0-39.874149 3.980661-58.013275 10.66899l21.248953 40.742936c2.486634 2.677992 4.0175 6.2831 4.0175 10.243295 0 8.417717-8.404414 14.921851-15.365966 15.07023-0.102331 0-0.206708 0-0.309038 0-0.220011 0-0.427742 0-0.647753-0.013303l-150.579507-6.463202c-5.372358-0.234337-10.229992-3.310396-12.716626-8.093329-2.486634-4.76963-2.236947-10.509355 0.647753-15.055904l80.890308-127.179564c2.8847-4.533246 8.006348-7.151887 13.365402-6.960529 5.372358 0.234337 10.227945 3.312442 12.71458 8.095375l18.580171 35.625382c26.629497-10.855232 55.683207-16.963347 86.168522-16.963347 126.338407 0 229.130537 102.791108 229.130537 229.130537S635.340119 751.859903 509.001713 751.859903z"})})},Wt=function(){return fe("svg",{viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",children:fe("path",{d:"M891.072 822.144V167.36a34.432 34.432 0 0 0-34.432-34.432H201.856C201.856 94.848 232.704 64 270.784 64h620.288C929.152 64 960 94.848 960 132.928v620.288c0 38.08-30.848 68.928-68.928 68.928z m-68.928-551.36v620.288c0 38.08-30.848 68.928-68.928 68.928H132.928A68.928 68.928 0 0 1 64 891.072V270.784c0-38.08 30.848-68.928 68.928-68.928h620.288c38.08 0 68.928 30.848 68.928 68.928z m-137.856 137.856H201.856a34.432 34.432 0 0 0 0 68.864h482.432a34.432 34.432 0 0 0 0-68.864z m0 206.72H201.856a34.432 34.432 0 0 0 0 68.864h482.432a34.432 34.432 0 0 0 0-68.864z"})})},qt=function(){return fe("svg",{viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",children:fe("path",{d:"M547.4 197.4v46l200.3 0.1L546.1 444l32.4 32.6 201.9-200.7v200.9h46V197.5zM471.4 584.4l-32.6-32.6L243.6 747V547.9h-46v278.7h279v-46H275z"})})},Ut=function(){return fe("svg",{viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",children:fe("path",{d:"M544 480V282.944h52.224l0.064 107.968L763.072 224l36.928 36.928-166.976 166.976 108.032-0.128V480H544zM260.928 800l-36.928-36.928 166.912-166.784-107.968-0.064V544H480v197.056h-52.224l0.064-107.968L260.928 800z"})})},Kt=function(){return fe("svg",{viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",children:fe("path",{d:"M960 544H64a32 32 0 1 1 0-64h896a32 32 0 1 1 0 64"})})},Jt=function(){return fe("svg",{viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",children:[fe("path",{d:"M481.0752 263.3728l50.9952 1.024 1.8432-105.8816-50.9952-0.8192z"}),fe("path",{d:"M486.441426 180.895362a66.56 66.56 0 1 0 42.091944-126.290153 66.56 66.56 0 1 0-42.091944 126.290153Z"}),fe("path",{d:"M138.8544 664.3712c-52.8384 0-95.8464-43.008-95.8464-95.8464s43.008-95.8464 95.8464-95.8464M880.0256 472.6784c52.8384 0 95.8464 43.008 95.8464 95.8464s-43.008 95.8464-95.8464 95.8464"}),fe("path",{d:"M507.4944 220.5696c-220.16 0-398.7456 162.816-398.7456 363.7248s178.5856 363.7248 398.7456 363.7248 398.7456-162.816 398.7456-363.7248-178.5856-363.7248-398.7456-363.7248z m0 559.9232c-166.2976 0-301.2608-100.5568-301.2608-224.4608s134.9632-224.4608 301.2608-224.4608S808.7552 432.128 808.7552 556.032 673.792 780.4928 507.4944 780.4928z"}),fe("path",{d:"M319.6928 556.032a47.9232 38.912 90 1 0 77.824 0 47.9232 38.912 90 1 0-77.824 0Z"}),fe("path",{d:"M617.472 556.032a47.9232 38.912 90 1 0 77.824 0 47.9232 38.912 90 1 0-77.824 0Z"})]})},Gt=function(){return fe("svg",{viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[fe("path",{d:"M5.856 17.121a.979.979 0 0 1-.327-.06.839.839 0 0 1-.283-.177.739.739 0 0 1-.187-.255.724.724 0 0 1-.07-.303l-.02-1.609a4.663 4.663 0 0 1-1.446-.455 4.252 4.252 0 0 1-.637-.401c-.199-.146-.385-.31-.553-.492a4.442 4.442 0 0 1-.45-.577 4.303 4.303 0 0 1-.327-.637 3.823 3.823 0 0 1-.206-.686 3.729 3.729 0 0 1-.064-.704V6.478c0-.261.025-.516.077-.771a4.43 4.43 0 0 1 .244-.747 4.062 4.062 0 0 1 .932-1.28c.2-.183.418-.347.65-.493.23-.145.482-.267.739-.364a4.21 4.21 0 0 1 .81-.225c.27-.054.553-.078.835-.078H8.55c.103 0 .2.018.29.054a.7.7 0 0 1 .411.376.667.667 0 0 1-.161.766.736.736 0 0 1-.25.151.764.764 0 0 1-.29.055H5.573c-.186 0-.366.012-.54.049-.18.03-.353.079-.52.145-.167.061-.328.14-.482.237-.148.091-.29.2-.418.316a2.897 2.897 0 0 0-.347.388c-.097.14-.187.286-.257.444a2.473 2.473 0 0 0-.206.977v4.287c0 .17.013.333.051.503a2.549 2.549 0 0 0 .772 1.33 2.721 2.721 0 0 0 .913.559c.167.066.347.115.527.152.18.03.36.048.546.048a.904.904 0 0 1 .61.23.848.848 0 0 1 .194.262.84.84 0 0 1 .07.303l.007.99 1.915-1.293a2.877 2.877 0 0 1 1.64-.492h2.372c.186 0 .366-.018.54-.048.18-.03.353-.08.52-.146.168-.067.329-.146.483-.237.148-.091.29-.2.418-.316.128-.121.244-.249.347-.388a2.8 2.8 0 0 0 .257-.444 2.47 2.47 0 0 0 .206-.977V8.585a.646.646 0 0 1 .225-.492.679.679 0 0 1 .244-.152.814.814 0 0 1 .585 0c.09.03.174.085.244.152a.657.657 0 0 1 .225.492V10.8c0 .261-.032.516-.083.771a4.192 4.192 0 0 1-.245.74c-.109.244-.244.468-.398.687a3.735 3.735 0 0 1-.534.6c-.2.183-.418.347-.65.493a4.134 4.134 0 0 1-.738.364 4.7 4.7 0 0 1-.81.225c-.27.054-.553.079-.836.079h-1.877c-.604 0-1.144.164-1.633.491l-2.54 1.713a.913.913 0 0 1-.514.157z",fill:"currentColor"}),fe("path",{d:"M15.866 4.125h-4.174c-.41 0-.741.313-.741.7 0 .387.332.7.741.7h4.174c.41 0 .742-.313.742-.7 0-.387-.332-.7-.742-.7z",fill:"currentColor"}),fe("path",{d:"M14.537 2.932c0-.396-.34-.717-.759-.717s-.758.32-.758.717v3.786c0 .396.34.717.758.717.42 0 .76-.321.76-.717V2.932z",fill:"currentColor"})]})},Xt=function(){return fe("svg",{viewBox:"64 64 896 896",focusable:"false",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true",children:fe("path",{d:"M842 454c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8 0 140.3-113.7 254-254 254S258 594.3 258 454c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8 0 168.7 126.6 307.9 290 327.6V884H326.7c-13.7 0-24.7 14.3-24.7 32v36c0 4.4 2.8 8 6.2 8h407.6c3.4 0 6.2-3.6 6.2-8v-36c0-17.7-11-32-24.7-32H548V782.1c165.3-18 294-158 294-328.1zM512 624c93.9 0 170-75.2 170-168V232c0-92.8-76.1-168-170-168s-170 75.2-170 168v224c0 92.8 76.1 168 170 168zm-94-392c0-50.6 41.9-92 94-92s94 41.4 94 92v224c0 50.6-41.9 92-94 92s-94-41.4-94-92V232z"})})},Yt=function(){var e=1e3,t=140,n=250,r=.8;return fe("svg",{fill:"currentColor",viewBox:"0 0 ".concat(e," ").concat(e),xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",children:Array.from({length:4}).map(function(e,i){return fe("rect",{fill:"currentColor",rx:70,ry:70,height:n,width:t,x:i*(440/3+t),y:375,children:[fe("animate",{attributeName:"height",values:"".concat(n,"; ").concat(500,"; ").concat(n),keyTimes:"0; 0.5; 1",dur:"".concat(r,"s"),begin:"".concat(.2*i,"s"),repeatCount:"indefinite"}),fe("animate",{attributeName:"y",values:"".concat(375,"; ").concat(250,"; ").concat(375),keyTimes:"0; 0.5; 1",dur:"".concat(r,"s"),begin:"".concat(.2*i,"s"),repeatCount:"indefinite"})]},i)})})},Zt=function(e){return fe("svg",{className:e.className,onClick:e.onClick,viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",children:fe("path",{d:"M128 384a128 128 0 1 1 0 256 128 128 0 0 1 0-256z m768 0a128 128 0 1 1 0 256 128 128 0 0 1 0-256z m-372.4288 0a128 128 0 1 1 0 256 128 128 0 0 1 0-256z"})})},Qt=function(e){return fe("svg",{className:e.className,viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",children:fe("path",{d:"M498.33984 607.8464c-10.99776-32.9728-50.09408-73.5232-82.6368-85.74976L150.9376 422.8096c-38.54336-14.4384-36.98688-69.46816 2.27328-81.73568L844.92288 124.90752c33.30048-10.40384 64.57344 20.8896 54.1696 54.1696L682.92608 870.78912a43.2128 43.2128 0 0 1-81.36704 3.25632 121682.5344 121682.5344 0 0 1-103.2192-266.19904z"})})},en=function(){return fe("svg",{className:"icon",viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",children:fe("path",{d:"M972.657609 209.348408C987.158609 209.36839 998.930114 197.571202 998.949999 182.99865 998.969882 168.426097 987.230618 156.59651 972.729617 156.576528L32.457975 155.280806C17.956974 155.260823 6.18547 167.058012 6.165585 181.630564 6.1457 196.203116 17.884965 208.032703 32.385966 208.052686L972.657609 209.348408ZM180.466902 992.356169 180.466902 1019.014859 206.993296 1018.74074 833.361858 1012.267947 859.348284 1011.999407 859.348284 985.883377 859.348284 289.397297C859.348284 274.824732 847.59289 263.011332 833.091874 263.011332 818.590859 263.011332 806.835465 274.824732 806.835465 289.397297L806.835465 985.883377 832.82189 959.498805 206.453329 965.971599 232.979723 992.356169 232.979723 282.67005C232.979723 268.097483 221.224329 256.284085 206.723313 256.284085 192.222298 256.284085 180.466902 268.097483 180.466902 282.67005L180.466902 992.356169ZM656.410257 847.079027C656.410257 861.651593 668.165651 873.464992 682.666667 873.464992 697.167682 873.464992 708.923076 861.651593 708.923076 847.079027L708.923076 372.131659C708.923076 357.559091 697.167682 345.745694 682.666667 345.745694 668.165651 345.745694 656.410257 357.559091 656.410257 372.131659L656.410257 847.079027ZM341.333333 847.079027C341.333333 861.651593 353.08873 873.464992 367.589743 873.464992 382.090758 873.464992 393.846155 861.651593 393.846155 847.079027L393.846155 372.131659C393.846155 357.559091 382.090758 345.745694 367.589743 345.745694 353.08873 345.745694 341.333333 357.559091 341.333333 372.131659L341.333333 847.079027ZM498.871795 847.079027C498.871795 861.651593 510.627189 873.464992 525.128205 873.464992 539.62922 873.464992 551.384614 861.651593 551.384614 847.079027L551.384614 372.131659C551.384614 357.559091 539.62922 345.745694 525.128205 345.745694 510.627189 345.745694 498.871795 357.559091 498.871795 372.131659L498.871795 847.079027ZM392.147755 116.721777C392.147755 102.063669 403.758665 90.363507 418.40134 90.363507L622.925796 90.363507C637.408947 90.363507 649.179381 102.1619 649.179381 116.549585L649.179381 171.644875 701.692203 171.644875 701.692203 116.549585C701.692203 72.986607 666.38105 37.591577 622.925796 37.591577L418.40134 37.591577C374.724427 37.591577 339.634933 72.950804 339.634933 116.721777L339.634933 165.310801 392.147755 165.310801 392.147755 116.721777Z"})})},tn=function(e){return fe("svg",{xmlns:"http://www.w3.org/2000/svg",className:e.className,viewBox:"0 0 512 512",children:fe("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"48",d:"M112 184l144 144 144-144"})})},nn=function(e){return fe("svg",{xmlns:"http://www.w3.org/2000/svg",className:"".concat(e.className," icon"),viewBox:"0 0 512 512",children:fe("path",{d:"M256 48C141.31 48 48 141.31 48 256s93.31 208 208 208 208-93.31 208-208S370.69 48 256 48zm108.25 138.29l-134.4 160a16 16 0 01-12 5.71h-.27a16 16 0 01-11.89-5.3l-57.6-64a16 16 0 1123.78-21.4l45.29 50.32 122.59-145.91a16 16 0 0124.5 20.58z"})})},rn=function(e){return fe("svg",{className:e.className,width:"16",height:"16",viewBox:"0 0 50 50",xmlns:"http://www.w3.org/2000/svg",children:fe("circle",{cx:"25",cy:"25",r:"20",stroke:"currentColor",strokeWidth:"5",fill:"none",strokeDasharray:"31.415, 31.415",strokeLinecap:"round",children:fe("animateTransform",{attributeName:"transform",type:"rotate",from:"0 25 25",to:"360 25 25",dur:"1s",repeatCount:"indefinite"})})})},on=function(){return fe("svg",{className:"icon",viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",children:[fe("path",{d:"M512 61.44a40.96 40.96 0 0 1 40.96 40.96v122.88a40.96 40.96 0 1 1-81.92 0V102.4A40.96 40.96 0 0 1 512 61.44z",fill:"currentColor",opacity:".9"}),fe("path",{d:"M737.28 121.792a40.96 40.96 0 0 1 14.992 55.952l-61.44 106.432a40.96 40.96 0 1 1-70.944-40.96l61.44-106.432a40.96 40.96 0 0 1 55.952-14.992z",fill:"currentColor",opacity:".8"}),fe("path",{d:"M902.208 286.72a40.96 40.96 0 0 1-14.992 55.952l-106.432 61.44a40.96 40.96 0 0 1-40.96-70.944l106.432-61.44a40.96 40.96 0 0 1 55.952 14.992z",fill:"currentColor",opacity:".76"}),fe("path",{d:"M962.56 512a40.96 40.96 0 0 1-40.96 40.96h-122.88a40.96 40.96 0 1 1 0-81.92h122.88A40.96 40.96 0 0 1 962.56 512z",fill:"currentColor",opacity:".7"}),fe("path",{d:"M902.208 737.28a40.96 40.96 0 0 1-55.952 14.992l-106.432-61.44a40.96 40.96 0 1 1 40.96-70.944l106.432 61.44a40.96 40.96 0 0 1 14.992 55.952z",fill:"currentColor",opacity:".6"}),fe("path",{d:"M737.28 902.208a40.96 40.96 0 0 1-55.952-14.992l-61.44-106.432a40.96 40.96 0 0 1 70.944-40.96l61.44 106.432a40.96 40.96 0 0 1-14.992 55.952z",fill:"currentColor",opacity:".5"}),fe("path",{d:"M512 962.56a40.96 40.96 0 0 1-40.96-40.96v-122.88a40.96 40.96 0 1 1 81.92 0v122.88A40.96 40.96 0 0 1 512 962.56z",fill:"currentColor",opacity:".4"}),fe("path",{d:"M286.72 902.208a40.96 40.96 0 0 1-14.992-55.952l61.44-106.432a40.96 40.96 0 1 1 70.944 40.96l-61.44 106.432a40.96 40.96 0 0 1-55.952 14.992z",fill:"currentColor",opacity:".3"}),fe("path",{d:"M121.792 737.28a40.96 40.96 0 0 1 14.992-55.952l106.432-61.44a40.96 40.96 0 0 1 40.96 70.944l-106.432 61.44a40.96 40.96 0 0 1-55.952-14.992z",fill:"currentColor",opacity:".2"}),fe("path",{d:"M61.44 512a40.96 40.96 0 0 1 40.96-40.96h122.88a40.96 40.96 0 1 1 0 81.92H102.4A40.96 40.96 0 0 1 61.44 512z",fill:"currentColor",opacity:".1"}),fe("path",{d:"M121.792 286.72a40.96 40.96 0 0 1 55.952-14.992l106.432 61.44a40.96 40.96 0 1 1-40.96 70.944l-106.432-61.44a40.96 40.96 0 0 1-14.992-55.952z",fill:"currentColor",opacity:".04"}),fe("path",{d:"M286.72 121.792a40.96 40.96 0 0 1 55.952 14.992l61.44 106.432a40.96 40.96 0 0 1-70.944 40.96l-61.44-106.432a40.96 40.96 0 0 1 14.992-55.952z",fill:"currentColor"})]})},an=function(){return fe("svg",{className:"icon",viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",children:fe("path",{d:"M704 256v490.666667a170.666667 170.666667 0 0 1-170.666667 170.666666 170.666667 170.666667 0 0 1-170.666666-170.666666V213.333333A106.666667 106.666667 0 0 1 469.333333 106.666667 106.666667 106.666667 0 0 1 576 213.333333v448a42.666667 42.666667 0 0 1-42.666667 42.666667 42.666667 42.666667 0 0 1-42.666666-42.666667V256H426.666667v405.333333a106.666667 106.666667 0 0 0 106.666666 106.666667 106.666667 106.666667 0 0 0 106.666667-106.666667V213.333333a170.666667 170.666667 0 0 0-170.666667-170.666666 170.666667 170.666667 0 0 0-170.666666 170.666666v533.333334a234.666667 234.666667 0 0 0 234.666666 234.666666 234.666667 234.666667 0 0 0 234.666667-234.666666V256h-64z"})})},sn=function(){return fe("svg",{className:"icon",viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",children:[fe("path",{d:"M842.666667 285.866667l-187.733334-187.733334c-14.933333-14.933333-32-21.333333-53.333333-21.333333H234.666667C194.133333 74.666667 160 108.8 160 149.333333v725.333334c0 40.533333 34.133333 74.666667 74.666667 74.666666h554.666666c40.533333 0 74.666667-34.133333 74.666667-74.666666V337.066667c0-19.2-8.533333-38.4-21.333333-51.2z m-44.8 44.8c-2.133333 2.133333-4.266667 0-8.533334 0h-170.666666c-6.4 0-10.666667-4.266667-10.666667-10.666667V149.333333c0-2.133333 0-6.4-2.133333-8.533333 0 0 2.133333 0 2.133333 2.133333l189.866667 187.733334z m-8.533334 554.666666H234.666667c-6.4 0-10.666667-4.266667-10.666667-10.666666V149.333333c0-6.4 4.266667-10.666667 10.666667-10.666666h311.466666c-2.133333 4.266667-2.133333 6.4-2.133333 10.666666v170.666667c0 40.533333 34.133333 74.666667 74.666667 74.666667h170.666666c4.266667 0 6.4 0 10.666667-2.133334V874.666667c0 6.4-4.266667 10.666667-10.666667 10.666666z",fill:"currentColor"}),fe("path",{d:"M640 693.333333H341.333333c-17.066667 0-32 14.933333-32 32s14.933333 32 32 32h298.666667c17.066667 0 32-14.933333 32-32s-14.933333-32-32-32zM640 522.666667H341.333333c-17.066667 0-32 14.933333-32 32s14.933333 32 32 32h298.666667c17.066667 0 32-14.933333 32-32s-14.933333-32-32-32zM341.333333 416h85.333334c17.066667 0 32-14.933333 32-32s-14.933333-32-32-32h-85.333334c-17.066667 0-32 14.933333-32 32s14.933333 32 32 32z",fill:"currentColor"})]})},cn=function(){return fe("svg",{className:"icon",viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",children:fe("path",{d:"M557.248 511.68l135.776-135.744-45.248-45.28L512 466.432l-135.776-135.776-45.248 45.28 135.776 135.744-135.776 135.776 45.248 45.248L512 556.928l135.776 135.776 45.248-45.248-135.776-135.776zM512 64c247.136 0 448 200.864 448 448s-200.864 448-448 448S64 759.136 64 512 264.864 64 512 64z",fill:"currentColor"})})},ln=function(){return fe("svg",{className:"icon",viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",children:fe("path",{d:"M512.43945313 904.51953125c-6.06445313 0-12.12890625-1.58203125-17.57812501-4.74609375L136.70703125 689.71484375c-10.63476563-6.24023438-17.13867188-17.66601563-17.13867188-29.97070313s6.50390625-23.73046875 17.13867188-29.97070312l76.37695313-44.91210938L136.97070312 540.125c-10.63476563-6.24023438-17.13867188-17.66601563-17.13867187-29.97070313s6.50390625-23.73046875 17.13867188-29.97070312l73.38867187-43.15429688-73.125-42.890625C126.51171875 387.81054687 120.0078125 376.38476562 120.0078125 364.08007812c0-12.3046875 6.50390625-23.73046875 17.13867188-29.97070312L495.828125 122.99609375c10.8984375-6.41601563 24.34570313-6.41601563 35.24414063 0l358.15429687 210.05859375c10.63476563 6.24023438 17.13867188 17.66601563 17.13867188 29.97070313s-6.50390625 23.73046875-17.13867188 29.97070312l-73.38867188 43.15429688 73.12500001 42.890625c10.63476563 6.24023438 17.13867188 17.66601563 17.13867187 29.97070312s-6.50390625 23.73046875-17.13867187 29.97070313L812.5859375 583.89453125l76.11328125 44.6484375c10.63476563 6.24023438 17.13867188 17.66601563 17.13867188 29.97070313s-6.50390625 23.73046875-17.13867188 29.97070312l-358.59375 211.2890625c-5.44921875 3.1640625-11.6015625 4.74609375-17.66601563 4.74609375zM223.015625 659.65625l289.42382813 169.8046875 290.12695312-170.77148438-58.44726563-34.27734374L530.28125 750.18359375a34.67285156 34.67285156 0 0 1-35.24414063 0L281.7265625 625.02734375 223.015625 659.65625z m76.90429688-104.58984375l212.69531249 124.8046875 290.12695313-170.77148438-55.546875-32.60742187-216.65039063 127.6171875a34.67285156 34.67285156 0 0 1-35.24414062 0L279.00195312 477.28320312l-55.81054687 32.78320313 75.49804688 44.296875c0.43945313 0.26367188 0.79101563 0.52734375 1.23046874 0.703125z m-2.81250001-147.83203125l215.68359376 126.5625 216.12304687-127.17773438c0.3515625-0.26367188 0.703125-0.43945313 1.0546875-0.61523437l72.86132813-42.890625-289.33593751-169.8046875-290.12695312 170.68359375 72.59765625 42.62695313c0.43945313 0.17578125 0.79101563 0.43945313 1.14257813 0.61523437z"})})},un=function(e){return fe("svg",{className:e.className,id:"stop",viewBox:"0 0 1025 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",children:[fe("path",{d:"M512.268258 1022.835842c-68.658678 0-135.399619-13.564433-198.369591-40.316509-60.752236-25.809077-115.373446-62.712976-162.346233-109.685763-46.971763-46.971763-83.875662-101.592974-109.685763-162.346233C15.115619 647.517366 1.551186 580.777449 1.551186 512.118771S15.115619 376.719151 41.866671 313.74918c25.810101-60.752236 62.714-115.373446 109.685763-162.346233 46.972787-46.971763 101.593997-83.875662 162.346233-109.685763 62.969971-26.751052 129.710912-40.315485 198.369591-40.315485s135.398595 13.564433 198.368567 40.315485c60.752236 25.810101 115.373446 62.714 162.346233 109.685763 46.971763 46.972787 83.875662 101.593997 109.685763 162.346233 26.752076 62.969971 40.316509 129.710912 40.316509 198.369591s-13.564433 135.398595-40.316509 198.368567c-25.809077 60.75326-62.712976 115.37447-109.685763 162.346233-46.971763 46.972787-101.592974 83.876686-162.346233 109.685763C647.666853 1009.27141 580.925912 1022.835842 512.268258 1022.835842zM512.268258 50.548195c-62.018782 0-122.293887 12.247716-179.152287 36.403219-54.923257 23.333323-104.317532 56.709936-146.810821 99.204249s-75.870926 91.888588-99.204249 146.810821c-24.155503 56.8584-36.403219 117.133505-36.403219 179.152287 0 62.017758 12.247716 122.292863 36.403219 179.152287 23.333323 54.923257 56.709936 104.317532 99.204249 146.811845 42.493289 42.493289 91.888588 75.870926 146.810821 99.204249 56.8584 24.155503 117.133505 36.403219 179.152287 36.403219 62.017758 0 122.292863-12.247716 179.152287-36.403219 54.923257-23.333323 104.317532-56.71096 146.811845-99.204249 42.493289-42.494313 75.870926-91.888588 99.204249-146.811845 24.155503-56.8584 36.403219-117.133505 36.403219-179.152287s-12.247716-122.293887-36.403219-179.152287c-23.334347-54.923257-56.71096-104.317532-99.205273-146.810821-42.493289-42.493289-91.887565-75.870926-146.810821-99.204249C634.561121 62.795911 574.286016 50.548195 512.268258 50.548195z",fill:"currentColor"}),fe("path",{d:"M655.434047 694.244421 367.12637 694.244421c-21.046987 0-38.170445-17.123458-38.170445-38.170445L328.955925 367.766298c0-21.046987 17.123458-38.170445 38.170445-38.170445l288.307678 0c21.048011 0 38.170445 17.123458 38.170445 38.170445l0 288.307678C693.604492 677.120962 676.482058 694.244421 655.434047 694.244421zM380.150191 643.050154l262.260035 0L642.410226 380.79012 380.150191 380.79012 380.150191 643.050154z",fill:"currentColor"})]})},dn=function(e){return fe("svg",{xmlns:"http://www.w3.org/2000/svg",className:e.className,viewBox:"0 0 512 512",children:fe("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"48",d:"M112 268l144 144 144-144M256 392V100"})})},hn=function(){return fe("svg",{viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",children:[fe("path",{d:"M394.688 126.208a32 32 0 0 1 32-32h170.688a32 32 0 0 1 32 32v138.624h288a32 32 0 0 1 32 32v170.688a32 32 0 0 1-32 32H106.688a32 32 0 0 1-32-32V296.832a32 32 0 0 1 32-32h288V126.208z m64 32v138.624a32 32 0 0 1-32 32h-288v106.688h746.688V328.832h-288a32 32 0 0 1-32-32V158.208H458.688z"}),fe("path",{d:"M138.688 469.376a32 32 0 0 1 32-32h682.688a32 32 0 0 1 32 32v384a32 32 0 0 1-32 32H170.688a32 32 0 0 1-32-32v-384z m64 32v320h618.688v-320H202.688z"}),fe("path",{d:"M341.376 691.52a32 32 0 0 1 32 32V851.2a32 32 0 1 1-64 0v-127.68a32 32 0 0 1 32-32zM512 691.2a32 32 0 0 1 32 32v128a32 32 0 0 1-64 0v-128a32 32 0 0 1 32-32zM682.688 691.52a32 32 0 0 1 32 32V851.2a32 32 0 1 1-64 0v-127.68a32 32 0 0 1 32-32z"})]})},fn=function(){return fe("svg",{viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",children:fe("path",{d:"M843.251 424.407l43.828-74.898c10.194-17.946 32.596-22.158 48.956-11.598 16.298 10.499 23.44 32.658 14.223 49.566l-113.11 195.212-61.164-40.044-126.418-82.285c-16.115-11.598-20.632-34.428-10.194-51.702 9.705-17.397 31.009-23.501 47.857-13.734l89.67 59.028C748.576 295.547 615.81 180.667 461.008 180.667c-177.387 0-320.042 148.758-320.042 331.335 0 183.613 143.692 331.334 319.981 331.334 107.861 0.184 208.58-56.158 268.034-149.858 1.099-1.038 1.099-2.075 2.075-2.075 6.348-9.949 17.092-15.871 28.568-15.81 19.35 0 35.648 16.848 35.648 36.93 0 7.508-2.137 14.833-6.104 21.059-72.823 114.698-196.066 183.675-328.099 183.614-216.088 0-391.4-181.478-391.4-405.195 0-223.718 175.312-405.195 391.339-405.195 183.125-0.427 342.016 131.606 382.243 317.601z"})})},pn=function(){return fe("svg",{version:"1.1",className:"icon",viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg",children:fe("path",{d:"M627.498667 55.168l170.666666 170.666667a42.624 42.624 0 0 1 0 60.330666l-469.333333 469.333334A42.538667 42.538667 0 0 1 298.666667 768H128a42.666667 42.666667 0 0 1-42.666667-42.666667v-170.666666c0-11.306667 4.48-22.186667 12.501334-30.165334l469.333333-469.333333a42.624 42.624 0 0 1 60.330667 0zM896 896a42.666667 42.666667 0 0 1 0 85.333333H128a42.666667 42.666667 0 0 1 0-85.333333h768zM597.333333 145.664l-426.666666 426.666667V682.666667h110.336l426.666666-426.666667L597.333333 145.664z"})})},vn=function(e){return fe("svg",{xmlns:"http://www.w3.org/2000/svg",className:e.className,viewBox:"0 0 512 512",children:fe("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"48",d:"M184 112l144 144-144 144"})})},mn=function(){return fe("svg",{className:"icon",viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",children:fe("path",{d:"M896 870.4l-128-128c55.467-68.267 89.6-149.333 89.6-238.933 0-98.134-38.4-192-110.933-264.534-149.334-149.333-384-149.333-533.334-4.266-145.066 145.066-145.066 384 0 529.066 72.534 72.534 166.4 110.934 264.534 110.934 89.6 0 174.933-29.867 238.933-89.6l128 128c4.267 4.266 12.8 8.533 21.333 8.533s17.067-4.267 21.334-8.533c17.066-8.534 17.066-29.867 8.533-42.667zM260.267 721.067c-119.467-123.734-119.467-320 0-439.467 59.733-59.733 140.8-89.6 217.6-89.6 81.066 0 157.866 29.867 217.6 89.6 59.733 59.733 89.6 136.533 89.6 217.6 0 81.067-34.134 162.133-89.6 217.6-55.467 59.733-132.267 93.867-217.6 93.867-81.067 0-157.867-34.134-217.6-89.6z"})})},gn=function(){return fe("svg",{className:"icon",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",width:"1em",height:"1em",children:fe("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M19 9l-7 7-7-7"})})},yn=function(){return fe("svg",{viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",children:[fe("path",{d:"M190.193225 471.411583c14.446014 0 26.139334-11.718903 26.139334-26.13831 0-14.44499-11.69332-26.164916-26.139334-26.164916-0.271176 0-0.490164 0.149403-0.73678 0.149403l-62.496379 0.146333c-1.425466-0.195451-2.90005-0.295735-4.373611-0.295735-19.677155 0-35.621289 16.141632-35.621289 36.114522L86.622358 888.550075c0 19.949354 15.96767 35.597753 35.670407 35.597753 1.916653 0 3.808746 0.292666 5.649674 0l61.022819 0.022513c0.099261 0 0.148379 0.048095 0.24764 0.048095 0.097214 0 0.146333-0.048095 0.24457-0.048095l0.73678 0 0-0.148379c13.413498-0.540306 24.174586-11.422144 24.174586-24.960485 0-13.55983-10.760065-24.441669-24.174586-24.981974l0-0.393973-50.949392 0 1.450025-402.275993L190.193225 471.409536z"}),fe("path",{d:"M926.52241 433.948343c-19.283182-31.445176-47.339168-44.172035-81.289398-45.546336-1.77032-0.246617-3.536546-0.39295-5.380544-0.39295l-205.447139-0.688685c13.462616-39.059598 22.698978-85.58933 22.698978-129.317251 0-28.349675-3.193739-55.962569-9.041934-82.542948l-0.490164 0.049119c-10.638291-46.578852-51.736315-81.31498-100.966553-81.31498-57.264215 0-95.466282 48.15065-95.466282 106.126063 0 3.241834-0.294712 6.387477 0 9.532097-2.996241 108.386546-91.240027 195.548698-196.23636 207.513194l0 54.881958-0.785899 222.227314 0 229.744521 10.709923 0 500.025271 0.222057 8.746198-0.243547c19.35686 0.049119 30.239721-4.817726 47.803749-16.116049 16.682961-10.761088 29.236881-25.50079 37.490869-42.156122 2.260483-3.341095 4.028757-7.075139 5.106298-11.20111l77.018118-344.324116c1.056052-4.053316 1.348718-8.181333 1.056052-12.160971C943.643346 476.446249 938.781618 453.944769 926.52241 433.948343zM893.82573 486.837924l-82.983993 367.783411-0.099261-0.049119c-2.555196 6.141884-6.879688 11.596106-12.872169 15.427364-4.177136 2.727111-8.773827 4.351098-13.414521 4.964058-1.49812-0.195451-3.046383 0-4.620227 0l-477.028511-0.540306-0.171915-407.408897c89.323375-40.266076 154.841577-79.670527 188.596356-173.661202 0.072655 0.024559 0.124843 0.049119 0.195451 0.072655 2.99931-9.137101 6.313799-20.73423 8.697079-33.164331 5.551436-29.185716 5.258771-58.123792 5.258771-58.123792-4.937452-37.98001 25.940812-52.965306 44.364417-52.965306 25.304316 0.860601 50.263777 33.656541 50.263777 52.326762 0 0 5.600555 27.563776 5.649674 57.190537 0.048095 37.366026-4.6673 56.847729-4.6673 56.847729l-0.466628 0c-5.872754 30.879288-16.214287 60.138682-30.464849 86.964654l0.36839 0.342808c-2.358721 4.815679-3.709485 10.220782-3.709485 15.943111 0 19.922748 19.088754 21.742187 38.765909 21.742187l238.761895 0.270153c0 0 14.666024 0.465604 14.690584 0.465604l0 0.100284c12.132318-0.638543 24.221658 5.207605 31.100322 16.409738 5.504364 9.016351 6.437619 19.6045 3.486404 28.988218L893.82573 486.837924z"}),fe("path",{d:"M264.827039 924.31872c0.319272 0.024559 0.441045 0.024559 0.295735-0.024559 0.243547-0.048095 0.367367-0.074701-0.295735-0.074701s-0.539282 0.026606-0.271176 0.074701C264.43409 924.343279 264.532327 924.343279 264.827039 924.31872z"})]})},kn=function(){return fe("svg",{viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",children:fe("path",{d:"M190.208 552.576a26.176 26.176 0 0 1 0 52.288L189.44 604.8l-62.464-0.128a35.84 35.84 0 0 1-40-35.84l-0.384-433.28c0-19.968 16-35.648 35.712-35.648 1.92 0 3.84-0.256 5.632 0h62.272v0.128c13.44 0.576 24.192 11.456 24.192 24.96a25.024 25.024 0 0 1-24.192 24.96v0.448h-50.944l1.408 402.24h49.536z m736.32 37.504c-19.264 31.36-47.36 44.16-81.28 45.504a38.656 38.656 0 0 1-5.376 0.384l-205.44 0.704c13.44 39.04 22.656 85.568 22.656 129.28 0 28.416-3.2 56-9.024 82.56h-0.512a103.936 103.936 0 0 1-100.928 81.28c-57.28 0-95.488-48.128-95.488-106.112 0-3.2-0.32-6.4 0-9.536-3.008-108.352-91.264-195.52-196.224-207.488V551.68L254.08 329.6v-229.76h10.688l500.032-0.192 8.704 0.192c19.392 0 30.272 4.864 47.808 16.128 16.704 10.752 29.248 25.536 37.504 42.176 2.304 3.328 4.032 7.04 5.12 11.2l76.992 344.32a37.568 37.568 0 0 1 1.088 12.16c1.536 21.76-3.328 44.288-15.552 64.32z m-32.704-52.928l-83.008-367.744h-0.064a33.408 33.408 0 0 0-26.24-20.352c-1.536 0.192-3.072 0-4.672 0l-477.056 0.512-0.128 407.424c89.28 40.32 154.88 79.68 188.544 173.632h0.256c2.944 9.088 6.272 20.672 8.64 33.088 5.568 29.184 5.312 58.176 5.312 58.176-4.992 37.952 25.92 52.928 44.352 52.928 25.28-0.832 50.24-33.664 50.24-52.288 0 0 5.632-27.584 5.632-57.216 0.064-37.376-4.608-56.832-4.608-56.832h-0.512a307.84 307.84 0 0 0-30.464-87.04l0.384-0.256a36.16 36.16 0 0 1-3.712-16c0-19.84 19.072-21.76 38.784-21.76l238.72-0.192 14.72-0.512v-0.064c12.16 0.64 24.192-5.248 31.104-16.448a35.2 35.2 0 0 0 3.456-28.992h0.32zM267.52 96.768c2.048-0.192 2.816-0.192 1.92 0.128 1.536 0.32 2.304 0.512-1.92 0.512s-3.456-0.192-1.728-0.512c-0.768-0.32-0.192-0.32 1.728-0.128z"})})},wn=function(){return fe("svg",{viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",children:fe("path",{d:"M413.610667 336.192l226.346666-125.461333-11.114666-76.586667c-5.909333-40.64 43.349333-65.344 72.384-36.309333l241.365333 241.344c29.013333 29.013333 4.373333 78.250667-36.245333 72.405333l-76.458667-10.965333-126.165333 227.029333 2.176 5.12c34.56 84.330667 27.413333 153.962667-30.208 214.549333l-4.416 4.544a42.666667 42.666667 0 0 1-60.330667 0l-139.968-139.968L153.365333 946.730667c-38.528 28.48-86.677333-18.133333-61.44-57.109334l1.706667-2.474666 234.154667-318.442667-136.810667-136.832-4.906667-5.12a42.666667 42.666667 0 0 1 2.496-57.6c62.272-62.293333 139.157333-71.445333 222.122667-34.304l2.922667 1.344zM795.733333 313.024l-68.138666-68.117333-0.96 3.136a42.666667 42.666667 0 0 1-19.52 23.04L435.306667 421.76a42.666667 42.666667 0 0 1-41.216 0.085333c-42.197333-23.146667-76.565333-29.290667-106.581334-18.218666l-2.944 1.173333 129.493334 129.493333a42.666667 42.666667 0 0 1 4.202666 55.466667l-88.661333 120.533333 120.213333-88.853333a42.666667 42.666667 0 0 1 52.821334 1.642667l2.709333 2.496 130.282667 130.282666 1.685333-4.522666c8.917333-27.008 3.242667-58.24-16.704-100.608l-2.944-6.144A42.666667 42.666667 0 0 1 618.666667 605.077333l150.912-271.573333a42.666667 42.666667 0 0 1 23.018666-19.498667l3.157334-0.981333z"})})},bn=function(){return fe("svg",{viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",children:fe("path",{d:"M342.464 368.576l73.344 42.368-8.512 7.936a32 32 0 0 1-14.272 7.68l-5.44 0.832-2.88 0.192-19.456 2.24a442.88 442.88 0 0 0-53.504 10.688 245.12 245.12 0 0 0-64.32 25.984l-7.488 4.928 150.144 86.784a32 32 0 0 1 15.808 31.168l-1.024 5.312-61.568 215.168 155.584-160.896a32 32 0 0 1 34.112-7.744l4.928 2.304 152.32 87.872 1.472-8.192c4.992-38.272-7.68-83.456-31.552-128.832l-6.784-12.416a32 32 0 0 1-3.456-23.04l2.56-11.328 78.016 44.992c27.328 61.44 36.672 122.816 15.168 177.856l-5.12 11.84-6.208 11.648a32 32 0 0 1-43.712 11.712l-163.072-94.272-227.2 235.072c-21.632 22.336-57.728 3.84-55.04-24.768l1.28-6.272L336.448 600.96l-163.072-94.08a32 32 0 0 1-14.144-38.464l2.432-5.248c23.936-41.6 71.36-67.84 133.504-84.48 20.48-5.568 41.28-9.6 61.312-12.288l-14.016 2.112zM267.968 218.688l609.664 352a32 32 0 1 1-32 55.424l-609.664-352a32 32 0 1 1 32-55.424z m258.816-106.24a32 32 0 0 1 40.384-42.752l5.056 2.432 295.552 170.624a32 32 0 0 1-12.16 59.52l-83.584 9.984-31.68 138.24-57.984-33.408 32.32-140.992a32 32 0 0 1 21.76-23.424l5.632-1.216 10.56-1.344-129.28-74.624 4.16 9.856a32 32 0 0 1-3.84 31.808l-3.84 4.224L513.92 319.808l-57.984-33.472 104-96.64z"})})},xn=function(){return fe("svg",{className:"icon",viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",children:[fe("path",{d:"M509.4 900.5c-11.6 0-21-9.4-21-21v-168c0-11.6 9.4-21 21-21s21 9.4 21 21v168c0 11.6-9.4 21-21 21z"}),fe("path",{d:"M509.4 933.3c-5.4 0-10.7-2.1-14.8-6.2-8.2-8.2-8.2-21.5 0-29.7l74.2-74.3c8.2-8.2 21.5-8.2 29.7 0s8.2 21.5 0 29.7l-74.2 74.3c-4.2 4.1-9.6 6.2-14.9 6.2z"}),fe("path",{d:"M509.4 933.3c-5.4 0-10.7-2.1-14.8-6.2l-74.2-74.2c-8.2-8.2-8.2-21.5 0-29.7s21.5-8.2 29.7 0l74.2 74.2c8.2 8.2 8.2 21.5 0 29.7-4.2 4.1-9.6 6.2-14.9 6.2zM742.7 803.1c-56 0-110.1-20.3-152.2-57.2-8.7-7.6-9.6-20.9-1.9-29.6 7.6-8.7 20.9-9.6 29.6-1.9 34.4 30.2 78.6 46.8 124.5 46.8 104.2 0 189-84.8 189-189 0-91.8-65.6-170-156.1-185.9l-16.2-2.8-1.1-16.4c-9.2-131.4-119.5-234.3-251.1-234.3-120.4 0-224.4 85.7-247.3 203.8l-2.7 13.8-13.8 2.8C155.8 371 92.2 448.9 92.2 538.4c0 104.2 84.8 189 189 189 43.1 0 83.6-14.1 117.3-40.9 9.1-7.2 22.3-5.7 29.5 3.4 7.2 9.1 5.7 22.3-3.4 29.5-41.2 32.7-90.7 50-143.4 50-127.4 0-231-103.6-231-231 0-104.8 71.3-196.5 171.4-223.2C253.4 184.3 371.4 90.7 507.2 90.7c148.3 0 273.3 111.8 291.5 257.5 102.3 25.4 175 117.1 175 224 0 127.3-103.6 230.9-231 230.9z"})]})},Cn=function(){return fe("svg",{viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",children:fe("path",{d:"M934.4 770.133333L605.866667 181.333333C586.666667 147.2 550.4 128 512 128s-74.666667 21.333333-93.866667 53.333333L89.6 770.133333c-19.2 34.133333-19.2 76.8 0 110.933334S145.066667 938.666667 183.466667 938.666667h657.066666c40.533333 0 74.666667-21.333333 93.866667-57.6 19.2-34.133333 19.2-76.8 0-110.933334zM480 362.666667c0-17.066667 14.933333-32 32-32s29.866667 12.8 32 29.866666V640c0 17.066667-14.933333 32-32 32s-29.866667-12.8-32-29.866667V362.666667zM512 832c-23.466667 0-42.666667-19.2-42.666667-42.666667s19.2-42.666667 42.666667-42.666666 42.666667 19.2 42.666667 42.666666-19.2 42.666667-42.666667 42.666667z",fill:"red"})})},Sn=fe("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"red",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:"margin-left: 6px;",children:[fe("path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"}),fe("path",{d:"M12 9v4"}),fe("path",{d:"M12 17h.01"})]}),_n=fe("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"rgb(0, 185, 107)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-check","aria-hidden":"true",style:"margin-left: 6px;",children:fe("path",{d:"M20 6 9 17l-5-5"})}),Mn=fe("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:"margin-left: 6px;",children:[fe("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),fe("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"})]}),Nn=function(e){return fe("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:e.style,children:fe("path",{d:"m9 18 6-6-6-6"})})},Tn=fe("svg",{className:"icon",title:"知识库",viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"currentColor",xmlnsXlink:"http://www.w3.org/1999/xlink",children:fe("path",{d:"M849.2 80H267.7c-73.8 0.1-133.6 58.2-133.6 129.9v606.7c0.1 70.3 58.6 127.2 130.9 127.3h584.3c22.5 0 40.8-17.8 40.8-39.7V119.6C890 97.8 871.7 80 849.2 80z m-40.9 784.6H264.8c-27.2 0-49.2-21.5-49.2-47.9s22-47.9 49.2-47.9h543.5v95.8z m0-175.1H264.8c-16.9 0-33.6 3.1-49.2 9.3V209.9c0-27.9 23.3-50.5 52-50.6h276.8v224.4c0 5.9 6.3 9.8 11.6 7.2l67.7-33.8c4.5-2.3 9.8-2.3 14.3 0l67.7 33.8c5.3 2.7 11.6-1.2 11.6-7.2V159.4h91.1l-0.1 530.1z"})}),On=fe("svg",{className:"icon",viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",children:fe("path",{d:"M85.312 85.312h853.376v853.376H85.312V85.312z m85.376 768h579.648L384 487.04l-213.312 213.376v152.96z m682.624-17.664V170.688H170.688v408.96L384 366.336l469.312 469.312z m-179.328-526.336a42.688 42.688 0 1 0 0 85.376 42.688 42.688 0 0 0 0-85.376z m-128 42.688a128 128 0 1 1 256 0 128 128 0 0 1-256 0z",fill:"currentColor"})}),En=fe("svg",{viewBox:"0 0 79 86",version:"1.1",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",children:[fe("defs",{children:[fe("linearGradient",{id:"linearGradient-1-el-id-655-578",x1:"38.8503086%",y1:"0%",x2:"61.1496914%",y2:"100%",children:[fe("stop",{stopColor:"var(--el-empty-fill-color-1)",offset:"0%"}),fe("stop",{stopColor:"var(--el-empty-fill-color-4)",offset:"100%"})]}),fe("linearGradient",{id:"linearGradient-2-el-id-655-578",x1:"0%",y1:"9.5%",x2:"100%",y2:"90.5%",children:[fe("stop",{stopColor:"var(--el-empty-fill-color-1)",offset:"0%"}),fe("stop",{stopColor:"var(--el-empty-fill-color-6)",offset:"100%"})]}),fe("rect",{id:"path-3-el-id-655-578",x:"0",y:"0",width:"17",height:"36"})]}),fe("g",{id:"Illustrations",stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd",children:fe("g",{id:"B-type",transform:"translate(-1268.000000, -535.000000)",children:fe("g",{id:"Group-2",transform:"translate(1268.000000, 535.000000)",children:[fe("path",{id:"Oval-Copy-2",d:"M39.5,86 C61.3152476,86 79,83.9106622 79,81.3333333 C79,78.7560045 57.3152476,78 35.5,78 C13.6847524,78 0,78.7560045 0,81.3333333 C0,83.9106622 17.6847524,86 39.5,86 Z",fill:"var(--el-empty-fill-color-3)"}),fe("polygon",{id:"Rectangle-Copy-14",fill:"var(--el-empty-fill-color-7)",transform:"translate(27.500000, 51.500000) scale(1, -1) translate(-27.500000, -51.500000) ",points:"13 58 53 58 42 45 2 45"}),fe("g",{id:"Group-Copy",transform:"translate(34.500000, 31.500000) scale(-1, 1) rotate(-25.000000) translate(-34.500000, -31.500000) translate(7.000000, 10.000000)",children:[fe("polygon",{id:"Rectangle-Copy-10",fill:"var(--el-empty-fill-color-7)",transform:"translate(11.500000, 5.000000) scale(1, -1) translate(-11.500000, -5.000000) ",points:"2.84078316e-14 3 18 3 23 7 5 7"}),fe("polygon",{id:"Rectangle-Copy-11",fill:"var(--el-empty-fill-color-5)",points:"-3.69149156e-15 7 38 7 38 43 -3.69149156e-15 43"}),fe("rect",{id:"Rectangle-Copy-12",fill:"var(--el-empty-fill-color-3)",transform:"translate(46.500000, 25.000000) scale(-1, 1) translate(-46.500000, -25.000000) ",x:"38",y:"7",width:"17",height:"36"}),fe("polygon",{id:"Rectangle-Copy-13",fill:"var(--el-empty-fill-color-2)",transform:"translate(39.500000, 3.500000) scale(-1, 1) translate(-39.500000, -3.500000) ",points:"24 7 41 7 55 -3.63806207e-12 38 -3.63806207e-12"})]}),fe("rect",{id:"Rectangle-Copy-15",fill:"var(--el-empty-fill-color-2)",x:"13",y:"45",width:"40",height:"36"}),fe("g",{id:"Rectangle-Copy-17",transform:"translate(53.000000, 45.000000)",children:[fe("use",{id:"Mask",fill:"var(--el-empty-fill-color-8)",transform:"translate(8.500000, 18.000000) scale(-1, 1) translate(-8.500000, -18.000000) ",xlinkHref:"#path-3-el-id-655-578"}),fe("polygon",{id:"Rectangle-Copy",fill:"var(--el-empty-fill-color-9)",mask:"var(--el-empty-fill-color-5)",transform:"translate(12.000000, 9.000000) scale(-1, 1) translate(-12.000000, -9.000000) ",points:"7 0 24 0 20 18 7 16.5"})]}),fe("polygon",{id:"Rectangle-Copy-18",fill:"var(--el-empty-fill-color-2)",transform:"translate(66.000000, 51.500000) scale(-1, 1) translate(-66.000000, -51.500000) ",points:"62 45 79 45 70 58 53 58"})]})})})]}),An=function(){return fe("svg",{className:"icon",viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",children:[fe("path",{d:"M516.461 20.457c-274.346 0-496.742 222.394-496.742 496.742s222.394 496.742 496.742 496.742 496.742-222.394 496.742-496.742-222.394-496.742-496.742-496.742zM516.461 964.278c-246.527 0-447.079-200.547-447.079-447.079s200.547-447.079 447.079-447.079 447.079 200.547 447.079 447.079-200.547 447.079-447.079 447.079z",fill:""}),fe("path",{d:"M741.978 291.67c-12.099-12.117-31.79-12.117-43.905 0l-181.633 181.633-181.633-181.633c-12.102-12.117-31.795-12.117-43.905 0-12.117 12.102-12.117 31.79 0 43.905l181.633 181.633-181.633 181.633c-12.117 12.102-12.117 31.79 0 43.905 6.032 6.061 13.984 9.073 21.942 9.073 7.926 0 15.886-3.03 21.942-9.073l181.633-181.633 181.633 181.633c6.061 6.061 14.002 9.073 21.942 9.073s15.886-3.03 21.942-9.073c12.117-12.102 12.117-31.79 0-43.905l-181.669-181.633 181.633-181.633c12.117-12.102 12.117-31.79 0-43.905z",fill:""})]})},Dn=function(){return fe("svg",{className:"icon",viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",children:[fe("path",{d:"M512 85.333333C276.48 85.333333 85.333333 276.48 85.333333 512S276.48 938.666667 512 938.666667 938.666667 747.52 938.666667 512 747.52 85.333333 512 85.333333z m0 796.444445c-203.662222 0-369.777778-166.115556-369.777778-369.777778S308.337778 142.222222 512 142.222222 881.777778 308.337778 881.777778 512 715.662222 881.777778 512 881.777778z"}),fe("path",{d:"M678.115556 385.706667L461.937778 591.644444l-116.053334-110.364444c-11.377778-11.377778-29.582222-10.24-39.822222 1.137778-11.377778 11.377778-10.24 29.582222 1.137778 39.822222l135.395556 129.706667c5.688889 5.688889 12.515556 7.964444 19.342222 7.964444s13.653333-2.275556 19.342222-7.964444L716.8 426.666667c11.377778-11.377778 11.377778-28.444444 1.137778-39.822223-10.24-12.515556-28.444444-12.515556-39.822222-1.137777z"})]})},In=function(){return fe("svg",{className:"icon",viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",children:fe("path",{d:"M896 170.688c47.104 0 85.312 38.144 85.312 85.312v512c0 47.104-38.208 85.312-85.312 85.312H128A85.312 85.312 0 0 1 42.688 768V256c0-47.168 38.208-85.312 85.312-85.312h768z m-533.312 64H128c-10.496 0-19.2 7.488-20.992 17.472L106.688 256v512c0 10.496 7.552 19.2 17.472 20.992l3.84 0.32h234.688V234.688z m533.312 0H426.688v554.624H896c10.496 0 19.2-7.552 20.992-17.472l0.32-3.84V256c0-10.496-7.552-19.2-17.472-20.992L896 234.624zM298.688 469.248a21.312 21.312 0 0 1 0 42.688h-128a21.312 21.312 0 1 1 0-42.688h128z m0-85.312a21.312 21.312 0 0 1 0 42.688h-128a21.312 21.312 0 1 1 0-42.688h128z m0-85.312a21.312 21.312 0 0 1 0 42.624h-128a21.312 21.312 0 1 1 0-42.688h128z",fill:"currentColor"})})},zn=function(){return fe("svg",{className:"icon",viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",children:fe("path",{d:"M204.288 285.696c9.728 0 19.456-3.584 27.136-11.264 48.64-49.152 110.592-84.48 179.712-101.888 20.48-5.12 32.768-26.112 27.648-46.08-5.12-20.48-26.112-32.768-46.08-27.648-82.432 20.992-156.672 62.976-215.04 121.856-14.848 14.848-14.848 38.912 0.512 53.76 7.168 7.68 16.384 11.264 26.112 11.264zM602.112 92.16c-20.48-4.096-40.448 9.728-44.544 30.208-4.096 20.48 9.728 40.448 30.208 44.544 72.192 13.824 138.24 46.08 190.976 94.208 7.168 6.656 16.384 9.728 25.6 9.728 10.24 0 20.48-4.096 28.16-12.288 14.336-15.36 13.312-39.424-2.56-53.76-62.464-57.344-141.824-96.256-227.84-112.64zM948.736 386.56c-6.656-19.968-28.16-30.72-48.128-24.576-19.968 6.656-30.72 28.16-24.576 48.128 10.752 32.768 15.872 67.072 15.872 101.376 0 42.496-8.192 83.456-24.064 122.88-7.68 19.456 1.536 41.472 20.992 49.664 4.608 2.048 9.728 2.56 14.336 2.56 14.848 0 29.184-9.216 35.328-24.064 19.456-48.128 29.184-99.328 29.184-151.552 0.512-41.472-6.144-83.968-18.944-124.416zM775.168 765.952c-52.224 46.592-117.248 77.824-187.904 91.136-20.48 3.584-34.304 23.552-30.208 44.544 3.584 18.432 19.456 31.232 37.376 31.232 2.048 0 4.608 0 7.168-0.512 84.48-15.872 161.792-53.248 224.768-109.056 15.872-13.824 16.896-37.888 3.072-53.76-14.336-16.384-38.4-17.408-54.272-3.584zM415.232 851.968c-2.048-0.512-4.608-1.024-7.68-2.048-13.312-3.584-27.136-5.632-40.96-5.632H166.4l35.328-98.816c4.608-12.8 2.56-27.136-5.632-37.888-12.288-16.896-36.352-20.992-53.248-8.704-9.216 6.656-14.848 16.896-15.36 27.648l-49.152 138.24c-4.608 12.8-2.56 26.624 5.12 37.376 7.68 10.752 20.48 17.408 33.792 17.408h240.128c11.776 0 24.064 1.024 35.84 4.096 6.144 1.536 11.776 2.56 12.8 2.56 16.896 0 32.768-11.776 36.864-29.184 5.12-19.456-7.168-39.936-27.648-45.056zM108.032 651.264c3.584 0 7.168-0.512 10.752-1.536 19.968-5.632 31.744-27.136 26.112-47.104-8.704-29.696-12.8-59.904-12.8-91.136 0-33.792 5.12-66.56 15.36-98.816 6.144-19.968-4.608-41.472-24.576-47.616-19.968-6.144-41.472 4.608-47.616 24.576-12.288 39.424-18.944 80.384-18.944 121.344 0 37.888 5.12 75.776 15.872 112.128 4.096 17.408 19.456 28.16 35.84 28.16z"})})},Rn=function(){return fe("svg",{className:"icon",viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",children:fe("path",{d:"M204.288 285.184c9.728 0 19.456-3.584 27.136-11.264 48.64-49.152 111.104-84.48 179.712-101.888 20.48-5.12 32.768-26.112 27.648-46.08-5.12-20.48-26.112-32.768-46.08-27.648-82.432 20.992-156.672 62.976-215.04 121.856-14.848 14.848-14.848 38.912 0.512 53.76 6.656 7.68 16.384 11.264 26.112 11.264zM602.624 92.16c-20.48-4.096-40.448 9.728-44.544 30.208-4.096 20.48 9.728 40.448 30.208 44.544 72.192 13.824 138.24 46.08 190.976 94.72 7.168 6.656 16.384 9.728 25.6 9.728 10.24 0 20.48-4.096 28.16-12.288 14.336-15.36 13.312-39.424-2.56-53.76-62.976-57.856-141.824-97.28-227.84-113.152zM949.248 386.56c-6.656-19.968-28.16-30.72-48.128-24.576-19.968 6.656-30.72 28.16-24.576 48.128 10.752 32.768 15.872 67.072 15.872 101.888 0 42.496-8.192 83.968-24.064 122.88-7.68 19.456 1.536 41.472 20.992 49.664 4.608 2.048 9.728 2.56 14.336 2.56 14.848 0 29.184-9.216 35.328-24.064 19.456-48.64 29.696-99.328 29.696-151.552 0-42.496-6.656-84.48-19.456-124.928zM775.68 765.952c-52.224 46.592-117.248 77.824-187.904 91.136-20.48 3.584-34.304 23.552-30.72 44.544 3.584 18.432 19.456 31.232 37.376 31.232 2.048 0 4.608 0 7.168-0.512 84.48-15.872 162.304-53.248 224.768-109.056 15.872-13.824 17.408-37.888 3.072-53.76-14.336-15.872-38.4-17.408-53.76-3.584zM415.232 852.48c-2.048-0.512-4.608-1.024-7.68-2.048-13.312-3.584-27.136-5.632-40.96-5.632H166.4l35.328-98.816c4.608-12.8 2.56-27.136-5.632-37.888-12.288-16.896-36.352-20.992-53.248-8.704-9.216 6.656-14.848 16.896-15.36 27.648l-49.664 138.24c-4.608 12.8-2.56 26.624 5.12 37.376 7.68 10.752 20.48 17.408 33.792 17.408h240.64c11.776 0 24.064 1.024 35.84 4.096 6.144 1.536 11.776 2.56 13.312 2.56 16.896 0 32.768-11.776 36.864-29.184 4.608-19.456-8.192-39.936-28.16-45.056zM107.52 651.776c3.584 0 7.168-0.512 10.752-1.536 19.968-5.632 31.744-27.136 26.112-47.104-8.704-29.696-12.8-59.904-12.8-91.136 0-33.792 5.12-67.072 15.36-98.816 6.144-19.968-4.608-41.472-25.088-47.616-19.968-6.144-41.472 4.608-47.616 25.088-12.288 39.424-18.944 80.384-18.944 121.856 0 37.888 5.12 75.776 15.872 112.128 4.608 15.872 19.968 27.136 36.352 27.136zM658.944 390.656c-17.408-11.776-40.96-7.168-52.736 10.752l-141.824 212.48-71.68-71.68c-14.848-14.848-38.912-14.848-53.76 0-14.848 14.848-14.848 38.912 0 53.76l104.96 104.96c7.168 7.168 16.896 11.264 27.136 11.264h3.584c11.264-1.024 21.504-7.168 28.16-16.896l167.424-251.392c10.752-17.92 6.144-41.472-11.264-53.248z"})})},Pn=function(){return fe("svg",{className:"icon",viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",children:fe("path",{d:"M811.097325 675.11798a38.455724 38.455724 0 0 1-54.382232 0L511.992078 430.406848 267.269064 675.11798a38.453744 38.453744 0 0 1-54.383222-54.380252l271.91116-271.899277a38.454734 38.454734 0 0 1 54.383222 0l271.911159 271.899277a38.450773 38.450773 0 0 1 0.005942 54.380252z",fill:"currentColor"})})},Ln=function(e){var t=e.items,n=Lt([]),r=new ve("chat-thought-chain"),i=Lt([]);Ye(function(){i.value=t.filter(function(e){return e.description}),i.value.length>0&&i.value.forEach(function(e,t){e.done&&(n.value=[].concat(c(n.value),[t]))})},[t]);return 0===i.value.length?null:fe("div",{className:"".concat(r.b()," ").concat(r.is("single",1===i.value.length)),children:i.value.map(function(e,t){if(e.description){var i=n.value.includes(t);return fe("div",{className:"".concat(r.e("item")," ").concat(r.is("collapsed",i)),children:[fe("div",{className:r.e("item-icon"),children:e.icon||fe("span",{children:t})}),fe("div",{className:r.e("item-content"),children:[fe("div",{className:r.e("item-title"),onClick:function(){return function(e){n.value.includes(e)?n.value=n.value.filter(function(t){return t!==e}):n.value=[].concat(c(n.value),[e])}(t)},children:[e.title,fe(tn,{className:r.e("icon")})]}),fe("div",{className:r.e("item-description"),children:e.description})]})]},t)}})})},Bn=function(e){var t=e.suggestions,n=e.onSuggestionClick,r=e.uiactions,i=e.onUIActionClick,o=new ve("chat-suggestions");return fe("div",{className:"".concat(o.b()),children:[t&&t.length>0&&t.map(function(e,t){return fe("div",{className:"".concat(o.e("item")," ").concat(o.is("action","action"===e.type)),onClick:function(t){return function(e,t){null==n||n(e,t)}(e,t)},title:e.metadata.content_name,children:[e.metadata.content_name,fe(vn,{className:"".concat(o.e("item-icon"))})]},t)}),r&&r.length>0&&r.map(function(e,t){return fe("div",{className:"".concat(o.e("item")," ").concat(o.is("action","action"===e.type)),onClick:function(t){return function(e,t){null==i||i(e,t)}(e,t)},title:e.metadata.content_name,children:[e.metadata.content_name,fe(vn,{className:"".concat(o.e("item-icon"))})]},"action-".concat(t))})]})},Vn=function(e){var t,n,r,i=new ve("default-tool-call"),o=Lt(!1),a=Lt(!1);Ye(function(){return function(){r&&clearTimeout(r)}},[]);var s=function(e){return"string"==typeof e?e.includes("Failed")||e.includes("Error")||e.includes("ERR_")?'<span class="error">"'.concat(e,'"</span>'):'<span class="string">"'.concat(e,'"</span>'):"number"==typeof e?'<span class="number">'.concat(e,"</span>"):"boolean"==typeof e?'<span class="boolean">'.concat(e,"</span>"):null===e?'<span class="null">null</span>':""},l=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=" ".repeat(t),r=[];if(Array.isArray(e)){if(0===e.length)return["".concat(n,'<span class="array">[]</span>')];r.push("".concat(n,'<span class="array">[</span>')),e.forEach(function(n,i){var o=l(n,t+1),a=i<e.length-1?",":"";"object"===N(n)&&null!==n?(r.push.apply(r,c(o.slice(0,-1))),r.push("".concat(o[o.length-1]).concat(a))):r.push("".concat(o[0]).concat(a))}),r.push("".concat(n,'<span class="array">]</span>'))}else if("object"===N(e)&&null!==e){var i=Object.keys(e);if(0===i.length)return["".concat(n,'<span class="property">{}</span>')];r.push("".concat(n,'<span class="property">{</span>')),i.forEach(function(o,a){var u=e[o],d=a<i.length-1?",":"",h='<span class="json-key">"'.concat(o,'":</span>');if("object"===N(u)&&null!==u){var f=l(u,t+1);r.push("".concat(n," ").concat(h," ").concat(f[0].trim())),f.length>1&&(r.push.apply(r,c(f.slice(1,-1))),r.push("".concat(f[f.length-1]).concat(d)))}else{var p=s(u);r.push("".concat(n," ").concat(h," ").concat(p).concat(d))}}),r.push("".concat(n,'<span class="property">}</span>'))}else r.push("".concat(n).concat(s(e)));return r},u=Bt(function(){return l(e.item,0).map(function(e,t){return'<span class="line-number">'.concat(t+1,"</span>").concat(e)})});return fe("div",{className:"".concat(i.b()," ").concat(e.className||""),children:[fe("div",{className:i.e("header"),onClick:function(){o.value=!o.value},children:[fe("div",{className:i.e("header-left"),children:[fe("div",{className:i.em("header-left","caption"),children:e.item.name}),fe("div",{className:i.em("header-left","desc"),title:(null===(t=e.item.parameters)||void 0===t?void 0:t.desc)||"",children:(null===(n=e.item.parameters)||void 0===n?void 0:n.desc)||""})]}),fe("div",{className:i.e("header-right"),children:[e.item.error&&fe("span",{style:"color: red;",children:"发生错误"}),e.item.error&&Sn,fe("span",{title:"复制",className:i.e("copy"),onClick:function(t){return function(t){t.stopPropagation(),a.value||(r&&clearTimeout(r),a.value=!0,navigator.clipboard.writeText(JSON.stringify(e.item,void 0,2)),window.ibiz.message.success("已复制"),r=setTimeout(function(){a.value=!1},2e3))}(t)},children:a.value?_n:Mn}),fe(Nn,{style:{"margin-left":" 6px",transform:o.value?"rotate(90deg)":"rotate(0deg)"}})]})]}),o.value&&fe("div",{className:i.e("content"),children:u.value.map(function(e,t){return fe("div",{className:"code-line",dangerouslySetInnerHTML:{__html:e}},t)})})]})},Fn=function(e){var t,n,r,i=new ve("chunk-tool-call"),o=Lt([]),a=Lt(!1),s=Lt(!1);Ye(function(){var t,n=d((null===(t=e.item.result)||void 0===t?void 0:t.chunks)||[]),r=n.filter(function(e){return"SOURCE"===e.type}),i=n.filter(function(e){return"SOURCE"!==e.type});i.forEach(function(e){"CLUSTER"===e.type&&(e.children=r.filter(function(t){return t.pid===e.id}),e.isExpand=!1)}),o.value=i},[e.item]),Ye(function(){return function(){r&&clearTimeout(r)}},[]);var l=function(e){return fe("div",{className:i.e("footer"),children:["CLUSTER"===e.type&&(e.source_count||0===e.source_count)&&fe("div",{className:i.em("footer","description"),children:["由",e.source_count,"个原文段落智能总结生成"]}),fe("div",{className:i.em("footer","docname"),children:e.docname})]})},u=function(e){var t;return fe("div",{className:"".concat(i.e("item")," ").concat(i.em("item",(null===(t=e.type)||void 0===t?void 0:t.toLowerCase())||"default")),children:["KBGUIDANCE"===e.type?fe("div",{className:i.e("kbguidance"),children:"[引导]"}):fe("div",{className:i.e("similarity"),style:"--percent: ".concat((100*(e.similarity||0)).toFixed(2),"%;"),children:"SCORE ".concat((e.similarity||0).toFixed(2))}),e.original&&fe("div",{className:i.e("original"),children:"(向量".concat((e.original||0).toFixed(2),")")}),fe("div",{className:i.em("item","content"),title:e.content,children:e.content})]},e.id)},h=function(e){var t,n;return"CLUSTER"===e.type?fe("div",{className:"".concat(i.e("chunk")," ").concat(i.e("cluster")),children:[fe("div",{className:i.em("cluster","header"),children:[fe("div",{className:i.e("similarity"),style:"--percent: ".concat((100*(e.similarity||0)).toFixed(2),"%;"),children:"SCORE ".concat((e.similarity||0).toFixed(2))}),e.original&&fe("div",{className:i.e("original"),children:"(向量".concat((e.original||0).toFixed(2),")")}),fe("div",{className:i.em("cluster","title"),children:"[摘要]"}),fe("div",{className:i.em("cluster","summary"),title:e.content,children:e.content})]}),fe("div",{className:i.em("cluster","content"),children:[fe("div",{className:i.em("cluster","icon"),onClick:function(t){return function(e,t){e.stopPropagation(),t.isExpand=!t.isExpand,o.value=c(o.value)}(t,e)},children:[fe(Nn,{style:{transform:e.isExpand?"rotate(90deg)":"rotate(0deg)"}}),"命中 ".concat((null===(t=e.children)||void 0===t?void 0:t.length)||0," 个子段落")]}),e.isExpand&&fe("div",{className:i.em("cluster","children"),children:null===(n=e.children)||void 0===n?void 0:n.map(function(e){return u(e)})})]}),l(e)]},e.id):fe("div",{className:"".concat(i.e("chunk")," ").concat(i.e("default")),children:[u(e),l(e)]},e.id)};return fe("div",{className:"".concat(i.b()," ").concat(e.className||""),children:[fe("div",{className:i.e("header"),onClick:function(){a.value=!a.value},children:[fe("div",{className:i.e("header-left"),children:[fe("div",{className:i.em("header-left","icon"),children:Tn}),fe("div",{className:i.em("header-left","caption"),children:"知识库检索:"}),fe("div",{className:i.em("header-left","desc"),title:null===(t=e.item.result)||void 0===t?void 0:t.query,children:null===(n=e.item.result)||void 0===n?void 0:n.query})]}),fe("div",{className:i.e("header-right"),children:[e.item.error&&fe("span",{style:"color: red;",children:"发生错误"}),e.item.error&&Sn,fe("span",{title:"复制",className:i.e("copy"),onClick:function(t){return function(t){t.stopPropagation(),s.value||(r&&clearTimeout(r),s.value=!0,navigator.clipboard.writeText(JSON.stringify(e.item,void 0,2)),window.ibiz.message.success("已复制"),r=setTimeout(function(){s.value=!1},2e3))}(t)},children:s.value?_n:Mn}),fe(Nn,{style:{"margin-left":" 6px",transform:a.value?"rotate(90deg)":"rotate(0deg)"}})]})]}),a.value&&fe("div",{className:i.e("content"),children:e.item.error?fe("div",{className:"".concat(i.e("error")," ").concat(i.e("center-text")),children:e.item.result}):o.value.length>0?o.value.map(function(e){return h(e)}):fe("div",{className:"".concat(i.e("center-text")),children:"无数据"})})]})},jn=function(e){var t=new ve("chat-image-preview");return fe("div",{className:"el-image-viewer__wrapper ".concat(t.b()),children:[fe("div",{className:"el-image-viewer__mask",onClick:function(t){var n;return null===(n=e.onClose)||void 0===n?void 0:n.call(e,t)}}),fe("span",{className:"el-image-viewer__btn el-image-viewer__close",onClick:function(t){var n;return null===(n=e.onClose)||void 0===n?void 0:n.call(e,t)},children:fe("i",{className:"el-icon",children:fe("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",children:fe("path",{fill:"currentColor",d:"M764.288 214.592 512 466.88 259.712 214.592a31.936 31.936 0 0 0-45.12 45.12L466.752 512 214.528 764.224a31.936 31.936 0 1 0 45.12 45.184L512 557.184l252.288 252.288a31.936 31.936 0 0 0 45.12-45.12L557.12 512.064l252.288-252.352a31.936 31.936 0 1 0-45.12-45.184z"})})})}),fe("div",{className:"el-image-viewer__canvas",onClick:function(e){return e.stopPropagation()},children:fe("img",{src:e.src,className:"el-image-viewer__img",style:"transform: scale(1) rotate(0deg) translate(0px, 0px);"})})]})},$n=function(e){var t,n,r,i,o=new ve("image-tool-call"),a=Lt(!1),s=Lt(!1),c=Lt(!1);Ye(function(){return function(){i&&clearTimeout(i)}},[]);var l,u,d,h,f=function(){var t;null!==(t=e.item.result)&&void 0!==t&&t.image_url&&(a.value=!a.value)};return fe("div",{className:"".concat(o.b()," ").concat(e.className||""),children:[fe("div",{className:o.e("header"),onClick:function(){s.value=!s.value},children:[fe("div",{className:o.e("header-left"),children:[fe("div",{className:o.em("header-left","icon"),children:On}),fe("div",{className:o.em("header-left","caption"),children:"图片内容识别"}),fe("div",{className:o.em("header-left","desc"),title:(null===(t=e.item.parameters)||void 0===t?void 0:t.desc)||"",children:(null===(n=e.item.parameters)||void 0===n?void 0:n.desc)||""})]}),fe("div",{className:o.e("header-right"),children:[e.item.error&&fe("span",{style:"color: red;",children:"发生错误"}),e.item.error&&Sn,fe("span",{title:"复制",className:o.e("copy"),onClick:function(t){return function(t){t.stopPropagation(),c.value||(i&&clearTimeout(i),c.value=!0,navigator.clipboard.writeText(JSON.stringify(e.item,void 0,2)),window.ibiz.message.success("已复制"),i=setTimeout(function(){c.value=!1},2e3))}(t)},children:c.value?_n:Mn}),fe(Nn,{style:{"margin-left":" 6px",transform:s.value?"rotate(90deg)":"rotate(0deg)"}})]})]}),s.value&&fe("div",{className:o.e("content"),children:e.item.error?fe("div",{className:"".concat(o.e("error")," ").concat(o.e("center-text")),children:e.item.result}):null!==(l=e.item.result)&&void 0!==l&&l.image_url||null!==(u=e.item.result)&&void 0!==u&&u.content?[fe("img",{className:o.e("image"),src:null===(d=e.item.result)||void 0===d?void 0:d.image_url,onClick:f},"image"),fe("div",{className:o.e("description"),children:null===(h=e.item.result)||void 0===h?void 0:h.content},"description")]:fe("div",{className:"".concat(o.e("center-text")),children:"无数据"})}),a.value&&fe(jn,{src:null===(r=e.item.result)||void 0===r?void 0:r.image_url,onClose:f})]})},Hn=function(e){var t=new ve("chat-tool-call-item"),n=null;switch(e.item.type){case"fetch_chunks":n=Fn;break;case"desc_oss_image":n=$n;break;default:n=Vn}return $(n,{item:e.item,className:t.b()})},Wn=function(e){var t=e.items,n=new ve("chat-tool-call"),r=Lt([]),i=Lt(!1),o=Lt(!1);Ye(function(){r.value=t.filter(function(e){return e}),o.value=t.length>4},[t]);var a=Bt(function(){return o.value&&!i.value?r.value.slice(0,4):r.value});return fe("div",{className:"".concat(n.b()),children:[!e.toolcallCompleted&&fe("div",{className:n.e("loading-container"),children:[fe("div",{className:n.e("loading-text"),children:"智能体工具调用执行中"}),fe("div",{className:n.e("loading-dot")}),fe("div",{className:n.e("loading-dot")}),fe("div",{className:n.e("loading-dot")})]}),e.toolcallCompleted&&a.value.map(function(e,t){return fe(Hn,{item:e},t)}),e.toolcallCompleted&&o.value&&fe("div",{className:n.e("toggle"),onClick:function(){i.value=!i.value},children:fe("span",{className:n.e("toggle-label"),children:i.value?"工具调用 收缩":"工具调用 展开"})})]})},qn=new ve("chat-search"),Un=function(e){var t=e.className,n=e.value,r=e.placeholder,i=e.onChange,o=e.onEnter,a=g(Xe(!1),2),s=a[0],c=a[1],l=function(e){var t;e.stopPropagation(),null==i||i(null===(t=e.target)||void 0===t?void 0:t.value)};return fe("div",{className:"".concat(qn.b()," ").concat(qn.is("focus",s)," ").concat(t||""),children:[fe("div",{className:qn.e("prefix"),children:fe(mn,{})}),fe("input",{value:n,className:qn.e("inner"),placeholder:r,onFocus:function(){return c(!0)},onBlur:function(){return c(!1)},onChange:function(e){return l(e)},onKeyDown:function(e){var t;"Enter"===e.code&&(null==o||o(null===(t=e.target)||void 0===t?void 0:t.value))}})]})},Kn=new ve("chat-loading"),Jn=function(e){var t=e.size,n=void 0===t?24:t;return fe("div",{className:Kn.b(),children:fe("div",{className:Kn.e("spinner"),style:{width:"".concat(n,"px"),height:"".concat(n,"px")},children:fe(on,{})})})},Gn=new ve("chat-single-select"),Xn=function(e){var t,n=e.value,r=e.options,i=e.popperStyle,o=e.disabled,a=void 0!==o&&o,s=e.showBorder,c=void 0===s||s,l=e.enableSearch,u=void 0!==l&&l,d=e.placeholder,h=void 0===d?"请选择":d,p=e.icon,v=e.onChange,y=e.onSearch,k=!!r.length,w=Qe(null),b=Qe(null),x=Lt(""),C=g(Xe(n),2),S=C[0],_=C[1],M=g(Xe(r),2),N=M[0],T=M[1],O=g(Xe(!1),2),E=O[0],A=O[1],D=g(Xe(!1),2),I=D[0],z=D[1],R=(null===(t=r.find(function(e){return e.value===S}))||void 0===t?void 0:t.label)||h;Ye(function(){!1===E&&(x.value="",T(r))},[E]),Ye(function(){_(n)},[n]),Ye(function(){T(r)},[r]),Ye(function(){var e=function(e){var t,n;!k||a||null!==(t=b.current)&&void 0!==t&&t.contains(e.target)||(null!==(n=w.current)&&void 0!==n&&n.contains(e.target)?A(function(e){return!e}):A(!1))};return document.addEventListener("mousedown",e),function(){document.removeEventListener("mousedown",e)}},[]);var P=function(){var e=m(f().m(function e(t){var n,i;return f().w(function(e){for(;;)switch(e.p=e.n){case 0:if(e.p=0,z(!0),n=[],!y){e.n=2;break}return e.n=1,y(t);case 1:n=e.v,e.n=3;break;case 2:n=r.filter(function(e){return e.label.toLowerCase().includes(t.toLowerCase())});case 3:T(n),e.n=5;break;case 4:e.p=4,i=e.v,T([]),console.error("搜索失败:",i);case 5:return e.p=5,z(!1),e.f(5);case 6:return e.a(2)}},e,null,[[0,4,5,6]])}));return function(t){return e.apply(this,arguments)}}();return fe("div",{className:"".concat(Gn.b()," ").concat(e.className?e.className:""),children:[fe("div",{className:"".concat(Gn.e("button")," ").concat(c?Gn.em("button","border"):""," ").concat(Gn.is("focus",E)),ref:w,children:[p?fe("span",{className:"".concat(Gn.em("button","icon")," ").concat(Gn.em("button","prefix")),children:p()}):null,fe("span",{title:R,className:Gn.em("button","caption"),children:R}),k?fe("span",{className:"".concat(Gn.em("button","icon")," ").concat(Gn.em("button","suffix")),children:E?Pn():gn()}):null]}),E?fe("div",{className:Gn.e("dropdown"),ref:b,style:i,children:[u?fe("div",{className:Gn.em("dropdown","search"),children:fe(Un,{placeholder:"搜索",value:x.value,onEnter:P,onChange:function(e){x.value=e}})}):null,fe("ul",{className:Gn.em("dropdown","list"),children:I?fe(Jn,{}):N.length?N.map(function(e){return fe("li",{title:e.label,onClick:function(){return function(e){_(e.value),null==v||v(e.value),A(!1)}(e)},className:"".concat(Gn.em("dropdown","item")," ").concat(Gn.is("active",e.value===S)),children:e.label},e.value)}):fe("li",{className:"el-empty ".concat(Gn.e("empty")),children:[En,fe("div",{className:Gn.em("empty","text"),children:"暂无数据"})]})})]}):null]})},Yn=new ve("chat-multiple-select"),Zn=function(e){var t=e.value,n=e.options,r=e.placeholder,i=e.popperStyle,o=e.enableSearch,a=void 0!==o&&o,s=e.icon,l=e.onChange,u=e.onSearch,d=Qe(null),h=Qe(null),p=Lt(""),v=g(Xe(!1),2),y=v[0],k=v[1],w=g(Xe(!1),2),b=w[0],x=w[1],C=g(Xe(t||[]),2),S=C[0],_=C[1],M=g(Xe(n),2),N=M[0],T=M[1];Ye(function(){!1===y&&(p.value="",T(n))},[y]),Ye(function(){_(t||[])},[t]),Ye(function(){T(n)},[n]),Ye(function(){var e=function(e){var t,n;e.stopPropagation(),e.target&&null!==(t=h.current)&&void 0!==t&&t.contains(e.target)||(null!==(n=d.current)&&void 0!==n&&n.contains(e.target)?k(function(e){return!e}):k(!1))};return document.addEventListener("mousedown",e),function(){document.removeEventListener("mousedown",e)}},[]);var O=function(){var e=m(f().m(function e(t){var r,i;return f().w(function(e){for(;;)switch(e.p=e.n){case 0:if(e.p=0,x(!0),r=[],!u){e.n=2;break}return e.n=1,u(t);case 1:r=e.v,e.n=3;break;case 2:r=n.filter(function(e){return e.label.toLowerCase().includes(t.toLowerCase())});case 3:T(r),e.n=5;break;case 4:e.p=4,i=e.v,T([]),console.error("搜索失败:",i);case 5:return e.p=5,x(!1),e.f(5);case 6:return e.a(2)}},e,null,[[0,4,5,6]])}));return function(t){return e.apply(this,arguments)}}();return fe("div",{className:"".concat(Yn.b()," ").concat(e.className?e.className:""),onClick:function(t){return function(t){var n,r;t.target&&(null!==(n=h.current)&&void 0!==n&&n.contains(t.target)||null!==(r=d.current)&&void 0!==r&&r.contains(t.target))||e.onEnableChange&&e.onEnableChange()}(t)},children:[fe("div",{className:Yn.e("button"),title:r,children:[s?fe("span",{className:"".concat(Yn.em("button","icon")," ").concat(Yn.em("button","prefix")),children:s()}):null,r?[fe("span",{className:Yn.em("button","caption"),children:r},"placeholder"),fe("span",{ref:d,className:"".concat(Yn.em("button","icon")," ").concat(Yn.em("button","suffix")),children:y?Pn():gn()},"icon")]:null]}),y?fe("div",{className:Yn.e("dropdown"),ref:h,style:i,children:[a?fe("div",{className:Yn.em("dropdown","search"),children:fe(Un,{placeholder:"搜索",value:p.value,onEnter:O,onChange:function(e){p.value=e}})}):null,fe("ul",{className:Yn.em("dropdown","list"),children:b?fe(Jn,{}):N.length?N.map(function(e){return fe("li",{title:e.label,className:Yn.em("dropdown","item"),onClick:function(){return function(e){var t=S.includes(e.value)?S.filter(function(t){return t!==e.value}):[].concat(c(S),[e.value]);_(t),null==l||l(t)}(e)},children:[fe("input",{type:"checkbox",value:e.value,className:Yn.em("dropdown","item-checkbox"),checked:S.includes(e.value)}),fe("div",{className:Yn.em("dropdown","item-label"),children:e.label})]},e.value)}):fe("li",{className:"el-empty ".concat(Yn.e("empty")),children:[En,fe("div",{className:Yn.em("empty","text"),children:"暂无数据"})]})})]}):null]})},Qn=new ve("messsage-toolbar"),er=function(e){var t=e.controller,n=e.message,r=[{id:"islike",label:"点赞",title:"点赞",icon:function(){return fe(yn,{})},onClick:function(){t.messageLike(n._origin)}},{id:"isdislike",label:"点踩",title:"点踩",icon:function(){return fe(kn,{})},onClick:function(){t.messageDisLike(n._origin)}}],i=function(e){var t,n,r,i;return"function"==typeof e.icon?e.icon():null!==(t=e.icon)&&void 0!==t&&t.showIcon&&null!==(n=e.icon)&&void 0!==n&&n.cssClass?fe("i",{className:e.icon.cssClass}):null!==(r=e.icon)&&void 0!==r&&r.showIcon&&null!==(i=e.icon)&&void 0!==i&&i.imagePath?Ce(e.icon.imagePath)?fe("div",{dangerouslySetInnerHTML:{__html:e.icon.imagePath}}):fe("img",{src:e.icon.imagePath}):void 0};return et(function(){return 20===n.state&&!0!==n.completed||"REMOTE"!==t.resourceMode||!n.realmessageid||t.currentTopicDisableStorage},[n.state,n.completed])?fe(W,{}):fe("div",{className:"".concat(Qn.b()),children:r.map(function(e,r){var o="islike"===e.id&&"1"===n.islike||"isdislike"===e.id&&"1"===n.isdislike;return fe("div",{title:e.title,onClick:function(r){return function(e,r){var i;null===(i=r.onClick)||void 0===i||i.call(r,e,r,t.context,t.params,n)}(r,e)},className:"".concat(Qn.e("item")," ").concat(Qn.is("actived",o)),children:i(e)},r)})})};function tr(e,t){for(var n in t)e[n]=t[n];return e}function nr(e,t){for(var n in e)if("__source"!==n&&!(n in t))return!0;for(var r in t)if("__source"!==r&&e[r]!==t[r])return!0;return!1}function rr(e,t){this.props=e,this.context=t}(rr.prototype=new q).isPureReactComponent=!0,rr.prototype.shouldComponentUpdate=function(e,t){return nr(this.props,e)||nr(this.state,t)};var ir=v.__b;v.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),ir&&ir(e)};var or="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.forward_ref")||3911;var ar=v.__e;v.__e=function(e,t,n,r){if(e.then)for(var i,o=t;o=o.__;)if((i=o.__c)&&i.__c)return null==t.__e&&(t.__e=n.__e,t.__k=n.__k),i.__c(e,t);ar(e,t,n,r)};var sr=v.unmount;function cr(e,t,n){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(e){"function"==typeof e.__c&&e.__c()}),e.__c.__H=null),null!=(e=tr({},e)).__c&&(e.__c.__P===n&&(e.__c.__P=t),e.__c.__e=!0,e.__c=null),e.__k=e.__k&&e.__k.map(function(e){return cr(e,t,n)})),e}function lr(e,t,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(e){return lr(e,t,n)}),e.__c&&e.__c.__P===t&&(e.__e&&n.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=n)),e}function ur(){this.__u=0,this.o=null,this.__b=null}function dr(e){var t=e.__.__c;return t&&t.__a&&t.__a(e)}function hr(){this.i=null,this.l=null}v.unmount=function(e){var t=e.__c;t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),sr&&sr(e)},(ur.prototype=new q).__c=function(e,t){var n=t.__c,r=this;null==r.o&&(r.o=[]),r.o.push(n);var i=dr(r.__v),o=!1,a=function(){o||(o=!0,n.__R=null,i?i(s):s())};n.__R=a;var s=function(){if(! --r.__u){if(r.state.__a){var e=r.state.__a;r.__v.__k[0]=lr(e,e.__c.__P,e.__c.__O)}var t;for(r.setState({__a:r.__b=null});t=r.o.pop();)t.forceUpdate()}};r.__u++||32&t.__u||r.setState({__a:r.__b=r.__v.__k[0]}),e.then(a,a)},ur.prototype.componentWillUnmount=function(){this.o=[]},ur.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement("div"),r=this.__v.__k[0].__c;this.__v.__k[0]=cr(this.__b,n,r.__O=r.__P)}this.__b=null}var i=t.__a&&$(W,null,e.fallback);return i&&(i.__u&=-33),[$(W,null,t.__a?null:e.children),i]};var fr=function(e,t,n){if(++n[1]===n[0]&&e.l.delete(t),e.props.revealOrder&&("t"!==e.props.revealOrder[0]||!e.l.size))for(n=e.i;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;e.i=n=n[2]}};function pr(e){return this.getChildContext=function(){return e.context},e.children}function vr(e){var t=this,n=e.h;if(t.componentWillUnmount=function(){de(null,t.v),t.v=null,t.h=null},t.h&&t.h!==n&&t.componentWillUnmount(),!t.v){for(var r=t.__v;null!==r&&!r.__m&&null!==r.__;)r=r.__;t.h=n,t.v={nodeType:1,parentNode:n,childNodes:[],__k:{__m:r.__m},contains:function(){return!0},insertBefore:function(e,n){this.childNodes.push(e),t.h.insertBefore(e,n)},removeChild:function(e){this.childNodes.splice(this.childNodes.indexOf(e)>>>1,1),t.h.removeChild(e)}}}de($(pr,{context:t.context},e.__v),t.v)}function mr(e,t){var n=$(vr,{__v:e,h:t});return n.containerInfo=t,n}(hr.prototype=new q).__a=function(e){var t=this,n=dr(t.__v),r=t.l.get(e);return r[0]++,function(i){var o=function(){t.props.revealOrder?(r.push(i),fr(t,e,r)):i()};n?n(o):o()}},hr.prototype.render=function(e){this.i=null,this.l=new Map;var t=Z(e.children);e.revealOrder&&"b"===e.revealOrder[0]&&t.reverse();for(var n=t.length;n--;)this.l.set(t[n],this.i=[1,0,this.i]);return e.children},hr.prototype.componentDidUpdate=hr.prototype.componentDidMount=function(){var e=this;this.l.forEach(function(t,n){fr(e,n,t)})};var gr="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,yr=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,kr=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,wr=/[A-Z0-9]/g,br="undefined"!=typeof document,xr=function(e){return("undefined"!=typeof Symbol&&"symbol"==N(Symbol())?/fil|che|rad/:/fil|che|ra/).test(e)};q.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(q.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var Cr=v.event;function Sr(){}function _r(){return this.cancelBubble}function Mr(){return this.defaultPrevented}v.event=function(e){return Cr&&(e=Cr(e)),e.persist=Sr,e.isPropagationStopped=_r,e.isDefaultPrevented=Mr,e.nativeEvent=e};var Nr={enumerable:!1,configurable:!0,get:function(){return this.class}},Tr=v.vnode;v.vnode=function(e){"string"==typeof e.type&&function(e){var t=e.props,n=e.type,r={},i=-1===n.indexOf("-");for(var o in t){var a=t[o];if(!("value"===o&&"defaultValue"in t&&null==a||br&&"children"===o&&"noscript"===n||"class"===o||"className"===o)){var s=o.toLowerCase();"defaultValue"===o&&"value"in t&&null==t.value?o="value":"download"===o&&!0===a?a="":"translate"===s&&"no"===a?a=!1:"o"===s[0]&&"n"===s[1]?"ondoubleclick"===s?o="ondblclick":"onchange"!==s||"input"!==n&&"textarea"!==n||xr(t.type)?"onfocus"===s?o="onfocusin":"onblur"===s?o="onfocusout":kr.test(o)&&(o=s):s=o="oninput":i&&yr.test(o)?o=o.replace(wr,"-$&").toLowerCase():null===a&&(a=void 0),"oninput"===s&&r[o=s]&&(o="oninputCapture"),r[o]=a}}"select"==n&&r.multiple&&Array.isArray(r.value)&&(r.value=Z(t.children).forEach(function(e){e.props.selected=-1!=r.value.indexOf(e.props.value)})),"select"==n&&null!=r.defaultValue&&(r.value=Z(t.children).forEach(function(e){e.props.selected=r.multiple?-1!=r.defaultValue.indexOf(e.props.value):r.defaultValue==e.props.value})),t.class&&!t.className?(r.class=t.class,Object.defineProperty(r,"className",Nr)):(t.className&&!t.class||t.class&&t.className)&&(r.class=r.className=t.className),e.props=r}(e),e.$$typeof=gr,Tr&&Tr(e)};var Or=v.__r;v.__r=function(e){Or&&Or(e),e.__c};var Er=v.diffed;v.diffed=function(e){Er&&Er(e);var t=e.props,n=e.__e;null!=n&&"textarea"===e.type&&"value"in t&&t.value!==n.value&&(n.value=null==t.value?"":t.value)};var Ar=new ve("chat-slider"),Dr=function(e){function t(t){var n=tr({},t);return delete n.ref,e(n,t.ref||null)}return t.$$typeof=or,t.render=e,t.prototype.isReactComponent=t.__f=!0,t.displayName="ForwardRef("+(e.displayName||e.name)+")",t}(function(e,t){var n=e.min,r=e.max,i=e.step,o=e.onChange,a=Qe(null),s=Lt(e.value),c=Math.max.apply(null,[n,r,i].map(function(e){var t="".concat(e).split(".")[1];return t?t.length:0})),l=Qe({dragging:!1,startX:0,newPosition:0,startPosition:0}),u=Bt(function(){return"".concat((s.value-n)/(r-n)*100,"%")});Ye(function(){s.value=e.value},[e.value]);var d=function(e){var t,n;return e.type.startsWith("touch")?(n=e.touches[0].clientY,t=e.touches[0].clientX):(n=e.clientY,t=e.clientX),{clientX:t,clientY:n}},h=function(){var t=m(f().m(function t(a){var s,l,u;return f().w(function(t){for(;;)switch(t.n){case 0:if(null!==a&&!Number.isNaN(+a)){t.n=1;break}return t.a(2);case 1:a<0?a=0:a>100&&(a=100),s=100/((r-n)/i),l=Math.round(a/s),u=l*s*(r-n)*.01+n,(u=Number.parseFloat(u.toFixed(c)))!==e.value&&o(u);case 2:return t.a(2)}},t)}));return function(e){return t.apply(this,arguments)}}(),p=function(e){if(l.current.dragging){var t=d(e).clientX,n=a.current.parentElement.clientWidth,r=(t-l.current.startX)/n*100;l.current.newPosition=l.current.startPosition+r,h(l.current.newPosition)}},v=function(){l.current.dragging&&(l.current.dragging=!1,window.removeEventListener("mousemove",p),window.removeEventListener("touchmove",p),window.removeEventListener("mouseup",v),window.removeEventListener("touchend",v))},g=function(e){e.preventDefault(),function(e){var t=d(e).clientX,n=Number.parseFloat(u.value);Object.assign(l.current,{dragging:!0,startX:t,startPosition:n,newPosition:n})}(e),window.addEventListener("mousemove",p),window.addEventListener("touchmove",p),window.addEventListener("mouseup",v),window.addEventListener("touchend",v),a.current.focus()};return function(e,t,n){Fe=6,Ze(function(){if("function"==typeof e){var n=e(t());return function(){e(null),n&&"function"==typeof n&&n()}}if(e)return e.current=t(),function(){return e.current=null}},null==n?n:n.concat(e))}(t,function(){return{state:l,onButtonDown:g,setPosition:h}}),fe("div",{ref:a,className:Ar.e("button-wrapper"),onMouseDown:g,onTouchStart:g,style:{left:u.value},children:fe("div",{className:Ar.e("button")})})}),Ir=new ve("chat-slider"),zr=function(e){var t=e.step,n=void 0===t?1:t,r=e.min,i=void 0===r?0:r,o=e.max,a=void 0===o?100:o,s=e.value,c=void 0===s?0:s,l=e.onChange,u=Qe(null),d=Qe(null),h=Lt(c),f=Bt(function(){return{width:"".concat(100*(h.value-i)/(a-i),"%"),left:"0%"}});Ye(function(){void 0!==c&&(h.value=c)},[c]);var p=function(e){var t,n;if(d.current&&!d.current.state.current.dragging){var r,i=null!==(t=null===(n=e.touches)||void 0===n||null===(n=n.item(0))||void 0===n?void 0:n.clientX)&&void 0!==t?t:e.clientX,o=u.current.getBoundingClientRect();(r=(i-o.left)/o.width*100)<0||r>100||(d.current.setPosition(r),setTimeout(function(){d.current.onButtonDown(e)},0))}};return fe("div",{className:Ir.b(),title:"".concat(h.value),children:fe("div",{ref:u,className:Ir.e("runway"),onMouseDown:p,onTouchStart:p,children:[fe("div",{className:Ir.e("bar"),style:f.value}),fe(Dr,{min:i,max:a,step:n,ref:d,value:h.value,onChange:function(e){h.value=e,null==l||l(e)}})]})})},Rr=new ve("chat-switch"),Pr=function(e){var t=e.value,n=void 0!==t&&t,r=e.onChange,i=g(Xe(!!n),2),o=i[0],a=i[1];Ye(function(){a(!!n)},[n]);return fe("div",{className:"".concat(Rr.b()," ").concat(Rr.is("checked",!!o)),onClick:function(){var e=!o;a(e),null==r||r(e)},children:fe("div",{className:Rr.e("core"),children:fe("div",{className:Rr.e("action")})})})},Lr=new ve("chat-step-item"),Br=function(e){var t=e.element,n=g(Xe(t.title),2),r=n[0],i=n[1],o=g(Xe(!1),2),a=o[0],s=o[1],c=g(Xe(!1),2),l=c[0],u=c[1],d=g(Xe(0),2),h=d[0],f=d[1],p=Qe(null),v=Qe(null),m=function(){if(p.current){var e=p.current;f(e.clientHeight)}};Ye(function(){t.title?i(t.title):t.content&&(t.content.length>20&&i("".concat(t.content.substring(0,19),"...")),i(t.content.substring(0,19))),m(),function(){if(v.current){var e=v.current;e.style.display="block";var t=e.scrollHeight;e.style.display="-webkit-box";var n=e.clientHeight;s(!!(t>n))}}()},[]),Ye(function(){setTimeout(function(){m()},0)},[e.element.content]);return fe("div",{ref:p,className:"".concat(Lr.b()),style:{"--ibiz-chat-step-item-height":"".concat(h,"px")},children:[fe("div",{className:"".concat(Lr.e("left")),children:fe("div",{className:"".concat(Lr.e("icon")),children:["success"===t.status&&fe(Dn,{}),"failed"===t.status&&fe(An,{}),"pending"===t.status&&fe(rn,{})]})}),fe("div",{className:"".concat(Lr.e("right")," ").concat("pending"===t.status?"is-loadding":""),children:["pending"!==t.status&&fe("div",{className:"".concat(Lr.e("title")),title:r,children:r}),"pending"!==t.status&&fe("div",{className:"".concat(Lr.e("content")),children:[fe("div",{ref:v,className:"".concat(Lr.e("content-text")," ").concat(l?"expanded":""),children:t.content||""}),a&&fe("button",{className:"".concat(Lr.e("toggle-btn")),onClick:function(){u(!l),setTimeout(function(){m()},0)},children:l?"收起":"展开全部"})]}),"pending"===t.status&&fe("div",{className:"".concat(Lr.e("loadding-text")),children:"加载中......"})]})]})},Vr=new ve("chat-step"),Fr=function(e){var t=e.items,n=Lt(!1),r=Lt(!0),i=Lt([]);Ye(function(){n.value=t.length>1,i.value=n.value&&!r.value?[t[t.length-1]]:t},[t]);return fe("div",{className:"".concat(Vr.b()),children:[fe("div",{className:Vr.e("container"),children:i.value.map(function(e,t){return fe(Br,{element:e},"".concat(e.title,"_").concat(e.content,"_").concat(t))})}),n.value&&fe("div",{className:Vr.e("toggle"),onClick:function(){r.value=!r.value,i.value=n.value&&!r.value?[t[t.length-1]]:t},children:fe("span",{className:Vr.e("toggle-label"),children:r.value?"执行步骤 收缩":"执行步骤 展开"})})]})},jr=new ve("markdown-message"),$r=function(e){var t=e.message,n=e.size,r=Lt(we()),i=Lt(null),o=et(function(){return 20===t.state&&!0!==t.completed},[t.state,t.completed]),a=et(function(){return 20===t.state&&!0===t.completed},[t.state,t.completed]),c=Lt({title:"",description:"",icon:fe(rn,{})}),l=Lt({hasSuggestions:!1,suggestions:[]}),u=function(e){e&&e.length>0?l.value={hasSuggestions:!0,suggestions:e}:l.value={hasSuggestions:!1,suggestions:[]}},d=function(e){var t=e.indexOf("<think>"),n=e.indexOf("</think>"),r="",i="",o=!1;return-1===n?(o=!1,r=e.slice(t+7),i=""):(o=!0,r=e.slice(t+7,n),i=e.slice(n+8)),{isThoughtCompleted:o,thoughtContent:r,answerContent:i}};return Ye(function(){if(n>=0&&i.value){if(-1!==t.content.indexOf("<think>")){var e=d(t.content),r=e.isThoughtCompleted,o=e.thoughtContent,a=e.answerContent;r?(c.value.icon=fe(nn,{}),c.value.title="思考完成"):!0===t.completed?(c.value.icon=fe(nn,{}),c.value.title="思考已停止"):(c.value.icon=fe(rn,{}),c.value.title="思考中..."),c.value.description=o||"",i.value.setMarkdown(a||"")}else i.value.setMarkdown(t.content||"");u(t.suggestions)}},[t,n]),Ye(function(){var n="";if(-1!==t.content.indexOf("<think>")){var o=d(t.content),a=o.isThoughtCompleted,l=o.thoughtContent,h=o.answerContent;c.value={title:a?"思考完成":!0===t.completed?"思考已停止":"思考中...",description:l||"",icon:a||!0===t.completed?fe(nn,{}):fe(rn,{})},h&&(n=h)}else n=t.content;u(t.suggestions),i.value=new s({id:r,value:n||"",editor:{defaultModel:"previewOnly"},themeSettings:{mainTheme:"dark",codeBlockTheme:"dark"},previewer:{enablePreviewerBubble:!1},engine:{syntax:{table:{enableChart:!1,externals:["echarts"]}}},callback:{onClickPreview:function(t){var n=t.target,r=null==n?void 0:n.closest('a[href^="chunkview://"], a[href^="view://"], a[href^="action://"]');if(r){t.preventDefault();var i=r.getAttribute("href");if(i){var o="";switch(i.startsWith("chunkview://")?o="chunkview":i.startsWith("view://")?o="view":i.startsWith("action://")&&(o="action"),o){case"chunkview":case"view":case"action":e.controller.handlePredefinedClick(o,i,e.message,t);break;default:console.error("暂不支持".concat(o,"类型协议"))}}return!1}}}})},[]),fe("div",{className:"".concat(jr.b()," ").concat(jr.is("loading",o)),children:[fe("div",{className:jr.b("header"),children:[fe("div",{className:jr.be("header","caption"),children:"AI "}),e.children,a?fe("div",{className:jr.be("header","timeout"),children:"请求超时"}):null]}),fe("div",{className:"".concat(jr.b("content")," pre-wrap-container"),children:[t.chatsteps&&t.chatsteps.length>0&&fe(Fr,{items:t.chatsteps||[]}),fe(Wn,{toolcallCompleted:!!t.toolcallcompleted,items:t.toolcalls||[]}),fe(Ln,{items:[c.value]}),fe("div",{id:r})]}),fe("div",{className:jr.b("footer"),children:[fe(er,{message:t,controller:e.controller},"".concat(t.messageid,"_").concat(t.islike,"_").concat(t.isdislike)),l.value.hasSuggestions||t.chatuiactions&&t.chatuiactions.length>0?fe(Bn,{uiactions:t.chatuiactions||[],suggestions:l.value.suggestions,onSuggestionClick:function(t,n){!function(t,n){e.controller.handleSuggestionClick(e.message,t,n)}(t,n)},onUIActionClick:function(t,n){!function(t,n){e.controller.handleUIActionClick(e.message,t,n)}(t,n)}}):null]})]})},Hr=new ve("ossfile-material"),Wr=function(e){var t=Bt(function(){return e.material.data.name}),n=Bt(function(){var t,n=e.material.metadata.size;return(t=n)>=1048576?"".concat((t/1048576).toFixed(2),"M"):t>=1024?"".concat((t/1024).toFixed(2),"K"):"".concat(t,"B")}),r=Bt(function(){return e.material.metadata.state}),i=Bt(function(){var t=e.material.metadata.state;return"successed"===t?"上传成功":"uploading"===t?"上传中":"failed"===t?"上传失败":"未知状态"}),o=Bt(function(){switch(e.material.metadata.state){case"successed":return"#1890ff";case"uploading":return"#52c41a";default:return"#ff4d4f"}});return fe("div",{className:Hr.b(),children:[fe("div",{className:Hr.b("left"),children:fe(sn,{})}),fe("div",{className:Hr.b("right"),children:[fe("div",{className:Hr.e("name"),title:t,children:t}),fe("div",{className:Hr.b("metadata"),children:[fe("div",{children:n}),"successed"!==r.value&&fe("div",{style:{color:o.value},children:i}),"successed"===r.value&&fe("div",{className:Hr.be("metadata","img"),title:"下载",onClick:function(){var t=e.material.metadata;e.controller.opts.uploader.onDownLoad(t,{context:e.controller.context,params:e.controller.params})},children:fe(xn,{})})]})]})]})},qr=new ve("common-material"),Ur=function(e){var t,n,r,i,o=null===(t=e.controller.opts.questionToolbarItems)||void 0===t?void 0:t.find(function(t){return t.id===e.material.metadata.actionId}),a=Bt(function(){return e.material.metadata.name}),s=Bt(function(){return e.material.metadata.downloadactionid});return fe("div",{className:qr.b(),children:[fe("div",{className:qr.b("left"),children:o&&o.icon?"function"==typeof o.icon?o.icon():(null===(n=o.icon)||void 0===n?void 0:n.showIcon)&&fe(W,{children:null!==(r=o.icon)&&void 0!==r&&r.cssClass?fe("i",{className:o.icon.cssClass}):null!==(i=o.icon)&&void 0!==i&&i.imagePath?Ce(o.icon.imagePath)?fe("div",{dangerouslySetInnerHTML:{__html:o.icon.imagePath}}):fe("img",{src:o.icon.imagePath}):null}):fe(ln,{})}),fe("div",{className:qr.b("right"),children:[fe("div",{className:qr.e("name"),title:a,children:a}),fe("div",{className:qr.b("metadata"),children:[fe("div",{children:(null==o?void 0:o.label)||"素材资源"}),s&&fe("div",{className:qr.be("metadata","img"),title:"预览",onClick:function(t){var n=e.material.metadata,r=e.controller.opts.extendToolbarClick;if(r&&"function"==typeof r){var i=n.downloadactionid;if(!s)throw new Error("downloadactionid不能为空");var o=n.downloadAppId,a=h({},e.controller.context);if(n.downloadContext)try{var c=n.downloadContext.split(";").reduce(function(e,t){if(t.trim()){var n=g(t.split(":"),2),r=n[0],i=n[1];r&&i&&(e[r.trim()]=i.trim())}return e},{});c&&Object.keys(c).length>0&&Object.assign(a,c)}catch(l){throw new Error("downloadContext参数解析异常,正确格式如:abc:123;cde:456,")}r(t,{id:i,isPluginApp:!!o,appId:o||a.srfappid},a,e.controller.params,{})}},children:fe(xn,{})})]})]})]})},Kr=new ve("chat-input-material-item"),Jr=function(e){var t=e.material,n=null;if("ossfile"===t.type)n=Wr;else n=Ur;return fe("div",{className:"".concat(Kr.b()," ").concat(Kr.is("disabled",e.disabled)),children:[fe("div",{className:Kr.e("icon"),onClick:function(){e.controller.deleteMaterial(t)},children:fe(cn,{})}),$(n,{material:t,controller:e.controller})]})},Gr=new ve("user-message-question"),Xr=function(e){var t=we(),n=Lt(null),r=Lt(135),i=Lt(!0),o=Lt(!1),a=Qe(null),c=Bt(function(){return e.message.content}),l=Bt(function(){return Oe.parseMixedContent(c.value)});Ye(function(){n.value=new s({id:t,value:l.value.remainingText||"",editor:{defaultModel:"previewOnly"},previewer:{enablePreviewerBubble:!1},engine:{syntax:{table:{enableChart:!1,externals:["echarts"]}}}})},[l.value.remainingText]),Ye(function(){if(a.current&&window.ResizeObserver){var e=new ResizeObserver(function(){var e,t=null===(e=n.value)||void 0===e?void 0:e.previewer.options.previewerDom;t&&(o.value=t.scrollHeight>r.value)});return e.observe(a.current),function(){e.disconnect()}}},[a.current]);return fe("div",{className:Gr.b(),children:[fe("div",{className:Gr.e("user-header"),children:[e.children,fe("div",{className:Gr.e("user"),children:"我"})]}),fe("div",{className:Gr.e("content"),children:[40===e.message.state&&fe("div",{className:Gr.em("content","warning-container"),onClick:function(t){e.message&&e.controller&&e.controller.refreshMessage(e.message,!0)},children:fe("div",{className:Gr.em("content","warning"),children:[fe("div",{className:"warning-icon",title:"未发送成功,请重试",children:fe(Cn,{})}),fe("div",{className:"refresh-icon",title:"未发送成功,请重试",children:fe(Ht,{})})]})}),fe("div",{className:Gr.em("content","body"),children:[l.value.hasResources&&fe("div",{className:Gr.em("content","material"),children:l.value.resources.map(function(t){return fe(Jr,{material:t,disabled:!0,controller:e.controller},t.id)})}),fe("div",{className:"pre-wrap-container",children:[fe("div",{className:"".concat(Gr.e("text-content")," ").concat(Gr.is("collapse",i.value)),id:t,ref:a,style:{maxHeight:i.value?"".concat(r.value,"px"):""}}),fe("div",{className:"".concat(Gr.e("collapse-btn")," ").concat(Gr.is("visible",o.value)),title:i.value?"展开":"收起",onClick:function(){i.value=!i.value},children:i.value?fe("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",children:fe("path",{fill:"currentColor",d:"M104.704 338.752a64 64 0 0 1 90.496 0l316.8 316.8 316.8-316.8a64 64 0 0 1 90.496 90.496L557.248 791.296a64 64 0 0 1-90.496 0L104.704 429.248a64 64 0 0 1 0-90.496"})}):fe("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",children:fe("path",{fill:"currentColor",d:"M104.704 685.248a64 64 0 0 0 90.496 0l316.8-316.8 316.8 316.8a64 64 0 0 0 90.496-90.496L557.248 232.704a64 64 0 0 0-90.496 0L104.704 594.752a64 64 0 0 0 0 90.496"})})})]})]})]})]})},Yr=new ve("error-message"),Zr=function(e){var t=Bt(function(){return e.message.content});return fe("div",{className:Yr.b(),children:[fe("div",{className:Yr.b("header"),children:[fe("div",{className:Yr.be("header","caption"),children:"AI "}),e.children]}),fe("div",{className:"".concat(Yr.e("content")," pre-wrap-container"),children:fe("span",{children:t})})]})},Qr=new ve("unknown-message"),ei=function(e){return fe("div",{className:Qr.b(),children:fe("div",{className:"".concat(Qr.e("content")," pre-wrap-container"),children:["暂未支持的消息类型: ",e.message.type]})})},ti=new ve("chat-message-item"),ni=function(e){var t=e.message,n=e.size,r=null;switch(t.type){case"DEFAULT":r="ASSISTANT"===t.role?$r:Xr;break;case"ERROR":r=Zr;break;default:r=ei}return fe("div",{className:ti.b(),children:$(r,{size:n,message:t,controller:e.controller,children:e.children})})},ri=function(){return S(function e(t){x(this,e),_(this,"toolcallcompleted",!0),_(this,"toolcalls",[]),_(this,"chatsteps",[]),_(this,"chatuiactions",[]),_(this,"allcontent",""),this.msg=t,this.toolcalls=t.toolcalls||[],this.chatsteps=t.chatsteps||[],this.chatuiactions=t.chatuiactions||[],this.allcontent=t.content},[{key:"messageid",get:function(){return this.msg.messageid}},{key:"state",get:function(){return this.msg.state}},{key:"role",get:function(){return this.msg.role}},{key:"type",get:function(){return this.msg.type}},{key:"status",get:function(){return this.msg.status}},{key:"realcontent",get:function(){var e=this.msg.content;if(-1!==e.indexOf("<think>")&&-1===e.indexOf("</think>"))return"";if(-1!==(e=e.replace(/<think>[^]*?<\/think>/g,"").trim()).indexOf("<chatstep>")&&-1===e.indexOf("</chatstep>"))return"";if(-1!==(e=e.replace(/<chatstep>[^]*?<\/chatstep>/g,"").trim()).indexOf("<tool_call>")&&-1===e.indexOf("</tool_call>"))return"";if(-1!==(e=e.replace(/<tool_call>[^]*?<\/tool_call>/g,"").trim()).indexOf("<resources>")&&-1===e.indexOf("</resources>"))return"";var t=(e=e.replace(/<resources>[^]*?<\/resources>/g,"").trim()).indexOf("<suggestions>");-1!==t&&(e=e.substring(0,t).trim());var n=e.indexOf("<chatuiaction>");return-1!==n&&(e=e.substring(0,n).trim()),e}},{key:"content",get:function(){return this.msg.content}},{key:"completed",get:function(){return this.msg.completed}},{key:"suggestions",get:function(){return this.msg.suggestions}},{key:"_origin",get:function(){return this.msg}},{key:"islike",get:function(){return this.msg.islike}},{key:"isdislike",get:function(){return this.msg.isdislike}},{key:"feedbackcontent",get:function(){return this.msg.feedbackcontent}},{key:"realmessageid",get:function(){return this.msg.realmessageid}},{key:"update",value:function(e){e.content||(e.content=""),this.allcontent+=e.content,-1!==e.content.indexOf("<think>")&&this.msg.content&&(this.msg.content=""),this.msg.content+=e.content,-1===this.msg.content.indexOf("<tool_call>")&&-1===this.msg.content.indexOf("</tool_call>")||(this.msg.content=""),this.computeToolCalls();var t=this.msg.content.indexOf("<chatstep>"),n=this.msg.content.indexOf("</chatstep>");-1===t&&-1===n||(this.msg.content=-1!==t&&-1!==n?this.msg.content.replace(/<chatstep>[^]*?<\/chatstep>/g,""):""),this.computeChatSteps();var r=this.msg.content.indexOf("<chatuiaction>"),i=this.msg.content.indexOf("</chatuiaction>");-1===r&&-1===i||(this.msg.content=-1!==r&&-1!==i?this.msg.content.replace(/<chatuiaction>[^]*?<\/chatuiaction>/g,""):""),this.computeChatUIActions()}},{key:"replace",value:function(e){this.msg=e}},{key:"updateCompleted",value:function(e){this.msg.completed=e}},{key:"computeToolCalls",value:function(){var e=Le.parse(this.allcontent),t=e.completed,n=e.toolCalls;this.toolcallcompleted=t,this.toolcalls=n}},{key:"computeChatSteps",value:function(){this.chatsteps=Be.parse(this.allcontent)}},{key:"computeChatUIActions",value:function(){this.chatuiactions=Ve.parse(this.allcontent)}}])}(),ii=function(){return S(function e(t){x(this,e),this.data=t},[{key:"appid",get:function(){return this.data.appid}},{key:"id",get:function(){return this.data.id}},{key:"type",get:function(){return this.data.type}},{key:"caption",get:function(){return this.data.caption}},{key:"sourceCaption",get:function(){return this.data.sourceCaption}},{key:"url",get:function(){return this.data.url}},{key:"aiChat",get:function(){return this.data.aiChat}},{key:"captionMode",get:function(){return this.data.captionMode}},{key:"realid",get:function(){return this.data.realid}},{key:"sequence",get:function(){return this.data.sequence}},{key:"isTop",get:function(){return this.data.isTop}},{key:"isShow",get:function(){var e;return null===(e=this.data.isShow)||void 0===e||e}},{key:"disableStorage",get:function(){return this.data.disableStorage||!1}},{key:"captionComputed",get:function(){return this.data.captionComputed||!1}}])}(),oi=function(){return S(function e(t){x(this,e),this.material=t},[{key:"id",get:function(){return this.material.id}},{key:"type",get:function(){return this.material.type}},{key:"metadata",get:function(){return this.material.metadata}},{key:"data",get:function(){return this.material.data}}])}(),ai=function(){return S(function e(t,n){x(this,e),this.agent=t,this.defaultConfig=n},[{key:"id",get:function(){return this.agent.id}},{key:"caption",get:function(){return this.agent.caption}},{key:"default",get:function(){return this.agent.default}},{key:"order",get:function(){return this.agent.order}},{key:"value",get:function(){return this.agent.id}},{key:"label",get:function(){return this.agent.caption}},{key:"knowledge_bases",get:function(){return this.agent.knowledge_bases}},{key:"allow_any_knowledge_base",get:function(){return this.agent.allow_any_knowledge_base}},{key:"rerank",get:function(){return this.agent.rerank||this.defaultConfig.chunkrerank}},{key:"maxchunks",get:function(){return this.agent.maxchunks||this.defaultConfig.maxchunks}},{key:"chunkthreshold",get:function(){return this.agent.chunkthreshold||this.defaultConfig.chunkthreshold}},{key:"chunkpageindex",get:function(){return this.agent.chunkpageindex||this.defaultConfig.chunkpageindex}}])}(),si=function(){return S(function e(t){x(this,e),this.knowledgeBase=t},[{key:"id",get:function(){return this.knowledgeBase.id}},{key:"name",get:function(){return this.knowledgeBase.name}},{key:"value",get:function(){return this.knowledgeBase.id}},{key:"label",get:function(){return this.knowledgeBase.name}}])}(),ci=new ve("chat-toolbar-item"),li=function(e){var t,n,r,i=e.model,o=e.data,a=e.className,s=e.disabled,c=void 0!==s&&s,l=e.buttonType,u=void 0===l?"default":l,d=e.onClick,h=g(Xe(!1),2),f=h[0],p=h[1],v=Qe(null),m=function(e){return"function"==typeof e.hidden?e.hidden(o):!0===e.hidden};if(m(i))return fe(W,{});var y=function(e){return!!c||("function"==typeof e.disabled?e.disabled(o):!0===e.disabled)},k=function(e){var t,n,r,i;return"function"==typeof e.icon?e.icon():null!==(t=e.icon)&&void 0!==t&&t.showIcon&&null!==(n=e.icon)&&void 0!==n&&n.cssClass?fe("i",{className:e.icon.cssClass}):null!==(r=e.icon)&&void 0!==r&&r.showIcon&&null!==(i=e.icon)&&void 0!==i&&i.imagePath?Ce(e.icon.imagePath)?fe("div",{dangerouslySetInnerHTML:{__html:e.icon.imagePath}}):fe("img",{src:e.icon.imagePath}):void 0},w=function(e,t){y(t)||(p(!1),d(e,t))};return Ye(function(){var e=function(e){v.current&&v.current.contains(e.target)||p(!1)};return f&&document.addEventListener("mousedown",e),function(){document.removeEventListener("mousedown",e)}},[f]),fe("div",{className:"".concat(ci.b()," ").concat(ci.b(u)," ").concat(i.customClass||""," ").concat(a||""," ").concat(ci.is("disabled",y(i))," ").concat(ci.is("more",!(null===(t=i.children)||void 0===t||!t.length))),children:[fe("div",{title:i.title,className:ci.e("content"),onClick:function(e){return w(e,i)},children:[fe("div",{className:ci.em("content","icon"),children:k(i)}),fe("div",{className:ci.em("content","label"),children:i.label})]}),(null===(n=i.children)||void 0===n?void 0:n.length)&&fe("div",{title:"更多",className:ci.e("more"),onClick:function(e){y(i)||p(!0)},children:fe("i",{"aria-hidden":"true",className:"fa fa-angle-down ".concat(ci.em("more","icon"))})}),f&&fe("div",{ref:v,className:ci.b("dropdown"),children:null===(r=i.children)||void 0===r?void 0:r.map(function(e,t){if(!m(e))return fe("div",{title:e.title,onClick:function(t){return w(t,e)},className:"".concat(ci.be("dropdown","item")," ").concat(e.customClass||""," ").concat(ci.is("disabled",y(e))),children:[fe("div",{className:ci.bem("dropdown","item","icon"),children:k(e)}),fe("div",{className:ci.bem("dropdown","item","label"),children:e.label})]},t)})})]})},ui=new ve("chat-toolbar"),di=function(e){var t=e.controller,n=e.items,r=void 0===n?[]:n,i=e.data,o=e.type,a=e.className,s=[],l=[{label:"重置对话",title:"重置对话",icon:function(){return fe(fn,{})},onClick:function(){t.resetTopic()},children:[{label:"清空对话",title:"清空对话",icon:function(){return fe(hn,{})},onClick:function(){t.clearTopic()}}]}],u=[{label:"刷新",title:"刷新",icon:function(){return fe(Ht,{})},onClick:function(){t.refreshMessage(i)}},{label:"删除",title:"删除",hidden:function(){return!i.realmessageid},icon:function(){return fe($t,{})},onClick:function(){t.deleteMessage(i)}},{label:"复制",title:"复制",icon:function(){return fe(Wt,{})},onClick:function(){t.copyMessage(i)}}];nt(Ip).enableBackFill&&u.unshift.apply(u,[{label:"回填",title:"回填",icon:function(){return fe(Ft,{})},onClick:function(){t.backfill(i)}}]);var d=[{label:"刷新",title:"刷新",icon:function(){return fe(Ht,{})},onClick:function(){t.refreshMessage(i,!0)}}];if("content"===o)switch(i.type){case"DEFAULT":s="ASSISTANT"===i.role?[].concat(u,c(r)):[].concat(d);break;case"ERROR":s=[].concat(u,c(r))}else s=[].concat(l,c(r));var f=function(n,r){var o=h({},i);if(i instanceof ri?(Object.assign(o,{topic:t.topic}),o.msg.realcontent=i.realcontent):(o.data||(o.data={}),Object.assign(o.data,{messages:t.messages.value})),r.onClick&&"function"==typeof r.onClick)r.onClick(n,r,t.context,t.params,o);else{var a=e.controller.opts.extendToolbarClick;a&&"function"==typeof a&&a(n,r,t.context,t.params,o)}},p=et(function(){return"content"===o&&20===(null==i?void 0:i.state)&&!0!==(null==i?void 0:i.completed)},[null==i?void 0:i.state,null==i?void 0:i.completed]);return fe("div",{className:"".concat(ui.b()," ").concat(a||""),children:s.map(function(e,t){return fe(li,{data:i,model:e,disabled:p,buttonType:"content"===o?"circle":"default",onClick:f.bind(void 0)},t)})})};var hi=function(e){var t=Lt(!1),n=Lt({}),r=new ve("chat-back-bottom"),i=Lt(null),o=function(){if(i.value){var n=e.visibilityHeight||200,r=i.value.scrollHeight-i.value.scrollTop-i.value.offsetHeight;t.value=r>=n}},a=function(e,t){var n=null;return function(){for(var r=this,i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];n||(n=setTimeout(function(){e.apply(r,o),n=null},t))}}(o,300);return et(function(){n.value={right:"".concat(e.right,"px"),bottom:"".concat(e.bottom,"px")}},[e.right,e.bottom]),Ye(function(){if(e.target){var t,n=null!==(t=document.querySelector(e.target))&&void 0!==t?t:void 0;n&&(i.value=n,n.addEventListener("scroll",a),o())}},[]),fe("div",{className:"".concat(r.b()," ").concat(r.is("visible",t.value)),style:n.value,onClick:function(){var t;i.value&&(i.value.scrollTo({top:i.value.scrollHeight,behavior:"smooth"}),null===(t=e.onClick)||void 0===t||t.call(e))},children:fe(dn,{className:r.e("icon")})})},fi=new ve("chat-messages"),pi=function(e){var t=Qe(null),n=g(Xe(5),2),r=n[0],i=n[1],o=g(Xe(!1),2),a=o[0],s=o[1],c=g(Xe(!0),2),l=c[0],u=c[1],d=Qe(!1),h=e.controller.messages,f=et(function(){var e=Math.max(0,h.value.length-r);return h.value.slice(e)},[h.value,r]),p=et(function(){return r<h.value.length},[h.value,r]);Ye(function(){var e;l&&((e=t.current)&&(d.current=!0,e.scrollTo({top:e.scrollHeight,behavior:"auto"}),setTimeout(function(){d.current=!1},500)))},[h.value]);return fe("div",{ref:t,className:fi.b(),onScroll:function(){if(!d.current){var e=t.current;if(e){var n=e.scrollTop,o=e.scrollHeight,c=e.clientHeight;n<100&&!a&&p&&(s(!0),setTimeout(function(){var t=Math.min(r+5,h.value.length);i(t);var n=e.scrollHeight;setTimeout(function(){var t=e.scrollHeight;e.scrollTop=t-n+e.scrollTop,s(!1)},0)},300)),u(o-(n+c)<50)}}},children:[f.map(function(t){var n,r=(null===(n=t.content)||void 0===n?void 0:n.length)||0;return"SYSTEM"!==t.role?fe(ni,{size:r,message:t,controller:e.controller,children:fe(di,{type:"content",mode:"DEFAULT",hideTopicSidebar:!1,data:t,items:e.toolbarItems,controller:e.controller})},"".concat(t.messageid,"_").concat(t.completed?"completed":"incomplete")):null}),fe(hi,{right:20,bottom:14,target:".".concat(fi.b()),onClick:function(){d.current=!0,u(!0)}})]})},vi=function(e){return e.STYLE_CACHE="ai-chat-style-cache",e.MINIMIZE_STYLY_CHCHE="ai-chat-minimize-style-cache",e.DATA_BASE_NAME="ibiz-chat",e.DATA_TABLE_NAME="history-message",e.DATA_TABLE_KEY_NAME="id",e}(vi||{});function mi(e){switch(e){case"user":default:return"USER";case"agent":return"ASSISTANT";case"system":return"SYSTEM"}}function gi(e){switch(e){case"pending":return 20;case"sent":case"canceled":default:return 30;case"failed":return 40}}function yi(e){switch(e){case"pending":case"sent":case"canceled":default:return"DEFAULT";case"failed":return"ERROR"}}var ki=function(){return S(function e(t,n){x(this,e),_(this,"evt",new p),_(this,"messages",xt([])),_(this,"materials",xt([])),_(this,"input",xt("")),_(this,"isLoading",xt(!1)),_(this,"enableKnowledgeBaseSelect",xt(!1)),_(this,"enableKnowledgeBaseState",xt(!1)),_(this,"enableRecallConfigSetting",xt(!1)),_(this,"enableAIAgentChange",!0),_(this,"activeAIAgentID",void 0),_(this,"agentList",xt([])),_(this,"context",void 0),_(this,"params",void 0),_(this,"appDataEntityId",void 0),_(this,"topicId",void 0),_(this,"topic",void 0),_(this,"aiTopic",void 0),_(this,"chatSessionid",""),_(this,"chatMode",void 0),_(this,"isDigestProcessed",!1),_(this,"knowledgeBasesList",[]),_(this,"selectionKnowledgeBases",xt([])),_(this,"knowledgeBases",xt([])),_(this,"reCallConfig",xt({chunkrerank:2,maxchunks:10,chunkthreshold:.4,chunkpageindex:0})),this.opts=t,this.resourceOptions=n,this.context=t.context,this.params=t.params,this.appDataEntityId=t.appDataEntityId,this.aiTopic=t.aiTopic,this.topicId=t.topicId,this.topic=t.topic,this.activeAIAgentID=t.activeAIAgentID,this.enableAIAgentChange=!!t.enableAIAgentChange,this.chatMode=t.srfMode,this.chatSessionid=t.sessionid,this.enableKnowledgeBaseSelect.value=!!t.enableKnowledgeBaseSelect,this.enableKnowledgeBaseState.value=this.enableKnowledgeBaseSelect.value,this.enableRecallConfigSetting.value=!!t.enableRecallConfigSetting,this.initAIChat()},[{key:"resourceMode",get:function(){var e;return(null===(e=this.resourceOptions)||void 0===e?void 0:e.resourceMode)||"LOCAL"}},{key:"currentTopicDisableStorage",get:function(){if(this.topicId&&this.aiTopic){var e=this.aiTopic.getCurrentTopicByID(this.topicId);if(e&&e.disableStorage)return!0}return!1}},{key:"sessionCaptionMode",get:function(){if(this.aiTopic&&this.topicId){var e=this.aiTopic.getCurrentTopicByID(this.topicId);if(e&&e.captionMode)return e.captionMode}return"default"}},{key:"sessionDefaultCaption",get:function(){if(this.aiTopic&&this.topicId){var e=this.aiTopic.getCurrentTopicByID(this.topicId);if(e&&e.caption)return e.caption}return this.opts.caption||"新会话"}},{key:"initAIChat",value:(z=m(f().m(function e(){return f().w(function(e){for(;;)switch(e.n){case 0:return this.messages.value=[],e.n=1,this.initAIChatAgent();case 1:return e.n=2,this.initAIChatKnowledge();case 2:return e.n=3,this.fecthHistory();case 3:return e.a(2)}},e,this)})),function(){return z.apply(this,arguments)})},{key:"initAIChatAgent",value:(I=m(f().m(function e(){var t,n=this;return f().w(function(e){for(;;)switch(e.n){case 0:if(this.opts.aiAgentlist&&this.opts.aiAgentlist.length>0&&this.opts.aiAgentlist.forEach(function(e){n.agentList.value=[].concat(c(n.agentList.value),[new ai(e,{chunkrerank:n.opts.reRankDefaultValue,maxchunks:n.opts.maxChunksDefaultValue,chunkthreshold:n.opts.chunkThresholdDefaultValue,chunkpageindex:n.opts.chunkPageIndexDefaultValue})])}),this.enableRecallConfigSetting.value){e.n=1;break}return e.a(2);case 1:t=this.agentList.value.find(function(e){return e.id===n.activeAIAgentID}),t&&(this.reCallConfig.value={chunkrerank:t.rerank,maxchunks:t.maxchunks,chunkthreshold:t.chunkthreshold,chunkpageindex:t.chunkpageindex});case 2:return e.a(2)}},e,this)})),function(){return I.apply(this,arguments)})},{key:"initAIChatKnowledge",value:(D=m(f().m(function e(){var t;return f().w(function(e){for(;;)switch(e.n){case 0:if(this.enableKnowledgeBaseSelect.value){e.n=1;break}return e.a(2);case 1:null!==(t=this.opts.aiknowledgeBasesList)&&void 0!==t&&t.length&&(this.knowledgeBasesList=this.opts.aiknowledgeBasesList.map(function(e){return new si(e)})),this.computeSelectedKnowledge();case 2:return e.a(2)}},e,this)})),function(){return D.apply(this,arguments)})},{key:"computeSelectedKnowledge",value:function(){var e,t=this;if(this.enableKnowledgeBaseSelect.value){var n=this.agentList.value.find(function(e){return e.id===t.activeAIAgentID});if(this.knowledgeBases.value=!n||n.allow_any_knowledge_base?c(this.knowledgeBasesList):(null===(e=n.knowledge_bases)||void 0===e?void 0:e.map(function(e){return new si({id:e.ai_knowledge_base_id,name:e.ai_knowledge_base_name})}))||[],this.opts.selectAIKnowledgeBaseId)this.selectionKnowledgeBases.value=this.knowledgeBases.value.filter(function(e){var n;return null===(n=t.opts.selectAIKnowledgeBaseId)||void 0===n?void 0:n.includes(e.id)}).map(function(e){return e.id});else if(n){var r;this.selectionKnowledgeBases.value=(null===(r=n.knowledge_bases)||void 0===r?void 0:r.map(function(e){return e.ai_knowledge_base_id}))||[]}}}},{key:"getHistoryStoreKey",value:function(e){return"".concat(e)}},{key:"getQueryKnowledgeBases",value:function(){return this.enableKnowledgeBaseSelect.value&&this.enableKnowledgeBaseState.value?this.selectionKnowledgeBases.value.join(","):void 0}},{key:"getQueryRecallConfig",value:function(){return this.enableRecallConfigSetting.value?this.reCallConfig.value:void 0}},{key:"fecthHistory",value:(A=m(f().m(function e(){var t,n,r,i=this;return f().w(function(e){for(;;)switch(e.n){case 0:if(!this.topicId){e.n=7;break}if(t={},!this.currentTopicDisableStorage){e.n=1;break}t.data=[],e.n=5;break;case 1:if("LOCAL"!==this.resourceMode){e.n=3;break}return e.n=2,Ne.getData(vi.DATA_BASE_NAME,vi.DATA_TABLE_NAME,this.getHistoryStoreKey(this.topicId));case 2:t=e.v,e.n=5;break;case 3:if("REMOTE"!==this.resourceMode||!this.resourceOptions){e.n=5;break}return e.n=4,this.resourceOptions.getMessages({n_session_id_eq:this.chatSessionid});case 4:(n=e.v)&&n.length>0&&(r=[],n.forEach(function(e){var t;r.push({messageid:(t=e).id,state:gi(t.status),type:yi(t.status),role:mi(t.sender_type),content:t.content,completed:!0,islike:t.is_like,isdislike:t.is_dislike,feedbackcontent:t.feedback_content,realmessageid:t.id,status:t.status})}),t.data=r);case 5:if(!(t&&t.data&&t.data.length>0)){e.n=7;break}return t.data.forEach(function(e){var t={messageid:e.messageid,state:e.state,type:e.type,role:e.role,islike:e.islike,isdislike:e.isdislike,feedbackcontent:e.feedbackcontent,content:e.content,suggestions:e.suggestions,completed:!0,toolcalls:e.toolcalls,realmessageid:e.realmessageid,status:e.status,chatsteps:e.chatsteps,chatuiactions:e.chatuiactions};i.addMessage(t)}),e.n=6,this.afterFecthHistory();case 6:return e.a(2,!0);case 7:return e.n=8,this.opts.history(this.context,this.params,{appDataEntityId:this.appDataEntityId,appendCurData:this.opts.appendCurData,sessionid:this.chatSessionid,srfaiagent:this.activeAIAgentID,srfmode:this.chatMode});case 8:if(!e.v){e.n=9;break}return e.n=9,this.afterFecthHistory();case 9:return e.a(2,!0)}},e,this)})),function(){return A.apply(this,arguments)})},{key:"afterFecthHistory",value:(E=m(f().m(function e(){var t,n,r,i,o,a,s,l,u=this;return f().w(function(e){for(;;)switch(e.p=e.n){case 0:if(this.opts.appendCurContent&&this.addMessage({state:30,messageid:we(),role:"USER",type:"DEFAULT",content:this.opts.appendCurContent,completed:!0,status:"sent"}),this.opts.appendCurResource&&(t=Oe.parseMixedContent(this.opts.appendCurResource),n=t.hasResources,r=t.resources,n&&r&&r.length>0&&r.forEach(function(e){u.replaceMaterial(e.id,e)})),!1===this.opts.autoQuestion){e.n=4;break}if(i=this.messages.value.length-1,!(o=this.messages.value[i])||"USER"!==o.role){e.n=4;break}return(a=this.stringlyMaterialResource(!1))&&(s=a+o.content,l=h(h({},o._origin),{},{messageid:we(),content:s}),this.messages.value[i]=new ri(l),this.messages.value=c(this.messages.value)),e.p=1,this.isLoading.value=!0,e.n=2,this.opts.question(this,this.context,this.params,{appDataEntityId:this.appDataEntityId},this.getMessages(),this.chatSessionid,this.activeAIAgentID,this.chatMode,this.getQueryKnowledgeBases(),this.getQueryRecallConfig());case 2:if(!this.opts.action){e.n=3;break}return e.n=3,this.opts.action("question",o.content);case 3:return e.p=3,this.isLoading.value=!1,e.f(3);case 4:return e.n=5,this.updateTopicCaption();case 5:return e.a(2)}},e,this,[[1,,3,4]])})),function(){return E.apply(this,arguments)})},{key:"asyncToIndexDB",value:(O=m(f().m(function e(){var t;return f().w(function(e){for(;;)switch(e.n){case 0:if(this.topicId&&"LOCAL"===this.resourceMode){e.n=1;break}return e.a(2);case 1:if(!this.currentTopicDisableStorage){e.n=2;break}return e.a(2);case 2:return t={id:this.getHistoryStoreKey(this.topicId),data:this.messages.value.map(function(e){return h(h({},e._origin),{},{toolcalls:e.toolcalls,chatsteps:e.chatsteps,chatuiactions:e.chatuiactions})}),timestamp:(new Date).getTime()},e.n=3,Ne.updateData(vi.DATA_BASE_NAME,vi.DATA_TABLE_NAME,t);case 3:return e.a(2)}},e,this)})),function(){return O.apply(this,arguments)})},{key:"setInput",value:function(e){this.input.value=e||""}},{key:"addMessage",value:function(e){var t=this.messages.value.find(function(t){return t.messageid===e.messageid});if(t)t.update(e),this.messages.value=c(this.messages.value);else{var n=new ri(e);n.update(h(h({},e),{},{content:""})),this.messages.value=[].concat(c(this.messages.value),[n])}this.asyncToIndexDB()}},{key:"completeMessage",value:(T=m(f().m(function e(t,n){var r,i;return f().w(function(e){for(;;)switch(e.n){case 0:if(!(r=this.messages.value.find(function(e){return e.messageid===t}))){e.n=1;break}return r.updateCompleted(n),this.messages.value=c(this.messages.value),e.n=1,this.asyncToIndexDB();case 1:!0===this.opts.autoFill&&"ASSISTANT"===(i=r||this.messages.value[this.messages.value.length-1]).role&&30===i.state&&this.backfill(i),this.evt.emit("onCompleteMessage",{messageid:t,completed:n});case 2:return e.a(2)}},e,this)})),function(e,t){return T.apply(this,arguments)})},{key:"replaceMessage",value:function(e){var t=this,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=[];if(e.content){var i=e.content,o=i.indexOf("<chatuiaction>"),a=i.indexOf("</chatuiaction>");-1!==o&&-1!==a&&o<a&&(e.content=i.replace(/<chatuiaction>[^]*?<\/chatuiaction>/g,""));var s=i.indexOf("<chatstep>"),l=i.indexOf("</chatstep>");-1!==s&&-1!==l&&s<l&&(r=Be.parse(e.content),e.content=i.replace(/<chatstep>[^]*?<\/chatstep>/g,""))}var u=h({},e),d=this.messages.value.findIndex(function(t){return t.messageid===e.messageid});if(-1!==d){var f;if(r.length>0)null===(f=this.messages.value[d].chatsteps)||void 0===f||f.push.apply(f,c(r));u.toolcalls=this.messages.value[d].toolcalls,u.chatsteps=this.messages.value[d].chatsteps,u.chatuiactions=this.messages.value[d].chatuiactions,this.messages.value[d].replace(e),this.messages.value=c(this.messages.value)}else{var p;if(r.length>0)e.chatsteps||(e.chatsteps=[]),(p=e.chatsteps).push.apply(p,c(r));this.messages.value=[].concat(c(this.messages.value),[new ri(e)])}this.asyncToIndexDB(),"DEFAULT"===e.type&&this.opts.recommendPrompt&&n&&this.opts.recommendPrompt(this.context,this.params,{appDataEntityId:this.appDataEntityId,message:{messages:[h(h({},e),{},{content:e.content.replace(/<think>[^]*?<\/think>/g,"")})],sessionid:this.chatSessionid,srfaiagent:this.activeAIAgentID}}).then(function(e){e&&e.content&&t.updateRecommendPrompt(u,e.content)})}},{key:"stopMessage",value:(N=m(f().m(function e(t){var n;return f().w(function(e){for(;;)switch(e.n){case 0:return n=this.messages.value.findIndex(function(e){return e.messageid===t.messageid}),t.content=t.content||"用户中断",-1!==n?(this.messages.value[n].replace(t),this.messages.value=c(this.messages.value)):this.messages.value=[].concat(c(this.messages.value),[new ri(t)]),e.n=1,this.asyncToIndexDB();case 1:return e.a(2)}},e,this)})),function(e){return N.apply(this,arguments)})},{key:"stringlyMaterialResource",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t="",n=[];return this.materials.value&&this.materials.value.length>0&&(this.materials.value.forEach(function(e){if("ossfile"===e.type){var t=e.metadata;t.state&&"successed"===t.state&&n.push(e)}else n.push(e)}),e&&(this.materials.value=[])),n&&n.length>0&&(t=Oe.stringify(n)),t}},{key:"getMessages",value:function(){var e=this.messages.value.filter(function(e){return"ERROR"!==e.type&&"canceled"!==e.status}).map(function(e){return e._origin});return e.forEach(function(e){e.content=e.content.replace(/<tool_call>[^]*?<\/tool_call>/g,"").replace(/<think>[^]*?<\/think>/g,"").trim()}),e}},{key:"getAllMessages",value:function(){return this.messages.value.map(function(e){return e._origin})}},{key:"question",value:(M=m(f().m(function e(t){var n,r=this;return f().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,this.isLoading.value=!0,this.messages.value.forEach(function(e,t){var n=e._origin;n.suggestions&&(n.suggestions=void 0,r.messages.value[t].replace(n))}),this.messages.value=c(this.messages.value),this.asyncToIndexDB(),(n=this.stringlyMaterialResource(!0))?n+="\n".concat(t):n=t,this.addMessage({state:30,messageid:we(),role:"USER",type:"DEFAULT",content:n,status:"sent"}),e.n=1,this.opts.question(this,this.context,this.params,{appDataEntityId:this.appDataEntityId},this.getMessages(),this.chatSessionid,this.activeAIAgentID,this.chatMode,this.getQueryKnowledgeBases(),this.getQueryRecallConfig());case 1:return e.n=2,this.updateTopicCaption();case 2:this.opts.action&&this.opts.action("question",t),this.isLoading.value=!1;case 3:return e.p=3,this.isLoading.value=!1,e.f(3);case 4:return e.a(2)}},e,this,[[0,,3,4]])})),function(e){return M.apply(this,arguments)})},{key:"abortQuestion",value:(C=m(f().m(function e(){return f().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,this.opts.abortQuestion(this,this.context,this.params,{appDataEntityId:this.appDataEntityId,sessionid:this.chatSessionid,srfaiagent:this.activeAIAgentID,srfmode:this.chatMode});case 1:return e.p=1,this.isLoading.value=!1,e.f(1);case 2:return e.a(2)}},e,this,[[0,,1,2]])})),function(){return C.apply(this,arguments)})},{key:"backfill",value:function(e){this.opts.action&&this.opts.action("backfill",e)}},{key:"deleteMessage",value:(b=m(f().m(function e(t){var n;return f().w(function(e){for(;;)switch(e.n){case 0:if(-1!==(n=this.messages.value.findIndex(function(e){return e.messageid===t.messageid}))&&(this.messages.value.splice(n,1),this.messages.value=c(this.messages.value)),this.asyncToIndexDB(),"REMOTE"!==this.resourceMode||!this.resourceOptions){e.n=1;break}if(!t.realmessageid){e.n=1;break}return e.n=1,this.resourceOptions.deleteMessage(t.realmessageid);case 1:this.opts.action&&this.opts.action("deletemsg",t);case 2:return e.a(2)}},e,this)})),function(e){return b.apply(this,arguments)})},{key:"refreshMessage",value:(w=m(f().m(function e(t){var n,r,i,o,a=arguments;return f().w(function(e){for(;;)switch(e.p=e.n){case 0:if(n=a.length>1&&void 0!==a[1]&&a[1],this.isLoading.value=!0,e.p=1,r=this.messages.value.findIndex(function(e){return e.messageid===t.messageid}),!n){e.n=3;break}return 40===t.state&&(i=h(h({},t._origin),{},{state:30}),this.replaceMessage(i,!1)),this.messages.value.splice(r+1,this.messages.value.length-r-1),this.messages.value=c(this.messages.value),e.n=2,this.opts.question(this,this.context,this.params,{appDataEntityId:this.appDataEntityId},this.getMessages(),this.chatSessionid,this.activeAIAgentID,this.chatMode,this.getQueryKnowledgeBases(),this.getQueryRecallConfig());case 2:e.n=6;break;case 3:if(r!==this.messages.value.length-1){e.n=5;break}return this.messages.value.pop(),this.messages.value=c(this.messages.value),e.n=4,this.opts.question(this,this.context,this.params,{appDataEntityId:this.appDataEntityId},this.getMessages(),this.chatSessionid,this.activeAIAgentID,this.chatMode,this.getQueryKnowledgeBases(),this.getQueryRecallConfig());case 4:e.n=6;break;case 5:o=this.messages.value[r-1].content,this.messages.value.splice(r-1,2),this.question(o);case 6:this.asyncToIndexDB(),this.opts.action&&this.opts.action("refreshmsg",t);case 7:return e.p=7,this.isLoading.value=!1,e.f(7);case 8:return e.a(2)}},e,this,[[1,,7,8]])})),function(e){return w.apply(this,arguments)})},{key:"copyMessage",value:function(e){var t=e.realcontent;Me.copy(t),this.opts.action&&this.opts.action("copymsg",e)}},{key:"resetTopic",value:(k=m(f().m(function e(){var t;return f().w(function(e){for(;;)switch(e.n){case 0:return t=!0,e.n=1,this.clearTopic();case 1:if(t=e.v){e.n=2;break}return e.a(2,t);case 2:return e.n=3,this.fecthHistory();case 3:return e.a(2,t)}},e,this)})),function(){return k.apply(this,arguments)})},{key:"clearTopic",value:(y=m(f().m(function e(){var t,n;return f().w(function(e){for(;;)switch(e.n){case 0:return t=!0,e.n=1,this.abortQuestion();case 1:if(!this.topicId){e.n=7;break}if(!this.topicId||!this.aiTopic){e.n=6;break}if(!this.currentTopicDisableStorage){e.n=2;break}t=!0,e.n=6;break;case 2:if("LOCAL"!==this.resourceMode){e.n=4;break}return e.n=3,Ne.deleteData(vi.DATA_BASE_NAME,vi.DATA_TABLE_NAME,this.getHistoryStoreKey(this.topicId));case 3:t=e.v,e.n=6;break;case 4:if("REMOTE"!==this.resourceMode){e.n=6;break}return e.n=5,this.aiTopic.clearMessagesByTopicId(this.topicId);case 5:t=e.v;case 6:e.n=10;break;case 7:if("REMOTE"!==this.resourceMode||!this.resourceOptions){e.n=10;break}return e.n=8,this.resourceOptions.getSessionList({n_session_id_eq:this.chatSessionid});case 8:if(!((n=e.v)&&n.length>0)){e.n=10;break}return e.n=9,this.resourceOptions.clearAllMessageBySessionId(n[0].realid);case 9:t=e.v;case 10:if(t){e.n=11;break}return e.a(2,t);case 11:return this.messages.value=[],e.a(2,t)}},e,this)})),function(){return y.apply(this,arguments)})},{key:"addMaterial",value:function(e){var t=this.materials.value.find(function(t){return t.id===e.id});this.materials.value=t?c(this.materials.value):[].concat(c(this.materials.value),[new oi(e)])}},{key:"replaceMaterial",value:function(e,t){var n=this.materials.value.findIndex(function(t){return t.id===e});-1!==n?(this.materials.value[n]=new oi(t),this.materials.value=c(this.materials.value)):this.materials.value=[].concat(c(this.materials.value),[new oi(t)])}},{key:"deleteMaterial",value:function(e){var t=this.materials.value.findIndex(function(t){return t.id===e.id});-1!==t&&(this.materials.value.splice(t,1),this.materials.value=c(this.materials.value))}},{key:"updateRecommendPrompt",value:function(e,t){if(t){var n=this.messages.value.findIndex(function(t){return t.messageid===e.messageid}),r=Ee.parseMixedContent(t).suggestions;r&&r.length>0&&(e.suggestions=r,-1!==n?(this.messages.value[n]=new ri(e),this.messages.value=c(this.messages.value)):this.messages.value=[].concat(c(this.messages.value),[new ri(e)]),this.asyncToIndexDB())}}},{key:"clearUIActions",value:(v=m(f().m(function e(t){var n,r;return f().w(function(e){for(;;)switch(e.n){case 0:-1!==(n=this.messages.value.findIndex(function(e){return e.messageid===t.messageid}))&&((r=this.messages.value[n]._origin).suggestions=void 0,this.messages.value[n].replace(r),this.messages.value=c(this.messages.value)),this.asyncToIndexDB();case 1:return e.a(2)}},e,this)})),function(e){return v.apply(this,arguments)})},{key:"handleSuggestionClick",value:(d=m(f().m(function e(t,n,r){var i,o,a,s,c,l,u,d,p,v,m,y;return f().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.n=1,this.clearUIActions(t);case 1:i=n.type,o=n.metadata,y=i,e.n="action"===y?2:"raw"===y?9:11;break;case 2:if(!this.opts.extendToolbarClick){e.n=8;break}if(s=n.data.actionid,c=n.data.appid,s){e.n=3;break}throw new Error("actionid不能为空");case 3:if(this.addMessage({messageid:we(),state:30,type:"DEFAULT",role:"USER",content:o.content_name,status:"sent"}),l=h({},t),Object.assign(l,{topic:this.topic}),l.msg.realcontent=t.realcontent,u=h({},this.context),!o.action_context){e.n=6;break}e.p=4,d=o.action_context.split(";"),(p=d.reduce(function(e,t){if(t.trim()){var n=g(t.split(":"),2),r=n[0],i=n[1];r&&i&&(e[r.trim()]=i.trim())}return e},{}))&&Object.keys(p).length>0&&Object.assign(u,h({},p)),e.n=6;break;case 5:throw e.p=5,e.v,new Error("action_context参数解析异常,正确格式如:abc:123;cde:456");case 6:return e.n=7,this.opts.extendToolbarClick(r,{id:s,isPluginApp:!!c,appId:c||this.context.srfappid},u,this.params,l);case 7:v=e.v,(m=null==v||null===(a=v.data)||void 0===a?void 0:a[0])&&m.content&&this.addMessage({messageid:we(),state:30,type:m.type||"DEFAULT",role:m.role||"ASSISTANT",content:m.content,status:"sent"});case 8:return e.a(3,12);case 9:return e.n=10,this.question(n.data.content);case 10:return e.a(3,12);case 11:throw new Error("不支持".concat(i,"推荐类型"));case 12:return e.a(2)}},e,this,[[4,5]])})),function(e,t,n){return d.apply(this,arguments)})},{key:"handleUIActionClick",value:(u=m(f().m(function e(t,n,r){var i,o,a,s,c,l,u,d,p,v,m,y,k;return f().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.n=1,this.clearUIActions(t);case 1:i=n.type,o=n.data,a=n.metadata,k=i,e.n="action"===k?2:"raw"===k?9:11;break;case 2:if(!this.opts.extendToolbarClick){e.n=8;break}if(c=o.actionid,l=o.appid,c){e.n=3;break}throw new Error("actionid不能为空");case 3:if(u=h({},t),Object.assign(u,{topic:this.topic}),u.msg.realcontent=t.realcontent,d=h({},this.context),!a.action_context){e.n=6;break}e.p=4,p=a.action_context.split(";"),(v=p.reduce(function(e,t){if(t.trim()){var n=g(t.split(":"),2),r=n[0],i=n[1];r&&i&&(e[r.trim()]=i.trim())}return e},{}))&&Object.keys(v).length>0&&Object.assign(d,h({},v)),e.n=6;break;case 5:throw e.p=5,e.v,new Error("action_context参数解析异常,正确格式如:abc:123;cde:456");case 6:return e.n=7,this.opts.extendToolbarClick(r,{id:c,isPluginApp:!!l,appId:l||this.context.srfappid},d,this.params,u);case 7:m=e.v,(y=null==m||null===(s=m.data)||void 0===s?void 0:s[0])&&y.content&&this.addMessage({messageid:we(),state:30,type:y.type||"DEFAULT",role:y.role||"ASSISTANT",content:y.content,status:"sent"});case 8:return e.a(3,12);case 9:return e.n=10,this.question(o.content);case 10:return e.a(3,12);case 11:throw new Error("不支持".concat(i,"推荐类型"));case 12:return e.a(2)}},e,this,[[4,5]])})),function(e,t,n){return u.apply(this,arguments)})},{key:"setActiveAIAgentID",value:(l=m(f().m(function e(t){var n,r=this;return f().w(function(e){for(;;)switch(e.n){case 0:if(this.activeAIAgentID!==t){e.n=1;break}return e.a(2);case 1:this.activeAIAgentID=t,this.topicId&&this.aiTopic&&this.aiTopic.updateTopicChatByID(this.topicId,{activeAIAgentID:t}),this.enableRecallConfigSetting.value&&(n=this.agentList.value.find(function(e){return e.id===r.activeAIAgentID}),n&&(this.reCallConfig.value={chunkrerank:n.rerank,maxchunks:n.maxchunks,chunkthreshold:n.chunkthreshold,chunkpageindex:n.chunkpageindex})),this.enableKnowledgeBaseSelect.value&&this.computeSelectedKnowledge();case 2:return e.a(2)}},e,this)})),function(e){return l.apply(this,arguments)})},{key:"setAIAgentConfig",value:function(e){this.reCallConfig.value=h(h({},this.reCallConfig.value),e)}},{key:"searchAIAgent",value:(s=m(f().m(function e(t){var n,r,i=this;return f().w(function(e){for(;;)switch(e.n){case 0:if(n=[],!this.opts.fetchAgentList){e.n=3;break}return e.n=1,this.opts.fetchAgentList(t);case 1:if(r=e.v){e.n=2;break}r=[];case 2:n=r.map(function(e){return new ai(e,{chunkrerank:i.opts.reRankDefaultValue,maxchunks:i.opts.maxChunksDefaultValue,chunkthreshold:i.opts.chunkThresholdDefaultValue,chunkpageindex:i.opts.chunkPageIndexDefaultValue})}),e.n=4;break;case 3:n=this.agentList.value;case 4:return e.a(2,n)}},e,this)})),function(e){return s.apply(this,arguments)})},{key:"setSelectionKnowledge",value:function(e){this.selectionKnowledgeBases.value=c(e)}},{key:"switchKnowledgeEnableState",value:function(){this.enableKnowledgeBaseState.value=!this.enableKnowledgeBaseState.value}},{key:"updateTopicCaption",value:(a=m(f().m(function e(){var t,n,r,i,o,a,s,c,l;return f().w(function(e){for(;;)switch(e.n){case 0:if(!this.topicId||!this.aiTopic){e.n=1;break}if(!(t=this.aiTopic.getCurrentTopicByID(this.topicId))||!t.captionComputed){e.n=1;break}return e.a(2);case 1:if(!0!==this.isDigestProcessed){e.n=2;break}return e.a(2);case 2:if(!(n=this.messages.value.find(function(e){return"USER"===e.role}))){e.n=10;break}if(r="",!this.sessionCaptionMode){e.n=7;break}l=this.sessionCaptionMode,e.n="snippet"===l?3:"summary"===l?4:6;break;case 3:return i=n.content,o=Oe.parseMixedContent(i),a=o.remainingText,r=a.substring(0,15),e.a(3,7);case 4:return e.n=5,this.opts.chatDigest(this.context,this.params,{appDataEntityId:this.appDataEntityId,message:{messages:this.getMessages(),sessionid:this.chatSessionid,srfaiagent:this.activeAIAgentID,mode:"title",maxtokens:this.opts.summaryMaxTokens||30}});case 5:return(s=e.v)&&s.content&&(r=s.content),e.a(3,7);case 6:return r=this.sessionDefaultCaption,e.a(3,7);case 7:if("REMOTE"!==this.resourceMode||!this.resourceOptions||this.currentTopicDisableStorage){e.n=9;break}return e.n=8,this.resourceOptions.getSessionList({n_session_id_eq:this.chatSessionid});case 8:if(!((c=e.v)&&c.length>0)){e.n=9;break}if(c[0].caption===r){e.n=9;break}return e.n=9,this.resourceOptions.updateSession(c[0].realid,{caption:r});case 9:this.topicId&&this.aiTopic&&this.aiTopic.updateTopicCaption(this.topicId,r),this.isDigestProcessed=!0;case 10:return e.a(2)}},e,this)})),function(){return a.apply(this,arguments)})},{key:"messageLike",value:(o=m(f().m(function e(t){var n,r,i;return f().w(function(e){for(;;)switch(e.n){case 0:if(n="1"===t.islike,(r=t.realmessageid)&&this.resourceOptions){e.n=1;break}return e.a(2);case 1:if(!n){e.n=3;break}return e.n=2,this.resourceOptions.cancelFeedback(r);case 2:i=e.v,e.n=5;break;case 3:return e.n=4,this.resourceOptions.likeMessage(r);case 4:i=e.v;case 5:i&&(t.islike=n?"0":"1",n||"1"!==t.isdislike||(t.isdislike="0"),this.replaceMessage(t,!1));case 6:return e.a(2)}},e,this)})),function(e){return o.apply(this,arguments)})},{key:"messageDisLike",value:(i=m(f().m(function e(t){var n,r,i,o;return f().w(function(e){for(;;)switch(e.n){case 0:if(n="1"===t.isdislike,r=t.realmessageid,i=t.feedbackcontent,r&&this.resourceOptions){e.n=1;break}return e.a(2);case 1:if(!n){e.n=3;break}return e.n=2,this.resourceOptions.cancelFeedback(r);case 2:o=e.v,e.n=5;break;case 3:return e.n=4,this.resourceOptions.dislikeMessage(r,i);case 4:o=e.v;case 5:o&&(t.isdislike=n?"0":"1",n||"1"!==t.islike||(t.islike="0"),this.replaceMessage(t,!1));case 6:return e.a(2)}},e,this)})),function(e){return i.apply(this,arguments)})},{key:"handlePredefinedClick",value:(r=m(f().m(function e(t,n,r,i){var o,a,s;return f().w(function(e){for(;;)switch(e.n){case 0:s=t,e.n="chunkview"===s?1:"view"===s?5:"action"===s?7:9;break;case 1:if(o=n.replace("chunkview://",""),this.opts.chunkView){e.n=2;break}return console.error("文档分片查看界面不存在,请确认chunkView是否配置"),e.a(2);case 2:if(this.opts.chunkEntity){e.n=3;break}return console.error("文档分片实体标识不存在,请确认chunkEntity是否配置"),e.a(2);case 3:return a="view://".concat(this.opts.chunkView,'?srfnavctx={"').concat(this.opts.chunkEntity,'":"').concat(o,'"}'),e.n=4,this.handlePredefViewClick(a,r,i);case 4:case 6:case 8:return e.a(3,9);case 5:return e.n=6,this.handlePredefViewClick(n,r,i);case 7:return e.n=8,this.handlePredefActionClick(n,r,i);case 9:return e.a(2)}},e,this)})),function(e,t,n,i){return r.apply(this,arguments)})},{key:"handlePredefViewClick",value:(n=m(f().m(function e(t,n,r){return f().w(function(e){for(;;)switch(e.n){case 0:if(this.opts.openLinkView){e.n=1;break}return e.a(2);case 1:return e.n=2,this.opts.openLinkView(t,n,r);case 2:return e.a(2)}},e,this)})),function(e,t,r){return n.apply(this,arguments)})},{key:"handlePredefActionClick",value:(t=m(f().m(function e(t,n,r){var i,o,a,s,c,l,u,d,p,v,m,g;return f().w(function(e){for(;;)switch(e.n){case 0:if(this.opts.extendToolbarClick){e.n=1;break}return e.a(2);case 1:if(o=_e(t),a=o.typeId,s=o.context,c=o.params,l=a,u=s.appid,l){e.n=2;break}throw new Error("actionid不能为空");case 2:return d=h({},n),Object.assign(d,{topic:this.topic}),d.msg.realcontent=n.realcontent,p=h({},this.context),s&&Object.keys(s).length>0&&Object.assign(p,h({},s)),v=h({},this.params),c&&Object.keys(c).length>0&&Object.assign(v,h({},c)),e.n=3,this.opts.extendToolbarClick(r,{id:l,isPluginApp:!!u,appId:u||this.context.srfappid},p,v,d);case 3:m=e.v,(g=null==m||null===(i=m.data)||void 0===i?void 0:i[0])&&g.content&&this.addMessage({messageid:we(),state:30,type:g.type||"DEFAULT",role:g.role||"ASSISTANT",content:g.content,status:"sent"});case 4:return e.a(2)}},e,this)})),function(e,n,r){return t.apply(this,arguments)})},{key:"destroyed",value:(e=m(f().m(function e(){return f().w(function(e){for(;;)switch(e.n){case 0:this.evt.reset();case 1:return e.a(2)}},e,this)})),function(){return e.apply(this,arguments)})}]);var e,t,n,r,i,o,a,s,l,u,d,v,y,k,w,b,C,M,N,T,O,E,A,D,I,z}(),wi=function(){return S(function e(t){x(this,e),_(this,"topics",xt([])),_(this,"activedTopic",xt(void 0)),_(this,"topicSidebarCollapse",xt(!1)),_(this,"topicSidebarWidth",xt(0)),_(this,"isTempChat",xt(!1)),_(this,"backupOptions",void 0),_(this,"preActivedTopic",void 0),_(this,"remoteSessionList",[]),_(this,"resourceMode","LOCAL"),_(this,"resourceOptions",void 0),this.chat=t,this.computeTopicSidebarWidth()},[{key:"setActivedTopic",value:function(e){this.preActivedTopic=this.activedTopic.value,this.activedTopic.value=e}},{key:"injectResourceOptions",value:function(e){this.resourceMode=(null==e?void 0:e.resourceMode)||"LOCAL",this.resourceOptions=e}},{key:"fetchHistory",value:(d=m(f().m(function e(t){var n,r,i=this;return f().w(function(e){for(;;)switch(e.n){case 0:return this.topics.value=[],n=t.configService(t.appid,"aitopics",t.type),e.n=1,n.load();case 1:if(!((r=e.v)&&r.length>0)){e.n=5;break}if("REMOTE"!==this.resourceMode||!this.resourceOptions){e.n=4;break}return e.n=2,this.resourceOptions.getSessionList();case 2:return this.remoteSessionList=e.v,e.n=3,this.asyncRemoteSession(r);case 3:e.n=5;break;case 4:r.forEach(function(e,t){Object.prototype.hasOwnProperty.call(e,"sequence")||(e.sequence=t),Object.prototype.hasOwnProperty.call(e,"isTop")||(e.isTop=0),i.topics.value=[].concat(c(i.topics.value),[new ii(e)])});case 5:return e.a(2)}},e,this)})),function(e){return d.apply(this,arguments)})},{key:"asyncRemoteSession",value:(u=m(f().m(function e(t){var n=this;return f().w(function(e){for(;;)switch(e.n){case 0:if(this.remoteSessionList&&0!==this.remoteSessionList.length&&t&&0!==t.length){e.n=1;break}return e.a(2);case 1:this.remoteSessionList.forEach(function(e){var r=t.find(function(t){var n;return(null===(n=t.aiChat)||void 0===n?void 0:n.sessionid)===e.session_id});if(r){r.realid=e.realid,r.sequence=e.sequence,r.isTop=e.is_top?e.is_top:0,e.caption&&(r.caption=e.caption);var i=n.topics.value.findIndex(function(t){var n;return(null===(n=t.aiChat)||void 0===n?void 0:n.sessionid)===e.session_id});-1===i?n.topics.value=[].concat(c(n.topics.value),[new ii(r)]):(n.topics.value.splice(i,1,new ii(r)),n.topics.value=c(n.topics.value))}});case 2:return e.a(2)}},e,this)})),function(e){return u.apply(this,arguments)})},{key:"asyncTopic",value:(l=m(f().m(function e(t){var n,r;return f().w(function(e){for(;;)switch(e.n){case 0:return this.backupOptions=t,n=this.topics.value.findIndex(function(e){return e.id===t.id}),r=new ii(t),-1!==n?this.topics.value.splice(n,1,r):this.topics.value=[].concat(c(this.topics.value),[r]),e.n=1,this.updateTopic(t);case 1:this.setActivedTopic(r);case 2:return e.a(2)}},e,this)})),function(e){return l.apply(this,arguments)})},{key:"getCurrentTopicByID",value:function(e){var t=this.topics.value.find(function(t){return t.id===e});return t&&t.data?new ii(h({},t.data)):void 0}},{key:"updateTopicChatByID",value:(s=m(f().m(function e(t,n){var r;return f().w(function(e){for(;;)switch(e.n){case 0:if(t&&n&&this.backupOptions){e.n=1;break}return e.a(2);case 1:if(-1!==(r=this.topics.value.findIndex(function(e){return e.id===t}))&&this.topics.value[r].data.aiChat){e.n=2;break}return e.a(2);case 2:return this.topics.value[r].data.aiChat=h(h({},this.topics.value[r].data.aiChat),n),e.n=3,this.updateTopic(this.backupOptions);case 3:return e.a(2)}},e,this)})),function(e,t){return s.apply(this,arguments)})},{key:"removeTopic",value:(a=m(f().m(function e(t,n,r,i,o){var a,s,l,u,d;return f().w(function(e){for(;;)switch(e.n){case 0:if(s=!0,!t.beforeDelete){e.n=2;break}return e.n=1,t.beforeDelete(n,r,i,o);case 1:s=e.v;case 2:if(s){e.n=3;break}return e.a(2);case 3:if(l=!1,!i||!i.disableStorage){e.n=4;break}l=!0,e.n=12;break;case 4:if("LOCAL"!==this.resourceMode){e.n=6;break}return e.n=5,Ne.deleteData(vi.DATA_BASE_NAME,vi.DATA_TABLE_NAME,i.id);case 5:l=e.v,e.n=12;break;case 6:if("REMOTE"!==this.resourceMode||!this.resourceOptions){e.n=12;break}if(!i.realid){e.n=8;break}return e.n=7,this.resourceOptions.deleteSession(i.realid);case 7:l=e.v,e.n=12;break;case 8:if(!i.aiChat||!i.aiChat.sessionid){e.n=12;break}return e.n=9,this.resourceOptions.getSessionList({n_session_id_eq:i.aiChat.sessionid});case 9:if(!((u=e.v)&&u.length>0)){e.n=11;break}return e.n=10,this.resourceOptions.deleteSession(u[0].realid);case 10:l=e.v,e.n=12;break;case 11:l=!0;case 12:if(l){e.n=13;break}return e.a(2);case 13:return-1!==(d=this.topics.value.findIndex(function(e){return e.id===i.id}))&&(this.topics.value.splice(d,1),this.topics.value=c(this.topics.value)),e.n=14,this.updateTopic(t);case 14:this.topics.value.length>0&&i.id===(null===(a=this.activedTopic.value)||void 0===a?void 0:a.id)&&this.handleTopicChange(this.topics.value[0]);case 15:return e.a(2)}},e,this)})),function(e,t,n,r,i){return a.apply(this,arguments)})},{key:"handleTopicChange",value:function(e){var t;(null===(t=this.activedTopic.value)||void 0===t?void 0:t.id)!==e.id&&(this.setActivedTopic(e),this.chat.switchAiChatController(e))}},{key:"handleTopicAction",value:(o=m(f().m(function e(t,n,r){var i,o,a,s,l,u,d,h;return f().w(function(e){for(;;)switch(e.n){case 0:if(i=this.topics.value.find(function(e){return e.id===n.id}),!(this.backupOptions&&i&&i.aiChat)){e.n=10;break}s=i.aiChat,l=s.context,u=s.params,h=t,e.n="DELETE"===h?1:"RENAME"===h||"PINNED"===h?3:9;break;case 1:return e.n=2,this.removeTopic(this.backupOptions,l,u,i,r);case 2:return e.a(3,9);case 3:if("PINNED"===t&&(n.data.isTop=0===n.data.isTop?1:0,this.topics.value=c(this.topics.value)),!n||n.disableStorage){e.n=8;break}return e.n=4,this.updateTopic(this.backupOptions);case 4:if(!n||"REMOTE"!==this.resourceMode||!this.resourceOptions){e.n=8;break}if(!n.realid){e.n=6;break}return e.n=5,this.resourceOptions.updateSession(n.realid,{caption:n.caption,is_top:n.isTop});case 5:e.n=8;break;case 6:if(!n.aiChat||!n.aiChat.sessionid){e.n=8;break}return e.n=7,this.resourceOptions.getSessionList({n_session_id_eq:n.aiChat.sessionid});case 7:if(!((d=e.v)&&d.length>0)){e.n=8;break}return e.n=8,this.resourceOptions.updateSession(d[0].realid,{caption:n.caption,is_top:n.isTop});case 8:return e.a(3,9);case 9:null===(o=(a=this.backupOptions).action)||void 0===o||o.call(a,t,l,u,n,r);case 10:return e.a(2)}},e,this)})),function(e,t,n){return o.apply(this,arguments)})},{key:"clearMessagesByTopicId",value:(i=m(f().m(function e(t){var n,r,i,o;return f().w(function(e){for(;;)switch(e.n){case 0:if(n=!0,t&&this.backupOptions){e.n=1;break}return e.a(2,n);case 1:if(-1!==(r=this.topics.value.findIndex(function(e){return e.id===t}))&&this.topics.value[r].data){e.n=2;break}return e.a(2,n);case 2:if(i=this.topics.value[r]){e.n=3;break}return e.a(2,n);case 3:if(!i.disableStorage){e.n=4;break}return e.a(2,n);case 4:if("REMOTE"!==this.resourceMode||!this.resourceOptions){e.n=10;break}if(!i.realid){e.n=6;break}return e.n=5,this.resourceOptions.clearAllMessageBySessionId(i.realid);case 5:n=e.v,e.n=9;break;case 6:if(!i.aiChat||!i.aiChat.sessionid){e.n=9;break}return e.n=7,this.resourceOptions.getSessionList({n_session_id_eq:i.aiChat.sessionid});case 7:if(!((o=e.v)&&o.length>0)){e.n=9;break}return e.n=8,this.resourceOptions.clearAllMessageBySessionId(o[0].realid);case 8:n=e.v;case 9:if(n){e.n=10;break}return e.a(2,n);case 10:return e.a(2,n)}},e,this)})),function(e){return i.apply(this,arguments)})},{key:"newTopic",value:(r=m(f().m(function e(t,n){var r,i,o,a,s,l,u,d;return f().w(function(e){for(;;)switch(e.n){case 0:if(t){e.n=1;break}return e.a(2);case 1:if(r=this.getCurrentTopicByID(t)){e.n=2;break}return e.a(2);case 2:if(i=be(r.id),o=this.topics.value.filter(function(e){return e.id.startsWith(i)}),n&&r.aiChat&&(r.data.aiChat=h(h({},r.aiChat),n)),a="",a="default"===r.captionMode?"".concat(null===(s=r.sourceCaption)||void 0===s?void 0:s.split("_")[0],"_").concat(o.length):"新会话",l=Math.max.apply(Math,c(this.topics.value.map(function(e){return e.sequence}))),u={appid:r.appid,id:"".concat(i,"@").concat(Date.now()),type:r.type,captionMode:r.captionMode,caption:a,sourceCaption:r.sourceCaption,url:r.url,aiChat:r.aiChat,sequence:l+1,isTop:0,disableStorage:r.disableStorage},d=new ii(u),this.topics.value=[].concat(c(this.topics.value),[d]),!this.backupOptions){e.n=3;break}return e.n=3,this.updateTopic(this.backupOptions);case 3:this.handleTopicChange(d);case 4:return e.a(2)}},e,this)})),function(e,t){return r.apply(this,arguments)})},{key:"clearTopic",value:(n=m(f().m(function e(){var t,n,r,i,o,a=this;return f().w(function(e){for(;;)switch(e.n){case 0:if(t=this.topics.value.find(function(e){var t;return e.id===(null===(t=a.activedTopic.value)||void 0===t?void 0:t.id)}),this.backupOptions&&t){e.n=1;break}return e.a(2);case 1:if(n=!0,!this.backupOptions.beforeDelete){e.n=3;break}return e.n=2,this.backupOptions.beforeDelete(t.aiChat.context,t.aiChat.params,t,void 0,!0);case 2:n=e.v;case 3:if(n){e.n=4;break}return e.a(2);case 4:if(r=!1,"LOCAL"!==this.resourceMode){e.n=6;break}return e.n=5,Promise.all(this.topics.value.map(function(e){if(e.id!==(null==t?void 0:t.id)&&!e.disableStorage)return Ne.deleteData(vi.DATA_BASE_NAME,vi.DATA_TABLE_NAME,e.id)}));case 5:r=!0,e.n=11;break;case 6:if("REMOTE"!==this.resourceMode){e.n=11;break}if(!t||!this.resourceOptions){e.n=10;break}if(!(o=null===(i=t.aiChat)||void 0===i?void 0:i.sessionid)){e.n=8;break}return e.n=7,this.resourceOptions.clearAllSession(o);case 7:r=e.v,e.n=9;break;case 8:r=!0;case 9:e.n=11;break;case 10:r=!0;case 11:if(r){e.n=12;break}return e.a(2);case 12:return this.topics.value=t?[t]:[],e.n=13,this.updateTopic(this.backupOptions);case 13:return e.a(2)}},e,this)})),function(){return n.apply(this,arguments)})},{key:"updateTopicCaption",value:(t=m(f().m(function e(t,n){var r;return f().w(function(e){for(;;)switch(e.n){case 0:if(!(r=this.topics.value.find(function(e){return e.id===t}))||r.caption===n){e.n=1;break}if(r.data.caption=n,r.data.captionComputed=!0,this.topics.value=c(this.topics.value),!this.backupOptions){e.n=1;break}return e.n=1,this.updateTopic(this.backupOptions);case 1:return e.a(2)}},e,this)})),function(e,n){return t.apply(this,arguments)})},{key:"updateTopic",value:(e=m(f().m(function e(t){var n,r;return f().w(function(e){for(;;)switch(e.n){case 0:if(t){e.n=1;break}return e.a(2);case 1:return n=[],this.topics.value.forEach(function(e){e.disableStorage||n.push({appid:e.appid,id:e.id,type:e.type,captionMode:e.captionMode,captionComputed:!!e.captionComputed,caption:e.caption||e.sourceCaption,sourceCaption:e.sourceCaption,url:e.url,aiChat:e.aiChat,isTop:e.isTop,sequence:e.sequence})}),r=t.configService(t.appid,"aitopics",t.type),e.n=2,null==r?void 0:r.save(n);case 2:return e.a(2)}},e,this)})),function(t){return e.apply(this,arguments)})},{key:"computeTopicSidebarWidth",value:function(){this.topicSidebarWidth.value=!0===this.topicSidebarCollapse.value?42:200}},{key:"switchTopicSidebarCollapse",value:function(){this.topicSidebarCollapse.value=!this.topicSidebarCollapse.value,this.computeTopicSidebarWidth()}},{key:"globalNewTopic",value:function(){if(this.activedTopic.value)if(this.isTempChat.value){if(!this.backupOptions)return;this.exitTempChat();var e=this.backupOptions.aiChat;this.newTopic(this.backupOptions.id,{activeAIAgentID:e.activeAIAgentID,sessionid:"".concat(be(e.sessionid),"@").concat((new Date).getTime())})}else{var t=this.activedTopic.value.aiChat;this.newTopic(this.activedTopic.value.id,{activeAIAgentID:t.activeAIAgentID,sessionid:"".concat(be(t.sessionid),"@").concat((new Date).getTime())})}}},{key:"enterTempChat",value:function(){if(this.isTempChat.value=!0,this.backupOptions){var e=be(this.backupOptions.id),t=Se("TEMP"),n=Math.max.apply(Math,c(this.topics.value.map(function(e){return e.sequence}))),r=h(h({},this.backupOptions.aiChat),{},{sessionid:t}),i={appid:this.backupOptions.appid,id:"".concat(e,"@").concat(Date.now()),type:this.backupOptions.type,captionMode:this.backupOptions.captionMode,caption:"临时会话",sourceCaption:"临时会话",url:this.backupOptions.url,aiChat:r,sequence:n+1,isTop:0,disableStorage:!0,isShow:!1},o=new ii(i);this.topics.value=[].concat(c(this.topics.value),[o]),this.handleTopicChange(o)}else console.error("临时会话失败,无话题配置备份配置")}},{key:"exitTempChat",value:function(){this.isTempChat.value=!1;var e=this.topics.value.findIndex(function(e){return!0===e.disableStorage&&!1===e.isShow});-1!==e&&(this.topics.value.splice(e,1),this.topics.value=c(this.topics.value))}}]);var e,t,n,r,i,o,a,s,l,u,d}(),bi=S(function e(t){x(this,e),this.aiChat=t}),xi=function(e){function t(){return x(this,t),r(this,t,arguments)}return a(t,e),S(t,[{key:"excuteAction",value:(n=m(f().m(function e(t,n){var r,i,o=this;return f().w(function(e){for(;;)switch(e.n){case 0:if(!n||!n.onClick||"function"!=typeof n.onClick){e.n=2;break}return e.n=1,n.onClick(t,n,this.aiChat.context,this.aiChat.params);case 1:r=e.v,e.n=5;break;case 2:if(!(i=this.aiChat.opts.extendToolbarClick)){e.n=4;break}return e.n=3,i(t,n,this.aiChat.context,this.aiChat.params,{});case 3:r=e.v,e.n=5;break;case 4:console.error("未找到扩展工具栏点击事件");case 5:r&&r.data&&r.data.length>0&&r.data.forEach(function(e){var t={id:e.id,type:e.type,data:e.data||{},metadata:e.metadata||{}};n.id&&Object.assign(t.metadata,{actionId:n.id}),o.aiChat.addMaterial(t)});case 6:return e.a(2)}},e,this)})),function(e,t){return n.apply(this,arguments)})}]);var n}(bi),Ci=function(e){function t(){return x(this,t),r(this,t,arguments)}return a(t,e),S(t,[{key:"excuteAction",value:(n=m(f().m(function e(t,n){var r,i,o,a,s,c,l,u,d,h,p,v,g,y=this;return f().w(function(e){for(;;)switch(e.n){case 0:r=this.aiChat.opts.uploader,i=r.folder,o=r.accept,a=r.maxSize,s=r.multiple,c=r.onError,l=r.onSelect,u=r.onUpload,d=r.onSuccess,h=r.onDownLoad,p=r.onProgress,v=r.globalDownloadPrifix,g={folder:i,globalDownloadPrifix:v,multiple:s||!0,accept:o||"*/*",maxSize:a||5242880,onSelect:function(e){null==l||l(e),e.length>0&&e.forEach(function(e){var t=y.buildMaterialObject(i,e);Object.assign(t.metadata,{state:"uploading"}),y.aiChat.addMaterial(t)})},onUpload:function(){var e=m(f().m(function e(t,n){return f().w(function(e){for(;;)if(0===e.n)return e.a(2,u(t,n,{context:y.aiChat.context,params:y.aiChat.params}))},e)}));return function(t,n){return e.apply(this,arguments)}}(),onDownLoad:h,onSuccess:function(e,t){var n={id:e.id,type:"ossfile",data:{id:e.id,name:e.name,folder:i},metadata:{ext:e.ext,fileext:e.fileext,fileid:e.fileid,filename:e.filename,size:e.size,filesize:e.filesize,state:"successed",folder:i}};y.aiChat.replaceMaterial(t.name,n),null==d||d(e,t)},onError:function(e,t){var n=y.buildMaterialObject(i,t);Object.assign(n.metadata,{state:"failed"}),y.aiChat.replaceMaterial(t.name,n),null==c||c(e,t)},onProgress:function(e,t){null==p||p(e,t)}},new Te(g).openFilePicker();case 1:return e.a(2)}},e,this)})),function(e,t){return n.apply(this,arguments)})},{key:"buildMaterialObject",value:function(e,t){return{id:t.name,type:"ossfile",data:{name:t.name,id:t.name,folder:e},metadata:{size:t.size,type:t.type,lastModified:t.lastModified,folder:e}}}}]);var n}(bi),Si=function(){return S(function e(){x(this,e)},null,[{key:"getMaterialHelper",value:function(e,t){return"ossfile"===e?new Ci(t):new xi(t)}}])}(),_i=function(){return S(function e(){x(this,e),_(this,"container",void 0),_(this,"mode","DEFAULT"),_(this,"resourceOptions",void 0),_(this,"backupChatOptions",void 0),_(this,"aiTopic",void 0),_(this,"aiTopicMap",new Map),this.aiTopic=new wi(this)},[{key:"aiChat",get:function(){var e;return this.aiTopicMap.get("".concat(null===(e=this.aiTopic.activedTopic.value)||void 0===e?void 0:e.id))}},{key:"initIndexDB",value:(t=m(f().m(function e(){return f().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,Ne.checkTableExists(vi.DATA_BASE_NAME,vi.DATA_TABLE_NAME);case 1:if(e.v){e.n=2;break}return e.n=2,Ne.createTable(vi.DATA_BASE_NAME,vi.DATA_TABLE_NAME,vi.DATA_TABLE_KEY_NAME,!1);case 2:return e.a(2)}},e)})),function(){return t.apply(this,arguments)})},{key:"create",value:(e=m(f().m(function e(t){var n,r,i,o,a,s,c,l,u,d,h,p,v,m=this;return f().w(function(e){for(;;)switch(e.n){case 0:if(this.resourceOptions=t.resourceOptions,"LOCAL"!==((null===(n=t.resourceOptions)||void 0===n?void 0:n.resourceMode)||"LOCAL")){e.n=1;break}return e.n=1,this.initIndexDB();case 1:if(this.backupChatOptions=t,this.close(),this.container=document.createElement("div"),this.container.classList.add("ibiz-ai-chat"),document.body.appendChild(this.container),c=t.chatOptions,de($(zp,{mode:t.mode?t.mode:"DEFAULT",containerOptions:t.containerOptions,caption:t.mode&&"TOPIC"===t.mode?"AI助手":c.caption,autoClose:null===(r=t.containerOptions)||void 0===r?void 0:r.autoClose,openMode:null===(i=t.containerOptions)||void 0===i?void 0:i.openMode,hideTopicSidebar:(null===(o=t.topicOptions)||void 0===o?void 0:o.hideTopicSidebar)||!1,close:function(){m.close(),c&&c.closed&&c.closed(c.context,c.params,[])},fullscreen:function(e){c&&c.fullscreen&&c.fullscreen(e,c.context,c.params)},minimize:function(e){c&&c.minimize&&c.minimize(e,c.context,c.params)},isLoading:!0}),this.container),c.aiAgentlist||!c.fetchAgentList){e.n=3;break}return e.n=2,c.fetchAgentList();case 2:c.aiAgentlist=e.v;case 3:if(c.aiknowledgeBasesList||!c.fetchKnowledgeBaseList||!c.enableKnowledgeBaseSelect){e.n=5;break}return e.n=4,c.fetchKnowledgeBaseList();case 4:c.aiknowledgeBasesList=e.v,e.n=6;break;case 5:c.aiknowledgeBasesList=[];case 6:if(!t.mode||"TOPIC"!==t.mode){e.n=9;break}return this.aiTopic.injectResourceOptions(t.resourceOptions),e.n=7,this.aiTopic.fetchHistory(t.topicOptions);case 7:return l=t.topicOptions,Object.assign(l,{aiChat:{caption:c.caption,context:c.context,params:c.params,appDataEntityId:c.appDataEntityId,sessionid:c.sessionid,contentToolbarItems:c.contentToolbarItems,footerToolbarItems:c.footerToolbarItems,questionToolbarItems:c.questionToolbarItems,otherToolbarItems:c.otherToolbarItems,appendCurData:c.appendCurData,appendCurContent:c.appendCurContent,enableAIAgentChange:c.enableAIAgentChange,activeAIAgentID:c.activeAIAgentID,aiAgentlist:c.aiAgentlist,srfMode:c.srfMode,appendCurResource:c.appendCurResource}}),this.syncHistoryOptions(l,c,t.resourceOptions),e.n=8,this.aiTopic.asyncTopic(l);case 8:e.n=10;break;case 9:this.aiTopic.setActivedTopic(void 0);case 10:return Object.assign(c,{topicId:null===(a=l)||void 0===a?void 0:a.id,topic:l,aiTopic:this.aiTopic}),u=new ki(c,this.resourceOptions),this.aiTopicMap.set("".concat(null===(s=l)||void 0===s?void 0:s.id),u),t.mode&&"TOPIC"===t.mode&&this.aiTopic.isTempChat.value?this.aiTopic.enterTempChat():de($(zp,{aiChat:u,aiTopic:this.aiTopic,mode:t.mode?t.mode:"DEFAULT",containerOptions:t.containerOptions,caption:t.mode&&"TOPIC"===t.mode?"AI助手":c.caption,enableBackFill:null===(d=t.containerOptions)||void 0===d?void 0:d.enableBackFill,contentToolbarItems:c.contentToolbarItems,footerToolbarItems:c.footerToolbarItems,questionToolbarItems:c.questionToolbarItems,autoClose:null===(h=t.containerOptions)||void 0===h?void 0:h.autoClose,openMode:null===(p=t.containerOptions)||void 0===p?void 0:p.openMode,hideTopicSidebar:(null===(v=t.topicOptions)||void 0===v?void 0:v.hideTopicSidebar)||!1,close:function(){m.close(),c.closed&&c.closed(c.context,c.params,u.getAllMessages())},fullscreen:function(e){c.fullscreen&&c.fullscreen(e,c.context,c.params)},minimize:function(e){c.minimize&&c.minimize(e,c.context,c.params)},isLoading:!1}),this.container),e.a(2,u)}},e,this)})),function(t){return e.apply(this,arguments)})},{key:"syncHistoryOptions",value:function(e,t,n){if(e.disableStorage){var r=Se("TEMP");return t.sessionid=r,e.aiChat.sessionid=r,e.caption="临时会话",void(e.sourceCaption="临时会话")}var i=this.aiTopic.getCurrentTopicByID(e.id);if(i&&(e.sequence=i.sequence,e.isTop=i.isTop),i&&i.aiChat&&i.aiChat.activeAIAgentID)t.activeAIAgentID=i.aiChat.activeAIAgentID,e.aiChat.activeAIAgentID=i.aiChat.activeAIAgentID;else if(t.aiAgentlist&&t.aiAgentlist.length>0&&!t.activeAIAgentID){var o=t.aiAgentlist.find(function(e){return 1===e.default});o?(t.activeAIAgentID=o.id,e.aiChat.activeAIAgentID=o.id):(t.activeAIAgentID=t.aiAgentlist[0].id,e.aiChat.activeAIAgentID=t.aiAgentlist[0].id)}i&&i.aiChat&&i.aiChat.sessionid&&(t.sessionid=i.aiChat.sessionid,e.aiChat.sessionid=i.aiChat.sessionid);var a=n.resourceMode;"LOCAL"===a?"default"!==e.captionMode?(e.sourceCaption="新会话",i&&i.caption?e.caption=i.caption:e.caption="新会话"):e.sourceCaption=e.caption:"REMOTE"===a&&(e.sourceCaption=e.caption,i&&i.caption&&(e.caption=i.caption)),i&&(e.captionComputed=!!i.captionComputed),"REMOTE"===a&&i&&i.realid&&(e.realid=i.realid)}},{key:"switchAiChatController",value:function(e){var t=this,n=h({},this.backupChatOptions.chatOptions);e.aiChat&&Object.assign(n,{caption:e.aiChat.caption,context:e.aiChat.context,params:e.aiChat.params,sessionid:e.aiChat.sessionid,contentToolbarItems:e.aiChat.contentToolbarItems,footerToolbarItems:e.aiChat.footerToolbarItems,questionToolbarItems:e.aiChat.questionToolbarItems,otherToolbarItems:e.aiChat.otherToolbarItems,appendCurData:e.aiChat.appendCurData,appendCurContent:e.aiChat.appendCurContent,aiAgentlist:e.aiChat.aiAgentlist,activeAIAgentID:e.aiChat.activeAIAgentID,enableAIAgentChange:e.aiChat.enableAIAgentChange,srfMode:e.aiChat.srfMode,appendCurResource:e.aiChat.appendCurResource,appDataEntityId:e.aiChat.appDataEntityId,topicId:e.id,topic:e,aiTopic:this.aiTopic,extendToolbarClick:this.backupChatOptions.chatOptions.extendToolbarClick,recommendPrompt:this.backupChatOptions.chatOptions.recommendPrompt,chatDigest:this.backupChatOptions.chatOptions.chatDigest,openLinkView:this.backupChatOptions.chatOptions.openLinkView});var r,i,o,a,s,c,l,u=new ki(n,this.resourceOptions);(this.aiTopicMap.set("".concat(e.id),u),this.container)&&(de(null,this.container),de($(zp,{aiChat:u,aiTopic:this.aiTopic,mode:null!==(r=this.backupChatOptions)&&void 0!==r&&r.mode?this.backupChatOptions.mode:"DEFAULT",containerOptions:null===(i=this.backupChatOptions)||void 0===i?void 0:i.containerOptions,caption:null!==(o=this.backupChatOptions)&&void 0!==o&&o.mode&&"TOPIC"===this.backupChatOptions.mode?"AI助手":n.caption,enableBackFill:null===(a=this.backupChatOptions)||void 0===a||null===(a=a.containerOptions)||void 0===a?void 0:a.enableBackFill,contentToolbarItems:n.contentToolbarItems,footerToolbarItems:n.footerToolbarItems,questionToolbarItems:n.questionToolbarItems,autoClose:null===(s=this.backupChatOptions)||void 0===s||null===(s=s.containerOptions)||void 0===s?void 0:s.autoClose,openMode:null===(c=this.backupChatOptions)||void 0===c||null===(c=c.containerOptions)||void 0===c?void 0:c.openMode,hideTopicSidebar:(null===(l=this.backupChatOptions)||void 0===l||null===(l=l.topicOptions)||void 0===l?void 0:l.hideTopicSidebar)||!1,close:function(){t.close(),n.closed&&n.closed(n.context,n.params,u.getAllMessages())},fullscreen:function(e){n.fullscreen&&n.fullscreen(e,n.context,n.params)},minimize:function(e){n.minimize&&n.minimize(e,n.context,n.params)},isLoading:!1}),this.container))}},{key:"hidden",value:function(){this.container&&(this.container.style.display="none")}},{key:"show",value:function(){this.container&&(this.container.style.display="flex")}},{key:"close",value:function(){this.container&&(de(null,this.container),this.container.remove(),this.container=void 0),this.aiTopicMap.forEach(function(e){e.destroyed()})}}]);var e,t}(),Mi=(t("chat",new _i),new ve("chat-input-material")),Ni=function(e){var t=e.controller.materials;return fe("div",{className:Mi.b(),children:t.value.map(function(t){return fe(Jr,{material:t,disabled:!1,controller:e.controller},t.id)})})},Ti=function(e){var t=e.triggerMode,n=e.children,r=e.actions,i=e.content,o=e.position,a=void 0===o?"bottom":o,s=e.isOpen,c=e.onToggleOpen,l=e.onAction,u=new ve("pop"),d=nt(Ip),f=g(Xe(s||!1),2),p=f[0],v=f[1],m=Qe(null),y=Qe(null),k=Qe(null);Ye(function(){void 0!==s&&v(s)},[s]),Ye(function(){return y.current||(y.current=document.createElement("div"),y.current.className=u.b("content-container"),document.body.appendChild(y.current)),function(){y.current&&document.body.removeChild(y.current)}},[]),Ye(function(){var e=function(e){!m.current||m.current.contains(e.target)||e.target.closest(".".concat(u.b()))||e.target.closest(".ibiz-quick-edit")||e.target.closest(".ibiz-picker__transfer")||(v(!1),null==c||c(!1))};return p&&document.addEventListener("mousedown",e),function(){document.removeEventListener("mousedown",e)}},[p,c]);var w=function(){k.current&&"hover"===t&&(clearTimeout(k.current),k.current=null)},b=function(){"hover"===t&&(w(),k.current=setTimeout(function(){v(!1),null==c||c(!1)},100))};return fe("span",{className:"".concat(u.b("trigger-container")),children:[fe("span",{className:"".concat(u.b("trigger-element")),ref:m,onClick:function(e){!function(e){if("click"===t){e.stopPropagation();var n=!p;v(n),null==c||c(n)}}(e)},onMouseEnter:function(e){!function(e){if("hover"===t){e.stopPropagation(),w();var n=!0;v(n),null==c||c(n)}}(e)},onMouseLeave:function(e){e.stopPropagation(),b()},children:n}),p&&y.current&&mr(fe("div",{className:"".concat(u.b()," pop-").concat(a),style:function(){if(!m.current)return{};var e=m.current.getBoundingClientRect(),t={position:"absolute",zIndex:d.zIndex+1},n={bottom:{top:e.bottom+window.scrollY,left:e.left+window.scrollX},top:{bottom:window.innerHeight-e.top+window.scrollY,left:e.left+window.scrollX},left:{top:e.top+window.scrollY,right:window.innerWidth-e.left+window.scrollX},right:{top:e.top+window.scrollY,left:e.right+window.scrollX},"top-left":{bottom:window.innerHeight-e.top+window.scrollY,right:window.innerWidth-e.left+window.scrollX}};return h(h({},t),n[a])}(),onMouseEnter:w,onMouseLeave:b,children:i||(null==r?void 0:r.map(function(e){return fe("div",{title:e.caption,className:u.e("item"),onMouseDown:function(t){t.stopPropagation(),null==l||l(e.id,t)},children:[e.icon,fe("div",{className:u.em("item","caption"),children:e.caption})]},e.id)}))}),y.current)]})};function Oi(e){this.content=e}function Ei(e,t,n){for(var r=0;;r++){if(r==e.childCount||r==t.childCount)return e.childCount==t.childCount?null:n;var i=e.child(r),o=t.child(r);if(i!=o){if(!i.sameMarkup(o))return n;if(i.isText&&i.text!=o.text){for(var a=0;i.text[a]==o.text[a];a++)n++;return n}if(i.content.size||o.content.size){var s=Ei(i.content,o.content,n+1);if(null!=s)return s}n+=i.nodeSize}else n+=i.nodeSize}}function Ai(e,t,n,r){for(var i=e.childCount,o=t.childCount;;){if(0==i||0==o)return i==o?null:{a:n,b:r};var a=e.child(--i),s=t.child(--o),c=a.nodeSize;if(a!=s){if(!a.sameMarkup(s))return{a:n,b:r};if(a.isText&&a.text!=s.text){for(var l=0,u=Math.min(a.text.length,s.text.length);l<u&&a.text[a.text.length-l-1]==s.text[s.text.length-l-1];)l++,n--,r--;return{a:n,b:r}}if(a.content.size||s.content.size){var d=Ai(a.content,s.content,n-1,r-1);if(d)return d}n-=c,r-=c}else n-=c,r-=c}}Oi.prototype={constructor:Oi,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return-1},get:function(e){var t=this.find(e);return-1==t?void 0:this.content[t+1]},update:function(e,t,n){var r=n&&n!=e?this.remove(n):this,i=r.find(e),o=r.content.slice();return-1==i?o.push(n||e,t):(o[i+1]=t,n&&(o[i]=n)),new Oi(o)},remove:function(e){var t=this.find(e);if(-1==t)return this;var n=this.content.slice();return n.splice(t,2),new Oi(n)},addToStart:function(e,t){return new Oi([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new Oi(n)},addBefore:function(e,t,n){var r=this.remove(t),i=r.content.slice(),o=r.find(e);return i.splice(-1==o?i.length:o,0,t,n),new Oi(i)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return(e=Oi.from(e)).size?new Oi(e.content.concat(this.subtract(e).content)):this},append:function(e){return(e=Oi.from(e)).size?new Oi(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=Oi.from(e);for(var n=0;n<e.content.length;n+=2)t=t.remove(e.content[n]);return t},toObject:function(){var e={};return this.forEach(function(t,n){e[t]=n}),e},get size(){return this.content.length>>1}},Oi.from=function(e){if(e instanceof Oi)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new Oi(t)};var Di=function(){function e(t,n){if(x(this,e),this.content=t,this.size=n||0,null==n)for(var r=0;r<t.length;r++)this.size+=t[r].nodeSize}return S(e,[{key:"nodesBetween",value:function(e,t,n){for(var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4?arguments[4]:void 0,o=0,a=0;a<t;o++){var s=this.content[o],c=a+s.nodeSize;if(c>e&&!1!==n(s,r+a,i||null,o)&&s.content.size){var l=a+1;s.nodesBetween(Math.max(0,e-l),Math.min(s.content.size,t-l),n,r+l)}a=c}}},{key:"descendants",value:function(e){this.nodesBetween(0,this.size,e)}},{key:"textBetween",value:function(e,t,n,r){var i="",o=!0;return this.nodesBetween(e,t,function(a,s){var c=a.isText?a.text.slice(Math.max(e,s)-s,t-s):a.isLeaf?r?"function"==typeof r?r(a):r:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&c||a.isTextblock)&&n&&(o?o=!1:i+=n),i+=c},0),i}},{key:"append",value:function(t){if(!t.size)return this;if(!this.size)return t;var n=this.lastChild,r=t.firstChild,i=this.content.slice(),o=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),o=1);o<t.content.length;o++)i.push(t.content[o]);return new e(i,this.size+t.size)}},{key:"cut",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.size;if(0==t&&n==this.size)return this;var r=[],i=0;if(n>t)for(var o=0,a=0;a<n;o++){var s=this.content[o],c=a+s.nodeSize;c>t&&((a<t||c>n)&&(s=s.isText?s.cut(Math.max(0,t-a),Math.min(s.text.length,n-a)):s.cut(Math.max(0,t-a-1),Math.min(s.content.size,n-a-1))),r.push(s),i+=s.nodeSize),a=c}return new e(r,i)}},{key:"cutByIndex",value:function(t,n){return t==n?e.empty:0==t&&n==this.content.length?this:new e(this.content.slice(t,n))}},{key:"replaceChild",value:function(t,n){var r=this.content[t];if(r==n)return this;var i=this.content.slice(),o=this.size+n.nodeSize-r.nodeSize;return i[t]=n,new e(i,o)}},{key:"addToStart",value:function(t){return new e([t].concat(this.content),this.size+t.nodeSize)}},{key:"addToEnd",value:function(t){return new e(this.content.concat(t),this.size+t.nodeSize)}},{key:"eq",value:function(e){if(this.content.length!=e.content.length)return!1;for(var t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}},{key:"firstChild",get:function(){return this.content.length?this.content[0]:null}},{key:"lastChild",get:function(){return this.content.length?this.content[this.content.length-1]:null}},{key:"childCount",get:function(){return this.content.length}},{key:"child",value:function(e){var t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}},{key:"maybeChild",value:function(e){return this.content[e]||null}},{key:"forEach",value:function(e){for(var t=0,n=0;t<this.content.length;t++){var r=this.content[t];e(r,n,t),n+=r.nodeSize}}},{key:"findDiffStart",value:function(e){return Ei(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0)}},{key:"findDiffEnd",value:function(e){return Ai(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.size,arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.size)}},{key:"findIndex",value:function(e){if(0==e)return zi(0,e);if(e==this.size)return zi(this.content.length,e);if(e>this.size||e<0)throw new RangeError("Position ".concat(e," outside of fragment (").concat(this,")"));for(var t=0,n=0;;t++){var r=n+this.child(t).nodeSize;if(r>=e)return r==e?zi(t+1,r):zi(t,n);n=r}}},{key:"toString",value:function(){return"<"+this.toStringInner()+">"}},{key:"toStringInner",value:function(){return this.content.join(", ")}},{key:"toJSON",value:function(){return this.content.length?this.content.map(function(e){return e.toJSON()}):null}}],[{key:"fromJSON",value:function(t,n){if(!n)return e.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new e(n.map(t.nodeFromJSON))}},{key:"fromArray",value:function(t){if(!t.length)return e.empty;for(var n,r=0,i=0;i<t.length;i++){var o=t[i];r+=o.nodeSize,i&&o.isText&&t[i-1].sameMarkup(o)?(n||(n=t.slice(0,i)),n[n.length-1]=o.withText(n[n.length-1].text+o.text)):n&&n.push(o)}return new e(n||t,r)}},{key:"from",value:function(t){if(!t)return e.empty;if(t instanceof e)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new e([t],t.nodeSize);throw new RangeError("Can not convert "+t+" to a Fragment"+(t.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}])}();Di.empty=new Di([],0);var Ii={index:0,offset:0};function zi(e,t){return Ii.index=e,Ii.offset=t,Ii}function Ri(e,t){if(e===t)return!0;if(!e||"object"!=N(e)||!t||"object"!=N(t))return!1;var n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(var r=0;r<e.length;r++)if(!Ri(e[r],t[r]))return!1}else{for(var i in e)if(!(i in t)||!Ri(e[i],t[i]))return!1;for(var o in t)if(!(o in e))return!1}return!0}var Pi=function(){function e(t,n){x(this,e),this.type=t,this.attrs=n}return S(e,[{key:"addToSet",value:function(e){for(var t,n=!1,r=0;r<e.length;r++){var i=e[r];if(this.eq(i))return e;if(this.type.excludes(i.type))t||(t=e.slice(0,r));else{if(i.type.excludes(this.type))return e;!n&&i.type.rank>this.type.rank&&(t||(t=e.slice(0,r)),t.push(this),n=!0),t&&t.push(i)}}return t||(t=e.slice()),n||t.push(this),t}},{key:"removeFromSet",value:function(e){for(var t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}},{key:"isInSet",value:function(e){for(var t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}},{key:"eq",value:function(e){return this==e||this.type==e.type&&Ri(this.attrs,e.attrs)}},{key:"toJSON",value:function(){var e={type:this.type.name};for(var t in this.attrs){e.attrs=this.attrs;break}return e}}],[{key:"fromJSON",value:function(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");var n=e.marks[t.type];if(!n)throw new RangeError("There is no mark type ".concat(t.type," in this schema"));var r=n.create(t.attrs);return n.checkAttrs(r.attrs),r}},{key:"sameSet",value:function(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(var n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}},{key:"setFrom",value:function(t){if(!t||Array.isArray(t)&&0==t.length)return e.none;if(t instanceof e)return[t];var n=t.slice();return n.sort(function(e,t){return e.type.rank-t.type.rank}),n}}])}();Pi.none=[];var Li=function(e){function t(){return x(this,t),r(this,t,arguments)}return a(t,e),S(t)}(n(Error)),Bi=function(){function e(t,n,r){x(this,e),this.content=t,this.openStart=n,this.openEnd=r}return S(e,[{key:"size",get:function(){return this.content.size-this.openStart-this.openEnd}},{key:"insertAt",value:function(t,n){var r=Fi(this.content,t+this.openStart,n);return r&&new e(r,this.openStart,this.openEnd)}},{key:"removeBetween",value:function(t,n){return new e(Vi(this.content,t+this.openStart,n+this.openStart),this.openStart,this.openEnd)}},{key:"eq",value:function(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}},{key:"toString",value:function(){return this.content+"("+this.openStart+","+this.openEnd+")"}},{key:"toJSON",value:function(){if(!this.content.size)return null;var e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}}],[{key:"fromJSON",value:function(t,n){if(!n)return e.empty;var r=n.openStart||0,i=n.openEnd||0;if("number"!=typeof r||"number"!=typeof i)throw new RangeError("Invalid input for Slice.fromJSON");return new e(Di.fromJSON(t,n.content),r,i)}},{key:"maxOpen",value:function(t){for(var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=0,i=0,o=t.firstChild;o&&!o.isLeaf&&(n||!o.type.spec.isolating);o=o.firstChild)r++;for(var a=t.lastChild;a&&!a.isLeaf&&(n||!a.type.spec.isolating);a=a.lastChild)i++;return new e(t,r,i)}}])}();function Vi(e,t,n){var r=e.findIndex(t),i=r.index,o=r.offset,a=e.maybeChild(i),s=e.findIndex(n),c=s.index,l=s.offset;if(o==t||a.isText){if(l!=n&&!e.child(c).isText)throw new RangeError("Removing non-flat range");return e.cut(0,t).append(e.cut(n))}if(i!=c)throw new RangeError("Removing non-flat range");return e.replaceChild(i,a.copy(Vi(a.content,t-o-1,n-o-1)))}function Fi(e,t,n,r){var i=e.findIndex(t),o=i.index,a=i.offset,s=e.maybeChild(o);if(a==t||s.isText)return r&&!r.canReplace(o,o,n)?null:e.cut(0,t).append(n).append(e.cut(t));var c=Fi(s.content,t-a-1,n,s);return c&&e.replaceChild(o,s.copy(c))}function ji(e,t,n){if(n.openStart>e.depth)throw new Li("Inserted content deeper than insertion position");if(e.depth-n.openStart!=t.depth-n.openEnd)throw new Li("Inconsistent open depths");return $i(e,t,n,0)}function $i(e,t,n,r){var i=e.index(r),o=e.node(r);if(i==t.index(r)&&r<e.depth-n.openStart){var a=$i(e,t,n,r+1);return o.copy(o.content.replaceChild(i,a))}if(n.content.size){if(n.openStart||n.openEnd||e.depth!=r||t.depth!=r){var s=function(e,t){for(var n=t.depth-e.openStart,r=t.node(n).copy(e.content),i=n-1;i>=0;i--)r=t.node(i).copy(Di.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}(n,e);return Ki(o,Ji(e,s.start,s.end,t,r))}var c=e.parent,l=c.content;return Ki(c,l.cut(0,e.parentOffset).append(n.content).append(l.cut(t.parentOffset)))}return Ki(o,Gi(e,t,r))}function Hi(e,t){if(!t.type.compatibleContent(e.type))throw new Li("Cannot join "+t.type.name+" onto "+e.type.name)}function Wi(e,t,n){var r=e.node(n);return Hi(r,t.node(n)),r}function qi(e,t){var n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function Ui(e,t,n,r){var i=(t||e).node(n),o=0,a=t?t.index(n):i.childCount;e&&(o=e.index(n),e.depth>n?o++:e.textOffset&&(qi(e.nodeAfter,r),o++));for(var s=o;s<a;s++)qi(i.child(s),r);t&&t.depth==n&&t.textOffset&&qi(t.nodeBefore,r)}function Ki(e,t){return e.type.checkContent(t),e.copy(t)}function Ji(e,t,n,r,i){var o=e.depth>i&&Wi(e,t,i+1),a=r.depth>i&&Wi(n,r,i+1),s=[];return Ui(null,e,i,s),o&&a&&t.index(i)==n.index(i)?(Hi(o,a),qi(Ki(o,Ji(e,t,n,r,i+1)),s)):(o&&qi(Ki(o,Gi(e,t,i+1)),s),Ui(t,n,i,s),a&&qi(Ki(a,Gi(n,r,i+1)),s)),Ui(r,null,i,s),new Di(s)}function Gi(e,t,n){var r=[];(Ui(null,e,n,r),e.depth>n)&&qi(Ki(Wi(e,t,n+1),Gi(e,t,n+1)),r);return Ui(t,null,n,r),new Di(r)}Bi.empty=new Bi(Di.empty,0,0);var Xi=function(){function e(t,n,r){x(this,e),this.pos=t,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}return S(e,[{key:"resolveDepth",value:function(e){return null==e?this.depth:e<0?this.depth+e:e}},{key:"parent",get:function(){return this.node(this.depth)}},{key:"doc",get:function(){return this.node(0)}},{key:"node",value:function(e){return this.path[3*this.resolveDepth(e)]}},{key:"index",value:function(e){return this.path[3*this.resolveDepth(e)+1]}},{key:"indexAfter",value:function(e){return e=this.resolveDepth(e),this.index(e)+(e!=this.depth||this.textOffset?1:0)}},{key:"start",value:function(e){return 0==(e=this.resolveDepth(e))?0:this.path[3*e-1]+1}},{key:"end",value:function(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}},{key:"before",value:function(e){if(!(e=this.resolveDepth(e)))throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[3*e-1]}},{key:"after",value:function(e){if(!(e=this.resolveDepth(e)))throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[3*e-1]+this.path[3*e].nodeSize}},{key:"textOffset",get:function(){return this.pos-this.path[this.path.length-1]}},{key:"nodeAfter",get:function(){var e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;var n=this.pos-this.path[this.path.length-1],r=e.child(t);return n?e.child(t).cut(n):r}},{key:"nodeBefore",get:function(){var e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):0==e?null:this.parent.child(e-1)}},{key:"posAtIndex",value:function(e,t){t=this.resolveDepth(t);for(var n=this.path[3*t],r=0==t?0:this.path[3*t-1]+1,i=0;i<e;i++)r+=n.child(i).nodeSize;return r}},{key:"marks",value:function(){var e=this.parent,t=this.index();if(0==e.content.size)return Pi.none;if(this.textOffset)return e.child(t).marks;var n=e.maybeChild(t-1),r=e.maybeChild(t);if(!n){var i=n;n=r,r=i}for(var o=n.marks,a=0;a<o.length;a++)!1!==o[a].type.spec.inclusive||r&&o[a].isInSet(r.marks)||(o=o[a--].removeFromSet(o));return o}},{key:"marksAcross",value:function(e){var t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;for(var n=t.marks,r=e.parent.maybeChild(e.index()),i=0;i<n.length;i++)!1!==n[i].type.spec.inclusive||r&&n[i].isInSet(r.marks)||(n=n[i--].removeFromSet(n));return n}},{key:"sharedDepth",value:function(e){for(var t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}},{key:"blockRange",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this,t=arguments.length>1?arguments[1]:void 0;if(e.pos<this.pos)return e.blockRange(this);for(var n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new eo(this,e,n);return null}},{key:"sameParent",value:function(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}},{key:"max",value:function(e){return e.pos>this.pos?e:this}},{key:"min",value:function(e){return e.pos<this.pos?e:this}},{key:"toString",value:function(){for(var e="",t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}}],[{key:"resolve",value:function(t,n){if(!(n>=0&&n<=t.content.size))throw new RangeError("Position "+n+" out of range");for(var r=[],i=0,o=n,a=t;;){var s=a.content.findIndex(o),c=s.index,l=s.offset,u=o-l;if(r.push(a,c,i+l),!u)break;if((a=a.child(c)).isText)break;o=u-1,i+=l+1}return new e(n,r,o)}},{key:"resolveCached",value:function(t,n){var r=Qi.get(t);if(r)for(var i=0;i<r.elts.length;i++){var o=r.elts[i];if(o.pos==n)return o}else Qi.set(t,r=new Yi);var a=r.elts[r.i]=e.resolve(t,n);return r.i=(r.i+1)%Zi,a}}])}(),Yi=S(function e(){x(this,e),this.elts=[],this.i=0}),Zi=12,Qi=new WeakMap,eo=function(){return S(function e(t,n,r){x(this,e),this.$from=t,this.$to=n,this.depth=r},[{key:"start",get:function(){return this.$from.before(this.depth+1)}},{key:"end",get:function(){return this.$to.after(this.depth+1)}},{key:"parent",get:function(){return this.$from.node(this.depth)}},{key:"startIndex",get:function(){return this.$from.index(this.depth)}},{key:"endIndex",get:function(){return this.$to.indexAfter(this.depth)}}])}(),to=Object.create(null),no=function(){function e(t,n,r){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Pi.none;x(this,e),this.type=t,this.attrs=n,this.marks=i,this.content=r||Di.empty}return S(e,[{key:"children",get:function(){return this.content.content}},{key:"nodeSize",get:function(){return this.isLeaf?1:2+this.content.size}},{key:"childCount",get:function(){return this.content.childCount}},{key:"child",value:function(e){return this.content.child(e)}},{key:"maybeChild",value:function(e){return this.content.maybeChild(e)}},{key:"forEach",value:function(e){this.content.forEach(e)}},{key:"nodesBetween",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;this.content.nodesBetween(e,t,n,r,this)}},{key:"descendants",value:function(e){this.nodesBetween(0,this.content.size,e)}},{key:"textContent",get:function(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}},{key:"textBetween",value:function(e,t,n,r){return this.content.textBetween(e,t,n,r)}},{key:"firstChild",get:function(){return this.content.firstChild}},{key:"lastChild",get:function(){return this.content.lastChild}},{key:"eq",value:function(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}},{key:"sameMarkup",value:function(e){return this.hasMarkup(e.type,e.attrs,e.marks)}},{key:"hasMarkup",value:function(e,t,n){return this.type==e&&Ri(this.attrs,t||e.defaultAttrs||to)&&Pi.sameSet(this.marks,n||Pi.none)}},{key:"copy",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return t==this.content?this:new e(this.type,this.attrs,t,this.marks)}},{key:"mark",value:function(t){return t==this.marks?this:new e(this.type,this.attrs,this.content,t)}},{key:"cut",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.content.size;return 0==e&&t==this.content.size?this:this.copy(this.content.cut(e,t))}},{key:"slice",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.content.size,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(e==t)return Bi.empty;var r=this.resolve(e),i=this.resolve(t),o=n?0:r.sharedDepth(t),a=r.start(o),s=r.node(o).content.cut(r.pos-a,i.pos-a);return new Bi(s,r.depth-o,i.depth-o)}},{key:"replace",value:function(e,t,n){return ji(this.resolve(e),this.resolve(t),n)}},{key:"nodeAt",value:function(e){for(var t=this;;){var n=t.content.findIndex(e),r=n.index,i=n.offset;if(!(t=t.maybeChild(r)))return null;if(i==e||t.isText)return t;e-=i+1}}},{key:"childAfter",value:function(e){var t=this.content.findIndex(e),n=t.index,r=t.offset;return{node:this.content.maybeChild(n),index:n,offset:r}}},{key:"childBefore",value:function(e){if(0==e)return{node:null,index:0,offset:0};var t=this.content.findIndex(e),n=t.index,r=t.offset;if(r<e)return{node:this.content.child(n),index:n,offset:r};var i=this.content.child(n-1);return{node:i,index:n-1,offset:r-i.nodeSize}}},{key:"resolve",value:function(e){return Xi.resolveCached(this,e)}},{key:"resolveNoCache",value:function(e){return Xi.resolve(this,e)}},{key:"rangeHasMark",value:function(e,t,n){var r=!1;return t>e&&this.nodesBetween(e,t,function(e){return n.isInSet(e.marks)&&(r=!0),!r}),r}},{key:"isBlock",get:function(){return this.type.isBlock}},{key:"isTextblock",get:function(){return this.type.isTextblock}},{key:"inlineContent",get:function(){return this.type.inlineContent}},{key:"isInline",get:function(){return this.type.isInline}},{key:"isText",get:function(){return this.type.isText}},{key:"isLeaf",get:function(){return this.type.isLeaf}},{key:"isAtom",get:function(){return this.type.isAtom}},{key:"toString",value:function(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);var e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),io(this.marks,e)}},{key:"contentMatchAt",value:function(e){var t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}},{key:"canReplace",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Di.empty,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:n.childCount,o=this.contentMatchAt(e).matchFragment(n,r,i),a=o&&o.matchFragment(this.content,t);if(!a||!a.validEnd)return!1;for(var s=r;s<i;s++)if(!this.type.allowsMarks(n.child(s).marks))return!1;return!0}},{key:"canReplaceWith",value:function(e,t,n,r){if(r&&!this.type.allowsMarks(r))return!1;var i=this.contentMatchAt(e).matchType(n),o=i&&i.matchFragment(this.content,t);return!!o&&o.validEnd}},{key:"canAppend",value:function(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}},{key:"check",value:function(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);for(var e=Pi.none,t=0;t<this.marks.length;t++){var n=this.marks[t];n.type.checkAttrs(n.attrs),e=n.addToSet(e)}if(!Pi.sameSet(e,this.marks))throw new RangeError("Invalid collection of marks for node ".concat(this.type.name,": ").concat(this.marks.map(function(e){return e.type.name})));this.content.forEach(function(e){return e.check()})}},{key:"toJSON",value:function(){var e={type:this.type.name};for(var t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(function(e){return e.toJSON()})),e}}],[{key:"fromJSON",value:function(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");var n=void 0;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");n=t.marks.map(e.markFromJSON)}if("text"==t.type){if("string"!=typeof t.text)throw new RangeError("Invalid text node in JSON");return e.text(t.text,n)}var r=Di.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,r,n);return i.type.checkAttrs(i.attrs),i}}])}();no.prototype.text=void 0;var ro=function(t){function n(e,t,i,o){var a;if(x(this,n),a=r(this,n,[e,t,null,o]),!i)throw new RangeError("Empty text nodes are not allowed");return a.text=i,a}return a(n,t),S(n,[{key:"toString",value:function(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):io(this.marks,JSON.stringify(this.text))}},{key:"textContent",get:function(){return this.text}},{key:"textBetween",value:function(e,t){return this.text.slice(e,t)}},{key:"nodeSize",get:function(){return this.text.length}},{key:"mark",value:function(e){return e==this.marks?this:new n(this.type,this.attrs,this.text,e)}},{key:"withText",value:function(e){return e==this.text?this:new n(this.type,this.attrs,e,this.marks)}},{key:"cut",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.text.length;return 0==e&&t==this.text.length?this:this.withText(this.text.slice(e,t))}},{key:"eq",value:function(e){return this.sameMarkup(e)&&this.text==e.text}},{key:"toJSON",value:function(){var t=e(n,"toJSON",this,3)([]);return t.text=this.text,t}}])}(no);function io(e,t){for(var n=e.length-1;n>=0;n--)t=e[n].type.name+"("+t+")";return t}var oo=function(){function e(t){x(this,e),this.validEnd=t,this.next=[],this.wrapCache=[]}return S(e,[{key:"matchType",value:function(e){for(var t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}},{key:"matchFragment",value:function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.childCount,r=this,i=t;r&&i<n;i++)r=r.matchType(e.child(i).type);return r}},{key:"inlineContent",get:function(){return 0!=this.next.length&&this.next[0].type.isInline}},{key:"defaultType",get:function(){for(var e=0;e<this.next.length;e++){var t=this.next[e].type;if(!t.isText&&!t.hasRequiredAttrs())return t}return null}},{key:"compatible",value:function(e){for(var t=0;t<this.next.length;t++)for(var n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}},{key:"fillBefore",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=[this];return function i(o,a){var s=o.matchFragment(e,n);if(s&&(!t||s.validEnd))return Di.from(a.map(function(e){return e.createAndFill()}));for(var c=0;c<o.next.length;c++){var l=o.next[c],u=l.type,d=l.next;if(!u.isText&&!u.hasRequiredAttrs()&&-1==r.indexOf(d)){r.push(d);var h=i(d,a.concat(u));if(h)return h}}return null}(this,[])}},{key:"findWrapping",value:function(e){for(var t=0;t<this.wrapCache.length;t+=2)if(this.wrapCache[t]==e)return this.wrapCache[t+1];var n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}},{key:"computeWrapping",value:function(e){for(var t=Object.create(null),n=[{match:this,type:null,via:null}];n.length;){var r=n.shift(),i=r.match;if(i.matchType(e)){for(var o=[],a=r;a.type;a=a.via)o.push(a.type);return o.reverse()}for(var s=0;s<i.next.length;s++){var c=i.next[s],l=c.type,u=c.next;l.isLeaf||l.hasRequiredAttrs()||l.name in t||r.type&&!u.validEnd||(n.push({match:l.contentMatch,type:l,via:r}),t[l.name]=!0)}}return null}},{key:"edgeCount",get:function(){return this.next.length}},{key:"edge",value:function(e){if(e>=this.next.length)throw new RangeError("There's no ".concat(e,"th edge in this content match"));return this.next[e]}},{key:"toString",value:function(){var e=[];return function t(n){e.push(n);for(var r=0;r<n.next.length;r++)-1==e.indexOf(n.next[r].next)&&t(n.next[r].next)}(this),e.map(function(t,n){for(var r=n+(t.validEnd?"*":" ")+" ",i=0;i<t.next.length;i++)r+=(i?", ":"")+t.next[i].type.name+"->"+e.indexOf(t.next[i].next);return r}).join("\n")}}],[{key:"parse",value:function(t,n){var r=new ao(t,n);if(null==r.next)return e.empty;var i=so(r);r.next&&r.err("Unexpected trailing text");var o=vo(function(e){var t=[[]];return i(o(e,0),n()),t;function n(){return t.push([])-1}function r(e,n,r){var i={term:r,to:n};return t[e].push(i),i}function i(e,t){e.forEach(function(e){return e.to=t})}function o(e,t){if("choice"==e.type)return e.exprs.reduce(function(e,n){return e.concat(o(n,t))},[]);if("seq"!=e.type){if("star"==e.type){var a=n();return r(t,a),i(o(e.expr,a),a),[r(a)]}if("plus"==e.type){var s=n();return i(o(e.expr,t),s),i(o(e.expr,s),s),[r(s)]}if("opt"==e.type)return[r(t)].concat(o(e.expr,t));if("range"==e.type){for(var c=t,l=0;l<e.min;l++){var u=n();i(o(e.expr,c),u),c=u}if(-1==e.max)i(o(e.expr,c),c);else for(var d=e.min;d<e.max;d++){var h=n();r(c,h),i(o(e.expr,c),h),c=h}return[r(c)]}if("name"==e.type)return[r(t,void 0,e.value)];throw new Error("Unknown expr type")}for(var f=0;;f++){var p=o(e.exprs[f],t);if(f==e.exprs.length-1)return p;i(p,t=n())}}}(i));return function(e,t){for(var n=0,r=[e];n<r.length;n++){for(var i=r[n],o=!i.validEnd,a=[],s=0;s<i.next.length;s++){var c=i.next[s],l=c.type,u=c.next;a.push(l.name),!o||l.isText||l.hasRequiredAttrs()||(o=!1),-1==r.indexOf(u)&&r.push(u)}o&&t.err("Only non-generatable nodes ("+a.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}(o,r),o}}])}();oo.empty=new oo(!0);var ao=function(){return S(function e(t,n){x(this,e),this.string=t,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=t.split(/\s*(?=\b|\W|$)/),""==this.tokens[this.tokens.length-1]&&this.tokens.pop(),""==this.tokens[0]&&this.tokens.shift()},[{key:"next",get:function(){return this.tokens[this.pos]}},{key:"eat",value:function(e){return this.next==e&&(this.pos++||!0)}},{key:"err",value:function(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}])}();function so(e){var t=[];do{t.push(co(e))}while(e.eat("|"));return 1==t.length?t[0]:{type:"choice",exprs:t}}function co(e){var t=[];do{t.push(lo(e))}while(e.next&&")"!=e.next&&"|"!=e.next);return 1==t.length?t[0]:{type:"seq",exprs:t}}function lo(e){for(var t=function(e){if(e.eat("(")){var t=so(e);return e.eat(")")||e.err("Missing closing paren"),t}if(!/\W/.test(e.next)){var n=function(e,t){var n=e.nodeTypes,r=n[t];if(r)return[r];var i=[];for(var o in n){var a=n[o];a.isInGroup(t)&&i.push(a)}0==i.length&&e.err("No node type or group '"+t+"' found");return i}(e,e.next).map(function(t){return null==e.inline?e.inline=t.isInline:e.inline!=t.isInline&&e.err("Mixing inline and block content"),{type:"name",value:t}});return e.pos++,1==n.length?n[0]:{type:"choice",exprs:n}}e.err("Unexpected token '"+e.next+"'")}(e);;)if(e.eat("+"))t={type:"plus",expr:t};else if(e.eat("*"))t={type:"star",expr:t};else if(e.eat("?"))t={type:"opt",expr:t};else{if(!e.eat("{"))break;t=ho(e,t)}return t}function uo(e){/\D/.test(e.next)&&e.err("Expected number, got '"+e.next+"'");var t=Number(e.next);return e.pos++,t}function ho(e,t){var n=uo(e),r=n;return e.eat(",")&&(r="}"!=e.next?uo(e):-1),e.eat("}")||e.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:t}}function fo(e,t){return t-e}function po(e,t){var n=[];return function t(r){var i=e[r];if(1==i.length&&!i[0].term)return t(i[0].to);n.push(r);for(var o=0;o<i.length;o++){var a=i[o],s=a.term,c=a.to;s||-1!=n.indexOf(c)||t(c)}}(t),n.sort(fo)}function vo(e){var t=Object.create(null);return function n(r){var i=[];r.forEach(function(t){e[t].forEach(function(t){var n=t.term,r=t.to;if(n){for(var o,a=0;a<i.length;a++)i[a][0]==n&&(o=i[a][1]);po(e,r).forEach(function(e){o||i.push([n,o=[]]),-1==o.indexOf(e)&&o.push(e)})}})});for(var o=t[r.join(",")]=new oo(r.indexOf(e.length-1)>-1),a=0;a<i.length;a++){var s=i[a][1].sort(fo);o.next.push({type:i[a][0],next:t[s.join(",")]||n(s)})}return o}(po(e,0))}function mo(e){var t=Object.create(null);for(var n in e){var r=e[n];if(!r.hasDefault)return null;t[n]=r.default}return t}function go(e,t){var n=Object.create(null);for(var r in e){var i=t&&t[r];if(void 0===i){var o=e[r];if(!o.hasDefault)throw new RangeError("No value supplied for attribute "+r);i=o.default}n[r]=i}return n}function yo(e,t,n,r){for(var i in t)if(!(i in e))throw new RangeError("Unsupported attribute ".concat(i," for ").concat(n," of type ").concat(i));for(var o in e){var a=e[o];a.validate&&a.validate(t[o])}}function ko(e,t){var n=Object.create(null);if(t)for(var r in t)n[r]=new bo(e,r,t[r]);return n}var wo=function(){function e(t,n,r){x(this,e),this.name=t,this.schema=n,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=ko(t,r.attrs),this.defaultAttrs=mo(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||"text"==t),this.isText="text"==t}return S(e,[{key:"isInline",get:function(){return!this.isBlock}},{key:"isTextblock",get:function(){return this.isBlock&&this.inlineContent}},{key:"isLeaf",get:function(){return this.contentMatch==oo.empty}},{key:"isAtom",get:function(){return this.isLeaf||!!this.spec.atom}},{key:"isInGroup",value:function(e){return this.groups.indexOf(e)>-1}},{key:"whitespace",get:function(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}},{key:"hasRequiredAttrs",value:function(){for(var e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}},{key:"compatibleContent",value:function(e){return this==e||this.contentMatch.compatible(e.contentMatch)}},{key:"computeAttrs",value:function(e){return!e&&this.defaultAttrs?this.defaultAttrs:go(this.attrs,e)}},{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0;if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new no(this,this.computeAttrs(e),Di.from(t),Pi.setFrom(n))}},{key:"createChecked",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0;return t=Di.from(t),this.checkContent(t),new no(this,this.computeAttrs(e),t,Pi.setFrom(n))}},{key:"createAndFill",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0;if(e=this.computeAttrs(e),(t=Di.from(t)).size){var r=this.contentMatch.fillBefore(t);if(!r)return null;t=r.append(t)}var i=this.contentMatch.matchFragment(t),o=i&&i.fillBefore(Di.empty,!0);return o?new no(this,e,t.append(o),Pi.setFrom(n)):null}},{key:"validContent",value:function(e){var t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(var n=0;n<e.childCount;n++)if(!this.allowsMarks(e.child(n).marks))return!1;return!0}},{key:"checkContent",value:function(e){if(!this.validContent(e))throw new RangeError("Invalid content for node ".concat(this.name,": ").concat(e.toString().slice(0,50)))}},{key:"checkAttrs",value:function(e){yo(this.attrs,e,"node",this.name)}},{key:"allowsMarkType",value:function(e){return null==this.markSet||this.markSet.indexOf(e)>-1}},{key:"allowsMarks",value:function(e){if(null==this.markSet)return!0;for(var t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}},{key:"allowedMarks",value:function(e){if(null==this.markSet)return e;for(var t,n=0;n<e.length;n++)this.allowsMarkType(e[n].type)?t&&t.push(e[n]):t||(t=e.slice(0,n));return t?t.length?t:Pi.none:e}}],[{key:"compile",value:function(t,n){var r=Object.create(null);t.forEach(function(t,i){return r[t]=new e(t,n,i)});var i=n.spec.topNode||"doc";if(!r[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(var o in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}}])}();var bo=function(){return S(function e(t,n,r){x(this,e),this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate="string"==typeof r.validate?function(e,t,n){var r=n.split("|");return function(n){var i=null===n?"null":N(n);if(r.indexOf(i)<0)throw new RangeError("Expected value of type ".concat(r," for attribute ").concat(t," on type ").concat(e,", got ").concat(i))}}(t,n,r.validate):r.validate},[{key:"isRequired",get:function(){return!this.hasDefault}}])}(),xo=function(){function e(t,n,r,i){x(this,e),this.name=t,this.rank=n,this.schema=r,this.spec=i,this.attrs=ko(t,i.attrs),this.excluded=null;var o=mo(this.attrs);this.instance=o?new Pi(this,o):null}return S(e,[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return!e&&this.instance?this.instance:new Pi(this,go(this.attrs,e))}},{key:"removeFromSet",value:function(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}},{key:"isInSet",value:function(e){for(var t=0;t<e.length;t++)if(e[t].type==this)return e[t]}},{key:"checkAttrs",value:function(e){yo(this.attrs,e,"mark",this.name)}},{key:"excludes",value:function(e){return this.excluded.indexOf(e)>-1}}],[{key:"compile",value:function(t,n){var r=Object.create(null),i=0;return t.forEach(function(t,o){return r[t]=new e(t,i++,n,o)}),r}}])}(),Co=function(){return S(function e(t){var n=this;x(this,e),this.linebreakReplacement=null,this.cached=Object.create(null);var r=this.spec={};for(var i in t)r[i]=t[i];r.nodes=Oi.from(t.nodes),r.marks=Oi.from(t.marks||{}),this.nodes=wo.compile(this.spec.nodes,this),this.marks=xo.compile(this.spec.marks,this);var o=Object.create(null);for(var a in this.nodes){if(a in this.marks)throw new RangeError(a+" can not be both a node and a mark");var s=this.nodes[a],c=s.spec.content||"",l=s.spec.marks;if(s.contentMatch=o[c]||(o[c]=oo.parse(c,this.nodes)),s.inlineContent=s.contentMatch.inlineContent,s.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!s.isInline||!s.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=s}s.markSet="_"==l?null:l?So(this,l.split(" ")):""!=l&&s.inlineContent?null:[]}for(var u in this.marks){var d=this.marks[u],h=d.spec.excludes;d.excluded=null==h?[d]:""==h?[]:So(this,h.split(" "))}this.nodeFromJSON=function(e){return no.fromJSON(n,e)},this.markFromJSON=function(e){return Pi.fromJSON(n,e)},this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)},[{key:"node",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0;if("string"==typeof e)e=this.nodeType(e);else{if(!(e instanceof wo))throw new RangeError("Invalid node type: "+e);if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}return e.createChecked(t,n,r)}},{key:"text",value:function(e,t){var n=this.nodes.text;return new ro(n,n.defaultAttrs,e,Pi.setFrom(t))}},{key:"mark",value:function(e,t){return"string"==typeof e&&(e=this.marks[e]),e.create(t)}},{key:"nodeType",value:function(e){var t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}])}();function So(e,t){for(var n=[],r=0;r<t.length;r++){var i=t[r],o=e.marks[i],a=o;if(o)n.push(o);else for(var s in e.marks){var c=e.marks[s];("_"==i||c.spec.group&&c.spec.group.split(" ").indexOf(i)>-1)&&n.push(a=c)}if(!a)throw new SyntaxError("Unknown mark type: '"+t[r]+"'")}return n}var _o=function(){function e(t,n){var r=this;x(this,e),this.schema=t,this.rules=n,this.tags=[],this.styles=[];var i=this.matchedStyles=[];n.forEach(function(e){if(function(e){return null!=e.tag}(e))r.tags.push(e);else if(function(e){return null!=e.style}(e)){var t=/[^=]*/.exec(e.style)[0];i.indexOf(t)<0&&i.push(t),r.styles.push(e)}}),this.normalizeLists=!this.tags.some(function(e){if(!/^(ul|ol)\b/.test(e.tag)||!e.node)return!1;var n=t.nodes[e.node];return n.contentMatch.matchType(n)})}return S(e,[{key:"parse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=new Ao(this,t,!1);return n.addAll(e,Pi.none,t.from,t.to),n.finish()}},{key:"parseSlice",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=new Ao(this,t,!0);return n.addAll(e,Pi.none,t.from,t.to),Bi.maxOpen(n.finish())}},{key:"matchTag",value:function(e,t,n){for(var r=n?this.tags.indexOf(n)+1:0;r<this.tags.length;r++){var i=this.tags[r];if(Do(e,i.tag)&&(void 0===i.namespace||e.namespaceURI==i.namespace)&&(!i.context||t.matchesContext(i.context))){if(i.getAttrs){var o=i.getAttrs(e);if(!1===o)continue;i.attrs=o||void 0}return i}}}},{key:"matchStyle",value:function(e,t,n,r){for(var i=r?this.styles.indexOf(r)+1:0;i<this.styles.length;i++){var o=this.styles[i],a=o.style;if(!(0!=a.indexOf(e)||o.context&&!n.matchesContext(o.context)||a.length>e.length&&(61!=a.charCodeAt(e.length)||a.slice(e.length+1)!=t))){if(o.getAttrs){var s=o.getAttrs(t);if(!1===s)continue;o.attrs=s||void 0}return o}}}}],[{key:"schemaRules",value:function(e){var t=[];function n(e){for(var n=null==e.priority?50:e.priority,r=0;r<t.length;r++){var i=t[r];if((null==i.priority?50:i.priority)<n)break}t.splice(r,0,e)}var r=function(t){var r=e.marks[t].spec.parseDOM;r&&r.forEach(function(e){n(e=Io(e)),e.mark||e.ignore||e.clearMark||(e.mark=t)})};for(var i in e.marks)r(i);var o=function(t){var r=e.nodes[t].spec.parseDOM;r&&r.forEach(function(e){n(e=Io(e)),e.node||e.ignore||e.mark||(e.node=t)})};for(var a in e.nodes)o(a);return t}},{key:"fromSchema",value:function(t){return t.cached.domParser||(t.cached.domParser=new e(t,e.schemaRules(t)))}}])}(),Mo={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},No={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},To={ol:!0,ul:!0};function Oo(e,t,n){return null!=t?(t?1:0)|("full"===t?2:0):e&&"pre"==e.whitespace?3:-5&n}var Eo=function(){return S(function e(t,n,r,i,o,a){x(this,e),this.type=t,this.attrs=n,this.marks=r,this.solid=i,this.options=a,this.content=[],this.activeMarks=Pi.none,this.match=o||(4&a?null:t.contentMatch)},[{key:"findWrapping",value:function(e){if(!this.match){if(!this.type)return[];var t=this.type.contentMatch.fillBefore(Di.from(e));if(!t){var n,r=this.type.contentMatch;return(n=r.findWrapping(e.type))?(this.match=r,n):null}this.match=this.type.contentMatch.matchFragment(t)}return this.match.findWrapping(e.type)}},{key:"finish",value:function(e){if(!(1&this.options)){var t,n=this.content[this.content.length-1];if(n&&n.isText&&(t=/[ \t\r\n\u000c]+$/.exec(n.text))){var r=n;n.text.length==t[0].length?this.content.pop():this.content[this.content.length-1]=r.withText(r.text.slice(0,r.text.length-t[0].length))}}var i=Di.from(this.content);return!e&&this.match&&(i=i.append(this.match.fillBefore(Di.empty,!0))),this.type?this.type.create(this.attrs,i,this.marks):i}},{key:"inlineContext",value:function(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!Mo.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}])}(),Ao=function(){return S(function e(t,n,r){x(this,e),this.parser=t,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;var i,o=n.topNode,a=Oo(null,n.preserveWhitespace,0)|(r?4:0);i=o?new Eo(o.type,o.attrs,Pi.none,!0,n.topMatch||o.type.contentMatch,a):new Eo(r?null:t.schema.topNodeType,null,Pi.none,!0,null,a),this.nodes=[i],this.find=n.findPositions,this.needsBlock=!1},[{key:"top",get:function(){return this.nodes[this.open]}},{key:"addDOM",value:function(e,t){3==e.nodeType?this.addTextNode(e,t):1==e.nodeType&&this.addElement(e,t)}},{key:"addTextNode",value:function(e,t){var n=e.nodeValue,r=this.top,i=2&r.options?"full":this.localPreserveWS||(1&r.options)>0,o=this.parser.schema;if("full"===i||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(n)){if(i)if("full"===i)n=n.replace(/\r\n?/g,"\n");else if(o.linebreakReplacement&&/[\r\n]/.test(n)&&this.top.findWrapping(o.linebreakReplacement.create())){for(var a=n.split(/\r?\n|\r/),s=0;s<a.length;s++)s&&this.insertNode(o.linebreakReplacement.create(),t,!0),a[s]&&this.insertNode(o.text(a[s]),t,!/\S/.test(a[s]));n=""}else n=n.replace(/\r?\n|\r/g," ");else if(n=n.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(n)&&this.open==this.nodes.length-1){var c=r.content[r.content.length-1],l=e.previousSibling;(!c||l&&"BR"==l.nodeName||c.isText&&/[ \t\r\n\u000c]$/.test(c.text))&&(n=n.slice(1))}n&&this.insertNode(o.text(n),t,!/\S/.test(n)),this.findInText(e)}else this.findInside(e)}},{key:"addElement",value:function(e,t,n){var r=this.localPreserveWS,i=this.top;("PRE"==e.tagName||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);var o,a=e.nodeName.toLowerCase();To.hasOwnProperty(a)&&this.parser.normalizeLists&&function(e){for(var t=e.firstChild,n=null;t;t=t.nextSibling){var r=1==t.nodeType?t.nodeName.toLowerCase():null;r&&To.hasOwnProperty(r)&&n?(n.appendChild(t),t=n):"li"==r?n=t:r&&(n=null)}}(e);var s=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(o=this.parser.matchTag(e,this,n));e:if(s?s.ignore:No.hasOwnProperty(a))this.findInside(e),this.ignoreFallback(e,t);else if(!s||s.skip||s.closeParent){s&&s.closeParent?this.open=Math.max(0,this.open-1):s&&s.skip.nodeType&&(e=s.skip);var c,l=this.needsBlock;if(Mo.hasOwnProperty(a))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),c=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}var u=s&&s.skip?t:this.readStyles(e,t);u&&this.addAll(e,u),c&&this.sync(i),this.needsBlock=l}else{var d=this.readStyles(e,t);d&&this.addElementByRule(e,s,d,!1===s.consuming?o:void 0)}this.localPreserveWS=r}},{key:"leafFallback",value:function(e,t){"BR"==e.nodeName&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode("\n"),t)}},{key:"ignoreFallback",value:function(e,t){"BR"!=e.nodeName||this.top.type&&this.top.type.inlineContent||this.findPlace(this.parser.schema.text("-"),t,!0)}},{key:"readStyles",value:function(e,t){var n=this,r=e.style;if(r&&r.length)for(var i=0;i<this.parser.matchedStyles.length;i++){var o=this.parser.matchedStyles[i],a=r.getPropertyValue(o);if(a)for(var s,c=function(e){var r=n.parser.matchStyle(o,a,n,e);return r?r.ignore?{v:null}:(t=r.clearMark?t.filter(function(e){return!r.clearMark(e)}):t.concat(n.parser.schema.marks[r.mark].create(r.attrs)),!1!==r.consuming?(l=e,0):void(l=e=r)):(l=e,0)},l=void 0;0!==(s=c(l));)if(s)return s.v}return t}},{key:"addElementByRule",value:function(e,t,n,r){var i,o,a=this;if(t.node)if((o=this.parser.schema.nodes[t.node]).isLeaf)this.insertNode(o.create(t.attrs),n,"BR"==e.nodeName)||this.leafFallback(e,n);else{var s=this.enter(o,t.attrs||null,n,t.preserveWhitespace);s&&(i=!0,n=s)}else{var c=this.parser.schema.marks[t.mark];n=n.concat(c.create(t.attrs))}var l=this.top;if(o&&o.isLeaf)this.findInside(e);else if(r)this.addElement(e,n,r);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(function(e){return a.insertNode(e,n,!1)});else{var u=e;"string"==typeof t.contentElement?u=e.querySelector(t.contentElement):"function"==typeof t.contentElement?u=t.contentElement(e):t.contentElement&&(u=t.contentElement),this.findAround(e,u,!0),this.addAll(u,n),this.findAround(e,u,!1)}i&&this.sync(l)&&this.open--}},{key:"addAll",value:function(e,t,n,r){for(var i=n||0,o=n?e.childNodes[n]:e.firstChild,a=null==r?null:e.childNodes[r];o!=a;o=o.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(o,t);this.findAtPoint(e,i)}},{key:"findPlace",value:function(e,t,n){for(var r,i,o=this.open,a=0;o>=0;o--){var s=this.nodes[o],c=s.findWrapping(e);if(c&&(!r||r.length>c.length+a)&&(r=c,i=s,!c.length))break;if(s.solid){if(n)break;a+=2}}if(!r)return null;this.sync(i);for(var l=0;l<r.length;l++)t=this.enterInner(r[l],null,t,!1);return t}},{key:"insertNode",value:function(e,t,n){if(e.isInline&&this.needsBlock&&!this.top.type){var r=this.textblockFromContext();r&&(t=this.enterInner(r,null,t))}var i=this.findPlace(e,t,n);if(i){this.closeExtra();var o=this.top;o.match&&(o.match=o.match.matchType(e.type));var a,s=Pi.none,c=u(i.concat(e.marks));try{for(c.s();!(a=c.n()).done;){var l=a.value;(o.type?o.type.allowsMarkType(l.type):zo(l.type,e.type))&&(s=l.addToSet(s))}}catch(d){c.e(d)}finally{c.f()}return o.content.push(e.mark(s)),!0}return!1}},{key:"enter",value:function(e,t,n,r){var i=this.findPlace(e.create(t),n,!1);return i&&(i=this.enterInner(e,t,n,!0,r)),i}},{key:"enterInner",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],i=arguments.length>4?arguments[4]:void 0;this.closeExtra();var o=this.top;o.match=o.match&&o.match.matchType(e);var a=Oo(e,i,o.options);4&o.options&&0==o.content.length&&(a|=4);var s=Pi.none;return n=n.filter(function(t){return!(o.type?o.type.allowsMarkType(t.type):zo(t.type,e))||(s=t.addToSet(s),!1)}),this.nodes.push(new Eo(e,t,s,r,null,a)),this.open++,n}},{key:"closeExtra",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}},{key:"finish",value:function(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!(!this.isOpen&&!this.options.topOpen))}},{key:"sync",value:function(e){for(var t=this.open;t>=0;t--){if(this.nodes[t]==e)return this.open=t,!0;this.localPreserveWS&&(this.nodes[t].options|=1)}return!1}},{key:"currentPos",get:function(){this.closeExtra();for(var e=0,t=this.open;t>=0;t--){for(var n=this.nodes[t].content,r=n.length-1;r>=0;r--)e+=n[r].nodeSize;t&&e++}return e}},{key:"findAtPoint",value:function(e,t){if(this.find)for(var n=0;n<this.find.length;n++)this.find[n].node==e&&this.find[n].offset==t&&(this.find[n].pos=this.currentPos)}},{key:"findInside",value:function(e){if(this.find)for(var t=0;t<this.find.length;t++)null==this.find[t].pos&&1==e.nodeType&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}},{key:"findAround",value:function(e,t,n){if(e!=t&&this.find)for(var r=0;r<this.find.length;r++){if(null==this.find[r].pos&&1==e.nodeType&&e.contains(this.find[r].node))t.compareDocumentPosition(this.find[r].node)&(n?2:4)&&(this.find[r].pos=this.currentPos)}}},{key:"findInText",value:function(e){if(this.find)for(var t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}},{key:"matchesContext",value:function(e){var t=this;if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);var n=e.split("/"),r=this.options.context,i=!(this.isOpen||r&&r.parent.type!=this.nodes[0].type),o=-(r?r.depth+1:0)+(i?0:1),a=function(e,s){for(;e>=0;e--){var c=n[e];if(""==c){if(e==n.length-1||0==e)continue;for(;s>=o;s--)if(a(e-1,s))return!0;return!1}var l=s>0||0==s&&i?t.nodes[s].type:r&&s>=o?r.node(s-o).type:null;if(!l||l.name!=c&&!l.isInGroup(c))return!1;s--}return!0};return a(n.length-1,this.open)}},{key:"textblockFromContext",value:function(){var e=this.options.context;if(e)for(var t=e.depth;t>=0;t--){var n=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(var r in this.parser.schema.nodes){var i=this.parser.schema.nodes[r];if(i.isTextblock&&i.defaultAttrs)return i}}}])}();function Do(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function Io(e){var t={};for(var n in e)t[n]=e[n];return t}function zo(e,t){var n,r=t.schema.nodes,i=function(){var n=r[o];if(!n.allowsMarkType(e))return 0;var i=[],a=function(e){i.push(e);for(var n=0;n<e.edgeCount;n++){var r=e.edge(n),o=r.type,s=r.next;if(o==t)return!0;if(i.indexOf(s)<0&&a(s))return!0}};return a(n.contentMatch)?{v:!0}:void 0};for(var o in r)if(0!==(n=i())&&n)return n.v}var Ro=function(){function e(t,n){x(this,e),this.nodes=t,this.marks=n}return S(e,[{key:"serializeFragment",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0;r||(r=Lo(n).createDocumentFragment());var i=r,o=[];return e.forEach(function(e){if(o.length||e.marks.length){for(var r=0,a=0;r<o.length&&a<e.marks.length;){var s=e.marks[a];if(t.marks[s.type.name]){if(!s.eq(o[r][0])||!1===s.type.spec.spanning)break;r++,a++}else a++}for(;r<o.length;)i=o.pop()[1];for(;a<e.marks.length;){var c=e.marks[a++],l=t.serializeMark(c,e.isInline,n);l&&(o.push([c,i]),i.appendChild(l.dom),i=l.contentDOM||l.dom)}}i.appendChild(t.serializeNodeInner(e,n))}),r}},{key:"serializeNodeInner",value:function(e,t){var n=Fo(Lo(t),this.nodes[e.type.name](e),null,e.attrs),r=n.dom,i=n.contentDOM;if(i){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,i)}return r}},{key:"serializeNode",value:function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=this.serializeNodeInner(e,t),r=e.marks.length-1;r>=0;r--){var i=this.serializeMark(e.marks[r],e.isInline,t);i&&((i.contentDOM||i.dom).appendChild(n),n=i.dom)}return n}},{key:"serializeMark",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=this.marks[e.type.name];return r&&Fo(Lo(n),r(e,t),null,e.attrs)}}],[{key:"renderSpec",value:function(e,t){return Fo(e,t,arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,arguments.length>3?arguments[3]:void 0)}},{key:"fromSchema",value:function(t){return t.cached.domSerializer||(t.cached.domSerializer=new e(this.nodesFromSchema(t),this.marksFromSchema(t)))}},{key:"nodesFromSchema",value:function(e){var t=Po(e.nodes);return t.text||(t.text=function(e){return e.text}),t}},{key:"marksFromSchema",value:function(e){return Po(e.marks)}}])}();function Po(e){var t={};for(var n in e){var r=e[n].spec.toDOM;r&&(t[n]=r)}return t}function Lo(e){return e.document||window.document}var Bo=new WeakMap;function Vo(e){var t=Bo.get(e);return void 0===t&&Bo.set(e,t=function(e){var t=null;function n(e){if(e&&"object"==N(e))if(Array.isArray(e))if("string"==typeof e[0])t||(t=[]),t.push(e);else for(var r=0;r<e.length;r++)n(e[r]);else for(var i in e)n(e[i])}return n(e),t}(e)),t}function Fo(e,t,n,r){if("string"==typeof t)return{dom:e.createTextNode(t)};if(null!=t.nodeType)return{dom:t};if(t.dom&&null!=t.dom.nodeType)return t;var i,o=t[0];if("string"!=typeof o)throw new RangeError("Invalid array passed to renderSpec");if(r&&(i=Vo(r))&&i.indexOf(t)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");var a,s=o.indexOf(" ");s>0&&(n=o.slice(0,s),o=o.slice(s+1));var c=n?e.createElementNS(n,o):e.createElement(o),l=t[1],u=1;if(l&&"object"==N(l)&&null==l.nodeType&&!Array.isArray(l))for(var d in u=2,l)if(null!=l[d]){var h=d.indexOf(" ");h>0?c.setAttributeNS(d.slice(0,h),d.slice(h+1),l[d]):"style"==d&&c.style?c.style.cssText=l[d]:c.setAttribute(d,l[d])}for(var f=u;f<t.length;f++){var p=t[f];if(0===p){if(f<t.length-1||f>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:c,contentDOM:c}}var v=Fo(e,p,n,r),m=v.dom,g=v.contentDOM;if(c.appendChild(m),g){if(a)throw new RangeError("Multiple content holes");a=g}}return{dom:c,contentDOM:a}}var jo=Math.pow(2,16);function $o(e,t){return e+t*jo}function Ho(e){return 65535&e}var Wo=function(){return S(function e(t,n,r){x(this,e),this.pos=t,this.delInfo=n,this.recover=r},[{key:"deleted",get:function(){return(8&this.delInfo)>0}},{key:"deletedBefore",get:function(){return(5&this.delInfo)>0}},{key:"deletedAfter",get:function(){return(6&this.delInfo)>0}},{key:"deletedAcross",get:function(){return(4&this.delInfo)>0}}])}(),qo=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(x(this,e),this.ranges=t,this.inverted=n,!t.length&&e.empty)return e.empty}return S(e,[{key:"recover",value:function(e){var t=0,n=Ho(e);if(!this.inverted)for(var r=0;r<n;r++)t+=this.ranges[3*r+2]-this.ranges[3*r+1];return this.ranges[3*n]+t+function(e){return(e-(65535&e))/jo}(e)}},{key:"mapResult",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return this._map(e,t,!1)}},{key:"map",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return this._map(e,t,!0)}},{key:"_map",value:function(e,t,n){for(var r=0,i=this.inverted?2:1,o=this.inverted?1:2,a=0;a<this.ranges.length;a+=3){var s=this.ranges[a]-(this.inverted?r:0);if(s>e)break;var c=this.ranges[a+i],l=this.ranges[a+o],u=s+c;if(e<=u){var d=s+r+((c?e==s?-1:e==u?1:t:t)<0?0:l);if(n)return d;var h=e==(t<0?s:u)?null:$o(a/3,e-s),f=e==s?2:e==u?1:4;return(t<0?e!=s:e!=u)&&(f|=8),new Wo(d,f,h)}r+=l-c}return n?e+r:new Wo(e+r,0,null)}},{key:"touches",value:function(e,t){for(var n=0,r=Ho(t),i=this.inverted?2:1,o=this.inverted?1:2,a=0;a<this.ranges.length;a+=3){var s=this.ranges[a]-(this.inverted?n:0);if(s>e)break;var c=this.ranges[a+i];if(e<=s+c&&a==3*r)return!0;n+=this.ranges[a+o]-c}return!1}},{key:"forEach",value:function(e){for(var t=this.inverted?2:1,n=this.inverted?1:2,r=0,i=0;r<this.ranges.length;r+=3){var o=this.ranges[r],a=o-(this.inverted?i:0),s=o+(this.inverted?0:i),c=this.ranges[r+t],l=this.ranges[r+n];e(a,a+c,s,s+l),i+=l-c}}},{key:"invert",value:function(){return new e(this.ranges,!this.inverted)}},{key:"toString",value:function(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}}],[{key:"offset",value:function(t){return 0==t?e.empty:new e(t<0?[0,-t,0]:[0,0,t])}}])}();qo.empty=new qo([]);var Uo=function(){function e(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:t?t.length:0;x(this,e),this.mirror=n,this.from=r,this.to=i,this._maps=t||[],this.ownData=!(t||n)}return S(e,[{key:"maps",get:function(){return this._maps}},{key:"slice",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.maps.length;return new e(this._maps,this.mirror,t,n)}},{key:"appendMap",value:function(e,t){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),null!=t&&this.setMirror(this._maps.length-1,t)}},{key:"appendMapping",value:function(e){for(var t=0,n=this._maps.length;t<e._maps.length;t++){var r=e.getMirror(t);this.appendMap(e._maps[t],null!=r&&r<t?n+r:void 0)}}},{key:"getMirror",value:function(e){if(this.mirror)for(var t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}},{key:"setMirror",value:function(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}},{key:"appendMappingInverted",value:function(e){for(var t=e.maps.length-1,n=this._maps.length+e._maps.length;t>=0;t--){var r=e.getMirror(t);this.appendMap(e._maps[t].invert(),null!=r&&r>t?n-r-1:void 0)}}},{key:"invert",value:function(){var t=new e;return t.appendMappingInverted(this),t}},{key:"map",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;if(this.mirror)return this._map(e,t,!0);for(var n=this.from;n<this.to;n++)e=this._maps[n].map(e,t);return e}},{key:"mapResult",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return this._map(e,t,!1)}},{key:"_map",value:function(e,t,n){for(var r=0,i=this.from;i<this.to;i++){var o=this._maps[i].mapResult(e,t);if(null!=o.recover){var a=this.getMirror(i);if(null!=a&&a>i&&a<this.to){i=a,e=this._maps[a].recover(o.recover);continue}}r|=o.delInfo,e=o.pos}return n?e:new Wo(e,r,null)}}])}(),Ko=Object.create(null),Jo=function(){return S(function e(){x(this,e)},[{key:"getMap",value:function(){return qo.empty}},{key:"merge",value:function(e){return null}}],[{key:"fromJSON",value:function(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");var n=Ko[t.stepType];if(!n)throw new RangeError("No step type ".concat(t.stepType," defined"));return n.fromJSON(e,t)}},{key:"jsonID",value:function(e,t){if(e in Ko)throw new RangeError("Duplicate use of step JSON ID "+e);return Ko[e]=t,t.prototype.jsonID=e,t}}])}(),Go=function(){function e(t,n){x(this,e),this.doc=t,this.failed=n}return S(e,null,[{key:"ok",value:function(t){return new e(t,null)}},{key:"fail",value:function(t){return new e(null,t)}},{key:"fromReplace",value:function(t,n,r,i){try{return e.ok(t.replace(n,r,i))}catch(wt){if(wt instanceof Li)return e.fail(wt.message);throw wt}}}])}();function Xo(e,t,n){for(var r=[],i=0;i<e.childCount;i++){var o=e.child(i);o.content.size&&(o=o.copy(Xo(o.content,t,o))),o.isInline&&(o=t(o,n,i)),r.push(o)}return Di.fromArray(r)}var Yo=function(e){function t(e,n,i){var o;return x(this,t),(o=r(this,t)).from=e,o.to=n,o.mark=i,o}return a(t,e),S(t,[{key:"apply",value:function(e){var t=this,n=e.slice(this.from,this.to),r=e.resolve(this.from),i=r.node(r.sharedDepth(this.to)),o=new Bi(Xo(n.content,function(e,n){return e.isAtom&&n.type.allowsMarkType(t.mark.type)?e.mark(t.mark.addToSet(e.marks)):e},i),n.openStart,n.openEnd);return Go.fromReplace(e,this.from,this.to,o)}},{key:"invert",value:function(){return new Zo(this.from,this.to,this.mark)}},{key:"map",value:function(e){var n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new t(n.pos,r.pos,this.mark)}},{key:"merge",value:function(e){return e instanceof t&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new t(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}},{key:"toJSON",value:function(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}}],[{key:"fromJSON",value:function(e,n){if("number"!=typeof n.from||"number"!=typeof n.to)throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new t(n.from,n.to,e.markFromJSON(n.mark))}}])}(Jo);Jo.jsonID("addMark",Yo);var Zo=function(e){function t(e,n,i){var o;return x(this,t),(o=r(this,t)).from=e,o.to=n,o.mark=i,o}return a(t,e),S(t,[{key:"apply",value:function(e){var t=this,n=e.slice(this.from,this.to),r=new Bi(Xo(n.content,function(e){return e.mark(t.mark.removeFromSet(e.marks))},e),n.openStart,n.openEnd);return Go.fromReplace(e,this.from,this.to,r)}},{key:"invert",value:function(){return new Yo(this.from,this.to,this.mark)}},{key:"map",value:function(e){var n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new t(n.pos,r.pos,this.mark)}},{key:"merge",value:function(e){return e instanceof t&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new t(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}},{key:"toJSON",value:function(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}}],[{key:"fromJSON",value:function(e,n){if("number"!=typeof n.from||"number"!=typeof n.to)throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new t(n.from,n.to,e.markFromJSON(n.mark))}}])}(Jo);Jo.jsonID("removeMark",Zo);var Qo=function(e){function t(e,n){var i;return x(this,t),(i=r(this,t)).pos=e,i.mark=n,i}return a(t,e),S(t,[{key:"apply",value:function(e){var t=e.nodeAt(this.pos);if(!t)return Go.fail("No node at mark step's position");var n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return Go.fromReplace(e,this.pos,this.pos+1,new Bi(Di.from(n),0,t.isLeaf?0:1))}},{key:"invert",value:function(e){var n=e.nodeAt(this.pos);if(n){var r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(var i=0;i<n.marks.length;i++)if(!n.marks[i].isInSet(r))return new t(this.pos,n.marks[i]);return new t(this.pos,this.mark)}}return new ea(this.pos,this.mark)}},{key:"map",value:function(e){var n=e.mapResult(this.pos,1);return n.deletedAfter?null:new t(n.pos,this.mark)}},{key:"toJSON",value:function(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}}],[{key:"fromJSON",value:function(e,n){if("number"!=typeof n.pos)throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new t(n.pos,e.markFromJSON(n.mark))}}])}(Jo);Jo.jsonID("addNodeMark",Qo);var ea=function(e){function t(e,n){var i;return x(this,t),(i=r(this,t)).pos=e,i.mark=n,i}return a(t,e),S(t,[{key:"apply",value:function(e){var t=e.nodeAt(this.pos);if(!t)return Go.fail("No node at mark step's position");var n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return Go.fromReplace(e,this.pos,this.pos+1,new Bi(Di.from(n),0,t.isLeaf?0:1))}},{key:"invert",value:function(e){var t=e.nodeAt(this.pos);return t&&this.mark.isInSet(t.marks)?new Qo(this.pos,this.mark):this}},{key:"map",value:function(e){var n=e.mapResult(this.pos,1);return n.deletedAfter?null:new t(n.pos,this.mark)}},{key:"toJSON",value:function(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}}],[{key:"fromJSON",value:function(e,n){if("number"!=typeof n.pos)throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new t(n.pos,e.markFromJSON(n.mark))}}])}(Jo);Jo.jsonID("removeNodeMark",ea);var ta=function(e){function t(e,n,i){var o,a=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return x(this,t),(o=r(this,t)).from=e,o.to=n,o.slice=i,o.structure=a,o}return a(t,e),S(t,[{key:"apply",value:function(e){return this.structure&&ra(e,this.from,this.to)?Go.fail("Structure replace would overwrite content"):Go.fromReplace(e,this.from,this.to,this.slice)}},{key:"getMap",value:function(){return new qo([this.from,this.to-this.from,this.slice.size])}},{key:"invert",value:function(e){return new t(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}},{key:"map",value:function(e){var n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deletedAcross&&r.deletedAcross?null:new t(n.pos,Math.max(n.pos,r.pos),this.slice,this.structure)}},{key:"merge",value:function(e){if(!(e instanceof t)||e.structure||this.structure)return null;if(this.from+this.slice.size!=e.from||this.slice.openEnd||e.slice.openStart){if(e.to!=this.from||this.slice.openStart||e.slice.openEnd)return null;var n=this.slice.size+e.slice.size==0?Bi.empty:new Bi(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new t(e.from,this.to,n,this.structure)}var r=this.slice.size+e.slice.size==0?Bi.empty:new Bi(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new t(this.from,this.to+(e.to-e.from),r,this.structure)}},{key:"toJSON",value:function(){var e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}}],[{key:"fromJSON",value:function(e,n){if("number"!=typeof n.from||"number"!=typeof n.to)throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new t(n.from,n.to,Bi.fromJSON(e,n.slice),!!n.structure)}}])}(Jo);Jo.jsonID("replace",ta);var na=function(e){function t(e,n,i,o,a,s){var c,l=arguments.length>6&&void 0!==arguments[6]&&arguments[6];return x(this,t),(c=r(this,t)).from=e,c.to=n,c.gapFrom=i,c.gapTo=o,c.slice=a,c.insert=s,c.structure=l,c}return a(t,e),S(t,[{key:"apply",value:function(e){if(this.structure&&(ra(e,this.from,this.gapFrom)||ra(e,this.gapTo,this.to)))return Go.fail("Structure gap-replace would overwrite content");var t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return Go.fail("Gap is not a flat range");var n=this.slice.insertAt(this.insert,t.content);return n?Go.fromReplace(e,this.from,this.to,n):Go.fail("Content does not fit in gap")}},{key:"getMap",value:function(){return new qo([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}},{key:"invert",value:function(e){var n=this.gapTo-this.gapFrom;return new t(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}},{key:"map",value:function(e){var n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),i=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),o=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||o>r.pos?null:new t(n.pos,r.pos,i,o,this.slice,this.insert,this.structure)}},{key:"toJSON",value:function(){var e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}}],[{key:"fromJSON",value:function(e,n){if("number"!=typeof n.from||"number"!=typeof n.to||"number"!=typeof n.gapFrom||"number"!=typeof n.gapTo||"number"!=typeof n.insert)throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new t(n.from,n.to,n.gapFrom,n.gapTo,Bi.fromJSON(e,n.slice),n.insert,!!n.structure)}}])}(Jo);function ra(e,t,n){for(var r=e.resolve(t),i=n-t,o=r.depth;i>0&&o>0&&r.indexAfter(o)==r.node(o).childCount;)o--,i--;if(i>0)for(var a=r.node(o).maybeChild(r.indexAfter(o));i>0;){if(!a||a.isLeaf)return!0;a=a.firstChild,i--}return!1}function ia(e,t,n){for(var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:n.contentMatch,i=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],o=e.doc.nodeAt(t),a=[],s=t+1,c=0;c<o.childCount;c++){var l=o.child(c),u=s+l.nodeSize,d=r.matchType(l.type);if(d){r=d;for(var h=0;h<l.marks.length;h++)n.allowsMarkType(l.marks[h].type)||e.step(new Zo(s,u,l.marks[h]));if(i&&l.isText&&"pre"!=n.whitespace)for(var f=void 0,p=/\r?\n|\r/g,v=void 0;f=p.exec(l.text);)v||(v=new Bi(Di.from(n.schema.text(" ",n.allowedMarks(l.marks))),0,0)),a.push(new ta(s+f.index,s+f.index+f[0].length,v))}else a.push(new ta(s,u,Bi.empty));s=u}if(!r.validEnd){var m=r.fillBefore(Di.empty,!0);e.replace(s,s,new Bi(m,0,0))}for(var g=a.length-1;g>=0;g--)e.step(a[g])}function oa(e,t,n){return(0==t||e.canReplace(t,e.childCount))&&(n==e.childCount||e.canReplace(0,n))}function aa(e){for(var t=e.parent.content.cutByIndex(e.startIndex,e.endIndex),n=e.depth,r=0,i=0;;--n){var o=e.$from.node(n),a=e.$from.index(n)+r,s=e.$to.indexAfter(n)-i;if(n<e.depth&&o.canReplace(a,s,t))return n;if(0==n||o.type.spec.isolating||!oa(o,a,s))break;a&&(r=1),s<o.childCount&&(i=1)}return null}function sa(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:e,i=function(e,t){var n=e.parent,r=e.startIndex,i=e.endIndex,o=n.contentMatchAt(r).findWrapping(t);if(!o)return null;var a=o.length?o[0]:t;return n.canReplaceWith(r,i,a)?o:null}(e,t),o=i&&function(e,t){var n=e.parent,r=e.startIndex,i=e.endIndex,o=n.child(r),a=t.contentMatch.findWrapping(o.type);if(!a)return null;for(var s=(a.length?a[a.length-1]:t).contentMatch,c=r;s&&c<i;c++)s=s.matchType(n.child(c).type);return s&&s.validEnd?a:null}(r,t);return o?i.map(ca).concat({type:t,attrs:n}).concat(o.map(ca)):null}function ca(e){return{type:e,attrs:null}}function la(e,t,n,r){t.forEach(function(i,o){if(i.isText)for(var a,s=/\r?\n|\r/g;a=s.exec(i.text);){var c=e.mapping.slice(r).map(n+1+o+a.index);e.replaceWith(c,c+1,t.type.schema.linebreakReplacement.create())}})}function ua(e,t,n,r){t.forEach(function(i,o){if(i.type==i.type.schema.linebreakReplacement){var a=e.mapping.slice(r).map(n+1+o);e.replaceWith(a,a+1,t.type.schema.text("\n"))}})}function da(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=arguments.length>3?arguments[3]:void 0,i=e.resolve(t),o=i.depth-n,a=r&&r[r.length-1]||i.parent;if(o<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!a.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(var s=i.depth-1,c=n-2;s>o;s--,c--){var l=i.node(s),u=i.index(s);if(l.type.spec.isolating)return!1;var d=l.content.cutByIndex(u,l.childCount),h=r&&r[c+1];h&&(d=d.replaceChild(0,h.type.create(h.attrs)));var f=r&&r[c]||l;if(!l.canReplace(u+1,l.childCount)||!f.type.validContent(d))return!1}var p=i.indexAfter(o),v=r&&r[0];return i.node(o).canReplaceWith(p,p,v?v.type:i.node(o+1).type)}function ha(e,t){var n=e.resolve(t),r=n.index();return fa(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function fa(e,t){return!(!e||!t||e.isLeaf||!function(e,t){t.content.size||e.type.compatibleContent(t.type);for(var n=e.contentMatchAt(e.childCount),r=e.type.schema.linebreakReplacement,i=0;i<t.childCount;i++){var o=t.child(i),a=o.type==r?e.type.schema.nodes.text:o.type;if(!(n=n.matchType(a)))return!1;if(!e.type.allowsMarks(o.marks))return!1}return n.validEnd}(e,t))}function pa(e,t){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1,r=e.resolve(t),i=r.depth;;i--){var o=void 0,a=void 0,s=r.index(i);if(i==r.depth?(o=r.nodeBefore,a=r.nodeAfter):n>0?(o=r.node(i+1),s++,a=r.node(i).maybeChild(s)):(o=r.node(i).maybeChild(s-1),a=r.node(i+1)),o&&!o.isTextblock&&fa(o,a)&&r.node(i).canReplace(s,s+1))return t;if(0==i)break;t=n<0?r.before(i):r.after(i)}}function va(e,t,n){var r=e.resolve(t);if(!n.content.size)return t;for(var i=n.content,o=0;o<n.openStart;o++)i=i.firstChild.content;for(var a=1;a<=(0==n.openStart&&n.size?2:1);a++)for(var s=r.depth;s>=0;s--){var c=s==r.depth?0:r.pos<=(r.start(s+1)+r.end(s+1))/2?-1:1,l=r.index(s)+(c>0?1:0),u=r.node(s),d=!1;if(1==a)d=u.canReplace(l,l,i);else{var h=u.contentMatchAt(l).findWrapping(i.firstChild.type);d=h&&u.canReplaceWith(l,l,h[0])}if(d)return 0==c?r.pos:c<0?r.before(s+1):r.after(s+1)}return null}function ma(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Bi.empty;if(t==n&&!r.size)return null;var i=e.resolve(t),o=e.resolve(n);return ga(i,o,r)?new ta(t,n,r):new ya(i,o,r).fit()}function ga(e,t,n){return!n.openStart&&!n.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),n.content)}Jo.jsonID("replaceAround",na);var ya=function(){return S(function e(t,n,r){x(this,e),this.$from=t,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=Di.empty;for(var i=0;i<=t.depth;i++){var o=t.node(i);this.frontier.push({type:o.type,match:o.contentMatchAt(t.indexAfter(i))})}for(var a=t.depth;a>0;a--)this.placed=Di.from(t.node(a).copy(this.placed))},[{key:"depth",get:function(){return this.frontier.length-1}},{key:"fit",value:function(){for(;this.unplaced.size;){var e=this.findFittable();e?this.placeNodes(e):this.openMore()||this.dropNode()}var t=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,i=this.close(t<0?this.$to:r.doc.resolve(t));if(!i)return null;for(var o=this.placed,a=r.depth,s=i.depth;a&&s&&1==o.childCount;)o=o.firstChild.content,a--,s--;var c=new Bi(o,a,s);return t>-1?new na(r.pos,t,this.$to.pos,this.$to.end(),c,n):c.size||r.pos!=this.$to.pos?new ta(r.pos,i.pos,c):null}},{key:"findFittable",value:function(){for(var e=this.unplaced.openStart,t=this.unplaced.content,n=0,r=this.unplaced.openEnd;n<e;n++){var i=t.firstChild;if(t.childCount>1&&(r=0),i.type.spec.isolating&&r<=n){e=n;break}t=i.content}for(var o=1;o<=2;o++)for(var a=1==o?e:this.unplaced.openStart;a>=0;a--)for(var s=null,c=(a?(s=ba(this.unplaced.content,a-1).firstChild).content:this.unplaced.content).firstChild,l=this.depth;l>=0;l--){var u=this.frontier[l],d=u.type,h=u.match,f=void 0,p=null;if(1==o&&(c?h.matchType(c.type)||(p=h.fillBefore(Di.from(c),!1)):s&&d.compatibleContent(s.type)))return{sliceDepth:a,frontierDepth:l,parent:s,inject:p};if(2==o&&c&&(f=h.findWrapping(c.type)))return{sliceDepth:a,frontierDepth:l,parent:s,wrap:f};if(s&&h.matchType(s.type))break}}},{key:"openMore",value:function(){var e=this.unplaced,t=e.content,n=e.openStart,r=e.openEnd,i=ba(t,n);return!(!i.childCount||i.firstChild.isLeaf)&&(this.unplaced=new Bi(t,n+1,Math.max(r,i.size+n>=t.size-r?n+1:0)),!0)}},{key:"dropNode",value:function(){var e=this.unplaced,t=e.content,n=e.openStart,r=e.openEnd,i=ba(t,n);if(i.childCount<=1&&n>0){var o=t.size-n<=n+i.size;this.unplaced=new Bi(ka(t,n-1,1),n-1,o?n-1:r)}else this.unplaced=new Bi(ka(t,n,1),n,r)}},{key:"placeNodes",value:function(e){for(var t=e.sliceDepth,n=e.frontierDepth,r=e.parent,i=e.inject,o=e.wrap;this.depth>n;)this.closeFrontierNode();if(o)for(var a=0;a<o.length;a++)this.openFrontierNode(o[a]);var s=this.unplaced,c=r?r.content:s.content,l=s.openStart-t,u=0,d=[],h=this.frontier[n],f=h.match,p=h.type;if(i){for(var v=0;v<i.childCount;v++)d.push(i.child(v));f=f.matchFragment(i)}for(var m=c.size+t-(s.content.size-s.openEnd);u<c.childCount;){var g=c.child(u),y=f.matchType(g.type);if(!y)break;(++u>1||0==l||g.content.size)&&(f=y,d.push(xa(g.mark(p.allowedMarks(g.marks)),1==u?l:0,u==c.childCount?m:-1)))}var k=u==c.childCount;k||(m=-1),this.placed=wa(this.placed,n,Di.from(d)),this.frontier[n].match=f,k&&m<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(var w=0,b=c;w<m;w++){var x=b.lastChild;this.frontier.push({type:x.type,match:x.contentMatchAt(x.childCount)}),b=x.content}this.unplaced=k?0==t?Bi.empty:new Bi(ka(s.content,t-1,1),t-1,m<0?s.openEnd:t-1):new Bi(ka(s.content,t,u),s.openStart,s.openEnd)}},{key:"mustMoveInline",value:function(){if(!this.$to.parent.isTextblock)return-1;var e,t=this.frontier[this.depth];if(!t.type.isTextblock||!Ca(this.$to,this.$to.depth,t.type,t.match,!1)||this.$to.depth==this.depth&&(e=this.findCloseLevel(this.$to))&&e.depth==this.depth)return-1;for(var n=this.$to.depth,r=this.$to.after(n);n>1&&r==this.$to.end(--n);)++r;return r}},{key:"findCloseLevel",value:function(e){e:for(var t=Math.min(this.depth,e.depth);t>=0;t--){var n=this.frontier[t],r=n.match,i=n.type,o=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),a=Ca(e,t,i,r,o);if(a){for(var s=t-1;s>=0;s--){var c=this.frontier[s],l=c.match,u=Ca(e,s,c.type,l,!0);if(!u||u.childCount)continue e}return{depth:t,fit:a,move:o?e.doc.resolve(e.after(t+1)):e}}}}},{key:"close",value:function(e){var t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=wa(this.placed,t.depth,t.fit)),e=t.move;for(var n=t.depth+1;n<=e.depth;n++){var r=e.node(n),i=r.type.contentMatch.fillBefore(r.content,!0,e.index(n));this.openFrontierNode(r.type,r.attrs,i)}return e}},{key:"openFrontierNode",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2?arguments[2]:void 0,r=this.frontier[this.depth];r.match=r.match.matchType(e),this.placed=wa(this.placed,this.depth,Di.from(e.create(t,n))),this.frontier.push({type:e,match:e.contentMatch})}},{key:"closeFrontierNode",value:function(){var e=this.frontier.pop().match.fillBefore(Di.empty,!0);e.childCount&&(this.placed=wa(this.placed,this.frontier.length,e))}}])}();function ka(e,t,n){return 0==t?e.cutByIndex(n,e.childCount):e.replaceChild(0,e.firstChild.copy(ka(e.firstChild.content,t-1,n)))}function wa(e,t,n){return 0==t?e.append(n):e.replaceChild(e.childCount-1,e.lastChild.copy(wa(e.lastChild.content,t-1,n)))}function ba(e,t){for(var n=0;n<t;n++)e=e.firstChild.content;return e}function xa(e,t,n){if(t<=0)return e;var r=e.content;return t>1&&(r=r.replaceChild(0,xa(r.firstChild,t-1,1==r.childCount?n-1:0))),t>0&&(r=e.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(e.type.contentMatch.matchFragment(r).fillBefore(Di.empty,!0)))),e.copy(r)}function Ca(e,t,n,r,i){var o=e.node(t),a=i?e.indexAfter(t):e.index(t);if(a==o.childCount&&!n.compatibleContent(o.type))return null;var s=r.fillBefore(o.content,!0,a);return s&&!function(e,t,n){for(var r=n;r<t.childCount;r++)if(!e.allowsMarks(t.child(r).marks))return!0;return!1}(n,o.content,a)?s:null}function Sa(e){return e.spec.defining||e.spec.definingForContent}function _a(e,t,n,r,i){if(t<n){var o=e.firstChild;e=e.replaceChild(0,o.copy(_a(o.content,t+1,n,r,o)))}if(t>r){var a=i.contentMatchAt(0),s=a.fillBefore(e).append(e);e=s.append(a.matchFragment(s).fillBefore(Di.empty,!0))}return e}function Ma(e,t){for(var n=[],r=Math.min(e.depth,t.depth);r>=0;r--){var i=e.start(r);if(i<e.pos-(e.depth-r)||t.end(r)>t.pos+(t.depth-r)||e.node(r).type.spec.isolating||t.node(r).type.spec.isolating)break;(i==t.start(r)||r==e.depth&&r==t.depth&&e.parent.inlineContent&&t.parent.inlineContent&&r&&t.start(r-1)==i-1)&&n.push(r)}return n}var Na=function(e){function t(e,n,i){var o;return x(this,t),(o=r(this,t)).pos=e,o.attr=n,o.value=i,o}return a(t,e),S(t,[{key:"apply",value:function(e){var t=e.nodeAt(this.pos);if(!t)return Go.fail("No node at attribute step's position");var n=Object.create(null);for(var r in t.attrs)n[r]=t.attrs[r];n[this.attr]=this.value;var i=t.type.create(n,null,t.marks);return Go.fromReplace(e,this.pos,this.pos+1,new Bi(Di.from(i),0,t.isLeaf?0:1))}},{key:"getMap",value:function(){return qo.empty}},{key:"invert",value:function(e){return new t(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}},{key:"map",value:function(e){var n=e.mapResult(this.pos,1);return n.deletedAfter?null:new t(n.pos,this.attr,this.value)}},{key:"toJSON",value:function(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}}],[{key:"fromJSON",value:function(e,n){if("number"!=typeof n.pos||"string"!=typeof n.attr)throw new RangeError("Invalid input for AttrStep.fromJSON");return new t(n.pos,n.attr,n.value)}}])}(Jo);Jo.jsonID("attr",Na);var Ta=function(e){function t(e,n){var i;return x(this,t),(i=r(this,t)).attr=e,i.value=n,i}return a(t,e),S(t,[{key:"apply",value:function(e){var t=Object.create(null);for(var n in e.attrs)t[n]=e.attrs[n];t[this.attr]=this.value;var r=e.type.create(t,e.content,e.marks);return Go.ok(r)}},{key:"getMap",value:function(){return qo.empty}},{key:"invert",value:function(e){return new t(this.attr,e.attrs[this.attr])}},{key:"map",value:function(e){return this}},{key:"toJSON",value:function(){return{stepType:"docAttr",attr:this.attr,value:this.value}}}],[{key:"fromJSON",value:function(e,n){if("string"!=typeof n.attr)throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new t(n.attr,n.value)}}])}(Jo);Jo.jsonID("docAttr",Ta);var Oa=Error;((Oa=function e(t){var n=Error.call(this,t);return n.__proto__=e.prototype,n}).prototype=Object.create(Error.prototype)).constructor=Oa,Oa.prototype.name="TransformError";var Ea=function(){return S(function e(t){x(this,e),this.doc=t,this.steps=[],this.docs=[],this.mapping=new Uo},[{key:"before",get:function(){return this.docs.length?this.docs[0]:this.doc}},{key:"step",value:function(e){var t=this.maybeStep(e);if(t.failed)throw new Oa(t.failed);return this}},{key:"maybeStep",value:function(e){var t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}},{key:"docChanged",get:function(){return this.steps.length>0}},{key:"addStep",value:function(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}},{key:"replace",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Bi.empty,r=ma(this.doc,e,t,n);return r&&this.step(r),this}},{key:"replaceWith",value:function(e,t,n){return this.replace(e,t,new Bi(Di.from(n),0,0))}},{key:"delete",value:function(e,t){return this.replace(e,t,Bi.empty)}},{key:"insert",value:function(e,t){return this.replaceWith(e,e,t)}},{key:"replaceRange",value:function(e,t,n){return function(e,t,n,r){if(!r.size)return e.deleteRange(t,n);var i=e.doc.resolve(t),o=e.doc.resolve(n);if(ga(i,o,r))return e.step(new ta(t,n,r));var a=Ma(i,o);0==a[a.length-1]&&a.pop();var s=-(i.depth+1);a.unshift(s);for(var c=i.depth,l=i.pos-1;c>0;c--,l--){var u=i.node(c).type.spec;if(u.defining||u.definingAsContext||u.isolating)break;a.indexOf(c)>-1?s=c:i.before(c)==l&&a.splice(1,0,-c)}for(var d=a.indexOf(s),h=[],f=r.openStart,p=r.content,v=0;;v++){var m=p.firstChild;if(h.push(m),v==r.openStart)break;p=m.content}for(var g=f-1;g>=0;g--){var y=h[g],k=Sa(y.type);if(k&&!y.sameMarkup(i.node(Math.abs(s)-1)))f=g;else if(k||!y.type.isTextblock)break}for(var w=r.openStart;w>=0;w--){var b=(w+f+1)%(r.openStart+1),x=h[b];if(x)for(var C=0;C<a.length;C++){var S=a[(C+d)%a.length],_=!0;S<0&&(_=!1,S=-S);var M=i.node(S-1),N=i.index(S-1);if(M.canReplaceWith(N,N,x.type,x.marks))return e.replace(i.before(S),_?o.after(S):n,new Bi(_a(r.content,0,r.openStart,b),b,r.openEnd))}}for(var T=e.steps.length,O=a.length-1;O>=0&&(e.replace(t,n,r),!(e.steps.length>T));O--){var E=a[O];E<0||(t=i.before(E),n=o.after(E))}}(this,e,t,n),this}},{key:"replaceRangeWith",value:function(e,t,n){return function(e,t,n,r){if(!r.isInline&&t==n&&e.doc.resolve(t).parent.content.size){var i=function(e,t,n){var r=e.resolve(t);if(r.parent.canReplaceWith(r.index(),r.index(),n))return t;if(0==r.parentOffset)for(var i=r.depth-1;i>=0;i--){var o=r.index(i);if(r.node(i).canReplaceWith(o,o,n))return r.before(i+1);if(o>0)return null}if(r.parentOffset==r.parent.content.size)for(var a=r.depth-1;a>=0;a--){var s=r.indexAfter(a);if(r.node(a).canReplaceWith(s,s,n))return r.after(a+1);if(s<r.node(a).childCount)return null}return null}(e.doc,t,r.type);null!=i&&(t=n=i)}e.replaceRange(t,n,new Bi(Di.from(r),0,0))}(this,e,t,n),this}},{key:"deleteRange",value:function(e,t){return function(e,t,n){for(var r=e.doc.resolve(t),i=e.doc.resolve(n),o=Ma(r,i),a=0;a<o.length;a++){var s=o[a],c=a==o.length-1;if(c&&0==s||r.node(s).type.contentMatch.validEnd)return e.delete(r.start(s),i.end(s));if(s>0&&(c||r.node(s-1).canReplace(r.index(s-1),i.indexAfter(s-1))))return e.delete(r.before(s),i.after(s))}for(var l=1;l<=r.depth&&l<=i.depth;l++)if(t-r.start(l)==r.depth-l&&n>r.end(l)&&i.end(l)-n!=i.depth-l&&r.start(l-1)==i.start(l-1)&&r.node(l-1).canReplace(r.index(l-1),i.index(l-1)))return e.delete(r.before(l),n);e.delete(t,n)}(this,e,t),this}},{key:"lift",value:function(e,t){return function(e,t,n){for(var r=t.$from,i=t.$to,o=t.depth,a=r.before(o+1),s=i.after(o+1),c=a,l=s,u=Di.empty,d=0,h=o,f=!1;h>n;h--)f||r.index(h)>0?(f=!0,u=Di.from(r.node(h).copy(u)),d++):c--;for(var p=Di.empty,v=0,m=o,g=!1;m>n;m--)g||i.after(m+1)<i.end(m)?(g=!0,p=Di.from(i.node(m).copy(p)),v++):l++;e.step(new na(c,l,a,s,new Bi(u.append(p),d,v),u.size-d,!0))}(this,e,t),this}},{key:"join",value:function(e){return function(e,t,n){var r=null,i=e.doc.type.schema.linebreakReplacement,o=e.doc.resolve(t-n),a=o.node().type;if(i&&a.inlineContent){var s="pre"==a.whitespace,c=!!a.contentMatch.matchType(i);s&&!c?r=!1:!s&&c&&(r=!0)}var l=e.steps.length;if(!1===r){var u=e.doc.resolve(t+n);ua(e,u.node(),u.before(),l)}a.inlineContent&&ia(e,t+n-1,a,o.node().contentMatchAt(o.index()),null==r);var d=e.mapping.slice(l),h=d.map(t-n);if(e.step(new ta(h,d.map(t+n,-1),Bi.empty,!0)),!0===r){var f=e.doc.resolve(h);la(e,f.node(),f.before(),e.steps.length)}}(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:1),this}},{key:"wrap",value:function(e,t){return function(e,t,n){for(var r=Di.empty,i=n.length-1;i>=0;i--){if(r.size){var o=n[i].type.contentMatch.matchFragment(r);if(!o||!o.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=Di.from(n[i].type.create(n[i].attrs,r))}var a=t.start,s=t.end;e.step(new na(a,s,a,s,new Bi(r,0,0),n.length,!0))}(this,e,t),this}},{key:"setBlockType",value:function(e){return function(e,t,n,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");var o=e.steps.length;e.doc.nodesBetween(t,n,function(t,n){var a="function"==typeof i?i(t):i;if(t.isTextblock&&!t.hasMarkup(r,a)&&function(e,t,n){var r=e.resolve(t),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}(e.doc,e.mapping.slice(o).map(n),r)){var s=null;if(r.schema.linebreakReplacement){var c="pre"==r.whitespace,l=!!r.contentMatch.matchType(r.schema.linebreakReplacement);c&&!l?s=!1:!c&&l&&(s=!0)}!1===s&&ua(e,t,n,o),ia(e,e.mapping.slice(o).map(n,1),r,void 0,null===s);var u=e.mapping.slice(o),d=u.map(n,1),h=u.map(n+t.nodeSize,1);return e.step(new na(d,h,d+1,h-1,new Bi(Di.from(r.create(a,null,t.marks)),0,0),1,!0)),!0===s&&la(e,t,n,o),!1}})}(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:e,arguments.length>2?arguments[2]:void 0,arguments.length>3&&void 0!==arguments[3]?arguments[3]:null),this}},{key:"setNodeMarkup",value:function(e,t){return function(e,t,n,r,i){var o=e.doc.nodeAt(t);if(!o)throw new RangeError("No node at given position");n||(n=o.type);var a=n.create(r,null,i||o.marks);if(o.isLeaf)return e.replaceWith(t,t+o.nodeSize,a);if(!n.validContent(o.content))throw new RangeError("Invalid content for node type "+n.name);e.step(new na(t,t+o.nodeSize,t+1,t+o.nodeSize-1,new Bi(Di.from(a),0,0),1,!0))}(this,e,t,arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,arguments.length>3?arguments[3]:void 0),this}},{key:"setNodeAttribute",value:function(e,t,n){return this.step(new Na(e,t,n)),this}},{key:"setDocAttribute",value:function(e,t){return this.step(new Ta(e,t)),this}},{key:"addNodeMark",value:function(e,t){return this.step(new Qo(e,t)),this}},{key:"removeNodeMark",value:function(e,t){var n=this.doc.nodeAt(e);if(!n)throw new RangeError("No node at position "+e);if(t instanceof Pi)t.isInSet(n.marks)&&this.step(new ea(e,t));else{for(var r,i=n.marks,o=[];r=t.isInSet(i);)o.push(new ea(e,r)),i=r.removeFromSet(i);for(var a=o.length-1;a>=0;a--)this.step(o[a])}return this}},{key:"split",value:function(e){return function(e,t){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=arguments.length>3?arguments[3]:void 0,i=e.doc.resolve(t),o=Di.empty,a=Di.empty,s=i.depth,c=i.depth-n,l=n-1;s>c;s--,l--){o=Di.from(i.node(s).copy(o));var u=r&&r[l];a=Di.from(u?u.type.create(u.attrs,a):i.node(s).copy(a))}e.step(new ta(t,t,new Bi(o.append(a),n,n),!0))}(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,arguments.length>2?arguments[2]:void 0),this}},{key:"addMark",value:function(e,t,n){return function(e,t,n,r){var i,o,a=[],s=[];e.doc.nodesBetween(t,n,function(e,c,l){if(e.isInline){var u=e.marks;if(!r.isInSet(u)&&l.type.allowsMarkType(r.type)){for(var d=Math.max(c,t),h=Math.min(c+e.nodeSize,n),f=r.addToSet(u),p=0;p<u.length;p++)u[p].isInSet(f)||(i&&i.to==d&&i.mark.eq(u[p])?i.to=h:a.push(i=new Zo(d,h,u[p])));o&&o.to==d?o.to=h:s.push(o=new Yo(d,h,r))}}}),a.forEach(function(t){return e.step(t)}),s.forEach(function(t){return e.step(t)})}(this,e,t,n),this}},{key:"removeMark",value:function(e,t,n){return function(e,t,n,r){var i=[],o=0;e.doc.nodesBetween(t,n,function(e,a){if(e.isInline){o++;var s=null;if(r instanceof xo)for(var c,l=e.marks;c=r.isInSet(l);)(s||(s=[])).push(c),l=c.removeFromSet(l);else r?r.isInSet(e.marks)&&(s=[r]):s=e.marks;if(s&&s.length)for(var u=Math.min(a+e.nodeSize,n),d=0;d<s.length;d++){for(var h=s[d],f=void 0,p=0;p<i.length;p++){var v=i[p];v.step==o-1&&h.eq(i[p].style)&&(f=v)}f?(f.to=u,f.step=o):i.push({style:h,from:Math.max(a,t),to:u,step:o})}}}),i.forEach(function(t){return e.step(new Zo(t.from,t.to,t.style))})}(this,e,t,n),this}},{key:"clearIncompatible",value:function(e,t,n){return ia(this,e,t,n),this}}])}(),Aa=Object.create(null),Da=function(){return S(function e(t,n,r){x(this,e),this.$anchor=t,this.$head=n,this.ranges=r||[new Ia(t.min(n),t.max(n))]},[{key:"anchor",get:function(){return this.$anchor.pos}},{key:"head",get:function(){return this.$head.pos}},{key:"from",get:function(){return this.$from.pos}},{key:"to",get:function(){return this.$to.pos}},{key:"$from",get:function(){return this.ranges[0].$from}},{key:"$to",get:function(){return this.ranges[0].$to}},{key:"empty",get:function(){for(var e=this.ranges,t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}},{key:"content",value:function(){return this.$from.doc.slice(this.from,this.to,!0)}},{key:"replace",value:function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Bi.empty,n=t.content.lastChild,r=null,i=0;i<t.openEnd;i++)r=n,n=n.lastChild;for(var o=e.steps.length,a=this.ranges,s=0;s<a.length;s++){var c=a[s],l=c.$from,u=c.$to,d=e.mapping.slice(o);e.replaceRange(d.map(l.pos),d.map(u.pos),s?Bi.empty:t),0==s&&Ha(e,o,(n?n.isInline:r&&r.isTextblock)?-1:1)}}},{key:"replaceWith",value:function(e,t){for(var n=e.steps.length,r=this.ranges,i=0;i<r.length;i++){var o=r[i],a=o.$from,s=o.$to,c=e.mapping.slice(n),l=c.map(a.pos),u=c.map(s.pos);i?e.deleteRange(l,u):(e.replaceRangeWith(l,u,t),Ha(e,n,t.isInline?-1:1))}}},{key:"getBookmark",value:function(){return Pa.between(this.$anchor,this.$head).getBookmark()}}],[{key:"findFrom",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=e.parent.inlineContent?new Pa(e):$a(e.node(0),e.parent,e.pos,e.index(),t,n);if(r)return r;for(var i=e.depth-1;i>=0;i--){var o=t<0?$a(e.node(0),e.node(i),e.before(i+1),e.index(i),t,n):$a(e.node(0),e.node(i),e.after(i+1),e.index(i)+1,t,n);if(o)return o}return null}},{key:"near",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return this.findFrom(e,t)||this.findFrom(e,-t)||new Fa(e.node(0))}},{key:"atStart",value:function(e){return $a(e,e,0,0,1)||new Fa(e)}},{key:"atEnd",value:function(e){return $a(e,e,e.content.size,e.childCount,-1)||new Fa(e)}},{key:"fromJSON",value:function(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");var n=Aa[t.type];if(!n)throw new RangeError("No selection type ".concat(t.type," defined"));return n.fromJSON(e,t)}},{key:"jsonID",value:function(e,t){if(e in Aa)throw new RangeError("Duplicate use of selection JSON ID "+e);return Aa[e]=t,t.prototype.jsonID=e,t}}])}();Da.prototype.visible=!0;var Ia=S(function e(t,n){x(this,e),this.$from=t,this.$to=n}),za=!1;function Ra(e){za||e.parent.inlineContent||(za=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+e.parent.type.name+")"))}var Pa=function(t){function n(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e;return x(this,n),Ra(e),Ra(t),r(this,n,[e,t])}return a(n,t),S(n,[{key:"$cursor",get:function(){return this.$anchor.pos==this.$head.pos?this.$head:null}},{key:"map",value:function(e,t){var r=e.resolve(t.map(this.head));if(!r.parent.inlineContent)return Da.near(r);var i=e.resolve(t.map(this.anchor));return new n(i.parent.inlineContent?i:r,r)}},{key:"replace",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Bi.empty;if(e(n,"replace",this,3)([t,r]),r==Bi.empty){var i=this.$from.marksAcross(this.$to);i&&t.ensureMarks(i)}}},{key:"eq",value:function(e){return e instanceof n&&e.anchor==this.anchor&&e.head==this.head}},{key:"getBookmark",value:function(){return new La(this.anchor,this.head)}},{key:"toJSON",value:function(){return{type:"text",anchor:this.anchor,head:this.head}}}],[{key:"fromJSON",value:function(e,t){if("number"!=typeof t.anchor||"number"!=typeof t.head)throw new RangeError("Invalid input for TextSelection.fromJSON");return new n(e.resolve(t.anchor),e.resolve(t.head))}},{key:"create",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t,r=e.resolve(t);return new this(r,n==t?r:e.resolve(n))}},{key:"between",value:function(e,t,r){var i=e.pos-t.pos;if(r&&!i||(r=i>=0?1:-1),!t.parent.inlineContent){var o=Da.findFrom(t,r,!0)||Da.findFrom(t,-r,!0);if(!o)return Da.near(t,r);t=o.$head}return e.parent.inlineContent||(0==i||(e=(Da.findFrom(e,-r,!0)||Da.findFrom(e,r,!0)).$anchor).pos<t.pos!=i<0)&&(e=t),new n(e,t)}}])}(Da);Da.jsonID("text",Pa);var La=function(){function e(t,n){x(this,e),this.anchor=t,this.head=n}return S(e,[{key:"map",value:function(t){return new e(t.map(this.anchor),t.map(this.head))}},{key:"resolve",value:function(e){return Pa.between(e.resolve(this.anchor),e.resolve(this.head))}}])}(),Ba=function(e){function t(e){var n;x(this,t);var i=e.nodeAfter,o=e.node(0).resolve(e.pos+i.nodeSize);return(n=r(this,t,[e,o])).node=i,n}return a(t,e),S(t,[{key:"map",value:function(e,n){var r=n.mapResult(this.anchor),i=r.deleted,o=r.pos,a=e.resolve(o);return i?Da.near(a):new t(a)}},{key:"content",value:function(){return new Bi(Di.from(this.node),0,0)}},{key:"eq",value:function(e){return e instanceof t&&e.anchor==this.anchor}},{key:"toJSON",value:function(){return{type:"node",anchor:this.anchor}}},{key:"getBookmark",value:function(){return new Va(this.anchor)}}],[{key:"fromJSON",value:function(e,n){if("number"!=typeof n.anchor)throw new RangeError("Invalid input for NodeSelection.fromJSON");return new t(e.resolve(n.anchor))}},{key:"create",value:function(e,n){return new t(e.resolve(n))}},{key:"isSelectable",value:function(e){return!e.isText&&!1!==e.type.spec.selectable}}])}(Da);Ba.prototype.visible=!1,Da.jsonID("node",Ba);var Va=function(){function e(t){x(this,e),this.anchor=t}return S(e,[{key:"map",value:function(t){var n=t.mapResult(this.anchor),r=n.deleted,i=n.pos;return r?new La(i,i):new e(i)}},{key:"resolve",value:function(e){var t=e.resolve(this.anchor),n=t.nodeAfter;return n&&Ba.isSelectable(n)?new Ba(t):Da.near(t)}}])}(),Fa=function(t){function n(e){return x(this,n),r(this,n,[e.resolve(0),e.resolve(e.content.size)])}return a(n,t),S(n,[{key:"replace",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Bi.empty;if(r==Bi.empty){t.delete(0,t.doc.content.size);var i=Da.atStart(t.doc);i.eq(t.selection)||t.setSelection(i)}else e(n,"replace",this,3)([t,r])}},{key:"toJSON",value:function(){return{type:"all"}}},{key:"map",value:function(e){return new n(e)}},{key:"eq",value:function(e){return e instanceof n}},{key:"getBookmark",value:function(){return ja}}],[{key:"fromJSON",value:function(e){return new n(e)}}])}(Da);Da.jsonID("all",Fa);var ja={map:function(){return this},resolve:function(e){return new Fa(e)}};function $a(e,t,n,r,i){var o=arguments.length>5&&void 0!==arguments[5]&&arguments[5];if(t.inlineContent)return Pa.create(e,n);for(var a=r-(i>0?0:1);i>0?a<t.childCount:a>=0;a+=i){var s=t.child(a);if(s.isAtom){if(!o&&Ba.isSelectable(s))return Ba.create(e,n-(i<0?s.nodeSize:0))}else{var c=$a(e,s,n+i,i<0?s.childCount:0,i,o);if(c)return c}n+=s.nodeSize*i}return null}function Ha(e,t,n){var r=e.steps.length-1;if(!(r<t)){var i,o=e.steps[r];if(o instanceof ta||o instanceof na)e.mapping.maps[r].forEach(function(e,t,n,r){null==i&&(i=r)}),e.setSelection(Da.near(e.doc.resolve(i),n))}}var Wa=function(t){function n(e){var t;return x(this,n),(t=r(this,n,[e.doc])).curSelectionFor=0,t.updated=0,t.meta=Object.create(null),t.time=Date.now(),t.curSelection=e.selection,t.storedMarks=e.storedMarks,t}return a(n,t),S(n,[{key:"selection",get:function(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}},{key:"setSelection",value:function(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=-3&this.updated|1,this.storedMarks=null,this}},{key:"selectionSet",get:function(){return(1&this.updated)>0}},{key:"setStoredMarks",value:function(e){return this.storedMarks=e,this.updated|=2,this}},{key:"ensureMarks",value:function(e){return Pi.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}},{key:"addStoredMark",value:function(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}},{key:"removeStoredMark",value:function(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}},{key:"storedMarksSet",get:function(){return(2&this.updated)>0}},{key:"addStep",value:function(t,r){e(n,"addStep",this,3)([t,r]),this.updated=-3&this.updated,this.storedMarks=null}},{key:"setTime",value:function(e){return this.time=e,this}},{key:"replaceSelection",value:function(e){return this.selection.replace(this,e),this}},{key:"replaceSelectionWith",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=this.selection;return t&&(e=e.mark(this.storedMarks||(n.empty?n.$from.marks():n.$from.marksAcross(n.$to)||Pi.none))),n.replaceWith(this,e),this}},{key:"deleteSelection",value:function(){return this.selection.replace(this),this}},{key:"insertText",value:function(e,t,n){var r=this.doc.type.schema;if(null==t)return e?this.replaceSelectionWith(r.text(e),!0):this.deleteSelection();if(null==n&&(n=t),!e)return this.deleteRange(t,n);var i=this.storedMarks;if(!i){var o=this.doc.resolve(t);i=n==t?o.marks():o.marksAcross(this.doc.resolve(n))}return this.replaceRangeWith(t,n,r.text(e,i)),this.selection.empty||this.selection.to!=t+e.length||this.setSelection(Da.near(this.selection.$to)),this}},{key:"setMeta",value:function(e,t){return this.meta["string"==typeof e?e:e.key]=t,this}},{key:"getMeta",value:function(e){return this.meta["string"==typeof e?e:e.key]}},{key:"isGeneric",get:function(){for(var e in this.meta)return!1;return!0}},{key:"scrollIntoView",value:function(){return this.updated|=4,this}},{key:"scrolledIntoView",get:function(){return(4&this.updated)>0}}])}(Ea);function qa(e,t){return t&&e?e.bind(t):e}var Ua=S(function e(t,n,r){x(this,e),this.name=t,this.init=qa(n.init,r),this.apply=qa(n.apply,r)}),Ka=[new Ua("doc",{init:function(e){return e.doc||e.schema.topNodeType.createAndFill()},apply:function(e){return e.doc}}),new Ua("selection",{init:function(e,t){return e.selection||Da.atStart(t.doc)},apply:function(e){return e.selection}}),new Ua("storedMarks",{init:function(e){return e.storedMarks||null},apply:function(e,t,n,r){return r.selection.$cursor?e.storedMarks:null}}),new Ua("scrollToSelection",{init:function(){return 0},apply:function(e,t){return e.scrolledIntoView?t+1:t}})],Ja=S(function e(t,n){var r=this;x(this,e),this.schema=t,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=Ka.slice(),n&&n.forEach(function(e){if(r.pluginsByKey[e.key])throw new RangeError("Adding different instances of a keyed plugin ("+e.key+")");r.plugins.push(e),r.pluginsByKey[e.key]=e,e.spec.state&&r.fields.push(new Ua(e.key,e.spec.state,e))})}),Ga=function(){function e(t){x(this,e),this.config=t}return S(e,[{key:"schema",get:function(){return this.config.schema}},{key:"plugins",get:function(){return this.config.plugins}},{key:"apply",value:function(e){return this.applyTransaction(e).state}},{key:"filterTransaction",value:function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1,n=0;n<this.config.plugins.length;n++)if(n!=t){var r=this.config.plugins[n];if(r.spec.filterTransaction&&!r.spec.filterTransaction.call(r,e,this))return!1}return!0}},{key:"applyTransaction",value:function(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};for(var t=[e],n=this.applyInner(e),r=null;;){for(var i=!1,o=0;o<this.config.plugins.length;o++){var a=this.config.plugins[o];if(a.spec.appendTransaction){var s=r?r[o].n:0,c=r?r[o].state:this,l=s<t.length&&a.spec.appendTransaction.call(a,s?t.slice(s):t,c,n);if(l&&n.filterTransaction(l,o)){if(l.setMeta("appendedTransaction",e),!r){r=[];for(var u=0;u<this.config.plugins.length;u++)r.push(u<o?{state:n,n:t.length}:{state:this,n:0})}t.push(l),n=n.applyInner(l),i=!0}r&&(r[o]={state:n,n:t.length})}}if(!i)return{state:n,transactions:t}}}},{key:"applyInner",value:function(t){if(!t.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");for(var n=new e(this.config),r=this.config.fields,i=0;i<r.length;i++){var o=r[i];n[o.name]=o.apply(t,this[o.name],this,n)}return n}},{key:"tr",get:function(){return new Wa(this)}},{key:"reconfigure",value:function(t){for(var n=new Ja(this.schema,t.plugins),r=n.fields,i=new e(n),o=0;o<r.length;o++){var a=r[o].name;i[a]=this.hasOwnProperty(a)?this[a]:r[o].init(t,i)}return i}},{key:"toJSON",value:function(e){var t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map(function(e){return e.toJSON()})),e&&"object"==N(e))for(var n in e){if("doc"==n||"selection"==n)throw new RangeError("The JSON fields `doc` and `selection` are reserved");var r=e[n],i=r.spec.state;i&&i.toJSON&&(t[n]=i.toJSON.call(r,this[r.key]))}return t}}],[{key:"create",value:function(t){for(var n=new Ja(t.doc?t.doc.type.schema:t.schema,t.plugins),r=new e(n),i=0;i<n.fields.length;i++)r[n.fields[i].name]=n.fields[i].init(t,r);return r}},{key:"fromJSON",value:function(t,n,r){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!t.schema)throw new RangeError("Required config field 'schema' missing");var i=new Ja(t.schema,t.plugins),o=new e(i);return i.fields.forEach(function(e){if("doc"==e.name)o.doc=no.fromJSON(t.schema,n.doc);else if("selection"==e.name)o.selection=Da.fromJSON(o.doc,n.selection);else if("storedMarks"==e.name)n.storedMarks&&(o.storedMarks=n.storedMarks.map(t.schema.markFromJSON));else{if(r)for(var i in r){var a=r[i],s=a.spec.state;if(a.key==e.name&&s&&s.fromJSON&&Object.prototype.hasOwnProperty.call(n,i))return void(o[e.name]=s.fromJSON.call(a,t,n[i],o))}o[e.name]=e.init(t,o)}}),o}}])}();function Xa(e,t,n){for(var r in e){var i=e[r];i instanceof Function?i=i.bind(t):"handleDOMEvents"==r&&(i=Xa(i,t,{})),n[r]=i}return n}var Ya=function(){return S(function e(t){x(this,e),this.spec=t,this.props={},t.props&&Xa(t.props,this,this.props),this.key=t.key?t.key.key:Qa("plugin")},[{key:"getState",value:function(e){return e[this.key]}}])}(),Za=Object.create(null);function Qa(e){return e in Za?e+"$"+ ++Za[e]:(Za[e]=0,e+"$")}var es=function(){return S(function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"key";x(this,e),this.key=Qa(t)},[{key:"get",value:function(e){return e.config.pluginsByKey[this.key]}},{key:"getState",value:function(e){return e[this.key]}}])}();function ts(e,t){var n=e.selection.$cursor;return!n||(t?!t.endOfTextblock("backward",e):n.parentOffset>0)?null:n}function ns(e,t,n){for(var r=t.nodeBefore,i=t.pos-1;!r.isTextblock;i--){if(r.type.spec.isolating)return!1;var o=r.lastChild;if(!o)return!1;r=o}for(var a=t.nodeAfter,s=t.pos+1;!a.isTextblock;s++){if(a.type.spec.isolating)return!1;var c=a.firstChild;if(!c)return!1;a=c}var l=ma(e.doc,i,s,Bi.empty);if(!l||l.from!=i||l instanceof ta&&l.slice.size>=s-i)return!1;if(n){var u=e.tr.step(l);u.setSelection(Pa.create(u.doc,i)),n(u.scrollIntoView())}return!0}function rs(e,t){for(var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=e;r;r="start"==t?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&1!=r.childCount)return!1}return!1}function is(e){if(!e.parent.type.spec.isolating)for(var t=e.depth-1;t>=0;t--){if(e.index(t)>0)return e.doc.resolve(e.before(t+1));if(e.node(t).type.spec.isolating)break}return null}function as(e,t){var n=e.selection.$cursor;return!n||(t?!t.endOfTextblock("forward",e):n.parentOffset<n.parent.content.size)?null:n}function ss(e){if(!e.parent.type.spec.isolating)for(var t=e.depth-1;t>=0;t--){var n=e.node(t);if(e.index(t)+1<n.childCount)return e.doc.resolve(e.after(t+1));if(n.type.spec.isolating)break}return null}function cs(e){for(var t=0;t<e.edgeCount;t++){var n=e.edge(t).type;if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}function ls(e,t,n,r){var i,o,a=t.nodeBefore,s=t.nodeAfter,c=a.type.spec.isolating||s.type.spec.isolating;if(!c&&function(e,t,n){var r=t.nodeBefore,i=t.nodeAfter,o=t.index();return!(!(r&&i&&r.type.compatibleContent(i.type))||(!r.content.size&&t.parent.canReplace(o-1,o)?(n&&n(e.tr.delete(t.pos-r.nodeSize,t.pos).scrollIntoView()),0):!t.parent.canReplace(o,o+1)||!i.isTextblock&&!ha(e.doc,t.pos)||(n&&n(e.tr.join(t.pos).scrollIntoView()),0)))}(e,t,n))return!0;var l=!c&&t.parent.canReplace(t.index(),t.index()+1);if(l&&(i=(o=a.contentMatchAt(a.childCount)).findWrapping(s.type))&&o.matchType(i[0]||s.type).validEnd){if(n){for(var u=t.pos+s.nodeSize,d=Di.empty,h=i.length-1;h>=0;h--)d=Di.from(i[h].create(null,d));d=Di.from(a.copy(d));var f=e.tr.step(new na(t.pos-1,u,t.pos,u,new Bi(d,1,0),i.length,!0)),p=f.doc.resolve(u+2*i.length);p.nodeAfter&&p.nodeAfter.type==a.type&&ha(f.doc,p.pos)&&f.join(p.pos),n(f.scrollIntoView())}return!0}var v=s.type.spec.isolating||r>0&&c?null:Da.findFrom(t,1),m=v&&v.$from.blockRange(v.$to),g=m&&aa(m);if(null!=g&&g>=t.depth)return n&&n(e.tr.lift(m,g).scrollIntoView()),!0;if(l&&rs(s,"start",!0)&&rs(a,"end")){for(var y=a,k=[];k.push(y),!y.isTextblock;)y=y.lastChild;for(var w=s,b=1;!w.isTextblock;w=w.firstChild)b++;if(y.canReplace(y.childCount,y.childCount,w.content)){if(n){for(var x=Di.empty,C=k.length-1;C>=0;C--)x=Di.from(k[C].copy(x));n(e.tr.step(new na(t.pos-k.length,t.pos+s.nodeSize,t.pos+b,t.pos+s.nodeSize-b,new Bi(x,k.length,0),0,!0)).scrollIntoView())}return!0}}return!1}function us(e){return function(t,n){for(var r=t.selection,i=e<0?r.$from:r.$to,o=i.depth;i.node(o).isInline;){if(!o)return!1;o--}return!!i.node(o).isTextblock&&(n&&n(t.tr.setSelection(Pa.create(t.doc,e<0?i.start(o):i.end(o)))),!0)}}var ds=us(-1),hs=us(1);function fs(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return function(n,r){for(var i=!1,o=0;o<n.selection.ranges.length&&!i;o++){var a=n.selection.ranges[o],s=a.$from.pos,c=a.$to.pos;n.doc.nodesBetween(s,c,function(r,o){if(i)return!1;if(r.isTextblock&&!r.hasMarkup(e,t))if(r.type==e)i=!0;else{var a=n.doc.resolve(o),s=a.index();i=a.parent.canReplaceWith(s,s+1,e)}})}if(!i)return!1;if(r){for(var l=n.tr,u=0;u<n.selection.ranges.length;u++){var d=n.selection.ranges[u],h=d.$from.pos,f=d.$to.pos;l.setBlockType(h,f,e,t)}r(l.scrollIntoView())}return!0}}function ps(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return function(n,r){var i=n.selection,o=i.$from,a=i.$to,s=o.blockRange(a);if(!s)return!1;var c=r?n.tr:null;return!!function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=!1,o=t,a=t.$from.doc;if(t.depth>=2&&t.$from.node(t.depth-1).type.compatibleContent(n)&&0==t.startIndex){if(0==t.$from.index(t.depth-1))return!1;var s=a.resolve(t.start-2);o=new eo(s,s,t.depth),t.endIndex<t.parent.childCount&&(t=new eo(t.$from,a.resolve(t.$to.end(t.depth)),t.depth)),i=!0}var c=sa(o,n,r,t);if(!c)return!1;e&&function(e,t,n,r,i){for(var o=Di.empty,a=n.length-1;a>=0;a--)o=Di.from(n[a].type.create(n[a].attrs,o));e.step(new na(t.start-(r?2:0),t.end,t.start,t.end,new Bi(o,0,0),n.length,!0));for(var s=0,c=0;c<n.length;c++)n[c].type==i&&(s=c+1);for(var l=n.length-s,u=t.start+n.length-(r?2:0),d=t.parent,h=t.startIndex,f=t.endIndex,p=!0;h<f;h++,p=!1)!p&&da(e.doc,u,l)&&(e.split(u,l),u+=2*l),u+=d.child(h).nodeSize}(e,t,c,i,n);return!0}(c,s,e,t)&&(r&&r(c.scrollIntoView()),!0)}}function vs(e){return function(t,n){var r=t.selection,i=r.$from,o=r.$to,a=i.blockRange(o,function(t){return t.childCount>0&&t.firstChild.type==e});return!!a&&(!n||(i.node(a.depth-1).type==e?function(e,t,n,r){var i=e.tr,o=r.end,a=r.$to.end(r.depth);o<a&&(i.step(new na(o-1,a,o,a,new Bi(Di.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new eo(i.doc.resolve(r.$from.pos),i.doc.resolve(a),r.depth));var s=aa(r);if(null==s)return!1;i.lift(r,s);var c=i.doc.resolve(i.mapping.map(o,-1)-1);ha(i.doc,c.pos)&&c.nodeBefore.type==c.nodeAfter.type&&i.join(c.pos);return t(i.scrollIntoView()),!0}(t,n,e,a):function(e,t,n){for(var r=e.tr,i=n.parent,o=n.end,a=n.endIndex-1,s=n.startIndex;a>s;a--)o-=i.child(a).nodeSize,r.delete(o-1,o+1);var c=r.doc.resolve(n.start),l=c.nodeAfter;if(r.mapping.map(n.end)!=n.start+c.nodeAfter.nodeSize)return!1;var u=0==n.startIndex,d=n.endIndex==i.childCount,h=c.node(-1),f=c.index(-1);if(!h.canReplace(f+(u?0:1),f+1,l.content.append(d?Di.empty:Di.from(i))))return!1;var p=c.pos,v=p+l.nodeSize;return r.step(new na(p-(u?1:0),v+(d?1:0),p+1,v-1,new Bi((u?Di.empty:Di.from(i.copy(Di.empty))).append(d?Di.empty:Di.from(i.copy(Di.empty))),u?0:1,d?0:1),u?0:1)),t(r.scrollIntoView()),!0}(t,n,a)))}}"undefined"!=typeof navigator?/Mac|iP(hone|[oa]d)/.test(navigator.platform):"undefined"!=typeof os&&os.platform&&os.platform();var ms=function(e){for(var t=0;;t++)if(!(e=e.previousSibling))return t},gs=function(e){var t=e.assignedSlot||e.parentNode;return t&&11==t.nodeType?t.host:t},ys=null,ks=function(e,t,n){var r=ys||(ys=document.createRange());return r.setEnd(e,null==n?e.nodeValue.length:n),r.setStart(e,t||0),r},ws=function(e,t,n,r){return n&&(xs(e,t,n,r,-1)||xs(e,t,n,r,1))},bs=/^(img|br|input|textarea|hr)$/i;function xs(e,t,n,r,i){for(var o;;){if(e==n&&t==r)return!0;if(t==(i<0?0:Cs(e))){var a=e.parentNode;if(!a||1!=a.nodeType||Ss(e)||bs.test(e.nodeName)||"false"==e.contentEditable)return!1;t=ms(e)+(i<0?0:1),e=a}else{if(1!=e.nodeType)return!1;var s=e.childNodes[t+(i<0?-1:0)];if(1==s.nodeType&&"false"==s.contentEditable){if(!(null===(o=s.pmViewDesc)||void 0===o?void 0:o.ignoreForSelection))return!1;t+=i}else e=s,t=i<0?Cs(e):0}}}function Cs(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function Ss(e){for(var t,n=e;n&&!(t=n.pmViewDesc);n=n.parentNode);return t&&t.node&&t.node.isBlock&&(t.dom==e||t.contentDOM==e)}var _s=function(e){return e.focusNode&&ws(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)};function Ms(e,t){var n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=e,n.key=n.code=t,n}var Ns="undefined"!=typeof navigator?navigator:null,Ts="undefined"!=typeof document?document:null,Os=Ns&&Ns.userAgent||"",Es=/Edge\/(\d+)/.exec(Os),As=/MSIE \d/.exec(Os),Ds=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Os),Is=!!(As||Ds||Es),zs=As?document.documentMode:Ds?+Ds[1]:Es?+Es[1]:0,Rs=!Is&&/gecko\/(\d+)/i.test(Os);Rs&&(/Firefox\/(\d+)/.exec(Os)||[0,0])[1];var Ps=!Is&&/Chrome\/(\d+)/.exec(Os),Ls=!!Ps,Bs=Ps?+Ps[1]:0,Vs=!Is&&!!Ns&&/Apple Computer/.test(Ns.vendor),Fs=Vs&&(/Mobile\/\w+/.test(Os)||!!Ns&&Ns.maxTouchPoints>2),js=Fs||!!Ns&&/Mac/.test(Ns.platform),$s=!!Ns&&/Win/.test(Ns.platform),Hs=/Android \d/.test(Os),Ws=!!Ts&&"webkitFontSmoothing"in Ts.documentElement.style,qs=Ws?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function Us(e){var t=e.defaultView&&e.defaultView.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.documentElement.clientWidth,top:0,bottom:e.documentElement.clientHeight}}function Ks(e,t){return"number"==typeof e?e:e[t]}function Js(e){var t=e.getBoundingClientRect(),n=t.width/e.offsetWidth||1,r=t.height/e.offsetHeight||1;return{left:t.left,right:t.left+e.clientWidth*n,top:t.top,bottom:t.top+e.clientHeight*r}}function Gs(e,t,n){for(var r=e.someProp("scrollThreshold")||0,i=e.someProp("scrollMargin")||5,o=e.dom.ownerDocument,a=n||e.dom;a;)if(1==a.nodeType){var s=a,c=s==o.body,l=c?Us(o):Js(s),u=0,d=0;if(t.top<l.top+Ks(r,"top")?d=-(l.top-t.top+Ks(i,"top")):t.bottom>l.bottom-Ks(r,"bottom")&&(d=t.bottom-t.top>l.bottom-l.top?t.top+Ks(i,"top")-l.top:t.bottom-l.bottom+Ks(i,"bottom")),t.left<l.left+Ks(r,"left")?u=-(l.left-t.left+Ks(i,"left")):t.right>l.right-Ks(r,"right")&&(u=t.right-l.right+Ks(i,"right")),u||d)if(c)o.defaultView.scrollBy(u,d);else{var h=s.scrollLeft,f=s.scrollTop;d&&(s.scrollTop+=d),u&&(s.scrollLeft+=u);var p=s.scrollLeft-h,v=s.scrollTop-f;t={left:t.left-p,top:t.top-v,right:t.right-p,bottom:t.bottom-v}}var m=c?"fixed":getComputedStyle(a).position;if(/^(fixed|sticky)$/.test(m))break;a="absolute"==m?a.offsetParent:gs(a)}else a=gs(a)}function Xs(e){for(var t=[],n=e.ownerDocument,r=e;r&&(t.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),e!=n);r=gs(r));return t}function Ys(e,t){for(var n=0;n<e.length;n++){var r=e[n],i=r.dom,o=r.top,a=r.left;i.scrollTop!=o+t&&(i.scrollTop=o+t),i.scrollLeft!=a&&(i.scrollLeft=a)}}var Zs=null;function Qs(e,t){for(var n,r,i,o,a=2e8,s=0,c=t.top,l=t.top,u=e.firstChild,d=0;u;u=u.nextSibling,d++){var h=void 0;if(1==u.nodeType)h=u.getClientRects();else{if(3!=u.nodeType)continue;h=ks(u).getClientRects()}for(var f=0;f<h.length;f++){var p=h[f];if(p.top<=c&&p.bottom>=l){c=Math.max(p.bottom,c),l=Math.min(p.top,l);var v=p.left>t.left?p.left-t.left:p.right<t.left?t.left-p.right:0;if(v<a){n=u,a=v,r=v&&3==n.nodeType?{left:p.right<t.left?p.right:p.left,top:t.top}:t,1==u.nodeType&&v&&(s=d+(t.left>=(p.left+p.right)/2?1:0));continue}}else p.top>t.top&&!i&&p.left<=t.left&&p.right>=t.left&&(i=u,o={left:Math.max(p.left,Math.min(p.right,t.left)),top:p.top});!n&&(t.left>=p.right&&t.top>=p.top||t.left>=p.left&&t.top>=p.bottom)&&(s=d+1)}}return!n&&i&&(n=i,r=o,a=0),n&&3==n.nodeType?function(e,t){for(var n,r=e.nodeValue.length,i=document.createRange(),o=0;o<r;o++){i.setEnd(e,o+1),i.setStart(e,o);var a=ic(i,1);if(a.top!=a.bottom&&ec(t,a)){n={node:e,offset:o+(t.left>=(a.left+a.right)/2?1:0)};break}}return i.detach(),n||{node:e,offset:0}}(n,r):!n||a&&1==n.nodeType?{node:e,offset:s}:Qs(n,r)}function ec(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function tc(e,t,n){var r=e.childNodes.length;if(r&&n.top<n.bottom)for(var i=Math.max(0,Math.min(r-1,Math.floor(r*(t.top-n.top)/(n.bottom-n.top))-2)),o=i;;){var a=e.childNodes[o];if(1==a.nodeType)for(var s=a.getClientRects(),c=0;c<s.length;c++){var l=s[c];if(ec(t,l))return tc(a,t,l)}if((o=(o+1)%r)==i)break}return e}function nc(e,t){var n,r=e.dom.ownerDocument,i=0,o=function(e,t,n){if(e.caretPositionFromPoint)try{var r=e.caretPositionFromPoint(t,n);if(r)return{node:r.offsetNode,offset:Math.min(Cs(r.offsetNode),r.offset)}}catch(Tt){}if(e.caretRangeFromPoint){var i=e.caretRangeFromPoint(t,n);if(i)return{node:i.startContainer,offset:Math.min(Cs(i.startContainer),i.startOffset)}}}(r,t.left,t.top);o&&(n=o.node,i=o.offset);var a,s=(e.root.elementFromPoint?e.root:r).elementFromPoint(t.left,t.top);if(!s||!e.dom.contains(1!=s.nodeType?s.parentNode:s)){var c=e.dom.getBoundingClientRect();if(!ec(t,c))return null;if(!(s=tc(e.dom,t,c)))return null}if(Vs)for(var l=s;n&&l;l=gs(l))l.draggable&&(n=void 0);if(s=function(e,t){var n=e.parentNode;return n&&/^li$/i.test(n.nodeName)&&t.left<e.getBoundingClientRect().left?n:e}(s,t),n){if(Rs&&1==n.nodeType&&(i=Math.min(i,n.childNodes.length))<n.childNodes.length){var u,d=n.childNodes[i];"IMG"==d.nodeName&&(u=d.getBoundingClientRect()).right<=t.left&&u.bottom>t.top&&i++}var h;Ws&&i&&1==n.nodeType&&1==(h=n.childNodes[i-1]).nodeType&&"false"==h.contentEditable&&h.getBoundingClientRect().top>=t.top&&i--,n==e.dom&&i==n.childNodes.length-1&&1==n.lastChild.nodeType&&t.top>n.lastChild.getBoundingClientRect().bottom?a=e.state.doc.content.size:0!=i&&1==n.nodeType&&"BR"==n.childNodes[i-1].nodeName||(a=function(e,t,n,r){for(var i=-1,o=t,a=!1;o!=e.dom;){var s=e.docView.nearestDesc(o,!0),c=void 0;if(!s)return null;if(1==s.dom.nodeType&&(s.node.isBlock&&s.parent||!s.contentDOM)&&((c=s.dom.getBoundingClientRect()).width||c.height)&&(s.node.isBlock&&s.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(s.dom.nodeName)&&(!a&&c.left>r.left||c.top>r.top?i=s.posBefore:(!a&&c.right<r.left||c.bottom<r.top)&&(i=s.posAfter),a=!0),!s.contentDOM&&i<0&&!s.node.isText))return(s.node.isBlock?r.top<(c.top+c.bottom)/2:r.left<(c.left+c.right)/2)?s.posBefore:s.posAfter;o=s.dom.parentNode}return i>-1?i:e.docView.posFromDOM(t,n,-1)}(e,n,i,t))}null==a&&(a=function(e,t,n){var r=Qs(t,n),i=r.node,o=r.offset,a=-1;if(1==i.nodeType&&!i.firstChild){var s=i.getBoundingClientRect();a=s.left!=s.right&&n.left>(s.left+s.right)/2?1:-1}return e.docView.posFromDOM(i,o,a)}(e,s,t));var f=e.docView.nearestDesc(s,!0);return{pos:a,inside:f?f.posAtStart-f.border:-1}}function rc(e){return e.top<e.bottom||e.left<e.right}function ic(e,t){var n=e.getClientRects();if(n.length){var r=n[t<0?0:n.length-1];if(rc(r))return r}return Array.prototype.find.call(n,rc)||e.getBoundingClientRect()}var oc=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function ac(e,t,n){var r=e.docView.domFromPos(t,n<0?-1:1),i=r.node,o=r.offset,a=r.atom,s=Ws||Rs;if(3==i.nodeType){if(!s||!oc.test(i.nodeValue)&&(n<0?o:o!=i.nodeValue.length)){var c=o,l=o,u=n<0?1:-1;return n<0&&!o?(l++,u=-1):n>=0&&o==i.nodeValue.length?(c--,u=1):n<0?c--:l++,sc(ic(ks(i,c,l),u),u<0)}var d=ic(ks(i,o,o),n);if(Rs&&o&&/\s/.test(i.nodeValue[o-1])&&o<i.nodeValue.length){var h=ic(ks(i,o-1,o-1),-1);if(h.top==d.top){var f=ic(ks(i,o,o+1),-1);if(f.top!=d.top)return sc(f,f.left<h.left)}}return d}if(!e.state.doc.resolve(t-(a||0)).parent.inlineContent){if(null==a&&o&&(n<0||o==Cs(i))){var p=i.childNodes[o-1];if(1==p.nodeType)return cc(p.getBoundingClientRect(),!1)}if(null==a&&o<Cs(i)){var v=i.childNodes[o];if(1==v.nodeType)return cc(v.getBoundingClientRect(),!0)}return cc(i.getBoundingClientRect(),n>=0)}if(null==a&&o&&(n<0||o==Cs(i))){var m=i.childNodes[o-1],g=3==m.nodeType?ks(m,Cs(m)-(s?0:1)):1!=m.nodeType||"BR"==m.nodeName&&m.nextSibling?null:m;if(g)return sc(ic(g,1),!1)}if(null==a&&o<Cs(i)){for(var y=i.childNodes[o];y.pmViewDesc&&y.pmViewDesc.ignoreForCoords;)y=y.nextSibling;var k=y?3==y.nodeType?ks(y,0,s?0:1):1==y.nodeType?y:null:null;if(k)return sc(ic(k,-1),!0)}return sc(ic(3==i.nodeType?ks(i):i,-n),n>=0)}function sc(e,t){if(0==e.width)return e;var n=t?e.left:e.right;return{top:e.top,bottom:e.bottom,left:n,right:n}}function cc(e,t){if(0==e.height)return e;var n=t?e.top:e.bottom;return{top:n,bottom:n,left:e.left,right:e.right}}function lc(e,t,n){var r=e.state,i=e.root.activeElement;r!=t&&e.updateState(t),i!=e.dom&&e.focus();try{return n()}finally{r!=t&&e.updateState(r),i!=e.dom&&i&&i.focus()}}var uc=/[\u0590-\u08ac]/;var dc=null,hc=null,fc=!1;function pc(e,t,n){return dc==t&&hc==n?fc:(dc=t,hc=n,fc="up"==n||"down"==n?function(e,t,n){var r=t.selection,i="up"==n?r.$from:r.$to;return lc(e,t,function(){for(var t=e.docView.domFromPos(i.pos,"up"==n?-1:1).node;;){var r=e.docView.nearestDesc(t,!0);if(!r)break;if(r.node.isBlock){t=r.contentDOM||r.dom;break}t=r.dom.parentNode}for(var o=ac(e,i.pos,1),a=t.firstChild;a;a=a.nextSibling){var s=void 0;if(1==a.nodeType)s=a.getClientRects();else{if(3!=a.nodeType)continue;s=ks(a,0,a.nodeValue.length).getClientRects()}for(var c=0;c<s.length;c++){var l=s[c];if(l.bottom>l.top+1&&("up"==n?o.top-l.top>2*(l.bottom-o.top):l.bottom-o.bottom>2*(o.bottom-l.top)))return!1}}return!0})}(e,t,n):function(e,t,n){var r=t.selection.$head;if(!r.parent.isTextblock)return!1;var i=r.parentOffset,o=!i,a=i==r.parent.content.size,s=e.domSelection();return s?uc.test(r.parent.textContent)&&s.modify?lc(e,t,function(){var t=e.domSelectionRange(),i=t.focusNode,o=t.focusOffset,a=t.anchorNode,c=t.anchorOffset,l=s.caretBidiLevel;s.modify("move",n,"character");var u=r.depth?e.docView.domAfterPos(r.before()):e.dom,d=e.domSelectionRange(),h=d.focusNode,f=d.focusOffset,p=h&&!u.contains(1==h.nodeType?h:h.parentNode)||i==h&&o==f;try{s.collapse(a,c),i&&(i!=a||o!=c)&&s.extend&&s.extend(i,o)}catch(Tt){}return null!=l&&(s.caretBidiLevel=l),p}):"left"==n||"backward"==n?o:a:r.pos==r.start()||r.pos==r.end()}(e,t,n))}var vc=function(){return S(function e(t,n,r,i){x(this,e),this.parent=t,this.children=n,this.dom=r,this.contentDOM=i,this.dirty=0,r.pmViewDesc=this},[{key:"matchesWidget",value:function(e){return!1}},{key:"matchesMark",value:function(e){return!1}},{key:"matchesNode",value:function(e,t,n){return!1}},{key:"matchesHack",value:function(e){return!1}},{key:"parseRule",value:function(){return null}},{key:"stopEvent",value:function(e){return!1}},{key:"size",get:function(){for(var e=0,t=0;t<this.children.length;t++)e+=this.children[t].size;return e}},{key:"border",get:function(){return 0}},{key:"destroy",value:function(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(var e=0;e<this.children.length;e++)this.children[e].destroy()}},{key:"posBeforeChild",value:function(e){for(var t=0,n=this.posAtStart;;t++){var r=this.children[t];if(r==e)return n;n+=r.size}}},{key:"posBefore",get:function(){return this.parent.posBeforeChild(this)}},{key:"posAtStart",get:function(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}},{key:"posAfter",get:function(){return this.posBefore+this.size}},{key:"posAtEnd",get:function(){return this.posAtStart+this.size-2*this.border}},{key:"localPosFromDOM",value:function(e,t,n){if(this.contentDOM&&this.contentDOM.contains(1==e.nodeType?e:e.parentNode)){if(n<0){var r,i;if(e==this.contentDOM)r=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;r=e.previousSibling}for(;r&&(!(i=r.pmViewDesc)||i.parent!=this);)r=r.previousSibling;return r?this.posBeforeChild(i)+i.size:this.posAtStart}var o,a;if(e==this.contentDOM)o=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;o=e.nextSibling}for(;o&&(!(a=o.pmViewDesc)||a.parent!=this);)o=o.nextSibling;return o?this.posBeforeChild(a):this.posAtEnd}var s;if(e==this.dom&&this.contentDOM)s=t>ms(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))s=2&e.compareDocumentPosition(this.contentDOM);else if(this.dom.firstChild){if(0==t)for(var c=e;;c=c.parentNode){if(c==this.dom){s=!1;break}if(c.previousSibling)break}if(null==s&&t==e.childNodes.length)for(var l=e;;l=l.parentNode){if(l==this.dom){s=!0;break}if(l.nextSibling)break}}return(null==s?n>0:s)?this.posAtEnd:this.posAtStart}},{key:"nearestDesc",value:function(e){for(var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=!0,r=e;r;r=r.parentNode){var i=this.getDesc(r),o=void 0;if(i&&(!t||i.node)){if(!n||!(o=i.nodeDOM)||(1==o.nodeType?o.contains(1==e.nodeType?e:e.parentNode):o==e))return i;n=!1}}}},{key:"getDesc",value:function(e){for(var t=e.pmViewDesc,n=t;n;n=n.parent)if(n==this)return t}},{key:"posFromDOM",value:function(e,t,n){for(var r=e;r;r=r.parentNode){var i=this.getDesc(r);if(i)return i.localPosFromDOM(e,t,n)}return-1}},{key:"descAt",value:function(e){for(var t=0,n=0;t<this.children.length;t++){var r=this.children[t],i=n+r.size;if(n==e&&i!=n){for(;!r.border&&r.children.length;)for(var o=0;o<r.children.length;o++){var a=r.children[o];if(a.size){r=a;break}}return r}if(e<i)return r.descAt(e-n-r.border);n=i}}},{key:"domFromPos",value:function(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};for(var n,r=0,i=0,o=0;r<this.children.length;r++){var a=this.children[r],s=o+a.size;if(s>e||a instanceof xc){i=e-o;break}o=s}if(i)return this.children[r].domFromPos(i-this.children[r].border,t);for(;r&&!(n=this.children[r-1]).size&&n instanceof mc&&n.side>=0;r--);if(t<=0){for(var c,l=!0;(c=r?this.children[r-1]:null)&&c.dom.parentNode!=this.contentDOM;r--,l=!1);return c&&t&&l&&!c.border&&!c.domAtom?c.domFromPos(c.size,t):{node:this.contentDOM,offset:c?ms(c.dom)+1:0}}for(var u,d=!0;(u=r<this.children.length?this.children[r]:null)&&u.dom.parentNode!=this.contentDOM;r++,d=!1);return u&&d&&!u.border&&!u.domAtom?u.domFromPos(0,t):{node:this.contentDOM,offset:u?ms(u.dom):this.contentDOM.childNodes.length}}},{key:"parseRange",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(0==this.children.length)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};for(var r=-1,i=-1,o=n,a=0;;a++){var s=this.children[a],c=o+s.size;if(-1==r&&e<=c){var l=o+s.border;if(e>=l&&t<=c-s.border&&s.node&&s.contentDOM&&this.contentDOM.contains(s.contentDOM))return s.parseRange(e,t,l);e=o;for(var u=a;u>0;u--){var d=this.children[u-1];if(d.size&&d.dom.parentNode==this.contentDOM&&!d.emptyChildAt(1)){r=ms(d.dom)+1;break}e-=d.size}-1==r&&(r=0)}if(r>-1&&(c>t||a==this.children.length-1)){t=c;for(var h=a+1;h<this.children.length;h++){var f=this.children[h];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(-1)){i=ms(f.dom);break}t+=f.size}-1==i&&(i=this.contentDOM.childNodes.length);break}o=c}return{node:this.contentDOM,from:e,to:t,fromOffset:r,toOffset:i}}},{key:"emptyChildAt",value:function(e){if(this.border||!this.contentDOM||!this.children.length)return!1;var t=this.children[e<0?0:this.children.length-1];return 0==t.size||t.emptyChildAt(e)}},{key:"domAfterPos",value:function(e){var t=this.domFromPos(e,0),n=t.node,r=t.offset;if(1!=n.nodeType||r==n.childNodes.length)throw new RangeError("No node after pos "+e);return n.childNodes[r]}},{key:"setSelection",value:function(e,t,n){for(var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],i=Math.min(e,t),o=Math.max(e,t),a=0,s=0;a<this.children.length;a++){var c=this.children[a],l=s+c.size;if(i>s&&o<l)return c.setSelection(e-s-c.border,t-s-c.border,n,r);s=l}var u=this.domFromPos(e,e?-1:1),d=t==e?u:this.domFromPos(t,t?-1:1),h=n.root.getSelection(),f=n.domSelectionRange(),p=!1;if((Rs||Vs)&&e==t){var v=u,m=v.node,g=v.offset;if(3==m.nodeType){if((p=!(!g||"\n"!=m.nodeValue[g-1]))&&g==m.nodeValue.length)for(var y,k=m;k;k=k.parentNode){if(y=k.nextSibling){"BR"==y.nodeName&&(u=d={node:y.parentNode,offset:ms(y)+1});break}var w=k.pmViewDesc;if(w&&w.node&&w.node.isBlock)break}}else{var b=m.childNodes[g-1];p=b&&("BR"==b.nodeName||"false"==b.contentEditable)}}if(Rs&&f.focusNode&&f.focusNode!=d.node&&1==f.focusNode.nodeType){var x=f.focusNode.childNodes[f.focusOffset];x&&"false"==x.contentEditable&&(r=!0)}if(r||p&&Vs||!ws(u.node,u.offset,f.anchorNode,f.anchorOffset)||!ws(d.node,d.offset,f.focusNode,f.focusOffset)){var C=!1;if((h.extend||e==t)&&(!p||!Rs)){h.collapse(u.node,u.offset);try{e!=t&&h.extend(d.node,d.offset),C=!0}catch(Tt){}}if(!C){if(e>t){var S=u;u=d,d=S}var _=document.createRange();_.setEnd(d.node,d.offset),_.setStart(u.node,u.offset),h.removeAllRanges(),h.addRange(_)}}}},{key:"ignoreMutation",value:function(e){return!this.contentDOM&&"selection"!=e.type}},{key:"contentLost",get:function(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}},{key:"markDirty",value:function(e,t){for(var n=0,r=0;r<this.children.length;r++){var i=this.children[r],o=n+i.size;if(n==o?e<=o&&t>=n:e<o&&t>n){var a=n+i.border,s=o-i.border;if(e>=a&&t<=s)return this.dirty=e==n||t==o?2:1,void(e!=a||t!=s||!i.contentLost&&i.dom.parentNode==this.contentDOM?i.markDirty(e-a,t-a):i.dirty=3);i.dirty=i.dom!=i.contentDOM||i.dom.parentNode!=this.contentDOM||i.children.length?3:2}n=o}this.dirty=2}},{key:"markParentsDirty",value:function(){for(var e=1,t=this.parent;t;t=t.parent,e++){var n=1==e?2:1;t.dirty<n&&(t.dirty=n)}}},{key:"domAtom",get:function(){return!1}},{key:"ignoreForCoords",get:function(){return!1}},{key:"ignoreForSelection",get:function(){return!1}},{key:"isText",value:function(e){return!1}}])}(),mc=function(t){function n(e,t,i,o){var a;x(this,n);var s,c=t.type.toDOM;if("function"==typeof c&&(c=c(i,function(){return s?s.parent?s.parent.posBeforeChild(s):void 0:o})),!t.type.spec.raw){if(1!=c.nodeType){var l=document.createElement("span");l.appendChild(c),c=l}c.contentEditable="false",c.classList.add("ProseMirror-widget")}return(a=r(this,n,[e,[],c,null])).widget=t,a.widget=t,s=a,a}return a(n,t),S(n,[{key:"matchesWidget",value:function(e){return 0==this.dirty&&e.type.eq(this.widget.type)}},{key:"parseRule",value:function(){return{ignore:!0}}},{key:"stopEvent",value:function(e){var t=this.widget.spec.stopEvent;return!!t&&t(e)}},{key:"ignoreMutation",value:function(e){return"selection"!=e.type||this.widget.spec.ignoreSelection}},{key:"destroy",value:function(){this.widget.type.destroy(this.dom),e(n,"destroy",this,3)([])}},{key:"domAtom",get:function(){return!0}},{key:"ignoreForSelection",get:function(){return!!this.widget.type.spec.relaxedSide}},{key:"side",get:function(){return this.widget.type.side}}])}(vc),gc=function(e){function t(e,n,i,o){var a;return x(this,t),(a=r(this,t,[e,[],n,null])).textDOM=i,a.text=o,a}return a(t,e),S(t,[{key:"size",get:function(){return this.text.length}},{key:"localPosFromDOM",value:function(e,t){return e!=this.textDOM?this.posAtStart+(t?this.size:0):this.posAtStart+t}},{key:"domFromPos",value:function(e){return{node:this.textDOM,offset:e}}},{key:"ignoreMutation",value:function(e){return"characterData"===e.type&&e.target.nodeValue==e.oldValue}}])}(vc),yc=function(t){function n(e,t,i,o,a){var s;return x(this,n),(s=r(this,n,[e,[],i,o])).mark=t,s.spec=a,s}return a(n,t),S(n,[{key:"parseRule",value:function(){return 3&this.dirty||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}},{key:"matchesMark",value:function(e){return 3!=this.dirty&&this.mark.eq(e)}},{key:"markDirty",value:function(t,r){if(e(n,"markDirty",this,3)([t,r]),0!=this.dirty){for(var i=this.parent;!i.node;)i=i.parent;i.dirty<this.dirty&&(i.dirty=this.dirty),this.dirty=0}}},{key:"slice",value:function(e,t,r){var i=n.create(this.parent,this.mark,!0,r),o=this.children,a=this.size;t<a&&(o=Rc(o,t,a,r)),e>0&&(o=Rc(o,0,e,r));for(var s=0;s<o.length;s++)o[s].parent=i;return i.children=o,i}},{key:"ignoreMutation",value:function(t){return this.spec.ignoreMutation?this.spec.ignoreMutation(t):e(n,"ignoreMutation",this,3)([t])}},{key:"destroy",value:function(){this.spec.destroy&&this.spec.destroy(),e(n,"destroy",this,3)([])}}],[{key:"create",value:function(e,t,r,i){var o=i.nodeViews[t.type.name],a=o&&o(t,i,r);return a&&a.dom||(a=Ro.renderSpec(document,t.type.spec.toDOM(t,r),null,t.attrs)),new n(e,t,a.dom,a.contentDOM||a.dom,a)}}])}(vc),kc=function(e){function t(e,n,i,o,a,s,c,l,u){var d;return x(this,t),(d=r(this,t,[e,[],a,s])).node=n,d.outerDeco=i,d.innerDeco=o,d.nodeDOM=c,d}return a(t,e),S(t,[{key:"parseRule",value:function(){var e=this;if(this.node.type.spec.reparseInView)return null;var t={node:this.node.type.name,attrs:this.node.attrs};if("pre"==this.node.type.whitespace&&(t.preserveWhitespace="full"),this.contentDOM)if(this.contentLost){for(var n=this.children.length-1;n>=0;n--){var r=this.children[n];if(this.dom.contains(r.dom.parentNode)){t.contentElement=r.dom.parentNode;break}}t.contentElement||(t.getContent=function(){return Di.empty})}else t.contentElement=this.contentDOM;else t.getContent=function(){return e.node.content};return t}},{key:"matchesNode",value:function(e,t,n){return 0==this.dirty&&e.eq(this.node)&&Ac(t,this.outerDeco)&&n.eq(this.innerDeco)}},{key:"size",get:function(){return this.node.nodeSize}},{key:"border",get:function(){return this.node.isLeaf?0:1}},{key:"updateChildren",value:function(e,t){var n=this,r=this.node.inlineContent,i=t,o=e.composing?this.localCompositionInfo(e,t):null,a=o&&o.pos>-1?o:null,s=o&&o.pos<0,c=new Ic(this,a&&a.node,e);!function(e,t,n,r){var i=t.locals(e),o=0;if(0==i.length){for(var a=0;a<e.childCount;a++){var s=e.child(a);r(s,i,t.forChild(o,s),a),o+=s.nodeSize}return}for(var c=0,l=[],u=null,d=0;;){for(var h=void 0,f=void 0;c<i.length&&i[c].to==o;){var p=i[c++];p.widget&&(h?(f||(f=[h])).push(p):h=p)}if(h)if(f){f.sort(zc);for(var v=0;v<f.length;v++)n(f[v],d,!!u)}else n(h,d,!!u);var m=void 0,g=void 0;if(u)g=-1,m=u,u=null;else{if(!(d<e.childCount))break;g=d,m=e.child(d++)}for(var y=0;y<l.length;y++)l[y].to<=o&&l.splice(y--,1);for(;c<i.length&&i[c].from<=o&&i[c].to>o;)l.push(i[c++]);var k=o+m.nodeSize;if(m.isText){var w=k;c<i.length&&i[c].from<w&&(w=i[c].from);for(var b=0;b<l.length;b++)l[b].to<w&&(w=l[b].to);w<k&&(u=m.cut(w-o),m=m.cut(0,w-o),k=w,g=-1)}else for(;c<i.length&&i[c].to<k;)c++;var x=m.isInline&&!m.isLeaf?l.filter(function(e){return!e.inline}):l.slice();r(m,x,t.forChild(o,m),g),o=k}}(this.node,this.innerDeco,function(t,o,a){t.spec.marks?c.syncToMarks(t.spec.marks,r,e):t.type.side>=0&&!a&&c.syncToMarks(o==n.node.childCount?Pi.none:n.node.child(o).marks,r,e),c.placeWidget(t,e,i)},function(t,n,a,l){var u;c.syncToMarks(t.marks,r,e),c.findNodeMatch(t,n,a,l)||s&&e.state.selection.from>i&&e.state.selection.to<i+t.nodeSize&&(u=c.findIndexWithChild(o.node))>-1&&c.updateNodeAt(t,n,a,u,e)||c.updateNextNode(t,n,a,e,l,i)||c.addNode(t,n,a,e,i),i+=t.nodeSize}),c.syncToMarks([],r,e),this.node.isTextblock&&c.addTextblockHacks(),c.destroyRest(),(c.changed||2==this.dirty)&&(a&&this.protectLocalComposition(e,a),Sc(this.contentDOM,this.children,e),Fs&&function(e){if("UL"==e.nodeName||"OL"==e.nodeName){var t=e.style.cssText;e.style.cssText=t+"; list-style: square !important",window.getComputedStyle(e).listStyle,e.style.cssText=t}}(this.dom))}},{key:"localCompositionInfo",value:function(e,t){var n=e.state.selection,r=n.from,i=n.to;if(!(e.state.selection instanceof Pa)||r<t||i>t+this.node.content.size)return null;var o=e.input.compositionNode;if(!o||!this.dom.contains(o.parentNode))return null;if(this.node.inlineContent){var a=o.nodeValue,s=function(e,t,n,r){for(var i=0,o=0;i<e.childCount&&o<=r;){var a=e.child(i++),s=o;if(o+=a.nodeSize,a.isText){for(var c=a.text;i<e.childCount;){var l=e.child(i++);if(o+=l.nodeSize,!l.isText)break;c+=l.text}if(o>=n){if(o>=r&&c.slice(r-t.length-s,r-s)==t)return r-t.length;var u=s<r?c.lastIndexOf(t,r-s-1):-1;if(u>=0&&u+t.length+s>=n)return s+u;if(n==r&&c.length>=r+t.length-s&&c.slice(r-s,r-s+t.length)==t)return r}}}return-1}(this.node.content,a,r-t,i-t);return s<0?null:{node:o,pos:s,text:a}}return{node:o,pos:-1,text:""}}},{key:"protectLocalComposition",value:function(e,t){var n=t.node,r=t.pos,i=t.text;if(!this.getDesc(n)){for(var o=n;o.parentNode!=this.contentDOM;o=o.parentNode){for(;o.previousSibling;)o.parentNode.removeChild(o.previousSibling);for(;o.nextSibling;)o.parentNode.removeChild(o.nextSibling);o.pmViewDesc&&(o.pmViewDesc=void 0)}var a=new gc(this,o,n,i);e.input.compositionNodes.push(a),this.children=Rc(this.children,r,r+i.length,e,a)}}},{key:"update",value:function(e,t,n,r){return!(3==this.dirty||!e.sameMarkup(this.node))&&(this.updateInner(e,t,n,r),!0)}},{key:"updateInner",value:function(e,t,n,r){this.updateOuterDeco(t),this.node=e,this.innerDeco=n,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=0}},{key:"updateOuterDeco",value:function(e){if(!Ac(e,this.outerDeco)){var t=1!=this.nodeDOM.nodeType,n=this.dom;this.dom=Tc(this.dom,this.nodeDOM,Nc(this.outerDeco,this.node,t),Nc(e,this.node,t)),this.dom!=n&&(n.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}}},{key:"selectNode",value:function(){1==this.nodeDOM.nodeType&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||(this.nodeDOM.draggable=!0))}},{key:"deselectNode",value:function(){1==this.nodeDOM.nodeType&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||this.nodeDOM.removeAttribute("draggable"))}},{key:"domAtom",get:function(){return this.node.isAtom}}],[{key:"create",value:function(e,n,r,i,o,a){var s,c=o.nodeViews[n.type.name],l=c&&c(n,o,function(){return s?s.parent?s.parent.posBeforeChild(s):void 0:a},r,i),u=l&&l.dom,d=l&&l.contentDOM;if(n.isText)if(u){if(3!=u.nodeType)throw new RangeError("Text must be rendered as a DOM text node")}else u=document.createTextNode(n.text);else if(!u){var h=Ro.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs);u=h.dom,d=h.contentDOM}d||n.isText||"BR"==u.nodeName||(u.hasAttribute("contenteditable")||(u.contentEditable="false"),n.type.spec.draggable&&(u.draggable=!0));var f=u;return u=Ec(u,r,n),l?s=new Cc(e,n,r,i,u,d||null,f,l,o,a+1):n.isText?new bc(e,n,r,i,u,f,o):new t(e,n,r,i,u,d||null,f,o,a+1)}}])}(vc);function wc(e,t,n,r,i){Ec(r,t,e);var o=new kc(void 0,e,t,n,r,r,r,i,0);return o.contentDOM&&o.updateChildren(i,0),o}var bc=function(t){function n(e,t,i,o,a,s,c){return x(this,n),r(this,n,[e,t,i,o,a,null,s,c,0])}return a(n,t),S(n,[{key:"parseRule",value:function(){for(var e=this.nodeDOM.parentNode;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}},{key:"update",value:function(e,t,n,r){return!(3==this.dirty||0!=this.dirty&&!this.inParent()||!e.sameMarkup(this.node))&&(this.updateOuterDeco(t),0==this.dirty&&e.text==this.node.text||e.text==this.nodeDOM.nodeValue||(this.nodeDOM.nodeValue=e.text,r.trackWrites==this.nodeDOM&&(r.trackWrites=null)),this.node=e,this.dirty=0,!0)}},{key:"inParent",value:function(){for(var e=this.parent.contentDOM,t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}},{key:"domFromPos",value:function(e){return{node:this.nodeDOM,offset:e}}},{key:"localPosFromDOM",value:function(t,r,i){return t==this.nodeDOM?this.posAtStart+Math.min(r,this.node.text.length):e(n,"localPosFromDOM",this,3)([t,r,i])}},{key:"ignoreMutation",value:function(e){return"characterData"!=e.type&&"selection"!=e.type}},{key:"slice",value:function(e,t,r){var i=this.node.cut(e,t),o=document.createTextNode(i.text);return new n(this.parent,i,this.outerDeco,this.innerDeco,o,o,r)}},{key:"markDirty",value:function(t,r){e(n,"markDirty",this,3)([t,r]),this.dom==this.nodeDOM||0!=t&&r!=this.nodeDOM.nodeValue.length||(this.dirty=3)}},{key:"domAtom",get:function(){return!1}},{key:"isText",value:function(e){return this.node.text==e}}])}(kc),xc=function(e){function t(){return x(this,t),r(this,t,arguments)}return a(t,e),S(t,[{key:"parseRule",value:function(){return{ignore:!0}}},{key:"matchesHack",value:function(e){return 0==this.dirty&&this.dom.nodeName==e}},{key:"domAtom",get:function(){return!0}},{key:"ignoreForCoords",get:function(){return"IMG"==this.dom.nodeName}}])}(vc),Cc=function(t){function n(e,t,i,o,a,s,c,l,u,d){var h;return x(this,n),(h=r(this,n,[e,t,i,o,a,s,c,u,d])).spec=l,h}return a(n,t),S(n,[{key:"update",value:function(t,r,i,o){if(3==this.dirty)return!1;if(this.spec.update&&(this.node.type==t.type||this.spec.multiType)){var a=this.spec.update(t,r,i);return a&&this.updateInner(t,r,i,o),a}return!(!this.contentDOM&&!t.isLeaf)&&e(n,"update",this,3)([t,r,i,o])}},{key:"selectNode",value:function(){this.spec.selectNode?this.spec.selectNode():e(n,"selectNode",this,3)([])}},{key:"deselectNode",value:function(){this.spec.deselectNode?this.spec.deselectNode():e(n,"deselectNode",this,3)([])}},{key:"setSelection",value:function(t,r,i,o){this.spec.setSelection?this.spec.setSelection(t,r,i.root):e(n,"setSelection",this,3)([t,r,i,o])}},{key:"destroy",value:function(){this.spec.destroy&&this.spec.destroy(),e(n,"destroy",this,3)([])}},{key:"stopEvent",value:function(e){return!!this.spec.stopEvent&&this.spec.stopEvent(e)}},{key:"ignoreMutation",value:function(t){return this.spec.ignoreMutation?this.spec.ignoreMutation(t):e(n,"ignoreMutation",this,3)([t])}}])}(kc);function Sc(e,t,n){for(var r=e.firstChild,i=!1,o=0;o<t.length;o++){var a=t[o],s=a.dom;if(s.parentNode==e){for(;s!=r;)r=Dc(r),i=!0;r=r.nextSibling}else i=!0,e.insertBefore(s,r);if(a instanceof yc){var c=r?r.previousSibling:e.lastChild;Sc(a.contentDOM,a.children,n),r=c?c.nextSibling:e.firstChild}}for(;r;)r=Dc(r),i=!0;i&&n.trackWrites==e&&(n.trackWrites=null)}var _c=function(e){e&&(this.nodeName=e)};_c.prototype=Object.create(null);var Mc=[new _c];function Nc(e,t,n){if(0==e.length)return Mc;for(var r=n?Mc[0]:new _c,i=[r],o=0;o<e.length;o++){var a=e[o].type.attrs;if(a)for(var s in a.nodeName&&i.push(r=new _c(a.nodeName)),a){var c=a[s];null!=c&&(n&&1==i.length&&i.push(r=new _c(t.isInline?"span":"div")),"class"==s?r.class=(r.class?r.class+" ":"")+c:"style"==s?r.style=(r.style?r.style+";":"")+c:"nodeName"!=s&&(r[s]=c))}}return i}function Tc(e,t,n,r){if(n==Mc&&r==Mc)return t;for(var i=t,o=0;o<r.length;o++){var a=r[o],s=n[o];if(o){var c=void 0;s&&s.nodeName==a.nodeName&&i!=e&&(c=i.parentNode)&&c.nodeName.toLowerCase()==a.nodeName||((c=document.createElement(a.nodeName)).pmIsDeco=!0,c.appendChild(i),s=Mc[0]),i=c}Oc(i,s||Mc[0],a)}return i}function Oc(e,t,n){for(var r in t)"class"==r||"style"==r||"nodeName"==r||r in n||e.removeAttribute(r);for(var i in n)"class"!=i&&"style"!=i&&"nodeName"!=i&&n[i]!=t[i]&&e.setAttribute(i,n[i]);if(t.class!=n.class){for(var o=t.class?t.class.split(" ").filter(Boolean):[],a=n.class?n.class.split(" ").filter(Boolean):[],s=0;s<o.length;s++)-1==a.indexOf(o[s])&&e.classList.remove(o[s]);for(var c=0;c<a.length;c++)-1==o.indexOf(a[c])&&e.classList.add(a[c]);0==e.classList.length&&e.removeAttribute("class")}if(t.style!=n.style){if(t.style)for(var l,u=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g;l=u.exec(t.style);)e.style.removeProperty(l[1]);n.style&&(e.style.cssText+=n.style)}}function Ec(e,t,n){return Tc(e,e,Mc,Nc(t,n,1!=e.nodeType))}function Ac(e,t){if(e.length!=t.length)return!1;for(var n=0;n<e.length;n++)if(!e[n].type.eq(t[n].type))return!1;return!0}function Dc(e){var t=e.nextSibling;return e.parentNode.removeChild(e),t}var Ic=function(){return S(function e(t,n,r){x(this,e),this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=t,this.preMatch=function(e,t){var n=t,r=n.children.length,i=e.childCount,o=new Map,a=[];e:for(;i>0;){for(var s=void 0;;)if(r){var c=n.children[r-1];if(!(c instanceof yc)){s=c,r--;break}n=c,r=c.children.length}else{if(n==t)break e;r=n.parent.children.indexOf(n),n=n.parent}var l=s.node;if(l){if(l!=e.child(i-1))break;--i,o.set(s,i),a.push(s)}}return{index:i,matched:o,matches:a.reverse()}}(t.node.content,t)},[{key:"destroyBetween",value:function(e,t){if(e!=t){for(var n=e;n<t;n++)this.top.children[n].destroy();this.top.children.splice(e,t-e),this.changed=!0}}},{key:"destroyRest",value:function(){this.destroyBetween(this.index,this.top.children.length)}},{key:"syncToMarks",value:function(e,t,n){for(var r=0,i=this.stack.length>>1,o=Math.min(i,e.length);r<o&&(r==i-1?this.top:this.stack[r+1<<1]).matchesMark(e[r])&&!1!==e[r].type.spec.spanning;)r++;for(;r<i;)this.destroyRest(),this.top.dirty=0,this.index=this.stack.pop(),this.top=this.stack.pop(),i--;for(;i<e.length;){this.stack.push(this.top,this.index+1);for(var a=-1,s=this.index;s<Math.min(this.index+3,this.top.children.length);s++){var c=this.top.children[s];if(c.matchesMark(e[i])&&!this.isLocked(c.dom)){a=s;break}}if(a>-1)a>this.index&&(this.changed=!0,this.destroyBetween(this.index,a)),this.top=this.top.children[this.index];else{var l=yc.create(this.top,e[i],t,n);this.top.children.splice(this.index,0,l),this.top=l,this.changed=!0}this.index=0,i++}}},{key:"findNodeMatch",value:function(e,t,n,r){var i,o=-1;if(r>=this.preMatch.index&&(i=this.preMatch.matches[r-this.preMatch.index]).parent==this.top&&i.matchesNode(e,t,n))o=this.top.children.indexOf(i,this.index);else for(var a=this.index,s=Math.min(this.top.children.length,a+5);a<s;a++){var c=this.top.children[a];if(c.matchesNode(e,t,n)&&!this.preMatch.matched.has(c)){o=a;break}}return!(o<0)&&(this.destroyBetween(this.index,o),this.index++,!0)}},{key:"updateNodeAt",value:function(e,t,n,r,i){var o=this.top.children[r];return 3==o.dirty&&o.dom==o.contentDOM&&(o.dirty=2),!!o.update(e,t,n,i)&&(this.destroyBetween(this.index,r),this.index++,!0)}},{key:"findIndexWithChild",value:function(e){for(;;){var t=e.parentNode;if(!t)return-1;if(t==this.top.contentDOM){var n=e.pmViewDesc;if(n)for(var r=this.index;r<this.top.children.length;r++)if(this.top.children[r]==n)return r;return-1}e=t}}},{key:"updateNextNode",value:function(e,t,n,r,i,o){for(var a=this.index;a<this.top.children.length;a++){var s=this.top.children[a];if(s instanceof kc){var c=this.preMatch.matched.get(s);if(null!=c&&c!=i)return!1;var l=s.dom,u=void 0,d=this.isLocked(l)&&!(e.isText&&s.node&&s.node.isText&&s.nodeDOM.nodeValue==e.text&&3!=s.dirty&&Ac(t,s.outerDeco));if(!d&&s.update(e,t,n,r))return this.destroyBetween(this.index,a),s.dom!=l&&(this.changed=!0),this.index++,!0;if(!d&&(u=this.recreateWrapper(s,e,t,n,r,o)))return this.destroyBetween(this.index,a),this.top.children[this.index]=u,u.contentDOM&&(u.dirty=2,u.updateChildren(r,o+1),u.dirty=0),this.changed=!0,this.index++,!0;break}}return!1}},{key:"recreateWrapper",value:function(e,t,n,r,i,o){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!Ac(n,e.outerDeco)||!r.eq(e.innerDeco))return null;var a=kc.create(this.top,t,n,r,i,o);if(a.contentDOM){a.children=e.children,e.children=[];var s,c=u(a.children);try{for(c.s();!(s=c.n()).done;){s.value.parent=a}}catch(l){c.e(l)}finally{c.f()}}return e.destroy(),a}},{key:"addNode",value:function(e,t,n,r,i){var o=kc.create(this.top,e,t,n,r,i);o.contentDOM&&o.updateChildren(r,i+1),this.top.children.splice(this.index++,0,o),this.changed=!0}},{key:"placeWidget",value:function(e,t,n){var r=this.index<this.top.children.length?this.top.children[this.index]:null;if(!r||!r.matchesWidget(e)||e!=r.widget&&r.widget.type.toDOM.parentNode){var i=new mc(this.top,e,t,n);this.top.children.splice(this.index++,0,i),this.changed=!0}else this.index++}},{key:"addTextblockHacks",value:function(){for(var e=this.top.children[this.index-1],t=this.top;e instanceof yc;)e=(t=e).children[t.children.length-1];(!e||!(e instanceof bc)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((Vs||Ls)&&e&&"false"==e.dom.contentEditable&&this.addHackNode("IMG",t),this.addHackNode("BR",this.top))}},{key:"addHackNode",value:function(e,t){if(t==this.top&&this.index<t.children.length&&t.children[this.index].matchesHack(e))this.index++;else{var n=document.createElement(e);"IMG"==e&&(n.className="ProseMirror-separator",n.alt=""),"BR"==e&&(n.className="ProseMirror-trailingBreak");var r=new xc(this.top,[],n,null);t!=this.top?t.children.push(r):t.children.splice(this.index++,0,r),this.changed=!0}}},{key:"isLocked",value:function(e){return this.lock&&(e==this.lock||1==e.nodeType&&e.contains(this.lock.parentNode))}}])}();function zc(e,t){return e.type.side-t.type.side}function Rc(e,t,n,r,i){for(var o=[],a=0,s=0;a<e.length;a++){var c=e[a],l=s,u=s+=c.size;l>=n||u<=t?o.push(c):(l<t&&o.push(c.slice(0,t-l,r)),i&&(o.push(i),i=void 0),u>n&&o.push(c.slice(n-l,c.size,r)))}return o}function Pc(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=e.domSelectionRange(),r=e.state.doc;if(!n.focusNode)return null;var i=e.docView.nearestDesc(n.focusNode),o=i&&0==i.size,a=e.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(a<0)return null;var s,c,l=r.resolve(a);if(_s(n)){for(s=a;i&&!i.node;)i=i.parent;var u=i.node;if(i&&u.isAtom&&Ba.isSelectable(u)&&i.parent&&(!u.isInline||!function(e,t,n){for(var r=0==t,i=t==Cs(e);r||i;){if(e==n)return!0;var o=ms(e);if(!(e=e.parentNode))return!1;r=r&&0==o,i=i&&o==Cs(e)}}(n.focusNode,n.focusOffset,i.dom))){var d=i.posBefore;c=new Ba(a==d?l:r.resolve(d))}}else{if(n instanceof e.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){for(var h=a,f=a,p=0;p<n.rangeCount;p++){var v=n.getRangeAt(p);h=Math.min(h,e.docView.posFromDOM(v.startContainer,v.startOffset,1)),f=Math.max(f,e.docView.posFromDOM(v.endContainer,v.endOffset,-1))}if(h<0)return null;var m=g(f==e.state.selection.anchor?[f,h]:[h,f],2);s=m[0],a=m[1],l=r.resolve(a)}else s=e.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(s<0)return null}var y=r.resolve(s);c||(c=qc(e,y,l,"pointer"==t||e.state.selection.head<l.pos&&!o?1:-1));return c}function Lc(e){return e.editable?e.hasFocus():Kc(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function Bc(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=e.state.selection;if(Hc(e,n),Lc(e)){if(!t&&e.input.mouseDown&&e.input.mouseDown.allowDefault&&Ls){var r=e.domSelectionRange(),i=e.domObserver.currentSelection;if(r.anchorNode&&i.anchorNode&&ws(r.anchorNode,r.anchorOffset,i.anchorNode,i.anchorOffset))return e.input.mouseDown.delayedSelectionSync=!0,void e.domObserver.setCurSelection()}if(e.domObserver.disconnectSelection(),e.cursorWrapper)!function(e){var t=e.domSelection();if(!t)return;var n=e.cursorWrapper.dom,r="IMG"==n.nodeName;r?t.collapse(n.parentNode,ms(n)+1):t.collapse(n,0);!r&&!e.state.selection.visible&&Is&&zs<=11&&(n.disabled=!0,n.disabled=!1)}(e);else{var o,a,s=n.anchor,c=n.head;!Vc||n instanceof Pa||(n.$from.parent.inlineContent||(o=Fc(e,n.from)),n.empty||n.$from.parent.inlineContent||(a=Fc(e,n.to))),e.docView.setSelection(s,c,e,t),Vc&&(o&&$c(o),a&&$c(a)),n.visible?e.dom.classList.remove("ProseMirror-hideselection"):(e.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&function(e){var t=e.dom.ownerDocument;t.removeEventListener("selectionchange",e.input.hideSelectionGuard);var n=e.domSelectionRange(),r=n.anchorNode,i=n.anchorOffset;t.addEventListener("selectionchange",e.input.hideSelectionGuard=function(){n.anchorNode==r&&n.anchorOffset==i||(t.removeEventListener("selectionchange",e.input.hideSelectionGuard),setTimeout(function(){Lc(e)&&!e.state.selection.visible||e.dom.classList.remove("ProseMirror-hideselection")},20))})}(e))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}}var Vc=Vs||Ls&&Bs<63;function Fc(e,t){var n=e.docView.domFromPos(t,0),r=n.node,i=n.offset,o=i<r.childNodes.length?r.childNodes[i]:null,a=i?r.childNodes[i-1]:null;if(Vs&&o&&"false"==o.contentEditable)return jc(o);if(!(o&&"false"!=o.contentEditable||a&&"false"!=a.contentEditable)){if(o)return jc(o);if(a)return jc(a)}}function jc(e){return e.contentEditable="true",Vs&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function $c(e){e.contentEditable="false",e.wasDraggable&&(e.draggable=!0,e.wasDraggable=null)}function Hc(e,t){if(t instanceof Ba){var n=e.docView.descAt(t.from);n!=e.lastSelectedViewDesc&&(Wc(e),n&&n.selectNode(),e.lastSelectedViewDesc=n)}else Wc(e)}function Wc(e){e.lastSelectedViewDesc&&(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),e.lastSelectedViewDesc=void 0)}function qc(e,t,n,r){return e.someProp("createSelectionBetween",function(r){return r(e,t,n)})||Pa.between(t,n,r)}function Uc(e){return!(e.editable&&!e.hasFocus())&&Kc(e)}function Kc(e){var t=e.domSelectionRange();if(!t.anchorNode)return!1;try{return e.dom.contains(3==t.anchorNode.nodeType?t.anchorNode.parentNode:t.anchorNode)&&(e.editable||e.dom.contains(3==t.focusNode.nodeType?t.focusNode.parentNode:t.focusNode))}catch(Tt){return!1}}function Jc(e,t){var n=e.selection,r=n.$anchor,i=n.$head,o=t>0?r.max(i):r.min(i),a=o.parent.inlineContent?o.depth?e.doc.resolve(t>0?o.after():o.before()):null:o;return a&&Da.findFrom(a,t)}function Gc(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function Xc(e,t,n){var r=e.state.selection;if(!(r instanceof Pa)){if(r instanceof Ba&&r.node.isInline)return Gc(e,new Pa(t>0?r.$to:r.$from));var i=Jc(e.state,t);return!!i&&Gc(e,i)}if(n.indexOf("s")>-1){var o=r.$head,a=o.textOffset?null:t<0?o.nodeBefore:o.nodeAfter;if(!a||a.isText||!a.isLeaf)return!1;var s=e.state.doc.resolve(o.pos+a.nodeSize*(t<0?-1:1));return Gc(e,new Pa(r.$anchor,s))}if(!r.empty)return!1;if(e.endOfTextblock(t>0?"forward":"backward")){var c=Jc(e.state,t);return!!(c&&c instanceof Ba)&&Gc(e,c)}if(!(js&&n.indexOf("m")>-1)){var l,u=r.$head,d=u.textOffset?null:t<0?u.nodeBefore:u.nodeAfter;if(!d||d.isText)return!1;var h=t<0?u.pos-d.nodeSize:u.pos;return!!(d.isAtom||(l=e.docView.descAt(h))&&!l.contentDOM)&&(Ba.isSelectable(d)?Gc(e,new Ba(t<0?e.state.doc.resolve(u.pos-d.nodeSize):u)):!!Ws&&Gc(e,new Pa(e.state.doc.resolve(t<0?h:h+d.nodeSize))))}}function Yc(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function Zc(e,t){var n=e.pmViewDesc;return n&&0==n.size&&(t<0||e.nextSibling||"BR"!=e.nodeName)}function Qc(e,t){return t<0?function(e){var t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;var i,o,a=!1;Rs&&1==n.nodeType&&r<Yc(n)&&Zc(n.childNodes[r],-1)&&(a=!0);for(;;)if(r>0){if(1!=n.nodeType)break;var s=n.childNodes[r-1];if(Zc(s,-1))i=n,o=--r;else{if(3!=s.nodeType)break;r=(n=s).nodeValue.length}}else{if(el(n))break;for(var c=n.previousSibling;c&&Zc(c,-1);)i=n.parentNode,o=ms(c),c=c.previousSibling;if(c)r=Yc(n=c);else{if((n=n.parentNode)==e.dom)break;r=0}}a?tl(e,n,r):i&&tl(e,i,o)}(e):function(e){var t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;for(var i,o,a=Yc(n);;)if(r<a){if(1!=n.nodeType)break;if(!Zc(n.childNodes[r],1))break;i=n,o=++r}else{if(el(n))break;for(var s=n.nextSibling;s&&Zc(s,1);)i=s.parentNode,o=ms(s)+1,s=s.nextSibling;if(s)r=0,a=Yc(n=s);else{if((n=n.parentNode)==e.dom)break;r=a=0}}i&&tl(e,i,o)}(e)}function el(e){var t=e.pmViewDesc;return t&&t.node&&t.node.isBlock}function tl(e,t,n){var r,i;3!=t.nodeType&&((i=function(e,t){for(;e&&t==e.childNodes.length&&!Ss(e);)t=ms(e)+1,e=e.parentNode;for(;e&&t<e.childNodes.length;){var n=e.childNodes[t];if(3==n.nodeType)return n;if(1==n.nodeType&&"false"==n.contentEditable)break;e=n,t=0}}(t,n))?(t=i,n=0):(r=function(e,t){for(;e&&!t&&!Ss(e);)t=ms(e),e=e.parentNode;for(;e&&t;){var n=e.childNodes[t-1];if(3==n.nodeType)return n;if(1==n.nodeType&&"false"==n.contentEditable)break;t=(e=n).childNodes.length}}(t,n))&&(t=r,n=r.nodeValue.length));var o=e.domSelection();if(o){if(_s(o)){var a=document.createRange();a.setEnd(t,n),a.setStart(t,n),o.removeAllRanges(),o.addRange(a)}else o.extend&&o.extend(t,n);e.domObserver.setCurSelection();var s=e.state;setTimeout(function(){e.state==s&&Bc(e)},50)}}function nl(e,t){var n=e.state.doc.resolve(t);if(!Ls&&!$s&&n.parent.inlineContent){var r=e.coordsAtPos(t);if(t>n.start()){var i=e.coordsAtPos(t-1),o=(i.top+i.bottom)/2;if(o>r.top&&o<r.bottom&&Math.abs(i.left-r.left)>1)return i.left<r.left?"ltr":"rtl"}if(t<n.end()){var a=e.coordsAtPos(t+1),s=(a.top+a.bottom)/2;if(s>r.top&&s<r.bottom&&Math.abs(a.left-r.left)>1)return a.left>r.left?"ltr":"rtl"}}return"rtl"==getComputedStyle(e.dom).direction?"rtl":"ltr"}function rl(e,t,n){var r=e.state.selection;if(r instanceof Pa&&!r.empty||n.indexOf("s")>-1)return!1;if(js&&n.indexOf("m")>-1)return!1;var i=r.$from,o=r.$to;if(!i.parent.inlineContent||e.endOfTextblock(t<0?"up":"down")){var a=Jc(e.state,t);if(a&&a instanceof Ba)return Gc(e,a)}if(!i.parent.inlineContent){var s=t<0?i:o,c=r instanceof Fa?Da.near(s,t):Da.findFrom(s,t);return!!c&&Gc(e,c)}return!1}function il(e,t){if(!(e.state.selection instanceof Pa))return!0;var n=e.state.selection,r=n.$head,i=n.$anchor,o=n.empty;if(!r.sameParent(i))return!0;if(!o)return!1;if(e.endOfTextblock(t>0?"forward":"backward"))return!0;var a=!r.textOffset&&(t<0?r.nodeBefore:r.nodeAfter);if(a&&!a.isText){var s=e.state.tr;return t<0?s.delete(r.pos-a.nodeSize,r.pos):s.delete(r.pos,r.pos+a.nodeSize),e.dispatch(s),!0}return!1}function ol(e,t,n){e.domObserver.stop(),t.contentEditable=n,e.domObserver.start()}function al(e,t){var n=t.keyCode,r=function(e){var t="";return e.ctrlKey&&(t+="c"),e.metaKey&&(t+="m"),e.altKey&&(t+="a"),e.shiftKey&&(t+="s"),t}(t);if(8==n||js&&72==n&&"c"==r)return il(e,-1)||Qc(e,-1);if(46==n&&!t.shiftKey||js&&68==n&&"c"==r)return il(e,1)||Qc(e,1);if(13==n||27==n)return!0;if(37==n||js&&66==n&&"c"==r){var i=37==n?"ltr"==nl(e,e.state.selection.from)?-1:1:-1;return Xc(e,i,r)||Qc(e,i)}if(39==n||js&&70==n&&"c"==r){var o=39==n?"ltr"==nl(e,e.state.selection.from)?1:-1:1;return Xc(e,o,r)||Qc(e,o)}return 38==n||js&&80==n&&"c"==r?rl(e,-1,r)||Qc(e,-1):40==n||js&&78==n&&"c"==r?function(e){if(!Vs||e.state.selection.$head.parentOffset>0)return!1;var t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(n&&1==n.nodeType&&0==r&&n.firstChild&&"false"==n.firstChild.contentEditable){var i=n.firstChild;ol(e,i,"true"),setTimeout(function(){return ol(e,i,"false")},20)}return!1}(e)||rl(e,1,r)||Qc(e,1):r==(js?"m":"c")&&(66==n||73==n||89==n||90==n)}function sl(e,t){e.someProp("transformCopied",function(n){t=n(t,e)});for(var n=[],r=t,i=r.content,o=r.openStart,a=r.openEnd;o>1&&a>1&&1==i.childCount&&1==i.firstChild.childCount;){o--,a--;var s=i.firstChild;n.push(s.type.name,s.attrs!=s.type.defaultAttrs?s.attrs:null),i=s.content}var c=e.someProp("clipboardSerializer")||Ro.fromSchema(e.state.schema),l=gl(),u=l.createElement("div");u.appendChild(c.serializeFragment(i,{document:l}));for(var d,h=u.firstChild,f=0;h&&1==h.nodeType&&(d=vl[h.nodeName.toLowerCase()]);){for(var p=d.length-1;p>=0;p--){for(var v=l.createElement(d[p]);u.firstChild;)v.appendChild(u.firstChild);u.appendChild(v),f++}h=u.firstChild}h&&1==h.nodeType&&h.setAttribute("data-pm-slice","".concat(o," ").concat(a).concat(f?" -".concat(f):""," ").concat(JSON.stringify(n)));var m=e.someProp("clipboardTextSerializer",function(n){return n(t,e)})||t.content.textBetween(0,t.content.size,"\n\n");return{dom:u,text:m,slice:t}}function cl(e,t,n,r,i){var o,a,s=i.parent.type.spec.code;if(!n&&!t)return null;var c=!!t&&(r||s||!n);if(c){if(e.someProp("transformPastedText",function(n){t=n(t,s||r,e)}),s)return a=new Bi(Di.from(e.state.schema.text(t.replace(/\r\n?/g,"\n"))),0,0),e.someProp("transformPasted",function(t){a=t(a,e,!0)}),a;var l=e.someProp("clipboardTextParser",function(n){return n(t,i,r,e)});if(l)a=l;else{var u=i.marks(),d=e.state.schema,h=Ro.fromSchema(d);o=document.createElement("div"),t.split(/(?:\r\n?|\n)+/).forEach(function(e){var t=o.appendChild(document.createElement("p"));e&&t.appendChild(h.serializeNode(d.text(e,u)))})}}else e.someProp("transformPastedHTML",function(t){n=t(n,e)}),o=function(e){var t=/^(\s*<meta [^>]*>)*/.exec(e);t&&(e=e.slice(t[0].length));var n,r=gl().createElement("div"),i=/<([a-z][^>\s]+)/i.exec(e);(n=i&&vl[i[1].toLowerCase()])&&(e=n.map(function(e){return"<"+e+">"}).join("")+e+n.map(function(e){return"</"+e+">"}).reverse().join(""));if(r.innerHTML=function(e){var t=window.trustedTypes;if(!t)return e;yl||(yl=t.defaultPolicy||t.createPolicy("ProseMirrorClipboard",{createHTML:function(e){return e}}));return yl.createHTML(e)}(e),n)for(var o=0;o<n.length;o++)r=r.querySelector(n[o])||r;return r}(n),Ws&&function(e){for(var t=e.querySelectorAll(Ls?"span:not([class]):not([style])":"span.Apple-converted-space"),n=0;n<t.length;n++){var r=t[n];1==r.childNodes.length&&" "==r.textContent&&r.parentNode&&r.parentNode.replaceChild(e.ownerDocument.createTextNode(" "),r)}}(o);var f=o&&o.querySelector("[data-pm-slice]"),p=f&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(f.getAttribute("data-pm-slice")||"");if(p&&p[3])for(var v=+p[3];v>0;v--){for(var m=o.firstChild;m&&1!=m.nodeType;)m=m.nextSibling;if(!m)break;o=m}if(!a){var g=e.someProp("clipboardParser")||e.someProp("domParser")||_o.fromSchema(e.state.schema);a=g.parseSlice(o,{preserveWhitespace:!(!c&&!p),context:i,ruleFromNode:function(e){return"BR"!=e.nodeName||e.nextSibling||!e.parentNode||ll.test(e.parentNode.nodeName)?null:{ignore:!0}}})}if(p)a=function(e,t){if(!e.size)return e;var n,r=e.content.firstChild.type.schema;try{n=JSON.parse(t)}catch(wt){return e}for(var i=e.content,o=e.openStart,a=e.openEnd,s=n.length-2;s>=0;s-=2){var c=r.nodes[n[s]];if(!c||c.hasRequiredAttrs())break;i=Di.from(c.create(n[s+1],i)),o++,a++}return new Bi(i,o,a)}(pl(a,+p[1],+p[2]),p[4]);else if(a=Bi.maxOpen(function(e,t){if(e.childCount<2)return e;for(var n,r=function(){var n,r=t.node(i).contentMatchAt(t.index(i)),o=[];if(e.forEach(function(e){if(o){var t,i=r.findWrapping(e.type);if(!i)return o=null;if(t=o.length&&n.length&&dl(i,n,e,o[o.length-1],0))o[o.length-1]=t;else{o.length&&(o[o.length-1]=hl(o[o.length-1],n.length));var a=ul(e,i);o.push(a),r=r.matchType(a.type),n=i}}}),o)return{v:Di.from(o)}},i=t.depth;i>=0;i--)if(n=r())return n.v;return e}(a.content,i),!0),a.openStart||a.openEnd){for(var y=0,k=0,w=a.content.firstChild;y<a.openStart&&!w.type.spec.isolating;y++,w=w.firstChild);for(var b=a.content.lastChild;k<a.openEnd&&!b.type.spec.isolating;k++,b=b.lastChild);a=pl(a,y,k)}return e.someProp("transformPasted",function(t){a=t(a,e,c)}),a}var ll=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function ul(e,t){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=t.length-1;r>=n;r--)e=t[r].create(null,Di.from(e));return e}function dl(e,t,n,r,i){if(i<e.length&&i<t.length&&e[i]==t[i]){var o=dl(e,t,n,r.lastChild,i+1);if(o)return r.copy(r.content.replaceChild(r.childCount-1,o));if(r.contentMatchAt(r.childCount).matchType(i==e.length-1?n.type:e[i+1]))return r.copy(r.content.append(Di.from(ul(n,e,i+1))))}}function hl(e,t){if(0==t)return e;var n=e.content.replaceChild(e.childCount-1,hl(e.lastChild,t-1)),r=e.contentMatchAt(e.childCount).fillBefore(Di.empty,!0);return e.copy(n.append(r))}function fl(e,t,n,r,i,o){var a=t<0?e.firstChild:e.lastChild,s=a.content;return e.childCount>1&&(o=0),i<r-1&&(s=fl(s,t,n,r,i+1,o)),i>=n&&(s=t<0?a.contentMatchAt(0).fillBefore(s,o<=i).append(s):s.append(a.contentMatchAt(a.childCount).fillBefore(Di.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,a.copy(s))}function pl(e,t,n){return t<e.openStart&&(e=new Bi(fl(e.content,-1,t,e.openStart,0,e.openEnd),t,e.openEnd)),n<e.openEnd&&(e=new Bi(fl(e.content,1,n,e.openEnd,0,0),e.openStart,n)),e}var vl={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]},ml=null;function gl(){return ml||(ml=document.implementation.createHTMLDocument("title"))}var yl=null;var kl={},wl={},bl={touchstart:!0,touchmove:!0},xl=S(function e(){x(this,e),this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null});function Cl(e,t){e.input.lastSelectionOrigin=t,e.input.lastSelectionTime=Date.now()}function Sl(e){e.someProp("handleDOMEvents",function(t){for(var n in t)e.input.eventHandlers[n]||e.dom.addEventListener(n,e.input.eventHandlers[n]=function(t){return _l(e,t)})})}function _l(e,t){return e.someProp("handleDOMEvents",function(n){var r=n[t.type];return!!r&&(r(e,t)||t.defaultPrevented)})}function Ml(e){return{left:e.clientX,top:e.clientY}}function Nl(e,t,n,r,i){if(-1==r)return!1;for(var o,a=e.state.doc.resolve(r),s=function(r){if(e.someProp(t,function(t){return r>a.depth?t(e,n,a.nodeAfter,a.before(r),i,!0):t(e,n,a.node(r),a.before(r),i,!1)}))return{v:!0}},c=a.depth+1;c>0;c--)if(o=s(c))return o.v;return!1}function Tl(e,t,n){if(e.focused||e.focus(),!e.state.selection.eq(t)){var r=e.state.tr.setSelection(t);"pointer"==n&&r.setMeta("pointer",!0),e.dispatch(r)}}function Ol(e,t,n,r,i){return Nl(e,"handleClickOn",t,n,r)||e.someProp("handleClick",function(n){return n(e,t,r)})||(i?function(e,t){if(-1==t)return!1;var n,r,i=e.state.selection;i instanceof Ba&&(n=i.node);for(var o=e.state.doc.resolve(t),a=o.depth+1;a>0;a--){var s=a>o.depth?o.nodeAfter:o.node(a);if(Ba.isSelectable(s)){r=n&&i.$from.depth>0&&a>=i.$from.depth&&o.before(i.$from.depth+1)==i.$from.pos?o.before(i.$from.depth):o.before(a);break}}return null!=r&&(Tl(e,Ba.create(e.state.doc,r),"pointer"),!0)}(e,n):function(e,t){if(-1==t)return!1;var n=e.state.doc.resolve(t),r=n.nodeAfter;return!!(r&&r.isAtom&&Ba.isSelectable(r))&&(Tl(e,new Ba(n),"pointer"),!0)}(e,n))}function El(e,t,n,r){return Nl(e,"handleDoubleClickOn",t,n,r)||e.someProp("handleDoubleClick",function(n){return n(e,t,r)})}function Al(e,t,n,r){return Nl(e,"handleTripleClickOn",t,n,r)||e.someProp("handleTripleClick",function(n){return n(e,t,r)})||function(e,t,n){if(0!=n.button)return!1;var r=e.state.doc;if(-1==t)return!!r.inlineContent&&(Tl(e,Pa.create(r,0,r.content.size),"pointer"),!0);for(var i=r.resolve(t),o=i.depth+1;o>0;o--){var a=o>i.depth?i.nodeAfter:i.node(o),s=i.before(o);if(a.inlineContent)Tl(e,Pa.create(r,s+1,s+1+a.content.size),"pointer");else{if(!Ba.isSelectable(a))continue;Tl(e,Ba.create(r,s),"pointer")}return!0}}(e,n,r)}function Dl(e){return Fl(e)}wl.keydown=function(e,t){var n=t;if(e.input.shiftKey=16==n.keyCode||n.shiftKey,!Rl(e,n)&&(e.input.lastKeyCode=n.keyCode,e.input.lastKeyCodeTime=Date.now(),!Hs||!Ls||13!=n.keyCode))if(229!=n.keyCode&&e.domObserver.forceFlush(),!Fs||13!=n.keyCode||n.ctrlKey||n.altKey||n.metaKey)e.someProp("handleKeyDown",function(t){return t(e,n)})||al(e,n)?n.preventDefault():Cl(e,"key");else{var r=Date.now();e.input.lastIOSEnter=r,e.input.lastIOSEnterFallbackTimeout=setTimeout(function(){e.input.lastIOSEnter==r&&(e.someProp("handleKeyDown",function(t){return t(e,Ms(13,"Enter"))}),e.input.lastIOSEnter=0)},200)}},wl.keyup=function(e,t){16==t.keyCode&&(e.input.shiftKey=!1)},wl.keypress=function(e,t){var n=t;if(!(Rl(e,n)||!n.charCode||n.ctrlKey&&!n.altKey||js&&n.metaKey))if(e.someProp("handleKeyPress",function(t){return t(e,n)}))n.preventDefault();else{var r=e.state.selection;if(!(r instanceof Pa&&r.$from.sameParent(r.$to))){var i=String.fromCharCode(n.charCode),o=function(){return e.state.tr.insertText(i).scrollIntoView()};/[\r\n]/.test(i)||e.someProp("handleTextInput",function(t){return t(e,r.$from.pos,r.$to.pos,i,o)})||e.dispatch(o()),n.preventDefault()}}};var Il=js?"metaKey":"ctrlKey";kl.mousedown=function(e,t){var n=t;e.input.shiftKey=n.shiftKey;var r=Dl(e),i=Date.now(),o="singleClick";i-e.input.lastClick.time<500&&function(e,t){var n=t.x-e.clientX,r=t.y-e.clientY;return n*n+r*r<100}(n,e.input.lastClick)&&!n[Il]&&e.input.lastClick.button==n.button&&("singleClick"==e.input.lastClick.type?o="doubleClick":"doubleClick"==e.input.lastClick.type&&(o="tripleClick")),e.input.lastClick={time:i,x:n.clientX,y:n.clientY,type:o,button:n.button};var a=e.posAtCoords(Ml(n));a&&("singleClick"==o?(e.input.mouseDown&&e.input.mouseDown.done(),e.input.mouseDown=new zl(e,a,n,!!r)):("doubleClick"==o?El:Al)(e,a.pos,a.inside,n)?n.preventDefault():Cl(e,"pointer"))};var zl=function(){return S(function e(t,n,r,i){var o,a,s=this;if(x(this,e),this.view=t,this.pos=n,this.event=r,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=t.state.doc,this.selectNode=!!r[Il],this.allowDefault=r.shiftKey,n.inside>-1)o=t.state.doc.nodeAt(n.inside),a=n.inside;else{var c=t.state.doc.resolve(n.pos);o=c.parent,a=c.depth?c.before():0}var l=i?null:r.target,u=l?t.docView.nearestDesc(l,!0):null;this.target=u&&1==u.nodeDOM.nodeType?u.nodeDOM:null;var d=t.state.selection;(0==r.button&&o.type.spec.draggable&&!1!==o.type.spec.selectable||d instanceof Ba&&d.from<=a&&d.to>a)&&(this.mightDrag={node:o,pos:a,addAttr:!(!this.target||this.target.draggable),setUneditable:!(!this.target||!Rs||this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(function(){s.view.input.mouseDown==s&&s.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),t.root.addEventListener("mouseup",this.up=this.up.bind(this)),t.root.addEventListener("mousemove",this.move=this.move.bind(this)),Cl(t,"pointer")},[{key:"done",value:function(){var e=this;this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(function(){return Bc(e.view)}),this.view.input.mouseDown=null}},{key:"up",value:function(e){if(this.done(),this.view.dom.contains(e.target)){var t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(Ml(e))),this.updateAllowDefault(e),this.allowDefault||!t?Cl(this.view,"pointer"):Ol(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():0==e.button&&(this.flushed||Vs&&this.mightDrag&&!this.mightDrag.node.isAtom||Ls&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(Tl(this.view,Da.near(this.view.state.doc.resolve(t.pos)),"pointer"),e.preventDefault()):Cl(this.view,"pointer")}}},{key:"move",value:function(e){this.updateAllowDefault(e),Cl(this.view,"pointer"),0==e.buttons&&this.done()}},{key:"updateAllowDefault",value:function(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}])}();function Rl(e,t){return!!e.composing||!!(Vs&&Math.abs(t.timeStamp-e.input.compositionEndedAt)<500)&&(e.input.compositionEndedAt=-2e8,!0)}kl.touchstart=function(e){e.input.lastTouch=Date.now(),Dl(e),Cl(e,"pointer")},kl.touchmove=function(e){e.input.lastTouch=Date.now(),Cl(e,"pointer")},kl.contextmenu=function(e){return Dl(e)};var Pl=Hs?5e3:-1;function Ll(e,t){clearTimeout(e.input.composingTimeout),t>-1&&(e.input.composingTimeout=setTimeout(function(){return Fl(e)},t))}function Bl(e){var t;for(e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=((t=document.createEvent("Event")).initEvent("event",!0,!0),t.timeStamp));e.input.compositionNodes.length>0;)e.input.compositionNodes.pop().markParentsDirty()}function Vl(e){var t=e.domSelectionRange();if(!t.focusNode)return null;var n=function(e,t){for(;;){if(3==e.nodeType&&t)return e;if(1==e.nodeType&&t>0){if("false"==e.contentEditable)return null;t=Cs(e=e.childNodes[t-1])}else{if(!e.parentNode||Ss(e))return null;t=ms(e),e=e.parentNode}}}(t.focusNode,t.focusOffset),r=function(e,t){for(;;){if(3==e.nodeType&&t<e.nodeValue.length)return e;if(1==e.nodeType&&t<e.childNodes.length){if("false"==e.contentEditable)return null;e=e.childNodes[t],t=0}else{if(!e.parentNode||Ss(e))return null;t=ms(e)+1,e=e.parentNode}}}(t.focusNode,t.focusOffset);if(n&&r&&n!=r){var i=r.pmViewDesc,o=e.domObserver.lastChangedTextNode;if(n==o||r==o)return o;if(!i||!i.isText(r.nodeValue))return r;if(e.input.compositionNode==r){var a=n.pmViewDesc;if(a&&a.isText(n.nodeValue))return r}}return n||r}function Fl(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!(Hs&&e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),Bl(e),t||e.docView&&e.docView.dirty){var n=Pc(e),r=e.state.selection;return n&&!n.eq(r)?e.dispatch(e.state.tr.setSelection(n)):!e.markCursor&&!t||r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?e.updateState(e.state):e.dispatch(e.state.tr.deleteSelection()),!0}return!1}}wl.compositionstart=wl.compositionupdate=function(e){if(!e.composing){e.domObserver.flush();var t=e.state,n=t.selection.$to;if(t.selection instanceof Pa&&(t.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(function(e){return!1===e.type.spec.inclusive})||Ls&&$s&&function(e){var t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n||1!=n.nodeType||r>=n.childNodes.length)return!1;var i=n.childNodes[r];return 1==i.nodeType&&"false"==i.contentEditable}(e)))e.markCursor=e.state.storedMarks||n.marks(),Fl(e,!0),e.markCursor=null;else if(Fl(e,!t.selection.empty),Rs&&t.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length)for(var r=e.domSelectionRange(),i=r.focusNode,o=r.focusOffset;i&&1==i.nodeType&&0!=o;){var a=o<0?i.lastChild:i.childNodes[o-1];if(!a)break;if(3==a.nodeType){var s=e.domSelection();s&&s.collapse(a,a.nodeValue.length);break}i=a,o=-1}e.input.composing=!0}Ll(e,Pl)},wl.compositionend=function(e,t){e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=t.timeStamp,e.input.compositionPendingChanges=e.domObserver.pendingRecords().length?e.input.compositionID:0,e.input.compositionNode=null,e.input.compositionPendingChanges&&Promise.resolve().then(function(){return e.domObserver.flush()}),e.input.compositionID++,Ll(e,20))};var jl=Is&&zs<15||Fs&&qs<604;function $l(e,t,n,r,i){var o=cl(e,t,n,r,e.state.selection.$from);if(e.someProp("handlePaste",function(t){return t(e,i,o||Bi.empty)}))return!0;if(!o)return!1;var a=function(e){return 0==e.openStart&&0==e.openEnd&&1==e.content.childCount?e.content.firstChild:null}(o),s=a?e.state.tr.replaceSelectionWith(a,r):e.state.tr.replaceSelection(o);return e.dispatch(s.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Hl(e){var t=e.getData("text/plain")||e.getData("Text");if(t)return t;var n=e.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}kl.copy=wl.cut=function(e,t){var n=t,r=e.state.selection,i="cut"==n.type;if(!r.empty){var o=jl?null:n.clipboardData,a=sl(e,r.content()),s=a.dom,c=a.text;o?(n.preventDefault(),o.clearData(),o.setData("text/html",s.innerHTML),o.setData("text/plain",c)):function(e,t){if(e.dom.parentNode){var n=e.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(t),n.style.cssText="position: fixed; left: -10000px; top: 10px";var r=getSelection(),i=document.createRange();i.selectNodeContents(t),e.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(function(){n.parentNode&&n.parentNode.removeChild(n),e.focus()},50)}}(e,s),i&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))}},wl.paste=function(e,t){var n=t;if(!e.composing||Hs){var r=jl?null:n.clipboardData,i=e.input.shiftKey&&45!=e.input.lastKeyCode;r&&$l(e,Hl(r),r.getData("text/html"),i,n)?n.preventDefault():function(e,t){if(e.dom.parentNode){var n=e.input.shiftKey||e.state.selection.$from.parent.type.spec.code,r=e.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();var i=e.input.shiftKey&&45!=e.input.lastKeyCode;setTimeout(function(){e.focus(),r.parentNode&&r.parentNode.removeChild(r),n?$l(e,r.value,null,i,t):$l(e,r.textContent,r.innerHTML,i,t)},50)}}(e,n)}};var Wl=S(function e(t,n,r){x(this,e),this.slice=t,this.move=n,this.node=r}),ql=js?"altKey":"ctrlKey";function Ul(e,t){var n=e.someProp("dragCopies",function(e){return!e(t)});return null!=n?n:!t[ql]}for(var Kl in kl.dragstart=function(e,t){var n=t,r=e.input.mouseDown;if(r&&r.done(),n.dataTransfer){var i,o=e.state.selection,a=o.empty?null:e.posAtCoords(Ml(n));if(a&&a.pos>=o.from&&a.pos<=(o instanceof Ba?o.to-1:o.to));else if(r&&r.mightDrag)i=Ba.create(e.state.doc,r.mightDrag.pos);else if(n.target&&1==n.target.nodeType){var s=e.docView.nearestDesc(n.target,!0);s&&s.node.type.spec.draggable&&s!=e.docView&&(i=Ba.create(e.state.doc,s.posBefore))}var c=sl(e,(i||e.state.selection).content()),l=c.dom,u=c.text,d=c.slice;(!n.dataTransfer.files.length||!Ls||Bs>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(jl?"Text":"text/html",l.innerHTML),n.dataTransfer.effectAllowed="copyMove",jl||n.dataTransfer.setData("text/plain",u),e.dragging=new Wl(d,Ul(e,n),i)}},kl.dragend=function(e){var t=e.dragging;window.setTimeout(function(){e.dragging==t&&(e.dragging=null)},50)},wl.dragover=wl.dragenter=function(e,t){return t.preventDefault()},wl.drop=function(e,t){try{!function(e,t,n){if(!t.dataTransfer)return;var r=e.posAtCoords(Ml(t));if(!r)return;var i=e.state.doc.resolve(r.pos),o=n&&n.slice;o?e.someProp("transformPasted",function(t){o=t(o,e,!1)}):o=cl(e,Hl(t.dataTransfer),jl?null:t.dataTransfer.getData("text/html"),!1,i);var a=!(!n||!Ul(e,t));if(e.someProp("handleDrop",function(n){return n(e,t,o||Bi.empty,a)}))return void t.preventDefault();if(!o)return;t.preventDefault();var s=o?va(e.state.doc,i.pos,o):i.pos;null==s&&(s=i.pos);var c=e.state.tr;if(a){var l=n.node;l?l.replace(c):c.deleteSelection()}var u=c.mapping.map(s),d=0==o.openStart&&0==o.openEnd&&1==o.content.childCount,h=c.doc;d?c.replaceRangeWith(u,u,o.content.firstChild):c.replaceRange(u,u,o);if(c.doc.eq(h))return;var f=c.doc.resolve(u);if(d&&Ba.isSelectable(o.content.firstChild)&&f.nodeAfter&&f.nodeAfter.sameMarkup(o.content.firstChild))c.setSelection(new Ba(f));else{var p=c.mapping.map(s);c.mapping.maps[c.mapping.maps.length-1].forEach(function(e,t,n,r){return p=r}),c.setSelection(qc(e,f,c.doc.resolve(p)))}e.focus(),e.dispatch(c.setMeta("uiEvent","drop"))}(e,t,e.dragging)}finally{e.dragging=null}},kl.focus=function(e){e.input.lastFocus=Date.now(),e.focused||(e.domObserver.stop(),e.dom.classList.add("ProseMirror-focused"),e.domObserver.start(),e.focused=!0,setTimeout(function(){e.docView&&e.hasFocus()&&!e.domObserver.currentSelection.eq(e.domSelectionRange())&&Bc(e)},20))},kl.blur=function(e,t){var n=t;e.focused&&(e.domObserver.stop(),e.dom.classList.remove("ProseMirror-focused"),e.domObserver.start(),n.relatedTarget&&e.dom.contains(n.relatedTarget)&&e.domObserver.currentSelection.clear(),e.focused=!1)},kl.beforeinput=function(e,t){if(Ls&&Hs&&"deleteContentBackward"==t.inputType){e.domObserver.flushSoon();var n=e.input.domChangeCount;setTimeout(function(){if(e.input.domChangeCount==n&&(e.dom.blur(),e.focus(),!e.someProp("handleKeyDown",function(t){return t(e,Ms(8,"Backspace"))}))){var t=e.state.selection.$cursor;t&&t.pos>0&&e.dispatch(e.state.tr.delete(t.pos-1,t.pos).scrollIntoView())}},50)}},wl)kl[Kl]=wl[Kl];function Jl(e,t){if(e==t)return!0;for(var n in e)if(e[n]!==t[n])return!1;for(var r in t)if(!(r in e))return!1;return!0}var Gl=function(){function e(t,n){x(this,e),this.toDOM=t,this.spec=n||eu,this.side=this.spec.side||0}return S(e,[{key:"map",value:function(e,t,n,r){var i=e.mapResult(t.from+r,this.side<0?-1:1),o=i.pos;return i.deleted?null:new Zl(o-n,o-n,this)}},{key:"valid",value:function(){return!0}},{key:"eq",value:function(t){return this==t||t instanceof e&&(this.spec.key&&this.spec.key==t.spec.key||this.toDOM==t.toDOM&&Jl(this.spec,t.spec))}},{key:"destroy",value:function(e){this.spec.destroy&&this.spec.destroy(e)}}])}(),Xl=function(){function e(t,n){x(this,e),this.attrs=t,this.spec=n||eu}return S(e,[{key:"map",value:function(e,t,n,r){var i=e.map(t.from+r,this.spec.inclusiveStart?-1:1)-n,o=e.map(t.to+r,this.spec.inclusiveEnd?1:-1)-n;return i>=o?null:new Zl(i,o,this)}},{key:"valid",value:function(e,t){return t.from<t.to}},{key:"eq",value:function(t){return this==t||t instanceof e&&Jl(this.attrs,t.attrs)&&Jl(this.spec,t.spec)}},{key:"destroy",value:function(){}}],[{key:"is",value:function(t){return t.type instanceof e}}])}(),Yl=function(){function e(t,n){x(this,e),this.attrs=t,this.spec=n||eu}return S(e,[{key:"map",value:function(e,t,n,r){var i=e.mapResult(t.from+r,1);if(i.deleted)return null;var o=e.mapResult(t.to+r,-1);return o.deleted||o.pos<=i.pos?null:new Zl(i.pos-n,o.pos-n,this)}},{key:"valid",value:function(e,t){var n,r=e.content.findIndex(t.from),i=r.index,o=r.offset;return o==t.from&&!(n=e.child(i)).isText&&o+n.nodeSize==t.to}},{key:"eq",value:function(t){return this==t||t instanceof e&&Jl(this.attrs,t.attrs)&&Jl(this.spec,t.spec)}},{key:"destroy",value:function(){}}])}(),Zl=function(){function e(t,n,r){x(this,e),this.from=t,this.to=n,this.type=r}return S(e,[{key:"copy",value:function(t,n){return new e(t,n,this.type)}},{key:"eq",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}},{key:"map",value:function(e,t,n){return this.type.map(e,this,t,n)}},{key:"spec",get:function(){return this.type.spec}},{key:"inline",get:function(){return this.type instanceof Xl}},{key:"widget",get:function(){return this.type instanceof Gl}}],[{key:"widget",value:function(t,n,r){return new e(t,t,new Gl(n,r))}},{key:"inline",value:function(t,n,r,i){return new e(t,n,new Xl(r,i))}},{key:"node",value:function(t,n,r,i){return new e(t,n,new Yl(r,i))}}])}(),Ql=[],eu={},tu=function(){function e(t,n){x(this,e),this.local=t.length?t:Ql,this.children=n.length?n:Ql}return S(e,[{key:"find",value:function(e,t,n){var r=[];return this.findInner(null==e?0:e,null==t?1e9:t,r,0,n),r}},{key:"findInner",value:function(e,t,n,r,i){for(var o=0;o<this.local.length;o++){var a=this.local[o];a.from<=t&&a.to>=e&&(!i||i(a.spec))&&n.push(a.copy(a.from+r,a.to+r))}for(var s=0;s<this.children.length;s+=3)if(this.children[s]<t&&this.children[s+1]>e){var c=this.children[s]+1;this.children[s+2].findInner(e-c,t-c,n,r+c,i)}}},{key:"map",value:function(e,t,n){return this==nu||0==e.maps.length?this:this.mapInner(e,t,0,0,n||eu)}},{key:"mapInner",value:function(t,n,r,i,o){for(var a,s=0;s<this.local.length;s++){var c=this.local[s].map(t,r,i);c&&c.type.valid(n,c)?(a||(a=[])).push(c):o.onRemove&&o.onRemove(this.local[s].spec)}return this.children.length?iu(this.children,a||[],t,n,r,i,o):a?new e(a.sort(lu),Ql):nu}},{key:"add",value:function(t,n){return n.length?this==nu?e.create(t,n):this.addInner(t,n,0):this}},{key:"addInner",value:function(t,n,r){var i,o=this,a=0;t.forEach(function(e,t){var s,c=t+r;if(s=au(n,e,c)){for(i||(i=o.children.slice());a<i.length&&i[a]<t;)a+=3;i[a]==t?i[a+2]=i[a+2].addInner(e,s,c+1):i.splice(a,0,t,t+e.nodeSize,cu(s,e,c+1,eu)),a+=3}});for(var s=ou(a?su(n):n,-r),c=0;c<s.length;c++)s[c].type.valid(t,s[c])||s.splice(c--,1);return new e(s.length?this.local.concat(s).sort(lu):this.local,i||this.children)}},{key:"remove",value:function(e){return 0==e.length||this==nu?this:this.removeInner(e,0)}},{key:"removeInner",value:function(t,n){for(var r=this.children,i=this.local,o=0;o<r.length;o+=3){for(var a,s=void 0,c=r[o]+n,l=r[o+1]+n,u=0;u<t.length;u++)(a=t[u])&&a.from>c&&a.to<l&&(t[u]=null,(s||(s=[])).push(a));if(s){r==this.children&&(r=this.children.slice());var d=r[o+2].removeInner(s,c+1);d!=nu?r[o+2]=d:(r.splice(o,3),o-=3)}}if(i.length)for(var h,f=0;f<t.length;f++)if(h=t[f])for(var p=0;p<i.length;p++)i[p].eq(h,n)&&(i==this.local&&(i=this.local.slice()),i.splice(p--,1));return r==this.children&&i==this.local?this:i.length||r.length?new e(i,r):nu}},{key:"forChild",value:function(t,n){if(this==nu)return this;if(n.isLeaf)return e.empty;for(var r,i,o=0;o<this.children.length;o+=3)if(this.children[o]>=t){this.children[o]==t&&(r=this.children[o+2]);break}for(var a=t+1,s=a+n.content.size,c=0;c<this.local.length;c++){var l=this.local[c];if(l.from<s&&l.to>a&&l.type instanceof Xl){var u=Math.max(a,l.from)-a,d=Math.min(s,l.to)-a;u<d&&(i||(i=[])).push(l.copy(u,d))}}if(i){var h=new e(i.sort(lu),Ql);return r?new ru([h,r]):h}return r||nu}},{key:"eq",value:function(t){if(this==t)return!0;if(!(t instanceof e)||this.local.length!=t.local.length||this.children.length!=t.children.length)return!1;for(var n=0;n<this.local.length;n++)if(!this.local[n].eq(t.local[n]))return!1;for(var r=0;r<this.children.length;r+=3)if(this.children[r]!=t.children[r]||this.children[r+1]!=t.children[r+1]||!this.children[r+2].eq(t.children[r+2]))return!1;return!0}},{key:"locals",value:function(e){return uu(this.localsInner(e))}},{key:"localsInner",value:function(e){if(this==nu)return Ql;if(e.inlineContent||!this.local.some(Xl.is))return this.local;for(var t=[],n=0;n<this.local.length;n++)this.local[n].type instanceof Xl||t.push(this.local[n]);return t}},{key:"forEachSet",value:function(e){e(this)}}],[{key:"create",value:function(e,t){return t.length?cu(t,e,0,eu):nu}}])}();tu.empty=new tu([],[]),tu.removeOverlap=uu;var nu=tu.empty,ru=function(){function e(t){x(this,e),this.members=t}return S(e,[{key:"map",value:function(t,n){var r=this.members.map(function(e){return e.map(t,n,eu)});return e.from(r)}},{key:"forChild",value:function(t,n){if(n.isLeaf)return tu.empty;for(var r=[],i=0;i<this.members.length;i++){var o=this.members[i].forChild(t,n);o!=nu&&(o instanceof e?r=r.concat(o.members):r.push(o))}return e.from(r)}},{key:"eq",value:function(t){if(!(t instanceof e)||t.members.length!=this.members.length)return!1;for(var n=0;n<this.members.length;n++)if(!this.members[n].eq(t.members[n]))return!1;return!0}},{key:"locals",value:function(e){for(var t,n=!0,r=0;r<this.members.length;r++){var i=this.members[r].localsInner(e);if(i.length)if(t){n&&(t=t.slice(),n=!1);for(var o=0;o<i.length;o++)t.push(i[o])}else t=i}return t?uu(n?t:t.sort(lu)):Ql}},{key:"forEachSet",value:function(e){for(var t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}],[{key:"from",value:function(t){switch(t.length){case 0:return nu;case 1:return t[0];default:return new e(t.every(function(e){return e instanceof tu})?t:t.reduce(function(e,t){return e.concat(t instanceof tu?t:t.members)},[]))}}}])}();function iu(e,t,n,r,i,o,a){for(var s=e.slice(),c=function(e){var t=0;n.maps[l].forEach(function(n,r,i,o){for(var a=o-i-(r-n),c=0;c<s.length;c+=3){var l=s[c+1];if(!(l<0||n>l+e-t)){var u=s[c]+e-t;r>=u?s[c+1]=n<=u?-2:-1:n>=e&&a&&(s[c]+=a,s[c+1]+=a)}}t+=a}),e=n.maps[l].map(e,-1),u=e},l=0,u=o;l<n.maps.length;l++)c(u);for(var d=!1,h=0;h<s.length;h+=3)if(s[h+1]<0){if(-2==s[h+1]){d=!0,s[h+1]=-1;continue}var f=n.map(e[h]+o),p=f-i;if(p<0||p>=r.content.size){d=!0;continue}var v=n.map(e[h+1]+o,-1)-i,m=r.content.findIndex(p),g=m.index,y=m.offset,k=r.maybeChild(g);if(k&&y==p&&y+k.nodeSize==v){var w=s[h+2].mapInner(n,k,f+1,e[h]+o+1,a);w!=nu?(s[h]=p,s[h+1]=v,s[h+2]=w):(s[h+1]=-2,d=!0)}else d=!0}if(d){var b=function(e,t,n,r,i,o,a){function s(e,t){for(var o=0;o<e.local.length;o++){var c=e.local[o].map(r,i,t);c?n.push(c):a.onRemove&&a.onRemove(e.local[o].spec)}for(var l=0;l<e.children.length;l+=3)s(e.children[l+2],e.children[l]+t+1)}for(var c=0;c<e.length;c+=3)-1==e[c+1]&&s(e[c+2],t[c]+o+1);return n}(s,e,t,n,i,o,a),x=cu(b,r,0,a);t=x.local;for(var C=0;C<s.length;C+=3)s[C+1]<0&&(s.splice(C,3),C-=3);for(var S=0,_=0;S<x.children.length;S+=3){for(var M=x.children[S];_<s.length&&s[_]<M;)_+=3;s.splice(_,0,x.children[S],x.children[S+1],x.children[S+2])}}return new tu(t.sort(lu),s)}function ou(e,t){if(!t||!e.length)return e;for(var n=[],r=0;r<e.length;r++){var i=e[r];n.push(new Zl(i.from+t,i.to+t,i.type))}return n}function au(e,t,n){if(t.isLeaf)return null;for(var r,i=n+t.nodeSize,o=null,a=0;a<e.length;a++)(r=e[a])&&r.from>n&&r.to<i&&((o||(o=[])).push(r),e[a]=null);return o}function su(e){for(var t=[],n=0;n<e.length;n++)null!=e[n]&&t.push(e[n]);return t}function cu(e,t,n,r){var i=[],o=!1;t.forEach(function(t,a){var s=au(e,t,a+n);if(s){o=!0;var c=cu(s,t,n+a+1,r);c!=nu&&i.push(a,a+t.nodeSize,c)}});for(var a=ou(o?su(e):e,-n).sort(lu),s=0;s<a.length;s++)a[s].type.valid(t,a[s])||(r.onRemove&&r.onRemove(a[s].spec),a.splice(s--,1));return a.length||i.length?new tu(a,i):nu}function lu(e,t){return e.from-t.from||e.to-t.to}function uu(e){for(var t=e,n=0;n<t.length-1;n++){var r=t[n];if(r.from!=r.to)for(var i=n+1;i<t.length;i++){var o=t[i];if(o.from!=r.from){o.from<r.to&&(t==e&&(t=e.slice()),t[n]=r.copy(r.from,o.from),du(t,i,r.copy(o.from,r.to)));break}o.to!=r.to&&(t==e&&(t=e.slice()),t[i]=o.copy(o.from,r.to),du(t,i+1,o.copy(r.to,o.to)))}}return t}function du(e,t,n){for(;t<e.length&&lu(n,e[t])>0;)t++;e.splice(t,0,n)}function hu(e){var t=[];return e.someProp("decorations",function(n){var r=n(e.state);r&&r!=nu&&t.push(r)}),e.cursorWrapper&&t.push(tu.create(e.state.doc,[e.cursorWrapper.deco])),ru.from(t)}var fu={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},pu=Is&&zs<=11,vu=function(){return S(function e(){x(this,e),this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0},[{key:"set",value:function(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}},{key:"clear",value:function(){this.anchorNode=this.focusNode=null}},{key:"eq",value:function(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}])}(),mu=function(){return S(function e(t,n){var r=this;x(this,e),this.view=t,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new vu,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(function(e){for(var t=0;t<e.length;t++)r.queue.push(e[t]);Is&&zs<=11&&e.some(function(e){return"childList"==e.type&&e.removedNodes.length||"characterData"==e.type&&e.oldValue.length>e.target.nodeValue.length})?r.flushSoon():r.flush()}),pu&&(this.onCharData=function(e){r.queue.push({target:e.target,type:"characterData",oldValue:e.prevValue}),r.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)},[{key:"flushSoon",value:function(){var e=this;this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(function(){e.flushingSoon=-1,e.flush()},20))}},{key:"forceFlush",value:function(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}},{key:"start",value:function(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,fu)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}},{key:"stop",value:function(){var e=this;if(this.observer){var t=this.observer.takeRecords();if(t.length){for(var n=0;n<t.length;n++)this.queue.push(t[n]);window.setTimeout(function(){return e.flush()},20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}},{key:"connectSelection",value:function(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}},{key:"disconnectSelection",value:function(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}},{key:"suppressSelectionUpdates",value:function(){var e=this;this.suppressingSelectionUpdates=!0,setTimeout(function(){return e.suppressingSelectionUpdates=!1},50)}},{key:"onSelectionChange",value:function(){if(Uc(this.view)){if(this.suppressingSelectionUpdates)return Bc(this.view);if(Is&&zs<=11&&!this.view.state.selection.empty){var e=this.view.domSelectionRange();if(e.focusNode&&ws(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}},{key:"setCurSelection",value:function(){this.currentSelection.set(this.view.domSelectionRange())}},{key:"ignoreSelectionChange",value:function(e){if(!e.focusNode)return!0;for(var t,n=new Set,r=e.focusNode;r;r=gs(r))n.add(r);for(var i=e.anchorNode;i;i=gs(i))if(n.has(i)){t=i;break}var o=t&&this.view.docView.nearestDesc(t);return o&&o.ignoreMutation({type:"selection",target:3==t.nodeType?t.parentNode:t})?(this.setCurSelection(),!0):void 0}},{key:"pendingRecords",value:function(){if(this.observer){var e,t=u(this.observer.takeRecords());try{for(t.s();!(e=t.n()).done;){var n=e.value;this.queue.push(n)}}catch(r){t.e(r)}finally{t.f()}}return this.queue}},{key:"flush",value:function(){var e=this.view;if(e.docView&&!(this.flushingSoon>-1)){var t=this.pendingRecords();t.length&&(this.queue=[]);var n=e.domSelectionRange(),r=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(n)&&Uc(e)&&!this.ignoreSelectionChange(n),i=-1,o=-1,a=!1,s=[];if(e.editable)for(var c=0;c<t.length;c++){var l=this.registerMutation(t[c],s);l&&(i=i<0?l.from:Math.min(l.from,i),o=o<0?l.to:Math.max(l.to,o),l.typeOver&&(a=!0))}if(Rs&&s.length){var d=s.filter(function(e){return"BR"==e.nodeName});if(2==d.length){var h=g(d,2),f=h[0],p=h[1];f.parentNode&&f.parentNode.parentNode==p.parentNode?p.remove():f.remove()}else{var v,m=this.currentSelection.focusNode,y=u(d);try{for(y.s();!(v=y.n()).done;){var k=v.value,w=k.parentNode;!w||"LI"!=w.nodeName||m&&wu(e,m)==w||k.remove()}}catch(M){y.e(M)}finally{y.f()}}}else if((Ls||Vs)&&s.some(function(e){return"BR"==e.nodeName})&&(8==e.input.lastKeyCode||46==e.input.lastKeyCode)){var b,x=u(s);try{for(x.s();!(b=x.n()).done;){var C=b.value;if("BR"==C.nodeName&&C.parentNode){var S=C.nextSibling;S&&1==S.nodeType&&"false"==S.contentEditable&&C.parentNode.removeChild(C)}}}catch(M){x.e(M)}finally{x.f()}}var _=null;i<0&&r&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&_s(n)&&(_=Pc(e))&&_.eq(Da.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,Bc(e),this.currentSelection.set(n),e.scrollToSelection()):(i>-1||r)&&(i>-1&&(e.docView.markDirty(i,o),function(e){if(gu.has(e))return;if(gu.set(e,null),-1!==["normal","nowrap","pre-line"].indexOf(getComputedStyle(e.dom).whiteSpace)){if(e.requiresGeckoHackNode=Rs,yu)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),yu=!0}}(e)),this.handleDOMChange(i,o,a,s),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(n)||Bc(e),this.currentSelection.set(n))}}},{key:"registerMutation",value:function(e,t){if(t.indexOf(e.target)>-1)return null;var n=this.view.docView.nearestDesc(e.target);if("attributes"==e.type&&(n==this.view.docView||"contenteditable"==e.attributeName||"style"==e.attributeName&&!e.oldValue&&!e.target.getAttribute("style")))return null;if(!n||n.ignoreMutation(e))return null;if("childList"==e.type){for(var r=0;r<e.addedNodes.length;r++){var i=e.addedNodes[r];t.push(i),3==i.nodeType&&(this.lastChangedTextNode=i)}if(n.contentDOM&&n.contentDOM!=n.dom&&!n.contentDOM.contains(e.target))return{from:n.posBefore,to:n.posAfter};var o=e.previousSibling,a=e.nextSibling;if(Is&&zs<=11&&e.addedNodes.length)for(var s=0;s<e.addedNodes.length;s++){var c=e.addedNodes[s],l=c.previousSibling,u=c.nextSibling;(!l||Array.prototype.indexOf.call(e.addedNodes,l)<0)&&(o=l),(!u||Array.prototype.indexOf.call(e.addedNodes,u)<0)&&(a=u)}var d=o&&o.parentNode==e.target?ms(o)+1:0,h=n.localPosFromDOM(e.target,d,-1),f=a&&a.parentNode==e.target?ms(a):e.target.childNodes.length;return{from:h,to:n.localPosFromDOM(e.target,f,1)}}return"attributes"==e.type?{from:n.posAtStart-n.border,to:n.posAtEnd+n.border}:(this.lastChangedTextNode=e.target,{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}])}(),gu=new WeakMap,yu=!1;function ku(e,t){var n=t.startContainer,r=t.startOffset,i=t.endContainer,o=t.endOffset,a=e.domAtPos(e.state.selection.anchor);if(ws(a.node,a.offset,i,o)){var s=[i,o,n,r];n=s[0],r=s[1],i=s[2],o=s[3]}return{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:o}}function wu(e,t){for(var n=t.parentNode;n&&n!=e.dom;n=n.parentNode){var r=e.docView.nearestDesc(n,!0);if(r&&r.node.isBlock)return n}return null}function bu(e){var t=e.pmViewDesc;if(t)return t.parseRule();if("BR"==e.nodeName&&e.parentNode){if(Vs&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){var n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}if(e.parentNode.lastChild==e||Vs&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if("IMG"==e.nodeName&&e.getAttribute("mark-placeholder"))return{ignore:!0};return null}var xu=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function Cu(e,t,n,r,i){var o=e.input.compositionPendingChanges||(e.composing?e.input.compositionID:0);if(e.input.compositionPendingChanges=0,t<0){var a=e.input.lastSelectionTime>Date.now()-50?e.input.lastSelectionOrigin:null,s=Pc(e,a);if(s&&!e.state.selection.eq(s)){if(Ls&&Hs&&13===e.input.lastKeyCode&&Date.now()-100<e.input.lastKeyCodeTime&&e.someProp("handleKeyDown",function(t){return t(e,Ms(13,"Enter"))}))return;var c=e.state.tr.setSelection(s);"pointer"==a?c.setMeta("pointer",!0):"key"==a&&c.scrollIntoView(),o&&c.setMeta("composition",o),e.dispatch(c)}}else{var l=e.state.doc.resolve(t),u=l.sharedDepth(n);t=l.before(u+1),n=e.state.doc.resolve(n).after(u+1);var d,h,f=e.state.selection,p=function(e,t,n){var r,i=e.docView.parseRange(t,n),o=i.node,a=i.fromOffset,s=i.toOffset,c=i.from,l=i.to,u=e.domSelectionRange(),d=u.anchorNode;if(d&&e.dom.contains(1==d.nodeType?d:d.parentNode)&&(r=[{node:d,offset:u.anchorOffset}],_s(u)||r.push({node:u.focusNode,offset:u.focusOffset})),Ls&&8===e.input.lastKeyCode)for(var h=s;h>a;h--){var f=o.childNodes[h-1],p=f.pmViewDesc;if("BR"==f.nodeName&&!p){s=h;break}if(!p||p.size)break}var v=e.state.doc,m=e.someProp("domParser")||_o.fromSchema(e.state.schema),g=v.resolve(c),y=null,k=m.parse(o,{topNode:g.parent,topMatch:g.parent.contentMatchAt(g.index()),topOpen:!0,from:a,to:s,preserveWhitespace:"pre"!=g.parent.type.whitespace||"full",findPositions:r,ruleFromNode:bu,context:g});if(r&&null!=r[0].pos){var w=r[0].pos,b=r[1]&&r[1].pos;null==b&&(b=w),y={anchor:w+c,head:b+c}}return{doc:k,sel:y,from:c,to:l}}(e,t,n),v=e.state.doc,m=v.slice(p.from,p.to);8===e.input.lastKeyCode&&Date.now()-100<e.input.lastKeyCodeTime?(d=e.state.selection.to,h="end"):(d=e.state.selection.from,h="start"),e.input.lastKeyCode=null;var g=function(e,t,n,r,i){var o=e.findDiffStart(t,n);if(null==o)return null;var a=e.findDiffEnd(t,n+e.size,n+t.size),s=a.a,c=a.b;if("end"==i){r-=s+Math.max(0,o-Math.min(s,c))-o}if(s<o&&e.size<t.size){var l=r<=o&&r>=s?o-r:0;(o-=l)&&o<t.size&&Mu(t.textBetween(o-1,o+1))&&(o+=l?1:-1),c=o+(c-s),s=o}else if(c<o){var u=r<=o&&r>=c?o-r:0;(o-=u)&&o<e.size&&Mu(e.textBetween(o-1,o+1))&&(o+=u?1:-1),s=o+(s-c),c=o}return{start:o,endA:s,endB:c}}(m.content,p.doc.content,p.from,d,h);if(g&&e.input.domChangeCount++,(Fs&&e.input.lastIOSEnter>Date.now()-225||Hs)&&i.some(function(e){return 1==e.nodeType&&!xu.test(e.nodeName)})&&(!g||g.endA>=g.endB)&&e.someProp("handleKeyDown",function(t){return t(e,Ms(13,"Enter"))}))e.input.lastIOSEnter=0;else{if(!g){if(!(r&&f instanceof Pa&&!f.empty&&f.$head.sameParent(f.$anchor))||e.composing||p.sel&&p.sel.anchor!=p.sel.head){if(p.sel){var y=Su(e,e.state.doc,p.sel);if(y&&!y.eq(e.state.selection)){var k=e.state.tr.setSelection(y);o&&k.setMeta("composition",o),e.dispatch(k)}}return}g={start:f.from,endA:f.to,endB:f.to}}e.state.selection.from<e.state.selection.to&&g.start==g.endB&&e.state.selection instanceof Pa&&(g.start>e.state.selection.from&&g.start<=e.state.selection.from+2&&e.state.selection.from>=p.from?g.start=e.state.selection.from:g.endA<e.state.selection.to&&g.endA>=e.state.selection.to-2&&e.state.selection.to<=p.to&&(g.endB+=e.state.selection.to-g.endA,g.endA=e.state.selection.to)),Is&&zs<=11&&g.endB==g.start+1&&g.endA==g.start&&g.start>p.from&&" "==p.doc.textBetween(g.start-p.from-1,g.start-p.from+1)&&(g.start--,g.endA--,g.endB--);var w=p.doc.resolveNoCache(g.start-p.from),b=p.doc.resolveNoCache(g.endB-p.from),x=v.resolve(g.start),C=w.sameParent(b)&&w.parent.inlineContent&&x.end()>=g.endA;if((Fs&&e.input.lastIOSEnter>Date.now()-225&&(!C||i.some(function(e){return"DIV"==e.nodeName||"P"==e.nodeName}))||!C&&w.pos<p.doc.content.size&&(!w.sameParent(b)||!w.parent.inlineContent)&&w.pos<b.pos&&!/\S/.test(p.doc.textBetween(w.pos,b.pos,"","")))&&e.someProp("handleKeyDown",function(t){return t(e,Ms(13,"Enter"))}))e.input.lastIOSEnter=0;else if(e.state.selection.anchor>g.start&&function(e,t,n,r,i){if(n-t<=i.pos-r.pos||_u(r,!0,!1)<i.pos)return!1;var o=e.resolve(t);if(!r.parent.isTextblock){var a=o.nodeAfter;return null!=a&&n==t+a.nodeSize}if(o.parentOffset<o.parent.content.size||!o.parent.isTextblock)return!1;var s=e.resolve(_u(o,!0,!0));return!(!s.parent.isTextblock||s.pos>n||_u(s,!0,!1)<n)&&r.parent.content.cut(r.parentOffset).eq(s.parent.content)}(v,g.start,g.endA,w,b)&&e.someProp("handleKeyDown",function(t){return t(e,Ms(8,"Backspace"))}))Hs&&Ls&&e.domObserver.suppressSelectionUpdates();else{Ls&&g.endB==g.start&&(e.input.lastChromeDelete=Date.now()),Hs&&!C&&w.start()!=b.start()&&0==b.parentOffset&&w.depth==b.depth&&p.sel&&p.sel.anchor==p.sel.head&&p.sel.head==g.endA&&(g.endB-=2,b=p.doc.resolveNoCache(g.endB-p.from),setTimeout(function(){e.someProp("handleKeyDown",function(t){return t(e,Ms(13,"Enter"))})},20));var S,_=g.start,M=g.endA,N=function(t){var n=t||e.state.tr.replace(_,M,p.doc.slice(g.start-p.from,g.endB-p.from));if(p.sel){var r=Su(e,n.doc,p.sel);r&&!(Ls&&e.composing&&r.empty&&(g.start!=g.endB||e.input.lastChromeDelete<Date.now()-100)&&(r.head==_||r.head==n.mapping.map(M)-1)||Is&&r.empty&&r.head==_)&&n.setSelection(r)}return o&&n.setMeta("composition",o),n.scrollIntoView()};if(C)if(w.pos==b.pos){Is&&zs<=11&&0==w.parentOffset&&(e.domObserver.suppressSelectionUpdates(),setTimeout(function(){return Bc(e)},20));var T=N(e.state.tr.delete(_,M)),O=v.resolve(g.start).marksAcross(v.resolve(g.endA));O&&T.ensureMarks(O),e.dispatch(T)}else if(g.endA==g.endB&&(S=function(e,t){for(var n,r,i,o=e.firstChild.marks,a=t.firstChild.marks,s=o,c=a,l=0;l<a.length;l++)s=a[l].removeFromSet(s);for(var u=0;u<o.length;u++)c=o[u].removeFromSet(c);if(1==s.length&&0==c.length)r=s[0],n="add",i=function(e){return e.mark(r.addToSet(e.marks))};else{if(0!=s.length||1!=c.length)return null;r=c[0],n="remove",i=function(e){return e.mark(r.removeFromSet(e.marks))}}for(var d=[],h=0;h<t.childCount;h++)d.push(i(t.child(h)));if(Di.from(d).eq(e))return{mark:r,type:n}}(w.parent.content.cut(w.parentOffset,b.parentOffset),x.parent.content.cut(x.parentOffset,g.endA-x.start())))){var E=N(e.state.tr);"add"==S.type?E.addMark(_,M,S.mark):E.removeMark(_,M,S.mark),e.dispatch(E)}else if(w.parent.child(w.index()).isText&&w.index()==b.index()-(b.textOffset?0:1)){var A=w.parent.textBetween(w.parentOffset,b.parentOffset),D=function(){return N(e.state.tr.insertText(A,_,M))};e.someProp("handleTextInput",function(t){return t(e,_,M,A,D)})||e.dispatch(D())}else e.dispatch(N());else e.dispatch(N())}}}}function Su(e,t,n){return Math.max(n.anchor,n.head)>t.content.size?null:qc(e,t.resolve(n.anchor),t.resolve(n.head))}function _u(e,t,n){for(var r=e.depth,i=t?e.end():e.pos;r>0&&(t||e.indexAfter(r)==e.node(r).childCount);)r--,i++,t=!1;if(n)for(var o=e.node(r).maybeChild(e.indexAfter(r));o&&!o.isLeaf;)o=o.firstChild,i++;return i}function Mu(e){if(2!=e.length)return!1;var t=e.charCodeAt(0),n=e.charCodeAt(1);return t>=56320&&t<=57343&&n>=55296&&n<=56319}var Nu=function(){return S(function e(t,n){var r=this;x(this,e),this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new xl,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(Du),this.dispatch=this.dispatch.bind(this),this.dom=t&&t.mount||document.createElement("div"),t&&(t.appendChild?t.appendChild(this.dom):"function"==typeof t?t(this.dom):t.mount&&(this.mounted=!0)),this.editable=Eu(this),Ou(this),this.nodeViews=Au(this),this.docView=wc(this.state.doc,Tu(this),hu(this),this.dom,this),this.domObserver=new mu(this,function(e,t,n,i){return Cu(r,e,t,n,i)}),this.domObserver.start(),function(e){var t=function(){var t=kl[n];e.dom.addEventListener(n,e.input.eventHandlers[n]=function(n){!function(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(var n=t.target;n!=e.dom;n=n.parentNode)if(!n||11==n.nodeType||n.pmViewDesc&&n.pmViewDesc.stopEvent(t))return!1;return!0}(e,n)||_l(e,n)||!e.editable&&n.type in wl||t(e,n)},bl[n]?{passive:!0}:void 0)};for(var n in kl)t();Vs&&e.dom.addEventListener("input",function(){return null}),Sl(e)}(this),this.updatePluginViews()},[{key:"composing",get:function(){return this.input.composing}},{key:"props",get:function(){if(this._props.state!=this.state){var e=this._props;for(var t in this._props={},e)this._props[t]=e[t];this._props.state=this.state}return this._props}},{key:"update",value:function(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Sl(this);var t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Du),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}},{key:"setProps",value:function(e){var t={};for(var n in this._props)t[n]=this._props[n];for(var r in t.state=this.state,e)t[r]=e[r];this.update(t)}},{key:"updateState",value:function(e){this.updateStateInner(e,this._props)}},{key:"updateStateInner",value:function(e,t){var n,r=this.state,i=!1,o=!1;e.storedMarks&&this.composing&&(Bl(this),o=!0),this.state=e;var a=r.plugins!=e.plugins||this._props.plugins!=t.plugins;if(a||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){var s=Au(this);(function(e,t){var n=0,r=0;for(var i in e){if(e[i]!=t[i])return!0;n++}for(var o in t)r++;return n!=r})(s,this.nodeViews)&&(this.nodeViews=s,i=!0)}(a||t.handleDOMEvents!=this._props.handleDOMEvents)&&Sl(this),this.editable=Eu(this),Ou(this);var c=hu(this),l=Tu(this),u=r.plugins==e.plugins||r.doc.eq(e.doc)?e.scrollToSelection>r.scrollToSelection?"to selection":"preserve":"reset",d=i||!this.docView.matchesNode(e.doc,l,c);!d&&e.selection.eq(r.selection)||(o=!0);var h,f,p,v,m,g,y,k,w,b,x,C="preserve"==u&&o&&null==this.dom.style.overflowAnchor&&function(e){for(var t,n,r=e.dom.getBoundingClientRect(),i=Math.max(0,r.top),o=(r.left+r.right)/2,a=i+1;a<Math.min(innerHeight,r.bottom);a+=5){var s=e.root.elementFromPoint(o,a);if(s&&s!=e.dom&&e.dom.contains(s)){var c=s.getBoundingClientRect();if(c.top>=i-20){t=s,n=c.top;break}}}return{refDOM:t,refTop:n,stack:Xs(e.dom)}}(this);if(o){this.domObserver.stop();var S=d&&(Is||Ls)&&!this.composing&&!r.selection.empty&&!e.selection.empty&&(v=r.selection,m=e.selection,g=Math.min(v.$anchor.sharedDepth(v.head),m.$anchor.sharedDepth(m.head)),v.$anchor.start(g)!=m.$anchor.start(g));if(d){var _=Ls?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=Vl(this)),!i&&this.docView.update(e.doc,l,c,this)||(this.docView.updateOuterDeco(l),this.docView.destroy(),this.docView=wc(e.doc,l,c,this.dom,this)),_&&!this.trackWrites&&(S=!0)}S||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&(h=this,f=h.docView.domFromPos(h.state.selection.anchor,0),p=h.domSelectionRange(),ws(f.node,f.offset,p.anchorNode,p.anchorOffset)))?Bc(this,S):(Hc(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(r),(null===(n=this.dragging)||void 0===n?void 0:n.node)&&!r.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,r),"reset"==u?this.dom.scrollTop=0:"to selection"==u?this.scrollToSelection():C&&(k=(y=C).refDOM,w=y.refTop,b=y.stack,x=k?k.getBoundingClientRect().top:0,Ys(b,0==x?0:x-w))}},{key:"scrollToSelection",value:function(){var e=this,t=this.domSelectionRange().focusNode;if(t&&this.dom.contains(1==t.nodeType?t:t.parentNode))if(this.someProp("handleScrollToSelection",function(t){return t(e)}));else if(this.state.selection instanceof Ba){var n=this.docView.domAfterPos(this.state.selection.from);1==n.nodeType&&Gs(this,n.getBoundingClientRect(),t)}else Gs(this,this.coordsAtPos(this.state.selection.head,1),t);else;}},{key:"destroyPluginViews",value:function(){for(var e;e=this.pluginViews.pop();)e.destroy&&e.destroy()}},{key:"updatePluginViews",value:function(e){if(e&&e.plugins==this.state.plugins&&this.directPlugins==this.prevDirectPlugins)for(var t=0;t<this.pluginViews.length;t++){var n=this.pluginViews[t];n.update&&n.update(this,e)}else{this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(var r=0;r<this.directPlugins.length;r++){var i=this.directPlugins[r];i.spec.view&&this.pluginViews.push(i.spec.view(this))}for(var o=0;o<this.state.plugins.length;o++){var a=this.state.plugins[o];a.spec.view&&this.pluginViews.push(a.spec.view(this))}}}},{key:"updateDraggedNode",value:function(e,t){var n=e.node,r=-1;if(this.state.doc.nodeAt(n.from)==n.node)r=n.from;else{var i=n.from+(this.state.doc.content.size-t.doc.content.size);(i>0&&this.state.doc.nodeAt(i))==n.node&&(r=i)}this.dragging=new Wl(e.slice,e.move,r<0?void 0:Ba.create(this.state.doc,r))}},{key:"someProp",value:function(e,t){var n,r=this._props&&this._props[e];if(null!=r&&(n=t?t(r):r))return n;for(var i=0;i<this.directPlugins.length;i++){var o=this.directPlugins[i].props[e];if(null!=o&&(n=t?t(o):o))return n}var a=this.state.plugins;if(a)for(var s=0;s<a.length;s++){var c=a[s].props[e];if(null!=c&&(n=t?t(c):c))return n}}},{key:"hasFocus",value:function(){if(Is){var e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if("false"==e.contentEditable)return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}},{key:"focus",value:function(){this.domObserver.stop(),this.editable&&function(e){if(e.setActive)return e.setActive();if(Zs)return e.focus(Zs);var t=Xs(e);e.focus(null==Zs?{get preventScroll(){return Zs={preventScroll:!0},!0}}:void 0),Zs||(Zs=!1,Ys(t,0))}(this.dom),Bc(this),this.domObserver.start()}},{key:"root",get:function(){var e=this,t=this._root;if(null==t)for(var n,r=function(t){if(9==t.nodeType||11==t.nodeType&&t.host)return t.getSelection||(Object.getPrototypeOf(t).getSelection=function(){return t.ownerDocument.getSelection()}),{v:e._root=t}},i=this.dom.parentNode;i;i=i.parentNode)if(n=r(i))return n.v;return t||document}},{key:"updateRoot",value:function(){this._root=null}},{key:"posAtCoords",value:function(e){return nc(this,e)}},{key:"coordsAtPos",value:function(e){return ac(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:1)}},{key:"domAtPos",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.docView.domFromPos(e,t)}},{key:"nodeDOM",value:function(e){var t=this.docView.descAt(e);return t?t.nodeDOM:null}},{key:"posAtDOM",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1,r=this.docView.posFromDOM(e,t,n);if(null==r)throw new RangeError("DOM position not inside the editor");return r}},{key:"endOfTextblock",value:function(e,t){return pc(this,t||this.state,e)}},{key:"pasteHTML",value:function(e,t){return $l(this,"",e,!1,t||new ClipboardEvent("paste"))}},{key:"pasteText",value:function(e,t){return $l(this,e,null,!0,t||new ClipboardEvent("paste"))}},{key:"serializeForClipboard",value:function(e){return sl(this,e)}},{key:"destroy",value:function(){this.docView&&(!function(e){for(var t in e.domObserver.stop(),e.input.eventHandlers)e.dom.removeEventListener(t,e.input.eventHandlers[t]);clearTimeout(e.input.composingTimeout),clearTimeout(e.input.lastIOSEnterFallbackTimeout)}(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],hu(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,ys=null)}},{key:"isDestroyed",get:function(){return null==this.docView}},{key:"dispatchEvent",value:function(e){return function(e,t){_l(e,t)||!kl[t.type]||!e.editable&&t.type in wl||kl[t.type](e,t)}(this,e)}},{key:"domSelectionRange",value:function(){var e=this.domSelection();return e?Vs&&11===this.root.nodeType&&function(e){for(var t=e.activeElement;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}(this.dom.ownerDocument)==this.dom&&function(e,t){if(t.getComposedRanges){var n=t.getComposedRanges(e.root)[0];if(n)return ku(e,n)}var r;function i(e){e.preventDefault(),e.stopImmediatePropagation(),r=e.getTargetRanges()[0]}return e.dom.addEventListener("beforeinput",i,!0),document.execCommand("indent"),e.dom.removeEventListener("beforeinput",i,!0),r?ku(e,r):null}(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}},{key:"domSelection",value:function(){return this.root.getSelection()}}])}();function Tu(e){var t=Object.create(null);return t.class="ProseMirror",t.contenteditable=String(e.editable),e.someProp("attributes",function(n){if("function"==typeof n&&(n=n(e.state)),n)for(var r in n)"class"==r?t.class+=" "+n[r]:"style"==r?t.style=(t.style?t.style+";":"")+n[r]:t[r]||"contenteditable"==r||"nodeName"==r||(t[r]=String(n[r]))}),t.translate||(t.translate="no"),[Zl.node(0,e.state.doc.content.size,t)]}function Ou(e){if(e.markCursor){var t=document.createElement("img");t.className="ProseMirror-separator",t.setAttribute("mark-placeholder","true"),t.setAttribute("alt",""),e.cursorWrapper={dom:t,deco:Zl.widget(e.state.selection.from,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function Eu(e){return!e.someProp("editable",function(t){return!1===t(e.state)})}function Au(e){var t=Object.create(null);function n(e){for(var n in e)Object.prototype.hasOwnProperty.call(t,n)||(t[n]=e[n])}return e.someProp("nodeViews",n),e.someProp("markViews",n),t}function Du(e){if(e.spec.state||e.spec.filterTransaction||e.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}Nu.prototype.dispatch=function(e){var t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))};for(var Iu={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},zu={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Ru="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),Pu="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Lu=0;Lu<10;Lu++)Iu[48+Lu]=Iu[96+Lu]=String(Lu);for(Lu=1;Lu<=24;Lu++)Iu[Lu+111]="F"+Lu;for(Lu=65;Lu<=90;Lu++)Iu[Lu]=String.fromCharCode(Lu+32),zu[Lu]=String.fromCharCode(Lu);for(var Bu in Iu)zu.hasOwnProperty(Bu)||(zu[Bu]=Iu[Bu]);var Vu="undefined"!=typeof navigator&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),Fu="undefined"!=typeof navigator&&/Win/.test(navigator.platform);function ju(e){var t,n,r,i,o=e.split(/-(?!$)/),a=o[o.length-1];"Space"==a&&(a=" ");for(var s=0;s<o.length-1;s++){var c=o[s];if(/^(cmd|meta|m)$/i.test(c))i=!0;else if(/^a(lt)?$/i.test(c))t=!0;else if(/^(c|ctrl|control)$/i.test(c))n=!0;else if(/^s(hift)?$/i.test(c))r=!0;else{if(!/^mod$/i.test(c))throw new Error("Unrecognized modifier name: "+c);Vu?i=!0:n=!0}}return t&&(a="Alt-"+a),n&&(a="Ctrl-"+a),i&&(a="Meta-"+a),r&&(a="Shift-"+a),a}function $u(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return t.altKey&&(e="Alt-"+e),t.ctrlKey&&(e="Ctrl-"+e),t.metaKey&&(e="Meta-"+e),n&&t.shiftKey&&(e="Shift-"+e),e}function Hu(e){var t=function(e){var t=Object.create(null);for(var n in e)t[ju(n)]=e[n];return t}(e);return function(e,n){var r,i=function(e){var t=!(Ru&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||Pu&&e.shiftKey&&e.key&&1==e.key.length||"Unidentified"==e.key)&&e.key||(e.shiftKey?zu:Iu)[e.keyCode]||e.key||"Unidentified";return"Esc"==t&&(t="Escape"),"Del"==t&&(t="Delete"),"Left"==t&&(t="ArrowLeft"),"Up"==t&&(t="ArrowUp"),"Right"==t&&(t="ArrowRight"),"Down"==t&&(t="ArrowDown"),t}(n),o=t[$u(i,n)];if(o&&o(e.state,e.dispatch,e))return!0;if(1==i.length&&" "!=i){if(n.shiftKey){var a=t[$u(i,n,!1)];if(a&&a(e.state,e.dispatch,e))return!0}if((n.altKey||n.metaKey||n.ctrlKey)&&!(Fu&&n.ctrlKey&&n.altKey)&&(r=Iu[n.keyCode])&&r!=i){var s=t[$u(r,n)];if(s&&s(e.state,e.dispatch,e))return!0}}return!1}}var Wu=Object.defineProperty,qu=function(e,t){for(var n in t)Wu(e,n,{get:t[n],enumerable:!0})};function Uu(e){var t=e.state,n=e.transaction,r=n.selection,i=n.doc,o=n.storedMarks;return h(h({},t),{},{apply:t.apply.bind(t),applyTransaction:t.applyTransaction.bind(t),plugins:t.plugins,schema:t.schema,reconfigure:t.reconfigure.bind(t),toJSON:t.toJSON.bind(t),get storedMarks(){return o},get selection(){return r},get doc(){return i},get tr(){return r=n.selection,i=n.doc,o=n.storedMarks,n}})}var Ku=function(){return S(function e(t){x(this,e),this.editor=t.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=t.state},[{key:"hasCustomState",get:function(){return!!this.customState}},{key:"state",get:function(){return this.customState||this.editor.state}},{key:"commands",get:function(){var e=this,t=this.rawCommands,n=this.editor,r=this.state,i=n.view,o=r.tr,a=this.buildProps(o);return Object.fromEntries(Object.entries(t).map(function(t){var n=g(t,2),r=n[0],s=n[1];return[r,function(){var t=s.apply(void 0,arguments)(a);return o.getMeta("preventDispatch")||e.hasCustomState||i.dispatch(o),t}]}))}},{key:"chain",get:function(){var e=this;return function(){return e.createChain()}}},{key:"can",get:function(){var e=this;return function(){return e.createCan()}}},{key:"createChain",value:function(e){var t=this,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=this.rawCommands,i=this.editor,o=this.state,a=i.view,s=[],c=!!e,l=e||o.tr,u=h(h({},Object.fromEntries(Object.entries(r).map(function(e){var r=g(e,2),i=r[0],o=r[1];return[i,function(){var e=t.buildProps(l,n),r=o.apply(void 0,arguments)(e);return s.push(r),u}]}))),{},{run:function(){return c||!n||l.getMeta("preventDispatch")||t.hasCustomState||a.dispatch(l),s.every(function(e){return!0===e})}});return u}},{key:"createCan",value:function(e){var t=this,n=this.rawCommands,r=this.state,i=!1,o=e||r.tr,a=this.buildProps(o,i),s=Object.fromEntries(Object.entries(n).map(function(e){var t=g(e,2),n=t[0],r=t[1];return[n,function(){return r.apply(void 0,arguments)(h(h({},a),{},{dispatch:void 0}))}]}));return h(h({},s),{},{chain:function(){return t.createChain(o,i)}})}},{key:"buildProps",value:function(e){var t=this,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=this.rawCommands,i=this.editor,o=this.state,a=i.view,s={tr:e,editor:i,view:a,state:Uu({state:o,transaction:e}),dispatch:n?function(){}:void 0,chain:function(){return t.createChain(e,n)},can:function(){return t.createCan(e)},get commands(){return Object.fromEntries(Object.entries(r).map(function(e){var t=g(e,2),n=t[0],r=t[1];return[n,function(){return r.apply(void 0,arguments)(s)}]}))}};return s}}])}(),Ju={};qu(Ju,{blur:function(){return Gu},clearContent:function(){return Xu},clearNodes:function(){return Yu},command:function(){return Zu},createParagraphNear:function(){return Qu},cut:function(){return ed},deleteCurrentNode:function(){return td},deleteNode:function(){return rd},deleteRange:function(){return id},deleteSelection:function(){return od},enter:function(){return ad},exitCode:function(){return sd},extendMarkRange:function(){return pd},first:function(){return vd},focus:function(){return wd},forEach:function(){return bd},insertContent:function(){return xd},insertContentAt:function(){return Md},joinBackward:function(){return Od},joinDown:function(){return Td},joinForward:function(){return Ed},joinItemBackward:function(){return Ad},joinItemForward:function(){return Dd},joinTextblockBackward:function(){return Id},joinTextblockForward:function(){return zd},joinUp:function(){return Nd},keyboardShortcut:function(){return Pd},lift:function(){return Bd},liftEmptyBlock:function(){return Vd},liftListItem:function(){return Fd},newlineInCode:function(){return jd},resetAttributes:function(){return Wd},scrollIntoView:function(){return qd},selectAll:function(){return Ud},selectNodeBackward:function(){return Kd},selectNodeForward:function(){return Jd},selectParentNode:function(){return Gd},selectTextblockEnd:function(){return Xd},selectTextblockStart:function(){return Yd},setContent:function(){return Qd},setMark:function(){return Oh},setMeta:function(){return Eh},setNode:function(){return Ah},setNodeSelection:function(){return Dh},setTextDirection:function(){return Ih},setTextSelection:function(){return zh},sinkListItem:function(){return Rh},splitBlock:function(){return Lh},splitListItem:function(){return Bh},toggleList:function(){return jh},toggleMark:function(){return $h},toggleNode:function(){return Hh},toggleWrap:function(){return Wh},undoInputRule:function(){return qh},unsetAllMarks:function(){return Uh},unsetMark:function(){return Kh},unsetTextDirection:function(){return Jh},updateAttributes:function(){return Gh},wrapIn:function(){return Xh},wrapInList:function(){return Yh}});var Gu=function(){return function(e){var t=e.editor,n=e.view;return requestAnimationFrame(function(){var e;t.isDestroyed||(n.dom.blur(),null==(e=null==window?void 0:window.getSelection())||e.removeAllRanges())}),!0}},Xu=function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return function(t){return t.commands.setContent("",{emitUpdate:e})}},Yu=function(){return function(e){var t=e.state,n=e.tr,r=e.dispatch,i=n.selection.ranges;return!r||(i.forEach(function(e){var r=e.$from,i=e.$to;t.doc.nodesBetween(r.pos,i.pos,function(e,t){if(!e.type.isText){var r=n.doc,i=n.mapping,o=r.resolve(i.map(t)),a=r.resolve(i.map(t+e.nodeSize)),s=o.blockRange(a);if(s){var c=aa(s);if(e.type.isTextblock){var l=o.parent.contentMatchAt(o.index()).defaultType;n.setNodeMarkup(s.start,l)}(c||0===c)&&n.lift(s,c)}}})}),!0)}},Zu=function(e){return function(t){return e(t)}},Qu=function(){return function(e){return function(e,t){var n=e.selection,r=n.$from,i=n.$to;if(n instanceof Fa||r.parent.inlineContent||i.parent.inlineContent)return!1;var o=cs(i.parent.contentMatchAt(i.indexAfter()));if(!o||!o.isTextblock)return!1;if(t){var a=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,s=e.tr.insert(a,o.createAndFill());s.setSelection(Pa.create(s.doc,a+1)),t(s.scrollIntoView())}return!0}(e.state,e.dispatch)}},ed=function(e,t){return function(n){var r=n.editor,i=n.tr,o=r.state.doc.slice(e.from,e.to);i.deleteRange(e.from,e.to);var a=i.mapping.map(t);return i.insert(a,o.content),i.setSelection(new Pa(i.doc.resolve(Math.max(a-1,0)))),!0}},td=function(){return function(e){var t=e.tr,n=e.dispatch,r=t.selection.$anchor.node();if(r.content.size>0)return!1;for(var i=t.selection.$anchor,o=i.depth;o>0;o-=1){if(i.node(o).type===r.type){if(n){var a=i.before(o),s=i.after(o);t.delete(a,s).scrollIntoView()}return!0}}return!1}};function nd(e,t){if("string"==typeof e){if(!t.nodes[e])throw Error("There is no node type named '".concat(e,"'. Maybe you forgot to add the extension?"));return t.nodes[e]}return e}var rd=function(e){return function(t){for(var n=t.tr,r=t.state,i=t.dispatch,o=nd(e,r.schema),a=n.selection.$anchor,s=a.depth;s>0;s-=1){if(a.node(s).type===o){if(i){var c=a.before(s),l=a.after(s);n.delete(c,l).scrollIntoView()}return!0}}return!1}},id=function(e){return function(t){var n=t.tr,r=t.dispatch,i=e.from,o=e.to;return r&&n.delete(i,o),!0}},od=function(){return function(e){return function(e,t){return!e.selection.empty&&(t&&t(e.tr.deleteSelection().scrollIntoView()),!0)}(e.state,e.dispatch)}},ad=function(){return function(e){return e.commands.keyboardShortcut("Enter")}},sd=function(){return function(e){return function(e,t){var n=e.selection,r=n.$head,i=n.$anchor;if(!r.parent.type.spec.code||!r.sameParent(i))return!1;var o=r.node(-1),a=r.indexAfter(-1),s=cs(o.contentMatchAt(a));if(!s||!o.canReplaceWith(a,a,s))return!1;if(t){var c=r.after(),l=e.tr.replaceWith(c,c,s.createAndFill());l.setSelection(Da.near(l.doc.resolve(c),1)),t(l.scrollIntoView())}return!0}(e.state,e.dispatch)}};function cd(e){return"[object RegExp]"===Object.prototype.toString.call(e)}function ld(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{strict:!0},r=Object.keys(t);return!r.length||r.every(function(r){return n.strict?t[r]===e[r]:cd(t[r])?t[r].test(e[r]):t[r]===e[r]})}function ud(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return e.find(function(e){return e.type===t&&ld(Object.fromEntries(Object.keys(n).map(function(t){return[t,e.attrs[t]]})),n)})}function dd(e,t){return!!ud(e,t,arguments.length>2&&void 0!==arguments[2]?arguments[2]:{})}function hd(e,t,n){var r;if(e&&t){var i=e.parent.childAfter(e.parentOffset);if(i.node&&i.node.marks.some(function(e){return e.type===t})||(i=e.parent.childBefore(e.parentOffset)),i.node&&i.node.marks.some(function(e){return e.type===t}))if(n=n||(null==(r=i.node.marks[0])?void 0:r.attrs),ud(c(i.node.marks),t,n)){for(var o=i.index,a=e.start()+i.offset,s=o+1,l=a+i.node.nodeSize;o>0&&dd(c(e.parent.child(o-1).marks),t,n);)o-=1,a-=e.parent.child(o).nodeSize;for(;s<e.parent.childCount&&dd(c(e.parent.child(s).marks),t,n);)l+=e.parent.child(s).nodeSize,s+=1;return{from:a,to:l}}}}function fd(e,t){if("string"==typeof e){if(!t.marks[e])throw Error("There is no mark type named '".concat(e,"'. Maybe you forgot to add the extension?"));return t.marks[e]}return e}var pd=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(n){var r=n.tr,i=n.state,o=n.dispatch,a=fd(e,i.schema),s=r.doc,c=r.selection,l=c.$from,u=c.from,d=c.to;if(o){var h=hd(l,a,t);if(h&&h.from<=u&&h.to>=d){var f=Pa.create(s,h.from,h.to);r.setSelection(f)}}return!0}},vd=function(e){return function(t){for(var n="function"==typeof e?e(t):e,r=0;r<n.length;r+=1)if(n[r](t))return!0;return!1}};function md(e){return e instanceof Pa}function gd(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return Math.min(Math.max(e,t),n)}function yd(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(!t)return null;var n=Da.atStart(e),r=Da.atEnd(e);if("start"===t||!0===t)return n;if("end"===t)return r;var i=n.from,o=r.to;return"all"===t?Pa.create(e,gd(0,i,o),gd(e.content.size,i,o)):Pa.create(e,gd(t,i,o),gd(t,i,o))}function kd(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}var wd=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(n){var r=n.editor,i=n.view,o=n.tr,a=n.dispatch;t=h({scrollIntoView:!0},t);var s=function(){(kd()||"Android"===navigator.platform||/android/i.test(navigator.userAgent))&&i.dom.focus(),requestAnimationFrame(function(){r.isDestroyed||(i.focus(),(null==t?void 0:t.scrollIntoView)&&r.commands.scrollIntoView())})};if(i.hasFocus()&&null===e||!1===e)return!0;if(a&&null===e&&!md(r.state.selection))return s(),!0;var c=yd(o.doc,e)||r.state.selection,l=r.state.selection.eq(c);return a&&(l||o.setSelection(c),l&&o.storedMarks&&o.setStoredMarks(o.storedMarks),s()),!0}},bd=function(e,t){return function(n){return e.every(function(e,r){return t(e,h(h({},n),{},{index:r}))})}},xd=function(e,t){return function(n){var r=n.tr;return n.commands.insertContentAt({from:r.selection.from,to:r.selection.to},e,t)}},Cd=function(e){for(var t=e.childNodes,n=t.length-1;n>=0;n-=1){var r=t[n];3===r.nodeType&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?e.removeChild(r):1===r.nodeType&&Cd(r)}return e};function Sd(e){if("undefined"==typeof window)throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");var t="<body>".concat(e,"</body>"),n=(new window.DOMParser).parseFromString(t,"text/html").body;return Cd(n)}function _d(e,t,n){if(e instanceof no||e instanceof Di)return e;n=h({slice:!0,parseOptions:{}},n);var r="string"==typeof e;if("object"===N(e)&&null!==e)try{if(Array.isArray(e)&&e.length>0)return Di.fromArray(e.map(function(e){return t.nodeFromJSON(e)}));var i=t.nodeFromJSON(e);return n.errorOnInvalidContent&&i.check(),i}catch(l){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:l});return console.warn("[tiptap warn]: Invalid content.","Passed value:",e,"Error:",l),_d("",t,n)}if(r){if(n.errorOnInvalidContent){var o=!1,a="",s=new Co({topNode:t.spec.topNode,marks:t.spec.marks,nodes:t.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:function(e){return o=!0,a="string"==typeof e?e:e.outerHTML,null}}]}})});if(n.slice?_o.fromSchema(s).parseSlice(Sd(e),n.parseOptions):_o.fromSchema(s).parse(Sd(e),n.parseOptions),n.errorOnInvalidContent&&o)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error("Invalid element found: ".concat(a))})}var c=_o.fromSchema(t);return n.slice?c.parseSlice(Sd(e),n.parseOptions).content:c.parse(Sd(e),n.parseOptions)}return _d("",t,n)}var Md=function(e,t,n){return function(r){var i,o=r.tr,a=r.dispatch,s=r.editor;if(a){var c;n=h({parseOptions:s.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1},n);var l=function(e){s.emit("contentError",{editor:s,error:e,disableCollaboration:function(){"collaboration"in s.storage&&"object"===N(s.storage.collaboration)&&s.storage.collaboration&&(s.storage.collaboration.isDisabled=!0)}})},u=h({preserveWhitespace:"full"},n.parseOptions);if(!n.errorOnInvalidContent&&!s.options.enableContentCheck&&s.options.emitContentError)try{_d(t,s.schema,{parseOptions:u,errorOnInvalidContent:!0})}catch(wt){l(wt)}try{c=_d(t,s.schema,{parseOptions:u,errorOnInvalidContent:null!=(i=n.errorOnInvalidContent)?i:s.options.enableContentCheck})}catch(wt){return l(wt),!1}var d,f="number"==typeof e?{from:e,to:e}:{from:e.from,to:e.to},p=f.from,v=f.to,m=!0,g=!0;if(("type"in c?[c]:c).forEach(function(e){e.check(),m=!!m&&(e.isText&&0===e.marks.length),g=!!g&&e.isBlock}),p===v&&g){var y=o.doc.resolve(p).parent;y.isTextblock&&!y.type.spec.code&&!y.childCount&&(p-=1,v+=1)}if(m){if(Array.isArray(t))d=t.map(function(e){return e.text||""}).join("");else if(t instanceof Di){var k="";t.forEach(function(e){e.text&&(k+=e.text)}),d=k}else d="object"===N(t)&&t&&t.text?t.text:t;o.insertText(d,p,v)}else{d=c;var w=o.doc.resolve(p),b=w.node(),x=0===w.parentOffset,C=b.isText||b.isTextblock,S=b.content.size>0;x&&C&&S&&(p=Math.max(0,p-1)),o.replaceWith(p,v,d)}n.updateSelection&&function(e,t,n){var r=e.steps.length-1;if(!(r<t)){var i=e.steps[r];if(i instanceof ta||i instanceof na){var o=e.mapping.maps[r],a=0;o.forEach(function(e,t,n,r){0===a&&(a=r)}),e.setSelection(Da.near(e.doc.resolve(a),n))}}}(o,o.steps.length-1,-1),n.applyInputRules&&o.setMeta("applyInputRules",{from:p,text:d}),n.applyPasteRules&&o.setMeta("applyPasteRules",{from:p,text:d})}return!0}},Nd=function(){return function(e){return function(e,t){var n,r=e.selection,i=r instanceof Ba;if(i){if(r.node.isTextblock||!ha(e.doc,r.from))return!1;n=r.from}else if(null==(n=pa(e.doc,r.from,-1)))return!1;if(t){var o=e.tr.join(n);i&&o.setSelection(Ba.create(o.doc,n-e.doc.resolve(n).nodeBefore.nodeSize)),t(o.scrollIntoView())}return!0}(e.state,e.dispatch)}},Td=function(){return function(e){return function(e,t){var n,r=e.selection;if(r instanceof Ba){if(r.node.isTextblock||!ha(e.doc,r.to))return!1;n=r.to}else if(null==(n=pa(e.doc,r.to,1)))return!1;return t&&t(e.tr.join(n).scrollIntoView()),!0}(e.state,e.dispatch)}},Od=function(){return function(e){return function(e,t,n){var r=ts(e,n);if(!r)return!1;var i=is(r);if(!i){var o=r.blockRange(),a=o&&aa(o);return null!=a&&(t&&t(e.tr.lift(o,a).scrollIntoView()),!0)}var s=i.nodeBefore;if(ls(e,i,t,-1))return!0;if(0==r.parent.content.size&&(rs(s,"end")||Ba.isSelectable(s)))for(var c=r.depth;;c--){var l=ma(e.doc,r.before(c),r.after(c),Bi.empty);if(l&&l.slice.size<l.to-l.from){if(t){var u=e.tr.step(l);u.setSelection(rs(s,"end")?Da.findFrom(u.doc.resolve(u.mapping.map(i.pos,-1)),-1):Ba.create(u.doc,i.pos-s.nodeSize)),t(u.scrollIntoView())}return!0}if(1==c||r.node(c-1).childCount>1)break}return!(!s.isAtom||i.depth!=r.depth-1||(t&&t(e.tr.delete(i.pos-s.nodeSize,i.pos).scrollIntoView()),0))}(e.state,e.dispatch)}},Ed=function(){return function(e){return function(e,t,n){var r=as(e,n);if(!r)return!1;var i=ss(r);if(!i)return!1;var o=i.nodeAfter;if(ls(e,i,t,1))return!0;if(0==r.parent.content.size&&(rs(o,"start")||Ba.isSelectable(o))){var a=ma(e.doc,r.before(),r.after(),Bi.empty);if(a&&a.slice.size<a.to-a.from){if(t){var s=e.tr.step(a);s.setSelection(rs(o,"start")?Da.findFrom(s.doc.resolve(s.mapping.map(i.pos)),1):Ba.create(s.doc,s.mapping.map(i.pos))),t(s.scrollIntoView())}return!0}}return!(!o.isAtom||i.depth!=r.depth-1||(t&&t(e.tr.delete(i.pos,i.pos+o.nodeSize).scrollIntoView()),0))}(e.state,e.dispatch)}},Ad=function(){return function(e){var t=e.state,n=e.dispatch,r=e.tr;try{var i=pa(t.doc,t.selection.$from.pos,-1);return null!=i&&(r.join(i,2),n&&n(r),!0)}catch(o){return!1}}},Dd=function(){return function(e){var t=e.state,n=e.dispatch,r=e.tr;try{var i=pa(t.doc,t.selection.$from.pos,1);return null!=i&&(r.join(i,2),n&&n(r),!0)}catch(o){return!1}}},Id=function(){return function(e){return function(e,t,n){var r=ts(e,n);if(!r)return!1;var i=is(r);return!!i&&ns(e,i,t)}(e.state,e.dispatch)}},zd=function(){return function(e){return function(e,t,n){var r=as(e,n);if(!r)return!1;var i=ss(r);return!!i&&ns(e,i,t)}(e.state,e.dispatch)}};function Rd(){return"undefined"!=typeof navigator&&/Mac/.test(navigator.platform)}var Pd=function(e){return function(t){var n=t.editor,r=t.view,i=t.tr,o=t.dispatch,a=function(e){var t,n,r,i,o=e.split(/-(?!$)/),a=o[o.length-1];"Space"===a&&(a=" ");for(var s=0;s<o.length-1;s+=1){var c=o[s];if(/^(cmd|meta|m)$/i.test(c))i=!0;else if(/^a(lt)?$/i.test(c))t=!0;else if(/^(c|ctrl|control)$/i.test(c))n=!0;else if(/^s(hift)?$/i.test(c))r=!0;else{if(!/^mod$/i.test(c))throw new Error("Unrecognized modifier name: ".concat(c));kd()||Rd()?i=!0:n=!0}}return t&&(a="Alt-".concat(a)),n&&(a="Ctrl-".concat(a)),i&&(a="Meta-".concat(a)),r&&(a="Shift-".concat(a)),a}(e).split(/-(?!$)/),s=a.find(function(e){return!["Alt","Ctrl","Meta","Shift"].includes(e)}),c=new KeyboardEvent("keydown",{key:"Space"===s?" ":s,altKey:a.includes("Alt"),ctrlKey:a.includes("Ctrl"),metaKey:a.includes("Meta"),shiftKey:a.includes("Shift"),bubbles:!0,cancelable:!0}),l=n.captureTransaction(function(){r.someProp("handleKeyDown",function(e){return e(r,c)})});return null==l||l.steps.forEach(function(e){var t=e.map(i.mapping);t&&o&&i.maybeStep(t)}),!0}};function Ld(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=e.selection,i=r.from,o=r.to,a=r.empty,s=t?nd(t,e.schema):null,c=[];e.doc.nodesBetween(i,o,function(e,t){if(!e.isText){var n=Math.max(i,t),r=Math.min(o,t+e.nodeSize);c.push({node:e,from:n,to:r})}});var l=o-i,u=c.filter(function(e){return!s||s.name===e.node.type.name}).filter(function(e){return ld(e.node.attrs,n,{strict:!1})});return a?!!u.length:u.reduce(function(e,t){return e+t.to-t.from},0)>=l}var Bd=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(n){var r=n.state,i=n.dispatch;return!!Ld(r,nd(e,r.schema),t)&&function(e,t){var n=e.selection,r=n.$from,i=n.$to,o=r.blockRange(i),a=o&&aa(o);return null!=a&&(t&&t(e.tr.lift(o,a).scrollIntoView()),!0)}(r,i)}},Vd=function(){return function(e){return function(e,t){var n=e.selection.$cursor;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){var r=n.before();if(da(e.doc,r))return t&&t(e.tr.split(r).scrollIntoView()),!0}var i=n.blockRange(),o=i&&aa(i);return null!=o&&(t&&t(e.tr.lift(i,o).scrollIntoView()),!0)}(e.state,e.dispatch)}},Fd=function(e){return function(t){var n=t.state,r=t.dispatch;return vs(nd(e,n.schema))(n,r)}},jd=function(){return function(e){return function(e,t){var n=e.selection,r=n.$head,i=n.$anchor;return!(!r.parent.type.spec.code||!r.sameParent(i)||(t&&t(e.tr.insertText("\n").scrollIntoView()),0))}(e.state,e.dispatch)}};function $d(e,t){return t.nodes[e]?"node":t.marks[e]?"mark":null}function Hd(e,t){var n="string"==typeof t?[t]:t;return Object.keys(e).reduce(function(t,r){return n.includes(r)||(t[r]=e[r]),t},{})}var Wd=function(e,t){return function(n){var r=n.tr,i=n.state,o=n.dispatch,a=null,s=null,c=$d("string"==typeof e?e:e.name,i.schema);if(!c)return!1;"node"===c&&(a=nd(e,i.schema)),"mark"===c&&(s=fd(e,i.schema));var l=!1;return r.selection.ranges.forEach(function(e){i.doc.nodesBetween(e.$from.pos,e.$to.pos,function(e,n){a&&a===e.type&&(l=!0,o&&r.setNodeMarkup(n,void 0,Hd(e.attrs,t))),s&&e.marks.length&&e.marks.forEach(function(i){s===i.type&&(l=!0,o&&r.addMark(n,n+e.nodeSize,s.create(Hd(i.attrs,t))))})})}),l}},qd=function(){return function(e){var t=e.tr;return e.dispatch&&t.scrollIntoView(),!0}},Ud=function(){return function(e){var t=e.tr;if(e.dispatch){var n=new Fa(t.doc);t.setSelection(n)}return!0}},Kd=function(){return function(e){return function(e,t,n){var r=e.selection,i=r.$head,o=i;if(!r.empty)return!1;if(i.parent.isTextblock){if(n?!n.endOfTextblock("backward",e):i.parentOffset>0)return!1;o=is(i)}var a=o&&o.nodeBefore;return!(!a||!Ba.isSelectable(a)||(t&&t(e.tr.setSelection(Ba.create(e.doc,o.pos-a.nodeSize)).scrollIntoView()),0))}(e.state,e.dispatch)}},Jd=function(){return function(e){return function(e,t,n){var r=e.selection,i=r.$head,o=i;if(!r.empty)return!1;if(i.parent.isTextblock){if(n?!n.endOfTextblock("forward",e):i.parentOffset<i.parent.content.size)return!1;o=ss(i)}var a=o&&o.nodeAfter;return!(!a||!Ba.isSelectable(a)||(t&&t(e.tr.setSelection(Ba.create(e.doc,o.pos)).scrollIntoView()),0))}(e.state,e.dispatch)}},Gd=function(){return function(e){return function(e,t){var n,r=e.selection,i=r.$from,o=r.to,a=i.sharedDepth(o);return 0!=a&&(n=i.before(a),t&&t(e.tr.setSelection(Ba.create(e.doc,n))),!0)}(e.state,e.dispatch)}},Xd=function(){return function(e){var t=e.state,n=e.dispatch;return hs(t,n)}},Yd=function(){return function(e){var t=e.state,n=e.dispatch;return ds(t,n)}};function Zd(e,t){return _d(e,t,{slice:!1,parseOptions:arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},errorOnInvalidContent:(arguments.length>3&&void 0!==arguments[3]?arguments[3]:{}).errorOnInvalidContent})}var Qd=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.errorOnInvalidContent,r=t.emitUpdate,i=void 0===r||r,o=t.parseOptions,a=void 0===o?{}:o;return function(t){var r=t.editor,o=t.tr,s=t.dispatch,c=t.commands,l=o.doc;if("full"!==a.preserveWhitespace){var u=Zd(e,r.schema,a,{errorOnInvalidContent:null!=n?n:r.options.enableContentCheck});return s&&o.replaceWith(0,l.content.size,u).setMeta("preventUpdate",!i),!0}return s&&o.setMeta("preventUpdate",!i),c.insertContentAt({from:0,to:l.content.size},e,{parseOptions:a,errorOnInvalidContent:null!=n?n:r.options.enableContentCheck})}};function eh(e,t){var n=fd(t,e.schema),r=e.selection,i=r.from,o=r.to,a=r.empty,s=[];a?(e.storedMarks&&s.push.apply(s,c(e.storedMarks)),s.push.apply(s,c(e.selection.$head.marks()))):e.doc.nodesBetween(i,o,function(e){s.push.apply(s,c(e.marks))});var l=s.find(function(e){return e.type.name===n.name});return l?h({},l.attrs):{}}function th(e){return function(t){return function(e,t){for(var n=e.depth;n>0;n-=1){var r=e.node(n);if(t(r))return{pos:n>0?e.before(n):0,start:e.start(n),depth:n,node:r}}}(t.$from,e)}}function nh(e,t,n){return void 0===e.config[t]&&e.parent?nh(e.parent,t,n):"function"==typeof e.config[t]?e.config[t].bind(h(h({},n),{},{parent:e.parent?nh(e.parent,t,n):null})):e.config[t]}function rh(e){return e.map(function(e){var t=nh(e,"addExtensions",{name:e.name,options:e.options,storage:e.storage});return t?[e].concat(c(rh(t()))):e}).flat(10)}function ih(e,t){var n=Ro.fromSchema(t).serializeFragment(e),r=document.implementation.createHTMLDocument().createElement("div");return r.appendChild(n),r.innerHTML}function oh(e){return"function"==typeof e}function ah(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;if(oh(e)){for(var n=arguments.length,r=new Array(n>2?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i];return t?e.bind(t).apply(void 0,r):e.apply(void 0,r)}return e}function sh(e){return{baseExtensions:e.filter(function(e){return"extension"===e.type}),nodeExtensions:e.filter(function(e){return"node"===e.type}),markExtensions:e.filter(function(e){return"mark"===e.type})}}function ch(e){var t=[],n=sh(e),r=n.nodeExtensions,i=n.markExtensions,o=[].concat(c(r),c(i)),a={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return e.forEach(function(e){var n=nh(e,"addGlobalAttributes",{name:e.name,options:e.options,storage:e.storage,extensions:o});n&&n().forEach(function(e){e.types.forEach(function(n){Object.entries(e.attributes).forEach(function(e){var r=g(e,2),i=r[0],o=r[1];t.push({type:n,name:i,attribute:h(h({},a),o)})})})})}),o.forEach(function(e){var n={name:e.name,options:e.options,storage:e.storage},r=nh(e,"addAttributes",n);if(r){var i=r();Object.entries(i).forEach(function(n){var r=g(n,2),i=r[0],o=r[1],s=h(h({},a),o);"function"==typeof(null==s?void 0:s.default)&&(s.default=s.default()),(null==s?void 0:s.isRequired)&&void 0===(null==s?void 0:s.default)&&delete s.default,t.push({type:e.name,name:i,attribute:s})})}}),t}function lh(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return t.filter(function(e){return!!e}).reduce(function(e,t){var n=h({},e);return Object.entries(t).forEach(function(e){var t=g(e,2),r=t[0],i=t[1];if(n[r])if("class"===r){var o=i?String(i).split(" "):[],a=n[r]?n[r].split(" "):[],s=o.filter(function(e){return!a.includes(e)});n[r]=[].concat(c(a),c(s)).join(" ")}else if("style"===r){var l=i?i.split(";").map(function(e){return e.trim()}).filter(Boolean):[],u=n[r]?n[r].split(";").map(function(e){return e.trim()}).filter(Boolean):[],d=new Map;u.forEach(function(e){var t=g(e.split(":").map(function(e){return e.trim()}),2),n=t[0],r=t[1];d.set(n,r)}),l.forEach(function(e){var t=g(e.split(":").map(function(e){return e.trim()}),2),n=t[0],r=t[1];d.set(n,r)}),n[r]=Array.from(d.entries()).map(function(e){var t=g(e,2),n=t[0],r=t[1];return"".concat(n,": ").concat(r)}).join("; ")}else n[r]=i;else n[r]=i}),n},{})}function uh(e,t){return t.filter(function(t){return t.type===e.type.name}).filter(function(e){return e.attribute.rendered}).map(function(t){return t.attribute.renderHTML?t.attribute.renderHTML(e.attrs)||{}:_({},t.name,e.attrs[t.name])}).reduce(function(e,t){return lh(e,t)},{})}function dh(e,t){return"style"in e?e:h(h({},e),{},{getAttrs:function(n){var r=e.getAttrs?e.getAttrs(n):e.attrs;if(!1===r)return!1;var i=t.reduce(function(e,t){var r=t.attribute.parseHTML?t.attribute.parseHTML(n):function(e){return"string"!=typeof e?e:e.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(e):"true"===e||"false"!==e&&e}(n.getAttribute(t.name));return null==r?e:h(h({},e),{},_({},t.name,r))},{});return h(h({},r),i)}})}function hh(e){return Object.fromEntries(Object.entries(e).filter(function(e){var t=g(e,2),n=t[0],r=t[1];return("attrs"!==n||!function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return 0===Object.keys(e).length&&e.constructor===Object}(r))&&null!=r}))}function fh(e){var t,n,r={};return!(null==(t=null==e?void 0:e.attribute)?void 0:t.isRequired)&&"default"in((null==e?void 0:e.attribute)||{})&&(r.default=e.attribute.default),void 0!==(null==(n=null==e?void 0:e.attribute)?void 0:n.validate)&&(r.validate=e.attribute.validate),[e.name,r]}function ph(e){return e.sort(function(e,t){var n=nh(e,"priority")||100,r=nh(t,"priority")||100;return n>r?-1:n<r?1:0})}function vh(e){var t,n,r=ph(rh(e)),i=(t=r.map(function(e){return e.name}),n=t.filter(function(e,n){return t.indexOf(e)!==n}),Array.from(new Set(n)));return i.length&&console.warn("[tiptap warn]: Duplicate extension names found: [".concat(i.map(function(e){return"'".concat(e,"'")}).join(", "),"]. This can lead to issues.")),r}function mh(e,t,n){var r=t.from,i=t.to,o=n||{},a=o.blockSeparator,s=void 0===a?"\n\n":a,c=o.textSerializers,l=void 0===c?{}:c,u="";return e.nodesBetween(r,i,function(e,n,o,a){var c;e.isBlock&&n>r&&(u+=s);var d=null==l?void 0:l[e.type.name];if(d)return o&&(u+=d({node:e,pos:n,parent:o,index:a,range:t})),!1;e.isText&&(u+=null==(c=null==e?void 0:e.text)?void 0:c.slice(Math.max(r,n)-n,i-n))}),u}function gh(e){return Object.fromEntries(Object.entries(e.nodes).filter(function(e){return g(e,2)[1].spec.toText}).map(function(e){var t=g(e,2);return[t[0],t[1].spec.toText]}))}function yh(e,t){var n=$d("string"==typeof t?t:t.name,e.schema);return"node"===n?function(e,t){var n=nd(t,e.schema),r=e.selection,i=r.from,o=r.to,a=[];e.doc.nodesBetween(i,o,function(e){a.push(e)});var s=a.reverse().find(function(e){return e.type.name===n.name});return s?h({},s.attrs):{}}(e,t):"mark"===n?eh(e,t):{}}function kh(e){var t=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:JSON.stringify,n={};return e.filter(function(e){var r=t(e);return!Object.prototype.hasOwnProperty.call(n,r)&&(n[r]=!0)})}(e);return 1===t.length?t:t.filter(function(e,n){var r=t.filter(function(e,t){return t!==n});return!r.some(function(t){return e.oldRange.from>=t.oldRange.from&&e.oldRange.to<=t.oldRange.to&&e.newRange.from>=t.newRange.from&&e.newRange.to<=t.newRange.to})})}function wh(e,t){return t.nodes[e]||t.marks[e]||null}function bh(e,t,n){return Object.fromEntries(Object.entries(n).filter(function(n){var r=g(n,1)[0],i=e.find(function(e){return e.type===t&&e.name===r});return!!i&&i.attribute.keepOnSplit}))}function xh(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=e.selection,i=r.empty,o=r.ranges,a=t?fd(t,e.schema):null;if(i)return!!(e.storedMarks||e.selection.$from.marks()).filter(function(e){return!a||a.name===e.type.name}).find(function(e){return ld(e.attrs,n,{strict:!1})});var s=0,l=[];if(o.forEach(function(t){var n=t.$from,r=t.$to,i=n.pos,o=r.pos;e.doc.nodesBetween(i,o,function(e,t){if(e.isText||e.marks.length){var n=Math.max(i,t),r=Math.min(o,t+e.nodeSize);s+=r-n,l.push.apply(l,c(e.marks.map(function(e){return{mark:e,from:n,to:r}})))}})}),0===s)return!1;var u=l.filter(function(e){return!a||a.name===e.mark.type.name}).filter(function(e){return ld(e.mark.attrs,n,{strict:!1})}).reduce(function(e,t){return e+t.to-t.from},0),d=l.filter(function(e){return!a||e.mark.type!==a&&e.mark.type.excludes(a)}).reduce(function(e,t){return e+t.to-t.from},0);return(u>0?u+d:u)>=s}function Ch(e,t){return Array.isArray(t)?t.some(function(t){return("string"==typeof t?t:t.name)===e.name}):t}function Sh(e,t){var n=sh(t).nodeExtensions.find(function(t){return t.name===e});if(!n)return!1;var r=ah(nh(n,"group",{name:n.name,options:n.options,storage:n.storage}));return"string"==typeof r&&r.split(" ").includes("list")}function _h(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=n.checkChildren,i=void 0===r||r,o=n.ignoreWhitespace,a=void 0!==o&&o;if(a){if("hardBreak"===e.type.name)return!0;if(e.isText)return/^\s*$/m.test(null!=(t=e.text)?t:"")}if(e.isText)return!e.text;if(e.isAtom||e.isLeaf)return!1;if(0===e.content.childCount)return!0;if(i){var s=!0;return e.content.forEach(function(e){!1!==s&&(_h(e,{ignoreWhitespace:a,checkChildren:i})||(s=!1))}),s}return!1}var Mh=function(){function e(t){x(this,e),this.position=t}return S(e,[{key:"toJSON",value:function(){return{position:this.position}}}],[{key:"fromJSON",value:function(t){return new e(t.position)}}])}();function Nh(e,t){var n=t.mapping.mapResult(e.position);return{position:new Mh(n.pos),mapResult:n}}function Th(e){return new Mh(e)}var Oh=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(n){var r=n.tr,i=n.state,o=n.dispatch,a=r.selection,s=a.empty,c=a.ranges,l=fd(e,i.schema);if(o)if(s){var u=eh(i,l);r.addStoredMark(l.create(h(h({},u),t)))}else c.forEach(function(e){var n=e.$from.pos,o=e.$to.pos;i.doc.nodesBetween(n,o,function(e,i){var a=Math.max(i,n),s=Math.min(i+e.nodeSize,o);e.marks.find(function(e){return e.type===l})?e.marks.forEach(function(e){l===e.type&&r.addMark(a,s,l.create(h(h({},e.attrs),t)))}):r.addMark(a,s,l.create(t))})});return function(e,t,n){var r,i=t.selection,o=null;if(md(i)&&(o=i.$cursor),o){var a=null!=(r=e.storedMarks)?r:o.marks();return o.parent.type.allowsMarkType(n)&&(!!n.isInSet(a)||!a.some(function(e){return e.type.excludes(n)}))}return i.ranges.some(function(t){var r=t.$from,i=t.$to,o=0===r.depth&&e.doc.inlineContent&&e.doc.type.allowsMarkType(n);return e.doc.nodesBetween(r.pos,i.pos,function(e,t,r){if(o)return!1;if(e.isInline){var i=!r||r.type.allowsMarkType(n),a=!!n.isInSet(e.marks)||!e.marks.some(function(e){return e.type.excludes(n)});o=i&&a}return!o}),o})}(i,r,l)}},Eh=function(e,t){return function(n){return n.tr.setMeta(e,t),!0}},Ah=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(n){var r,i=n.state,o=n.dispatch,a=n.chain,s=nd(e,i.schema);return i.selection.$anchor.sameParent(i.selection.$head)&&(r=i.selection.$anchor.parent.attrs),s.isTextblock?a().command(function(e){var n=e.commands;return!!fs(s,h(h({},r),t))(i)||n.clearNodes()}).command(function(e){var n=e.state;return fs(s,h(h({},r),t))(n,o)}).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)}},Dh=function(e){return function(t){var n=t.tr;if(t.dispatch){var r=n.doc,i=gd(e,0,r.content.size),o=Ba.create(r,i);n.setSelection(o)}return!0}},Ih=function(e,t){return function(n){var r,i,o=n.tr,a=n.state,s=n.dispatch,c=a.selection;return"number"==typeof t?(r=t,i=t):t&&"from"in t&&"to"in t?(r=t.from,i=t.to):(r=c.from,i=c.to),s&&o.doc.nodesBetween(r,i,function(t,n){t.isText||o.setNodeMarkup(n,void 0,h(h({},t.attrs),{},{dir:e}))}),!0}},zh=function(e){return function(t){var n=t.tr;if(t.dispatch){var r=n.doc,i="number"==typeof e?{from:e,to:e}:e,o=i.from,a=i.to,s=Pa.atStart(r).from,c=Pa.atEnd(r).to,l=gd(o,s,c),u=gd(a,s,c),d=Pa.create(r,l,u);n.setSelection(d)}return!0}},Rh=function(e){return function(t){var n,r=t.state,i=t.dispatch,o=nd(e,r.schema);return(n=o,function(e,t){var r=e.selection,i=r.$from,o=r.$to,a=i.blockRange(o,function(e){return e.childCount>0&&e.firstChild.type==n});if(!a)return!1;var s=a.startIndex;if(0==s)return!1;var c=a.parent,l=c.child(s-1);if(l.type!=n)return!1;if(t){var u=l.lastChild&&l.lastChild.type==c.type,d=Di.from(u?n.create():null),h=new Bi(Di.from(n.create(null,Di.from(c.type.create(null,d)))),u?3:1,0),f=a.start,p=a.end;t(e.tr.step(new na(f-(u?3:1),p,f,p,h,1,!0)).scrollIntoView())}return!0})(r,i)}};function Ph(e,t){var n=e.storedMarks||e.selection.$to.parentOffset&&e.selection.$from.marks();if(n){var r=n.filter(function(e){return null==t?void 0:t.includes(e.type.name)});e.tr.ensureMarks(r)}}var Lh=function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).keepMarks,t=void 0===e||e;return function(e){var n=e.tr,r=e.state,i=e.dispatch,o=e.editor,a=n.selection,s=n.doc,c=a.$from,l=a.$to,u=bh(o.extensionManager.attributes,c.node().type.name,c.node().attrs);if(a instanceof Ba&&a.node.isBlock)return!(!c.parentOffset||!da(s,c.pos))&&(i&&(t&&Ph(r,o.extensionManager.splittableMarks),n.split(c.pos).scrollIntoView()),!0);if(!c.parent.isBlock)return!1;var d=l.parentOffset===l.parent.content.size,h=0===c.depth?void 0:function(e){for(var t=0;t<e.edgeCount;t+=1){var n=e.edge(t).type;if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}(c.node(-1).contentMatchAt(c.indexAfter(-1))),f=d&&h?[{type:h,attrs:u}]:void 0,p=da(n.doc,n.mapping.map(c.pos),1,f);if(f||p||!da(n.doc,n.mapping.map(c.pos),1,h?[{type:h}]:void 0)||(p=!0,f=h?[{type:h,attrs:u}]:void 0),i){if(p&&(a instanceof Pa&&n.deleteSelection(),n.split(n.mapping.map(c.pos),1,f),h&&!d&&!c.parentOffset&&c.parent.type!==h)){var v=n.mapping.map(c.before()),m=n.doc.resolve(v);c.node(-1).canReplaceWith(m.index(),m.index()+1,h)&&n.setNodeMarkup(n.mapping.map(c.before()),h)}t&&Ph(r,o.extensionManager.splittableMarks),n.scrollIntoView()}return p}},Bh=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(n){var r,i=n.tr,o=n.state,a=n.dispatch,s=n.editor,c=nd(e,o.schema),l=o.selection,u=l.$from,d=l.$to,f=o.selection.node;if(f&&f.isBlock||u.depth<2||!u.sameParent(d))return!1;var p=u.node(-1);if(p.type!==c)return!1;var v=s.extensionManager.attributes;if(0===u.parent.content.size&&u.node(-1).childCount===u.indexAfter(-1)){if(2===u.depth||u.node(-3).type!==c||u.index(-2)!==u.node(-2).childCount-1)return!1;if(a){for(var m=Di.empty,g=u.index(-1)?1:u.index(-2)?2:3,y=u.depth-g;y>=u.depth-3;y-=1)m=Di.from(u.node(y).copy(m));var k=u.indexAfter(-1)<u.node(-2).childCount?1:u.indexAfter(-2)<u.node(-3).childCount?2:3,w=h(h({},bh(v,u.node().type.name,u.node().attrs)),t),b=(null==(r=c.contentMatch.defaultType)?void 0:r.createAndFill(w))||void 0;m=m.append(Di.from(c.createAndFill(null,b)||void 0));var x=u.before(u.depth-(g-1));i.replace(x,u.after(-k),new Bi(m,4-g,0));var C=-1;i.doc.nodesBetween(x,i.doc.content.size,function(e,t){if(C>-1)return!1;e.isTextblock&&0===e.content.size&&(C=t+1)}),C>-1&&i.setSelection(Pa.near(i.doc.resolve(C))),i.scrollIntoView()}return!0}var S=d.pos===u.end()?p.contentMatchAt(0).defaultType:null,_=h(h({},bh(v,p.type.name,p.attrs)),t),M=h(h({},bh(v,u.node().type.name,u.node().attrs)),t);i.delete(u.pos,d.pos);var N=S?[{type:c,attrs:_},{type:S,attrs:M}]:[{type:c,attrs:_}];if(!da(i.doc,u.pos,2))return!1;if(a){var T=o.selection,O=o.storedMarks,E=s.extensionManager.splittableMarks,A=O||T.$to.parentOffset&&T.$from.marks();if(i.split(u.pos,2,N).scrollIntoView(),!A||!a)return!0;var D=A.filter(function(e){return E.includes(e.type.name)});i.ensureMarks(D)}return!0}},Vh=function(e,t){var n=th(function(e){return e.type===t})(e.selection);if(!n)return!0;var r=e.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(void 0===r)return!0;var i=e.doc.nodeAt(r);return n.node.type!==(null==i?void 0:i.type)||!ha(e.doc,n.pos)||(e.join(n.pos),!0)},Fh=function(e,t){var n=th(function(e){return e.type===t})(e.selection);if(!n)return!0;var r=e.doc.resolve(n.start).after(n.depth);if(void 0===r)return!0;var i=e.doc.nodeAt(r);return n.node.type!==(null==i?void 0:i.type)||!ha(e.doc,r)||(e.join(r),!0)},jh=function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return function(i){var o=i.editor,a=i.tr,s=i.state,c=i.dispatch,l=i.chain,u=i.commands,d=i.can,h=o.extensionManager,f=h.extensions,p=h.splittableMarks,v=nd(e,s.schema),m=nd(t,s.schema),g=s.selection,y=s.storedMarks,k=g.$from,w=g.$to,b=k.blockRange(w),x=y||g.$to.parentOffset&&g.$from.marks();if(!b)return!1;var C=th(function(e){return Sh(e.type.name,f)})(g);if(b.depth>=1&&C&&b.depth-C.depth<=1){if(C.node.type===v)return u.liftListItem(m);if(Sh(C.node.type.name,f)&&v.validContent(C.node.content)&&c)return l().command(function(){return a.setNodeMarkup(C.pos,v),!0}).command(function(){return Vh(a,v)}).command(function(){return Fh(a,v)}).run()}return n&&x&&c?l().command(function(){var e=d().wrapInList(v,r),t=x.filter(function(e){return p.includes(e.type.name)});return a.ensureMarks(t),!!e||u.clearNodes()}).wrapInList(v,r).command(function(){return Vh(a,v)}).command(function(){return Fh(a,v)}).run():l().command(function(){return!!d().wrapInList(v,r)||u.clearNodes()}).wrapInList(v,r).command(function(){return Vh(a,v)}).command(function(){return Fh(a,v)}).run()}},$h=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return function(r){var i=r.state,o=r.commands,a=n.extendEmptyMarkRange,s=void 0!==a&&a,c=fd(e,i.schema);return xh(i,c,t)?o.unsetMark(c,{extendEmptyMarkRange:s}):o.setMark(c,t)}},Hh=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return function(r){var i,o=r.state,a=r.commands,s=nd(e,o.schema),c=nd(t,o.schema),l=Ld(o,s,n);return o.selection.$anchor.sameParent(o.selection.$head)&&(i=o.selection.$anchor.parent.attrs),l?a.setNode(c,i):a.setNode(s,h(h({},i),n))}},Wh=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(n){var r=n.state,i=n.commands,o=nd(e,r.schema);return Ld(r,o,t)?i.lift(o):i.wrapIn(o,t)}},qh=function(){return function(e){for(var t=e.state,n=e.dispatch,r=t.plugins,i=0;i<r.length;i+=1){var o=r[i],a=void 0;if(o.spec.isInputRules&&(a=o.getState(t))){if(n){for(var s=t.tr,c=a.transform,l=c.steps.length-1;l>=0;l-=1)s.step(c.steps[l].invert(c.docs[l]));if(a.text){var u=s.doc.resolve(a.from).marks();s.replaceWith(a.from,a.to,t.schema.text(a.text,u))}else s.delete(a.from,a.to)}return!0}}return!1}},Uh=function(){return function(e){var t=e.tr,n=e.dispatch,r=t.selection,i=r.empty,o=r.ranges;return i||n&&o.forEach(function(e){t.removeMark(e.$from.pos,e.$to.pos)}),!0}},Kh=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(n){var r,i=n.tr,o=n.state,a=n.dispatch,s=t.extendEmptyMarkRange,c=void 0!==s&&s,l=i.selection,u=fd(e,o.schema),d=l.$from,h=l.empty,f=l.ranges;if(!a)return!0;if(h&&c){var p=l.from,v=l.to,m=null==(r=d.marks().find(function(e){return e.type===u}))?void 0:r.attrs,g=hd(d,u,m);g&&(p=g.from,v=g.to),i.removeMark(p,v,u)}else f.forEach(function(e){i.removeMark(e.$from.pos,e.$to.pos,u)});return i.removeStoredMark(u),!0}},Jh=function(e){return function(t){var n,r,i=t.tr,o=t.state,a=t.dispatch,s=o.selection;return"number"==typeof e?(n=e,r=e):e&&"from"in e&&"to"in e?(n=e.from,r=e.to):(n=s.from,r=s.to),a&&i.doc.nodesBetween(n,r,function(e,t){if(!e.isText){var n=h({},e.attrs);delete n.dir,i.setNodeMarkup(t,void 0,n)}}),!0}},Gh=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(n){var r=n.tr,i=n.state,o=n.dispatch,a=null,s=null,c=$d("string"==typeof e?e:e.name,i.schema);if(!c)return!1;"node"===c&&(a=nd(e,i.schema)),"mark"===c&&(s=fd(e,i.schema));var l=!1;return r.selection.ranges.forEach(function(e){var n,c,u,d,f=e.$from.pos,p=e.$to.pos;r.selection.empty?i.doc.nodesBetween(f,p,function(e,t){a&&a===e.type&&(l=!0,u=Math.max(t,f),d=Math.min(t+e.nodeSize,p),n=t,c=e)}):i.doc.nodesBetween(f,p,function(e,i){i<f&&a&&a===e.type&&(l=!0,u=Math.max(i,f),d=Math.min(i+e.nodeSize,p),n=i,c=e),i>=f&&i<=p&&(a&&a===e.type&&(l=!0,o&&r.setNodeMarkup(i,void 0,h(h({},e.attrs),t))),s&&e.marks.length&&e.marks.forEach(function(n){if(s===n.type&&(l=!0,o)){var a=Math.max(i,f),c=Math.min(i+e.nodeSize,p);r.addMark(a,c,s.create(h(h({},n.attrs),t)))}}))}),c&&(void 0!==n&&o&&r.setNodeMarkup(n,void 0,h(h({},c.attrs),t)),s&&c.marks.length&&c.marks.forEach(function(e){s===e.type&&o&&r.addMark(u,d,s.create(h(h({},e.attrs),t)))}))}),l}},Xh=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(n){var r=n.state,i=n.dispatch;return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return function(n,r){var i=n.selection,o=i.$from,a=i.$to,s=o.blockRange(a),c=s&&sa(s,e,t);return!!c&&(r&&r(n.tr.wrap(s,c).scrollIntoView()),!0)}}(nd(e,r.schema),t)(r,i)}},Yh=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(n){var r=n.state,i=n.dispatch;return ps(nd(e,r.schema),t)(r,i)}},Zh=function(){return S(function e(){x(this,e),this.callbacks={}},[{key:"on",value:function(e,t){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(t),this}},{key:"emit",value:function(e){for(var t=this,n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];var o=this.callbacks[e];return o&&o.forEach(function(e){return e.apply(t,r)}),this}},{key:"off",value:function(e,t){var n=this.callbacks[e];return n&&(t?this.callbacks[e]=n.filter(function(e){return e!==t}):delete this.callbacks[e]),this}},{key:"once",value:function(e,t){var n=this,r=function(){n.off(e,r);for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];t.apply(n,o)};return this.on(e,r)}},{key:"removeAllListeners",value:function(){this.callbacks={}}}])}(),Qh=S(function e(t){var n;x(this,e),this.find=t.find,this.handler=t.handler,this.undoable=null==(n=t.undoable)||n});function ef(e){var t,n=e.editor,r=e.from,i=e.to,o=e.text,a=e.rules,s=e.plugin,c=n.view;if(c.composing)return!1;var l=c.state.doc.resolve(r);if(l.parent.type.spec.code||(null==(t=l.nodeBefore||l.nodeAfter)?void 0:t.marks.find(function(e){return e.type.spec.code})))return!1;var u=!1,d=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:500,n="",r=e.parentOffset;return e.parent.nodesBetween(Math.max(0,r-t),r,function(e,t,i,o){var a,s,c=(null==(s=(a=e.type.spec).toText)?void 0:s.call(a,{node:e,pos:t,parent:i,index:o}))||e.textContent||"%leaf%";n+=e.isAtom&&!e.isText?c:c.slice(0,Math.max(0,r-t))}),n}(l)+o;return a.forEach(function(e){if(!u){var t=function(e,t){if(cd(t))return t.exec(e);var n=t(e);if(!n)return null;var r=[n.text];return r.index=n.index,r.input=e,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r}(d,e.find);if(t){var a=c.state.tr,l=Uu({state:c.state,transaction:a}),h={from:r-(t[0].length-o.length),to:i},f=new Ku({editor:n,state:l}),p=f.commands,v=f.chain,m=f.can;null!==e.handler({state:l,range:h,match:t,commands:p,chain:v,can:m})&&a.steps.length&&(e.undoable&&a.setMeta(s,{transform:a,from:r,to:i,text:o}),c.dispatch(a),u=!0)}}}),u}function tf(e){return"Object"===function(e){return Object.prototype.toString.call(e).slice(8,-1)}(e)&&(e.constructor===Object&&Object.getPrototypeOf(e)===Object.prototype)}function nf(e,t){var n=h({},e);return tf(e)&&tf(t)&&Object.keys(t).forEach(function(r){tf(t[r])&&tf(e[r])?n[r]=nf(e[r],t[r]):n[r]=t[r]}),n}var rf=function(){return S(function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};x(this,e),this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config=h(h({},this.config),t),this.name=this.config.name},[{key:"options",get:function(){return h({},ah(nh(this,"addOptions",{name:this.name}))||{})}},{key:"storage",get:function(){return h({},ah(nh(this,"addStorage",{name:this.name,options:this.options}))||{})}},{key:"configure",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=this.extend(h(h({},this.config),{},{addOptions:function(){return nf(e.options,t)}}));return n.name=this.name,n.parent=this.parent,n}},{key:"extend",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=new this.constructor(h(h({},this.config),e));return t.parent=this,this.child=t,t.name="name"in e?e.name:t.parent.name,t}}])}(),of=function(t){function n(){var e;return x(this,n),(e=r(this,n,arguments)).type="mark",e}return a(n,t),S(n,[{key:"configure",value:function(t){return e(n,"configure",this,3)([t])}},{key:"extend",value:function(t){var r="function"==typeof t?t():t;return e(n,"extend",this,3)([r])}}],[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new n("function"==typeof e?e():e)}},{key:"handleExit",value:function(e){var t=e.editor,n=e.mark,r=t.state.tr,i=t.state.selection.$from;if(i.pos===i.end()){var o=i.marks(),a=!!o.find(function(e){return(null==e?void 0:e.type.name)===n.name});if(!a)return!1;var s=o.find(function(e){return(null==e?void 0:e.type.name)===n.name});return s&&r.removeStoredMark(s),r.insertText(" ",i.pos),t.view.dispatch(r),!0}return!1}}])}(rf);function af(e){var t=e.editor,n=e.state,r=e.from,i=e.to,o=e.rule,a=e.pasteEvent,s=e.dropEvent,l=new Ku({editor:t,state:n}),u=l.commands,d=l.chain,h=l.can,f=[];return n.doc.nodesBetween(r,i,function(e,t){var l,p,v,m,g;if(!(null==(p=null==(l=e.type)?void 0:l.spec)?void 0:p.code)&&(e.isText||e.isTextblock||e.isInline)){var y=null!=(g=null!=(m=null==(v=e.content)?void 0:v.size)?m:e.nodeSize)?g:0,k=Math.max(r,t),w=Math.min(i,t+y);if(!(k>=w))(function(e,t,n){if(cd(t))return c(e.matchAll(t));var r=t(e,n);return r?r.map(function(t){var n=[t.text];return n.index=t.index,n.input=e,n.data=t.data,t.replaceWith&&(t.text.includes(t.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),n.push(t.replaceWith)),n}):[]})(e.isText?e.text||"":e.textBetween(k-t,w-t,void 0,""),o.find,a).forEach(function(e){if(void 0!==e.index){var t=k+e.index+1,r=t+e[0].length,i={from:n.tr.mapping.map(t),to:n.tr.mapping.map(r)},c=o.handler({state:n,range:i,match:e,commands:u,chain:d,can:h,pasteEvent:a,dropEvent:s});f.push(c)}})}}),f.every(function(e){return null!==e})}var sf=null;function cf(e){var t,n=e.editor,r=e.rules,i=null,o=!1,a=!1,s="undefined"!=typeof ClipboardEvent?new ClipboardEvent("paste"):null;try{t="undefined"!=typeof DragEvent?new DragEvent("drop"):null}catch(l){t=null}var c=function(e){var r=e.state,i=e.from,o=e.to,a=e.rule,c=e.pasteEvt,l=r.tr,u=Uu({state:r,transaction:l});if(af({editor:n,state:u,from:Math.max(i-1,0),to:o.b-1,rule:a,pasteEvent:c,dropEvent:t})&&l.steps.length){try{t="undefined"!=typeof DragEvent?new DragEvent("drop"):null}catch(d){t=null}return s="undefined"!=typeof ClipboardEvent?new ClipboardEvent("paste"):null,l}};return r.map(function(e){return new Ya({view:function(e){var t=function(t){var r;(i=(null==(r=e.dom.parentElement)?void 0:r.contains(t.target))?e.dom.parentElement:null)&&(sf=n)},r=function(){sf&&(sf=null)};return window.addEventListener("dragstart",t),window.addEventListener("dragend",r),{destroy:function(){window.removeEventListener("dragstart",t),window.removeEventListener("dragend",r)}}},props:{handleDOMEvents:{drop:function(e,n){if(a=i===e.dom.parentElement,t=n,!a){var r=sf;(null==r?void 0:r.isEditable)&&setTimeout(function(){var e=r.state.selection;e&&r.commands.deleteRange({from:e.from,to:e.to})},10)}return!1},paste:function(e,t){var n,r=null==(n=t.clipboardData)?void 0:n.getData("text/html");return s=t,o=!!(null==r?void 0:r.includes("data-pm-slice")),!1}}},appendTransaction:function(t,n,r){var i=t[0],l="paste"===i.getMeta("uiEvent")&&!o,u="drop"===i.getMeta("uiEvent")&&!a,d=i.getMeta("applyPasteRules"),h=!!d;if(l||u||h){if(h){var f=d.text;"string"==typeof f||(f=ih(Di.from(f),r.schema));var p=d.from,v=p+f.length,m=function(e){var t,n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return null==(t=n.clipboardData)||t.setData("text/html",e),n}(f);return c({rule:e,state:r,from:p,to:{b:v},pasteEvt:m})}var g=n.doc.content.findDiffStart(r.doc.content),y=n.doc.content.findDiffEnd(r.doc.content);if("number"==typeof g&&y&&g!==y.b)return c({rule:e,state:r,from:g,to:y,pasteEvt:s})}}})})}var lf=function(){return S(function e(t,n){x(this,e),this.splittableMarks=[],this.editor=n,this.baseExtensions=t,this.extensions=vh(t),this.schema=function(e,t){var n,r=ch(e),i=sh(e),o=i.nodeExtensions,a=i.markExtensions,s=null==(n=o.find(function(e){return nh(e,"topNode")}))?void 0:n.name,c=Object.fromEntries(o.map(function(n){var i=r.filter(function(e){return e.type===n.name}),o={name:n.name,options:n.options,storage:n.storage,editor:t},a=e.reduce(function(e,t){var r=nh(t,"extendNodeSchema",o);return h(h({},e),r?r(n):{})},{}),s=hh(h(h({},a),{},{content:ah(nh(n,"content",o)),marks:ah(nh(n,"marks",o)),group:ah(nh(n,"group",o)),inline:ah(nh(n,"inline",o)),atom:ah(nh(n,"atom",o)),selectable:ah(nh(n,"selectable",o)),draggable:ah(nh(n,"draggable",o)),code:ah(nh(n,"code",o)),whitespace:ah(nh(n,"whitespace",o)),linebreakReplacement:ah(nh(n,"linebreakReplacement",o)),defining:ah(nh(n,"defining",o)),isolating:ah(nh(n,"isolating",o)),attrs:Object.fromEntries(i.map(fh))})),c=ah(nh(n,"parseHTML",o));c&&(s.parseDOM=c.map(function(e){return dh(e,i)}));var l=nh(n,"renderHTML",o);l&&(s.toDOM=function(e){return l({node:e,HTMLAttributes:uh(e,i)})});var u=nh(n,"renderText",o);return u&&(s.toText=u),[n.name,s]})),l=Object.fromEntries(a.map(function(n){var i=r.filter(function(e){return e.type===n.name}),o={name:n.name,options:n.options,storage:n.storage,editor:t},a=e.reduce(function(e,t){var r=nh(t,"extendMarkSchema",o);return h(h({},e),r?r(n):{})},{}),s=hh(h(h({},a),{},{inclusive:ah(nh(n,"inclusive",o)),excludes:ah(nh(n,"excludes",o)),group:ah(nh(n,"group",o)),spanning:ah(nh(n,"spanning",o)),code:ah(nh(n,"code",o)),attrs:Object.fromEntries(i.map(fh))})),c=ah(nh(n,"parseHTML",o));c&&(s.parseDOM=c.map(function(e){return dh(e,i)}));var l=nh(n,"renderHTML",o);return l&&(s.toDOM=function(e){return l({mark:e,HTMLAttributes:uh(e,i)})}),[n.name,s]}));return new Co({topNode:s,nodes:c,marks:l})}(this.extensions,n),this.setupExtensions()},[{key:"commands",get:function(){var e=this;return this.extensions.reduce(function(t,n){var r=nh(n,"addCommands",{name:n.name,options:n.options,storage:e.editor.extensionStorage[n.name],editor:e.editor,type:wh(n.name,e.schema)});return r?h(h({},t),r()):t},{})}},{key:"plugins",get:function(){var e=this,t=this.editor;return ph(c(this.extensions).reverse()).flatMap(function(n){var r={name:n.name,options:n.options,storage:e.editor.extensionStorage[n.name],editor:t,type:wh(n.name,e.schema)},i=[],o=nh(n,"addKeyboardShortcuts",r),a={};if("mark"===n.type&&nh(n,"exitable",r)&&(a.ArrowRight=function(){return of.handleExit({editor:t,mark:n})}),o){var s=Object.fromEntries(Object.entries(o()).map(function(e){var n=g(e,2),r=n[0],i=n[1];return[r,function(){return i({editor:t})}]}));a=h(h({},a),s)}var l=function(e){return new Ya({props:{handleKeyDown:Hu(e)}})}(a);i.push(l);var u=nh(n,"addInputRules",r);if(Ch(n,t.options.enableInputRules)&&u){var d=u();if(d&&d.length){var f=function(e){var t=e.editor,n=e.rules,r=new Ya({state:{init:function(){return null},apply:function(e,i,o){var a=e.getMeta(r);if(a)return a;var s=e.getMeta("applyInputRules");return!!s&&setTimeout(function(){var e=s.text;"string"==typeof e||(e=ih(Di.from(e),o.schema));var i=s.from,a=i+e.length;ef({editor:t,from:i,to:a,text:e,rules:n,plugin:r})}),e.selectionSet||e.docChanged?null:i}},props:{handleTextInput:function(e,i,o,a){return ef({editor:t,from:i,to:o,text:a,rules:n,plugin:r})},handleDOMEvents:{compositionend:function(e){return setTimeout(function(){var i=e.state.selection.$cursor;i&&ef({editor:t,from:i.pos,to:i.pos,text:"",rules:n,plugin:r})}),!1}},handleKeyDown:function(e,i){if("Enter"!==i.key)return!1;var o=e.state.selection.$cursor;return!!o&&ef({editor:t,from:o.pos,to:o.pos,text:"\n",rules:n,plugin:r})}},isInputRules:!0});return r}({editor:t,rules:d}),p=Array.isArray(f)?f:[f];i.push.apply(i,c(p))}}var v=nh(n,"addPasteRules",r);if(Ch(n,t.options.enablePasteRules)&&v){var m=v();if(m&&m.length){var y=cf({editor:t,rules:m});i.push.apply(i,c(y))}}var k=nh(n,"addProseMirrorPlugins",r);if(k){var w=k();i.push.apply(i,c(w))}return i})}},{key:"attributes",get:function(){return ch(this.extensions)}},{key:"nodeViews",get:function(){var e=this,t=this.editor,n=sh(this.extensions).nodeExtensions;return Object.fromEntries(n.filter(function(e){return!!nh(e,"addNodeView")}).map(function(n){var r=e.attributes.filter(function(e){return e.type===n.name}),i={name:n.name,options:n.options,storage:e.editor.extensionStorage[n.name],editor:t,type:nd(n.name,e.schema)},o=nh(n,"addNodeView",i);if(!o)return[];var a=o();if(!a)return[];return[n.name,function(e,i,o,s,c){var l=uh(e,r);return a({node:e,view:i,getPos:o,decorations:s,innerDecorations:c,editor:t,extension:n,HTMLAttributes:l})}]}))}},{key:"markViews",get:function(){var e=this,t=this.editor,n=sh(this.extensions).markExtensions;return Object.fromEntries(n.filter(function(e){return!!nh(e,"addMarkView")}).map(function(n){var r=e.attributes.filter(function(e){return e.type===n.name}),i={name:n.name,options:n.options,storage:e.editor.extensionStorage[n.name],editor:t,type:fd(n.name,e.schema)},o=nh(n,"addMarkView",i);if(!o)return[];return[n.name,function(e,i,a){var s=uh(e,r);return o()({mark:e,view:i,inline:a,editor:t,extension:n,HTMLAttributes:s,updateAttributes:function(n){!function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=t.state,i=r.doc,o=r.tr,a=e;i.descendants(function(t,r){var i=o.mapping.map(r),s=o.mapping.map(r)+t.nodeSize,c=null;if(t.marks.forEach(function(e){if(e!==a)return!1;c=e}),c){var l=!1;if(Object.keys(n).forEach(function(e){n[e]!==c.attrs[e]&&(l=!0)}),l){var u=e.type.create(h(h({},e.attrs),n));o.removeMark(i,s,e.type),o.addMark(i,s,u)}}}),o.docChanged&&t.view.dispatch(o)}(e,t,n)}})}]}))}},{key:"setupExtensions",value:function(){var e=this,t=this.extensions;this.editor.extensionStorage=Object.fromEntries(t.map(function(e){return[e.name,e.storage]})),t.forEach(function(t){var n,r={name:t.name,options:t.options,storage:e.editor.extensionStorage[t.name],editor:e.editor,type:wh(t.name,e.schema)};"mark"===t.type&&((null==(n=ah(nh(t,"keepOnSplit",r)))||n)&&e.splittableMarks.push(t.name));var i=nh(t,"onBeforeCreate",r),o=nh(t,"onCreate",r),a=nh(t,"onUpdate",r),s=nh(t,"onSelectionUpdate",r),c=nh(t,"onTransaction",r),l=nh(t,"onFocus",r),u=nh(t,"onBlur",r),d=nh(t,"onDestroy",r);i&&e.editor.on("beforeCreate",i),o&&e.editor.on("create",o),a&&e.editor.on("update",a),s&&e.editor.on("selectionUpdate",s),c&&e.editor.on("transaction",c),l&&e.editor.on("focus",l),u&&e.editor.on("blur",u),d&&e.editor.on("destroy",d)})}}])}();lf.resolve=vh,lf.sort=ph,lf.flatten=rh;qu({},{ClipboardTextSerializer:function(){return df},Commands:function(){return hf},Delete:function(){return ff},Drop:function(){return pf},Editable:function(){return vf},FocusEvents:function(){return gf},Keymap:function(){return yf},Paste:function(){return kf},Tabindex:function(){return wf},TextDirection:function(){return bf},focusEventsPluginKey:function(){return mf}});var uf=function(t){function n(){var e;return x(this,n),(e=r(this,n,arguments)).type="extension",e}return a(n,t),S(n,[{key:"configure",value:function(t){return e(n,"configure",this,3)([t])}},{key:"extend",value:function(t){var r="function"==typeof t?t():t;return e(n,"extend",this,3)([r])}}],[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new n("function"==typeof e?e():e)}}])}(rf),df=uf.create({name:"clipboardTextSerializer",addOptions:function(){return{blockSeparator:void 0}},addProseMirrorPlugins:function(){var e=this;return[new Ya({key:new es("clipboardTextSerializer"),props:{clipboardTextSerializer:function(){var t=e.editor,n=t.state,r=t.schema,i=n.doc,o=n.selection.ranges,a=Math.min.apply(Math,c(o.map(function(e){return e.$from.pos}))),s=Math.max.apply(Math,c(o.map(function(e){return e.$to.pos}))),l=gh(r);return mh(i,{from:a,to:s},h(h({},void 0!==e.options.blockSeparator?{blockSeparator:e.options.blockSeparator}:{}),{},{textSerializers:l}))}}})]}}),hf=uf.create({name:"commands",addCommands:function(){return h({},Ju)}}),ff=uf.create({name:"delete",onUpdate:function(e){var t,n,r,i=this,o=e.transaction,a=e.appendedTransactions,s=function(){var e,t,n,r;if(!(null!=(r=null==(n=null==(t=null==(e=i.editor.options.coreExtensionOptions)?void 0:e.delete)?void 0:t.filterTransaction)?void 0:n.call(t,o))?r:o.getMeta("y-sync$"))){var s,l,u,d=(s=o.before,l=[o].concat(c(a)),u=new Ea(s),l.forEach(function(e){e.steps.forEach(function(e){u.step(e)})}),u),h=function(e){var t=e.mapping,n=e.steps,r=[];return t.maps.forEach(function(e,i){var o=[];if(e.ranges.length)e.forEach(function(e,t){o.push({from:e,to:t})});else{var a=n[i],s=a.from,c=a.to;if(void 0===s||void 0===c)return;o.push({from:s,to:c})}o.forEach(function(e){var n=e.from,o=e.to,a=t.slice(i).map(n,-1),s=t.slice(i).map(o),c=t.invert().map(a,-1),l=t.invert().map(s);r.push({oldRange:{from:c,to:l},newRange:{from:a,to:s}})})}),kh(r)}(d);h.forEach(function(e){d.mapping.mapResult(e.oldRange.from).deletedAfter&&d.mapping.mapResult(e.oldRange.to).deletedBefore&&d.before.nodesBetween(e.oldRange.from,e.oldRange.to,function(t,n){var r=n+t.nodeSize-2,a=e.oldRange.from<=n&&r<=e.oldRange.to;i.editor.emit("delete",{type:"node",node:t,from:n,to:r,newFrom:d.mapping.map(n),newTo:d.mapping.map(r),deletedRange:e.oldRange,newRange:e.newRange,partial:!a,editor:i.editor,transaction:o,combinedTransform:d})})});var f=d.mapping;d.steps.forEach(function(e,t){var n,r;if(e instanceof Zo){var a=f.slice(t).map(e.from,-1),s=f.slice(t).map(e.to),c=f.invert().map(a,-1),l=f.invert().map(s),u=null==(n=d.doc.nodeAt(a-1))?void 0:n.marks.some(function(t){return t.eq(e.mark)}),h=null==(r=d.doc.nodeAt(s))?void 0:r.marks.some(function(t){return t.eq(e.mark)});i.editor.emit("delete",{type:"mark",mark:e.mark,from:e.from,to:e.to,deletedRange:{from:c,to:l},newRange:{from:a,to:s},partial:Boolean(h||u),editor:i.editor,transaction:o,combinedTransform:d})}})}};null==(r=null==(n=null==(t=this.editor.options.coreExtensionOptions)?void 0:t.delete)?void 0:n.async)||r?setTimeout(s,0):s()}}),pf=uf.create({name:"drop",addProseMirrorPlugins:function(){var e=this;return[new Ya({key:new es("tiptapDrop"),props:{handleDrop:function(t,n,r,i){e.editor.emit("drop",{editor:e.editor,event:n,slice:r,moved:i})}}})]}}),vf=uf.create({name:"editable",addProseMirrorPlugins:function(){var e=this;return[new Ya({key:new es("editable"),props:{editable:function(){return e.editor.options.editable}}})]}}),mf=new es("focusEvents"),gf=uf.create({name:"focusEvents",addProseMirrorPlugins:function(){var e=this.editor;return[new Ya({key:mf,props:{handleDOMEvents:{focus:function(t,n){e.isFocused=!0;var r=e.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return t.dispatch(r),!1},blur:function(t,n){e.isFocused=!1;var r=e.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return t.dispatch(r),!1}}}})]}}),yf=uf.create({name:"keymap",addKeyboardShortcuts:function(){var e=this,t=function(){return e.editor.commands.first(function(e){var t=e.commands;return[function(){return t.undoInputRule()},function(){return t.command(function(e){var n=e.tr,r=n.selection,i=n.doc,o=r.empty,a=r.$anchor,s=a.pos,c=a.parent,l=a.parent.isTextblock&&s>0?n.doc.resolve(s-1):a,u=l.parent.type.spec.isolating,d=a.pos-a.parentOffset,h=u&&1===l.parent.childCount?d===a.pos:Da.atStart(i).from===s;return!(!o||!c.type.isTextblock||c.textContent.length||!h||h&&"paragraph"===a.parent.type.name)&&t.clearNodes()})},function(){return t.deleteSelection()},function(){return t.joinBackward()},function(){return t.selectNodeBackward()}]})},n=function(){return e.editor.commands.first(function(e){var t=e.commands;return[function(){return t.deleteSelection()},function(){return t.deleteCurrentNode()},function(){return t.joinForward()},function(){return t.selectNodeForward()}]})},r={Enter:function(){return e.editor.commands.first(function(e){var t=e.commands;return[function(){return t.newlineInCode()},function(){return t.createParagraphNear()},function(){return t.liftEmptyBlock()},function(){return t.splitBlock()}]})},"Mod-Enter":function(){return e.editor.commands.exitCode()},Backspace:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:n,"Mod-Delete":n,"Mod-a":function(){return e.editor.commands.selectAll()}},i=h({},r),o=h(h({},r),{},{"Ctrl-h":t,"Alt-Backspace":t,"Ctrl-d":n,"Ctrl-Alt-Backspace":n,"Alt-Delete":n,"Alt-d":n,"Ctrl-a":function(){return e.editor.commands.selectTextblockStart()},"Ctrl-e":function(){return e.editor.commands.selectTextblockEnd()}});return kd()||Rd()?o:i},addProseMirrorPlugins:function(){var e=this;return[new Ya({key:new es("clearDocument"),appendTransaction:function(t,n,r){if(!t.some(function(e){return e.getMeta("composition")})){var i=t.some(function(e){return e.docChanged})&&!n.doc.eq(r.doc),o=t.some(function(e){return e.getMeta("preventClearDocument")});if(i&&!o){var a=n.selection,s=a.empty,c=a.from,l=a.to,u=Da.atStart(n.doc).from,d=Da.atEnd(n.doc).to;if(!s&&(c===u&&l===d))if(_h(r.doc)){var h=r.tr,f=Uu({state:r,transaction:h});if(new Ku({editor:e.editor,state:f}).commands.clearNodes(),h.steps.length)return h}}}}})]}}),kf=uf.create({name:"paste",addProseMirrorPlugins:function(){var e=this;return[new Ya({key:new es("tiptapPaste"),props:{handlePaste:function(t,n,r){e.editor.emit("paste",{editor:e.editor,event:n,slice:r})}}})]}}),wf=uf.create({name:"tabindex",addProseMirrorPlugins:function(){var e=this;return[new Ya({key:new es("tabindex"),props:{attributes:function(){return e.editor.isEditable?{tabindex:"0"}:{}}}})]}}),bf=uf.create({name:"textDirection",addOptions:function(){return{direction:void 0}},addGlobalAttributes:function(){var e=this;return this.options.direction?[{types:sh(this.extensions).nodeExtensions.filter(function(e){return"text"!==e.name}).map(function(e){return e.name}),attributes:{dir:{default:this.options.direction,parseHTML:function(t){var n=t.getAttribute("dir");return!n||"ltr"!==n&&"rtl"!==n&&"auto"!==n?e.options.direction:n},renderHTML:function(e){return e.dir?{dir:e.dir}:{}}}}}]:[]},addProseMirrorPlugins:function(){var e=this;return[new Ya({key:new es("textDirection"),props:{attributes:function(){var t=e.options.direction;return t?{dir:t}:{}}}})]}}),xf=function(){function e(t,n){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;x(this,e),this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=t,this.editor=n,this.currentNode=i}return S(e,[{key:"name",get:function(){return this.node.type.name}},{key:"node",get:function(){return this.currentNode||this.resolvedPos.node()}},{key:"element",get:function(){return this.editor.view.domAtPos(this.pos).node}},{key:"depth",get:function(){var e;return null!=(e=this.actualDepth)?e:this.resolvedPos.depth}},{key:"pos",get:function(){return this.resolvedPos.pos}},{key:"content",get:function(){return this.node.content},set:function(e){var t=this.from,n=this.to;if(this.isBlock){if(0===this.content.size)return void console.error("You can’t set content on a block node. Tried to set content on ".concat(this.name," at ").concat(this.pos));t=this.from+1,n=this.to-1}this.editor.commands.insertContentAt({from:t,to:n},e)}},{key:"attributes",get:function(){return this.node.attrs}},{key:"textContent",get:function(){return this.node.textContent}},{key:"size",get:function(){return this.node.nodeSize}},{key:"from",get:function(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}},{key:"range",get:function(){return{from:this.from,to:this.to}}},{key:"to",get:function(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}},{key:"parent",get:function(){if(0===this.depth)return null;var t=this.resolvedPos.start(this.resolvedPos.depth-1);return new e(this.resolvedPos.doc.resolve(t),this.editor)}},{key:"before",get:function(){var t=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.from-3)),new e(t,this.editor)}},{key:"after",get:function(){var t=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.to+3)),new e(t,this.editor)}},{key:"children",get:function(){var t=this,n=[];return this.node.content.forEach(function(r,i){var o=r.isBlock&&!r.isTextblock,a=r.isAtom&&!r.isText,s=t.pos+i+(a?0:1);if(!(s<0||s>t.resolvedPos.doc.nodeSize-2)){var c=t.resolvedPos.doc.resolve(s);if(o||!(c.depth<=t.depth)){var l=new e(c,t.editor,o,o?r:null);o&&(l.actualDepth=t.depth+1),n.push(new e(c,t.editor,o,o?r:null))}}}),n}},{key:"firstChild",get:function(){return this.children[0]||null}},{key:"lastChild",get:function(){var e=this.children;return e[e.length-1]||null}},{key:"closest",value:function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=null,r=this.parent;r&&!n;){if(r.node.type.name===e)if(Object.keys(t).length>0)for(var i=r.node.attrs,o=Object.keys(t),a=0;a<o.length;a+=1){var s=o[a];if(i[s]!==t[s])break}else n=r;r=r.parent}return n}},{key:"querySelector",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.querySelectorAll(e,t,!0)[0]||null}},{key:"querySelectorAll",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=[];if(!this.children||0===this.children.length)return r;var i=Object.keys(t);return this.children.forEach(function(o){if(!(n&&r.length>0)){if(o.node.type.name===e)i.every(function(e){return t[e]===o.node.attrs[e]})&&r.push(o);n&&r.length>0||(r=r.concat(o.querySelectorAll(e,t,n)))}}),r}},{key:"setAttribute",value:function(e){var t=this.editor.state.tr;t.setNodeMarkup(this.from,void 0,h(h({},this.node.attrs),e)),this.editor.view.dispatch(t)}}])}();var Cf=function(e){function t(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};x(this,t),(e=r(this,t)).css=null,e.className="tiptap",e.editorView=null,e.isFocused=!1,e.isInitialized=!1,e.extensionStorage={},e.instanceId=Math.random().toString(36).slice(2,9),e.options={element:"undefined"!=typeof document?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,textDirection:void 0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:function(){return null},onCreate:function(){return null},onMount:function(){return null},onUnmount:function(){return null},onUpdate:function(){return null},onSelectionUpdate:function(){return null},onTransaction:function(){return null},onFocus:function(){return null},onBlur:function(){return null},onDestroy:function(){return null},onContentError:function(e){throw e.error},onPaste:function(){return null},onDrop:function(){return null},onDelete:function(){return null}},e.isCapturingTransaction=!1,e.capturedTransaction=null,e.utils={getUpdatedPosition:Nh,createMappablePosition:Th},e.setOptions(n),e.createExtensionManager(),e.createCommandManager(),e.createSchema(),e.on("beforeCreate",e.options.onBeforeCreate),e.emit("beforeCreate",{editor:e}),e.on("mount",e.options.onMount),e.on("unmount",e.options.onUnmount),e.on("contentError",e.options.onContentError),e.on("create",e.options.onCreate),e.on("update",e.options.onUpdate),e.on("selectionUpdate",e.options.onSelectionUpdate),e.on("transaction",e.options.onTransaction),e.on("focus",e.options.onFocus),e.on("blur",e.options.onBlur),e.on("destroy",e.options.onDestroy),e.on("drop",function(t){var n=t.event,r=t.slice,i=t.moved;return e.options.onDrop(n,r,i)}),e.on("paste",function(t){var n=t.event,r=t.slice;return e.options.onPaste(n,r)}),e.on("delete",e.options.onDelete);var i=e.createDoc(),o=yd(i,e.options.autofocus);return e.editorState=Ga.create({doc:i,schema:e.schema,selection:o||void 0}),e.options.element&&e.mount(e.options.element),e}return a(t,e),S(t,[{key:"mount",value:function(e){var t=this;if("undefined"==typeof document)throw new Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(e),this.emit("mount",{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(function(){t.isDestroyed||(!1!==t.options.autofocus&&null!==t.options.autofocus&&t.commands.focus(t.options.autofocus),t.emit("create",{editor:t}),t.isInitialized=!0)},0)}},{key:"unmount",value:function(){if(this.editorView){var e=this.editorView.dom;(null==e?void 0:e.editor)&&delete e.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(".".concat(this.className)).length)try{"function"==typeof this.css.remove?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(t){console.warn("Failed to remove CSS element:",t)}this.css=null,this.emit("unmount",{editor:this})}},{key:"storage",get:function(){return this.extensionStorage}},{key:"commands",get:function(){return this.commandManager.commands}},{key:"chain",value:function(){return this.commandManager.chain()}},{key:"can",value:function(){return this.commandManager.can()}},{key:"injectCSS",value:function(){this.options.injectCSS&&"undefined"!=typeof document&&(this.css=function(e,t,n){var r=document.querySelector("style[data-tiptap-style".concat(n?"-".concat(n):"","]"));if(null!==r)return r;var i=document.createElement("style");return t&&i.setAttribute("nonce",t),i.setAttribute("data-tiptap-style".concat(n?"-".concat(n):""),""),i.innerHTML=e,document.getElementsByTagName("head")[0].appendChild(i),i}('.ProseMirror {\n position: relative;\n}\n\n.ProseMirror {\n word-wrap: break-word;\n white-space: pre-wrap;\n white-space: break-spaces;\n -webkit-font-variant-ligatures: none;\n font-variant-ligatures: none;\n font-feature-settings: "liga" 0; /* the above doesn\'t seem to work in Edge */\n}\n\n.ProseMirror [contenteditable="false"] {\n white-space: normal;\n}\n\n.ProseMirror [contenteditable="false"] [contenteditable="true"] {\n white-space: pre-wrap;\n}\n\n.ProseMirror pre {\n white-space: pre-wrap;\n}\n\nimg.ProseMirror-separator {\n display: inline !important;\n border: none !important;\n margin: 0 !important;\n width: 0 !important;\n height: 0 !important;\n}\n\n.ProseMirror-gapcursor {\n display: none;\n pointer-events: none;\n position: absolute;\n margin: 0;\n}\n\n.ProseMirror-gapcursor:after {\n content: "";\n display: block;\n position: absolute;\n top: -2px;\n width: 20px;\n border-top: 1px solid black;\n animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;\n}\n\n@keyframes ProseMirror-cursor-blink {\n to {\n visibility: hidden;\n }\n}\n\n.ProseMirror-hideselection *::selection {\n background: transparent;\n}\n\n.ProseMirror-hideselection *::-moz-selection {\n background: transparent;\n}\n\n.ProseMirror-hideselection * {\n caret-color: transparent;\n}\n\n.ProseMirror-focused .ProseMirror-gapcursor {\n display: block;\n}',this.options.injectNonce))}},{key:"setOptions",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.options=h(h({},this.options),e),this.editorView&&this.state&&!this.isDestroyed&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}},{key:"setEditable",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.setOptions({editable:e}),t&&this.emit("update",{editor:this,transaction:this.state.tr,appendedTransactions:[]})}},{key:"isEditable",get:function(){return this.options.editable&&this.view&&this.view.editable}},{key:"view",get:function(){var e=this;return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:function(t){e.editorState=t},dispatch:function(t){e.dispatchTransaction(t)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:function(t,n){if(e.editorView)return e.editorView[n];if("state"===n)return e.editorState;if(n in t)return Reflect.get(t,n);throw new Error("[tiptap error]: The editor view is not available. Cannot access view['".concat(n,"']. The editor may not be mounted yet."))}})}},{key:"state",get:function(){return this.editorView&&(this.editorState=this.view.state),this.editorState}},{key:"registerPlugin",value:function(e,t){var n=oh(t)?t(e,c(this.state.plugins)):[].concat(c(this.state.plugins),[e]),r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}},{key:"unregisterPlugin",value:function(e){if(!this.isDestroyed){var t=this.state.plugins,n=t;if([].concat(e).forEach(function(e){var t="string"==typeof e?"".concat(e,"$"):e.key;n=n.filter(function(e){return!e.key.startsWith(t)})}),t.length!==n.length){var r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}}}},{key:"createExtensionManager",value:function(){var e,t,n=this,r=this.options.enableCoreExtensions?[vf,df.configure({blockSeparator:null==(t=null==(e=this.options.coreExtensionOptions)?void 0:e.clipboardTextSerializer)?void 0:t.blockSeparator}),hf,gf,yf,wf,pf,kf,ff,bf.configure({direction:this.options.textDirection})].filter(function(e){return"object"!==N(n.options.enableCoreExtensions)||!1!==n.options.enableCoreExtensions[e.name]}):[],i=[].concat(c(r),c(this.options.extensions)).filter(function(e){return["extension","node","mark"].includes(null==e?void 0:e.type)});this.extensionManager=new lf(i,this)}},{key:"createCommandManager",value:function(){this.commandManager=new Ku({editor:this})}},{key:"createSchema",value:function(){this.schema=this.extensionManager.schema}},{key:"createDoc",value:function(){var e,t=this;try{e=Zd(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(wt){if(!(wt instanceof Error&&["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(wt.message)))throw wt;this.emit("contentError",{editor:this,error:wt,disableCollaboration:function(){"collaboration"in t.storage&&"object"===N(t.storage.collaboration)&&t.storage.collaboration&&(t.storage.collaboration.isDisabled=!0),t.options.extensions=t.options.extensions.filter(function(e){return"collaboration"!==e.name}),t.createExtensionManager()}}),e=Zd(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return e}},{key:"createView",value:function(e){var t;this.editorView=new Nu(e,h(h({},this.options.editorProps),{},{attributes:h({role:"textbox"},null==(t=this.options.editorProps)?void 0:t.attributes),dispatchTransaction:this.dispatchTransaction.bind(this),state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews}));var n=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(n),this.prependClass(),this.injectCSS(),this.view.dom.editor=this}},{key:"createNodeViews",value:function(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}},{key:"prependClass",value:function(){this.view.dom.className="".concat(this.className," ").concat(this.view.dom.className)}},{key:"captureTransaction",value:function(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;var t=this.capturedTransaction;return this.capturedTransaction=null,t}},{key:"dispatchTransaction",value:function(e){var t=this;if(!this.view.isDestroyed){if(this.isCapturingTransaction)return this.capturedTransaction?void e.steps.forEach(function(e){var n;return null==(n=t.capturedTransaction)?void 0:n.step(e)}):void(this.capturedTransaction=e);var n=this.state.applyTransaction(e),r=n.state,i=n.transactions,o=!this.state.selection.eq(r.selection),a=i.includes(e),s=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:e,nextState:r}),a){this.view.updateState(r),this.emit("transaction",{editor:this,transaction:e,appendedTransactions:i.slice(1)}),o&&this.emit("selectionUpdate",{editor:this,transaction:e});var c=i.findLast(function(e){return e.getMeta("focus")||e.getMeta("blur")}),l=null==c?void 0:c.getMeta("focus"),u=null==c?void 0:c.getMeta("blur");l&&this.emit("focus",{editor:this,event:l.event,transaction:c}),u&&this.emit("blur",{editor:this,event:u.event,transaction:c}),e.getMeta("preventUpdate")||!i.some(function(e){return e.docChanged})||s.doc.eq(r.doc)||this.emit("update",{editor:this,transaction:e,appendedTransactions:i.slice(1)})}}}},{key:"getAttributes",value:function(e){return yh(this.state,e)}},{key:"isActive",value:function(e,t){var n="string"==typeof e?e:null,r="string"==typeof e?t:e;return function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!t)return Ld(e,null,n)||xh(e,null,n);var r=$d(t,e.schema);return"node"===r?Ld(e,t,n):"mark"===r&&xh(e,t,n)}(this.state,n,r)}},{key:"getJSON",value:function(){return this.state.doc.toJSON()}},{key:"getHTML",value:function(){return ih(this.state.doc.content,this.schema)}},{key:"getText",value:function(e){var t=e||{},n=t.blockSeparator,r=void 0===n?"\n\n":n,i=t.textSerializers,o=void 0===i?{}:i;return function(e,t){return mh(e,{from:0,to:e.content.size},t)}(this.state.doc,{blockSeparator:r,textSerializers:h(h({},gh(this.schema)),o)})}},{key:"isEmpty",get:function(){return _h(this.state.doc)}},{key:"destroy",value:function(){this.emit("destroy"),this.unmount(),this.removeAllListeners()}},{key:"isDestroyed",get:function(){var e,t;return null==(t=null==(e=this.editorView)?void 0:e.isDestroyed)||t}},{key:"$node",value:function(e,t){var n;return(null==(n=this.$doc)?void 0:n.querySelector(e,t))||null}},{key:"$nodes",value:function(e,t){var n;return(null==(n=this.$doc)?void 0:n.querySelectorAll(e,t))||null}},{key:"$pos",value:function(e){var t=this.state.doc.resolve(e);return new xf(t,this)}},{key:"$doc",get:function(){return this.$pos(0)}}])}(Zh);var Sf=function(){return S(function e(t){var n,r,i,o,a,s=this;x(this,e),this.directions=["bottom-left","bottom-right","top-left","top-right"],this.minSize={height:8,width:8},this.preserveAspectRatio=!1,this.classNames={container:"",wrapper:"",handle:"",resizing:""},this.initialWidth=0,this.initialHeight=0,this.aspectRatio=1,this.isResizing=!1,this.activeHandle=null,this.startX=0,this.startY=0,this.startWidth=0,this.startHeight=0,this.isShiftKeyPressed=!1,this.handleMouseMove=function(e){if(s.isResizing&&s.activeHandle){var t=e.clientX-s.startX,n=e.clientY-s.startY;s.handleResize(t,n)}},this.handleTouchMove=function(e){if(s.isResizing&&s.activeHandle){var t=e.touches[0];if(t){var n=t.clientX-s.startX,r=t.clientY-s.startY;s.handleResize(n,r)}}},this.handleMouseUp=function(){if(s.isResizing){var e=s.element.offsetWidth,t=s.element.offsetHeight;s.onCommit(e,t),s.isResizing=!1,s.activeHandle=null,s.container.dataset.resizeState="false",s.classNames.resizing&&s.container.classList.remove(s.classNames.resizing),document.removeEventListener("mousemove",s.handleMouseMove),document.removeEventListener("mouseup",s.handleMouseUp),document.removeEventListener("keydown",s.handleKeyDown),document.removeEventListener("keyup",s.handleKeyUp)}},this.handleKeyDown=function(e){"Shift"===e.key&&(s.isShiftKeyPressed=!0)},this.handleKeyUp=function(e){"Shift"===e.key&&(s.isShiftKeyPressed=!1)},this.node=t.node,this.element=t.element,this.contentElement=t.contentElement,this.getPos=t.getPos,this.onResize=t.onResize,this.onCommit=t.onCommit,this.onUpdate=t.onUpdate,(null==(n=t.options)?void 0:n.min)&&(this.minSize=h(h({},this.minSize),t.options.min)),(null==(r=t.options)?void 0:r.max)&&(this.maxSize=t.options.max),(null==(i=null==t?void 0:t.options)?void 0:i.directions)&&(this.directions=t.options.directions),(null==(o=t.options)?void 0:o.preserveAspectRatio)&&(this.preserveAspectRatio=t.options.preserveAspectRatio),(null==(a=t.options)?void 0:a.className)&&(this.classNames={container:t.options.className.container||"",wrapper:t.options.className.wrapper||"",handle:t.options.className.handle||"",resizing:t.options.className.resizing||""}),this.wrapper=this.createWrapper(),this.container=this.createContainer(),this.applyInitialSize(),this.attachHandles()},[{key:"dom",get:function(){return this.container}},{key:"contentDOM",get:function(){return this.contentElement}},{key:"update",value:function(e,t,n){return e.type===this.node.type&&(this.node=e,!this.onUpdate||this.onUpdate(e,t,n))}},{key:"destroy",value:function(){this.isResizing&&(this.container.dataset.resizeState="false",this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("keyup",this.handleKeyUp),this.isResizing=!1,this.activeHandle=null),this.container.remove()}},{key:"createContainer",value:function(){var e=document.createElement("div");return e.dataset.resizeContainer="",e.dataset.node=this.node.type.name,e.style.display="flex",e.style.justifyContent="flex-start",e.style.alignItems="flex-start",this.classNames.container&&(e.className=this.classNames.container),e.appendChild(this.wrapper),e}},{key:"createWrapper",value:function(){var e=document.createElement("div");return e.style.position="relative",e.style.display="block",e.dataset.resizeWrapper="",this.classNames.wrapper&&(e.className=this.classNames.wrapper),e.appendChild(this.element),e}},{key:"createHandle",value:function(e){var t=document.createElement("div");return t.dataset.resizeHandle=e,t.style.position="absolute",this.classNames.handle&&(t.className=this.classNames.handle),t}},{key:"positionHandle",value:function(e,t){var n=t.includes("top"),r=t.includes("bottom"),i=t.includes("left"),o=t.includes("right");n&&(e.style.top="0"),r&&(e.style.bottom="0"),i&&(e.style.left="0"),o&&(e.style.right="0"),"top"!==t&&"bottom"!==t||(e.style.left="0",e.style.right="0"),"left"!==t&&"right"!==t||(e.style.top="0",e.style.bottom="0")}},{key:"attachHandles",value:function(){var e=this;this.directions.forEach(function(t){var n=e.createHandle(t);e.positionHandle(n,t),n.addEventListener("mousedown",function(n){return e.handleResizeStart(n,t)}),n.addEventListener("touchstart",function(n){return e.handleResizeStart(n,t)}),e.wrapper.appendChild(n)})}},{key:"applyInitialSize",value:function(){var e=this.node.attrs.width,t=this.node.attrs.height;e?(this.element.style.width="".concat(e,"px"),this.initialWidth=e):this.initialWidth=this.element.offsetWidth,t?(this.element.style.height="".concat(t,"px"),this.initialHeight=t):this.initialHeight=this.element.offsetHeight,this.initialWidth>0&&this.initialHeight>0&&(this.aspectRatio=this.initialWidth/this.initialHeight)}},{key:"handleResizeStart",value:function(e,t){e.preventDefault(),e.stopPropagation(),this.isResizing=!0,this.activeHandle=t,!function(e){return"touches"in e}(e)?(this.startX=e.clientX,this.startY=e.clientY):(this.startX=e.touches[0].clientX,this.startY=e.touches[0].clientY),this.startWidth=this.element.offsetWidth,this.startHeight=this.element.offsetHeight,this.startWidth>0&&this.startHeight>0&&(this.aspectRatio=this.startWidth/this.startHeight),this.getPos(),this.container.dataset.resizeState="true",this.classNames.resizing&&this.container.classList.add(this.classNames.resizing),document.addEventListener("mousemove",this.handleMouseMove),document.addEventListener("touchmove",this.handleTouchMove),document.addEventListener("mouseup",this.handleMouseUp),document.addEventListener("keydown",this.handleKeyDown),document.addEventListener("keyup",this.handleKeyUp)}},{key:"handleResize",value:function(e,t){if(this.activeHandle){var n=this.preserveAspectRatio||this.isShiftKeyPressed,r=this.calculateNewDimensions(this.activeHandle,e,t),i=r.width,o=r.height,a=this.applyConstraints(i,o,n);this.element.style.width="".concat(a.width,"px"),this.element.style.height="".concat(a.height,"px"),this.onResize&&this.onResize(a.width,a.height)}}},{key:"calculateNewDimensions",value:function(e,t,n){var r=this.startWidth,i=this.startHeight,o=e.includes("right"),a=e.includes("left"),s=e.includes("bottom"),c=e.includes("top");return o?r=this.startWidth+t:a&&(r=this.startWidth-t),s?i=this.startHeight+n:c&&(i=this.startHeight-n),"right"!==e&&"left"!==e||(r=this.startWidth+(o?t:-t)),"top"!==e&&"bottom"!==e||(i=this.startHeight+(s?n:-n)),this.preserveAspectRatio||this.isShiftKeyPressed?this.applyAspectRatio(r,i,e):{width:r,height:i}}},{key:"applyConstraints",value:function(e,t,n){var r,i,o,a;if(!n){var s=Math.max(this.minSize.width,e),c=Math.max(this.minSize.height,t);return(null==(r=this.maxSize)?void 0:r.width)&&(s=Math.min(this.maxSize.width,s)),(null==(i=this.maxSize)?void 0:i.height)&&(c=Math.min(this.maxSize.height,c)),{width:s,height:c}}var l=e,u=t;return l<this.minSize.width&&(u=(l=this.minSize.width)/this.aspectRatio),u<this.minSize.height&&(l=(u=this.minSize.height)*this.aspectRatio),(null==(o=this.maxSize)?void 0:o.width)&&l>this.maxSize.width&&(u=(l=this.maxSize.width)/this.aspectRatio),(null==(a=this.maxSize)?void 0:a.height)&&u>this.maxSize.height&&(l=(u=this.maxSize.height)*this.aspectRatio),{width:l,height:u}}},{key:"applyAspectRatio",value:function(e,t,n){var r="top"===n||"bottom"===n;return"left"===n||"right"===n?{width:e,height:e/this.aspectRatio}:r?{width:t*this.aspectRatio,height:t}:{width:e,height:e/this.aspectRatio}}}])}();function _f(e){if(!(null==e?void 0:e.trim()))return{};var t={},n=[],r=e.replace(/["']([^"']*)["']/g,function(e){return n.push(e),"__QUOTED_".concat(n.length-1,"__")}),i=r.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(i){var o=i.map(function(e){return e.trim().slice(1)});t.class=o.join(" ")}var a=r.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);a&&(t.id=a[1]);Array.from(r.matchAll(/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g)).forEach(function(e){var r,i=g(e,3),o=i[1],a=i[2],s=parseInt((null==(r=a.match(/__QUOTED_(\d+)__/))?void 0:r[1])||"0",10),c=n[s];c&&(t[o]=c.slice(1,-1))});var s=r.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g,"").replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();s&&s.split(/\s+/).filter(Boolean).forEach(function(e){e.match(/^[a-zA-Z][\w-]*$/)&&(t[e]=!0)});return t}function Mf(e){if(!e||0===Object.keys(e).length)return"";var t=[];e.class&&String(e.class).split(/\s+/).filter(Boolean).forEach(function(e){return t.push(".".concat(e))});return e.id&&t.push("#".concat(e.id)),Object.entries(e).forEach(function(e){var n=g(e,2),r=n[0],i=n[1];"class"!==r&&"id"!==r&&(!0===i?t.push(r):!1!==i&&null!=i&&t.push("".concat(r,'="').concat(String(i),'"')))}),t.join(" ")}function Nf(e){var t=e.nodeName,n=e.name,r=e.parseAttributes,i=void 0===r?_f:r,o=e.serializeAttributes,a=void 0===o?Mf:o,s=e.defaultAttributes,c=void 0===s?{}:s,l=e.requiredAttributes,u=void 0===l?[]:l,d=e.allowedAttributes,f=n||t;return{parseMarkdown:function(e,n){var r=h(h({},c),e.attributes);return n.createNode(t,r,[])},markdownTokenizer:{name:t,level:"block",start:function(e){var t,n=new RegExp("^:::".concat(f,"(?:\\s|$)"),"m"),r=null==(t=e.match(n))?void 0:t.index;return void 0!==r?r:-1},tokenize:function(e,n,r){var o=new RegExp("^:::".concat(f,"(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)")),a=e.match(o);if(a){var s=a[1]||"",c=i(s);if(!u.find(function(e){return!(e in c)}))return{type:t,raw:a[0],attributes:c}}}},renderMarkdown:function(e){var t=function(e){if(!d)return e;var t={};return d.forEach(function(n){n in e&&(t[n]=e[n])}),t}(e.attrs||{}),n=a(t),r=n?" {".concat(n,"}"):"";return":::".concat(f).concat(r," :::")}}}function Tf(e){var t=e.nodeName,n=e.name,r=e.getContent,i=e.parseAttributes,o=void 0===i?_f:i,a=e.serializeAttributes,s=void 0===a?Mf:a,c=e.defaultAttributes,l=void 0===c?{}:c,u=e.content,d=void 0===u?"block":u,f=e.allowedAttributes,p=n||t;return{parseMarkdown:function(e,n){var i;if(r){var o=r(e);i="string"==typeof o?[{type:"text",text:o}]:o}else i="block"===d?n.parseChildren(e.tokens||[]):n.parseInline(e.tokens||[]);var a=h(h({},l),e.attributes);return n.createNode(t,a,i)},markdownTokenizer:{name:t,level:"block",start:function(e){var t,n=new RegExp("^:::".concat(p),"m"),r=null==(t=e.match(n))?void 0:t.index;return void 0!==r?r:-1},tokenize:function(e,n,r){var i,a=new RegExp("^:::".concat(p,"(?:\\s+\\{([^}]*)\\})?\\s*\\n")),s=e.match(a);if(s){var c=g(s,2),l=c[0],u=c[1],h=o(void 0===u?"":u),f=1,v=l.length,m="",y=/^:::([\w-]*)(\s.*)?/gm,k=e.slice(v);for(y.lastIndex=0;;){var w=y.exec(k);if(null===w)break;var b=w.index,x=w[1];if(!(null==(i=w[2])?void 0:i.endsWith(":::")))if(x)f+=1;else if(0===(f-=1)){var C=k.slice(0,b);m=C.trim();var S=e.slice(0,v+b+w[0].length),_=[];if(m)if("block"===d)for((_=r.blockTokens(C)).forEach(function(e){!e.text||e.tokens&&0!==e.tokens.length||(e.tokens=r.inlineTokens(e.text))});_.length>0;){var M=_[_.length-1];if("paragraph"!==M.type||M.text&&""!==M.text.trim())break;_.pop()}else _=r.inlineTokens(m);return{type:t,raw:S,attributes:h,content:m,tokens:_}}}}}},renderMarkdown:function(e,t){var n=function(e){if(!f)return e;var t={};return f.forEach(function(n){n in e&&(t[n]=e[n])}),t}(e.attrs||{}),r=s(n),i=r?" {".concat(r,"}"):"",o=t.renderChildren(e.content||[],"\n\n");return":::".concat(p).concat(i,"\n\n").concat(o,"\n\n:::")}}}function Of(e){if(!e.trim())return{};for(var t={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g,r=n.exec(e);null!==r;){var i=g(r,4),o=i[1],a=i[2],s=i[3];t[o]=a||s,r=n.exec(e)}return t}function Ef(e){return Object.entries(e).filter(function(e){var t=g(e,2)[1];return null!=t}).map(function(e){var t=g(e,2),n=t[0],r=t[1];return"".concat(n,'="').concat(r,'"')}).join(" ")}function Af(e){var t=e.nodeName,n=e.name,r=e.getContent,i=e.parseAttributes,o=void 0===i?Of:i,a=e.serializeAttributes,s=void 0===a?Ef:a,c=e.defaultAttributes,l=void 0===c?{}:c,u=e.selfClosing,d=void 0!==u&&u,f=e.allowedAttributes,p=n||t,v=p.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:function(e,n){var i=h(h({},l),e.attributes);if(d)return n.createNode(t,i);var o=r?r(e):e.content||"";return o?n.createNode(t,i,[n.createTextNode(o)]):n.createNode(t,i,[])},markdownTokenizer:{name:t,level:"inline",start:function(e){var t=d?new RegExp("\\[".concat(v,"\\s*[^\\]]*\\]")):new RegExp("\\[".concat(v,"\\s*[^\\]]*\\][\\s\\S]*?\\[\\/").concat(v,"\\]")),n=e.match(t),r=null==n?void 0:n.index;return void 0!==r?r:-1},tokenize:function(e,n,r){var i=d?new RegExp("^\\[".concat(v,"\\s*([^\\]]*)\\]")):new RegExp("^\\[".concat(v,"\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/").concat(v,"\\]")),a=e.match(i);if(a){var s="",c="";if(d){c=g(a,2)[1]}else{var l=g(a,3);c=l[1],s=l[2]||""}var u=o(c.trim());return{type:t,raw:a[0],content:s.trim(),attributes:u}}}},renderMarkdown:function(e){var t="";r?t=r(e):e.content&&e.content.length>0&&(t=e.content.filter(function(e){return"text"===e.type}).map(function(e){return e.text}).join(""));var n=function(e){if(!f)return e;var t={};return f.forEach(function(n){n in e&&(t[n]=e[n])}),t}(e.attrs||{}),i=s(n),o=i?" ".concat(i):"";return d?"[".concat(p).concat(o,"]"):"[".concat(p).concat(o,"]").concat(t,"[/").concat(p,"]")}}}function Df(e,t,n){for(var r,i,o,a,s,c=e.split("\n"),l=[],u="",d=0,h=t.baseIndentSize||2,f=function(){var e=c[d],s=e.match(t.itemPattern);if(!s)return l.length>0?0:""===e.trim()?(d+=1,u="".concat(u).concat(e,"\n"),1):{v:void 0};var f=t.extractItemData(s),p=f.indentLevel,v=f.mainContent;u="".concat(u).concat(e,"\n");var m,g=[v];for(d+=1;d<c.length;){var y=c[d];if(""===y.trim()){var k=c.slice(d+1).findIndex(function(e){return""!==e.trim()});if(-1===k)break;var w=c[d+1+k];if(((null==(i=null==(r=w.match(/^(\s*)/))?void 0:r[1])?void 0:i.length)||0)>p){g.push(y),u="".concat(u).concat(y,"\n"),d+=1;continue}break}if(!(((null==(a=null==(o=y.match(/^(\s*)/))?void 0:o[1])?void 0:a.length)||0)>p))break;g.push(y),u="".concat(u).concat(y,"\n"),d+=1}var b=g.slice(1);if(b.length>0){var x=b.map(function(e){return e.slice(p+h)}).join("\n");x.trim()&&(m=t.customNestedParser?t.customNestedParser(x):n.blockTokens(x))}var C=t.createToken(f,m);l.push(C)};d<c.length&&0!==(s=f());)if(1!==s&&s)return s.v;if(0!==l.length)return{items:l,raw:u}}function If(e,t,n,r){if(!e||!Array.isArray(e.content))return"";var i="function"==typeof n?n(r):n,o=function(e){return b(e)||l(e)||k(e)||y()}(e.content),a=o[0],s=o.slice(1),c=t.renderChildren([a]),u=["".concat(i).concat(c)];return s&&s.length>0&&s.forEach(function(e){var n=t.renderChildren([e]);if(n){var r=n.split("\n").map(function(e){return e?t.indent(e):""}).join("\n");u.push(r)}}),u.join("\n")}qu({},{createAtomBlockMarkdownSpec:function(){return Nf},createBlockMarkdownSpec:function(){return Tf},createInlineMarkdownSpec:function(){return Af},parseAttributes:function(){return _f},parseIndentedBlocks:function(){return Df},renderNestedMarkdownContent:function(){return If},serializeAttributes:function(){return Mf}});var zf=function(t){function n(){var e;return x(this,n),(e=r(this,n,arguments)).type="node",e}return a(n,t),S(n,[{key:"configure",value:function(t){return e(n,"configure",this,3)([t])}},{key:"extend",value:function(t){var r="function"==typeof t?t():t;return e(n,"extend",this,3)([r])}}],[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new n("function"==typeof e?e():e)}}])}(rf),Rf=zf.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:function(e,t){return e.content?t.renderChildren(e.content,"\n\n"):""}}),Pf=Rf,Lf=zf.create({name:"text",group:"inline",parseMarkdown:function(e){return{type:"text",text:e.text||""}},renderMarkdown:function(e){return e.text||""}}),Bf=zf.create({name:"paragraph",priority:1e3,addOptions:function(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML:function(){return[{tag:"p"}]},renderHTML:function(e){var t=e.HTMLAttributes;return["p",lh(this.options.HTMLAttributes,t),0]},parseMarkdown:function(e,t){var n=e.tokens||[];return 1===n.length&&"image"===n[0].type?t.parseChildren([n[0]]):t.createNode("paragraph",void 0,t.parseInline(n))},renderMarkdown:function(e,t){return e&&Array.isArray(e.content)?t.renderChildren(e.content):""},addCommands:function(){var e=this;return{setParagraph:function(){return function(t){return t.commands.setNode(e.name)}}}},addKeyboardShortcuts:function(){var e=this;return{"Mod-Alt-0":function(){return e.editor.commands.setParagraph()}}}}),Vf=Bf;function Ff(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new Ya({view:function(t){return new jf(t,e)}})}var jf=function(){return S(function e(t,n){var r,i=this;x(this,e),this.editorView=t,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=null!==(r=n.width)&&void 0!==r?r:1,this.color=!1===n.color?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(function(e){var n=function(t){i[e](t)};return t.dom.addEventListener(e,n),{name:e,handler:n}})},[{key:"destroy",value:function(){var e=this;this.handlers.forEach(function(t){var n=t.name,r=t.handler;return e.editorView.dom.removeEventListener(n,r)})}},{key:"update",value:function(e,t){null!=this.cursorPos&&t.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}},{key:"setCursor",value:function(e){e!=this.cursorPos&&(this.cursorPos=e,null==e?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}},{key:"updateOverlay",value:function(){var e,t=this.editorView.state.doc.resolve(this.cursorPos),n=!t.parent.inlineContent,r=this.editorView.dom,i=r.getBoundingClientRect(),o=i.width/r.offsetWidth,a=i.height/r.offsetHeight;if(n){var s=t.nodeBefore,c=t.nodeAfter;if(s||c){var l=this.editorView.nodeDOM(this.cursorPos-(s?s.nodeSize:0));if(l){var u=l.getBoundingClientRect(),d=s?u.bottom:u.top;s&&c&&(d=(d+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);var h=this.width/2*a;e={left:u.left,right:u.right,top:d-h,bottom:d+h}}}}if(!e){var f=this.editorView.coordsAtPos(this.cursorPos),p=this.width/2*o;e={left:f.left-p,right:f.left+p,top:f.top,bottom:f.bottom}}var v,m,g=this.editorView.dom.offsetParent;if(this.element||(this.element=g.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n),!g||g==document.body&&"static"==getComputedStyle(g).position)v=-pageXOffset,m=-pageYOffset;else{var y=g.getBoundingClientRect(),k=y.width/g.offsetWidth,w=y.height/g.offsetHeight;v=y.left-g.scrollLeft*k,m=y.top-g.scrollTop*w}this.element.style.left=(e.left-v)/o+"px",this.element.style.top=(e.top-m)/a+"px",this.element.style.width=(e.right-e.left)/o+"px",this.element.style.height=(e.bottom-e.top)/a+"px"}},{key:"scheduleRemoval",value:function(e){var t=this;clearTimeout(this.timeout),this.timeout=setTimeout(function(){return t.setCursor(null)},e)}},{key:"dragover",value:function(e){if(this.editorView.editable){var t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),n=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),r=n&&n.type.spec.disableDropCursor,i="function"==typeof r?r(this.editorView,t,e):r;if(t&&!i){var o=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){var a=va(this.editorView.state.doc,o,this.editorView.dragging.slice);null!=a&&(o=a)}this.setCursor(o),this.scheduleRemoval(5e3)}}}},{key:"dragend",value:function(){this.scheduleRemoval(20)}},{key:"drop",value:function(){this.scheduleRemoval(20)}},{key:"dragleave",value:function(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}])}(),$f=function(e){function t(e){return x(this,t),r(this,t,[e,e])}return a(t,e),S(t,[{key:"map",value:function(e,n){var r=e.resolve(n.map(this.head));return t.valid(r)?new t(r):Da.near(r)}},{key:"content",value:function(){return Bi.empty}},{key:"eq",value:function(e){return e instanceof t&&e.head==this.head}},{key:"toJSON",value:function(){return{type:"gapcursor",pos:this.head}}},{key:"getBookmark",value:function(){return new Hf(this.anchor)}}],[{key:"fromJSON",value:function(e,n){if("number"!=typeof n.pos)throw new RangeError("Invalid input for GapCursor.fromJSON");return new t(e.resolve(n.pos))}},{key:"valid",value:function(e){var t=e.parent;if(t.isTextblock||!function(e){for(var t=e.depth;t>=0;t--){var n=e.index(t),r=e.node(t);if(0!=n)for(var i=r.child(n-1);;i=i.lastChild){if(0==i.childCount&&!i.inlineContent||Wf(i.type))return!0;if(i.inlineContent)return!1}else if(r.type.spec.isolating)return!0}return!0}(e)||!function(e){for(var t=e.depth;t>=0;t--){var n=e.indexAfter(t),r=e.node(t);if(n!=r.childCount)for(var i=r.child(n);;i=i.firstChild){if(0==i.childCount&&!i.inlineContent||Wf(i.type))return!0;if(i.inlineContent)return!1}else if(r.type.spec.isolating)return!0}return!0}(e))return!1;var n=t.type.spec.allowGapCursor;if(null!=n)return n;var r=t.contentMatchAt(e.index()).defaultType;return r&&r.isTextblock}},{key:"findGapCursorFrom",value:function(e,n){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];e:for(;;){if(!r&&t.valid(e))return e;for(var i=e.pos,o=null,a=e.depth;;a--){var s=e.node(a);if(n>0?e.indexAfter(a)<s.childCount:e.index(a)>0){o=s.child(n>0?e.indexAfter(a):e.index(a)-1);break}if(0==a)return null;i+=n;var c=e.doc.resolve(i);if(t.valid(c))return c}for(;;){var l=n>0?o.firstChild:o.lastChild;if(!l){if(o.isAtom&&!o.isText&&!Ba.isSelectable(o)){e=e.doc.resolve(i+o.nodeSize*n),r=!1;continue e}break}o=l,i+=n;var u=e.doc.resolve(i);if(t.valid(u))return u}return null}}}])}(Da);$f.prototype.visible=!1,$f.findFrom=$f.findGapCursorFrom,Da.jsonID("gapcursor",$f);var Hf=function(){function e(t){x(this,e),this.pos=t}return S(e,[{key:"map",value:function(t){return new e(t.map(this.pos))}},{key:"resolve",value:function(e){var t=e.resolve(this.pos);return $f.valid(t)?new $f(t):Da.near(t)}}])}();function Wf(e){return e.isAtom||e.spec.isolating||e.spec.createGapCursor}var qf=Hu({ArrowLeft:Uf("horiz",-1),ArrowRight:Uf("horiz",1),ArrowUp:Uf("vert",-1),ArrowDown:Uf("vert",1)});function Uf(e,t){var n="vert"==e?t>0?"down":"up":t>0?"right":"left";return function(e,r,i){var o=e.selection,a=t>0?o.$to:o.$from,s=o.empty;if(o instanceof Pa){if(!i.endOfTextblock(n)||0==a.depth)return!1;s=!1,a=e.doc.resolve(t>0?a.after():a.before())}var c=$f.findGapCursorFrom(a,t,s);return!!c&&(r&&r(e.tr.setSelection(new $f(c))),!0)}}function Kf(e,t,n){if(!e||!e.editable)return!1;var r=e.state.doc.resolve(t);if(!$f.valid(r))return!1;var i=e.posAtCoords({left:n.clientX,top:n.clientY});return!(i&&i.inside>-1&&Ba.isSelectable(e.state.doc.nodeAt(i.inside)))&&(e.dispatch(e.state.tr.setSelection(new $f(r))),!0)}function Jf(e,t){if("insertCompositionText"!=t.inputType||!(e.state.selection instanceof $f))return!1;var n=e.state.selection.$from,r=n.parent.contentMatchAt(n.index()).findWrapping(e.state.schema.nodes.text);if(!r)return!1;for(var i=Di.empty,o=r.length-1;o>=0;o--)i=Di.from(r[o].createAndFill(null,i));var a=e.state.tr.replace(n.pos,n.pos,new Bi(i,0,0));return a.setSelection(Pa.near(a.doc.resolve(n.pos+1))),e.dispatch(a),!1}function Gf(e){if(!(e.selection instanceof $f))return null;var t=document.createElement("div");return t.className="ProseMirror-gapcursor",tu.create(e.doc,[Zl.widget(e.selection.head,t,{key:"gapcursor"})])}var Xf=200,Yf=function(){};Yf.prototype.append=function(e){return e.length?(e=Yf.from(e),!this.length&&e||e.length<Xf&&this.leafAppend(e)||this.length<Xf&&e.leafPrepend(this)||this.appendInner(e)):this},Yf.prototype.prepend=function(e){return e.length?Yf.from(e).append(this):this},Yf.prototype.appendInner=function(e){return new Qf(this,e)},Yf.prototype.slice=function(e,t){return void 0===e&&(e=0),void 0===t&&(t=this.length),e>=t?Yf.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},Yf.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},Yf.prototype.forEach=function(e,t,n){void 0===t&&(t=0),void 0===n&&(n=this.length),t<=n?this.forEachInner(e,t,n,0):this.forEachInvertedInner(e,t,n,0)},Yf.prototype.map=function(e,t,n){void 0===t&&(t=0),void 0===n&&(n=this.length);var r=[];return this.forEach(function(t,n){return r.push(e(t,n))},t,n),r},Yf.from=function(e){return e instanceof Yf?e:e&&e.length?new Zf(e):Yf.empty};var Zf=function(e){function t(t){e.call(this),this.values=t}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(e,n){return 0==e&&n==this.length?this:new t(this.values.slice(e,n))},t.prototype.getInner=function(e){return this.values[e]},t.prototype.forEachInner=function(e,t,n,r){for(var i=t;i<n;i++)if(!1===e(this.values[i],r+i))return!1},t.prototype.forEachInvertedInner=function(e,t,n,r){for(var i=t-1;i>=n;i--)if(!1===e(this.values[i],r+i))return!1},t.prototype.leafAppend=function(e){if(this.length+e.length<=Xf)return new t(this.values.concat(e.flatten()))},t.prototype.leafPrepend=function(e){if(this.length+e.length<=Xf)return new t(e.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(t.prototype,n),t}(Yf);Yf.empty=new Zf([]);var Qf=function(e){function t(t,n){e.call(this),this.left=t,this.right=n,this.length=t.length+n.length,this.depth=Math.max(t.depth,n.depth)+1}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.prototype.getInner=function(e){return e<this.left.length?this.left.get(e):this.right.get(e-this.left.length)},t.prototype.forEachInner=function(e,t,n,r){var i=this.left.length;return!(t<i&&!1===this.left.forEachInner(e,t,Math.min(n,i),r))&&(!(n>i&&!1===this.right.forEachInner(e,Math.max(t-i,0),Math.min(this.length,n)-i,r+i))&&void 0)},t.prototype.forEachInvertedInner=function(e,t,n,r){var i=this.left.length;return!(t>i&&!1===this.right.forEachInvertedInner(e,t-i,Math.max(n,i)-i,r+i))&&(!(n<i&&!1===this.left.forEachInvertedInner(e,Math.min(t,i),n,r))&&void 0)},t.prototype.sliceInner=function(e,t){if(0==e&&t==this.length)return this;var n=this.left.length;return t<=n?this.left.slice(e,t):e>=n?this.right.slice(e-n,t-n):this.left.slice(e,n).append(this.right.slice(0,t-n))},t.prototype.leafAppend=function(e){var n=this.right.leafAppend(e);if(n)return new t(this.left,n)},t.prototype.leafPrepend=function(e){var n=this.left.leafPrepend(e);if(n)return new t(n,this.right)},t.prototype.appendInner=function(e){return this.left.depth>=Math.max(this.right.depth,e.depth)+1?new t(this.left,new t(this.right,e)):new t(this,e)},t}(Yf),ep=function(){function e(t,n){x(this,e),this.items=t,this.eventCount=n}return S(e,[{key:"popEvent",value:function(t,n){var r=this;if(0==this.eventCount)return null;for(var i,o,a=this.items.length;;a--){if(this.items.get(a-1).selection){--a;break}}n&&(i=this.remapping(a,this.items.length),o=i.maps.length);var s,c,l=t.tr,u=[],d=[];return this.items.forEach(function(t,n){if(!t.step)return i||(i=r.remapping(a,n+1),o=i.maps.length),o--,void d.push(t);if(i){d.push(new tp(t.map));var h,f=t.step.map(i.slice(o));f&&l.maybeStep(f).doc&&(h=l.mapping.maps[l.mapping.maps.length-1],u.push(new tp(h,void 0,void 0,u.length+d.length))),o--,h&&i.appendMap(h,o)}else l.maybeStep(t.step);return t.selection?(s=i?t.selection.map(i.slice(o)):t.selection,c=new e(r.items.slice(0,a).append(d.reverse().concat(u)),r.eventCount-1),!1):void 0},this.items.length,0),{remaining:c,transform:l,selection:s}}},{key:"addTransform",value:function(t,n,r,i){for(var o=[],a=this.eventCount,s=this.items,c=!i&&s.length?s.get(s.length-1):null,l=0;l<t.steps.length;l++){var u,d=t.steps[l].invert(t.docs[l]),h=new tp(t.mapping.maps[l],d,n);(u=c&&c.merge(h))&&(h=u,l?o.pop():s=s.slice(0,s.length-1)),o.push(h),n&&(a++,n=void 0),i||(c=h)}var f=a-r.depth;return f>rp&&(s=function(e,t){var n;return e.forEach(function(e,r){if(e.selection&&0==t--)return n=r,!1}),e.slice(n)}(s,f),a-=f),new e(s.append(o),a)}},{key:"remapping",value:function(e,t){var n=new Uo;return this.items.forEach(function(t,r){var i=null!=t.mirrorOffset&&r-t.mirrorOffset>=e?n.maps.length-t.mirrorOffset:void 0;n.appendMap(t.map,i)},e,t),n}},{key:"addMaps",value:function(t){return 0==this.eventCount?this:new e(this.items.append(t.map(function(e){return new tp(e)})),this.eventCount)}},{key:"rebased",value:function(t,n){if(!this.eventCount)return this;var r=[],i=Math.max(0,this.items.length-n),o=t.mapping,a=t.steps.length,s=this.eventCount;this.items.forEach(function(e){e.selection&&s--},i);var c=n;this.items.forEach(function(e){var n=o.getMirror(--c);if(null!=n){a=Math.min(a,n);var i=o.maps[n];if(e.step){var l=t.steps[n].invert(t.docs[n]),u=e.selection&&e.selection.map(o.slice(c+1,n));u&&s++,r.push(new tp(i,l,u))}else r.push(new tp(i))}},i);for(var l=[],u=n;u<a;u++)l.push(new tp(o.maps[u]));var d=new e(this.items.slice(0,i).append(l).append(r),s);return d.emptyItemCount()>500&&(d=d.compress(this.items.length-r.length)),d}},{key:"emptyItemCount",value:function(){var e=0;return this.items.forEach(function(t){t.step||e++}),e}},{key:"compress",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.items.length,n=this.remapping(0,t),r=n.maps.length,i=[],o=0;return this.items.forEach(function(e,a){if(a>=t)i.push(e),e.selection&&o++;else if(e.step){var s=e.step.map(n.slice(r)),c=s&&s.getMap();if(r--,c&&n.appendMap(c,r),s){var l=e.selection&&e.selection.map(n.slice(r));l&&o++;var u,d=new tp(c.invert(),s,l),h=i.length-1;(u=i.length&&i[h].merge(d))?i[h]=u:i.push(d)}}else e.map&&r--},this.items.length,0),new e(Yf.from(i.reverse()),o)}}])}();ep.empty=new ep(Yf.empty,0);var tp=function(){function e(t,n,r,i){x(this,e),this.map=t,this.step=n,this.selection=r,this.mirrorOffset=i}return S(e,[{key:"merge",value:function(t){if(this.step&&t.step&&!t.selection){var n=t.step.merge(this.step);if(n)return new e(n.getMap().invert(),n,this.selection)}}}])}(),np=S(function e(t,n,r,i,o){x(this,e),this.done=t,this.undone=n,this.prevRanges=r,this.prevTime=i,this.prevComposition=o}),rp=20;function ip(e){for(var t=[],n=e.length-1;n>=0&&0==t.length;n--)e[n].forEach(function(e,n,r,i){return t.push(r,i)});return t}function op(e,t){if(!e)return null;for(var n=[],r=0;r<e.length;r+=2){var i=t.map(e[r],1),o=t.map(e[r+1],-1);i<=o&&n.push(i,o)}return n}var ap=!1,sp=null;function cp(e){var t=e.plugins;if(sp!=t){ap=!1,sp=t;for(var n=0;n<t.length;n++)if(t[n].spec.historyPreserveItems){ap=!0;break}}return ap}var lp=new es("history"),up=new es("closeHistory");function dp(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},new Ya({key:lp,state:{init:function(){return new np(ep.empty,ep.empty,null,0,-1)},apply:function(t,n,r){return function(e,t,n,r){var i,o=n.getMeta(lp);if(o)return o.historyState;n.getMeta(up)&&(e=new np(e.done,e.undone,null,0,-1));var a=n.getMeta("appendedTransaction");if(0==n.steps.length)return e;if(a&&a.getMeta(lp))return a.getMeta(lp).redo?new np(e.done.addTransform(n,void 0,r,cp(t)),e.undone,ip(n.mapping.maps),e.prevTime,e.prevComposition):new np(e.done,e.undone.addTransform(n,void 0,r,cp(t)),null,e.prevTime,e.prevComposition);if(!1===n.getMeta("addToHistory")||a&&!1===a.getMeta("addToHistory"))return(i=n.getMeta("rebased"))?new np(e.done.rebased(n,i),e.undone.rebased(n,i),op(e.prevRanges,n.mapping),e.prevTime,e.prevComposition):new np(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),op(e.prevRanges,n.mapping),e.prevTime,e.prevComposition);var s=n.getMeta("composition"),c=0==e.prevTime||!a&&e.prevComposition!=s&&(e.prevTime<(n.time||0)-r.newGroupDelay||!function(e,t){if(!t)return!1;if(!e.docChanged)return!0;var n=!1;return e.mapping.maps[0].forEach(function(e,r){for(var i=0;i<t.length;i+=2)e<=t[i+1]&&r>=t[i]&&(n=!0)}),n}(n,e.prevRanges)),l=a?op(e.prevRanges,n.mapping):ip(n.mapping.maps);return new np(e.done.addTransform(n,c?t.selection.getBookmark():void 0,r,cp(t)),ep.empty,l,n.time,null==s?e.prevComposition:s)}(n,r,t,e)}},config:e,props:{handleDOMEvents:{beforeinput:function(e,t){var n=t.inputType,r="historyUndo"==n?fp:"historyRedo"==n?pp:null;return!(!r||!e.editable)&&(t.preventDefault(),r(e.state,e.dispatch))}}}})}function hp(e,t){return function(n,r){var i=lp.getState(n);if(!i||0==(e?i.undone:i.done).eventCount)return!1;if(r){var o=function(e,t,n){var r=cp(t),i=lp.get(t).spec.config,o=(n?e.undone:e.done).popEvent(t,r);if(!o)return null;var a=o.selection.resolve(o.transform.doc),s=(n?e.done:e.undone).addTransform(o.transform,t.selection.getBookmark(),i,r),c=new np(n?s:o.remaining,n?o.remaining:s,null,0,-1);return o.transform.setSelection(a).setMeta(lp,{redo:n,historyState:c})}(i,n,e);o&&r(t?o.scrollIntoView():o)}return!0}}var fp=hp(!1,!0),pp=hp(!0,!0);function vp(e){var t=e.types,n=e.node;return n&&Array.isArray(t)&&t.includes(n.type)||(null==n?void 0:n.type)===t}uf.create({name:"characterCount",addOptions:function(){return{limit:null,mode:"textSize",textCounter:function(e){return e.length},wordCounter:function(e){return e.split(" ").filter(function(e){return""!==e}).length}}},addStorage:function(){return{characters:function(){return 0},words:function(){return 0}}},onBeforeCreate:function(){var e=this;this.storage.characters=function(t){var n=(null==t?void 0:t.node)||e.editor.state.doc;if("textSize"===((null==t?void 0:t.mode)||e.options.mode)){var r=n.textBetween(0,n.content.size,void 0," ");return e.options.textCounter(r)}return n.nodeSize},this.storage.words=function(t){var n=(null==t?void 0:t.node)||e.editor.state.doc,r=n.textBetween(0,n.content.size," "," ");return e.options.wordCounter(r)}},addProseMirrorPlugins:function(){var e=this,t=!1;return[new Ya({key:new es("characterCount"),appendTransaction:function(n,r,i){if(!t){var o=e.options.limit;if(null!=o&&0!==o){var a=e.storage.characters({node:i.doc});if(a>o){var s=a-o;console.warn("[CharacterCount] Initial content exceeded limit of ".concat(o," characters. Content was automatically trimmed."));var c=i.tr.deleteRange(0,s);return t=!0,c}t=!0}else t=!0}},filterTransaction:function(t,n){var r=e.options.limit;if(!t.docChanged||0===r||null==r)return!0;var i=e.storage.characters({node:n.doc}),o=e.storage.characters({node:t.doc});if(o<=r)return!0;if(i>r&&o>r&&o<=i)return!0;if(i>r&&o>r&&o>i)return!1;if(!t.getMeta("paste"))return!1;var a=t.selection.$head.pos,s=a-(o-r),c=a;return t.deleteRange(s,c),!(e.storage.characters({node:t.doc})>r)}})]}}),uf.create({name:"dropCursor",addOptions:function(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins:function(){return[Ff(this.options)]}}),uf.create({name:"focus",addOptions:function(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins:function(){var e=this;return[new Ya({key:new es("focus"),props:{decorations:function(t){var n=t.doc,r=t.selection,i=e.editor,o=i.isEditable,a=i.isFocused,s=r.anchor,c=[];if(!o||!a)return tu.create(n,[]);var l=0;"deepest"===e.options.mode&&n.descendants(function(e,t){if(!e.isText){if(!(s>=t&&s<=t+e.nodeSize-1))return!1;l+=1}});var u=0;return n.descendants(function(t,n){return!t.isText&&(s>=n&&s<=n+t.nodeSize-1&&(u+=1,"deepest"===e.options.mode&&l-u>0||"shallowest"===e.options.mode&&u>1?"deepest"===e.options.mode:void c.push(Zl.node(n,n+t.nodeSize,{class:e.options.className}))))}),tu.create(n,c)}}})]}}),uf.create({name:"gapCursor",addProseMirrorPlugins:function(){return[new Ya({props:{decorations:Gf,createSelectionBetween:function(e,t,n){return t.pos==n.pos&&$f.valid(n)?new $f(n):null},handleClick:Kf,handleKeyDown:qf,handleDOMEvents:{beforeinput:Jf}}})]},extendNodeSchema:function(e){var t;return{allowGapCursor:null!=(t=ah(nh(e,"allowGapCursor",{name:e.name,options:e.options,storage:e.storage})))?t:null}}}),uf.create({name:"placeholder",addOptions:function(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins:function(){var e=this;return[new Ya({key:new es("placeholder"),props:{decorations:function(t){var n=t.doc,r=t.selection,i=e.editor.isEditable||!e.options.showOnlyWhenEditable,o=r.anchor,a=[];if(!i)return null;var s=e.editor.isEmpty;return n.descendants(function(t,n){var r=o>=n&&o<=n+t.nodeSize,i=!t.isLeaf&&_h(t);if((r||!e.options.showOnlyCurrent)&&i){var c=[e.options.emptyNodeClass];s&&c.push(e.options.emptyEditorClass);var l=Zl.node(n,n+t.nodeSize,{class:c.join(" "),"data-placeholder":"function"==typeof e.options.placeholder?e.options.placeholder({editor:e.editor,node:t,pos:n,hasAnchor:r}):e.options.placeholder});a.push(l)}return e.options.includeChildren}),tu.create(n,a)}}})]}}),uf.create({name:"selection",addOptions:function(){return{className:"selection"}},addProseMirrorPlugins:function(){var e=this.editor,t=this.options;return[new Ya({key:new es("selection"),props:{decorations:function(n){return n.selection.empty||e.isFocused||!e.isEditable||n.selection instanceof Ba||e.view.dragging?null:tu.create(n.doc,[Zl.inline(n.selection.from,n.selection.to,{class:t.className})])}}})]}}),uf.create({name:"trailingNode",addOptions:function(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins:function(){var e,t=this,n=new es(this.name),r=this.options.node||(null==(e=this.editor.schema.topNodeType.contentMatch.defaultType)?void 0:e.name)||"paragraph",i=Object.entries(this.editor.schema.nodes).map(function(e){return g(e,2)[1]}).filter(function(e){return(t.options.notAfter||[]).concat(r).includes(e.name)});return[new Ya({key:n,appendTransaction:function(e,t,i){var o=i.doc,a=i.tr,s=i.schema,c=n.getState(i),l=o.content.size,u=s.nodes[r];if(c)return a.insert(l,u.create())},state:{init:function(e,t){return!vp({node:t.tr.doc.lastChild,types:i})},apply:function(e,t){return e.docChanged?e.getMeta("__uniqueIDTransaction")?t:!vp({node:e.doc.lastChild,types:i}):t}}})]}});var mp=uf.create({name:"undoRedo",addOptions:function(){return{depth:100,newGroupDelay:500}},addCommands:function(){return{undo:function(){return function(e){var t=e.state,n=e.dispatch;return fp(t,n)}},redo:function(){return function(e){var t=e.state,n=e.dispatch;return pp(t,n)}}}},addProseMirrorPlugins:function(){return[dp(this.options)]},addKeyboardShortcuts:function(){var e=this;return{"Mod-z":function(){return e.editor.commands.undo()},"Shift-Mod-z":function(){return e.editor.commands.redo()},"Mod-y":function(){return e.editor.commands.redo()},"Mod-я":function(){return e.editor.commands.undo()},"Shift-Mod-я":function(){return e.editor.commands.redo()}}}}),gp=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,yp=zf.create({name:"image",addOptions:function(){return{inline:!1,allowBase64:!1,HTMLAttributes:{},resize:!1}},inline:function(){return this.options.inline},group:function(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes:function(){return{src:{default:null},alt:{default:null},title:{default:null},width:{default:null},height:{default:null}}},parseHTML:function(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML:function(e){var t=e.HTMLAttributes;return["img",lh(this.options.HTMLAttributes,t)]},parseMarkdown:function(e,t){return t.createNode("image",{src:e.href,title:e.title,alt:e.text})},renderMarkdown:function(e){var t,n,r,i,o,a,s=null!=(n=null==(t=e.attrs)?void 0:t.src)?n:"",c=null!=(i=null==(r=e.attrs)?void 0:r.alt)?i:"",l=null!=(a=null==(o=e.attrs)?void 0:o.title)?a:"";return l?".concat(s,' "').concat(l,'")'):".concat(s,")")},addNodeView:function(){var e=this;if(!this.options.resize||!this.options.resize.enabled||"undefined"==typeof document||!this.editor.isEditable)return null;var t=this.options.resize,n=t.directions,r=t.minWidth,i=t.minHeight,o=t.alwaysPreserveAspectRatio;return function(t){var a=t.node,s=t.getPos,c=t.HTMLAttributes,l=document.createElement("img");Object.entries(c).forEach(function(e){var t=g(e,2),n=t[0],r=t[1];if(null!=r)switch(n){case"width":case"height":break;default:l.setAttribute(n,r)}}),l.src=c.src;var u=new Sf({element:l,node:a,getPos:s,onResize:function(e,t){l.style.width="".concat(e,"px"),l.style.height="".concat(t,"px")},onCommit:function(t,n){var r=s();void 0!==r&&e.editor.chain().setNodeSelection(r).updateAttributes(e.name,{width:t,height:n}).run()},onUpdate:function(e,t,n){return e.type===a.type},options:{directions:n,min:{width:r,height:i},preserveAspectRatio:!0===o}}),d=u.dom;return d.style.visibility="hidden",d.style.pointerEvents="none",l.onload=function(){d.style.visibility="",d.style.pointerEvents=""},u}},addCommands:function(){var e=this;return{setImage:function(t){return function(n){return n.commands.insertContent({type:e.name,attrs:t})}}}},addInputRules:function(){return[(e={find:gp,type:this.type,getAttributes:function(e){var t=g(e,5),n=t[2];return{src:t[3],alt:n,title:t[4]}}},new Qh({find:e.find,handler:function(t){var n=t.state,r=t.range,i=t.match,o=ah(e.getAttributes,void 0,i)||{},a=n.tr,s=r.from,c=r.to,l=e.type.create(o);if(i[1]){var u=s+i[0].lastIndexOf(i[1]);u>c?u=c:c=u+i[1].length;var d=i[0][i[0].length-1];a.insertText(d,s+i[0].length-1),a.replaceWith(u,c,l)}else if(i[0]){var h=e.type.isInline?s:s-1;a.insert(h,e.type.create(o)).delete(a.mapping.map(s),a.mapping.map(c))}a.scrollIntoView()},undoable:e.undoable}))];var e}}),kp=uf.create({name:"fileHandler",addOptions:function(){return{onPaste:void 0,onDrop:void 0,allowedMimeTypes:void 0}},addProseMirrorPlugins:function(){return[(e={key:new es(this.name),editor:this.editor,allowedMimeTypes:this.options.allowedMimeTypes,onDrop:this.options.onDrop,onPaste:this.options.onPaste},t=e.key,n=e.editor,r=e.onPaste,i=e.onDrop,o=e.allowedMimeTypes,new Ya({key:t||new es("fileHandler"),props:{handleDrop:function(e,t){var r;if(!i)return!1;if(!(null==(r=t.dataTransfer)?void 0:r.files.length))return!1;var a=e.posAtCoords({left:t.clientX,top:t.clientY}),s=Array.from(t.dataTransfer.files);return o&&(s=s.filter(function(e){return o.includes(e.type)})),0!==s.length&&(t.preventDefault(),t.stopPropagation(),i(n,s,(null==a?void 0:a.pos)||0),!0)},handlePaste:function(e,t){var i;if(!r)return!1;if(!(null==(i=t.clipboardData)?void 0:i.files.length))return!1;var a=Array.from(t.clipboardData.files),s=t.clipboardData.getData("text/html");return o&&(a=a.filter(function(e){return o.includes(e.type)})),0!==a.length&&(t.preventDefault(),t.stopPropagation(),r(n,a,s),!(s.length>0))}}}))];var e,t,n,r,i,o}}),wp=new ve("chat-editor"),bp=function(e){var t=e.c,n=e.value,r=e.disabled,i=e.onCreate,o=e.onChange,a=e.onKeyDown,s=Qe(null),c=Qe(null);return Ye(function(){if(c.current){var e,r,l=window.ibiz.util.file.getUploadHeaders(),u=window.ibiz.util.file.calcFileUpDownUrl(t.context,t.params,{},{enableNoAccess:!0,globalDownloadPrifix:t.opts.uploader.globalDownloadPrifix}),d=u.uploadUrl,h=u.downloadUrl,p=function(){var e=m(f().m(function e(t){var n,r,i,o;return f().w(function(e){for(;;)switch(e.n){case 0:return(n=new FormData).append("file",t),e.n=1,window.ibiz.net.axios({url:d,method:"post",headers:l,data:n});case 1:if(r=e.v,i=r.data){e.n=2;break}return e.a(2,{name:"",url:""});case 2:return o=h.replace("%fileId%",i.fileid),e.a(2,{name:i.name,url:o})}},e)}));return function(t){return e.apply(this,arguments)}}(),v=new Cf({element:c.current,extensions:[Pf,Lf.extend({addKeyboardShortcuts:function(){return{"Mod-Enter":function(){var e,t;return null===(e=s.current)||void 0===e||e.commands.enter(),null===(t=s.current)||void 0===t||t.commands.scrollIntoView(),!0},"Shift-Enter":function(){var e,t;return null===(e=s.current)||void 0===e||e.commands.enter(),null===(t=s.current)||void 0===t||t.commands.scrollIntoView(),!0}}}}),Vf,mp,yp.configure({inline:!0,allowBase64:!0,HTMLAttributes:{draggable:"false"}}).extend({draggable:!1}),kp.configure({onDrop:(r=m(f().m(function e(t,n){var r;return f().w(function(e){for(;;)switch(e.n){case 0:if((n=n.filter(function(e){return e.type.startsWith("image/")})).length){e.n=1;break}return e.a(2);case 1:return e.n=2,Promise.all(n.map(function(e){return p(e)}));case 2:if(r=e.v,!t.isDestroyed){e.n=3;break}return e.a(2);case 3:t.chain().deleteSelection().insertContentAt(t.state.selection.from,r.map(function(e){return{type:"image",attrs:{src:e.url,alt:e.name}}})).focus().scrollIntoView().run();case 4:return e.a(2)}},e)})),function(e,t){return r.apply(this,arguments)}),onPaste:(e=m(f().m(function e(t,n){var r;return f().w(function(e){for(;;)switch(e.n){case 0:if((n=n.filter(function(e){return e.type.startsWith("image/")})).length){e.n=1;break}return e.a(2);case 1:return e.n=2,Promise.all(n.map(function(e){return p(e)}));case 2:if(r=e.v,!t.isDestroyed){e.n=3;break}return e.a(2);case 3:t.chain().deleteSelection().insertContentAt(t.state.selection.from,r.map(function(e){return{type:"image",attrs:{src:e.url,alt:e.name}}})).focus().scrollIntoView().run();case 4:return e.a(2)}},e)})),function(t,n){return e.apply(this,arguments)})})],content:n||"",editorProps:{handleKeyDown:function(e,t){return a(t)}},onUpdate:function(){o(v.getHTML())},onCreate:function(){i(v)}});return s.current=v,function(){s.current&&(s.current.destroy(),s.current=null)}}},[]),fe("div",{className:"".concat(wp.b()," ").concat(r?wp.m("disabled"):""),children:fe("div",{ref:c})})},xp=new ve("chat-agent-setting"),Cp=function(e){var t=e.controller,n=Qe(null),r=Qe(null),i=g(Xe(!1),2),o=i[0],a=i[1];return Ye(function(){var e=function(e){var t,i;e.target&&null!==(t=r.current)&&void 0!==t&&t.contains(e.target)||(null!==(i=n.current)&&void 0!==i&&i.contains(e.target)?a(function(e){return!e}):a(!1))};return document.addEventListener("mousedown",e),function(){document.removeEventListener("mousedown",e)}},[]),fe("div",{className:"".concat(xp.b()," ").concat(e.className?e.className:""),children:[fe("div",{className:xp.e("button"),ref:n,children:fe("span",{title:"召回设置",className:"".concat(xp.em("button","icon")," ").concat(xp.em("button","prefix")),children:fe("svg",{className:"icon",viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor",children:[fe("path",{d:"M512 721.67619c-117.028571 0-209.67619-92.647619-209.67619-209.67619s92.647619-209.67619 209.67619-209.67619 209.67619 92.647619 209.67619 209.67619-92.647619 209.67619-209.67619 209.67619z m0-321.828571c-63.390476 0-112.152381 48.761905-112.152381 112.152381 0 63.390476 48.761905 112.152381 112.152381 112.152381s112.152381-48.761905 112.152381-112.152381c0-63.390476-48.761905-112.152381-112.152381-112.152381z"}),fe("path",{d:"M604.647619 1009.371429l-14.628571-48.761905c-9.752381-34.133333-43.885714-58.514286-78.019048-58.514286s-68.266667 24.380952-78.019048 58.514286l-14.628571 48.761905-48.761905-14.628572C292.571429 975.238095 219.428571 931.352381 160.914286 877.714286l-34.133334-34.133334 34.133334-34.133333c24.380952-29.257143 29.257143-68.266667 9.752381-97.523809-19.504762-34.133333-53.638095-48.761905-92.647619-39.009524l-48.761905 9.752381-9.752381-48.761905c-9.752381-39.009524-14.628571-82.895238-14.628572-121.904762S9.752381 429.104762 19.504762 390.095238l9.752381-48.761905 48.761905 9.752381c34.133333 9.752381 73.142857-4.87619 92.647619-39.009524 19.504762-34.133333 14.628571-73.142857-9.752381-97.523809l-34.133334-34.133333 34.133334-34.133334C219.428571 92.647619 292.571429 48.761905 370.590476 24.380952l48.761905-14.628571 14.628571 43.885714c9.752381 34.133333 43.885714 58.514286 78.019048 58.514286s68.266667-24.380952 78.019048-58.514286l14.628571-43.885714 48.761905 14.628571C731.428571 48.761905 804.571429 92.647619 863.085714 146.285714l34.133334 34.133334-34.133334 34.133333c-24.380952 29.257143-29.257143 68.266667-9.752381 97.523809 19.504762 34.133333 53.638095 48.761905 92.647619 39.009524l48.761905-9.752381 9.752381 48.761905c9.752381 39.009524 14.628571 82.895238 14.628572 121.904762s-4.87619 82.895238-14.628572 121.904762l-9.752381 48.761905-48.761905-9.752381c-34.133333-9.752381-73.142857 4.87619-92.647619 39.009524-19.504762 34.133333-14.628571 73.142857 9.752381 97.523809l34.133334 34.133333-34.133334 34.133334c-58.514286 58.514286-131.657143 97.52381-209.67619 121.904762l-48.761905 9.752381z m-346.209524-175.542858c34.133333 24.380952 68.266667 43.885714 102.4 58.514286 34.133333-48.761905 87.771429-82.895238 151.161905-82.895238s117.028571 34.133333 151.161905 82.895238c34.133333-14.628571 68.266667-34.133333 102.4-58.514286-29.257143-53.638095-29.257143-117.028571 4.87619-170.666666 29.257143-53.638095 87.771429-87.771429 146.285715-87.771429 4.87619-19.504762 4.87619-39.009524 4.87619-58.514286s0-39.009524-4.87619-58.514285c-58.514286-4.87619-117.028571-34.133333-146.285715-87.771429-29.257143-53.638095-34.133333-117.028571-4.87619-170.666666-34.133333-34.133333-68.266667-53.638095-102.4-68.266667-34.133333 48.761905-87.771429 82.895238-151.161905 82.895238s-117.028571-29.257143-151.161905-82.895238c-34.133333 14.628571-68.266667 34.133333-102.4 58.514286 29.257143 53.638095 29.257143 117.028571-4.87619 175.542857-29.257143 53.638095-87.771429 87.771429-146.285715 87.771428-4.87619 19.504762-4.87619 39.009524-4.87619 58.514286s0 39.009524 4.87619 58.514286c58.514286 4.87619 117.028571 34.133333 146.285715 87.771428s34.133333 121.904762 4.87619 175.542857z"})]})})}),o?fe("div",{className:xp.e("dropdown"),ref:r,children:fe("ul",{className:xp.em("dropdown","list"),children:[fe("li",{className:"".concat(xp.em("dropdown","item")," ").concat(xp.is("horizontal",!0)),children:[fe("div",{className:xp.em("dropdown","item-label"),children:"召回重排:"}),fe(Xn,{options:[{label:"禁用",value:0},{label:"启用",value:1},{label:"自动",value:2}],value:t.reCallConfig.value.chunkrerank,onChange:function(e){return t.setAIAgentConfig({chunkrerank:e})},popperStyle:{width:"90px",bottom:"inherit",top:"calc(100% + 4px)"}})]}),fe("li",{className:"".concat(xp.em("dropdown","item")," ").concat(xp.is("horizontal",!0)),children:[fe("div",{className:xp.em("dropdown","item-label"),children:"资料目录召回:"}),fe(Pr,{value:t.reCallConfig.value.chunkpageindex,onChange:function(e){return t.setAIAgentConfig({chunkpageindex:e?1:0})}})]}),fe("li",{className:"".concat(xp.em("dropdown","item")," ").concat(xp.is("vertical",!0)),children:[fe("div",{className:xp.em("dropdown","item-label"),children:["最大召回数量: ",t.reCallConfig.value.maxchunks]}),fe(zr,{min:0,max:20,step:1,value:t.reCallConfig.value.maxchunks,onChange:function(e){return t.setAIAgentConfig({maxchunks:e})}})]}),fe("li",{className:"".concat(xp.em("dropdown","item")," ").concat(xp.is("vertical",!0)),children:[fe("div",{className:xp.em("dropdown","item-label"),children:["召回相似度阈值: ",t.reCallConfig.value.chunkthreshold]}),fe(zr,{min:0,max:1,step:.01,value:t.reCallConfig.value.chunkthreshold,onChange:function(e){return t.setAIAgentConfig({chunkthreshold:e})}})]})]})}):null]})},Sp=new ve("chat-input"),_p=window.SpeechRecognition||window.webkitSpeechRecognition,Mp=function(e){var t,n=g(Xe(!1),2),r=n[0],i=n[1];nt(Ip);var o=e.controller.input,a=Lt(!1),s=Qe(),c=Qe(null);_p&&!s.current&&(s.current=new _p,s.current.onstart=function(){a.value=!0},s.current.onend=function(){a.value=!1},s.current.onresult=function(e){var t,n,r=null===(t=e.results)||void 0===t||null===(t=t[0])||void 0===t||null===(t=t[0])||void 0===t?void 0:t.transcript;r&&(null===(n=c.current)||void 0===n||n.commands.insertContent(r))});var l=function(e){var t=(new DOMParser).parseFromString(e,"text/html");var n=Array.from(t.body.childNodes).map(function e(t){if(t.nodeType===Node.TEXT_NODE)return t.textContent||"";if(t.nodeType!==Node.ELEMENT_NODE)return"";var n=t,r=n.tagName.toLowerCase(),i=Array.from(n.childNodes).map(function(t){return e(t)}).join("");switch(r){case"p":return"".concat(i,"\n");case"img":var o=n.getAttribute("src")||"",a=n.getAttribute("alt")||"";return o?"\n.concat(o,")\n"):"";default:return t.textContent||""}}).join("").replace(/\n+/g,"\n").replace(/^\n|\n$/g,"");return n},u=Bt(function(){return l(o.value).length<=0}),d=tt(m(f().m(function t(){var n,r,i;return f().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,r=l(o.value),o.value="",null===(n=c.current)||void 0===n||n.chain().clearContent().run(),t.n=1,e.controller.question(r);case 1:t.n=3;break;case 2:t.p=2,i=t.v,console.error(i);case 3:return t.p=3,setTimeout(function(){c.current&&!c.current.isDestroyed&&c.current.chain().focus().run()},100),t.f(3);case 4:return t.a(2)}},t,null,[[0,2,3,4]])})),[o]),h=tt(m(f().m(function t(){return f().w(function(t){for(;;)switch(t.n){case 0:try{e.controller.abortQuestion()}catch(n){console.error(n)}case 1:return t.a(2)}},t)})),[o]),p=function(){var t=m(f().m(function t(n){var r;return f().w(function(t){for(;;)switch(t.n){case 0:return r=Si.getMaterialHelper("ossfile",e.controller),t.n=1,r.excuteAction(n);case 1:i(!1);case 2:return t.a(2)}},t)}));return function(e){return t.apply(this,arguments)}}(),v=function(){var t=m(f().m(function t(n,r){var o;return f().w(function(t){for(;;)switch(t.n){case 0:return o=Si.getMaterialHelper("common",e.controller),t.n=1,o.excuteAction(n,r);case 1:i(!1);case 2:return t.a(2)}},t)}));return function(e,n){return t.apply(this,arguments)}}(),y=function(){var t=m(f().m(function t(n){var r;return f().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,e.controller.searchAIAgent(n);case 1:return r=t.v,t.a(2,r)}},t)}));return function(e){return t.apply(this,arguments)}}();return fe("div",{className:Sp.b("wrapper"),children:[fe("div",{className:Sp.b("material-wrapper"),children:fe(Ni,{controller:e.controller})}),fe("div",{className:Sp.b("main-wrapper"),children:[fe(bp,{c:e.controller,value:o.value,disabled:e.controller.isLoading.value,onCreate:function(e){c.current=e},onChange:function(e){o.value=e},onKeyDown:function(e){if("Enter"===e.code&&!e.isComposing&&!1===e.shiftKey)return d(),!0}}),fe("div",{className:Sp.b("action-wrapper"),children:[fe("div",{className:Sp.b("left-action-wrapper"),children:[fe(Xn,{className:Sp.b("setting-wrapper"),showBorder:!1,enableSearch:!0,placeholder:"Auto",popperStyle:{height:"220px"},value:e.controller.activeAIAgentID,options:e.controller.agentList.value,icon:function(){return fe("div",{title:"智能体",children:fe("svg",{className:"icon",viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",stroke:"currentColor",width:"1em",height:"1em",children:fe("path",{d:"M497.0496 55.7056a38.4 38.4 0 0 1 38.912 0l362.7008 213.2992c11.776 6.912 18.944 19.456 18.944 33.1264v426.6496a38.4 38.4 0 0 1-18.944 33.0752l-362.6496 213.3504a38.4 38.4 0 0 1-38.912 0L134.3488 761.856a38.4 38.4 0 0 1-18.944-33.0752V302.1312a38.4 38.4 0 0 1 18.944-33.1264z m19.456 77.6192L192.3072 324.096v382.72l324.3008 190.7712 324.2496-190.7712V324.096l-324.2496-190.7712zM345.9584 370.3296c7.68 0 14.848 2.2528 20.8384 6.144l149.6576 93.696 149.8624-93.696a38.4512 38.4512 0 0 1 49.1008 58.2656l-1.792 1.792a38.6048 38.6048 0 0 1-6.656 5.12l-152.0128 94.976v170.4448a38.4 38.4 0 0 1-0.1536 3.7376l-0.512 3.7376a38.0928 38.0928 0 0 1-23.04 27.9552 38.0928 38.0928 0 0 1-35.9936-3.5328 38.1952 38.1952 0 0 1-17.0496-31.8976v-170.2912l-152.064-95.1296a38.4 38.4 0 0 1 19.7632-71.3216z"})})})},disabled:!e.controller.enableAIAgentChange,onSearch:y,onChange:function(t){return n=t,void e.controller.setActiveAIAgentID(n);var n}}),e.controller.enableKnowledgeBaseSelect.value&&fe(Zn,{className:"".concat(Sp.b("setting-wrapper")," ").concat(Sp.is("disabled",!e.controller.enableKnowledgeBaseState.value)),enableSearch:!0,popperStyle:{height:"220px"},options:e.controller.knowledgeBases.value,icon:function(){return fe("div",{title:"知识库",children:Tn})},placeholder:"知识库搜索",value:e.controller.selectionKnowledgeBases.value,onChange:function(t){e.controller.setSelectionKnowledge(t)},onEnableChange:function(){e.controller.switchKnowledgeEnableState()}}),e.controller.enableRecallConfigSetting.value&&e.controller.agentList.value.length>0?fe(Cp,{className:Sp.b("setting-wrapper"),controller:e.controller}):null]}),fe("div",{className:Sp.b("right-action-wrapper"),children:[fe("div",{className:"".concat(Sp.be("right-action-wrapper","action-item")," ").concat(Sp.is("disabled",e.controller.isLoading.value)),title:"上传资料",children:fe(Ti,{triggerMode:"hover",content:fe("div",{className:Sp.b("pop-actions"),children:[fe("div",{className:Sp.b("pop-action-item"),onClick:function(e){p(e)},children:[fe("span",{className:Sp.b("pop-action-item-icon"),children:fe(sn,{})}),fe("span",{className:Sp.b("pop-action-item-title"),children:"文件资料"})]}),null===(t=e.questionToolbarItems)||void 0===t?void 0:t.map(function(e){var t,n,r;return fe("div",{className:Sp.b("pop-action-item"),onClick:function(t){v(t,e)},children:[fe("span",{className:Sp.b("pop-action-item-icon"),children:"function"==typeof e.icon?e.icon():(null===(t=e.icon)||void 0===t?void 0:t.showIcon)&&fe(W,{children:null!==(n=e.icon)&&void 0!==n&&n.cssClass?fe("i",{className:e.icon.cssClass}):null!==(r=e.icon)&&void 0!==r&&r.imagePath?Ce(e.icon.imagePath)?fe("div",{dangerouslySetInnerHTML:{__html:e.icon.imagePath}}):fe("img",{src:e.icon.imagePath}):null})}),fe("span",{className:Sp.b("pop-action-item-title"),children:e.label})]},e.id)})]}),position:"top-left",isOpen:r,onToggleOpen:i,children:fe(an,{})})}),fe("div",{title:a.value?"语音输入中...":"语音输入",className:"".concat(Sp.be("right-action-wrapper","action-item")," ").concat(Sp.is("disabled",e.controller.isLoading.value)),onClick:function(){s.current&&!a.value&&s.current.start()},children:a.value?fe(Yt,{}):fe(Xt,{})}),e.controller.isLoading.value?fe("div",{title:"停止生成",className:"".concat(Sp.be("right-action-wrapper","action-item")),onClick:h,children:fe(un,{})}):fe("div",{title:"发送消息",className:"".concat(Sp.be("right-action-wrapper","action-item")," ").concat(Sp.is("disabled",u.value)),onClick:d,children:fe(jt,{})})]})]})]})]})},Np=new ve("chat-topic-item"),Tp=function(e){var t=e.controller,n=e.topic,r=e.onClick,i=e.onAction,o=Qe(null),a=Bt(function(){var e;return(null===(e=t.activedTopic.value)||void 0===e?void 0:e.id)===n.id}),s=g(Xe(!1),2),c=s[0],l=s[1],u=Lt(!1);return fe("div",{className:"".concat(Np.b()," ").concat(Np.is("active",a.value)," ").concat(Np.is("edit",u.value)),onClick:r.bind(void 0),children:[fe("div",{className:Np.e("caption"),title:n.caption,children:u.value?fe("input",{ref:o,value:n.caption,onBlur:function(e){e.stopPropagation(),u.value=!1,i("RENAME",e)},onKeyDown:function(e){e.stopPropagation(),"Enter"===e.key&&(u.value=!1)},onClick:function(e){return e.stopPropagation()},onChange:function(e){return(t=e).stopPropagation(),void(n.data.caption=null===(r=t.target)||void 0===r?void 0:r.value);var t,r},className:Np.em("caption","editor")}):fe("div",{className:Np.em("caption","readonly"),children:[fe("span",{className:Np.em("caption","text"),children:n.caption}),n.isTop?fe("span",{className:Np.em("caption","icon"),children:fe(wn,{})}):null]})}),!u.value&&fe("div",{className:Np.e("icon"),children:[fe("span",{title:"跳转主视图",className:Np.em("icon","item"),onClick:function(e){e.stopPropagation(),i("LINK",e)}.bind(void 0),children:fe(Qt,{className:Np.b("link-icon")})}),a.value?null:fe(Ti,{triggerMode:"click",actions:[{id:"PINNED",caption:n.isTop?"取消置顶":"置顶",icon:n.isTop?fe(bn,{}):fe(wn,{})},{id:"RENAME",caption:"重命名",icon:fe(pn,{})},{id:"DELETE",caption:"删除话题",icon:fe(en,{})}],position:"bottom",isOpen:c,onToggleOpen:l,onAction:function(e,t){"RENAME"===e?(u.value=!0,setTimeout(function(){var e;null===(e=o.current)||void 0===e||e.focus()},100)):i(e,t),l(!1)}.bind(void 0),children:fe("span",{className:Np.em("icon","item"),title:"更多",children:fe(Zt,{className:Np.e("more-icon")})})})]})]})},Op=new ve("chat-topics"),Ep=function(e){var t=Qe(null),n=Lt(void 0),r=Lt([]);Ye(function(){var t=c(e.controller.topics.value).sort(function(e,t){return e.isTop!==t.isTop?t.isTop?1:-1:e.sequence-t.sequence});r.value=t.filter(function(e){var t,r;return null===(t=e.caption)||void 0===t?void 0:t.toLowerCase().includes((null===(r=n.value)||void 0===r?void 0:r.trim().toLowerCase())||"")})},[e.controller.topics.value]);Ye(function(){var e=t.current;if(e){var n=e.querySelector(".ibiz-chat-topic-item.is-active");null==n||n.scrollIntoView({behavior:"smooth",block:"nearest"})}},[e.controller.activedTopic.value]);var i=function(){e.controller.switchTopicSidebarCollapse()},o=function(t){if(t)e.controller.enterTempChat();else{e.controller.exitTempChat();var n=e.controller.preActivedTopic;if(n||(n=e.controller.topics.value[0]),!n)return;e.controller.handleTopicChange(n)}};return fe("div",{className:Op.b(),children:!0===e.controller.topicSidebarCollapse.value?fe("div",{className:Op.e("collapse-container"),children:[fe("div",{className:Op.e("icon-item"),title:"打开侧栏",onClick:function(){return i()},children:fe(In,{})}),!1===e.controller.isTempChat.value?fe("div",{className:Op.e("icon-item"),title:"进入临时会话",onClick:function(){return o(!0)},children:fe(zn,{})}):fe("div",{className:Op.e("icon-item"),title:"退出临时会话",onClick:function(){return o(!1)},children:fe(Rn,{})})]}):fe(W,{children:[fe("div",{className:Op.e("header"),children:[fe("div",{className:Op.e("icon-container"),children:[fe("div",{className:Op.e("icon-item"),title:"收起侧栏",onClick:function(){return i()},children:fe(In,{})}),fe("div",{className:Op.e("icon-item"),title:"新建对话",onClick:function(){e.controller.globalNewTopic()},children:fe(Gt,{})}),!1===e.controller.isTempChat.value?fe("div",{className:Op.e("icon-item"),title:"进入临时会话",onClick:function(){return o(!0)},children:fe(zn,{})}):fe("div",{className:Op.e("icon-item"),title:"退出临时会话",onClick:function(){return o(!1)},children:fe(Rn,{})})]}),fe(Un,{value:n.value,placeholder:"搜索话题",onChange:function(t){n.value=t,r.value=e.controller.topics.value.filter(function(e){var t,r;return null===(t=e.caption)||void 0===t?void 0:t.toLowerCase().includes((null===(r=n.value)||void 0===r?void 0:r.trim().toLowerCase())||"")})}.bind(void 0)})]}),fe("div",{ref:t,className:Op.e("main"),children:r.value&&r.value.length>0?r.value.map(function(t){return!1===t.isShow?null:fe(Tp,{topic:t,controller:e.controller,onClick:function(){return function(t){e.controller.isTempChat.value&&e.controller.exitTempChat(),e.controller.handleTopicChange(t)}(t)},onAction:function(n,r){return function(t,n,r){e.controller.handleTopicAction(t,n,r)}(n,t,r)}},t.id)}):fe("div",{className:Op.e("empty"),children:"暂无话题"})}),fe("div",{className:Op.e("footer"),children:fe("div",{title:"清空会话",className:Op.e("action"),onClick:function(){return e.controller.clearTopic()},children:[fe(en,{}),fe("span",{children:"清空会话"})]})})]})})},Ap=new ve("chat-minimize"),Dp=function(e){var t=Qe(null),n=g(Xe(""),2),r=n[0],i=n[1],o=g(Xe(0),2),a=o[0],s=o[1],c=Qe(!1),l={x:(window.innerWidth-86)/window.innerWidth,y:(window.innerHeight-86)/window.innerHeight},u=Bt(function(){var t=e.controller.messages.value[e.controller.messages.value.length-1];return!!t&&("ASSISTANT"===t.role&&20===t.state&&!0!==t.completed)}),d=Bt(function(){var t="";if(!u.value)return i(""),s(0),t;var n=e.controller.messages.value[e.controller.messages.value.length-1];if(t=n.content,-1!==n.content.indexOf("<think>")){var r=function(e){var t=e.indexOf("<think>"),n=e.indexOf("</think>"),r="",i="";return-1===n?(r=e.slice(t+7),i=""):(r=e.slice(t+7,n),i=e.slice(n+8)),{thoughtContent:r,answerContent:i}}(n.content);t=r.thoughtContent+r.answerContent}return t}),h=function(){Object.assign(t.current.style,{left:"".concat(100*l.x,"%"),top:"".concat(100*l.y,"%")}),localStorage.setItem(vi.MINIMIZE_STYLY_CHCHE,JSON.stringify(l))};return Ye(function(){var e,n=localStorage.getItem(vi.MINIMIZE_STYLY_CHCHE);if(n){var r=JSON.parse(n);Ae(r)&&Object.assign(l,r)}h(),(e=t.current)&&(e.onmousedown=function(t){document.body.style.userSelect="none";var n=t.clientX-e.offsetLeft,r=t.clientY-e.offsetTop,i=Date.now(),o=function(e){var t=56/window.innerWidth,i=56/window.innerHeight,o=De(e.clientX-n,e.clientY-r,t,i),a=o.x,s=o.y;Object.assign(l,{x:a,y:s}),requestAnimationFrame(function(){h()})},a=function(){var e=Date.now();c.current=e-i>300,document.body.style.userSelect="",document.removeEventListener("mousemove",o),document.removeEventListener("mouseup",a)};document.addEventListener("mousemove",o),document.addEventListener("mouseup",a)})},[]),Ye(function(){if(a<d.value.length){var e=setTimeout(function(){i(function(e){return e+d.value[a]}),s(function(e){return e+1})},100);return function(){return clearTimeout(e)}}},[a,d.value]),fe("div",{ref:t,title:e.title,className:"".concat(Ap.b()," ").concat(Ap.is("hidden",!e.isMinimize)," ").concat(Ap.is("show-halo",u.value)),onClick:function(){c.current||e.onClick()},children:fe("div",{className:"".concat(Ap.e("content")," ").concat(Ap.is("show-border",!u.value)),children:[r&&fe("div",{className:"".concat(Ap.em("content","popover")),children:fe("div",{className:"typewriter",children:r})}),fe(Jt,{})]})})},Ip=function(e){function t(e){var n,r;return this.getChildContext||(n=new Set,(r={})[t.__c]=this,this.getChildContext=function(){return r},this.componentWillUnmount=function(){n=null},this.shouldComponentUpdate=function(e){this.props.value!=e.value&&n.forEach(function(e){e.__e=!0,J(e)})},this.sub=function(e){n.add(e);var t=e.componentWillUnmount;e.componentWillUnmount=function(){n&&n.delete(e),t&&t.call(e)}}),e.children}return t.__c="__cC"+R++,t.__=e,t.Provider=t.__l=(t.Consumer=function(e,t){return e.children(t)}).contextType=t,t}({zIndex:10,enableBackFill:!0}),zp=function(e){function t(e){var n,i,o,a,s,c,l;return x(this,t),_(l=r(this,t,[e]),"ns",new ve("chat-container")),_(l,"containerRef",{current:null}),_(l,"dragHandle",{current:null}),_(l,"data",{side:{y:0,height:1,width:750/window.innerWidth,x:(window.innerWidth-750)/window.innerWidth},window:{y:0,width:750/window.innerWidth,height:750/window.innerHeight,x:(window.innerWidth-750)/window.innerWidth},minWidth:500,minHeight:300,showMode:"side"}),_(l,"disabled",!1),_(l,"isDragging",!1),_(l,"containerContext",{zIndex:(null===(n=l.props.containerOptions)||void 0===n?void 0:n.zIndex)||10,enableBackFill:void 0===(null===(i=l.props)||void 0===i?void 0:i.enableBackFill)||null===(null===(o=l.props)||void 0===o?void 0:o.enableBackFill)||(null===(a=l.props)||void 0===a?void 0:a.enableBackFill)}),l.state={isFullScreen:!1,isMinimize:!("minimize"!==(null==e?void 0:e.openMode)&&"autoexpand"!==(null==e?void 0:e.openMode)),enableAIMinimize:!0===(null==e||null===(s=e.containerOptions)||void 0===s?void 0:s.enableAIMinimize)},null==e||null===(c=e.aiChat)||void 0===c||c.evt.on("onCompleteMessage",function(){if(e.autoClose){var t=e.autoClose,n=t.mode,r=t.duration,i=void 0===r?3:r;switch(n){case"minimize":l.minimize();break;case"close":l.close();break;case"closetime":setTimeout(function(){l.close()},1e3*i)}}"autoexpand"===e.openMode&&l.exitMinimize()}),l}return a(t,e),S(t,[{key:"calcWindowStyle",value:function(){var e,t="window"===this.data.showMode?this.data.window:this.data.side;return{left:"".concat(100*t.x,"%"),top:"".concat(100*t.y,"%"),width:"".concat(100*t.width,"%"),height:"".concat(100*t.height,"%"),minWidth:"".concat(this.data.minWidth,"px"),minHeight:"".concat(this.data.minHeight,"px"),"z-index":(null===(e=this.props.containerOptions)||void 0===e||null===(e=e.zIndex)||void 0===e?void 0:e.toString())||"10"}}},{key:"calcSideModeStyle",value:function(e){Object.assign(this.data,{side:{y:0,x:"left"===e?0:(window.innerWidth-750)/window.innerWidth,height:1,width:750/window.innerWidth},showMode:"side"})}},{key:"setStyle",value:function(){Object.assign(this.containerRef.current.style,this.calcWindowStyle()),localStorage.setItem(vi.STYLE_CACHE,JSON.stringify(this.data))}},{key:"snapToEdge",value:function(){var e=20/window.innerWidth,t=20/window.innerHeight,n=this.data.window,r=n.x,i=n.y,o=n.width,a=n.height;r<e||r+o>1-e?this.calcSideModeStyle(r<e?"left":"right"):(i<t&&(this.data.window.y=0),i+a>1-t&&(this.data.window.y=1-a)),this.setStyle()}},{key:"registerDragDialog",value:function(){var e=this;this.dragHandle.current.onmousedown=function(t){if(!e.state.isFullScreen){document.body.style.userSelect="none";var n=t.clientX-e.containerRef.current.offsetLeft,r=t.clientY-e.containerRef.current.offsetTop,i=function(t){if(!e.disabled){e.data.showMode="window";var i=De(t.clientX-n,t.clientY-r,e.data.window.width,e.data.window.height),o=i.x,a=i.y;Object.assign(e.data.window,{x:o,y:a}),e.setStyle()}},o=function(){document.body.style.userSelect="",document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",o),e.disabled||e.snapToEdge()};document.addEventListener("mousemove",i),document.addEventListener("mouseup",o)}}}},{key:"registerDragDialogBorder",value:function(){var e=this;o(this.containerRef.current).resizable({edges:{top:!0,right:!0,bottom:!0,left:!0},margin:6,modifiers:[o.modifiers.restrictEdges({outer:document.body}),o.modifiers.restrictSize({min:{width:this.data.minWidth,height:this.data.minHeight}})],inertia:!0,listeners:{move:function(t){if(!e.state.isFullScreen){var n="side"===e.data.showMode?e.data.side:e.data.window;n.x=t.rect.left/window.innerWidth,n.y=t.rect.top/window.innerHeight,n.width=t.rect.width/window.innerWidth,n.height=t.rect.height/window.innerHeight,e.setStyle()}},start:function(){e.disabled=!0,document.body.style.userSelect="none"},end:function(){e.disabled=!1,document.body.style.userSelect=""}}})}},{key:"handleFullScreenChange",value:function(){this.setState({isFullScreen:null!==document.fullscreenElement})}},{key:"componentDidMount",value:function(){this.handleFullScreenChange=this.handleFullScreenChange.bind(this);var e=localStorage.getItem(vi.STYLE_CACHE);if(e){var t=JSON.parse(e);t.side&&Ae(t.side)&&t.window&&Ae(t.window)&&Object.assign(this.data,t)}this.setStyle(),this.registerDragDialog(),this.registerDragDialogBorder(),document.addEventListener("fullscreenchange",this.handleFullScreenChange)}},{key:"componentWillUnmount",value:function(){document.removeEventListener("fullscreenchange",this.handleFullScreenChange)}},{key:"close",value:function(){this.props.close()}},{key:"fullScreen",value:function(){var e=this.containerRef.current;e&&(e.requestFullscreen(),this.props.fullscreen(!0))}},{key:"closeFullScreen",value:function(){var e;this.state.isFullScreen&&(null===(e=document)||void 0===e||e.exitFullscreen(),this.props.fullscreen(!1),this.setStyle())}},{key:"minimize",value:function(){this.closeFullScreen(),this.setState({isMinimize:!0}),this.props.minimize(!0)}},{key:"exitMinimize",value:function(){this.setState({isMinimize:!1}),this.props.minimize(!1)}},{key:"stopPropagation",value:function(e){e.stopPropagation()}},{key:"render",value:function(){return fe(Ip.Provider,{value:this.containerContext,children:fe("div",{className:"".concat(this.ns.b()),children:[fe("div",{className:"".concat(this.ns.e("dialog")," ").concat(this.ns.is("full-screen",this.state.isFullScreen)," ").concat(this.ns.is("hidden",this.state.isMinimize)),ref:this.containerRef,children:[fe("div",{ref:this.dragHandle,className:this.ns.b("header"),children:[fe("div",{className:this.ns.b("header-caption"),children:this.props.caption||"AI助手"}),fe("div",{className:this.ns.b("header-action-wrapper"),children:[this.state.enableAIMinimize&&fe("div",{title:"最小化",className:"".concat(this.ns.be("header-action-wrapper","action-item")," ").concat(this.ns.be("header-action-wrapper","minimize")),onMouseDown:this.stopPropagation.bind(this),onClick:this.minimize.bind(this),children:fe(Kt,{})}),this.state.isFullScreen?fe("div",{title:"退出全屏",className:"".concat(this.ns.be("header-action-wrapper","action-item")," ").concat(this.ns.be("header-action-wrapper","close-full-screen")),onMouseDown:this.stopPropagation.bind(this),onClick:this.closeFullScreen.bind(this),children:fe(Ut,{})}):fe("div",{title:"全屏",className:"".concat(this.ns.be("header-action-wrapper","action-item")," ").concat(this.ns.be("header-action-wrapper","full-screen")),onMouseDown:this.stopPropagation.bind(this),onClick:this.fullScreen.bind(this),children:fe(qt,{})}),fe("div",{title:"关闭",className:"".concat(this.ns.be("header-action-wrapper","action-item")," ").concat(this.ns.be("header-action-wrapper","action-close")),onMouseDown:this.stopPropagation.bind(this),onClick:this.close.bind(this),children:fe(Vt,{})})]})]}),this.props.isLoading?fe("div",{className:"".concat(this.ns.be("main","loading")),children:[fe("div",{className:"".concat(this.ns.be("main","spinner"))}),fe("div",{className:"".concat(this.ns.be("main","text")),children:"正在加载..."})]}):"TOPIC"===this.props.mode?fe("div",{className:"".concat(this.ns.b("main")),children:[!this.props.hideTopicSidebar&&fe("div",{className:"".concat(this.ns.be("main","left")),style:{width:"".concat(this.props.aiTopic.topicSidebarWidth.value,"px")},children:fe(Ep,{controller:this.props.aiTopic})}),fe("div",{className:"".concat(this.ns.be("main","right")),style:{width:this.props.hideTopicSidebar?"100%":"calc(100% - ".concat(this.props.aiTopic.topicSidebarWidth.value,"px)")},children:[fe("div",{className:this.ns.b("content"),children:fe(pi,{controller:this.props.aiChat,toolbarItems:this.props.contentToolbarItems})}),fe(di,{type:"footer",mode:this.props.mode,hideTopicSidebar:this.props.hideTopicSidebar,data:this.props.aiTopic.activedTopic.value,className:"".concat(this.ns.e("toolbar")," ").concat(this.ns.is("has-materials",this.props.aiChat.materials.value.length>0)),controller:this.props.aiChat,items:this.props.footerToolbarItems}),fe("div",{className:this.ns.b("footer"),children:fe(Mp,{controller:this.props.aiChat,questionToolbarItems:this.props.questionToolbarItems})})]})]}):fe("div",{className:"".concat(this.ns.be("main","default")),children:[fe("div",{className:this.ns.b("content"),children:fe(pi,{controller:this.props.aiChat,toolbarItems:this.props.contentToolbarItems})}),fe(di,{type:"footer",mode:this.props.mode,hideTopicSidebar:this.props.hideTopicSidebar,data:this.props.aiTopic.activedTopic.value,className:"".concat(this.ns.e("toolbar")," ").concat(this.ns.is("has-materials",this.props.aiChat.materials.value.length>0)),controller:this.props.aiChat,items:this.props.footerToolbarItems}),fe("div",{className:this.ns.b("footer"),children:fe(Mp,{controller:this.props.aiChat,questionToolbarItems:this.props.questionToolbarItems})})]})]}),!this.props.isLoading&&fe(Dp,{title:this.props.caption||"AI助手",controller:this.props.aiChat,isMinimize:this.state.isMinimize,onClick:this.exitMinimize.bind(this)})]})})}}])}(q);t("ChatContainer",zp)}}})}();
|
|
1
|
+
!function(){function e(e,n,r,i){var a=t(o(1&i?e.prototype:e),n,r);return 2&i&&"function"==typeof a?function(e){return a.apply(r,e)}:a}function t(){return t="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=o(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},t.apply(null,arguments)}function n(e){var t="function"==typeof Map?new Map:void 0;return n=function(e){if(null===e||!function(e){try{return-1!==Function.toString.call(e).indexOf("[native code]")}catch(t){return"function"==typeof e}}(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return function(e,t,n){if(i())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,t);var o=new(e.bind.apply(e,r));return n&&s(o,n.prototype),o}(e,arguments,o(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),s(n,e)},n(e)}function r(e,t,n){return t=o(t),function(e,t){if(t&&("object"==N(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,i()?Reflect.construct(t,n||[],o(e).constructor):t.apply(e,n))}function i(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(i=function(){return!!e})()}function o(e){return o=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},o(e)}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&s(e,t)}function s(e,t){return s=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},s(e,t)}function c(e){return function(e){if(Array.isArray(e))return w(e)}(e)||l(e)||k(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function l(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function u(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=k(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function d(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function h(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?d(Object(n),!0).forEach(function(t){_(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):d(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function f(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",i=n.toStringTag||"@@toStringTag";function o(n,r,i,o){var c=r&&r.prototype instanceof s?r:s,l=Object.create(c.prototype);return p(l,"_invoke",function(n,r,i){var o,s,c,l=0,u=i||[],d=!1,h={p:0,n:0,v:e,a:f,f:f.bind(e,4),d:function(t,n){return o=t,s=0,c=e,h.n=n,a}};function f(n,r){for(s=n,c=r,t=0;!d&&l&&!i&&t<u.length;t++){var i,o=u[t],f=h.p,p=o[2];n>3?(i=p===r)&&(c=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=e):o[0]<=f&&((i=n<2&&f<o[1])?(s=0,h.v=r,h.n=o[1]):f<p&&(i=n<3||o[0]>r||r>p)&&(o[4]=n,o[5]=r,h.n=p,s=0))}if(i||n>1)return a;throw d=!0,r}return function(i,u,p){if(l>1)throw TypeError("Generator is already running");for(d&&1===u&&f(u,p),s=u,c=p;(t=s<2?e:c)||!d;){o||(s?s<3?(s>1&&(h.n=-1),f(s,c)):h.n=c:h.v=c);try{if(l=2,o){if(s||(i="next"),t=o[i]){if(!(t=t.call(o,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,s<2&&(s=0)}else 1===s&&(t=o.return)&&t.call(o),s<2&&(c=TypeError("The iterator does not provide a '"+i+"' method"),s=1);o=e}else if((t=(d=h.n<0)?c:n.call(r,h))!==a)break}catch(t){o=e,s=1,c=t}finally{l=1}}return{value:t,done:d}}}(n,i,o),!0),l}var a={};function s(){}function c(){}function l(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(p(t={},r,function(){return this}),t),d=l.prototype=s.prototype=Object.create(u);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,l):(e.__proto__=l,p(e,i,"GeneratorFunction")),e.prototype=Object.create(d),e}return c.prototype=l,p(d,"constructor",l),p(l,"constructor",c),c.displayName="GeneratorFunction",p(l,i,"GeneratorFunction"),p(d),p(d,i,"Generator"),p(d,r,function(){return this}),p(d,"toString",function(){return"[object Generator]"}),(f=function(){return{w:o,m:h}})()}function p(e,t,n,r){var i=Object.defineProperty;try{i({},"",{})}catch(e){i=0}p=function(e,t,n,r){function o(t,n){p(e,t,function(e){return this._invoke(t,n,e)})}t?i?i(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},p(e,t,n,r)}function v(e,t,n,r,i,o,a){try{var s=e[o](a),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,i)}function m(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(e){v(o,r,i,a,s,"next",e)}function s(e){v(o,r,i,a,s,"throw",e)}a(void 0)})}}function g(e,t){return b(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,s=[],c=!0,l=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw i}}return s}}(e,t)||k(e,t)||y()}function y(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function k(e,t){if(e){if("string"==typeof e)return w(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?w(e,t):void 0}}function w(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function b(e){if(Array.isArray(e))return e}function x(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function C(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,M(r.key),r)}}function S(e,t,n){return t&&C(e.prototype,t),n&&C(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function _(e,t,n){return(t=M(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function M(e){var t=function(e,t){if("object"!=N(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=N(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==N(t)?t:t+""}function N(e){return N="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},N(e)}System.register(["interactjs","cherry-markdown","lodash-es","qx-util"],function(t,i){"use strict";var o,s,d,p;return{setters:[function(e){o=e.default},function(e){s=e.default},function(e){d=e.cloneDeep},function(e){p=e.QXEvent}],execute:function(){var i,v,w,C,M,T,O,E,A,D,I,z,R,P={},L=[],B=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,V=Array.isArray;function F(e,t){for(var n in t)e[n]=t[n];return e}function j(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function $(e,t,n){var r,o,a,s={};for(a in t)"key"==a?r=t[a]:"ref"==a?o=t[a]:s[a]=t[a];if(arguments.length>2&&(s.children=arguments.length>3?i.call(arguments,2):n),"function"==typeof e&&null!=e.defaultProps)for(a in e.defaultProps)void 0===s[a]&&(s[a]=e.defaultProps[a]);return H(e,s,r,o,null)}function H(e,t,n,r,i){var o={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:null==i?++w:i,__i:-1,__u:0};return null==i&&null!=v.vnode&&v.vnode(o),o}function W(e){return e.children}function q(e,t){this.props=e,this.context=t}function U(e,t){if(null==t)return e.__?U(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e)return n.__e;return"function"==typeof e.type?U(e):null}function K(e){var t,n;if(null!=(e=e.__)&&null!=e.__c){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e){e.__e=e.__c.base=n.__e;break}return K(e)}}function J(e){(!e.__d&&(e.__d=!0)&&M.push(e)&&!G.__r++||T!=v.debounceRendering)&&((T=v.debounceRendering)||O)(G)}function G(){for(var e,t,n,r,i,o,a,s=1;M.length;)M.length>s&&M.sort(E),e=M.shift(),s=M.length,e.__d&&(n=void 0,r=void 0,i=(r=(t=e).__v).__e,o=[],a=[],t.__P&&((n=F({},r)).__v=r.__v+1,v.vnode&&v.vnode(n),re(t.__P,n,r,t.__n,t.__P.namespaceURI,32&r.__u?[i]:null,o,null==i?U(r):i,!!(32&r.__u),a),n.__v=r.__v,n.__.__k[n.__i]=n,oe(o,n,a),r.__e=r.__=null,n.__e!=i&&K(n)));G.__r=0}function X(e,t,n,r,i,o,a,s,c,l,u){var d,h,f,p,v,m,g,y=r&&r.__k||L,k=t.length;for(c=function(e,t,n,r,i){var o,a,s,c,l,u=n.length,d=u,h=0;for(e.__k=new Array(i),o=0;o<i;o++)null!=(a=t[o])&&"boolean"!=typeof a&&"function"!=typeof a?(c=o+h,(a=e.__k[o]="string"==typeof a||"number"==typeof a||"bigint"==typeof a||a.constructor==String?H(null,a,null,null,null):V(a)?H(W,{children:a},null,null,null):null==a.constructor&&a.__b>0?H(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):a).__=e,a.__b=e.__b+1,s=null,-1!=(l=a.__i=Q(a,n,c,d))&&(d--,(s=n[l])&&(s.__u|=2)),null==s||null==s.__v?(-1==l&&(i>u?h--:i<u&&h++),"function"!=typeof a.type&&(a.__u|=4)):l!=c&&(l==c-1?h--:l==c+1?h++:(l>c?h--:h++,a.__u|=4))):e.__k[o]=null;if(d)for(o=0;o<u;o++)null!=(s=n[o])&&!(2&s.__u)&&(s.__e==r&&(r=U(s)),le(s,s));return r}(n,t,y,c,k),d=0;d<k;d++)null!=(f=n.__k[d])&&(h=-1==f.__i?P:y[f.__i]||P,f.__i=d,m=re(e,f,h,i,o,a,s,c,l,u),p=f.__e,f.ref&&h.ref!=f.ref&&(h.ref&&ce(h.ref,null,f),u.push(f.ref,f.__c||p,f)),null==v&&null!=p&&(v=p),(g=!!(4&f.__u))||h.__k===f.__k?c=Y(f,c,e,g):"function"==typeof f.type&&void 0!==m?c=m:p&&(c=p.nextSibling),f.__u&=-7);return n.__e=v,c}function Y(e,t,n,r){var i,o;if("function"==typeof e.type){for(i=e.__k,o=0;i&&o<i.length;o++)i[o]&&(i[o].__=e,t=Y(i[o],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=U(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do{t=t&&t.nextSibling}while(null!=t&&8==t.nodeType);return t}function Z(e,t){return t=t||[],null==e||"boolean"==typeof e||(V(e)?e.some(function(e){Z(e,t)}):t.push(e)),t}function Q(e,t,n,r){var i,o,a,s=e.key,c=e.type,l=t[n],u=null!=l&&!(2&l.__u);if(null===l&&null==e.key||u&&s==l.key&&c==l.type)return n;if(r>(u?1:0))for(i=n-1,o=n+1;i>=0||o<t.length;)if(null!=(l=t[a=i>=0?i--:o++])&&!(2&l.__u)&&s==l.key&&c==l.type)return a;return-1}function ee(e,t,n){"-"==t[0]?e.setProperty(t,null==n?"":n):e[t]=null==n?"":"number"!=typeof n||B.test(t)?n:n+"px"}function te(e,t,n,r,i){var o,a;e:if("style"==t)if("string"==typeof n)e.style.cssText=n;else{if("string"==typeof r&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||ee(e.style,t,"");if(n)for(t in n)r&&n[t]==r[t]||ee(e.style,t,n[t])}else if("o"==t[0]&&"n"==t[1])o=t!=(t=t.replace(A,"$1")),a=t.toLowerCase(),t=a in e||"onFocusOut"==t||"onFocusIn"==t?a.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+o]=n,n?r?n.u=r.u:(n.u=D,e.addEventListener(t,o?z:I,o)):e.removeEventListener(t,o?z:I,o);else{if("http://www.w3.org/2000/svg"==i)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!=t&&"height"!=t&&"href"!=t&&"list"!=t&&"form"!=t&&"tabIndex"!=t&&"download"!=t&&"rowSpan"!=t&&"colSpan"!=t&&"role"!=t&&"popover"!=t&&t in e)try{e[t]=null==n?"":n;break e}catch(e){}"function"==typeof n||(null==n||!1===n&&"-"!=t[4]?e.removeAttribute(t):e.setAttribute(t,"popover"==t&&1==n?"":n))}}function ne(e){return function(t){if(this.l){var n=this.l[t.type+e];if(null==t.t)t.t=D++;else if(t.t<n.u)return;return n(v.event?v.event(t):t)}}}function re(e,t,n,r,i,o,a,s,c,l){var u,d,h,f,p,m,g,y,k,w,b,x,C,S,_,M,N,T=t.type;if(null!=t.constructor)return null;128&n.__u&&(c=!!(32&n.__u),o=[s=t.__e=n.__e]),(u=v.__b)&&u(t);e:if("function"==typeof T)try{if(y=t.props,k="prototype"in T&&T.prototype.render,w=(u=T.contextType)&&r[u.__c],b=u?w?w.props.value:u.__:r,n.__c?g=(d=t.__c=n.__c).__=d.__E:(k?t.__c=d=new T(y,b):(t.__c=d=new q(y,b),d.constructor=T,d.render=ue),w&&w.sub(d),d.props=y,d.state||(d.state={}),d.context=b,d.__n=r,h=d.__d=!0,d.__h=[],d._sb=[]),k&&null==d.__s&&(d.__s=d.state),k&&null!=T.getDerivedStateFromProps&&(d.__s==d.state&&(d.__s=F({},d.__s)),F(d.__s,T.getDerivedStateFromProps(y,d.__s))),f=d.props,p=d.state,d.__v=t,h)k&&null==T.getDerivedStateFromProps&&null!=d.componentWillMount&&d.componentWillMount(),k&&null!=d.componentDidMount&&d.__h.push(d.componentDidMount);else{if(k&&null==T.getDerivedStateFromProps&&y!==f&&null!=d.componentWillReceiveProps&&d.componentWillReceiveProps(y,b),!d.__e&&null!=d.shouldComponentUpdate&&!1===d.shouldComponentUpdate(y,d.__s,b)||t.__v==n.__v){for(t.__v!=n.__v&&(d.props=y,d.state=d.__s,d.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(e){e&&(e.__=t)}),x=0;x<d._sb.length;x++)d.__h.push(d._sb[x]);d._sb=[],d.__h.length&&a.push(d);break e}null!=d.componentWillUpdate&&d.componentWillUpdate(y,d.__s,b),k&&null!=d.componentDidUpdate&&d.__h.push(function(){d.componentDidUpdate(f,p,m)})}if(d.context=b,d.props=y,d.__P=e,d.__e=!1,C=v.__r,S=0,k){for(d.state=d.__s,d.__d=!1,C&&C(t),u=d.render(d.props,d.state,d.context),_=0;_<d._sb.length;_++)d.__h.push(d._sb[_]);d._sb=[]}else do{d.__d=!1,C&&C(t),u=d.render(d.props,d.state,d.context),d.state=d.__s}while(d.__d&&++S<25);d.state=d.__s,null!=d.getChildContext&&(r=F(F({},r),d.getChildContext())),k&&!h&&null!=d.getSnapshotBeforeUpdate&&(m=d.getSnapshotBeforeUpdate(f,p)),M=u,null!=u&&u.type===W&&null==u.key&&(M=ae(u.props.children)),s=X(e,V(M)?M:[M],t,n,r,i,o,a,s,c,l),d.base=t.__e,t.__u&=-161,d.__h.length&&a.push(d),g&&(d.__E=d.__=null)}catch(e){if(t.__v=null,c||null!=o)if(e.then){for(t.__u|=c?160:128;s&&8==s.nodeType&&s.nextSibling;)s=s.nextSibling;o[o.indexOf(s)]=null,t.__e=s}else{for(N=o.length;N--;)j(o[N]);ie(t)}else t.__e=n.__e,t.__k=n.__k,e.then||ie(t);v.__e(e,t,n)}else null==o&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=se(n.__e,t,n,r,i,o,a,c,l);return(u=v.diffed)&&u(t),128&t.__u?void 0:s}function ie(e){e&&e.__c&&(e.__c.__e=!0),e&&e.__k&&e.__k.forEach(ie)}function oe(e,t,n){for(var r=0;r<n.length;r++)ce(n[r],n[++r],n[++r]);v.__c&&v.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){v.__e(e,t.__v)}})}function ae(e){return"object"!=N(e)||null==e||e.__b&&e.__b>0?e:V(e)?e.map(ae):F({},e)}function se(e,t,n,r,o,a,s,c,l){var u,d,h,f,p,m,g,y=n.props,k=t.props,w=t.type;if("svg"==w?o="http://www.w3.org/2000/svg":"math"==w?o="http://www.w3.org/1998/Math/MathML":o||(o="http://www.w3.org/1999/xhtml"),null!=a)for(u=0;u<a.length;u++)if((p=a[u])&&"setAttribute"in p==!!w&&(w?p.localName==w:3==p.nodeType)){e=p,a[u]=null;break}if(null==e){if(null==w)return document.createTextNode(k);e=document.createElementNS(o,w,k.is&&k),c&&(v.__m&&v.__m(t,a),c=!1),a=null}if(null==w)y===k||c&&e.data==k||(e.data=k);else{if(a=a&&i.call(e.childNodes),y=n.props||P,!c&&null!=a)for(y={},u=0;u<e.attributes.length;u++)y[(p=e.attributes[u]).name]=p.value;for(u in y)if(p=y[u],"children"==u);else if("dangerouslySetInnerHTML"==u)h=p;else if(!(u in k)){if("value"==u&&"defaultValue"in k||"checked"==u&&"defaultChecked"in k)continue;te(e,u,null,p,o)}for(u in k)p=k[u],"children"==u?f=p:"dangerouslySetInnerHTML"==u?d=p:"value"==u?m=p:"checked"==u?g=p:c&&"function"!=typeof p||y[u]===p||te(e,u,p,y[u],o);if(d)c||h&&(d.__html==h.__html||d.__html==e.innerHTML)||(e.innerHTML=d.__html),t.__k=[];else if(h&&(e.innerHTML=""),X("template"==t.type?e.content:e,V(f)?f:[f],t,n,r,"foreignObject"==w?"http://www.w3.org/1999/xhtml":o,a,s,a?a[0]:n.__k&&U(n,0),c,l),null!=a)for(u=a.length;u--;)j(a[u]);c||(u="value","progress"==w&&null==m?e.removeAttribute("value"):null!=m&&(m!==e[u]||"progress"==w&&!m||"option"==w&&m!=y[u])&&te(e,u,m,y[u],o),u="checked",null!=g&&g!=e[u]&&te(e,u,g,y[u],o))}return e}function ce(e,t,n){try{if("function"==typeof e){var r="function"==typeof e.__u;r&&e.__u(),r&&null==t||(e.__u=e(t))}else e.current=t}catch(e){v.__e(e,n)}}function le(e,t,n){var r,i;if(v.unmount&&v.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||ce(r,null,t)),null!=(r=e.__c)){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){v.__e(e,t)}r.base=r.__P=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&le(r[i],t,n||"function"!=typeof e.type);n||j(e.__e),e.__c=e.__=e.__e=void 0}function ue(e,t,n){return this.constructor(e,n)}function de(e,t,n){var r,o,a,s;t==document&&(t=document.documentElement),v.__&&v.__(e,t),o=(r="function"==typeof n)?null:n&&n.__k||t.__k,a=[],s=[],re(t,e=(!r&&n||t).__k=$(W,null,[e]),o||P,P,t.namespaceURI,!r&&n?[n]:o?null:t.firstChild?i.call(t.childNodes):null,a,!r&&n?n:o?o.__e:t.firstChild,r,s),oe(a,e,s)}i=L.slice,v={__e:function(e,t,n,r){for(var i,o,a;t=t.__;)if((i=t.__c)&&!i.__)try{if((o=i.constructor)&&null!=o.getDerivedStateFromError&&(i.setState(o.getDerivedStateFromError(e)),a=i.__d),null!=i.componentDidCatch&&(i.componentDidCatch(e,r||{}),a=i.__d),a)return i.__E=i}catch(t){e=t}throw e}},w=0,C=function(e){return null!=e&&null==e.constructor},q.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!=this.state?this.__s:this.__s=F({},this.state),"function"==typeof e&&(e=e(F({},n),this.props)),e&&F(n,e),null!=e&&this.__v&&(t&&this._sb.push(t),J(this))},q.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),J(this))},q.prototype.render=W,M=[],O="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,E=function(e,t){return e.__v.__b-t.__v.__b},G.__r=0,A=/(PointerCapture)$|Capture$/i,D=0,I=ne(!1),z=ne(!0),R=0;var he=0;function fe(e,t,n,r,i,o){t||(t={});var a,s,c=t;if("ref"in c)for(s in c={},t)"ref"==s?a=t[s]:c[s]=t[s];var l={type:e,props:c,key:n,ref:a,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--he,__i:-1,__u:0,__source:i,__self:o};if("function"==typeof e&&(a=e.defaultProps))for(s in a)void 0===c[s]&&(c[s]=a[s]);return v.vnode&&v.vnode(l),l}function pe(e,t,n,r,i){var o="".concat(e,"-").concat(t);return n&&(o+="-".concat(n)),r&&(o+="__".concat(r)),i&&(o+="--".concat(i)),o}var ve=function(){return S(function e(t,n){x(this,e),_(this,"namespace",void 0),this.block=t,this.namespace=n||"ibiz"},[{key:"b",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return pe(this.namespace,this.block,e,"","")}},{key:"e",value:function(e){return e?pe(this.namespace,this.block,"",e,""):""}},{key:"m",value:function(e){return e?pe(this.namespace,this.block,"","",e):""}},{key:"be",value:function(e,t){return e&&t?pe(this.namespace,this.block,e,t,""):""}},{key:"em",value:function(e,t){return e&&t?pe(this.namespace,this.block,"",e,t):""}},{key:"bm",value:function(e,t){return e&&t?pe(this.namespace,this.block,e,"",t):""}},{key:"bem",value:function(e,t,n){return e&&t&&n?pe(this.namespace,this.block,e,t,n):""}},{key:"is",value:function(e,t){return e&&t?"".concat("is-").concat(e):""}},{key:"cssVar",value:function(e){var t={};for(var n in e)e[n]&&(t[this.cssVarName(n)]=e[n]);return t}},{key:"cssVarBlock",value:function(e){var t={};for(var n in e)e[n]&&(t[this.cssVarBlockName(n)]=e[n]);return t}},{key:"cssVarName",value:function(e){return"--".concat(this.namespace,"-").concat(e)}},{key:"cssVarBlockName",value:function(e){return"--".concat(this.namespace,"-").concat(this.block,"-").concat(e)}}])}();function me(e){if("string"!=typeof e)throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}function ge(e,t){for(var n,r="",i=0,o=-1,a=0,s=0;s<=e.length;++s){if(s<e.length)n=e.charCodeAt(s);else{if(47===n)break;n=47}if(47===n){if(o===s-1||1===a);else if(o!==s-1&&2===a){if(r.length<2||2!==i||46!==r.charCodeAt(r.length-1)||46!==r.charCodeAt(r.length-2))if(r.length>2){var c=r.lastIndexOf("/");if(c!==r.length-1){-1===c?(r="",i=0):i=(r=r.slice(0,c)).length-1-r.lastIndexOf("/"),o=s,a=0;continue}}else if(2===r.length||1===r.length){r="",i=0,o=s,a=0;continue}t&&(r.length>0?r+="/..":r="..",i=2)}else r.length>0?r+="/"+e.slice(o+1,s):r=e.slice(o+1,s),i=s-o-1;o=s,a=0}else 46===n&&-1!==a?++a:a=-1}return r}var ye={resolve:function(){for(var e,t="",n=!1,r=arguments.length-1;r>=-1&&!n;r--){var i;r>=0?i=arguments[r]:(void 0===e&&(e=process.cwd()),i=e),me(i),0!==i.length&&(t=i+"/"+t,n=47===i.charCodeAt(0))}return t=ge(t,!n),n?t.length>0?"/"+t:"/":t.length>0?t:"."},normalize:function(e){if(me(e),0===e.length)return".";var t=47===e.charCodeAt(0),n=47===e.charCodeAt(e.length-1);return 0!==(e=ge(e,!t)).length||t||(e="."),e.length>0&&n&&(e+="/"),t?"/"+e:e},isAbsolute:function(e){return me(e),e.length>0&&47===e.charCodeAt(0)},join:function(){if(0===arguments.length)return".";for(var e,t=0;t<arguments.length;++t){var n=arguments[t];me(n),n.length>0&&(void 0===e?e=n:e+="/"+n)}return void 0===e?".":ye.normalize(e)},relative:function(e,t){if(me(e),me(t),e===t)return"";if((e=ye.resolve(e))===(t=ye.resolve(t)))return"";for(var n=1;n<e.length&&47===e.charCodeAt(n);++n);for(var r=e.length,i=r-n,o=1;o<t.length&&47===t.charCodeAt(o);++o);for(var a=t.length-o,s=i<a?i:a,c=-1,l=0;l<=s;++l){if(l===s){if(a>s){if(47===t.charCodeAt(o+l))return t.slice(o+l+1);if(0===l)return t.slice(o+l)}else i>s&&(47===e.charCodeAt(n+l)?c=l:0===l&&(c=0));break}var u=e.charCodeAt(n+l);if(u!==t.charCodeAt(o+l))break;47===u&&(c=l)}var d="";for(l=n+c+1;l<=r;++l)l!==r&&47!==e.charCodeAt(l)||(0===d.length?d+="..":d+="/..");return d.length>0?d+t.slice(o+c):(o+=c,47===t.charCodeAt(o)&&++o,t.slice(o))},_makeLong:function(e){return e},dirname:function(e){if(me(e),0===e.length)return".";for(var t=e.charCodeAt(0),n=47===t,r=-1,i=!0,o=e.length-1;o>=1;--o)if(47===(t=e.charCodeAt(o))){if(!i){r=o;break}}else i=!1;return-1===r?n?"/":".":n&&1===r?"//":e.slice(0,r)},basename:function(e,t){if(void 0!==t&&"string"!=typeof t)throw new TypeError('"ext" argument must be a string');me(e);var n,r=0,i=-1,o=!0;if(void 0!==t&&t.length>0&&t.length<=e.length){if(t.length===e.length&&t===e)return"";var a=t.length-1,s=-1;for(n=e.length-1;n>=0;--n){var c=e.charCodeAt(n);if(47===c){if(!o){r=n+1;break}}else-1===s&&(o=!1,s=n+1),a>=0&&(c===t.charCodeAt(a)?-1===--a&&(i=n):(a=-1,i=s))}return r===i?i=s:-1===i&&(i=e.length),e.slice(r,i)}for(n=e.length-1;n>=0;--n)if(47===e.charCodeAt(n)){if(!o){r=n+1;break}}else-1===i&&(o=!1,i=n+1);return-1===i?"":e.slice(r,i)},extname:function(e){me(e);for(var t=-1,n=0,r=-1,i=!0,o=0,a=e.length-1;a>=0;--a){var s=e.charCodeAt(a);if(47!==s)-1===r&&(i=!1,r=a+1),46===s?-1===t?t=a:1!==o&&(o=1):-1!==t&&(o=-1);else if(!i){n=a+1;break}}return-1===t||-1===r||0===o||1===o&&t===r-1&&t===n+1?"":e.slice(t,r)},format:function(e){if(null===e||"object"!==N(e))throw new TypeError('The "pathObject" argument must be of type Object. Received type '+N(e));return function(e,t){var n=t.dir||t.root,r=t.base||(t.name||"")+(t.ext||"");return n?n===t.root?n+r:n+e+r:r}("/",e)},parse:function(e){me(e);var t={root:"",dir:"",base:"",ext:"",name:""};if(0===e.length)return t;var n,r=e.charCodeAt(0),i=47===r;i?(t.root="/",n=1):n=0;for(var o=-1,a=0,s=-1,c=!0,l=e.length-1,u=0;l>=n;--l)if(47!==(r=e.charCodeAt(l)))-1===s&&(c=!1,s=l+1),46===r?-1===o?o=l:1!==u&&(u=1):-1!==o&&(u=-1);else if(!c){a=l+1;break}return-1===o||-1===s||0===u||1===u&&o===s-1&&o===a+1?-1!==s&&(t.base=t.name=0===a&&i?e.slice(1,s):e.slice(a,s)):(0===a&&i?(t.name=e.slice(1,o),t.base=e.slice(1,s)):(t.name=e.slice(a,o),t.base=e.slice(a,s)),t.ext=e.slice(o,s)),a>0?t.dir=e.slice(0,a-1):i&&(t.dir="/"),t},sep:"/",delimiter:":",win32:null,posix:null};function ke(){return(65536*(1+Math.random())|0).toString(16).substring(1)}function we(){return"".concat(ke()+ke(),"-").concat(ke(),"-").concat(ke(),"-").concat(ke(),"-").concat(ke()).concat(ke()).concat(ke())}function be(e){var t=e.lastIndexOf("@");return-1===t?e:e.substring(0,t)}ye.posix=ye;var xe=/<svg\b[^>]*>[\s\S]*?<\/svg>/;function Ce(e){return xe.test(e)}function Se(e,t){var n="";switch(e){case"TOPIC":n+="topic";break;case"INLINE":n+="inline";break;case"TEMP":n+="temp";break;default:n+="unknow"}return n+="@".concat(t||we(),"@").concat((new Date).getTime())}function _e(e){var t=new URL(e),n={},r={};if(t.searchParams.size>0){var i=t.searchParams.get("srfnavctx");if(i){try{Object.assign(n,JSON.parse(i))}catch(d){console.error("srfnavctx 参数解析失败")}t.searchParams.delete("srfnavctx")}t.searchParams.forEach(function(e,t){r[t]=e})}else if(t.search){var o=function(e){var t={};e.startsWith("?")&&(e=e.substring(1));for(var n=e.split("&"),r=0;r<n.length;r++){var i=g(n[r].split("="),2),o=i[0],a=i[1];t[o]=a}return t}(t.search),a=o.srfnavctx;if(a){try{var s=decodeURIComponent(a);Object.assign(n,JSON.parse(s))}catch(d){console.error("srfnavctx 参数解析失败")}delete o.srfnavctx}Object.keys(o).forEach(function(e){r[e]=o[e]})}var c=g((t.pathname||t.hostname).replace("//","").split("/"),2),l=c[0],u=c[1];return{context:n,params:r,typeId:u||l}}var Me=function(){return S(function e(){x(this,e)},null,[{key:"copy",value:function(e){return this.inputElement||(this.inputElement=document.createElement("input"),this.inputElement.style.position="absolute",this.inputElement.style.left="-9999px",document.body.appendChild(this.inputElement)),this.inputElement.value=e,this.inputElement.select(),document.execCommand("copy")}}])}();_(Me,"inputElement",null);var Ne=function(){function e(){x(this,e)}return S(e,null,[{key:"checkDataBaseExists",value:(u=m(f().m(function e(t){var n,r;return f().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,indexedDB.databases();case 1:return n=e.v,e.a(2,n.some(function(e){return e.name===t}));case 2:return e.p=2,r=e.v,console.error("检查数据库是否存在时出错:",r),e.a(2,!1)}},e,null,[[0,2]])})),function(e){return u.apply(this,arguments)})},{key:"deleteDatabase",value:(l=m(f().m(function t(n){var r,i;return f().w(function(t){for(;;)if(0===t.n)return e.lastLink&&(null===(r=(i=e.lastLink).close)||void 0===r||r.call(i)),t.a(2,new Promise(function(e,t){var r=indexedDB.deleteDatabase(n);r.onsuccess=function(){e(!0)},r.onerror=function(){e(!1)},r.onblocked=function(){console.warn("删除数据库 ".concat(n," 被阻塞,可能有其他连接正在使用该数据库。")),t(new Error("删除数据库 ".concat(n," 被阻塞")))}}))},t)})),function(e){return l.apply(this,arguments)})},{key:"checkTableExists",value:(c=m(f().m(function t(n,r){return f().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,e.checkDataBaseExists(n);case 1:if(t.v){t.n=2;break}return t.a(2,!1);case 2:return t.a(2,new Promise(function(t,i){var o=indexedDB.open(n);o.onupgradeneeded=function(t){e.db=t.target.result,e.version=e.db.version},o.onsuccess=function(n){e.db=n.target.result,e.lastLink=o.result;var i=e.db.objectStoreNames.contains(r);o.result.close(),t(i)},o.onerror=function(e){i(e.target.error)}}))}},t)})),function(e,t){return c.apply(this,arguments)})},{key:"createTable",value:(s=m(f().m(function t(n,r,i){var o,a=arguments;return f().w(function(t){for(;;)if(0===t.n)return o=a.length>3&&void 0!==a[3]&&a[3],t.a(2,new Promise(function(t){var a,s;e.version+=1,e.lastLink&&(null===(a=(s=e.lastLink).close)||void 0===a||a.call(s));var c=indexedDB.open(n,e.version);c.onupgradeneeded=function(t){if(e.db=t.target.result,!e.db.objectStoreNames.contains(r)){var n={};i?n.keyPath=i:o&&(n.autoIncrement=!0),e.db.createObjectStore(r,n)}},c.onsuccess=function(){e.lastLink=c.result,c.result.close(),t(!0)},c.onerror=function(){t(!1)}}))},t)})),function(e,t,n){return s.apply(this,arguments)})},{key:"deleteTable",value:(a=m(f().m(function t(n,r){return f().w(function(t){for(;;)if(0===t.n)return t.a(2,new Promise(function(t){var i,o;e.version+=1,e.lastLink&&(null===(i=(o=e.lastLink).close)||void 0===i||i.call(o));var a=indexedDB.open(n,e.version);a.onupgradeneeded=function(t){e.db=t.target.result,e.lastLink=a.result,e.db.objectStoreNames.contains(r)&&e.db.deleteObjectStore(r)},a.onsuccess=function(n){e.db=n.target.result,e.lastLink=a.result,a.result.close(),t(!0)},a.onerror=function(){a.result.close(),t(!1)}}))},t)})),function(e,t){return a.apply(this,arguments)})},{key:"addData",value:(o=m(f().m(function t(n,r,i){return f().w(function(t){for(;;)if(0===t.n)return t.a(2,new Promise(function(t,o){var a=indexedDB.open(n);a.onsuccess=function(n){if(e.db=n.target.result,e.lastLink=a.result,e.db.objectStoreNames.contains(r)){var o=e.db.transaction([r],"readwrite").objectStore(r).add(i);o.onsuccess=function(e){t(i)},o.onerror=function(){t(null)}}a.result.close()},a.onerror=function(){a.result.close(),o()}}))},t)})),function(e,t,n){return o.apply(this,arguments)})},{key:"deleteData",value:(i=m(f().m(function t(n,r,i){return f().w(function(t){for(;;)if(0===t.n)return t.a(2,new Promise(function(t,o){var a=indexedDB.open(n);a.onsuccess=function(n){if(e.db=n.target.result,e.lastLink=a.result,e.db.objectStoreNames.contains(r)){var o=e.db.transaction([r],"readwrite").objectStore(r).delete(i);o.onsuccess=function(e){t(!0)},o.onerror=function(){t(!1)}}a.result.close()},a.onerror=function(){a.result.close(),o()}}))},t)})),function(e,t,n){return i.apply(this,arguments)})},{key:"updateData",value:(r=m(f().m(function t(n,r,i){return f().w(function(t){for(;;)if(0===t.n)return t.a(2,new Promise(function(t,o){var a=indexedDB.open(n);a.onsuccess=function(n){if(e.db=n.target.result,e.lastLink=a.result,e.db.objectStoreNames.contains(r)){var o=e.db.transaction([r],"readwrite").objectStore(r).put(i);o.onsuccess=function(e){t(i)},o.onerror=function(){t(i)}}a.result.close()},a.onerror=function(){a.result.close(),o()}}))},t)})),function(e,t,n){return r.apply(this,arguments)})},{key:"getData",value:(n=m(f().m(function t(n,r,i){return f().w(function(t){for(;;)if(0===t.n)return t.a(2,new Promise(function(t,o){var a=indexedDB.open(n);a.onsuccess=function(n){if(e.db=n.target.result,e.lastLink=a.result,e.db.objectStoreNames.contains(r)){var s=e.db.transaction([r],"readonly").objectStore(r).get(i);s.onsuccess=function(e){t(s.result)},s.onerror=function(){o(new Error("未找到数据".concat(i)))}}a.result.close()},a.onerror=function(){a.result.close(),o()}}))},t)})),function(e,t,r){return n.apply(this,arguments)})},{key:"getAllData",value:(t=m(f().m(function t(n,r){return f().w(function(t){for(;;)if(0===t.n)return t.a(2,new Promise(function(t,i){var o=indexedDB.open(n);o.onsuccess=function(n){if(e.db=n.target.result,e.lastLink=o.result,e.db.objectStoreNames.contains(r)){var i=e.db.transaction([r],"readonly").objectStore(r).getAll();i.onsuccess=function(e){t(i.result)},i.onerror=function(){t([])}}o.result.close()},o.onerror=function(){o.result.close(),i()}}))},t)})),function(e,n){return t.apply(this,arguments)})}]);var t,n,r,i,o,a,s,c,l,u}();_(Ne,"version",1),_(Ne,"db",null),_(Ne,"lastLink",void 0);var Te=function(){return S(function e(t){x(this,e),_(this,"options",void 0),this.options=h({multiple:!0,accept:"*/*",maxSize:5242880},t)},[{key:"openFilePicker",value:function(){var e=this,t=document.createElement("input");t.type="file",t.multiple=this.options.multiple,t.accept=this.options.accept||"",t.onchange=function(t){var n=Array.from(t.target.files||[]);e.handleFiles(n)},t.click()}},{key:"handleFiles",value:(t=m(f().m(function e(t){var n,r,i,o=this;return f().w(function(e){for(;;)switch(e.n){case 0:if(0!==t.length){e.n=1;break}return e.a(2);case 1:return i=t.filter(function(e){var t,n;return!(o.options.maxSize&&e.size>o.options.maxSize&&(null===(t=(n=o.options).onError)||void 0===t||t.call(n,new Error("文件大小超过限制 (".concat(o.formatSize(e.size)," > ").concat(o.formatSize(o.options.maxSize),")")),e),1))}),null===(n=(r=this.options).onSelect)||void 0===n||n.call(r,i),e.n=2,Promise.all(i.map(function(e){return o.processFile(e)}));case 2:return e.a(2)}},e,this)})),function(e){return t.apply(this,arguments)})},{key:"processFile",value:(e=m(f().m(function e(t){var n,r,i,o,a,s,c,l,u,d=this;return f().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,a=function(e){var n,r;null===(n=(r=d.options).onProgress)||void 0===n||n.call(r,t,e)},e.n=1,this.options.onUpload(t,a);case 1:s=e.v,null===(n=(r=this.options).onProgress)||void 0===n||n.call(r,t,100),null===(i=(o=this.options).onSuccess)||void 0===i||i.call(o,s,t),e.n=3;break;case 2:e.p=2,u=e.v,null===(c=(l=this.options).onError)||void 0===c||c.call(l,u instanceof Error?u:new Error("上传失败"),t);case 3:return e.a(2)}},e,this,[[0,2]])})),function(t){return e.apply(this,arguments)})},{key:"formatSize",value:function(e){if(0===e)return"0 B";var t=Math.floor(Math.log(e)/Math.log(1024));return"".concat((e/Math.pow(1024,t)).toFixed(2)," ").concat(["B","KB","MB","GB"][t])}}]);var e,t}(),Oe=function(){return S(function e(){x(this,e)},null,[{key:"getCdataContent",value:function(e){if(!e)return null;var t=Array.from(e.childNodes).find(function(e){return e.nodeType===e.CDATA_SECTION_NODE});return(null==t?void 0:t.nodeValue)||e.textContent}},{key:"parse",value:function(e){var t=this,n=(new DOMParser).parseFromString(e,"text/xml");return Array.from(n.querySelectorAll("resource")).map(function(e){var n=e.getAttribute("type")||"",r=e.querySelector("data"),i=e.querySelector("metadata");try{var o=t.getCdataContent(r),a=t.getCdataContent(i),s=o?JSON.parse(o):{},c=a?JSON.parse(a):{};return{id:s.id,type:n,data:s,metadata:c}}catch(wt){throw new Error("XML 解析错误: ".concat(wt.message))}})}},{key:"parseMixedContent",value:function(e){var t=/<resources\b[^>]*>[\s\S]*?<\/resources>/i.exec(e);if(!t)return{resources:[],remainingText:e,hasResources:!1};var n=g(t,1)[0],r=t.index,i=r+n.length,o=(e.slice(0,r)+e.slice(i)).replace(/\n/g,"").replace(/(!\[[^\]]*\]\([^)]+\))/g,"\n$1\n").replace(/\n+/g,"\n").replace(/^\n|\n$/g,"");try{return{resources:this.parse(n),remainingText:o,hasResources:!0}}catch(a){return{resources:[],remainingText:o,hasResources:!0,error:"资源解析失败: ".concat(a.message)}}}},{key:"stringify",value:function(e){var t=document.implementation.createDocument(null,null,null),n=t.createElement("resources");n.setAttribute("version","1.0");var r=function(e){return"\n".concat(" ".repeat(e))};return e.forEach(function(e){n.appendChild(t.createTextNode(r(1)));var i=t.createElement("resource");i.setAttribute("type",e.type),i.setAttribute("version","1.0");var o=function(e,n){var i=t.createElement(e);i.appendChild(t.createTextNode(r(2)));var o=t.createCDATASection(JSON.stringify(n));return i.appendChild(o),i.appendChild(t.createTextNode(r(1))),i};i.appendChild(t.createTextNode(r(2))),i.appendChild(o("data",e.data)),i.appendChild(t.createTextNode(r(2))),i.appendChild(o("metadata",e.metadata)),i.appendChild(t.createTextNode(r(1))),n.appendChild(i)}),n.appendChild(t.createTextNode("\n")),t.appendChild(n),(new XMLSerializer).serializeToString(t).replace(/></g,">\n<")}}])}(),Ee=function(){return S(function e(){x(this,e)},null,[{key:"getCdataContent",value:function(e){if(!e)return null;var t=Array.from(e.childNodes).find(function(e){return e.nodeType===e.CDATA_SECTION_NODE});return(null==t?void 0:t.nodeValue)||e.textContent}},{key:"parse",value:function(e){var t=this,n=(new DOMParser).parseFromString(e,"text/xml");return Array.from(n.querySelectorAll("suggestion")).map(function(e){var n=e.getAttribute("type")||"",r=e.querySelector("data"),i=e.querySelector("metadata");try{var o=t.getCdataContent(r),a=t.getCdataContent(i);return{type:n,data:o?JSON.parse(o):{},metadata:a?JSON.parse(a):{}}}catch(wt){throw new Error("XML 解析错误: ".concat(wt.message))}})}},{key:"parseMixedContent",value:function(e){var t=/<suggestions\b[^>]*>[\s\S]*?<\/suggestions>/i.exec(e);if(!t)return{suggestions:[],remainingText:e,hasSuggestions:!1};var n=g(t,1)[0],r=t.index,i=r+n.length,o=(e.slice(0,r)+e.slice(i)).replace(/\n/g,"");try{return{suggestions:this.parse(n),remainingText:o,hasSuggestions:!0}}catch(a){return{suggestions:[],remainingText:o,hasSuggestions:!0,error:"资源解析失败: ".concat(a.message)}}}},{key:"stringify",value:function(e){var t=document.implementation.createDocument(null,null,null),n=t.createElement("suggestions");n.setAttribute("version","1.0");var r=function(e){return"\n".concat(" ".repeat(e))};return e.forEach(function(e){n.appendChild(t.createTextNode(r(1)));var i=t.createElement("suggestion");i.setAttribute("type",e.type),i.setAttribute("version","1.0");var o=function(e,n){var i=t.createElement(e);i.appendChild(t.createTextNode(r(2)));var o=t.createCDATASection(JSON.stringify(n));return i.appendChild(o),i.appendChild(t.createTextNode(r(1))),i};i.appendChild(t.createTextNode(r(2))),i.appendChild(o("data",e.data)),i.appendChild(t.createTextNode(r(2))),i.appendChild(o("metadata",e.metadata)),i.appendChild(t.createTextNode(r(1))),n.appendChild(i)}),n.appendChild(t.createTextNode("\n")),t.appendChild(n),(new XMLSerializer).serializeToString(t).replace(/></g,">\n<")}}])}();function Ae(e){return e.x>=0&&e.x<=1&&e.y>=0&&e.y<=1}function De(e,t,n,r){var i=e/window.innerWidth,o=t/window.innerHeight;return{x:Math.max(0,Math.min(i,1-n)),y:Math.max(0,Math.min(o,1-r))}}var Ie,ze,Re,Pe,Le=function(){return S(function e(){x(this,e)},null,[{key:"parse",value:function(e){var t=!0;-1!==e.indexOf("<tool_call>")&&-1===e.indexOf("</tool_call>")&&(t=!1);var n,r=new RegExp("<tool_call>\\s*({[\\s\\S]*?})\\s*</tool_call>","g"),i=[],o=u(e.matchAll(r));try{for(o.s();!(n=o.n()).done;){var a=n.value;try{var s=JSON.parse(a[1]),c={name:s.name,parameters:s.parameters,error:s.error||!1,type:s.type};if(s.result){var l=s.result;try{["desc_oss_image","fetch_chunks"].includes(s.type)&&(l=JSON.parse(s.result))}catch(d){console.error("解析 ".concat(c.type," 工具调用失败:"),d)}finally{Object.assign(c,{result:l})}}i.push(c)}catch(wt){console.error("解析工具调用失败:",wt)}}}catch(h){o.e(h)}finally{o.f()}return{completed:t,toolCalls:i}}}])}(),Be=function(){return S(function e(){x(this,e)},null,[{key:"parse",value:function(e){var t,n=(e.match(/<chatstep>/g)||[]).length===(e.match(/<\/chatstep>/g)||[]).length,r=new RegExp("<chatstep>\\s*({[\\s\\S]*?})\\s*</chatstep>","g"),i=[],o=u(e.matchAll(r));try{for(o.s();!(t=o.n()).done;){var a=t.value;try{var s=JSON.parse(a[1]),c={title:s.title,content:s.content,status:s.status||"success"};i.push(c)}catch(wt){console.error("解析完整聊天步骤失败:",wt)}}}catch(v){o.e(v)}finally{o.f()}if(!n){for(var l=[],d=0;-1!==(d=e.indexOf("<chatstep>",d));)l.push(d),d+=10;var h=[];for(d=0;-1!==(d=e.indexOf("</chatstep>",d));)h.push(d),d+=11;for(var f=l.filter(function(e){return!h.find(function(t){return t>e})}),p=0;p<f.length;p++)i.push({title:"",content:"",status:"pending"})}return i}}])}(),Ve=function(){return S(function e(){x(this,e)},null,[{key:"parse",value:function(e){var t=[],n=e.indexOf("<chatuiaction>"),r=e.indexOf("</chatuiaction>");if(-1===n||-1===r)return t;var i=e.substring(n,r+17);i=i.replace(/\\r/g,"\r").replace(/\\n/g,"\n");var o,a=new RegExp("<chatuiaction>\\s*({[\\s\\S]*?})\\s*</chatuiaction>","g"),s=u(i.matchAll(a));try{for(s.s();!(o=s.n()).done;){var l=o.value;try{var d=l[1].replace(/\\/g,"").replace(/"\[/g,"[").replace(/\]"/g,"]").replace(/\n/g,""),h=JSON.parse(d);h&&h.content&&h.content.length>0&&(t=c(h.content))}catch(wt){console.error("解析完整聊天界面操作失败:",wt)}}}catch(f){s.e(f)}finally{s.f()}return t}}])}(),Fe=0,je=[],$e=v,He=$e.__b,We=$e.__r,qe=$e.diffed,Ue=$e.__c,Ke=$e.unmount,Je=$e.__;function Ge(e,t){$e.__h&&$e.__h(ze,e,Fe||t),Fe=0;var n=ze.__H||(ze.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function Xe(e){return Fe=1,function(e,t,n){var r=Ge(Ie++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):lt(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);t!==n&&(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=ze,!ze.__f)){var i=function(e,t,n){if(!r.__c.__H)return!0;var i=r.__c.__H.__.filter(function(e){return!!e.__c});if(i.every(function(e){return!e.__N}))return!o||o.call(this,e,t,n);var a=r.__c.props!==e;return i.forEach(function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(a=!0)}}),o&&o.call(this,e,t,n)||a};ze.__f=!0;var o=ze.shouldComponentUpdate,a=ze.componentWillUpdate;ze.componentWillUpdate=function(e,t,n){if(this.__e){var r=o;o=void 0,i(e,t,n),o=r}a&&a.call(this,e,t,n)},ze.shouldComponentUpdate=i}return r.__N||r.__}(lt,e)}function Ye(e,t){var n=Ge(Ie++,3);!$e.__s&&ct(n.__H,t)&&(n.__=e,n.u=t,ze.__H.__h.push(n))}function Ze(e,t){var n=Ge(Ie++,4);!$e.__s&&ct(n.__H,t)&&(n.__=e,n.u=t,ze.__h.push(n))}function Qe(e){return Fe=5,et(function(){return{current:e}},[])}function et(e,t){var n=Ge(Ie++,7);return ct(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function tt(e,t){return Fe=8,et(function(){return e},t)}function nt(e){var t=ze.context[e.__c],n=Ge(Ie++,9);return n.c=e,t?(null==n.__&&(n.__=!0,t.sub(ze)),t.props.value):e.__}function rt(){for(var e;e=je.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(at),e.__H.__h.forEach(st),e.__H.__h=[]}catch(dt){e.__H.__h=[],$e.__e(dt,e.__v)}}$e.__b=function(e){ze=null,He&&He(e)},$e.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Je&&Je(e,t)},$e.__r=function(e){We&&We(e),Ie=0;var t=(ze=e.__c).__H;t&&(Re===ze?(t.__h=[],ze.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.forEach(at),t.__h.forEach(st),t.__h=[],Ie=0)),Re=ze},$e.diffed=function(e){qe&&qe(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==je.push(t)&&Pe===$e.requestAnimationFrame||((Pe=$e.requestAnimationFrame)||ot)(rt)),t.__H.__.forEach(function(e){e.u&&(e.__H=e.u),e.u=void 0})),Re=ze=null},$e.__c=function(e,t){t.some(function(e){try{e.__h.forEach(at),e.__h=e.__h.filter(function(e){return!e.__||st(e)})}catch(ze){t.some(function(e){e.__h&&(e.__h=[])}),t=[],$e.__e(ze,e.__v)}}),Ue&&Ue(e,t)},$e.unmount=function(e){Ke&&Ke(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(e){try{at(e)}catch(e){t=e}}),n.__H=void 0,t&&$e.__e(t,n.__v))};var it="function"==typeof requestAnimationFrame;function ot(e){var t,n=function(){clearTimeout(r),it&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);it&&(t=requestAnimationFrame(n))}function at(e){var t=ze,n=e.__c;"function"==typeof n&&(e.__c=void 0,n()),ze=t}function st(e){var t=ze;e.__c=e.__(),ze=t}function ct(e,t){return!e||e.length!==t.length||t.some(function(t,n){return t!==e[n]})}function lt(e,t){return"function"==typeof t?t(e):t}var ut=Symbol.for("preact-signals");function dt(){if(gt>1)gt--;else{for(var e,t=!1;void 0!==mt;){var n=mt;for(mt=void 0,yt++;void 0!==n;){var r=n.o;if(n.o=void 0,n.f&=-3,!(8&n.f)&&Ct(n))try{n.c()}catch(n){t||(e=n,t=!0)}n=r}}if(yt=0,gt--,t)throw e}}var ht=void 0;function ft(e){var t=ht;ht=void 0;try{return e()}finally{ht=t}}var pt,vt,mt=void 0,gt=0,yt=0,kt=0;function wt(e){if(void 0!==ht){var t=e.n;if(void 0===t||t.t!==ht)return t={i:0,S:e,p:ht.s,n:void 0,t:ht,e:void 0,x:void 0,r:t},void 0!==ht.s&&(ht.s.n=t),ht.s=t,e.n=t,32&ht.f&&e.S(t),t;if(-1===t.i)return t.i=0,void 0!==t.n&&(t.n.p=t.p,void 0!==t.p&&(t.p.n=t.n),t.p=ht.s,t.n=void 0,ht.s.n=t,ht.s=t),t}}function bt(e,t){this.v=e,this.i=0,this.n=void 0,this.t=void 0,this.W=null==t?void 0:t.watched,this.Z=null==t?void 0:t.unwatched,this.name=null==t?void 0:t.name}function xt(e,t){return new bt(e,t)}function Ct(e){for(var t=e.s;void 0!==t;t=t.n)if(t.S.i!==t.i||!t.S.h()||t.S.i!==t.i)return!0;return!1}function St(e){for(var t=e.s;void 0!==t;t=t.n){var n=t.S.n;if(void 0!==n&&(t.r=n),t.S.n=t,t.i=-1,void 0===t.n){e.s=t;break}}}function _t(e){for(var t=e.s,n=void 0;void 0!==t;){var r=t.p;-1===t.i?(t.S.U(t),void 0!==r&&(r.n=t.n),void 0!==t.n&&(t.n.p=r)):n=t,t.S.n=t.r,void 0!==t.r&&(t.r=void 0),t=r}e.s=n}function Mt(e,t){bt.call(this,void 0),this.x=e,this.s=void 0,this.g=kt-1,this.f=4,this.W=null==t?void 0:t.watched,this.Z=null==t?void 0:t.unwatched,this.name=null==t?void 0:t.name}function Nt(e,t){return new Mt(e,t)}function Tt(e){var t=e.u;if(e.u=void 0,"function"==typeof t){gt++;var n=ht;ht=void 0;try{t()}catch(dt){throw e.f&=-2,e.f|=8,Ot(e),dt}finally{ht=n,dt()}}}function Ot(e){for(var t=e.s;void 0!==t;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,Tt(e)}function Et(e){if(ht!==this)throw new Error("Out-of-order effect");_t(this),ht=e,this.f&=-2,8&this.f&&Ot(this),dt()}function At(e,t){this.x=e,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32,this.name=null==t?void 0:t.name}function Dt(e,t){var n=new At(e,t);try{n.c()}catch(e){throw n.d(),e}var r=n.d.bind(n);return r[Symbol.dispose]=r,r}function It(e,t){v[e]=t.bind(null,v[e]||function(){})}function zt(e){vt&&vt(),vt=e&&e.S()}function Rt(e){var t=this,n=e.data,r=Lt(n);r.value=n;var i=et(function(){for(var e=t.__v;e=e.__;)if(e.__c){e.__c.__$f|=4;break}return t.__$u.c=function(){var e,n=t.__$u.S(),r=i.value;n(),C(r)||3!==(null==(e=t.base)?void 0:e.nodeType)?(t.__$f|=1,t.setState({})):t.base.data=r},Nt(function(){var e=r.value.value;return 0===e?0:!0===e?"":e||""})},[]);return i.value}function Pt(e,t,n,r){var i=t in e&&void 0===e.ownerSVGElement,o=xt(n);return{o:function(e,t){o.value=e,r=t},d:Dt(function(){var n=o.value.value;r[t]!==n&&(r[t]=n,i?e[t]=n:n?e.setAttribute(t,n):e.removeAttribute(t))})}}function Lt(e){return et(function(){return xt(e)},[])}function Bt(e){var t=Qe(e);return t.current=e,pt.__$f|=4,et(function(){return Nt(function(){return t.current()})},[])}bt.prototype.brand=ut,bt.prototype.h=function(){return!0},bt.prototype.S=function(e){var t=this,n=this.t;n!==e&&void 0===e.e&&(e.x=n,this.t=e,void 0!==n?n.e=e:ft(function(){var e;null==(e=t.W)||e.call(t)}))},bt.prototype.U=function(e){var t=this;if(void 0!==this.t){var n=e.e,r=e.x;void 0!==n&&(n.x=r,e.e=void 0),void 0!==r&&(r.e=n,e.x=void 0),e===this.t&&(this.t=r,void 0===r&&ft(function(){var e;null==(e=t.Z)||e.call(t)}))}},bt.prototype.subscribe=function(e){var t=this;return Dt(function(){var n=t.value,r=ht;ht=void 0;try{e(n)}finally{ht=r}},{name:"sub"})},bt.prototype.valueOf=function(){return this.value},bt.prototype.toString=function(){return this.value+""},bt.prototype.toJSON=function(){return this.value},bt.prototype.peek=function(){var e=ht;ht=void 0;try{return this.value}finally{ht=e}},Object.defineProperty(bt.prototype,"value",{get:function(){var e=wt(this);return void 0!==e&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(yt>100)throw new Error("Cycle detected");this.v=e,this.i++,kt++,gt++;try{for(var t=this.t;void 0!==t;t=t.x)t.t.N()}finally{dt()}}}}),Mt.prototype=new bt,Mt.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if(32==(36&this.f))return!0;if(this.f&=-5,this.g===kt)return!0;if(this.g=kt,this.f|=1,this.i>0&&!Ct(this))return this.f&=-2,!0;var e=ht;try{St(this),ht=this;var t=this.x();(16&this.f||this.v!==t||0===this.i)&&(this.v=t,this.f&=-17,this.i++)}catch(e){this.v=e,this.f|=16,this.i++}return ht=e,_t(this),this.f&=-2,!0},Mt.prototype.S=function(e){if(void 0===this.t){this.f|=36;for(var t=this.s;void 0!==t;t=t.n)t.S.S(t)}bt.prototype.S.call(this,e)},Mt.prototype.U=function(e){if(void 0!==this.t&&(bt.prototype.U.call(this,e),void 0===this.t)){this.f&=-33;for(var t=this.s;void 0!==t;t=t.n)t.S.U(t)}},Mt.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var e=this.t;void 0!==e;e=e.x)e.t.N()}},Object.defineProperty(Mt.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var e=wt(this);if(this.h(),void 0!==e&&(e.i=this.i),16&this.f)throw this.v;return this.v}}),At.prototype.c=function(){var e=this.S();try{if(8&this.f)return;if(void 0===this.x)return;var t=this.x();"function"==typeof t&&(this.u=t)}finally{e()}},At.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,Tt(this),St(this),gt++;var e=ht;return ht=this,Et.bind(this,e)},At.prototype.N=function(){2&this.f||(this.f|=2,this.o=mt,mt=this)},At.prototype.d=function(){this.f|=8,1&this.f||Ot(this)},At.prototype.dispose=function(){this.d()},Rt.displayName="_st",Object.defineProperties(bt.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:Rt},props:{configurable:!0,get:function(){return{data:this}}},__b:{configurable:!0,value:1}}),It("__b",function(e,t){if("string"==typeof t.type){var n,r=t.props;for(var i in r)if("children"!==i){var o=r[i];o instanceof bt&&(n||(t.__np=n={}),n[i]=o,r[i]=o.peek())}}e(t)}),It("__r",function(e,t){zt();var n,r=t.__c;r&&(r.__$f&=-2,void 0===(n=r.__$u)&&(r.__$u=n=function(){var e;return Dt(function(){e=this}),e.c=function(){r.__$f|=1,r.setState({})},e}())),pt=r,zt(n),e(t)}),It("__e",function(e,t,n,r){zt(),pt=void 0,e(t,n,r)}),It("diffed",function(e,t){var n;if(zt(),pt=void 0,"string"==typeof t.type&&(n=t.__e)){var r=t.__np,i=t.props;if(r){var o=n.U;if(o)for(var a in o){var s=o[a];void 0===s||a in r||(s.d(),o[a]=void 0)}else n.U=o={};for(var c in r){var l=o[c],u=r[c];void 0===l?(l=Pt(n,c,u,i),o[c]=l):l.o(u,i)}}}e(t)}),It("unmount",function(e,t){if("string"==typeof t.type){var n=t.__e;if(n){var r=n.U;if(r)for(var i in n.U=void 0,r){var o=r[i];o&&o.d()}}}else{var a=t.__c;if(a){var s=a.__$u;s&&(a.__$u=void 0,s.d())}}e(t)}),It("__h",function(e,t,n,r){(r<3||9===r)&&(t.__$f|=2),e(t,n,r)}),q.prototype.shouldComponentUpdate=function(e,t){var n=this.__$u,r=n&&void 0!==n.s;for(var i in t)return!0;if(this.__f||"boolean"==typeof this.u&&!0===this.u){if(!(r||2&this.__$f||4&this.__$f))return!0;if(1&this.__$f)return!0}else{if(!(r||4&this.__$f))return!0;if(3&this.__$f)return!0}for(var o in e)if("__source"!==o&&e[o]!==this.props[o])return!0;for(var a in this.props)if(!(a in e))return!0;return!1};var Vt=function(){return fe("svg",{viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",children:fe("path",{d:"M843.904 783.573333 783.573333 843.904 512.042667 572.373333 240.512 843.904 180.181333 783.573333 451.712 512.042667 180.181333 240.512 240.512 180.181333 512.042667 451.712 783.573333 180.181333 843.904 240.512 572.373333 512.042667 843.904 783.573333Z"})})},Ft=function(){return fe("svg",{className:"icon",viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",children:fe("path",{d:"M900.64 379.808l-263.072-256.032c-36.448-35.328-105.76-35.392-142.304 0.096l-327.04 319.904c-56.416 54.72-70.72 76.704-70.72 150.976l0 143.936c0 132.768 26.976 192 186.912 192l131.872 0c81.12 0 128.448-46.656 193.952-111.264l290.016-297.696c18.592-17.984 29.248-43.968 29.248-71.264C929.504 423.36 918.976 397.6 900.64 379.808zM323.008 786.752c-52.928 0-96-43.072-96-96s43.072-96 96-96 96 43.072 96 96S375.936 786.752 323.008 786.752z"})})},jt=function(e){return fe("svg",{viewBox:"0 0 1024 1024",id:"send",className:e.className,version:"1.1",xmlns:"http://www.w3.org/2000/svg",children:fe("path",{d:"M931.4 498.9L94.9 79.5c-3.4-1.7-7.3-2.1-11-1.2-8.5 2.1-13.8 10.7-11.7 19.3l86.2 352.2c1.3 5.3 5.2 9.6 10.4 11.3l147.7 50.7-147.6 50.7c-5.2 1.8-9.1 6-10.3 11.3L72.2 926.5c-0.9 3.7-0.5 7.6 1.2 10.9 3.9 7.9 13.5 11.1 21.5 7.2l836.5-417c3.1-1.5 5.6-4.1 7.2-7.1 3.9-8 0.7-17.6-7.2-21.6zM170.8 826.3l50.3-205.6 295.2-101.3c2.3-0.8 4.2-2.6 5-5 1.4-4.2-0.8-8.7-5-10.2L221.1 403 171 198.2l628 314.9-628.2 313.2z"})})},$t=function(){return fe("svg",{viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",children:fe("path",{d:"M962 197.61H747v-60c0-55.14-44.86-100-100-100H377c-55.14 0-100 44.86-100 100v60H62c-11.05 0-20 8.95-20 20s8.95 20 20 20h60v630.57c0 66.17 53.83 120 120 120h540c66.17 0 120-53.83 120-120V237.61h60c11.05 0 20-8.95 20-20s-8.95-20-20-20zM637.34 457.66v260c0 12.01-10.72 21.63-23.06 19.77-9.84-1.48-16.94-10.25-16.94-20.2V458.09c0-9.95 7.1-18.72 16.94-20.2 12.34-1.86 23.06 7.76 23.06 19.77z m-210.68 0v260c0 11-9 20-20 20s-20-9-20-20v-260c0-11 9-20 20-20s20 9 20 20zM317 137.61c0-33.08 26.92-60 60-60h270c33.08 0 60 26.92 60 60v60H317v-60z"})})},Ht=function(){return fe("svg",{viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",children:fe("path",{d:"M511.582491 63.413262C265.134543 63.413262 64.62588 263.921925 64.62588 510.369873s200.508663 446.957635 446.957635 446.957635 446.957635-200.508663 446.957635-446.957635S758.031463 63.413262 511.582491 63.413262zM509.001713 751.859903c-98.517781 0-182.467775-62.623269-214.771505-150.056598l0.327458-0.134053c-2.007727-4.036943-3.38305-8.422833-3.38305-13.237489 0-16.647145 13.494339-30.142507 30.142507-30.142507 13.389962 0 24.358781 8.877181 28.2893 20.955264l0.422625-0.172939c23.269983 65.442478 85.645612 112.503307 158.972665 112.503307 93.106538 0 168.845523-75.738985 168.845523-168.845523s-75.738985-168.845523-168.845523-168.845523c-20.432355 0-39.874149 3.980661-58.013275 10.66899l21.248953 40.742936c2.486634 2.677992 4.0175 6.2831 4.0175 10.243295 0 8.417717-8.404414 14.921851-15.365966 15.07023-0.102331 0-0.206708 0-0.309038 0-0.220011 0-0.427742 0-0.647753-0.013303l-150.579507-6.463202c-5.372358-0.234337-10.229992-3.310396-12.716626-8.093329-2.486634-4.76963-2.236947-10.509355 0.647753-15.055904l80.890308-127.179564c2.8847-4.533246 8.006348-7.151887 13.365402-6.960529 5.372358 0.234337 10.227945 3.312442 12.71458 8.095375l18.580171 35.625382c26.629497-10.855232 55.683207-16.963347 86.168522-16.963347 126.338407 0 229.130537 102.791108 229.130537 229.130537S635.340119 751.859903 509.001713 751.859903z"})})},Wt=function(){return fe("svg",{viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",children:fe("path",{d:"M891.072 822.144V167.36a34.432 34.432 0 0 0-34.432-34.432H201.856C201.856 94.848 232.704 64 270.784 64h620.288C929.152 64 960 94.848 960 132.928v620.288c0 38.08-30.848 68.928-68.928 68.928z m-68.928-551.36v620.288c0 38.08-30.848 68.928-68.928 68.928H132.928A68.928 68.928 0 0 1 64 891.072V270.784c0-38.08 30.848-68.928 68.928-68.928h620.288c38.08 0 68.928 30.848 68.928 68.928z m-137.856 137.856H201.856a34.432 34.432 0 0 0 0 68.864h482.432a34.432 34.432 0 0 0 0-68.864z m0 206.72H201.856a34.432 34.432 0 0 0 0 68.864h482.432a34.432 34.432 0 0 0 0-68.864z"})})},qt=function(){return fe("svg",{viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",children:fe("path",{d:"M547.4 197.4v46l200.3 0.1L546.1 444l32.4 32.6 201.9-200.7v200.9h46V197.5zM471.4 584.4l-32.6-32.6L243.6 747V547.9h-46v278.7h279v-46H275z"})})},Ut=function(){return fe("svg",{viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",children:fe("path",{d:"M544 480V282.944h52.224l0.064 107.968L763.072 224l36.928 36.928-166.976 166.976 108.032-0.128V480H544zM260.928 800l-36.928-36.928 166.912-166.784-107.968-0.064V544H480v197.056h-52.224l0.064-107.968L260.928 800z"})})},Kt=function(){return fe("svg",{viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",children:fe("path",{d:"M960 544H64a32 32 0 1 1 0-64h896a32 32 0 1 1 0 64"})})},Jt=function(){return fe("svg",{viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",children:[fe("path",{d:"M481.0752 263.3728l50.9952 1.024 1.8432-105.8816-50.9952-0.8192z"}),fe("path",{d:"M486.441426 180.895362a66.56 66.56 0 1 0 42.091944-126.290153 66.56 66.56 0 1 0-42.091944 126.290153Z"}),fe("path",{d:"M138.8544 664.3712c-52.8384 0-95.8464-43.008-95.8464-95.8464s43.008-95.8464 95.8464-95.8464M880.0256 472.6784c52.8384 0 95.8464 43.008 95.8464 95.8464s-43.008 95.8464-95.8464 95.8464"}),fe("path",{d:"M507.4944 220.5696c-220.16 0-398.7456 162.816-398.7456 363.7248s178.5856 363.7248 398.7456 363.7248 398.7456-162.816 398.7456-363.7248-178.5856-363.7248-398.7456-363.7248z m0 559.9232c-166.2976 0-301.2608-100.5568-301.2608-224.4608s134.9632-224.4608 301.2608-224.4608S808.7552 432.128 808.7552 556.032 673.792 780.4928 507.4944 780.4928z"}),fe("path",{d:"M319.6928 556.032a47.9232 38.912 90 1 0 77.824 0 47.9232 38.912 90 1 0-77.824 0Z"}),fe("path",{d:"M617.472 556.032a47.9232 38.912 90 1 0 77.824 0 47.9232 38.912 90 1 0-77.824 0Z"})]})},Gt=function(){return fe("svg",{viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[fe("path",{d:"M5.856 17.121a.979.979 0 0 1-.327-.06.839.839 0 0 1-.283-.177.739.739 0 0 1-.187-.255.724.724 0 0 1-.07-.303l-.02-1.609a4.663 4.663 0 0 1-1.446-.455 4.252 4.252 0 0 1-.637-.401c-.199-.146-.385-.31-.553-.492a4.442 4.442 0 0 1-.45-.577 4.303 4.303 0 0 1-.327-.637 3.823 3.823 0 0 1-.206-.686 3.729 3.729 0 0 1-.064-.704V6.478c0-.261.025-.516.077-.771a4.43 4.43 0 0 1 .244-.747 4.062 4.062 0 0 1 .932-1.28c.2-.183.418-.347.65-.493.23-.145.482-.267.739-.364a4.21 4.21 0 0 1 .81-.225c.27-.054.553-.078.835-.078H8.55c.103 0 .2.018.29.054a.7.7 0 0 1 .411.376.667.667 0 0 1-.161.766.736.736 0 0 1-.25.151.764.764 0 0 1-.29.055H5.573c-.186 0-.366.012-.54.049-.18.03-.353.079-.52.145-.167.061-.328.14-.482.237-.148.091-.29.2-.418.316a2.897 2.897 0 0 0-.347.388c-.097.14-.187.286-.257.444a2.473 2.473 0 0 0-.206.977v4.287c0 .17.013.333.051.503a2.549 2.549 0 0 0 .772 1.33 2.721 2.721 0 0 0 .913.559c.167.066.347.115.527.152.18.03.36.048.546.048a.904.904 0 0 1 .61.23.848.848 0 0 1 .194.262.84.84 0 0 1 .07.303l.007.99 1.915-1.293a2.877 2.877 0 0 1 1.64-.492h2.372c.186 0 .366-.018.54-.048.18-.03.353-.08.52-.146.168-.067.329-.146.483-.237.148-.091.29-.2.418-.316.128-.121.244-.249.347-.388a2.8 2.8 0 0 0 .257-.444 2.47 2.47 0 0 0 .206-.977V8.585a.646.646 0 0 1 .225-.492.679.679 0 0 1 .244-.152.814.814 0 0 1 .585 0c.09.03.174.085.244.152a.657.657 0 0 1 .225.492V10.8c0 .261-.032.516-.083.771a4.192 4.192 0 0 1-.245.74c-.109.244-.244.468-.398.687a3.735 3.735 0 0 1-.534.6c-.2.183-.418.347-.65.493a4.134 4.134 0 0 1-.738.364 4.7 4.7 0 0 1-.81.225c-.27.054-.553.079-.836.079h-1.877c-.604 0-1.144.164-1.633.491l-2.54 1.713a.913.913 0 0 1-.514.157z",fill:"currentColor"}),fe("path",{d:"M15.866 4.125h-4.174c-.41 0-.741.313-.741.7 0 .387.332.7.741.7h4.174c.41 0 .742-.313.742-.7 0-.387-.332-.7-.742-.7z",fill:"currentColor"}),fe("path",{d:"M14.537 2.932c0-.396-.34-.717-.759-.717s-.758.32-.758.717v3.786c0 .396.34.717.758.717.42 0 .76-.321.76-.717V2.932z",fill:"currentColor"})]})},Xt=function(){return fe("svg",{viewBox:"64 64 896 896",focusable:"false",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true",children:fe("path",{d:"M842 454c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8 0 140.3-113.7 254-254 254S258 594.3 258 454c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8 0 168.7 126.6 307.9 290 327.6V884H326.7c-13.7 0-24.7 14.3-24.7 32v36c0 4.4 2.8 8 6.2 8h407.6c3.4 0 6.2-3.6 6.2-8v-36c0-17.7-11-32-24.7-32H548V782.1c165.3-18 294-158 294-328.1zM512 624c93.9 0 170-75.2 170-168V232c0-92.8-76.1-168-170-168s-170 75.2-170 168v224c0 92.8 76.1 168 170 168zm-94-392c0-50.6 41.9-92 94-92s94 41.4 94 92v224c0 50.6-41.9 92-94 92s-94-41.4-94-92V232z"})})},Yt=function(){var e=1e3,t=140,n=250,r=.8;return fe("svg",{fill:"currentColor",viewBox:"0 0 ".concat(e," ").concat(e),xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",children:Array.from({length:4}).map(function(e,i){return fe("rect",{fill:"currentColor",rx:70,ry:70,height:n,width:t,x:i*(440/3+t),y:375,children:[fe("animate",{attributeName:"height",values:"".concat(n,"; ").concat(500,"; ").concat(n),keyTimes:"0; 0.5; 1",dur:"".concat(r,"s"),begin:"".concat(.2*i,"s"),repeatCount:"indefinite"}),fe("animate",{attributeName:"y",values:"".concat(375,"; ").concat(250,"; ").concat(375),keyTimes:"0; 0.5; 1",dur:"".concat(r,"s"),begin:"".concat(.2*i,"s"),repeatCount:"indefinite"})]},i)})})},Zt=function(e){return fe("svg",{className:e.className,onClick:e.onClick,viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",children:fe("path",{d:"M128 384a128 128 0 1 1 0 256 128 128 0 0 1 0-256z m768 0a128 128 0 1 1 0 256 128 128 0 0 1 0-256z m-372.4288 0a128 128 0 1 1 0 256 128 128 0 0 1 0-256z"})})},Qt=function(e){return fe("svg",{className:e.className,viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",children:fe("path",{d:"M498.33984 607.8464c-10.99776-32.9728-50.09408-73.5232-82.6368-85.74976L150.9376 422.8096c-38.54336-14.4384-36.98688-69.46816 2.27328-81.73568L844.92288 124.90752c33.30048-10.40384 64.57344 20.8896 54.1696 54.1696L682.92608 870.78912a43.2128 43.2128 0 0 1-81.36704 3.25632 121682.5344 121682.5344 0 0 1-103.2192-266.19904z"})})},en=function(){return fe("svg",{className:"icon",viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",children:fe("path",{d:"M972.657609 209.348408C987.158609 209.36839 998.930114 197.571202 998.949999 182.99865 998.969882 168.426097 987.230618 156.59651 972.729617 156.576528L32.457975 155.280806C17.956974 155.260823 6.18547 167.058012 6.165585 181.630564 6.1457 196.203116 17.884965 208.032703 32.385966 208.052686L972.657609 209.348408ZM180.466902 992.356169 180.466902 1019.014859 206.993296 1018.74074 833.361858 1012.267947 859.348284 1011.999407 859.348284 985.883377 859.348284 289.397297C859.348284 274.824732 847.59289 263.011332 833.091874 263.011332 818.590859 263.011332 806.835465 274.824732 806.835465 289.397297L806.835465 985.883377 832.82189 959.498805 206.453329 965.971599 232.979723 992.356169 232.979723 282.67005C232.979723 268.097483 221.224329 256.284085 206.723313 256.284085 192.222298 256.284085 180.466902 268.097483 180.466902 282.67005L180.466902 992.356169ZM656.410257 847.079027C656.410257 861.651593 668.165651 873.464992 682.666667 873.464992 697.167682 873.464992 708.923076 861.651593 708.923076 847.079027L708.923076 372.131659C708.923076 357.559091 697.167682 345.745694 682.666667 345.745694 668.165651 345.745694 656.410257 357.559091 656.410257 372.131659L656.410257 847.079027ZM341.333333 847.079027C341.333333 861.651593 353.08873 873.464992 367.589743 873.464992 382.090758 873.464992 393.846155 861.651593 393.846155 847.079027L393.846155 372.131659C393.846155 357.559091 382.090758 345.745694 367.589743 345.745694 353.08873 345.745694 341.333333 357.559091 341.333333 372.131659L341.333333 847.079027ZM498.871795 847.079027C498.871795 861.651593 510.627189 873.464992 525.128205 873.464992 539.62922 873.464992 551.384614 861.651593 551.384614 847.079027L551.384614 372.131659C551.384614 357.559091 539.62922 345.745694 525.128205 345.745694 510.627189 345.745694 498.871795 357.559091 498.871795 372.131659L498.871795 847.079027ZM392.147755 116.721777C392.147755 102.063669 403.758665 90.363507 418.40134 90.363507L622.925796 90.363507C637.408947 90.363507 649.179381 102.1619 649.179381 116.549585L649.179381 171.644875 701.692203 171.644875 701.692203 116.549585C701.692203 72.986607 666.38105 37.591577 622.925796 37.591577L418.40134 37.591577C374.724427 37.591577 339.634933 72.950804 339.634933 116.721777L339.634933 165.310801 392.147755 165.310801 392.147755 116.721777Z"})})},tn=function(e){return fe("svg",{xmlns:"http://www.w3.org/2000/svg",className:e.className,viewBox:"0 0 512 512",children:fe("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"48",d:"M112 184l144 144 144-144"})})},nn=function(e){return fe("svg",{xmlns:"http://www.w3.org/2000/svg",className:"".concat(e.className," icon"),viewBox:"0 0 512 512",children:fe("path",{d:"M256 48C141.31 48 48 141.31 48 256s93.31 208 208 208 208-93.31 208-208S370.69 48 256 48zm108.25 138.29l-134.4 160a16 16 0 01-12 5.71h-.27a16 16 0 01-11.89-5.3l-57.6-64a16 16 0 1123.78-21.4l45.29 50.32 122.59-145.91a16 16 0 0124.5 20.58z"})})},rn=function(e){return fe("svg",{className:e.className,width:"16",height:"16",viewBox:"0 0 50 50",xmlns:"http://www.w3.org/2000/svg",children:fe("circle",{cx:"25",cy:"25",r:"20",stroke:"currentColor",strokeWidth:"5",fill:"none",strokeDasharray:"31.415, 31.415",strokeLinecap:"round",children:fe("animateTransform",{attributeName:"transform",type:"rotate",from:"0 25 25",to:"360 25 25",dur:"1s",repeatCount:"indefinite"})})})},on=function(){return fe("svg",{className:"icon",viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",children:[fe("path",{d:"M512 61.44a40.96 40.96 0 0 1 40.96 40.96v122.88a40.96 40.96 0 1 1-81.92 0V102.4A40.96 40.96 0 0 1 512 61.44z",fill:"currentColor",opacity:".9"}),fe("path",{d:"M737.28 121.792a40.96 40.96 0 0 1 14.992 55.952l-61.44 106.432a40.96 40.96 0 1 1-70.944-40.96l61.44-106.432a40.96 40.96 0 0 1 55.952-14.992z",fill:"currentColor",opacity:".8"}),fe("path",{d:"M902.208 286.72a40.96 40.96 0 0 1-14.992 55.952l-106.432 61.44a40.96 40.96 0 0 1-40.96-70.944l106.432-61.44a40.96 40.96 0 0 1 55.952 14.992z",fill:"currentColor",opacity:".76"}),fe("path",{d:"M962.56 512a40.96 40.96 0 0 1-40.96 40.96h-122.88a40.96 40.96 0 1 1 0-81.92h122.88A40.96 40.96 0 0 1 962.56 512z",fill:"currentColor",opacity:".7"}),fe("path",{d:"M902.208 737.28a40.96 40.96 0 0 1-55.952 14.992l-106.432-61.44a40.96 40.96 0 1 1 40.96-70.944l106.432 61.44a40.96 40.96 0 0 1 14.992 55.952z",fill:"currentColor",opacity:".6"}),fe("path",{d:"M737.28 902.208a40.96 40.96 0 0 1-55.952-14.992l-61.44-106.432a40.96 40.96 0 0 1 70.944-40.96l61.44 106.432a40.96 40.96 0 0 1-14.992 55.952z",fill:"currentColor",opacity:".5"}),fe("path",{d:"M512 962.56a40.96 40.96 0 0 1-40.96-40.96v-122.88a40.96 40.96 0 1 1 81.92 0v122.88A40.96 40.96 0 0 1 512 962.56z",fill:"currentColor",opacity:".4"}),fe("path",{d:"M286.72 902.208a40.96 40.96 0 0 1-14.992-55.952l61.44-106.432a40.96 40.96 0 1 1 70.944 40.96l-61.44 106.432a40.96 40.96 0 0 1-55.952 14.992z",fill:"currentColor",opacity:".3"}),fe("path",{d:"M121.792 737.28a40.96 40.96 0 0 1 14.992-55.952l106.432-61.44a40.96 40.96 0 0 1 40.96 70.944l-106.432 61.44a40.96 40.96 0 0 1-55.952-14.992z",fill:"currentColor",opacity:".2"}),fe("path",{d:"M61.44 512a40.96 40.96 0 0 1 40.96-40.96h122.88a40.96 40.96 0 1 1 0 81.92H102.4A40.96 40.96 0 0 1 61.44 512z",fill:"currentColor",opacity:".1"}),fe("path",{d:"M121.792 286.72a40.96 40.96 0 0 1 55.952-14.992l106.432 61.44a40.96 40.96 0 1 1-40.96 70.944l-106.432-61.44a40.96 40.96 0 0 1-14.992-55.952z",fill:"currentColor",opacity:".04"}),fe("path",{d:"M286.72 121.792a40.96 40.96 0 0 1 55.952 14.992l61.44 106.432a40.96 40.96 0 0 1-70.944 40.96l-61.44-106.432a40.96 40.96 0 0 1 14.992-55.952z",fill:"currentColor"})]})},an=function(){return fe("svg",{className:"icon",viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",children:fe("path",{d:"M704 256v490.666667a170.666667 170.666667 0 0 1-170.666667 170.666666 170.666667 170.666667 0 0 1-170.666666-170.666666V213.333333A106.666667 106.666667 0 0 1 469.333333 106.666667 106.666667 106.666667 0 0 1 576 213.333333v448a42.666667 42.666667 0 0 1-42.666667 42.666667 42.666667 42.666667 0 0 1-42.666666-42.666667V256H426.666667v405.333333a106.666667 106.666667 0 0 0 106.666666 106.666667 106.666667 106.666667 0 0 0 106.666667-106.666667V213.333333a170.666667 170.666667 0 0 0-170.666667-170.666666 170.666667 170.666667 0 0 0-170.666666 170.666666v533.333334a234.666667 234.666667 0 0 0 234.666666 234.666666 234.666667 234.666667 0 0 0 234.666667-234.666666V256h-64z"})})},sn=function(){return fe("svg",{className:"icon",viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",children:[fe("path",{d:"M842.666667 285.866667l-187.733334-187.733334c-14.933333-14.933333-32-21.333333-53.333333-21.333333H234.666667C194.133333 74.666667 160 108.8 160 149.333333v725.333334c0 40.533333 34.133333 74.666667 74.666667 74.666666h554.666666c40.533333 0 74.666667-34.133333 74.666667-74.666666V337.066667c0-19.2-8.533333-38.4-21.333333-51.2z m-44.8 44.8c-2.133333 2.133333-4.266667 0-8.533334 0h-170.666666c-6.4 0-10.666667-4.266667-10.666667-10.666667V149.333333c0-2.133333 0-6.4-2.133333-8.533333 0 0 2.133333 0 2.133333 2.133333l189.866667 187.733334z m-8.533334 554.666666H234.666667c-6.4 0-10.666667-4.266667-10.666667-10.666666V149.333333c0-6.4 4.266667-10.666667 10.666667-10.666666h311.466666c-2.133333 4.266667-2.133333 6.4-2.133333 10.666666v170.666667c0 40.533333 34.133333 74.666667 74.666667 74.666667h170.666666c4.266667 0 6.4 0 10.666667-2.133334V874.666667c0 6.4-4.266667 10.666667-10.666667 10.666666z",fill:"currentColor"}),fe("path",{d:"M640 693.333333H341.333333c-17.066667 0-32 14.933333-32 32s14.933333 32 32 32h298.666667c17.066667 0 32-14.933333 32-32s-14.933333-32-32-32zM640 522.666667H341.333333c-17.066667 0-32 14.933333-32 32s14.933333 32 32 32h298.666667c17.066667 0 32-14.933333 32-32s-14.933333-32-32-32zM341.333333 416h85.333334c17.066667 0 32-14.933333 32-32s-14.933333-32-32-32h-85.333334c-17.066667 0-32 14.933333-32 32s14.933333 32 32 32z",fill:"currentColor"})]})},cn=function(){return fe("svg",{className:"icon",viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",children:fe("path",{d:"M557.248 511.68l135.776-135.744-45.248-45.28L512 466.432l-135.776-135.776-45.248 45.28 135.776 135.744-135.776 135.776 45.248 45.248L512 556.928l135.776 135.776 45.248-45.248-135.776-135.776zM512 64c247.136 0 448 200.864 448 448s-200.864 448-448 448S64 759.136 64 512 264.864 64 512 64z",fill:"currentColor"})})},ln=function(){return fe("svg",{className:"icon",viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",children:fe("path",{d:"M512.43945313 904.51953125c-6.06445313 0-12.12890625-1.58203125-17.57812501-4.74609375L136.70703125 689.71484375c-10.63476563-6.24023438-17.13867188-17.66601563-17.13867188-29.97070313s6.50390625-23.73046875 17.13867188-29.97070312l76.37695313-44.91210938L136.97070312 540.125c-10.63476563-6.24023438-17.13867188-17.66601563-17.13867187-29.97070313s6.50390625-23.73046875 17.13867188-29.97070312l73.38867187-43.15429688-73.125-42.890625C126.51171875 387.81054687 120.0078125 376.38476562 120.0078125 364.08007812c0-12.3046875 6.50390625-23.73046875 17.13867188-29.97070312L495.828125 122.99609375c10.8984375-6.41601563 24.34570313-6.41601563 35.24414063 0l358.15429687 210.05859375c10.63476563 6.24023438 17.13867188 17.66601563 17.13867188 29.97070313s-6.50390625 23.73046875-17.13867188 29.97070312l-73.38867188 43.15429688 73.12500001 42.890625c10.63476563 6.24023438 17.13867188 17.66601563 17.13867187 29.97070312s-6.50390625 23.73046875-17.13867187 29.97070313L812.5859375 583.89453125l76.11328125 44.6484375c10.63476563 6.24023438 17.13867188 17.66601563 17.13867188 29.97070313s-6.50390625 23.73046875-17.13867188 29.97070312l-358.59375 211.2890625c-5.44921875 3.1640625-11.6015625 4.74609375-17.66601563 4.74609375zM223.015625 659.65625l289.42382813 169.8046875 290.12695312-170.77148438-58.44726563-34.27734374L530.28125 750.18359375a34.67285156 34.67285156 0 0 1-35.24414063 0L281.7265625 625.02734375 223.015625 659.65625z m76.90429688-104.58984375l212.69531249 124.8046875 290.12695313-170.77148438-55.546875-32.60742187-216.65039063 127.6171875a34.67285156 34.67285156 0 0 1-35.24414062 0L279.00195312 477.28320312l-55.81054687 32.78320313 75.49804688 44.296875c0.43945313 0.26367188 0.79101563 0.52734375 1.23046874 0.703125z m-2.81250001-147.83203125l215.68359376 126.5625 216.12304687-127.17773438c0.3515625-0.26367188 0.703125-0.43945313 1.0546875-0.61523437l72.86132813-42.890625-289.33593751-169.8046875-290.12695312 170.68359375 72.59765625 42.62695313c0.43945313 0.17578125 0.79101563 0.43945313 1.14257813 0.61523437z"})})},un=function(e){return fe("svg",{className:e.className,id:"stop",viewBox:"0 0 1025 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",children:[fe("path",{d:"M512.268258 1022.835842c-68.658678 0-135.399619-13.564433-198.369591-40.316509-60.752236-25.809077-115.373446-62.712976-162.346233-109.685763-46.971763-46.971763-83.875662-101.592974-109.685763-162.346233C15.115619 647.517366 1.551186 580.777449 1.551186 512.118771S15.115619 376.719151 41.866671 313.74918c25.810101-60.752236 62.714-115.373446 109.685763-162.346233 46.972787-46.971763 101.593997-83.875662 162.346233-109.685763 62.969971-26.751052 129.710912-40.315485 198.369591-40.315485s135.398595 13.564433 198.368567 40.315485c60.752236 25.810101 115.373446 62.714 162.346233 109.685763 46.971763 46.972787 83.875662 101.593997 109.685763 162.346233 26.752076 62.969971 40.316509 129.710912 40.316509 198.369591s-13.564433 135.398595-40.316509 198.368567c-25.809077 60.75326-62.712976 115.37447-109.685763 162.346233-46.971763 46.972787-101.592974 83.876686-162.346233 109.685763C647.666853 1009.27141 580.925912 1022.835842 512.268258 1022.835842zM512.268258 50.548195c-62.018782 0-122.293887 12.247716-179.152287 36.403219-54.923257 23.333323-104.317532 56.709936-146.810821 99.204249s-75.870926 91.888588-99.204249 146.810821c-24.155503 56.8584-36.403219 117.133505-36.403219 179.152287 0 62.017758 12.247716 122.292863 36.403219 179.152287 23.333323 54.923257 56.709936 104.317532 99.204249 146.811845 42.493289 42.493289 91.888588 75.870926 146.810821 99.204249 56.8584 24.155503 117.133505 36.403219 179.152287 36.403219 62.017758 0 122.292863-12.247716 179.152287-36.403219 54.923257-23.333323 104.317532-56.71096 146.811845-99.204249 42.493289-42.494313 75.870926-91.888588 99.204249-146.811845 24.155503-56.8584 36.403219-117.133505 36.403219-179.152287s-12.247716-122.293887-36.403219-179.152287c-23.334347-54.923257-56.71096-104.317532-99.205273-146.810821-42.493289-42.493289-91.887565-75.870926-146.810821-99.204249C634.561121 62.795911 574.286016 50.548195 512.268258 50.548195z",fill:"currentColor"}),fe("path",{d:"M655.434047 694.244421 367.12637 694.244421c-21.046987 0-38.170445-17.123458-38.170445-38.170445L328.955925 367.766298c0-21.046987 17.123458-38.170445 38.170445-38.170445l288.307678 0c21.048011 0 38.170445 17.123458 38.170445 38.170445l0 288.307678C693.604492 677.120962 676.482058 694.244421 655.434047 694.244421zM380.150191 643.050154l262.260035 0L642.410226 380.79012 380.150191 380.79012 380.150191 643.050154z",fill:"currentColor"})]})},dn=function(e){return fe("svg",{xmlns:"http://www.w3.org/2000/svg",className:e.className,viewBox:"0 0 512 512",children:fe("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"48",d:"M112 268l144 144 144-144M256 392V100"})})},hn=function(){return fe("svg",{viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",children:[fe("path",{d:"M394.688 126.208a32 32 0 0 1 32-32h170.688a32 32 0 0 1 32 32v138.624h288a32 32 0 0 1 32 32v170.688a32 32 0 0 1-32 32H106.688a32 32 0 0 1-32-32V296.832a32 32 0 0 1 32-32h288V126.208z m64 32v138.624a32 32 0 0 1-32 32h-288v106.688h746.688V328.832h-288a32 32 0 0 1-32-32V158.208H458.688z"}),fe("path",{d:"M138.688 469.376a32 32 0 0 1 32-32h682.688a32 32 0 0 1 32 32v384a32 32 0 0 1-32 32H170.688a32 32 0 0 1-32-32v-384z m64 32v320h618.688v-320H202.688z"}),fe("path",{d:"M341.376 691.52a32 32 0 0 1 32 32V851.2a32 32 0 1 1-64 0v-127.68a32 32 0 0 1 32-32zM512 691.2a32 32 0 0 1 32 32v128a32 32 0 0 1-64 0v-128a32 32 0 0 1 32-32zM682.688 691.52a32 32 0 0 1 32 32V851.2a32 32 0 1 1-64 0v-127.68a32 32 0 0 1 32-32z"})]})},fn=function(){return fe("svg",{viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",children:fe("path",{d:"M843.251 424.407l43.828-74.898c10.194-17.946 32.596-22.158 48.956-11.598 16.298 10.499 23.44 32.658 14.223 49.566l-113.11 195.212-61.164-40.044-126.418-82.285c-16.115-11.598-20.632-34.428-10.194-51.702 9.705-17.397 31.009-23.501 47.857-13.734l89.67 59.028C748.576 295.547 615.81 180.667 461.008 180.667c-177.387 0-320.042 148.758-320.042 331.335 0 183.613 143.692 331.334 319.981 331.334 107.861 0.184 208.58-56.158 268.034-149.858 1.099-1.038 1.099-2.075 2.075-2.075 6.348-9.949 17.092-15.871 28.568-15.81 19.35 0 35.648 16.848 35.648 36.93 0 7.508-2.137 14.833-6.104 21.059-72.823 114.698-196.066 183.675-328.099 183.614-216.088 0-391.4-181.478-391.4-405.195 0-223.718 175.312-405.195 391.339-405.195 183.125-0.427 342.016 131.606 382.243 317.601z"})})},pn=function(){return fe("svg",{version:"1.1",className:"icon",viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg",children:fe("path",{d:"M627.498667 55.168l170.666666 170.666667a42.624 42.624 0 0 1 0 60.330666l-469.333333 469.333334A42.538667 42.538667 0 0 1 298.666667 768H128a42.666667 42.666667 0 0 1-42.666667-42.666667v-170.666666c0-11.306667 4.48-22.186667 12.501334-30.165334l469.333333-469.333333a42.624 42.624 0 0 1 60.330667 0zM896 896a42.666667 42.666667 0 0 1 0 85.333333H128a42.666667 42.666667 0 0 1 0-85.333333h768zM597.333333 145.664l-426.666666 426.666667V682.666667h110.336l426.666666-426.666667L597.333333 145.664z"})})},vn=function(e){return fe("svg",{xmlns:"http://www.w3.org/2000/svg",className:e.className,viewBox:"0 0 512 512",children:fe("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"48",d:"M184 112l144 144-144 144"})})},mn=function(){return fe("svg",{className:"icon",viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",children:fe("path",{d:"M896 870.4l-128-128c55.467-68.267 89.6-149.333 89.6-238.933 0-98.134-38.4-192-110.933-264.534-149.334-149.333-384-149.333-533.334-4.266-145.066 145.066-145.066 384 0 529.066 72.534 72.534 166.4 110.934 264.534 110.934 89.6 0 174.933-29.867 238.933-89.6l128 128c4.267 4.266 12.8 8.533 21.333 8.533s17.067-4.267 21.334-8.533c17.066-8.534 17.066-29.867 8.533-42.667zM260.267 721.067c-119.467-123.734-119.467-320 0-439.467 59.733-59.733 140.8-89.6 217.6-89.6 81.066 0 157.866 29.867 217.6 89.6 59.733 59.733 89.6 136.533 89.6 217.6 0 81.067-34.134 162.133-89.6 217.6-55.467 59.733-132.267 93.867-217.6 93.867-81.067 0-157.867-34.134-217.6-89.6z"})})},gn=function(){return fe("svg",{className:"icon",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",width:"1em",height:"1em",children:fe("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M19 9l-7 7-7-7"})})},yn=function(){return fe("svg",{viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",children:[fe("path",{d:"M190.193225 471.411583c14.446014 0 26.139334-11.718903 26.139334-26.13831 0-14.44499-11.69332-26.164916-26.139334-26.164916-0.271176 0-0.490164 0.149403-0.73678 0.149403l-62.496379 0.146333c-1.425466-0.195451-2.90005-0.295735-4.373611-0.295735-19.677155 0-35.621289 16.141632-35.621289 36.114522L86.622358 888.550075c0 19.949354 15.96767 35.597753 35.670407 35.597753 1.916653 0 3.808746 0.292666 5.649674 0l61.022819 0.022513c0.099261 0 0.148379 0.048095 0.24764 0.048095 0.097214 0 0.146333-0.048095 0.24457-0.048095l0.73678 0 0-0.148379c13.413498-0.540306 24.174586-11.422144 24.174586-24.960485 0-13.55983-10.760065-24.441669-24.174586-24.981974l0-0.393973-50.949392 0 1.450025-402.275993L190.193225 471.409536z"}),fe("path",{d:"M926.52241 433.948343c-19.283182-31.445176-47.339168-44.172035-81.289398-45.546336-1.77032-0.246617-3.536546-0.39295-5.380544-0.39295l-205.447139-0.688685c13.462616-39.059598 22.698978-85.58933 22.698978-129.317251 0-28.349675-3.193739-55.962569-9.041934-82.542948l-0.490164 0.049119c-10.638291-46.578852-51.736315-81.31498-100.966553-81.31498-57.264215 0-95.466282 48.15065-95.466282 106.126063 0 3.241834-0.294712 6.387477 0 9.532097-2.996241 108.386546-91.240027 195.548698-196.23636 207.513194l0 54.881958-0.785899 222.227314 0 229.744521 10.709923 0 500.025271 0.222057 8.746198-0.243547c19.35686 0.049119 30.239721-4.817726 47.803749-16.116049 16.682961-10.761088 29.236881-25.50079 37.490869-42.156122 2.260483-3.341095 4.028757-7.075139 5.106298-11.20111l77.018118-344.324116c1.056052-4.053316 1.348718-8.181333 1.056052-12.160971C943.643346 476.446249 938.781618 453.944769 926.52241 433.948343zM893.82573 486.837924l-82.983993 367.783411-0.099261-0.049119c-2.555196 6.141884-6.879688 11.596106-12.872169 15.427364-4.177136 2.727111-8.773827 4.351098-13.414521 4.964058-1.49812-0.195451-3.046383 0-4.620227 0l-477.028511-0.540306-0.171915-407.408897c89.323375-40.266076 154.841577-79.670527 188.596356-173.661202 0.072655 0.024559 0.124843 0.049119 0.195451 0.072655 2.99931-9.137101 6.313799-20.73423 8.697079-33.164331 5.551436-29.185716 5.258771-58.123792 5.258771-58.123792-4.937452-37.98001 25.940812-52.965306 44.364417-52.965306 25.304316 0.860601 50.263777 33.656541 50.263777 52.326762 0 0 5.600555 27.563776 5.649674 57.190537 0.048095 37.366026-4.6673 56.847729-4.6673 56.847729l-0.466628 0c-5.872754 30.879288-16.214287 60.138682-30.464849 86.964654l0.36839 0.342808c-2.358721 4.815679-3.709485 10.220782-3.709485 15.943111 0 19.922748 19.088754 21.742187 38.765909 21.742187l238.761895 0.270153c0 0 14.666024 0.465604 14.690584 0.465604l0 0.100284c12.132318-0.638543 24.221658 5.207605 31.100322 16.409738 5.504364 9.016351 6.437619 19.6045 3.486404 28.988218L893.82573 486.837924z"}),fe("path",{d:"M264.827039 924.31872c0.319272 0.024559 0.441045 0.024559 0.295735-0.024559 0.243547-0.048095 0.367367-0.074701-0.295735-0.074701s-0.539282 0.026606-0.271176 0.074701C264.43409 924.343279 264.532327 924.343279 264.827039 924.31872z"})]})},kn=function(){return fe("svg",{viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",children:fe("path",{d:"M190.208 552.576a26.176 26.176 0 0 1 0 52.288L189.44 604.8l-62.464-0.128a35.84 35.84 0 0 1-40-35.84l-0.384-433.28c0-19.968 16-35.648 35.712-35.648 1.92 0 3.84-0.256 5.632 0h62.272v0.128c13.44 0.576 24.192 11.456 24.192 24.96a25.024 25.024 0 0 1-24.192 24.96v0.448h-50.944l1.408 402.24h49.536z m736.32 37.504c-19.264 31.36-47.36 44.16-81.28 45.504a38.656 38.656 0 0 1-5.376 0.384l-205.44 0.704c13.44 39.04 22.656 85.568 22.656 129.28 0 28.416-3.2 56-9.024 82.56h-0.512a103.936 103.936 0 0 1-100.928 81.28c-57.28 0-95.488-48.128-95.488-106.112 0-3.2-0.32-6.4 0-9.536-3.008-108.352-91.264-195.52-196.224-207.488V551.68L254.08 329.6v-229.76h10.688l500.032-0.192 8.704 0.192c19.392 0 30.272 4.864 47.808 16.128 16.704 10.752 29.248 25.536 37.504 42.176 2.304 3.328 4.032 7.04 5.12 11.2l76.992 344.32a37.568 37.568 0 0 1 1.088 12.16c1.536 21.76-3.328 44.288-15.552 64.32z m-32.704-52.928l-83.008-367.744h-0.064a33.408 33.408 0 0 0-26.24-20.352c-1.536 0.192-3.072 0-4.672 0l-477.056 0.512-0.128 407.424c89.28 40.32 154.88 79.68 188.544 173.632h0.256c2.944 9.088 6.272 20.672 8.64 33.088 5.568 29.184 5.312 58.176 5.312 58.176-4.992 37.952 25.92 52.928 44.352 52.928 25.28-0.832 50.24-33.664 50.24-52.288 0 0 5.632-27.584 5.632-57.216 0.064-37.376-4.608-56.832-4.608-56.832h-0.512a307.84 307.84 0 0 0-30.464-87.04l0.384-0.256a36.16 36.16 0 0 1-3.712-16c0-19.84 19.072-21.76 38.784-21.76l238.72-0.192 14.72-0.512v-0.064c12.16 0.64 24.192-5.248 31.104-16.448a35.2 35.2 0 0 0 3.456-28.992h0.32zM267.52 96.768c2.048-0.192 2.816-0.192 1.92 0.128 1.536 0.32 2.304 0.512-1.92 0.512s-3.456-0.192-1.728-0.512c-0.768-0.32-0.192-0.32 1.728-0.128z"})})},wn=function(){return fe("svg",{viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",children:fe("path",{d:"M413.610667 336.192l226.346666-125.461333-11.114666-76.586667c-5.909333-40.64 43.349333-65.344 72.384-36.309333l241.365333 241.344c29.013333 29.013333 4.373333 78.250667-36.245333 72.405333l-76.458667-10.965333-126.165333 227.029333 2.176 5.12c34.56 84.330667 27.413333 153.962667-30.208 214.549333l-4.416 4.544a42.666667 42.666667 0 0 1-60.330667 0l-139.968-139.968L153.365333 946.730667c-38.528 28.48-86.677333-18.133333-61.44-57.109334l1.706667-2.474666 234.154667-318.442667-136.810667-136.832-4.906667-5.12a42.666667 42.666667 0 0 1 2.496-57.6c62.272-62.293333 139.157333-71.445333 222.122667-34.304l2.922667 1.344zM795.733333 313.024l-68.138666-68.117333-0.96 3.136a42.666667 42.666667 0 0 1-19.52 23.04L435.306667 421.76a42.666667 42.666667 0 0 1-41.216 0.085333c-42.197333-23.146667-76.565333-29.290667-106.581334-18.218666l-2.944 1.173333 129.493334 129.493333a42.666667 42.666667 0 0 1 4.202666 55.466667l-88.661333 120.533333 120.213333-88.853333a42.666667 42.666667 0 0 1 52.821334 1.642667l2.709333 2.496 130.282667 130.282666 1.685333-4.522666c8.917333-27.008 3.242667-58.24-16.704-100.608l-2.944-6.144A42.666667 42.666667 0 0 1 618.666667 605.077333l150.912-271.573333a42.666667 42.666667 0 0 1 23.018666-19.498667l3.157334-0.981333z"})})},bn=function(){return fe("svg",{viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",children:fe("path",{d:"M342.464 368.576l73.344 42.368-8.512 7.936a32 32 0 0 1-14.272 7.68l-5.44 0.832-2.88 0.192-19.456 2.24a442.88 442.88 0 0 0-53.504 10.688 245.12 245.12 0 0 0-64.32 25.984l-7.488 4.928 150.144 86.784a32 32 0 0 1 15.808 31.168l-1.024 5.312-61.568 215.168 155.584-160.896a32 32 0 0 1 34.112-7.744l4.928 2.304 152.32 87.872 1.472-8.192c4.992-38.272-7.68-83.456-31.552-128.832l-6.784-12.416a32 32 0 0 1-3.456-23.04l2.56-11.328 78.016 44.992c27.328 61.44 36.672 122.816 15.168 177.856l-5.12 11.84-6.208 11.648a32 32 0 0 1-43.712 11.712l-163.072-94.272-227.2 235.072c-21.632 22.336-57.728 3.84-55.04-24.768l1.28-6.272L336.448 600.96l-163.072-94.08a32 32 0 0 1-14.144-38.464l2.432-5.248c23.936-41.6 71.36-67.84 133.504-84.48 20.48-5.568 41.28-9.6 61.312-12.288l-14.016 2.112zM267.968 218.688l609.664 352a32 32 0 1 1-32 55.424l-609.664-352a32 32 0 1 1 32-55.424z m258.816-106.24a32 32 0 0 1 40.384-42.752l5.056 2.432 295.552 170.624a32 32 0 0 1-12.16 59.52l-83.584 9.984-31.68 138.24-57.984-33.408 32.32-140.992a32 32 0 0 1 21.76-23.424l5.632-1.216 10.56-1.344-129.28-74.624 4.16 9.856a32 32 0 0 1-3.84 31.808l-3.84 4.224L513.92 319.808l-57.984-33.472 104-96.64z"})})},xn=function(){return fe("svg",{className:"icon",viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",children:[fe("path",{d:"M509.4 900.5c-11.6 0-21-9.4-21-21v-168c0-11.6 9.4-21 21-21s21 9.4 21 21v168c0 11.6-9.4 21-21 21z"}),fe("path",{d:"M509.4 933.3c-5.4 0-10.7-2.1-14.8-6.2-8.2-8.2-8.2-21.5 0-29.7l74.2-74.3c8.2-8.2 21.5-8.2 29.7 0s8.2 21.5 0 29.7l-74.2 74.3c-4.2 4.1-9.6 6.2-14.9 6.2z"}),fe("path",{d:"M509.4 933.3c-5.4 0-10.7-2.1-14.8-6.2l-74.2-74.2c-8.2-8.2-8.2-21.5 0-29.7s21.5-8.2 29.7 0l74.2 74.2c8.2 8.2 8.2 21.5 0 29.7-4.2 4.1-9.6 6.2-14.9 6.2zM742.7 803.1c-56 0-110.1-20.3-152.2-57.2-8.7-7.6-9.6-20.9-1.9-29.6 7.6-8.7 20.9-9.6 29.6-1.9 34.4 30.2 78.6 46.8 124.5 46.8 104.2 0 189-84.8 189-189 0-91.8-65.6-170-156.1-185.9l-16.2-2.8-1.1-16.4c-9.2-131.4-119.5-234.3-251.1-234.3-120.4 0-224.4 85.7-247.3 203.8l-2.7 13.8-13.8 2.8C155.8 371 92.2 448.9 92.2 538.4c0 104.2 84.8 189 189 189 43.1 0 83.6-14.1 117.3-40.9 9.1-7.2 22.3-5.7 29.5 3.4 7.2 9.1 5.7 22.3-3.4 29.5-41.2 32.7-90.7 50-143.4 50-127.4 0-231-103.6-231-231 0-104.8 71.3-196.5 171.4-223.2C253.4 184.3 371.4 90.7 507.2 90.7c148.3 0 273.3 111.8 291.5 257.5 102.3 25.4 175 117.1 175 224 0 127.3-103.6 230.9-231 230.9z"})]})},Cn=function(){return fe("svg",{viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",children:fe("path",{d:"M934.4 770.133333L605.866667 181.333333C586.666667 147.2 550.4 128 512 128s-74.666667 21.333333-93.866667 53.333333L89.6 770.133333c-19.2 34.133333-19.2 76.8 0 110.933334S145.066667 938.666667 183.466667 938.666667h657.066666c40.533333 0 74.666667-21.333333 93.866667-57.6 19.2-34.133333 19.2-76.8 0-110.933334zM480 362.666667c0-17.066667 14.933333-32 32-32s29.866667 12.8 32 29.866666V640c0 17.066667-14.933333 32-32 32s-29.866667-12.8-32-29.866667V362.666667zM512 832c-23.466667 0-42.666667-19.2-42.666667-42.666667s19.2-42.666667 42.666667-42.666666 42.666667 19.2 42.666667 42.666666-19.2 42.666667-42.666667 42.666667z",fill:"red"})})},Sn=fe("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"red",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:"margin-left: 6px;",children:[fe("path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"}),fe("path",{d:"M12 9v4"}),fe("path",{d:"M12 17h.01"})]}),_n=fe("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"rgb(0, 185, 107)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"lucide lucide-check","aria-hidden":"true",style:"margin-left: 6px;",children:fe("path",{d:"M20 6 9 17l-5-5"})}),Mn=fe("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:"margin-left: 6px;",children:[fe("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),fe("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"})]}),Nn=function(e){return fe("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:e.style,children:fe("path",{d:"m9 18 6-6-6-6"})})},Tn=fe("svg",{className:"icon",title:"知识库",viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"currentColor",xmlnsXlink:"http://www.w3.org/1999/xlink",children:fe("path",{d:"M849.2 80H267.7c-73.8 0.1-133.6 58.2-133.6 129.9v606.7c0.1 70.3 58.6 127.2 130.9 127.3h584.3c22.5 0 40.8-17.8 40.8-39.7V119.6C890 97.8 871.7 80 849.2 80z m-40.9 784.6H264.8c-27.2 0-49.2-21.5-49.2-47.9s22-47.9 49.2-47.9h543.5v95.8z m0-175.1H264.8c-16.9 0-33.6 3.1-49.2 9.3V209.9c0-27.9 23.3-50.5 52-50.6h276.8v224.4c0 5.9 6.3 9.8 11.6 7.2l67.7-33.8c4.5-2.3 9.8-2.3 14.3 0l67.7 33.8c5.3 2.7 11.6-1.2 11.6-7.2V159.4h91.1l-0.1 530.1z"})}),On=fe("svg",{className:"icon",viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",children:fe("path",{d:"M85.312 85.312h853.376v853.376H85.312V85.312z m85.376 768h579.648L384 487.04l-213.312 213.376v152.96z m682.624-17.664V170.688H170.688v408.96L384 366.336l469.312 469.312z m-179.328-526.336a42.688 42.688 0 1 0 0 85.376 42.688 42.688 0 0 0 0-85.376z m-128 42.688a128 128 0 1 1 256 0 128 128 0 0 1-256 0z",fill:"currentColor"})}),En=fe("svg",{viewBox:"0 0 79 86",version:"1.1",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",children:[fe("defs",{children:[fe("linearGradient",{id:"linearGradient-1-el-id-655-578",x1:"38.8503086%",y1:"0%",x2:"61.1496914%",y2:"100%",children:[fe("stop",{stopColor:"var(--el-empty-fill-color-1)",offset:"0%"}),fe("stop",{stopColor:"var(--el-empty-fill-color-4)",offset:"100%"})]}),fe("linearGradient",{id:"linearGradient-2-el-id-655-578",x1:"0%",y1:"9.5%",x2:"100%",y2:"90.5%",children:[fe("stop",{stopColor:"var(--el-empty-fill-color-1)",offset:"0%"}),fe("stop",{stopColor:"var(--el-empty-fill-color-6)",offset:"100%"})]}),fe("rect",{id:"path-3-el-id-655-578",x:"0",y:"0",width:"17",height:"36"})]}),fe("g",{id:"Illustrations",stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd",children:fe("g",{id:"B-type",transform:"translate(-1268.000000, -535.000000)",children:fe("g",{id:"Group-2",transform:"translate(1268.000000, 535.000000)",children:[fe("path",{id:"Oval-Copy-2",d:"M39.5,86 C61.3152476,86 79,83.9106622 79,81.3333333 C79,78.7560045 57.3152476,78 35.5,78 C13.6847524,78 0,78.7560045 0,81.3333333 C0,83.9106622 17.6847524,86 39.5,86 Z",fill:"var(--el-empty-fill-color-3)"}),fe("polygon",{id:"Rectangle-Copy-14",fill:"var(--el-empty-fill-color-7)",transform:"translate(27.500000, 51.500000) scale(1, -1) translate(-27.500000, -51.500000) ",points:"13 58 53 58 42 45 2 45"}),fe("g",{id:"Group-Copy",transform:"translate(34.500000, 31.500000) scale(-1, 1) rotate(-25.000000) translate(-34.500000, -31.500000) translate(7.000000, 10.000000)",children:[fe("polygon",{id:"Rectangle-Copy-10",fill:"var(--el-empty-fill-color-7)",transform:"translate(11.500000, 5.000000) scale(1, -1) translate(-11.500000, -5.000000) ",points:"2.84078316e-14 3 18 3 23 7 5 7"}),fe("polygon",{id:"Rectangle-Copy-11",fill:"var(--el-empty-fill-color-5)",points:"-3.69149156e-15 7 38 7 38 43 -3.69149156e-15 43"}),fe("rect",{id:"Rectangle-Copy-12",fill:"var(--el-empty-fill-color-3)",transform:"translate(46.500000, 25.000000) scale(-1, 1) translate(-46.500000, -25.000000) ",x:"38",y:"7",width:"17",height:"36"}),fe("polygon",{id:"Rectangle-Copy-13",fill:"var(--el-empty-fill-color-2)",transform:"translate(39.500000, 3.500000) scale(-1, 1) translate(-39.500000, -3.500000) ",points:"24 7 41 7 55 -3.63806207e-12 38 -3.63806207e-12"})]}),fe("rect",{id:"Rectangle-Copy-15",fill:"var(--el-empty-fill-color-2)",x:"13",y:"45",width:"40",height:"36"}),fe("g",{id:"Rectangle-Copy-17",transform:"translate(53.000000, 45.000000)",children:[fe("use",{id:"Mask",fill:"var(--el-empty-fill-color-8)",transform:"translate(8.500000, 18.000000) scale(-1, 1) translate(-8.500000, -18.000000) ",xlinkHref:"#path-3-el-id-655-578"}),fe("polygon",{id:"Rectangle-Copy",fill:"var(--el-empty-fill-color-9)",mask:"var(--el-empty-fill-color-5)",transform:"translate(12.000000, 9.000000) scale(-1, 1) translate(-12.000000, -9.000000) ",points:"7 0 24 0 20 18 7 16.5"})]}),fe("polygon",{id:"Rectangle-Copy-18",fill:"var(--el-empty-fill-color-2)",transform:"translate(66.000000, 51.500000) scale(-1, 1) translate(-66.000000, -51.500000) ",points:"62 45 79 45 70 58 53 58"})]})})})]}),An=function(){return fe("svg",{className:"icon",viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",children:[fe("path",{d:"M516.461 20.457c-274.346 0-496.742 222.394-496.742 496.742s222.394 496.742 496.742 496.742 496.742-222.394 496.742-496.742-222.394-496.742-496.742-496.742zM516.461 964.278c-246.527 0-447.079-200.547-447.079-447.079s200.547-447.079 447.079-447.079 447.079 200.547 447.079 447.079-200.547 447.079-447.079 447.079z",fill:""}),fe("path",{d:"M741.978 291.67c-12.099-12.117-31.79-12.117-43.905 0l-181.633 181.633-181.633-181.633c-12.102-12.117-31.795-12.117-43.905 0-12.117 12.102-12.117 31.79 0 43.905l181.633 181.633-181.633 181.633c-12.117 12.102-12.117 31.79 0 43.905 6.032 6.061 13.984 9.073 21.942 9.073 7.926 0 15.886-3.03 21.942-9.073l181.633-181.633 181.633 181.633c6.061 6.061 14.002 9.073 21.942 9.073s15.886-3.03 21.942-9.073c12.117-12.102 12.117-31.79 0-43.905l-181.669-181.633 181.633-181.633c12.117-12.102 12.117-31.79 0-43.905z",fill:""})]})},Dn=function(){return fe("svg",{className:"icon",viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",children:[fe("path",{d:"M512 85.333333C276.48 85.333333 85.333333 276.48 85.333333 512S276.48 938.666667 512 938.666667 938.666667 747.52 938.666667 512 747.52 85.333333 512 85.333333z m0 796.444445c-203.662222 0-369.777778-166.115556-369.777778-369.777778S308.337778 142.222222 512 142.222222 881.777778 308.337778 881.777778 512 715.662222 881.777778 512 881.777778z"}),fe("path",{d:"M678.115556 385.706667L461.937778 591.644444l-116.053334-110.364444c-11.377778-11.377778-29.582222-10.24-39.822222 1.137778-11.377778 11.377778-10.24 29.582222 1.137778 39.822222l135.395556 129.706667c5.688889 5.688889 12.515556 7.964444 19.342222 7.964444s13.653333-2.275556 19.342222-7.964444L716.8 426.666667c11.377778-11.377778 11.377778-28.444444 1.137778-39.822223-10.24-12.515556-28.444444-12.515556-39.822222-1.137777z"})]})},In=function(){return fe("svg",{className:"icon",viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",children:fe("path",{d:"M896 170.688c47.104 0 85.312 38.144 85.312 85.312v512c0 47.104-38.208 85.312-85.312 85.312H128A85.312 85.312 0 0 1 42.688 768V256c0-47.168 38.208-85.312 85.312-85.312h768z m-533.312 64H128c-10.496 0-19.2 7.488-20.992 17.472L106.688 256v512c0 10.496 7.552 19.2 17.472 20.992l3.84 0.32h234.688V234.688z m533.312 0H426.688v554.624H896c10.496 0 19.2-7.552 20.992-17.472l0.32-3.84V256c0-10.496-7.552-19.2-17.472-20.992L896 234.624zM298.688 469.248a21.312 21.312 0 0 1 0 42.688h-128a21.312 21.312 0 1 1 0-42.688h128z m0-85.312a21.312 21.312 0 0 1 0 42.688h-128a21.312 21.312 0 1 1 0-42.688h128z m0-85.312a21.312 21.312 0 0 1 0 42.624h-128a21.312 21.312 0 1 1 0-42.688h128z",fill:"currentColor"})})},zn=function(){return fe("svg",{className:"icon",viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",children:fe("path",{d:"M204.288 285.696c9.728 0 19.456-3.584 27.136-11.264 48.64-49.152 110.592-84.48 179.712-101.888 20.48-5.12 32.768-26.112 27.648-46.08-5.12-20.48-26.112-32.768-46.08-27.648-82.432 20.992-156.672 62.976-215.04 121.856-14.848 14.848-14.848 38.912 0.512 53.76 7.168 7.68 16.384 11.264 26.112 11.264zM602.112 92.16c-20.48-4.096-40.448 9.728-44.544 30.208-4.096 20.48 9.728 40.448 30.208 44.544 72.192 13.824 138.24 46.08 190.976 94.208 7.168 6.656 16.384 9.728 25.6 9.728 10.24 0 20.48-4.096 28.16-12.288 14.336-15.36 13.312-39.424-2.56-53.76-62.464-57.344-141.824-96.256-227.84-112.64zM948.736 386.56c-6.656-19.968-28.16-30.72-48.128-24.576-19.968 6.656-30.72 28.16-24.576 48.128 10.752 32.768 15.872 67.072 15.872 101.376 0 42.496-8.192 83.456-24.064 122.88-7.68 19.456 1.536 41.472 20.992 49.664 4.608 2.048 9.728 2.56 14.336 2.56 14.848 0 29.184-9.216 35.328-24.064 19.456-48.128 29.184-99.328 29.184-151.552 0.512-41.472-6.144-83.968-18.944-124.416zM775.168 765.952c-52.224 46.592-117.248 77.824-187.904 91.136-20.48 3.584-34.304 23.552-30.208 44.544 3.584 18.432 19.456 31.232 37.376 31.232 2.048 0 4.608 0 7.168-0.512 84.48-15.872 161.792-53.248 224.768-109.056 15.872-13.824 16.896-37.888 3.072-53.76-14.336-16.384-38.4-17.408-54.272-3.584zM415.232 851.968c-2.048-0.512-4.608-1.024-7.68-2.048-13.312-3.584-27.136-5.632-40.96-5.632H166.4l35.328-98.816c4.608-12.8 2.56-27.136-5.632-37.888-12.288-16.896-36.352-20.992-53.248-8.704-9.216 6.656-14.848 16.896-15.36 27.648l-49.152 138.24c-4.608 12.8-2.56 26.624 5.12 37.376 7.68 10.752 20.48 17.408 33.792 17.408h240.128c11.776 0 24.064 1.024 35.84 4.096 6.144 1.536 11.776 2.56 12.8 2.56 16.896 0 32.768-11.776 36.864-29.184 5.12-19.456-7.168-39.936-27.648-45.056zM108.032 651.264c3.584 0 7.168-0.512 10.752-1.536 19.968-5.632 31.744-27.136 26.112-47.104-8.704-29.696-12.8-59.904-12.8-91.136 0-33.792 5.12-66.56 15.36-98.816 6.144-19.968-4.608-41.472-24.576-47.616-19.968-6.144-41.472 4.608-47.616 24.576-12.288 39.424-18.944 80.384-18.944 121.344 0 37.888 5.12 75.776 15.872 112.128 4.096 17.408 19.456 28.16 35.84 28.16z"})})},Rn=function(){return fe("svg",{className:"icon",viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",children:fe("path",{d:"M204.288 285.184c9.728 0 19.456-3.584 27.136-11.264 48.64-49.152 111.104-84.48 179.712-101.888 20.48-5.12 32.768-26.112 27.648-46.08-5.12-20.48-26.112-32.768-46.08-27.648-82.432 20.992-156.672 62.976-215.04 121.856-14.848 14.848-14.848 38.912 0.512 53.76 6.656 7.68 16.384 11.264 26.112 11.264zM602.624 92.16c-20.48-4.096-40.448 9.728-44.544 30.208-4.096 20.48 9.728 40.448 30.208 44.544 72.192 13.824 138.24 46.08 190.976 94.72 7.168 6.656 16.384 9.728 25.6 9.728 10.24 0 20.48-4.096 28.16-12.288 14.336-15.36 13.312-39.424-2.56-53.76-62.976-57.856-141.824-97.28-227.84-113.152zM949.248 386.56c-6.656-19.968-28.16-30.72-48.128-24.576-19.968 6.656-30.72 28.16-24.576 48.128 10.752 32.768 15.872 67.072 15.872 101.888 0 42.496-8.192 83.968-24.064 122.88-7.68 19.456 1.536 41.472 20.992 49.664 4.608 2.048 9.728 2.56 14.336 2.56 14.848 0 29.184-9.216 35.328-24.064 19.456-48.64 29.696-99.328 29.696-151.552 0-42.496-6.656-84.48-19.456-124.928zM775.68 765.952c-52.224 46.592-117.248 77.824-187.904 91.136-20.48 3.584-34.304 23.552-30.72 44.544 3.584 18.432 19.456 31.232 37.376 31.232 2.048 0 4.608 0 7.168-0.512 84.48-15.872 162.304-53.248 224.768-109.056 15.872-13.824 17.408-37.888 3.072-53.76-14.336-15.872-38.4-17.408-53.76-3.584zM415.232 852.48c-2.048-0.512-4.608-1.024-7.68-2.048-13.312-3.584-27.136-5.632-40.96-5.632H166.4l35.328-98.816c4.608-12.8 2.56-27.136-5.632-37.888-12.288-16.896-36.352-20.992-53.248-8.704-9.216 6.656-14.848 16.896-15.36 27.648l-49.664 138.24c-4.608 12.8-2.56 26.624 5.12 37.376 7.68 10.752 20.48 17.408 33.792 17.408h240.64c11.776 0 24.064 1.024 35.84 4.096 6.144 1.536 11.776 2.56 13.312 2.56 16.896 0 32.768-11.776 36.864-29.184 4.608-19.456-8.192-39.936-28.16-45.056zM107.52 651.776c3.584 0 7.168-0.512 10.752-1.536 19.968-5.632 31.744-27.136 26.112-47.104-8.704-29.696-12.8-59.904-12.8-91.136 0-33.792 5.12-67.072 15.36-98.816 6.144-19.968-4.608-41.472-25.088-47.616-19.968-6.144-41.472 4.608-47.616 25.088-12.288 39.424-18.944 80.384-18.944 121.856 0 37.888 5.12 75.776 15.872 112.128 4.608 15.872 19.968 27.136 36.352 27.136zM658.944 390.656c-17.408-11.776-40.96-7.168-52.736 10.752l-141.824 212.48-71.68-71.68c-14.848-14.848-38.912-14.848-53.76 0-14.848 14.848-14.848 38.912 0 53.76l104.96 104.96c7.168 7.168 16.896 11.264 27.136 11.264h3.584c11.264-1.024 21.504-7.168 28.16-16.896l167.424-251.392c10.752-17.92 6.144-41.472-11.264-53.248z"})})},Pn=function(){return fe("svg",{className:"icon",viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",children:fe("path",{d:"M811.097325 675.11798a38.455724 38.455724 0 0 1-54.382232 0L511.992078 430.406848 267.269064 675.11798a38.453744 38.453744 0 0 1-54.383222-54.380252l271.91116-271.899277a38.454734 38.454734 0 0 1 54.383222 0l271.911159 271.899277a38.450773 38.450773 0 0 1 0.005942 54.380252z",fill:"currentColor"})})},Ln=function(e){var t=e.items,n=Lt([]),r=new ve("chat-thought-chain"),i=Lt([]);Ye(function(){i.value=t.filter(function(e){return e.description}),i.value.length>0&&i.value.forEach(function(e,t){e.done&&(n.value=[].concat(c(n.value),[t]))})},[t]);return 0===i.value.length?null:fe("div",{className:"".concat(r.b()," ").concat(r.is("single",1===i.value.length)),children:i.value.map(function(e,t){if(e.description){var i=n.value.includes(t);return fe("div",{className:"".concat(r.e("item")," ").concat(r.is("collapsed",i)),children:[fe("div",{className:r.e("item-icon"),children:e.icon||fe("span",{children:t})}),fe("div",{className:r.e("item-content"),children:[fe("div",{className:r.e("item-title"),onClick:function(){return function(e){n.value.includes(e)?n.value=n.value.filter(function(t){return t!==e}):n.value=[].concat(c(n.value),[e])}(t)},children:[e.title,fe(tn,{className:r.e("icon")})]}),fe("div",{className:r.e("item-description"),children:e.description})]})]},t)}})})},Bn=function(e){var t=e.suggestions,n=e.onSuggestionClick,r=e.uiactions,i=e.onUIActionClick,o=new ve("chat-suggestions");return fe("div",{className:"".concat(o.b()),children:[t&&t.length>0&&t.map(function(e,t){return fe("div",{className:"".concat(o.e("item")," ").concat(o.is("action","action"===e.type)),onClick:function(t){return function(e,t){null==n||n(e,t)}(e,t)},title:e.metadata.content_name,children:[e.metadata.content_name,fe(vn,{className:"".concat(o.e("item-icon"))})]},t)}),r&&r.length>0&&r.map(function(e,t){return fe("div",{className:"".concat(o.e("item")," ").concat(o.is("action","action"===e.type)),onClick:function(t){return function(e,t){null==i||i(e,t)}(e,t)},title:e.metadata.content_name,children:[e.metadata.content_name,fe(vn,{className:"".concat(o.e("item-icon"))})]},"action-".concat(t))})]})},Vn=function(e){var t,n,r,i=new ve("default-tool-call"),o=Lt(!1),a=Lt(!1);Ye(function(){return function(){r&&clearTimeout(r)}},[]);var s=function(e){return"string"==typeof e?e.includes("Failed")||e.includes("Error")||e.includes("ERR_")?'<span class="error">"'.concat(e,'"</span>'):'<span class="string">"'.concat(e,'"</span>'):"number"==typeof e?'<span class="number">'.concat(e,"</span>"):"boolean"==typeof e?'<span class="boolean">'.concat(e,"</span>"):null===e?'<span class="null">null</span>':""},l=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=" ".repeat(t),r=[];if(Array.isArray(e)){if(0===e.length)return["".concat(n,'<span class="array">[]</span>')];r.push("".concat(n,'<span class="array">[</span>')),e.forEach(function(n,i){var o=l(n,t+1),a=i<e.length-1?",":"";"object"===N(n)&&null!==n?(r.push.apply(r,c(o.slice(0,-1))),r.push("".concat(o[o.length-1]).concat(a))):r.push("".concat(o[0]).concat(a))}),r.push("".concat(n,'<span class="array">]</span>'))}else if("object"===N(e)&&null!==e){var i=Object.keys(e);if(0===i.length)return["".concat(n,'<span class="property">{}</span>')];r.push("".concat(n,'<span class="property">{</span>')),i.forEach(function(o,a){var u=e[o],d=a<i.length-1?",":"",h='<span class="json-key">"'.concat(o,'":</span>');if("object"===N(u)&&null!==u){var f=l(u,t+1);r.push("".concat(n," ").concat(h," ").concat(f[0].trim())),f.length>1&&(r.push.apply(r,c(f.slice(1,-1))),r.push("".concat(f[f.length-1]).concat(d)))}else{var p=s(u);r.push("".concat(n," ").concat(h," ").concat(p).concat(d))}}),r.push("".concat(n,'<span class="property">}</span>'))}else r.push("".concat(n).concat(s(e)));return r},u=Bt(function(){return l(e.item,0).map(function(e,t){return'<span class="line-number">'.concat(t+1,"</span>").concat(e)})});return fe("div",{className:"".concat(i.b()," ").concat(e.className||""),children:[fe("div",{className:i.e("header"),onClick:function(){o.value=!o.value},children:[fe("div",{className:i.e("header-left"),children:[fe("div",{className:i.em("header-left","caption"),children:e.item.name}),fe("div",{className:i.em("header-left","desc"),title:(null===(t=e.item.parameters)||void 0===t?void 0:t.desc)||"",children:(null===(n=e.item.parameters)||void 0===n?void 0:n.desc)||""})]}),fe("div",{className:i.e("header-right"),children:[e.item.error&&fe("span",{style:"color: red;",children:"发生错误"}),e.item.error&&Sn,fe("span",{title:"复制",className:i.e("copy"),onClick:function(t){return function(t){t.stopPropagation(),a.value||(r&&clearTimeout(r),a.value=!0,navigator.clipboard.writeText(JSON.stringify(e.item,void 0,2)),window.ibiz.message.success("已复制"),r=setTimeout(function(){a.value=!1},2e3))}(t)},children:a.value?_n:Mn}),fe(Nn,{style:{"margin-left":" 6px",transform:o.value?"rotate(90deg)":"rotate(0deg)"}})]})]}),o.value&&fe("div",{className:i.e("content"),children:u.value.map(function(e,t){return fe("div",{className:"code-line",dangerouslySetInnerHTML:{__html:e}},t)})})]})},Fn=function(e){var t,n,r,i=new ve("chunk-tool-call"),o=Lt([]),a=Lt(!1),s=Lt(!1);Ye(function(){var t,n=d((null===(t=e.item.result)||void 0===t?void 0:t.chunks)||[]),r=n.filter(function(e){return"SOURCE"===e.type}),i=n.filter(function(e){return"SOURCE"!==e.type});i.forEach(function(e){"CLUSTER"===e.type&&(e.children=r.filter(function(t){return t.pid===e.id}),e.isExpand=!1)}),o.value=i},[e.item]),Ye(function(){return function(){r&&clearTimeout(r)}},[]);var l=function(e){return fe("div",{className:i.e("footer"),children:["CLUSTER"===e.type&&(e.source_count||0===e.source_count)&&fe("div",{className:i.em("footer","description"),children:["由",e.source_count,"个原文段落智能总结生成"]}),fe("div",{className:i.em("footer","docname"),children:e.docname})]})},u=function(e){var t;return fe("div",{className:"".concat(i.e("item")," ").concat(i.em("item",(null===(t=e.type)||void 0===t?void 0:t.toLowerCase())||"default")),children:["KBGUIDANCE"===e.type?fe("div",{className:i.e("kbguidance"),children:"[引导]"}):fe("div",{className:i.e("similarity"),style:"--percent: ".concat((100*(e.similarity||0)).toFixed(2),"%;"),children:"SCORE ".concat((e.similarity||0).toFixed(2))}),e.original&&fe("div",{className:i.e("original"),children:"(向量".concat((e.original||0).toFixed(2),")")}),fe("div",{className:i.em("item","content"),title:e.content,children:e.content})]},e.id)},h=function(e){var t,n;return"CLUSTER"===e.type?fe("div",{className:"".concat(i.e("chunk")," ").concat(i.e("cluster")),children:[fe("div",{className:i.em("cluster","header"),children:[fe("div",{className:i.e("similarity"),style:"--percent: ".concat((100*(e.similarity||0)).toFixed(2),"%;"),children:"SCORE ".concat((e.similarity||0).toFixed(2))}),e.original&&fe("div",{className:i.e("original"),children:"(向量".concat((e.original||0).toFixed(2),")")}),fe("div",{className:i.em("cluster","title"),children:"[摘要]"}),fe("div",{className:i.em("cluster","summary"),title:e.content,children:e.content})]}),fe("div",{className:i.em("cluster","content"),children:[fe("div",{className:i.em("cluster","icon"),onClick:function(t){return function(e,t){e.stopPropagation(),t.isExpand=!t.isExpand,o.value=c(o.value)}(t,e)},children:[fe(Nn,{style:{transform:e.isExpand?"rotate(90deg)":"rotate(0deg)"}}),"命中 ".concat((null===(t=e.children)||void 0===t?void 0:t.length)||0," 个子段落")]}),e.isExpand&&fe("div",{className:i.em("cluster","children"),children:null===(n=e.children)||void 0===n?void 0:n.map(function(e){return u(e)})})]}),l(e)]},e.id):fe("div",{className:"".concat(i.e("chunk")," ").concat(i.e("default")),children:[u(e),l(e)]},e.id)};return fe("div",{className:"".concat(i.b()," ").concat(e.className||""),children:[fe("div",{className:i.e("header"),onClick:function(){a.value=!a.value},children:[fe("div",{className:i.e("header-left"),children:[fe("div",{className:i.em("header-left","icon"),children:Tn}),fe("div",{className:i.em("header-left","caption"),children:"知识库检索:"}),fe("div",{className:i.em("header-left","desc"),title:null===(t=e.item.result)||void 0===t?void 0:t.query,children:null===(n=e.item.result)||void 0===n?void 0:n.query})]}),fe("div",{className:i.e("header-right"),children:[e.item.error&&fe("span",{style:"color: red;",children:"发生错误"}),e.item.error&&Sn,fe("span",{title:"复制",className:i.e("copy"),onClick:function(t){return function(t){t.stopPropagation(),s.value||(r&&clearTimeout(r),s.value=!0,navigator.clipboard.writeText(JSON.stringify(e.item,void 0,2)),window.ibiz.message.success("已复制"),r=setTimeout(function(){s.value=!1},2e3))}(t)},children:s.value?_n:Mn}),fe(Nn,{style:{"margin-left":" 6px",transform:a.value?"rotate(90deg)":"rotate(0deg)"}})]})]}),a.value&&fe("div",{className:i.e("content"),children:e.item.error?fe("div",{className:"".concat(i.e("error")," ").concat(i.e("center-text")),children:e.item.result}):o.value.length>0?o.value.map(function(e){return h(e)}):fe("div",{className:"".concat(i.e("center-text")),children:"无数据"})})]})},jn=function(e){var t=new ve("chat-image-preview");return fe("div",{className:"el-image-viewer__wrapper ".concat(t.b()),children:[fe("div",{className:"el-image-viewer__mask",onClick:function(t){var n;return null===(n=e.onClose)||void 0===n?void 0:n.call(e,t)}}),fe("span",{className:"el-image-viewer__btn el-image-viewer__close",onClick:function(t){var n;return null===(n=e.onClose)||void 0===n?void 0:n.call(e,t)},children:fe("i",{className:"el-icon",children:fe("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",children:fe("path",{fill:"currentColor",d:"M764.288 214.592 512 466.88 259.712 214.592a31.936 31.936 0 0 0-45.12 45.12L466.752 512 214.528 764.224a31.936 31.936 0 1 0 45.12 45.184L512 557.184l252.288 252.288a31.936 31.936 0 0 0 45.12-45.12L557.12 512.064l252.288-252.352a31.936 31.936 0 1 0-45.12-45.184z"})})})}),fe("div",{className:"el-image-viewer__canvas",onClick:function(e){return e.stopPropagation()},children:fe("img",{src:e.src,className:"el-image-viewer__img",style:"transform: scale(1) rotate(0deg) translate(0px, 0px);"})})]})},$n=function(e){var t,n,r,i,o=new ve("image-tool-call"),a=Lt(!1),s=Lt(!1),c=Lt(!1);Ye(function(){return function(){i&&clearTimeout(i)}},[]);var l,u,d,h,f=function(){var t;null!==(t=e.item.result)&&void 0!==t&&t.image_url&&(a.value=!a.value)};return fe("div",{className:"".concat(o.b()," ").concat(e.className||""),children:[fe("div",{className:o.e("header"),onClick:function(){s.value=!s.value},children:[fe("div",{className:o.e("header-left"),children:[fe("div",{className:o.em("header-left","icon"),children:On}),fe("div",{className:o.em("header-left","caption"),children:"图片内容识别"}),fe("div",{className:o.em("header-left","desc"),title:(null===(t=e.item.parameters)||void 0===t?void 0:t.desc)||"",children:(null===(n=e.item.parameters)||void 0===n?void 0:n.desc)||""})]}),fe("div",{className:o.e("header-right"),children:[e.item.error&&fe("span",{style:"color: red;",children:"发生错误"}),e.item.error&&Sn,fe("span",{title:"复制",className:o.e("copy"),onClick:function(t){return function(t){t.stopPropagation(),c.value||(i&&clearTimeout(i),c.value=!0,navigator.clipboard.writeText(JSON.stringify(e.item,void 0,2)),window.ibiz.message.success("已复制"),i=setTimeout(function(){c.value=!1},2e3))}(t)},children:c.value?_n:Mn}),fe(Nn,{style:{"margin-left":" 6px",transform:s.value?"rotate(90deg)":"rotate(0deg)"}})]})]}),s.value&&fe("div",{className:o.e("content"),children:e.item.error?fe("div",{className:"".concat(o.e("error")," ").concat(o.e("center-text")),children:e.item.result}):null!==(l=e.item.result)&&void 0!==l&&l.image_url||null!==(u=e.item.result)&&void 0!==u&&u.content?[fe("img",{className:o.e("image"),src:null===(d=e.item.result)||void 0===d?void 0:d.image_url,onClick:f},"image"),fe("div",{className:o.e("description"),children:null===(h=e.item.result)||void 0===h?void 0:h.content},"description")]:fe("div",{className:"".concat(o.e("center-text")),children:"无数据"})}),a.value&&fe(jn,{src:null===(r=e.item.result)||void 0===r?void 0:r.image_url,onClose:f})]})},Hn=function(e){var t=new ve("chat-tool-call-item"),n=null;switch(e.item.type){case"fetch_chunks":n=Fn;break;case"desc_oss_image":n=$n;break;default:n=Vn}return $(n,{item:e.item,className:t.b()})},Wn=function(e){var t=e.items,n=new ve("chat-tool-call"),r=Lt([]),i=Lt(!1),o=Lt(!1);Ye(function(){r.value=t.filter(function(e){return e}),o.value=t.length>4},[t]);var a=Bt(function(){return o.value&&!i.value?r.value.slice(0,4):r.value});return fe("div",{className:"".concat(n.b()),children:[!e.toolcallCompleted&&fe("div",{className:n.e("loading-container"),children:[fe("div",{className:n.e("loading-text"),children:"智能体工具调用执行中"}),fe("div",{className:n.e("loading-dot")}),fe("div",{className:n.e("loading-dot")}),fe("div",{className:n.e("loading-dot")})]}),e.toolcallCompleted&&a.value.map(function(e,t){return fe(Hn,{item:e},t)}),e.toolcallCompleted&&o.value&&fe("div",{className:n.e("toggle"),onClick:function(){i.value=!i.value},children:fe("span",{className:n.e("toggle-label"),children:i.value?"工具调用 收缩":"工具调用 展开"})})]})},qn=new ve("chat-search"),Un=function(e){var t=e.className,n=e.value,r=e.placeholder,i=e.onChange,o=e.onEnter,a=g(Xe(!1),2),s=a[0],c=a[1],l=function(e){var t;e.stopPropagation(),null==i||i(null===(t=e.target)||void 0===t?void 0:t.value)};return fe("div",{className:"".concat(qn.b()," ").concat(qn.is("focus",s)," ").concat(t||""),children:[fe("div",{className:qn.e("prefix"),children:fe(mn,{})}),fe("input",{value:n,className:qn.e("inner"),placeholder:r,onFocus:function(){return c(!0)},onBlur:function(){return c(!1)},onChange:function(e){return l(e)},onKeyDown:function(e){var t;"Enter"===e.code&&(null==o||o(null===(t=e.target)||void 0===t?void 0:t.value))}})]})},Kn=new ve("chat-loading"),Jn=function(e){var t=e.size,n=void 0===t?24:t;return fe("div",{className:Kn.b(),children:fe("div",{className:Kn.e("spinner"),style:{width:"".concat(n,"px"),height:"".concat(n,"px")},children:fe(on,{})})})},Gn=new ve("chat-single-select"),Xn=function(e){var t,n=e.value,r=e.options,i=e.popperStyle,o=e.disabled,a=void 0!==o&&o,s=e.showBorder,c=void 0===s||s,l=e.enableSearch,u=void 0!==l&&l,d=e.placeholder,h=void 0===d?"请选择":d,p=e.icon,v=e.onChange,y=e.onSearch,k=!!r.length,w=Qe(null),b=Qe(null),x=Lt(""),C=g(Xe(n),2),S=C[0],_=C[1],M=g(Xe(r),2),N=M[0],T=M[1],O=g(Xe(!1),2),E=O[0],A=O[1],D=g(Xe(!1),2),I=D[0],z=D[1],R=(null===(t=r.find(function(e){return e.value===S}))||void 0===t?void 0:t.label)||h;Ye(function(){!1===E&&(x.value="",T(r))},[E]),Ye(function(){_(n)},[n]),Ye(function(){T(r)},[r]),Ye(function(){var e=function(e){var t,n;!k||a||null!==(t=b.current)&&void 0!==t&&t.contains(e.target)||(null!==(n=w.current)&&void 0!==n&&n.contains(e.target)?A(function(e){return!e}):A(!1))};return document.addEventListener("mousedown",e),function(){document.removeEventListener("mousedown",e)}},[]);var P=function(){var e=m(f().m(function e(t){var n,i;return f().w(function(e){for(;;)switch(e.p=e.n){case 0:if(e.p=0,z(!0),n=[],!y){e.n=2;break}return e.n=1,y(t);case 1:n=e.v,e.n=3;break;case 2:n=r.filter(function(e){return e.label.toLowerCase().includes(t.toLowerCase())});case 3:T(n),e.n=5;break;case 4:e.p=4,i=e.v,T([]),console.error("搜索失败:",i);case 5:return e.p=5,z(!1),e.f(5);case 6:return e.a(2)}},e,null,[[0,4,5,6]])}));return function(t){return e.apply(this,arguments)}}();return fe("div",{className:"".concat(Gn.b()," ").concat(e.className?e.className:""),children:[fe("div",{className:"".concat(Gn.e("button")," ").concat(c?Gn.em("button","border"):""," ").concat(Gn.is("focus",E)),ref:w,children:[p?fe("span",{className:"".concat(Gn.em("button","icon")," ").concat(Gn.em("button","prefix")),children:p()}):null,fe("span",{title:R,className:Gn.em("button","caption"),children:R}),k?fe("span",{className:"".concat(Gn.em("button","icon")," ").concat(Gn.em("button","suffix")),children:E?Pn():gn()}):null]}),E?fe("div",{className:Gn.e("dropdown"),ref:b,style:i,children:[u?fe("div",{className:Gn.em("dropdown","search"),children:fe(Un,{placeholder:"搜索",value:x.value,onEnter:P,onChange:function(e){x.value=e}})}):null,fe("ul",{className:Gn.em("dropdown","list"),children:I?fe(Jn,{}):N.length?N.map(function(e){return fe("li",{title:e.label,onClick:function(){return function(e){_(e.value),null==v||v(e.value),A(!1)}(e)},className:"".concat(Gn.em("dropdown","item")," ").concat(Gn.is("active",e.value===S)),children:e.label},e.value)}):fe("li",{className:"el-empty ".concat(Gn.e("empty")),children:[En,fe("div",{className:Gn.em("empty","text"),children:"暂无数据"})]})})]}):null]})},Yn=new ve("chat-multiple-select"),Zn=function(e){var t=e.value,n=e.options,r=e.placeholder,i=e.popperStyle,o=e.enableSearch,a=void 0!==o&&o,s=e.icon,l=e.onChange,u=e.onSearch,d=Qe(null),h=Qe(null),p=Lt(""),v=g(Xe(!1),2),y=v[0],k=v[1],w=g(Xe(!1),2),b=w[0],x=w[1],C=g(Xe(t||[]),2),S=C[0],_=C[1],M=g(Xe(n),2),N=M[0],T=M[1];Ye(function(){!1===y&&(p.value="",T(n))},[y]),Ye(function(){_(t||[])},[t]),Ye(function(){T(n)},[n]),Ye(function(){var e=function(e){var t,n;e.stopPropagation(),e.target&&null!==(t=h.current)&&void 0!==t&&t.contains(e.target)||(null!==(n=d.current)&&void 0!==n&&n.contains(e.target)?k(function(e){return!e}):k(!1))};return document.addEventListener("mousedown",e),function(){document.removeEventListener("mousedown",e)}},[]);var O=function(){var e=m(f().m(function e(t){var r,i;return f().w(function(e){for(;;)switch(e.p=e.n){case 0:if(e.p=0,x(!0),r=[],!u){e.n=2;break}return e.n=1,u(t);case 1:r=e.v,e.n=3;break;case 2:r=n.filter(function(e){return e.label.toLowerCase().includes(t.toLowerCase())});case 3:T(r),e.n=5;break;case 4:e.p=4,i=e.v,T([]),console.error("搜索失败:",i);case 5:return e.p=5,x(!1),e.f(5);case 6:return e.a(2)}},e,null,[[0,4,5,6]])}));return function(t){return e.apply(this,arguments)}}();return fe("div",{className:"".concat(Yn.b()," ").concat(e.className?e.className:""),onClick:function(t){return function(t){var n,r;t.target&&(null!==(n=h.current)&&void 0!==n&&n.contains(t.target)||null!==(r=d.current)&&void 0!==r&&r.contains(t.target))||e.onEnableChange&&e.onEnableChange()}(t)},children:[fe("div",{className:Yn.e("button"),title:r,children:[s?fe("span",{className:"".concat(Yn.em("button","icon")," ").concat(Yn.em("button","prefix")),children:s()}):null,r?[fe("span",{className:Yn.em("button","caption"),children:r},"placeholder"),fe("span",{ref:d,className:"".concat(Yn.em("button","icon")," ").concat(Yn.em("button","suffix")),children:y?Pn():gn()},"icon")]:null]}),y?fe("div",{className:Yn.e("dropdown"),ref:h,style:i,children:[a?fe("div",{className:Yn.em("dropdown","search"),children:fe(Un,{placeholder:"搜索",value:p.value,onEnter:O,onChange:function(e){p.value=e}})}):null,fe("ul",{className:Yn.em("dropdown","list"),children:b?fe(Jn,{}):N.length?N.map(function(e){return fe("li",{title:e.label,className:Yn.em("dropdown","item"),onClick:function(){return function(e){var t=S.includes(e.value)?S.filter(function(t){return t!==e.value}):[].concat(c(S),[e.value]);_(t),null==l||l(t)}(e)},children:[fe("input",{type:"checkbox",value:e.value,className:Yn.em("dropdown","item-checkbox"),checked:S.includes(e.value)}),fe("div",{className:Yn.em("dropdown","item-label"),children:e.label})]},e.value)}):fe("li",{className:"el-empty ".concat(Yn.e("empty")),children:[En,fe("div",{className:Yn.em("empty","text"),children:"暂无数据"})]})})]}):null]})},Qn=new ve("messsage-toolbar"),er=function(e){var t=e.controller,n=e.message,r=[{id:"islike",label:"点赞",title:"点赞",icon:function(){return fe(yn,{})},onClick:function(){t.messageLike(n._origin)}},{id:"isdislike",label:"点踩",title:"点踩",icon:function(){return fe(kn,{})},onClick:function(){t.messageDisLike(n._origin)}}],i=function(e){var t,n,r,i;return"function"==typeof e.icon?e.icon():null!==(t=e.icon)&&void 0!==t&&t.showIcon&&null!==(n=e.icon)&&void 0!==n&&n.cssClass?fe("i",{className:e.icon.cssClass}):null!==(r=e.icon)&&void 0!==r&&r.showIcon&&null!==(i=e.icon)&&void 0!==i&&i.imagePath?Ce(e.icon.imagePath)?fe("div",{dangerouslySetInnerHTML:{__html:e.icon.imagePath}}):fe("img",{src:e.icon.imagePath}):void 0};return et(function(){return 20===n.state&&!0!==n.completed||"REMOTE"!==t.resourceMode||!n.realmessageid||t.currentTopicDisableStorage},[n.state,n.completed])?fe(W,{}):fe("div",{className:"".concat(Qn.b()),children:r.map(function(e,r){var o="islike"===e.id&&"1"===n.islike||"isdislike"===e.id&&"1"===n.isdislike;return fe("div",{title:e.title,onClick:function(r){return function(e,r){var i;null===(i=r.onClick)||void 0===i||i.call(r,e,r,t.context,t.params,n)}(r,e)},className:"".concat(Qn.e("item")," ").concat(Qn.is("actived",o)),children:i(e)},r)})})};function tr(e,t){for(var n in t)e[n]=t[n];return e}function nr(e,t){for(var n in e)if("__source"!==n&&!(n in t))return!0;for(var r in t)if("__source"!==r&&e[r]!==t[r])return!0;return!1}function rr(e,t){this.props=e,this.context=t}(rr.prototype=new q).isPureReactComponent=!0,rr.prototype.shouldComponentUpdate=function(e,t){return nr(this.props,e)||nr(this.state,t)};var ir=v.__b;v.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),ir&&ir(e)};var or="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.forward_ref")||3911;var ar=v.__e;v.__e=function(e,t,n,r){if(e.then)for(var i,o=t;o=o.__;)if((i=o.__c)&&i.__c)return null==t.__e&&(t.__e=n.__e,t.__k=n.__k),i.__c(e,t);ar(e,t,n,r)};var sr=v.unmount;function cr(e,t,n){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(e){"function"==typeof e.__c&&e.__c()}),e.__c.__H=null),null!=(e=tr({},e)).__c&&(e.__c.__P===n&&(e.__c.__P=t),e.__c.__e=!0,e.__c=null),e.__k=e.__k&&e.__k.map(function(e){return cr(e,t,n)})),e}function lr(e,t,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(e){return lr(e,t,n)}),e.__c&&e.__c.__P===t&&(e.__e&&n.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=n)),e}function ur(){this.__u=0,this.o=null,this.__b=null}function dr(e){var t=e.__.__c;return t&&t.__a&&t.__a(e)}function hr(){this.i=null,this.l=null}v.unmount=function(e){var t=e.__c;t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),sr&&sr(e)},(ur.prototype=new q).__c=function(e,t){var n=t.__c,r=this;null==r.o&&(r.o=[]),r.o.push(n);var i=dr(r.__v),o=!1,a=function(){o||(o=!0,n.__R=null,i?i(s):s())};n.__R=a;var s=function(){if(! --r.__u){if(r.state.__a){var e=r.state.__a;r.__v.__k[0]=lr(e,e.__c.__P,e.__c.__O)}var t;for(r.setState({__a:r.__b=null});t=r.o.pop();)t.forceUpdate()}};r.__u++||32&t.__u||r.setState({__a:r.__b=r.__v.__k[0]}),e.then(a,a)},ur.prototype.componentWillUnmount=function(){this.o=[]},ur.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement("div"),r=this.__v.__k[0].__c;this.__v.__k[0]=cr(this.__b,n,r.__O=r.__P)}this.__b=null}var i=t.__a&&$(W,null,e.fallback);return i&&(i.__u&=-33),[$(W,null,t.__a?null:e.children),i]};var fr=function(e,t,n){if(++n[1]===n[0]&&e.l.delete(t),e.props.revealOrder&&("t"!==e.props.revealOrder[0]||!e.l.size))for(n=e.i;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;e.i=n=n[2]}};function pr(e){return this.getChildContext=function(){return e.context},e.children}function vr(e){var t=this,n=e.h;if(t.componentWillUnmount=function(){de(null,t.v),t.v=null,t.h=null},t.h&&t.h!==n&&t.componentWillUnmount(),!t.v){for(var r=t.__v;null!==r&&!r.__m&&null!==r.__;)r=r.__;t.h=n,t.v={nodeType:1,parentNode:n,childNodes:[],__k:{__m:r.__m},contains:function(){return!0},insertBefore:function(e,n){this.childNodes.push(e),t.h.insertBefore(e,n)},removeChild:function(e){this.childNodes.splice(this.childNodes.indexOf(e)>>>1,1),t.h.removeChild(e)}}}de($(pr,{context:t.context},e.__v),t.v)}function mr(e,t){var n=$(vr,{__v:e,h:t});return n.containerInfo=t,n}(hr.prototype=new q).__a=function(e){var t=this,n=dr(t.__v),r=t.l.get(e);return r[0]++,function(i){var o=function(){t.props.revealOrder?(r.push(i),fr(t,e,r)):i()};n?n(o):o()}},hr.prototype.render=function(e){this.i=null,this.l=new Map;var t=Z(e.children);e.revealOrder&&"b"===e.revealOrder[0]&&t.reverse();for(var n=t.length;n--;)this.l.set(t[n],this.i=[1,0,this.i]);return e.children},hr.prototype.componentDidUpdate=hr.prototype.componentDidMount=function(){var e=this;this.l.forEach(function(t,n){fr(e,n,t)})};var gr="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,yr=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,kr=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,wr=/[A-Z0-9]/g,br="undefined"!=typeof document,xr=function(e){return("undefined"!=typeof Symbol&&"symbol"==N(Symbol())?/fil|che|rad/:/fil|che|ra/).test(e)};q.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(q.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var Cr=v.event;function Sr(){}function _r(){return this.cancelBubble}function Mr(){return this.defaultPrevented}v.event=function(e){return Cr&&(e=Cr(e)),e.persist=Sr,e.isPropagationStopped=_r,e.isDefaultPrevented=Mr,e.nativeEvent=e};var Nr={enumerable:!1,configurable:!0,get:function(){return this.class}},Tr=v.vnode;v.vnode=function(e){"string"==typeof e.type&&function(e){var t=e.props,n=e.type,r={},i=-1===n.indexOf("-");for(var o in t){var a=t[o];if(!("value"===o&&"defaultValue"in t&&null==a||br&&"children"===o&&"noscript"===n||"class"===o||"className"===o)){var s=o.toLowerCase();"defaultValue"===o&&"value"in t&&null==t.value?o="value":"download"===o&&!0===a?a="":"translate"===s&&"no"===a?a=!1:"o"===s[0]&&"n"===s[1]?"ondoubleclick"===s?o="ondblclick":"onchange"!==s||"input"!==n&&"textarea"!==n||xr(t.type)?"onfocus"===s?o="onfocusin":"onblur"===s?o="onfocusout":kr.test(o)&&(o=s):s=o="oninput":i&&yr.test(o)?o=o.replace(wr,"-$&").toLowerCase():null===a&&(a=void 0),"oninput"===s&&r[o=s]&&(o="oninputCapture"),r[o]=a}}"select"==n&&r.multiple&&Array.isArray(r.value)&&(r.value=Z(t.children).forEach(function(e){e.props.selected=-1!=r.value.indexOf(e.props.value)})),"select"==n&&null!=r.defaultValue&&(r.value=Z(t.children).forEach(function(e){e.props.selected=r.multiple?-1!=r.defaultValue.indexOf(e.props.value):r.defaultValue==e.props.value})),t.class&&!t.className?(r.class=t.class,Object.defineProperty(r,"className",Nr)):(t.className&&!t.class||t.class&&t.className)&&(r.class=r.className=t.className),e.props=r}(e),e.$$typeof=gr,Tr&&Tr(e)};var Or=v.__r;v.__r=function(e){Or&&Or(e),e.__c};var Er=v.diffed;v.diffed=function(e){Er&&Er(e);var t=e.props,n=e.__e;null!=n&&"textarea"===e.type&&"value"in t&&t.value!==n.value&&(n.value=null==t.value?"":t.value)};var Ar=new ve("chat-slider"),Dr=function(e){function t(t){var n=tr({},t);return delete n.ref,e(n,t.ref||null)}return t.$$typeof=or,t.render=e,t.prototype.isReactComponent=t.__f=!0,t.displayName="ForwardRef("+(e.displayName||e.name)+")",t}(function(e,t){var n=e.min,r=e.max,i=e.step,o=e.onChange,a=Qe(null),s=Lt(e.value),c=Math.max.apply(null,[n,r,i].map(function(e){var t="".concat(e).split(".")[1];return t?t.length:0})),l=Qe({dragging:!1,startX:0,newPosition:0,startPosition:0}),u=Bt(function(){return"".concat((s.value-n)/(r-n)*100,"%")});Ye(function(){s.value=e.value},[e.value]);var d=function(e){var t,n;return e.type.startsWith("touch")?(n=e.touches[0].clientY,t=e.touches[0].clientX):(n=e.clientY,t=e.clientX),{clientX:t,clientY:n}},h=function(){var t=m(f().m(function t(a){var s,l,u;return f().w(function(t){for(;;)switch(t.n){case 0:if(null!==a&&!Number.isNaN(+a)){t.n=1;break}return t.a(2);case 1:a<0?a=0:a>100&&(a=100),s=100/((r-n)/i),l=Math.round(a/s),u=l*s*(r-n)*.01+n,(u=Number.parseFloat(u.toFixed(c)))!==e.value&&o(u);case 2:return t.a(2)}},t)}));return function(e){return t.apply(this,arguments)}}(),p=function(e){if(l.current.dragging){var t=d(e).clientX,n=a.current.parentElement.clientWidth,r=(t-l.current.startX)/n*100;l.current.newPosition=l.current.startPosition+r,h(l.current.newPosition)}},v=function(){l.current.dragging&&(l.current.dragging=!1,window.removeEventListener("mousemove",p),window.removeEventListener("touchmove",p),window.removeEventListener("mouseup",v),window.removeEventListener("touchend",v))},g=function(e){e.preventDefault(),function(e){var t=d(e).clientX,n=Number.parseFloat(u.value);Object.assign(l.current,{dragging:!0,startX:t,startPosition:n,newPosition:n})}(e),window.addEventListener("mousemove",p),window.addEventListener("touchmove",p),window.addEventListener("mouseup",v),window.addEventListener("touchend",v),a.current.focus()};return function(e,t,n){Fe=6,Ze(function(){if("function"==typeof e){var n=e(t());return function(){e(null),n&&"function"==typeof n&&n()}}if(e)return e.current=t(),function(){return e.current=null}},null==n?n:n.concat(e))}(t,function(){return{state:l,onButtonDown:g,setPosition:h}}),fe("div",{ref:a,className:Ar.e("button-wrapper"),onMouseDown:g,onTouchStart:g,style:{left:u.value},children:fe("div",{className:Ar.e("button")})})}),Ir=new ve("chat-slider"),zr=function(e){var t=e.step,n=void 0===t?1:t,r=e.min,i=void 0===r?0:r,o=e.max,a=void 0===o?100:o,s=e.value,c=void 0===s?0:s,l=e.onChange,u=Qe(null),d=Qe(null),h=Lt(c),f=Bt(function(){return{width:"".concat(100*(h.value-i)/(a-i),"%"),left:"0%"}});Ye(function(){void 0!==c&&(h.value=c)},[c]);var p=function(e){var t,n;if(d.current&&!d.current.state.current.dragging){var r,i=null!==(t=null===(n=e.touches)||void 0===n||null===(n=n.item(0))||void 0===n?void 0:n.clientX)&&void 0!==t?t:e.clientX,o=u.current.getBoundingClientRect();(r=(i-o.left)/o.width*100)<0||r>100||(d.current.setPosition(r),setTimeout(function(){d.current.onButtonDown(e)},0))}};return fe("div",{className:Ir.b(),title:"".concat(h.value),children:fe("div",{ref:u,className:Ir.e("runway"),onMouseDown:p,onTouchStart:p,children:[fe("div",{className:Ir.e("bar"),style:f.value}),fe(Dr,{min:i,max:a,step:n,ref:d,value:h.value,onChange:function(e){h.value=e,null==l||l(e)}})]})})},Rr=new ve("chat-switch"),Pr=function(e){var t=e.value,n=e.onChange,r=g(Xe(void 0),2),i=r[0],o=r[1],a=g(Xe(t),2),s=a[0],c=a[1];Ye(function(){c(t)},[t]);return fe("div",{className:Rr.b(),onClick:function(){var e;void 0===s&&(e=1===i?0:1),o(s),c(e),null==n||n(e)},children:fe("div",{className:"".concat(Rr.e("wrapper")," ").concat(Rr.is(0===s?"left":1===s?"right":"center",!0))})})},Lr=new ve("chat-step-item"),Br=function(e){var t=e.element,n=g(Xe(t.title),2),r=n[0],i=n[1],o=g(Xe(!1),2),a=o[0],s=o[1],c=g(Xe(!1),2),l=c[0],u=c[1],d=g(Xe(0),2),h=d[0],f=d[1],p=Qe(null),v=Qe(null),m=function(){if(p.current){var e=p.current;f(e.clientHeight)}};Ye(function(){t.title?i(t.title):t.content&&(t.content.length>20&&i("".concat(t.content.substring(0,19),"...")),i(t.content.substring(0,19))),m(),function(){if(v.current){var e=v.current;e.style.display="block";var t=e.scrollHeight;e.style.display="-webkit-box";var n=e.clientHeight;s(!!(t>n))}}()},[]),Ye(function(){setTimeout(function(){m()},0)},[e.element.content]);return fe("div",{ref:p,className:"".concat(Lr.b()),style:{"--ibiz-chat-step-item-height":"".concat(h,"px")},children:[fe("div",{className:"".concat(Lr.e("left")),children:fe("div",{className:"".concat(Lr.e("icon")),children:["success"===t.status&&fe(Dn,{}),"failed"===t.status&&fe(An,{}),"pending"===t.status&&fe(rn,{})]})}),fe("div",{className:"".concat(Lr.e("right")," ").concat("pending"===t.status?"is-loadding":""),children:["pending"!==t.status&&fe("div",{className:"".concat(Lr.e("title")),title:r,children:r}),"pending"!==t.status&&fe("div",{className:"".concat(Lr.e("content")),children:[fe("div",{ref:v,className:"".concat(Lr.e("content-text")," ").concat(l?"expanded":""),children:t.content||""}),a&&fe("button",{className:"".concat(Lr.e("toggle-btn")),onClick:function(){u(!l),setTimeout(function(){m()},0)},children:l?"收起":"展开全部"})]}),"pending"===t.status&&fe("div",{className:"".concat(Lr.e("loadding-text")),children:"加载中......"})]})]})},Vr=new ve("chat-step"),Fr=function(e){var t=e.items,n=Lt(!1),r=Lt(!0),i=Lt([]);Ye(function(){n.value=t.length>1,i.value=n.value&&!r.value?[t[t.length-1]]:t},[t]);return fe("div",{className:"".concat(Vr.b()),children:[fe("div",{className:Vr.e("container"),children:i.value.map(function(e,t){return fe(Br,{element:e},"".concat(e.title,"_").concat(e.content,"_").concat(t))})}),n.value&&fe("div",{className:Vr.e("toggle"),onClick:function(){r.value=!r.value,i.value=n.value&&!r.value?[t[t.length-1]]:t},children:fe("span",{className:Vr.e("toggle-label"),children:r.value?"执行步骤 收缩":"执行步骤 展开"})})]})},jr=new ve("ossfile-material"),$r=function(e){var t=Bt(function(){return e.material.data.name}),n=Bt(function(){var t,n=e.material.metadata.size;return(t=n)>=1048576?"".concat((t/1048576).toFixed(2),"M"):t>=1024?"".concat((t/1024).toFixed(2),"K"):"".concat(t,"B")}),r=Bt(function(){return e.material.metadata.state}),i=Bt(function(){var t=e.material.metadata.state;return"successed"===t?"上传成功":"uploading"===t?"上传中":"failed"===t?"上传失败":"未知状态"}),o=Bt(function(){switch(e.material.metadata.state){case"successed":return"#1890ff";case"uploading":return"#52c41a";default:return"#ff4d4f"}});return fe("div",{className:jr.b(),children:[fe("div",{className:jr.b("left"),children:fe(sn,{})}),fe("div",{className:jr.b("right"),children:[fe("div",{className:jr.e("name"),title:t,children:t}),fe("div",{className:jr.b("metadata"),children:[fe("div",{children:n}),"successed"!==r.value&&fe("div",{style:{color:o.value},children:i}),"successed"===r.value&&fe("div",{className:jr.be("metadata","img"),title:"下载",onClick:function(){var t=e.material.metadata;e.controller.opts.uploader.onDownLoad(t,{context:e.controller.context,params:e.controller.params})},children:fe(xn,{})})]})]})]})},Hr=new ve("common-material"),Wr=function(e){var t,n,r,i,o=null===(t=e.controller.opts.questionToolbarItems)||void 0===t?void 0:t.find(function(t){return t.id===e.material.metadata.actionId}),a=Bt(function(){return e.material.metadata.name}),s=Bt(function(){return e.material.metadata.downloadactionid});return fe("div",{className:Hr.b(),children:[fe("div",{className:Hr.b("left"),children:o&&o.icon?"function"==typeof o.icon?o.icon():(null===(n=o.icon)||void 0===n?void 0:n.showIcon)&&fe(W,{children:null!==(r=o.icon)&&void 0!==r&&r.cssClass?fe("i",{className:o.icon.cssClass}):null!==(i=o.icon)&&void 0!==i&&i.imagePath?Ce(o.icon.imagePath)?fe("div",{dangerouslySetInnerHTML:{__html:o.icon.imagePath}}):fe("img",{src:o.icon.imagePath}):null}):fe(ln,{})}),fe("div",{className:Hr.b("right"),children:[fe("div",{className:Hr.e("name"),title:a,children:a}),fe("div",{className:Hr.b("metadata"),children:[fe("div",{children:(null==o?void 0:o.label)||"素材资源"}),s&&fe("div",{className:Hr.be("metadata","img"),title:"预览",onClick:function(t){var n=e.material.metadata,r=e.controller.opts.extendToolbarClick;if(r&&"function"==typeof r){var i=n.downloadactionid;if(!s)throw new Error("downloadactionid不能为空");var o=n.downloadAppId,a=h({},e.controller.context);if(n.downloadContext)try{var c=n.downloadContext.split(";").reduce(function(e,t){if(t.trim()){var n=g(t.split(":"),2),r=n[0],i=n[1];r&&i&&(e[r.trim()]=i.trim())}return e},{});c&&Object.keys(c).length>0&&Object.assign(a,c)}catch(l){throw new Error("downloadContext参数解析异常,正确格式如:abc:123;cde:456,")}r(t,{id:i,isPluginApp:!!o,appId:o||a.srfappid},a,e.controller.params,{})}},children:fe(xn,{})})]})]})]})},qr=new ve("chat-input-material-item"),Ur=function(e){var t=e.material,n=null;if("ossfile"===t.type)n=$r;else n=Wr;return fe("div",{className:"".concat(qr.b()," ").concat(qr.is("disabled",e.disabled)),children:[fe("div",{className:qr.e("icon"),onClick:function(){e.controller.deleteMaterial(t)},children:fe(cn,{})}),$(n,{material:t,controller:e.controller})]})},Kr=new ve("markdown-message"),Jr=function(e){var t=e.message,n=e.size,r=Lt(we()),i=Lt(null),o=Lt({resources:[],remainingText:"",hasResources:!1}),a=function(e){var t=Oe.parseMixedContent(e),n=t.resources,r=t.remainingText,i=t.hasResources,a=t.error;o.value={resources:n,remainingText:r,hasResources:i,error:a}},c=et(function(){return 20===t.state&&!0!==t.completed},[t.state,t.completed]),l=et(function(){return 20===t.state&&!0===t.completed},[t.state,t.completed]),u=Lt({title:"",description:"",icon:fe(rn,{})}),d=Lt({hasSuggestions:!1,suggestions:[]}),h=function(e){e&&e.length>0?d.value={hasSuggestions:!0,suggestions:e}:d.value={hasSuggestions:!1,suggestions:[]}},f=function(e){var t=e.indexOf("<think>"),n=e.indexOf("</think>"),r="",i="",o=!1;return-1===n?(o=!1,r=e.slice(t+7),i=""):(o=!0,r=e.slice(t+7,n),i=e.slice(n+8)),{isThoughtCompleted:o,thoughtContent:r,answerContent:i}};return Ye(function(){if(n>=0&&i.value){if(-1!==t.content.indexOf("<think>")){var e=f(t.content),r=e.isThoughtCompleted,s=e.thoughtContent,c=e.answerContent;r?(u.value.icon=fe(nn,{}),u.value.title="思考完成"):!0===t.completed?(u.value.icon=fe(nn,{}),u.value.title="思考已停止"):(u.value.icon=fe(rn,{}),u.value.title="思考中..."),u.value.description=s||"",a(c)}else a(t.content);i.value.setMarkdown(o.value.remainingText||""),h(t.suggestions)}},[t,n]),Ye(function(){var n;if(-1!==t.content.indexOf("<think>")){var c=f(t.content),l=c.isThoughtCompleted,d=c.thoughtContent,p=c.answerContent;u.value={title:l?"思考完成":!0===t.completed?"思考已停止":"思考中...",description:d||"",icon:l||!0===t.completed?fe(nn,{}):fe(rn,{})},p&&a(p)}else a(t.content);n=o.value.remainingText,h(t.suggestions),i.value=new s({id:r,value:n||"",editor:{defaultModel:"previewOnly"},themeSettings:{mainTheme:"dark",codeBlockTheme:"dark"},previewer:{enablePreviewerBubble:!1},engine:{syntax:{table:{enableChart:!1,externals:["echarts"]}}},callback:{onClickPreview:function(t){var n=t.target,r=null==n?void 0:n.closest('a[href^="chunkview://"], a[href^="view://"], a[href^="action://"]');if(r){t.preventDefault();var i=r.getAttribute("href");if(i){var o="";switch(i.startsWith("chunkview://")?o="chunkview":i.startsWith("view://")?o="view":i.startsWith("action://")&&(o="action"),o){case"chunkview":case"view":case"action":e.controller.handlePredefinedClick(o,i,e.message,t);break;default:console.error("暂不支持".concat(o,"类型协议"))}}return!1}}}})},[]),fe("div",{className:"".concat(Kr.b()," ").concat(Kr.is("loading",c)),children:[fe("div",{className:Kr.b("header"),children:[fe("div",{className:Kr.be("header","caption"),children:"AI "}),e.children,l?fe("div",{className:Kr.be("header","timeout"),children:"请求超时"}):null]}),fe("div",{className:"".concat(Kr.b("content")," pre-wrap-container"),children:[o.value.hasResources&&fe("div",{className:"content-material-container",children:o.value.resources.map(function(t){return fe(Ur,{material:t,disabled:!0,controller:e.controller},t.id)})}),t.chatsteps&&t.chatsteps.length>0&&fe(Fr,{items:t.chatsteps||[]}),fe(Wn,{toolcallCompleted:!!t.toolcallcompleted,items:t.toolcalls||[]}),fe(Ln,{items:[u.value]}),fe("div",{id:r})]}),fe("div",{className:Kr.b("footer"),children:[fe(er,{message:t,controller:e.controller},"".concat(t.messageid,"_").concat(t.islike,"_").concat(t.isdislike)),d.value.hasSuggestions||t.chatuiactions&&t.chatuiactions.length>0?fe(Bn,{uiactions:t.chatuiactions||[],suggestions:d.value.suggestions,onSuggestionClick:function(t,n){!function(t,n){e.controller.handleSuggestionClick(e.message,t,n)}(t,n)},onUIActionClick:function(t,n){!function(t,n){e.controller.handleUIActionClick(e.message,t,n)}(t,n)}}):null]})]})},Gr=new ve("user-message-question"),Xr=function(e){var t=we(),n=Lt(null),r=Lt(135),i=Lt(!0),o=Lt(!1),a=Qe(null),c=Bt(function(){return e.message.content}),l=Bt(function(){return Oe.parseMixedContent(c.value)});Ye(function(){n.value=new s({id:t,value:l.value.remainingText||"",editor:{defaultModel:"previewOnly"},previewer:{enablePreviewerBubble:!1},engine:{syntax:{table:{enableChart:!1,externals:["echarts"]}}}})},[l.value.remainingText]),Ye(function(){if(a.current&&window.ResizeObserver){var e=new ResizeObserver(function(){var e,t=null===(e=n.value)||void 0===e?void 0:e.previewer.options.previewerDom;t&&(o.value=t.scrollHeight>r.value)});return e.observe(a.current),function(){e.disconnect()}}},[a.current]);return fe("div",{className:Gr.b(),children:[fe("div",{className:Gr.e("user-header"),children:[e.children,fe("div",{className:Gr.e("user"),children:"我"})]}),fe("div",{className:Gr.e("content"),children:[40===e.message.state&&fe("div",{className:Gr.em("content","warning-container"),onClick:function(t){e.message&&e.controller&&e.controller.refreshMessage(e.message,!0)},children:fe("div",{className:Gr.em("content","warning"),children:[fe("div",{className:"warning-icon",title:"未发送成功,请重试",children:fe(Cn,{})}),fe("div",{className:"refresh-icon",title:"未发送成功,请重试",children:fe(Ht,{})})]})}),fe("div",{className:Gr.em("content","body"),children:[l.value.hasResources&&fe("div",{className:Gr.em("content","material"),children:l.value.resources.map(function(t){return fe(Ur,{material:t,disabled:!0,controller:e.controller},t.id)})}),fe("div",{className:"pre-wrap-container",children:[fe("div",{className:"".concat(Gr.e("text-content")," ").concat(Gr.is("collapse",i.value)),id:t,ref:a,style:{maxHeight:i.value?"".concat(r.value,"px"):""}}),fe("div",{className:"".concat(Gr.e("collapse-btn")," ").concat(Gr.is("visible",o.value)),title:i.value?"展开":"收起",onClick:function(){i.value=!i.value},children:i.value?fe("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",children:fe("path",{fill:"currentColor",d:"M104.704 338.752a64 64 0 0 1 90.496 0l316.8 316.8 316.8-316.8a64 64 0 0 1 90.496 90.496L557.248 791.296a64 64 0 0 1-90.496 0L104.704 429.248a64 64 0 0 1 0-90.496"})}):fe("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024",children:fe("path",{fill:"currentColor",d:"M104.704 685.248a64 64 0 0 0 90.496 0l316.8-316.8 316.8 316.8a64 64 0 0 0 90.496-90.496L557.248 232.704a64 64 0 0 0-90.496 0L104.704 594.752a64 64 0 0 0 0 90.496"})})})]})]})]})]})},Yr=new ve("error-message"),Zr=function(e){var t=Bt(function(){return e.message.content});return fe("div",{className:Yr.b(),children:[fe("div",{className:Yr.b("header"),children:[fe("div",{className:Yr.be("header","caption"),children:"AI "}),e.children]}),fe("div",{className:"".concat(Yr.e("content")," pre-wrap-container"),children:fe("span",{children:t})})]})},Qr=new ve("unknown-message"),ei=function(e){return fe("div",{className:Qr.b(),children:fe("div",{className:"".concat(Qr.e("content")," pre-wrap-container"),children:["暂未支持的消息类型: ",e.message.type]})})},ti=new ve("chat-message-item"),ni=function(e){var t=e.message,n=e.size,r=null;switch(t.type){case"DEFAULT":r="ASSISTANT"===t.role?Jr:Xr;break;case"ERROR":r=Zr;break;default:r=ei}return fe("div",{className:ti.b(),children:$(r,{size:n,message:t,controller:e.controller,children:e.children})})},ri=function(){return S(function e(t){x(this,e),_(this,"toolcallcompleted",!0),_(this,"toolcalls",[]),_(this,"chatsteps",[]),_(this,"chatuiactions",[]),_(this,"allcontent",""),this.msg=t,this.toolcalls=t.toolcalls||[],this.chatsteps=t.chatsteps||[],this.chatuiactions=t.chatuiactions||[],this.allcontent=t.content},[{key:"messageid",get:function(){return this.msg.messageid}},{key:"state",get:function(){return this.msg.state}},{key:"role",get:function(){return this.msg.role}},{key:"type",get:function(){return this.msg.type}},{key:"status",get:function(){return this.msg.status}},{key:"realcontent",get:function(){var e=this.msg.content;if(-1!==e.indexOf("<think>")&&-1===e.indexOf("</think>"))return"";if(-1!==(e=e.replace(/<think>[^]*?<\/think>/g,"").trim()).indexOf("<chatstep>")&&-1===e.indexOf("</chatstep>"))return"";if(-1!==(e=e.replace(/<chatstep>[^]*?<\/chatstep>/g,"").trim()).indexOf("<tool_call>")&&-1===e.indexOf("</tool_call>"))return"";if(-1!==(e=e.replace(/<tool_call>[^]*?<\/tool_call>/g,"").trim()).indexOf("<resources>")&&-1===e.indexOf("</resources>"))return"";var t=(e=e.replace(/<resources>[^]*?<\/resources>/g,"").trim()).indexOf("<suggestions>");-1!==t&&(e=e.substring(0,t).trim());var n=e.indexOf("<chatuiaction>");return-1!==n&&(e=e.substring(0,n).trim()),e}},{key:"content",get:function(){return this.msg.content}},{key:"completed",get:function(){return this.msg.completed}},{key:"suggestions",get:function(){return this.msg.suggestions}},{key:"_origin",get:function(){return this.msg}},{key:"islike",get:function(){return this.msg.islike}},{key:"isdislike",get:function(){return this.msg.isdislike}},{key:"feedbackcontent",get:function(){return this.msg.feedbackcontent}},{key:"realmessageid",get:function(){return this.msg.realmessageid}},{key:"update",value:function(e){e.content||(e.content=""),this.allcontent+=e.content,-1!==e.content.indexOf("<think>")&&this.msg.content&&(this.msg.content=""),this.msg.content+=e.content,-1===this.msg.content.indexOf("<tool_call>")&&-1===this.msg.content.indexOf("</tool_call>")||(this.msg.content=""),this.computeToolCalls();var t=this.msg.content.indexOf("<chatstep>"),n=this.msg.content.indexOf("</chatstep>");-1===t&&-1===n||(this.msg.content=-1!==t&&-1!==n?this.msg.content.replace(/<chatstep>[^]*?<\/chatstep>/g,""):""),this.computeChatSteps();var r=this.msg.content.indexOf("<chatuiaction>"),i=this.msg.content.indexOf("</chatuiaction>");-1===r&&-1===i||(this.msg.content=-1!==r&&-1!==i?this.msg.content.replace(/<chatuiaction>[^]*?<\/chatuiaction>/g,""):""),this.computeChatUIActions()}},{key:"replace",value:function(e){this.msg=e}},{key:"updateCompleted",value:function(e){this.msg.completed=e}},{key:"computeToolCalls",value:function(){var e=Le.parse(this.allcontent),t=e.completed,n=e.toolCalls;this.toolcallcompleted=t,this.toolcalls=n}},{key:"computeChatSteps",value:function(){this.chatsteps=Be.parse(this.allcontent)}},{key:"computeChatUIActions",value:function(){this.chatuiactions=Ve.parse(this.allcontent)}}])}(),ii=function(){return S(function e(t){x(this,e),this.data=t},[{key:"appid",get:function(){return this.data.appid}},{key:"id",get:function(){return this.data.id}},{key:"type",get:function(){return this.data.type}},{key:"caption",get:function(){return this.data.caption}},{key:"sourceCaption",get:function(){return this.data.sourceCaption}},{key:"url",get:function(){return this.data.url}},{key:"aiChat",get:function(){return this.data.aiChat}},{key:"captionMode",get:function(){return this.data.captionMode}},{key:"realid",get:function(){return this.data.realid}},{key:"sequence",get:function(){return this.data.sequence}},{key:"isTop",get:function(){return this.data.isTop}},{key:"isShow",get:function(){var e;return null===(e=this.data.isShow)||void 0===e||e}},{key:"disableStorage",get:function(){return this.data.disableStorage||!1}},{key:"captionComputed",get:function(){return this.data.captionComputed||!1}}])}(),oi=function(){return S(function e(t){x(this,e),this.material=t},[{key:"id",get:function(){return this.material.id}},{key:"type",get:function(){return this.material.type}},{key:"metadata",get:function(){return this.material.metadata}},{key:"data",get:function(){return this.material.data}}])}(),ai=function(){return S(function e(t,n){x(this,e),this.agent=t,this.defaultConfig=n},[{key:"id",get:function(){return this.agent.id}},{key:"caption",get:function(){return this.agent.caption}},{key:"default",get:function(){return this.agent.default}},{key:"order",get:function(){return this.agent.order}},{key:"value",get:function(){return this.agent.id}},{key:"label",get:function(){return this.agent.caption}},{key:"knowledge_bases",get:function(){return this.agent.knowledge_bases}},{key:"allow_any_knowledge_base",get:function(){return this.agent.allow_any_knowledge_base}},{key:"rerank",get:function(){return this.agent.rerank||this.defaultConfig.chunkrerank}},{key:"maxchunks",get:function(){return this.agent.maxchunks||this.defaultConfig.maxchunks}},{key:"chunkthreshold",get:function(){return this.agent.chunkthreshold||this.defaultConfig.chunkthreshold}},{key:"chunkpageindex",get:function(){return this.agent.chunkpageindex||this.defaultConfig.chunkpageindex}}])}(),si=function(){return S(function e(t){x(this,e),this.knowledgeBase=t},[{key:"id",get:function(){return this.knowledgeBase.id}},{key:"name",get:function(){return this.knowledgeBase.name}},{key:"value",get:function(){return this.knowledgeBase.id}},{key:"label",get:function(){return this.knowledgeBase.name}}])}(),ci=new ve("chat-toolbar-item"),li=function(e){var t,n,r,i=e.model,o=e.data,a=e.className,s=e.disabled,c=void 0!==s&&s,l=e.buttonType,u=void 0===l?"default":l,d=e.onClick,h=g(Xe(!1),2),f=h[0],p=h[1],v=Qe(null),m=function(e){return"function"==typeof e.hidden?e.hidden(o):!0===e.hidden};if(m(i))return fe(W,{});var y=function(e){return!!c||("function"==typeof e.disabled?e.disabled(o):!0===e.disabled)},k=function(e){var t,n,r,i;return"function"==typeof e.icon?e.icon():null!==(t=e.icon)&&void 0!==t&&t.showIcon&&null!==(n=e.icon)&&void 0!==n&&n.cssClass?fe("i",{className:e.icon.cssClass}):null!==(r=e.icon)&&void 0!==r&&r.showIcon&&null!==(i=e.icon)&&void 0!==i&&i.imagePath?Ce(e.icon.imagePath)?fe("div",{dangerouslySetInnerHTML:{__html:e.icon.imagePath}}):fe("img",{src:e.icon.imagePath}):void 0},w=function(e,t){y(t)||(p(!1),d(e,t))};return Ye(function(){var e=function(e){v.current&&v.current.contains(e.target)||p(!1)};return f&&document.addEventListener("mousedown",e),function(){document.removeEventListener("mousedown",e)}},[f]),fe("div",{className:"".concat(ci.b()," ").concat(ci.b(u)," ").concat(i.customClass||""," ").concat(a||""," ").concat(ci.is("disabled",y(i))," ").concat(ci.is("more",!(null===(t=i.children)||void 0===t||!t.length))),children:[fe("div",{title:i.title,className:ci.e("content"),onClick:function(e){return w(e,i)},children:[fe("div",{className:ci.em("content","icon"),children:k(i)}),fe("div",{className:ci.em("content","label"),children:i.label})]}),(null===(n=i.children)||void 0===n?void 0:n.length)&&fe("div",{title:"更多",className:ci.e("more"),onClick:function(e){y(i)||p(!0)},children:fe("i",{"aria-hidden":"true",className:"fa fa-angle-down ".concat(ci.em("more","icon"))})}),f&&fe("div",{ref:v,className:ci.b("dropdown"),children:null===(r=i.children)||void 0===r?void 0:r.map(function(e,t){if(!m(e))return fe("div",{title:e.title,onClick:function(t){return w(t,e)},className:"".concat(ci.be("dropdown","item")," ").concat(e.customClass||""," ").concat(ci.is("disabled",y(e))),children:[fe("div",{className:ci.bem("dropdown","item","icon"),children:k(e)}),fe("div",{className:ci.bem("dropdown","item","label"),children:e.label})]},t)})})]})},ui=new ve("chat-toolbar"),di=function(e){var t=e.controller,n=e.items,r=void 0===n?[]:n,i=e.data,o=e.type,a=e.className,s=[],l=[{label:"重置对话",title:"重置对话",icon:function(){return fe(fn,{})},onClick:function(){t.resetTopic()},children:[{label:"清空对话",title:"清空对话",icon:function(){return fe(hn,{})},onClick:function(){t.clearTopic()}}]}],u=[{label:"刷新",title:"刷新",icon:function(){return fe(Ht,{})},onClick:function(){t.refreshMessage(i)}},{label:"删除",title:"删除",hidden:function(){return!i.realmessageid},icon:function(){return fe($t,{})},onClick:function(){t.deleteMessage(i)}},{label:"复制",title:"复制",icon:function(){return fe(Wt,{})},onClick:function(){t.copyMessage(i)}}];nt(Ip).enableBackFill&&u.unshift.apply(u,[{label:"回填",title:"回填",icon:function(){return fe(Ft,{})},onClick:function(){t.backfill(i)}}]);var d=[{label:"刷新",title:"刷新",icon:function(){return fe(Ht,{})},onClick:function(){t.refreshMessage(i,!0)}}];if("content"===o)switch(i.type){case"DEFAULT":s="ASSISTANT"===i.role?[].concat(u,c(r)):[].concat(d);break;case"ERROR":s=[].concat(u,c(r))}else s=[].concat(l,c(r));var f=function(n,r){var o=h({},i);if(i instanceof ri?(Object.assign(o,{topic:t.topic}),o.msg.realcontent=i.realcontent):(o.data||(o.data={}),Object.assign(o.data,{messages:t.messages.value})),r.onClick&&"function"==typeof r.onClick)r.onClick(n,r,t.context,t.params,o);else{var a=e.controller.opts.extendToolbarClick;a&&"function"==typeof a&&a(n,r,t.context,t.params,o)}},p=et(function(){return"content"===o&&20===(null==i?void 0:i.state)&&!0!==(null==i?void 0:i.completed)},[null==i?void 0:i.state,null==i?void 0:i.completed]);return fe("div",{className:"".concat(ui.b()," ").concat(a||""),children:s.map(function(e,t){return fe(li,{data:i,model:e,disabled:p,buttonType:"content"===o?"circle":"default",onClick:f.bind(void 0)},t)})})};var hi=function(e){var t=Lt(!1),n=Lt({}),r=new ve("chat-back-bottom"),i=Lt(null),o=function(){if(i.value){var n=e.visibilityHeight||200,r=i.value.scrollHeight-i.value.scrollTop-i.value.offsetHeight;t.value=r>=n}},a=function(e,t){var n=null;return function(){for(var r=this,i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];n||(n=setTimeout(function(){e.apply(r,o),n=null},t))}}(o,300);return et(function(){n.value={right:"".concat(e.right,"px"),bottom:"".concat(e.bottom,"px")}},[e.right,e.bottom]),Ye(function(){if(e.target){var t,n=null!==(t=document.querySelector(e.target))&&void 0!==t?t:void 0;n&&(i.value=n,n.addEventListener("scroll",a),o())}},[]),fe("div",{className:"".concat(r.b()," ").concat(r.is("visible",t.value)),style:n.value,onClick:function(){var t;i.value&&(i.value.scrollTo({top:i.value.scrollHeight,behavior:"smooth"}),null===(t=e.onClick)||void 0===t||t.call(e))},children:fe(dn,{className:r.e("icon")})})},fi=new ve("chat-messages"),pi=function(e){var t=Qe(null),n=g(Xe(5),2),r=n[0],i=n[1],o=g(Xe(!1),2),a=o[0],s=o[1],c=g(Xe(!0),2),l=c[0],u=c[1],d=Qe(!1),h=e.controller.messages,f=et(function(){var e=Math.max(0,h.value.length-r);return h.value.slice(e)},[h.value,r]),p=et(function(){return r<h.value.length},[h.value,r]);Ye(function(){var e;l&&((e=t.current)&&(d.current=!0,e.scrollTo({top:e.scrollHeight,behavior:"auto"}),setTimeout(function(){d.current=!1},500)))},[h.value]);return fe("div",{ref:t,className:fi.b(),onScroll:function(){if(!d.current){var e=t.current;if(e){var n=e.scrollTop,o=e.scrollHeight,c=e.clientHeight;n<100&&!a&&p&&(s(!0),setTimeout(function(){var t=Math.min(r+5,h.value.length);i(t);var n=e.scrollHeight;setTimeout(function(){var t=e.scrollHeight;e.scrollTop=t-n+e.scrollTop,s(!1)},0)},300)),u(o-(n+c)<50)}}},children:[f.map(function(t){var n,r=(null===(n=t.content)||void 0===n?void 0:n.length)||0;return"SYSTEM"!==t.role?fe(ni,{size:r,message:t,controller:e.controller,children:fe(di,{type:"content",mode:"DEFAULT",hideTopicSidebar:!1,data:t,items:e.toolbarItems,controller:e.controller})},"".concat(t.messageid,"_").concat(t.completed?"completed":"incomplete")):null}),fe(hi,{right:20,bottom:14,target:".".concat(fi.b()),onClick:function(){d.current=!0,u(!0)}})]})},vi=function(e){return e.STYLE_CACHE="ai-chat-style-cache",e.MINIMIZE_STYLY_CHCHE="ai-chat-minimize-style-cache",e.DATA_BASE_NAME="ibiz-chat",e.DATA_TABLE_NAME="history-message",e.DATA_TABLE_KEY_NAME="id",e}(vi||{});function mi(e){switch(e){case"user":default:return"USER";case"agent":return"ASSISTANT";case"system":return"SYSTEM"}}function gi(e){switch(e){case"pending":return 20;case"sent":case"canceled":default:return 30;case"failed":return 40}}function yi(e){switch(e){case"pending":case"sent":case"canceled":default:return"DEFAULT";case"failed":return"ERROR"}}var ki=function(){return S(function e(t,n){x(this,e),_(this,"evt",new p),_(this,"messages",xt([])),_(this,"materials",xt([])),_(this,"input",xt("")),_(this,"isLoading",xt(!1)),_(this,"enableKnowledgeBaseSelect",xt(!1)),_(this,"enableKnowledgeBaseState",xt(!1)),_(this,"enableRecallConfigSetting",xt(!1)),_(this,"enableAIAgentChange",!0),_(this,"activeAIAgentID",void 0),_(this,"agentList",xt([])),_(this,"context",void 0),_(this,"params",void 0),_(this,"appDataEntityId",void 0),_(this,"topicId",void 0),_(this,"topic",void 0),_(this,"aiTopic",void 0),_(this,"chatSessionid",""),_(this,"chatMode",void 0),_(this,"isDigestProcessed",!1),_(this,"knowledgeBasesList",[]),_(this,"selectionKnowledgeBases",xt([])),_(this,"knowledgeBases",xt([])),_(this,"reCallConfig",xt({chunkrerank:2,maxchunks:10,chunkthreshold:.4,chunkpageindex:void 0})),this.opts=t,this.resourceOptions=n,this.context=t.context,this.params=t.params,this.appDataEntityId=t.appDataEntityId,this.aiTopic=t.aiTopic,this.topicId=t.topicId,this.topic=t.topic,this.activeAIAgentID=t.activeAIAgentID,this.enableAIAgentChange=!!t.enableAIAgentChange,this.chatMode=t.srfMode,this.chatSessionid=t.sessionid,this.enableKnowledgeBaseSelect.value=!!t.enableKnowledgeBaseSelect,this.enableKnowledgeBaseState.value=this.enableKnowledgeBaseSelect.value,this.enableRecallConfigSetting.value=!!t.enableRecallConfigSetting,this.initAIChat()},[{key:"resourceMode",get:function(){var e;return(null===(e=this.resourceOptions)||void 0===e?void 0:e.resourceMode)||"LOCAL"}},{key:"currentTopicDisableStorage",get:function(){if(this.topicId&&this.aiTopic){var e=this.aiTopic.getCurrentTopicByID(this.topicId);if(e&&e.disableStorage)return!0}return!1}},{key:"sessionCaptionMode",get:function(){if(this.aiTopic&&this.topicId){var e=this.aiTopic.getCurrentTopicByID(this.topicId);if(e&&e.captionMode)return e.captionMode}return"default"}},{key:"sessionDefaultCaption",get:function(){if(this.aiTopic&&this.topicId){var e=this.aiTopic.getCurrentTopicByID(this.topicId);if(e&&e.caption)return e.caption}return this.opts.caption||"新会话"}},{key:"initAIChat",value:(z=m(f().m(function e(){return f().w(function(e){for(;;)switch(e.n){case 0:return this.messages.value=[],e.n=1,this.initAIChatAgent();case 1:return e.n=2,this.initAIChatKnowledge();case 2:return e.n=3,this.fecthHistory();case 3:return e.a(2)}},e,this)})),function(){return z.apply(this,arguments)})},{key:"initAIChatAgent",value:(I=m(f().m(function e(){var t,n=this;return f().w(function(e){for(;;)switch(e.n){case 0:if(this.opts.aiAgentlist&&this.opts.aiAgentlist.length>0&&this.opts.aiAgentlist.forEach(function(e){n.agentList.value=[].concat(c(n.agentList.value),[new ai(e,{chunkrerank:n.opts.reRankDefaultValue,maxchunks:n.opts.maxChunksDefaultValue,chunkthreshold:n.opts.chunkThresholdDefaultValue,chunkpageindex:n.opts.chunkPageIndexDefaultValue})])}),this.enableRecallConfigSetting.value){e.n=1;break}return e.a(2);case 1:t=this.agentList.value.find(function(e){return e.id===n.activeAIAgentID}),t&&(this.reCallConfig.value={chunkrerank:t.rerank,maxchunks:t.maxchunks,chunkthreshold:t.chunkthreshold,chunkpageindex:t.chunkpageindex});case 2:return e.a(2)}},e,this)})),function(){return I.apply(this,arguments)})},{key:"initAIChatKnowledge",value:(D=m(f().m(function e(){var t;return f().w(function(e){for(;;)switch(e.n){case 0:if(this.enableKnowledgeBaseSelect.value){e.n=1;break}return e.a(2);case 1:null!==(t=this.opts.aiknowledgeBasesList)&&void 0!==t&&t.length&&(this.knowledgeBasesList=this.opts.aiknowledgeBasesList.map(function(e){return new si(e)})),this.computeSelectedKnowledge();case 2:return e.a(2)}},e,this)})),function(){return D.apply(this,arguments)})},{key:"computeSelectedKnowledge",value:function(){var e,t=this;if(this.enableKnowledgeBaseSelect.value){var n=this.agentList.value.find(function(e){return e.id===t.activeAIAgentID});if(this.knowledgeBases.value=!n||n.allow_any_knowledge_base?c(this.knowledgeBasesList):(null===(e=n.knowledge_bases)||void 0===e?void 0:e.map(function(e){return new si({id:e.ai_knowledge_base_id,name:e.ai_knowledge_base_name})}))||[],this.opts.selectAIKnowledgeBaseId)this.selectionKnowledgeBases.value=this.knowledgeBases.value.filter(function(e){var n;return null===(n=t.opts.selectAIKnowledgeBaseId)||void 0===n?void 0:n.includes(e.id)}).map(function(e){return e.id});else if(n){var r;this.selectionKnowledgeBases.value=(null===(r=n.knowledge_bases)||void 0===r?void 0:r.map(function(e){return e.ai_knowledge_base_id}))||[]}}}},{key:"getHistoryStoreKey",value:function(e){return"".concat(e)}},{key:"getQueryKnowledgeBases",value:function(){return this.enableKnowledgeBaseSelect.value&&this.enableKnowledgeBaseState.value?this.selectionKnowledgeBases.value.join(","):void 0}},{key:"getQueryRecallConfig",value:function(){return this.enableRecallConfigSetting.value?this.reCallConfig.value:void 0}},{key:"fecthHistory",value:(A=m(f().m(function e(){var t,n,r,i=this;return f().w(function(e){for(;;)switch(e.n){case 0:if(!this.topicId){e.n=7;break}if(t={},!this.currentTopicDisableStorage){e.n=1;break}t.data=[],e.n=5;break;case 1:if("LOCAL"!==this.resourceMode){e.n=3;break}return e.n=2,Ne.getData(vi.DATA_BASE_NAME,vi.DATA_TABLE_NAME,this.getHistoryStoreKey(this.topicId));case 2:t=e.v,e.n=5;break;case 3:if("REMOTE"!==this.resourceMode||!this.resourceOptions){e.n=5;break}return e.n=4,this.resourceOptions.getMessages({n_session_id_eq:this.chatSessionid});case 4:(n=e.v)&&n.length>0&&(r=[],n.forEach(function(e){var t;r.push({messageid:(t=e).id,state:gi(t.status),type:yi(t.status),role:mi(t.sender_type),content:t.content,completed:!0,islike:t.is_like,isdislike:t.is_dislike,feedbackcontent:t.feedback_content,realmessageid:t.id,status:t.status})}),t.data=r);case 5:if(!(t&&t.data&&t.data.length>0)){e.n=7;break}return t.data.forEach(function(e){var t={messageid:e.messageid,state:e.state,type:e.type,role:e.role,islike:e.islike,isdislike:e.isdislike,feedbackcontent:e.feedbackcontent,content:e.content,suggestions:e.suggestions,completed:!0,toolcalls:e.toolcalls,realmessageid:e.realmessageid,status:e.status,chatsteps:e.chatsteps,chatuiactions:e.chatuiactions};i.addMessage(t)}),e.n=6,this.afterFecthHistory();case 6:return e.a(2,!0);case 7:return e.n=8,this.opts.history(this.context,this.params,{appDataEntityId:this.appDataEntityId,appendCurData:this.opts.appendCurData,sessionid:this.chatSessionid,srfaiagent:this.activeAIAgentID,srfmode:this.chatMode});case 8:if(!e.v){e.n=9;break}return e.n=9,this.afterFecthHistory();case 9:return e.a(2,!0)}},e,this)})),function(){return A.apply(this,arguments)})},{key:"afterFecthHistory",value:(E=m(f().m(function e(){var t,n,r,i,o,a,s,l,u=this;return f().w(function(e){for(;;)switch(e.p=e.n){case 0:if(this.opts.appendCurContent&&this.addMessage({state:30,messageid:we(),role:"USER",type:"DEFAULT",content:this.opts.appendCurContent,completed:!0,status:"sent"}),this.opts.appendCurResource&&(t=Oe.parseMixedContent(this.opts.appendCurResource),n=t.hasResources,r=t.resources,n&&r&&r.length>0&&r.forEach(function(e){u.replaceMaterial(e.id,e)})),!1===this.opts.autoQuestion){e.n=4;break}if(i=this.messages.value.length-1,!(o=this.messages.value[i])||"USER"!==o.role){e.n=4;break}return(a=this.stringlyMaterialResource(!1))&&(s=a+o.content,l=h(h({},o._origin),{},{messageid:we(),content:s}),this.messages.value[i]=new ri(l),this.messages.value=c(this.messages.value)),e.p=1,this.isLoading.value=!0,e.n=2,this.opts.question(this,this.context,this.params,{appDataEntityId:this.appDataEntityId},this.getMessages(),this.chatSessionid,this.activeAIAgentID,this.chatMode,this.getQueryKnowledgeBases(),this.getQueryRecallConfig());case 2:if(!this.opts.action){e.n=3;break}return e.n=3,this.opts.action("question",o.content);case 3:return e.p=3,this.isLoading.value=!1,e.f(3);case 4:return e.n=5,this.updateTopicCaption();case 5:return e.a(2)}},e,this,[[1,,3,4]])})),function(){return E.apply(this,arguments)})},{key:"asyncToIndexDB",value:(O=m(f().m(function e(){var t;return f().w(function(e){for(;;)switch(e.n){case 0:if(this.topicId&&"LOCAL"===this.resourceMode){e.n=1;break}return e.a(2);case 1:if(!this.currentTopicDisableStorage){e.n=2;break}return e.a(2);case 2:return t={id:this.getHistoryStoreKey(this.topicId),data:this.messages.value.map(function(e){return h(h({},e._origin),{},{toolcalls:e.toolcalls,chatsteps:e.chatsteps,chatuiactions:e.chatuiactions})}),timestamp:(new Date).getTime()},e.n=3,Ne.updateData(vi.DATA_BASE_NAME,vi.DATA_TABLE_NAME,t);case 3:return e.a(2)}},e,this)})),function(){return O.apply(this,arguments)})},{key:"setInput",value:function(e){this.input.value=e||""}},{key:"addMessage",value:function(e){var t=this.messages.value.find(function(t){return t.messageid===e.messageid});if(t)t.update(e),this.messages.value=c(this.messages.value);else{var n=new ri(e);n.update(h(h({},e),{},{content:""})),this.messages.value=[].concat(c(this.messages.value),[n])}this.asyncToIndexDB()}},{key:"completeMessage",value:(T=m(f().m(function e(t,n){var r,i;return f().w(function(e){for(;;)switch(e.n){case 0:if(!(r=this.messages.value.find(function(e){return e.messageid===t}))){e.n=1;break}return r.updateCompleted(n),this.messages.value=c(this.messages.value),e.n=1,this.asyncToIndexDB();case 1:!0===this.opts.autoFill&&"ASSISTANT"===(i=r||this.messages.value[this.messages.value.length-1]).role&&30===i.state&&this.backfill(i),this.evt.emit("onCompleteMessage",{messageid:t,completed:n});case 2:return e.a(2)}},e,this)})),function(e,t){return T.apply(this,arguments)})},{key:"replaceMessage",value:function(e){var t=this,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=[];if(e.content){var i=e.content,o=i.indexOf("<chatuiaction>"),a=i.indexOf("</chatuiaction>");-1!==o&&-1!==a&&o<a&&(e.content=i.replace(/<chatuiaction>[^]*?<\/chatuiaction>/g,""));var s=i.indexOf("<chatstep>"),l=i.indexOf("</chatstep>");-1!==s&&-1!==l&&s<l&&(r=Be.parse(e.content),e.content=i.replace(/<chatstep>[^]*?<\/chatstep>/g,""))}var u=h({},e),d=this.messages.value.findIndex(function(t){return t.messageid===e.messageid});if(-1!==d){var f;if(r.length>0)null===(f=this.messages.value[d].chatsteps)||void 0===f||f.push.apply(f,c(r));u.toolcalls=this.messages.value[d].toolcalls,u.chatsteps=this.messages.value[d].chatsteps,u.chatuiactions=this.messages.value[d].chatuiactions,this.messages.value[d].replace(e),this.messages.value=c(this.messages.value)}else{var p;if(r.length>0)e.chatsteps||(e.chatsteps=[]),(p=e.chatsteps).push.apply(p,c(r));this.messages.value=[].concat(c(this.messages.value),[new ri(e)])}this.asyncToIndexDB(),"DEFAULT"===e.type&&this.opts.recommendPrompt&&n&&this.opts.recommendPrompt(this.context,this.params,{appDataEntityId:this.appDataEntityId,message:{messages:[h(h({},e),{},{content:e.content.replace(/<think>[^]*?<\/think>/g,"")})],sessionid:this.chatSessionid,srfaiagent:this.activeAIAgentID}}).then(function(e){e&&e.content&&t.updateRecommendPrompt(u,e.content)})}},{key:"stopMessage",value:(N=m(f().m(function e(t){var n;return f().w(function(e){for(;;)switch(e.n){case 0:return n=this.messages.value.findIndex(function(e){return e.messageid===t.messageid}),t.content=t.content||"用户中断",-1!==n?(this.messages.value[n].replace(t),this.messages.value=c(this.messages.value)):this.messages.value=[].concat(c(this.messages.value),[new ri(t)]),e.n=1,this.asyncToIndexDB();case 1:return e.a(2)}},e,this)})),function(e){return N.apply(this,arguments)})},{key:"stringlyMaterialResource",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t="",n=[];return this.materials.value&&this.materials.value.length>0&&(this.materials.value.forEach(function(e){if("ossfile"===e.type){var t=e.metadata;t.state&&"successed"===t.state&&n.push(e)}else n.push(e)}),e&&(this.materials.value=[])),n&&n.length>0&&(t=Oe.stringify(n)),t}},{key:"getMessages",value:function(){var e=this.messages.value.filter(function(e){return"ERROR"!==e.type&&"canceled"!==e.status}).map(function(e){return e._origin});return e.forEach(function(e){e.content=e.content.replace(/<tool_call>[^]*?<\/tool_call>/g,"").replace(/<think>[^]*?<\/think>/g,"").trim()}),e}},{key:"getAllMessages",value:function(){return this.messages.value.map(function(e){return e._origin})}},{key:"question",value:(M=m(f().m(function e(t){var n,r=this;return f().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,this.isLoading.value=!0,this.messages.value.forEach(function(e,t){var n=e._origin;n.suggestions&&(n.suggestions=void 0,r.messages.value[t].replace(n))}),this.messages.value=c(this.messages.value),this.asyncToIndexDB(),(n=this.stringlyMaterialResource(!0))?n+="\n".concat(t):n=t,this.addMessage({state:30,messageid:we(),role:"USER",type:"DEFAULT",content:n,status:"sent"}),e.n=1,this.opts.question(this,this.context,this.params,{appDataEntityId:this.appDataEntityId},this.getMessages(),this.chatSessionid,this.activeAIAgentID,this.chatMode,this.getQueryKnowledgeBases(),this.getQueryRecallConfig());case 1:return e.n=2,this.updateTopicCaption();case 2:this.opts.action&&this.opts.action("question",t),this.isLoading.value=!1;case 3:return e.p=3,this.isLoading.value=!1,e.f(3);case 4:return e.a(2)}},e,this,[[0,,3,4]])})),function(e){return M.apply(this,arguments)})},{key:"abortQuestion",value:(C=m(f().m(function e(){return f().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,this.opts.abortQuestion(this,this.context,this.params,{appDataEntityId:this.appDataEntityId,sessionid:this.chatSessionid,srfaiagent:this.activeAIAgentID,srfmode:this.chatMode});case 1:return e.p=1,this.isLoading.value=!1,e.f(1);case 2:return e.a(2)}},e,this,[[0,,1,2]])})),function(){return C.apply(this,arguments)})},{key:"backfill",value:function(e){this.opts.action&&this.opts.action("backfill",e)}},{key:"deleteMessage",value:(b=m(f().m(function e(t){var n;return f().w(function(e){for(;;)switch(e.n){case 0:if(-1!==(n=this.messages.value.findIndex(function(e){return e.messageid===t.messageid}))&&(this.messages.value.splice(n,1),this.messages.value=c(this.messages.value)),this.asyncToIndexDB(),"REMOTE"!==this.resourceMode||!this.resourceOptions){e.n=1;break}if(!t.realmessageid){e.n=1;break}return e.n=1,this.resourceOptions.deleteMessage(t.realmessageid);case 1:this.opts.action&&this.opts.action("deletemsg",t);case 2:return e.a(2)}},e,this)})),function(e){return b.apply(this,arguments)})},{key:"refreshMessage",value:(w=m(f().m(function e(t){var n,r,i,o,a=arguments;return f().w(function(e){for(;;)switch(e.p=e.n){case 0:if(n=a.length>1&&void 0!==a[1]&&a[1],this.isLoading.value=!0,e.p=1,r=this.messages.value.findIndex(function(e){return e.messageid===t.messageid}),!n){e.n=3;break}return 40===t.state&&(i=h(h({},t._origin),{},{state:30}),this.replaceMessage(i,!1)),this.messages.value.splice(r+1,this.messages.value.length-r-1),this.messages.value=c(this.messages.value),e.n=2,this.opts.question(this,this.context,this.params,{appDataEntityId:this.appDataEntityId},this.getMessages(),this.chatSessionid,this.activeAIAgentID,this.chatMode,this.getQueryKnowledgeBases(),this.getQueryRecallConfig());case 2:e.n=6;break;case 3:if(r!==this.messages.value.length-1){e.n=5;break}return this.messages.value.pop(),this.messages.value=c(this.messages.value),e.n=4,this.opts.question(this,this.context,this.params,{appDataEntityId:this.appDataEntityId},this.getMessages(),this.chatSessionid,this.activeAIAgentID,this.chatMode,this.getQueryKnowledgeBases(),this.getQueryRecallConfig());case 4:e.n=6;break;case 5:o=this.messages.value[r-1].content,this.messages.value.splice(r-1,2),this.question(o);case 6:this.asyncToIndexDB(),this.opts.action&&this.opts.action("refreshmsg",t);case 7:return e.p=7,this.isLoading.value=!1,e.f(7);case 8:return e.a(2)}},e,this,[[1,,7,8]])})),function(e){return w.apply(this,arguments)})},{key:"copyMessage",value:function(e){var t=e.realcontent;Me.copy(t),this.opts.action&&this.opts.action("copymsg",e)}},{key:"resetTopic",value:(k=m(f().m(function e(){var t;return f().w(function(e){for(;;)switch(e.n){case 0:return t=!0,e.n=1,this.clearTopic();case 1:if(t=e.v){e.n=2;break}return e.a(2,t);case 2:return e.n=3,this.fecthHistory();case 3:return e.a(2,t)}},e,this)})),function(){return k.apply(this,arguments)})},{key:"clearTopic",value:(y=m(f().m(function e(){var t,n;return f().w(function(e){for(;;)switch(e.n){case 0:return t=!0,e.n=1,this.abortQuestion();case 1:if(!this.topicId){e.n=7;break}if(!this.topicId||!this.aiTopic){e.n=6;break}if(!this.currentTopicDisableStorage){e.n=2;break}t=!0,e.n=6;break;case 2:if("LOCAL"!==this.resourceMode){e.n=4;break}return e.n=3,Ne.deleteData(vi.DATA_BASE_NAME,vi.DATA_TABLE_NAME,this.getHistoryStoreKey(this.topicId));case 3:t=e.v,e.n=6;break;case 4:if("REMOTE"!==this.resourceMode){e.n=6;break}return e.n=5,this.aiTopic.clearMessagesByTopicId(this.topicId);case 5:t=e.v;case 6:e.n=10;break;case 7:if("REMOTE"!==this.resourceMode||!this.resourceOptions){e.n=10;break}return e.n=8,this.resourceOptions.getSessionList({n_session_id_eq:this.chatSessionid});case 8:if(!((n=e.v)&&n.length>0)){e.n=10;break}return e.n=9,this.resourceOptions.clearAllMessageBySessionId(n[0].realid);case 9:t=e.v;case 10:if(t){e.n=11;break}return e.a(2,t);case 11:return this.messages.value=[],e.a(2,t)}},e,this)})),function(){return y.apply(this,arguments)})},{key:"addMaterial",value:function(e){var t=this.materials.value.find(function(t){return t.id===e.id});this.materials.value=t?c(this.materials.value):[].concat(c(this.materials.value),[new oi(e)])}},{key:"replaceMaterial",value:function(e,t){var n=this.materials.value.findIndex(function(t){return t.id===e});-1!==n?(this.materials.value[n]=new oi(t),this.materials.value=c(this.materials.value)):this.materials.value=[].concat(c(this.materials.value),[new oi(t)])}},{key:"deleteMaterial",value:function(e){var t=this.materials.value.findIndex(function(t){return t.id===e.id});-1!==t&&(this.materials.value.splice(t,1),this.materials.value=c(this.materials.value))}},{key:"updateRecommendPrompt",value:function(e,t){if(t){var n=this.messages.value.findIndex(function(t){return t.messageid===e.messageid}),r=Ee.parseMixedContent(t).suggestions;r&&r.length>0&&(e.suggestions=r,-1!==n?(this.messages.value[n]=new ri(e),this.messages.value=c(this.messages.value)):this.messages.value=[].concat(c(this.messages.value),[new ri(e)]),this.asyncToIndexDB())}}},{key:"clearUIActions",value:(v=m(f().m(function e(t){var n,r;return f().w(function(e){for(;;)switch(e.n){case 0:-1!==(n=this.messages.value.findIndex(function(e){return e.messageid===t.messageid}))&&((r=this.messages.value[n]._origin).suggestions=void 0,this.messages.value[n].replace(r),this.messages.value=c(this.messages.value)),this.asyncToIndexDB();case 1:return e.a(2)}},e,this)})),function(e){return v.apply(this,arguments)})},{key:"handleSuggestionClick",value:(d=m(f().m(function e(t,n,r){var i,o,a,s,c,l,u,d,p,v,m,y;return f().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.n=1,this.clearUIActions(t);case 1:i=n.type,o=n.metadata,y=i,e.n="action"===y?2:"raw"===y?9:11;break;case 2:if(!this.opts.extendToolbarClick){e.n=8;break}if(s=n.data.actionid,c=n.data.appid,s){e.n=3;break}throw new Error("actionid不能为空");case 3:if(this.addMessage({messageid:we(),state:30,type:"DEFAULT",role:"USER",content:o.content_name,status:"sent"}),l=h({},t),Object.assign(l,{topic:this.topic}),l.msg.realcontent=t.realcontent,u=h({},this.context),!o.action_context){e.n=6;break}e.p=4,d=o.action_context.split(";"),(p=d.reduce(function(e,t){if(t.trim()){var n=g(t.split(":"),2),r=n[0],i=n[1];r&&i&&(e[r.trim()]=i.trim())}return e},{}))&&Object.keys(p).length>0&&Object.assign(u,h({},p)),e.n=6;break;case 5:throw e.p=5,e.v,new Error("action_context参数解析异常,正确格式如:abc:123;cde:456");case 6:return e.n=7,this.opts.extendToolbarClick(r,{id:s,isPluginApp:!!c,appId:c||this.context.srfappid},u,this.params,l);case 7:v=e.v,(m=null==v||null===(a=v.data)||void 0===a?void 0:a[0])&&m.content&&this.addMessage({messageid:we(),state:30,type:m.type||"DEFAULT",role:m.role||"ASSISTANT",content:m.content,status:"sent"});case 8:return e.a(3,12);case 9:return e.n=10,this.question(n.data.content);case 10:return e.a(3,12);case 11:throw new Error("不支持".concat(i,"推荐类型"));case 12:return e.a(2)}},e,this,[[4,5]])})),function(e,t,n){return d.apply(this,arguments)})},{key:"handleUIActionClick",value:(u=m(f().m(function e(t,n,r){var i,o,a,s,c,l,u,d,p,v,m,y,k;return f().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.n=1,this.clearUIActions(t);case 1:i=n.type,o=n.data,a=n.metadata,k=i,e.n="action"===k?2:"raw"===k?9:11;break;case 2:if(!this.opts.extendToolbarClick){e.n=8;break}if(c=o.actionid,l=o.appid,c){e.n=3;break}throw new Error("actionid不能为空");case 3:if(u=h({},t),Object.assign(u,{topic:this.topic}),u.msg.realcontent=t.realcontent,d=h({},this.context),!a.action_context){e.n=6;break}e.p=4,p=a.action_context.split(";"),(v=p.reduce(function(e,t){if(t.trim()){var n=g(t.split(":"),2),r=n[0],i=n[1];r&&i&&(e[r.trim()]=i.trim())}return e},{}))&&Object.keys(v).length>0&&Object.assign(d,h({},v)),e.n=6;break;case 5:throw e.p=5,e.v,new Error("action_context参数解析异常,正确格式如:abc:123;cde:456");case 6:return e.n=7,this.opts.extendToolbarClick(r,{id:c,isPluginApp:!!l,appId:l||this.context.srfappid},d,this.params,u);case 7:m=e.v,(y=null==m||null===(s=m.data)||void 0===s?void 0:s[0])&&y.content&&this.addMessage({messageid:we(),state:30,type:y.type||"DEFAULT",role:y.role||"ASSISTANT",content:y.content,status:"sent"});case 8:return e.a(3,12);case 9:return e.n=10,this.question(o.content);case 10:return e.a(3,12);case 11:throw new Error("不支持".concat(i,"推荐类型"));case 12:return e.a(2)}},e,this,[[4,5]])})),function(e,t,n){return u.apply(this,arguments)})},{key:"setActiveAIAgentID",value:(l=m(f().m(function e(t){var n,r=this;return f().w(function(e){for(;;)switch(e.n){case 0:if(this.activeAIAgentID!==t){e.n=1;break}return e.a(2);case 1:this.activeAIAgentID=t,this.topicId&&this.aiTopic&&this.aiTopic.updateTopicChatByID(this.topicId,{activeAIAgentID:t}),this.enableRecallConfigSetting.value&&(n=this.agentList.value.find(function(e){return e.id===r.activeAIAgentID}),n&&(this.reCallConfig.value={chunkrerank:n.rerank,maxchunks:n.maxchunks,chunkthreshold:n.chunkthreshold,chunkpageindex:n.chunkpageindex})),this.enableKnowledgeBaseSelect.value&&this.computeSelectedKnowledge();case 2:return e.a(2)}},e,this)})),function(e){return l.apply(this,arguments)})},{key:"setAIAgentConfig",value:function(e){this.reCallConfig.value=h(h({},this.reCallConfig.value),e)}},{key:"searchAIAgent",value:(s=m(f().m(function e(t){var n,r,i=this;return f().w(function(e){for(;;)switch(e.n){case 0:if(n=[],!this.opts.fetchAgentList){e.n=3;break}return e.n=1,this.opts.fetchAgentList(t);case 1:if(r=e.v){e.n=2;break}r=[];case 2:n=r.map(function(e){return new ai(e,{chunkrerank:i.opts.reRankDefaultValue,maxchunks:i.opts.maxChunksDefaultValue,chunkthreshold:i.opts.chunkThresholdDefaultValue,chunkpageindex:i.opts.chunkPageIndexDefaultValue})}),e.n=4;break;case 3:n=this.agentList.value;case 4:return e.a(2,n)}},e,this)})),function(e){return s.apply(this,arguments)})},{key:"setSelectionKnowledge",value:function(e){this.selectionKnowledgeBases.value=c(e)}},{key:"switchKnowledgeEnableState",value:function(){this.enableKnowledgeBaseState.value=!this.enableKnowledgeBaseState.value}},{key:"updateTopicCaption",value:(a=m(f().m(function e(){var t,n,r,i,o,a,s,c,l;return f().w(function(e){for(;;)switch(e.n){case 0:if(!this.topicId||!this.aiTopic){e.n=1;break}if(!(t=this.aiTopic.getCurrentTopicByID(this.topicId))||!t.captionComputed){e.n=1;break}return e.a(2);case 1:if(!0!==this.isDigestProcessed){e.n=2;break}return e.a(2);case 2:if(!(n=this.messages.value.find(function(e){return"USER"===e.role}))){e.n=10;break}if(r="",!this.sessionCaptionMode){e.n=7;break}l=this.sessionCaptionMode,e.n="snippet"===l?3:"summary"===l?4:6;break;case 3:return i=n.content,o=Oe.parseMixedContent(i),a=o.remainingText,r=a.substring(0,15),e.a(3,7);case 4:return e.n=5,this.opts.chatDigest(this.context,this.params,{appDataEntityId:this.appDataEntityId,message:{messages:this.getMessages(),sessionid:this.chatSessionid,srfaiagent:this.activeAIAgentID,mode:"title",maxtokens:this.opts.summaryMaxTokens||30}});case 5:return(s=e.v)&&s.content&&(r=s.content),e.a(3,7);case 6:return r=this.sessionDefaultCaption,e.a(3,7);case 7:if("REMOTE"!==this.resourceMode||!this.resourceOptions||this.currentTopicDisableStorage){e.n=9;break}return e.n=8,this.resourceOptions.getSessionList({n_session_id_eq:this.chatSessionid});case 8:if(!((c=e.v)&&c.length>0)){e.n=9;break}if(c[0].caption===r){e.n=9;break}return e.n=9,this.resourceOptions.updateSession(c[0].realid,{caption:r});case 9:this.topicId&&this.aiTopic&&this.aiTopic.updateTopicCaption(this.topicId,r),this.isDigestProcessed=!0;case 10:return e.a(2)}},e,this)})),function(){return a.apply(this,arguments)})},{key:"messageLike",value:(o=m(f().m(function e(t){var n,r,i;return f().w(function(e){for(;;)switch(e.n){case 0:if(n="1"===t.islike,(r=t.realmessageid)&&this.resourceOptions){e.n=1;break}return e.a(2);case 1:if(!n){e.n=3;break}return e.n=2,this.resourceOptions.cancelFeedback(r);case 2:i=e.v,e.n=5;break;case 3:return e.n=4,this.resourceOptions.likeMessage(r);case 4:i=e.v;case 5:i&&(t.islike=n?"0":"1",n||"1"!==t.isdislike||(t.isdislike="0"),this.replaceMessage(t,!1));case 6:return e.a(2)}},e,this)})),function(e){return o.apply(this,arguments)})},{key:"messageDisLike",value:(i=m(f().m(function e(t){var n,r,i,o;return f().w(function(e){for(;;)switch(e.n){case 0:if(n="1"===t.isdislike,r=t.realmessageid,i=t.feedbackcontent,r&&this.resourceOptions){e.n=1;break}return e.a(2);case 1:if(!n){e.n=3;break}return e.n=2,this.resourceOptions.cancelFeedback(r);case 2:o=e.v,e.n=5;break;case 3:return e.n=4,this.resourceOptions.dislikeMessage(r,i);case 4:o=e.v;case 5:o&&(t.isdislike=n?"0":"1",n||"1"!==t.islike||(t.islike="0"),this.replaceMessage(t,!1));case 6:return e.a(2)}},e,this)})),function(e){return i.apply(this,arguments)})},{key:"handlePredefinedClick",value:(r=m(f().m(function e(t,n,r,i){var o,a,s;return f().w(function(e){for(;;)switch(e.n){case 0:s=t,e.n="chunkview"===s?1:"view"===s?5:"action"===s?7:9;break;case 1:if(o=n.replace("chunkview://",""),this.opts.chunkView){e.n=2;break}return console.error("文档分片查看界面不存在,请确认chunkView是否配置"),e.a(2);case 2:if(this.opts.chunkEntity){e.n=3;break}return console.error("文档分片实体标识不存在,请确认chunkEntity是否配置"),e.a(2);case 3:return a="view://".concat(this.opts.chunkView,'?srfnavctx={"').concat(this.opts.chunkEntity,'":"').concat(o,'"}'),e.n=4,this.handlePredefViewClick(a,r,i);case 4:case 6:case 8:return e.a(3,9);case 5:return e.n=6,this.handlePredefViewClick(n,r,i);case 7:return e.n=8,this.handlePredefActionClick(n,r,i);case 9:return e.a(2)}},e,this)})),function(e,t,n,i){return r.apply(this,arguments)})},{key:"handlePredefViewClick",value:(n=m(f().m(function e(t,n,r){return f().w(function(e){for(;;)switch(e.n){case 0:if(this.opts.openLinkView){e.n=1;break}return e.a(2);case 1:return e.n=2,this.opts.openLinkView(t,n,r);case 2:return e.a(2)}},e,this)})),function(e,t,r){return n.apply(this,arguments)})},{key:"handlePredefActionClick",value:(t=m(f().m(function e(t,n,r){var i,o,a,s,c,l,u,d,p,v,m,g;return f().w(function(e){for(;;)switch(e.n){case 0:if(this.opts.extendToolbarClick){e.n=1;break}return e.a(2);case 1:if(o=_e(t),a=o.typeId,s=o.context,c=o.params,l=a,u=s.appid,l){e.n=2;break}throw new Error("actionid不能为空");case 2:return d=h({},n),Object.assign(d,{topic:this.topic}),d.msg.realcontent=n.realcontent,p=h({},this.context),s&&Object.keys(s).length>0&&Object.assign(p,h({},s)),v=h({},this.params),c&&Object.keys(c).length>0&&Object.assign(v,h({},c)),e.n=3,this.opts.extendToolbarClick(r,{id:l,isPluginApp:!!u,appId:u||this.context.srfappid},p,v,d);case 3:m=e.v,(g=null==m||null===(i=m.data)||void 0===i?void 0:i[0])&&g.content&&this.addMessage({messageid:we(),state:30,type:g.type||"DEFAULT",role:g.role||"ASSISTANT",content:g.content,status:"sent"});case 4:return e.a(2)}},e,this)})),function(e,n,r){return t.apply(this,arguments)})},{key:"destroyed",value:(e=m(f().m(function e(){return f().w(function(e){for(;;)switch(e.n){case 0:this.evt.reset();case 1:return e.a(2)}},e,this)})),function(){return e.apply(this,arguments)})}]);var e,t,n,r,i,o,a,s,l,u,d,v,y,k,w,b,C,M,N,T,O,E,A,D,I,z}(),wi=function(){return S(function e(t){x(this,e),_(this,"topics",xt([])),_(this,"activedTopic",xt(void 0)),_(this,"topicSidebarCollapse",xt(!1)),_(this,"topicSidebarWidth",xt(0)),_(this,"isTempChat",xt(!1)),_(this,"backupOptions",void 0),_(this,"preActivedTopic",void 0),_(this,"remoteSessionList",[]),_(this,"resourceMode","LOCAL"),_(this,"resourceOptions",void 0),this.chat=t,this.computeTopicSidebarWidth()},[{key:"setActivedTopic",value:function(e){this.preActivedTopic=this.activedTopic.value,this.activedTopic.value=e}},{key:"injectResourceOptions",value:function(e){this.resourceMode=(null==e?void 0:e.resourceMode)||"LOCAL",this.resourceOptions=e}},{key:"fetchHistory",value:(d=m(f().m(function e(t){var n,r,i=this;return f().w(function(e){for(;;)switch(e.n){case 0:return this.topics.value=[],n=t.configService(t.appid,"aitopics",t.type),e.n=1,n.load();case 1:if(!((r=e.v)&&r.length>0)){e.n=5;break}if("REMOTE"!==this.resourceMode||!this.resourceOptions){e.n=4;break}return e.n=2,this.resourceOptions.getSessionList();case 2:return this.remoteSessionList=e.v,e.n=3,this.asyncRemoteSession(r);case 3:e.n=5;break;case 4:r.forEach(function(e,t){Object.prototype.hasOwnProperty.call(e,"sequence")||(e.sequence=t),Object.prototype.hasOwnProperty.call(e,"isTop")||(e.isTop=0),i.topics.value=[].concat(c(i.topics.value),[new ii(e)])});case 5:return e.a(2)}},e,this)})),function(e){return d.apply(this,arguments)})},{key:"asyncRemoteSession",value:(u=m(f().m(function e(t){var n=this;return f().w(function(e){for(;;)switch(e.n){case 0:if(this.remoteSessionList&&0!==this.remoteSessionList.length&&t&&0!==t.length){e.n=1;break}return e.a(2);case 1:this.remoteSessionList.forEach(function(e){var r=t.find(function(t){var n;return(null===(n=t.aiChat)||void 0===n?void 0:n.sessionid)===e.session_id});if(r){r.realid=e.realid,r.sequence=e.sequence,r.isTop=e.is_top?e.is_top:0,e.caption&&(r.caption=e.caption);var i=n.topics.value.findIndex(function(t){var n;return(null===(n=t.aiChat)||void 0===n?void 0:n.sessionid)===e.session_id});-1===i?n.topics.value=[].concat(c(n.topics.value),[new ii(r)]):(n.topics.value.splice(i,1,new ii(r)),n.topics.value=c(n.topics.value))}});case 2:return e.a(2)}},e,this)})),function(e){return u.apply(this,arguments)})},{key:"asyncTopic",value:(l=m(f().m(function e(t){var n,r;return f().w(function(e){for(;;)switch(e.n){case 0:return this.backupOptions=t,n=this.topics.value.findIndex(function(e){return e.id===t.id}),r=new ii(t),-1!==n?this.topics.value.splice(n,1,r):this.topics.value=[].concat(c(this.topics.value),[r]),e.n=1,this.updateTopic(t);case 1:this.setActivedTopic(r);case 2:return e.a(2)}},e,this)})),function(e){return l.apply(this,arguments)})},{key:"getCurrentTopicByID",value:function(e){var t=this.topics.value.find(function(t){return t.id===e});return t&&t.data?new ii(h({},t.data)):void 0}},{key:"updateTopicChatByID",value:(s=m(f().m(function e(t,n){var r;return f().w(function(e){for(;;)switch(e.n){case 0:if(t&&n&&this.backupOptions){e.n=1;break}return e.a(2);case 1:if(-1!==(r=this.topics.value.findIndex(function(e){return e.id===t}))&&this.topics.value[r].data.aiChat){e.n=2;break}return e.a(2);case 2:return this.topics.value[r].data.aiChat=h(h({},this.topics.value[r].data.aiChat),n),e.n=3,this.updateTopic(this.backupOptions);case 3:return e.a(2)}},e,this)})),function(e,t){return s.apply(this,arguments)})},{key:"removeTopic",value:(a=m(f().m(function e(t,n,r,i,o){var a,s,l,u,d;return f().w(function(e){for(;;)switch(e.n){case 0:if(s=!0,!t.beforeDelete){e.n=2;break}return e.n=1,t.beforeDelete(n,r,i,o);case 1:s=e.v;case 2:if(s){e.n=3;break}return e.a(2);case 3:if(l=!1,!i||!i.disableStorage){e.n=4;break}l=!0,e.n=12;break;case 4:if("LOCAL"!==this.resourceMode){e.n=6;break}return e.n=5,Ne.deleteData(vi.DATA_BASE_NAME,vi.DATA_TABLE_NAME,i.id);case 5:l=e.v,e.n=12;break;case 6:if("REMOTE"!==this.resourceMode||!this.resourceOptions){e.n=12;break}if(!i.realid){e.n=8;break}return e.n=7,this.resourceOptions.deleteSession(i.realid);case 7:l=e.v,e.n=12;break;case 8:if(!i.aiChat||!i.aiChat.sessionid){e.n=12;break}return e.n=9,this.resourceOptions.getSessionList({n_session_id_eq:i.aiChat.sessionid});case 9:if(!((u=e.v)&&u.length>0)){e.n=11;break}return e.n=10,this.resourceOptions.deleteSession(u[0].realid);case 10:l=e.v,e.n=12;break;case 11:l=!0;case 12:if(l){e.n=13;break}return e.a(2);case 13:return-1!==(d=this.topics.value.findIndex(function(e){return e.id===i.id}))&&(this.topics.value.splice(d,1),this.topics.value=c(this.topics.value)),e.n=14,this.updateTopic(t);case 14:this.topics.value.length>0&&i.id===(null===(a=this.activedTopic.value)||void 0===a?void 0:a.id)&&this.handleTopicChange(this.topics.value[0]);case 15:return e.a(2)}},e,this)})),function(e,t,n,r,i){return a.apply(this,arguments)})},{key:"handleTopicChange",value:function(e){var t;(null===(t=this.activedTopic.value)||void 0===t?void 0:t.id)!==e.id&&(this.setActivedTopic(e),this.chat.switchAiChatController(e))}},{key:"handleTopicAction",value:(o=m(f().m(function e(t,n,r){var i,o,a,s,l,u,d,h;return f().w(function(e){for(;;)switch(e.n){case 0:if(i=this.topics.value.find(function(e){return e.id===n.id}),!(this.backupOptions&&i&&i.aiChat)){e.n=10;break}s=i.aiChat,l=s.context,u=s.params,h=t,e.n="DELETE"===h?1:"RENAME"===h||"PINNED"===h?3:9;break;case 1:return e.n=2,this.removeTopic(this.backupOptions,l,u,i,r);case 2:return e.a(3,9);case 3:if("PINNED"===t&&(n.data.isTop=0===n.data.isTop?1:0,this.topics.value=c(this.topics.value)),!n||n.disableStorage){e.n=8;break}return e.n=4,this.updateTopic(this.backupOptions);case 4:if(!n||"REMOTE"!==this.resourceMode||!this.resourceOptions){e.n=8;break}if(!n.realid){e.n=6;break}return e.n=5,this.resourceOptions.updateSession(n.realid,{caption:n.caption,is_top:n.isTop});case 5:e.n=8;break;case 6:if(!n.aiChat||!n.aiChat.sessionid){e.n=8;break}return e.n=7,this.resourceOptions.getSessionList({n_session_id_eq:n.aiChat.sessionid});case 7:if(!((d=e.v)&&d.length>0)){e.n=8;break}return e.n=8,this.resourceOptions.updateSession(d[0].realid,{caption:n.caption,is_top:n.isTop});case 8:return e.a(3,9);case 9:null===(o=(a=this.backupOptions).action)||void 0===o||o.call(a,t,l,u,n,r);case 10:return e.a(2)}},e,this)})),function(e,t,n){return o.apply(this,arguments)})},{key:"clearMessagesByTopicId",value:(i=m(f().m(function e(t){var n,r,i,o;return f().w(function(e){for(;;)switch(e.n){case 0:if(n=!0,t&&this.backupOptions){e.n=1;break}return e.a(2,n);case 1:if(-1!==(r=this.topics.value.findIndex(function(e){return e.id===t}))&&this.topics.value[r].data){e.n=2;break}return e.a(2,n);case 2:if(i=this.topics.value[r]){e.n=3;break}return e.a(2,n);case 3:if(!i.disableStorage){e.n=4;break}return e.a(2,n);case 4:if("REMOTE"!==this.resourceMode||!this.resourceOptions){e.n=10;break}if(!i.realid){e.n=6;break}return e.n=5,this.resourceOptions.clearAllMessageBySessionId(i.realid);case 5:n=e.v,e.n=9;break;case 6:if(!i.aiChat||!i.aiChat.sessionid){e.n=9;break}return e.n=7,this.resourceOptions.getSessionList({n_session_id_eq:i.aiChat.sessionid});case 7:if(!((o=e.v)&&o.length>0)){e.n=9;break}return e.n=8,this.resourceOptions.clearAllMessageBySessionId(o[0].realid);case 8:n=e.v;case 9:if(n){e.n=10;break}return e.a(2,n);case 10:return e.a(2,n)}},e,this)})),function(e){return i.apply(this,arguments)})},{key:"newTopic",value:(r=m(f().m(function e(t,n){var r,i,o,a,s,l,u,d;return f().w(function(e){for(;;)switch(e.n){case 0:if(t){e.n=1;break}return e.a(2);case 1:if(r=this.getCurrentTopicByID(t)){e.n=2;break}return e.a(2);case 2:if(i=be(r.id),o=this.topics.value.filter(function(e){return e.id.startsWith(i)}),n&&r.aiChat&&(r.data.aiChat=h(h({},r.aiChat),n)),a="",a="default"===r.captionMode?"".concat(null===(s=r.sourceCaption)||void 0===s?void 0:s.split("_")[0],"_").concat(o.length):"新会话",l=Math.max.apply(Math,c(this.topics.value.map(function(e){return e.sequence}))),u={appid:r.appid,id:"".concat(i,"@").concat(Date.now()),type:r.type,captionMode:r.captionMode,caption:a,sourceCaption:r.sourceCaption,url:r.url,aiChat:r.aiChat,sequence:l+1,isTop:0,disableStorage:r.disableStorage},d=new ii(u),this.topics.value=[].concat(c(this.topics.value),[d]),!this.backupOptions){e.n=3;break}return e.n=3,this.updateTopic(this.backupOptions);case 3:this.handleTopicChange(d);case 4:return e.a(2)}},e,this)})),function(e,t){return r.apply(this,arguments)})},{key:"clearTopic",value:(n=m(f().m(function e(){var t,n,r,i,o,a=this;return f().w(function(e){for(;;)switch(e.n){case 0:if(t=this.topics.value.find(function(e){var t;return e.id===(null===(t=a.activedTopic.value)||void 0===t?void 0:t.id)}),this.backupOptions&&t){e.n=1;break}return e.a(2);case 1:if(n=!0,!this.backupOptions.beforeDelete){e.n=3;break}return e.n=2,this.backupOptions.beforeDelete(t.aiChat.context,t.aiChat.params,t,void 0,!0);case 2:n=e.v;case 3:if(n){e.n=4;break}return e.a(2);case 4:if(r=!1,"LOCAL"!==this.resourceMode){e.n=6;break}return e.n=5,Promise.all(this.topics.value.map(function(e){if(e.id!==(null==t?void 0:t.id)&&!e.disableStorage)return Ne.deleteData(vi.DATA_BASE_NAME,vi.DATA_TABLE_NAME,e.id)}));case 5:r=!0,e.n=11;break;case 6:if("REMOTE"!==this.resourceMode){e.n=11;break}if(!t||!this.resourceOptions){e.n=10;break}if(!(o=null===(i=t.aiChat)||void 0===i?void 0:i.sessionid)){e.n=8;break}return e.n=7,this.resourceOptions.clearAllSession(o);case 7:r=e.v,e.n=9;break;case 8:r=!0;case 9:e.n=11;break;case 10:r=!0;case 11:if(r){e.n=12;break}return e.a(2);case 12:return this.topics.value=t?[t]:[],e.n=13,this.updateTopic(this.backupOptions);case 13:return e.a(2)}},e,this)})),function(){return n.apply(this,arguments)})},{key:"updateTopicCaption",value:(t=m(f().m(function e(t,n){var r;return f().w(function(e){for(;;)switch(e.n){case 0:if(!(r=this.topics.value.find(function(e){return e.id===t}))||r.caption===n){e.n=1;break}if(r.data.caption=n,r.data.captionComputed=!0,this.topics.value=c(this.topics.value),!this.backupOptions){e.n=1;break}return e.n=1,this.updateTopic(this.backupOptions);case 1:return e.a(2)}},e,this)})),function(e,n){return t.apply(this,arguments)})},{key:"updateTopic",value:(e=m(f().m(function e(t){var n,r;return f().w(function(e){for(;;)switch(e.n){case 0:if(t){e.n=1;break}return e.a(2);case 1:return n=[],this.topics.value.forEach(function(e){e.disableStorage||n.push({appid:e.appid,id:e.id,type:e.type,captionMode:e.captionMode,captionComputed:!!e.captionComputed,caption:e.caption||e.sourceCaption,sourceCaption:e.sourceCaption,url:e.url,aiChat:e.aiChat,isTop:e.isTop,sequence:e.sequence})}),r=t.configService(t.appid,"aitopics",t.type),e.n=2,null==r?void 0:r.save(n);case 2:return e.a(2)}},e,this)})),function(t){return e.apply(this,arguments)})},{key:"computeTopicSidebarWidth",value:function(){this.topicSidebarWidth.value=!0===this.topicSidebarCollapse.value?42:200}},{key:"switchTopicSidebarCollapse",value:function(){this.topicSidebarCollapse.value=!this.topicSidebarCollapse.value,this.computeTopicSidebarWidth()}},{key:"globalNewTopic",value:function(){if(this.activedTopic.value)if(this.isTempChat.value){if(!this.backupOptions)return;this.exitTempChat();var e=this.backupOptions.aiChat;this.newTopic(this.backupOptions.id,{activeAIAgentID:e.activeAIAgentID,sessionid:"".concat(be(e.sessionid),"@").concat((new Date).getTime())})}else{var t=this.activedTopic.value.aiChat;this.newTopic(this.activedTopic.value.id,{activeAIAgentID:t.activeAIAgentID,sessionid:"".concat(be(t.sessionid),"@").concat((new Date).getTime())})}}},{key:"enterTempChat",value:function(){if(this.isTempChat.value=!0,this.backupOptions){var e=be(this.backupOptions.id),t=Se("TEMP"),n=Math.max.apply(Math,c(this.topics.value.map(function(e){return e.sequence}))),r=h(h({},this.backupOptions.aiChat),{},{sessionid:t}),i={appid:this.backupOptions.appid,id:"".concat(e,"@").concat(Date.now()),type:this.backupOptions.type,captionMode:this.backupOptions.captionMode,caption:"临时会话",sourceCaption:"临时会话",url:this.backupOptions.url,aiChat:r,sequence:n+1,isTop:0,disableStorage:!0,isShow:!1},o=new ii(i);this.topics.value=[].concat(c(this.topics.value),[o]),this.handleTopicChange(o)}else console.error("临时会话失败,无话题配置备份配置")}},{key:"exitTempChat",value:function(){this.isTempChat.value=!1;var e=this.topics.value.findIndex(function(e){return!0===e.disableStorage&&!1===e.isShow});-1!==e&&(this.topics.value.splice(e,1),this.topics.value=c(this.topics.value))}}]);var e,t,n,r,i,o,a,s,l,u,d}(),bi=S(function e(t){x(this,e),this.aiChat=t}),xi=function(e){function t(){return x(this,t),r(this,t,arguments)}return a(t,e),S(t,[{key:"excuteAction",value:(n=m(f().m(function e(t,n){var r,i,o=this;return f().w(function(e){for(;;)switch(e.n){case 0:if(!n||!n.onClick||"function"!=typeof n.onClick){e.n=2;break}return e.n=1,n.onClick(t,n,this.aiChat.context,this.aiChat.params);case 1:r=e.v,e.n=5;break;case 2:if(!(i=this.aiChat.opts.extendToolbarClick)){e.n=4;break}return e.n=3,i(t,n,this.aiChat.context,this.aiChat.params,{});case 3:r=e.v,e.n=5;break;case 4:console.error("未找到扩展工具栏点击事件");case 5:r&&r.data&&r.data.length>0&&r.data.forEach(function(e){var t={id:e.id,type:e.type,data:e.data||{},metadata:e.metadata||{}};n.id&&Object.assign(t.metadata,{actionId:n.id}),o.aiChat.addMaterial(t)});case 6:return e.a(2)}},e,this)})),function(e,t){return n.apply(this,arguments)})}]);var n}(bi),Ci=function(e){function t(){return x(this,t),r(this,t,arguments)}return a(t,e),S(t,[{key:"excuteAction",value:(n=m(f().m(function e(t,n){var r,i,o,a,s,c,l,u,d,h,p,v,g,y=this;return f().w(function(e){for(;;)switch(e.n){case 0:r=this.aiChat.opts.uploader,i=r.folder,o=r.accept,a=r.maxSize,s=r.multiple,c=r.onError,l=r.onSelect,u=r.onUpload,d=r.onSuccess,h=r.onDownLoad,p=r.onProgress,v=r.globalDownloadPrifix,g={folder:i,globalDownloadPrifix:v,multiple:s||!0,accept:o||"*/*",maxSize:a||5242880,onSelect:function(e){null==l||l(e),e.length>0&&e.forEach(function(e){var t=y.buildMaterialObject(i,e);Object.assign(t.metadata,{state:"uploading"}),y.aiChat.addMaterial(t)})},onUpload:function(){var e=m(f().m(function e(t,n){return f().w(function(e){for(;;)if(0===e.n)return e.a(2,u(t,n,{context:y.aiChat.context,params:y.aiChat.params}))},e)}));return function(t,n){return e.apply(this,arguments)}}(),onDownLoad:h,onSuccess:function(e,t){var n={id:e.id,type:"ossfile",data:{id:e.id,name:e.name,folder:i},metadata:{ext:e.ext,fileext:e.fileext,fileid:e.fileid,filename:e.filename,size:e.size,filesize:e.filesize,state:"successed",folder:i}};y.aiChat.replaceMaterial(t.name,n),null==d||d(e,t)},onError:function(e,t){var n=y.buildMaterialObject(i,t);Object.assign(n.metadata,{state:"failed"}),y.aiChat.replaceMaterial(t.name,n),null==c||c(e,t)},onProgress:function(e,t){null==p||p(e,t)}},new Te(g).openFilePicker();case 1:return e.a(2)}},e,this)})),function(e,t){return n.apply(this,arguments)})},{key:"buildMaterialObject",value:function(e,t){return{id:t.name,type:"ossfile",data:{name:t.name,id:t.name,folder:e},metadata:{size:t.size,type:t.type,lastModified:t.lastModified,folder:e}}}}]);var n}(bi),Si=function(){return S(function e(){x(this,e)},null,[{key:"getMaterialHelper",value:function(e,t){return"ossfile"===e?new Ci(t):new xi(t)}}])}(),_i=function(){return S(function e(){x(this,e),_(this,"container",void 0),_(this,"mode","DEFAULT"),_(this,"resourceOptions",void 0),_(this,"backupChatOptions",void 0),_(this,"aiTopic",void 0),_(this,"aiTopicMap",new Map),this.aiTopic=new wi(this)},[{key:"aiChat",get:function(){var e;return this.aiTopicMap.get("".concat(null===(e=this.aiTopic.activedTopic.value)||void 0===e?void 0:e.id))}},{key:"initIndexDB",value:(t=m(f().m(function e(){return f().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,Ne.checkTableExists(vi.DATA_BASE_NAME,vi.DATA_TABLE_NAME);case 1:if(e.v){e.n=2;break}return e.n=2,Ne.createTable(vi.DATA_BASE_NAME,vi.DATA_TABLE_NAME,vi.DATA_TABLE_KEY_NAME,!1);case 2:return e.a(2)}},e)})),function(){return t.apply(this,arguments)})},{key:"create",value:(e=m(f().m(function e(t){var n,r,i,o,a,s,c,l,u,d,h,p,v,m=this;return f().w(function(e){for(;;)switch(e.n){case 0:if(this.resourceOptions=t.resourceOptions,"LOCAL"!==((null===(n=t.resourceOptions)||void 0===n?void 0:n.resourceMode)||"LOCAL")){e.n=1;break}return e.n=1,this.initIndexDB();case 1:if(this.backupChatOptions=t,this.close(),this.container=document.createElement("div"),this.container.classList.add("ibiz-ai-chat"),document.body.appendChild(this.container),c=t.chatOptions,de($(zp,{mode:t.mode?t.mode:"DEFAULT",containerOptions:t.containerOptions,caption:t.mode&&"TOPIC"===t.mode?"AI助手":c.caption,autoClose:null===(r=t.containerOptions)||void 0===r?void 0:r.autoClose,openMode:null===(i=t.containerOptions)||void 0===i?void 0:i.openMode,hideTopicSidebar:(null===(o=t.topicOptions)||void 0===o?void 0:o.hideTopicSidebar)||!1,close:function(){m.close(),c&&c.closed&&c.closed(c.context,c.params,[])},fullscreen:function(e){c&&c.fullscreen&&c.fullscreen(e,c.context,c.params)},minimize:function(e){c&&c.minimize&&c.minimize(e,c.context,c.params)},isLoading:!0}),this.container),c.aiAgentlist||!c.fetchAgentList){e.n=3;break}return e.n=2,c.fetchAgentList();case 2:c.aiAgentlist=e.v;case 3:if(c.aiknowledgeBasesList||!c.fetchKnowledgeBaseList||!c.enableKnowledgeBaseSelect){e.n=5;break}return e.n=4,c.fetchKnowledgeBaseList();case 4:c.aiknowledgeBasesList=e.v,e.n=6;break;case 5:c.aiknowledgeBasesList=[];case 6:if(!t.mode||"TOPIC"!==t.mode){e.n=9;break}return this.aiTopic.injectResourceOptions(t.resourceOptions),e.n=7,this.aiTopic.fetchHistory(t.topicOptions);case 7:return l=t.topicOptions,Object.assign(l,{aiChat:{caption:c.caption,context:c.context,params:c.params,appDataEntityId:c.appDataEntityId,sessionid:c.sessionid,contentToolbarItems:c.contentToolbarItems,footerToolbarItems:c.footerToolbarItems,questionToolbarItems:c.questionToolbarItems,otherToolbarItems:c.otherToolbarItems,appendCurData:c.appendCurData,appendCurContent:c.appendCurContent,enableAIAgentChange:c.enableAIAgentChange,activeAIAgentID:c.activeAIAgentID,aiAgentlist:c.aiAgentlist,srfMode:c.srfMode,appendCurResource:c.appendCurResource}}),this.syncHistoryOptions(l,c,t.resourceOptions),e.n=8,this.aiTopic.asyncTopic(l);case 8:e.n=10;break;case 9:this.aiTopic.setActivedTopic(void 0);case 10:return Object.assign(c,{topicId:null===(a=l)||void 0===a?void 0:a.id,topic:l,aiTopic:this.aiTopic}),u=new ki(c,this.resourceOptions),this.aiTopicMap.set("".concat(null===(s=l)||void 0===s?void 0:s.id),u),t.mode&&"TOPIC"===t.mode&&this.aiTopic.isTempChat.value?this.aiTopic.enterTempChat():de($(zp,{aiChat:u,aiTopic:this.aiTopic,mode:t.mode?t.mode:"DEFAULT",containerOptions:t.containerOptions,caption:t.mode&&"TOPIC"===t.mode?"AI助手":c.caption,enableBackFill:null===(d=t.containerOptions)||void 0===d?void 0:d.enableBackFill,contentToolbarItems:c.contentToolbarItems,footerToolbarItems:c.footerToolbarItems,questionToolbarItems:c.questionToolbarItems,autoClose:null===(h=t.containerOptions)||void 0===h?void 0:h.autoClose,openMode:null===(p=t.containerOptions)||void 0===p?void 0:p.openMode,hideTopicSidebar:(null===(v=t.topicOptions)||void 0===v?void 0:v.hideTopicSidebar)||!1,close:function(){m.close(),c.closed&&c.closed(c.context,c.params,u.getAllMessages())},fullscreen:function(e){c.fullscreen&&c.fullscreen(e,c.context,c.params)},minimize:function(e){c.minimize&&c.minimize(e,c.context,c.params)},isLoading:!1}),this.container),e.a(2,u)}},e,this)})),function(t){return e.apply(this,arguments)})},{key:"syncHistoryOptions",value:function(e,t,n){if(e.disableStorage){var r=Se("TEMP");return t.sessionid=r,e.aiChat.sessionid=r,e.caption="临时会话",void(e.sourceCaption="临时会话")}var i=this.aiTopic.getCurrentTopicByID(e.id);if(i&&(e.sequence=i.sequence,e.isTop=i.isTop),i&&i.aiChat&&i.aiChat.activeAIAgentID)t.activeAIAgentID=i.aiChat.activeAIAgentID,e.aiChat.activeAIAgentID=i.aiChat.activeAIAgentID;else if(t.aiAgentlist&&t.aiAgentlist.length>0&&!t.activeAIAgentID){var o=t.aiAgentlist.find(function(e){return 1===e.default});o?(t.activeAIAgentID=o.id,e.aiChat.activeAIAgentID=o.id):(t.activeAIAgentID=t.aiAgentlist[0].id,e.aiChat.activeAIAgentID=t.aiAgentlist[0].id)}i&&i.aiChat&&i.aiChat.sessionid&&(t.sessionid=i.aiChat.sessionid,e.aiChat.sessionid=i.aiChat.sessionid);var a=n.resourceMode;"LOCAL"===a?"default"!==e.captionMode?(e.sourceCaption="新会话",i&&i.caption?e.caption=i.caption:e.caption="新会话"):e.sourceCaption=e.caption:"REMOTE"===a&&(e.sourceCaption=e.caption,i&&i.caption&&(e.caption=i.caption)),i&&(e.captionComputed=!!i.captionComputed),"REMOTE"===a&&i&&i.realid&&(e.realid=i.realid)}},{key:"switchAiChatController",value:function(e){var t=this,n=h({},this.backupChatOptions.chatOptions);e.aiChat&&Object.assign(n,{caption:e.aiChat.caption,context:e.aiChat.context,params:e.aiChat.params,sessionid:e.aiChat.sessionid,contentToolbarItems:e.aiChat.contentToolbarItems,footerToolbarItems:e.aiChat.footerToolbarItems,questionToolbarItems:e.aiChat.questionToolbarItems,otherToolbarItems:e.aiChat.otherToolbarItems,appendCurData:e.aiChat.appendCurData,appendCurContent:e.aiChat.appendCurContent,aiAgentlist:e.aiChat.aiAgentlist,activeAIAgentID:e.aiChat.activeAIAgentID,enableAIAgentChange:e.aiChat.enableAIAgentChange,srfMode:e.aiChat.srfMode,appendCurResource:e.aiChat.appendCurResource,appDataEntityId:e.aiChat.appDataEntityId,topicId:e.id,topic:e,aiTopic:this.aiTopic,extendToolbarClick:this.backupChatOptions.chatOptions.extendToolbarClick,recommendPrompt:this.backupChatOptions.chatOptions.recommendPrompt,chatDigest:this.backupChatOptions.chatOptions.chatDigest,openLinkView:this.backupChatOptions.chatOptions.openLinkView});var r,i,o,a,s,c,l,u=new ki(n,this.resourceOptions);(this.aiTopicMap.set("".concat(e.id),u),this.container)&&(de(null,this.container),de($(zp,{aiChat:u,aiTopic:this.aiTopic,mode:null!==(r=this.backupChatOptions)&&void 0!==r&&r.mode?this.backupChatOptions.mode:"DEFAULT",containerOptions:null===(i=this.backupChatOptions)||void 0===i?void 0:i.containerOptions,caption:null!==(o=this.backupChatOptions)&&void 0!==o&&o.mode&&"TOPIC"===this.backupChatOptions.mode?"AI助手":n.caption,enableBackFill:null===(a=this.backupChatOptions)||void 0===a||null===(a=a.containerOptions)||void 0===a?void 0:a.enableBackFill,contentToolbarItems:n.contentToolbarItems,footerToolbarItems:n.footerToolbarItems,questionToolbarItems:n.questionToolbarItems,autoClose:null===(s=this.backupChatOptions)||void 0===s||null===(s=s.containerOptions)||void 0===s?void 0:s.autoClose,openMode:null===(c=this.backupChatOptions)||void 0===c||null===(c=c.containerOptions)||void 0===c?void 0:c.openMode,hideTopicSidebar:(null===(l=this.backupChatOptions)||void 0===l||null===(l=l.topicOptions)||void 0===l?void 0:l.hideTopicSidebar)||!1,close:function(){t.close(),n.closed&&n.closed(n.context,n.params,u.getAllMessages())},fullscreen:function(e){n.fullscreen&&n.fullscreen(e,n.context,n.params)},minimize:function(e){n.minimize&&n.minimize(e,n.context,n.params)},isLoading:!1}),this.container))}},{key:"hidden",value:function(){this.container&&(this.container.style.display="none")}},{key:"show",value:function(){this.container&&(this.container.style.display="flex")}},{key:"close",value:function(){this.container&&(de(null,this.container),this.container.remove(),this.container=void 0),this.aiTopicMap.forEach(function(e){e.destroyed()})}}]);var e,t}(),Mi=(t("chat",new _i),new ve("chat-input-material")),Ni=function(e){var t=e.controller.materials;return fe("div",{className:Mi.b(),children:t.value.map(function(t){return fe(Ur,{material:t,disabled:!1,controller:e.controller},t.id)})})},Ti=function(e){var t=e.triggerMode,n=e.children,r=e.actions,i=e.content,o=e.position,a=void 0===o?"bottom":o,s=e.isOpen,c=e.onToggleOpen,l=e.onAction,u=new ve("pop"),d=nt(Ip),f=g(Xe(s||!1),2),p=f[0],v=f[1],m=Qe(null),y=Qe(null),k=Qe(null);Ye(function(){void 0!==s&&v(s)},[s]),Ye(function(){return y.current||(y.current=document.createElement("div"),y.current.className=u.b("content-container"),document.body.appendChild(y.current)),function(){y.current&&document.body.removeChild(y.current)}},[]),Ye(function(){var e=function(e){!m.current||m.current.contains(e.target)||e.target.closest(".".concat(u.b()))||e.target.closest(".ibiz-quick-edit")||e.target.closest(".ibiz-picker__transfer")||(v(!1),null==c||c(!1))};return p&&document.addEventListener("mousedown",e),function(){document.removeEventListener("mousedown",e)}},[p,c]);var w=function(){k.current&&"hover"===t&&(clearTimeout(k.current),k.current=null)},b=function(){"hover"===t&&(w(),k.current=setTimeout(function(){v(!1),null==c||c(!1)},100))};return fe("span",{className:"".concat(u.b("trigger-container")),children:[fe("span",{className:"".concat(u.b("trigger-element")),ref:m,onClick:function(e){!function(e){if("click"===t){e.stopPropagation();var n=!p;v(n),null==c||c(n)}}(e)},onMouseEnter:function(e){!function(e){if("hover"===t){e.stopPropagation(),w();var n=!0;v(n),null==c||c(n)}}(e)},onMouseLeave:function(e){e.stopPropagation(),b()},children:n}),p&&y.current&&mr(fe("div",{className:"".concat(u.b()," pop-").concat(a),style:function(){if(!m.current)return{};var e=m.current.getBoundingClientRect(),t={position:"absolute",zIndex:d.zIndex+1},n={bottom:{top:e.bottom+window.scrollY,left:e.left+window.scrollX},top:{bottom:window.innerHeight-e.top+window.scrollY,left:e.left+window.scrollX},left:{top:e.top+window.scrollY,right:window.innerWidth-e.left+window.scrollX},right:{top:e.top+window.scrollY,left:e.right+window.scrollX},"top-left":{bottom:window.innerHeight-e.top+window.scrollY,right:window.innerWidth-e.left+window.scrollX}};return h(h({},t),n[a])}(),onMouseEnter:w,onMouseLeave:b,children:i||(null==r?void 0:r.map(function(e){return fe("div",{title:e.caption,className:u.e("item"),onMouseDown:function(t){t.stopPropagation(),null==l||l(e.id,t)},children:[e.icon,fe("div",{className:u.em("item","caption"),children:e.caption})]},e.id)}))}),y.current)]})};function Oi(e){this.content=e}function Ei(e,t,n){for(var r=0;;r++){if(r==e.childCount||r==t.childCount)return e.childCount==t.childCount?null:n;var i=e.child(r),o=t.child(r);if(i!=o){if(!i.sameMarkup(o))return n;if(i.isText&&i.text!=o.text){for(var a=0;i.text[a]==o.text[a];a++)n++;return n}if(i.content.size||o.content.size){var s=Ei(i.content,o.content,n+1);if(null!=s)return s}n+=i.nodeSize}else n+=i.nodeSize}}function Ai(e,t,n,r){for(var i=e.childCount,o=t.childCount;;){if(0==i||0==o)return i==o?null:{a:n,b:r};var a=e.child(--i),s=t.child(--o),c=a.nodeSize;if(a!=s){if(!a.sameMarkup(s))return{a:n,b:r};if(a.isText&&a.text!=s.text){for(var l=0,u=Math.min(a.text.length,s.text.length);l<u&&a.text[a.text.length-l-1]==s.text[s.text.length-l-1];)l++,n--,r--;return{a:n,b:r}}if(a.content.size||s.content.size){var d=Ai(a.content,s.content,n-1,r-1);if(d)return d}n-=c,r-=c}else n-=c,r-=c}}Oi.prototype={constructor:Oi,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return-1},get:function(e){var t=this.find(e);return-1==t?void 0:this.content[t+1]},update:function(e,t,n){var r=n&&n!=e?this.remove(n):this,i=r.find(e),o=r.content.slice();return-1==i?o.push(n||e,t):(o[i+1]=t,n&&(o[i]=n)),new Oi(o)},remove:function(e){var t=this.find(e);if(-1==t)return this;var n=this.content.slice();return n.splice(t,2),new Oi(n)},addToStart:function(e,t){return new Oi([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new Oi(n)},addBefore:function(e,t,n){var r=this.remove(t),i=r.content.slice(),o=r.find(e);return i.splice(-1==o?i.length:o,0,t,n),new Oi(i)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return(e=Oi.from(e)).size?new Oi(e.content.concat(this.subtract(e).content)):this},append:function(e){return(e=Oi.from(e)).size?new Oi(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=Oi.from(e);for(var n=0;n<e.content.length;n+=2)t=t.remove(e.content[n]);return t},toObject:function(){var e={};return this.forEach(function(t,n){e[t]=n}),e},get size(){return this.content.length>>1}},Oi.from=function(e){if(e instanceof Oi)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new Oi(t)};var Di=function(){function e(t,n){if(x(this,e),this.content=t,this.size=n||0,null==n)for(var r=0;r<t.length;r++)this.size+=t[r].nodeSize}return S(e,[{key:"nodesBetween",value:function(e,t,n){for(var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4?arguments[4]:void 0,o=0,a=0;a<t;o++){var s=this.content[o],c=a+s.nodeSize;if(c>e&&!1!==n(s,r+a,i||null,o)&&s.content.size){var l=a+1;s.nodesBetween(Math.max(0,e-l),Math.min(s.content.size,t-l),n,r+l)}a=c}}},{key:"descendants",value:function(e){this.nodesBetween(0,this.size,e)}},{key:"textBetween",value:function(e,t,n,r){var i="",o=!0;return this.nodesBetween(e,t,function(a,s){var c=a.isText?a.text.slice(Math.max(e,s)-s,t-s):a.isLeaf?r?"function"==typeof r?r(a):r:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&c||a.isTextblock)&&n&&(o?o=!1:i+=n),i+=c},0),i}},{key:"append",value:function(t){if(!t.size)return this;if(!this.size)return t;var n=this.lastChild,r=t.firstChild,i=this.content.slice(),o=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),o=1);o<t.content.length;o++)i.push(t.content[o]);return new e(i,this.size+t.size)}},{key:"cut",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.size;if(0==t&&n==this.size)return this;var r=[],i=0;if(n>t)for(var o=0,a=0;a<n;o++){var s=this.content[o],c=a+s.nodeSize;c>t&&((a<t||c>n)&&(s=s.isText?s.cut(Math.max(0,t-a),Math.min(s.text.length,n-a)):s.cut(Math.max(0,t-a-1),Math.min(s.content.size,n-a-1))),r.push(s),i+=s.nodeSize),a=c}return new e(r,i)}},{key:"cutByIndex",value:function(t,n){return t==n?e.empty:0==t&&n==this.content.length?this:new e(this.content.slice(t,n))}},{key:"replaceChild",value:function(t,n){var r=this.content[t];if(r==n)return this;var i=this.content.slice(),o=this.size+n.nodeSize-r.nodeSize;return i[t]=n,new e(i,o)}},{key:"addToStart",value:function(t){return new e([t].concat(this.content),this.size+t.nodeSize)}},{key:"addToEnd",value:function(t){return new e(this.content.concat(t),this.size+t.nodeSize)}},{key:"eq",value:function(e){if(this.content.length!=e.content.length)return!1;for(var t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}},{key:"firstChild",get:function(){return this.content.length?this.content[0]:null}},{key:"lastChild",get:function(){return this.content.length?this.content[this.content.length-1]:null}},{key:"childCount",get:function(){return this.content.length}},{key:"child",value:function(e){var t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}},{key:"maybeChild",value:function(e){return this.content[e]||null}},{key:"forEach",value:function(e){for(var t=0,n=0;t<this.content.length;t++){var r=this.content[t];e(r,n,t),n+=r.nodeSize}}},{key:"findDiffStart",value:function(e){return Ei(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0)}},{key:"findDiffEnd",value:function(e){return Ai(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.size,arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.size)}},{key:"findIndex",value:function(e){if(0==e)return zi(0,e);if(e==this.size)return zi(this.content.length,e);if(e>this.size||e<0)throw new RangeError("Position ".concat(e," outside of fragment (").concat(this,")"));for(var t=0,n=0;;t++){var r=n+this.child(t).nodeSize;if(r>=e)return r==e?zi(t+1,r):zi(t,n);n=r}}},{key:"toString",value:function(){return"<"+this.toStringInner()+">"}},{key:"toStringInner",value:function(){return this.content.join(", ")}},{key:"toJSON",value:function(){return this.content.length?this.content.map(function(e){return e.toJSON()}):null}}],[{key:"fromJSON",value:function(t,n){if(!n)return e.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new e(n.map(t.nodeFromJSON))}},{key:"fromArray",value:function(t){if(!t.length)return e.empty;for(var n,r=0,i=0;i<t.length;i++){var o=t[i];r+=o.nodeSize,i&&o.isText&&t[i-1].sameMarkup(o)?(n||(n=t.slice(0,i)),n[n.length-1]=o.withText(n[n.length-1].text+o.text)):n&&n.push(o)}return new e(n||t,r)}},{key:"from",value:function(t){if(!t)return e.empty;if(t instanceof e)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new e([t],t.nodeSize);throw new RangeError("Can not convert "+t+" to a Fragment"+(t.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}])}();Di.empty=new Di([],0);var Ii={index:0,offset:0};function zi(e,t){return Ii.index=e,Ii.offset=t,Ii}function Ri(e,t){if(e===t)return!0;if(!e||"object"!=N(e)||!t||"object"!=N(t))return!1;var n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(var r=0;r<e.length;r++)if(!Ri(e[r],t[r]))return!1}else{for(var i in e)if(!(i in t)||!Ri(e[i],t[i]))return!1;for(var o in t)if(!(o in e))return!1}return!0}var Pi=function(){function e(t,n){x(this,e),this.type=t,this.attrs=n}return S(e,[{key:"addToSet",value:function(e){for(var t,n=!1,r=0;r<e.length;r++){var i=e[r];if(this.eq(i))return e;if(this.type.excludes(i.type))t||(t=e.slice(0,r));else{if(i.type.excludes(this.type))return e;!n&&i.type.rank>this.type.rank&&(t||(t=e.slice(0,r)),t.push(this),n=!0),t&&t.push(i)}}return t||(t=e.slice()),n||t.push(this),t}},{key:"removeFromSet",value:function(e){for(var t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}},{key:"isInSet",value:function(e){for(var t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}},{key:"eq",value:function(e){return this==e||this.type==e.type&&Ri(this.attrs,e.attrs)}},{key:"toJSON",value:function(){var e={type:this.type.name};for(var t in this.attrs){e.attrs=this.attrs;break}return e}}],[{key:"fromJSON",value:function(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");var n=e.marks[t.type];if(!n)throw new RangeError("There is no mark type ".concat(t.type," in this schema"));var r=n.create(t.attrs);return n.checkAttrs(r.attrs),r}},{key:"sameSet",value:function(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(var n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}},{key:"setFrom",value:function(t){if(!t||Array.isArray(t)&&0==t.length)return e.none;if(t instanceof e)return[t];var n=t.slice();return n.sort(function(e,t){return e.type.rank-t.type.rank}),n}}])}();Pi.none=[];var Li=function(e){function t(){return x(this,t),r(this,t,arguments)}return a(t,e),S(t)}(n(Error)),Bi=function(){function e(t,n,r){x(this,e),this.content=t,this.openStart=n,this.openEnd=r}return S(e,[{key:"size",get:function(){return this.content.size-this.openStart-this.openEnd}},{key:"insertAt",value:function(t,n){var r=Fi(this.content,t+this.openStart,n);return r&&new e(r,this.openStart,this.openEnd)}},{key:"removeBetween",value:function(t,n){return new e(Vi(this.content,t+this.openStart,n+this.openStart),this.openStart,this.openEnd)}},{key:"eq",value:function(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}},{key:"toString",value:function(){return this.content+"("+this.openStart+","+this.openEnd+")"}},{key:"toJSON",value:function(){if(!this.content.size)return null;var e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}}],[{key:"fromJSON",value:function(t,n){if(!n)return e.empty;var r=n.openStart||0,i=n.openEnd||0;if("number"!=typeof r||"number"!=typeof i)throw new RangeError("Invalid input for Slice.fromJSON");return new e(Di.fromJSON(t,n.content),r,i)}},{key:"maxOpen",value:function(t){for(var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=0,i=0,o=t.firstChild;o&&!o.isLeaf&&(n||!o.type.spec.isolating);o=o.firstChild)r++;for(var a=t.lastChild;a&&!a.isLeaf&&(n||!a.type.spec.isolating);a=a.lastChild)i++;return new e(t,r,i)}}])}();function Vi(e,t,n){var r=e.findIndex(t),i=r.index,o=r.offset,a=e.maybeChild(i),s=e.findIndex(n),c=s.index,l=s.offset;if(o==t||a.isText){if(l!=n&&!e.child(c).isText)throw new RangeError("Removing non-flat range");return e.cut(0,t).append(e.cut(n))}if(i!=c)throw new RangeError("Removing non-flat range");return e.replaceChild(i,a.copy(Vi(a.content,t-o-1,n-o-1)))}function Fi(e,t,n,r){var i=e.findIndex(t),o=i.index,a=i.offset,s=e.maybeChild(o);if(a==t||s.isText)return r&&!r.canReplace(o,o,n)?null:e.cut(0,t).append(n).append(e.cut(t));var c=Fi(s.content,t-a-1,n,s);return c&&e.replaceChild(o,s.copy(c))}function ji(e,t,n){if(n.openStart>e.depth)throw new Li("Inserted content deeper than insertion position");if(e.depth-n.openStart!=t.depth-n.openEnd)throw new Li("Inconsistent open depths");return $i(e,t,n,0)}function $i(e,t,n,r){var i=e.index(r),o=e.node(r);if(i==t.index(r)&&r<e.depth-n.openStart){var a=$i(e,t,n,r+1);return o.copy(o.content.replaceChild(i,a))}if(n.content.size){if(n.openStart||n.openEnd||e.depth!=r||t.depth!=r){var s=function(e,t){for(var n=t.depth-e.openStart,r=t.node(n).copy(e.content),i=n-1;i>=0;i--)r=t.node(i).copy(Di.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}(n,e);return Ki(o,Ji(e,s.start,s.end,t,r))}var c=e.parent,l=c.content;return Ki(c,l.cut(0,e.parentOffset).append(n.content).append(l.cut(t.parentOffset)))}return Ki(o,Gi(e,t,r))}function Hi(e,t){if(!t.type.compatibleContent(e.type))throw new Li("Cannot join "+t.type.name+" onto "+e.type.name)}function Wi(e,t,n){var r=e.node(n);return Hi(r,t.node(n)),r}function qi(e,t){var n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function Ui(e,t,n,r){var i=(t||e).node(n),o=0,a=t?t.index(n):i.childCount;e&&(o=e.index(n),e.depth>n?o++:e.textOffset&&(qi(e.nodeAfter,r),o++));for(var s=o;s<a;s++)qi(i.child(s),r);t&&t.depth==n&&t.textOffset&&qi(t.nodeBefore,r)}function Ki(e,t){return e.type.checkContent(t),e.copy(t)}function Ji(e,t,n,r,i){var o=e.depth>i&&Wi(e,t,i+1),a=r.depth>i&&Wi(n,r,i+1),s=[];return Ui(null,e,i,s),o&&a&&t.index(i)==n.index(i)?(Hi(o,a),qi(Ki(o,Ji(e,t,n,r,i+1)),s)):(o&&qi(Ki(o,Gi(e,t,i+1)),s),Ui(t,n,i,s),a&&qi(Ki(a,Gi(n,r,i+1)),s)),Ui(r,null,i,s),new Di(s)}function Gi(e,t,n){var r=[];(Ui(null,e,n,r),e.depth>n)&&qi(Ki(Wi(e,t,n+1),Gi(e,t,n+1)),r);return Ui(t,null,n,r),new Di(r)}Bi.empty=new Bi(Di.empty,0,0);var Xi=function(){function e(t,n,r){x(this,e),this.pos=t,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}return S(e,[{key:"resolveDepth",value:function(e){return null==e?this.depth:e<0?this.depth+e:e}},{key:"parent",get:function(){return this.node(this.depth)}},{key:"doc",get:function(){return this.node(0)}},{key:"node",value:function(e){return this.path[3*this.resolveDepth(e)]}},{key:"index",value:function(e){return this.path[3*this.resolveDepth(e)+1]}},{key:"indexAfter",value:function(e){return e=this.resolveDepth(e),this.index(e)+(e!=this.depth||this.textOffset?1:0)}},{key:"start",value:function(e){return 0==(e=this.resolveDepth(e))?0:this.path[3*e-1]+1}},{key:"end",value:function(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}},{key:"before",value:function(e){if(!(e=this.resolveDepth(e)))throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[3*e-1]}},{key:"after",value:function(e){if(!(e=this.resolveDepth(e)))throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[3*e-1]+this.path[3*e].nodeSize}},{key:"textOffset",get:function(){return this.pos-this.path[this.path.length-1]}},{key:"nodeAfter",get:function(){var e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;var n=this.pos-this.path[this.path.length-1],r=e.child(t);return n?e.child(t).cut(n):r}},{key:"nodeBefore",get:function(){var e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):0==e?null:this.parent.child(e-1)}},{key:"posAtIndex",value:function(e,t){t=this.resolveDepth(t);for(var n=this.path[3*t],r=0==t?0:this.path[3*t-1]+1,i=0;i<e;i++)r+=n.child(i).nodeSize;return r}},{key:"marks",value:function(){var e=this.parent,t=this.index();if(0==e.content.size)return Pi.none;if(this.textOffset)return e.child(t).marks;var n=e.maybeChild(t-1),r=e.maybeChild(t);if(!n){var i=n;n=r,r=i}for(var o=n.marks,a=0;a<o.length;a++)!1!==o[a].type.spec.inclusive||r&&o[a].isInSet(r.marks)||(o=o[a--].removeFromSet(o));return o}},{key:"marksAcross",value:function(e){var t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;for(var n=t.marks,r=e.parent.maybeChild(e.index()),i=0;i<n.length;i++)!1!==n[i].type.spec.inclusive||r&&n[i].isInSet(r.marks)||(n=n[i--].removeFromSet(n));return n}},{key:"sharedDepth",value:function(e){for(var t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}},{key:"blockRange",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this,t=arguments.length>1?arguments[1]:void 0;if(e.pos<this.pos)return e.blockRange(this);for(var n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new eo(this,e,n);return null}},{key:"sameParent",value:function(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}},{key:"max",value:function(e){return e.pos>this.pos?e:this}},{key:"min",value:function(e){return e.pos<this.pos?e:this}},{key:"toString",value:function(){for(var e="",t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}}],[{key:"resolve",value:function(t,n){if(!(n>=0&&n<=t.content.size))throw new RangeError("Position "+n+" out of range");for(var r=[],i=0,o=n,a=t;;){var s=a.content.findIndex(o),c=s.index,l=s.offset,u=o-l;if(r.push(a,c,i+l),!u)break;if((a=a.child(c)).isText)break;o=u-1,i+=l+1}return new e(n,r,o)}},{key:"resolveCached",value:function(t,n){var r=Qi.get(t);if(r)for(var i=0;i<r.elts.length;i++){var o=r.elts[i];if(o.pos==n)return o}else Qi.set(t,r=new Yi);var a=r.elts[r.i]=e.resolve(t,n);return r.i=(r.i+1)%Zi,a}}])}(),Yi=S(function e(){x(this,e),this.elts=[],this.i=0}),Zi=12,Qi=new WeakMap,eo=function(){return S(function e(t,n,r){x(this,e),this.$from=t,this.$to=n,this.depth=r},[{key:"start",get:function(){return this.$from.before(this.depth+1)}},{key:"end",get:function(){return this.$to.after(this.depth+1)}},{key:"parent",get:function(){return this.$from.node(this.depth)}},{key:"startIndex",get:function(){return this.$from.index(this.depth)}},{key:"endIndex",get:function(){return this.$to.indexAfter(this.depth)}}])}(),to=Object.create(null),no=function(){function e(t,n,r){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Pi.none;x(this,e),this.type=t,this.attrs=n,this.marks=i,this.content=r||Di.empty}return S(e,[{key:"children",get:function(){return this.content.content}},{key:"nodeSize",get:function(){return this.isLeaf?1:2+this.content.size}},{key:"childCount",get:function(){return this.content.childCount}},{key:"child",value:function(e){return this.content.child(e)}},{key:"maybeChild",value:function(e){return this.content.maybeChild(e)}},{key:"forEach",value:function(e){this.content.forEach(e)}},{key:"nodesBetween",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;this.content.nodesBetween(e,t,n,r,this)}},{key:"descendants",value:function(e){this.nodesBetween(0,this.content.size,e)}},{key:"textContent",get:function(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}},{key:"textBetween",value:function(e,t,n,r){return this.content.textBetween(e,t,n,r)}},{key:"firstChild",get:function(){return this.content.firstChild}},{key:"lastChild",get:function(){return this.content.lastChild}},{key:"eq",value:function(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}},{key:"sameMarkup",value:function(e){return this.hasMarkup(e.type,e.attrs,e.marks)}},{key:"hasMarkup",value:function(e,t,n){return this.type==e&&Ri(this.attrs,t||e.defaultAttrs||to)&&Pi.sameSet(this.marks,n||Pi.none)}},{key:"copy",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return t==this.content?this:new e(this.type,this.attrs,t,this.marks)}},{key:"mark",value:function(t){return t==this.marks?this:new e(this.type,this.attrs,this.content,t)}},{key:"cut",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.content.size;return 0==e&&t==this.content.size?this:this.copy(this.content.cut(e,t))}},{key:"slice",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.content.size,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(e==t)return Bi.empty;var r=this.resolve(e),i=this.resolve(t),o=n?0:r.sharedDepth(t),a=r.start(o),s=r.node(o).content.cut(r.pos-a,i.pos-a);return new Bi(s,r.depth-o,i.depth-o)}},{key:"replace",value:function(e,t,n){return ji(this.resolve(e),this.resolve(t),n)}},{key:"nodeAt",value:function(e){for(var t=this;;){var n=t.content.findIndex(e),r=n.index,i=n.offset;if(!(t=t.maybeChild(r)))return null;if(i==e||t.isText)return t;e-=i+1}}},{key:"childAfter",value:function(e){var t=this.content.findIndex(e),n=t.index,r=t.offset;return{node:this.content.maybeChild(n),index:n,offset:r}}},{key:"childBefore",value:function(e){if(0==e)return{node:null,index:0,offset:0};var t=this.content.findIndex(e),n=t.index,r=t.offset;if(r<e)return{node:this.content.child(n),index:n,offset:r};var i=this.content.child(n-1);return{node:i,index:n-1,offset:r-i.nodeSize}}},{key:"resolve",value:function(e){return Xi.resolveCached(this,e)}},{key:"resolveNoCache",value:function(e){return Xi.resolve(this,e)}},{key:"rangeHasMark",value:function(e,t,n){var r=!1;return t>e&&this.nodesBetween(e,t,function(e){return n.isInSet(e.marks)&&(r=!0),!r}),r}},{key:"isBlock",get:function(){return this.type.isBlock}},{key:"isTextblock",get:function(){return this.type.isTextblock}},{key:"inlineContent",get:function(){return this.type.inlineContent}},{key:"isInline",get:function(){return this.type.isInline}},{key:"isText",get:function(){return this.type.isText}},{key:"isLeaf",get:function(){return this.type.isLeaf}},{key:"isAtom",get:function(){return this.type.isAtom}},{key:"toString",value:function(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);var e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),io(this.marks,e)}},{key:"contentMatchAt",value:function(e){var t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}},{key:"canReplace",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Di.empty,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:n.childCount,o=this.contentMatchAt(e).matchFragment(n,r,i),a=o&&o.matchFragment(this.content,t);if(!a||!a.validEnd)return!1;for(var s=r;s<i;s++)if(!this.type.allowsMarks(n.child(s).marks))return!1;return!0}},{key:"canReplaceWith",value:function(e,t,n,r){if(r&&!this.type.allowsMarks(r))return!1;var i=this.contentMatchAt(e).matchType(n),o=i&&i.matchFragment(this.content,t);return!!o&&o.validEnd}},{key:"canAppend",value:function(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}},{key:"check",value:function(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);for(var e=Pi.none,t=0;t<this.marks.length;t++){var n=this.marks[t];n.type.checkAttrs(n.attrs),e=n.addToSet(e)}if(!Pi.sameSet(e,this.marks))throw new RangeError("Invalid collection of marks for node ".concat(this.type.name,": ").concat(this.marks.map(function(e){return e.type.name})));this.content.forEach(function(e){return e.check()})}},{key:"toJSON",value:function(){var e={type:this.type.name};for(var t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(function(e){return e.toJSON()})),e}}],[{key:"fromJSON",value:function(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");var n=void 0;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");n=t.marks.map(e.markFromJSON)}if("text"==t.type){if("string"!=typeof t.text)throw new RangeError("Invalid text node in JSON");return e.text(t.text,n)}var r=Di.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,r,n);return i.type.checkAttrs(i.attrs),i}}])}();no.prototype.text=void 0;var ro=function(t){function n(e,t,i,o){var a;if(x(this,n),a=r(this,n,[e,t,null,o]),!i)throw new RangeError("Empty text nodes are not allowed");return a.text=i,a}return a(n,t),S(n,[{key:"toString",value:function(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):io(this.marks,JSON.stringify(this.text))}},{key:"textContent",get:function(){return this.text}},{key:"textBetween",value:function(e,t){return this.text.slice(e,t)}},{key:"nodeSize",get:function(){return this.text.length}},{key:"mark",value:function(e){return e==this.marks?this:new n(this.type,this.attrs,this.text,e)}},{key:"withText",value:function(e){return e==this.text?this:new n(this.type,this.attrs,e,this.marks)}},{key:"cut",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.text.length;return 0==e&&t==this.text.length?this:this.withText(this.text.slice(e,t))}},{key:"eq",value:function(e){return this.sameMarkup(e)&&this.text==e.text}},{key:"toJSON",value:function(){var t=e(n,"toJSON",this,3)([]);return t.text=this.text,t}}])}(no);function io(e,t){for(var n=e.length-1;n>=0;n--)t=e[n].type.name+"("+t+")";return t}var oo=function(){function e(t){x(this,e),this.validEnd=t,this.next=[],this.wrapCache=[]}return S(e,[{key:"matchType",value:function(e){for(var t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}},{key:"matchFragment",value:function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.childCount,r=this,i=t;r&&i<n;i++)r=r.matchType(e.child(i).type);return r}},{key:"inlineContent",get:function(){return 0!=this.next.length&&this.next[0].type.isInline}},{key:"defaultType",get:function(){for(var e=0;e<this.next.length;e++){var t=this.next[e].type;if(!t.isText&&!t.hasRequiredAttrs())return t}return null}},{key:"compatible",value:function(e){for(var t=0;t<this.next.length;t++)for(var n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}},{key:"fillBefore",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=[this];return function i(o,a){var s=o.matchFragment(e,n);if(s&&(!t||s.validEnd))return Di.from(a.map(function(e){return e.createAndFill()}));for(var c=0;c<o.next.length;c++){var l=o.next[c],u=l.type,d=l.next;if(!u.isText&&!u.hasRequiredAttrs()&&-1==r.indexOf(d)){r.push(d);var h=i(d,a.concat(u));if(h)return h}}return null}(this,[])}},{key:"findWrapping",value:function(e){for(var t=0;t<this.wrapCache.length;t+=2)if(this.wrapCache[t]==e)return this.wrapCache[t+1];var n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}},{key:"computeWrapping",value:function(e){for(var t=Object.create(null),n=[{match:this,type:null,via:null}];n.length;){var r=n.shift(),i=r.match;if(i.matchType(e)){for(var o=[],a=r;a.type;a=a.via)o.push(a.type);return o.reverse()}for(var s=0;s<i.next.length;s++){var c=i.next[s],l=c.type,u=c.next;l.isLeaf||l.hasRequiredAttrs()||l.name in t||r.type&&!u.validEnd||(n.push({match:l.contentMatch,type:l,via:r}),t[l.name]=!0)}}return null}},{key:"edgeCount",get:function(){return this.next.length}},{key:"edge",value:function(e){if(e>=this.next.length)throw new RangeError("There's no ".concat(e,"th edge in this content match"));return this.next[e]}},{key:"toString",value:function(){var e=[];return function t(n){e.push(n);for(var r=0;r<n.next.length;r++)-1==e.indexOf(n.next[r].next)&&t(n.next[r].next)}(this),e.map(function(t,n){for(var r=n+(t.validEnd?"*":" ")+" ",i=0;i<t.next.length;i++)r+=(i?", ":"")+t.next[i].type.name+"->"+e.indexOf(t.next[i].next);return r}).join("\n")}}],[{key:"parse",value:function(t,n){var r=new ao(t,n);if(null==r.next)return e.empty;var i=so(r);r.next&&r.err("Unexpected trailing text");var o=vo(function(e){var t=[[]];return i(o(e,0),n()),t;function n(){return t.push([])-1}function r(e,n,r){var i={term:r,to:n};return t[e].push(i),i}function i(e,t){e.forEach(function(e){return e.to=t})}function o(e,t){if("choice"==e.type)return e.exprs.reduce(function(e,n){return e.concat(o(n,t))},[]);if("seq"!=e.type){if("star"==e.type){var a=n();return r(t,a),i(o(e.expr,a),a),[r(a)]}if("plus"==e.type){var s=n();return i(o(e.expr,t),s),i(o(e.expr,s),s),[r(s)]}if("opt"==e.type)return[r(t)].concat(o(e.expr,t));if("range"==e.type){for(var c=t,l=0;l<e.min;l++){var u=n();i(o(e.expr,c),u),c=u}if(-1==e.max)i(o(e.expr,c),c);else for(var d=e.min;d<e.max;d++){var h=n();r(c,h),i(o(e.expr,c),h),c=h}return[r(c)]}if("name"==e.type)return[r(t,void 0,e.value)];throw new Error("Unknown expr type")}for(var f=0;;f++){var p=o(e.exprs[f],t);if(f==e.exprs.length-1)return p;i(p,t=n())}}}(i));return function(e,t){for(var n=0,r=[e];n<r.length;n++){for(var i=r[n],o=!i.validEnd,a=[],s=0;s<i.next.length;s++){var c=i.next[s],l=c.type,u=c.next;a.push(l.name),!o||l.isText||l.hasRequiredAttrs()||(o=!1),-1==r.indexOf(u)&&r.push(u)}o&&t.err("Only non-generatable nodes ("+a.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}(o,r),o}}])}();oo.empty=new oo(!0);var ao=function(){return S(function e(t,n){x(this,e),this.string=t,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=t.split(/\s*(?=\b|\W|$)/),""==this.tokens[this.tokens.length-1]&&this.tokens.pop(),""==this.tokens[0]&&this.tokens.shift()},[{key:"next",get:function(){return this.tokens[this.pos]}},{key:"eat",value:function(e){return this.next==e&&(this.pos++||!0)}},{key:"err",value:function(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}])}();function so(e){var t=[];do{t.push(co(e))}while(e.eat("|"));return 1==t.length?t[0]:{type:"choice",exprs:t}}function co(e){var t=[];do{t.push(lo(e))}while(e.next&&")"!=e.next&&"|"!=e.next);return 1==t.length?t[0]:{type:"seq",exprs:t}}function lo(e){for(var t=function(e){if(e.eat("(")){var t=so(e);return e.eat(")")||e.err("Missing closing paren"),t}if(!/\W/.test(e.next)){var n=function(e,t){var n=e.nodeTypes,r=n[t];if(r)return[r];var i=[];for(var o in n){var a=n[o];a.isInGroup(t)&&i.push(a)}0==i.length&&e.err("No node type or group '"+t+"' found");return i}(e,e.next).map(function(t){return null==e.inline?e.inline=t.isInline:e.inline!=t.isInline&&e.err("Mixing inline and block content"),{type:"name",value:t}});return e.pos++,1==n.length?n[0]:{type:"choice",exprs:n}}e.err("Unexpected token '"+e.next+"'")}(e);;)if(e.eat("+"))t={type:"plus",expr:t};else if(e.eat("*"))t={type:"star",expr:t};else if(e.eat("?"))t={type:"opt",expr:t};else{if(!e.eat("{"))break;t=ho(e,t)}return t}function uo(e){/\D/.test(e.next)&&e.err("Expected number, got '"+e.next+"'");var t=Number(e.next);return e.pos++,t}function ho(e,t){var n=uo(e),r=n;return e.eat(",")&&(r="}"!=e.next?uo(e):-1),e.eat("}")||e.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:t}}function fo(e,t){return t-e}function po(e,t){var n=[];return function t(r){var i=e[r];if(1==i.length&&!i[0].term)return t(i[0].to);n.push(r);for(var o=0;o<i.length;o++){var a=i[o],s=a.term,c=a.to;s||-1!=n.indexOf(c)||t(c)}}(t),n.sort(fo)}function vo(e){var t=Object.create(null);return function n(r){var i=[];r.forEach(function(t){e[t].forEach(function(t){var n=t.term,r=t.to;if(n){for(var o,a=0;a<i.length;a++)i[a][0]==n&&(o=i[a][1]);po(e,r).forEach(function(e){o||i.push([n,o=[]]),-1==o.indexOf(e)&&o.push(e)})}})});for(var o=t[r.join(",")]=new oo(r.indexOf(e.length-1)>-1),a=0;a<i.length;a++){var s=i[a][1].sort(fo);o.next.push({type:i[a][0],next:t[s.join(",")]||n(s)})}return o}(po(e,0))}function mo(e){var t=Object.create(null);for(var n in e){var r=e[n];if(!r.hasDefault)return null;t[n]=r.default}return t}function go(e,t){var n=Object.create(null);for(var r in e){var i=t&&t[r];if(void 0===i){var o=e[r];if(!o.hasDefault)throw new RangeError("No value supplied for attribute "+r);i=o.default}n[r]=i}return n}function yo(e,t,n,r){for(var i in t)if(!(i in e))throw new RangeError("Unsupported attribute ".concat(i," for ").concat(n," of type ").concat(i));for(var o in e){var a=e[o];a.validate&&a.validate(t[o])}}function ko(e,t){var n=Object.create(null);if(t)for(var r in t)n[r]=new bo(e,r,t[r]);return n}var wo=function(){function e(t,n,r){x(this,e),this.name=t,this.schema=n,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=ko(t,r.attrs),this.defaultAttrs=mo(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||"text"==t),this.isText="text"==t}return S(e,[{key:"isInline",get:function(){return!this.isBlock}},{key:"isTextblock",get:function(){return this.isBlock&&this.inlineContent}},{key:"isLeaf",get:function(){return this.contentMatch==oo.empty}},{key:"isAtom",get:function(){return this.isLeaf||!!this.spec.atom}},{key:"isInGroup",value:function(e){return this.groups.indexOf(e)>-1}},{key:"whitespace",get:function(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}},{key:"hasRequiredAttrs",value:function(){for(var e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}},{key:"compatibleContent",value:function(e){return this==e||this.contentMatch.compatible(e.contentMatch)}},{key:"computeAttrs",value:function(e){return!e&&this.defaultAttrs?this.defaultAttrs:go(this.attrs,e)}},{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0;if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new no(this,this.computeAttrs(e),Di.from(t),Pi.setFrom(n))}},{key:"createChecked",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0;return t=Di.from(t),this.checkContent(t),new no(this,this.computeAttrs(e),t,Pi.setFrom(n))}},{key:"createAndFill",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0;if(e=this.computeAttrs(e),(t=Di.from(t)).size){var r=this.contentMatch.fillBefore(t);if(!r)return null;t=r.append(t)}var i=this.contentMatch.matchFragment(t),o=i&&i.fillBefore(Di.empty,!0);return o?new no(this,e,t.append(o),Pi.setFrom(n)):null}},{key:"validContent",value:function(e){var t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(var n=0;n<e.childCount;n++)if(!this.allowsMarks(e.child(n).marks))return!1;return!0}},{key:"checkContent",value:function(e){if(!this.validContent(e))throw new RangeError("Invalid content for node ".concat(this.name,": ").concat(e.toString().slice(0,50)))}},{key:"checkAttrs",value:function(e){yo(this.attrs,e,"node",this.name)}},{key:"allowsMarkType",value:function(e){return null==this.markSet||this.markSet.indexOf(e)>-1}},{key:"allowsMarks",value:function(e){if(null==this.markSet)return!0;for(var t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}},{key:"allowedMarks",value:function(e){if(null==this.markSet)return e;for(var t,n=0;n<e.length;n++)this.allowsMarkType(e[n].type)?t&&t.push(e[n]):t||(t=e.slice(0,n));return t?t.length?t:Pi.none:e}}],[{key:"compile",value:function(t,n){var r=Object.create(null);t.forEach(function(t,i){return r[t]=new e(t,n,i)});var i=n.spec.topNode||"doc";if(!r[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(var o in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}}])}();var bo=function(){return S(function e(t,n,r){x(this,e),this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate="string"==typeof r.validate?function(e,t,n){var r=n.split("|");return function(n){var i=null===n?"null":N(n);if(r.indexOf(i)<0)throw new RangeError("Expected value of type ".concat(r," for attribute ").concat(t," on type ").concat(e,", got ").concat(i))}}(t,n,r.validate):r.validate},[{key:"isRequired",get:function(){return!this.hasDefault}}])}(),xo=function(){function e(t,n,r,i){x(this,e),this.name=t,this.rank=n,this.schema=r,this.spec=i,this.attrs=ko(t,i.attrs),this.excluded=null;var o=mo(this.attrs);this.instance=o?new Pi(this,o):null}return S(e,[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return!e&&this.instance?this.instance:new Pi(this,go(this.attrs,e))}},{key:"removeFromSet",value:function(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}},{key:"isInSet",value:function(e){for(var t=0;t<e.length;t++)if(e[t].type==this)return e[t]}},{key:"checkAttrs",value:function(e){yo(this.attrs,e,"mark",this.name)}},{key:"excludes",value:function(e){return this.excluded.indexOf(e)>-1}}],[{key:"compile",value:function(t,n){var r=Object.create(null),i=0;return t.forEach(function(t,o){return r[t]=new e(t,i++,n,o)}),r}}])}(),Co=function(){return S(function e(t){var n=this;x(this,e),this.linebreakReplacement=null,this.cached=Object.create(null);var r=this.spec={};for(var i in t)r[i]=t[i];r.nodes=Oi.from(t.nodes),r.marks=Oi.from(t.marks||{}),this.nodes=wo.compile(this.spec.nodes,this),this.marks=xo.compile(this.spec.marks,this);var o=Object.create(null);for(var a in this.nodes){if(a in this.marks)throw new RangeError(a+" can not be both a node and a mark");var s=this.nodes[a],c=s.spec.content||"",l=s.spec.marks;if(s.contentMatch=o[c]||(o[c]=oo.parse(c,this.nodes)),s.inlineContent=s.contentMatch.inlineContent,s.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!s.isInline||!s.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=s}s.markSet="_"==l?null:l?So(this,l.split(" ")):""!=l&&s.inlineContent?null:[]}for(var u in this.marks){var d=this.marks[u],h=d.spec.excludes;d.excluded=null==h?[d]:""==h?[]:So(this,h.split(" "))}this.nodeFromJSON=function(e){return no.fromJSON(n,e)},this.markFromJSON=function(e){return Pi.fromJSON(n,e)},this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)},[{key:"node",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0;if("string"==typeof e)e=this.nodeType(e);else{if(!(e instanceof wo))throw new RangeError("Invalid node type: "+e);if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}return e.createChecked(t,n,r)}},{key:"text",value:function(e,t){var n=this.nodes.text;return new ro(n,n.defaultAttrs,e,Pi.setFrom(t))}},{key:"mark",value:function(e,t){return"string"==typeof e&&(e=this.marks[e]),e.create(t)}},{key:"nodeType",value:function(e){var t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}])}();function So(e,t){for(var n=[],r=0;r<t.length;r++){var i=t[r],o=e.marks[i],a=o;if(o)n.push(o);else for(var s in e.marks){var c=e.marks[s];("_"==i||c.spec.group&&c.spec.group.split(" ").indexOf(i)>-1)&&n.push(a=c)}if(!a)throw new SyntaxError("Unknown mark type: '"+t[r]+"'")}return n}var _o=function(){function e(t,n){var r=this;x(this,e),this.schema=t,this.rules=n,this.tags=[],this.styles=[];var i=this.matchedStyles=[];n.forEach(function(e){if(function(e){return null!=e.tag}(e))r.tags.push(e);else if(function(e){return null!=e.style}(e)){var t=/[^=]*/.exec(e.style)[0];i.indexOf(t)<0&&i.push(t),r.styles.push(e)}}),this.normalizeLists=!this.tags.some(function(e){if(!/^(ul|ol)\b/.test(e.tag)||!e.node)return!1;var n=t.nodes[e.node];return n.contentMatch.matchType(n)})}return S(e,[{key:"parse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=new Ao(this,t,!1);return n.addAll(e,Pi.none,t.from,t.to),n.finish()}},{key:"parseSlice",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=new Ao(this,t,!0);return n.addAll(e,Pi.none,t.from,t.to),Bi.maxOpen(n.finish())}},{key:"matchTag",value:function(e,t,n){for(var r=n?this.tags.indexOf(n)+1:0;r<this.tags.length;r++){var i=this.tags[r];if(Do(e,i.tag)&&(void 0===i.namespace||e.namespaceURI==i.namespace)&&(!i.context||t.matchesContext(i.context))){if(i.getAttrs){var o=i.getAttrs(e);if(!1===o)continue;i.attrs=o||void 0}return i}}}},{key:"matchStyle",value:function(e,t,n,r){for(var i=r?this.styles.indexOf(r)+1:0;i<this.styles.length;i++){var o=this.styles[i],a=o.style;if(!(0!=a.indexOf(e)||o.context&&!n.matchesContext(o.context)||a.length>e.length&&(61!=a.charCodeAt(e.length)||a.slice(e.length+1)!=t))){if(o.getAttrs){var s=o.getAttrs(t);if(!1===s)continue;o.attrs=s||void 0}return o}}}}],[{key:"schemaRules",value:function(e){var t=[];function n(e){for(var n=null==e.priority?50:e.priority,r=0;r<t.length;r++){var i=t[r];if((null==i.priority?50:i.priority)<n)break}t.splice(r,0,e)}var r=function(t){var r=e.marks[t].spec.parseDOM;r&&r.forEach(function(e){n(e=Io(e)),e.mark||e.ignore||e.clearMark||(e.mark=t)})};for(var i in e.marks)r(i);var o=function(t){var r=e.nodes[t].spec.parseDOM;r&&r.forEach(function(e){n(e=Io(e)),e.node||e.ignore||e.mark||(e.node=t)})};for(var a in e.nodes)o(a);return t}},{key:"fromSchema",value:function(t){return t.cached.domParser||(t.cached.domParser=new e(t,e.schemaRules(t)))}}])}(),Mo={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},No={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},To={ol:!0,ul:!0};function Oo(e,t,n){return null!=t?(t?1:0)|("full"===t?2:0):e&&"pre"==e.whitespace?3:-5&n}var Eo=function(){return S(function e(t,n,r,i,o,a){x(this,e),this.type=t,this.attrs=n,this.marks=r,this.solid=i,this.options=a,this.content=[],this.activeMarks=Pi.none,this.match=o||(4&a?null:t.contentMatch)},[{key:"findWrapping",value:function(e){if(!this.match){if(!this.type)return[];var t=this.type.contentMatch.fillBefore(Di.from(e));if(!t){var n,r=this.type.contentMatch;return(n=r.findWrapping(e.type))?(this.match=r,n):null}this.match=this.type.contentMatch.matchFragment(t)}return this.match.findWrapping(e.type)}},{key:"finish",value:function(e){if(!(1&this.options)){var t,n=this.content[this.content.length-1];if(n&&n.isText&&(t=/[ \t\r\n\u000c]+$/.exec(n.text))){var r=n;n.text.length==t[0].length?this.content.pop():this.content[this.content.length-1]=r.withText(r.text.slice(0,r.text.length-t[0].length))}}var i=Di.from(this.content);return!e&&this.match&&(i=i.append(this.match.fillBefore(Di.empty,!0))),this.type?this.type.create(this.attrs,i,this.marks):i}},{key:"inlineContext",value:function(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!Mo.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}])}(),Ao=function(){return S(function e(t,n,r){x(this,e),this.parser=t,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;var i,o=n.topNode,a=Oo(null,n.preserveWhitespace,0)|(r?4:0);i=o?new Eo(o.type,o.attrs,Pi.none,!0,n.topMatch||o.type.contentMatch,a):new Eo(r?null:t.schema.topNodeType,null,Pi.none,!0,null,a),this.nodes=[i],this.find=n.findPositions,this.needsBlock=!1},[{key:"top",get:function(){return this.nodes[this.open]}},{key:"addDOM",value:function(e,t){3==e.nodeType?this.addTextNode(e,t):1==e.nodeType&&this.addElement(e,t)}},{key:"addTextNode",value:function(e,t){var n=e.nodeValue,r=this.top,i=2&r.options?"full":this.localPreserveWS||(1&r.options)>0,o=this.parser.schema;if("full"===i||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(n)){if(i)if("full"===i)n=n.replace(/\r\n?/g,"\n");else if(o.linebreakReplacement&&/[\r\n]/.test(n)&&this.top.findWrapping(o.linebreakReplacement.create())){for(var a=n.split(/\r?\n|\r/),s=0;s<a.length;s++)s&&this.insertNode(o.linebreakReplacement.create(),t,!0),a[s]&&this.insertNode(o.text(a[s]),t,!/\S/.test(a[s]));n=""}else n=n.replace(/\r?\n|\r/g," ");else if(n=n.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(n)&&this.open==this.nodes.length-1){var c=r.content[r.content.length-1],l=e.previousSibling;(!c||l&&"BR"==l.nodeName||c.isText&&/[ \t\r\n\u000c]$/.test(c.text))&&(n=n.slice(1))}n&&this.insertNode(o.text(n),t,!/\S/.test(n)),this.findInText(e)}else this.findInside(e)}},{key:"addElement",value:function(e,t,n){var r=this.localPreserveWS,i=this.top;("PRE"==e.tagName||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);var o,a=e.nodeName.toLowerCase();To.hasOwnProperty(a)&&this.parser.normalizeLists&&function(e){for(var t=e.firstChild,n=null;t;t=t.nextSibling){var r=1==t.nodeType?t.nodeName.toLowerCase():null;r&&To.hasOwnProperty(r)&&n?(n.appendChild(t),t=n):"li"==r?n=t:r&&(n=null)}}(e);var s=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(o=this.parser.matchTag(e,this,n));e:if(s?s.ignore:No.hasOwnProperty(a))this.findInside(e),this.ignoreFallback(e,t);else if(!s||s.skip||s.closeParent){s&&s.closeParent?this.open=Math.max(0,this.open-1):s&&s.skip.nodeType&&(e=s.skip);var c,l=this.needsBlock;if(Mo.hasOwnProperty(a))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),c=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}var u=s&&s.skip?t:this.readStyles(e,t);u&&this.addAll(e,u),c&&this.sync(i),this.needsBlock=l}else{var d=this.readStyles(e,t);d&&this.addElementByRule(e,s,d,!1===s.consuming?o:void 0)}this.localPreserveWS=r}},{key:"leafFallback",value:function(e,t){"BR"==e.nodeName&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode("\n"),t)}},{key:"ignoreFallback",value:function(e,t){"BR"!=e.nodeName||this.top.type&&this.top.type.inlineContent||this.findPlace(this.parser.schema.text("-"),t,!0)}},{key:"readStyles",value:function(e,t){var n=this,r=e.style;if(r&&r.length)for(var i=0;i<this.parser.matchedStyles.length;i++){var o=this.parser.matchedStyles[i],a=r.getPropertyValue(o);if(a)for(var s,c=function(e){var r=n.parser.matchStyle(o,a,n,e);return r?r.ignore?{v:null}:(t=r.clearMark?t.filter(function(e){return!r.clearMark(e)}):t.concat(n.parser.schema.marks[r.mark].create(r.attrs)),!1!==r.consuming?(l=e,0):void(l=e=r)):(l=e,0)},l=void 0;0!==(s=c(l));)if(s)return s.v}return t}},{key:"addElementByRule",value:function(e,t,n,r){var i,o,a=this;if(t.node)if((o=this.parser.schema.nodes[t.node]).isLeaf)this.insertNode(o.create(t.attrs),n,"BR"==e.nodeName)||this.leafFallback(e,n);else{var s=this.enter(o,t.attrs||null,n,t.preserveWhitespace);s&&(i=!0,n=s)}else{var c=this.parser.schema.marks[t.mark];n=n.concat(c.create(t.attrs))}var l=this.top;if(o&&o.isLeaf)this.findInside(e);else if(r)this.addElement(e,n,r);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(function(e){return a.insertNode(e,n,!1)});else{var u=e;"string"==typeof t.contentElement?u=e.querySelector(t.contentElement):"function"==typeof t.contentElement?u=t.contentElement(e):t.contentElement&&(u=t.contentElement),this.findAround(e,u,!0),this.addAll(u,n),this.findAround(e,u,!1)}i&&this.sync(l)&&this.open--}},{key:"addAll",value:function(e,t,n,r){for(var i=n||0,o=n?e.childNodes[n]:e.firstChild,a=null==r?null:e.childNodes[r];o!=a;o=o.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(o,t);this.findAtPoint(e,i)}},{key:"findPlace",value:function(e,t,n){for(var r,i,o=this.open,a=0;o>=0;o--){var s=this.nodes[o],c=s.findWrapping(e);if(c&&(!r||r.length>c.length+a)&&(r=c,i=s,!c.length))break;if(s.solid){if(n)break;a+=2}}if(!r)return null;this.sync(i);for(var l=0;l<r.length;l++)t=this.enterInner(r[l],null,t,!1);return t}},{key:"insertNode",value:function(e,t,n){if(e.isInline&&this.needsBlock&&!this.top.type){var r=this.textblockFromContext();r&&(t=this.enterInner(r,null,t))}var i=this.findPlace(e,t,n);if(i){this.closeExtra();var o=this.top;o.match&&(o.match=o.match.matchType(e.type));var a,s=Pi.none,c=u(i.concat(e.marks));try{for(c.s();!(a=c.n()).done;){var l=a.value;(o.type?o.type.allowsMarkType(l.type):zo(l.type,e.type))&&(s=l.addToSet(s))}}catch(d){c.e(d)}finally{c.f()}return o.content.push(e.mark(s)),!0}return!1}},{key:"enter",value:function(e,t,n,r){var i=this.findPlace(e.create(t),n,!1);return i&&(i=this.enterInner(e,t,n,!0,r)),i}},{key:"enterInner",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],i=arguments.length>4?arguments[4]:void 0;this.closeExtra();var o=this.top;o.match=o.match&&o.match.matchType(e);var a=Oo(e,i,o.options);4&o.options&&0==o.content.length&&(a|=4);var s=Pi.none;return n=n.filter(function(t){return!(o.type?o.type.allowsMarkType(t.type):zo(t.type,e))||(s=t.addToSet(s),!1)}),this.nodes.push(new Eo(e,t,s,r,null,a)),this.open++,n}},{key:"closeExtra",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}},{key:"finish",value:function(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!(!this.isOpen&&!this.options.topOpen))}},{key:"sync",value:function(e){for(var t=this.open;t>=0;t--){if(this.nodes[t]==e)return this.open=t,!0;this.localPreserveWS&&(this.nodes[t].options|=1)}return!1}},{key:"currentPos",get:function(){this.closeExtra();for(var e=0,t=this.open;t>=0;t--){for(var n=this.nodes[t].content,r=n.length-1;r>=0;r--)e+=n[r].nodeSize;t&&e++}return e}},{key:"findAtPoint",value:function(e,t){if(this.find)for(var n=0;n<this.find.length;n++)this.find[n].node==e&&this.find[n].offset==t&&(this.find[n].pos=this.currentPos)}},{key:"findInside",value:function(e){if(this.find)for(var t=0;t<this.find.length;t++)null==this.find[t].pos&&1==e.nodeType&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}},{key:"findAround",value:function(e,t,n){if(e!=t&&this.find)for(var r=0;r<this.find.length;r++){if(null==this.find[r].pos&&1==e.nodeType&&e.contains(this.find[r].node))t.compareDocumentPosition(this.find[r].node)&(n?2:4)&&(this.find[r].pos=this.currentPos)}}},{key:"findInText",value:function(e){if(this.find)for(var t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}},{key:"matchesContext",value:function(e){var t=this;if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);var n=e.split("/"),r=this.options.context,i=!(this.isOpen||r&&r.parent.type!=this.nodes[0].type),o=-(r?r.depth+1:0)+(i?0:1),a=function(e,s){for(;e>=0;e--){var c=n[e];if(""==c){if(e==n.length-1||0==e)continue;for(;s>=o;s--)if(a(e-1,s))return!0;return!1}var l=s>0||0==s&&i?t.nodes[s].type:r&&s>=o?r.node(s-o).type:null;if(!l||l.name!=c&&!l.isInGroup(c))return!1;s--}return!0};return a(n.length-1,this.open)}},{key:"textblockFromContext",value:function(){var e=this.options.context;if(e)for(var t=e.depth;t>=0;t--){var n=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(var r in this.parser.schema.nodes){var i=this.parser.schema.nodes[r];if(i.isTextblock&&i.defaultAttrs)return i}}}])}();function Do(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function Io(e){var t={};for(var n in e)t[n]=e[n];return t}function zo(e,t){var n,r=t.schema.nodes,i=function(){var n=r[o];if(!n.allowsMarkType(e))return 0;var i=[],a=function(e){i.push(e);for(var n=0;n<e.edgeCount;n++){var r=e.edge(n),o=r.type,s=r.next;if(o==t)return!0;if(i.indexOf(s)<0&&a(s))return!0}};return a(n.contentMatch)?{v:!0}:void 0};for(var o in r)if(0!==(n=i())&&n)return n.v}var Ro=function(){function e(t,n){x(this,e),this.nodes=t,this.marks=n}return S(e,[{key:"serializeFragment",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0;r||(r=Lo(n).createDocumentFragment());var i=r,o=[];return e.forEach(function(e){if(o.length||e.marks.length){for(var r=0,a=0;r<o.length&&a<e.marks.length;){var s=e.marks[a];if(t.marks[s.type.name]){if(!s.eq(o[r][0])||!1===s.type.spec.spanning)break;r++,a++}else a++}for(;r<o.length;)i=o.pop()[1];for(;a<e.marks.length;){var c=e.marks[a++],l=t.serializeMark(c,e.isInline,n);l&&(o.push([c,i]),i.appendChild(l.dom),i=l.contentDOM||l.dom)}}i.appendChild(t.serializeNodeInner(e,n))}),r}},{key:"serializeNodeInner",value:function(e,t){var n=Fo(Lo(t),this.nodes[e.type.name](e),null,e.attrs),r=n.dom,i=n.contentDOM;if(i){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,i)}return r}},{key:"serializeNode",value:function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=this.serializeNodeInner(e,t),r=e.marks.length-1;r>=0;r--){var i=this.serializeMark(e.marks[r],e.isInline,t);i&&((i.contentDOM||i.dom).appendChild(n),n=i.dom)}return n}},{key:"serializeMark",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=this.marks[e.type.name];return r&&Fo(Lo(n),r(e,t),null,e.attrs)}}],[{key:"renderSpec",value:function(e,t){return Fo(e,t,arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,arguments.length>3?arguments[3]:void 0)}},{key:"fromSchema",value:function(t){return t.cached.domSerializer||(t.cached.domSerializer=new e(this.nodesFromSchema(t),this.marksFromSchema(t)))}},{key:"nodesFromSchema",value:function(e){var t=Po(e.nodes);return t.text||(t.text=function(e){return e.text}),t}},{key:"marksFromSchema",value:function(e){return Po(e.marks)}}])}();function Po(e){var t={};for(var n in e){var r=e[n].spec.toDOM;r&&(t[n]=r)}return t}function Lo(e){return e.document||window.document}var Bo=new WeakMap;function Vo(e){var t=Bo.get(e);return void 0===t&&Bo.set(e,t=function(e){var t=null;function n(e){if(e&&"object"==N(e))if(Array.isArray(e))if("string"==typeof e[0])t||(t=[]),t.push(e);else for(var r=0;r<e.length;r++)n(e[r]);else for(var i in e)n(e[i])}return n(e),t}(e)),t}function Fo(e,t,n,r){if("string"==typeof t)return{dom:e.createTextNode(t)};if(null!=t.nodeType)return{dom:t};if(t.dom&&null!=t.dom.nodeType)return t;var i,o=t[0];if("string"!=typeof o)throw new RangeError("Invalid array passed to renderSpec");if(r&&(i=Vo(r))&&i.indexOf(t)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");var a,s=o.indexOf(" ");s>0&&(n=o.slice(0,s),o=o.slice(s+1));var c=n?e.createElementNS(n,o):e.createElement(o),l=t[1],u=1;if(l&&"object"==N(l)&&null==l.nodeType&&!Array.isArray(l))for(var d in u=2,l)if(null!=l[d]){var h=d.indexOf(" ");h>0?c.setAttributeNS(d.slice(0,h),d.slice(h+1),l[d]):"style"==d&&c.style?c.style.cssText=l[d]:c.setAttribute(d,l[d])}for(var f=u;f<t.length;f++){var p=t[f];if(0===p){if(f<t.length-1||f>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:c,contentDOM:c}}var v=Fo(e,p,n,r),m=v.dom,g=v.contentDOM;if(c.appendChild(m),g){if(a)throw new RangeError("Multiple content holes");a=g}}return{dom:c,contentDOM:a}}var jo=Math.pow(2,16);function $o(e,t){return e+t*jo}function Ho(e){return 65535&e}var Wo=function(){return S(function e(t,n,r){x(this,e),this.pos=t,this.delInfo=n,this.recover=r},[{key:"deleted",get:function(){return(8&this.delInfo)>0}},{key:"deletedBefore",get:function(){return(5&this.delInfo)>0}},{key:"deletedAfter",get:function(){return(6&this.delInfo)>0}},{key:"deletedAcross",get:function(){return(4&this.delInfo)>0}}])}(),qo=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(x(this,e),this.ranges=t,this.inverted=n,!t.length&&e.empty)return e.empty}return S(e,[{key:"recover",value:function(e){var t=0,n=Ho(e);if(!this.inverted)for(var r=0;r<n;r++)t+=this.ranges[3*r+2]-this.ranges[3*r+1];return this.ranges[3*n]+t+function(e){return(e-(65535&e))/jo}(e)}},{key:"mapResult",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return this._map(e,t,!1)}},{key:"map",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return this._map(e,t,!0)}},{key:"_map",value:function(e,t,n){for(var r=0,i=this.inverted?2:1,o=this.inverted?1:2,a=0;a<this.ranges.length;a+=3){var s=this.ranges[a]-(this.inverted?r:0);if(s>e)break;var c=this.ranges[a+i],l=this.ranges[a+o],u=s+c;if(e<=u){var d=s+r+((c?e==s?-1:e==u?1:t:t)<0?0:l);if(n)return d;var h=e==(t<0?s:u)?null:$o(a/3,e-s),f=e==s?2:e==u?1:4;return(t<0?e!=s:e!=u)&&(f|=8),new Wo(d,f,h)}r+=l-c}return n?e+r:new Wo(e+r,0,null)}},{key:"touches",value:function(e,t){for(var n=0,r=Ho(t),i=this.inverted?2:1,o=this.inverted?1:2,a=0;a<this.ranges.length;a+=3){var s=this.ranges[a]-(this.inverted?n:0);if(s>e)break;var c=this.ranges[a+i];if(e<=s+c&&a==3*r)return!0;n+=this.ranges[a+o]-c}return!1}},{key:"forEach",value:function(e){for(var t=this.inverted?2:1,n=this.inverted?1:2,r=0,i=0;r<this.ranges.length;r+=3){var o=this.ranges[r],a=o-(this.inverted?i:0),s=o+(this.inverted?0:i),c=this.ranges[r+t],l=this.ranges[r+n];e(a,a+c,s,s+l),i+=l-c}}},{key:"invert",value:function(){return new e(this.ranges,!this.inverted)}},{key:"toString",value:function(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}}],[{key:"offset",value:function(t){return 0==t?e.empty:new e(t<0?[0,-t,0]:[0,0,t])}}])}();qo.empty=new qo([]);var Uo=function(){function e(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:t?t.length:0;x(this,e),this.mirror=n,this.from=r,this.to=i,this._maps=t||[],this.ownData=!(t||n)}return S(e,[{key:"maps",get:function(){return this._maps}},{key:"slice",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.maps.length;return new e(this._maps,this.mirror,t,n)}},{key:"appendMap",value:function(e,t){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),null!=t&&this.setMirror(this._maps.length-1,t)}},{key:"appendMapping",value:function(e){for(var t=0,n=this._maps.length;t<e._maps.length;t++){var r=e.getMirror(t);this.appendMap(e._maps[t],null!=r&&r<t?n+r:void 0)}}},{key:"getMirror",value:function(e){if(this.mirror)for(var t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}},{key:"setMirror",value:function(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}},{key:"appendMappingInverted",value:function(e){for(var t=e.maps.length-1,n=this._maps.length+e._maps.length;t>=0;t--){var r=e.getMirror(t);this.appendMap(e._maps[t].invert(),null!=r&&r>t?n-r-1:void 0)}}},{key:"invert",value:function(){var t=new e;return t.appendMappingInverted(this),t}},{key:"map",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;if(this.mirror)return this._map(e,t,!0);for(var n=this.from;n<this.to;n++)e=this._maps[n].map(e,t);return e}},{key:"mapResult",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return this._map(e,t,!1)}},{key:"_map",value:function(e,t,n){for(var r=0,i=this.from;i<this.to;i++){var o=this._maps[i].mapResult(e,t);if(null!=o.recover){var a=this.getMirror(i);if(null!=a&&a>i&&a<this.to){i=a,e=this._maps[a].recover(o.recover);continue}}r|=o.delInfo,e=o.pos}return n?e:new Wo(e,r,null)}}])}(),Ko=Object.create(null),Jo=function(){return S(function e(){x(this,e)},[{key:"getMap",value:function(){return qo.empty}},{key:"merge",value:function(e){return null}}],[{key:"fromJSON",value:function(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");var n=Ko[t.stepType];if(!n)throw new RangeError("No step type ".concat(t.stepType," defined"));return n.fromJSON(e,t)}},{key:"jsonID",value:function(e,t){if(e in Ko)throw new RangeError("Duplicate use of step JSON ID "+e);return Ko[e]=t,t.prototype.jsonID=e,t}}])}(),Go=function(){function e(t,n){x(this,e),this.doc=t,this.failed=n}return S(e,null,[{key:"ok",value:function(t){return new e(t,null)}},{key:"fail",value:function(t){return new e(null,t)}},{key:"fromReplace",value:function(t,n,r,i){try{return e.ok(t.replace(n,r,i))}catch(wt){if(wt instanceof Li)return e.fail(wt.message);throw wt}}}])}();function Xo(e,t,n){for(var r=[],i=0;i<e.childCount;i++){var o=e.child(i);o.content.size&&(o=o.copy(Xo(o.content,t,o))),o.isInline&&(o=t(o,n,i)),r.push(o)}return Di.fromArray(r)}var Yo=function(e){function t(e,n,i){var o;return x(this,t),(o=r(this,t)).from=e,o.to=n,o.mark=i,o}return a(t,e),S(t,[{key:"apply",value:function(e){var t=this,n=e.slice(this.from,this.to),r=e.resolve(this.from),i=r.node(r.sharedDepth(this.to)),o=new Bi(Xo(n.content,function(e,n){return e.isAtom&&n.type.allowsMarkType(t.mark.type)?e.mark(t.mark.addToSet(e.marks)):e},i),n.openStart,n.openEnd);return Go.fromReplace(e,this.from,this.to,o)}},{key:"invert",value:function(){return new Zo(this.from,this.to,this.mark)}},{key:"map",value:function(e){var n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new t(n.pos,r.pos,this.mark)}},{key:"merge",value:function(e){return e instanceof t&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new t(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}},{key:"toJSON",value:function(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}}],[{key:"fromJSON",value:function(e,n){if("number"!=typeof n.from||"number"!=typeof n.to)throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new t(n.from,n.to,e.markFromJSON(n.mark))}}])}(Jo);Jo.jsonID("addMark",Yo);var Zo=function(e){function t(e,n,i){var o;return x(this,t),(o=r(this,t)).from=e,o.to=n,o.mark=i,o}return a(t,e),S(t,[{key:"apply",value:function(e){var t=this,n=e.slice(this.from,this.to),r=new Bi(Xo(n.content,function(e){return e.mark(t.mark.removeFromSet(e.marks))},e),n.openStart,n.openEnd);return Go.fromReplace(e,this.from,this.to,r)}},{key:"invert",value:function(){return new Yo(this.from,this.to,this.mark)}},{key:"map",value:function(e){var n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new t(n.pos,r.pos,this.mark)}},{key:"merge",value:function(e){return e instanceof t&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new t(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}},{key:"toJSON",value:function(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}}],[{key:"fromJSON",value:function(e,n){if("number"!=typeof n.from||"number"!=typeof n.to)throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new t(n.from,n.to,e.markFromJSON(n.mark))}}])}(Jo);Jo.jsonID("removeMark",Zo);var Qo=function(e){function t(e,n){var i;return x(this,t),(i=r(this,t)).pos=e,i.mark=n,i}return a(t,e),S(t,[{key:"apply",value:function(e){var t=e.nodeAt(this.pos);if(!t)return Go.fail("No node at mark step's position");var n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return Go.fromReplace(e,this.pos,this.pos+1,new Bi(Di.from(n),0,t.isLeaf?0:1))}},{key:"invert",value:function(e){var n=e.nodeAt(this.pos);if(n){var r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(var i=0;i<n.marks.length;i++)if(!n.marks[i].isInSet(r))return new t(this.pos,n.marks[i]);return new t(this.pos,this.mark)}}return new ea(this.pos,this.mark)}},{key:"map",value:function(e){var n=e.mapResult(this.pos,1);return n.deletedAfter?null:new t(n.pos,this.mark)}},{key:"toJSON",value:function(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}}],[{key:"fromJSON",value:function(e,n){if("number"!=typeof n.pos)throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new t(n.pos,e.markFromJSON(n.mark))}}])}(Jo);Jo.jsonID("addNodeMark",Qo);var ea=function(e){function t(e,n){var i;return x(this,t),(i=r(this,t)).pos=e,i.mark=n,i}return a(t,e),S(t,[{key:"apply",value:function(e){var t=e.nodeAt(this.pos);if(!t)return Go.fail("No node at mark step's position");var n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return Go.fromReplace(e,this.pos,this.pos+1,new Bi(Di.from(n),0,t.isLeaf?0:1))}},{key:"invert",value:function(e){var t=e.nodeAt(this.pos);return t&&this.mark.isInSet(t.marks)?new Qo(this.pos,this.mark):this}},{key:"map",value:function(e){var n=e.mapResult(this.pos,1);return n.deletedAfter?null:new t(n.pos,this.mark)}},{key:"toJSON",value:function(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}}],[{key:"fromJSON",value:function(e,n){if("number"!=typeof n.pos)throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new t(n.pos,e.markFromJSON(n.mark))}}])}(Jo);Jo.jsonID("removeNodeMark",ea);var ta=function(e){function t(e,n,i){var o,a=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return x(this,t),(o=r(this,t)).from=e,o.to=n,o.slice=i,o.structure=a,o}return a(t,e),S(t,[{key:"apply",value:function(e){return this.structure&&ra(e,this.from,this.to)?Go.fail("Structure replace would overwrite content"):Go.fromReplace(e,this.from,this.to,this.slice)}},{key:"getMap",value:function(){return new qo([this.from,this.to-this.from,this.slice.size])}},{key:"invert",value:function(e){return new t(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}},{key:"map",value:function(e){var n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deletedAcross&&r.deletedAcross?null:new t(n.pos,Math.max(n.pos,r.pos),this.slice,this.structure)}},{key:"merge",value:function(e){if(!(e instanceof t)||e.structure||this.structure)return null;if(this.from+this.slice.size!=e.from||this.slice.openEnd||e.slice.openStart){if(e.to!=this.from||this.slice.openStart||e.slice.openEnd)return null;var n=this.slice.size+e.slice.size==0?Bi.empty:new Bi(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new t(e.from,this.to,n,this.structure)}var r=this.slice.size+e.slice.size==0?Bi.empty:new Bi(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new t(this.from,this.to+(e.to-e.from),r,this.structure)}},{key:"toJSON",value:function(){var e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}}],[{key:"fromJSON",value:function(e,n){if("number"!=typeof n.from||"number"!=typeof n.to)throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new t(n.from,n.to,Bi.fromJSON(e,n.slice),!!n.structure)}}])}(Jo);Jo.jsonID("replace",ta);var na=function(e){function t(e,n,i,o,a,s){var c,l=arguments.length>6&&void 0!==arguments[6]&&arguments[6];return x(this,t),(c=r(this,t)).from=e,c.to=n,c.gapFrom=i,c.gapTo=o,c.slice=a,c.insert=s,c.structure=l,c}return a(t,e),S(t,[{key:"apply",value:function(e){if(this.structure&&(ra(e,this.from,this.gapFrom)||ra(e,this.gapTo,this.to)))return Go.fail("Structure gap-replace would overwrite content");var t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return Go.fail("Gap is not a flat range");var n=this.slice.insertAt(this.insert,t.content);return n?Go.fromReplace(e,this.from,this.to,n):Go.fail("Content does not fit in gap")}},{key:"getMap",value:function(){return new qo([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}},{key:"invert",value:function(e){var n=this.gapTo-this.gapFrom;return new t(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}},{key:"map",value:function(e){var n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),i=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),o=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||o>r.pos?null:new t(n.pos,r.pos,i,o,this.slice,this.insert,this.structure)}},{key:"toJSON",value:function(){var e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}}],[{key:"fromJSON",value:function(e,n){if("number"!=typeof n.from||"number"!=typeof n.to||"number"!=typeof n.gapFrom||"number"!=typeof n.gapTo||"number"!=typeof n.insert)throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new t(n.from,n.to,n.gapFrom,n.gapTo,Bi.fromJSON(e,n.slice),n.insert,!!n.structure)}}])}(Jo);function ra(e,t,n){for(var r=e.resolve(t),i=n-t,o=r.depth;i>0&&o>0&&r.indexAfter(o)==r.node(o).childCount;)o--,i--;if(i>0)for(var a=r.node(o).maybeChild(r.indexAfter(o));i>0;){if(!a||a.isLeaf)return!0;a=a.firstChild,i--}return!1}function ia(e,t,n){for(var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:n.contentMatch,i=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],o=e.doc.nodeAt(t),a=[],s=t+1,c=0;c<o.childCount;c++){var l=o.child(c),u=s+l.nodeSize,d=r.matchType(l.type);if(d){r=d;for(var h=0;h<l.marks.length;h++)n.allowsMarkType(l.marks[h].type)||e.step(new Zo(s,u,l.marks[h]));if(i&&l.isText&&"pre"!=n.whitespace)for(var f=void 0,p=/\r?\n|\r/g,v=void 0;f=p.exec(l.text);)v||(v=new Bi(Di.from(n.schema.text(" ",n.allowedMarks(l.marks))),0,0)),a.push(new ta(s+f.index,s+f.index+f[0].length,v))}else a.push(new ta(s,u,Bi.empty));s=u}if(!r.validEnd){var m=r.fillBefore(Di.empty,!0);e.replace(s,s,new Bi(m,0,0))}for(var g=a.length-1;g>=0;g--)e.step(a[g])}function oa(e,t,n){return(0==t||e.canReplace(t,e.childCount))&&(n==e.childCount||e.canReplace(0,n))}function aa(e){for(var t=e.parent.content.cutByIndex(e.startIndex,e.endIndex),n=e.depth,r=0,i=0;;--n){var o=e.$from.node(n),a=e.$from.index(n)+r,s=e.$to.indexAfter(n)-i;if(n<e.depth&&o.canReplace(a,s,t))return n;if(0==n||o.type.spec.isolating||!oa(o,a,s))break;a&&(r=1),s<o.childCount&&(i=1)}return null}function sa(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:e,i=function(e,t){var n=e.parent,r=e.startIndex,i=e.endIndex,o=n.contentMatchAt(r).findWrapping(t);if(!o)return null;var a=o.length?o[0]:t;return n.canReplaceWith(r,i,a)?o:null}(e,t),o=i&&function(e,t){var n=e.parent,r=e.startIndex,i=e.endIndex,o=n.child(r),a=t.contentMatch.findWrapping(o.type);if(!a)return null;for(var s=(a.length?a[a.length-1]:t).contentMatch,c=r;s&&c<i;c++)s=s.matchType(n.child(c).type);return s&&s.validEnd?a:null}(r,t);return o?i.map(ca).concat({type:t,attrs:n}).concat(o.map(ca)):null}function ca(e){return{type:e,attrs:null}}function la(e,t,n,r){t.forEach(function(i,o){if(i.isText)for(var a,s=/\r?\n|\r/g;a=s.exec(i.text);){var c=e.mapping.slice(r).map(n+1+o+a.index);e.replaceWith(c,c+1,t.type.schema.linebreakReplacement.create())}})}function ua(e,t,n,r){t.forEach(function(i,o){if(i.type==i.type.schema.linebreakReplacement){var a=e.mapping.slice(r).map(n+1+o);e.replaceWith(a,a+1,t.type.schema.text("\n"))}})}function da(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=arguments.length>3?arguments[3]:void 0,i=e.resolve(t),o=i.depth-n,a=r&&r[r.length-1]||i.parent;if(o<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!a.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(var s=i.depth-1,c=n-2;s>o;s--,c--){var l=i.node(s),u=i.index(s);if(l.type.spec.isolating)return!1;var d=l.content.cutByIndex(u,l.childCount),h=r&&r[c+1];h&&(d=d.replaceChild(0,h.type.create(h.attrs)));var f=r&&r[c]||l;if(!l.canReplace(u+1,l.childCount)||!f.type.validContent(d))return!1}var p=i.indexAfter(o),v=r&&r[0];return i.node(o).canReplaceWith(p,p,v?v.type:i.node(o+1).type)}function ha(e,t){var n=e.resolve(t),r=n.index();return fa(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function fa(e,t){return!(!e||!t||e.isLeaf||!function(e,t){t.content.size||e.type.compatibleContent(t.type);for(var n=e.contentMatchAt(e.childCount),r=e.type.schema.linebreakReplacement,i=0;i<t.childCount;i++){var o=t.child(i),a=o.type==r?e.type.schema.nodes.text:o.type;if(!(n=n.matchType(a)))return!1;if(!e.type.allowsMarks(o.marks))return!1}return n.validEnd}(e,t))}function pa(e,t){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1,r=e.resolve(t),i=r.depth;;i--){var o=void 0,a=void 0,s=r.index(i);if(i==r.depth?(o=r.nodeBefore,a=r.nodeAfter):n>0?(o=r.node(i+1),s++,a=r.node(i).maybeChild(s)):(o=r.node(i).maybeChild(s-1),a=r.node(i+1)),o&&!o.isTextblock&&fa(o,a)&&r.node(i).canReplace(s,s+1))return t;if(0==i)break;t=n<0?r.before(i):r.after(i)}}function va(e,t,n){var r=e.resolve(t);if(!n.content.size)return t;for(var i=n.content,o=0;o<n.openStart;o++)i=i.firstChild.content;for(var a=1;a<=(0==n.openStart&&n.size?2:1);a++)for(var s=r.depth;s>=0;s--){var c=s==r.depth?0:r.pos<=(r.start(s+1)+r.end(s+1))/2?-1:1,l=r.index(s)+(c>0?1:0),u=r.node(s),d=!1;if(1==a)d=u.canReplace(l,l,i);else{var h=u.contentMatchAt(l).findWrapping(i.firstChild.type);d=h&&u.canReplaceWith(l,l,h[0])}if(d)return 0==c?r.pos:c<0?r.before(s+1):r.after(s+1)}return null}function ma(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Bi.empty;if(t==n&&!r.size)return null;var i=e.resolve(t),o=e.resolve(n);return ga(i,o,r)?new ta(t,n,r):new ya(i,o,r).fit()}function ga(e,t,n){return!n.openStart&&!n.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),n.content)}Jo.jsonID("replaceAround",na);var ya=function(){return S(function e(t,n,r){x(this,e),this.$from=t,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=Di.empty;for(var i=0;i<=t.depth;i++){var o=t.node(i);this.frontier.push({type:o.type,match:o.contentMatchAt(t.indexAfter(i))})}for(var a=t.depth;a>0;a--)this.placed=Di.from(t.node(a).copy(this.placed))},[{key:"depth",get:function(){return this.frontier.length-1}},{key:"fit",value:function(){for(;this.unplaced.size;){var e=this.findFittable();e?this.placeNodes(e):this.openMore()||this.dropNode()}var t=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,i=this.close(t<0?this.$to:r.doc.resolve(t));if(!i)return null;for(var o=this.placed,a=r.depth,s=i.depth;a&&s&&1==o.childCount;)o=o.firstChild.content,a--,s--;var c=new Bi(o,a,s);return t>-1?new na(r.pos,t,this.$to.pos,this.$to.end(),c,n):c.size||r.pos!=this.$to.pos?new ta(r.pos,i.pos,c):null}},{key:"findFittable",value:function(){for(var e=this.unplaced.openStart,t=this.unplaced.content,n=0,r=this.unplaced.openEnd;n<e;n++){var i=t.firstChild;if(t.childCount>1&&(r=0),i.type.spec.isolating&&r<=n){e=n;break}t=i.content}for(var o=1;o<=2;o++)for(var a=1==o?e:this.unplaced.openStart;a>=0;a--)for(var s=null,c=(a?(s=ba(this.unplaced.content,a-1).firstChild).content:this.unplaced.content).firstChild,l=this.depth;l>=0;l--){var u=this.frontier[l],d=u.type,h=u.match,f=void 0,p=null;if(1==o&&(c?h.matchType(c.type)||(p=h.fillBefore(Di.from(c),!1)):s&&d.compatibleContent(s.type)))return{sliceDepth:a,frontierDepth:l,parent:s,inject:p};if(2==o&&c&&(f=h.findWrapping(c.type)))return{sliceDepth:a,frontierDepth:l,parent:s,wrap:f};if(s&&h.matchType(s.type))break}}},{key:"openMore",value:function(){var e=this.unplaced,t=e.content,n=e.openStart,r=e.openEnd,i=ba(t,n);return!(!i.childCount||i.firstChild.isLeaf)&&(this.unplaced=new Bi(t,n+1,Math.max(r,i.size+n>=t.size-r?n+1:0)),!0)}},{key:"dropNode",value:function(){var e=this.unplaced,t=e.content,n=e.openStart,r=e.openEnd,i=ba(t,n);if(i.childCount<=1&&n>0){var o=t.size-n<=n+i.size;this.unplaced=new Bi(ka(t,n-1,1),n-1,o?n-1:r)}else this.unplaced=new Bi(ka(t,n,1),n,r)}},{key:"placeNodes",value:function(e){for(var t=e.sliceDepth,n=e.frontierDepth,r=e.parent,i=e.inject,o=e.wrap;this.depth>n;)this.closeFrontierNode();if(o)for(var a=0;a<o.length;a++)this.openFrontierNode(o[a]);var s=this.unplaced,c=r?r.content:s.content,l=s.openStart-t,u=0,d=[],h=this.frontier[n],f=h.match,p=h.type;if(i){for(var v=0;v<i.childCount;v++)d.push(i.child(v));f=f.matchFragment(i)}for(var m=c.size+t-(s.content.size-s.openEnd);u<c.childCount;){var g=c.child(u),y=f.matchType(g.type);if(!y)break;(++u>1||0==l||g.content.size)&&(f=y,d.push(xa(g.mark(p.allowedMarks(g.marks)),1==u?l:0,u==c.childCount?m:-1)))}var k=u==c.childCount;k||(m=-1),this.placed=wa(this.placed,n,Di.from(d)),this.frontier[n].match=f,k&&m<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(var w=0,b=c;w<m;w++){var x=b.lastChild;this.frontier.push({type:x.type,match:x.contentMatchAt(x.childCount)}),b=x.content}this.unplaced=k?0==t?Bi.empty:new Bi(ka(s.content,t-1,1),t-1,m<0?s.openEnd:t-1):new Bi(ka(s.content,t,u),s.openStart,s.openEnd)}},{key:"mustMoveInline",value:function(){if(!this.$to.parent.isTextblock)return-1;var e,t=this.frontier[this.depth];if(!t.type.isTextblock||!Ca(this.$to,this.$to.depth,t.type,t.match,!1)||this.$to.depth==this.depth&&(e=this.findCloseLevel(this.$to))&&e.depth==this.depth)return-1;for(var n=this.$to.depth,r=this.$to.after(n);n>1&&r==this.$to.end(--n);)++r;return r}},{key:"findCloseLevel",value:function(e){e:for(var t=Math.min(this.depth,e.depth);t>=0;t--){var n=this.frontier[t],r=n.match,i=n.type,o=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),a=Ca(e,t,i,r,o);if(a){for(var s=t-1;s>=0;s--){var c=this.frontier[s],l=c.match,u=Ca(e,s,c.type,l,!0);if(!u||u.childCount)continue e}return{depth:t,fit:a,move:o?e.doc.resolve(e.after(t+1)):e}}}}},{key:"close",value:function(e){var t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=wa(this.placed,t.depth,t.fit)),e=t.move;for(var n=t.depth+1;n<=e.depth;n++){var r=e.node(n),i=r.type.contentMatch.fillBefore(r.content,!0,e.index(n));this.openFrontierNode(r.type,r.attrs,i)}return e}},{key:"openFrontierNode",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2?arguments[2]:void 0,r=this.frontier[this.depth];r.match=r.match.matchType(e),this.placed=wa(this.placed,this.depth,Di.from(e.create(t,n))),this.frontier.push({type:e,match:e.contentMatch})}},{key:"closeFrontierNode",value:function(){var e=this.frontier.pop().match.fillBefore(Di.empty,!0);e.childCount&&(this.placed=wa(this.placed,this.frontier.length,e))}}])}();function ka(e,t,n){return 0==t?e.cutByIndex(n,e.childCount):e.replaceChild(0,e.firstChild.copy(ka(e.firstChild.content,t-1,n)))}function wa(e,t,n){return 0==t?e.append(n):e.replaceChild(e.childCount-1,e.lastChild.copy(wa(e.lastChild.content,t-1,n)))}function ba(e,t){for(var n=0;n<t;n++)e=e.firstChild.content;return e}function xa(e,t,n){if(t<=0)return e;var r=e.content;return t>1&&(r=r.replaceChild(0,xa(r.firstChild,t-1,1==r.childCount?n-1:0))),t>0&&(r=e.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(e.type.contentMatch.matchFragment(r).fillBefore(Di.empty,!0)))),e.copy(r)}function Ca(e,t,n,r,i){var o=e.node(t),a=i?e.indexAfter(t):e.index(t);if(a==o.childCount&&!n.compatibleContent(o.type))return null;var s=r.fillBefore(o.content,!0,a);return s&&!function(e,t,n){for(var r=n;r<t.childCount;r++)if(!e.allowsMarks(t.child(r).marks))return!0;return!1}(n,o.content,a)?s:null}function Sa(e){return e.spec.defining||e.spec.definingForContent}function _a(e,t,n,r,i){if(t<n){var o=e.firstChild;e=e.replaceChild(0,o.copy(_a(o.content,t+1,n,r,o)))}if(t>r){var a=i.contentMatchAt(0),s=a.fillBefore(e).append(e);e=s.append(a.matchFragment(s).fillBefore(Di.empty,!0))}return e}function Ma(e,t){for(var n=[],r=Math.min(e.depth,t.depth);r>=0;r--){var i=e.start(r);if(i<e.pos-(e.depth-r)||t.end(r)>t.pos+(t.depth-r)||e.node(r).type.spec.isolating||t.node(r).type.spec.isolating)break;(i==t.start(r)||r==e.depth&&r==t.depth&&e.parent.inlineContent&&t.parent.inlineContent&&r&&t.start(r-1)==i-1)&&n.push(r)}return n}var Na=function(e){function t(e,n,i){var o;return x(this,t),(o=r(this,t)).pos=e,o.attr=n,o.value=i,o}return a(t,e),S(t,[{key:"apply",value:function(e){var t=e.nodeAt(this.pos);if(!t)return Go.fail("No node at attribute step's position");var n=Object.create(null);for(var r in t.attrs)n[r]=t.attrs[r];n[this.attr]=this.value;var i=t.type.create(n,null,t.marks);return Go.fromReplace(e,this.pos,this.pos+1,new Bi(Di.from(i),0,t.isLeaf?0:1))}},{key:"getMap",value:function(){return qo.empty}},{key:"invert",value:function(e){return new t(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}},{key:"map",value:function(e){var n=e.mapResult(this.pos,1);return n.deletedAfter?null:new t(n.pos,this.attr,this.value)}},{key:"toJSON",value:function(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}}],[{key:"fromJSON",value:function(e,n){if("number"!=typeof n.pos||"string"!=typeof n.attr)throw new RangeError("Invalid input for AttrStep.fromJSON");return new t(n.pos,n.attr,n.value)}}])}(Jo);Jo.jsonID("attr",Na);var Ta=function(e){function t(e,n){var i;return x(this,t),(i=r(this,t)).attr=e,i.value=n,i}return a(t,e),S(t,[{key:"apply",value:function(e){var t=Object.create(null);for(var n in e.attrs)t[n]=e.attrs[n];t[this.attr]=this.value;var r=e.type.create(t,e.content,e.marks);return Go.ok(r)}},{key:"getMap",value:function(){return qo.empty}},{key:"invert",value:function(e){return new t(this.attr,e.attrs[this.attr])}},{key:"map",value:function(e){return this}},{key:"toJSON",value:function(){return{stepType:"docAttr",attr:this.attr,value:this.value}}}],[{key:"fromJSON",value:function(e,n){if("string"!=typeof n.attr)throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new t(n.attr,n.value)}}])}(Jo);Jo.jsonID("docAttr",Ta);var Oa=Error;((Oa=function e(t){var n=Error.call(this,t);return n.__proto__=e.prototype,n}).prototype=Object.create(Error.prototype)).constructor=Oa,Oa.prototype.name="TransformError";var Ea=function(){return S(function e(t){x(this,e),this.doc=t,this.steps=[],this.docs=[],this.mapping=new Uo},[{key:"before",get:function(){return this.docs.length?this.docs[0]:this.doc}},{key:"step",value:function(e){var t=this.maybeStep(e);if(t.failed)throw new Oa(t.failed);return this}},{key:"maybeStep",value:function(e){var t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}},{key:"docChanged",get:function(){return this.steps.length>0}},{key:"addStep",value:function(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}},{key:"replace",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Bi.empty,r=ma(this.doc,e,t,n);return r&&this.step(r),this}},{key:"replaceWith",value:function(e,t,n){return this.replace(e,t,new Bi(Di.from(n),0,0))}},{key:"delete",value:function(e,t){return this.replace(e,t,Bi.empty)}},{key:"insert",value:function(e,t){return this.replaceWith(e,e,t)}},{key:"replaceRange",value:function(e,t,n){return function(e,t,n,r){if(!r.size)return e.deleteRange(t,n);var i=e.doc.resolve(t),o=e.doc.resolve(n);if(ga(i,o,r))return e.step(new ta(t,n,r));var a=Ma(i,o);0==a[a.length-1]&&a.pop();var s=-(i.depth+1);a.unshift(s);for(var c=i.depth,l=i.pos-1;c>0;c--,l--){var u=i.node(c).type.spec;if(u.defining||u.definingAsContext||u.isolating)break;a.indexOf(c)>-1?s=c:i.before(c)==l&&a.splice(1,0,-c)}for(var d=a.indexOf(s),h=[],f=r.openStart,p=r.content,v=0;;v++){var m=p.firstChild;if(h.push(m),v==r.openStart)break;p=m.content}for(var g=f-1;g>=0;g--){var y=h[g],k=Sa(y.type);if(k&&!y.sameMarkup(i.node(Math.abs(s)-1)))f=g;else if(k||!y.type.isTextblock)break}for(var w=r.openStart;w>=0;w--){var b=(w+f+1)%(r.openStart+1),x=h[b];if(x)for(var C=0;C<a.length;C++){var S=a[(C+d)%a.length],_=!0;S<0&&(_=!1,S=-S);var M=i.node(S-1),N=i.index(S-1);if(M.canReplaceWith(N,N,x.type,x.marks))return e.replace(i.before(S),_?o.after(S):n,new Bi(_a(r.content,0,r.openStart,b),b,r.openEnd))}}for(var T=e.steps.length,O=a.length-1;O>=0&&(e.replace(t,n,r),!(e.steps.length>T));O--){var E=a[O];E<0||(t=i.before(E),n=o.after(E))}}(this,e,t,n),this}},{key:"replaceRangeWith",value:function(e,t,n){return function(e,t,n,r){if(!r.isInline&&t==n&&e.doc.resolve(t).parent.content.size){var i=function(e,t,n){var r=e.resolve(t);if(r.parent.canReplaceWith(r.index(),r.index(),n))return t;if(0==r.parentOffset)for(var i=r.depth-1;i>=0;i--){var o=r.index(i);if(r.node(i).canReplaceWith(o,o,n))return r.before(i+1);if(o>0)return null}if(r.parentOffset==r.parent.content.size)for(var a=r.depth-1;a>=0;a--){var s=r.indexAfter(a);if(r.node(a).canReplaceWith(s,s,n))return r.after(a+1);if(s<r.node(a).childCount)return null}return null}(e.doc,t,r.type);null!=i&&(t=n=i)}e.replaceRange(t,n,new Bi(Di.from(r),0,0))}(this,e,t,n),this}},{key:"deleteRange",value:function(e,t){return function(e,t,n){for(var r=e.doc.resolve(t),i=e.doc.resolve(n),o=Ma(r,i),a=0;a<o.length;a++){var s=o[a],c=a==o.length-1;if(c&&0==s||r.node(s).type.contentMatch.validEnd)return e.delete(r.start(s),i.end(s));if(s>0&&(c||r.node(s-1).canReplace(r.index(s-1),i.indexAfter(s-1))))return e.delete(r.before(s),i.after(s))}for(var l=1;l<=r.depth&&l<=i.depth;l++)if(t-r.start(l)==r.depth-l&&n>r.end(l)&&i.end(l)-n!=i.depth-l&&r.start(l-1)==i.start(l-1)&&r.node(l-1).canReplace(r.index(l-1),i.index(l-1)))return e.delete(r.before(l),n);e.delete(t,n)}(this,e,t),this}},{key:"lift",value:function(e,t){return function(e,t,n){for(var r=t.$from,i=t.$to,o=t.depth,a=r.before(o+1),s=i.after(o+1),c=a,l=s,u=Di.empty,d=0,h=o,f=!1;h>n;h--)f||r.index(h)>0?(f=!0,u=Di.from(r.node(h).copy(u)),d++):c--;for(var p=Di.empty,v=0,m=o,g=!1;m>n;m--)g||i.after(m+1)<i.end(m)?(g=!0,p=Di.from(i.node(m).copy(p)),v++):l++;e.step(new na(c,l,a,s,new Bi(u.append(p),d,v),u.size-d,!0))}(this,e,t),this}},{key:"join",value:function(e){return function(e,t,n){var r=null,i=e.doc.type.schema.linebreakReplacement,o=e.doc.resolve(t-n),a=o.node().type;if(i&&a.inlineContent){var s="pre"==a.whitespace,c=!!a.contentMatch.matchType(i);s&&!c?r=!1:!s&&c&&(r=!0)}var l=e.steps.length;if(!1===r){var u=e.doc.resolve(t+n);ua(e,u.node(),u.before(),l)}a.inlineContent&&ia(e,t+n-1,a,o.node().contentMatchAt(o.index()),null==r);var d=e.mapping.slice(l),h=d.map(t-n);if(e.step(new ta(h,d.map(t+n,-1),Bi.empty,!0)),!0===r){var f=e.doc.resolve(h);la(e,f.node(),f.before(),e.steps.length)}}(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:1),this}},{key:"wrap",value:function(e,t){return function(e,t,n){for(var r=Di.empty,i=n.length-1;i>=0;i--){if(r.size){var o=n[i].type.contentMatch.matchFragment(r);if(!o||!o.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=Di.from(n[i].type.create(n[i].attrs,r))}var a=t.start,s=t.end;e.step(new na(a,s,a,s,new Bi(r,0,0),n.length,!0))}(this,e,t),this}},{key:"setBlockType",value:function(e){return function(e,t,n,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");var o=e.steps.length;e.doc.nodesBetween(t,n,function(t,n){var a="function"==typeof i?i(t):i;if(t.isTextblock&&!t.hasMarkup(r,a)&&function(e,t,n){var r=e.resolve(t),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}(e.doc,e.mapping.slice(o).map(n),r)){var s=null;if(r.schema.linebreakReplacement){var c="pre"==r.whitespace,l=!!r.contentMatch.matchType(r.schema.linebreakReplacement);c&&!l?s=!1:!c&&l&&(s=!0)}!1===s&&ua(e,t,n,o),ia(e,e.mapping.slice(o).map(n,1),r,void 0,null===s);var u=e.mapping.slice(o),d=u.map(n,1),h=u.map(n+t.nodeSize,1);return e.step(new na(d,h,d+1,h-1,new Bi(Di.from(r.create(a,null,t.marks)),0,0),1,!0)),!0===s&&la(e,t,n,o),!1}})}(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:e,arguments.length>2?arguments[2]:void 0,arguments.length>3&&void 0!==arguments[3]?arguments[3]:null),this}},{key:"setNodeMarkup",value:function(e,t){return function(e,t,n,r,i){var o=e.doc.nodeAt(t);if(!o)throw new RangeError("No node at given position");n||(n=o.type);var a=n.create(r,null,i||o.marks);if(o.isLeaf)return e.replaceWith(t,t+o.nodeSize,a);if(!n.validContent(o.content))throw new RangeError("Invalid content for node type "+n.name);e.step(new na(t,t+o.nodeSize,t+1,t+o.nodeSize-1,new Bi(Di.from(a),0,0),1,!0))}(this,e,t,arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,arguments.length>3?arguments[3]:void 0),this}},{key:"setNodeAttribute",value:function(e,t,n){return this.step(new Na(e,t,n)),this}},{key:"setDocAttribute",value:function(e,t){return this.step(new Ta(e,t)),this}},{key:"addNodeMark",value:function(e,t){return this.step(new Qo(e,t)),this}},{key:"removeNodeMark",value:function(e,t){var n=this.doc.nodeAt(e);if(!n)throw new RangeError("No node at position "+e);if(t instanceof Pi)t.isInSet(n.marks)&&this.step(new ea(e,t));else{for(var r,i=n.marks,o=[];r=t.isInSet(i);)o.push(new ea(e,r)),i=r.removeFromSet(i);for(var a=o.length-1;a>=0;a--)this.step(o[a])}return this}},{key:"split",value:function(e){return function(e,t){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=arguments.length>3?arguments[3]:void 0,i=e.doc.resolve(t),o=Di.empty,a=Di.empty,s=i.depth,c=i.depth-n,l=n-1;s>c;s--,l--){o=Di.from(i.node(s).copy(o));var u=r&&r[l];a=Di.from(u?u.type.create(u.attrs,a):i.node(s).copy(a))}e.step(new ta(t,t,new Bi(o.append(a),n,n),!0))}(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,arguments.length>2?arguments[2]:void 0),this}},{key:"addMark",value:function(e,t,n){return function(e,t,n,r){var i,o,a=[],s=[];e.doc.nodesBetween(t,n,function(e,c,l){if(e.isInline){var u=e.marks;if(!r.isInSet(u)&&l.type.allowsMarkType(r.type)){for(var d=Math.max(c,t),h=Math.min(c+e.nodeSize,n),f=r.addToSet(u),p=0;p<u.length;p++)u[p].isInSet(f)||(i&&i.to==d&&i.mark.eq(u[p])?i.to=h:a.push(i=new Zo(d,h,u[p])));o&&o.to==d?o.to=h:s.push(o=new Yo(d,h,r))}}}),a.forEach(function(t){return e.step(t)}),s.forEach(function(t){return e.step(t)})}(this,e,t,n),this}},{key:"removeMark",value:function(e,t,n){return function(e,t,n,r){var i=[],o=0;e.doc.nodesBetween(t,n,function(e,a){if(e.isInline){o++;var s=null;if(r instanceof xo)for(var c,l=e.marks;c=r.isInSet(l);)(s||(s=[])).push(c),l=c.removeFromSet(l);else r?r.isInSet(e.marks)&&(s=[r]):s=e.marks;if(s&&s.length)for(var u=Math.min(a+e.nodeSize,n),d=0;d<s.length;d++){for(var h=s[d],f=void 0,p=0;p<i.length;p++){var v=i[p];v.step==o-1&&h.eq(i[p].style)&&(f=v)}f?(f.to=u,f.step=o):i.push({style:h,from:Math.max(a,t),to:u,step:o})}}}),i.forEach(function(t){return e.step(new Zo(t.from,t.to,t.style))})}(this,e,t,n),this}},{key:"clearIncompatible",value:function(e,t,n){return ia(this,e,t,n),this}}])}(),Aa=Object.create(null),Da=function(){return S(function e(t,n,r){x(this,e),this.$anchor=t,this.$head=n,this.ranges=r||[new Ia(t.min(n),t.max(n))]},[{key:"anchor",get:function(){return this.$anchor.pos}},{key:"head",get:function(){return this.$head.pos}},{key:"from",get:function(){return this.$from.pos}},{key:"to",get:function(){return this.$to.pos}},{key:"$from",get:function(){return this.ranges[0].$from}},{key:"$to",get:function(){return this.ranges[0].$to}},{key:"empty",get:function(){for(var e=this.ranges,t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}},{key:"content",value:function(){return this.$from.doc.slice(this.from,this.to,!0)}},{key:"replace",value:function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Bi.empty,n=t.content.lastChild,r=null,i=0;i<t.openEnd;i++)r=n,n=n.lastChild;for(var o=e.steps.length,a=this.ranges,s=0;s<a.length;s++){var c=a[s],l=c.$from,u=c.$to,d=e.mapping.slice(o);e.replaceRange(d.map(l.pos),d.map(u.pos),s?Bi.empty:t),0==s&&Ha(e,o,(n?n.isInline:r&&r.isTextblock)?-1:1)}}},{key:"replaceWith",value:function(e,t){for(var n=e.steps.length,r=this.ranges,i=0;i<r.length;i++){var o=r[i],a=o.$from,s=o.$to,c=e.mapping.slice(n),l=c.map(a.pos),u=c.map(s.pos);i?e.deleteRange(l,u):(e.replaceRangeWith(l,u,t),Ha(e,n,t.isInline?-1:1))}}},{key:"getBookmark",value:function(){return Pa.between(this.$anchor,this.$head).getBookmark()}}],[{key:"findFrom",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=e.parent.inlineContent?new Pa(e):$a(e.node(0),e.parent,e.pos,e.index(),t,n);if(r)return r;for(var i=e.depth-1;i>=0;i--){var o=t<0?$a(e.node(0),e.node(i),e.before(i+1),e.index(i),t,n):$a(e.node(0),e.node(i),e.after(i+1),e.index(i)+1,t,n);if(o)return o}return null}},{key:"near",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return this.findFrom(e,t)||this.findFrom(e,-t)||new Fa(e.node(0))}},{key:"atStart",value:function(e){return $a(e,e,0,0,1)||new Fa(e)}},{key:"atEnd",value:function(e){return $a(e,e,e.content.size,e.childCount,-1)||new Fa(e)}},{key:"fromJSON",value:function(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");var n=Aa[t.type];if(!n)throw new RangeError("No selection type ".concat(t.type," defined"));return n.fromJSON(e,t)}},{key:"jsonID",value:function(e,t){if(e in Aa)throw new RangeError("Duplicate use of selection JSON ID "+e);return Aa[e]=t,t.prototype.jsonID=e,t}}])}();Da.prototype.visible=!0;var Ia=S(function e(t,n){x(this,e),this.$from=t,this.$to=n}),za=!1;function Ra(e){za||e.parent.inlineContent||(za=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+e.parent.type.name+")"))}var Pa=function(t){function n(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e;return x(this,n),Ra(e),Ra(t),r(this,n,[e,t])}return a(n,t),S(n,[{key:"$cursor",get:function(){return this.$anchor.pos==this.$head.pos?this.$head:null}},{key:"map",value:function(e,t){var r=e.resolve(t.map(this.head));if(!r.parent.inlineContent)return Da.near(r);var i=e.resolve(t.map(this.anchor));return new n(i.parent.inlineContent?i:r,r)}},{key:"replace",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Bi.empty;if(e(n,"replace",this,3)([t,r]),r==Bi.empty){var i=this.$from.marksAcross(this.$to);i&&t.ensureMarks(i)}}},{key:"eq",value:function(e){return e instanceof n&&e.anchor==this.anchor&&e.head==this.head}},{key:"getBookmark",value:function(){return new La(this.anchor,this.head)}},{key:"toJSON",value:function(){return{type:"text",anchor:this.anchor,head:this.head}}}],[{key:"fromJSON",value:function(e,t){if("number"!=typeof t.anchor||"number"!=typeof t.head)throw new RangeError("Invalid input for TextSelection.fromJSON");return new n(e.resolve(t.anchor),e.resolve(t.head))}},{key:"create",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t,r=e.resolve(t);return new this(r,n==t?r:e.resolve(n))}},{key:"between",value:function(e,t,r){var i=e.pos-t.pos;if(r&&!i||(r=i>=0?1:-1),!t.parent.inlineContent){var o=Da.findFrom(t,r,!0)||Da.findFrom(t,-r,!0);if(!o)return Da.near(t,r);t=o.$head}return e.parent.inlineContent||(0==i||(e=(Da.findFrom(e,-r,!0)||Da.findFrom(e,r,!0)).$anchor).pos<t.pos!=i<0)&&(e=t),new n(e,t)}}])}(Da);Da.jsonID("text",Pa);var La=function(){function e(t,n){x(this,e),this.anchor=t,this.head=n}return S(e,[{key:"map",value:function(t){return new e(t.map(this.anchor),t.map(this.head))}},{key:"resolve",value:function(e){return Pa.between(e.resolve(this.anchor),e.resolve(this.head))}}])}(),Ba=function(e){function t(e){var n;x(this,t);var i=e.nodeAfter,o=e.node(0).resolve(e.pos+i.nodeSize);return(n=r(this,t,[e,o])).node=i,n}return a(t,e),S(t,[{key:"map",value:function(e,n){var r=n.mapResult(this.anchor),i=r.deleted,o=r.pos,a=e.resolve(o);return i?Da.near(a):new t(a)}},{key:"content",value:function(){return new Bi(Di.from(this.node),0,0)}},{key:"eq",value:function(e){return e instanceof t&&e.anchor==this.anchor}},{key:"toJSON",value:function(){return{type:"node",anchor:this.anchor}}},{key:"getBookmark",value:function(){return new Va(this.anchor)}}],[{key:"fromJSON",value:function(e,n){if("number"!=typeof n.anchor)throw new RangeError("Invalid input for NodeSelection.fromJSON");return new t(e.resolve(n.anchor))}},{key:"create",value:function(e,n){return new t(e.resolve(n))}},{key:"isSelectable",value:function(e){return!e.isText&&!1!==e.type.spec.selectable}}])}(Da);Ba.prototype.visible=!1,Da.jsonID("node",Ba);var Va=function(){function e(t){x(this,e),this.anchor=t}return S(e,[{key:"map",value:function(t){var n=t.mapResult(this.anchor),r=n.deleted,i=n.pos;return r?new La(i,i):new e(i)}},{key:"resolve",value:function(e){var t=e.resolve(this.anchor),n=t.nodeAfter;return n&&Ba.isSelectable(n)?new Ba(t):Da.near(t)}}])}(),Fa=function(t){function n(e){return x(this,n),r(this,n,[e.resolve(0),e.resolve(e.content.size)])}return a(n,t),S(n,[{key:"replace",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Bi.empty;if(r==Bi.empty){t.delete(0,t.doc.content.size);var i=Da.atStart(t.doc);i.eq(t.selection)||t.setSelection(i)}else e(n,"replace",this,3)([t,r])}},{key:"toJSON",value:function(){return{type:"all"}}},{key:"map",value:function(e){return new n(e)}},{key:"eq",value:function(e){return e instanceof n}},{key:"getBookmark",value:function(){return ja}}],[{key:"fromJSON",value:function(e){return new n(e)}}])}(Da);Da.jsonID("all",Fa);var ja={map:function(){return this},resolve:function(e){return new Fa(e)}};function $a(e,t,n,r,i){var o=arguments.length>5&&void 0!==arguments[5]&&arguments[5];if(t.inlineContent)return Pa.create(e,n);for(var a=r-(i>0?0:1);i>0?a<t.childCount:a>=0;a+=i){var s=t.child(a);if(s.isAtom){if(!o&&Ba.isSelectable(s))return Ba.create(e,n-(i<0?s.nodeSize:0))}else{var c=$a(e,s,n+i,i<0?s.childCount:0,i,o);if(c)return c}n+=s.nodeSize*i}return null}function Ha(e,t,n){var r=e.steps.length-1;if(!(r<t)){var i,o=e.steps[r];if(o instanceof ta||o instanceof na)e.mapping.maps[r].forEach(function(e,t,n,r){null==i&&(i=r)}),e.setSelection(Da.near(e.doc.resolve(i),n))}}var Wa=function(t){function n(e){var t;return x(this,n),(t=r(this,n,[e.doc])).curSelectionFor=0,t.updated=0,t.meta=Object.create(null),t.time=Date.now(),t.curSelection=e.selection,t.storedMarks=e.storedMarks,t}return a(n,t),S(n,[{key:"selection",get:function(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}},{key:"setSelection",value:function(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=-3&this.updated|1,this.storedMarks=null,this}},{key:"selectionSet",get:function(){return(1&this.updated)>0}},{key:"setStoredMarks",value:function(e){return this.storedMarks=e,this.updated|=2,this}},{key:"ensureMarks",value:function(e){return Pi.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}},{key:"addStoredMark",value:function(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}},{key:"removeStoredMark",value:function(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}},{key:"storedMarksSet",get:function(){return(2&this.updated)>0}},{key:"addStep",value:function(t,r){e(n,"addStep",this,3)([t,r]),this.updated=-3&this.updated,this.storedMarks=null}},{key:"setTime",value:function(e){return this.time=e,this}},{key:"replaceSelection",value:function(e){return this.selection.replace(this,e),this}},{key:"replaceSelectionWith",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=this.selection;return t&&(e=e.mark(this.storedMarks||(n.empty?n.$from.marks():n.$from.marksAcross(n.$to)||Pi.none))),n.replaceWith(this,e),this}},{key:"deleteSelection",value:function(){return this.selection.replace(this),this}},{key:"insertText",value:function(e,t,n){var r=this.doc.type.schema;if(null==t)return e?this.replaceSelectionWith(r.text(e),!0):this.deleteSelection();if(null==n&&(n=t),!e)return this.deleteRange(t,n);var i=this.storedMarks;if(!i){var o=this.doc.resolve(t);i=n==t?o.marks():o.marksAcross(this.doc.resolve(n))}return this.replaceRangeWith(t,n,r.text(e,i)),this.selection.empty||this.selection.to!=t+e.length||this.setSelection(Da.near(this.selection.$to)),this}},{key:"setMeta",value:function(e,t){return this.meta["string"==typeof e?e:e.key]=t,this}},{key:"getMeta",value:function(e){return this.meta["string"==typeof e?e:e.key]}},{key:"isGeneric",get:function(){for(var e in this.meta)return!1;return!0}},{key:"scrollIntoView",value:function(){return this.updated|=4,this}},{key:"scrolledIntoView",get:function(){return(4&this.updated)>0}}])}(Ea);function qa(e,t){return t&&e?e.bind(t):e}var Ua=S(function e(t,n,r){x(this,e),this.name=t,this.init=qa(n.init,r),this.apply=qa(n.apply,r)}),Ka=[new Ua("doc",{init:function(e){return e.doc||e.schema.topNodeType.createAndFill()},apply:function(e){return e.doc}}),new Ua("selection",{init:function(e,t){return e.selection||Da.atStart(t.doc)},apply:function(e){return e.selection}}),new Ua("storedMarks",{init:function(e){return e.storedMarks||null},apply:function(e,t,n,r){return r.selection.$cursor?e.storedMarks:null}}),new Ua("scrollToSelection",{init:function(){return 0},apply:function(e,t){return e.scrolledIntoView?t+1:t}})],Ja=S(function e(t,n){var r=this;x(this,e),this.schema=t,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=Ka.slice(),n&&n.forEach(function(e){if(r.pluginsByKey[e.key])throw new RangeError("Adding different instances of a keyed plugin ("+e.key+")");r.plugins.push(e),r.pluginsByKey[e.key]=e,e.spec.state&&r.fields.push(new Ua(e.key,e.spec.state,e))})}),Ga=function(){function e(t){x(this,e),this.config=t}return S(e,[{key:"schema",get:function(){return this.config.schema}},{key:"plugins",get:function(){return this.config.plugins}},{key:"apply",value:function(e){return this.applyTransaction(e).state}},{key:"filterTransaction",value:function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1,n=0;n<this.config.plugins.length;n++)if(n!=t){var r=this.config.plugins[n];if(r.spec.filterTransaction&&!r.spec.filterTransaction.call(r,e,this))return!1}return!0}},{key:"applyTransaction",value:function(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};for(var t=[e],n=this.applyInner(e),r=null;;){for(var i=!1,o=0;o<this.config.plugins.length;o++){var a=this.config.plugins[o];if(a.spec.appendTransaction){var s=r?r[o].n:0,c=r?r[o].state:this,l=s<t.length&&a.spec.appendTransaction.call(a,s?t.slice(s):t,c,n);if(l&&n.filterTransaction(l,o)){if(l.setMeta("appendedTransaction",e),!r){r=[];for(var u=0;u<this.config.plugins.length;u++)r.push(u<o?{state:n,n:t.length}:{state:this,n:0})}t.push(l),n=n.applyInner(l),i=!0}r&&(r[o]={state:n,n:t.length})}}if(!i)return{state:n,transactions:t}}}},{key:"applyInner",value:function(t){if(!t.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");for(var n=new e(this.config),r=this.config.fields,i=0;i<r.length;i++){var o=r[i];n[o.name]=o.apply(t,this[o.name],this,n)}return n}},{key:"tr",get:function(){return new Wa(this)}},{key:"reconfigure",value:function(t){for(var n=new Ja(this.schema,t.plugins),r=n.fields,i=new e(n),o=0;o<r.length;o++){var a=r[o].name;i[a]=this.hasOwnProperty(a)?this[a]:r[o].init(t,i)}return i}},{key:"toJSON",value:function(e){var t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map(function(e){return e.toJSON()})),e&&"object"==N(e))for(var n in e){if("doc"==n||"selection"==n)throw new RangeError("The JSON fields `doc` and `selection` are reserved");var r=e[n],i=r.spec.state;i&&i.toJSON&&(t[n]=i.toJSON.call(r,this[r.key]))}return t}}],[{key:"create",value:function(t){for(var n=new Ja(t.doc?t.doc.type.schema:t.schema,t.plugins),r=new e(n),i=0;i<n.fields.length;i++)r[n.fields[i].name]=n.fields[i].init(t,r);return r}},{key:"fromJSON",value:function(t,n,r){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!t.schema)throw new RangeError("Required config field 'schema' missing");var i=new Ja(t.schema,t.plugins),o=new e(i);return i.fields.forEach(function(e){if("doc"==e.name)o.doc=no.fromJSON(t.schema,n.doc);else if("selection"==e.name)o.selection=Da.fromJSON(o.doc,n.selection);else if("storedMarks"==e.name)n.storedMarks&&(o.storedMarks=n.storedMarks.map(t.schema.markFromJSON));else{if(r)for(var i in r){var a=r[i],s=a.spec.state;if(a.key==e.name&&s&&s.fromJSON&&Object.prototype.hasOwnProperty.call(n,i))return void(o[e.name]=s.fromJSON.call(a,t,n[i],o))}o[e.name]=e.init(t,o)}}),o}}])}();function Xa(e,t,n){for(var r in e){var i=e[r];i instanceof Function?i=i.bind(t):"handleDOMEvents"==r&&(i=Xa(i,t,{})),n[r]=i}return n}var Ya=function(){return S(function e(t){x(this,e),this.spec=t,this.props={},t.props&&Xa(t.props,this,this.props),this.key=t.key?t.key.key:Qa("plugin")},[{key:"getState",value:function(e){return e[this.key]}}])}(),Za=Object.create(null);function Qa(e){return e in Za?e+"$"+ ++Za[e]:(Za[e]=0,e+"$")}var es=function(){return S(function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"key";x(this,e),this.key=Qa(t)},[{key:"get",value:function(e){return e.config.pluginsByKey[this.key]}},{key:"getState",value:function(e){return e[this.key]}}])}();function ts(e,t){var n=e.selection.$cursor;return!n||(t?!t.endOfTextblock("backward",e):n.parentOffset>0)?null:n}function ns(e,t,n){for(var r=t.nodeBefore,i=t.pos-1;!r.isTextblock;i--){if(r.type.spec.isolating)return!1;var o=r.lastChild;if(!o)return!1;r=o}for(var a=t.nodeAfter,s=t.pos+1;!a.isTextblock;s++){if(a.type.spec.isolating)return!1;var c=a.firstChild;if(!c)return!1;a=c}var l=ma(e.doc,i,s,Bi.empty);if(!l||l.from!=i||l instanceof ta&&l.slice.size>=s-i)return!1;if(n){var u=e.tr.step(l);u.setSelection(Pa.create(u.doc,i)),n(u.scrollIntoView())}return!0}function rs(e,t){for(var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=e;r;r="start"==t?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&1!=r.childCount)return!1}return!1}function is(e){if(!e.parent.type.spec.isolating)for(var t=e.depth-1;t>=0;t--){if(e.index(t)>0)return e.doc.resolve(e.before(t+1));if(e.node(t).type.spec.isolating)break}return null}function as(e,t){var n=e.selection.$cursor;return!n||(t?!t.endOfTextblock("forward",e):n.parentOffset<n.parent.content.size)?null:n}function ss(e){if(!e.parent.type.spec.isolating)for(var t=e.depth-1;t>=0;t--){var n=e.node(t);if(e.index(t)+1<n.childCount)return e.doc.resolve(e.after(t+1));if(n.type.spec.isolating)break}return null}function cs(e){for(var t=0;t<e.edgeCount;t++){var n=e.edge(t).type;if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}function ls(e,t,n,r){var i,o,a=t.nodeBefore,s=t.nodeAfter,c=a.type.spec.isolating||s.type.spec.isolating;if(!c&&function(e,t,n){var r=t.nodeBefore,i=t.nodeAfter,o=t.index();return!(!(r&&i&&r.type.compatibleContent(i.type))||(!r.content.size&&t.parent.canReplace(o-1,o)?(n&&n(e.tr.delete(t.pos-r.nodeSize,t.pos).scrollIntoView()),0):!t.parent.canReplace(o,o+1)||!i.isTextblock&&!ha(e.doc,t.pos)||(n&&n(e.tr.join(t.pos).scrollIntoView()),0)))}(e,t,n))return!0;var l=!c&&t.parent.canReplace(t.index(),t.index()+1);if(l&&(i=(o=a.contentMatchAt(a.childCount)).findWrapping(s.type))&&o.matchType(i[0]||s.type).validEnd){if(n){for(var u=t.pos+s.nodeSize,d=Di.empty,h=i.length-1;h>=0;h--)d=Di.from(i[h].create(null,d));d=Di.from(a.copy(d));var f=e.tr.step(new na(t.pos-1,u,t.pos,u,new Bi(d,1,0),i.length,!0)),p=f.doc.resolve(u+2*i.length);p.nodeAfter&&p.nodeAfter.type==a.type&&ha(f.doc,p.pos)&&f.join(p.pos),n(f.scrollIntoView())}return!0}var v=s.type.spec.isolating||r>0&&c?null:Da.findFrom(t,1),m=v&&v.$from.blockRange(v.$to),g=m&&aa(m);if(null!=g&&g>=t.depth)return n&&n(e.tr.lift(m,g).scrollIntoView()),!0;if(l&&rs(s,"start",!0)&&rs(a,"end")){for(var y=a,k=[];k.push(y),!y.isTextblock;)y=y.lastChild;for(var w=s,b=1;!w.isTextblock;w=w.firstChild)b++;if(y.canReplace(y.childCount,y.childCount,w.content)){if(n){for(var x=Di.empty,C=k.length-1;C>=0;C--)x=Di.from(k[C].copy(x));n(e.tr.step(new na(t.pos-k.length,t.pos+s.nodeSize,t.pos+b,t.pos+s.nodeSize-b,new Bi(x,k.length,0),0,!0)).scrollIntoView())}return!0}}return!1}function us(e){return function(t,n){for(var r=t.selection,i=e<0?r.$from:r.$to,o=i.depth;i.node(o).isInline;){if(!o)return!1;o--}return!!i.node(o).isTextblock&&(n&&n(t.tr.setSelection(Pa.create(t.doc,e<0?i.start(o):i.end(o)))),!0)}}var ds=us(-1),hs=us(1);function fs(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return function(n,r){for(var i=!1,o=0;o<n.selection.ranges.length&&!i;o++){var a=n.selection.ranges[o],s=a.$from.pos,c=a.$to.pos;n.doc.nodesBetween(s,c,function(r,o){if(i)return!1;if(r.isTextblock&&!r.hasMarkup(e,t))if(r.type==e)i=!0;else{var a=n.doc.resolve(o),s=a.index();i=a.parent.canReplaceWith(s,s+1,e)}})}if(!i)return!1;if(r){for(var l=n.tr,u=0;u<n.selection.ranges.length;u++){var d=n.selection.ranges[u],h=d.$from.pos,f=d.$to.pos;l.setBlockType(h,f,e,t)}r(l.scrollIntoView())}return!0}}function ps(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return function(n,r){var i=n.selection,o=i.$from,a=i.$to,s=o.blockRange(a);if(!s)return!1;var c=r?n.tr:null;return!!function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=!1,o=t,a=t.$from.doc;if(t.depth>=2&&t.$from.node(t.depth-1).type.compatibleContent(n)&&0==t.startIndex){if(0==t.$from.index(t.depth-1))return!1;var s=a.resolve(t.start-2);o=new eo(s,s,t.depth),t.endIndex<t.parent.childCount&&(t=new eo(t.$from,a.resolve(t.$to.end(t.depth)),t.depth)),i=!0}var c=sa(o,n,r,t);if(!c)return!1;e&&function(e,t,n,r,i){for(var o=Di.empty,a=n.length-1;a>=0;a--)o=Di.from(n[a].type.create(n[a].attrs,o));e.step(new na(t.start-(r?2:0),t.end,t.start,t.end,new Bi(o,0,0),n.length,!0));for(var s=0,c=0;c<n.length;c++)n[c].type==i&&(s=c+1);for(var l=n.length-s,u=t.start+n.length-(r?2:0),d=t.parent,h=t.startIndex,f=t.endIndex,p=!0;h<f;h++,p=!1)!p&&da(e.doc,u,l)&&(e.split(u,l),u+=2*l),u+=d.child(h).nodeSize}(e,t,c,i,n);return!0}(c,s,e,t)&&(r&&r(c.scrollIntoView()),!0)}}function vs(e){return function(t,n){var r=t.selection,i=r.$from,o=r.$to,a=i.blockRange(o,function(t){return t.childCount>0&&t.firstChild.type==e});return!!a&&(!n||(i.node(a.depth-1).type==e?function(e,t,n,r){var i=e.tr,o=r.end,a=r.$to.end(r.depth);o<a&&(i.step(new na(o-1,a,o,a,new Bi(Di.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new eo(i.doc.resolve(r.$from.pos),i.doc.resolve(a),r.depth));var s=aa(r);if(null==s)return!1;i.lift(r,s);var c=i.doc.resolve(i.mapping.map(o,-1)-1);ha(i.doc,c.pos)&&c.nodeBefore.type==c.nodeAfter.type&&i.join(c.pos);return t(i.scrollIntoView()),!0}(t,n,e,a):function(e,t,n){for(var r=e.tr,i=n.parent,o=n.end,a=n.endIndex-1,s=n.startIndex;a>s;a--)o-=i.child(a).nodeSize,r.delete(o-1,o+1);var c=r.doc.resolve(n.start),l=c.nodeAfter;if(r.mapping.map(n.end)!=n.start+c.nodeAfter.nodeSize)return!1;var u=0==n.startIndex,d=n.endIndex==i.childCount,h=c.node(-1),f=c.index(-1);if(!h.canReplace(f+(u?0:1),f+1,l.content.append(d?Di.empty:Di.from(i))))return!1;var p=c.pos,v=p+l.nodeSize;return r.step(new na(p-(u?1:0),v+(d?1:0),p+1,v-1,new Bi((u?Di.empty:Di.from(i.copy(Di.empty))).append(d?Di.empty:Di.from(i.copy(Di.empty))),u?0:1,d?0:1),u?0:1)),t(r.scrollIntoView()),!0}(t,n,a)))}}"undefined"!=typeof navigator?/Mac|iP(hone|[oa]d)/.test(navigator.platform):"undefined"!=typeof os&&os.platform&&os.platform();var ms=function(e){for(var t=0;;t++)if(!(e=e.previousSibling))return t},gs=function(e){var t=e.assignedSlot||e.parentNode;return t&&11==t.nodeType?t.host:t},ys=null,ks=function(e,t,n){var r=ys||(ys=document.createRange());return r.setEnd(e,null==n?e.nodeValue.length:n),r.setStart(e,t||0),r},ws=function(e,t,n,r){return n&&(xs(e,t,n,r,-1)||xs(e,t,n,r,1))},bs=/^(img|br|input|textarea|hr)$/i;function xs(e,t,n,r,i){for(var o;;){if(e==n&&t==r)return!0;if(t==(i<0?0:Cs(e))){var a=e.parentNode;if(!a||1!=a.nodeType||Ss(e)||bs.test(e.nodeName)||"false"==e.contentEditable)return!1;t=ms(e)+(i<0?0:1),e=a}else{if(1!=e.nodeType)return!1;var s=e.childNodes[t+(i<0?-1:0)];if(1==s.nodeType&&"false"==s.contentEditable){if(!(null===(o=s.pmViewDesc)||void 0===o?void 0:o.ignoreForSelection))return!1;t+=i}else e=s,t=i<0?Cs(e):0}}}function Cs(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function Ss(e){for(var t,n=e;n&&!(t=n.pmViewDesc);n=n.parentNode);return t&&t.node&&t.node.isBlock&&(t.dom==e||t.contentDOM==e)}var _s=function(e){return e.focusNode&&ws(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)};function Ms(e,t){var n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=e,n.key=n.code=t,n}var Ns="undefined"!=typeof navigator?navigator:null,Ts="undefined"!=typeof document?document:null,Os=Ns&&Ns.userAgent||"",Es=/Edge\/(\d+)/.exec(Os),As=/MSIE \d/.exec(Os),Ds=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Os),Is=!!(As||Ds||Es),zs=As?document.documentMode:Ds?+Ds[1]:Es?+Es[1]:0,Rs=!Is&&/gecko\/(\d+)/i.test(Os);Rs&&(/Firefox\/(\d+)/.exec(Os)||[0,0])[1];var Ps=!Is&&/Chrome\/(\d+)/.exec(Os),Ls=!!Ps,Bs=Ps?+Ps[1]:0,Vs=!Is&&!!Ns&&/Apple Computer/.test(Ns.vendor),Fs=Vs&&(/Mobile\/\w+/.test(Os)||!!Ns&&Ns.maxTouchPoints>2),js=Fs||!!Ns&&/Mac/.test(Ns.platform),$s=!!Ns&&/Win/.test(Ns.platform),Hs=/Android \d/.test(Os),Ws=!!Ts&&"webkitFontSmoothing"in Ts.documentElement.style,qs=Ws?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function Us(e){var t=e.defaultView&&e.defaultView.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.documentElement.clientWidth,top:0,bottom:e.documentElement.clientHeight}}function Ks(e,t){return"number"==typeof e?e:e[t]}function Js(e){var t=e.getBoundingClientRect(),n=t.width/e.offsetWidth||1,r=t.height/e.offsetHeight||1;return{left:t.left,right:t.left+e.clientWidth*n,top:t.top,bottom:t.top+e.clientHeight*r}}function Gs(e,t,n){for(var r=e.someProp("scrollThreshold")||0,i=e.someProp("scrollMargin")||5,o=e.dom.ownerDocument,a=n||e.dom;a;)if(1==a.nodeType){var s=a,c=s==o.body,l=c?Us(o):Js(s),u=0,d=0;if(t.top<l.top+Ks(r,"top")?d=-(l.top-t.top+Ks(i,"top")):t.bottom>l.bottom-Ks(r,"bottom")&&(d=t.bottom-t.top>l.bottom-l.top?t.top+Ks(i,"top")-l.top:t.bottom-l.bottom+Ks(i,"bottom")),t.left<l.left+Ks(r,"left")?u=-(l.left-t.left+Ks(i,"left")):t.right>l.right-Ks(r,"right")&&(u=t.right-l.right+Ks(i,"right")),u||d)if(c)o.defaultView.scrollBy(u,d);else{var h=s.scrollLeft,f=s.scrollTop;d&&(s.scrollTop+=d),u&&(s.scrollLeft+=u);var p=s.scrollLeft-h,v=s.scrollTop-f;t={left:t.left-p,top:t.top-v,right:t.right-p,bottom:t.bottom-v}}var m=c?"fixed":getComputedStyle(a).position;if(/^(fixed|sticky)$/.test(m))break;a="absolute"==m?a.offsetParent:gs(a)}else a=gs(a)}function Xs(e){for(var t=[],n=e.ownerDocument,r=e;r&&(t.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),e!=n);r=gs(r));return t}function Ys(e,t){for(var n=0;n<e.length;n++){var r=e[n],i=r.dom,o=r.top,a=r.left;i.scrollTop!=o+t&&(i.scrollTop=o+t),i.scrollLeft!=a&&(i.scrollLeft=a)}}var Zs=null;function Qs(e,t){for(var n,r,i,o,a=2e8,s=0,c=t.top,l=t.top,u=e.firstChild,d=0;u;u=u.nextSibling,d++){var h=void 0;if(1==u.nodeType)h=u.getClientRects();else{if(3!=u.nodeType)continue;h=ks(u).getClientRects()}for(var f=0;f<h.length;f++){var p=h[f];if(p.top<=c&&p.bottom>=l){c=Math.max(p.bottom,c),l=Math.min(p.top,l);var v=p.left>t.left?p.left-t.left:p.right<t.left?t.left-p.right:0;if(v<a){n=u,a=v,r=v&&3==n.nodeType?{left:p.right<t.left?p.right:p.left,top:t.top}:t,1==u.nodeType&&v&&(s=d+(t.left>=(p.left+p.right)/2?1:0));continue}}else p.top>t.top&&!i&&p.left<=t.left&&p.right>=t.left&&(i=u,o={left:Math.max(p.left,Math.min(p.right,t.left)),top:p.top});!n&&(t.left>=p.right&&t.top>=p.top||t.left>=p.left&&t.top>=p.bottom)&&(s=d+1)}}return!n&&i&&(n=i,r=o,a=0),n&&3==n.nodeType?function(e,t){for(var n,r=e.nodeValue.length,i=document.createRange(),o=0;o<r;o++){i.setEnd(e,o+1),i.setStart(e,o);var a=ic(i,1);if(a.top!=a.bottom&&ec(t,a)){n={node:e,offset:o+(t.left>=(a.left+a.right)/2?1:0)};break}}return i.detach(),n||{node:e,offset:0}}(n,r):!n||a&&1==n.nodeType?{node:e,offset:s}:Qs(n,r)}function ec(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function tc(e,t,n){var r=e.childNodes.length;if(r&&n.top<n.bottom)for(var i=Math.max(0,Math.min(r-1,Math.floor(r*(t.top-n.top)/(n.bottom-n.top))-2)),o=i;;){var a=e.childNodes[o];if(1==a.nodeType)for(var s=a.getClientRects(),c=0;c<s.length;c++){var l=s[c];if(ec(t,l))return tc(a,t,l)}if((o=(o+1)%r)==i)break}return e}function nc(e,t){var n,r=e.dom.ownerDocument,i=0,o=function(e,t,n){if(e.caretPositionFromPoint)try{var r=e.caretPositionFromPoint(t,n);if(r)return{node:r.offsetNode,offset:Math.min(Cs(r.offsetNode),r.offset)}}catch(Tt){}if(e.caretRangeFromPoint){var i=e.caretRangeFromPoint(t,n);if(i)return{node:i.startContainer,offset:Math.min(Cs(i.startContainer),i.startOffset)}}}(r,t.left,t.top);o&&(n=o.node,i=o.offset);var a,s=(e.root.elementFromPoint?e.root:r).elementFromPoint(t.left,t.top);if(!s||!e.dom.contains(1!=s.nodeType?s.parentNode:s)){var c=e.dom.getBoundingClientRect();if(!ec(t,c))return null;if(!(s=tc(e.dom,t,c)))return null}if(Vs)for(var l=s;n&&l;l=gs(l))l.draggable&&(n=void 0);if(s=function(e,t){var n=e.parentNode;return n&&/^li$/i.test(n.nodeName)&&t.left<e.getBoundingClientRect().left?n:e}(s,t),n){if(Rs&&1==n.nodeType&&(i=Math.min(i,n.childNodes.length))<n.childNodes.length){var u,d=n.childNodes[i];"IMG"==d.nodeName&&(u=d.getBoundingClientRect()).right<=t.left&&u.bottom>t.top&&i++}var h;Ws&&i&&1==n.nodeType&&1==(h=n.childNodes[i-1]).nodeType&&"false"==h.contentEditable&&h.getBoundingClientRect().top>=t.top&&i--,n==e.dom&&i==n.childNodes.length-1&&1==n.lastChild.nodeType&&t.top>n.lastChild.getBoundingClientRect().bottom?a=e.state.doc.content.size:0!=i&&1==n.nodeType&&"BR"==n.childNodes[i-1].nodeName||(a=function(e,t,n,r){for(var i=-1,o=t,a=!1;o!=e.dom;){var s=e.docView.nearestDesc(o,!0),c=void 0;if(!s)return null;if(1==s.dom.nodeType&&(s.node.isBlock&&s.parent||!s.contentDOM)&&((c=s.dom.getBoundingClientRect()).width||c.height)&&(s.node.isBlock&&s.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(s.dom.nodeName)&&(!a&&c.left>r.left||c.top>r.top?i=s.posBefore:(!a&&c.right<r.left||c.bottom<r.top)&&(i=s.posAfter),a=!0),!s.contentDOM&&i<0&&!s.node.isText))return(s.node.isBlock?r.top<(c.top+c.bottom)/2:r.left<(c.left+c.right)/2)?s.posBefore:s.posAfter;o=s.dom.parentNode}return i>-1?i:e.docView.posFromDOM(t,n,-1)}(e,n,i,t))}null==a&&(a=function(e,t,n){var r=Qs(t,n),i=r.node,o=r.offset,a=-1;if(1==i.nodeType&&!i.firstChild){var s=i.getBoundingClientRect();a=s.left!=s.right&&n.left>(s.left+s.right)/2?1:-1}return e.docView.posFromDOM(i,o,a)}(e,s,t));var f=e.docView.nearestDesc(s,!0);return{pos:a,inside:f?f.posAtStart-f.border:-1}}function rc(e){return e.top<e.bottom||e.left<e.right}function ic(e,t){var n=e.getClientRects();if(n.length){var r=n[t<0?0:n.length-1];if(rc(r))return r}return Array.prototype.find.call(n,rc)||e.getBoundingClientRect()}var oc=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function ac(e,t,n){var r=e.docView.domFromPos(t,n<0?-1:1),i=r.node,o=r.offset,a=r.atom,s=Ws||Rs;if(3==i.nodeType){if(!s||!oc.test(i.nodeValue)&&(n<0?o:o!=i.nodeValue.length)){var c=o,l=o,u=n<0?1:-1;return n<0&&!o?(l++,u=-1):n>=0&&o==i.nodeValue.length?(c--,u=1):n<0?c--:l++,sc(ic(ks(i,c,l),u),u<0)}var d=ic(ks(i,o,o),n);if(Rs&&o&&/\s/.test(i.nodeValue[o-1])&&o<i.nodeValue.length){var h=ic(ks(i,o-1,o-1),-1);if(h.top==d.top){var f=ic(ks(i,o,o+1),-1);if(f.top!=d.top)return sc(f,f.left<h.left)}}return d}if(!e.state.doc.resolve(t-(a||0)).parent.inlineContent){if(null==a&&o&&(n<0||o==Cs(i))){var p=i.childNodes[o-1];if(1==p.nodeType)return cc(p.getBoundingClientRect(),!1)}if(null==a&&o<Cs(i)){var v=i.childNodes[o];if(1==v.nodeType)return cc(v.getBoundingClientRect(),!0)}return cc(i.getBoundingClientRect(),n>=0)}if(null==a&&o&&(n<0||o==Cs(i))){var m=i.childNodes[o-1],g=3==m.nodeType?ks(m,Cs(m)-(s?0:1)):1!=m.nodeType||"BR"==m.nodeName&&m.nextSibling?null:m;if(g)return sc(ic(g,1),!1)}if(null==a&&o<Cs(i)){for(var y=i.childNodes[o];y.pmViewDesc&&y.pmViewDesc.ignoreForCoords;)y=y.nextSibling;var k=y?3==y.nodeType?ks(y,0,s?0:1):1==y.nodeType?y:null:null;if(k)return sc(ic(k,-1),!0)}return sc(ic(3==i.nodeType?ks(i):i,-n),n>=0)}function sc(e,t){if(0==e.width)return e;var n=t?e.left:e.right;return{top:e.top,bottom:e.bottom,left:n,right:n}}function cc(e,t){if(0==e.height)return e;var n=t?e.top:e.bottom;return{top:n,bottom:n,left:e.left,right:e.right}}function lc(e,t,n){var r=e.state,i=e.root.activeElement;r!=t&&e.updateState(t),i!=e.dom&&e.focus();try{return n()}finally{r!=t&&e.updateState(r),i!=e.dom&&i&&i.focus()}}var uc=/[\u0590-\u08ac]/;var dc=null,hc=null,fc=!1;function pc(e,t,n){return dc==t&&hc==n?fc:(dc=t,hc=n,fc="up"==n||"down"==n?function(e,t,n){var r=t.selection,i="up"==n?r.$from:r.$to;return lc(e,t,function(){for(var t=e.docView.domFromPos(i.pos,"up"==n?-1:1).node;;){var r=e.docView.nearestDesc(t,!0);if(!r)break;if(r.node.isBlock){t=r.contentDOM||r.dom;break}t=r.dom.parentNode}for(var o=ac(e,i.pos,1),a=t.firstChild;a;a=a.nextSibling){var s=void 0;if(1==a.nodeType)s=a.getClientRects();else{if(3!=a.nodeType)continue;s=ks(a,0,a.nodeValue.length).getClientRects()}for(var c=0;c<s.length;c++){var l=s[c];if(l.bottom>l.top+1&&("up"==n?o.top-l.top>2*(l.bottom-o.top):l.bottom-o.bottom>2*(o.bottom-l.top)))return!1}}return!0})}(e,t,n):function(e,t,n){var r=t.selection.$head;if(!r.parent.isTextblock)return!1;var i=r.parentOffset,o=!i,a=i==r.parent.content.size,s=e.domSelection();return s?uc.test(r.parent.textContent)&&s.modify?lc(e,t,function(){var t=e.domSelectionRange(),i=t.focusNode,o=t.focusOffset,a=t.anchorNode,c=t.anchorOffset,l=s.caretBidiLevel;s.modify("move",n,"character");var u=r.depth?e.docView.domAfterPos(r.before()):e.dom,d=e.domSelectionRange(),h=d.focusNode,f=d.focusOffset,p=h&&!u.contains(1==h.nodeType?h:h.parentNode)||i==h&&o==f;try{s.collapse(a,c),i&&(i!=a||o!=c)&&s.extend&&s.extend(i,o)}catch(Tt){}return null!=l&&(s.caretBidiLevel=l),p}):"left"==n||"backward"==n?o:a:r.pos==r.start()||r.pos==r.end()}(e,t,n))}var vc=function(){return S(function e(t,n,r,i){x(this,e),this.parent=t,this.children=n,this.dom=r,this.contentDOM=i,this.dirty=0,r.pmViewDesc=this},[{key:"matchesWidget",value:function(e){return!1}},{key:"matchesMark",value:function(e){return!1}},{key:"matchesNode",value:function(e,t,n){return!1}},{key:"matchesHack",value:function(e){return!1}},{key:"parseRule",value:function(){return null}},{key:"stopEvent",value:function(e){return!1}},{key:"size",get:function(){for(var e=0,t=0;t<this.children.length;t++)e+=this.children[t].size;return e}},{key:"border",get:function(){return 0}},{key:"destroy",value:function(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(var e=0;e<this.children.length;e++)this.children[e].destroy()}},{key:"posBeforeChild",value:function(e){for(var t=0,n=this.posAtStart;;t++){var r=this.children[t];if(r==e)return n;n+=r.size}}},{key:"posBefore",get:function(){return this.parent.posBeforeChild(this)}},{key:"posAtStart",get:function(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}},{key:"posAfter",get:function(){return this.posBefore+this.size}},{key:"posAtEnd",get:function(){return this.posAtStart+this.size-2*this.border}},{key:"localPosFromDOM",value:function(e,t,n){if(this.contentDOM&&this.contentDOM.contains(1==e.nodeType?e:e.parentNode)){if(n<0){var r,i;if(e==this.contentDOM)r=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;r=e.previousSibling}for(;r&&(!(i=r.pmViewDesc)||i.parent!=this);)r=r.previousSibling;return r?this.posBeforeChild(i)+i.size:this.posAtStart}var o,a;if(e==this.contentDOM)o=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;o=e.nextSibling}for(;o&&(!(a=o.pmViewDesc)||a.parent!=this);)o=o.nextSibling;return o?this.posBeforeChild(a):this.posAtEnd}var s;if(e==this.dom&&this.contentDOM)s=t>ms(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))s=2&e.compareDocumentPosition(this.contentDOM);else if(this.dom.firstChild){if(0==t)for(var c=e;;c=c.parentNode){if(c==this.dom){s=!1;break}if(c.previousSibling)break}if(null==s&&t==e.childNodes.length)for(var l=e;;l=l.parentNode){if(l==this.dom){s=!0;break}if(l.nextSibling)break}}return(null==s?n>0:s)?this.posAtEnd:this.posAtStart}},{key:"nearestDesc",value:function(e){for(var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=!0,r=e;r;r=r.parentNode){var i=this.getDesc(r),o=void 0;if(i&&(!t||i.node)){if(!n||!(o=i.nodeDOM)||(1==o.nodeType?o.contains(1==e.nodeType?e:e.parentNode):o==e))return i;n=!1}}}},{key:"getDesc",value:function(e){for(var t=e.pmViewDesc,n=t;n;n=n.parent)if(n==this)return t}},{key:"posFromDOM",value:function(e,t,n){for(var r=e;r;r=r.parentNode){var i=this.getDesc(r);if(i)return i.localPosFromDOM(e,t,n)}return-1}},{key:"descAt",value:function(e){for(var t=0,n=0;t<this.children.length;t++){var r=this.children[t],i=n+r.size;if(n==e&&i!=n){for(;!r.border&&r.children.length;)for(var o=0;o<r.children.length;o++){var a=r.children[o];if(a.size){r=a;break}}return r}if(e<i)return r.descAt(e-n-r.border);n=i}}},{key:"domFromPos",value:function(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};for(var n,r=0,i=0,o=0;r<this.children.length;r++){var a=this.children[r],s=o+a.size;if(s>e||a instanceof xc){i=e-o;break}o=s}if(i)return this.children[r].domFromPos(i-this.children[r].border,t);for(;r&&!(n=this.children[r-1]).size&&n instanceof mc&&n.side>=0;r--);if(t<=0){for(var c,l=!0;(c=r?this.children[r-1]:null)&&c.dom.parentNode!=this.contentDOM;r--,l=!1);return c&&t&&l&&!c.border&&!c.domAtom?c.domFromPos(c.size,t):{node:this.contentDOM,offset:c?ms(c.dom)+1:0}}for(var u,d=!0;(u=r<this.children.length?this.children[r]:null)&&u.dom.parentNode!=this.contentDOM;r++,d=!1);return u&&d&&!u.border&&!u.domAtom?u.domFromPos(0,t):{node:this.contentDOM,offset:u?ms(u.dom):this.contentDOM.childNodes.length}}},{key:"parseRange",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(0==this.children.length)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};for(var r=-1,i=-1,o=n,a=0;;a++){var s=this.children[a],c=o+s.size;if(-1==r&&e<=c){var l=o+s.border;if(e>=l&&t<=c-s.border&&s.node&&s.contentDOM&&this.contentDOM.contains(s.contentDOM))return s.parseRange(e,t,l);e=o;for(var u=a;u>0;u--){var d=this.children[u-1];if(d.size&&d.dom.parentNode==this.contentDOM&&!d.emptyChildAt(1)){r=ms(d.dom)+1;break}e-=d.size}-1==r&&(r=0)}if(r>-1&&(c>t||a==this.children.length-1)){t=c;for(var h=a+1;h<this.children.length;h++){var f=this.children[h];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(-1)){i=ms(f.dom);break}t+=f.size}-1==i&&(i=this.contentDOM.childNodes.length);break}o=c}return{node:this.contentDOM,from:e,to:t,fromOffset:r,toOffset:i}}},{key:"emptyChildAt",value:function(e){if(this.border||!this.contentDOM||!this.children.length)return!1;var t=this.children[e<0?0:this.children.length-1];return 0==t.size||t.emptyChildAt(e)}},{key:"domAfterPos",value:function(e){var t=this.domFromPos(e,0),n=t.node,r=t.offset;if(1!=n.nodeType||r==n.childNodes.length)throw new RangeError("No node after pos "+e);return n.childNodes[r]}},{key:"setSelection",value:function(e,t,n){for(var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],i=Math.min(e,t),o=Math.max(e,t),a=0,s=0;a<this.children.length;a++){var c=this.children[a],l=s+c.size;if(i>s&&o<l)return c.setSelection(e-s-c.border,t-s-c.border,n,r);s=l}var u=this.domFromPos(e,e?-1:1),d=t==e?u:this.domFromPos(t,t?-1:1),h=n.root.getSelection(),f=n.domSelectionRange(),p=!1;if((Rs||Vs)&&e==t){var v=u,m=v.node,g=v.offset;if(3==m.nodeType){if((p=!(!g||"\n"!=m.nodeValue[g-1]))&&g==m.nodeValue.length)for(var y,k=m;k;k=k.parentNode){if(y=k.nextSibling){"BR"==y.nodeName&&(u=d={node:y.parentNode,offset:ms(y)+1});break}var w=k.pmViewDesc;if(w&&w.node&&w.node.isBlock)break}}else{var b=m.childNodes[g-1];p=b&&("BR"==b.nodeName||"false"==b.contentEditable)}}if(Rs&&f.focusNode&&f.focusNode!=d.node&&1==f.focusNode.nodeType){var x=f.focusNode.childNodes[f.focusOffset];x&&"false"==x.contentEditable&&(r=!0)}if(r||p&&Vs||!ws(u.node,u.offset,f.anchorNode,f.anchorOffset)||!ws(d.node,d.offset,f.focusNode,f.focusOffset)){var C=!1;if((h.extend||e==t)&&(!p||!Rs)){h.collapse(u.node,u.offset);try{e!=t&&h.extend(d.node,d.offset),C=!0}catch(Tt){}}if(!C){if(e>t){var S=u;u=d,d=S}var _=document.createRange();_.setEnd(d.node,d.offset),_.setStart(u.node,u.offset),h.removeAllRanges(),h.addRange(_)}}}},{key:"ignoreMutation",value:function(e){return!this.contentDOM&&"selection"!=e.type}},{key:"contentLost",get:function(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}},{key:"markDirty",value:function(e,t){for(var n=0,r=0;r<this.children.length;r++){var i=this.children[r],o=n+i.size;if(n==o?e<=o&&t>=n:e<o&&t>n){var a=n+i.border,s=o-i.border;if(e>=a&&t<=s)return this.dirty=e==n||t==o?2:1,void(e!=a||t!=s||!i.contentLost&&i.dom.parentNode==this.contentDOM?i.markDirty(e-a,t-a):i.dirty=3);i.dirty=i.dom!=i.contentDOM||i.dom.parentNode!=this.contentDOM||i.children.length?3:2}n=o}this.dirty=2}},{key:"markParentsDirty",value:function(){for(var e=1,t=this.parent;t;t=t.parent,e++){var n=1==e?2:1;t.dirty<n&&(t.dirty=n)}}},{key:"domAtom",get:function(){return!1}},{key:"ignoreForCoords",get:function(){return!1}},{key:"ignoreForSelection",get:function(){return!1}},{key:"isText",value:function(e){return!1}}])}(),mc=function(t){function n(e,t,i,o){var a;x(this,n);var s,c=t.type.toDOM;if("function"==typeof c&&(c=c(i,function(){return s?s.parent?s.parent.posBeforeChild(s):void 0:o})),!t.type.spec.raw){if(1!=c.nodeType){var l=document.createElement("span");l.appendChild(c),c=l}c.contentEditable="false",c.classList.add("ProseMirror-widget")}return(a=r(this,n,[e,[],c,null])).widget=t,a.widget=t,s=a,a}return a(n,t),S(n,[{key:"matchesWidget",value:function(e){return 0==this.dirty&&e.type.eq(this.widget.type)}},{key:"parseRule",value:function(){return{ignore:!0}}},{key:"stopEvent",value:function(e){var t=this.widget.spec.stopEvent;return!!t&&t(e)}},{key:"ignoreMutation",value:function(e){return"selection"!=e.type||this.widget.spec.ignoreSelection}},{key:"destroy",value:function(){this.widget.type.destroy(this.dom),e(n,"destroy",this,3)([])}},{key:"domAtom",get:function(){return!0}},{key:"ignoreForSelection",get:function(){return!!this.widget.type.spec.relaxedSide}},{key:"side",get:function(){return this.widget.type.side}}])}(vc),gc=function(e){function t(e,n,i,o){var a;return x(this,t),(a=r(this,t,[e,[],n,null])).textDOM=i,a.text=o,a}return a(t,e),S(t,[{key:"size",get:function(){return this.text.length}},{key:"localPosFromDOM",value:function(e,t){return e!=this.textDOM?this.posAtStart+(t?this.size:0):this.posAtStart+t}},{key:"domFromPos",value:function(e){return{node:this.textDOM,offset:e}}},{key:"ignoreMutation",value:function(e){return"characterData"===e.type&&e.target.nodeValue==e.oldValue}}])}(vc),yc=function(t){function n(e,t,i,o,a){var s;return x(this,n),(s=r(this,n,[e,[],i,o])).mark=t,s.spec=a,s}return a(n,t),S(n,[{key:"parseRule",value:function(){return 3&this.dirty||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}},{key:"matchesMark",value:function(e){return 3!=this.dirty&&this.mark.eq(e)}},{key:"markDirty",value:function(t,r){if(e(n,"markDirty",this,3)([t,r]),0!=this.dirty){for(var i=this.parent;!i.node;)i=i.parent;i.dirty<this.dirty&&(i.dirty=this.dirty),this.dirty=0}}},{key:"slice",value:function(e,t,r){var i=n.create(this.parent,this.mark,!0,r),o=this.children,a=this.size;t<a&&(o=Rc(o,t,a,r)),e>0&&(o=Rc(o,0,e,r));for(var s=0;s<o.length;s++)o[s].parent=i;return i.children=o,i}},{key:"ignoreMutation",value:function(t){return this.spec.ignoreMutation?this.spec.ignoreMutation(t):e(n,"ignoreMutation",this,3)([t])}},{key:"destroy",value:function(){this.spec.destroy&&this.spec.destroy(),e(n,"destroy",this,3)([])}}],[{key:"create",value:function(e,t,r,i){var o=i.nodeViews[t.type.name],a=o&&o(t,i,r);return a&&a.dom||(a=Ro.renderSpec(document,t.type.spec.toDOM(t,r),null,t.attrs)),new n(e,t,a.dom,a.contentDOM||a.dom,a)}}])}(vc),kc=function(e){function t(e,n,i,o,a,s,c,l,u){var d;return x(this,t),(d=r(this,t,[e,[],a,s])).node=n,d.outerDeco=i,d.innerDeco=o,d.nodeDOM=c,d}return a(t,e),S(t,[{key:"parseRule",value:function(){var e=this;if(this.node.type.spec.reparseInView)return null;var t={node:this.node.type.name,attrs:this.node.attrs};if("pre"==this.node.type.whitespace&&(t.preserveWhitespace="full"),this.contentDOM)if(this.contentLost){for(var n=this.children.length-1;n>=0;n--){var r=this.children[n];if(this.dom.contains(r.dom.parentNode)){t.contentElement=r.dom.parentNode;break}}t.contentElement||(t.getContent=function(){return Di.empty})}else t.contentElement=this.contentDOM;else t.getContent=function(){return e.node.content};return t}},{key:"matchesNode",value:function(e,t,n){return 0==this.dirty&&e.eq(this.node)&&Ac(t,this.outerDeco)&&n.eq(this.innerDeco)}},{key:"size",get:function(){return this.node.nodeSize}},{key:"border",get:function(){return this.node.isLeaf?0:1}},{key:"updateChildren",value:function(e,t){var n=this,r=this.node.inlineContent,i=t,o=e.composing?this.localCompositionInfo(e,t):null,a=o&&o.pos>-1?o:null,s=o&&o.pos<0,c=new Ic(this,a&&a.node,e);!function(e,t,n,r){var i=t.locals(e),o=0;if(0==i.length){for(var a=0;a<e.childCount;a++){var s=e.child(a);r(s,i,t.forChild(o,s),a),o+=s.nodeSize}return}for(var c=0,l=[],u=null,d=0;;){for(var h=void 0,f=void 0;c<i.length&&i[c].to==o;){var p=i[c++];p.widget&&(h?(f||(f=[h])).push(p):h=p)}if(h)if(f){f.sort(zc);for(var v=0;v<f.length;v++)n(f[v],d,!!u)}else n(h,d,!!u);var m=void 0,g=void 0;if(u)g=-1,m=u,u=null;else{if(!(d<e.childCount))break;g=d,m=e.child(d++)}for(var y=0;y<l.length;y++)l[y].to<=o&&l.splice(y--,1);for(;c<i.length&&i[c].from<=o&&i[c].to>o;)l.push(i[c++]);var k=o+m.nodeSize;if(m.isText){var w=k;c<i.length&&i[c].from<w&&(w=i[c].from);for(var b=0;b<l.length;b++)l[b].to<w&&(w=l[b].to);w<k&&(u=m.cut(w-o),m=m.cut(0,w-o),k=w,g=-1)}else for(;c<i.length&&i[c].to<k;)c++;var x=m.isInline&&!m.isLeaf?l.filter(function(e){return!e.inline}):l.slice();r(m,x,t.forChild(o,m),g),o=k}}(this.node,this.innerDeco,function(t,o,a){t.spec.marks?c.syncToMarks(t.spec.marks,r,e):t.type.side>=0&&!a&&c.syncToMarks(o==n.node.childCount?Pi.none:n.node.child(o).marks,r,e),c.placeWidget(t,e,i)},function(t,n,a,l){var u;c.syncToMarks(t.marks,r,e),c.findNodeMatch(t,n,a,l)||s&&e.state.selection.from>i&&e.state.selection.to<i+t.nodeSize&&(u=c.findIndexWithChild(o.node))>-1&&c.updateNodeAt(t,n,a,u,e)||c.updateNextNode(t,n,a,e,l,i)||c.addNode(t,n,a,e,i),i+=t.nodeSize}),c.syncToMarks([],r,e),this.node.isTextblock&&c.addTextblockHacks(),c.destroyRest(),(c.changed||2==this.dirty)&&(a&&this.protectLocalComposition(e,a),Sc(this.contentDOM,this.children,e),Fs&&function(e){if("UL"==e.nodeName||"OL"==e.nodeName){var t=e.style.cssText;e.style.cssText=t+"; list-style: square !important",window.getComputedStyle(e).listStyle,e.style.cssText=t}}(this.dom))}},{key:"localCompositionInfo",value:function(e,t){var n=e.state.selection,r=n.from,i=n.to;if(!(e.state.selection instanceof Pa)||r<t||i>t+this.node.content.size)return null;var o=e.input.compositionNode;if(!o||!this.dom.contains(o.parentNode))return null;if(this.node.inlineContent){var a=o.nodeValue,s=function(e,t,n,r){for(var i=0,o=0;i<e.childCount&&o<=r;){var a=e.child(i++),s=o;if(o+=a.nodeSize,a.isText){for(var c=a.text;i<e.childCount;){var l=e.child(i++);if(o+=l.nodeSize,!l.isText)break;c+=l.text}if(o>=n){if(o>=r&&c.slice(r-t.length-s,r-s)==t)return r-t.length;var u=s<r?c.lastIndexOf(t,r-s-1):-1;if(u>=0&&u+t.length+s>=n)return s+u;if(n==r&&c.length>=r+t.length-s&&c.slice(r-s,r-s+t.length)==t)return r}}}return-1}(this.node.content,a,r-t,i-t);return s<0?null:{node:o,pos:s,text:a}}return{node:o,pos:-1,text:""}}},{key:"protectLocalComposition",value:function(e,t){var n=t.node,r=t.pos,i=t.text;if(!this.getDesc(n)){for(var o=n;o.parentNode!=this.contentDOM;o=o.parentNode){for(;o.previousSibling;)o.parentNode.removeChild(o.previousSibling);for(;o.nextSibling;)o.parentNode.removeChild(o.nextSibling);o.pmViewDesc&&(o.pmViewDesc=void 0)}var a=new gc(this,o,n,i);e.input.compositionNodes.push(a),this.children=Rc(this.children,r,r+i.length,e,a)}}},{key:"update",value:function(e,t,n,r){return!(3==this.dirty||!e.sameMarkup(this.node))&&(this.updateInner(e,t,n,r),!0)}},{key:"updateInner",value:function(e,t,n,r){this.updateOuterDeco(t),this.node=e,this.innerDeco=n,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=0}},{key:"updateOuterDeco",value:function(e){if(!Ac(e,this.outerDeco)){var t=1!=this.nodeDOM.nodeType,n=this.dom;this.dom=Tc(this.dom,this.nodeDOM,Nc(this.outerDeco,this.node,t),Nc(e,this.node,t)),this.dom!=n&&(n.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}}},{key:"selectNode",value:function(){1==this.nodeDOM.nodeType&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||(this.nodeDOM.draggable=!0))}},{key:"deselectNode",value:function(){1==this.nodeDOM.nodeType&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||this.nodeDOM.removeAttribute("draggable"))}},{key:"domAtom",get:function(){return this.node.isAtom}}],[{key:"create",value:function(e,n,r,i,o,a){var s,c=o.nodeViews[n.type.name],l=c&&c(n,o,function(){return s?s.parent?s.parent.posBeforeChild(s):void 0:a},r,i),u=l&&l.dom,d=l&&l.contentDOM;if(n.isText)if(u){if(3!=u.nodeType)throw new RangeError("Text must be rendered as a DOM text node")}else u=document.createTextNode(n.text);else if(!u){var h=Ro.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs);u=h.dom,d=h.contentDOM}d||n.isText||"BR"==u.nodeName||(u.hasAttribute("contenteditable")||(u.contentEditable="false"),n.type.spec.draggable&&(u.draggable=!0));var f=u;return u=Ec(u,r,n),l?s=new Cc(e,n,r,i,u,d||null,f,l,o,a+1):n.isText?new bc(e,n,r,i,u,f,o):new t(e,n,r,i,u,d||null,f,o,a+1)}}])}(vc);function wc(e,t,n,r,i){Ec(r,t,e);var o=new kc(void 0,e,t,n,r,r,r,i,0);return o.contentDOM&&o.updateChildren(i,0),o}var bc=function(t){function n(e,t,i,o,a,s,c){return x(this,n),r(this,n,[e,t,i,o,a,null,s,c,0])}return a(n,t),S(n,[{key:"parseRule",value:function(){for(var e=this.nodeDOM.parentNode;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}},{key:"update",value:function(e,t,n,r){return!(3==this.dirty||0!=this.dirty&&!this.inParent()||!e.sameMarkup(this.node))&&(this.updateOuterDeco(t),0==this.dirty&&e.text==this.node.text||e.text==this.nodeDOM.nodeValue||(this.nodeDOM.nodeValue=e.text,r.trackWrites==this.nodeDOM&&(r.trackWrites=null)),this.node=e,this.dirty=0,!0)}},{key:"inParent",value:function(){for(var e=this.parent.contentDOM,t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}},{key:"domFromPos",value:function(e){return{node:this.nodeDOM,offset:e}}},{key:"localPosFromDOM",value:function(t,r,i){return t==this.nodeDOM?this.posAtStart+Math.min(r,this.node.text.length):e(n,"localPosFromDOM",this,3)([t,r,i])}},{key:"ignoreMutation",value:function(e){return"characterData"!=e.type&&"selection"!=e.type}},{key:"slice",value:function(e,t,r){var i=this.node.cut(e,t),o=document.createTextNode(i.text);return new n(this.parent,i,this.outerDeco,this.innerDeco,o,o,r)}},{key:"markDirty",value:function(t,r){e(n,"markDirty",this,3)([t,r]),this.dom==this.nodeDOM||0!=t&&r!=this.nodeDOM.nodeValue.length||(this.dirty=3)}},{key:"domAtom",get:function(){return!1}},{key:"isText",value:function(e){return this.node.text==e}}])}(kc),xc=function(e){function t(){return x(this,t),r(this,t,arguments)}return a(t,e),S(t,[{key:"parseRule",value:function(){return{ignore:!0}}},{key:"matchesHack",value:function(e){return 0==this.dirty&&this.dom.nodeName==e}},{key:"domAtom",get:function(){return!0}},{key:"ignoreForCoords",get:function(){return"IMG"==this.dom.nodeName}}])}(vc),Cc=function(t){function n(e,t,i,o,a,s,c,l,u,d){var h;return x(this,n),(h=r(this,n,[e,t,i,o,a,s,c,u,d])).spec=l,h}return a(n,t),S(n,[{key:"update",value:function(t,r,i,o){if(3==this.dirty)return!1;if(this.spec.update&&(this.node.type==t.type||this.spec.multiType)){var a=this.spec.update(t,r,i);return a&&this.updateInner(t,r,i,o),a}return!(!this.contentDOM&&!t.isLeaf)&&e(n,"update",this,3)([t,r,i,o])}},{key:"selectNode",value:function(){this.spec.selectNode?this.spec.selectNode():e(n,"selectNode",this,3)([])}},{key:"deselectNode",value:function(){this.spec.deselectNode?this.spec.deselectNode():e(n,"deselectNode",this,3)([])}},{key:"setSelection",value:function(t,r,i,o){this.spec.setSelection?this.spec.setSelection(t,r,i.root):e(n,"setSelection",this,3)([t,r,i,o])}},{key:"destroy",value:function(){this.spec.destroy&&this.spec.destroy(),e(n,"destroy",this,3)([])}},{key:"stopEvent",value:function(e){return!!this.spec.stopEvent&&this.spec.stopEvent(e)}},{key:"ignoreMutation",value:function(t){return this.spec.ignoreMutation?this.spec.ignoreMutation(t):e(n,"ignoreMutation",this,3)([t])}}])}(kc);function Sc(e,t,n){for(var r=e.firstChild,i=!1,o=0;o<t.length;o++){var a=t[o],s=a.dom;if(s.parentNode==e){for(;s!=r;)r=Dc(r),i=!0;r=r.nextSibling}else i=!0,e.insertBefore(s,r);if(a instanceof yc){var c=r?r.previousSibling:e.lastChild;Sc(a.contentDOM,a.children,n),r=c?c.nextSibling:e.firstChild}}for(;r;)r=Dc(r),i=!0;i&&n.trackWrites==e&&(n.trackWrites=null)}var _c=function(e){e&&(this.nodeName=e)};_c.prototype=Object.create(null);var Mc=[new _c];function Nc(e,t,n){if(0==e.length)return Mc;for(var r=n?Mc[0]:new _c,i=[r],o=0;o<e.length;o++){var a=e[o].type.attrs;if(a)for(var s in a.nodeName&&i.push(r=new _c(a.nodeName)),a){var c=a[s];null!=c&&(n&&1==i.length&&i.push(r=new _c(t.isInline?"span":"div")),"class"==s?r.class=(r.class?r.class+" ":"")+c:"style"==s?r.style=(r.style?r.style+";":"")+c:"nodeName"!=s&&(r[s]=c))}}return i}function Tc(e,t,n,r){if(n==Mc&&r==Mc)return t;for(var i=t,o=0;o<r.length;o++){var a=r[o],s=n[o];if(o){var c=void 0;s&&s.nodeName==a.nodeName&&i!=e&&(c=i.parentNode)&&c.nodeName.toLowerCase()==a.nodeName||((c=document.createElement(a.nodeName)).pmIsDeco=!0,c.appendChild(i),s=Mc[0]),i=c}Oc(i,s||Mc[0],a)}return i}function Oc(e,t,n){for(var r in t)"class"==r||"style"==r||"nodeName"==r||r in n||e.removeAttribute(r);for(var i in n)"class"!=i&&"style"!=i&&"nodeName"!=i&&n[i]!=t[i]&&e.setAttribute(i,n[i]);if(t.class!=n.class){for(var o=t.class?t.class.split(" ").filter(Boolean):[],a=n.class?n.class.split(" ").filter(Boolean):[],s=0;s<o.length;s++)-1==a.indexOf(o[s])&&e.classList.remove(o[s]);for(var c=0;c<a.length;c++)-1==o.indexOf(a[c])&&e.classList.add(a[c]);0==e.classList.length&&e.removeAttribute("class")}if(t.style!=n.style){if(t.style)for(var l,u=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g;l=u.exec(t.style);)e.style.removeProperty(l[1]);n.style&&(e.style.cssText+=n.style)}}function Ec(e,t,n){return Tc(e,e,Mc,Nc(t,n,1!=e.nodeType))}function Ac(e,t){if(e.length!=t.length)return!1;for(var n=0;n<e.length;n++)if(!e[n].type.eq(t[n].type))return!1;return!0}function Dc(e){var t=e.nextSibling;return e.parentNode.removeChild(e),t}var Ic=function(){return S(function e(t,n,r){x(this,e),this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=t,this.preMatch=function(e,t){var n=t,r=n.children.length,i=e.childCount,o=new Map,a=[];e:for(;i>0;){for(var s=void 0;;)if(r){var c=n.children[r-1];if(!(c instanceof yc)){s=c,r--;break}n=c,r=c.children.length}else{if(n==t)break e;r=n.parent.children.indexOf(n),n=n.parent}var l=s.node;if(l){if(l!=e.child(i-1))break;--i,o.set(s,i),a.push(s)}}return{index:i,matched:o,matches:a.reverse()}}(t.node.content,t)},[{key:"destroyBetween",value:function(e,t){if(e!=t){for(var n=e;n<t;n++)this.top.children[n].destroy();this.top.children.splice(e,t-e),this.changed=!0}}},{key:"destroyRest",value:function(){this.destroyBetween(this.index,this.top.children.length)}},{key:"syncToMarks",value:function(e,t,n){for(var r=0,i=this.stack.length>>1,o=Math.min(i,e.length);r<o&&(r==i-1?this.top:this.stack[r+1<<1]).matchesMark(e[r])&&!1!==e[r].type.spec.spanning;)r++;for(;r<i;)this.destroyRest(),this.top.dirty=0,this.index=this.stack.pop(),this.top=this.stack.pop(),i--;for(;i<e.length;){this.stack.push(this.top,this.index+1);for(var a=-1,s=this.index;s<Math.min(this.index+3,this.top.children.length);s++){var c=this.top.children[s];if(c.matchesMark(e[i])&&!this.isLocked(c.dom)){a=s;break}}if(a>-1)a>this.index&&(this.changed=!0,this.destroyBetween(this.index,a)),this.top=this.top.children[this.index];else{var l=yc.create(this.top,e[i],t,n);this.top.children.splice(this.index,0,l),this.top=l,this.changed=!0}this.index=0,i++}}},{key:"findNodeMatch",value:function(e,t,n,r){var i,o=-1;if(r>=this.preMatch.index&&(i=this.preMatch.matches[r-this.preMatch.index]).parent==this.top&&i.matchesNode(e,t,n))o=this.top.children.indexOf(i,this.index);else for(var a=this.index,s=Math.min(this.top.children.length,a+5);a<s;a++){var c=this.top.children[a];if(c.matchesNode(e,t,n)&&!this.preMatch.matched.has(c)){o=a;break}}return!(o<0)&&(this.destroyBetween(this.index,o),this.index++,!0)}},{key:"updateNodeAt",value:function(e,t,n,r,i){var o=this.top.children[r];return 3==o.dirty&&o.dom==o.contentDOM&&(o.dirty=2),!!o.update(e,t,n,i)&&(this.destroyBetween(this.index,r),this.index++,!0)}},{key:"findIndexWithChild",value:function(e){for(;;){var t=e.parentNode;if(!t)return-1;if(t==this.top.contentDOM){var n=e.pmViewDesc;if(n)for(var r=this.index;r<this.top.children.length;r++)if(this.top.children[r]==n)return r;return-1}e=t}}},{key:"updateNextNode",value:function(e,t,n,r,i,o){for(var a=this.index;a<this.top.children.length;a++){var s=this.top.children[a];if(s instanceof kc){var c=this.preMatch.matched.get(s);if(null!=c&&c!=i)return!1;var l=s.dom,u=void 0,d=this.isLocked(l)&&!(e.isText&&s.node&&s.node.isText&&s.nodeDOM.nodeValue==e.text&&3!=s.dirty&&Ac(t,s.outerDeco));if(!d&&s.update(e,t,n,r))return this.destroyBetween(this.index,a),s.dom!=l&&(this.changed=!0),this.index++,!0;if(!d&&(u=this.recreateWrapper(s,e,t,n,r,o)))return this.destroyBetween(this.index,a),this.top.children[this.index]=u,u.contentDOM&&(u.dirty=2,u.updateChildren(r,o+1),u.dirty=0),this.changed=!0,this.index++,!0;break}}return!1}},{key:"recreateWrapper",value:function(e,t,n,r,i,o){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!Ac(n,e.outerDeco)||!r.eq(e.innerDeco))return null;var a=kc.create(this.top,t,n,r,i,o);if(a.contentDOM){a.children=e.children,e.children=[];var s,c=u(a.children);try{for(c.s();!(s=c.n()).done;){s.value.parent=a}}catch(l){c.e(l)}finally{c.f()}}return e.destroy(),a}},{key:"addNode",value:function(e,t,n,r,i){var o=kc.create(this.top,e,t,n,r,i);o.contentDOM&&o.updateChildren(r,i+1),this.top.children.splice(this.index++,0,o),this.changed=!0}},{key:"placeWidget",value:function(e,t,n){var r=this.index<this.top.children.length?this.top.children[this.index]:null;if(!r||!r.matchesWidget(e)||e!=r.widget&&r.widget.type.toDOM.parentNode){var i=new mc(this.top,e,t,n);this.top.children.splice(this.index++,0,i),this.changed=!0}else this.index++}},{key:"addTextblockHacks",value:function(){for(var e=this.top.children[this.index-1],t=this.top;e instanceof yc;)e=(t=e).children[t.children.length-1];(!e||!(e instanceof bc)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((Vs||Ls)&&e&&"false"==e.dom.contentEditable&&this.addHackNode("IMG",t),this.addHackNode("BR",this.top))}},{key:"addHackNode",value:function(e,t){if(t==this.top&&this.index<t.children.length&&t.children[this.index].matchesHack(e))this.index++;else{var n=document.createElement(e);"IMG"==e&&(n.className="ProseMirror-separator",n.alt=""),"BR"==e&&(n.className="ProseMirror-trailingBreak");var r=new xc(this.top,[],n,null);t!=this.top?t.children.push(r):t.children.splice(this.index++,0,r),this.changed=!0}}},{key:"isLocked",value:function(e){return this.lock&&(e==this.lock||1==e.nodeType&&e.contains(this.lock.parentNode))}}])}();function zc(e,t){return e.type.side-t.type.side}function Rc(e,t,n,r,i){for(var o=[],a=0,s=0;a<e.length;a++){var c=e[a],l=s,u=s+=c.size;l>=n||u<=t?o.push(c):(l<t&&o.push(c.slice(0,t-l,r)),i&&(o.push(i),i=void 0),u>n&&o.push(c.slice(n-l,c.size,r)))}return o}function Pc(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=e.domSelectionRange(),r=e.state.doc;if(!n.focusNode)return null;var i=e.docView.nearestDesc(n.focusNode),o=i&&0==i.size,a=e.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(a<0)return null;var s,c,l=r.resolve(a);if(_s(n)){for(s=a;i&&!i.node;)i=i.parent;var u=i.node;if(i&&u.isAtom&&Ba.isSelectable(u)&&i.parent&&(!u.isInline||!function(e,t,n){for(var r=0==t,i=t==Cs(e);r||i;){if(e==n)return!0;var o=ms(e);if(!(e=e.parentNode))return!1;r=r&&0==o,i=i&&o==Cs(e)}}(n.focusNode,n.focusOffset,i.dom))){var d=i.posBefore;c=new Ba(a==d?l:r.resolve(d))}}else{if(n instanceof e.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){for(var h=a,f=a,p=0;p<n.rangeCount;p++){var v=n.getRangeAt(p);h=Math.min(h,e.docView.posFromDOM(v.startContainer,v.startOffset,1)),f=Math.max(f,e.docView.posFromDOM(v.endContainer,v.endOffset,-1))}if(h<0)return null;var m=g(f==e.state.selection.anchor?[f,h]:[h,f],2);s=m[0],a=m[1],l=r.resolve(a)}else s=e.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(s<0)return null}var y=r.resolve(s);c||(c=qc(e,y,l,"pointer"==t||e.state.selection.head<l.pos&&!o?1:-1));return c}function Lc(e){return e.editable?e.hasFocus():Kc(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function Bc(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=e.state.selection;if(Hc(e,n),Lc(e)){if(!t&&e.input.mouseDown&&e.input.mouseDown.allowDefault&&Ls){var r=e.domSelectionRange(),i=e.domObserver.currentSelection;if(r.anchorNode&&i.anchorNode&&ws(r.anchorNode,r.anchorOffset,i.anchorNode,i.anchorOffset))return e.input.mouseDown.delayedSelectionSync=!0,void e.domObserver.setCurSelection()}if(e.domObserver.disconnectSelection(),e.cursorWrapper)!function(e){var t=e.domSelection();if(!t)return;var n=e.cursorWrapper.dom,r="IMG"==n.nodeName;r?t.collapse(n.parentNode,ms(n)+1):t.collapse(n,0);!r&&!e.state.selection.visible&&Is&&zs<=11&&(n.disabled=!0,n.disabled=!1)}(e);else{var o,a,s=n.anchor,c=n.head;!Vc||n instanceof Pa||(n.$from.parent.inlineContent||(o=Fc(e,n.from)),n.empty||n.$from.parent.inlineContent||(a=Fc(e,n.to))),e.docView.setSelection(s,c,e,t),Vc&&(o&&$c(o),a&&$c(a)),n.visible?e.dom.classList.remove("ProseMirror-hideselection"):(e.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&function(e){var t=e.dom.ownerDocument;t.removeEventListener("selectionchange",e.input.hideSelectionGuard);var n=e.domSelectionRange(),r=n.anchorNode,i=n.anchorOffset;t.addEventListener("selectionchange",e.input.hideSelectionGuard=function(){n.anchorNode==r&&n.anchorOffset==i||(t.removeEventListener("selectionchange",e.input.hideSelectionGuard),setTimeout(function(){Lc(e)&&!e.state.selection.visible||e.dom.classList.remove("ProseMirror-hideselection")},20))})}(e))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}}var Vc=Vs||Ls&&Bs<63;function Fc(e,t){var n=e.docView.domFromPos(t,0),r=n.node,i=n.offset,o=i<r.childNodes.length?r.childNodes[i]:null,a=i?r.childNodes[i-1]:null;if(Vs&&o&&"false"==o.contentEditable)return jc(o);if(!(o&&"false"!=o.contentEditable||a&&"false"!=a.contentEditable)){if(o)return jc(o);if(a)return jc(a)}}function jc(e){return e.contentEditable="true",Vs&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function $c(e){e.contentEditable="false",e.wasDraggable&&(e.draggable=!0,e.wasDraggable=null)}function Hc(e,t){if(t instanceof Ba){var n=e.docView.descAt(t.from);n!=e.lastSelectedViewDesc&&(Wc(e),n&&n.selectNode(),e.lastSelectedViewDesc=n)}else Wc(e)}function Wc(e){e.lastSelectedViewDesc&&(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),e.lastSelectedViewDesc=void 0)}function qc(e,t,n,r){return e.someProp("createSelectionBetween",function(r){return r(e,t,n)})||Pa.between(t,n,r)}function Uc(e){return!(e.editable&&!e.hasFocus())&&Kc(e)}function Kc(e){var t=e.domSelectionRange();if(!t.anchorNode)return!1;try{return e.dom.contains(3==t.anchorNode.nodeType?t.anchorNode.parentNode:t.anchorNode)&&(e.editable||e.dom.contains(3==t.focusNode.nodeType?t.focusNode.parentNode:t.focusNode))}catch(Tt){return!1}}function Jc(e,t){var n=e.selection,r=n.$anchor,i=n.$head,o=t>0?r.max(i):r.min(i),a=o.parent.inlineContent?o.depth?e.doc.resolve(t>0?o.after():o.before()):null:o;return a&&Da.findFrom(a,t)}function Gc(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function Xc(e,t,n){var r=e.state.selection;if(!(r instanceof Pa)){if(r instanceof Ba&&r.node.isInline)return Gc(e,new Pa(t>0?r.$to:r.$from));var i=Jc(e.state,t);return!!i&&Gc(e,i)}if(n.indexOf("s")>-1){var o=r.$head,a=o.textOffset?null:t<0?o.nodeBefore:o.nodeAfter;if(!a||a.isText||!a.isLeaf)return!1;var s=e.state.doc.resolve(o.pos+a.nodeSize*(t<0?-1:1));return Gc(e,new Pa(r.$anchor,s))}if(!r.empty)return!1;if(e.endOfTextblock(t>0?"forward":"backward")){var c=Jc(e.state,t);return!!(c&&c instanceof Ba)&&Gc(e,c)}if(!(js&&n.indexOf("m")>-1)){var l,u=r.$head,d=u.textOffset?null:t<0?u.nodeBefore:u.nodeAfter;if(!d||d.isText)return!1;var h=t<0?u.pos-d.nodeSize:u.pos;return!!(d.isAtom||(l=e.docView.descAt(h))&&!l.contentDOM)&&(Ba.isSelectable(d)?Gc(e,new Ba(t<0?e.state.doc.resolve(u.pos-d.nodeSize):u)):!!Ws&&Gc(e,new Pa(e.state.doc.resolve(t<0?h:h+d.nodeSize))))}}function Yc(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function Zc(e,t){var n=e.pmViewDesc;return n&&0==n.size&&(t<0||e.nextSibling||"BR"!=e.nodeName)}function Qc(e,t){return t<0?function(e){var t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;var i,o,a=!1;Rs&&1==n.nodeType&&r<Yc(n)&&Zc(n.childNodes[r],-1)&&(a=!0);for(;;)if(r>0){if(1!=n.nodeType)break;var s=n.childNodes[r-1];if(Zc(s,-1))i=n,o=--r;else{if(3!=s.nodeType)break;r=(n=s).nodeValue.length}}else{if(el(n))break;for(var c=n.previousSibling;c&&Zc(c,-1);)i=n.parentNode,o=ms(c),c=c.previousSibling;if(c)r=Yc(n=c);else{if((n=n.parentNode)==e.dom)break;r=0}}a?tl(e,n,r):i&&tl(e,i,o)}(e):function(e){var t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;for(var i,o,a=Yc(n);;)if(r<a){if(1!=n.nodeType)break;if(!Zc(n.childNodes[r],1))break;i=n,o=++r}else{if(el(n))break;for(var s=n.nextSibling;s&&Zc(s,1);)i=s.parentNode,o=ms(s)+1,s=s.nextSibling;if(s)r=0,a=Yc(n=s);else{if((n=n.parentNode)==e.dom)break;r=a=0}}i&&tl(e,i,o)}(e)}function el(e){var t=e.pmViewDesc;return t&&t.node&&t.node.isBlock}function tl(e,t,n){var r,i;3!=t.nodeType&&((i=function(e,t){for(;e&&t==e.childNodes.length&&!Ss(e);)t=ms(e)+1,e=e.parentNode;for(;e&&t<e.childNodes.length;){var n=e.childNodes[t];if(3==n.nodeType)return n;if(1==n.nodeType&&"false"==n.contentEditable)break;e=n,t=0}}(t,n))?(t=i,n=0):(r=function(e,t){for(;e&&!t&&!Ss(e);)t=ms(e),e=e.parentNode;for(;e&&t;){var n=e.childNodes[t-1];if(3==n.nodeType)return n;if(1==n.nodeType&&"false"==n.contentEditable)break;t=(e=n).childNodes.length}}(t,n))&&(t=r,n=r.nodeValue.length));var o=e.domSelection();if(o){if(_s(o)){var a=document.createRange();a.setEnd(t,n),a.setStart(t,n),o.removeAllRanges(),o.addRange(a)}else o.extend&&o.extend(t,n);e.domObserver.setCurSelection();var s=e.state;setTimeout(function(){e.state==s&&Bc(e)},50)}}function nl(e,t){var n=e.state.doc.resolve(t);if(!Ls&&!$s&&n.parent.inlineContent){var r=e.coordsAtPos(t);if(t>n.start()){var i=e.coordsAtPos(t-1),o=(i.top+i.bottom)/2;if(o>r.top&&o<r.bottom&&Math.abs(i.left-r.left)>1)return i.left<r.left?"ltr":"rtl"}if(t<n.end()){var a=e.coordsAtPos(t+1),s=(a.top+a.bottom)/2;if(s>r.top&&s<r.bottom&&Math.abs(a.left-r.left)>1)return a.left>r.left?"ltr":"rtl"}}return"rtl"==getComputedStyle(e.dom).direction?"rtl":"ltr"}function rl(e,t,n){var r=e.state.selection;if(r instanceof Pa&&!r.empty||n.indexOf("s")>-1)return!1;if(js&&n.indexOf("m")>-1)return!1;var i=r.$from,o=r.$to;if(!i.parent.inlineContent||e.endOfTextblock(t<0?"up":"down")){var a=Jc(e.state,t);if(a&&a instanceof Ba)return Gc(e,a)}if(!i.parent.inlineContent){var s=t<0?i:o,c=r instanceof Fa?Da.near(s,t):Da.findFrom(s,t);return!!c&&Gc(e,c)}return!1}function il(e,t){if(!(e.state.selection instanceof Pa))return!0;var n=e.state.selection,r=n.$head,i=n.$anchor,o=n.empty;if(!r.sameParent(i))return!0;if(!o)return!1;if(e.endOfTextblock(t>0?"forward":"backward"))return!0;var a=!r.textOffset&&(t<0?r.nodeBefore:r.nodeAfter);if(a&&!a.isText){var s=e.state.tr;return t<0?s.delete(r.pos-a.nodeSize,r.pos):s.delete(r.pos,r.pos+a.nodeSize),e.dispatch(s),!0}return!1}function ol(e,t,n){e.domObserver.stop(),t.contentEditable=n,e.domObserver.start()}function al(e,t){var n=t.keyCode,r=function(e){var t="";return e.ctrlKey&&(t+="c"),e.metaKey&&(t+="m"),e.altKey&&(t+="a"),e.shiftKey&&(t+="s"),t}(t);if(8==n||js&&72==n&&"c"==r)return il(e,-1)||Qc(e,-1);if(46==n&&!t.shiftKey||js&&68==n&&"c"==r)return il(e,1)||Qc(e,1);if(13==n||27==n)return!0;if(37==n||js&&66==n&&"c"==r){var i=37==n?"ltr"==nl(e,e.state.selection.from)?-1:1:-1;return Xc(e,i,r)||Qc(e,i)}if(39==n||js&&70==n&&"c"==r){var o=39==n?"ltr"==nl(e,e.state.selection.from)?1:-1:1;return Xc(e,o,r)||Qc(e,o)}return 38==n||js&&80==n&&"c"==r?rl(e,-1,r)||Qc(e,-1):40==n||js&&78==n&&"c"==r?function(e){if(!Vs||e.state.selection.$head.parentOffset>0)return!1;var t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(n&&1==n.nodeType&&0==r&&n.firstChild&&"false"==n.firstChild.contentEditable){var i=n.firstChild;ol(e,i,"true"),setTimeout(function(){return ol(e,i,"false")},20)}return!1}(e)||rl(e,1,r)||Qc(e,1):r==(js?"m":"c")&&(66==n||73==n||89==n||90==n)}function sl(e,t){e.someProp("transformCopied",function(n){t=n(t,e)});for(var n=[],r=t,i=r.content,o=r.openStart,a=r.openEnd;o>1&&a>1&&1==i.childCount&&1==i.firstChild.childCount;){o--,a--;var s=i.firstChild;n.push(s.type.name,s.attrs!=s.type.defaultAttrs?s.attrs:null),i=s.content}var c=e.someProp("clipboardSerializer")||Ro.fromSchema(e.state.schema),l=gl(),u=l.createElement("div");u.appendChild(c.serializeFragment(i,{document:l}));for(var d,h=u.firstChild,f=0;h&&1==h.nodeType&&(d=vl[h.nodeName.toLowerCase()]);){for(var p=d.length-1;p>=0;p--){for(var v=l.createElement(d[p]);u.firstChild;)v.appendChild(u.firstChild);u.appendChild(v),f++}h=u.firstChild}h&&1==h.nodeType&&h.setAttribute("data-pm-slice","".concat(o," ").concat(a).concat(f?" -".concat(f):""," ").concat(JSON.stringify(n)));var m=e.someProp("clipboardTextSerializer",function(n){return n(t,e)})||t.content.textBetween(0,t.content.size,"\n\n");return{dom:u,text:m,slice:t}}function cl(e,t,n,r,i){var o,a,s=i.parent.type.spec.code;if(!n&&!t)return null;var c=!!t&&(r||s||!n);if(c){if(e.someProp("transformPastedText",function(n){t=n(t,s||r,e)}),s)return a=new Bi(Di.from(e.state.schema.text(t.replace(/\r\n?/g,"\n"))),0,0),e.someProp("transformPasted",function(t){a=t(a,e,!0)}),a;var l=e.someProp("clipboardTextParser",function(n){return n(t,i,r,e)});if(l)a=l;else{var u=i.marks(),d=e.state.schema,h=Ro.fromSchema(d);o=document.createElement("div"),t.split(/(?:\r\n?|\n)+/).forEach(function(e){var t=o.appendChild(document.createElement("p"));e&&t.appendChild(h.serializeNode(d.text(e,u)))})}}else e.someProp("transformPastedHTML",function(t){n=t(n,e)}),o=function(e){var t=/^(\s*<meta [^>]*>)*/.exec(e);t&&(e=e.slice(t[0].length));var n,r=gl().createElement("div"),i=/<([a-z][^>\s]+)/i.exec(e);(n=i&&vl[i[1].toLowerCase()])&&(e=n.map(function(e){return"<"+e+">"}).join("")+e+n.map(function(e){return"</"+e+">"}).reverse().join(""));if(r.innerHTML=function(e){var t=window.trustedTypes;if(!t)return e;yl||(yl=t.defaultPolicy||t.createPolicy("ProseMirrorClipboard",{createHTML:function(e){return e}}));return yl.createHTML(e)}(e),n)for(var o=0;o<n.length;o++)r=r.querySelector(n[o])||r;return r}(n),Ws&&function(e){for(var t=e.querySelectorAll(Ls?"span:not([class]):not([style])":"span.Apple-converted-space"),n=0;n<t.length;n++){var r=t[n];1==r.childNodes.length&&" "==r.textContent&&r.parentNode&&r.parentNode.replaceChild(e.ownerDocument.createTextNode(" "),r)}}(o);var f=o&&o.querySelector("[data-pm-slice]"),p=f&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(f.getAttribute("data-pm-slice")||"");if(p&&p[3])for(var v=+p[3];v>0;v--){for(var m=o.firstChild;m&&1!=m.nodeType;)m=m.nextSibling;if(!m)break;o=m}if(!a){var g=e.someProp("clipboardParser")||e.someProp("domParser")||_o.fromSchema(e.state.schema);a=g.parseSlice(o,{preserveWhitespace:!(!c&&!p),context:i,ruleFromNode:function(e){return"BR"!=e.nodeName||e.nextSibling||!e.parentNode||ll.test(e.parentNode.nodeName)?null:{ignore:!0}}})}if(p)a=function(e,t){if(!e.size)return e;var n,r=e.content.firstChild.type.schema;try{n=JSON.parse(t)}catch(wt){return e}for(var i=e.content,o=e.openStart,a=e.openEnd,s=n.length-2;s>=0;s-=2){var c=r.nodes[n[s]];if(!c||c.hasRequiredAttrs())break;i=Di.from(c.create(n[s+1],i)),o++,a++}return new Bi(i,o,a)}(pl(a,+p[1],+p[2]),p[4]);else if(a=Bi.maxOpen(function(e,t){if(e.childCount<2)return e;for(var n,r=function(){var n,r=t.node(i).contentMatchAt(t.index(i)),o=[];if(e.forEach(function(e){if(o){var t,i=r.findWrapping(e.type);if(!i)return o=null;if(t=o.length&&n.length&&dl(i,n,e,o[o.length-1],0))o[o.length-1]=t;else{o.length&&(o[o.length-1]=hl(o[o.length-1],n.length));var a=ul(e,i);o.push(a),r=r.matchType(a.type),n=i}}}),o)return{v:Di.from(o)}},i=t.depth;i>=0;i--)if(n=r())return n.v;return e}(a.content,i),!0),a.openStart||a.openEnd){for(var y=0,k=0,w=a.content.firstChild;y<a.openStart&&!w.type.spec.isolating;y++,w=w.firstChild);for(var b=a.content.lastChild;k<a.openEnd&&!b.type.spec.isolating;k++,b=b.lastChild);a=pl(a,y,k)}return e.someProp("transformPasted",function(t){a=t(a,e,c)}),a}var ll=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function ul(e,t){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=t.length-1;r>=n;r--)e=t[r].create(null,Di.from(e));return e}function dl(e,t,n,r,i){if(i<e.length&&i<t.length&&e[i]==t[i]){var o=dl(e,t,n,r.lastChild,i+1);if(o)return r.copy(r.content.replaceChild(r.childCount-1,o));if(r.contentMatchAt(r.childCount).matchType(i==e.length-1?n.type:e[i+1]))return r.copy(r.content.append(Di.from(ul(n,e,i+1))))}}function hl(e,t){if(0==t)return e;var n=e.content.replaceChild(e.childCount-1,hl(e.lastChild,t-1)),r=e.contentMatchAt(e.childCount).fillBefore(Di.empty,!0);return e.copy(n.append(r))}function fl(e,t,n,r,i,o){var a=t<0?e.firstChild:e.lastChild,s=a.content;return e.childCount>1&&(o=0),i<r-1&&(s=fl(s,t,n,r,i+1,o)),i>=n&&(s=t<0?a.contentMatchAt(0).fillBefore(s,o<=i).append(s):s.append(a.contentMatchAt(a.childCount).fillBefore(Di.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,a.copy(s))}function pl(e,t,n){return t<e.openStart&&(e=new Bi(fl(e.content,-1,t,e.openStart,0,e.openEnd),t,e.openEnd)),n<e.openEnd&&(e=new Bi(fl(e.content,1,n,e.openEnd,0,0),e.openStart,n)),e}var vl={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]},ml=null;function gl(){return ml||(ml=document.implementation.createHTMLDocument("title"))}var yl=null;var kl={},wl={},bl={touchstart:!0,touchmove:!0},xl=S(function e(){x(this,e),this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null});function Cl(e,t){e.input.lastSelectionOrigin=t,e.input.lastSelectionTime=Date.now()}function Sl(e){e.someProp("handleDOMEvents",function(t){for(var n in t)e.input.eventHandlers[n]||e.dom.addEventListener(n,e.input.eventHandlers[n]=function(t){return _l(e,t)})})}function _l(e,t){return e.someProp("handleDOMEvents",function(n){var r=n[t.type];return!!r&&(r(e,t)||t.defaultPrevented)})}function Ml(e){return{left:e.clientX,top:e.clientY}}function Nl(e,t,n,r,i){if(-1==r)return!1;for(var o,a=e.state.doc.resolve(r),s=function(r){if(e.someProp(t,function(t){return r>a.depth?t(e,n,a.nodeAfter,a.before(r),i,!0):t(e,n,a.node(r),a.before(r),i,!1)}))return{v:!0}},c=a.depth+1;c>0;c--)if(o=s(c))return o.v;return!1}function Tl(e,t,n){if(e.focused||e.focus(),!e.state.selection.eq(t)){var r=e.state.tr.setSelection(t);"pointer"==n&&r.setMeta("pointer",!0),e.dispatch(r)}}function Ol(e,t,n,r,i){return Nl(e,"handleClickOn",t,n,r)||e.someProp("handleClick",function(n){return n(e,t,r)})||(i?function(e,t){if(-1==t)return!1;var n,r,i=e.state.selection;i instanceof Ba&&(n=i.node);for(var o=e.state.doc.resolve(t),a=o.depth+1;a>0;a--){var s=a>o.depth?o.nodeAfter:o.node(a);if(Ba.isSelectable(s)){r=n&&i.$from.depth>0&&a>=i.$from.depth&&o.before(i.$from.depth+1)==i.$from.pos?o.before(i.$from.depth):o.before(a);break}}return null!=r&&(Tl(e,Ba.create(e.state.doc,r),"pointer"),!0)}(e,n):function(e,t){if(-1==t)return!1;var n=e.state.doc.resolve(t),r=n.nodeAfter;return!!(r&&r.isAtom&&Ba.isSelectable(r))&&(Tl(e,new Ba(n),"pointer"),!0)}(e,n))}function El(e,t,n,r){return Nl(e,"handleDoubleClickOn",t,n,r)||e.someProp("handleDoubleClick",function(n){return n(e,t,r)})}function Al(e,t,n,r){return Nl(e,"handleTripleClickOn",t,n,r)||e.someProp("handleTripleClick",function(n){return n(e,t,r)})||function(e,t,n){if(0!=n.button)return!1;var r=e.state.doc;if(-1==t)return!!r.inlineContent&&(Tl(e,Pa.create(r,0,r.content.size),"pointer"),!0);for(var i=r.resolve(t),o=i.depth+1;o>0;o--){var a=o>i.depth?i.nodeAfter:i.node(o),s=i.before(o);if(a.inlineContent)Tl(e,Pa.create(r,s+1,s+1+a.content.size),"pointer");else{if(!Ba.isSelectable(a))continue;Tl(e,Ba.create(r,s),"pointer")}return!0}}(e,n,r)}function Dl(e){return Fl(e)}wl.keydown=function(e,t){var n=t;if(e.input.shiftKey=16==n.keyCode||n.shiftKey,!Rl(e,n)&&(e.input.lastKeyCode=n.keyCode,e.input.lastKeyCodeTime=Date.now(),!Hs||!Ls||13!=n.keyCode))if(229!=n.keyCode&&e.domObserver.forceFlush(),!Fs||13!=n.keyCode||n.ctrlKey||n.altKey||n.metaKey)e.someProp("handleKeyDown",function(t){return t(e,n)})||al(e,n)?n.preventDefault():Cl(e,"key");else{var r=Date.now();e.input.lastIOSEnter=r,e.input.lastIOSEnterFallbackTimeout=setTimeout(function(){e.input.lastIOSEnter==r&&(e.someProp("handleKeyDown",function(t){return t(e,Ms(13,"Enter"))}),e.input.lastIOSEnter=0)},200)}},wl.keyup=function(e,t){16==t.keyCode&&(e.input.shiftKey=!1)},wl.keypress=function(e,t){var n=t;if(!(Rl(e,n)||!n.charCode||n.ctrlKey&&!n.altKey||js&&n.metaKey))if(e.someProp("handleKeyPress",function(t){return t(e,n)}))n.preventDefault();else{var r=e.state.selection;if(!(r instanceof Pa&&r.$from.sameParent(r.$to))){var i=String.fromCharCode(n.charCode),o=function(){return e.state.tr.insertText(i).scrollIntoView()};/[\r\n]/.test(i)||e.someProp("handleTextInput",function(t){return t(e,r.$from.pos,r.$to.pos,i,o)})||e.dispatch(o()),n.preventDefault()}}};var Il=js?"metaKey":"ctrlKey";kl.mousedown=function(e,t){var n=t;e.input.shiftKey=n.shiftKey;var r=Dl(e),i=Date.now(),o="singleClick";i-e.input.lastClick.time<500&&function(e,t){var n=t.x-e.clientX,r=t.y-e.clientY;return n*n+r*r<100}(n,e.input.lastClick)&&!n[Il]&&e.input.lastClick.button==n.button&&("singleClick"==e.input.lastClick.type?o="doubleClick":"doubleClick"==e.input.lastClick.type&&(o="tripleClick")),e.input.lastClick={time:i,x:n.clientX,y:n.clientY,type:o,button:n.button};var a=e.posAtCoords(Ml(n));a&&("singleClick"==o?(e.input.mouseDown&&e.input.mouseDown.done(),e.input.mouseDown=new zl(e,a,n,!!r)):("doubleClick"==o?El:Al)(e,a.pos,a.inside,n)?n.preventDefault():Cl(e,"pointer"))};var zl=function(){return S(function e(t,n,r,i){var o,a,s=this;if(x(this,e),this.view=t,this.pos=n,this.event=r,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=t.state.doc,this.selectNode=!!r[Il],this.allowDefault=r.shiftKey,n.inside>-1)o=t.state.doc.nodeAt(n.inside),a=n.inside;else{var c=t.state.doc.resolve(n.pos);o=c.parent,a=c.depth?c.before():0}var l=i?null:r.target,u=l?t.docView.nearestDesc(l,!0):null;this.target=u&&1==u.nodeDOM.nodeType?u.nodeDOM:null;var d=t.state.selection;(0==r.button&&o.type.spec.draggable&&!1!==o.type.spec.selectable||d instanceof Ba&&d.from<=a&&d.to>a)&&(this.mightDrag={node:o,pos:a,addAttr:!(!this.target||this.target.draggable),setUneditable:!(!this.target||!Rs||this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(function(){s.view.input.mouseDown==s&&s.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),t.root.addEventListener("mouseup",this.up=this.up.bind(this)),t.root.addEventListener("mousemove",this.move=this.move.bind(this)),Cl(t,"pointer")},[{key:"done",value:function(){var e=this;this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(function(){return Bc(e.view)}),this.view.input.mouseDown=null}},{key:"up",value:function(e){if(this.done(),this.view.dom.contains(e.target)){var t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(Ml(e))),this.updateAllowDefault(e),this.allowDefault||!t?Cl(this.view,"pointer"):Ol(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():0==e.button&&(this.flushed||Vs&&this.mightDrag&&!this.mightDrag.node.isAtom||Ls&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(Tl(this.view,Da.near(this.view.state.doc.resolve(t.pos)),"pointer"),e.preventDefault()):Cl(this.view,"pointer")}}},{key:"move",value:function(e){this.updateAllowDefault(e),Cl(this.view,"pointer"),0==e.buttons&&this.done()}},{key:"updateAllowDefault",value:function(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}])}();function Rl(e,t){return!!e.composing||!!(Vs&&Math.abs(t.timeStamp-e.input.compositionEndedAt)<500)&&(e.input.compositionEndedAt=-2e8,!0)}kl.touchstart=function(e){e.input.lastTouch=Date.now(),Dl(e),Cl(e,"pointer")},kl.touchmove=function(e){e.input.lastTouch=Date.now(),Cl(e,"pointer")},kl.contextmenu=function(e){return Dl(e)};var Pl=Hs?5e3:-1;function Ll(e,t){clearTimeout(e.input.composingTimeout),t>-1&&(e.input.composingTimeout=setTimeout(function(){return Fl(e)},t))}function Bl(e){var t;for(e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=((t=document.createEvent("Event")).initEvent("event",!0,!0),t.timeStamp));e.input.compositionNodes.length>0;)e.input.compositionNodes.pop().markParentsDirty()}function Vl(e){var t=e.domSelectionRange();if(!t.focusNode)return null;var n=function(e,t){for(;;){if(3==e.nodeType&&t)return e;if(1==e.nodeType&&t>0){if("false"==e.contentEditable)return null;t=Cs(e=e.childNodes[t-1])}else{if(!e.parentNode||Ss(e))return null;t=ms(e),e=e.parentNode}}}(t.focusNode,t.focusOffset),r=function(e,t){for(;;){if(3==e.nodeType&&t<e.nodeValue.length)return e;if(1==e.nodeType&&t<e.childNodes.length){if("false"==e.contentEditable)return null;e=e.childNodes[t],t=0}else{if(!e.parentNode||Ss(e))return null;t=ms(e)+1,e=e.parentNode}}}(t.focusNode,t.focusOffset);if(n&&r&&n!=r){var i=r.pmViewDesc,o=e.domObserver.lastChangedTextNode;if(n==o||r==o)return o;if(!i||!i.isText(r.nodeValue))return r;if(e.input.compositionNode==r){var a=n.pmViewDesc;if(a&&a.isText(n.nodeValue))return r}}return n||r}function Fl(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!(Hs&&e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),Bl(e),t||e.docView&&e.docView.dirty){var n=Pc(e),r=e.state.selection;return n&&!n.eq(r)?e.dispatch(e.state.tr.setSelection(n)):!e.markCursor&&!t||r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?e.updateState(e.state):e.dispatch(e.state.tr.deleteSelection()),!0}return!1}}wl.compositionstart=wl.compositionupdate=function(e){if(!e.composing){e.domObserver.flush();var t=e.state,n=t.selection.$to;if(t.selection instanceof Pa&&(t.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(function(e){return!1===e.type.spec.inclusive})||Ls&&$s&&function(e){var t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n||1!=n.nodeType||r>=n.childNodes.length)return!1;var i=n.childNodes[r];return 1==i.nodeType&&"false"==i.contentEditable}(e)))e.markCursor=e.state.storedMarks||n.marks(),Fl(e,!0),e.markCursor=null;else if(Fl(e,!t.selection.empty),Rs&&t.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length)for(var r=e.domSelectionRange(),i=r.focusNode,o=r.focusOffset;i&&1==i.nodeType&&0!=o;){var a=o<0?i.lastChild:i.childNodes[o-1];if(!a)break;if(3==a.nodeType){var s=e.domSelection();s&&s.collapse(a,a.nodeValue.length);break}i=a,o=-1}e.input.composing=!0}Ll(e,Pl)},wl.compositionend=function(e,t){e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=t.timeStamp,e.input.compositionPendingChanges=e.domObserver.pendingRecords().length?e.input.compositionID:0,e.input.compositionNode=null,e.input.compositionPendingChanges&&Promise.resolve().then(function(){return e.domObserver.flush()}),e.input.compositionID++,Ll(e,20))};var jl=Is&&zs<15||Fs&&qs<604;function $l(e,t,n,r,i){var o=cl(e,t,n,r,e.state.selection.$from);if(e.someProp("handlePaste",function(t){return t(e,i,o||Bi.empty)}))return!0;if(!o)return!1;var a=function(e){return 0==e.openStart&&0==e.openEnd&&1==e.content.childCount?e.content.firstChild:null}(o),s=a?e.state.tr.replaceSelectionWith(a,r):e.state.tr.replaceSelection(o);return e.dispatch(s.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Hl(e){var t=e.getData("text/plain")||e.getData("Text");if(t)return t;var n=e.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}kl.copy=wl.cut=function(e,t){var n=t,r=e.state.selection,i="cut"==n.type;if(!r.empty){var o=jl?null:n.clipboardData,a=sl(e,r.content()),s=a.dom,c=a.text;o?(n.preventDefault(),o.clearData(),o.setData("text/html",s.innerHTML),o.setData("text/plain",c)):function(e,t){if(e.dom.parentNode){var n=e.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(t),n.style.cssText="position: fixed; left: -10000px; top: 10px";var r=getSelection(),i=document.createRange();i.selectNodeContents(t),e.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(function(){n.parentNode&&n.parentNode.removeChild(n),e.focus()},50)}}(e,s),i&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))}},wl.paste=function(e,t){var n=t;if(!e.composing||Hs){var r=jl?null:n.clipboardData,i=e.input.shiftKey&&45!=e.input.lastKeyCode;r&&$l(e,Hl(r),r.getData("text/html"),i,n)?n.preventDefault():function(e,t){if(e.dom.parentNode){var n=e.input.shiftKey||e.state.selection.$from.parent.type.spec.code,r=e.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();var i=e.input.shiftKey&&45!=e.input.lastKeyCode;setTimeout(function(){e.focus(),r.parentNode&&r.parentNode.removeChild(r),n?$l(e,r.value,null,i,t):$l(e,r.textContent,r.innerHTML,i,t)},50)}}(e,n)}};var Wl=S(function e(t,n,r){x(this,e),this.slice=t,this.move=n,this.node=r}),ql=js?"altKey":"ctrlKey";function Ul(e,t){var n=e.someProp("dragCopies",function(e){return!e(t)});return null!=n?n:!t[ql]}for(var Kl in kl.dragstart=function(e,t){var n=t,r=e.input.mouseDown;if(r&&r.done(),n.dataTransfer){var i,o=e.state.selection,a=o.empty?null:e.posAtCoords(Ml(n));if(a&&a.pos>=o.from&&a.pos<=(o instanceof Ba?o.to-1:o.to));else if(r&&r.mightDrag)i=Ba.create(e.state.doc,r.mightDrag.pos);else if(n.target&&1==n.target.nodeType){var s=e.docView.nearestDesc(n.target,!0);s&&s.node.type.spec.draggable&&s!=e.docView&&(i=Ba.create(e.state.doc,s.posBefore))}var c=sl(e,(i||e.state.selection).content()),l=c.dom,u=c.text,d=c.slice;(!n.dataTransfer.files.length||!Ls||Bs>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(jl?"Text":"text/html",l.innerHTML),n.dataTransfer.effectAllowed="copyMove",jl||n.dataTransfer.setData("text/plain",u),e.dragging=new Wl(d,Ul(e,n),i)}},kl.dragend=function(e){var t=e.dragging;window.setTimeout(function(){e.dragging==t&&(e.dragging=null)},50)},wl.dragover=wl.dragenter=function(e,t){return t.preventDefault()},wl.drop=function(e,t){try{!function(e,t,n){if(!t.dataTransfer)return;var r=e.posAtCoords(Ml(t));if(!r)return;var i=e.state.doc.resolve(r.pos),o=n&&n.slice;o?e.someProp("transformPasted",function(t){o=t(o,e,!1)}):o=cl(e,Hl(t.dataTransfer),jl?null:t.dataTransfer.getData("text/html"),!1,i);var a=!(!n||!Ul(e,t));if(e.someProp("handleDrop",function(n){return n(e,t,o||Bi.empty,a)}))return void t.preventDefault();if(!o)return;t.preventDefault();var s=o?va(e.state.doc,i.pos,o):i.pos;null==s&&(s=i.pos);var c=e.state.tr;if(a){var l=n.node;l?l.replace(c):c.deleteSelection()}var u=c.mapping.map(s),d=0==o.openStart&&0==o.openEnd&&1==o.content.childCount,h=c.doc;d?c.replaceRangeWith(u,u,o.content.firstChild):c.replaceRange(u,u,o);if(c.doc.eq(h))return;var f=c.doc.resolve(u);if(d&&Ba.isSelectable(o.content.firstChild)&&f.nodeAfter&&f.nodeAfter.sameMarkup(o.content.firstChild))c.setSelection(new Ba(f));else{var p=c.mapping.map(s);c.mapping.maps[c.mapping.maps.length-1].forEach(function(e,t,n,r){return p=r}),c.setSelection(qc(e,f,c.doc.resolve(p)))}e.focus(),e.dispatch(c.setMeta("uiEvent","drop"))}(e,t,e.dragging)}finally{e.dragging=null}},kl.focus=function(e){e.input.lastFocus=Date.now(),e.focused||(e.domObserver.stop(),e.dom.classList.add("ProseMirror-focused"),e.domObserver.start(),e.focused=!0,setTimeout(function(){e.docView&&e.hasFocus()&&!e.domObserver.currentSelection.eq(e.domSelectionRange())&&Bc(e)},20))},kl.blur=function(e,t){var n=t;e.focused&&(e.domObserver.stop(),e.dom.classList.remove("ProseMirror-focused"),e.domObserver.start(),n.relatedTarget&&e.dom.contains(n.relatedTarget)&&e.domObserver.currentSelection.clear(),e.focused=!1)},kl.beforeinput=function(e,t){if(Ls&&Hs&&"deleteContentBackward"==t.inputType){e.domObserver.flushSoon();var n=e.input.domChangeCount;setTimeout(function(){if(e.input.domChangeCount==n&&(e.dom.blur(),e.focus(),!e.someProp("handleKeyDown",function(t){return t(e,Ms(8,"Backspace"))}))){var t=e.state.selection.$cursor;t&&t.pos>0&&e.dispatch(e.state.tr.delete(t.pos-1,t.pos).scrollIntoView())}},50)}},wl)kl[Kl]=wl[Kl];function Jl(e,t){if(e==t)return!0;for(var n in e)if(e[n]!==t[n])return!1;for(var r in t)if(!(r in e))return!1;return!0}var Gl=function(){function e(t,n){x(this,e),this.toDOM=t,this.spec=n||eu,this.side=this.spec.side||0}return S(e,[{key:"map",value:function(e,t,n,r){var i=e.mapResult(t.from+r,this.side<0?-1:1),o=i.pos;return i.deleted?null:new Zl(o-n,o-n,this)}},{key:"valid",value:function(){return!0}},{key:"eq",value:function(t){return this==t||t instanceof e&&(this.spec.key&&this.spec.key==t.spec.key||this.toDOM==t.toDOM&&Jl(this.spec,t.spec))}},{key:"destroy",value:function(e){this.spec.destroy&&this.spec.destroy(e)}}])}(),Xl=function(){function e(t,n){x(this,e),this.attrs=t,this.spec=n||eu}return S(e,[{key:"map",value:function(e,t,n,r){var i=e.map(t.from+r,this.spec.inclusiveStart?-1:1)-n,o=e.map(t.to+r,this.spec.inclusiveEnd?1:-1)-n;return i>=o?null:new Zl(i,o,this)}},{key:"valid",value:function(e,t){return t.from<t.to}},{key:"eq",value:function(t){return this==t||t instanceof e&&Jl(this.attrs,t.attrs)&&Jl(this.spec,t.spec)}},{key:"destroy",value:function(){}}],[{key:"is",value:function(t){return t.type instanceof e}}])}(),Yl=function(){function e(t,n){x(this,e),this.attrs=t,this.spec=n||eu}return S(e,[{key:"map",value:function(e,t,n,r){var i=e.mapResult(t.from+r,1);if(i.deleted)return null;var o=e.mapResult(t.to+r,-1);return o.deleted||o.pos<=i.pos?null:new Zl(i.pos-n,o.pos-n,this)}},{key:"valid",value:function(e,t){var n,r=e.content.findIndex(t.from),i=r.index,o=r.offset;return o==t.from&&!(n=e.child(i)).isText&&o+n.nodeSize==t.to}},{key:"eq",value:function(t){return this==t||t instanceof e&&Jl(this.attrs,t.attrs)&&Jl(this.spec,t.spec)}},{key:"destroy",value:function(){}}])}(),Zl=function(){function e(t,n,r){x(this,e),this.from=t,this.to=n,this.type=r}return S(e,[{key:"copy",value:function(t,n){return new e(t,n,this.type)}},{key:"eq",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}},{key:"map",value:function(e,t,n){return this.type.map(e,this,t,n)}},{key:"spec",get:function(){return this.type.spec}},{key:"inline",get:function(){return this.type instanceof Xl}},{key:"widget",get:function(){return this.type instanceof Gl}}],[{key:"widget",value:function(t,n,r){return new e(t,t,new Gl(n,r))}},{key:"inline",value:function(t,n,r,i){return new e(t,n,new Xl(r,i))}},{key:"node",value:function(t,n,r,i){return new e(t,n,new Yl(r,i))}}])}(),Ql=[],eu={},tu=function(){function e(t,n){x(this,e),this.local=t.length?t:Ql,this.children=n.length?n:Ql}return S(e,[{key:"find",value:function(e,t,n){var r=[];return this.findInner(null==e?0:e,null==t?1e9:t,r,0,n),r}},{key:"findInner",value:function(e,t,n,r,i){for(var o=0;o<this.local.length;o++){var a=this.local[o];a.from<=t&&a.to>=e&&(!i||i(a.spec))&&n.push(a.copy(a.from+r,a.to+r))}for(var s=0;s<this.children.length;s+=3)if(this.children[s]<t&&this.children[s+1]>e){var c=this.children[s]+1;this.children[s+2].findInner(e-c,t-c,n,r+c,i)}}},{key:"map",value:function(e,t,n){return this==nu||0==e.maps.length?this:this.mapInner(e,t,0,0,n||eu)}},{key:"mapInner",value:function(t,n,r,i,o){for(var a,s=0;s<this.local.length;s++){var c=this.local[s].map(t,r,i);c&&c.type.valid(n,c)?(a||(a=[])).push(c):o.onRemove&&o.onRemove(this.local[s].spec)}return this.children.length?iu(this.children,a||[],t,n,r,i,o):a?new e(a.sort(lu),Ql):nu}},{key:"add",value:function(t,n){return n.length?this==nu?e.create(t,n):this.addInner(t,n,0):this}},{key:"addInner",value:function(t,n,r){var i,o=this,a=0;t.forEach(function(e,t){var s,c=t+r;if(s=au(n,e,c)){for(i||(i=o.children.slice());a<i.length&&i[a]<t;)a+=3;i[a]==t?i[a+2]=i[a+2].addInner(e,s,c+1):i.splice(a,0,t,t+e.nodeSize,cu(s,e,c+1,eu)),a+=3}});for(var s=ou(a?su(n):n,-r),c=0;c<s.length;c++)s[c].type.valid(t,s[c])||s.splice(c--,1);return new e(s.length?this.local.concat(s).sort(lu):this.local,i||this.children)}},{key:"remove",value:function(e){return 0==e.length||this==nu?this:this.removeInner(e,0)}},{key:"removeInner",value:function(t,n){for(var r=this.children,i=this.local,o=0;o<r.length;o+=3){for(var a,s=void 0,c=r[o]+n,l=r[o+1]+n,u=0;u<t.length;u++)(a=t[u])&&a.from>c&&a.to<l&&(t[u]=null,(s||(s=[])).push(a));if(s){r==this.children&&(r=this.children.slice());var d=r[o+2].removeInner(s,c+1);d!=nu?r[o+2]=d:(r.splice(o,3),o-=3)}}if(i.length)for(var h,f=0;f<t.length;f++)if(h=t[f])for(var p=0;p<i.length;p++)i[p].eq(h,n)&&(i==this.local&&(i=this.local.slice()),i.splice(p--,1));return r==this.children&&i==this.local?this:i.length||r.length?new e(i,r):nu}},{key:"forChild",value:function(t,n){if(this==nu)return this;if(n.isLeaf)return e.empty;for(var r,i,o=0;o<this.children.length;o+=3)if(this.children[o]>=t){this.children[o]==t&&(r=this.children[o+2]);break}for(var a=t+1,s=a+n.content.size,c=0;c<this.local.length;c++){var l=this.local[c];if(l.from<s&&l.to>a&&l.type instanceof Xl){var u=Math.max(a,l.from)-a,d=Math.min(s,l.to)-a;u<d&&(i||(i=[])).push(l.copy(u,d))}}if(i){var h=new e(i.sort(lu),Ql);return r?new ru([h,r]):h}return r||nu}},{key:"eq",value:function(t){if(this==t)return!0;if(!(t instanceof e)||this.local.length!=t.local.length||this.children.length!=t.children.length)return!1;for(var n=0;n<this.local.length;n++)if(!this.local[n].eq(t.local[n]))return!1;for(var r=0;r<this.children.length;r+=3)if(this.children[r]!=t.children[r]||this.children[r+1]!=t.children[r+1]||!this.children[r+2].eq(t.children[r+2]))return!1;return!0}},{key:"locals",value:function(e){return uu(this.localsInner(e))}},{key:"localsInner",value:function(e){if(this==nu)return Ql;if(e.inlineContent||!this.local.some(Xl.is))return this.local;for(var t=[],n=0;n<this.local.length;n++)this.local[n].type instanceof Xl||t.push(this.local[n]);return t}},{key:"forEachSet",value:function(e){e(this)}}],[{key:"create",value:function(e,t){return t.length?cu(t,e,0,eu):nu}}])}();tu.empty=new tu([],[]),tu.removeOverlap=uu;var nu=tu.empty,ru=function(){function e(t){x(this,e),this.members=t}return S(e,[{key:"map",value:function(t,n){var r=this.members.map(function(e){return e.map(t,n,eu)});return e.from(r)}},{key:"forChild",value:function(t,n){if(n.isLeaf)return tu.empty;for(var r=[],i=0;i<this.members.length;i++){var o=this.members[i].forChild(t,n);o!=nu&&(o instanceof e?r=r.concat(o.members):r.push(o))}return e.from(r)}},{key:"eq",value:function(t){if(!(t instanceof e)||t.members.length!=this.members.length)return!1;for(var n=0;n<this.members.length;n++)if(!this.members[n].eq(t.members[n]))return!1;return!0}},{key:"locals",value:function(e){for(var t,n=!0,r=0;r<this.members.length;r++){var i=this.members[r].localsInner(e);if(i.length)if(t){n&&(t=t.slice(),n=!1);for(var o=0;o<i.length;o++)t.push(i[o])}else t=i}return t?uu(n?t:t.sort(lu)):Ql}},{key:"forEachSet",value:function(e){for(var t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}],[{key:"from",value:function(t){switch(t.length){case 0:return nu;case 1:return t[0];default:return new e(t.every(function(e){return e instanceof tu})?t:t.reduce(function(e,t){return e.concat(t instanceof tu?t:t.members)},[]))}}}])}();function iu(e,t,n,r,i,o,a){for(var s=e.slice(),c=function(e){var t=0;n.maps[l].forEach(function(n,r,i,o){for(var a=o-i-(r-n),c=0;c<s.length;c+=3){var l=s[c+1];if(!(l<0||n>l+e-t)){var u=s[c]+e-t;r>=u?s[c+1]=n<=u?-2:-1:n>=e&&a&&(s[c]+=a,s[c+1]+=a)}}t+=a}),e=n.maps[l].map(e,-1),u=e},l=0,u=o;l<n.maps.length;l++)c(u);for(var d=!1,h=0;h<s.length;h+=3)if(s[h+1]<0){if(-2==s[h+1]){d=!0,s[h+1]=-1;continue}var f=n.map(e[h]+o),p=f-i;if(p<0||p>=r.content.size){d=!0;continue}var v=n.map(e[h+1]+o,-1)-i,m=r.content.findIndex(p),g=m.index,y=m.offset,k=r.maybeChild(g);if(k&&y==p&&y+k.nodeSize==v){var w=s[h+2].mapInner(n,k,f+1,e[h]+o+1,a);w!=nu?(s[h]=p,s[h+1]=v,s[h+2]=w):(s[h+1]=-2,d=!0)}else d=!0}if(d){var b=function(e,t,n,r,i,o,a){function s(e,t){for(var o=0;o<e.local.length;o++){var c=e.local[o].map(r,i,t);c?n.push(c):a.onRemove&&a.onRemove(e.local[o].spec)}for(var l=0;l<e.children.length;l+=3)s(e.children[l+2],e.children[l]+t+1)}for(var c=0;c<e.length;c+=3)-1==e[c+1]&&s(e[c+2],t[c]+o+1);return n}(s,e,t,n,i,o,a),x=cu(b,r,0,a);t=x.local;for(var C=0;C<s.length;C+=3)s[C+1]<0&&(s.splice(C,3),C-=3);for(var S=0,_=0;S<x.children.length;S+=3){for(var M=x.children[S];_<s.length&&s[_]<M;)_+=3;s.splice(_,0,x.children[S],x.children[S+1],x.children[S+2])}}return new tu(t.sort(lu),s)}function ou(e,t){if(!t||!e.length)return e;for(var n=[],r=0;r<e.length;r++){var i=e[r];n.push(new Zl(i.from+t,i.to+t,i.type))}return n}function au(e,t,n){if(t.isLeaf)return null;for(var r,i=n+t.nodeSize,o=null,a=0;a<e.length;a++)(r=e[a])&&r.from>n&&r.to<i&&((o||(o=[])).push(r),e[a]=null);return o}function su(e){for(var t=[],n=0;n<e.length;n++)null!=e[n]&&t.push(e[n]);return t}function cu(e,t,n,r){var i=[],o=!1;t.forEach(function(t,a){var s=au(e,t,a+n);if(s){o=!0;var c=cu(s,t,n+a+1,r);c!=nu&&i.push(a,a+t.nodeSize,c)}});for(var a=ou(o?su(e):e,-n).sort(lu),s=0;s<a.length;s++)a[s].type.valid(t,a[s])||(r.onRemove&&r.onRemove(a[s].spec),a.splice(s--,1));return a.length||i.length?new tu(a,i):nu}function lu(e,t){return e.from-t.from||e.to-t.to}function uu(e){for(var t=e,n=0;n<t.length-1;n++){var r=t[n];if(r.from!=r.to)for(var i=n+1;i<t.length;i++){var o=t[i];if(o.from!=r.from){o.from<r.to&&(t==e&&(t=e.slice()),t[n]=r.copy(r.from,o.from),du(t,i,r.copy(o.from,r.to)));break}o.to!=r.to&&(t==e&&(t=e.slice()),t[i]=o.copy(o.from,r.to),du(t,i+1,o.copy(r.to,o.to)))}}return t}function du(e,t,n){for(;t<e.length&&lu(n,e[t])>0;)t++;e.splice(t,0,n)}function hu(e){var t=[];return e.someProp("decorations",function(n){var r=n(e.state);r&&r!=nu&&t.push(r)}),e.cursorWrapper&&t.push(tu.create(e.state.doc,[e.cursorWrapper.deco])),ru.from(t)}var fu={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},pu=Is&&zs<=11,vu=function(){return S(function e(){x(this,e),this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0},[{key:"set",value:function(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}},{key:"clear",value:function(){this.anchorNode=this.focusNode=null}},{key:"eq",value:function(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}])}(),mu=function(){return S(function e(t,n){var r=this;x(this,e),this.view=t,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new vu,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(function(e){for(var t=0;t<e.length;t++)r.queue.push(e[t]);Is&&zs<=11&&e.some(function(e){return"childList"==e.type&&e.removedNodes.length||"characterData"==e.type&&e.oldValue.length>e.target.nodeValue.length})?r.flushSoon():r.flush()}),pu&&(this.onCharData=function(e){r.queue.push({target:e.target,type:"characterData",oldValue:e.prevValue}),r.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)},[{key:"flushSoon",value:function(){var e=this;this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(function(){e.flushingSoon=-1,e.flush()},20))}},{key:"forceFlush",value:function(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}},{key:"start",value:function(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,fu)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}},{key:"stop",value:function(){var e=this;if(this.observer){var t=this.observer.takeRecords();if(t.length){for(var n=0;n<t.length;n++)this.queue.push(t[n]);window.setTimeout(function(){return e.flush()},20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}},{key:"connectSelection",value:function(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}},{key:"disconnectSelection",value:function(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}},{key:"suppressSelectionUpdates",value:function(){var e=this;this.suppressingSelectionUpdates=!0,setTimeout(function(){return e.suppressingSelectionUpdates=!1},50)}},{key:"onSelectionChange",value:function(){if(Uc(this.view)){if(this.suppressingSelectionUpdates)return Bc(this.view);if(Is&&zs<=11&&!this.view.state.selection.empty){var e=this.view.domSelectionRange();if(e.focusNode&&ws(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}},{key:"setCurSelection",value:function(){this.currentSelection.set(this.view.domSelectionRange())}},{key:"ignoreSelectionChange",value:function(e){if(!e.focusNode)return!0;for(var t,n=new Set,r=e.focusNode;r;r=gs(r))n.add(r);for(var i=e.anchorNode;i;i=gs(i))if(n.has(i)){t=i;break}var o=t&&this.view.docView.nearestDesc(t);return o&&o.ignoreMutation({type:"selection",target:3==t.nodeType?t.parentNode:t})?(this.setCurSelection(),!0):void 0}},{key:"pendingRecords",value:function(){if(this.observer){var e,t=u(this.observer.takeRecords());try{for(t.s();!(e=t.n()).done;){var n=e.value;this.queue.push(n)}}catch(r){t.e(r)}finally{t.f()}}return this.queue}},{key:"flush",value:function(){var e=this.view;if(e.docView&&!(this.flushingSoon>-1)){var t=this.pendingRecords();t.length&&(this.queue=[]);var n=e.domSelectionRange(),r=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(n)&&Uc(e)&&!this.ignoreSelectionChange(n),i=-1,o=-1,a=!1,s=[];if(e.editable)for(var c=0;c<t.length;c++){var l=this.registerMutation(t[c],s);l&&(i=i<0?l.from:Math.min(l.from,i),o=o<0?l.to:Math.max(l.to,o),l.typeOver&&(a=!0))}if(Rs&&s.length){var d=s.filter(function(e){return"BR"==e.nodeName});if(2==d.length){var h=g(d,2),f=h[0],p=h[1];f.parentNode&&f.parentNode.parentNode==p.parentNode?p.remove():f.remove()}else{var v,m=this.currentSelection.focusNode,y=u(d);try{for(y.s();!(v=y.n()).done;){var k=v.value,w=k.parentNode;!w||"LI"!=w.nodeName||m&&wu(e,m)==w||k.remove()}}catch(M){y.e(M)}finally{y.f()}}}else if((Ls||Vs)&&s.some(function(e){return"BR"==e.nodeName})&&(8==e.input.lastKeyCode||46==e.input.lastKeyCode)){var b,x=u(s);try{for(x.s();!(b=x.n()).done;){var C=b.value;if("BR"==C.nodeName&&C.parentNode){var S=C.nextSibling;S&&1==S.nodeType&&"false"==S.contentEditable&&C.parentNode.removeChild(C)}}}catch(M){x.e(M)}finally{x.f()}}var _=null;i<0&&r&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&_s(n)&&(_=Pc(e))&&_.eq(Da.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,Bc(e),this.currentSelection.set(n),e.scrollToSelection()):(i>-1||r)&&(i>-1&&(e.docView.markDirty(i,o),function(e){if(gu.has(e))return;if(gu.set(e,null),-1!==["normal","nowrap","pre-line"].indexOf(getComputedStyle(e.dom).whiteSpace)){if(e.requiresGeckoHackNode=Rs,yu)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),yu=!0}}(e)),this.handleDOMChange(i,o,a,s),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(n)||Bc(e),this.currentSelection.set(n))}}},{key:"registerMutation",value:function(e,t){if(t.indexOf(e.target)>-1)return null;var n=this.view.docView.nearestDesc(e.target);if("attributes"==e.type&&(n==this.view.docView||"contenteditable"==e.attributeName||"style"==e.attributeName&&!e.oldValue&&!e.target.getAttribute("style")))return null;if(!n||n.ignoreMutation(e))return null;if("childList"==e.type){for(var r=0;r<e.addedNodes.length;r++){var i=e.addedNodes[r];t.push(i),3==i.nodeType&&(this.lastChangedTextNode=i)}if(n.contentDOM&&n.contentDOM!=n.dom&&!n.contentDOM.contains(e.target))return{from:n.posBefore,to:n.posAfter};var o=e.previousSibling,a=e.nextSibling;if(Is&&zs<=11&&e.addedNodes.length)for(var s=0;s<e.addedNodes.length;s++){var c=e.addedNodes[s],l=c.previousSibling,u=c.nextSibling;(!l||Array.prototype.indexOf.call(e.addedNodes,l)<0)&&(o=l),(!u||Array.prototype.indexOf.call(e.addedNodes,u)<0)&&(a=u)}var d=o&&o.parentNode==e.target?ms(o)+1:0,h=n.localPosFromDOM(e.target,d,-1),f=a&&a.parentNode==e.target?ms(a):e.target.childNodes.length;return{from:h,to:n.localPosFromDOM(e.target,f,1)}}return"attributes"==e.type?{from:n.posAtStart-n.border,to:n.posAtEnd+n.border}:(this.lastChangedTextNode=e.target,{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}])}(),gu=new WeakMap,yu=!1;function ku(e,t){var n=t.startContainer,r=t.startOffset,i=t.endContainer,o=t.endOffset,a=e.domAtPos(e.state.selection.anchor);if(ws(a.node,a.offset,i,o)){var s=[i,o,n,r];n=s[0],r=s[1],i=s[2],o=s[3]}return{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:o}}function wu(e,t){for(var n=t.parentNode;n&&n!=e.dom;n=n.parentNode){var r=e.docView.nearestDesc(n,!0);if(r&&r.node.isBlock)return n}return null}function bu(e){var t=e.pmViewDesc;if(t)return t.parseRule();if("BR"==e.nodeName&&e.parentNode){if(Vs&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){var n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}if(e.parentNode.lastChild==e||Vs&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if("IMG"==e.nodeName&&e.getAttribute("mark-placeholder"))return{ignore:!0};return null}var xu=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function Cu(e,t,n,r,i){var o=e.input.compositionPendingChanges||(e.composing?e.input.compositionID:0);if(e.input.compositionPendingChanges=0,t<0){var a=e.input.lastSelectionTime>Date.now()-50?e.input.lastSelectionOrigin:null,s=Pc(e,a);if(s&&!e.state.selection.eq(s)){if(Ls&&Hs&&13===e.input.lastKeyCode&&Date.now()-100<e.input.lastKeyCodeTime&&e.someProp("handleKeyDown",function(t){return t(e,Ms(13,"Enter"))}))return;var c=e.state.tr.setSelection(s);"pointer"==a?c.setMeta("pointer",!0):"key"==a&&c.scrollIntoView(),o&&c.setMeta("composition",o),e.dispatch(c)}}else{var l=e.state.doc.resolve(t),u=l.sharedDepth(n);t=l.before(u+1),n=e.state.doc.resolve(n).after(u+1);var d,h,f=e.state.selection,p=function(e,t,n){var r,i=e.docView.parseRange(t,n),o=i.node,a=i.fromOffset,s=i.toOffset,c=i.from,l=i.to,u=e.domSelectionRange(),d=u.anchorNode;if(d&&e.dom.contains(1==d.nodeType?d:d.parentNode)&&(r=[{node:d,offset:u.anchorOffset}],_s(u)||r.push({node:u.focusNode,offset:u.focusOffset})),Ls&&8===e.input.lastKeyCode)for(var h=s;h>a;h--){var f=o.childNodes[h-1],p=f.pmViewDesc;if("BR"==f.nodeName&&!p){s=h;break}if(!p||p.size)break}var v=e.state.doc,m=e.someProp("domParser")||_o.fromSchema(e.state.schema),g=v.resolve(c),y=null,k=m.parse(o,{topNode:g.parent,topMatch:g.parent.contentMatchAt(g.index()),topOpen:!0,from:a,to:s,preserveWhitespace:"pre"!=g.parent.type.whitespace||"full",findPositions:r,ruleFromNode:bu,context:g});if(r&&null!=r[0].pos){var w=r[0].pos,b=r[1]&&r[1].pos;null==b&&(b=w),y={anchor:w+c,head:b+c}}return{doc:k,sel:y,from:c,to:l}}(e,t,n),v=e.state.doc,m=v.slice(p.from,p.to);8===e.input.lastKeyCode&&Date.now()-100<e.input.lastKeyCodeTime?(d=e.state.selection.to,h="end"):(d=e.state.selection.from,h="start"),e.input.lastKeyCode=null;var g=function(e,t,n,r,i){var o=e.findDiffStart(t,n);if(null==o)return null;var a=e.findDiffEnd(t,n+e.size,n+t.size),s=a.a,c=a.b;if("end"==i){r-=s+Math.max(0,o-Math.min(s,c))-o}if(s<o&&e.size<t.size){var l=r<=o&&r>=s?o-r:0;(o-=l)&&o<t.size&&Mu(t.textBetween(o-1,o+1))&&(o+=l?1:-1),c=o+(c-s),s=o}else if(c<o){var u=r<=o&&r>=c?o-r:0;(o-=u)&&o<e.size&&Mu(e.textBetween(o-1,o+1))&&(o+=u?1:-1),s=o+(s-c),c=o}return{start:o,endA:s,endB:c}}(m.content,p.doc.content,p.from,d,h);if(g&&e.input.domChangeCount++,(Fs&&e.input.lastIOSEnter>Date.now()-225||Hs)&&i.some(function(e){return 1==e.nodeType&&!xu.test(e.nodeName)})&&(!g||g.endA>=g.endB)&&e.someProp("handleKeyDown",function(t){return t(e,Ms(13,"Enter"))}))e.input.lastIOSEnter=0;else{if(!g){if(!(r&&f instanceof Pa&&!f.empty&&f.$head.sameParent(f.$anchor))||e.composing||p.sel&&p.sel.anchor!=p.sel.head){if(p.sel){var y=Su(e,e.state.doc,p.sel);if(y&&!y.eq(e.state.selection)){var k=e.state.tr.setSelection(y);o&&k.setMeta("composition",o),e.dispatch(k)}}return}g={start:f.from,endA:f.to,endB:f.to}}e.state.selection.from<e.state.selection.to&&g.start==g.endB&&e.state.selection instanceof Pa&&(g.start>e.state.selection.from&&g.start<=e.state.selection.from+2&&e.state.selection.from>=p.from?g.start=e.state.selection.from:g.endA<e.state.selection.to&&g.endA>=e.state.selection.to-2&&e.state.selection.to<=p.to&&(g.endB+=e.state.selection.to-g.endA,g.endA=e.state.selection.to)),Is&&zs<=11&&g.endB==g.start+1&&g.endA==g.start&&g.start>p.from&&" "==p.doc.textBetween(g.start-p.from-1,g.start-p.from+1)&&(g.start--,g.endA--,g.endB--);var w=p.doc.resolveNoCache(g.start-p.from),b=p.doc.resolveNoCache(g.endB-p.from),x=v.resolve(g.start),C=w.sameParent(b)&&w.parent.inlineContent&&x.end()>=g.endA;if((Fs&&e.input.lastIOSEnter>Date.now()-225&&(!C||i.some(function(e){return"DIV"==e.nodeName||"P"==e.nodeName}))||!C&&w.pos<p.doc.content.size&&(!w.sameParent(b)||!w.parent.inlineContent)&&w.pos<b.pos&&!/\S/.test(p.doc.textBetween(w.pos,b.pos,"","")))&&e.someProp("handleKeyDown",function(t){return t(e,Ms(13,"Enter"))}))e.input.lastIOSEnter=0;else if(e.state.selection.anchor>g.start&&function(e,t,n,r,i){if(n-t<=i.pos-r.pos||_u(r,!0,!1)<i.pos)return!1;var o=e.resolve(t);if(!r.parent.isTextblock){var a=o.nodeAfter;return null!=a&&n==t+a.nodeSize}if(o.parentOffset<o.parent.content.size||!o.parent.isTextblock)return!1;var s=e.resolve(_u(o,!0,!0));return!(!s.parent.isTextblock||s.pos>n||_u(s,!0,!1)<n)&&r.parent.content.cut(r.parentOffset).eq(s.parent.content)}(v,g.start,g.endA,w,b)&&e.someProp("handleKeyDown",function(t){return t(e,Ms(8,"Backspace"))}))Hs&&Ls&&e.domObserver.suppressSelectionUpdates();else{Ls&&g.endB==g.start&&(e.input.lastChromeDelete=Date.now()),Hs&&!C&&w.start()!=b.start()&&0==b.parentOffset&&w.depth==b.depth&&p.sel&&p.sel.anchor==p.sel.head&&p.sel.head==g.endA&&(g.endB-=2,b=p.doc.resolveNoCache(g.endB-p.from),setTimeout(function(){e.someProp("handleKeyDown",function(t){return t(e,Ms(13,"Enter"))})},20));var S,_=g.start,M=g.endA,N=function(t){var n=t||e.state.tr.replace(_,M,p.doc.slice(g.start-p.from,g.endB-p.from));if(p.sel){var r=Su(e,n.doc,p.sel);r&&!(Ls&&e.composing&&r.empty&&(g.start!=g.endB||e.input.lastChromeDelete<Date.now()-100)&&(r.head==_||r.head==n.mapping.map(M)-1)||Is&&r.empty&&r.head==_)&&n.setSelection(r)}return o&&n.setMeta("composition",o),n.scrollIntoView()};if(C)if(w.pos==b.pos){Is&&zs<=11&&0==w.parentOffset&&(e.domObserver.suppressSelectionUpdates(),setTimeout(function(){return Bc(e)},20));var T=N(e.state.tr.delete(_,M)),O=v.resolve(g.start).marksAcross(v.resolve(g.endA));O&&T.ensureMarks(O),e.dispatch(T)}else if(g.endA==g.endB&&(S=function(e,t){for(var n,r,i,o=e.firstChild.marks,a=t.firstChild.marks,s=o,c=a,l=0;l<a.length;l++)s=a[l].removeFromSet(s);for(var u=0;u<o.length;u++)c=o[u].removeFromSet(c);if(1==s.length&&0==c.length)r=s[0],n="add",i=function(e){return e.mark(r.addToSet(e.marks))};else{if(0!=s.length||1!=c.length)return null;r=c[0],n="remove",i=function(e){return e.mark(r.removeFromSet(e.marks))}}for(var d=[],h=0;h<t.childCount;h++)d.push(i(t.child(h)));if(Di.from(d).eq(e))return{mark:r,type:n}}(w.parent.content.cut(w.parentOffset,b.parentOffset),x.parent.content.cut(x.parentOffset,g.endA-x.start())))){var E=N(e.state.tr);"add"==S.type?E.addMark(_,M,S.mark):E.removeMark(_,M,S.mark),e.dispatch(E)}else if(w.parent.child(w.index()).isText&&w.index()==b.index()-(b.textOffset?0:1)){var A=w.parent.textBetween(w.parentOffset,b.parentOffset),D=function(){return N(e.state.tr.insertText(A,_,M))};e.someProp("handleTextInput",function(t){return t(e,_,M,A,D)})||e.dispatch(D())}else e.dispatch(N());else e.dispatch(N())}}}}function Su(e,t,n){return Math.max(n.anchor,n.head)>t.content.size?null:qc(e,t.resolve(n.anchor),t.resolve(n.head))}function _u(e,t,n){for(var r=e.depth,i=t?e.end():e.pos;r>0&&(t||e.indexAfter(r)==e.node(r).childCount);)r--,i++,t=!1;if(n)for(var o=e.node(r).maybeChild(e.indexAfter(r));o&&!o.isLeaf;)o=o.firstChild,i++;return i}function Mu(e){if(2!=e.length)return!1;var t=e.charCodeAt(0),n=e.charCodeAt(1);return t>=56320&&t<=57343&&n>=55296&&n<=56319}var Nu=function(){return S(function e(t,n){var r=this;x(this,e),this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new xl,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(Du),this.dispatch=this.dispatch.bind(this),this.dom=t&&t.mount||document.createElement("div"),t&&(t.appendChild?t.appendChild(this.dom):"function"==typeof t?t(this.dom):t.mount&&(this.mounted=!0)),this.editable=Eu(this),Ou(this),this.nodeViews=Au(this),this.docView=wc(this.state.doc,Tu(this),hu(this),this.dom,this),this.domObserver=new mu(this,function(e,t,n,i){return Cu(r,e,t,n,i)}),this.domObserver.start(),function(e){var t=function(){var t=kl[n];e.dom.addEventListener(n,e.input.eventHandlers[n]=function(n){!function(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(var n=t.target;n!=e.dom;n=n.parentNode)if(!n||11==n.nodeType||n.pmViewDesc&&n.pmViewDesc.stopEvent(t))return!1;return!0}(e,n)||_l(e,n)||!e.editable&&n.type in wl||t(e,n)},bl[n]?{passive:!0}:void 0)};for(var n in kl)t();Vs&&e.dom.addEventListener("input",function(){return null}),Sl(e)}(this),this.updatePluginViews()},[{key:"composing",get:function(){return this.input.composing}},{key:"props",get:function(){if(this._props.state!=this.state){var e=this._props;for(var t in this._props={},e)this._props[t]=e[t];this._props.state=this.state}return this._props}},{key:"update",value:function(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Sl(this);var t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Du),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}},{key:"setProps",value:function(e){var t={};for(var n in this._props)t[n]=this._props[n];for(var r in t.state=this.state,e)t[r]=e[r];this.update(t)}},{key:"updateState",value:function(e){this.updateStateInner(e,this._props)}},{key:"updateStateInner",value:function(e,t){var n,r=this.state,i=!1,o=!1;e.storedMarks&&this.composing&&(Bl(this),o=!0),this.state=e;var a=r.plugins!=e.plugins||this._props.plugins!=t.plugins;if(a||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){var s=Au(this);(function(e,t){var n=0,r=0;for(var i in e){if(e[i]!=t[i])return!0;n++}for(var o in t)r++;return n!=r})(s,this.nodeViews)&&(this.nodeViews=s,i=!0)}(a||t.handleDOMEvents!=this._props.handleDOMEvents)&&Sl(this),this.editable=Eu(this),Ou(this);var c=hu(this),l=Tu(this),u=r.plugins==e.plugins||r.doc.eq(e.doc)?e.scrollToSelection>r.scrollToSelection?"to selection":"preserve":"reset",d=i||!this.docView.matchesNode(e.doc,l,c);!d&&e.selection.eq(r.selection)||(o=!0);var h,f,p,v,m,g,y,k,w,b,x,C="preserve"==u&&o&&null==this.dom.style.overflowAnchor&&function(e){for(var t,n,r=e.dom.getBoundingClientRect(),i=Math.max(0,r.top),o=(r.left+r.right)/2,a=i+1;a<Math.min(innerHeight,r.bottom);a+=5){var s=e.root.elementFromPoint(o,a);if(s&&s!=e.dom&&e.dom.contains(s)){var c=s.getBoundingClientRect();if(c.top>=i-20){t=s,n=c.top;break}}}return{refDOM:t,refTop:n,stack:Xs(e.dom)}}(this);if(o){this.domObserver.stop();var S=d&&(Is||Ls)&&!this.composing&&!r.selection.empty&&!e.selection.empty&&(v=r.selection,m=e.selection,g=Math.min(v.$anchor.sharedDepth(v.head),m.$anchor.sharedDepth(m.head)),v.$anchor.start(g)!=m.$anchor.start(g));if(d){var _=Ls?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=Vl(this)),!i&&this.docView.update(e.doc,l,c,this)||(this.docView.updateOuterDeco(l),this.docView.destroy(),this.docView=wc(e.doc,l,c,this.dom,this)),_&&!this.trackWrites&&(S=!0)}S||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&(h=this,f=h.docView.domFromPos(h.state.selection.anchor,0),p=h.domSelectionRange(),ws(f.node,f.offset,p.anchorNode,p.anchorOffset)))?Bc(this,S):(Hc(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(r),(null===(n=this.dragging)||void 0===n?void 0:n.node)&&!r.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,r),"reset"==u?this.dom.scrollTop=0:"to selection"==u?this.scrollToSelection():C&&(k=(y=C).refDOM,w=y.refTop,b=y.stack,x=k?k.getBoundingClientRect().top:0,Ys(b,0==x?0:x-w))}},{key:"scrollToSelection",value:function(){var e=this,t=this.domSelectionRange().focusNode;if(t&&this.dom.contains(1==t.nodeType?t:t.parentNode))if(this.someProp("handleScrollToSelection",function(t){return t(e)}));else if(this.state.selection instanceof Ba){var n=this.docView.domAfterPos(this.state.selection.from);1==n.nodeType&&Gs(this,n.getBoundingClientRect(),t)}else Gs(this,this.coordsAtPos(this.state.selection.head,1),t);else;}},{key:"destroyPluginViews",value:function(){for(var e;e=this.pluginViews.pop();)e.destroy&&e.destroy()}},{key:"updatePluginViews",value:function(e){if(e&&e.plugins==this.state.plugins&&this.directPlugins==this.prevDirectPlugins)for(var t=0;t<this.pluginViews.length;t++){var n=this.pluginViews[t];n.update&&n.update(this,e)}else{this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(var r=0;r<this.directPlugins.length;r++){var i=this.directPlugins[r];i.spec.view&&this.pluginViews.push(i.spec.view(this))}for(var o=0;o<this.state.plugins.length;o++){var a=this.state.plugins[o];a.spec.view&&this.pluginViews.push(a.spec.view(this))}}}},{key:"updateDraggedNode",value:function(e,t){var n=e.node,r=-1;if(this.state.doc.nodeAt(n.from)==n.node)r=n.from;else{var i=n.from+(this.state.doc.content.size-t.doc.content.size);(i>0&&this.state.doc.nodeAt(i))==n.node&&(r=i)}this.dragging=new Wl(e.slice,e.move,r<0?void 0:Ba.create(this.state.doc,r))}},{key:"someProp",value:function(e,t){var n,r=this._props&&this._props[e];if(null!=r&&(n=t?t(r):r))return n;for(var i=0;i<this.directPlugins.length;i++){var o=this.directPlugins[i].props[e];if(null!=o&&(n=t?t(o):o))return n}var a=this.state.plugins;if(a)for(var s=0;s<a.length;s++){var c=a[s].props[e];if(null!=c&&(n=t?t(c):c))return n}}},{key:"hasFocus",value:function(){if(Is){var e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if("false"==e.contentEditable)return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}},{key:"focus",value:function(){this.domObserver.stop(),this.editable&&function(e){if(e.setActive)return e.setActive();if(Zs)return e.focus(Zs);var t=Xs(e);e.focus(null==Zs?{get preventScroll(){return Zs={preventScroll:!0},!0}}:void 0),Zs||(Zs=!1,Ys(t,0))}(this.dom),Bc(this),this.domObserver.start()}},{key:"root",get:function(){var e=this,t=this._root;if(null==t)for(var n,r=function(t){if(9==t.nodeType||11==t.nodeType&&t.host)return t.getSelection||(Object.getPrototypeOf(t).getSelection=function(){return t.ownerDocument.getSelection()}),{v:e._root=t}},i=this.dom.parentNode;i;i=i.parentNode)if(n=r(i))return n.v;return t||document}},{key:"updateRoot",value:function(){this._root=null}},{key:"posAtCoords",value:function(e){return nc(this,e)}},{key:"coordsAtPos",value:function(e){return ac(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:1)}},{key:"domAtPos",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.docView.domFromPos(e,t)}},{key:"nodeDOM",value:function(e){var t=this.docView.descAt(e);return t?t.nodeDOM:null}},{key:"posAtDOM",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1,r=this.docView.posFromDOM(e,t,n);if(null==r)throw new RangeError("DOM position not inside the editor");return r}},{key:"endOfTextblock",value:function(e,t){return pc(this,t||this.state,e)}},{key:"pasteHTML",value:function(e,t){return $l(this,"",e,!1,t||new ClipboardEvent("paste"))}},{key:"pasteText",value:function(e,t){return $l(this,e,null,!0,t||new ClipboardEvent("paste"))}},{key:"serializeForClipboard",value:function(e){return sl(this,e)}},{key:"destroy",value:function(){this.docView&&(!function(e){for(var t in e.domObserver.stop(),e.input.eventHandlers)e.dom.removeEventListener(t,e.input.eventHandlers[t]);clearTimeout(e.input.composingTimeout),clearTimeout(e.input.lastIOSEnterFallbackTimeout)}(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],hu(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,ys=null)}},{key:"isDestroyed",get:function(){return null==this.docView}},{key:"dispatchEvent",value:function(e){return function(e,t){_l(e,t)||!kl[t.type]||!e.editable&&t.type in wl||kl[t.type](e,t)}(this,e)}},{key:"domSelectionRange",value:function(){var e=this.domSelection();return e?Vs&&11===this.root.nodeType&&function(e){for(var t=e.activeElement;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}(this.dom.ownerDocument)==this.dom&&function(e,t){if(t.getComposedRanges){var n=t.getComposedRanges(e.root)[0];if(n)return ku(e,n)}var r;function i(e){e.preventDefault(),e.stopImmediatePropagation(),r=e.getTargetRanges()[0]}return e.dom.addEventListener("beforeinput",i,!0),document.execCommand("indent"),e.dom.removeEventListener("beforeinput",i,!0),r?ku(e,r):null}(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}},{key:"domSelection",value:function(){return this.root.getSelection()}}])}();function Tu(e){var t=Object.create(null);return t.class="ProseMirror",t.contenteditable=String(e.editable),e.someProp("attributes",function(n){if("function"==typeof n&&(n=n(e.state)),n)for(var r in n)"class"==r?t.class+=" "+n[r]:"style"==r?t.style=(t.style?t.style+";":"")+n[r]:t[r]||"contenteditable"==r||"nodeName"==r||(t[r]=String(n[r]))}),t.translate||(t.translate="no"),[Zl.node(0,e.state.doc.content.size,t)]}function Ou(e){if(e.markCursor){var t=document.createElement("img");t.className="ProseMirror-separator",t.setAttribute("mark-placeholder","true"),t.setAttribute("alt",""),e.cursorWrapper={dom:t,deco:Zl.widget(e.state.selection.from,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function Eu(e){return!e.someProp("editable",function(t){return!1===t(e.state)})}function Au(e){var t=Object.create(null);function n(e){for(var n in e)Object.prototype.hasOwnProperty.call(t,n)||(t[n]=e[n])}return e.someProp("nodeViews",n),e.someProp("markViews",n),t}function Du(e){if(e.spec.state||e.spec.filterTransaction||e.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}Nu.prototype.dispatch=function(e){var t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))};for(var Iu={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},zu={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Ru="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),Pu="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Lu=0;Lu<10;Lu++)Iu[48+Lu]=Iu[96+Lu]=String(Lu);for(Lu=1;Lu<=24;Lu++)Iu[Lu+111]="F"+Lu;for(Lu=65;Lu<=90;Lu++)Iu[Lu]=String.fromCharCode(Lu+32),zu[Lu]=String.fromCharCode(Lu);for(var Bu in Iu)zu.hasOwnProperty(Bu)||(zu[Bu]=Iu[Bu]);var Vu="undefined"!=typeof navigator&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),Fu="undefined"!=typeof navigator&&/Win/.test(navigator.platform);function ju(e){var t,n,r,i,o=e.split(/-(?!$)/),a=o[o.length-1];"Space"==a&&(a=" ");for(var s=0;s<o.length-1;s++){var c=o[s];if(/^(cmd|meta|m)$/i.test(c))i=!0;else if(/^a(lt)?$/i.test(c))t=!0;else if(/^(c|ctrl|control)$/i.test(c))n=!0;else if(/^s(hift)?$/i.test(c))r=!0;else{if(!/^mod$/i.test(c))throw new Error("Unrecognized modifier name: "+c);Vu?i=!0:n=!0}}return t&&(a="Alt-"+a),n&&(a="Ctrl-"+a),i&&(a="Meta-"+a),r&&(a="Shift-"+a),a}function $u(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return t.altKey&&(e="Alt-"+e),t.ctrlKey&&(e="Ctrl-"+e),t.metaKey&&(e="Meta-"+e),n&&t.shiftKey&&(e="Shift-"+e),e}function Hu(e){var t=function(e){var t=Object.create(null);for(var n in e)t[ju(n)]=e[n];return t}(e);return function(e,n){var r,i=function(e){var t=!(Ru&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||Pu&&e.shiftKey&&e.key&&1==e.key.length||"Unidentified"==e.key)&&e.key||(e.shiftKey?zu:Iu)[e.keyCode]||e.key||"Unidentified";return"Esc"==t&&(t="Escape"),"Del"==t&&(t="Delete"),"Left"==t&&(t="ArrowLeft"),"Up"==t&&(t="ArrowUp"),"Right"==t&&(t="ArrowRight"),"Down"==t&&(t="ArrowDown"),t}(n),o=t[$u(i,n)];if(o&&o(e.state,e.dispatch,e))return!0;if(1==i.length&&" "!=i){if(n.shiftKey){var a=t[$u(i,n,!1)];if(a&&a(e.state,e.dispatch,e))return!0}if((n.altKey||n.metaKey||n.ctrlKey)&&!(Fu&&n.ctrlKey&&n.altKey)&&(r=Iu[n.keyCode])&&r!=i){var s=t[$u(r,n)];if(s&&s(e.state,e.dispatch,e))return!0}}return!1}}var Wu=Object.defineProperty,qu=function(e,t){for(var n in t)Wu(e,n,{get:t[n],enumerable:!0})};function Uu(e){var t=e.state,n=e.transaction,r=n.selection,i=n.doc,o=n.storedMarks;return h(h({},t),{},{apply:t.apply.bind(t),applyTransaction:t.applyTransaction.bind(t),plugins:t.plugins,schema:t.schema,reconfigure:t.reconfigure.bind(t),toJSON:t.toJSON.bind(t),get storedMarks(){return o},get selection(){return r},get doc(){return i},get tr(){return r=n.selection,i=n.doc,o=n.storedMarks,n}})}var Ku=function(){return S(function e(t){x(this,e),this.editor=t.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=t.state},[{key:"hasCustomState",get:function(){return!!this.customState}},{key:"state",get:function(){return this.customState||this.editor.state}},{key:"commands",get:function(){var e=this,t=this.rawCommands,n=this.editor,r=this.state,i=n.view,o=r.tr,a=this.buildProps(o);return Object.fromEntries(Object.entries(t).map(function(t){var n=g(t,2),r=n[0],s=n[1];return[r,function(){var t=s.apply(void 0,arguments)(a);return o.getMeta("preventDispatch")||e.hasCustomState||i.dispatch(o),t}]}))}},{key:"chain",get:function(){var e=this;return function(){return e.createChain()}}},{key:"can",get:function(){var e=this;return function(){return e.createCan()}}},{key:"createChain",value:function(e){var t=this,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=this.rawCommands,i=this.editor,o=this.state,a=i.view,s=[],c=!!e,l=e||o.tr,u=h(h({},Object.fromEntries(Object.entries(r).map(function(e){var r=g(e,2),i=r[0],o=r[1];return[i,function(){var e=t.buildProps(l,n),r=o.apply(void 0,arguments)(e);return s.push(r),u}]}))),{},{run:function(){return c||!n||l.getMeta("preventDispatch")||t.hasCustomState||a.dispatch(l),s.every(function(e){return!0===e})}});return u}},{key:"createCan",value:function(e){var t=this,n=this.rawCommands,r=this.state,i=!1,o=e||r.tr,a=this.buildProps(o,i),s=Object.fromEntries(Object.entries(n).map(function(e){var t=g(e,2),n=t[0],r=t[1];return[n,function(){return r.apply(void 0,arguments)(h(h({},a),{},{dispatch:void 0}))}]}));return h(h({},s),{},{chain:function(){return t.createChain(o,i)}})}},{key:"buildProps",value:function(e){var t=this,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=this.rawCommands,i=this.editor,o=this.state,a=i.view,s={tr:e,editor:i,view:a,state:Uu({state:o,transaction:e}),dispatch:n?function(){}:void 0,chain:function(){return t.createChain(e,n)},can:function(){return t.createCan(e)},get commands(){return Object.fromEntries(Object.entries(r).map(function(e){var t=g(e,2),n=t[0],r=t[1];return[n,function(){return r.apply(void 0,arguments)(s)}]}))}};return s}}])}(),Ju={};qu(Ju,{blur:function(){return Gu},clearContent:function(){return Xu},clearNodes:function(){return Yu},command:function(){return Zu},createParagraphNear:function(){return Qu},cut:function(){return ed},deleteCurrentNode:function(){return td},deleteNode:function(){return rd},deleteRange:function(){return id},deleteSelection:function(){return od},enter:function(){return ad},exitCode:function(){return sd},extendMarkRange:function(){return pd},first:function(){return vd},focus:function(){return wd},forEach:function(){return bd},insertContent:function(){return xd},insertContentAt:function(){return Md},joinBackward:function(){return Od},joinDown:function(){return Td},joinForward:function(){return Ed},joinItemBackward:function(){return Ad},joinItemForward:function(){return Dd},joinTextblockBackward:function(){return Id},joinTextblockForward:function(){return zd},joinUp:function(){return Nd},keyboardShortcut:function(){return Pd},lift:function(){return Bd},liftEmptyBlock:function(){return Vd},liftListItem:function(){return Fd},newlineInCode:function(){return jd},resetAttributes:function(){return Wd},scrollIntoView:function(){return qd},selectAll:function(){return Ud},selectNodeBackward:function(){return Kd},selectNodeForward:function(){return Jd},selectParentNode:function(){return Gd},selectTextblockEnd:function(){return Xd},selectTextblockStart:function(){return Yd},setContent:function(){return Qd},setMark:function(){return Oh},setMeta:function(){return Eh},setNode:function(){return Ah},setNodeSelection:function(){return Dh},setTextDirection:function(){return Ih},setTextSelection:function(){return zh},sinkListItem:function(){return Rh},splitBlock:function(){return Lh},splitListItem:function(){return Bh},toggleList:function(){return jh},toggleMark:function(){return $h},toggleNode:function(){return Hh},toggleWrap:function(){return Wh},undoInputRule:function(){return qh},unsetAllMarks:function(){return Uh},unsetMark:function(){return Kh},unsetTextDirection:function(){return Jh},updateAttributes:function(){return Gh},wrapIn:function(){return Xh},wrapInList:function(){return Yh}});var Gu=function(){return function(e){var t=e.editor,n=e.view;return requestAnimationFrame(function(){var e;t.isDestroyed||(n.dom.blur(),null==(e=null==window?void 0:window.getSelection())||e.removeAllRanges())}),!0}},Xu=function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return function(t){return t.commands.setContent("",{emitUpdate:e})}},Yu=function(){return function(e){var t=e.state,n=e.tr,r=e.dispatch,i=n.selection.ranges;return!r||(i.forEach(function(e){var r=e.$from,i=e.$to;t.doc.nodesBetween(r.pos,i.pos,function(e,t){if(!e.type.isText){var r=n.doc,i=n.mapping,o=r.resolve(i.map(t)),a=r.resolve(i.map(t+e.nodeSize)),s=o.blockRange(a);if(s){var c=aa(s);if(e.type.isTextblock){var l=o.parent.contentMatchAt(o.index()).defaultType;n.setNodeMarkup(s.start,l)}(c||0===c)&&n.lift(s,c)}}})}),!0)}},Zu=function(e){return function(t){return e(t)}},Qu=function(){return function(e){return function(e,t){var n=e.selection,r=n.$from,i=n.$to;if(n instanceof Fa||r.parent.inlineContent||i.parent.inlineContent)return!1;var o=cs(i.parent.contentMatchAt(i.indexAfter()));if(!o||!o.isTextblock)return!1;if(t){var a=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,s=e.tr.insert(a,o.createAndFill());s.setSelection(Pa.create(s.doc,a+1)),t(s.scrollIntoView())}return!0}(e.state,e.dispatch)}},ed=function(e,t){return function(n){var r=n.editor,i=n.tr,o=r.state.doc.slice(e.from,e.to);i.deleteRange(e.from,e.to);var a=i.mapping.map(t);return i.insert(a,o.content),i.setSelection(new Pa(i.doc.resolve(Math.max(a-1,0)))),!0}},td=function(){return function(e){var t=e.tr,n=e.dispatch,r=t.selection.$anchor.node();if(r.content.size>0)return!1;for(var i=t.selection.$anchor,o=i.depth;o>0;o-=1){if(i.node(o).type===r.type){if(n){var a=i.before(o),s=i.after(o);t.delete(a,s).scrollIntoView()}return!0}}return!1}};function nd(e,t){if("string"==typeof e){if(!t.nodes[e])throw Error("There is no node type named '".concat(e,"'. Maybe you forgot to add the extension?"));return t.nodes[e]}return e}var rd=function(e){return function(t){for(var n=t.tr,r=t.state,i=t.dispatch,o=nd(e,r.schema),a=n.selection.$anchor,s=a.depth;s>0;s-=1){if(a.node(s).type===o){if(i){var c=a.before(s),l=a.after(s);n.delete(c,l).scrollIntoView()}return!0}}return!1}},id=function(e){return function(t){var n=t.tr,r=t.dispatch,i=e.from,o=e.to;return r&&n.delete(i,o),!0}},od=function(){return function(e){return function(e,t){return!e.selection.empty&&(t&&t(e.tr.deleteSelection().scrollIntoView()),!0)}(e.state,e.dispatch)}},ad=function(){return function(e){return e.commands.keyboardShortcut("Enter")}},sd=function(){return function(e){return function(e,t){var n=e.selection,r=n.$head,i=n.$anchor;if(!r.parent.type.spec.code||!r.sameParent(i))return!1;var o=r.node(-1),a=r.indexAfter(-1),s=cs(o.contentMatchAt(a));if(!s||!o.canReplaceWith(a,a,s))return!1;if(t){var c=r.after(),l=e.tr.replaceWith(c,c,s.createAndFill());l.setSelection(Da.near(l.doc.resolve(c),1)),t(l.scrollIntoView())}return!0}(e.state,e.dispatch)}};function cd(e){return"[object RegExp]"===Object.prototype.toString.call(e)}function ld(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{strict:!0},r=Object.keys(t);return!r.length||r.every(function(r){return n.strict?t[r]===e[r]:cd(t[r])?t[r].test(e[r]):t[r]===e[r]})}function ud(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return e.find(function(e){return e.type===t&&ld(Object.fromEntries(Object.keys(n).map(function(t){return[t,e.attrs[t]]})),n)})}function dd(e,t){return!!ud(e,t,arguments.length>2&&void 0!==arguments[2]?arguments[2]:{})}function hd(e,t,n){var r;if(e&&t){var i=e.parent.childAfter(e.parentOffset);if(i.node&&i.node.marks.some(function(e){return e.type===t})||(i=e.parent.childBefore(e.parentOffset)),i.node&&i.node.marks.some(function(e){return e.type===t}))if(n=n||(null==(r=i.node.marks[0])?void 0:r.attrs),ud(c(i.node.marks),t,n)){for(var o=i.index,a=e.start()+i.offset,s=o+1,l=a+i.node.nodeSize;o>0&&dd(c(e.parent.child(o-1).marks),t,n);)o-=1,a-=e.parent.child(o).nodeSize;for(;s<e.parent.childCount&&dd(c(e.parent.child(s).marks),t,n);)l+=e.parent.child(s).nodeSize,s+=1;return{from:a,to:l}}}}function fd(e,t){if("string"==typeof e){if(!t.marks[e])throw Error("There is no mark type named '".concat(e,"'. Maybe you forgot to add the extension?"));return t.marks[e]}return e}var pd=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(n){var r=n.tr,i=n.state,o=n.dispatch,a=fd(e,i.schema),s=r.doc,c=r.selection,l=c.$from,u=c.from,d=c.to;if(o){var h=hd(l,a,t);if(h&&h.from<=u&&h.to>=d){var f=Pa.create(s,h.from,h.to);r.setSelection(f)}}return!0}},vd=function(e){return function(t){for(var n="function"==typeof e?e(t):e,r=0;r<n.length;r+=1)if(n[r](t))return!0;return!1}};function md(e){return e instanceof Pa}function gd(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return Math.min(Math.max(e,t),n)}function yd(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(!t)return null;var n=Da.atStart(e),r=Da.atEnd(e);if("start"===t||!0===t)return n;if("end"===t)return r;var i=n.from,o=r.to;return"all"===t?Pa.create(e,gd(0,i,o),gd(e.content.size,i,o)):Pa.create(e,gd(t,i,o),gd(t,i,o))}function kd(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}var wd=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(n){var r=n.editor,i=n.view,o=n.tr,a=n.dispatch;t=h({scrollIntoView:!0},t);var s=function(){(kd()||"Android"===navigator.platform||/android/i.test(navigator.userAgent))&&i.dom.focus(),requestAnimationFrame(function(){r.isDestroyed||(i.focus(),(null==t?void 0:t.scrollIntoView)&&r.commands.scrollIntoView())})};if(i.hasFocus()&&null===e||!1===e)return!0;if(a&&null===e&&!md(r.state.selection))return s(),!0;var c=yd(o.doc,e)||r.state.selection,l=r.state.selection.eq(c);return a&&(l||o.setSelection(c),l&&o.storedMarks&&o.setStoredMarks(o.storedMarks),s()),!0}},bd=function(e,t){return function(n){return e.every(function(e,r){return t(e,h(h({},n),{},{index:r}))})}},xd=function(e,t){return function(n){var r=n.tr;return n.commands.insertContentAt({from:r.selection.from,to:r.selection.to},e,t)}},Cd=function(e){for(var t=e.childNodes,n=t.length-1;n>=0;n-=1){var r=t[n];3===r.nodeType&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?e.removeChild(r):1===r.nodeType&&Cd(r)}return e};function Sd(e){if("undefined"==typeof window)throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");var t="<body>".concat(e,"</body>"),n=(new window.DOMParser).parseFromString(t,"text/html").body;return Cd(n)}function _d(e,t,n){if(e instanceof no||e instanceof Di)return e;n=h({slice:!0,parseOptions:{}},n);var r="string"==typeof e;if("object"===N(e)&&null!==e)try{if(Array.isArray(e)&&e.length>0)return Di.fromArray(e.map(function(e){return t.nodeFromJSON(e)}));var i=t.nodeFromJSON(e);return n.errorOnInvalidContent&&i.check(),i}catch(l){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:l});return console.warn("[tiptap warn]: Invalid content.","Passed value:",e,"Error:",l),_d("",t,n)}if(r){if(n.errorOnInvalidContent){var o=!1,a="",s=new Co({topNode:t.spec.topNode,marks:t.spec.marks,nodes:t.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:function(e){return o=!0,a="string"==typeof e?e:e.outerHTML,null}}]}})});if(n.slice?_o.fromSchema(s).parseSlice(Sd(e),n.parseOptions):_o.fromSchema(s).parse(Sd(e),n.parseOptions),n.errorOnInvalidContent&&o)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error("Invalid element found: ".concat(a))})}var c=_o.fromSchema(t);return n.slice?c.parseSlice(Sd(e),n.parseOptions).content:c.parse(Sd(e),n.parseOptions)}return _d("",t,n)}var Md=function(e,t,n){return function(r){var i,o=r.tr,a=r.dispatch,s=r.editor;if(a){var c;n=h({parseOptions:s.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1},n);var l=function(e){s.emit("contentError",{editor:s,error:e,disableCollaboration:function(){"collaboration"in s.storage&&"object"===N(s.storage.collaboration)&&s.storage.collaboration&&(s.storage.collaboration.isDisabled=!0)}})},u=h({preserveWhitespace:"full"},n.parseOptions);if(!n.errorOnInvalidContent&&!s.options.enableContentCheck&&s.options.emitContentError)try{_d(t,s.schema,{parseOptions:u,errorOnInvalidContent:!0})}catch(wt){l(wt)}try{c=_d(t,s.schema,{parseOptions:u,errorOnInvalidContent:null!=(i=n.errorOnInvalidContent)?i:s.options.enableContentCheck})}catch(wt){return l(wt),!1}var d,f="number"==typeof e?{from:e,to:e}:{from:e.from,to:e.to},p=f.from,v=f.to,m=!0,g=!0;if(("type"in c?[c]:c).forEach(function(e){e.check(),m=!!m&&(e.isText&&0===e.marks.length),g=!!g&&e.isBlock}),p===v&&g){var y=o.doc.resolve(p).parent;y.isTextblock&&!y.type.spec.code&&!y.childCount&&(p-=1,v+=1)}if(m){if(Array.isArray(t))d=t.map(function(e){return e.text||""}).join("");else if(t instanceof Di){var k="";t.forEach(function(e){e.text&&(k+=e.text)}),d=k}else d="object"===N(t)&&t&&t.text?t.text:t;o.insertText(d,p,v)}else{d=c;var w=o.doc.resolve(p),b=w.node(),x=0===w.parentOffset,C=b.isText||b.isTextblock,S=b.content.size>0;x&&C&&S&&(p=Math.max(0,p-1)),o.replaceWith(p,v,d)}n.updateSelection&&function(e,t,n){var r=e.steps.length-1;if(!(r<t)){var i=e.steps[r];if(i instanceof ta||i instanceof na){var o=e.mapping.maps[r],a=0;o.forEach(function(e,t,n,r){0===a&&(a=r)}),e.setSelection(Da.near(e.doc.resolve(a),n))}}}(o,o.steps.length-1,-1),n.applyInputRules&&o.setMeta("applyInputRules",{from:p,text:d}),n.applyPasteRules&&o.setMeta("applyPasteRules",{from:p,text:d})}return!0}},Nd=function(){return function(e){return function(e,t){var n,r=e.selection,i=r instanceof Ba;if(i){if(r.node.isTextblock||!ha(e.doc,r.from))return!1;n=r.from}else if(null==(n=pa(e.doc,r.from,-1)))return!1;if(t){var o=e.tr.join(n);i&&o.setSelection(Ba.create(o.doc,n-e.doc.resolve(n).nodeBefore.nodeSize)),t(o.scrollIntoView())}return!0}(e.state,e.dispatch)}},Td=function(){return function(e){return function(e,t){var n,r=e.selection;if(r instanceof Ba){if(r.node.isTextblock||!ha(e.doc,r.to))return!1;n=r.to}else if(null==(n=pa(e.doc,r.to,1)))return!1;return t&&t(e.tr.join(n).scrollIntoView()),!0}(e.state,e.dispatch)}},Od=function(){return function(e){return function(e,t,n){var r=ts(e,n);if(!r)return!1;var i=is(r);if(!i){var o=r.blockRange(),a=o&&aa(o);return null!=a&&(t&&t(e.tr.lift(o,a).scrollIntoView()),!0)}var s=i.nodeBefore;if(ls(e,i,t,-1))return!0;if(0==r.parent.content.size&&(rs(s,"end")||Ba.isSelectable(s)))for(var c=r.depth;;c--){var l=ma(e.doc,r.before(c),r.after(c),Bi.empty);if(l&&l.slice.size<l.to-l.from){if(t){var u=e.tr.step(l);u.setSelection(rs(s,"end")?Da.findFrom(u.doc.resolve(u.mapping.map(i.pos,-1)),-1):Ba.create(u.doc,i.pos-s.nodeSize)),t(u.scrollIntoView())}return!0}if(1==c||r.node(c-1).childCount>1)break}return!(!s.isAtom||i.depth!=r.depth-1||(t&&t(e.tr.delete(i.pos-s.nodeSize,i.pos).scrollIntoView()),0))}(e.state,e.dispatch)}},Ed=function(){return function(e){return function(e,t,n){var r=as(e,n);if(!r)return!1;var i=ss(r);if(!i)return!1;var o=i.nodeAfter;if(ls(e,i,t,1))return!0;if(0==r.parent.content.size&&(rs(o,"start")||Ba.isSelectable(o))){var a=ma(e.doc,r.before(),r.after(),Bi.empty);if(a&&a.slice.size<a.to-a.from){if(t){var s=e.tr.step(a);s.setSelection(rs(o,"start")?Da.findFrom(s.doc.resolve(s.mapping.map(i.pos)),1):Ba.create(s.doc,s.mapping.map(i.pos))),t(s.scrollIntoView())}return!0}}return!(!o.isAtom||i.depth!=r.depth-1||(t&&t(e.tr.delete(i.pos,i.pos+o.nodeSize).scrollIntoView()),0))}(e.state,e.dispatch)}},Ad=function(){return function(e){var t=e.state,n=e.dispatch,r=e.tr;try{var i=pa(t.doc,t.selection.$from.pos,-1);return null!=i&&(r.join(i,2),n&&n(r),!0)}catch(o){return!1}}},Dd=function(){return function(e){var t=e.state,n=e.dispatch,r=e.tr;try{var i=pa(t.doc,t.selection.$from.pos,1);return null!=i&&(r.join(i,2),n&&n(r),!0)}catch(o){return!1}}},Id=function(){return function(e){return function(e,t,n){var r=ts(e,n);if(!r)return!1;var i=is(r);return!!i&&ns(e,i,t)}(e.state,e.dispatch)}},zd=function(){return function(e){return function(e,t,n){var r=as(e,n);if(!r)return!1;var i=ss(r);return!!i&&ns(e,i,t)}(e.state,e.dispatch)}};function Rd(){return"undefined"!=typeof navigator&&/Mac/.test(navigator.platform)}var Pd=function(e){return function(t){var n=t.editor,r=t.view,i=t.tr,o=t.dispatch,a=function(e){var t,n,r,i,o=e.split(/-(?!$)/),a=o[o.length-1];"Space"===a&&(a=" ");for(var s=0;s<o.length-1;s+=1){var c=o[s];if(/^(cmd|meta|m)$/i.test(c))i=!0;else if(/^a(lt)?$/i.test(c))t=!0;else if(/^(c|ctrl|control)$/i.test(c))n=!0;else if(/^s(hift)?$/i.test(c))r=!0;else{if(!/^mod$/i.test(c))throw new Error("Unrecognized modifier name: ".concat(c));kd()||Rd()?i=!0:n=!0}}return t&&(a="Alt-".concat(a)),n&&(a="Ctrl-".concat(a)),i&&(a="Meta-".concat(a)),r&&(a="Shift-".concat(a)),a}(e).split(/-(?!$)/),s=a.find(function(e){return!["Alt","Ctrl","Meta","Shift"].includes(e)}),c=new KeyboardEvent("keydown",{key:"Space"===s?" ":s,altKey:a.includes("Alt"),ctrlKey:a.includes("Ctrl"),metaKey:a.includes("Meta"),shiftKey:a.includes("Shift"),bubbles:!0,cancelable:!0}),l=n.captureTransaction(function(){r.someProp("handleKeyDown",function(e){return e(r,c)})});return null==l||l.steps.forEach(function(e){var t=e.map(i.mapping);t&&o&&i.maybeStep(t)}),!0}};function Ld(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=e.selection,i=r.from,o=r.to,a=r.empty,s=t?nd(t,e.schema):null,c=[];e.doc.nodesBetween(i,o,function(e,t){if(!e.isText){var n=Math.max(i,t),r=Math.min(o,t+e.nodeSize);c.push({node:e,from:n,to:r})}});var l=o-i,u=c.filter(function(e){return!s||s.name===e.node.type.name}).filter(function(e){return ld(e.node.attrs,n,{strict:!1})});return a?!!u.length:u.reduce(function(e,t){return e+t.to-t.from},0)>=l}var Bd=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(n){var r=n.state,i=n.dispatch;return!!Ld(r,nd(e,r.schema),t)&&function(e,t){var n=e.selection,r=n.$from,i=n.$to,o=r.blockRange(i),a=o&&aa(o);return null!=a&&(t&&t(e.tr.lift(o,a).scrollIntoView()),!0)}(r,i)}},Vd=function(){return function(e){return function(e,t){var n=e.selection.$cursor;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){var r=n.before();if(da(e.doc,r))return t&&t(e.tr.split(r).scrollIntoView()),!0}var i=n.blockRange(),o=i&&aa(i);return null!=o&&(t&&t(e.tr.lift(i,o).scrollIntoView()),!0)}(e.state,e.dispatch)}},Fd=function(e){return function(t){var n=t.state,r=t.dispatch;return vs(nd(e,n.schema))(n,r)}},jd=function(){return function(e){return function(e,t){var n=e.selection,r=n.$head,i=n.$anchor;return!(!r.parent.type.spec.code||!r.sameParent(i)||(t&&t(e.tr.insertText("\n").scrollIntoView()),0))}(e.state,e.dispatch)}};function $d(e,t){return t.nodes[e]?"node":t.marks[e]?"mark":null}function Hd(e,t){var n="string"==typeof t?[t]:t;return Object.keys(e).reduce(function(t,r){return n.includes(r)||(t[r]=e[r]),t},{})}var Wd=function(e,t){return function(n){var r=n.tr,i=n.state,o=n.dispatch,a=null,s=null,c=$d("string"==typeof e?e:e.name,i.schema);if(!c)return!1;"node"===c&&(a=nd(e,i.schema)),"mark"===c&&(s=fd(e,i.schema));var l=!1;return r.selection.ranges.forEach(function(e){i.doc.nodesBetween(e.$from.pos,e.$to.pos,function(e,n){a&&a===e.type&&(l=!0,o&&r.setNodeMarkup(n,void 0,Hd(e.attrs,t))),s&&e.marks.length&&e.marks.forEach(function(i){s===i.type&&(l=!0,o&&r.addMark(n,n+e.nodeSize,s.create(Hd(i.attrs,t))))})})}),l}},qd=function(){return function(e){var t=e.tr;return e.dispatch&&t.scrollIntoView(),!0}},Ud=function(){return function(e){var t=e.tr;if(e.dispatch){var n=new Fa(t.doc);t.setSelection(n)}return!0}},Kd=function(){return function(e){return function(e,t,n){var r=e.selection,i=r.$head,o=i;if(!r.empty)return!1;if(i.parent.isTextblock){if(n?!n.endOfTextblock("backward",e):i.parentOffset>0)return!1;o=is(i)}var a=o&&o.nodeBefore;return!(!a||!Ba.isSelectable(a)||(t&&t(e.tr.setSelection(Ba.create(e.doc,o.pos-a.nodeSize)).scrollIntoView()),0))}(e.state,e.dispatch)}},Jd=function(){return function(e){return function(e,t,n){var r=e.selection,i=r.$head,o=i;if(!r.empty)return!1;if(i.parent.isTextblock){if(n?!n.endOfTextblock("forward",e):i.parentOffset<i.parent.content.size)return!1;o=ss(i)}var a=o&&o.nodeAfter;return!(!a||!Ba.isSelectable(a)||(t&&t(e.tr.setSelection(Ba.create(e.doc,o.pos)).scrollIntoView()),0))}(e.state,e.dispatch)}},Gd=function(){return function(e){return function(e,t){var n,r=e.selection,i=r.$from,o=r.to,a=i.sharedDepth(o);return 0!=a&&(n=i.before(a),t&&t(e.tr.setSelection(Ba.create(e.doc,n))),!0)}(e.state,e.dispatch)}},Xd=function(){return function(e){var t=e.state,n=e.dispatch;return hs(t,n)}},Yd=function(){return function(e){var t=e.state,n=e.dispatch;return ds(t,n)}};function Zd(e,t){return _d(e,t,{slice:!1,parseOptions:arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},errorOnInvalidContent:(arguments.length>3&&void 0!==arguments[3]?arguments[3]:{}).errorOnInvalidContent})}var Qd=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.errorOnInvalidContent,r=t.emitUpdate,i=void 0===r||r,o=t.parseOptions,a=void 0===o?{}:o;return function(t){var r=t.editor,o=t.tr,s=t.dispatch,c=t.commands,l=o.doc;if("full"!==a.preserveWhitespace){var u=Zd(e,r.schema,a,{errorOnInvalidContent:null!=n?n:r.options.enableContentCheck});return s&&o.replaceWith(0,l.content.size,u).setMeta("preventUpdate",!i),!0}return s&&o.setMeta("preventUpdate",!i),c.insertContentAt({from:0,to:l.content.size},e,{parseOptions:a,errorOnInvalidContent:null!=n?n:r.options.enableContentCheck})}};function eh(e,t){var n=fd(t,e.schema),r=e.selection,i=r.from,o=r.to,a=r.empty,s=[];a?(e.storedMarks&&s.push.apply(s,c(e.storedMarks)),s.push.apply(s,c(e.selection.$head.marks()))):e.doc.nodesBetween(i,o,function(e){s.push.apply(s,c(e.marks))});var l=s.find(function(e){return e.type.name===n.name});return l?h({},l.attrs):{}}function th(e){return function(t){return function(e,t){for(var n=e.depth;n>0;n-=1){var r=e.node(n);if(t(r))return{pos:n>0?e.before(n):0,start:e.start(n),depth:n,node:r}}}(t.$from,e)}}function nh(e,t,n){return void 0===e.config[t]&&e.parent?nh(e.parent,t,n):"function"==typeof e.config[t]?e.config[t].bind(h(h({},n),{},{parent:e.parent?nh(e.parent,t,n):null})):e.config[t]}function rh(e){return e.map(function(e){var t=nh(e,"addExtensions",{name:e.name,options:e.options,storage:e.storage});return t?[e].concat(c(rh(t()))):e}).flat(10)}function ih(e,t){var n=Ro.fromSchema(t).serializeFragment(e),r=document.implementation.createHTMLDocument().createElement("div");return r.appendChild(n),r.innerHTML}function oh(e){return"function"==typeof e}function ah(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;if(oh(e)){for(var n=arguments.length,r=new Array(n>2?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i];return t?e.bind(t).apply(void 0,r):e.apply(void 0,r)}return e}function sh(e){return{baseExtensions:e.filter(function(e){return"extension"===e.type}),nodeExtensions:e.filter(function(e){return"node"===e.type}),markExtensions:e.filter(function(e){return"mark"===e.type})}}function ch(e){var t=[],n=sh(e),r=n.nodeExtensions,i=n.markExtensions,o=[].concat(c(r),c(i)),a={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return e.forEach(function(e){var n=nh(e,"addGlobalAttributes",{name:e.name,options:e.options,storage:e.storage,extensions:o});n&&n().forEach(function(e){e.types.forEach(function(n){Object.entries(e.attributes).forEach(function(e){var r=g(e,2),i=r[0],o=r[1];t.push({type:n,name:i,attribute:h(h({},a),o)})})})})}),o.forEach(function(e){var n={name:e.name,options:e.options,storage:e.storage},r=nh(e,"addAttributes",n);if(r){var i=r();Object.entries(i).forEach(function(n){var r=g(n,2),i=r[0],o=r[1],s=h(h({},a),o);"function"==typeof(null==s?void 0:s.default)&&(s.default=s.default()),(null==s?void 0:s.isRequired)&&void 0===(null==s?void 0:s.default)&&delete s.default,t.push({type:e.name,name:i,attribute:s})})}}),t}function lh(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return t.filter(function(e){return!!e}).reduce(function(e,t){var n=h({},e);return Object.entries(t).forEach(function(e){var t=g(e,2),r=t[0],i=t[1];if(n[r])if("class"===r){var o=i?String(i).split(" "):[],a=n[r]?n[r].split(" "):[],s=o.filter(function(e){return!a.includes(e)});n[r]=[].concat(c(a),c(s)).join(" ")}else if("style"===r){var l=i?i.split(";").map(function(e){return e.trim()}).filter(Boolean):[],u=n[r]?n[r].split(";").map(function(e){return e.trim()}).filter(Boolean):[],d=new Map;u.forEach(function(e){var t=g(e.split(":").map(function(e){return e.trim()}),2),n=t[0],r=t[1];d.set(n,r)}),l.forEach(function(e){var t=g(e.split(":").map(function(e){return e.trim()}),2),n=t[0],r=t[1];d.set(n,r)}),n[r]=Array.from(d.entries()).map(function(e){var t=g(e,2),n=t[0],r=t[1];return"".concat(n,": ").concat(r)}).join("; ")}else n[r]=i;else n[r]=i}),n},{})}function uh(e,t){return t.filter(function(t){return t.type===e.type.name}).filter(function(e){return e.attribute.rendered}).map(function(t){return t.attribute.renderHTML?t.attribute.renderHTML(e.attrs)||{}:_({},t.name,e.attrs[t.name])}).reduce(function(e,t){return lh(e,t)},{})}function dh(e,t){return"style"in e?e:h(h({},e),{},{getAttrs:function(n){var r=e.getAttrs?e.getAttrs(n):e.attrs;if(!1===r)return!1;var i=t.reduce(function(e,t){var r=t.attribute.parseHTML?t.attribute.parseHTML(n):function(e){return"string"!=typeof e?e:e.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(e):"true"===e||"false"!==e&&e}(n.getAttribute(t.name));return null==r?e:h(h({},e),{},_({},t.name,r))},{});return h(h({},r),i)}})}function hh(e){return Object.fromEntries(Object.entries(e).filter(function(e){var t=g(e,2),n=t[0],r=t[1];return("attrs"!==n||!function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return 0===Object.keys(e).length&&e.constructor===Object}(r))&&null!=r}))}function fh(e){var t,n,r={};return!(null==(t=null==e?void 0:e.attribute)?void 0:t.isRequired)&&"default"in((null==e?void 0:e.attribute)||{})&&(r.default=e.attribute.default),void 0!==(null==(n=null==e?void 0:e.attribute)?void 0:n.validate)&&(r.validate=e.attribute.validate),[e.name,r]}function ph(e){return e.sort(function(e,t){var n=nh(e,"priority")||100,r=nh(t,"priority")||100;return n>r?-1:n<r?1:0})}function vh(e){var t,n,r=ph(rh(e)),i=(t=r.map(function(e){return e.name}),n=t.filter(function(e,n){return t.indexOf(e)!==n}),Array.from(new Set(n)));return i.length&&console.warn("[tiptap warn]: Duplicate extension names found: [".concat(i.map(function(e){return"'".concat(e,"'")}).join(", "),"]. This can lead to issues.")),r}function mh(e,t,n){var r=t.from,i=t.to,o=n||{},a=o.blockSeparator,s=void 0===a?"\n\n":a,c=o.textSerializers,l=void 0===c?{}:c,u="";return e.nodesBetween(r,i,function(e,n,o,a){var c;e.isBlock&&n>r&&(u+=s);var d=null==l?void 0:l[e.type.name];if(d)return o&&(u+=d({node:e,pos:n,parent:o,index:a,range:t})),!1;e.isText&&(u+=null==(c=null==e?void 0:e.text)?void 0:c.slice(Math.max(r,n)-n,i-n))}),u}function gh(e){return Object.fromEntries(Object.entries(e.nodes).filter(function(e){return g(e,2)[1].spec.toText}).map(function(e){var t=g(e,2);return[t[0],t[1].spec.toText]}))}function yh(e,t){var n=$d("string"==typeof t?t:t.name,e.schema);return"node"===n?function(e,t){var n=nd(t,e.schema),r=e.selection,i=r.from,o=r.to,a=[];e.doc.nodesBetween(i,o,function(e){a.push(e)});var s=a.reverse().find(function(e){return e.type.name===n.name});return s?h({},s.attrs):{}}(e,t):"mark"===n?eh(e,t):{}}function kh(e){var t=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:JSON.stringify,n={};return e.filter(function(e){var r=t(e);return!Object.prototype.hasOwnProperty.call(n,r)&&(n[r]=!0)})}(e);return 1===t.length?t:t.filter(function(e,n){var r=t.filter(function(e,t){return t!==n});return!r.some(function(t){return e.oldRange.from>=t.oldRange.from&&e.oldRange.to<=t.oldRange.to&&e.newRange.from>=t.newRange.from&&e.newRange.to<=t.newRange.to})})}function wh(e,t){return t.nodes[e]||t.marks[e]||null}function bh(e,t,n){return Object.fromEntries(Object.entries(n).filter(function(n){var r=g(n,1)[0],i=e.find(function(e){return e.type===t&&e.name===r});return!!i&&i.attribute.keepOnSplit}))}function xh(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=e.selection,i=r.empty,o=r.ranges,a=t?fd(t,e.schema):null;if(i)return!!(e.storedMarks||e.selection.$from.marks()).filter(function(e){return!a||a.name===e.type.name}).find(function(e){return ld(e.attrs,n,{strict:!1})});var s=0,l=[];if(o.forEach(function(t){var n=t.$from,r=t.$to,i=n.pos,o=r.pos;e.doc.nodesBetween(i,o,function(e,t){if(e.isText||e.marks.length){var n=Math.max(i,t),r=Math.min(o,t+e.nodeSize);s+=r-n,l.push.apply(l,c(e.marks.map(function(e){return{mark:e,from:n,to:r}})))}})}),0===s)return!1;var u=l.filter(function(e){return!a||a.name===e.mark.type.name}).filter(function(e){return ld(e.mark.attrs,n,{strict:!1})}).reduce(function(e,t){return e+t.to-t.from},0),d=l.filter(function(e){return!a||e.mark.type!==a&&e.mark.type.excludes(a)}).reduce(function(e,t){return e+t.to-t.from},0);return(u>0?u+d:u)>=s}function Ch(e,t){return Array.isArray(t)?t.some(function(t){return("string"==typeof t?t:t.name)===e.name}):t}function Sh(e,t){var n=sh(t).nodeExtensions.find(function(t){return t.name===e});if(!n)return!1;var r=ah(nh(n,"group",{name:n.name,options:n.options,storage:n.storage}));return"string"==typeof r&&r.split(" ").includes("list")}function _h(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=n.checkChildren,i=void 0===r||r,o=n.ignoreWhitespace,a=void 0!==o&&o;if(a){if("hardBreak"===e.type.name)return!0;if(e.isText)return/^\s*$/m.test(null!=(t=e.text)?t:"")}if(e.isText)return!e.text;if(e.isAtom||e.isLeaf)return!1;if(0===e.content.childCount)return!0;if(i){var s=!0;return e.content.forEach(function(e){!1!==s&&(_h(e,{ignoreWhitespace:a,checkChildren:i})||(s=!1))}),s}return!1}var Mh=function(){function e(t){x(this,e),this.position=t}return S(e,[{key:"toJSON",value:function(){return{position:this.position}}}],[{key:"fromJSON",value:function(t){return new e(t.position)}}])}();function Nh(e,t){var n=t.mapping.mapResult(e.position);return{position:new Mh(n.pos),mapResult:n}}function Th(e){return new Mh(e)}var Oh=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(n){var r=n.tr,i=n.state,o=n.dispatch,a=r.selection,s=a.empty,c=a.ranges,l=fd(e,i.schema);if(o)if(s){var u=eh(i,l);r.addStoredMark(l.create(h(h({},u),t)))}else c.forEach(function(e){var n=e.$from.pos,o=e.$to.pos;i.doc.nodesBetween(n,o,function(e,i){var a=Math.max(i,n),s=Math.min(i+e.nodeSize,o);e.marks.find(function(e){return e.type===l})?e.marks.forEach(function(e){l===e.type&&r.addMark(a,s,l.create(h(h({},e.attrs),t)))}):r.addMark(a,s,l.create(t))})});return function(e,t,n){var r,i=t.selection,o=null;if(md(i)&&(o=i.$cursor),o){var a=null!=(r=e.storedMarks)?r:o.marks();return o.parent.type.allowsMarkType(n)&&(!!n.isInSet(a)||!a.some(function(e){return e.type.excludes(n)}))}return i.ranges.some(function(t){var r=t.$from,i=t.$to,o=0===r.depth&&e.doc.inlineContent&&e.doc.type.allowsMarkType(n);return e.doc.nodesBetween(r.pos,i.pos,function(e,t,r){if(o)return!1;if(e.isInline){var i=!r||r.type.allowsMarkType(n),a=!!n.isInSet(e.marks)||!e.marks.some(function(e){return e.type.excludes(n)});o=i&&a}return!o}),o})}(i,r,l)}},Eh=function(e,t){return function(n){return n.tr.setMeta(e,t),!0}},Ah=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(n){var r,i=n.state,o=n.dispatch,a=n.chain,s=nd(e,i.schema);return i.selection.$anchor.sameParent(i.selection.$head)&&(r=i.selection.$anchor.parent.attrs),s.isTextblock?a().command(function(e){var n=e.commands;return!!fs(s,h(h({},r),t))(i)||n.clearNodes()}).command(function(e){var n=e.state;return fs(s,h(h({},r),t))(n,o)}).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)}},Dh=function(e){return function(t){var n=t.tr;if(t.dispatch){var r=n.doc,i=gd(e,0,r.content.size),o=Ba.create(r,i);n.setSelection(o)}return!0}},Ih=function(e,t){return function(n){var r,i,o=n.tr,a=n.state,s=n.dispatch,c=a.selection;return"number"==typeof t?(r=t,i=t):t&&"from"in t&&"to"in t?(r=t.from,i=t.to):(r=c.from,i=c.to),s&&o.doc.nodesBetween(r,i,function(t,n){t.isText||o.setNodeMarkup(n,void 0,h(h({},t.attrs),{},{dir:e}))}),!0}},zh=function(e){return function(t){var n=t.tr;if(t.dispatch){var r=n.doc,i="number"==typeof e?{from:e,to:e}:e,o=i.from,a=i.to,s=Pa.atStart(r).from,c=Pa.atEnd(r).to,l=gd(o,s,c),u=gd(a,s,c),d=Pa.create(r,l,u);n.setSelection(d)}return!0}},Rh=function(e){return function(t){var n,r=t.state,i=t.dispatch,o=nd(e,r.schema);return(n=o,function(e,t){var r=e.selection,i=r.$from,o=r.$to,a=i.blockRange(o,function(e){return e.childCount>0&&e.firstChild.type==n});if(!a)return!1;var s=a.startIndex;if(0==s)return!1;var c=a.parent,l=c.child(s-1);if(l.type!=n)return!1;if(t){var u=l.lastChild&&l.lastChild.type==c.type,d=Di.from(u?n.create():null),h=new Bi(Di.from(n.create(null,Di.from(c.type.create(null,d)))),u?3:1,0),f=a.start,p=a.end;t(e.tr.step(new na(f-(u?3:1),p,f,p,h,1,!0)).scrollIntoView())}return!0})(r,i)}};function Ph(e,t){var n=e.storedMarks||e.selection.$to.parentOffset&&e.selection.$from.marks();if(n){var r=n.filter(function(e){return null==t?void 0:t.includes(e.type.name)});e.tr.ensureMarks(r)}}var Lh=function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).keepMarks,t=void 0===e||e;return function(e){var n=e.tr,r=e.state,i=e.dispatch,o=e.editor,a=n.selection,s=n.doc,c=a.$from,l=a.$to,u=bh(o.extensionManager.attributes,c.node().type.name,c.node().attrs);if(a instanceof Ba&&a.node.isBlock)return!(!c.parentOffset||!da(s,c.pos))&&(i&&(t&&Ph(r,o.extensionManager.splittableMarks),n.split(c.pos).scrollIntoView()),!0);if(!c.parent.isBlock)return!1;var d=l.parentOffset===l.parent.content.size,h=0===c.depth?void 0:function(e){for(var t=0;t<e.edgeCount;t+=1){var n=e.edge(t).type;if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}(c.node(-1).contentMatchAt(c.indexAfter(-1))),f=d&&h?[{type:h,attrs:u}]:void 0,p=da(n.doc,n.mapping.map(c.pos),1,f);if(f||p||!da(n.doc,n.mapping.map(c.pos),1,h?[{type:h}]:void 0)||(p=!0,f=h?[{type:h,attrs:u}]:void 0),i){if(p&&(a instanceof Pa&&n.deleteSelection(),n.split(n.mapping.map(c.pos),1,f),h&&!d&&!c.parentOffset&&c.parent.type!==h)){var v=n.mapping.map(c.before()),m=n.doc.resolve(v);c.node(-1).canReplaceWith(m.index(),m.index()+1,h)&&n.setNodeMarkup(n.mapping.map(c.before()),h)}t&&Ph(r,o.extensionManager.splittableMarks),n.scrollIntoView()}return p}},Bh=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(n){var r,i=n.tr,o=n.state,a=n.dispatch,s=n.editor,c=nd(e,o.schema),l=o.selection,u=l.$from,d=l.$to,f=o.selection.node;if(f&&f.isBlock||u.depth<2||!u.sameParent(d))return!1;var p=u.node(-1);if(p.type!==c)return!1;var v=s.extensionManager.attributes;if(0===u.parent.content.size&&u.node(-1).childCount===u.indexAfter(-1)){if(2===u.depth||u.node(-3).type!==c||u.index(-2)!==u.node(-2).childCount-1)return!1;if(a){for(var m=Di.empty,g=u.index(-1)?1:u.index(-2)?2:3,y=u.depth-g;y>=u.depth-3;y-=1)m=Di.from(u.node(y).copy(m));var k=u.indexAfter(-1)<u.node(-2).childCount?1:u.indexAfter(-2)<u.node(-3).childCount?2:3,w=h(h({},bh(v,u.node().type.name,u.node().attrs)),t),b=(null==(r=c.contentMatch.defaultType)?void 0:r.createAndFill(w))||void 0;m=m.append(Di.from(c.createAndFill(null,b)||void 0));var x=u.before(u.depth-(g-1));i.replace(x,u.after(-k),new Bi(m,4-g,0));var C=-1;i.doc.nodesBetween(x,i.doc.content.size,function(e,t){if(C>-1)return!1;e.isTextblock&&0===e.content.size&&(C=t+1)}),C>-1&&i.setSelection(Pa.near(i.doc.resolve(C))),i.scrollIntoView()}return!0}var S=d.pos===u.end()?p.contentMatchAt(0).defaultType:null,_=h(h({},bh(v,p.type.name,p.attrs)),t),M=h(h({},bh(v,u.node().type.name,u.node().attrs)),t);i.delete(u.pos,d.pos);var N=S?[{type:c,attrs:_},{type:S,attrs:M}]:[{type:c,attrs:_}];if(!da(i.doc,u.pos,2))return!1;if(a){var T=o.selection,O=o.storedMarks,E=s.extensionManager.splittableMarks,A=O||T.$to.parentOffset&&T.$from.marks();if(i.split(u.pos,2,N).scrollIntoView(),!A||!a)return!0;var D=A.filter(function(e){return E.includes(e.type.name)});i.ensureMarks(D)}return!0}},Vh=function(e,t){var n=th(function(e){return e.type===t})(e.selection);if(!n)return!0;var r=e.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(void 0===r)return!0;var i=e.doc.nodeAt(r);return n.node.type!==(null==i?void 0:i.type)||!ha(e.doc,n.pos)||(e.join(n.pos),!0)},Fh=function(e,t){var n=th(function(e){return e.type===t})(e.selection);if(!n)return!0;var r=e.doc.resolve(n.start).after(n.depth);if(void 0===r)return!0;var i=e.doc.nodeAt(r);return n.node.type!==(null==i?void 0:i.type)||!ha(e.doc,r)||(e.join(r),!0)},jh=function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return function(i){var o=i.editor,a=i.tr,s=i.state,c=i.dispatch,l=i.chain,u=i.commands,d=i.can,h=o.extensionManager,f=h.extensions,p=h.splittableMarks,v=nd(e,s.schema),m=nd(t,s.schema),g=s.selection,y=s.storedMarks,k=g.$from,w=g.$to,b=k.blockRange(w),x=y||g.$to.parentOffset&&g.$from.marks();if(!b)return!1;var C=th(function(e){return Sh(e.type.name,f)})(g);if(b.depth>=1&&C&&b.depth-C.depth<=1){if(C.node.type===v)return u.liftListItem(m);if(Sh(C.node.type.name,f)&&v.validContent(C.node.content)&&c)return l().command(function(){return a.setNodeMarkup(C.pos,v),!0}).command(function(){return Vh(a,v)}).command(function(){return Fh(a,v)}).run()}return n&&x&&c?l().command(function(){var e=d().wrapInList(v,r),t=x.filter(function(e){return p.includes(e.type.name)});return a.ensureMarks(t),!!e||u.clearNodes()}).wrapInList(v,r).command(function(){return Vh(a,v)}).command(function(){return Fh(a,v)}).run():l().command(function(){return!!d().wrapInList(v,r)||u.clearNodes()}).wrapInList(v,r).command(function(){return Vh(a,v)}).command(function(){return Fh(a,v)}).run()}},$h=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return function(r){var i=r.state,o=r.commands,a=n.extendEmptyMarkRange,s=void 0!==a&&a,c=fd(e,i.schema);return xh(i,c,t)?o.unsetMark(c,{extendEmptyMarkRange:s}):o.setMark(c,t)}},Hh=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return function(r){var i,o=r.state,a=r.commands,s=nd(e,o.schema),c=nd(t,o.schema),l=Ld(o,s,n);return o.selection.$anchor.sameParent(o.selection.$head)&&(i=o.selection.$anchor.parent.attrs),l?a.setNode(c,i):a.setNode(s,h(h({},i),n))}},Wh=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(n){var r=n.state,i=n.commands,o=nd(e,r.schema);return Ld(r,o,t)?i.lift(o):i.wrapIn(o,t)}},qh=function(){return function(e){for(var t=e.state,n=e.dispatch,r=t.plugins,i=0;i<r.length;i+=1){var o=r[i],a=void 0;if(o.spec.isInputRules&&(a=o.getState(t))){if(n){for(var s=t.tr,c=a.transform,l=c.steps.length-1;l>=0;l-=1)s.step(c.steps[l].invert(c.docs[l]));if(a.text){var u=s.doc.resolve(a.from).marks();s.replaceWith(a.from,a.to,t.schema.text(a.text,u))}else s.delete(a.from,a.to)}return!0}}return!1}},Uh=function(){return function(e){var t=e.tr,n=e.dispatch,r=t.selection,i=r.empty,o=r.ranges;return i||n&&o.forEach(function(e){t.removeMark(e.$from.pos,e.$to.pos)}),!0}},Kh=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(n){var r,i=n.tr,o=n.state,a=n.dispatch,s=t.extendEmptyMarkRange,c=void 0!==s&&s,l=i.selection,u=fd(e,o.schema),d=l.$from,h=l.empty,f=l.ranges;if(!a)return!0;if(h&&c){var p=l.from,v=l.to,m=null==(r=d.marks().find(function(e){return e.type===u}))?void 0:r.attrs,g=hd(d,u,m);g&&(p=g.from,v=g.to),i.removeMark(p,v,u)}else f.forEach(function(e){i.removeMark(e.$from.pos,e.$to.pos,u)});return i.removeStoredMark(u),!0}},Jh=function(e){return function(t){var n,r,i=t.tr,o=t.state,a=t.dispatch,s=o.selection;return"number"==typeof e?(n=e,r=e):e&&"from"in e&&"to"in e?(n=e.from,r=e.to):(n=s.from,r=s.to),a&&i.doc.nodesBetween(n,r,function(e,t){if(!e.isText){var n=h({},e.attrs);delete n.dir,i.setNodeMarkup(t,void 0,n)}}),!0}},Gh=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(n){var r=n.tr,i=n.state,o=n.dispatch,a=null,s=null,c=$d("string"==typeof e?e:e.name,i.schema);if(!c)return!1;"node"===c&&(a=nd(e,i.schema)),"mark"===c&&(s=fd(e,i.schema));var l=!1;return r.selection.ranges.forEach(function(e){var n,c,u,d,f=e.$from.pos,p=e.$to.pos;r.selection.empty?i.doc.nodesBetween(f,p,function(e,t){a&&a===e.type&&(l=!0,u=Math.max(t,f),d=Math.min(t+e.nodeSize,p),n=t,c=e)}):i.doc.nodesBetween(f,p,function(e,i){i<f&&a&&a===e.type&&(l=!0,u=Math.max(i,f),d=Math.min(i+e.nodeSize,p),n=i,c=e),i>=f&&i<=p&&(a&&a===e.type&&(l=!0,o&&r.setNodeMarkup(i,void 0,h(h({},e.attrs),t))),s&&e.marks.length&&e.marks.forEach(function(n){if(s===n.type&&(l=!0,o)){var a=Math.max(i,f),c=Math.min(i+e.nodeSize,p);r.addMark(a,c,s.create(h(h({},n.attrs),t)))}}))}),c&&(void 0!==n&&o&&r.setNodeMarkup(n,void 0,h(h({},c.attrs),t)),s&&c.marks.length&&c.marks.forEach(function(e){s===e.type&&o&&r.addMark(u,d,s.create(h(h({},e.attrs),t)))}))}),l}},Xh=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(n){var r=n.state,i=n.dispatch;return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return function(n,r){var i=n.selection,o=i.$from,a=i.$to,s=o.blockRange(a),c=s&&sa(s,e,t);return!!c&&(r&&r(n.tr.wrap(s,c).scrollIntoView()),!0)}}(nd(e,r.schema),t)(r,i)}},Yh=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(n){var r=n.state,i=n.dispatch;return ps(nd(e,r.schema),t)(r,i)}},Zh=function(){return S(function e(){x(this,e),this.callbacks={}},[{key:"on",value:function(e,t){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(t),this}},{key:"emit",value:function(e){for(var t=this,n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];var o=this.callbacks[e];return o&&o.forEach(function(e){return e.apply(t,r)}),this}},{key:"off",value:function(e,t){var n=this.callbacks[e];return n&&(t?this.callbacks[e]=n.filter(function(e){return e!==t}):delete this.callbacks[e]),this}},{key:"once",value:function(e,t){var n=this,r=function(){n.off(e,r);for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];t.apply(n,o)};return this.on(e,r)}},{key:"removeAllListeners",value:function(){this.callbacks={}}}])}(),Qh=S(function e(t){var n;x(this,e),this.find=t.find,this.handler=t.handler,this.undoable=null==(n=t.undoable)||n});function ef(e){var t,n=e.editor,r=e.from,i=e.to,o=e.text,a=e.rules,s=e.plugin,c=n.view;if(c.composing)return!1;var l=c.state.doc.resolve(r);if(l.parent.type.spec.code||(null==(t=l.nodeBefore||l.nodeAfter)?void 0:t.marks.find(function(e){return e.type.spec.code})))return!1;var u=!1,d=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:500,n="",r=e.parentOffset;return e.parent.nodesBetween(Math.max(0,r-t),r,function(e,t,i,o){var a,s,c=(null==(s=(a=e.type.spec).toText)?void 0:s.call(a,{node:e,pos:t,parent:i,index:o}))||e.textContent||"%leaf%";n+=e.isAtom&&!e.isText?c:c.slice(0,Math.max(0,r-t))}),n}(l)+o;return a.forEach(function(e){if(!u){var t=function(e,t){if(cd(t))return t.exec(e);var n=t(e);if(!n)return null;var r=[n.text];return r.index=n.index,r.input=e,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r}(d,e.find);if(t){var a=c.state.tr,l=Uu({state:c.state,transaction:a}),h={from:r-(t[0].length-o.length),to:i},f=new Ku({editor:n,state:l}),p=f.commands,v=f.chain,m=f.can;null!==e.handler({state:l,range:h,match:t,commands:p,chain:v,can:m})&&a.steps.length&&(e.undoable&&a.setMeta(s,{transform:a,from:r,to:i,text:o}),c.dispatch(a),u=!0)}}}),u}function tf(e){return"Object"===function(e){return Object.prototype.toString.call(e).slice(8,-1)}(e)&&(e.constructor===Object&&Object.getPrototypeOf(e)===Object.prototype)}function nf(e,t){var n=h({},e);return tf(e)&&tf(t)&&Object.keys(t).forEach(function(r){tf(t[r])&&tf(e[r])?n[r]=nf(e[r],t[r]):n[r]=t[r]}),n}var rf=function(){return S(function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};x(this,e),this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config=h(h({},this.config),t),this.name=this.config.name},[{key:"options",get:function(){return h({},ah(nh(this,"addOptions",{name:this.name}))||{})}},{key:"storage",get:function(){return h({},ah(nh(this,"addStorage",{name:this.name,options:this.options}))||{})}},{key:"configure",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=this.extend(h(h({},this.config),{},{addOptions:function(){return nf(e.options,t)}}));return n.name=this.name,n.parent=this.parent,n}},{key:"extend",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=new this.constructor(h(h({},this.config),e));return t.parent=this,this.child=t,t.name="name"in e?e.name:t.parent.name,t}}])}(),of=function(t){function n(){var e;return x(this,n),(e=r(this,n,arguments)).type="mark",e}return a(n,t),S(n,[{key:"configure",value:function(t){return e(n,"configure",this,3)([t])}},{key:"extend",value:function(t){var r="function"==typeof t?t():t;return e(n,"extend",this,3)([r])}}],[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new n("function"==typeof e?e():e)}},{key:"handleExit",value:function(e){var t=e.editor,n=e.mark,r=t.state.tr,i=t.state.selection.$from;if(i.pos===i.end()){var o=i.marks(),a=!!o.find(function(e){return(null==e?void 0:e.type.name)===n.name});if(!a)return!1;var s=o.find(function(e){return(null==e?void 0:e.type.name)===n.name});return s&&r.removeStoredMark(s),r.insertText(" ",i.pos),t.view.dispatch(r),!0}return!1}}])}(rf);function af(e){var t=e.editor,n=e.state,r=e.from,i=e.to,o=e.rule,a=e.pasteEvent,s=e.dropEvent,l=new Ku({editor:t,state:n}),u=l.commands,d=l.chain,h=l.can,f=[];return n.doc.nodesBetween(r,i,function(e,t){var l,p,v,m,g;if(!(null==(p=null==(l=e.type)?void 0:l.spec)?void 0:p.code)&&(e.isText||e.isTextblock||e.isInline)){var y=null!=(g=null!=(m=null==(v=e.content)?void 0:v.size)?m:e.nodeSize)?g:0,k=Math.max(r,t),w=Math.min(i,t+y);if(!(k>=w))(function(e,t,n){if(cd(t))return c(e.matchAll(t));var r=t(e,n);return r?r.map(function(t){var n=[t.text];return n.index=t.index,n.input=e,n.data=t.data,t.replaceWith&&(t.text.includes(t.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),n.push(t.replaceWith)),n}):[]})(e.isText?e.text||"":e.textBetween(k-t,w-t,void 0,""),o.find,a).forEach(function(e){if(void 0!==e.index){var t=k+e.index+1,r=t+e[0].length,i={from:n.tr.mapping.map(t),to:n.tr.mapping.map(r)},c=o.handler({state:n,range:i,match:e,commands:u,chain:d,can:h,pasteEvent:a,dropEvent:s});f.push(c)}})}}),f.every(function(e){return null!==e})}var sf=null;function cf(e){var t,n=e.editor,r=e.rules,i=null,o=!1,a=!1,s="undefined"!=typeof ClipboardEvent?new ClipboardEvent("paste"):null;try{t="undefined"!=typeof DragEvent?new DragEvent("drop"):null}catch(l){t=null}var c=function(e){var r=e.state,i=e.from,o=e.to,a=e.rule,c=e.pasteEvt,l=r.tr,u=Uu({state:r,transaction:l});if(af({editor:n,state:u,from:Math.max(i-1,0),to:o.b-1,rule:a,pasteEvent:c,dropEvent:t})&&l.steps.length){try{t="undefined"!=typeof DragEvent?new DragEvent("drop"):null}catch(d){t=null}return s="undefined"!=typeof ClipboardEvent?new ClipboardEvent("paste"):null,l}};return r.map(function(e){return new Ya({view:function(e){var t=function(t){var r;(i=(null==(r=e.dom.parentElement)?void 0:r.contains(t.target))?e.dom.parentElement:null)&&(sf=n)},r=function(){sf&&(sf=null)};return window.addEventListener("dragstart",t),window.addEventListener("dragend",r),{destroy:function(){window.removeEventListener("dragstart",t),window.removeEventListener("dragend",r)}}},props:{handleDOMEvents:{drop:function(e,n){if(a=i===e.dom.parentElement,t=n,!a){var r=sf;(null==r?void 0:r.isEditable)&&setTimeout(function(){var e=r.state.selection;e&&r.commands.deleteRange({from:e.from,to:e.to})},10)}return!1},paste:function(e,t){var n,r=null==(n=t.clipboardData)?void 0:n.getData("text/html");return s=t,o=!!(null==r?void 0:r.includes("data-pm-slice")),!1}}},appendTransaction:function(t,n,r){var i=t[0],l="paste"===i.getMeta("uiEvent")&&!o,u="drop"===i.getMeta("uiEvent")&&!a,d=i.getMeta("applyPasteRules"),h=!!d;if(l||u||h){if(h){var f=d.text;"string"==typeof f||(f=ih(Di.from(f),r.schema));var p=d.from,v=p+f.length,m=function(e){var t,n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return null==(t=n.clipboardData)||t.setData("text/html",e),n}(f);return c({rule:e,state:r,from:p,to:{b:v},pasteEvt:m})}var g=n.doc.content.findDiffStart(r.doc.content),y=n.doc.content.findDiffEnd(r.doc.content);if("number"==typeof g&&y&&g!==y.b)return c({rule:e,state:r,from:g,to:y,pasteEvt:s})}}})})}var lf=function(){return S(function e(t,n){x(this,e),this.splittableMarks=[],this.editor=n,this.baseExtensions=t,this.extensions=vh(t),this.schema=function(e,t){var n,r=ch(e),i=sh(e),o=i.nodeExtensions,a=i.markExtensions,s=null==(n=o.find(function(e){return nh(e,"topNode")}))?void 0:n.name,c=Object.fromEntries(o.map(function(n){var i=r.filter(function(e){return e.type===n.name}),o={name:n.name,options:n.options,storage:n.storage,editor:t},a=e.reduce(function(e,t){var r=nh(t,"extendNodeSchema",o);return h(h({},e),r?r(n):{})},{}),s=hh(h(h({},a),{},{content:ah(nh(n,"content",o)),marks:ah(nh(n,"marks",o)),group:ah(nh(n,"group",o)),inline:ah(nh(n,"inline",o)),atom:ah(nh(n,"atom",o)),selectable:ah(nh(n,"selectable",o)),draggable:ah(nh(n,"draggable",o)),code:ah(nh(n,"code",o)),whitespace:ah(nh(n,"whitespace",o)),linebreakReplacement:ah(nh(n,"linebreakReplacement",o)),defining:ah(nh(n,"defining",o)),isolating:ah(nh(n,"isolating",o)),attrs:Object.fromEntries(i.map(fh))})),c=ah(nh(n,"parseHTML",o));c&&(s.parseDOM=c.map(function(e){return dh(e,i)}));var l=nh(n,"renderHTML",o);l&&(s.toDOM=function(e){return l({node:e,HTMLAttributes:uh(e,i)})});var u=nh(n,"renderText",o);return u&&(s.toText=u),[n.name,s]})),l=Object.fromEntries(a.map(function(n){var i=r.filter(function(e){return e.type===n.name}),o={name:n.name,options:n.options,storage:n.storage,editor:t},a=e.reduce(function(e,t){var r=nh(t,"extendMarkSchema",o);return h(h({},e),r?r(n):{})},{}),s=hh(h(h({},a),{},{inclusive:ah(nh(n,"inclusive",o)),excludes:ah(nh(n,"excludes",o)),group:ah(nh(n,"group",o)),spanning:ah(nh(n,"spanning",o)),code:ah(nh(n,"code",o)),attrs:Object.fromEntries(i.map(fh))})),c=ah(nh(n,"parseHTML",o));c&&(s.parseDOM=c.map(function(e){return dh(e,i)}));var l=nh(n,"renderHTML",o);return l&&(s.toDOM=function(e){return l({mark:e,HTMLAttributes:uh(e,i)})}),[n.name,s]}));return new Co({topNode:s,nodes:c,marks:l})}(this.extensions,n),this.setupExtensions()},[{key:"commands",get:function(){var e=this;return this.extensions.reduce(function(t,n){var r=nh(n,"addCommands",{name:n.name,options:n.options,storage:e.editor.extensionStorage[n.name],editor:e.editor,type:wh(n.name,e.schema)});return r?h(h({},t),r()):t},{})}},{key:"plugins",get:function(){var e=this,t=this.editor;return ph(c(this.extensions).reverse()).flatMap(function(n){var r={name:n.name,options:n.options,storage:e.editor.extensionStorage[n.name],editor:t,type:wh(n.name,e.schema)},i=[],o=nh(n,"addKeyboardShortcuts",r),a={};if("mark"===n.type&&nh(n,"exitable",r)&&(a.ArrowRight=function(){return of.handleExit({editor:t,mark:n})}),o){var s=Object.fromEntries(Object.entries(o()).map(function(e){var n=g(e,2),r=n[0],i=n[1];return[r,function(){return i({editor:t})}]}));a=h(h({},a),s)}var l=function(e){return new Ya({props:{handleKeyDown:Hu(e)}})}(a);i.push(l);var u=nh(n,"addInputRules",r);if(Ch(n,t.options.enableInputRules)&&u){var d=u();if(d&&d.length){var f=function(e){var t=e.editor,n=e.rules,r=new Ya({state:{init:function(){return null},apply:function(e,i,o){var a=e.getMeta(r);if(a)return a;var s=e.getMeta("applyInputRules");return!!s&&setTimeout(function(){var e=s.text;"string"==typeof e||(e=ih(Di.from(e),o.schema));var i=s.from,a=i+e.length;ef({editor:t,from:i,to:a,text:e,rules:n,plugin:r})}),e.selectionSet||e.docChanged?null:i}},props:{handleTextInput:function(e,i,o,a){return ef({editor:t,from:i,to:o,text:a,rules:n,plugin:r})},handleDOMEvents:{compositionend:function(e){return setTimeout(function(){var i=e.state.selection.$cursor;i&&ef({editor:t,from:i.pos,to:i.pos,text:"",rules:n,plugin:r})}),!1}},handleKeyDown:function(e,i){if("Enter"!==i.key)return!1;var o=e.state.selection.$cursor;return!!o&&ef({editor:t,from:o.pos,to:o.pos,text:"\n",rules:n,plugin:r})}},isInputRules:!0});return r}({editor:t,rules:d}),p=Array.isArray(f)?f:[f];i.push.apply(i,c(p))}}var v=nh(n,"addPasteRules",r);if(Ch(n,t.options.enablePasteRules)&&v){var m=v();if(m&&m.length){var y=cf({editor:t,rules:m});i.push.apply(i,c(y))}}var k=nh(n,"addProseMirrorPlugins",r);if(k){var w=k();i.push.apply(i,c(w))}return i})}},{key:"attributes",get:function(){return ch(this.extensions)}},{key:"nodeViews",get:function(){var e=this,t=this.editor,n=sh(this.extensions).nodeExtensions;return Object.fromEntries(n.filter(function(e){return!!nh(e,"addNodeView")}).map(function(n){var r=e.attributes.filter(function(e){return e.type===n.name}),i={name:n.name,options:n.options,storage:e.editor.extensionStorage[n.name],editor:t,type:nd(n.name,e.schema)},o=nh(n,"addNodeView",i);if(!o)return[];var a=o();if(!a)return[];return[n.name,function(e,i,o,s,c){var l=uh(e,r);return a({node:e,view:i,getPos:o,decorations:s,innerDecorations:c,editor:t,extension:n,HTMLAttributes:l})}]}))}},{key:"markViews",get:function(){var e=this,t=this.editor,n=sh(this.extensions).markExtensions;return Object.fromEntries(n.filter(function(e){return!!nh(e,"addMarkView")}).map(function(n){var r=e.attributes.filter(function(e){return e.type===n.name}),i={name:n.name,options:n.options,storage:e.editor.extensionStorage[n.name],editor:t,type:fd(n.name,e.schema)},o=nh(n,"addMarkView",i);if(!o)return[];return[n.name,function(e,i,a){var s=uh(e,r);return o()({mark:e,view:i,inline:a,editor:t,extension:n,HTMLAttributes:s,updateAttributes:function(n){!function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=t.state,i=r.doc,o=r.tr,a=e;i.descendants(function(t,r){var i=o.mapping.map(r),s=o.mapping.map(r)+t.nodeSize,c=null;if(t.marks.forEach(function(e){if(e!==a)return!1;c=e}),c){var l=!1;if(Object.keys(n).forEach(function(e){n[e]!==c.attrs[e]&&(l=!0)}),l){var u=e.type.create(h(h({},e.attrs),n));o.removeMark(i,s,e.type),o.addMark(i,s,u)}}}),o.docChanged&&t.view.dispatch(o)}(e,t,n)}})}]}))}},{key:"setupExtensions",value:function(){var e=this,t=this.extensions;this.editor.extensionStorage=Object.fromEntries(t.map(function(e){return[e.name,e.storage]})),t.forEach(function(t){var n,r={name:t.name,options:t.options,storage:e.editor.extensionStorage[t.name],editor:e.editor,type:wh(t.name,e.schema)};"mark"===t.type&&((null==(n=ah(nh(t,"keepOnSplit",r)))||n)&&e.splittableMarks.push(t.name));var i=nh(t,"onBeforeCreate",r),o=nh(t,"onCreate",r),a=nh(t,"onUpdate",r),s=nh(t,"onSelectionUpdate",r),c=nh(t,"onTransaction",r),l=nh(t,"onFocus",r),u=nh(t,"onBlur",r),d=nh(t,"onDestroy",r);i&&e.editor.on("beforeCreate",i),o&&e.editor.on("create",o),a&&e.editor.on("update",a),s&&e.editor.on("selectionUpdate",s),c&&e.editor.on("transaction",c),l&&e.editor.on("focus",l),u&&e.editor.on("blur",u),d&&e.editor.on("destroy",d)})}}])}();lf.resolve=vh,lf.sort=ph,lf.flatten=rh;qu({},{ClipboardTextSerializer:function(){return df},Commands:function(){return hf},Delete:function(){return ff},Drop:function(){return pf},Editable:function(){return vf},FocusEvents:function(){return gf},Keymap:function(){return yf},Paste:function(){return kf},Tabindex:function(){return wf},TextDirection:function(){return bf},focusEventsPluginKey:function(){return mf}});var uf=function(t){function n(){var e;return x(this,n),(e=r(this,n,arguments)).type="extension",e}return a(n,t),S(n,[{key:"configure",value:function(t){return e(n,"configure",this,3)([t])}},{key:"extend",value:function(t){var r="function"==typeof t?t():t;return e(n,"extend",this,3)([r])}}],[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new n("function"==typeof e?e():e)}}])}(rf),df=uf.create({name:"clipboardTextSerializer",addOptions:function(){return{blockSeparator:void 0}},addProseMirrorPlugins:function(){var e=this;return[new Ya({key:new es("clipboardTextSerializer"),props:{clipboardTextSerializer:function(){var t=e.editor,n=t.state,r=t.schema,i=n.doc,o=n.selection.ranges,a=Math.min.apply(Math,c(o.map(function(e){return e.$from.pos}))),s=Math.max.apply(Math,c(o.map(function(e){return e.$to.pos}))),l=gh(r);return mh(i,{from:a,to:s},h(h({},void 0!==e.options.blockSeparator?{blockSeparator:e.options.blockSeparator}:{}),{},{textSerializers:l}))}}})]}}),hf=uf.create({name:"commands",addCommands:function(){return h({},Ju)}}),ff=uf.create({name:"delete",onUpdate:function(e){var t,n,r,i=this,o=e.transaction,a=e.appendedTransactions,s=function(){var e,t,n,r;if(!(null!=(r=null==(n=null==(t=null==(e=i.editor.options.coreExtensionOptions)?void 0:e.delete)?void 0:t.filterTransaction)?void 0:n.call(t,o))?r:o.getMeta("y-sync$"))){var s,l,u,d=(s=o.before,l=[o].concat(c(a)),u=new Ea(s),l.forEach(function(e){e.steps.forEach(function(e){u.step(e)})}),u),h=function(e){var t=e.mapping,n=e.steps,r=[];return t.maps.forEach(function(e,i){var o=[];if(e.ranges.length)e.forEach(function(e,t){o.push({from:e,to:t})});else{var a=n[i],s=a.from,c=a.to;if(void 0===s||void 0===c)return;o.push({from:s,to:c})}o.forEach(function(e){var n=e.from,o=e.to,a=t.slice(i).map(n,-1),s=t.slice(i).map(o),c=t.invert().map(a,-1),l=t.invert().map(s);r.push({oldRange:{from:c,to:l},newRange:{from:a,to:s}})})}),kh(r)}(d);h.forEach(function(e){d.mapping.mapResult(e.oldRange.from).deletedAfter&&d.mapping.mapResult(e.oldRange.to).deletedBefore&&d.before.nodesBetween(e.oldRange.from,e.oldRange.to,function(t,n){var r=n+t.nodeSize-2,a=e.oldRange.from<=n&&r<=e.oldRange.to;i.editor.emit("delete",{type:"node",node:t,from:n,to:r,newFrom:d.mapping.map(n),newTo:d.mapping.map(r),deletedRange:e.oldRange,newRange:e.newRange,partial:!a,editor:i.editor,transaction:o,combinedTransform:d})})});var f=d.mapping;d.steps.forEach(function(e,t){var n,r;if(e instanceof Zo){var a=f.slice(t).map(e.from,-1),s=f.slice(t).map(e.to),c=f.invert().map(a,-1),l=f.invert().map(s),u=null==(n=d.doc.nodeAt(a-1))?void 0:n.marks.some(function(t){return t.eq(e.mark)}),h=null==(r=d.doc.nodeAt(s))?void 0:r.marks.some(function(t){return t.eq(e.mark)});i.editor.emit("delete",{type:"mark",mark:e.mark,from:e.from,to:e.to,deletedRange:{from:c,to:l},newRange:{from:a,to:s},partial:Boolean(h||u),editor:i.editor,transaction:o,combinedTransform:d})}})}};null==(r=null==(n=null==(t=this.editor.options.coreExtensionOptions)?void 0:t.delete)?void 0:n.async)||r?setTimeout(s,0):s()}}),pf=uf.create({name:"drop",addProseMirrorPlugins:function(){var e=this;return[new Ya({key:new es("tiptapDrop"),props:{handleDrop:function(t,n,r,i){e.editor.emit("drop",{editor:e.editor,event:n,slice:r,moved:i})}}})]}}),vf=uf.create({name:"editable",addProseMirrorPlugins:function(){var e=this;return[new Ya({key:new es("editable"),props:{editable:function(){return e.editor.options.editable}}})]}}),mf=new es("focusEvents"),gf=uf.create({name:"focusEvents",addProseMirrorPlugins:function(){var e=this.editor;return[new Ya({key:mf,props:{handleDOMEvents:{focus:function(t,n){e.isFocused=!0;var r=e.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return t.dispatch(r),!1},blur:function(t,n){e.isFocused=!1;var r=e.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return t.dispatch(r),!1}}}})]}}),yf=uf.create({name:"keymap",addKeyboardShortcuts:function(){var e=this,t=function(){return e.editor.commands.first(function(e){var t=e.commands;return[function(){return t.undoInputRule()},function(){return t.command(function(e){var n=e.tr,r=n.selection,i=n.doc,o=r.empty,a=r.$anchor,s=a.pos,c=a.parent,l=a.parent.isTextblock&&s>0?n.doc.resolve(s-1):a,u=l.parent.type.spec.isolating,d=a.pos-a.parentOffset,h=u&&1===l.parent.childCount?d===a.pos:Da.atStart(i).from===s;return!(!o||!c.type.isTextblock||c.textContent.length||!h||h&&"paragraph"===a.parent.type.name)&&t.clearNodes()})},function(){return t.deleteSelection()},function(){return t.joinBackward()},function(){return t.selectNodeBackward()}]})},n=function(){return e.editor.commands.first(function(e){var t=e.commands;return[function(){return t.deleteSelection()},function(){return t.deleteCurrentNode()},function(){return t.joinForward()},function(){return t.selectNodeForward()}]})},r={Enter:function(){return e.editor.commands.first(function(e){var t=e.commands;return[function(){return t.newlineInCode()},function(){return t.createParagraphNear()},function(){return t.liftEmptyBlock()},function(){return t.splitBlock()}]})},"Mod-Enter":function(){return e.editor.commands.exitCode()},Backspace:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:n,"Mod-Delete":n,"Mod-a":function(){return e.editor.commands.selectAll()}},i=h({},r),o=h(h({},r),{},{"Ctrl-h":t,"Alt-Backspace":t,"Ctrl-d":n,"Ctrl-Alt-Backspace":n,"Alt-Delete":n,"Alt-d":n,"Ctrl-a":function(){return e.editor.commands.selectTextblockStart()},"Ctrl-e":function(){return e.editor.commands.selectTextblockEnd()}});return kd()||Rd()?o:i},addProseMirrorPlugins:function(){var e=this;return[new Ya({key:new es("clearDocument"),appendTransaction:function(t,n,r){if(!t.some(function(e){return e.getMeta("composition")})){var i=t.some(function(e){return e.docChanged})&&!n.doc.eq(r.doc),o=t.some(function(e){return e.getMeta("preventClearDocument")});if(i&&!o){var a=n.selection,s=a.empty,c=a.from,l=a.to,u=Da.atStart(n.doc).from,d=Da.atEnd(n.doc).to;if(!s&&(c===u&&l===d))if(_h(r.doc)){var h=r.tr,f=Uu({state:r,transaction:h});if(new Ku({editor:e.editor,state:f}).commands.clearNodes(),h.steps.length)return h}}}}})]}}),kf=uf.create({name:"paste",addProseMirrorPlugins:function(){var e=this;return[new Ya({key:new es("tiptapPaste"),props:{handlePaste:function(t,n,r){e.editor.emit("paste",{editor:e.editor,event:n,slice:r})}}})]}}),wf=uf.create({name:"tabindex",addProseMirrorPlugins:function(){var e=this;return[new Ya({key:new es("tabindex"),props:{attributes:function(){return e.editor.isEditable?{tabindex:"0"}:{}}}})]}}),bf=uf.create({name:"textDirection",addOptions:function(){return{direction:void 0}},addGlobalAttributes:function(){var e=this;return this.options.direction?[{types:sh(this.extensions).nodeExtensions.filter(function(e){return"text"!==e.name}).map(function(e){return e.name}),attributes:{dir:{default:this.options.direction,parseHTML:function(t){var n=t.getAttribute("dir");return!n||"ltr"!==n&&"rtl"!==n&&"auto"!==n?e.options.direction:n},renderHTML:function(e){return e.dir?{dir:e.dir}:{}}}}}]:[]},addProseMirrorPlugins:function(){var e=this;return[new Ya({key:new es("textDirection"),props:{attributes:function(){var t=e.options.direction;return t?{dir:t}:{}}}})]}}),xf=function(){function e(t,n){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;x(this,e),this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=t,this.editor=n,this.currentNode=i}return S(e,[{key:"name",get:function(){return this.node.type.name}},{key:"node",get:function(){return this.currentNode||this.resolvedPos.node()}},{key:"element",get:function(){return this.editor.view.domAtPos(this.pos).node}},{key:"depth",get:function(){var e;return null!=(e=this.actualDepth)?e:this.resolvedPos.depth}},{key:"pos",get:function(){return this.resolvedPos.pos}},{key:"content",get:function(){return this.node.content},set:function(e){var t=this.from,n=this.to;if(this.isBlock){if(0===this.content.size)return void console.error("You can’t set content on a block node. Tried to set content on ".concat(this.name," at ").concat(this.pos));t=this.from+1,n=this.to-1}this.editor.commands.insertContentAt({from:t,to:n},e)}},{key:"attributes",get:function(){return this.node.attrs}},{key:"textContent",get:function(){return this.node.textContent}},{key:"size",get:function(){return this.node.nodeSize}},{key:"from",get:function(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}},{key:"range",get:function(){return{from:this.from,to:this.to}}},{key:"to",get:function(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}},{key:"parent",get:function(){if(0===this.depth)return null;var t=this.resolvedPos.start(this.resolvedPos.depth-1);return new e(this.resolvedPos.doc.resolve(t),this.editor)}},{key:"before",get:function(){var t=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.from-3)),new e(t,this.editor)}},{key:"after",get:function(){var t=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.to+3)),new e(t,this.editor)}},{key:"children",get:function(){var t=this,n=[];return this.node.content.forEach(function(r,i){var o=r.isBlock&&!r.isTextblock,a=r.isAtom&&!r.isText,s=t.pos+i+(a?0:1);if(!(s<0||s>t.resolvedPos.doc.nodeSize-2)){var c=t.resolvedPos.doc.resolve(s);if(o||!(c.depth<=t.depth)){var l=new e(c,t.editor,o,o?r:null);o&&(l.actualDepth=t.depth+1),n.push(new e(c,t.editor,o,o?r:null))}}}),n}},{key:"firstChild",get:function(){return this.children[0]||null}},{key:"lastChild",get:function(){var e=this.children;return e[e.length-1]||null}},{key:"closest",value:function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=null,r=this.parent;r&&!n;){if(r.node.type.name===e)if(Object.keys(t).length>0)for(var i=r.node.attrs,o=Object.keys(t),a=0;a<o.length;a+=1){var s=o[a];if(i[s]!==t[s])break}else n=r;r=r.parent}return n}},{key:"querySelector",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.querySelectorAll(e,t,!0)[0]||null}},{key:"querySelectorAll",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=[];if(!this.children||0===this.children.length)return r;var i=Object.keys(t);return this.children.forEach(function(o){if(!(n&&r.length>0)){if(o.node.type.name===e)i.every(function(e){return t[e]===o.node.attrs[e]})&&r.push(o);n&&r.length>0||(r=r.concat(o.querySelectorAll(e,t,n)))}}),r}},{key:"setAttribute",value:function(e){var t=this.editor.state.tr;t.setNodeMarkup(this.from,void 0,h(h({},this.node.attrs),e)),this.editor.view.dispatch(t)}}])}();var Cf=function(e){function t(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};x(this,t),(e=r(this,t)).css=null,e.className="tiptap",e.editorView=null,e.isFocused=!1,e.isInitialized=!1,e.extensionStorage={},e.instanceId=Math.random().toString(36).slice(2,9),e.options={element:"undefined"!=typeof document?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,textDirection:void 0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:function(){return null},onCreate:function(){return null},onMount:function(){return null},onUnmount:function(){return null},onUpdate:function(){return null},onSelectionUpdate:function(){return null},onTransaction:function(){return null},onFocus:function(){return null},onBlur:function(){return null},onDestroy:function(){return null},onContentError:function(e){throw e.error},onPaste:function(){return null},onDrop:function(){return null},onDelete:function(){return null}},e.isCapturingTransaction=!1,e.capturedTransaction=null,e.utils={getUpdatedPosition:Nh,createMappablePosition:Th},e.setOptions(n),e.createExtensionManager(),e.createCommandManager(),e.createSchema(),e.on("beforeCreate",e.options.onBeforeCreate),e.emit("beforeCreate",{editor:e}),e.on("mount",e.options.onMount),e.on("unmount",e.options.onUnmount),e.on("contentError",e.options.onContentError),e.on("create",e.options.onCreate),e.on("update",e.options.onUpdate),e.on("selectionUpdate",e.options.onSelectionUpdate),e.on("transaction",e.options.onTransaction),e.on("focus",e.options.onFocus),e.on("blur",e.options.onBlur),e.on("destroy",e.options.onDestroy),e.on("drop",function(t){var n=t.event,r=t.slice,i=t.moved;return e.options.onDrop(n,r,i)}),e.on("paste",function(t){var n=t.event,r=t.slice;return e.options.onPaste(n,r)}),e.on("delete",e.options.onDelete);var i=e.createDoc(),o=yd(i,e.options.autofocus);return e.editorState=Ga.create({doc:i,schema:e.schema,selection:o||void 0}),e.options.element&&e.mount(e.options.element),e}return a(t,e),S(t,[{key:"mount",value:function(e){var t=this;if("undefined"==typeof document)throw new Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(e),this.emit("mount",{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(function(){t.isDestroyed||(!1!==t.options.autofocus&&null!==t.options.autofocus&&t.commands.focus(t.options.autofocus),t.emit("create",{editor:t}),t.isInitialized=!0)},0)}},{key:"unmount",value:function(){if(this.editorView){var e=this.editorView.dom;(null==e?void 0:e.editor)&&delete e.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(".".concat(this.className)).length)try{"function"==typeof this.css.remove?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(t){console.warn("Failed to remove CSS element:",t)}this.css=null,this.emit("unmount",{editor:this})}},{key:"storage",get:function(){return this.extensionStorage}},{key:"commands",get:function(){return this.commandManager.commands}},{key:"chain",value:function(){return this.commandManager.chain()}},{key:"can",value:function(){return this.commandManager.can()}},{key:"injectCSS",value:function(){this.options.injectCSS&&"undefined"!=typeof document&&(this.css=function(e,t,n){var r=document.querySelector("style[data-tiptap-style".concat(n?"-".concat(n):"","]"));if(null!==r)return r;var i=document.createElement("style");return t&&i.setAttribute("nonce",t),i.setAttribute("data-tiptap-style".concat(n?"-".concat(n):""),""),i.innerHTML=e,document.getElementsByTagName("head")[0].appendChild(i),i}('.ProseMirror {\n position: relative;\n}\n\n.ProseMirror {\n word-wrap: break-word;\n white-space: pre-wrap;\n white-space: break-spaces;\n -webkit-font-variant-ligatures: none;\n font-variant-ligatures: none;\n font-feature-settings: "liga" 0; /* the above doesn\'t seem to work in Edge */\n}\n\n.ProseMirror [contenteditable="false"] {\n white-space: normal;\n}\n\n.ProseMirror [contenteditable="false"] [contenteditable="true"] {\n white-space: pre-wrap;\n}\n\n.ProseMirror pre {\n white-space: pre-wrap;\n}\n\nimg.ProseMirror-separator {\n display: inline !important;\n border: none !important;\n margin: 0 !important;\n width: 0 !important;\n height: 0 !important;\n}\n\n.ProseMirror-gapcursor {\n display: none;\n pointer-events: none;\n position: absolute;\n margin: 0;\n}\n\n.ProseMirror-gapcursor:after {\n content: "";\n display: block;\n position: absolute;\n top: -2px;\n width: 20px;\n border-top: 1px solid black;\n animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;\n}\n\n@keyframes ProseMirror-cursor-blink {\n to {\n visibility: hidden;\n }\n}\n\n.ProseMirror-hideselection *::selection {\n background: transparent;\n}\n\n.ProseMirror-hideselection *::-moz-selection {\n background: transparent;\n}\n\n.ProseMirror-hideselection * {\n caret-color: transparent;\n}\n\n.ProseMirror-focused .ProseMirror-gapcursor {\n display: block;\n}',this.options.injectNonce))}},{key:"setOptions",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.options=h(h({},this.options),e),this.editorView&&this.state&&!this.isDestroyed&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}},{key:"setEditable",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.setOptions({editable:e}),t&&this.emit("update",{editor:this,transaction:this.state.tr,appendedTransactions:[]})}},{key:"isEditable",get:function(){return this.options.editable&&this.view&&this.view.editable}},{key:"view",get:function(){var e=this;return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:function(t){e.editorState=t},dispatch:function(t){e.dispatchTransaction(t)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:function(t,n){if(e.editorView)return e.editorView[n];if("state"===n)return e.editorState;if(n in t)return Reflect.get(t,n);throw new Error("[tiptap error]: The editor view is not available. Cannot access view['".concat(n,"']. The editor may not be mounted yet."))}})}},{key:"state",get:function(){return this.editorView&&(this.editorState=this.view.state),this.editorState}},{key:"registerPlugin",value:function(e,t){var n=oh(t)?t(e,c(this.state.plugins)):[].concat(c(this.state.plugins),[e]),r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}},{key:"unregisterPlugin",value:function(e){if(!this.isDestroyed){var t=this.state.plugins,n=t;if([].concat(e).forEach(function(e){var t="string"==typeof e?"".concat(e,"$"):e.key;n=n.filter(function(e){return!e.key.startsWith(t)})}),t.length!==n.length){var r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}}}},{key:"createExtensionManager",value:function(){var e,t,n=this,r=this.options.enableCoreExtensions?[vf,df.configure({blockSeparator:null==(t=null==(e=this.options.coreExtensionOptions)?void 0:e.clipboardTextSerializer)?void 0:t.blockSeparator}),hf,gf,yf,wf,pf,kf,ff,bf.configure({direction:this.options.textDirection})].filter(function(e){return"object"!==N(n.options.enableCoreExtensions)||!1!==n.options.enableCoreExtensions[e.name]}):[],i=[].concat(c(r),c(this.options.extensions)).filter(function(e){return["extension","node","mark"].includes(null==e?void 0:e.type)});this.extensionManager=new lf(i,this)}},{key:"createCommandManager",value:function(){this.commandManager=new Ku({editor:this})}},{key:"createSchema",value:function(){this.schema=this.extensionManager.schema}},{key:"createDoc",value:function(){var e,t=this;try{e=Zd(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(wt){if(!(wt instanceof Error&&["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(wt.message)))throw wt;this.emit("contentError",{editor:this,error:wt,disableCollaboration:function(){"collaboration"in t.storage&&"object"===N(t.storage.collaboration)&&t.storage.collaboration&&(t.storage.collaboration.isDisabled=!0),t.options.extensions=t.options.extensions.filter(function(e){return"collaboration"!==e.name}),t.createExtensionManager()}}),e=Zd(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return e}},{key:"createView",value:function(e){var t;this.editorView=new Nu(e,h(h({},this.options.editorProps),{},{attributes:h({role:"textbox"},null==(t=this.options.editorProps)?void 0:t.attributes),dispatchTransaction:this.dispatchTransaction.bind(this),state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews}));var n=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(n),this.prependClass(),this.injectCSS(),this.view.dom.editor=this}},{key:"createNodeViews",value:function(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}},{key:"prependClass",value:function(){this.view.dom.className="".concat(this.className," ").concat(this.view.dom.className)}},{key:"captureTransaction",value:function(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;var t=this.capturedTransaction;return this.capturedTransaction=null,t}},{key:"dispatchTransaction",value:function(e){var t=this;if(!this.view.isDestroyed){if(this.isCapturingTransaction)return this.capturedTransaction?void e.steps.forEach(function(e){var n;return null==(n=t.capturedTransaction)?void 0:n.step(e)}):void(this.capturedTransaction=e);var n=this.state.applyTransaction(e),r=n.state,i=n.transactions,o=!this.state.selection.eq(r.selection),a=i.includes(e),s=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:e,nextState:r}),a){this.view.updateState(r),this.emit("transaction",{editor:this,transaction:e,appendedTransactions:i.slice(1)}),o&&this.emit("selectionUpdate",{editor:this,transaction:e});var c=i.findLast(function(e){return e.getMeta("focus")||e.getMeta("blur")}),l=null==c?void 0:c.getMeta("focus"),u=null==c?void 0:c.getMeta("blur");l&&this.emit("focus",{editor:this,event:l.event,transaction:c}),u&&this.emit("blur",{editor:this,event:u.event,transaction:c}),e.getMeta("preventUpdate")||!i.some(function(e){return e.docChanged})||s.doc.eq(r.doc)||this.emit("update",{editor:this,transaction:e,appendedTransactions:i.slice(1)})}}}},{key:"getAttributes",value:function(e){return yh(this.state,e)}},{key:"isActive",value:function(e,t){var n="string"==typeof e?e:null,r="string"==typeof e?t:e;return function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!t)return Ld(e,null,n)||xh(e,null,n);var r=$d(t,e.schema);return"node"===r?Ld(e,t,n):"mark"===r&&xh(e,t,n)}(this.state,n,r)}},{key:"getJSON",value:function(){return this.state.doc.toJSON()}},{key:"getHTML",value:function(){return ih(this.state.doc.content,this.schema)}},{key:"getText",value:function(e){var t=e||{},n=t.blockSeparator,r=void 0===n?"\n\n":n,i=t.textSerializers,o=void 0===i?{}:i;return function(e,t){return mh(e,{from:0,to:e.content.size},t)}(this.state.doc,{blockSeparator:r,textSerializers:h(h({},gh(this.schema)),o)})}},{key:"isEmpty",get:function(){return _h(this.state.doc)}},{key:"destroy",value:function(){this.emit("destroy"),this.unmount(),this.removeAllListeners()}},{key:"isDestroyed",get:function(){var e,t;return null==(t=null==(e=this.editorView)?void 0:e.isDestroyed)||t}},{key:"$node",value:function(e,t){var n;return(null==(n=this.$doc)?void 0:n.querySelector(e,t))||null}},{key:"$nodes",value:function(e,t){var n;return(null==(n=this.$doc)?void 0:n.querySelectorAll(e,t))||null}},{key:"$pos",value:function(e){var t=this.state.doc.resolve(e);return new xf(t,this)}},{key:"$doc",get:function(){return this.$pos(0)}}])}(Zh);var Sf=function(){return S(function e(t){var n,r,i,o,a,s=this;x(this,e),this.directions=["bottom-left","bottom-right","top-left","top-right"],this.minSize={height:8,width:8},this.preserveAspectRatio=!1,this.classNames={container:"",wrapper:"",handle:"",resizing:""},this.initialWidth=0,this.initialHeight=0,this.aspectRatio=1,this.isResizing=!1,this.activeHandle=null,this.startX=0,this.startY=0,this.startWidth=0,this.startHeight=0,this.isShiftKeyPressed=!1,this.handleMouseMove=function(e){if(s.isResizing&&s.activeHandle){var t=e.clientX-s.startX,n=e.clientY-s.startY;s.handleResize(t,n)}},this.handleTouchMove=function(e){if(s.isResizing&&s.activeHandle){var t=e.touches[0];if(t){var n=t.clientX-s.startX,r=t.clientY-s.startY;s.handleResize(n,r)}}},this.handleMouseUp=function(){if(s.isResizing){var e=s.element.offsetWidth,t=s.element.offsetHeight;s.onCommit(e,t),s.isResizing=!1,s.activeHandle=null,s.container.dataset.resizeState="false",s.classNames.resizing&&s.container.classList.remove(s.classNames.resizing),document.removeEventListener("mousemove",s.handleMouseMove),document.removeEventListener("mouseup",s.handleMouseUp),document.removeEventListener("keydown",s.handleKeyDown),document.removeEventListener("keyup",s.handleKeyUp)}},this.handleKeyDown=function(e){"Shift"===e.key&&(s.isShiftKeyPressed=!0)},this.handleKeyUp=function(e){"Shift"===e.key&&(s.isShiftKeyPressed=!1)},this.node=t.node,this.element=t.element,this.contentElement=t.contentElement,this.getPos=t.getPos,this.onResize=t.onResize,this.onCommit=t.onCommit,this.onUpdate=t.onUpdate,(null==(n=t.options)?void 0:n.min)&&(this.minSize=h(h({},this.minSize),t.options.min)),(null==(r=t.options)?void 0:r.max)&&(this.maxSize=t.options.max),(null==(i=null==t?void 0:t.options)?void 0:i.directions)&&(this.directions=t.options.directions),(null==(o=t.options)?void 0:o.preserveAspectRatio)&&(this.preserveAspectRatio=t.options.preserveAspectRatio),(null==(a=t.options)?void 0:a.className)&&(this.classNames={container:t.options.className.container||"",wrapper:t.options.className.wrapper||"",handle:t.options.className.handle||"",resizing:t.options.className.resizing||""}),this.wrapper=this.createWrapper(),this.container=this.createContainer(),this.applyInitialSize(),this.attachHandles()},[{key:"dom",get:function(){return this.container}},{key:"contentDOM",get:function(){return this.contentElement}},{key:"update",value:function(e,t,n){return e.type===this.node.type&&(this.node=e,!this.onUpdate||this.onUpdate(e,t,n))}},{key:"destroy",value:function(){this.isResizing&&(this.container.dataset.resizeState="false",this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("keyup",this.handleKeyUp),this.isResizing=!1,this.activeHandle=null),this.container.remove()}},{key:"createContainer",value:function(){var e=document.createElement("div");return e.dataset.resizeContainer="",e.dataset.node=this.node.type.name,e.style.display="flex",e.style.justifyContent="flex-start",e.style.alignItems="flex-start",this.classNames.container&&(e.className=this.classNames.container),e.appendChild(this.wrapper),e}},{key:"createWrapper",value:function(){var e=document.createElement("div");return e.style.position="relative",e.style.display="block",e.dataset.resizeWrapper="",this.classNames.wrapper&&(e.className=this.classNames.wrapper),e.appendChild(this.element),e}},{key:"createHandle",value:function(e){var t=document.createElement("div");return t.dataset.resizeHandle=e,t.style.position="absolute",this.classNames.handle&&(t.className=this.classNames.handle),t}},{key:"positionHandle",value:function(e,t){var n=t.includes("top"),r=t.includes("bottom"),i=t.includes("left"),o=t.includes("right");n&&(e.style.top="0"),r&&(e.style.bottom="0"),i&&(e.style.left="0"),o&&(e.style.right="0"),"top"!==t&&"bottom"!==t||(e.style.left="0",e.style.right="0"),"left"!==t&&"right"!==t||(e.style.top="0",e.style.bottom="0")}},{key:"attachHandles",value:function(){var e=this;this.directions.forEach(function(t){var n=e.createHandle(t);e.positionHandle(n,t),n.addEventListener("mousedown",function(n){return e.handleResizeStart(n,t)}),n.addEventListener("touchstart",function(n){return e.handleResizeStart(n,t)}),e.wrapper.appendChild(n)})}},{key:"applyInitialSize",value:function(){var e=this.node.attrs.width,t=this.node.attrs.height;e?(this.element.style.width="".concat(e,"px"),this.initialWidth=e):this.initialWidth=this.element.offsetWidth,t?(this.element.style.height="".concat(t,"px"),this.initialHeight=t):this.initialHeight=this.element.offsetHeight,this.initialWidth>0&&this.initialHeight>0&&(this.aspectRatio=this.initialWidth/this.initialHeight)}},{key:"handleResizeStart",value:function(e,t){e.preventDefault(),e.stopPropagation(),this.isResizing=!0,this.activeHandle=t,!function(e){return"touches"in e}(e)?(this.startX=e.clientX,this.startY=e.clientY):(this.startX=e.touches[0].clientX,this.startY=e.touches[0].clientY),this.startWidth=this.element.offsetWidth,this.startHeight=this.element.offsetHeight,this.startWidth>0&&this.startHeight>0&&(this.aspectRatio=this.startWidth/this.startHeight),this.getPos(),this.container.dataset.resizeState="true",this.classNames.resizing&&this.container.classList.add(this.classNames.resizing),document.addEventListener("mousemove",this.handleMouseMove),document.addEventListener("touchmove",this.handleTouchMove),document.addEventListener("mouseup",this.handleMouseUp),document.addEventListener("keydown",this.handleKeyDown),document.addEventListener("keyup",this.handleKeyUp)}},{key:"handleResize",value:function(e,t){if(this.activeHandle){var n=this.preserveAspectRatio||this.isShiftKeyPressed,r=this.calculateNewDimensions(this.activeHandle,e,t),i=r.width,o=r.height,a=this.applyConstraints(i,o,n);this.element.style.width="".concat(a.width,"px"),this.element.style.height="".concat(a.height,"px"),this.onResize&&this.onResize(a.width,a.height)}}},{key:"calculateNewDimensions",value:function(e,t,n){var r=this.startWidth,i=this.startHeight,o=e.includes("right"),a=e.includes("left"),s=e.includes("bottom"),c=e.includes("top");return o?r=this.startWidth+t:a&&(r=this.startWidth-t),s?i=this.startHeight+n:c&&(i=this.startHeight-n),"right"!==e&&"left"!==e||(r=this.startWidth+(o?t:-t)),"top"!==e&&"bottom"!==e||(i=this.startHeight+(s?n:-n)),this.preserveAspectRatio||this.isShiftKeyPressed?this.applyAspectRatio(r,i,e):{width:r,height:i}}},{key:"applyConstraints",value:function(e,t,n){var r,i,o,a;if(!n){var s=Math.max(this.minSize.width,e),c=Math.max(this.minSize.height,t);return(null==(r=this.maxSize)?void 0:r.width)&&(s=Math.min(this.maxSize.width,s)),(null==(i=this.maxSize)?void 0:i.height)&&(c=Math.min(this.maxSize.height,c)),{width:s,height:c}}var l=e,u=t;return l<this.minSize.width&&(u=(l=this.minSize.width)/this.aspectRatio),u<this.minSize.height&&(l=(u=this.minSize.height)*this.aspectRatio),(null==(o=this.maxSize)?void 0:o.width)&&l>this.maxSize.width&&(u=(l=this.maxSize.width)/this.aspectRatio),(null==(a=this.maxSize)?void 0:a.height)&&u>this.maxSize.height&&(l=(u=this.maxSize.height)*this.aspectRatio),{width:l,height:u}}},{key:"applyAspectRatio",value:function(e,t,n){var r="top"===n||"bottom"===n;return"left"===n||"right"===n?{width:e,height:e/this.aspectRatio}:r?{width:t*this.aspectRatio,height:t}:{width:e,height:e/this.aspectRatio}}}])}();function _f(e){if(!(null==e?void 0:e.trim()))return{};var t={},n=[],r=e.replace(/["']([^"']*)["']/g,function(e){return n.push(e),"__QUOTED_".concat(n.length-1,"__")}),i=r.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(i){var o=i.map(function(e){return e.trim().slice(1)});t.class=o.join(" ")}var a=r.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);a&&(t.id=a[1]);Array.from(r.matchAll(/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g)).forEach(function(e){var r,i=g(e,3),o=i[1],a=i[2],s=parseInt((null==(r=a.match(/__QUOTED_(\d+)__/))?void 0:r[1])||"0",10),c=n[s];c&&(t[o]=c.slice(1,-1))});var s=r.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g,"").replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();s&&s.split(/\s+/).filter(Boolean).forEach(function(e){e.match(/^[a-zA-Z][\w-]*$/)&&(t[e]=!0)});return t}function Mf(e){if(!e||0===Object.keys(e).length)return"";var t=[];e.class&&String(e.class).split(/\s+/).filter(Boolean).forEach(function(e){return t.push(".".concat(e))});return e.id&&t.push("#".concat(e.id)),Object.entries(e).forEach(function(e){var n=g(e,2),r=n[0],i=n[1];"class"!==r&&"id"!==r&&(!0===i?t.push(r):!1!==i&&null!=i&&t.push("".concat(r,'="').concat(String(i),'"')))}),t.join(" ")}function Nf(e){var t=e.nodeName,n=e.name,r=e.parseAttributes,i=void 0===r?_f:r,o=e.serializeAttributes,a=void 0===o?Mf:o,s=e.defaultAttributes,c=void 0===s?{}:s,l=e.requiredAttributes,u=void 0===l?[]:l,d=e.allowedAttributes,f=n||t;return{parseMarkdown:function(e,n){var r=h(h({},c),e.attributes);return n.createNode(t,r,[])},markdownTokenizer:{name:t,level:"block",start:function(e){var t,n=new RegExp("^:::".concat(f,"(?:\\s|$)"),"m"),r=null==(t=e.match(n))?void 0:t.index;return void 0!==r?r:-1},tokenize:function(e,n,r){var o=new RegExp("^:::".concat(f,"(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)")),a=e.match(o);if(a){var s=a[1]||"",c=i(s);if(!u.find(function(e){return!(e in c)}))return{type:t,raw:a[0],attributes:c}}}},renderMarkdown:function(e){var t=function(e){if(!d)return e;var t={};return d.forEach(function(n){n in e&&(t[n]=e[n])}),t}(e.attrs||{}),n=a(t),r=n?" {".concat(n,"}"):"";return":::".concat(f).concat(r," :::")}}}function Tf(e){var t=e.nodeName,n=e.name,r=e.getContent,i=e.parseAttributes,o=void 0===i?_f:i,a=e.serializeAttributes,s=void 0===a?Mf:a,c=e.defaultAttributes,l=void 0===c?{}:c,u=e.content,d=void 0===u?"block":u,f=e.allowedAttributes,p=n||t;return{parseMarkdown:function(e,n){var i;if(r){var o=r(e);i="string"==typeof o?[{type:"text",text:o}]:o}else i="block"===d?n.parseChildren(e.tokens||[]):n.parseInline(e.tokens||[]);var a=h(h({},l),e.attributes);return n.createNode(t,a,i)},markdownTokenizer:{name:t,level:"block",start:function(e){var t,n=new RegExp("^:::".concat(p),"m"),r=null==(t=e.match(n))?void 0:t.index;return void 0!==r?r:-1},tokenize:function(e,n,r){var i,a=new RegExp("^:::".concat(p,"(?:\\s+\\{([^}]*)\\})?\\s*\\n")),s=e.match(a);if(s){var c=g(s,2),l=c[0],u=c[1],h=o(void 0===u?"":u),f=1,v=l.length,m="",y=/^:::([\w-]*)(\s.*)?/gm,k=e.slice(v);for(y.lastIndex=0;;){var w=y.exec(k);if(null===w)break;var b=w.index,x=w[1];if(!(null==(i=w[2])?void 0:i.endsWith(":::")))if(x)f+=1;else if(0===(f-=1)){var C=k.slice(0,b);m=C.trim();var S=e.slice(0,v+b+w[0].length),_=[];if(m)if("block"===d)for((_=r.blockTokens(C)).forEach(function(e){!e.text||e.tokens&&0!==e.tokens.length||(e.tokens=r.inlineTokens(e.text))});_.length>0;){var M=_[_.length-1];if("paragraph"!==M.type||M.text&&""!==M.text.trim())break;_.pop()}else _=r.inlineTokens(m);return{type:t,raw:S,attributes:h,content:m,tokens:_}}}}}},renderMarkdown:function(e,t){var n=function(e){if(!f)return e;var t={};return f.forEach(function(n){n in e&&(t[n]=e[n])}),t}(e.attrs||{}),r=s(n),i=r?" {".concat(r,"}"):"",o=t.renderChildren(e.content||[],"\n\n");return":::".concat(p).concat(i,"\n\n").concat(o,"\n\n:::")}}}function Of(e){if(!e.trim())return{};for(var t={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g,r=n.exec(e);null!==r;){var i=g(r,4),o=i[1],a=i[2],s=i[3];t[o]=a||s,r=n.exec(e)}return t}function Ef(e){return Object.entries(e).filter(function(e){var t=g(e,2)[1];return null!=t}).map(function(e){var t=g(e,2),n=t[0],r=t[1];return"".concat(n,'="').concat(r,'"')}).join(" ")}function Af(e){var t=e.nodeName,n=e.name,r=e.getContent,i=e.parseAttributes,o=void 0===i?Of:i,a=e.serializeAttributes,s=void 0===a?Ef:a,c=e.defaultAttributes,l=void 0===c?{}:c,u=e.selfClosing,d=void 0!==u&&u,f=e.allowedAttributes,p=n||t,v=p.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:function(e,n){var i=h(h({},l),e.attributes);if(d)return n.createNode(t,i);var o=r?r(e):e.content||"";return o?n.createNode(t,i,[n.createTextNode(o)]):n.createNode(t,i,[])},markdownTokenizer:{name:t,level:"inline",start:function(e){var t=d?new RegExp("\\[".concat(v,"\\s*[^\\]]*\\]")):new RegExp("\\[".concat(v,"\\s*[^\\]]*\\][\\s\\S]*?\\[\\/").concat(v,"\\]")),n=e.match(t),r=null==n?void 0:n.index;return void 0!==r?r:-1},tokenize:function(e,n,r){var i=d?new RegExp("^\\[".concat(v,"\\s*([^\\]]*)\\]")):new RegExp("^\\[".concat(v,"\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/").concat(v,"\\]")),a=e.match(i);if(a){var s="",c="";if(d){c=g(a,2)[1]}else{var l=g(a,3);c=l[1],s=l[2]||""}var u=o(c.trim());return{type:t,raw:a[0],content:s.trim(),attributes:u}}}},renderMarkdown:function(e){var t="";r?t=r(e):e.content&&e.content.length>0&&(t=e.content.filter(function(e){return"text"===e.type}).map(function(e){return e.text}).join(""));var n=function(e){if(!f)return e;var t={};return f.forEach(function(n){n in e&&(t[n]=e[n])}),t}(e.attrs||{}),i=s(n),o=i?" ".concat(i):"";return d?"[".concat(p).concat(o,"]"):"[".concat(p).concat(o,"]").concat(t,"[/").concat(p,"]")}}}function Df(e,t,n){for(var r,i,o,a,s,c=e.split("\n"),l=[],u="",d=0,h=t.baseIndentSize||2,f=function(){var e=c[d],s=e.match(t.itemPattern);if(!s)return l.length>0?0:""===e.trim()?(d+=1,u="".concat(u).concat(e,"\n"),1):{v:void 0};var f=t.extractItemData(s),p=f.indentLevel,v=f.mainContent;u="".concat(u).concat(e,"\n");var m,g=[v];for(d+=1;d<c.length;){var y=c[d];if(""===y.trim()){var k=c.slice(d+1).findIndex(function(e){return""!==e.trim()});if(-1===k)break;var w=c[d+1+k];if(((null==(i=null==(r=w.match(/^(\s*)/))?void 0:r[1])?void 0:i.length)||0)>p){g.push(y),u="".concat(u).concat(y,"\n"),d+=1;continue}break}if(!(((null==(a=null==(o=y.match(/^(\s*)/))?void 0:o[1])?void 0:a.length)||0)>p))break;g.push(y),u="".concat(u).concat(y,"\n"),d+=1}var b=g.slice(1);if(b.length>0){var x=b.map(function(e){return e.slice(p+h)}).join("\n");x.trim()&&(m=t.customNestedParser?t.customNestedParser(x):n.blockTokens(x))}var C=t.createToken(f,m);l.push(C)};d<c.length&&0!==(s=f());)if(1!==s&&s)return s.v;if(0!==l.length)return{items:l,raw:u}}function If(e,t,n,r){if(!e||!Array.isArray(e.content))return"";var i="function"==typeof n?n(r):n,o=function(e){return b(e)||l(e)||k(e)||y()}(e.content),a=o[0],s=o.slice(1),c=t.renderChildren([a]),u=["".concat(i).concat(c)];return s&&s.length>0&&s.forEach(function(e){var n=t.renderChildren([e]);if(n){var r=n.split("\n").map(function(e){return e?t.indent(e):""}).join("\n");u.push(r)}}),u.join("\n")}qu({},{createAtomBlockMarkdownSpec:function(){return Nf},createBlockMarkdownSpec:function(){return Tf},createInlineMarkdownSpec:function(){return Af},parseAttributes:function(){return _f},parseIndentedBlocks:function(){return Df},renderNestedMarkdownContent:function(){return If},serializeAttributes:function(){return Mf}});var zf=function(t){function n(){var e;return x(this,n),(e=r(this,n,arguments)).type="node",e}return a(n,t),S(n,[{key:"configure",value:function(t){return e(n,"configure",this,3)([t])}},{key:"extend",value:function(t){var r="function"==typeof t?t():t;return e(n,"extend",this,3)([r])}}],[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new n("function"==typeof e?e():e)}}])}(rf),Rf=zf.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:function(e,t){return e.content?t.renderChildren(e.content,"\n\n"):""}}),Pf=Rf,Lf=zf.create({name:"text",group:"inline",parseMarkdown:function(e){return{type:"text",text:e.text||""}},renderMarkdown:function(e){return e.text||""}}),Bf=zf.create({name:"paragraph",priority:1e3,addOptions:function(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML:function(){return[{tag:"p"}]},renderHTML:function(e){var t=e.HTMLAttributes;return["p",lh(this.options.HTMLAttributes,t),0]},parseMarkdown:function(e,t){var n=e.tokens||[];return 1===n.length&&"image"===n[0].type?t.parseChildren([n[0]]):t.createNode("paragraph",void 0,t.parseInline(n))},renderMarkdown:function(e,t){return e&&Array.isArray(e.content)?t.renderChildren(e.content):""},addCommands:function(){var e=this;return{setParagraph:function(){return function(t){return t.commands.setNode(e.name)}}}},addKeyboardShortcuts:function(){var e=this;return{"Mod-Alt-0":function(){return e.editor.commands.setParagraph()}}}}),Vf=Bf;function Ff(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new Ya({view:function(t){return new jf(t,e)}})}var jf=function(){return S(function e(t,n){var r,i=this;x(this,e),this.editorView=t,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=null!==(r=n.width)&&void 0!==r?r:1,this.color=!1===n.color?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(function(e){var n=function(t){i[e](t)};return t.dom.addEventListener(e,n),{name:e,handler:n}})},[{key:"destroy",value:function(){var e=this;this.handlers.forEach(function(t){var n=t.name,r=t.handler;return e.editorView.dom.removeEventListener(n,r)})}},{key:"update",value:function(e,t){null!=this.cursorPos&&t.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}},{key:"setCursor",value:function(e){e!=this.cursorPos&&(this.cursorPos=e,null==e?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}},{key:"updateOverlay",value:function(){var e,t=this.editorView.state.doc.resolve(this.cursorPos),n=!t.parent.inlineContent,r=this.editorView.dom,i=r.getBoundingClientRect(),o=i.width/r.offsetWidth,a=i.height/r.offsetHeight;if(n){var s=t.nodeBefore,c=t.nodeAfter;if(s||c){var l=this.editorView.nodeDOM(this.cursorPos-(s?s.nodeSize:0));if(l){var u=l.getBoundingClientRect(),d=s?u.bottom:u.top;s&&c&&(d=(d+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);var h=this.width/2*a;e={left:u.left,right:u.right,top:d-h,bottom:d+h}}}}if(!e){var f=this.editorView.coordsAtPos(this.cursorPos),p=this.width/2*o;e={left:f.left-p,right:f.left+p,top:f.top,bottom:f.bottom}}var v,m,g=this.editorView.dom.offsetParent;if(this.element||(this.element=g.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n),!g||g==document.body&&"static"==getComputedStyle(g).position)v=-pageXOffset,m=-pageYOffset;else{var y=g.getBoundingClientRect(),k=y.width/g.offsetWidth,w=y.height/g.offsetHeight;v=y.left-g.scrollLeft*k,m=y.top-g.scrollTop*w}this.element.style.left=(e.left-v)/o+"px",this.element.style.top=(e.top-m)/a+"px",this.element.style.width=(e.right-e.left)/o+"px",this.element.style.height=(e.bottom-e.top)/a+"px"}},{key:"scheduleRemoval",value:function(e){var t=this;clearTimeout(this.timeout),this.timeout=setTimeout(function(){return t.setCursor(null)},e)}},{key:"dragover",value:function(e){if(this.editorView.editable){var t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),n=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),r=n&&n.type.spec.disableDropCursor,i="function"==typeof r?r(this.editorView,t,e):r;if(t&&!i){var o=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){var a=va(this.editorView.state.doc,o,this.editorView.dragging.slice);null!=a&&(o=a)}this.setCursor(o),this.scheduleRemoval(5e3)}}}},{key:"dragend",value:function(){this.scheduleRemoval(20)}},{key:"drop",value:function(){this.scheduleRemoval(20)}},{key:"dragleave",value:function(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}])}(),$f=function(e){function t(e){return x(this,t),r(this,t,[e,e])}return a(t,e),S(t,[{key:"map",value:function(e,n){var r=e.resolve(n.map(this.head));return t.valid(r)?new t(r):Da.near(r)}},{key:"content",value:function(){return Bi.empty}},{key:"eq",value:function(e){return e instanceof t&&e.head==this.head}},{key:"toJSON",value:function(){return{type:"gapcursor",pos:this.head}}},{key:"getBookmark",value:function(){return new Hf(this.anchor)}}],[{key:"fromJSON",value:function(e,n){if("number"!=typeof n.pos)throw new RangeError("Invalid input for GapCursor.fromJSON");return new t(e.resolve(n.pos))}},{key:"valid",value:function(e){var t=e.parent;if(t.isTextblock||!function(e){for(var t=e.depth;t>=0;t--){var n=e.index(t),r=e.node(t);if(0!=n)for(var i=r.child(n-1);;i=i.lastChild){if(0==i.childCount&&!i.inlineContent||Wf(i.type))return!0;if(i.inlineContent)return!1}else if(r.type.spec.isolating)return!0}return!0}(e)||!function(e){for(var t=e.depth;t>=0;t--){var n=e.indexAfter(t),r=e.node(t);if(n!=r.childCount)for(var i=r.child(n);;i=i.firstChild){if(0==i.childCount&&!i.inlineContent||Wf(i.type))return!0;if(i.inlineContent)return!1}else if(r.type.spec.isolating)return!0}return!0}(e))return!1;var n=t.type.spec.allowGapCursor;if(null!=n)return n;var r=t.contentMatchAt(e.index()).defaultType;return r&&r.isTextblock}},{key:"findGapCursorFrom",value:function(e,n){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];e:for(;;){if(!r&&t.valid(e))return e;for(var i=e.pos,o=null,a=e.depth;;a--){var s=e.node(a);if(n>0?e.indexAfter(a)<s.childCount:e.index(a)>0){o=s.child(n>0?e.indexAfter(a):e.index(a)-1);break}if(0==a)return null;i+=n;var c=e.doc.resolve(i);if(t.valid(c))return c}for(;;){var l=n>0?o.firstChild:o.lastChild;if(!l){if(o.isAtom&&!o.isText&&!Ba.isSelectable(o)){e=e.doc.resolve(i+o.nodeSize*n),r=!1;continue e}break}o=l,i+=n;var u=e.doc.resolve(i);if(t.valid(u))return u}return null}}}])}(Da);$f.prototype.visible=!1,$f.findFrom=$f.findGapCursorFrom,Da.jsonID("gapcursor",$f);var Hf=function(){function e(t){x(this,e),this.pos=t}return S(e,[{key:"map",value:function(t){return new e(t.map(this.pos))}},{key:"resolve",value:function(e){var t=e.resolve(this.pos);return $f.valid(t)?new $f(t):Da.near(t)}}])}();function Wf(e){return e.isAtom||e.spec.isolating||e.spec.createGapCursor}var qf=Hu({ArrowLeft:Uf("horiz",-1),ArrowRight:Uf("horiz",1),ArrowUp:Uf("vert",-1),ArrowDown:Uf("vert",1)});function Uf(e,t){var n="vert"==e?t>0?"down":"up":t>0?"right":"left";return function(e,r,i){var o=e.selection,a=t>0?o.$to:o.$from,s=o.empty;if(o instanceof Pa){if(!i.endOfTextblock(n)||0==a.depth)return!1;s=!1,a=e.doc.resolve(t>0?a.after():a.before())}var c=$f.findGapCursorFrom(a,t,s);return!!c&&(r&&r(e.tr.setSelection(new $f(c))),!0)}}function Kf(e,t,n){if(!e||!e.editable)return!1;var r=e.state.doc.resolve(t);if(!$f.valid(r))return!1;var i=e.posAtCoords({left:n.clientX,top:n.clientY});return!(i&&i.inside>-1&&Ba.isSelectable(e.state.doc.nodeAt(i.inside)))&&(e.dispatch(e.state.tr.setSelection(new $f(r))),!0)}function Jf(e,t){if("insertCompositionText"!=t.inputType||!(e.state.selection instanceof $f))return!1;var n=e.state.selection.$from,r=n.parent.contentMatchAt(n.index()).findWrapping(e.state.schema.nodes.text);if(!r)return!1;for(var i=Di.empty,o=r.length-1;o>=0;o--)i=Di.from(r[o].createAndFill(null,i));var a=e.state.tr.replace(n.pos,n.pos,new Bi(i,0,0));return a.setSelection(Pa.near(a.doc.resolve(n.pos+1))),e.dispatch(a),!1}function Gf(e){if(!(e.selection instanceof $f))return null;var t=document.createElement("div");return t.className="ProseMirror-gapcursor",tu.create(e.doc,[Zl.widget(e.selection.head,t,{key:"gapcursor"})])}var Xf=200,Yf=function(){};Yf.prototype.append=function(e){return e.length?(e=Yf.from(e),!this.length&&e||e.length<Xf&&this.leafAppend(e)||this.length<Xf&&e.leafPrepend(this)||this.appendInner(e)):this},Yf.prototype.prepend=function(e){return e.length?Yf.from(e).append(this):this},Yf.prototype.appendInner=function(e){return new Qf(this,e)},Yf.prototype.slice=function(e,t){return void 0===e&&(e=0),void 0===t&&(t=this.length),e>=t?Yf.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},Yf.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},Yf.prototype.forEach=function(e,t,n){void 0===t&&(t=0),void 0===n&&(n=this.length),t<=n?this.forEachInner(e,t,n,0):this.forEachInvertedInner(e,t,n,0)},Yf.prototype.map=function(e,t,n){void 0===t&&(t=0),void 0===n&&(n=this.length);var r=[];return this.forEach(function(t,n){return r.push(e(t,n))},t,n),r},Yf.from=function(e){return e instanceof Yf?e:e&&e.length?new Zf(e):Yf.empty};var Zf=function(e){function t(t){e.call(this),this.values=t}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(e,n){return 0==e&&n==this.length?this:new t(this.values.slice(e,n))},t.prototype.getInner=function(e){return this.values[e]},t.prototype.forEachInner=function(e,t,n,r){for(var i=t;i<n;i++)if(!1===e(this.values[i],r+i))return!1},t.prototype.forEachInvertedInner=function(e,t,n,r){for(var i=t-1;i>=n;i--)if(!1===e(this.values[i],r+i))return!1},t.prototype.leafAppend=function(e){if(this.length+e.length<=Xf)return new t(this.values.concat(e.flatten()))},t.prototype.leafPrepend=function(e){if(this.length+e.length<=Xf)return new t(e.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(t.prototype,n),t}(Yf);Yf.empty=new Zf([]);var Qf=function(e){function t(t,n){e.call(this),this.left=t,this.right=n,this.length=t.length+n.length,this.depth=Math.max(t.depth,n.depth)+1}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.prototype.getInner=function(e){return e<this.left.length?this.left.get(e):this.right.get(e-this.left.length)},t.prototype.forEachInner=function(e,t,n,r){var i=this.left.length;return!(t<i&&!1===this.left.forEachInner(e,t,Math.min(n,i),r))&&(!(n>i&&!1===this.right.forEachInner(e,Math.max(t-i,0),Math.min(this.length,n)-i,r+i))&&void 0)},t.prototype.forEachInvertedInner=function(e,t,n,r){var i=this.left.length;return!(t>i&&!1===this.right.forEachInvertedInner(e,t-i,Math.max(n,i)-i,r+i))&&(!(n<i&&!1===this.left.forEachInvertedInner(e,Math.min(t,i),n,r))&&void 0)},t.prototype.sliceInner=function(e,t){if(0==e&&t==this.length)return this;var n=this.left.length;return t<=n?this.left.slice(e,t):e>=n?this.right.slice(e-n,t-n):this.left.slice(e,n).append(this.right.slice(0,t-n))},t.prototype.leafAppend=function(e){var n=this.right.leafAppend(e);if(n)return new t(this.left,n)},t.prototype.leafPrepend=function(e){var n=this.left.leafPrepend(e);if(n)return new t(n,this.right)},t.prototype.appendInner=function(e){return this.left.depth>=Math.max(this.right.depth,e.depth)+1?new t(this.left,new t(this.right,e)):new t(this,e)},t}(Yf),ep=function(){function e(t,n){x(this,e),this.items=t,this.eventCount=n}return S(e,[{key:"popEvent",value:function(t,n){var r=this;if(0==this.eventCount)return null;for(var i,o,a=this.items.length;;a--){if(this.items.get(a-1).selection){--a;break}}n&&(i=this.remapping(a,this.items.length),o=i.maps.length);var s,c,l=t.tr,u=[],d=[];return this.items.forEach(function(t,n){if(!t.step)return i||(i=r.remapping(a,n+1),o=i.maps.length),o--,void d.push(t);if(i){d.push(new tp(t.map));var h,f=t.step.map(i.slice(o));f&&l.maybeStep(f).doc&&(h=l.mapping.maps[l.mapping.maps.length-1],u.push(new tp(h,void 0,void 0,u.length+d.length))),o--,h&&i.appendMap(h,o)}else l.maybeStep(t.step);return t.selection?(s=i?t.selection.map(i.slice(o)):t.selection,c=new e(r.items.slice(0,a).append(d.reverse().concat(u)),r.eventCount-1),!1):void 0},this.items.length,0),{remaining:c,transform:l,selection:s}}},{key:"addTransform",value:function(t,n,r,i){for(var o=[],a=this.eventCount,s=this.items,c=!i&&s.length?s.get(s.length-1):null,l=0;l<t.steps.length;l++){var u,d=t.steps[l].invert(t.docs[l]),h=new tp(t.mapping.maps[l],d,n);(u=c&&c.merge(h))&&(h=u,l?o.pop():s=s.slice(0,s.length-1)),o.push(h),n&&(a++,n=void 0),i||(c=h)}var f=a-r.depth;return f>rp&&(s=function(e,t){var n;return e.forEach(function(e,r){if(e.selection&&0==t--)return n=r,!1}),e.slice(n)}(s,f),a-=f),new e(s.append(o),a)}},{key:"remapping",value:function(e,t){var n=new Uo;return this.items.forEach(function(t,r){var i=null!=t.mirrorOffset&&r-t.mirrorOffset>=e?n.maps.length-t.mirrorOffset:void 0;n.appendMap(t.map,i)},e,t),n}},{key:"addMaps",value:function(t){return 0==this.eventCount?this:new e(this.items.append(t.map(function(e){return new tp(e)})),this.eventCount)}},{key:"rebased",value:function(t,n){if(!this.eventCount)return this;var r=[],i=Math.max(0,this.items.length-n),o=t.mapping,a=t.steps.length,s=this.eventCount;this.items.forEach(function(e){e.selection&&s--},i);var c=n;this.items.forEach(function(e){var n=o.getMirror(--c);if(null!=n){a=Math.min(a,n);var i=o.maps[n];if(e.step){var l=t.steps[n].invert(t.docs[n]),u=e.selection&&e.selection.map(o.slice(c+1,n));u&&s++,r.push(new tp(i,l,u))}else r.push(new tp(i))}},i);for(var l=[],u=n;u<a;u++)l.push(new tp(o.maps[u]));var d=new e(this.items.slice(0,i).append(l).append(r),s);return d.emptyItemCount()>500&&(d=d.compress(this.items.length-r.length)),d}},{key:"emptyItemCount",value:function(){var e=0;return this.items.forEach(function(t){t.step||e++}),e}},{key:"compress",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.items.length,n=this.remapping(0,t),r=n.maps.length,i=[],o=0;return this.items.forEach(function(e,a){if(a>=t)i.push(e),e.selection&&o++;else if(e.step){var s=e.step.map(n.slice(r)),c=s&&s.getMap();if(r--,c&&n.appendMap(c,r),s){var l=e.selection&&e.selection.map(n.slice(r));l&&o++;var u,d=new tp(c.invert(),s,l),h=i.length-1;(u=i.length&&i[h].merge(d))?i[h]=u:i.push(d)}}else e.map&&r--},this.items.length,0),new e(Yf.from(i.reverse()),o)}}])}();ep.empty=new ep(Yf.empty,0);var tp=function(){function e(t,n,r,i){x(this,e),this.map=t,this.step=n,this.selection=r,this.mirrorOffset=i}return S(e,[{key:"merge",value:function(t){if(this.step&&t.step&&!t.selection){var n=t.step.merge(this.step);if(n)return new e(n.getMap().invert(),n,this.selection)}}}])}(),np=S(function e(t,n,r,i,o){x(this,e),this.done=t,this.undone=n,this.prevRanges=r,this.prevTime=i,this.prevComposition=o}),rp=20;function ip(e){for(var t=[],n=e.length-1;n>=0&&0==t.length;n--)e[n].forEach(function(e,n,r,i){return t.push(r,i)});return t}function op(e,t){if(!e)return null;for(var n=[],r=0;r<e.length;r+=2){var i=t.map(e[r],1),o=t.map(e[r+1],-1);i<=o&&n.push(i,o)}return n}var ap=!1,sp=null;function cp(e){var t=e.plugins;if(sp!=t){ap=!1,sp=t;for(var n=0;n<t.length;n++)if(t[n].spec.historyPreserveItems){ap=!0;break}}return ap}var lp=new es("history"),up=new es("closeHistory");function dp(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},new Ya({key:lp,state:{init:function(){return new np(ep.empty,ep.empty,null,0,-1)},apply:function(t,n,r){return function(e,t,n,r){var i,o=n.getMeta(lp);if(o)return o.historyState;n.getMeta(up)&&(e=new np(e.done,e.undone,null,0,-1));var a=n.getMeta("appendedTransaction");if(0==n.steps.length)return e;if(a&&a.getMeta(lp))return a.getMeta(lp).redo?new np(e.done.addTransform(n,void 0,r,cp(t)),e.undone,ip(n.mapping.maps),e.prevTime,e.prevComposition):new np(e.done,e.undone.addTransform(n,void 0,r,cp(t)),null,e.prevTime,e.prevComposition);if(!1===n.getMeta("addToHistory")||a&&!1===a.getMeta("addToHistory"))return(i=n.getMeta("rebased"))?new np(e.done.rebased(n,i),e.undone.rebased(n,i),op(e.prevRanges,n.mapping),e.prevTime,e.prevComposition):new np(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),op(e.prevRanges,n.mapping),e.prevTime,e.prevComposition);var s=n.getMeta("composition"),c=0==e.prevTime||!a&&e.prevComposition!=s&&(e.prevTime<(n.time||0)-r.newGroupDelay||!function(e,t){if(!t)return!1;if(!e.docChanged)return!0;var n=!1;return e.mapping.maps[0].forEach(function(e,r){for(var i=0;i<t.length;i+=2)e<=t[i+1]&&r>=t[i]&&(n=!0)}),n}(n,e.prevRanges)),l=a?op(e.prevRanges,n.mapping):ip(n.mapping.maps);return new np(e.done.addTransform(n,c?t.selection.getBookmark():void 0,r,cp(t)),ep.empty,l,n.time,null==s?e.prevComposition:s)}(n,r,t,e)}},config:e,props:{handleDOMEvents:{beforeinput:function(e,t){var n=t.inputType,r="historyUndo"==n?fp:"historyRedo"==n?pp:null;return!(!r||!e.editable)&&(t.preventDefault(),r(e.state,e.dispatch))}}}})}function hp(e,t){return function(n,r){var i=lp.getState(n);if(!i||0==(e?i.undone:i.done).eventCount)return!1;if(r){var o=function(e,t,n){var r=cp(t),i=lp.get(t).spec.config,o=(n?e.undone:e.done).popEvent(t,r);if(!o)return null;var a=o.selection.resolve(o.transform.doc),s=(n?e.done:e.undone).addTransform(o.transform,t.selection.getBookmark(),i,r),c=new np(n?s:o.remaining,n?o.remaining:s,null,0,-1);return o.transform.setSelection(a).setMeta(lp,{redo:n,historyState:c})}(i,n,e);o&&r(t?o.scrollIntoView():o)}return!0}}var fp=hp(!1,!0),pp=hp(!0,!0);function vp(e){var t=e.types,n=e.node;return n&&Array.isArray(t)&&t.includes(n.type)||(null==n?void 0:n.type)===t}uf.create({name:"characterCount",addOptions:function(){return{limit:null,mode:"textSize",textCounter:function(e){return e.length},wordCounter:function(e){return e.split(" ").filter(function(e){return""!==e}).length}}},addStorage:function(){return{characters:function(){return 0},words:function(){return 0}}},onBeforeCreate:function(){var e=this;this.storage.characters=function(t){var n=(null==t?void 0:t.node)||e.editor.state.doc;if("textSize"===((null==t?void 0:t.mode)||e.options.mode)){var r=n.textBetween(0,n.content.size,void 0," ");return e.options.textCounter(r)}return n.nodeSize},this.storage.words=function(t){var n=(null==t?void 0:t.node)||e.editor.state.doc,r=n.textBetween(0,n.content.size," "," ");return e.options.wordCounter(r)}},addProseMirrorPlugins:function(){var e=this,t=!1;return[new Ya({key:new es("characterCount"),appendTransaction:function(n,r,i){if(!t){var o=e.options.limit;if(null!=o&&0!==o){var a=e.storage.characters({node:i.doc});if(a>o){var s=a-o;console.warn("[CharacterCount] Initial content exceeded limit of ".concat(o," characters. Content was automatically trimmed."));var c=i.tr.deleteRange(0,s);return t=!0,c}t=!0}else t=!0}},filterTransaction:function(t,n){var r=e.options.limit;if(!t.docChanged||0===r||null==r)return!0;var i=e.storage.characters({node:n.doc}),o=e.storage.characters({node:t.doc});if(o<=r)return!0;if(i>r&&o>r&&o<=i)return!0;if(i>r&&o>r&&o>i)return!1;if(!t.getMeta("paste"))return!1;var a=t.selection.$head.pos,s=a-(o-r),c=a;return t.deleteRange(s,c),!(e.storage.characters({node:t.doc})>r)}})]}}),uf.create({name:"dropCursor",addOptions:function(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins:function(){return[Ff(this.options)]}}),uf.create({name:"focus",addOptions:function(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins:function(){var e=this;return[new Ya({key:new es("focus"),props:{decorations:function(t){var n=t.doc,r=t.selection,i=e.editor,o=i.isEditable,a=i.isFocused,s=r.anchor,c=[];if(!o||!a)return tu.create(n,[]);var l=0;"deepest"===e.options.mode&&n.descendants(function(e,t){if(!e.isText){if(!(s>=t&&s<=t+e.nodeSize-1))return!1;l+=1}});var u=0;return n.descendants(function(t,n){return!t.isText&&(s>=n&&s<=n+t.nodeSize-1&&(u+=1,"deepest"===e.options.mode&&l-u>0||"shallowest"===e.options.mode&&u>1?"deepest"===e.options.mode:void c.push(Zl.node(n,n+t.nodeSize,{class:e.options.className}))))}),tu.create(n,c)}}})]}}),uf.create({name:"gapCursor",addProseMirrorPlugins:function(){return[new Ya({props:{decorations:Gf,createSelectionBetween:function(e,t,n){return t.pos==n.pos&&$f.valid(n)?new $f(n):null},handleClick:Kf,handleKeyDown:qf,handleDOMEvents:{beforeinput:Jf}}})]},extendNodeSchema:function(e){var t;return{allowGapCursor:null!=(t=ah(nh(e,"allowGapCursor",{name:e.name,options:e.options,storage:e.storage})))?t:null}}}),uf.create({name:"placeholder",addOptions:function(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins:function(){var e=this;return[new Ya({key:new es("placeholder"),props:{decorations:function(t){var n=t.doc,r=t.selection,i=e.editor.isEditable||!e.options.showOnlyWhenEditable,o=r.anchor,a=[];if(!i)return null;var s=e.editor.isEmpty;return n.descendants(function(t,n){var r=o>=n&&o<=n+t.nodeSize,i=!t.isLeaf&&_h(t);if((r||!e.options.showOnlyCurrent)&&i){var c=[e.options.emptyNodeClass];s&&c.push(e.options.emptyEditorClass);var l=Zl.node(n,n+t.nodeSize,{class:c.join(" "),"data-placeholder":"function"==typeof e.options.placeholder?e.options.placeholder({editor:e.editor,node:t,pos:n,hasAnchor:r}):e.options.placeholder});a.push(l)}return e.options.includeChildren}),tu.create(n,a)}}})]}}),uf.create({name:"selection",addOptions:function(){return{className:"selection"}},addProseMirrorPlugins:function(){var e=this.editor,t=this.options;return[new Ya({key:new es("selection"),props:{decorations:function(n){return n.selection.empty||e.isFocused||!e.isEditable||n.selection instanceof Ba||e.view.dragging?null:tu.create(n.doc,[Zl.inline(n.selection.from,n.selection.to,{class:t.className})])}}})]}}),uf.create({name:"trailingNode",addOptions:function(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins:function(){var e,t=this,n=new es(this.name),r=this.options.node||(null==(e=this.editor.schema.topNodeType.contentMatch.defaultType)?void 0:e.name)||"paragraph",i=Object.entries(this.editor.schema.nodes).map(function(e){return g(e,2)[1]}).filter(function(e){return(t.options.notAfter||[]).concat(r).includes(e.name)});return[new Ya({key:n,appendTransaction:function(e,t,i){var o=i.doc,a=i.tr,s=i.schema,c=n.getState(i),l=o.content.size,u=s.nodes[r];if(c)return a.insert(l,u.create())},state:{init:function(e,t){return!vp({node:t.tr.doc.lastChild,types:i})},apply:function(e,t){return e.docChanged?e.getMeta("__uniqueIDTransaction")?t:!vp({node:e.doc.lastChild,types:i}):t}}})]}});var mp=uf.create({name:"undoRedo",addOptions:function(){return{depth:100,newGroupDelay:500}},addCommands:function(){return{undo:function(){return function(e){var t=e.state,n=e.dispatch;return fp(t,n)}},redo:function(){return function(e){var t=e.state,n=e.dispatch;return pp(t,n)}}}},addProseMirrorPlugins:function(){return[dp(this.options)]},addKeyboardShortcuts:function(){var e=this;return{"Mod-z":function(){return e.editor.commands.undo()},"Shift-Mod-z":function(){return e.editor.commands.redo()},"Mod-y":function(){return e.editor.commands.redo()},"Mod-я":function(){return e.editor.commands.undo()},"Shift-Mod-я":function(){return e.editor.commands.redo()}}}}),gp=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,yp=zf.create({name:"image",addOptions:function(){return{inline:!1,allowBase64:!1,HTMLAttributes:{},resize:!1}},inline:function(){return this.options.inline},group:function(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes:function(){return{src:{default:null},alt:{default:null},title:{default:null},width:{default:null},height:{default:null}}},parseHTML:function(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML:function(e){var t=e.HTMLAttributes;return["img",lh(this.options.HTMLAttributes,t)]},parseMarkdown:function(e,t){return t.createNode("image",{src:e.href,title:e.title,alt:e.text})},renderMarkdown:function(e){var t,n,r,i,o,a,s=null!=(n=null==(t=e.attrs)?void 0:t.src)?n:"",c=null!=(i=null==(r=e.attrs)?void 0:r.alt)?i:"",l=null!=(a=null==(o=e.attrs)?void 0:o.title)?a:"";return l?".concat(s,' "').concat(l,'")'):".concat(s,")")},addNodeView:function(){var e=this;if(!this.options.resize||!this.options.resize.enabled||"undefined"==typeof document||!this.editor.isEditable)return null;var t=this.options.resize,n=t.directions,r=t.minWidth,i=t.minHeight,o=t.alwaysPreserveAspectRatio;return function(t){var a=t.node,s=t.getPos,c=t.HTMLAttributes,l=document.createElement("img");Object.entries(c).forEach(function(e){var t=g(e,2),n=t[0],r=t[1];if(null!=r)switch(n){case"width":case"height":break;default:l.setAttribute(n,r)}}),l.src=c.src;var u=new Sf({element:l,node:a,getPos:s,onResize:function(e,t){l.style.width="".concat(e,"px"),l.style.height="".concat(t,"px")},onCommit:function(t,n){var r=s();void 0!==r&&e.editor.chain().setNodeSelection(r).updateAttributes(e.name,{width:t,height:n}).run()},onUpdate:function(e,t,n){return e.type===a.type},options:{directions:n,min:{width:r,height:i},preserveAspectRatio:!0===o}}),d=u.dom;return d.style.visibility="hidden",d.style.pointerEvents="none",l.onload=function(){d.style.visibility="",d.style.pointerEvents=""},u}},addCommands:function(){var e=this;return{setImage:function(t){return function(n){return n.commands.insertContent({type:e.name,attrs:t})}}}},addInputRules:function(){return[(e={find:gp,type:this.type,getAttributes:function(e){var t=g(e,5),n=t[2];return{src:t[3],alt:n,title:t[4]}}},new Qh({find:e.find,handler:function(t){var n=t.state,r=t.range,i=t.match,o=ah(e.getAttributes,void 0,i)||{},a=n.tr,s=r.from,c=r.to,l=e.type.create(o);if(i[1]){var u=s+i[0].lastIndexOf(i[1]);u>c?u=c:c=u+i[1].length;var d=i[0][i[0].length-1];a.insertText(d,s+i[0].length-1),a.replaceWith(u,c,l)}else if(i[0]){var h=e.type.isInline?s:s-1;a.insert(h,e.type.create(o)).delete(a.mapping.map(s),a.mapping.map(c))}a.scrollIntoView()},undoable:e.undoable}))];var e}}),kp=uf.create({name:"fileHandler",addOptions:function(){return{onPaste:void 0,onDrop:void 0,allowedMimeTypes:void 0}},addProseMirrorPlugins:function(){return[(e={key:new es(this.name),editor:this.editor,allowedMimeTypes:this.options.allowedMimeTypes,onDrop:this.options.onDrop,onPaste:this.options.onPaste},t=e.key,n=e.editor,r=e.onPaste,i=e.onDrop,o=e.allowedMimeTypes,new Ya({key:t||new es("fileHandler"),props:{handleDrop:function(e,t){var r;if(!i)return!1;if(!(null==(r=t.dataTransfer)?void 0:r.files.length))return!1;var a=e.posAtCoords({left:t.clientX,top:t.clientY}),s=Array.from(t.dataTransfer.files);return o&&(s=s.filter(function(e){return o.includes(e.type)})),0!==s.length&&(t.preventDefault(),t.stopPropagation(),i(n,s,(null==a?void 0:a.pos)||0),!0)},handlePaste:function(e,t){var i;if(!r)return!1;if(!(null==(i=t.clipboardData)?void 0:i.files.length))return!1;var a=Array.from(t.clipboardData.files),s=t.clipboardData.getData("text/html");return o&&(a=a.filter(function(e){return o.includes(e.type)})),0!==a.length&&(t.preventDefault(),t.stopPropagation(),r(n,a,s),!(s.length>0))}}}))];var e,t,n,r,i,o}}),wp=new ve("chat-editor"),bp=function(e){var t=e.c,n=e.value,r=e.disabled,i=e.onCreate,o=e.onChange,a=e.onKeyDown,s=Qe(null),c=Qe(null);return Ye(function(){if(c.current){var e,r,l=window.ibiz.util.file.getUploadHeaders(),u=window.ibiz.util.file.calcFileUpDownUrl(t.context,t.params,{},{enableNoAccess:!0,globalDownloadPrifix:t.opts.uploader.globalDownloadPrifix}),d=u.uploadUrl,h=u.downloadUrl,p=function(){var e=m(f().m(function e(t){var n,r,i,o;return f().w(function(e){for(;;)switch(e.n){case 0:return(n=new FormData).append("file",t),e.n=1,window.ibiz.net.axios({url:d,method:"post",headers:l,data:n});case 1:if(r=e.v,i=r.data){e.n=2;break}return e.a(2,{name:"",url:""});case 2:return o=h.replace("%fileId%",i.fileid),e.a(2,{name:i.name,url:o})}},e)}));return function(t){return e.apply(this,arguments)}}(),v=new Cf({element:c.current,extensions:[Pf,Lf.extend({addKeyboardShortcuts:function(){return{"Mod-Enter":function(){var e,t;return null===(e=s.current)||void 0===e||e.commands.enter(),null===(t=s.current)||void 0===t||t.commands.scrollIntoView(),!0},"Shift-Enter":function(){var e,t;return null===(e=s.current)||void 0===e||e.commands.enter(),null===(t=s.current)||void 0===t||t.commands.scrollIntoView(),!0}}}}),Vf,mp,yp.configure({inline:!0,allowBase64:!0,HTMLAttributes:{draggable:"false"}}).extend({draggable:!1}),kp.configure({onDrop:(r=m(f().m(function e(t,n){var r;return f().w(function(e){for(;;)switch(e.n){case 0:if((n=n.filter(function(e){return e.type.startsWith("image/")})).length){e.n=1;break}return e.a(2);case 1:return e.n=2,Promise.all(n.map(function(e){return p(e)}));case 2:if(r=e.v,!t.isDestroyed){e.n=3;break}return e.a(2);case 3:t.chain().deleteSelection().insertContentAt(t.state.selection.from,r.map(function(e){return{type:"image",attrs:{src:e.url,alt:e.name}}})).focus().scrollIntoView().run();case 4:return e.a(2)}},e)})),function(e,t){return r.apply(this,arguments)}),onPaste:(e=m(f().m(function e(t,n){var r;return f().w(function(e){for(;;)switch(e.n){case 0:if((n=n.filter(function(e){return e.type.startsWith("image/")})).length){e.n=1;break}return e.a(2);case 1:return e.n=2,Promise.all(n.map(function(e){return p(e)}));case 2:if(r=e.v,!t.isDestroyed){e.n=3;break}return e.a(2);case 3:t.chain().deleteSelection().insertContentAt(t.state.selection.from,r.map(function(e){return{type:"image",attrs:{src:e.url,alt:e.name}}})).focus().scrollIntoView().run();case 4:return e.a(2)}},e)})),function(t,n){return e.apply(this,arguments)})})],content:n||"",editorProps:{handleKeyDown:function(e,t){return a(t)}},onUpdate:function(){o(v.getHTML())},onCreate:function(){i(v)}});return s.current=v,function(){s.current&&(s.current.destroy(),s.current=null)}}},[]),fe("div",{className:"".concat(wp.b()," ").concat(r?wp.m("disabled"):""),children:fe("div",{ref:c})})},xp=new ve("chat-agent-setting"),Cp=function(e){var t=e.controller,n=Qe(null),r=Qe(null),i=g(Xe(!1),2),o=i[0],a=i[1];return Ye(function(){var e=function(e){var t,i;e.target&&null!==(t=r.current)&&void 0!==t&&t.contains(e.target)||(null!==(i=n.current)&&void 0!==i&&i.contains(e.target)?a(function(e){return!e}):a(!1))};return document.addEventListener("mousedown",e),function(){document.removeEventListener("mousedown",e)}},[]),fe("div",{className:"".concat(xp.b()," ").concat(e.className?e.className:""),children:[fe("div",{className:xp.e("button"),ref:n,children:fe("span",{title:"召回设置",className:"".concat(xp.em("button","icon")," ").concat(xp.em("button","prefix")),children:fe("svg",{className:"icon",viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor",children:[fe("path",{d:"M512 721.67619c-117.028571 0-209.67619-92.647619-209.67619-209.67619s92.647619-209.67619 209.67619-209.67619 209.67619 92.647619 209.67619 209.67619-92.647619 209.67619-209.67619 209.67619z m0-321.828571c-63.390476 0-112.152381 48.761905-112.152381 112.152381 0 63.390476 48.761905 112.152381 112.152381 112.152381s112.152381-48.761905 112.152381-112.152381c0-63.390476-48.761905-112.152381-112.152381-112.152381z"}),fe("path",{d:"M604.647619 1009.371429l-14.628571-48.761905c-9.752381-34.133333-43.885714-58.514286-78.019048-58.514286s-68.266667 24.380952-78.019048 58.514286l-14.628571 48.761905-48.761905-14.628572C292.571429 975.238095 219.428571 931.352381 160.914286 877.714286l-34.133334-34.133334 34.133334-34.133333c24.380952-29.257143 29.257143-68.266667 9.752381-97.523809-19.504762-34.133333-53.638095-48.761905-92.647619-39.009524l-48.761905 9.752381-9.752381-48.761905c-9.752381-39.009524-14.628571-82.895238-14.628572-121.904762S9.752381 429.104762 19.504762 390.095238l9.752381-48.761905 48.761905 9.752381c34.133333 9.752381 73.142857-4.87619 92.647619-39.009524 19.504762-34.133333 14.628571-73.142857-9.752381-97.523809l-34.133334-34.133333 34.133334-34.133334C219.428571 92.647619 292.571429 48.761905 370.590476 24.380952l48.761905-14.628571 14.628571 43.885714c9.752381 34.133333 43.885714 58.514286 78.019048 58.514286s68.266667-24.380952 78.019048-58.514286l14.628571-43.885714 48.761905 14.628571C731.428571 48.761905 804.571429 92.647619 863.085714 146.285714l34.133334 34.133334-34.133334 34.133333c-24.380952 29.257143-29.257143 68.266667-9.752381 97.523809 19.504762 34.133333 53.638095 48.761905 92.647619 39.009524l48.761905-9.752381 9.752381 48.761905c9.752381 39.009524 14.628571 82.895238 14.628572 121.904762s-4.87619 82.895238-14.628572 121.904762l-9.752381 48.761905-48.761905-9.752381c-34.133333-9.752381-73.142857 4.87619-92.647619 39.009524-19.504762 34.133333-14.628571 73.142857 9.752381 97.523809l34.133334 34.133333-34.133334 34.133334c-58.514286 58.514286-131.657143 97.52381-209.67619 121.904762l-48.761905 9.752381z m-346.209524-175.542858c34.133333 24.380952 68.266667 43.885714 102.4 58.514286 34.133333-48.761905 87.771429-82.895238 151.161905-82.895238s117.028571 34.133333 151.161905 82.895238c34.133333-14.628571 68.266667-34.133333 102.4-58.514286-29.257143-53.638095-29.257143-117.028571 4.87619-170.666666 29.257143-53.638095 87.771429-87.771429 146.285715-87.771429 4.87619-19.504762 4.87619-39.009524 4.87619-58.514286s0-39.009524-4.87619-58.514285c-58.514286-4.87619-117.028571-34.133333-146.285715-87.771429-29.257143-53.638095-34.133333-117.028571-4.87619-170.666666-34.133333-34.133333-68.266667-53.638095-102.4-68.266667-34.133333 48.761905-87.771429 82.895238-151.161905 82.895238s-117.028571-29.257143-151.161905-82.895238c-34.133333 14.628571-68.266667 34.133333-102.4 58.514286 29.257143 53.638095 29.257143 117.028571-4.87619 175.542857-29.257143 53.638095-87.771429 87.771429-146.285715 87.771428-4.87619 19.504762-4.87619 39.009524-4.87619 58.514286s0 39.009524 4.87619 58.514286c58.514286 4.87619 117.028571 34.133333 146.285715 87.771428s34.133333 121.904762 4.87619 175.542857z"})]})})}),o?fe("div",{className:xp.e("dropdown"),ref:r,children:fe("ul",{className:xp.em("dropdown","list"),children:[fe("li",{className:"".concat(xp.em("dropdown","item")," ").concat(xp.is("horizontal",!0)),children:[fe("div",{className:xp.em("dropdown","item-label"),children:"召回重排:"}),fe(Xn,{options:[{label:"禁用",value:0},{label:"启用",value:1},{label:"自动",value:2}],value:t.reCallConfig.value.chunkrerank,onChange:function(e){return t.setAIAgentConfig({chunkrerank:e})},popperStyle:{width:"90px",bottom:"inherit",top:"calc(100% + 4px)"}})]}),fe("li",{className:"".concat(xp.em("dropdown","item")," ").concat(xp.is("horizontal",!0)),children:[fe("div",{className:xp.em("dropdown","item-label"),children:"资料目录召回:"}),fe(Pr,{value:t.reCallConfig.value.chunkpageindex,onChange:function(e){return t.setAIAgentConfig({chunkpageindex:e})}})]}),fe("li",{className:"".concat(xp.em("dropdown","item")," ").concat(xp.is("vertical",!0)),children:[fe("div",{className:xp.em("dropdown","item-label"),children:["最大召回数量: ",t.reCallConfig.value.maxchunks]}),fe(zr,{min:0,max:20,step:1,value:t.reCallConfig.value.maxchunks,onChange:function(e){return t.setAIAgentConfig({maxchunks:e})}})]}),fe("li",{className:"".concat(xp.em("dropdown","item")," ").concat(xp.is("vertical",!0)),children:[fe("div",{className:xp.em("dropdown","item-label"),children:["召回相似度阈值: ",t.reCallConfig.value.chunkthreshold]}),fe(zr,{min:0,max:1,step:.01,value:t.reCallConfig.value.chunkthreshold,onChange:function(e){return t.setAIAgentConfig({chunkthreshold:e})}})]})]})}):null]})},Sp=new ve("chat-input"),_p=window.SpeechRecognition||window.webkitSpeechRecognition,Mp=function(e){var t,n=g(Xe(!1),2),r=n[0],i=n[1];nt(Ip);var o=e.controller.input,a=Lt(!1),s=Qe(),c=Qe(null);_p&&!s.current&&(s.current=new _p,s.current.onstart=function(){a.value=!0},s.current.onend=function(){a.value=!1},s.current.onresult=function(e){var t,n,r=null===(t=e.results)||void 0===t||null===(t=t[0])||void 0===t||null===(t=t[0])||void 0===t?void 0:t.transcript;r&&(null===(n=c.current)||void 0===n||n.commands.insertContent(r))});var l=function(e){var t=(new DOMParser).parseFromString(e,"text/html");var n=Array.from(t.body.childNodes).map(function e(t){if(t.nodeType===Node.TEXT_NODE)return t.textContent||"";if(t.nodeType!==Node.ELEMENT_NODE)return"";var n=t,r=n.tagName.toLowerCase(),i=Array.from(n.childNodes).map(function(t){return e(t)}).join("");switch(r){case"p":return"".concat(i,"\n");case"img":var o=n.getAttribute("src")||"",a=n.getAttribute("alt")||"";return o?"\n.concat(o,")\n"):"";default:return t.textContent||""}}).join("").replace(/\n+/g,"\n").replace(/^\n|\n$/g,"");return n},u=Bt(function(){return l(o.value).length<=0}),d=tt(m(f().m(function t(){var n,r,i;return f().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,r=l(o.value),o.value="",null===(n=c.current)||void 0===n||n.chain().clearContent().run(),t.n=1,e.controller.question(r);case 1:t.n=3;break;case 2:t.p=2,i=t.v,console.error(i);case 3:return t.p=3,setTimeout(function(){c.current&&!c.current.isDestroyed&&c.current.chain().focus().run()},100),t.f(3);case 4:return t.a(2)}},t,null,[[0,2,3,4]])})),[o]),h=tt(m(f().m(function t(){return f().w(function(t){for(;;)switch(t.n){case 0:try{e.controller.abortQuestion()}catch(n){console.error(n)}case 1:return t.a(2)}},t)})),[o]),p=function(){var t=m(f().m(function t(n){var r;return f().w(function(t){for(;;)switch(t.n){case 0:return r=Si.getMaterialHelper("ossfile",e.controller),t.n=1,r.excuteAction(n);case 1:i(!1);case 2:return t.a(2)}},t)}));return function(e){return t.apply(this,arguments)}}(),v=function(){var t=m(f().m(function t(n,r){var o;return f().w(function(t){for(;;)switch(t.n){case 0:return o=Si.getMaterialHelper("common",e.controller),t.n=1,o.excuteAction(n,r);case 1:i(!1);case 2:return t.a(2)}},t)}));return function(e,n){return t.apply(this,arguments)}}(),y=function(){var t=m(f().m(function t(n){var r;return f().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,e.controller.searchAIAgent(n);case 1:return r=t.v,t.a(2,r)}},t)}));return function(e){return t.apply(this,arguments)}}();return fe("div",{className:Sp.b("wrapper"),children:[fe("div",{className:Sp.b("material-wrapper"),children:fe(Ni,{controller:e.controller})}),fe("div",{className:Sp.b("main-wrapper"),children:[fe(bp,{c:e.controller,value:o.value,disabled:e.controller.isLoading.value,onCreate:function(e){c.current=e},onChange:function(e){o.value=e},onKeyDown:function(e){if("Enter"===e.code&&!e.isComposing&&!1===e.shiftKey)return d(),!0}}),fe("div",{className:Sp.b("action-wrapper"),children:[fe("div",{className:Sp.b("left-action-wrapper"),children:[fe(Xn,{showBorder:!1,enableSearch:!0,placeholder:"Auto",popperStyle:{height:"220px"},value:e.controller.activeAIAgentID,options:e.controller.agentList.value,icon:function(){return fe("div",{title:"智能体",children:fe("svg",{className:"icon",viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",stroke:"currentColor",width:"1em",height:"1em",children:fe("path",{d:"M497.0496 55.7056a38.4 38.4 0 0 1 38.912 0l362.7008 213.2992c11.776 6.912 18.944 19.456 18.944 33.1264v426.6496a38.4 38.4 0 0 1-18.944 33.0752l-362.6496 213.3504a38.4 38.4 0 0 1-38.912 0L134.3488 761.856a38.4 38.4 0 0 1-18.944-33.0752V302.1312a38.4 38.4 0 0 1 18.944-33.1264z m19.456 77.6192L192.3072 324.096v382.72l324.3008 190.7712 324.2496-190.7712V324.096l-324.2496-190.7712zM345.9584 370.3296c7.68 0 14.848 2.2528 20.8384 6.144l149.6576 93.696 149.8624-93.696a38.4512 38.4512 0 0 1 49.1008 58.2656l-1.792 1.792a38.6048 38.6048 0 0 1-6.656 5.12l-152.0128 94.976v170.4448a38.4 38.4 0 0 1-0.1536 3.7376l-0.512 3.7376a38.0928 38.0928 0 0 1-23.04 27.9552 38.0928 38.0928 0 0 1-35.9936-3.5328 38.1952 38.1952 0 0 1-17.0496-31.8976v-170.2912l-152.064-95.1296a38.4 38.4 0 0 1 19.7632-71.3216z"})})})},disabled:!e.controller.enableAIAgentChange,onSearch:y,onChange:function(t){return n=t,void e.controller.setActiveAIAgentID(n);var n}}),e.controller.enableKnowledgeBaseSelect.value&&fe(Zn,{className:"".concat(Sp.b("setting-wrapper")," ").concat(Sp.is("disabled",!e.controller.enableKnowledgeBaseState.value)),enableSearch:!0,popperStyle:{height:"220px"},options:e.controller.knowledgeBases.value,icon:function(){return fe("div",{title:"知识库",children:Tn})},placeholder:"知识库搜索",value:e.controller.selectionKnowledgeBases.value,onChange:function(t){e.controller.setSelectionKnowledge(t)},onEnableChange:function(){e.controller.switchKnowledgeEnableState()}}),e.controller.enableRecallConfigSetting.value&&e.controller.agentList.value.length>0?fe(Cp,{controller:e.controller}):null]}),fe("div",{className:Sp.b("right-action-wrapper"),children:[fe("div",{className:"".concat(Sp.be("right-action-wrapper","action-item")," ").concat(Sp.is("disabled",e.controller.isLoading.value)),title:"上传资料",children:fe(Ti,{triggerMode:"hover",content:fe("div",{className:Sp.b("pop-actions"),children:[fe("div",{className:Sp.b("pop-action-item"),onClick:function(e){p(e)},children:[fe("span",{className:Sp.b("pop-action-item-icon"),children:fe(sn,{})}),fe("span",{className:Sp.b("pop-action-item-title"),children:"文件资料"})]}),null===(t=e.questionToolbarItems)||void 0===t?void 0:t.map(function(e){var t,n,r;return fe("div",{className:Sp.b("pop-action-item"),onClick:function(t){v(t,e)},children:[fe("span",{className:Sp.b("pop-action-item-icon"),children:"function"==typeof e.icon?e.icon():(null===(t=e.icon)||void 0===t?void 0:t.showIcon)&&fe(W,{children:null!==(n=e.icon)&&void 0!==n&&n.cssClass?fe("i",{className:e.icon.cssClass}):null!==(r=e.icon)&&void 0!==r&&r.imagePath?Ce(e.icon.imagePath)?fe("div",{dangerouslySetInnerHTML:{__html:e.icon.imagePath}}):fe("img",{src:e.icon.imagePath}):null})}),fe("span",{className:Sp.b("pop-action-item-title"),children:e.label})]},e.id)})]}),position:"top-left",isOpen:r,onToggleOpen:i,children:fe(an,{})})}),fe("div",{title:a.value?"语音输入中...":"语音输入",className:"".concat(Sp.be("right-action-wrapper","action-item")," ").concat(Sp.is("disabled",e.controller.isLoading.value)),onClick:function(){s.current&&!a.value&&s.current.start()},children:a.value?fe(Yt,{}):fe(Xt,{})}),e.controller.isLoading.value?fe("div",{title:"停止生成",className:"".concat(Sp.be("right-action-wrapper","action-item")),onClick:h,children:fe(un,{})}):fe("div",{title:"发送消息",className:"".concat(Sp.be("right-action-wrapper","action-item")," ").concat(Sp.is("disabled",u.value)),onClick:d,children:fe(jt,{})})]})]})]})]})},Np=new ve("chat-topic-item"),Tp=function(e){var t=e.controller,n=e.topic,r=e.onClick,i=e.onAction,o=Qe(null),a=Bt(function(){var e;return(null===(e=t.activedTopic.value)||void 0===e?void 0:e.id)===n.id}),s=g(Xe(!1),2),c=s[0],l=s[1],u=Lt(!1);return fe("div",{className:"".concat(Np.b()," ").concat(Np.is("active",a.value)," ").concat(Np.is("edit",u.value)),onClick:r.bind(void 0),children:[fe("div",{className:Np.e("caption"),title:n.caption,children:u.value?fe("input",{ref:o,value:n.caption,onBlur:function(e){e.stopPropagation(),u.value=!1,i("RENAME",e)},onKeyDown:function(e){e.stopPropagation(),"Enter"===e.key&&(u.value=!1)},onClick:function(e){return e.stopPropagation()},onChange:function(e){return(t=e).stopPropagation(),void(n.data.caption=null===(r=t.target)||void 0===r?void 0:r.value);var t,r},className:Np.em("caption","editor")}):fe("div",{className:Np.em("caption","readonly"),children:[fe("span",{className:Np.em("caption","text"),children:n.caption}),n.isTop?fe("span",{className:Np.em("caption","icon"),children:fe(wn,{})}):null]})}),!u.value&&fe("div",{className:Np.e("icon"),children:[fe("span",{title:"跳转主视图",className:Np.em("icon","item"),onClick:function(e){e.stopPropagation(),i("LINK",e)}.bind(void 0),children:fe(Qt,{className:Np.b("link-icon")})}),a.value?null:fe(Ti,{triggerMode:"click",actions:[{id:"PINNED",caption:n.isTop?"取消置顶":"置顶",icon:n.isTop?fe(bn,{}):fe(wn,{})},{id:"RENAME",caption:"重命名",icon:fe(pn,{})},{id:"DELETE",caption:"删除话题",icon:fe(en,{})}],position:"bottom",isOpen:c,onToggleOpen:l,onAction:function(e,t){"RENAME"===e?(u.value=!0,setTimeout(function(){var e;null===(e=o.current)||void 0===e||e.focus()},100)):i(e,t),l(!1)}.bind(void 0),children:fe("span",{className:Np.em("icon","item"),title:"更多",children:fe(Zt,{className:Np.e("more-icon")})})})]})]})},Op=new ve("chat-topics"),Ep=function(e){var t=Qe(null),n=Lt(void 0),r=Lt([]);Ye(function(){var t=c(e.controller.topics.value).sort(function(e,t){return e.isTop!==t.isTop?t.isTop?1:-1:e.sequence-t.sequence});r.value=t.filter(function(e){var t,r;return null===(t=e.caption)||void 0===t?void 0:t.toLowerCase().includes((null===(r=n.value)||void 0===r?void 0:r.trim().toLowerCase())||"")})},[e.controller.topics.value]);Ye(function(){var e=t.current;if(e){var n=e.querySelector(".ibiz-chat-topic-item.is-active");null==n||n.scrollIntoView({behavior:"smooth",block:"nearest"})}},[e.controller.activedTopic.value]);var i=function(){e.controller.switchTopicSidebarCollapse()},o=function(t){if(t)e.controller.enterTempChat();else{e.controller.exitTempChat();var n=e.controller.preActivedTopic;if(n||(n=e.controller.topics.value[0]),!n)return;e.controller.handleTopicChange(n)}};return fe("div",{className:Op.b(),children:!0===e.controller.topicSidebarCollapse.value?fe("div",{className:Op.e("collapse-container"),children:[fe("div",{className:Op.e("icon-item"),title:"打开侧栏",onClick:function(){return i()},children:fe(In,{})}),!1===e.controller.isTempChat.value?fe("div",{className:Op.e("icon-item"),title:"进入临时会话",onClick:function(){return o(!0)},children:fe(zn,{})}):fe("div",{className:Op.e("icon-item"),title:"退出临时会话",onClick:function(){return o(!1)},children:fe(Rn,{})})]}):fe(W,{children:[fe("div",{className:Op.e("header"),children:[fe("div",{className:Op.e("icon-container"),children:[fe("div",{className:Op.e("icon-item"),title:"收起侧栏",onClick:function(){return i()},children:fe(In,{})}),fe("div",{className:Op.e("icon-item"),title:"新建对话",onClick:function(){e.controller.globalNewTopic()},children:fe(Gt,{})}),!1===e.controller.isTempChat.value?fe("div",{className:Op.e("icon-item"),title:"进入临时会话",onClick:function(){return o(!0)},children:fe(zn,{})}):fe("div",{className:Op.e("icon-item"),title:"退出临时会话",onClick:function(){return o(!1)},children:fe(Rn,{})})]}),fe(Un,{value:n.value,placeholder:"搜索话题",onChange:function(t){n.value=t,r.value=e.controller.topics.value.filter(function(e){var t,r;return null===(t=e.caption)||void 0===t?void 0:t.toLowerCase().includes((null===(r=n.value)||void 0===r?void 0:r.trim().toLowerCase())||"")})}.bind(void 0)})]}),fe("div",{ref:t,className:Op.e("main"),children:r.value&&r.value.length>0?r.value.map(function(t){return!1===t.isShow?null:fe(Tp,{topic:t,controller:e.controller,onClick:function(){return function(t){e.controller.isTempChat.value&&e.controller.exitTempChat(),e.controller.handleTopicChange(t)}(t)},onAction:function(n,r){return function(t,n,r){e.controller.handleTopicAction(t,n,r)}(n,t,r)}},t.id)}):fe("div",{className:Op.e("empty"),children:"暂无话题"})}),fe("div",{className:Op.e("footer"),children:fe("div",{title:"清空会话",className:Op.e("action"),onClick:function(){return e.controller.clearTopic()},children:[fe(en,{}),fe("span",{children:"清空会话"})]})})]})})},Ap=new ve("chat-minimize"),Dp=function(e){var t=Qe(null),n=g(Xe(""),2),r=n[0],i=n[1],o=g(Xe(0),2),a=o[0],s=o[1],c=Qe(!1),l={x:(window.innerWidth-86)/window.innerWidth,y:(window.innerHeight-86)/window.innerHeight},u=Bt(function(){var t=e.controller.messages.value[e.controller.messages.value.length-1];return!!t&&("ASSISTANT"===t.role&&20===t.state&&!0!==t.completed)}),d=Bt(function(){var t="";if(!u.value)return i(""),s(0),t;var n=e.controller.messages.value[e.controller.messages.value.length-1];if(t=n.content,-1!==n.content.indexOf("<think>")){var r=function(e){var t=e.indexOf("<think>"),n=e.indexOf("</think>"),r="",i="";return-1===n?(r=e.slice(t+7),i=""):(r=e.slice(t+7,n),i=e.slice(n+8)),{thoughtContent:r,answerContent:i}}(n.content);t=r.thoughtContent+r.answerContent}return t}),h=function(){Object.assign(t.current.style,{left:"".concat(100*l.x,"%"),top:"".concat(100*l.y,"%")}),localStorage.setItem(vi.MINIMIZE_STYLY_CHCHE,JSON.stringify(l))};return Ye(function(){var e,n=localStorage.getItem(vi.MINIMIZE_STYLY_CHCHE);if(n){var r=JSON.parse(n);Ae(r)&&Object.assign(l,r)}h(),(e=t.current)&&(e.onmousedown=function(t){document.body.style.userSelect="none";var n=t.clientX-e.offsetLeft,r=t.clientY-e.offsetTop,i=Date.now(),o=function(e){var t=56/window.innerWidth,i=56/window.innerHeight,o=De(e.clientX-n,e.clientY-r,t,i),a=o.x,s=o.y;Object.assign(l,{x:a,y:s}),requestAnimationFrame(function(){h()})},a=function(){var e=Date.now();c.current=e-i>300,document.body.style.userSelect="",document.removeEventListener("mousemove",o),document.removeEventListener("mouseup",a)};document.addEventListener("mousemove",o),document.addEventListener("mouseup",a)})},[]),Ye(function(){if(a<d.value.length){var e=setTimeout(function(){i(function(e){return e+d.value[a]}),s(function(e){return e+1})},100);return function(){return clearTimeout(e)}}},[a,d.value]),fe("div",{ref:t,title:e.title,className:"".concat(Ap.b()," ").concat(Ap.is("hidden",!e.isMinimize)," ").concat(Ap.is("show-halo",u.value)),onClick:function(){c.current||e.onClick()},children:fe("div",{className:"".concat(Ap.e("content")," ").concat(Ap.is("show-border",!u.value)),children:[r&&fe("div",{className:"".concat(Ap.em("content","popover")),children:fe("div",{className:"typewriter",children:r})}),fe(Jt,{})]})})},Ip=function(e){function t(e){var n,r;return this.getChildContext||(n=new Set,(r={})[t.__c]=this,this.getChildContext=function(){return r},this.componentWillUnmount=function(){n=null},this.shouldComponentUpdate=function(e){this.props.value!=e.value&&n.forEach(function(e){e.__e=!0,J(e)})},this.sub=function(e){n.add(e);var t=e.componentWillUnmount;e.componentWillUnmount=function(){n&&n.delete(e),t&&t.call(e)}}),e.children}return t.__c="__cC"+R++,t.__=e,t.Provider=t.__l=(t.Consumer=function(e,t){return e.children(t)}).contextType=t,t}({zIndex:10,enableBackFill:!0}),zp=function(e){function t(e){var n,i,o,a,s,c,l;return x(this,t),_(l=r(this,t,[e]),"ns",new ve("chat-container")),_(l,"containerRef",{current:null}),_(l,"dragHandle",{current:null}),_(l,"data",{side:{y:0,height:1,width:750/window.innerWidth,x:(window.innerWidth-750)/window.innerWidth},window:{y:0,width:750/window.innerWidth,height:750/window.innerHeight,x:(window.innerWidth-750)/window.innerWidth},minWidth:500,minHeight:300,showMode:"side"}),_(l,"disabled",!1),_(l,"isDragging",!1),_(l,"containerContext",{zIndex:(null===(n=l.props.containerOptions)||void 0===n?void 0:n.zIndex)||10,enableBackFill:void 0===(null===(i=l.props)||void 0===i?void 0:i.enableBackFill)||null===(null===(o=l.props)||void 0===o?void 0:o.enableBackFill)||(null===(a=l.props)||void 0===a?void 0:a.enableBackFill)}),l.state={isFullScreen:!1,isMinimize:!("minimize"!==(null==e?void 0:e.openMode)&&"autoexpand"!==(null==e?void 0:e.openMode)),enableAIMinimize:!0===(null==e||null===(s=e.containerOptions)||void 0===s?void 0:s.enableAIMinimize)},null==e||null===(c=e.aiChat)||void 0===c||c.evt.on("onCompleteMessage",function(){if(e.autoClose){var t=e.autoClose,n=t.mode,r=t.duration,i=void 0===r?3:r;switch(n){case"minimize":l.minimize();break;case"close":l.close();break;case"closetime":setTimeout(function(){l.close()},1e3*i)}}"autoexpand"===e.openMode&&l.exitMinimize()}),l}return a(t,e),S(t,[{key:"calcWindowStyle",value:function(){var e,t="window"===this.data.showMode?this.data.window:this.data.side;return{left:"".concat(100*t.x,"%"),top:"".concat(100*t.y,"%"),width:"".concat(100*t.width,"%"),height:"".concat(100*t.height,"%"),minWidth:"".concat(this.data.minWidth,"px"),minHeight:"".concat(this.data.minHeight,"px"),"z-index":(null===(e=this.props.containerOptions)||void 0===e||null===(e=e.zIndex)||void 0===e?void 0:e.toString())||"10"}}},{key:"calcSideModeStyle",value:function(e){Object.assign(this.data,{side:{y:0,x:"left"===e?0:(window.innerWidth-750)/window.innerWidth,height:1,width:750/window.innerWidth},showMode:"side"})}},{key:"setStyle",value:function(){Object.assign(this.containerRef.current.style,this.calcWindowStyle()),localStorage.setItem(vi.STYLE_CACHE,JSON.stringify(this.data))}},{key:"snapToEdge",value:function(){var e=20/window.innerWidth,t=20/window.innerHeight,n=this.data.window,r=n.x,i=n.y,o=n.width,a=n.height;r<e||r+o>1-e?this.calcSideModeStyle(r<e?"left":"right"):(i<t&&(this.data.window.y=0),i+a>1-t&&(this.data.window.y=1-a)),this.setStyle()}},{key:"registerDragDialog",value:function(){var e=this;this.dragHandle.current.onmousedown=function(t){if(!e.state.isFullScreen){document.body.style.userSelect="none";var n=t.clientX-e.containerRef.current.offsetLeft,r=t.clientY-e.containerRef.current.offsetTop,i=function(t){if(!e.disabled){e.data.showMode="window";var i=De(t.clientX-n,t.clientY-r,e.data.window.width,e.data.window.height),o=i.x,a=i.y;Object.assign(e.data.window,{x:o,y:a}),e.setStyle()}},o=function(){document.body.style.userSelect="",document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",o),e.disabled||e.snapToEdge()};document.addEventListener("mousemove",i),document.addEventListener("mouseup",o)}}}},{key:"registerDragDialogBorder",value:function(){var e=this;o(this.containerRef.current).resizable({edges:{top:!0,right:!0,bottom:!0,left:!0},margin:6,modifiers:[o.modifiers.restrictEdges({outer:document.body}),o.modifiers.restrictSize({min:{width:this.data.minWidth,height:this.data.minHeight}})],inertia:!0,listeners:{move:function(t){if(!e.state.isFullScreen){var n="side"===e.data.showMode?e.data.side:e.data.window;n.x=t.rect.left/window.innerWidth,n.y=t.rect.top/window.innerHeight,n.width=t.rect.width/window.innerWidth,n.height=t.rect.height/window.innerHeight,e.setStyle()}},start:function(){e.disabled=!0,document.body.style.userSelect="none"},end:function(){e.disabled=!1,document.body.style.userSelect=""}}})}},{key:"handleFullScreenChange",value:function(){this.setState({isFullScreen:null!==document.fullscreenElement})}},{key:"componentDidMount",value:function(){this.handleFullScreenChange=this.handleFullScreenChange.bind(this);var e=localStorage.getItem(vi.STYLE_CACHE);if(e){var t=JSON.parse(e);t.side&&Ae(t.side)&&t.window&&Ae(t.window)&&Object.assign(this.data,t)}this.setStyle(),this.registerDragDialog(),this.registerDragDialogBorder(),document.addEventListener("fullscreenchange",this.handleFullScreenChange)}},{key:"componentWillUnmount",value:function(){document.removeEventListener("fullscreenchange",this.handleFullScreenChange)}},{key:"close",value:function(){this.props.close()}},{key:"fullScreen",value:function(){var e=this.containerRef.current;e&&(e.requestFullscreen(),this.props.fullscreen(!0))}},{key:"closeFullScreen",value:function(){var e;this.state.isFullScreen&&(null===(e=document)||void 0===e||e.exitFullscreen(),this.props.fullscreen(!1),this.setStyle())}},{key:"minimize",value:function(){this.closeFullScreen(),this.setState({isMinimize:!0}),this.props.minimize(!0)}},{key:"exitMinimize",value:function(){this.setState({isMinimize:!1}),this.props.minimize(!1)}},{key:"stopPropagation",value:function(e){e.stopPropagation()}},{key:"render",value:function(){return fe(Ip.Provider,{value:this.containerContext,children:fe("div",{className:"".concat(this.ns.b()),children:[fe("div",{className:"".concat(this.ns.e("dialog")," ").concat(this.ns.is("full-screen",this.state.isFullScreen)," ").concat(this.ns.is("hidden",this.state.isMinimize)),ref:this.containerRef,children:[fe("div",{ref:this.dragHandle,className:this.ns.b("header"),children:[fe("div",{className:this.ns.b("header-caption"),children:this.props.caption||"AI助手"}),fe("div",{className:this.ns.b("header-action-wrapper"),children:[this.state.enableAIMinimize&&fe("div",{title:"最小化",className:"".concat(this.ns.be("header-action-wrapper","action-item")," ").concat(this.ns.be("header-action-wrapper","minimize")),onMouseDown:this.stopPropagation.bind(this),onClick:this.minimize.bind(this),children:fe(Kt,{})}),this.state.isFullScreen?fe("div",{title:"退出全屏",className:"".concat(this.ns.be("header-action-wrapper","action-item")," ").concat(this.ns.be("header-action-wrapper","close-full-screen")),onMouseDown:this.stopPropagation.bind(this),onClick:this.closeFullScreen.bind(this),children:fe(Ut,{})}):fe("div",{title:"全屏",className:"".concat(this.ns.be("header-action-wrapper","action-item")," ").concat(this.ns.be("header-action-wrapper","full-screen")),onMouseDown:this.stopPropagation.bind(this),onClick:this.fullScreen.bind(this),children:fe(qt,{})}),fe("div",{title:"关闭",className:"".concat(this.ns.be("header-action-wrapper","action-item")," ").concat(this.ns.be("header-action-wrapper","action-close")),onMouseDown:this.stopPropagation.bind(this),onClick:this.close.bind(this),children:fe(Vt,{})})]})]}),this.props.isLoading?fe("div",{className:"".concat(this.ns.be("main","loading")),children:[fe("div",{className:"".concat(this.ns.be("main","spinner"))}),fe("div",{className:"".concat(this.ns.be("main","text")),children:"正在加载..."})]}):"TOPIC"===this.props.mode?fe("div",{className:"".concat(this.ns.b("main")),children:[!this.props.hideTopicSidebar&&fe("div",{className:"".concat(this.ns.be("main","left")),style:{width:"".concat(this.props.aiTopic.topicSidebarWidth.value,"px")},children:fe(Ep,{controller:this.props.aiTopic})}),fe("div",{className:"".concat(this.ns.be("main","right")),style:{width:this.props.hideTopicSidebar?"100%":"calc(100% - ".concat(this.props.aiTopic.topicSidebarWidth.value,"px)")},children:[fe("div",{className:this.ns.b("content"),children:fe(pi,{controller:this.props.aiChat,toolbarItems:this.props.contentToolbarItems})}),fe(di,{type:"footer",mode:this.props.mode,hideTopicSidebar:this.props.hideTopicSidebar,data:this.props.aiTopic.activedTopic.value,className:"".concat(this.ns.e("toolbar")," ").concat(this.ns.is("has-materials",this.props.aiChat.materials.value.length>0)),controller:this.props.aiChat,items:this.props.footerToolbarItems}),fe("div",{className:this.ns.b("footer"),children:fe(Mp,{controller:this.props.aiChat,questionToolbarItems:this.props.questionToolbarItems})})]})]}):fe("div",{className:"".concat(this.ns.be("main","default")),children:[fe("div",{className:this.ns.b("content"),children:fe(pi,{controller:this.props.aiChat,toolbarItems:this.props.contentToolbarItems})}),fe(di,{type:"footer",mode:this.props.mode,hideTopicSidebar:this.props.hideTopicSidebar,data:this.props.aiTopic.activedTopic.value,className:"".concat(this.ns.e("toolbar")," ").concat(this.ns.is("has-materials",this.props.aiChat.materials.value.length>0)),controller:this.props.aiChat,items:this.props.footerToolbarItems}),fe("div",{className:this.ns.b("footer"),children:fe(Mp,{controller:this.props.aiChat,questionToolbarItems:this.props.questionToolbarItems})})]})]}),!this.props.isLoading&&fe(Dp,{title:this.props.caption||"AI助手",controller:this.props.aiChat,isMinimize:this.state.isMinimize,onClick:this.exitMinimize.bind(this)})]})})}}])}(q);t("ChatContainer",zp)}}})}();
|