";throw ie}}he.options=he.setOptions=function(P){return st(he.defaults,P),rt(he.defaults),he},he.getDefaults=fe,he.defaults=$e,he.use=function(P){var T=st({},P);if(P.renderer&&function(){var f=he.defaults.renderer||new ke,p=function(R){var ie=f[R];f[R]=function(){for(var ye=arguments.length,Ue=new Array(ye),Ye=0;Ye`,triples:"",explode:"[]{}"},se=G.Pos;G.defineOption("autoCloseBrackets",!1,function(U,B,I){I&&I!=G.Init&&(U.removeKeyMap(we),U.state.closeBrackets=null),B&&(q(Le(B,"pairs")),U.state.closeBrackets=B,U.addKeyMap(we))});function Le(U,B){return B=="pairs"&&typeof U=="string"?U:typeof U=="object"&&U[B]!=null?U[B]:xe[B]}var we={Backspace:Z,Enter:X};function q(U){for(var B=0;B=0;ce--){var Xe=oe[ce].head;U.replaceRange("",se(Xe.line,Xe.ch-1),se(Xe.line,Xe.ch+1),"+delete")}}function X(U){var B=W(U),I=B&&Le(B,"explode");if(!I||U.getOption("disableInput"))return G.Pass;for(var oe=U.listSelections(),ce=0;ce0;return{anchor:new se(U.anchor.line,U.anchor.ch+(B?-1:1)),head:new se(U.head.line,U.head.ch+(B?1:-1))}}function S(U,B){var I=W(U);if(!I||U.getOption("disableInput"))return G.Pass;var oe=Le(I,"pairs"),ce=oe.indexOf(B);if(ce==-1)return G.Pass;for(var Te=Le(I,"closeBefore"),Xe=Le(I,"triples"),Ie=oe.charAt(ce+1)==B,Re=U.listSelections(),We=ce%2==0,me,ge=0;ge=0&&U.getRange(ae,se(ae.line,ae.ch+3))==B+B+B?b="skipThree":b="skip";else if(Ie&&ae.ch>1&&Xe.indexOf(B)>=0&&U.getRange(se(ae.line,ae.ch-2),ae)==B+B){if(ae.ch>2&&/\bstring/.test(U.getTokenTypeAt(se(ae.line,ae.ch-2))))return G.Pass;b="addFour"}else if(Ie){var F=ae.ch==0?" ":U.getRange(se(ae.line,ae.ch-1),ae);if(!G.isWordChar(ne)&&F!=B&&!G.isWordChar(F))b="both";else return G.Pass}else if(We&&(ne.length===0||/\s/.test(ne)||Te.indexOf(ne)>-1))b="both";else return G.Pass;if(!me)me=b;else if(me!=b)return G.Pass}var x=ce%2?oe.charAt(ce-1):B,ee=ce%2?B:oe.charAt(ce+1);U.operation(function(){if(me=="skip")U.execCommand("goCharRight");else if(me=="skipThree")for(var j=0;j<3;j++)U.execCommand("goCharRight");else if(me=="surround"){for(var O=U.getSelections(),j=0;j0&&(H.percent=H.loaded/H.total*100),k.onProgress(H)});var s=new FormData;k.data&&Object.keys(k.data).forEach(function(A){var H=k.data[A];if(Array.isArray(H)){H.forEach(function(pe){s.append(A+"[]",pe)});return}s.append(A,k.data[A])}),k.file instanceof Blob?s.append(k.filename,k.file,k.file.name):s.append(k.filename,k.file),c.onerror=function(H){k.onError(H)},c.onload=function(){return c.status<200||c.status>=300?k.onError(we(k,c),q(c)):k.onSuccess(q(c),c)},c.open(k.method,k.action,!0),k.withCredentials&&"withCredentials"in c&&(c.withCredentials=!0);var m=k.headers||{};return m["X-Requested-With"]!==null&&c.setRequestHeader("X-Requested-With","XMLHttpRequest"),Object.keys(m).forEach(function(A){m[A]!==null&&c.setRequestHeader(A,m[A])}),c.send(s),{abort:function(){c.abort()}}}var W=+new Date,Z=0;function X(){return"rc-upload-"+W+"-"+ ++Z}function D(k,c){return k.indexOf(c,k.length-c.length)!==-1}var S=function(k,c){if(k&&c){var s=Array.isArray(c)?c:c.split(","),m=k.name||"",A=k.type||"",H=A.replace(/\/.*$/,"");return s.some(function(pe){var Ae=pe.trim();return Ae.charAt(0)==="."?D(m.toLowerCase(),Ae.toLowerCase()):/\/\*$/.test(Ae)?H===Ae.replace(/\/.*$/,""):A===Ae})}return!0};function be(k,c){var s=k.createReader(),m=[];function A(){s.readEntries(function(H){var pe=Array.prototype.slice.apply(H);m=m.concat(pe);var Ae=!pe.length;Ae?c(m):A()})}A()}var Q=function(c,s,m){var A=function H(pe,Ae){Ae=Ae||"",pe.isFile?pe.file(function(le){m(le)&&(pe.fullPath&&!le.webkitRelativePath&&(Object.defineProperties(le,{webkitRelativePath:{writable:!0}}),le.webkitRelativePath=pe.fullPath.replace(/^\//,""),Object.defineProperties(le,{webkitRelativePath:{writable:!1}})),s([le]))}):pe.isDirectory&&be(pe,function(le){le.forEach(function(te){H(te,""+Ae+pe.name+"/")})})};c.forEach(function(H){A(H.webkitGetAsEntry())})},U=Q,B=Object.assign||function(k){for(var c=1;c=0)continue;if(!Object.prototype.hasOwnProperty.call(k,m))continue;s[m]=k[m]}return s}function Xe(k,c){if(!(k instanceof c))throw new TypeError("Cannot call a class as a function")}function Ie(k,c){if(!k)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return c&&(typeof c=="object"||typeof c=="function")?c:k}function Re(k,c){if(typeof c!="function"&&c!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof c);k.prototype=Object.create(c&&c.prototype,{constructor:{value:k,enumerable:!1,writable:!0,configurable:!0}}),c&&(Object.setPrototypeOf?Object.setPrototypeOf(k,c):k.__proto__=c)}var We=function(c){return Object.keys(c).reduce(function(s,m){return(m.substr(0,5)==="data-"||m.substr(0,5)==="aria-"||m==="role")&&(s[m]=c[m]),s},{})},me=function(k){Re(c,k);function c(){var s,m,A,H;Xe(this,c);for(var pe=arguments.length,Ae=Array(pe),le=0;le1&&arguments[1]!==void 0?arguments[1]:1,L=Se.length,f=0;f1&&arguments[1]!==void 0?arguments[1]:!1;return Object(We.a)(s).map(function(A,H){if(!we.isValidElement(A)||!A.type)return null;var pe=A.type.isSelectOptGroup,Ae=A.key,le=A.props,te=le.children,V=Object(M.a)(le,["children"]);return m||!pe?me(A):Object(Re.a)(Object(Re.a)({key:"__RC_SELECT_GRP__".concat(Ae===null?H:Ae,"__"),label:Ae},V),{},{options:ge(te)})}).filter(function(A){return A})}var Pe=_("2Qr1"),ae=_("qNPg"),b=_("U8pU"),ne=_("Kwbf"),F=_("WKfj");function x(s){var m=s.mode,A=s.options,H=s.children,pe=s.backfill,Ae=s.allowClear,le=s.placeholder,te=s.getInputElement,V=s.showSearch,$=s.onSearch,N=s.defaultOpen,J=s.autoFocus,h=s.labelInValue,C=s.value,g=s.inputValue,re=s.optionLabelProp,ve=m==="multiple"||m==="tags",Y=V!==void 0?V:ve||m==="combobox",ue=A||ge(H);if(Object(ne.a)(m!=="tags"||ue.every(function(ke){return!ke.disabled}),"Please avoid setting option to disabled in tags mode since user can always type text as tag."),m==="tags"||m==="combobox"){var Ee=ue.some(function(ke){return ke.options?ke.options.some(function(Se){return typeof("value"in Se?Se.value:Se.key)=="number"}):typeof("value"in ke?ke.value:ke.key)=="number"});Object(ne.a)(!Ee,"`value` of Option should not use number type when `mode` is `tags` or `combobox`.")}if(Object(ne.a)(m!=="combobox"||!re,"`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly."),Object(ne.a)(m==="combobox"||!pe,"`backfill` only works with `combobox` mode."),Object(ne.a)(m==="combobox"||!te,"`getInputElement` only work with `combobox` mode."),Object(ne.b)(m!=="combobox"||!te||!Ae||!le,"Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`."),$&&!Y&&m!=="combobox"&&m!=="tags"&&Object(ne.a)(!1,"`onSearch` should work with `showSearch` instead of use alone."),Object(ne.b)(!N||J,"`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed."),C!=null){var je=Object(F.d)(C);Object(ne.a)(!h||je.every(function(ke){return Object(b.a)(ke)==="object"&&("key"in ke||"value"in ke)}),"`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`"),Object(ne.a)(!ve||Array.isArray(C),"`value` should be array when `mode` is `multiple` or `tags`")}if(H){var Me=null;Object(We.a)(H).some(function(ke){if(!we.isValidElement(ke)||!ke.type)return!1;var Se=ke.type;if(Se.isSelectOption)return!1;if(Se.isSelectOptGroup){var et=Object(We.a)(ke.props.children).every(function(Ge){return!we.isValidElement(Ge)||!ke.type||Ge.type.isSelectOption?!0:(Me=Ge.type,!1)});return!et}return Me=Se,!0}),Me&&Object(ne.a)(!1,"`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(Me.displayName||Me.name||Me,"`.")),Object(ne.a)(g===void 0,"`inputValue` is deprecated, please use `searchValue` instead.")}}var ee=x,j=Object(ae.a)({prefixCls:"rc-select",components:{optionList:oe},convertChildrenToData:ge,flattenOptions:Pe.d,getLabeledValue:Pe.e,filterOptions:Pe.b,isValueDisabled:Pe.g,findValueOption:Pe.c,warningProps:ee,fillOptionsWithMissingValue:Pe.a}),O=function(s){Object(se.a)(A,s);var m=Object(Le.a)(A);function A(){var H;return Object(G.a)(this,A),H=m.apply(this,arguments),H.selectRef=we.createRef(),H.focus=function(){H.selectRef.current.focus()},H.blur=function(){H.selectRef.current.blur()},H}return Object(xe.a)(A,[{key:"render",value:function(){return we.createElement(j,Object.assign({ref:this.selectRef},this.props))}}]),A}(we.Component);O.Option=Te,O.OptGroup=Ie;var k=O,c=nt.c=k},M8RZ:function(ht,nt,_){"use strict";_.d(nt,"a",function(){return Z});var G=_("fWQN"),xe=_("mtLc"),se=_("yKVA"),Le=_("879j"),we=_("cDcd"),q=_.n(we),M=_("faye"),W=_.n(M),Z=function(X){Object(se.a)(S,X);var D=Object(Le.a)(S);function S(be){var Q;Object(G.a)(this,S),Q=D.call(this,be);var U=window.document;return Q.node=U.createElement("div"),U.body.appendChild(Q.node),Q}return Object(xe.a)(S,[{key:"render",value:function(){var Q=this.props.children;return Object(M.createPortal)(Q,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),S}(q.a.Component)},Ot1p:function(ht,nt,_){"use strict";var G=_("2qtc"),xe=_("kLXV"),se=_("rAM+"),Le=_("miYZ"),we=_("tsqr"),q=_("9og8"),M=_("tJVT"),W=_("jrin"),Z=_("WmNS"),X=_.n(Z),D=_("cDcd"),S=_.n(D),be=_("VrN/"),Q=_.n(be),U=_("bdgK"),B=_("p77/"),I=_("Bd2K"),oe=_("ELLl"),ce=_("19Vz"),Te=_("lZu9"),Xe=_("+NIl"),Ie=_("kSUc"),Re=_("9Bee"),We=function(R){var ie=R.value,ye=ie===void 0?"":ie,Ue=R.className,Ye=R.showTextOnly,Fe=R.showLines,yt=R.style,dt=yt===void 0?{}:yt,it=Object(D.useMemo)(function(){return""},[ye]);return S.a.createElement(S.a.Fragment,null,S.a.createElement("div",{dangerouslySetInnerHTML:{__html:it}}))},me=_("0Owb"),ge=_("dejd"),Pe=_("C+DQ"),ae=_("1vsH"),b=_("m3rI"),ne=[{title:"\u7C97\u4F53",icon:"icon-bold",actionName:"bold"},{title:"\u659C\u4F53",icon:"icon-italic",actionName:"italic"},"|",{title:"\u65E0\u5E8F\u5217\u8868",icon:"icon-unorder-list",actionName:"list-ul"},{title:"\u6709\u5E8F\u5217\u8868",icon:"icon-order-list",actionName:"list-ol"},"|",{title:"\u884C\u5185\u4EE3\u7801",icon:"icon-code",actionName:"code"},{title:"\u4EE3\u7801\u5757\uFF08\u591A\u8BED\u8A00\u98CE\u683C\uFF09",icon:"icon-file-code",actionName:"code-block"},{title:"\u94FE\u63A5",icon:"icon-link",actionName:"link"},"|",{title:"\u884C\u5185\u516C\u5F0F",icon:"icon-sum",actionName:"inline-latex"},{title:"\u591A\u884C\u516C\u5F0F",icon:"icon-formula",actionName:"latex"},"|",{title:"\u6DFB\u52A0\u56FE\u7247",icon:"icon-picture",actionName:"upload-image"},{title:"\u8868\u683C",icon:"icon-table",actionName:"add-table"},"|",{title:"\u6362\u884C",icon:"icon-minus",actionName:"line-break"},{title:"\u6E05\u7A7A",icon:"icon-eraser",actionName:"eraser"}];function F(R){var ie=R.onActionCallback,ye=R.title,Ue=R.icon,Ye=R.actionName,Fe=R.className,yt=Fe===void 0?"":Fe,dt=R.children;function it(){ie(Ye)}return S.a.createElement("a",{title:ye,className:yt,onClick:it},S.a.createElement("i",{className:"md-iconfont ".concat(Ue)}),dt)}var x=function(R){var ie=R.watch,ye=R.showNullButton,Ue=R.onActionCallback,Ye=R.fullScreen,Fe=R.insertTemp,yt=R.hidetoolBar,dt=R.uuid,it=R.setOpenPhones;console.log("link:","".concat(location.origin,"/upload.html?_educoder_session_login=").concat(Object(ae.n)("_educoder_session_login"),"&_educoder_session=").concat(Object(ae.n)("_educoder_session"),"&key=").concat(dt,"&api=").concat(encodeURIComponent(b.a.PROXY_SERVER)));var kt=[].concat(ne,[{title:"".concat(ie?"\u5173\u95ED\u5B9E\u65F6\u9884\u89C8":"\u5F00\u542F\u5B9E\u65F6\u9884\u89C8"),icon:"".concat(ie?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return S.a.createElement("ul",{className:"markdown-toolbar-container"},!yt&&kt.map(function(xt,Et){return S.a.createElement("li",{key:Et},xt.actionName?S.a.createElement(F,Object(me.a)({},xt,{onActionCallback:Ue})):S.a.createElement("span",{className:"v-line"}))}),ye?S.a.createElement("li",null,S.a.createElement(F,{icon:"icon-edit",className:"btn-null",title:"\u589E\u52A0\u586B\u7A7A",actionName:"add-null-ch",onActionCallback:Ue},S.a.createElement("span",{className:"fill-tip"},"\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))):null,Fe&&S.a.createElement("li",null,S.a.createElement(F,{icon:"icon-edit",className:"btn-null",title:"\u63D2\u5165\u6A21\u677F",actionName:"inster-template-".concat(Fe),onActionCallback:Ue},S.a.createElement("span",{className:"fill-tip"},"\u63D2\u5165\u6A21\u677F"))),S.a.createElement("li",{className:"btn-full-screen"},S.a.createElement(F,{icon:"".concat(Ye?"icon-shrink":"icon-enlarge"),title:Ye?"\u5173\u95ED\u5168\u5C4F":"\u5F00\u542F\u5168\u5C4F",actionName:"trigger-full-screen",onActionCallback:Ue})))},ee=_("M8RZ"),j=_("+L6B"),O=_("2/Rp"),k=_("y8nQ"),c=_("Vl3Y"),s=_("5NDa"),m=_("5rEg"),A={labelCol:{span:4},wrapperCol:{span:20}},H=function(R){var ie=R.callback,ye=R.onCancel;function Ue(Ye){ie(Ye)}return S.a.createElement(c.a,Object(me.a)({},A,{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:Ue}),S.a.createElement(c.a.Item,{label:"\u94FE\u63A5\u5730\u5740",name:"link",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u5730\u5740"}]},S.a.createElement(m.a,null)),S.a.createElement(c.a.Item,{label:"\u94FE\u63A5\u6807\u9898",name:"title",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u94FE\u63A5\u6807\u9898"}]},S.a.createElement(m.a,null)),S.a.createElement("div",{className:"flex-container flex-end"},S.a.createElement(O.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),S.a.createElement(O.a,{type:"ghost",onClick:ye},"\u53D6\u6D88")))},pe=_("7ahc"),Ae=_("HmJG"),le=_("BjJ7"),te=c.a.useForm,V={width:280,marginRight:10},$={labelCol:{span:5},wrapperCol:{span:19}},N=function(R){var ie=R.callback,ye=R.onCancel,Ue=te(),Ye=Object(M.a)(Ue,1),Fe=Ye[0];function yt(kt){ie(kt)}function dt(kt,xt){if(kt.status===-1){we.b.error(kt.message);return}Fe.setFieldsValue({src:"/api/attachments/".concat(kt.id),type:xt.type})}function it(kt){var xt=kt.target.files[0];h(xt,dt)}return S.a.createElement(c.a,Object(me.a)({form:Fe},$,{className:"upload-image-panel",onFinish:yt}),S.a.createElement(c.a.Item,{label:"\u56FE\u7247\u5730\u5740",required:!0},S.a.createElement("div",{className:"flex-container"},S.a.createElement(c.a.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u56FE\u7247\u5730\u5740"}]},S.a.createElement(m.a,{style:V})),S.a.createElement(J,{onFileChange:it}))),S.a.createElement(c.a.Item,{label:"\u56FE\u7247\u63CF\u8FF0",name:"alt"},S.a.createElement(m.a,{style:{width:264}})),S.a.createElement(c.a.Item,{style:{textAlign:"right"}},S.a.createElement(O.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),S.a.createElement(O.a,{type:"ghost",onClick:ye},"\u53D6\u6D88")))};function J(R){var ie=R.onFileChange;return S.a.createElement("a",{className:"upload-button"},"\u672C\u5730\u4E0A\u4F20",S.a.createElement("input",{type:"file",onChange:ie}))}function h(R,ie){if(!R)throw new String("\u6CA1\u6709\u6587\u4EF6");var ye=new FormData;ye.append("editormd-image-file",R),ye.append("file_param_name","editormd-image-file"),ye.append("byxhr","true");var Ue=new window.XMLHttpRequest;Ue.withCredentials=!0,Ue.addEventListener("load",function(Ye){ie(JSON.parse(Ye.target.responseText),R)},!1),Ue.addEventListener("error",function(Ye){console.error(Ye)},!1),Ue.open("POST","".concat(le.a,"/api/attachments.json")),Ue.send(ye)}var C=_("giR+"),g=_("fyUT"),re=_("7Kak"),ve=_("9yH6"),Y=ve.a.Group,ue={margin:"0 8px"},Ee=function(R){var ie=R.callback,ye=R.onCancel;function Ue(Ye){ie(Ye)}return S.a.createElement(c.a,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:Ue},S.a.createElement("div",{className:"flex-container",style:{alignItems:"baseline"}},S.a.createElement("span",{style:ue},"\u5355\u5143\u683C\u6570\uFF1A"),S.a.createElement("span",{style:ue},"\u884C\u6570"),S.a.createElement(c.a.Item,{name:"row",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u884C\u6570"}]},S.a.createElement(g.a,null)),S.a.createElement("span",{style:ue},"\u5217\u6570"),S.a.createElement(c.a.Item,{name:"col",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u5217\u6570"}]},S.a.createElement(g.a,null))),S.a.createElement("div",{className:"flex-container",style:{marginTop:12,alignItems:"baseline"}},S.a.createElement("span",{style:ue},"\u5BF9\u9F50\u65B9\u5F0F\uFF1A"),S.a.createElement(c.a.Item,{name:"align"},S.a.createElement(Y,null,S.a.createElement(ve.a,{value:"default"},S.a.createElement("i",{className:"fa fa-align-justify"})),S.a.createElement(ve.a,{value:"left"},S.a.createElement("i",{className:"fa fa-align-left"})),S.a.createElement(ve.a,{value:"center"},S.a.createElement("i",{className:"fa fa-align-center"})),S.a.createElement(ve.a,{value:"right"},S.a.createElement("i",{className:"fa fa-align-right"}))))),S.a.createElement("div",{className:"flex-container flex-end"},S.a.createElement(O.a,{type:"primary",htmlType:"submit",style:{marginRight:10}},"\u786E\u5B9A"),S.a.createElement(O.a,{type:"ghost",onClick:ye},"\u53D6\u6D88")))},je=_("ErOA"),Me=_("7Cbv"),ke="link",Se="upload-image",et="code-block",Ge="add-table",Ke="------------",Ve={default:Ke,left:":".concat(Ke),center:":".concat(Ke,":"),right:"".concat(Ke,":")},st=_("9VGf"),tt,Je;function fe(){}var rt=0,$e=1e4,he="\u2581",Oe=`
**\u6A21\u677F\u6807\u9898**
\u6A21\u677F\u6B63\u6587\u5185\u5BB9\uFF0C\u53EF\u8F93\u5165\u6587\u672C\u5185\u5BB9\u548C\u7C98\u8D34\u56FE\u7247\u7B49\u64CD\u4F5C`;function P(R){return/^\d+$/.test(R)?"".concat(R,"px"):R}var T=navigator.platform.toUpperCase().indexOf("MAC")>=0,L=T?"Cmd":"Ctrl",f=["pptm","pptx","ppt","pot","pps","ppa","potx","ppsx","ppam","pptm","potm","ppsm","doc","docx","dot","dotx","docm","dotm","xls","xlsx","csv","xlt","xla","xltx","xlsm","xltm","xlam","xlsb"],p=(tt={},Object(W.a)(tt,L+"-B","bold"),Object(W.a)(tt,L+"-I","italic"),tt),v=(Je={},Object(W.a)(Je,ke,"\u6DFB\u52A0\u94FE\u63A5"),Object(W.a)(Je,et,"\u6DFB\u52A0\u4EE3\u7801\u5757"),Object(W.a)(Je,Se,"\u6DFB\u52A0\u6587\u4EF6"),Object(W.a)(Je,Ge,"\u6DFB\u52A0\u8868\u683C"),Je),w=nt.a=function(R){var ie=R.defaultValue,ye=ie===void 0?"":ie,Ue=R.onChange,Ye=R.width,Fe=Ye===void 0?"100%":Ye,yt=R.height,dt=yt===void 0?400:yt,it=R.miniToolbar,kt=it===void 0?!1:it,xt=R.isFocus,Et=xt===void 0?!1:xt,Ot=R.watch,vt=R.insertTemp,sn=R.mode,Mn=sn===void 0?"markdown":sn,cn=R.id,vn=cn===void 0?"markdown-editor-id":cn,pn=R.showResizeBar,ia=pn===void 0?!1:pn,An=R.noStorage,Wr=An===void 0?!1:An,Br=R.showNullButton,Dt=Br===void 0?!1:Br,Ze=R.hidetoolBar,Dn=Ze===void 0?!1:Ze,pr=R.fullScreen,Zt=pr===void 0?!1:pr,Ct=R.onBlur,bn=R.onCMBeforeChange,Nn=R.onFullScreen,mr=R.className,_e=mr===void 0?"":mr,ut=R.disablePaste,Xr=ut===void 0?!1:ut,gr=R.placeholder,vr=gr===void 0?"":gr,Zn=R.values,br=Zn===void 0?"":Zn,ft=Object(D.useState)(null),Ti=Object(M.a)(ft,2),De=Ti[0],yr=Ti[1],mn=Object(D.useState)(ye),Gr=Object(M.a)(mn,2),Qn=Gr[0],yn=Gr[1],Kr=Object(D.useState)(Ot),Vr=Object(M.a)(Kr,2),xn=Vr[0],$r=Vr[1],Ai=Object(D.useState)(Zt),Yr=Object(M.a)(Ai,2),wn=Yr[0],Oi=Yr[1],aa=Object(D.useState)(""),qr=Object(M.a)(aa,2),Yt=qr[0],Wn=qr[1],oa=Object(D.useState)(0),er=Object(M.a)(oa,2),En=er[0],Jr=er[1],sa=Object(D.useState)(dt),Li=Object(M.a)(sa,2),_i=Li[0],xr=Li[1],Ri=Object(D.useState)(!1),Mi=Object(M.a)(Ri,2),la=Mi[0],wr=Mi[1],tr=Object(D.useRef)(Object(Me.a)()),nr=Object(D.useRef)(!1),Er=Object(D.useRef)(),Pn=Object(D.useRef)(),jn=Object(D.useRef)(),In=Object(D.useRef)(),Cr=Object(D.useRef)(),Di=function(){var Qe=Object(q.a)(X.a.mark(function ct(){var ot,mt;return X.a.wrap(function(Lt){for(;;)switch(Lt.prev=Lt.next){case 0:return Lt.next=2,Object(je.a)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:tr.current}});case 2:mt=Lt.sent,mt!=null&&(ot=mt.attachments)!==null&&ot!==void 0&&ot.length&&(console.log("cm:",De,Pn),mt.attachments.map(function(bt){bt.content_type.indexOf("image")>-1?De.replaceSelection(".concat(bt.content_type,")")):bt.content_type.indexOf("video")>-1?De.replaceSelection('')):bt.content_type.indexOf("pdf")>-1?De.replaceSelection('').concat(bt.name,"")):De.replaceSelection("[".concat(bt.name,"](").concat(b.a.API_SERVER,"/api/attachments/").concat(bt.id,"?type=").concat(bt.content_type,")"))}));case 4:case"end":return Lt.stop()}},ct)}));return function(){return Qe.apply(this,arguments)}}();Object(D.useEffect)(function(){yn(br),De==null||De.setValue(br)},[br]),Object(D.useEffect)(function(){Nn==null||Nn(wn)},[wn]),Object(D.useEffect)(function(){if(Pn.current){var Qe=Q.a.fromTextArea(Pn.current,{mode:Mn,lineNumbers:!kt,lineWrapping:!0,value:ye,autoCloseTags:!0,autoCloseBrackets:!0});Et&&Qe.focus();function ct(ot,mt){if(Xr){mt.preventDefault();return}var wt=mt.clipboardData;if(wt){var Lt=wt.types.toString(),bt=wt.items;if(Lt==="Files"||wt.types.indexOf("Files")>-1){if(mt.preventDefault(),Mn=="stex")return;try{var Ut,Qt=bt[1];((Ut=bt[0])===null||Ut===void 0?void 0:Ut.kind)==="file"&&(Qt=bt[0]);var gt=Qt.getAsFile(),Un=gt.name.split(".").pop();h(gt,function(St){if(St.id){var en,Kt,gn;(gt==null||((en=gt.type)===null||en===void 0)?void 0:en.indexOf("image"))>-1?Qe.replaceSelection(".concat(St.content_type,")")):(gt==null||((Kt=gt.type)===null||Kt===void 0)?void 0:Kt.indexOf("video"))>-1?Qe.replaceSelection('')):(gt==null||((gn=gt.type)===null||gn===void 0)?void 0:gn.indexOf("pdf"))>-1?Qe.replaceSelection('').concat(gt.name,"")):f.includes(Un)?Qe.replaceSelection('').concat(gt.name,"")):Qe.replaceSelection("[".concat(gt.name,"](").concat(b.a.API_SERVER,"/api/attachments/").concat(St.id,"?type=").concat(St.content_type,")"))}else(St==null?void 0:St.status)===401&&(document.location.href="/user/login")})}catch(St){we.b.warn("\u8BF7\u4F7F\u7528chrome\u6D4F\u89C8\u5668\u7C98\u8D34")}return!0}else return!0}return!0}return Qe.on("paste",ct),Qe.on("dragleave",function(ot,mt){jn.current.classList.remove("mouse-hover-md")}),Qe.on("dragover",function(ot,mt){jn.current.classList.add("mouse-hover-md")}),Qe.on("drop",function(ot,mt){jn.current.classList.add("mouse-hover-md");var wt;if(wt=mt.dataTransfer.files,wt.length>0){mt.preventDefault(),mt.stopPropagation();for(var Lt=function(Qt){var gt=wt[Qt],Un=gt.name.split(".").pop();h(gt,function(St){if(St.id){var en,Kt,gn;(gt==null||((en=gt.type)===null||en===void 0)?void 0:en.indexOf("image"))>-1?Qe.replaceSelection(".concat(St.content_type,")")):(gt==null||((Kt=gt.type)===null||Kt===void 0)?void 0:Kt.indexOf("video"))>-1?Qe.replaceSelection('')):(gt==null||((gn=gt.type)===null||gn===void 0)?void 0:gn.indexOf("pdf"))>-1?Qe.replaceSelection('').concat(gt.name,"")):f.includes(Un)?Qe.replaceSelection('').concat(gt.name,"")):Qe.replaceSelection("[".concat(gt.name,"](").concat(b.a.API_SERVER,"/api/attachments/").concat(St.id,"?type=").concat(St.content_type,")"))}else(St==null?void 0:St.status)===401&&(document.location.href="/user/login")})},bt=0;bt0||bt.target.offsetWidth>0)&&(dn(),De.setSize("100%","100%"),De.refresh())}}catch(Ut){wt.e(Ut)}finally{wt.f()}});return ot.observe(Pn.current.parentElement),ot}if(De){var ct=Qe();return function(){ct.unobserve(Pn.current.parentElement)}}},[De,dn]),Object(D.useEffect)(function(){if(De){for(var Qe=[],ct=function(){var bt=mt[ot];wt=Object(M.a)(bt,2);var Ut=wt[0],Qt=wt[1],gt=Object(W.a)({},Ut,function(){Ni(Qt)});Qe.push(gt),De.addKeyMap(gt)},ot=0,mt=Object.entries(p);ot0){var Qe=new Date().getTime(),ct=window.sessionStorage.getItem(vn);Qe>=En+$e&&(!ct||ct!==Qn)&&(window.sessionStorage.setItem(vn,Qn),wr(!0))}},$e),Object(D.useEffect)(function(){$r(Ot)},[De,Ot]),Object(D.useEffect)(function(){De&&(Et&&De.focus())},[De,Et]),Object(D.useEffect)(function(){if(xn&&De){var Qe=De.getScrollerElement();function ct(ot){var mt=ot.target;if(Cr.current){var wt=mt.scrollTop/mt.scrollHeight;Cr.current.scrollTop=Cr.current.scrollHeight*wt}}return Qe.addEventListener("scroll",ct),function(){Qe.removeEventListener("scroll",ct)}}},[De,xn]),Object(D.useEffect)(function(){if(De&&bn){function Qe(ct,ot){bn(ct,ot)}return De.on("beforeChange",Qe),function(){De.off("beforeChange",Qe)}}},[De,bn]),Object(D.useEffect)(function(){if(De&&Ct){function Qe(){Ct(De.getValue())}return De.on("blur",Qe),function(){De.off("blur",Qe)}}},[De,Ct]),Object(D.useEffect)(function(){if(De){function Qe(ct){var ot=ct.getValue();yn(ot),Jr(new Date().getTime()),ct.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),Ue&&Ue(ot)}return De.on("change",Qe),function(){De.off("change",Qe)}}},[De,Ue]),Object(D.useEffect)(function(){De&&(ye==null?(De.setValue(""),yn("")):ye!==De.getValue()&&(De.setValue(ye),yn(ye),De.setCursor(De.lineCount(),0)))},[De,ye]);var Ni=Object(D.useCallback)(function(Qe){var ct=De.getCursor(),ot=De.getSelection(),mt=ot.split(`
`);switch(Qe){case"bold":return De.replaceSelection("**"+ot+"**"),ot===""&&De.setCursor(ct.line,ct.ch+2),De.focus();case"italic":return De.replaceSelection("*"+ot+"*"),ot===""&&De.setCursor(ct.line,ct.ch+1),De.focus();case"code":return De.replaceSelection("`"+ot+"`"),ot===""&&De.setCursor(ct.line,ct.ch+1),De.focus();case"inline-latex":return De.replaceSelection("`$$"+ot+"$$`"),ot===""&&De.setCursor(ct.line,ct.ch+3),De.focus();case"latex":return De.replaceSelection("```latex\n"+ot+"\n```"),De.setCursor(ct.line+1,ot.length+1),De.focus();case"line-break":return De.replaceSelection(`
`),De.focus();case"list-ul":return ot===""?De.replaceSelection("- "+ot):De.replaceSelection(mt.map(function(wt){return wt===""?"":"- ".concat(wt)}).join(`
`)),De.focus();case"list-ol":return ot===""?De.replaceSelection("1. "+ot):De.replaceSelection(mt.map(function(wt,Lt){return wt===""?"":"".concat(Lt+1,". ").concat(wt)}).join(`
`)),De.focus();case"add-null-ch":return ot===""&&De.setCursor(ct.line,ct.ch+1),De.replaceSelection(he),De.focus();case"inster-template-1":return ot===""&&De.setCursor(ct.line,ct.ch),De.replaceSelection(Oe),De.focus();case"eraser":return De.setValue(""),De.focus();case"trigger-watch":return $r(!xn),De.focus();case"trigger-full-screen":return Oi(!wn),De.focus();case ke:Wn(ke);return;case et:Wn(et);return;case Se:Wn(Se);return;case Ge:Wn(Ge);return;default:throw new Error}},[De,xn,wn]),kr=Object(D.useCallback)(function(Qe){Wn("");switch(Yt){case ke:var ct=Qe.title,ot=Qe.link;return De.replaceSelection("[".concat(ct,"](").concat(ot,")")),De.focus();case et:var mt=Qe.language,wt=Qe.content;return De.replaceSelection(["```"+mt,wt,"```"].join(`
`)),De.focus();case Se:var Lt=Qe.src,bt=Qe.alt;return bt?De.replaceSelection(".concat(Lt,' "').concat(bt,'" )')):De.replaceSelection("")),De.focus();case Ge:for(var Ut=Qe.row,Qt=Qe.col,gt=Qe.align,Un=`
`,St=0;St300&&(Ut=300);var Qt=dt+Ut+"px";xr(Qt)}}return Qe.addEventListener("mousedown",mt),document.addEventListener("mousemove",Lt),document.addEventListener("mouseup",wt),function(){Qe.removeEventListener("mousedown",mt),document.removeEventListener("mousemove",Lt),document.removeEventListener("mouseup",wt)}}},[De,In]),Object(D.useEffect)(function(){xr(dt)},[dt]);var On=P(Fe),Qr=P(_i),Cn={width:On,height:Qr},ei=Object(D.useMemo)(function(){if(En){var Qe=new Date(En),ct=Qe.getHours(),ot=Qe.getMinutes(),mt=Qe.getSeconds();return ct=ct<10?"0"+ct:ct,ot=ot<10?"0"+ot:ot,mt=mt<10?"0"+mt:mt,"".concat(ct,":").concat(ot,":").concat(mt)}return 0},[En]);function Pi(){window.sessionStorage.removeItem(vn),wr(!1),Jr(0)}function rr(){wr(!1),Jr(0),De.setValue(window.sessionStorage.getItem(vn))}function ua(Qe,ct){var ot=De.getValue();ot=ot.replace(Qe,ct),yn(ot),De==null||De.setValue(ot)}return S.a.createElement(D.Fragment,null,S.a.createElement("div",{className:"markdown-editor-wrapper",ref:jn},S.a.createElement("div",{className:"markdown-editor-container ".concat(_e," ").concat(xn?"on-preview":""," ").concat(kt?"mini":""," ").concat(wn?"full-screen":""),style:Cn},S.a.createElement(x,{insertTemp:vt,watch:xn,fullScreen:wn,showNullButton:Dt,onActionCallback:Ni,hidetoolBar:Dn,uuid:tr.current,setOpenPhones:function(){nr.current=!0}}),S.a.createElement("div",{className:"markdown-editor-body"},S.a.createElement("div",{className:"codemirror-container"},S.a.createElement("textarea",{ref:Pn,placeholder:vr})),xn?S.a.createElement("div",{ref:Cr,className:"preview-container"},Mn==="stex"&&S.a.createElement(We,{value:Qn}),Mn!=="stex"&&S.a.createElement(Re.a,{edit:!0,value:Qn,replaces:ua})):null))),ia?S.a.createElement("a",{ref:In,className:"editor-resize"}):null,S.a.createElement(ee.a,null,v[Yt]?S.a.createElement(xe.a,{centered:!0,title:v[Yt],visible:!0,onCancel:Bn,footer:null,className:"markdown-popup-form"},Zr):null))}},SJMd:function(ht,nt){/**
* @license
* Copyright (C) 2006 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/var _,G,xe,se=!1,Le,we;window.PR_SHOULD_USE_CONTINUATION=!0;var q,M;(function(){var W=window,Z=["break,continue,do,else,for,if,return,while"],X=[Z,"auto,case,char,const,default,double,enum,extern,float,goto,inline,int,long,register,restrict,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"],D=[X,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],S=[D,"alignas,alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,delegate,dynamic_cast,explicit,export,friend,generic,late_check,mutable,namespace,noexcept,noreturn,nullptr,property,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],be=[D,"abstract,assert,boolean,byte,extends,finally,final,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],Q=[D,"abstract,add,alias,as,ascending,async,await,base,bool,by,byte,checked,decimal,delegate,descending,dynamic,event,finally,fixed,foreach,from,get,global,group,implicit,in,interface,internal,into,is,join,let,lock,null,object,out,override,orderby,params,partial,readonly,ref,remove,sbyte,sealed,select,set,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,value,var,virtual,where,yield"],U="all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,throw,true,try,unless,until,when,while,yes",B=[D,"abstract,async,await,constructor,debugger,enum,eval,export,function,get,implements,instanceof,interface,let,null,set,undefined,var,with,yield,Infinity,NaN"],I="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",oe=[Z,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],ce=[Z,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],Te=[Z,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],Xe=[S,Q,be,B,I,oe,ce,Te],Ie=/^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,Re="str",We="kwd",me="com",ge="typ",Pe="lit",ae="pun",b="pln",ne="tag",F="dec",x="src",ee="atn",j="atv",O="nocode",k="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function c(Y){for(var ue=0,Ee=!1,je=!1,Me=0,ke=Y.length;Me122||(f<65||L>90||rt.push([Math.max(65,L)|32,Math.min(f,90)|32]),f<97||L>122||rt.push([Math.max(97,L)&~32,Math.min(f,122)&~32]))}}rt.sort(function(R,ie){return R[0]-ie[0]||ie[1]-R[1]});for(var p=[],v=[],Oe=0;Oew[0]&&(w[1]+1>w[0]&&he.push("-"),he.push(Ke(w[1])))}return he.push("]"),he.join("")}function st(Je){for(var fe=Je.source.match(new RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)","g")),rt=fe.length,$e=[],he=0,Oe=0;he