text: (window.webpackJsonp_N_E=window.webpackJsonp_N_E||[]).push([[96],{"H+VF":function(e,t,n){"use strict";n.r(t);var r=n("QM3I"),a=n("jffb"),o=n.n(a),i=n("mXGw"),c=n.n(i),l=n("zad5"),u=n("phF4"),s=function(e){return function(t){var n=t.isInline;return t.isInline=function(t){return!!e.some((function(e){return"component"===e.pluginType&&"inline"===e.object&&e.type===t.type}))||n(t)},t}},f=n("mZcU"),p=n("gI5u"),b=function(e,t,n,r){return new(n||(n=Promise))((function(a,o){function i(e){try{l(r.next(e))}catch(t){o(t)}}function c(e){try{l(r.throw(e))}catch(t){o(t)}}function l(e){var t;e.done?a(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,c)}l((r=r.apply(e,t||[])).next())}))},d=function(e,t){var n,r,a,o,i={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return o={next:c(0),throw:c(1),return:c(2)},"function"===typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function c(o){return function(c){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(a=2&o[0]?r.return:o[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,o[1])).done)return a;switch(r=0,a&&(o=[2&o[0],a.value]),o[0]){case 0:case 1:a=o;break;case 4:return i.label++,{value:o[1],done:!1};case 5:i.label++,r=o[1],o=[0];continue;case 7:o=i.ops.pop(),i.trys.pop();continue;default:if(!(a=(a=i.trys).length>0&&a[a.length-1])&&(6===o[0]||2===o[0])){i=0;continue}if(3===o[0]&&(!a||o[1]>a[0]&&o[1]<a[3])){i.label=o[1];break}if(6===o[0]&&i.label<a[1]){i.label=a[1],a=o;break}if(a&&i.label<a[2]){i.label=a[2],i.ops.push(o);break}a[2]&&i.ops.pop(),i.trys.pop();continue}o=t.call(e,i)}catch(c){o=[6,c],r=0}finally{n=a=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,c])}}},v=function(e,t){return function(n){var r=n.insertData,a=Object(p.a)({plugins:e});return n.insertData=function(e){return b(void 0,void 0,void 0,(function(){var o,i,c,u,s,p,b,v,h,y,m;return d(this,(function(d){switch(d.label){case 0:return e.getData("application/x-slate-fragment")?(r(e),[2]):(o=e.getData("text/html"))?[4,a(o)]:[3,2];case 1:return i=d.sent().slate,l.Transforms.insertFragment(n,i),[2];case 2:if(c=e.getData("text/plain")){try{if(u=JSON.parse(c),Object(f.a)(u))return[2]}catch(w){}for(s=c.split("\n"),p=!1,b=0;b<s.length;b++)v=s[b],h=s[b+1],y=!h||!h.trim(),m=v+(y?"":"\n"),v.trim()?p?(l.Transforms.insertNodes(n,{type:t,children:[{text:m}]}),p=!1):(l.Transforms.insertText(n,m),p=!1):p=!0;return[2]}return r(e),[2]}}))}))},n}},h=n("TucM"),y=function(e,t){var n="function"===typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,a,o=n.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)i.push(r.value)}catch(c){a={error:c}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(a)throw a.error}}return i};t.default=function(e){var t=e.data,n=e.plugins,a=e.children,f=e.defaultPluginType,p=y(Object(i.useState)(null===t||void 0===t?void 0:t.slate),2),b=p[0],d=p[1],m=Object(i.useRef)(b);m.current=b;var w=Object(i.useMemo)((function(){return v(n,f)(Object(u.g)(s(n)(Object(l.createEditor)())))}),[]),g=Object(i.useCallback)(o()((function(){e.onChange({slate:m.current,selection:w.selection},{notUndoable:Object(r.a)(m.current,t.slate)})}),200),[e.onChange,w,t.slate]);Object(i.useEffect)((function(){t.selection?l.Transforms.select(w,t.selection):l.Transforms.deselect(w),d(null===t||void 0===t?void 0:t.slate)}),[null===t||void 0===t?void 0:t.slate,null===t||void 0===t?void 0:t.selection]);var j=Object(i.useCallback)((function(e){w.selection&&(d(e),g())}),[g]);return c.a.createElement(h.a,null,c.a.createElement(u.c,{editor:w,value:b,onChange:j},a))}}}]);