@wangeditor-next/plugin-formula 0.0.11 → 0.0.12-beta.0

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.js CHANGED
@@ -1,2 +1,2578 @@
1
- !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("katex"),require("@wangeditor-next/editor"),require("snabbdom")):"function"==typeof define&&define.amd?define(["katex","@wangeditor-next/editor","snabbdom"],e):(t="undefined"!=typeof globalThis?globalThis:t||self).WangEditorFormulaPlugin=e(t.katex,t.editor,t.snabbdom)}(this,(function(t,e,n){"use strict";var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},r(t,e)};function i(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,i,o=n.call(t),u=[];try{for(;(void 0===e||e-- >0)&&!(r=o.next()).done;)u.push(r.value)}catch(t){i={error:t}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return u}"function"==typeof SuppressedError&&SuppressedError;var o="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function u(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var a,f,c={};function s(){if(f)return a;f=1;var t=function(t){return t&&t.Math===Math&&t};return a=t("object"==typeof globalThis&&globalThis)||t("object"==typeof window&&window)||t("object"==typeof self&&self)||t("object"==typeof o&&o)||t("object"==typeof a&&a)||function(){return this}()||Function("return this")()}var l,h,p,d,v,m,g,y,b,w,E,x,S,O,A,T,L,j,M,P,I,C,N,D,_,k,F,R,W,V,H,q,B,z,$,U,G,X={exports:{}};function K(){if(d)return p;d=1;var t=s(),e=Object.defineProperty;return p=function(n,r){try{e(t,n,{value:r,configurable:!0,writable:!0})}catch(e){t[n]=r}return r}}function Y(){if(v)return X.exports;v=1;var t=h?l:(h=1,l=!1),e=s(),n=K(),r="__core-js_shared__",i=X.exports=e[r]||n(r,{});return(i.versions||(i.versions=[])).push({version:"3.38.1",mode:t?"pure":"global",copyright:"© 2014-2024 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.38.1/LICENSE",source:"https://github.com/zloirock/core-js"}),X.exports}function J(){if(g)return m;g=1;var t=Y();return m=function(e,n){return t[e]||(t[e]=n||{})}}function Q(){return b?y:(b=1,y=function(t){try{return!!t()}catch(t){return!0}})}function Z(){if(E)return w;E=1;var t=Q();return w=!t((function(){var t=function(){}.bind();return"function"!=typeof t||t.hasOwnProperty("prototype")}))}function tt(){if(S)return x;S=1;var t=Z(),e=Function.prototype,n=e.call,r=t&&e.bind.bind(n,n);return x=t?r:function(t){return function(){return n.apply(t,arguments)}},x}function et(){return A?O:(A=1,O=function(t){return null==t})}function nt(){if(L)return T;L=1;var t=et(),e=TypeError;return T=function(n){if(t(n))throw new e("Can't call method on "+n);return n}}function rt(){if(M)return j;M=1;var t=nt(),e=Object;return j=function(n){return e(t(n))}}function it(){if(I)return P;I=1;var t=tt(),e=rt(),n=t({}.hasOwnProperty);return P=Object.hasOwn||function(t,r){return n(e(t),r)}}function ot(){if(N)return C;N=1;var t=tt(),e=0,n=Math.random(),r=t(1..toString);return C=function(t){return"Symbol("+(void 0===t?"":t)+")_"+r(++e+n,36)}}function ut(){if(F)return k;F=1;var t,e,n=s(),r=function(){if(_)return D;_=1;var t=s().navigator,e=t&&t.userAgent;return D=e?String(e):""}(),i=n.process,o=n.Deno,u=i&&i.versions||o&&o.version,a=u&&u.v8;return a&&(e=(t=a.split("."))[0]>0&&t[0]<4?1:+(t[0]+t[1])),!e&&r&&(!(t=r.match(/Edge\/(\d+)/))||t[1]>=74)&&(t=r.match(/Chrome\/(\d+)/))&&(e=+t[1]),k=e}function at(){if(W)return R;W=1;var t=ut(),e=Q(),n=s().String;return R=!!Object.getOwnPropertySymbols&&!e((function(){var e=Symbol("symbol detection");return!n(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&t&&t<41}))}function ft(){if(H)return V;H=1;var t=at();return V=t&&!Symbol.sham&&"symbol"==typeof Symbol.iterator}function ct(){if(B)return q;B=1;var t=s(),e=J(),n=it(),r=ot(),i=at(),o=ft(),u=t.Symbol,a=e("wks"),f=o?u.for||u:u&&u.withoutSetter||r;return q=function(t){return n(a,t)||(a[t]=i&&n(u,t)?u[t]:f("Symbol."+t)),a[t]}}function st(){if($)return z;$=1;var t={};return t[ct()("toStringTag")]="z",z="[object z]"===String(t)}function lt(){if(G)return U;G=1;var t="object"==typeof document&&document.all;return U=void 0===t&&void 0!==t?function(e){return"function"==typeof e||e===t}:function(t){return"function"==typeof t}}var ht,pt,dt,vt,mt,gt,yt,bt,wt,Et,xt,St,Ot,At,Tt,Lt,jt,Mt,Pt,It,Ct,Nt,Dt,_t,kt,Ft,Rt,Wt,Vt,Ht,qt,Bt,zt,$t={};function Ut(){if(pt)return ht;pt=1;var t=Q();return ht=!t((function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]}))}function Gt(){if(vt)return dt;vt=1;var t=lt();return dt=function(e){return"object"==typeof e?null!==e:t(e)}}function Xt(){if(gt)return mt;gt=1;var t=s(),e=Gt(),n=t.document,r=e(n)&&e(n.createElement);return mt=function(t){return r?n.createElement(t):{}}}function Kt(){if(bt)return yt;bt=1;var t=Ut(),e=Q(),n=Xt();return yt=!t&&!e((function(){return 7!==Object.defineProperty(n("div"),"a",{get:function(){return 7}}).a}))}function Yt(){if(Et)return wt;Et=1;var t=Ut(),e=Q();return wt=t&&e((function(){return 42!==Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype}))}function Jt(){if(St)return xt;St=1;var t=Gt(),e=String,n=TypeError;return xt=function(r){if(t(r))return r;throw new n(e(r)+" is not an object")}}function Qt(){if(At)return Ot;At=1;var t=Z(),e=Function.prototype.call;return Ot=t?e.bind(e):function(){return e.apply(e,arguments)},Ot}function Zt(){if(Lt)return Tt;Lt=1;var t=s(),e=lt();return Tt=function(n,r){return arguments.length<2?(i=t[n],e(i)?i:void 0):t[n]&&t[n][r];var i},Tt}function te(){if(It)return Pt;It=1;var t=Zt(),e=lt(),n=function(){if(Mt)return jt;Mt=1;var t=tt();return jt=t({}.isPrototypeOf)}(),r=ft(),i=Object;return Pt=r?function(t){return"symbol"==typeof t}:function(r){var o=t("Symbol");return e(o)&&n(o.prototype,i(r))}}function ee(){if(Nt)return Ct;Nt=1;var t=String;return Ct=function(e){try{return t(e)}catch(t){return"Object"}}}function ne(){if(_t)return Dt;_t=1;var t=lt(),e=ee(),n=TypeError;return Dt=function(r){if(t(r))return r;throw new n(e(r)+" is not a function")}}function re(){if(Ft)return kt;Ft=1;var t=ne(),e=et();return kt=function(n,r){var i=n[r];return e(i)?void 0:t(i)}}function ie(){if(Wt)return Rt;Wt=1;var t=Qt(),e=lt(),n=Gt(),r=TypeError;return Rt=function(i,o){var u,a;if("string"===o&&e(u=i.toString)&&!n(a=t(u,i)))return a;if(e(u=i.valueOf)&&!n(a=t(u,i)))return a;if("string"!==o&&e(u=i.toString)&&!n(a=t(u,i)))return a;throw new r("Can't convert object to primitive value")}}function oe(){if(Ht)return Vt;Ht=1;var t=Qt(),e=Gt(),n=te(),r=re(),i=ie(),o=ct(),u=TypeError,a=o("toPrimitive");return Vt=function(o,f){if(!e(o)||n(o))return o;var c,s=r(o,a);if(s){if(void 0===f&&(f="default"),c=t(s,o,f),!e(c)||n(c))return c;throw new u("Can't convert object to primitive value")}return void 0===f&&(f="number"),i(o,f)}}function ue(){if(Bt)return qt;Bt=1;var t=oe(),e=te();return qt=function(n){var r=t(n,"string");return e(r)?r:r+""}}function ae(){if(zt)return $t;zt=1;var t=Ut(),e=Kt(),n=Yt(),r=Jt(),i=ue(),o=TypeError,u=Object.defineProperty,a=Object.getOwnPropertyDescriptor,f="enumerable",c="configurable",s="writable";return $t.f=t?n?function(t,e,n){if(r(t),e=i(e),r(n),"function"==typeof t&&"prototype"===e&&"value"in n&&s in n&&!n[s]){var o=a(t,e);o&&o[s]&&(t[e]=n.value,n={configurable:c in n?n[c]:o[c],enumerable:f in n?n[f]:o[f],writable:!1})}return u(t,e,n)}:u:function(t,n,a){if(r(t),n=i(n),r(a),e)try{return u(t,n,a)}catch(t){}if("get"in a||"set"in a)throw new o("Accessors not supported");return"value"in a&&(t[n]=a.value),t},$t}var fe,ce,se,le,he,pe,de,ve,me,ge,ye,be,we,Ee,xe,Se,Oe,Ae,Te,Le,je,Me,Pe,Ie,Ce,Ne,De={exports:{}};function _e(){if(ce)return fe;ce=1;var t=Ut(),e=it(),n=Function.prototype,r=t&&Object.getOwnPropertyDescriptor,i=e(n,"name"),o=i&&"something"===function(){}.name,u=i&&(!t||t&&r(n,"name").configurable);return fe={EXISTS:i,PROPER:o,CONFIGURABLE:u}}function ke(){if(le)return se;le=1;var t=tt(),e=lt(),n=Y(),r=t(Function.toString);return e(n.inspectSource)||(n.inspectSource=function(t){return r(t)}),se=n.inspectSource}function Fe(){return ve?de:(ve=1,de=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}})}function Re(){if(ge)return me;ge=1;var t=Ut(),e=ae(),n=Fe();return me=t?function(t,r,i){return e.f(t,r,n(1,i))}:function(t,e,n){return t[e]=n,t}}function We(){if(be)return ye;be=1;var t=J(),e=ot(),n=t("keys");return ye=function(t){return n[t]||(n[t]=e(t))}}function Ve(){return Ee?we:(Ee=1,we={})}function He(){if(Se)return xe;Se=1;var t,e,n,r=function(){if(pe)return he;pe=1;var t=s(),e=lt(),n=t.WeakMap;return he=e(n)&&/native code/.test(String(n))}(),i=s(),o=Gt(),u=Re(),a=it(),f=Y(),c=We(),l=Ve(),h="Object already initialized",p=i.TypeError,d=i.WeakMap;if(r||f.state){var v=f.state||(f.state=new d);v.get=v.get,v.has=v.has,v.set=v.set,t=function(t,e){if(v.has(t))throw new p(h);return e.facade=t,v.set(t,e),e},e=function(t){return v.get(t)||{}},n=function(t){return v.has(t)}}else{var m=c("state");l[m]=!0,t=function(t,e){if(a(t,m))throw new p(h);return e.facade=t,u(t,m,e),e},e=function(t){return a(t,m)?t[m]:{}},n=function(t){return a(t,m)}}return xe={set:t,get:e,has:n,enforce:function(r){return n(r)?e(r):t(r,{})},getterFor:function(t){return function(n){var r;if(!o(n)||(r=e(n)).type!==t)throw new p("Incompatible receiver, "+t+" required");return r}}}}function qe(){if(Oe)return De.exports;Oe=1;var t=tt(),e=Q(),n=lt(),r=it(),i=Ut(),o=_e().CONFIGURABLE,u=ke(),a=He(),f=a.enforce,c=a.get,s=String,l=Object.defineProperty,h=t("".slice),p=t("".replace),d=t([].join),v=i&&!e((function(){return 8!==l((function(){}),"length",{value:8}).length})),m=String(String).split("String"),g=De.exports=function(t,e,n){"Symbol("===h(s(e),0,7)&&(e="["+p(s(e),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),n&&n.getter&&(e="get "+e),n&&n.setter&&(e="set "+e),(!r(t,"name")||o&&t.name!==e)&&(i?l(t,"name",{value:e,configurable:!0}):t.name=e),v&&n&&r(n,"arity")&&t.length!==n.arity&&l(t,"length",{value:n.arity});try{n&&r(n,"constructor")&&n.constructor?i&&l(t,"prototype",{writable:!1}):t.prototype&&(t.prototype=void 0)}catch(t){}var u=f(t);return r(u,"source")||(u.source=d(m,"string"==typeof e?e:"")),t};return Function.prototype.toString=g((function(){return n(this)&&c(this).source||u(this)}),"toString"),De.exports}function Be(){if(Te)return Ae;Te=1;var t=lt(),e=ae(),n=qe(),r=K();return Ae=function(i,o,u,a){a||(a={});var f=a.enumerable,c=void 0!==a.name?a.name:o;if(t(u)&&n(u,c,a),a.global)f?i[o]=u:r(o,u);else{try{a.unsafe?i[o]&&(f=!0):delete i[o]}catch(t){}f?i[o]=u:e.f(i,o,{value:u,enumerable:!1,configurable:!a.nonConfigurable,writable:!a.nonWritable})}return i}}function ze(){if(je)return Le;je=1;var t=tt(),e=t({}.toString),n=t("".slice);return Le=function(t){return n(e(t),8,-1)}}function $e(){if(Pe)return Me;Pe=1;var t=st(),e=lt(),n=ze(),r=ct()("toStringTag"),i=Object,o="Arguments"===n(function(){return arguments}());return Me=t?n:function(t){var u,a,f;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(a=function(t,e){try{return t[e]}catch(t){}}(u=i(t),r))?a:o?n(u):"Object"===(f=n(u))&&e(u.callee)?"Arguments":f}}!function(){if(Ne)return c;Ne=1;var t=st(),e=Be(),n=function(){if(Ce)return Ie;Ce=1;var t=st(),e=$e();return Ie=t?{}.toString:function(){return"[object "+e(this)+"]"}}();t||e(Object.prototype,"toString",n,{unsafe:!0})}();var Ue,Ge,Xe,Ke,Ye,Je,Qe={},Ze={},tn={};function en(){if(Xe)return Ge;Xe=1;var t=tt(),e=Q(),n=ze(),r=Object,i=t("".split);return Ge=e((function(){return!r("z").propertyIsEnumerable(0)}))?function(t){return"String"===n(t)?i(t,""):r(t)}:r}function nn(){if(Ye)return Ke;Ye=1;var t=en(),e=nt();return Ke=function(n){return t(e(n))}}function rn(){if(Je)return Ze;Je=1;var t=Ut(),e=Qt(),n=function(){if(Ue)return tn;Ue=1;var t={}.propertyIsEnumerable,e=Object.getOwnPropertyDescriptor,n=e&&!t.call({1:2},1);return tn.f=n?function(t){var n=e(this,t);return!!n&&n.enumerable}:t,tn}(),r=Fe(),i=nn(),o=ue(),u=it(),a=Kt(),f=Object.getOwnPropertyDescriptor;return Ze.f=t?f:function(t,c){if(t=i(t),c=o(c),a)try{return f(t,c)}catch(t){}if(u(t,c))return r(!e(n.f,t,c),t[c])},Ze}var on,un,an,fn,cn,sn,ln,hn,pn,dn,vn,mn,gn,yn,bn,wn,En,xn={};function Sn(){if(fn)return an;fn=1;var t=function(){if(un)return on;un=1;var t=Math.ceil,e=Math.floor;return on=Math.trunc||function(n){var r=+n;return(r>0?e:t)(r)}}();return an=function(e){var n=+e;return n!=n||0===n?0:t(n)}}function On(){if(sn)return cn;sn=1;var t=Sn(),e=Math.max,n=Math.min;return cn=function(r,i){var o=t(r);return o<0?e(o+i,0):n(o,i)}}function An(){if(hn)return ln;hn=1;var t=Sn(),e=Math.min;return ln=function(n){var r=t(n);return r>0?e(r,9007199254740991):0}}function Tn(){if(dn)return pn;dn=1;var t=An();return pn=function(e){return t(e.length)}}function Ln(){if(yn)return gn;yn=1;var t=tt(),e=it(),n=nn(),r=function(){if(mn)return vn;mn=1;var t=nn(),e=On(),n=Tn(),r=function(r){return function(i,o,u){var a=t(i),f=n(a);if(0===f)return!r&&-1;var c,s=e(u,f);if(r&&o!=o){for(;f>s;)if((c=a[s++])!=c)return!0}else for(;f>s;s++)if((r||s in a)&&a[s]===o)return r||s||0;return!r&&-1}};return vn={includes:r(!0),indexOf:r(!1)}}().indexOf,i=Ve(),o=t([].push);return gn=function(t,u){var a,f=n(t),c=0,s=[];for(a in f)!e(i,a)&&e(f,a)&&o(s,a);for(;u.length>c;)e(f,a=u[c++])&&(~r(s,a)||o(s,a));return s}}function jn(){return wn?bn:(wn=1,bn=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"])}var Mn,Pn,In,Cn,Nn,Dn,_n,kn,Fn,Rn,Wn,Vn,Hn,qn,Bn,zn,$n,Un,Gn,Xn={};function Kn(){if(In)return Pn;In=1;var t=Zt(),e=tt(),n=function(){if(En)return xn;En=1;var t=Ln(),e=jn().concat("length","prototype");return xn.f=Object.getOwnPropertyNames||function(n){return t(n,e)},xn}(),r=(Mn||(Mn=1,Xn.f=Object.getOwnPropertySymbols),Xn),i=Jt(),o=e([].concat);return Pn=t("Reflect","ownKeys")||function(t){var e=n.f(i(t)),u=r.f;return u?o(e,u(t)):e}}function Yn(){if(Nn)return Cn;Nn=1;var t=it(),e=Kn(),n=rn(),r=ae();return Cn=function(i,o,u){for(var a=e(o),f=r.f,c=n.f,s=0;s<a.length;s++){var l=a[s];t(i,l)||u&&t(u,l)||f(i,l,c(o,l))}}}function Jn(){if(Fn)return kn;Fn=1;var t=s(),e=rn().f,n=Re(),r=Be(),i=K(),o=Yn(),u=function(){if(_n)return Dn;_n=1;var t=Q(),e=lt(),n=/#|\.prototype\./,r=function(n,r){var f=o[i(n)];return f===a||f!==u&&(e(r)?t(r):!!r)},i=r.normalize=function(t){return String(t).replace(n,".").toLowerCase()},o=r.data={},u=r.NATIVE="N",a=r.POLYFILL="P";return Dn=r}();return kn=function(a,f){var c,s,l,h,p,d=a.target,v=a.global,m=a.stat;if(c=v?t:m?t[d]||i(d,{}):t[d]&&t[d].prototype)for(s in f){if(h=f[s],l=a.dontCallGetSet?(p=e(c,s))&&p.value:c[s],!u(v?s:d+(m?".":"#")+s,a.forced)&&void 0!==l){if(typeof h==typeof l)continue;o(h,l)}(a.sham||l&&l.sham)&&n(h,"sham",!0),r(c,s,h,a)}}}function Qn(){if(Hn)return Vn;Hn=1;var t=tt();return Vn=t([].slice)}function Zn(){if(Bn)return qn;Bn=1;var t=tt(),e=ne(),n=Gt(),r=it(),i=Qn(),o=Z(),u=Function,a=t([].concat),f=t([].join),c={};return qn=o?u.bind:function(t){var o=e(this),s=o.prototype,l=i(arguments,1),h=function(){var e=a(l,i(arguments));return this instanceof h?function(t,e,n){if(!r(c,e)){for(var i=[],o=0;o<e;o++)i[o]="a["+o+"]";c[e]=u("C,a","return new C("+f(i,",")+")")}return c[e](t,n)}(o,e.length,e):o.apply(t,e)};return n(s)&&(h.prototype=s),h},qn}function tr(){if($n)return zn;$n=1;var t=tt(),e=Q(),n=lt(),r=$e(),i=Zt(),o=ke(),u=function(){},a=i("Reflect","construct"),f=/^\s*(?:class|function)\b/,c=t(f.exec),s=!f.test(u),l=function(t){if(!n(t))return!1;try{return a(u,[],t),!0}catch(t){return!1}},h=function(t){if(!n(t))return!1;switch(r(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return s||!!c(f,o(t))}catch(t){return!0}};return h.sham=!0,zn=!a||e((function(){var t;return l(l.call)||!l(Object)||!l((function(){t=!0}))||t}))?h:l}function er(){if(Gn)return Un;Gn=1;var t=tr(),e=ee(),n=TypeError;return Un=function(r){if(t(r))return r;throw new n(e(r)+" is not a constructor")}}var nr,rr,ir,or,ur,ar,fr,cr,sr={};function lr(){if(rr)return nr;rr=1;var t=Ln(),e=jn();return nr=Object.keys||function(n){return t(n,e)}}function hr(){if(ur)return or;ur=1;var t=Zt();return or=t("document","documentElement")}function pr(){if(fr)return ar;fr=1;var t,e=Jt(),n=function(){if(ir)return sr;ir=1;var t=Ut(),e=Yt(),n=ae(),r=Jt(),i=nn(),o=lr();return sr.f=t&&!e?Object.defineProperties:function(t,e){r(t);for(var u,a=i(e),f=o(e),c=f.length,s=0;c>s;)n.f(t,u=f[s++],a[u]);return t},sr}(),r=jn(),i=Ve(),o=hr(),u=Xt(),a=We(),f="prototype",c="script",s=a("IE_PROTO"),l=function(){},h=function(t){return"<"+c+">"+t+"</"+c+">"},p=function(t){t.write(h("")),t.close();var e=t.parentWindow.Object;return t=null,e},d=function(){try{t=new ActiveXObject("htmlfile")}catch(t){}var e,n,i;d="undefined"!=typeof document?document.domain&&t?p(t):(n=u("iframe"),i="java"+c+":",n.style.display="none",o.appendChild(n),n.src=String(i),(e=n.contentWindow.document).open(),e.write(h("document.F=Object")),e.close(),e.F):p(t);for(var a=r.length;a--;)delete d[f][r[a]];return d()};return i[s]=!0,ar=Object.create||function(t,r){var i;return null!==t?(l[f]=e(t),i=new l,l[f]=null,i[s]=t):i=d(),void 0===r?i:n.f(i,r)}}!function(){if(cr)return Qe;cr=1;var t=Jn(),e=Zt(),n=function(){if(Wn)return Rn;Wn=1;var t=Z(),e=Function.prototype,n=e.apply,r=e.call;return Rn="object"==typeof Reflect&&Reflect.apply||(t?r.bind(n):function(){return r.apply(n,arguments)}),Rn}(),r=Zn(),i=er(),o=Jt(),u=Gt(),a=pr(),f=Q(),c=e("Reflect","construct"),s=Object.prototype,l=[].push,h=f((function(){function t(){}return!(c((function(){}),[],t)instanceof t)})),p=!f((function(){c((function(){}))})),d=h||p;t({target:"Reflect",stat:!0,forced:d,sham:d},{construct:function(t,e){i(t),o(e);var f=arguments.length<3?t:i(arguments[2]);if(p&&!h)return c(t,e,f);if(t===f){switch(e.length){case 0:return new t;case 1:return new t(e[0]);case 2:return new t(e[0],e[1]);case 3:return new t(e[0],e[1],e[2]);case 4:return new t(e[0],e[1],e[2],e[3])}var d=[null];return n(l,d,e),new(n(r,t,d))}var v=f.prototype,m=a(u(v)?v:s),g=n(t,m,e);return u(g)?g:m}})}(),function(){if(void 0!==window.Reflect&&void 0!==window.customElements&&!window.customElements.polyfillWrapFlushCallback){var t=HTMLElement,e=function(){return Reflect.construct(t,[],this.constructor)};window.HTMLElement=e,HTMLElement.prototype=t.prototype,HTMLElement.prototype.constructor=HTMLElement,Object.setPrototypeOf(HTMLElement,t)}}();var dr=function(e){function n(){var t=e.call(this)||this,n=t.attachShadow({mode:"open"}),r=n.ownerDocument,i=r.createElement("link");i.rel="stylesheet",i.href="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/katex.min.css",i.integrity="sha384-n8MVd4RsNIU0tAv4ct0nTaAbDJwPJzDEaqSD1odI+WdtXRGWt2kTvGFasHpSy3SV",i.crossOrigin="anonymous",n.appendChild(i);var o=r.createElement("span");return o.style.display="inline-block",n.appendChild(o),t.span=o,t}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}(n,e),Object.defineProperty(n,"observedAttributes",{get:function(){return["data-value"]},enumerable:!1,configurable:!0}),n.prototype.attributeChangedCallback=function(t,e,n){if("data-value"===t){if(e===n)return;this.render(n||"")}},n.prototype.render=function(e){t.render(e,this.span,{throwOnError:!1})},n}(HTMLElement);window.customElements.get("w-e-formula-card")||window.customElements.define("w-e-formula-card",dr),e.i18nAddResources("en",{formula:{formula:"Formula",placeholder:"Use LateX syntax",insert:"Insert formula",edit:"Edit formula",ok:"OK"}}),e.i18nAddResources("zh-CN",{formula:{formula:"公式",placeholder:"使用 LateX 语法",insert:"插入公式",edit:"编辑公式",ok:"确定"}});var vr,mr,gr,yr,br,wr,Er,xr,Sr,Or,Ar,Tr,Lr,jr,Mr,Pr={type:"formula",elemToHtml:function(t,e){var n=t.value;return'<span data-w-e-type="formula" data-w-e-is-void data-w-e-is-inline data-value="'.concat(void 0===n?"":n,'"></span>')}},Ir={};function Cr(){if(yr)return gr;yr=1;var t=function(){if(mr)return vr;mr=1;var t=ze(),e=tt();return vr=function(n){if("Function"===t(n))return e(n)}}(),e=ne(),n=Z(),r=t(t.bind);return gr=function(t,i){return e(t),void 0===i?t:n?r(t,i):function(){return t.apply(i,arguments)}},gr}function Nr(){if(wr)return br;wr=1;var t=ze();return br=Array.isArray||function(e){return"Array"===t(e)}}function Dr(){if(xr)return Er;xr=1;var t=Nr(),e=tr(),n=Gt(),r=ct()("species"),i=Array;return Er=function(o){var u;return t(o)&&(u=o.constructor,(e(u)&&(u===i||t(u.prototype))||n(u)&&null===(u=u[r]))&&(u=void 0)),void 0===u?i:u}}function _r(){if(Or)return Sr;Or=1;var t=Dr();return Sr=function(e,n){return new(t(e))(0===n?0:n)}}function kr(){if(jr)return Lr;jr=1;var t=ct(),e=pr(),n=ae().f,r=t("unscopables"),i=Array.prototype;return void 0===i[r]&&n(i,r,{configurable:!0,value:e(null)}),Lr=function(t){i[r][t]=!0}}!function(){if(Mr)return Ir;Mr=1;var t=Jn(),e=function(){if(Tr)return Ar;Tr=1;var t=Cr(),e=tt(),n=en(),r=rt(),i=Tn(),o=_r(),u=e([].push),a=function(e){var a=1===e,f=2===e,c=3===e,s=4===e,l=6===e,h=7===e,p=5===e||l;return function(d,v,m,g){for(var y,b,w=r(d),E=n(w),x=i(E),S=t(v,m),O=0,A=g||o,T=a?A(d,x):f||h?A(d,0):void 0;x>O;O++)if((p||O in E)&&(b=S(y=E[O],O,w),e))if(a)T[O]=b;else if(b)switch(e){case 3:return!0;case 5:return y;case 6:return O;case 2:u(T,y)}else switch(e){case 4:return!1;case 7:u(T,y)}return l?-1:c||s?s:T}};return Ar={forEach:a(0),map:a(1),filter:a(2),some:a(3),every:a(4),find:a(5),findIndex:a(6),filterReject:a(7)}}().find,n=kr(),r="find",i=!0;r in[]&&Array(1)[r]((function(){i=!1})),t({target:"Array",proto:!0,forced:i},{find:function(t){return e(this,t,arguments.length>1?arguments[1]:void 0)}}),n(r)}();var Fr,Rr,Wr,Vr,Hr,qr,Br,zr,$r,Ur,Gr,Xr,Kr,Yr={};function Jr(){if(Rr)return Fr;Rr=1;var t=$e(),e=String;return Fr=function(n){if("Symbol"===t(n))throw new TypeError("Cannot convert a Symbol value to a string");return e(n)}}function Qr(){if(Vr)return Wr;Vr=1;var t=Jt();return Wr=function(){var e=t(this),n="";return e.hasIndices&&(n+="d"),e.global&&(n+="g"),e.ignoreCase&&(n+="i"),e.multiline&&(n+="m"),e.dotAll&&(n+="s"),e.unicode&&(n+="u"),e.unicodeSets&&(n+="v"),e.sticky&&(n+="y"),n}}function Zr(){if(Xr)return Gr;Xr=1;var t,e,n=Qt(),r=tt(),i=Jr(),o=Qr(),u=function(){if(qr)return Hr;qr=1;var t=Q(),e=s().RegExp,n=t((function(){var t=e("a","y");return t.lastIndex=2,null!==t.exec("abcd")})),r=n||t((function(){return!e("a","y").sticky})),i=n||t((function(){var t=e("^r","gy");return t.lastIndex=2,null!==t.exec("str")}));return Hr={BROKEN_CARET:i,MISSED_STICKY:r,UNSUPPORTED_Y:n}}(),a=J(),f=pr(),c=He().get,l=function(){if(zr)return Br;zr=1;var t=Q(),e=s().RegExp;return Br=t((function(){var t=e(".","s");return!(t.dotAll&&t.test("\n")&&"s"===t.flags)}))}(),h=function(){if(Ur)return $r;Ur=1;var t=Q(),e=s().RegExp;return $r=t((function(){var t=e("(?<a>b)","g");return"b"!==t.exec("b").groups.a||"bc"!=="b".replace(t,"$<a>c")}))}(),p=a("native-string-replace",String.prototype.replace),d=RegExp.prototype.exec,v=d,m=r("".charAt),g=r("".indexOf),y=r("".replace),b=r("".slice),w=(e=/b*/g,n(d,t=/a/,"a"),n(d,e,"a"),0!==t.lastIndex||0!==e.lastIndex),E=u.BROKEN_CARET,x=void 0!==/()??/.exec("")[1];return(w||x||E||l||h)&&(v=function(t){var e,r,u,a,s,l,h,S=this,O=c(S),A=i(t),T=O.raw;if(T)return T.lastIndex=S.lastIndex,e=n(v,T,A),S.lastIndex=T.lastIndex,e;var L=O.groups,j=E&&S.sticky,M=n(o,S),P=S.source,I=0,C=A;if(j&&(M=y(M,"y",""),-1===g(M,"g")&&(M+="g"),C=b(A,S.lastIndex),S.lastIndex>0&&(!S.multiline||S.multiline&&"\n"!==m(A,S.lastIndex-1))&&(P="(?: "+P+")",C=" "+C,I++),r=new RegExp("^(?:"+P+")",M)),x&&(r=new RegExp("^"+P+"$(?!\\s)",M)),w&&(u=S.lastIndex),a=n(d,j?r:S,C),j?a?(a.input=b(a.input,I),a[0]=b(a[0],I),a.index=S.lastIndex,S.lastIndex+=a[0].length):S.lastIndex=0:w&&a&&(S.lastIndex=S.global?a.index+a[0].length:u),x&&a&&a.length>1&&n(p,a[0],r,(function(){for(s=1;s<arguments.length-2;s++)void 0===arguments[s]&&(a[s]=void 0)})),a&&L)for(a.groups=l=f(null),s=0;s<L.length;s++)l[(h=L[s])[0]]=a[h[1]];return a}),Gr=v}!function(){if(Kr)return Yr;Kr=1;var t=Jn(),e=Zr();t({target:"RegExp",proto:!0,forced:/./.exec!==e},{exec:e})}();var ti,ei,ni,ri,ii,oi,ui,ai={};function fi(){return ei?ti:(ei=1,ti="\t\n\v\f\r                 \u2028\u2029\ufeff")}!function(){if(ui)return ai;ui=1;var t=Jn(),e=function(){if(ri)return ni;ri=1;var t=tt(),e=nt(),n=Jr(),r=fi(),i=t("".replace),o=RegExp("^["+r+"]+"),u=RegExp("(^|[^"+r+"])["+r+"]+$"),a=function(t){return function(r){var a=n(e(r));return 1&t&&(a=i(a,o,"")),2&t&&(a=i(a,u,"$1")),a}};return ni={start:a(1),end:a(2),trim:a(3)}}().trim,n=function(){if(oi)return ii;oi=1;var t=_e().PROPER,e=Q(),n=fi();return ii=function(r){return e((function(){return!!n[r]()||"​…᠎"!=="​…᠎"[r]()||t&&n[r].name!==r}))}}();t({target:"String",proto:!0,forced:n("trim")},{trim:function(){return e(this)}})}();var ci,si,li={};si||(si=1,function(){if(ci)return li;ci=1;var t=Jn(),e=s();t({global:!0,forced:e.globalThis!==e},{globalThis:e})}());var hi,pi,di={},vi={exports:{}};vi.exports;function mi(){return hi||(hi=1,function(t,e){!function(t){function e(t){return null!==t&&"object"==typeof t&&"constructor"in t&&t.constructor===Object}function n(t,r){void 0===t&&(t={}),void 0===r&&(r={}),Object.keys(r).forEach((function(i){void 0===t[i]?t[i]=r[i]:e(r[i])&&e(t[i])&&Object.keys(r[i]).length>0&&n(t[i],r[i])}))}var r={body:{},addEventListener:function(){},removeEventListener:function(){},activeElement:{blur:function(){},nodeName:""},querySelector:function(){return null},querySelectorAll:function(){return[]},getElementById:function(){return null},createEvent:function(){return{initEvent:function(){}}},createElement:function(){return{children:[],childNodes:[],style:{},setAttribute:function(){},getElementsByTagName:function(){return[]}}},createElementNS:function(){return{}},importNode:function(){return null},location:{hash:"",host:"",hostname:"",href:"",origin:"",pathname:"",protocol:"",search:""}};function i(){var t="undefined"!=typeof document?document:{};return n(t,r),t}var o={document:r,navigator:{userAgent:""},location:{hash:"",host:"",hostname:"",href:"",origin:"",pathname:"",protocol:"",search:""},history:{replaceState:function(){},pushState:function(){},go:function(){},back:function(){}},CustomEvent:function(){return this},addEventListener:function(){},removeEventListener:function(){},getComputedStyle:function(){return{getPropertyValue:function(){return""}}},Image:function(){},Date:function(){},screen:{},setTimeout:function(){},clearTimeout:function(){},matchMedia:function(){return{}},requestAnimationFrame:function(t){return"undefined"==typeof setTimeout?(t(),null):setTimeout(t,0)},cancelAnimationFrame:function(t){"undefined"!=typeof setTimeout&&clearTimeout(t)}};function u(){var t="undefined"!=typeof window?window:{};return n(t,o),t}t.extend=n,t.getDocument=i,t.getWindow=u,t.ssrDocument=r,t.ssrWindow=o,Object.defineProperty(t,"__esModule",{value:!0})}(e)}(0,vi.exports)),vi.exports}function gi(){if(pi)return di;pi=1,Object.defineProperty(di,"__esModule",{value:!0});var t=mi();function e(t){return e=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},e(t)}function n(t,e){return n=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},n(t,e)}function r(t,e,i){return r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}()?Reflect.construct:function(t,e,r){var i=[null];i.push.apply(i,e);var o=new(Function.bind.apply(t,i));return r&&n(o,r.prototype),o},r.apply(null,arguments)}function i(t){var o="function"==typeof Map?new Map:void 0;return i=function(t){if(null===t||(i=t,-1===Function.toString.call(i).indexOf("[native code]")))return t;var i;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==o){if(o.has(t))return o.get(t);o.set(t,u)}function u(){return r(t,arguments,e(this).constructor)}return u.prototype=Object.create(t.prototype,{constructor:{value:u,enumerable:!1,writable:!0,configurable:!0}}),n(u,t)},i(t)}var o=function(t){var e,n;function r(e){var n,r,i;return n=t.call.apply(t,[this].concat(e))||this,r=function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(n),i=r.__proto__,Object.defineProperty(r,"__proto__",{get:function(){return i},set:function(t){i.__proto__=t}}),n}return n=t,(e=r).prototype=Object.create(n.prototype),e.prototype.constructor=e,e.__proto__=n,r}(i(Array));function u(t){void 0===t&&(t=[]);var e=[];return t.forEach((function(t){Array.isArray(t)?e.push.apply(e,u(t)):e.push(t)})),e}function a(t,e){return Array.prototype.filter.call(t,e)}function f(e,n){var r=t.getWindow(),i=t.getDocument(),u=[];if(!n&&e instanceof o)return e;if(!e)return new o(u);if("string"==typeof e){var a=e.trim();if(a.indexOf("<")>=0&&a.indexOf(">")>=0){var f="div";0===a.indexOf("<li")&&(f="ul"),0===a.indexOf("<tr")&&(f="tbody"),0!==a.indexOf("<td")&&0!==a.indexOf("<th")||(f="tr"),0===a.indexOf("<tbody")&&(f="table"),0===a.indexOf("<option")&&(f="select");var c=i.createElement(f);c.innerHTML=a;for(var s=0;s<c.childNodes.length;s+=1)u.push(c.childNodes[s])}else u=function(t,e){if("string"!=typeof t)return[t];for(var n=[],r=e.querySelectorAll(t),i=0;i<r.length;i+=1)n.push(r[i]);return n}(e.trim(),n||i)}else if(e.nodeType||e===r||e===i)u.push(e);else if(Array.isArray(e)){if(e instanceof o)return e;u=e}return new o(function(t){for(var e=[],n=0;n<t.length;n+=1)-1===e.indexOf(t[n])&&e.push(t[n]);return e}(u))}f.fn=o.prototype;var c="resize scroll".split(" ");function s(t){return function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];if(void 0===n[0]){for(var i=0;i<this.length;i+=1)c.indexOf(t)<0&&(t in this[i]?this[i][t]():f(this[i]).trigger(t));return this}return this.on.apply(this,[t].concat(n))}}var l=s("click"),h=s("blur"),p=s("focus"),d=s("focusin"),v=s("focusout"),m=s("keyup"),g=s("keydown"),y=s("keypress"),b=s("submit"),w=s("change"),E=s("mousedown"),x=s("mousemove"),S=s("mouseup"),O=s("mouseenter"),A=s("mouseleave"),T=s("mouseout"),L=s("mouseover"),j=s("touchstart"),M=s("touchend"),P=s("touchmove"),I=s("resize"),C=s("scroll");return di.$=f,di.add=function(){for(var t,e,n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];for(t=0;t<r.length;t+=1){var o=f(r[t]);for(e=0;e<o.length;e+=1)this.push(o[e])}return this},di.addClass=function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];var r=u(e.map((function(t){return t.split(" ")})));return this.forEach((function(t){var e;(e=t.classList).add.apply(e,r)})),this},di.animate=function(e,n){var r,i=t.getWindow(),o=this,u={props:Object.assign({},e),params:Object.assign({duration:300,easing:"swing"},n),elements:o,animating:!1,que:[],easingProgress:function(t,e){return"swing"===t?.5-Math.cos(e*Math.PI)/2:"function"==typeof t?t(e):e},stop:function(){u.frameId&&i.cancelAnimationFrame(u.frameId),u.animating=!1,u.elements.each((function(t){delete t.dom7AnimateInstance})),u.que=[]},done:function(t){if(u.animating=!1,u.elements.each((function(t){delete t.dom7AnimateInstance})),t&&t(o),u.que.length>0){var e=u.que.shift();u.animate(e[0],e[1])}},animate:function(t,e){if(u.animating)return u.que.push([t,e]),u;var n=[];u.elements.each((function(e,r){var o,a,f,c,s;e.dom7AnimateInstance||(u.elements[r].dom7AnimateInstance=u),n[r]={container:e},Object.keys(t).forEach((function(u){o=i.getComputedStyle(e,null).getPropertyValue(u).replace(",","."),a=parseFloat(o),f=o.replace(a,""),c=parseFloat(t[u]),s=t[u]+f,n[r][u]={initialFullValue:o,initialValue:a,unit:f,finalValue:c,finalFullValue:s,currentValue:a}}))}));var r,a,f=null,c=0,s=0,l=!1;return u.animating=!0,u.frameId=i.requestAnimationFrame((function h(){var p,d;r=(new Date).getTime(),l||(l=!0,e.begin&&e.begin(o)),null===f&&(f=r),e.progress&&e.progress(o,Math.max(Math.min((r-f)/e.duration,1),0),f+e.duration-r<0?0:f+e.duration-r,f),n.forEach((function(i){var o=i;a||o.done||Object.keys(t).forEach((function(i){if(!a&&!o.done){p=Math.max(Math.min((r-f)/e.duration,1),0),d=u.easingProgress(e.easing,p);var l=o[i],h=l.initialValue,v=l.finalValue,m=l.unit;o[i].currentValue=h+d*(v-h);var g=o[i].currentValue;(v>h&&g>=v||v<h&&g<=v)&&(o.container.style[i]=v+m,(s+=1)===Object.keys(t).length&&(o.done=!0,c+=1),c===n.length&&(a=!0)),a?u.done(e.complete):o.container.style[i]=g+m}}))})),a||(u.frameId=i.requestAnimationFrame(h))})),u}};if(0===u.elements.length)return o;for(var a=0;a<u.elements.length;a+=1)u.elements[a].dom7AnimateInstance?r=u.elements[a].dom7AnimateInstance:u.elements[a].dom7AnimateInstance=u;return r||(r=u),"stop"===e?r.stop():r.animate(u.props,u.params),o},di.animationEnd=function(t){var e=this;return t&&e.on("animationend",(function n(r){r.target===this&&(t.call(this,r),e.off("animationend",n))})),this},di.append=function(){for(var e,n=t.getDocument(),r=0;r<arguments.length;r+=1){e=r<0||arguments.length<=r?void 0:arguments[r];for(var i=0;i<this.length;i+=1)if("string"==typeof e){var u=n.createElement("div");for(u.innerHTML=e;u.firstChild;)this[i].appendChild(u.firstChild)}else if(e instanceof o)for(var a=0;a<e.length;a+=1)this[i].appendChild(e[a]);else this[i].appendChild(e)}return this},di.appendTo=function(t){return f(t).append(this),this},di.attr=function(t,e){if(1===arguments.length&&"string"==typeof t)return this[0]?this[0].getAttribute(t):void 0;for(var n=0;n<this.length;n+=1)if(2===arguments.length)this[n].setAttribute(t,e);else for(var r in t)this[n][r]=t[r],this[n].setAttribute(r,t[r]);return this},di.blur=h,di.change=w,di.children=function(t){for(var e=[],n=0;n<this.length;n+=1)for(var r=this[n].children,i=0;i<r.length;i+=1)t&&!f(r[i]).is(t)||e.push(r[i]);return f(e)},di.click=l,di.closest=function(t){var e=this;return void 0===t?f([]):(e.is(t)||(e=e.parents(t).eq(0)),e)},di.css=function(e,n){var r,i=t.getWindow();if(1===arguments.length){if("string"!=typeof e){for(r=0;r<this.length;r+=1)for(var o in e)this[r].style[o]=e[o];return this}if(this[0])return i.getComputedStyle(this[0],null).getPropertyValue(e)}if(2===arguments.length&&"string"==typeof e){for(r=0;r<this.length;r+=1)this[r].style[e]=n;return this}return this},di.data=function(t,e){var n;if(void 0===e){if(!(n=this[0]))return;if(n.dom7ElementDataStorage&&t in n.dom7ElementDataStorage)return n.dom7ElementDataStorage[t];var r=n.getAttribute("data-"+t);return r||void 0}for(var i=0;i<this.length;i+=1)(n=this[i]).dom7ElementDataStorage||(n.dom7ElementDataStorage={}),n.dom7ElementDataStorage[t]=e;return this},di.dataset=function(){var t=this[0];if(t){var e,n={};if(t.dataset)for(var r in t.dataset)n[r]=t.dataset[r];else for(var i=0;i<t.attributes.length;i+=1){var o=t.attributes[i];o.name.indexOf("data-")>=0&&(n[(e=o.name.split("data-")[1],e.toLowerCase().replace(/-(.)/g,(function(t,e){return e.toUpperCase()})))]=o.value)}for(var u in n)"false"===n[u]?n[u]=!1:"true"===n[u]?n[u]=!0:parseFloat(n[u])===1*n[u]&&(n[u]*=1);return n}},di.default=f,di.detach=function(){return this.remove()},di.each=function(t){return t?(this.forEach((function(e,n){t.apply(e,[e,n])})),this):this},di.empty=function(){for(var t=0;t<this.length;t+=1){var e=this[t];if(1===e.nodeType){for(var n=0;n<e.childNodes.length;n+=1)e.childNodes[n].parentNode&&e.childNodes[n].parentNode.removeChild(e.childNodes[n]);e.textContent=""}}return this},di.eq=function(t){if(void 0===t)return this;var e=this.length;if(t>e-1)return f([]);if(t<0){var n=e+t;return f(n<0?[]:[this[n]])}return f([this[t]])},di.filter=function(t){return f(a(this,t))},di.find=function(t){for(var e=[],n=0;n<this.length;n+=1)for(var r=this[n].querySelectorAll(t),i=0;i<r.length;i+=1)e.push(r[i]);return f(e)},di.focus=p,di.focusin=d,di.focusout=v,di.hasClass=function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];var r=u(e.map((function(t){return t.split(" ")})));return a(this,(function(t){return r.filter((function(e){return t.classList.contains(e)})).length>0})).length>0},di.height=function(){var e=t.getWindow();return this[0]===e?e.innerHeight:this.length>0?parseFloat(this.css("height")):null},di.hide=function(){for(var t=0;t<this.length;t+=1)this[t].style.display="none";return this},di.html=function(t){if(void 0===t)return this[0]?this[0].innerHTML:null;for(var e=0;e<this.length;e+=1)this[e].innerHTML=t;return this},di.index=function(){var t,e=this[0];if(e){for(t=0;null!==(e=e.previousSibling);)1===e.nodeType&&(t+=1);return t}},di.insertAfter=function(t){for(var e=f(t),n=0;n<this.length;n+=1)if(1===e.length)e[0].parentNode.insertBefore(this[n],e[0].nextSibling);else if(e.length>1)for(var r=0;r<e.length;r+=1)e[r].parentNode.insertBefore(this[n].cloneNode(!0),e[r].nextSibling)},di.insertBefore=function(t){for(var e=f(t),n=0;n<this.length;n+=1)if(1===e.length)e[0].parentNode.insertBefore(this[n],e[0]);else if(e.length>1)for(var r=0;r<e.length;r+=1)e[r].parentNode.insertBefore(this[n].cloneNode(!0),e[r])},di.is=function(e){var n,r,i=t.getWindow(),u=t.getDocument(),a=this[0];if(!a||void 0===e)return!1;if("string"==typeof e){if(a.matches)return a.matches(e);if(a.webkitMatchesSelector)return a.webkitMatchesSelector(e);if(a.msMatchesSelector)return a.msMatchesSelector(e);for(n=f(e),r=0;r<n.length;r+=1)if(n[r]===a)return!0;return!1}if(e===u)return a===u;if(e===i)return a===i;if(e.nodeType||e instanceof o){for(n=e.nodeType?[e]:e,r=0;r<n.length;r+=1)if(n[r]===a)return!0;return!1}return!1},di.keydown=g,di.keypress=y,di.keyup=m,di.mousedown=E,di.mouseenter=O,di.mouseleave=A,di.mousemove=x,di.mouseout=T,di.mouseover=L,di.mouseup=S,di.next=function(t){return this.length>0?t?this[0].nextElementSibling&&f(this[0].nextElementSibling).is(t)?f([this[0].nextElementSibling]):f([]):this[0].nextElementSibling?f([this[0].nextElementSibling]):f([]):f([])},di.nextAll=function(t){var e=[],n=this[0];if(!n)return f([]);for(;n.nextElementSibling;){var r=n.nextElementSibling;t?f(r).is(t)&&e.push(r):e.push(r),n=r}return f(e)},di.off=function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];var r=e[0],i=e[1],o=e[2],u=e[3];"function"==typeof e[1]&&(r=e[0],o=e[1],u=e[2],i=void 0),u||(u=!1);for(var a=r.split(" "),f=0;f<a.length;f+=1)for(var c=a[f],s=0;s<this.length;s+=1){var l=this[s],h=void 0;if(!i&&l.dom7Listeners?h=l.dom7Listeners[c]:i&&l.dom7LiveListeners&&(h=l.dom7LiveListeners[c]),h&&h.length)for(var p=h.length-1;p>=0;p-=1){var d=h[p];o&&d.listener===o||o&&d.listener&&d.listener.dom7proxy&&d.listener.dom7proxy===o?(l.removeEventListener(c,d.proxyListener,u),h.splice(p,1)):o||(l.removeEventListener(c,d.proxyListener,u),h.splice(p,1))}}return this},di.offset=function(){if(this.length>0){var e=t.getWindow(),n=t.getDocument(),r=this[0],i=r.getBoundingClientRect(),o=n.body,u=r.clientTop||o.clientTop||0,a=r.clientLeft||o.clientLeft||0,f=r===e?e.scrollY:r.scrollTop,c=r===e?e.scrollX:r.scrollLeft;return{top:i.top+f-u,left:i.left+c-a}}return null},di.on=function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];var r=e[0],i=e[1],o=e[2],u=e[3];function a(t){var e=t.target;if(e){var n=t.target.dom7EventData||[];if(n.indexOf(t)<0&&n.unshift(t),f(e).is(i))o.apply(e,n);else for(var r=f(e).parents(),u=0;u<r.length;u+=1)f(r[u]).is(i)&&o.apply(r[u],n)}}function c(t){var e=t&&t.target&&t.target.dom7EventData||[];e.indexOf(t)<0&&e.unshift(t),o.apply(this,e)}"function"==typeof e[1]&&(r=e[0],o=e[1],u=e[2],i=void 0),u||(u=!1);for(var s,l=r.split(" "),h=0;h<this.length;h+=1){var p=this[h];if(i)for(s=0;s<l.length;s+=1){var d=l[s];p.dom7LiveListeners||(p.dom7LiveListeners={}),p.dom7LiveListeners[d]||(p.dom7LiveListeners[d]=[]),p.dom7LiveListeners[d].push({listener:o,proxyListener:a}),p.addEventListener(d,a,u)}else for(s=0;s<l.length;s+=1){var v=l[s];p.dom7Listeners||(p.dom7Listeners={}),p.dom7Listeners[v]||(p.dom7Listeners[v]=[]),p.dom7Listeners[v].push({listener:o,proxyListener:c}),p.addEventListener(v,c,u)}}return this},di.once=function(){for(var t=this,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];var i=n[0],o=n[1],u=n[2],a=n[3];function f(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];u.apply(this,n),t.off(i,o,f,a),f.dom7proxy&&delete f.dom7proxy}return"function"==typeof n[1]&&(i=n[0],u=n[1],a=n[2],o=void 0),f.dom7proxy=u,t.on(i,o,f,a)},di.outerHeight=function(t){if(this.length>0){if(t){var e=this.styles();return this[0].offsetHeight+parseFloat(e.getPropertyValue("margin-top"))+parseFloat(e.getPropertyValue("margin-bottom"))}return this[0].offsetHeight}return null},di.outerWidth=function(t){if(this.length>0){if(t){var e=this.styles();return this[0].offsetWidth+parseFloat(e.getPropertyValue("margin-right"))+parseFloat(e.getPropertyValue("margin-left"))}return this[0].offsetWidth}return null},di.parent=function(t){for(var e=[],n=0;n<this.length;n+=1)null!==this[n].parentNode&&(t?f(this[n].parentNode).is(t)&&e.push(this[n].parentNode):e.push(this[n].parentNode));return f(e)},di.parents=function(t){for(var e=[],n=0;n<this.length;n+=1)for(var r=this[n].parentNode;r;)t?f(r).is(t)&&e.push(r):e.push(r),r=r.parentNode;return f(e)},di.prepend=function(e){var n,r,i=t.getDocument();for(n=0;n<this.length;n+=1)if("string"==typeof e){var u=i.createElement("div");for(u.innerHTML=e,r=u.childNodes.length-1;r>=0;r-=1)this[n].insertBefore(u.childNodes[r],this[n].childNodes[0])}else if(e instanceof o)for(r=0;r<e.length;r+=1)this[n].insertBefore(e[r],this[n].childNodes[0]);else this[n].insertBefore(e,this[n].childNodes[0]);return this},di.prependTo=function(t){return f(t).prepend(this),this},di.prev=function(t){if(this.length>0){var e=this[0];return t?e.previousElementSibling&&f(e.previousElementSibling).is(t)?f([e.previousElementSibling]):f([]):e.previousElementSibling?f([e.previousElementSibling]):f([])}return f([])},di.prevAll=function(t){var e=[],n=this[0];if(!n)return f([]);for(;n.previousElementSibling;){var r=n.previousElementSibling;t?f(r).is(t)&&e.push(r):e.push(r),n=r}return f(e)},di.prop=function(t,e){if(1!==arguments.length||"string"!=typeof t){for(var n=0;n<this.length;n+=1)if(2===arguments.length)this[n][t]=e;else for(var r in t)this[n][r]=t[r];return this}return this[0]?this[0][t]:this},di.remove=function(){for(var t=0;t<this.length;t+=1)this[t].parentNode&&this[t].parentNode.removeChild(this[t]);return this},di.removeAttr=function(t){for(var e=0;e<this.length;e+=1)this[e].removeAttribute(t);return this},di.removeClass=function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];var r=u(e.map((function(t){return t.split(" ")})));return this.forEach((function(t){var e;(e=t.classList).remove.apply(e,r)})),this},di.removeData=function(t){for(var e=0;e<this.length;e+=1){var n=this[e];n.dom7ElementDataStorage&&n.dom7ElementDataStorage[t]&&(n.dom7ElementDataStorage[t]=null,delete n.dom7ElementDataStorage[t])}},di.resize=I,di.scroll=C,di.scrollLeft=function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];var r=e[0],i=e[1],o=e[2],u=e[3];3===e.length&&"function"==typeof o&&(r=e[0],i=e[1],u=e[2],o=e[3]);var a=this;return void 0===r?a.length>0?a[0].scrollLeft:null:a.scrollTo(r,void 0,i,o,u)},di.scrollTo=function(){for(var e=t.getWindow(),n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];var o=r[0],u=r[1],a=r[2],f=r[3],c=r[4];return 4===r.length&&"function"==typeof f&&(c=f,o=r[0],u=r[1],a=r[2],c=r[3],f=r[4]),void 0===f&&(f="swing"),this.each((function(){var t,n,r,i,s,l,h,p,d=this,v=u>0||0===u,m=o>0||0===o;if(void 0===f&&(f="swing"),v&&(t=d.scrollTop,a||(d.scrollTop=u)),m&&(n=d.scrollLeft,a||(d.scrollLeft=o)),a){v&&(r=d.scrollHeight-d.offsetHeight,s=Math.max(Math.min(u,r),0)),m&&(i=d.scrollWidth-d.offsetWidth,l=Math.max(Math.min(o,i),0));var g=null;v&&s===t&&(v=!1),m&&l===n&&(m=!1),e.requestAnimationFrame((function r(i){void 0===i&&(i=(new Date).getTime()),null===g&&(g=i);var o,u=Math.max(Math.min((i-g)/a,1),0),y="linear"===f?u:.5-Math.cos(u*Math.PI)/2;v&&(h=t+y*(s-t)),m&&(p=n+y*(l-n)),v&&s>t&&h>=s&&(d.scrollTop=s,o=!0),v&&s<t&&h<=s&&(d.scrollTop=s,o=!0),m&&l>n&&p>=l&&(d.scrollLeft=l,o=!0),m&&l<n&&p<=l&&(d.scrollLeft=l,o=!0),o?c&&c():(v&&(d.scrollTop=h),m&&(d.scrollLeft=p),e.requestAnimationFrame(r))}))}}))},di.scrollTop=function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];var r=e[0],i=e[1],o=e[2],u=e[3];3===e.length&&"function"==typeof o&&(r=e[0],i=e[1],u=e[2],o=e[3]);var a=this;return void 0===r?a.length>0?a[0].scrollTop:null:a.scrollTo(void 0,r,i,o,u)},di.show=function(){for(var e=t.getWindow(),n=0;n<this.length;n+=1){var r=this[n];"none"===r.style.display&&(r.style.display=""),"none"===e.getComputedStyle(r,null).getPropertyValue("display")&&(r.style.display="block")}return this},di.siblings=function(t){return this.nextAll(t).add(this.prevAll(t))},di.stop=function(){for(var t=this,e=0;e<t.length;e+=1)t[e].dom7AnimateInstance&&t[e].dom7AnimateInstance.stop()},di.styles=function(){var e=t.getWindow();return this[0]?e.getComputedStyle(this[0],null):{}},di.submit=b,di.text=function(t){if(void 0===t)return this[0]?this[0].textContent.trim():null;for(var e=0;e<this.length;e+=1)this[e].textContent=t;return this},di.toggleClass=function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];var r=u(e.map((function(t){return t.split(" ")})));this.forEach((function(t){r.forEach((function(e){t.classList.toggle(e)}))}))},di.touchend=M,di.touchmove=P,di.touchstart=j,di.transform=function(t){for(var e=0;e<this.length;e+=1)this[e].style.transform=t;return this},di.transition=function(t){for(var e=0;e<this.length;e+=1)this[e].style.transitionDuration="string"!=typeof t?t+"ms":t;return this},di.transitionEnd=function(t){var e=this;return t&&e.on("transitionend",(function n(r){r.target===this&&(t.call(this,r),e.off("transitionend",n))})),this},di.trigger=function(){for(var e=t.getWindow(),n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];for(var o=r[0].split(" "),u=r[1],a=0;a<o.length;a+=1)for(var f=o[a],c=0;c<this.length;c+=1){var s=this[c];if(e.CustomEvent){var l=new e.CustomEvent(f,{detail:u,bubbles:!0,cancelable:!0});s.dom7EventData=r.filter((function(t,e){return e>0})),s.dispatchEvent(l),s.dom7EventData=[],delete s.dom7EventData}}return this},di.val=function(t){if(void 0===t){var e=this[0];if(!e)return;if(e.multiple&&"select"===e.nodeName.toLowerCase()){for(var n=[],r=0;r<e.selectedOptions.length;r+=1)n.push(e.selectedOptions[r].value);return n}return e.value}for(var i=0;i<this.length;i+=1){var o=this[i];if(Array.isArray(t)&&o.multiple&&"select"===o.nodeName.toLowerCase())for(var u=0;u<o.options.length;u+=1)o.options[u].selected=t.indexOf(o.options[u].value)>=0;else o.value=t}return this},di.value=function(t){return this.val(t)},di.width=function(){var e=t.getWindow();return this[0]===e?e.innerWidth:this.length>0?parseFloat(this.css("width")):null},di}var yi=gi(),bi=u(yi);yi.append&&(bi.fn.append=yi.append),yi.html&&(bi.fn.html=yi.html),yi.val&&(bi.fn.val=yi.val),yi.on&&(bi.fn.on=yi.on),yi.focus&&(bi.fn.focus=yi.focus),yi.is&&(bi.fn.is=yi.is),yi.parents&&(bi.fn.parents=yi.parents),yi.find&&(bi.fn.find=yi.find);var wi,Ei,xi,Si,Oi,Ai,Ti,Li={};function ji(){if(Ei)return wi;Ei=1;var t=TypeError;return wi=function(e){if(e>9007199254740991)throw t("Maximum allowed index exceeded");return e}}function Mi(){if(Si)return xi;Si=1;var t=Ut(),e=ae(),n=Fe();return xi=function(r,i,o){t?e.f(r,i,n(0,o)):r[i]=o}}function Pi(){if(Ai)return Oi;Ai=1;var t=Q(),e=ct(),n=ut(),r=e("species");return Oi=function(e){return n>=51||!t((function(){var t=[];return(t.constructor={})[r]=function(){return{foo:1}},1!==t[e](Boolean).foo}))}}!function(){if(Ti)return Li;Ti=1;var t=Jn(),e=Q(),n=Nr(),r=Gt(),i=rt(),o=Tn(),u=ji(),a=Mi(),f=_r(),c=Pi(),s=ct(),l=ut(),h=s("isConcatSpreadable"),p=l>=51||!e((function(){var t=[];return t[h]=!1,t.concat()[0]!==t})),d=function(t){if(!r(t))return!1;var e=t[h];return void 0!==e?!!e:n(t)};t({target:"Array",proto:!0,arity:1,forced:!p||!c("concat")},{concat:function(t){var e,n,r,c,s,l=i(this),h=f(l,0),p=0;for(e=-1,r=arguments.length;e<r;e++)if(d(s=-1===e?l:arguments[e]))for(c=o(s),u(p+c),n=0;n<c;n++,p++)n in s&&a(h,p,s[n]);else u(p+1),a(h,p++,s);return h.length=p,h}})}();let Ii=(t=21)=>crypto.getRandomValues(new Uint8Array(t)).reduce(((t,e)=>t+=(e&=63)<36?e.toString(36):e<62?(e-26).toString(36).toUpperCase():e>62?"-":"_"),"");function Ci(t){return"".concat(t,"-").concat(Ii())}function Ni(){return Ci("w-e-insert-formula")}var Di=function(){function t(){this.title=e.t("formula.edit"),this.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M864 0a160 160 0 0 1 128 256l-64 64-224-224 64-64c26.752-20.096 59.968-32 96-32zM64 736l-64 288 288-64 592-592-224-224L64 736z m651.584-372.416l-448 448-55.168-55.168 448-448 55.168 55.168z"></path></svg>',this.tag="button",this.showModal=!0,this.modalWidth=300,this.$content=null,this.textareaId=Ni(),this.buttonId=Ni()}return t.prototype.getSelectedElem=function(t){var n=e.DomEditor.getSelectedNodeByType(t,"formula");return null==n?null:n},t.prototype.getValue=function(t){var e=this.getSelectedElem(t);return e&&e.value||""},t.prototype.isActive=function(t){return!1},t.prototype.exec=function(t,e){},t.prototype.isDisabled=function(t){var n=t.selection;return null==n||(!!e.SlateRange.isExpanded(n)||null==this.getSelectedElem(t))},t.prototype.getModalPositionNode=function(t){return this.getSelectedElem(t)},t.prototype.getModalContentElem=function(t){var n=this,r=this.textareaId,o=this.buttonId,u=i(e.genModalTextareaElems(e.t("formula.formula"),r,e.t("formula.placeholder")),2),a=u[0],f=u[1],c=bi(f),s=i(e.genModalButtonElems(o,e.t("formula.ok")),1)[0];if(null==this.$content){var l=bi("<div></div>");l.on("click","#".concat(o),(function(e){e.preventDefault();var i=l.find("#".concat(r)).val().trim();n.updateFormula(t,i),t.hidePanelOrModal()})),this.$content=l}var h=this.$content;h.html(""),h.append(a),h.append(s);var p=this.getValue(t);return c.val(p),setTimeout((function(){c.focus()})),h[0]},t.prototype.updateFormula=function(t,n){if(n&&(t.restoreSelection(),!this.isDisabled(t))){var r=this.getSelectedElem(t);if(null!=r){var i=e.DomEditor.findPath(t,r),o={value:n};e.SlateTransforms.setNodes(t,o,{at:i})}}},t}();function _i(){return Ci("w-e-insert-formula")}var ki=function(){function t(){this.title=e.t("formula.insert"),this.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M941.6 734.72L985.984 640H1024l-64 384H0v-74.24l331.552-391.2L0 227.008V0h980L1024 256h-34.368l-18.72-38.88C935.584 143.744 909.024 128 832 128H169.984l353.056 353.056L225.632 832H768c116 0 146.656-41.568 173.6-97.28z"></path></svg>',this.tag="button",this.showModal=!0,this.modalWidth=300,this.$content=null,this.textareaId=_i(),this.buttonId=_i()}return t.prototype.getValue=function(t){return""},t.prototype.isActive=function(t){return!1},t.prototype.exec=function(t,e){},t.prototype.isDisabled=function(t){var n=t.selection;if(null==n)return!0;if(e.SlateRange.isExpanded(n))return!0;var r=e.DomEditor.getSelectedElems(t);return!!r.some((function(e){return t.isVoid(e)}))||!!r.some((function(t){return"pre"===e.DomEditor.getNodeType(t)}))},t.prototype.getModalPositionNode=function(t){return null},t.prototype.getModalContentElem=function(t){var n=this,r=this.textareaId,o=this.buttonId,u=i(e.genModalTextareaElems(e.t("formula.formula"),r,e.t("formula.placeholder")),2),a=u[0],f=u[1],c=bi(f),s=i(e.genModalButtonElems(o,e.t("formula.ok")),1)[0];if(null==this.$content){var l=bi("<div></div>");l.on("click","#".concat(o),(function(e){e.preventDefault();var i=l.find("#".concat(r)).val().trim();n.insertFormula(t,i),t.hidePanelOrModal()})),this.$content=l}var h=this.$content;return h.html(""),h.append(a),h.append(s),c.val(""),setTimeout((function(){c.focus()})),h[0]},t.prototype.insertFormula=function(t,e){if(e&&(t.restoreSelection(),!this.isDisabled(t))){var n={type:"formula",value:e,children:[{text:""}]};t.insertNode(n)}},t}();return{editorPlugin:function(t){var n=t.isInline,r=t.isVoid,i=t;return i.isInline=function(t){return"formula"===e.DomEditor.getNodeType(t)||n(t)},i.isVoid=function(t){return"formula"===e.DomEditor.getNodeType(t)||r(t)},i},renderElems:[{type:"formula",renderElem:function(t,r,i){var o=e.DomEditor.isNodeSelected(i,t),u=t.value,a=void 0===u?"":u,f=n.h("w-e-formula-card",{dataset:{value:a}},null);return n.h("div",{props:{contentEditable:!1},style:{display:"inline-block",marginLeft:"3px",marginRight:"3px",border:o?"2px solid var(--w-e-textarea-selected-border-color)":"2px solid transparent",borderRadius:"3px",padding:"3px 3px"}},[f])}}],elemsToHtml:[Pr],parseElemsHtml:[{selector:'span[data-w-e-type="formula"]',parseElemHtml:function(t,e,n){return{type:"formula",value:t.getAttribute("data-value")||"",children:[{text:""}]}}}],menus:[{key:"insertFormula",factory:function(){return new ki}},{key:"editFormula",factory:function(){return new Di}}]}}));
2
- //# sourceMappingURL=index.js.map
1
+ (function (global, factory) {
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('katex'), require('@wangeditor-next/editor'), require('snabbdom')) :
3
+ typeof define === 'function' && define.amd ? define(['katex', '@wangeditor-next/editor', 'snabbdom'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.WangEditorFormulaPlugin = factory(global.katex, global.editor, global.snabbdom));
5
+ })(this, (function (katex, editor, snabbdom) { 'use strict';
6
+
7
+ /******************************************************************************
8
+ Copyright (c) Microsoft Corporation.
9
+
10
+ Permission to use, copy, modify, and/or distribute this software for any
11
+ purpose with or without fee is hereby granted.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
14
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
15
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
16
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
17
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
18
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19
+ PERFORMANCE OF THIS SOFTWARE.
20
+ ***************************************************************************** */
21
+ /* global Reflect, Promise, SuppressedError, Symbol */
22
+
23
+ var extendStatics = function(d, b) {
24
+ extendStatics = Object.setPrototypeOf ||
25
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
26
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
27
+ return extendStatics(d, b);
28
+ };
29
+
30
+ function __extends(d, b) {
31
+ if (typeof b !== "function" && b !== null)
32
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
33
+ extendStatics(d, b);
34
+ function __() { this.constructor = d; }
35
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
36
+ }
37
+
38
+ function __read(o, n) {
39
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
40
+ if (!m) return o;
41
+ var i = m.call(o), r, ar = [], e;
42
+ try {
43
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
44
+ }
45
+ catch (error) { e = { error: error }; }
46
+ finally {
47
+ try {
48
+ if (r && !r.done && (m = i["return"])) m.call(i);
49
+ }
50
+ finally { if (e) throw e.error; }
51
+ }
52
+ return ar;
53
+ }
54
+
55
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
56
+ var e = new Error(message);
57
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
58
+ };
59
+
60
+ // @ts-nocheck
61
+ // 参考 https://github.com/webcomponents/custom-elements/blob/master/src/native-shim.js
62
+ /**
63
+ * @license
64
+ * Copyright (c) 2016 The Polymer Project Authors. All rights reserved.
65
+ * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
66
+ * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
67
+ * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
68
+ * Code distributed by Google as part of the polymer project is also
69
+ * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
70
+ */
71
+ /**
72
+ * This shim allows elements written in, or compiled to, ES5 to work on native
73
+ * implementations of Custom Elements v1. It sets new.target to the value of
74
+ * this.constructor so that the native HTMLElement constructor can access the
75
+ * current under-construction element's definition.
76
+ */
77
+ (function () {
78
+ if (
79
+ // No Reflect, no classes, no need for shim because native custom elements
80
+ // require ES2015 classes or Reflect.
81
+ window.Reflect === undefined
82
+ || window.customElements === undefined
83
+ // The webcomponentsjs custom elements polyfill doesn't require
84
+ // ES2015-compatible construction (`super()` or `Reflect.construct`).
85
+ || window.customElements.polyfillWrapFlushCallback) {
86
+ return;
87
+ }
88
+ var BuiltInHTMLElement = HTMLElement;
89
+ /**
90
+ * With jscompiler's RECOMMENDED_FLAGS the function name will be optimized away.
91
+ * However, if we declare the function as a property on an object literal, and
92
+ * use quotes for the property name, then closure will leave that much intact,
93
+ * which is enough for the JS VM to correctly set Function.prototype.name.
94
+ */
95
+ var wrapperForTheName = {
96
+ // eslint-disable-next-line func-names
97
+ HTMLElement: /** @this {!Object} */ function HTMLElement() {
98
+ return Reflect.construct(BuiltInHTMLElement, [], /** @type {!Function} */ this.constructor);
99
+ },
100
+ };
101
+ window.HTMLElement = wrapperForTheName.HTMLElement;
102
+ HTMLElement.prototype = BuiltInHTMLElement.prototype;
103
+ HTMLElement.prototype.constructor = HTMLElement;
104
+ Object.setPrototypeOf(HTMLElement, BuiltInHTMLElement);
105
+ }());
106
+
107
+ var katexStyleContent = undefined;
108
+
109
+ /**
110
+ * @description 注册自定义 elem
111
+ * @author wangfupeng
112
+ */
113
+ var WangEditorFormulaCard = /** @class */ (function (_super) {
114
+ __extends(WangEditorFormulaCard, _super);
115
+ function WangEditorFormulaCard() {
116
+ var _this = _super.call(this) || this;
117
+ var shadow = _this.attachShadow({ mode: 'open' });
118
+ var document = shadow.ownerDocument;
119
+ var style = document.createElement('style');
120
+ style.innerHTML = katexStyleContent; // 加载 css 文本
121
+ shadow.appendChild(style);
122
+ var span = document.createElement('span');
123
+ span.style.display = 'inline-block';
124
+ shadow.appendChild(span);
125
+ _this.span = span;
126
+ return _this;
127
+ }
128
+ Object.defineProperty(WangEditorFormulaCard, "observedAttributes", {
129
+ // 监听的 attr
130
+ get: function () {
131
+ return ['data-value'];
132
+ },
133
+ enumerable: false,
134
+ configurable: true
135
+ });
136
+ WangEditorFormulaCard.prototype.attributeChangedCallback = function (name, oldValue, newValue) {
137
+ if (name === 'data-value') {
138
+ if (oldValue === newValue) {
139
+ return;
140
+ }
141
+ this.render(newValue || '');
142
+ }
143
+ };
144
+ WangEditorFormulaCard.prototype.render = function (value) {
145
+ katex.render(value, this.span, {
146
+ throwOnError: false,
147
+ });
148
+ };
149
+ return WangEditorFormulaCard;
150
+ }(HTMLElement));
151
+ if (!window.customElements.get('w-e-formula-card')) {
152
+ window.customElements.define('w-e-formula-card', WangEditorFormulaCard);
153
+ }
154
+
155
+ /**
156
+ * @description 多语言
157
+ * @author wangfupeng
158
+ */
159
+ editor.i18nAddResources('en', {
160
+ formula: {
161
+ formula: 'Formula',
162
+ placeholder: 'Use LateX syntax',
163
+ insert: 'Insert formula',
164
+ edit: 'Edit formula',
165
+ ok: 'OK',
166
+ },
167
+ });
168
+ editor.i18nAddResources('zh-CN', {
169
+ formula: {
170
+ formula: '公式',
171
+ placeholder: '使用 LateX 语法',
172
+ insert: '插入公式',
173
+ edit: '编辑公式',
174
+ ok: '确定',
175
+ },
176
+ });
177
+
178
+ /**
179
+ * @description elem to html
180
+ * @author wangfupeng
181
+ */
182
+ // 生成 html 的函数
183
+ function formulaToHtml(elem, _childrenHtml) {
184
+ var _a = elem.value, value = _a === void 0 ? '' : _a;
185
+ return "<span data-w-e-type=\"formula\" data-w-e-is-void data-w-e-is-inline data-value=\"".concat(value, "\"></span>");
186
+ }
187
+ // 配置
188
+ var conf$1 = {
189
+ type: 'formula', // 节点 type ,重要!!!
190
+ elemToHtml: formulaToHtml,
191
+ };
192
+
193
+ /**
194
+ * @description icon svg
195
+ * @author wangfupeng
196
+ */
197
+ /**
198
+ * 【注意】svg 字符串的长度 ,否则会导致代码体积过大
199
+ * 尽量选择 https://www.iconfont.cn/collections/detail?spm=a313x.7781069.0.da5a778a4&cid=20293
200
+ * 找不到再从 iconfont.com 搜索
201
+ */
202
+ // 公式
203
+ var SIGMA_SVG = '<svg viewBox="0 0 1024 1024"><path d="M941.6 734.72L985.984 640H1024l-64 384H0v-74.24l331.552-391.2L0 227.008V0h980L1024 256h-34.368l-18.72-38.88C935.584 143.744 909.024 128 832 128H169.984l353.056 353.056L225.632 832H768c116 0 146.656-41.568 173.6-97.28z"></path></svg>';
204
+ // 编辑
205
+ var PENCIL_SVG = '<svg viewBox="0 0 1024 1024"><path d="M864 0a160 160 0 0 1 128 256l-64 64-224-224 64-64c26.752-20.096 59.968-32 96-32zM64 736l-64 288 288-64 592-592-224-224L64 736z m651.584-372.416l-448 448-55.168-55.168 448-448 55.168 55.168z"></path></svg>';
206
+
207
+ function getDefaultExportFromCjs (x) {
208
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
209
+ }
210
+
211
+ var dom7_cjs = {};
212
+
213
+ var ssrWindow_umd$1 = {exports: {}};
214
+
215
+ /**
216
+ * SSR Window 3.0.0
217
+ * Better handling for window object in SSR environment
218
+ * https://github.com/nolimits4web/ssr-window
219
+ *
220
+ * Copyright 2020, Vladimir Kharlampidi
221
+ *
222
+ * Licensed under MIT
223
+ *
224
+ * Released on: November 9, 2020
225
+ */
226
+ var ssrWindow_umd = ssrWindow_umd$1.exports;
227
+
228
+ var hasRequiredSsrWindow_umd;
229
+
230
+ function requireSsrWindow_umd () {
231
+ if (hasRequiredSsrWindow_umd) return ssrWindow_umd$1.exports;
232
+ hasRequiredSsrWindow_umd = 1;
233
+ (function (module, exports) {
234
+ (function (global, factory) {
235
+ factory(exports) ;
236
+ }(ssrWindow_umd, (function (exports) {
237
+ /* eslint-disable no-param-reassign */
238
+ function isObject(obj) {
239
+ return (obj !== null &&
240
+ typeof obj === 'object' &&
241
+ 'constructor' in obj &&
242
+ obj.constructor === Object);
243
+ }
244
+ function extend(target, src) {
245
+ if (target === void 0) { target = {}; }
246
+ if (src === void 0) { src = {}; }
247
+ Object.keys(src).forEach(function (key) {
248
+ if (typeof target[key] === 'undefined')
249
+ target[key] = src[key];
250
+ else if (isObject(src[key]) &&
251
+ isObject(target[key]) &&
252
+ Object.keys(src[key]).length > 0) {
253
+ extend(target[key], src[key]);
254
+ }
255
+ });
256
+ }
257
+
258
+ var ssrDocument = {
259
+ body: {},
260
+ addEventListener: function () { },
261
+ removeEventListener: function () { },
262
+ activeElement: {
263
+ blur: function () { },
264
+ nodeName: '',
265
+ },
266
+ querySelector: function () {
267
+ return null;
268
+ },
269
+ querySelectorAll: function () {
270
+ return [];
271
+ },
272
+ getElementById: function () {
273
+ return null;
274
+ },
275
+ createEvent: function () {
276
+ return {
277
+ initEvent: function () { },
278
+ };
279
+ },
280
+ createElement: function () {
281
+ return {
282
+ children: [],
283
+ childNodes: [],
284
+ style: {},
285
+ setAttribute: function () { },
286
+ getElementsByTagName: function () {
287
+ return [];
288
+ },
289
+ };
290
+ },
291
+ createElementNS: function () {
292
+ return {};
293
+ },
294
+ importNode: function () {
295
+ return null;
296
+ },
297
+ location: {
298
+ hash: '',
299
+ host: '',
300
+ hostname: '',
301
+ href: '',
302
+ origin: '',
303
+ pathname: '',
304
+ protocol: '',
305
+ search: '',
306
+ },
307
+ };
308
+ function getDocument() {
309
+ var doc = typeof document !== 'undefined' ? document : {};
310
+ extend(doc, ssrDocument);
311
+ return doc;
312
+ }
313
+
314
+ var ssrWindow = {
315
+ document: ssrDocument,
316
+ navigator: {
317
+ userAgent: '',
318
+ },
319
+ location: {
320
+ hash: '',
321
+ host: '',
322
+ hostname: '',
323
+ href: '',
324
+ origin: '',
325
+ pathname: '',
326
+ protocol: '',
327
+ search: '',
328
+ },
329
+ history: {
330
+ replaceState: function () { },
331
+ pushState: function () { },
332
+ go: function () { },
333
+ back: function () { },
334
+ },
335
+ CustomEvent: function CustomEvent() {
336
+ return this;
337
+ },
338
+ addEventListener: function () { },
339
+ removeEventListener: function () { },
340
+ getComputedStyle: function () {
341
+ return {
342
+ getPropertyValue: function () {
343
+ return '';
344
+ },
345
+ };
346
+ },
347
+ Image: function () { },
348
+ Date: function () { },
349
+ screen: {},
350
+ setTimeout: function () { },
351
+ clearTimeout: function () { },
352
+ matchMedia: function () {
353
+ return {};
354
+ },
355
+ requestAnimationFrame: function (callback) {
356
+ if (typeof setTimeout === 'undefined') {
357
+ callback();
358
+ return null;
359
+ }
360
+ return setTimeout(callback, 0);
361
+ },
362
+ cancelAnimationFrame: function (id) {
363
+ if (typeof setTimeout === 'undefined') {
364
+ return;
365
+ }
366
+ clearTimeout(id);
367
+ },
368
+ };
369
+ function getWindow() {
370
+ var win = typeof window !== 'undefined' ? window : {};
371
+ extend(win, ssrWindow);
372
+ return win;
373
+ }
374
+
375
+ exports.extend = extend;
376
+ exports.getDocument = getDocument;
377
+ exports.getWindow = getWindow;
378
+ exports.ssrDocument = ssrDocument;
379
+ exports.ssrWindow = ssrWindow;
380
+
381
+ Object.defineProperty(exports, '__esModule', { value: true });
382
+
383
+ })));
384
+
385
+ } (ssrWindow_umd$1, ssrWindow_umd$1.exports));
386
+ return ssrWindow_umd$1.exports;
387
+ }
388
+
389
+ /**
390
+ * Dom7 3.0.0
391
+ * Minimalistic JavaScript library for DOM manipulation, with a jQuery-compatible API
392
+ * https://framework7.io/docs/dom7.html
393
+ *
394
+ * Copyright 2020, Vladimir Kharlampidi
395
+ *
396
+ * Licensed under MIT
397
+ *
398
+ * Released on: November 9, 2020
399
+ */
400
+
401
+ var hasRequiredDom7_cjs;
402
+
403
+ function requireDom7_cjs () {
404
+ if (hasRequiredDom7_cjs) return dom7_cjs;
405
+ hasRequiredDom7_cjs = 1;
406
+
407
+ Object.defineProperty(dom7_cjs, '__esModule', { value: true });
408
+
409
+ var ssrWindow = requireSsrWindow_umd();
410
+
411
+ function _inheritsLoose(subClass, superClass) {
412
+ subClass.prototype = Object.create(superClass.prototype);
413
+ subClass.prototype.constructor = subClass;
414
+ subClass.__proto__ = superClass;
415
+ }
416
+
417
+ function _getPrototypeOf(o) {
418
+ _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
419
+ return o.__proto__ || Object.getPrototypeOf(o);
420
+ };
421
+ return _getPrototypeOf(o);
422
+ }
423
+
424
+ function _setPrototypeOf(o, p) {
425
+ _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
426
+ o.__proto__ = p;
427
+ return o;
428
+ };
429
+
430
+ return _setPrototypeOf(o, p);
431
+ }
432
+
433
+ function _isNativeReflectConstruct() {
434
+ if (typeof Reflect === "undefined" || !Reflect.construct) return false;
435
+ if (Reflect.construct.sham) return false;
436
+ if (typeof Proxy === "function") return true;
437
+
438
+ try {
439
+ Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
440
+ return true;
441
+ } catch (e) {
442
+ return false;
443
+ }
444
+ }
445
+
446
+ function _construct(Parent, args, Class) {
447
+ if (_isNativeReflectConstruct()) {
448
+ _construct = Reflect.construct;
449
+ } else {
450
+ _construct = function _construct(Parent, args, Class) {
451
+ var a = [null];
452
+ a.push.apply(a, args);
453
+ var Constructor = Function.bind.apply(Parent, a);
454
+ var instance = new Constructor();
455
+ if (Class) _setPrototypeOf(instance, Class.prototype);
456
+ return instance;
457
+ };
458
+ }
459
+
460
+ return _construct.apply(null, arguments);
461
+ }
462
+
463
+ function _isNativeFunction(fn) {
464
+ return Function.toString.call(fn).indexOf("[native code]") !== -1;
465
+ }
466
+
467
+ function _wrapNativeSuper(Class) {
468
+ var _cache = typeof Map === "function" ? new Map() : undefined;
469
+
470
+ _wrapNativeSuper = function _wrapNativeSuper(Class) {
471
+ if (Class === null || !_isNativeFunction(Class)) return Class;
472
+
473
+ if (typeof Class !== "function") {
474
+ throw new TypeError("Super expression must either be null or a function");
475
+ }
476
+
477
+ if (typeof _cache !== "undefined") {
478
+ if (_cache.has(Class)) return _cache.get(Class);
479
+
480
+ _cache.set(Class, Wrapper);
481
+ }
482
+
483
+ function Wrapper() {
484
+ return _construct(Class, arguments, _getPrototypeOf(this).constructor);
485
+ }
486
+
487
+ Wrapper.prototype = Object.create(Class.prototype, {
488
+ constructor: {
489
+ value: Wrapper,
490
+ enumerable: false,
491
+ writable: true,
492
+ configurable: true
493
+ }
494
+ });
495
+ return _setPrototypeOf(Wrapper, Class);
496
+ };
497
+
498
+ return _wrapNativeSuper(Class);
499
+ }
500
+
501
+ function _assertThisInitialized(self) {
502
+ if (self === void 0) {
503
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
504
+ }
505
+
506
+ return self;
507
+ }
508
+
509
+ /* eslint-disable no-proto */
510
+ function makeReactive(obj) {
511
+ var proto = obj.__proto__;
512
+ Object.defineProperty(obj, '__proto__', {
513
+ get: function get() {
514
+ return proto;
515
+ },
516
+ set: function set(value) {
517
+ proto.__proto__ = value;
518
+ }
519
+ });
520
+ }
521
+
522
+ var Dom7 = /*#__PURE__*/function (_Array) {
523
+ _inheritsLoose(Dom7, _Array);
524
+
525
+ function Dom7(items) {
526
+ var _this;
527
+
528
+ _this = _Array.call.apply(_Array, [this].concat(items)) || this;
529
+ makeReactive(_assertThisInitialized(_this));
530
+ return _this;
531
+ }
532
+
533
+ return Dom7;
534
+ }( /*#__PURE__*/_wrapNativeSuper(Array));
535
+
536
+ function arrayFlat(arr) {
537
+ if (arr === void 0) {
538
+ arr = [];
539
+ }
540
+
541
+ var res = [];
542
+ arr.forEach(function (el) {
543
+ if (Array.isArray(el)) {
544
+ res.push.apply(res, arrayFlat(el));
545
+ } else {
546
+ res.push(el);
547
+ }
548
+ });
549
+ return res;
550
+ }
551
+ function arrayFilter(arr, callback) {
552
+ return Array.prototype.filter.call(arr, callback);
553
+ }
554
+ function arrayUnique(arr) {
555
+ var uniqueArray = [];
556
+
557
+ for (var i = 0; i < arr.length; i += 1) {
558
+ if (uniqueArray.indexOf(arr[i]) === -1) uniqueArray.push(arr[i]);
559
+ }
560
+
561
+ return uniqueArray;
562
+ }
563
+ function toCamelCase(string) {
564
+ return string.toLowerCase().replace(/-(.)/g, function (match, group) {
565
+ return group.toUpperCase();
566
+ });
567
+ }
568
+
569
+ function qsa(selector, context) {
570
+ if (typeof selector !== 'string') {
571
+ return [selector];
572
+ }
573
+
574
+ var a = [];
575
+ var res = context.querySelectorAll(selector);
576
+
577
+ for (var i = 0; i < res.length; i += 1) {
578
+ a.push(res[i]);
579
+ }
580
+
581
+ return a;
582
+ }
583
+
584
+ function $(selector, context) {
585
+ var window = ssrWindow.getWindow();
586
+ var document = ssrWindow.getDocument();
587
+ var arr = [];
588
+
589
+ if (!context && selector instanceof Dom7) {
590
+ return selector;
591
+ }
592
+
593
+ if (!selector) {
594
+ return new Dom7(arr);
595
+ }
596
+
597
+ if (typeof selector === 'string') {
598
+ var html = selector.trim();
599
+
600
+ if (html.indexOf('<') >= 0 && html.indexOf('>') >= 0) {
601
+ var toCreate = 'div';
602
+ if (html.indexOf('<li') === 0) toCreate = 'ul';
603
+ if (html.indexOf('<tr') === 0) toCreate = 'tbody';
604
+ if (html.indexOf('<td') === 0 || html.indexOf('<th') === 0) toCreate = 'tr';
605
+ if (html.indexOf('<tbody') === 0) toCreate = 'table';
606
+ if (html.indexOf('<option') === 0) toCreate = 'select';
607
+ var tempParent = document.createElement(toCreate);
608
+ tempParent.innerHTML = html;
609
+
610
+ for (var i = 0; i < tempParent.childNodes.length; i += 1) {
611
+ arr.push(tempParent.childNodes[i]);
612
+ }
613
+ } else {
614
+ arr = qsa(selector.trim(), context || document);
615
+ } // arr = qsa(selector, document);
616
+
617
+ } else if (selector.nodeType || selector === window || selector === document) {
618
+ arr.push(selector);
619
+ } else if (Array.isArray(selector)) {
620
+ if (selector instanceof Dom7) return selector;
621
+ arr = selector;
622
+ }
623
+
624
+ return new Dom7(arrayUnique(arr));
625
+ }
626
+
627
+ $.fn = Dom7.prototype;
628
+
629
+ function addClass() {
630
+ for (var _len = arguments.length, classes = new Array(_len), _key = 0; _key < _len; _key++) {
631
+ classes[_key] = arguments[_key];
632
+ }
633
+
634
+ var classNames = arrayFlat(classes.map(function (c) {
635
+ return c.split(' ');
636
+ }));
637
+ this.forEach(function (el) {
638
+ var _el$classList;
639
+
640
+ (_el$classList = el.classList).add.apply(_el$classList, classNames);
641
+ });
642
+ return this;
643
+ }
644
+
645
+ function removeClass() {
646
+ for (var _len2 = arguments.length, classes = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
647
+ classes[_key2] = arguments[_key2];
648
+ }
649
+
650
+ var classNames = arrayFlat(classes.map(function (c) {
651
+ return c.split(' ');
652
+ }));
653
+ this.forEach(function (el) {
654
+ var _el$classList2;
655
+
656
+ (_el$classList2 = el.classList).remove.apply(_el$classList2, classNames);
657
+ });
658
+ return this;
659
+ }
660
+
661
+ function toggleClass() {
662
+ for (var _len3 = arguments.length, classes = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
663
+ classes[_key3] = arguments[_key3];
664
+ }
665
+
666
+ var classNames = arrayFlat(classes.map(function (c) {
667
+ return c.split(' ');
668
+ }));
669
+ this.forEach(function (el) {
670
+ classNames.forEach(function (className) {
671
+ el.classList.toggle(className);
672
+ });
673
+ });
674
+ }
675
+
676
+ function hasClass() {
677
+ for (var _len4 = arguments.length, classes = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
678
+ classes[_key4] = arguments[_key4];
679
+ }
680
+
681
+ var classNames = arrayFlat(classes.map(function (c) {
682
+ return c.split(' ');
683
+ }));
684
+ return arrayFilter(this, function (el) {
685
+ return classNames.filter(function (className) {
686
+ return el.classList.contains(className);
687
+ }).length > 0;
688
+ }).length > 0;
689
+ }
690
+
691
+ function attr(attrs, value) {
692
+ if (arguments.length === 1 && typeof attrs === 'string') {
693
+ // Get attr
694
+ if (this[0]) return this[0].getAttribute(attrs);
695
+ return undefined;
696
+ } // Set attrs
697
+
698
+
699
+ for (var i = 0; i < this.length; i += 1) {
700
+ if (arguments.length === 2) {
701
+ // String
702
+ this[i].setAttribute(attrs, value);
703
+ } else {
704
+ // Object
705
+ for (var attrName in attrs) {
706
+ this[i][attrName] = attrs[attrName];
707
+ this[i].setAttribute(attrName, attrs[attrName]);
708
+ }
709
+ }
710
+ }
711
+
712
+ return this;
713
+ }
714
+
715
+ function removeAttr(attr) {
716
+ for (var i = 0; i < this.length; i += 1) {
717
+ this[i].removeAttribute(attr);
718
+ }
719
+
720
+ return this;
721
+ }
722
+
723
+ function prop(props, value) {
724
+ if (arguments.length === 1 && typeof props === 'string') {
725
+ // Get prop
726
+ if (this[0]) return this[0][props];
727
+ } else {
728
+ // Set props
729
+ for (var i = 0; i < this.length; i += 1) {
730
+ if (arguments.length === 2) {
731
+ // String
732
+ this[i][props] = value;
733
+ } else {
734
+ // Object
735
+ for (var propName in props) {
736
+ this[i][propName] = props[propName];
737
+ }
738
+ }
739
+ }
740
+
741
+ return this;
742
+ }
743
+
744
+ return this;
745
+ }
746
+
747
+ function data(key, value) {
748
+ var el;
749
+
750
+ if (typeof value === 'undefined') {
751
+ el = this[0];
752
+ if (!el) return undefined; // Get value
753
+
754
+ if (el.dom7ElementDataStorage && key in el.dom7ElementDataStorage) {
755
+ return el.dom7ElementDataStorage[key];
756
+ }
757
+
758
+ var dataKey = el.getAttribute("data-" + key);
759
+
760
+ if (dataKey) {
761
+ return dataKey;
762
+ }
763
+
764
+ return undefined;
765
+ } // Set value
766
+
767
+
768
+ for (var i = 0; i < this.length; i += 1) {
769
+ el = this[i];
770
+ if (!el.dom7ElementDataStorage) el.dom7ElementDataStorage = {};
771
+ el.dom7ElementDataStorage[key] = value;
772
+ }
773
+
774
+ return this;
775
+ }
776
+
777
+ function removeData(key) {
778
+ for (var i = 0; i < this.length; i += 1) {
779
+ var el = this[i];
780
+
781
+ if (el.dom7ElementDataStorage && el.dom7ElementDataStorage[key]) {
782
+ el.dom7ElementDataStorage[key] = null;
783
+ delete el.dom7ElementDataStorage[key];
784
+ }
785
+ }
786
+ }
787
+
788
+ function dataset() {
789
+ var el = this[0];
790
+ if (!el) return undefined;
791
+ var dataset = {}; // eslint-disable-line
792
+
793
+ if (el.dataset) {
794
+ for (var dataKey in el.dataset) {
795
+ dataset[dataKey] = el.dataset[dataKey];
796
+ }
797
+ } else {
798
+ for (var i = 0; i < el.attributes.length; i += 1) {
799
+ var _attr = el.attributes[i];
800
+
801
+ if (_attr.name.indexOf('data-') >= 0) {
802
+ dataset[toCamelCase(_attr.name.split('data-')[1])] = _attr.value;
803
+ }
804
+ }
805
+ }
806
+
807
+ for (var key in dataset) {
808
+ if (dataset[key] === 'false') dataset[key] = false;else if (dataset[key] === 'true') dataset[key] = true;else if (parseFloat(dataset[key]) === dataset[key] * 1) dataset[key] *= 1;
809
+ }
810
+
811
+ return dataset;
812
+ }
813
+
814
+ function val(value) {
815
+ if (typeof value === 'undefined') {
816
+ // get value
817
+ var el = this[0];
818
+ if (!el) return undefined;
819
+
820
+ if (el.multiple && el.nodeName.toLowerCase() === 'select') {
821
+ var values = [];
822
+
823
+ for (var i = 0; i < el.selectedOptions.length; i += 1) {
824
+ values.push(el.selectedOptions[i].value);
825
+ }
826
+
827
+ return values;
828
+ }
829
+
830
+ return el.value;
831
+ } // set value
832
+
833
+
834
+ for (var _i = 0; _i < this.length; _i += 1) {
835
+ var _el = this[_i];
836
+
837
+ if (Array.isArray(value) && _el.multiple && _el.nodeName.toLowerCase() === 'select') {
838
+ for (var j = 0; j < _el.options.length; j += 1) {
839
+ _el.options[j].selected = value.indexOf(_el.options[j].value) >= 0;
840
+ }
841
+ } else {
842
+ _el.value = value;
843
+ }
844
+ }
845
+
846
+ return this;
847
+ }
848
+
849
+ function value(value) {
850
+ return this.val(value);
851
+ }
852
+
853
+ function transform(transform) {
854
+ for (var i = 0; i < this.length; i += 1) {
855
+ this[i].style.transform = transform;
856
+ }
857
+
858
+ return this;
859
+ }
860
+
861
+ function transition(duration) {
862
+ for (var i = 0; i < this.length; i += 1) {
863
+ this[i].style.transitionDuration = typeof duration !== 'string' ? duration + "ms" : duration;
864
+ }
865
+
866
+ return this;
867
+ }
868
+
869
+ function on() {
870
+ for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
871
+ args[_key5] = arguments[_key5];
872
+ }
873
+
874
+ var eventType = args[0],
875
+ targetSelector = args[1],
876
+ listener = args[2],
877
+ capture = args[3];
878
+
879
+ if (typeof args[1] === 'function') {
880
+ eventType = args[0];
881
+ listener = args[1];
882
+ capture = args[2];
883
+ targetSelector = undefined;
884
+ }
885
+
886
+ if (!capture) capture = false;
887
+
888
+ function handleLiveEvent(e) {
889
+ var target = e.target;
890
+ if (!target) return;
891
+ var eventData = e.target.dom7EventData || [];
892
+
893
+ if (eventData.indexOf(e) < 0) {
894
+ eventData.unshift(e);
895
+ }
896
+
897
+ if ($(target).is(targetSelector)) listener.apply(target, eventData);else {
898
+ var _parents = $(target).parents(); // eslint-disable-line
899
+
900
+
901
+ for (var k = 0; k < _parents.length; k += 1) {
902
+ if ($(_parents[k]).is(targetSelector)) listener.apply(_parents[k], eventData);
903
+ }
904
+ }
905
+ }
906
+
907
+ function handleEvent(e) {
908
+ var eventData = e && e.target ? e.target.dom7EventData || [] : [];
909
+
910
+ if (eventData.indexOf(e) < 0) {
911
+ eventData.unshift(e);
912
+ }
913
+
914
+ listener.apply(this, eventData);
915
+ }
916
+
917
+ var events = eventType.split(' ');
918
+ var j;
919
+
920
+ for (var i = 0; i < this.length; i += 1) {
921
+ var el = this[i];
922
+
923
+ if (!targetSelector) {
924
+ for (j = 0; j < events.length; j += 1) {
925
+ var event = events[j];
926
+ if (!el.dom7Listeners) el.dom7Listeners = {};
927
+ if (!el.dom7Listeners[event]) el.dom7Listeners[event] = [];
928
+ el.dom7Listeners[event].push({
929
+ listener: listener,
930
+ proxyListener: handleEvent
931
+ });
932
+ el.addEventListener(event, handleEvent, capture);
933
+ }
934
+ } else {
935
+ // Live events
936
+ for (j = 0; j < events.length; j += 1) {
937
+ var _event = events[j];
938
+ if (!el.dom7LiveListeners) el.dom7LiveListeners = {};
939
+ if (!el.dom7LiveListeners[_event]) el.dom7LiveListeners[_event] = [];
940
+
941
+ el.dom7LiveListeners[_event].push({
942
+ listener: listener,
943
+ proxyListener: handleLiveEvent
944
+ });
945
+
946
+ el.addEventListener(_event, handleLiveEvent, capture);
947
+ }
948
+ }
949
+ }
950
+
951
+ return this;
952
+ }
953
+
954
+ function off() {
955
+ for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
956
+ args[_key6] = arguments[_key6];
957
+ }
958
+
959
+ var eventType = args[0],
960
+ targetSelector = args[1],
961
+ listener = args[2],
962
+ capture = args[3];
963
+
964
+ if (typeof args[1] === 'function') {
965
+ eventType = args[0];
966
+ listener = args[1];
967
+ capture = args[2];
968
+ targetSelector = undefined;
969
+ }
970
+
971
+ if (!capture) capture = false;
972
+ var events = eventType.split(' ');
973
+
974
+ for (var i = 0; i < events.length; i += 1) {
975
+ var event = events[i];
976
+
977
+ for (var j = 0; j < this.length; j += 1) {
978
+ var el = this[j];
979
+ var handlers = void 0;
980
+
981
+ if (!targetSelector && el.dom7Listeners) {
982
+ handlers = el.dom7Listeners[event];
983
+ } else if (targetSelector && el.dom7LiveListeners) {
984
+ handlers = el.dom7LiveListeners[event];
985
+ }
986
+
987
+ if (handlers && handlers.length) {
988
+ for (var k = handlers.length - 1; k >= 0; k -= 1) {
989
+ var handler = handlers[k];
990
+
991
+ if (listener && handler.listener === listener) {
992
+ el.removeEventListener(event, handler.proxyListener, capture);
993
+ handlers.splice(k, 1);
994
+ } else if (listener && handler.listener && handler.listener.dom7proxy && handler.listener.dom7proxy === listener) {
995
+ el.removeEventListener(event, handler.proxyListener, capture);
996
+ handlers.splice(k, 1);
997
+ } else if (!listener) {
998
+ el.removeEventListener(event, handler.proxyListener, capture);
999
+ handlers.splice(k, 1);
1000
+ }
1001
+ }
1002
+ }
1003
+ }
1004
+ }
1005
+
1006
+ return this;
1007
+ }
1008
+
1009
+ function once() {
1010
+ var dom = this;
1011
+
1012
+ for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
1013
+ args[_key7] = arguments[_key7];
1014
+ }
1015
+
1016
+ var eventName = args[0],
1017
+ targetSelector = args[1],
1018
+ listener = args[2],
1019
+ capture = args[3];
1020
+
1021
+ if (typeof args[1] === 'function') {
1022
+ eventName = args[0];
1023
+ listener = args[1];
1024
+ capture = args[2];
1025
+ targetSelector = undefined;
1026
+ }
1027
+
1028
+ function onceHandler() {
1029
+ for (var _len8 = arguments.length, eventArgs = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {
1030
+ eventArgs[_key8] = arguments[_key8];
1031
+ }
1032
+
1033
+ listener.apply(this, eventArgs);
1034
+ dom.off(eventName, targetSelector, onceHandler, capture);
1035
+
1036
+ if (onceHandler.dom7proxy) {
1037
+ delete onceHandler.dom7proxy;
1038
+ }
1039
+ }
1040
+
1041
+ onceHandler.dom7proxy = listener;
1042
+ return dom.on(eventName, targetSelector, onceHandler, capture);
1043
+ }
1044
+
1045
+ function trigger() {
1046
+ var window = ssrWindow.getWindow();
1047
+
1048
+ for (var _len9 = arguments.length, args = new Array(_len9), _key9 = 0; _key9 < _len9; _key9++) {
1049
+ args[_key9] = arguments[_key9];
1050
+ }
1051
+
1052
+ var events = args[0].split(' ');
1053
+ var eventData = args[1];
1054
+
1055
+ for (var i = 0; i < events.length; i += 1) {
1056
+ var event = events[i];
1057
+
1058
+ for (var j = 0; j < this.length; j += 1) {
1059
+ var el = this[j];
1060
+
1061
+ if (window.CustomEvent) {
1062
+ var evt = new window.CustomEvent(event, {
1063
+ detail: eventData,
1064
+ bubbles: true,
1065
+ cancelable: true
1066
+ });
1067
+ el.dom7EventData = args.filter(function (data, dataIndex) {
1068
+ return dataIndex > 0;
1069
+ });
1070
+ el.dispatchEvent(evt);
1071
+ el.dom7EventData = [];
1072
+ delete el.dom7EventData;
1073
+ }
1074
+ }
1075
+ }
1076
+
1077
+ return this;
1078
+ }
1079
+
1080
+ function transitionEnd(callback) {
1081
+ var dom = this;
1082
+
1083
+ function fireCallBack(e) {
1084
+ if (e.target !== this) return;
1085
+ callback.call(this, e);
1086
+ dom.off('transitionend', fireCallBack);
1087
+ }
1088
+
1089
+ if (callback) {
1090
+ dom.on('transitionend', fireCallBack);
1091
+ }
1092
+
1093
+ return this;
1094
+ }
1095
+
1096
+ function animationEnd(callback) {
1097
+ var dom = this;
1098
+
1099
+ function fireCallBack(e) {
1100
+ if (e.target !== this) return;
1101
+ callback.call(this, e);
1102
+ dom.off('animationend', fireCallBack);
1103
+ }
1104
+
1105
+ if (callback) {
1106
+ dom.on('animationend', fireCallBack);
1107
+ }
1108
+
1109
+ return this;
1110
+ }
1111
+
1112
+ function width() {
1113
+ var window = ssrWindow.getWindow();
1114
+
1115
+ if (this[0] === window) {
1116
+ return window.innerWidth;
1117
+ }
1118
+
1119
+ if (this.length > 0) {
1120
+ return parseFloat(this.css('width'));
1121
+ }
1122
+
1123
+ return null;
1124
+ }
1125
+
1126
+ function outerWidth(includeMargins) {
1127
+ if (this.length > 0) {
1128
+ if (includeMargins) {
1129
+ var _styles = this.styles();
1130
+
1131
+ return this[0].offsetWidth + parseFloat(_styles.getPropertyValue('margin-right')) + parseFloat(_styles.getPropertyValue('margin-left'));
1132
+ }
1133
+
1134
+ return this[0].offsetWidth;
1135
+ }
1136
+
1137
+ return null;
1138
+ }
1139
+
1140
+ function height() {
1141
+ var window = ssrWindow.getWindow();
1142
+
1143
+ if (this[0] === window) {
1144
+ return window.innerHeight;
1145
+ }
1146
+
1147
+ if (this.length > 0) {
1148
+ return parseFloat(this.css('height'));
1149
+ }
1150
+
1151
+ return null;
1152
+ }
1153
+
1154
+ function outerHeight(includeMargins) {
1155
+ if (this.length > 0) {
1156
+ if (includeMargins) {
1157
+ var _styles2 = this.styles();
1158
+
1159
+ return this[0].offsetHeight + parseFloat(_styles2.getPropertyValue('margin-top')) + parseFloat(_styles2.getPropertyValue('margin-bottom'));
1160
+ }
1161
+
1162
+ return this[0].offsetHeight;
1163
+ }
1164
+
1165
+ return null;
1166
+ }
1167
+
1168
+ function offset() {
1169
+ if (this.length > 0) {
1170
+ var window = ssrWindow.getWindow();
1171
+ var document = ssrWindow.getDocument();
1172
+ var el = this[0];
1173
+ var box = el.getBoundingClientRect();
1174
+ var body = document.body;
1175
+ var clientTop = el.clientTop || body.clientTop || 0;
1176
+ var clientLeft = el.clientLeft || body.clientLeft || 0;
1177
+ var scrollTop = el === window ? window.scrollY : el.scrollTop;
1178
+ var scrollLeft = el === window ? window.scrollX : el.scrollLeft;
1179
+ return {
1180
+ top: box.top + scrollTop - clientTop,
1181
+ left: box.left + scrollLeft - clientLeft
1182
+ };
1183
+ }
1184
+
1185
+ return null;
1186
+ }
1187
+
1188
+ function hide() {
1189
+ for (var i = 0; i < this.length; i += 1) {
1190
+ this[i].style.display = 'none';
1191
+ }
1192
+
1193
+ return this;
1194
+ }
1195
+
1196
+ function show() {
1197
+ var window = ssrWindow.getWindow();
1198
+
1199
+ for (var i = 0; i < this.length; i += 1) {
1200
+ var el = this[i];
1201
+
1202
+ if (el.style.display === 'none') {
1203
+ el.style.display = '';
1204
+ }
1205
+
1206
+ if (window.getComputedStyle(el, null).getPropertyValue('display') === 'none') {
1207
+ // Still not visible
1208
+ el.style.display = 'block';
1209
+ }
1210
+ }
1211
+
1212
+ return this;
1213
+ }
1214
+
1215
+ function styles() {
1216
+ var window = ssrWindow.getWindow();
1217
+ if (this[0]) return window.getComputedStyle(this[0], null);
1218
+ return {};
1219
+ }
1220
+
1221
+ function css(props, value) {
1222
+ var window = ssrWindow.getWindow();
1223
+ var i;
1224
+
1225
+ if (arguments.length === 1) {
1226
+ if (typeof props === 'string') {
1227
+ // .css('width')
1228
+ if (this[0]) return window.getComputedStyle(this[0], null).getPropertyValue(props);
1229
+ } else {
1230
+ // .css({ width: '100px' })
1231
+ for (i = 0; i < this.length; i += 1) {
1232
+ for (var _prop in props) {
1233
+ this[i].style[_prop] = props[_prop];
1234
+ }
1235
+ }
1236
+
1237
+ return this;
1238
+ }
1239
+ }
1240
+
1241
+ if (arguments.length === 2 && typeof props === 'string') {
1242
+ // .css('width', '100px')
1243
+ for (i = 0; i < this.length; i += 1) {
1244
+ this[i].style[props] = value;
1245
+ }
1246
+
1247
+ return this;
1248
+ }
1249
+
1250
+ return this;
1251
+ }
1252
+
1253
+ function each(callback) {
1254
+ if (!callback) return this;
1255
+ this.forEach(function (el, index) {
1256
+ callback.apply(el, [el, index]);
1257
+ });
1258
+ return this;
1259
+ }
1260
+
1261
+ function filter(callback) {
1262
+ var result = arrayFilter(this, callback);
1263
+ return $(result);
1264
+ }
1265
+
1266
+ function html(html) {
1267
+ if (typeof html === 'undefined') {
1268
+ return this[0] ? this[0].innerHTML : null;
1269
+ }
1270
+
1271
+ for (var i = 0; i < this.length; i += 1) {
1272
+ this[i].innerHTML = html;
1273
+ }
1274
+
1275
+ return this;
1276
+ }
1277
+
1278
+ function text(text) {
1279
+ if (typeof text === 'undefined') {
1280
+ return this[0] ? this[0].textContent.trim() : null;
1281
+ }
1282
+
1283
+ for (var i = 0; i < this.length; i += 1) {
1284
+ this[i].textContent = text;
1285
+ }
1286
+
1287
+ return this;
1288
+ }
1289
+
1290
+ function is(selector) {
1291
+ var window = ssrWindow.getWindow();
1292
+ var document = ssrWindow.getDocument();
1293
+ var el = this[0];
1294
+ var compareWith;
1295
+ var i;
1296
+ if (!el || typeof selector === 'undefined') return false;
1297
+
1298
+ if (typeof selector === 'string') {
1299
+ if (el.matches) return el.matches(selector);
1300
+ if (el.webkitMatchesSelector) return el.webkitMatchesSelector(selector);
1301
+ if (el.msMatchesSelector) return el.msMatchesSelector(selector);
1302
+ compareWith = $(selector);
1303
+
1304
+ for (i = 0; i < compareWith.length; i += 1) {
1305
+ if (compareWith[i] === el) return true;
1306
+ }
1307
+
1308
+ return false;
1309
+ }
1310
+
1311
+ if (selector === document) {
1312
+ return el === document;
1313
+ }
1314
+
1315
+ if (selector === window) {
1316
+ return el === window;
1317
+ }
1318
+
1319
+ if (selector.nodeType || selector instanceof Dom7) {
1320
+ compareWith = selector.nodeType ? [selector] : selector;
1321
+
1322
+ for (i = 0; i < compareWith.length; i += 1) {
1323
+ if (compareWith[i] === el) return true;
1324
+ }
1325
+
1326
+ return false;
1327
+ }
1328
+
1329
+ return false;
1330
+ }
1331
+
1332
+ function index() {
1333
+ var child = this[0];
1334
+ var i;
1335
+
1336
+ if (child) {
1337
+ i = 0; // eslint-disable-next-line
1338
+
1339
+ while ((child = child.previousSibling) !== null) {
1340
+ if (child.nodeType === 1) i += 1;
1341
+ }
1342
+
1343
+ return i;
1344
+ }
1345
+
1346
+ return undefined;
1347
+ }
1348
+
1349
+ function eq(index) {
1350
+ if (typeof index === 'undefined') return this;
1351
+ var length = this.length;
1352
+
1353
+ if (index > length - 1) {
1354
+ return $([]);
1355
+ }
1356
+
1357
+ if (index < 0) {
1358
+ var returnIndex = length + index;
1359
+ if (returnIndex < 0) return $([]);
1360
+ return $([this[returnIndex]]);
1361
+ }
1362
+
1363
+ return $([this[index]]);
1364
+ }
1365
+
1366
+ function append() {
1367
+ var newChild;
1368
+ var document = ssrWindow.getDocument();
1369
+
1370
+ for (var k = 0; k < arguments.length; k += 1) {
1371
+ newChild = k < 0 || arguments.length <= k ? undefined : arguments[k];
1372
+
1373
+ for (var i = 0; i < this.length; i += 1) {
1374
+ if (typeof newChild === 'string') {
1375
+ var tempDiv = document.createElement('div');
1376
+ tempDiv.innerHTML = newChild;
1377
+
1378
+ while (tempDiv.firstChild) {
1379
+ this[i].appendChild(tempDiv.firstChild);
1380
+ }
1381
+ } else if (newChild instanceof Dom7) {
1382
+ for (var j = 0; j < newChild.length; j += 1) {
1383
+ this[i].appendChild(newChild[j]);
1384
+ }
1385
+ } else {
1386
+ this[i].appendChild(newChild);
1387
+ }
1388
+ }
1389
+ }
1390
+
1391
+ return this;
1392
+ }
1393
+
1394
+ function appendTo(parent) {
1395
+ $(parent).append(this);
1396
+ return this;
1397
+ }
1398
+
1399
+ function prepend(newChild) {
1400
+ var document = ssrWindow.getDocument();
1401
+ var i;
1402
+ var j;
1403
+
1404
+ for (i = 0; i < this.length; i += 1) {
1405
+ if (typeof newChild === 'string') {
1406
+ var tempDiv = document.createElement('div');
1407
+ tempDiv.innerHTML = newChild;
1408
+
1409
+ for (j = tempDiv.childNodes.length - 1; j >= 0; j -= 1) {
1410
+ this[i].insertBefore(tempDiv.childNodes[j], this[i].childNodes[0]);
1411
+ }
1412
+ } else if (newChild instanceof Dom7) {
1413
+ for (j = 0; j < newChild.length; j += 1) {
1414
+ this[i].insertBefore(newChild[j], this[i].childNodes[0]);
1415
+ }
1416
+ } else {
1417
+ this[i].insertBefore(newChild, this[i].childNodes[0]);
1418
+ }
1419
+ }
1420
+
1421
+ return this;
1422
+ }
1423
+
1424
+ function prependTo(parent) {
1425
+ $(parent).prepend(this);
1426
+ return this;
1427
+ }
1428
+
1429
+ function insertBefore(selector) {
1430
+ var before = $(selector);
1431
+
1432
+ for (var i = 0; i < this.length; i += 1) {
1433
+ if (before.length === 1) {
1434
+ before[0].parentNode.insertBefore(this[i], before[0]);
1435
+ } else if (before.length > 1) {
1436
+ for (var j = 0; j < before.length; j += 1) {
1437
+ before[j].parentNode.insertBefore(this[i].cloneNode(true), before[j]);
1438
+ }
1439
+ }
1440
+ }
1441
+ }
1442
+
1443
+ function insertAfter(selector) {
1444
+ var after = $(selector);
1445
+
1446
+ for (var i = 0; i < this.length; i += 1) {
1447
+ if (after.length === 1) {
1448
+ after[0].parentNode.insertBefore(this[i], after[0].nextSibling);
1449
+ } else if (after.length > 1) {
1450
+ for (var j = 0; j < after.length; j += 1) {
1451
+ after[j].parentNode.insertBefore(this[i].cloneNode(true), after[j].nextSibling);
1452
+ }
1453
+ }
1454
+ }
1455
+ }
1456
+
1457
+ function next(selector) {
1458
+ if (this.length > 0) {
1459
+ if (selector) {
1460
+ if (this[0].nextElementSibling && $(this[0].nextElementSibling).is(selector)) {
1461
+ return $([this[0].nextElementSibling]);
1462
+ }
1463
+
1464
+ return $([]);
1465
+ }
1466
+
1467
+ if (this[0].nextElementSibling) return $([this[0].nextElementSibling]);
1468
+ return $([]);
1469
+ }
1470
+
1471
+ return $([]);
1472
+ }
1473
+
1474
+ function nextAll(selector) {
1475
+ var nextEls = [];
1476
+ var el = this[0];
1477
+ if (!el) return $([]);
1478
+
1479
+ while (el.nextElementSibling) {
1480
+ var _next = el.nextElementSibling; // eslint-disable-line
1481
+
1482
+ if (selector) {
1483
+ if ($(_next).is(selector)) nextEls.push(_next);
1484
+ } else nextEls.push(_next);
1485
+
1486
+ el = _next;
1487
+ }
1488
+
1489
+ return $(nextEls);
1490
+ }
1491
+
1492
+ function prev(selector) {
1493
+ if (this.length > 0) {
1494
+ var el = this[0];
1495
+
1496
+ if (selector) {
1497
+ if (el.previousElementSibling && $(el.previousElementSibling).is(selector)) {
1498
+ return $([el.previousElementSibling]);
1499
+ }
1500
+
1501
+ return $([]);
1502
+ }
1503
+
1504
+ if (el.previousElementSibling) return $([el.previousElementSibling]);
1505
+ return $([]);
1506
+ }
1507
+
1508
+ return $([]);
1509
+ }
1510
+
1511
+ function prevAll(selector) {
1512
+ var prevEls = [];
1513
+ var el = this[0];
1514
+ if (!el) return $([]);
1515
+
1516
+ while (el.previousElementSibling) {
1517
+ var _prev = el.previousElementSibling; // eslint-disable-line
1518
+
1519
+ if (selector) {
1520
+ if ($(_prev).is(selector)) prevEls.push(_prev);
1521
+ } else prevEls.push(_prev);
1522
+
1523
+ el = _prev;
1524
+ }
1525
+
1526
+ return $(prevEls);
1527
+ }
1528
+
1529
+ function siblings(selector) {
1530
+ return this.nextAll(selector).add(this.prevAll(selector));
1531
+ }
1532
+
1533
+ function parent(selector) {
1534
+ var parents = []; // eslint-disable-line
1535
+
1536
+ for (var i = 0; i < this.length; i += 1) {
1537
+ if (this[i].parentNode !== null) {
1538
+ if (selector) {
1539
+ if ($(this[i].parentNode).is(selector)) parents.push(this[i].parentNode);
1540
+ } else {
1541
+ parents.push(this[i].parentNode);
1542
+ }
1543
+ }
1544
+ }
1545
+
1546
+ return $(parents);
1547
+ }
1548
+
1549
+ function parents(selector) {
1550
+ var parents = []; // eslint-disable-line
1551
+
1552
+ for (var i = 0; i < this.length; i += 1) {
1553
+ var _parent = this[i].parentNode; // eslint-disable-line
1554
+
1555
+ while (_parent) {
1556
+ if (selector) {
1557
+ if ($(_parent).is(selector)) parents.push(_parent);
1558
+ } else {
1559
+ parents.push(_parent);
1560
+ }
1561
+
1562
+ _parent = _parent.parentNode;
1563
+ }
1564
+ }
1565
+
1566
+ return $(parents);
1567
+ }
1568
+
1569
+ function closest(selector) {
1570
+ var closest = this; // eslint-disable-line
1571
+
1572
+ if (typeof selector === 'undefined') {
1573
+ return $([]);
1574
+ }
1575
+
1576
+ if (!closest.is(selector)) {
1577
+ closest = closest.parents(selector).eq(0);
1578
+ }
1579
+
1580
+ return closest;
1581
+ }
1582
+
1583
+ function find(selector) {
1584
+ var foundElements = [];
1585
+
1586
+ for (var i = 0; i < this.length; i += 1) {
1587
+ var found = this[i].querySelectorAll(selector);
1588
+
1589
+ for (var j = 0; j < found.length; j += 1) {
1590
+ foundElements.push(found[j]);
1591
+ }
1592
+ }
1593
+
1594
+ return $(foundElements);
1595
+ }
1596
+
1597
+ function children(selector) {
1598
+ var children = []; // eslint-disable-line
1599
+
1600
+ for (var i = 0; i < this.length; i += 1) {
1601
+ var childNodes = this[i].children;
1602
+
1603
+ for (var j = 0; j < childNodes.length; j += 1) {
1604
+ if (!selector || $(childNodes[j]).is(selector)) {
1605
+ children.push(childNodes[j]);
1606
+ }
1607
+ }
1608
+ }
1609
+
1610
+ return $(children);
1611
+ }
1612
+
1613
+ function remove() {
1614
+ for (var i = 0; i < this.length; i += 1) {
1615
+ if (this[i].parentNode) this[i].parentNode.removeChild(this[i]);
1616
+ }
1617
+
1618
+ return this;
1619
+ }
1620
+
1621
+ function detach() {
1622
+ return this.remove();
1623
+ }
1624
+
1625
+ function add() {
1626
+ var dom = this;
1627
+ var i;
1628
+ var j;
1629
+
1630
+ for (var _len10 = arguments.length, els = new Array(_len10), _key10 = 0; _key10 < _len10; _key10++) {
1631
+ els[_key10] = arguments[_key10];
1632
+ }
1633
+
1634
+ for (i = 0; i < els.length; i += 1) {
1635
+ var toAdd = $(els[i]);
1636
+
1637
+ for (j = 0; j < toAdd.length; j += 1) {
1638
+ dom.push(toAdd[j]);
1639
+ }
1640
+ }
1641
+
1642
+ return dom;
1643
+ }
1644
+
1645
+ function empty() {
1646
+ for (var i = 0; i < this.length; i += 1) {
1647
+ var el = this[i];
1648
+
1649
+ if (el.nodeType === 1) {
1650
+ for (var j = 0; j < el.childNodes.length; j += 1) {
1651
+ if (el.childNodes[j].parentNode) {
1652
+ el.childNodes[j].parentNode.removeChild(el.childNodes[j]);
1653
+ }
1654
+ }
1655
+
1656
+ el.textContent = '';
1657
+ }
1658
+ }
1659
+
1660
+ return this;
1661
+ }
1662
+
1663
+ function scrollTo() {
1664
+ var window = ssrWindow.getWindow();
1665
+
1666
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1667
+ args[_key] = arguments[_key];
1668
+ }
1669
+
1670
+ var left = args[0],
1671
+ top = args[1],
1672
+ duration = args[2],
1673
+ easing = args[3],
1674
+ callback = args[4];
1675
+
1676
+ if (args.length === 4 && typeof easing === 'function') {
1677
+ callback = easing;
1678
+ left = args[0];
1679
+ top = args[1];
1680
+ duration = args[2];
1681
+ callback = args[3];
1682
+ easing = args[4];
1683
+ }
1684
+
1685
+ if (typeof easing === 'undefined') easing = 'swing';
1686
+ return this.each(function animate() {
1687
+ var el = this;
1688
+ var currentTop;
1689
+ var currentLeft;
1690
+ var maxTop;
1691
+ var maxLeft;
1692
+ var newTop;
1693
+ var newLeft;
1694
+ var scrollTop; // eslint-disable-line
1695
+
1696
+ var scrollLeft; // eslint-disable-line
1697
+
1698
+ var animateTop = top > 0 || top === 0;
1699
+ var animateLeft = left > 0 || left === 0;
1700
+
1701
+ if (typeof easing === 'undefined') {
1702
+ easing = 'swing';
1703
+ }
1704
+
1705
+ if (animateTop) {
1706
+ currentTop = el.scrollTop;
1707
+
1708
+ if (!duration) {
1709
+ el.scrollTop = top;
1710
+ }
1711
+ }
1712
+
1713
+ if (animateLeft) {
1714
+ currentLeft = el.scrollLeft;
1715
+
1716
+ if (!duration) {
1717
+ el.scrollLeft = left;
1718
+ }
1719
+ }
1720
+
1721
+ if (!duration) return;
1722
+
1723
+ if (animateTop) {
1724
+ maxTop = el.scrollHeight - el.offsetHeight;
1725
+ newTop = Math.max(Math.min(top, maxTop), 0);
1726
+ }
1727
+
1728
+ if (animateLeft) {
1729
+ maxLeft = el.scrollWidth - el.offsetWidth;
1730
+ newLeft = Math.max(Math.min(left, maxLeft), 0);
1731
+ }
1732
+
1733
+ var startTime = null;
1734
+ if (animateTop && newTop === currentTop) animateTop = false;
1735
+ if (animateLeft && newLeft === currentLeft) animateLeft = false;
1736
+
1737
+ function render(time) {
1738
+ if (time === void 0) {
1739
+ time = new Date().getTime();
1740
+ }
1741
+
1742
+ if (startTime === null) {
1743
+ startTime = time;
1744
+ }
1745
+
1746
+ var progress = Math.max(Math.min((time - startTime) / duration, 1), 0);
1747
+ var easeProgress = easing === 'linear' ? progress : 0.5 - Math.cos(progress * Math.PI) / 2;
1748
+ var done;
1749
+ if (animateTop) scrollTop = currentTop + easeProgress * (newTop - currentTop);
1750
+ if (animateLeft) scrollLeft = currentLeft + easeProgress * (newLeft - currentLeft);
1751
+
1752
+ if (animateTop && newTop > currentTop && scrollTop >= newTop) {
1753
+ el.scrollTop = newTop;
1754
+ done = true;
1755
+ }
1756
+
1757
+ if (animateTop && newTop < currentTop && scrollTop <= newTop) {
1758
+ el.scrollTop = newTop;
1759
+ done = true;
1760
+ }
1761
+
1762
+ if (animateLeft && newLeft > currentLeft && scrollLeft >= newLeft) {
1763
+ el.scrollLeft = newLeft;
1764
+ done = true;
1765
+ }
1766
+
1767
+ if (animateLeft && newLeft < currentLeft && scrollLeft <= newLeft) {
1768
+ el.scrollLeft = newLeft;
1769
+ done = true;
1770
+ }
1771
+
1772
+ if (done) {
1773
+ if (callback) callback();
1774
+ return;
1775
+ }
1776
+
1777
+ if (animateTop) el.scrollTop = scrollTop;
1778
+ if (animateLeft) el.scrollLeft = scrollLeft;
1779
+ window.requestAnimationFrame(render);
1780
+ }
1781
+
1782
+ window.requestAnimationFrame(render);
1783
+ });
1784
+ } // scrollTop(top, duration, easing, callback) {
1785
+
1786
+
1787
+ function scrollTop() {
1788
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
1789
+ args[_key2] = arguments[_key2];
1790
+ }
1791
+
1792
+ var top = args[0],
1793
+ duration = args[1],
1794
+ easing = args[2],
1795
+ callback = args[3];
1796
+
1797
+ if (args.length === 3 && typeof easing === 'function') {
1798
+ top = args[0];
1799
+ duration = args[1];
1800
+ callback = args[2];
1801
+ easing = args[3];
1802
+ }
1803
+
1804
+ var dom = this;
1805
+
1806
+ if (typeof top === 'undefined') {
1807
+ if (dom.length > 0) return dom[0].scrollTop;
1808
+ return null;
1809
+ }
1810
+
1811
+ return dom.scrollTo(undefined, top, duration, easing, callback);
1812
+ }
1813
+
1814
+ function scrollLeft() {
1815
+ for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
1816
+ args[_key3] = arguments[_key3];
1817
+ }
1818
+
1819
+ var left = args[0],
1820
+ duration = args[1],
1821
+ easing = args[2],
1822
+ callback = args[3];
1823
+
1824
+ if (args.length === 3 && typeof easing === 'function') {
1825
+ left = args[0];
1826
+ duration = args[1];
1827
+ callback = args[2];
1828
+ easing = args[3];
1829
+ }
1830
+
1831
+ var dom = this;
1832
+
1833
+ if (typeof left === 'undefined') {
1834
+ if (dom.length > 0) return dom[0].scrollLeft;
1835
+ return null;
1836
+ }
1837
+
1838
+ return dom.scrollTo(left, undefined, duration, easing, callback);
1839
+ }
1840
+
1841
+ function animate(initialProps, initialParams) {
1842
+ var window = ssrWindow.getWindow();
1843
+ var els = this;
1844
+ var a = {
1845
+ props: Object.assign({}, initialProps),
1846
+ params: Object.assign({
1847
+ duration: 300,
1848
+ easing: 'swing' // or 'linear'
1849
+
1850
+ /* Callbacks
1851
+ begin(elements)
1852
+ complete(elements)
1853
+ progress(elements, complete, remaining, start, tweenValue)
1854
+ */
1855
+
1856
+ }, initialParams),
1857
+ elements: els,
1858
+ animating: false,
1859
+ que: [],
1860
+ easingProgress: function easingProgress(easing, progress) {
1861
+ if (easing === 'swing') {
1862
+ return 0.5 - Math.cos(progress * Math.PI) / 2;
1863
+ }
1864
+
1865
+ if (typeof easing === 'function') {
1866
+ return easing(progress);
1867
+ }
1868
+
1869
+ return progress;
1870
+ },
1871
+ stop: function stop() {
1872
+ if (a.frameId) {
1873
+ window.cancelAnimationFrame(a.frameId);
1874
+ }
1875
+
1876
+ a.animating = false;
1877
+ a.elements.each(function (el) {
1878
+ var element = el;
1879
+ delete element.dom7AnimateInstance;
1880
+ });
1881
+ a.que = [];
1882
+ },
1883
+ done: function done(complete) {
1884
+ a.animating = false;
1885
+ a.elements.each(function (el) {
1886
+ var element = el;
1887
+ delete element.dom7AnimateInstance;
1888
+ });
1889
+ if (complete) complete(els);
1890
+
1891
+ if (a.que.length > 0) {
1892
+ var que = a.que.shift();
1893
+ a.animate(que[0], que[1]);
1894
+ }
1895
+ },
1896
+ animate: function animate(props, params) {
1897
+ if (a.animating) {
1898
+ a.que.push([props, params]);
1899
+ return a;
1900
+ }
1901
+
1902
+ var elements = []; // Define & Cache Initials & Units
1903
+
1904
+ a.elements.each(function (el, index) {
1905
+ var initialFullValue;
1906
+ var initialValue;
1907
+ var unit;
1908
+ var finalValue;
1909
+ var finalFullValue;
1910
+ if (!el.dom7AnimateInstance) a.elements[index].dom7AnimateInstance = a;
1911
+ elements[index] = {
1912
+ container: el
1913
+ };
1914
+ Object.keys(props).forEach(function (prop) {
1915
+ initialFullValue = window.getComputedStyle(el, null).getPropertyValue(prop).replace(',', '.');
1916
+ initialValue = parseFloat(initialFullValue);
1917
+ unit = initialFullValue.replace(initialValue, '');
1918
+ finalValue = parseFloat(props[prop]);
1919
+ finalFullValue = props[prop] + unit;
1920
+ elements[index][prop] = {
1921
+ initialFullValue: initialFullValue,
1922
+ initialValue: initialValue,
1923
+ unit: unit,
1924
+ finalValue: finalValue,
1925
+ finalFullValue: finalFullValue,
1926
+ currentValue: initialValue
1927
+ };
1928
+ });
1929
+ });
1930
+ var startTime = null;
1931
+ var time;
1932
+ var elementsDone = 0;
1933
+ var propsDone = 0;
1934
+ var done;
1935
+ var began = false;
1936
+ a.animating = true;
1937
+
1938
+ function render() {
1939
+ time = new Date().getTime();
1940
+ var progress;
1941
+ var easeProgress; // let el;
1942
+
1943
+ if (!began) {
1944
+ began = true;
1945
+ if (params.begin) params.begin(els);
1946
+ }
1947
+
1948
+ if (startTime === null) {
1949
+ startTime = time;
1950
+ }
1951
+
1952
+ if (params.progress) {
1953
+ // eslint-disable-next-line
1954
+ params.progress(els, Math.max(Math.min((time - startTime) / params.duration, 1), 0), startTime + params.duration - time < 0 ? 0 : startTime + params.duration - time, startTime);
1955
+ }
1956
+
1957
+ elements.forEach(function (element) {
1958
+ var el = element;
1959
+ if (done || el.done) return;
1960
+ Object.keys(props).forEach(function (prop) {
1961
+ if (done || el.done) return;
1962
+ progress = Math.max(Math.min((time - startTime) / params.duration, 1), 0);
1963
+ easeProgress = a.easingProgress(params.easing, progress);
1964
+ var _el$prop = el[prop],
1965
+ initialValue = _el$prop.initialValue,
1966
+ finalValue = _el$prop.finalValue,
1967
+ unit = _el$prop.unit;
1968
+ el[prop].currentValue = initialValue + easeProgress * (finalValue - initialValue);
1969
+ var currentValue = el[prop].currentValue;
1970
+
1971
+ if (finalValue > initialValue && currentValue >= finalValue || finalValue < initialValue && currentValue <= finalValue) {
1972
+ el.container.style[prop] = finalValue + unit;
1973
+ propsDone += 1;
1974
+
1975
+ if (propsDone === Object.keys(props).length) {
1976
+ el.done = true;
1977
+ elementsDone += 1;
1978
+ }
1979
+
1980
+ if (elementsDone === elements.length) {
1981
+ done = true;
1982
+ }
1983
+ }
1984
+
1985
+ if (done) {
1986
+ a.done(params.complete);
1987
+ return;
1988
+ }
1989
+
1990
+ el.container.style[prop] = currentValue + unit;
1991
+ });
1992
+ });
1993
+ if (done) return; // Then call
1994
+
1995
+ a.frameId = window.requestAnimationFrame(render);
1996
+ }
1997
+
1998
+ a.frameId = window.requestAnimationFrame(render);
1999
+ return a;
2000
+ }
2001
+ };
2002
+
2003
+ if (a.elements.length === 0) {
2004
+ return els;
2005
+ }
2006
+
2007
+ var animateInstance;
2008
+
2009
+ for (var i = 0; i < a.elements.length; i += 1) {
2010
+ if (a.elements[i].dom7AnimateInstance) {
2011
+ animateInstance = a.elements[i].dom7AnimateInstance;
2012
+ } else a.elements[i].dom7AnimateInstance = a;
2013
+ }
2014
+
2015
+ if (!animateInstance) {
2016
+ animateInstance = a;
2017
+ }
2018
+
2019
+ if (initialProps === 'stop') {
2020
+ animateInstance.stop();
2021
+ } else {
2022
+ animateInstance.animate(a.props, a.params);
2023
+ }
2024
+
2025
+ return els;
2026
+ }
2027
+
2028
+ function stop() {
2029
+ var els = this;
2030
+
2031
+ for (var i = 0; i < els.length; i += 1) {
2032
+ if (els[i].dom7AnimateInstance) {
2033
+ els[i].dom7AnimateInstance.stop();
2034
+ }
2035
+ }
2036
+ }
2037
+
2038
+ var noTrigger = 'resize scroll'.split(' ');
2039
+
2040
+ function shortcut(name) {
2041
+ function eventHandler() {
2042
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
2043
+ args[_key] = arguments[_key];
2044
+ }
2045
+
2046
+ if (typeof args[0] === 'undefined') {
2047
+ for (var i = 0; i < this.length; i += 1) {
2048
+ if (noTrigger.indexOf(name) < 0) {
2049
+ if (name in this[i]) this[i][name]();else {
2050
+ $(this[i]).trigger(name);
2051
+ }
2052
+ }
2053
+ }
2054
+
2055
+ return this;
2056
+ }
2057
+
2058
+ return this.on.apply(this, [name].concat(args));
2059
+ }
2060
+
2061
+ return eventHandler;
2062
+ }
2063
+
2064
+ var click = shortcut('click');
2065
+ var blur = shortcut('blur');
2066
+ var focus = shortcut('focus');
2067
+ var focusin = shortcut('focusin');
2068
+ var focusout = shortcut('focusout');
2069
+ var keyup = shortcut('keyup');
2070
+ var keydown = shortcut('keydown');
2071
+ var keypress = shortcut('keypress');
2072
+ var submit = shortcut('submit');
2073
+ var change = shortcut('change');
2074
+ var mousedown = shortcut('mousedown');
2075
+ var mousemove = shortcut('mousemove');
2076
+ var mouseup = shortcut('mouseup');
2077
+ var mouseenter = shortcut('mouseenter');
2078
+ var mouseleave = shortcut('mouseleave');
2079
+ var mouseout = shortcut('mouseout');
2080
+ var mouseover = shortcut('mouseover');
2081
+ var touchstart = shortcut('touchstart');
2082
+ var touchend = shortcut('touchend');
2083
+ var touchmove = shortcut('touchmove');
2084
+ var resize = shortcut('resize');
2085
+ var scroll = shortcut('scroll');
2086
+
2087
+ dom7_cjs.$ = $;
2088
+ dom7_cjs.add = add;
2089
+ dom7_cjs.addClass = addClass;
2090
+ dom7_cjs.animate = animate;
2091
+ dom7_cjs.animationEnd = animationEnd;
2092
+ dom7_cjs.append = append;
2093
+ dom7_cjs.appendTo = appendTo;
2094
+ dom7_cjs.attr = attr;
2095
+ dom7_cjs.blur = blur;
2096
+ dom7_cjs.change = change;
2097
+ dom7_cjs.children = children;
2098
+ dom7_cjs.click = click;
2099
+ dom7_cjs.closest = closest;
2100
+ dom7_cjs.css = css;
2101
+ dom7_cjs.data = data;
2102
+ dom7_cjs.dataset = dataset;
2103
+ dom7_cjs.default = $;
2104
+ dom7_cjs.detach = detach;
2105
+ dom7_cjs.each = each;
2106
+ dom7_cjs.empty = empty;
2107
+ dom7_cjs.eq = eq;
2108
+ dom7_cjs.filter = filter;
2109
+ dom7_cjs.find = find;
2110
+ dom7_cjs.focus = focus;
2111
+ dom7_cjs.focusin = focusin;
2112
+ dom7_cjs.focusout = focusout;
2113
+ dom7_cjs.hasClass = hasClass;
2114
+ dom7_cjs.height = height;
2115
+ dom7_cjs.hide = hide;
2116
+ dom7_cjs.html = html;
2117
+ dom7_cjs.index = index;
2118
+ dom7_cjs.insertAfter = insertAfter;
2119
+ dom7_cjs.insertBefore = insertBefore;
2120
+ dom7_cjs.is = is;
2121
+ dom7_cjs.keydown = keydown;
2122
+ dom7_cjs.keypress = keypress;
2123
+ dom7_cjs.keyup = keyup;
2124
+ dom7_cjs.mousedown = mousedown;
2125
+ dom7_cjs.mouseenter = mouseenter;
2126
+ dom7_cjs.mouseleave = mouseleave;
2127
+ dom7_cjs.mousemove = mousemove;
2128
+ dom7_cjs.mouseout = mouseout;
2129
+ dom7_cjs.mouseover = mouseover;
2130
+ dom7_cjs.mouseup = mouseup;
2131
+ dom7_cjs.next = next;
2132
+ dom7_cjs.nextAll = nextAll;
2133
+ dom7_cjs.off = off;
2134
+ dom7_cjs.offset = offset;
2135
+ dom7_cjs.on = on;
2136
+ dom7_cjs.once = once;
2137
+ dom7_cjs.outerHeight = outerHeight;
2138
+ dom7_cjs.outerWidth = outerWidth;
2139
+ dom7_cjs.parent = parent;
2140
+ dom7_cjs.parents = parents;
2141
+ dom7_cjs.prepend = prepend;
2142
+ dom7_cjs.prependTo = prependTo;
2143
+ dom7_cjs.prev = prev;
2144
+ dom7_cjs.prevAll = prevAll;
2145
+ dom7_cjs.prop = prop;
2146
+ dom7_cjs.remove = remove;
2147
+ dom7_cjs.removeAttr = removeAttr;
2148
+ dom7_cjs.removeClass = removeClass;
2149
+ dom7_cjs.removeData = removeData;
2150
+ dom7_cjs.resize = resize;
2151
+ dom7_cjs.scroll = scroll;
2152
+ dom7_cjs.scrollLeft = scrollLeft;
2153
+ dom7_cjs.scrollTo = scrollTo;
2154
+ dom7_cjs.scrollTop = scrollTop;
2155
+ dom7_cjs.show = show;
2156
+ dom7_cjs.siblings = siblings;
2157
+ dom7_cjs.stop = stop;
2158
+ dom7_cjs.styles = styles;
2159
+ dom7_cjs.submit = submit;
2160
+ dom7_cjs.text = text;
2161
+ dom7_cjs.toggleClass = toggleClass;
2162
+ dom7_cjs.touchend = touchend;
2163
+ dom7_cjs.touchmove = touchmove;
2164
+ dom7_cjs.touchstart = touchstart;
2165
+ dom7_cjs.transform = transform;
2166
+ dom7_cjs.transition = transition;
2167
+ dom7_cjs.transitionEnd = transitionEnd;
2168
+ dom7_cjs.trigger = trigger;
2169
+ dom7_cjs.val = val;
2170
+ dom7_cjs.value = value;
2171
+ dom7_cjs.width = width;
2172
+ return dom7_cjs;
2173
+ }
2174
+
2175
+ var dom7_cjsExports = /*@__PURE__*/ requireDom7_cjs();
2176
+ var $ = /*@__PURE__*/getDefaultExportFromCjs(dom7_cjsExports);
2177
+
2178
+ /**
2179
+ * @description DOM 操作
2180
+ * @author wangfupeng
2181
+ */
2182
+ if (dom7_cjsExports.append) {
2183
+ $.fn.append = dom7_cjsExports.append;
2184
+ }
2185
+ if (dom7_cjsExports.html) {
2186
+ $.fn.html = dom7_cjsExports.html;
2187
+ }
2188
+ if (dom7_cjsExports.val) {
2189
+ $.fn.val = dom7_cjsExports.val;
2190
+ }
2191
+ if (dom7_cjsExports.on) {
2192
+ $.fn.on = dom7_cjsExports.on;
2193
+ }
2194
+ if (dom7_cjsExports.focus) {
2195
+ $.fn.focus = dom7_cjsExports.focus;
2196
+ }
2197
+ if (dom7_cjsExports.is) {
2198
+ $.fn.is = dom7_cjsExports.is;
2199
+ }
2200
+ if (dom7_cjsExports.parents) {
2201
+ $.fn.parents = dom7_cjsExports.parents;
2202
+ }
2203
+ if (dom7_cjsExports.find) {
2204
+ $.fn.find = dom7_cjsExports.find;
2205
+ }
2206
+
2207
+ let nanoid = (size = 21) =>
2208
+ crypto.getRandomValues(new Uint8Array(size)).reduce((id, byte) => {
2209
+ byte &= 63;
2210
+ if (byte < 36) {
2211
+ id += byte.toString(36);
2212
+ } else if (byte < 62) {
2213
+ id += (byte - 26).toString(36).toUpperCase();
2214
+ } else if (byte > 62) {
2215
+ id += '-';
2216
+ } else {
2217
+ id += '_';
2218
+ }
2219
+ return id
2220
+ }, '');
2221
+
2222
+ /**
2223
+ * @description 工具函数
2224
+ * @author wangfupeng
2225
+ */
2226
+ /**
2227
+ * 获取随机数字符串
2228
+ * @param prefix 前缀
2229
+ * @returns 随机数字符串
2230
+ */
2231
+ function genRandomStr(prefix) {
2232
+ return "".concat(prefix, "-").concat(nanoid());
2233
+ }
2234
+ // export function replaceSymbols(str: string) {
2235
+ // return str.replace(/</g, '&lt;').replace(/>/g, '&gt;')
2236
+ // }
2237
+
2238
+ /**
2239
+ * @description edit formula menu
2240
+ * @author wangfupeng
2241
+ */
2242
+ /**
2243
+ * 生成唯一的 DOM ID
2244
+ */
2245
+ function genDomID$1() {
2246
+ return genRandomStr('w-e-insert-formula');
2247
+ }
2248
+ var EditFormulaMenu = /** @class */ (function () {
2249
+ function EditFormulaMenu() {
2250
+ this.title = editor.t('formula.edit');
2251
+ this.iconSvg = PENCIL_SVG;
2252
+ this.tag = 'button';
2253
+ this.showModal = true; // 点击 button 时显示 modal
2254
+ this.modalWidth = 300;
2255
+ this.$content = null;
2256
+ this.textareaId = genDomID$1();
2257
+ this.buttonId = genDomID$1();
2258
+ }
2259
+ EditFormulaMenu.prototype.getSelectedElem = function (editor$1) {
2260
+ var node = editor.DomEditor.getSelectedNodeByType(editor$1, 'formula');
2261
+ if (node == null) {
2262
+ return null;
2263
+ }
2264
+ return node;
2265
+ };
2266
+ /**
2267
+ * 获取公式 value
2268
+ * @param editor editor
2269
+ */
2270
+ EditFormulaMenu.prototype.getValue = function (editor) {
2271
+ var formulaElem = this.getSelectedElem(editor);
2272
+ if (formulaElem) {
2273
+ return formulaElem.value || '';
2274
+ }
2275
+ return '';
2276
+ };
2277
+ EditFormulaMenu.prototype.isActive = function (_editor) {
2278
+ // 无需 active
2279
+ return false;
2280
+ };
2281
+ EditFormulaMenu.prototype.exec = function (_editor, _value) {
2282
+ // 点击菜单时,弹出 modal 之前,不需要执行其他代码
2283
+ // 此处空着即可
2284
+ };
2285
+ EditFormulaMenu.prototype.isDisabled = function (editor$1) {
2286
+ var selection = editor$1.selection;
2287
+ if (selection == null) {
2288
+ return true;
2289
+ }
2290
+ if (editor.SlateRange.isExpanded(selection)) {
2291
+ return true;
2292
+ } // 选区非折叠,禁用
2293
+ // 未匹配到 formula node 则禁用
2294
+ var formulaElem = this.getSelectedElem(editor$1);
2295
+ if (formulaElem == null) {
2296
+ return true;
2297
+ }
2298
+ return false;
2299
+ };
2300
+ // modal 定位
2301
+ EditFormulaMenu.prototype.getModalPositionNode = function (editor) {
2302
+ return this.getSelectedElem(editor);
2303
+ };
2304
+ EditFormulaMenu.prototype.getModalContentElem = function (editor$1) {
2305
+ var _this = this;
2306
+ var _a = this, textareaId = _a.textareaId, buttonId = _a.buttonId;
2307
+ var _b = __read(editor.genModalTextareaElems(editor.t('formula.formula'), textareaId, editor.t('formula.placeholder')), 2), textareaContainerElem = _b[0], textareaElem = _b[1];
2308
+ var $textarea = $(textareaElem);
2309
+ var _c = __read(editor.genModalButtonElems(buttonId, editor.t('formula.ok')), 1), buttonContainerElem = _c[0];
2310
+ if (this.$content == null) {
2311
+ // 第一次渲染
2312
+ var $content_1 = $('<div></div>');
2313
+ // 绑定事件(第一次渲染时绑定,不要重复绑定)
2314
+ $content_1.on('click', "#".concat(buttonId), function (e) {
2315
+ e.preventDefault();
2316
+ var value = $content_1.find("#".concat(textareaId)).val().trim();
2317
+ _this.updateFormula(editor$1, value);
2318
+ editor$1.hidePanelOrModal(); // 隐藏 modal
2319
+ });
2320
+ // 记录属性,重要
2321
+ this.$content = $content_1;
2322
+ }
2323
+ var $content = this.$content;
2324
+ $content.html(''); // 先清空内容
2325
+ // append textarea and button
2326
+ $content.append(textareaContainerElem);
2327
+ $content.append(buttonContainerElem);
2328
+ // 设置 input val
2329
+ var value = this.getValue(editor$1);
2330
+ $textarea.val(value);
2331
+ // focus 一个 input(异步,此时 DOM 尚未渲染)
2332
+ setTimeout(function () {
2333
+ $textarea.focus();
2334
+ });
2335
+ return $content[0];
2336
+ };
2337
+ EditFormulaMenu.prototype.updateFormula = function (editor$1, value) {
2338
+ if (!value) {
2339
+ return;
2340
+ }
2341
+ // 还原选区
2342
+ editor$1.restoreSelection();
2343
+ if (this.isDisabled(editor$1)) {
2344
+ return;
2345
+ }
2346
+ var selectedElem = this.getSelectedElem(editor$1);
2347
+ if (selectedElem == null) {
2348
+ return;
2349
+ }
2350
+ var path = editor.DomEditor.findPath(editor$1, selectedElem);
2351
+ var props = { value: value };
2352
+ editor.SlateTransforms.setNodes(editor$1, props, { at: path });
2353
+ };
2354
+ return EditFormulaMenu;
2355
+ }());
2356
+
2357
+ /**
2358
+ * @description insert formula menu
2359
+ * @author wangfupeng
2360
+ */
2361
+ /**
2362
+ * 生成唯一的 DOM ID
2363
+ */
2364
+ function genDomID() {
2365
+ return genRandomStr('w-e-insert-formula');
2366
+ }
2367
+ var InsertFormulaMenu = /** @class */ (function () {
2368
+ function InsertFormulaMenu() {
2369
+ this.title = editor.t('formula.insert');
2370
+ this.iconSvg = SIGMA_SVG;
2371
+ this.tag = 'button';
2372
+ this.showModal = true; // 点击 button 时显示 modal
2373
+ this.modalWidth = 300;
2374
+ this.$content = null;
2375
+ this.textareaId = genDomID();
2376
+ this.buttonId = genDomID();
2377
+ }
2378
+ InsertFormulaMenu.prototype.getValue = function (_editor) {
2379
+ // 插入菜单,不需要 value
2380
+ return '';
2381
+ };
2382
+ InsertFormulaMenu.prototype.isActive = function (_editor) {
2383
+ // 任何时候,都不用激活 menu
2384
+ return false;
2385
+ };
2386
+ InsertFormulaMenu.prototype.exec = function (_editor, _value) {
2387
+ // 点击菜单时,弹出 modal 之前,不需要执行其他代码
2388
+ // 此处空着即可
2389
+ };
2390
+ InsertFormulaMenu.prototype.isDisabled = function (editor$1) {
2391
+ var selection = editor$1.selection;
2392
+ if (selection == null) {
2393
+ return true;
2394
+ }
2395
+ if (editor.SlateRange.isExpanded(selection)) {
2396
+ return true;
2397
+ } // 选区非折叠,禁用
2398
+ var selectedElems = editor.DomEditor.getSelectedElems(editor$1);
2399
+ var hasVoidElem = selectedElems.some(function (elem) { return editor$1.isVoid(elem); });
2400
+ if (hasVoidElem) {
2401
+ return true;
2402
+ } // 选中了 void 元素,禁用
2403
+ var hasPreElem = selectedElems.some(function (elem) { return editor.DomEditor.getNodeType(elem) === 'pre'; });
2404
+ if (hasPreElem) {
2405
+ return true;
2406
+ } // 选中了 pre 原则,禁用
2407
+ return false;
2408
+ };
2409
+ InsertFormulaMenu.prototype.getModalPositionNode = function (_editor) {
2410
+ return null; // modal 依据选区定位
2411
+ };
2412
+ InsertFormulaMenu.prototype.getModalContentElem = function (editor$1) {
2413
+ var _this = this;
2414
+ var _a = this, textareaId = _a.textareaId, buttonId = _a.buttonId;
2415
+ var _b = __read(editor.genModalTextareaElems(editor.t('formula.formula'), textareaId, editor.t('formula.placeholder')), 2), textareaContainerElem = _b[0], textareaElem = _b[1];
2416
+ var $textarea = $(textareaElem);
2417
+ var _c = __read(editor.genModalButtonElems(buttonId, editor.t('formula.ok')), 1), buttonContainerElem = _c[0];
2418
+ if (this.$content == null) {
2419
+ // 第一次渲染
2420
+ var $content_1 = $('<div></div>');
2421
+ // 绑定事件(第一次渲染时绑定,不要重复绑定)
2422
+ $content_1.on('click', "#".concat(buttonId), function (e) {
2423
+ e.preventDefault();
2424
+ var value = $content_1.find("#".concat(textareaId)).val().trim();
2425
+ _this.insertFormula(editor$1, value);
2426
+ editor$1.hidePanelOrModal(); // 隐藏 modal
2427
+ });
2428
+ // 记录属性,重要
2429
+ this.$content = $content_1;
2430
+ }
2431
+ var $content = this.$content;
2432
+ $content.html(''); // 先清空内容
2433
+ // append textarea and button
2434
+ $content.append(textareaContainerElem);
2435
+ $content.append(buttonContainerElem);
2436
+ // 设置 input val
2437
+ $textarea.val('');
2438
+ // focus 一个 input(异步,此时 DOM 尚未渲染)
2439
+ setTimeout(function () {
2440
+ $textarea.focus();
2441
+ });
2442
+ return $content[0];
2443
+ };
2444
+ InsertFormulaMenu.prototype.insertFormula = function (editor, value) {
2445
+ if (!value) {
2446
+ return;
2447
+ }
2448
+ // 还原选区
2449
+ editor.restoreSelection();
2450
+ if (this.isDisabled(editor)) {
2451
+ return;
2452
+ }
2453
+ var formulaElem = {
2454
+ type: 'formula',
2455
+ value: value,
2456
+ children: [{ text: '' }], // void node 需要有一个空 text
2457
+ };
2458
+ editor.insertNode(formulaElem);
2459
+ };
2460
+ return InsertFormulaMenu;
2461
+ }());
2462
+
2463
+ /**
2464
+ * @description formula menu entry
2465
+ * @author wangfupeng
2466
+ */
2467
+ var insertFormulaMenuConf = {
2468
+ key: 'insertFormula', // menu key ,唯一。注册之后,可配置到工具栏
2469
+ factory: function () {
2470
+ return new InsertFormulaMenu();
2471
+ },
2472
+ };
2473
+ var editFormulaMenuConf = {
2474
+ key: 'editFormula', // menu key ,唯一。注册之后,可配置到工具栏
2475
+ factory: function () {
2476
+ return new EditFormulaMenu();
2477
+ },
2478
+ };
2479
+
2480
+ /**
2481
+ * @description parse elem html
2482
+ * @author wangfupeng
2483
+ */
2484
+ function parseHtml(elem, _children, _editor) {
2485
+ var value = elem.getAttribute('data-value') || '';
2486
+ return {
2487
+ type: 'formula',
2488
+ value: value,
2489
+ children: [{ text: '' }], // void node 必须有一个空白 text
2490
+ };
2491
+ }
2492
+ var parseHtmlConf = {
2493
+ selector: 'span[data-w-e-type="formula"]',
2494
+ parseElemHtml: parseHtml,
2495
+ };
2496
+
2497
+ /**
2498
+ * @description formula plugin
2499
+ * @author wangfupeng
2500
+ */
2501
+ function withFormula(editor$1) {
2502
+ var isInline = editor$1.isInline, isVoid = editor$1.isVoid;
2503
+ var newEditor = editor$1;
2504
+ // 重写 isInline
2505
+ newEditor.isInline = function (elem) {
2506
+ var type = editor.DomEditor.getNodeType(elem);
2507
+ if (type === 'formula') {
2508
+ return true;
2509
+ }
2510
+ return isInline(elem);
2511
+ };
2512
+ // 重写 isVoid
2513
+ newEditor.isVoid = function (elem) {
2514
+ var type = editor.DomEditor.getNodeType(elem);
2515
+ if (type === 'formula') {
2516
+ return true;
2517
+ }
2518
+ return isVoid(elem);
2519
+ };
2520
+ return newEditor;
2521
+ }
2522
+
2523
+ /**
2524
+ * @description render elem
2525
+ * @author wangfupeng
2526
+ */
2527
+ function renderFormula(elem, children, editor$1) {
2528
+ // 当前节点是否选中
2529
+ var selected = editor.DomEditor.isNodeSelected(editor$1, elem);
2530
+ // 构建 formula vnode
2531
+ var _a = elem.value, value = _a === void 0 ? '' : _a;
2532
+ var formulaVnode = snabbdom.h('w-e-formula-card', {
2533
+ dataset: { value: value },
2534
+ }, null);
2535
+ // 构建容器 vnode
2536
+ var containerVnode = snabbdom.h('div', {
2537
+ props: {
2538
+ contentEditable: false, // 不可编辑
2539
+ },
2540
+ style: {
2541
+ display: 'inline-block', // inline
2542
+ marginLeft: '3px',
2543
+ marginRight: '3px',
2544
+ border: selected // 选中/不选中,样式不一样
2545
+ ? '2px solid var(--w-e-textarea-selected-border-color)' // wangEditor 提供了 css var https://www.wangeditor.com/v5/theme.html
2546
+ : '2px solid transparent',
2547
+ borderRadius: '3px',
2548
+ padding: '3px 3px',
2549
+ },
2550
+ }, [formulaVnode]);
2551
+ return containerVnode;
2552
+ }
2553
+ var conf = {
2554
+ type: 'formula', // 节点 type ,重要!!!
2555
+ renderElem: renderFormula,
2556
+ };
2557
+
2558
+ /**
2559
+ * @description formula module entry
2560
+ * @author wangfupeng
2561
+ */
2562
+ var module = {
2563
+ editorPlugin: withFormula,
2564
+ renderElems: [conf],
2565
+ elemsToHtml: [conf$1],
2566
+ parseElemsHtml: [parseHtmlConf],
2567
+ menus: [insertFormulaMenuConf, editFormulaMenuConf],
2568
+ };
2569
+
2570
+ /**
2571
+ * @description src entry
2572
+ * @author wangfupeng
2573
+ */
2574
+ // 全局注册自定义组件,用于渲染公式
2575
+
2576
+ return module;
2577
+
2578
+ }));