"use strict";(self.webpackChunk_cocalc_static=self.webpackChunk_cocalc_static||[]).push([[6987],{12430:(e,t,r)=>{r.d(t,{l:()=>c,v:()=>i});var n=r(24620),o=r(56393),a=r(41780);function c(e){var t=(0,n.path_split)(e),r=(0,n.separate_file_extension)(t.tail);return{directory:t.head,base:r.name,filename:t.tail}}function i(e,t){var r=(0,n.encode_path)(t);return(0,o.join)(a.appBasePath,e,"raw",r)}},32148:(e,t,r)=>{r.r(t),r.d(t,{Editor:()=>g});var n=r(28459),o=r(24620),a=r(95788),c=r(20812),i=r(32295),l="".concat(900,"px"),s=r(56018),u=r(41735);function f(e,t,r,n,o,a,c){try{var i=e[a](c),l=i.value}catch(e){return void r(e)}i.done?t(l):Promise.resolve(l).then(n,o)}function p(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function c(e){f(a,n,o,c,i,"next",e)}function i(e){f(a,n,o,c,i,"throw",e)}c(void 0)}))}}function d(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function v(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})))),n.forEach((function(t){d(e,t,r[t])}))}return e}var b=function(e,t){var r,n,o,a,c={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function i(a){return function(i){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;c;)try{if(r=1,n&&(o=2&a[0]?n.return:a[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;switch(n=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return c.label++,{value:a[1],done:!1};case 5:c.label++,n=a[1],a=[0];continue;case 7:a=c.ops.pop(),c.trys.pop();continue;default:if(!((o=(o=c.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){c=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){c.label=a[1];break}if(6===a[0]&&c.label<o[1]){c.label=o[1],o=a;break}if(o&&c.label<o[2]){c.label=o[2],c.ops.push(a);break}o[2]&&c.ops.pop(),c.trys.pop();continue}a=t.call(e,c)}catch(e){a=[6,e],n=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,i])}}},m=r(91121),y=r(33258),h=r(72113),_=r(96396),w=r(63697),O={cm:{short:"Code",name:"Source Code",icon:"code",component:y.w,buttons:(0,o.set)(["print","decrease_font_size","increase_font_size","save","time_travel","replace","find","goto_line","cut","paste","copy","undo","redo","format"])},iframe:{short:"HTML",name:"HTML IFrame",icon:"compass",component:m.w,buttons:(0,o.set)(["print","save","time_travel","reload","decrease_font_size","increase_font_size","set_zoom"])},preview:{short:"Preview",name:"Sanitized Preview",icon:"html5",component:function(e){var t,r,n=e.id,o=e.actions,f=e.font_size,d=e.value,m=e.editor_state,y=(0,u.B)(),h=i.React.useRef(null);function _(e){return w.apply(this,arguments)}function w(){return(w=p((function(e){var t;return b(this,(function(r){switch(r.label){case 0:return e?[4,(0,a.delay)(e)]:[3,2];case 1:r.sent(),r.label=2;case 2:return void 0!==(t=m.get("scroll"))&&$(i.ReactDOM.findDOMNode(h.current)).scrollTop(t),[2]}}))}))).apply(this,arguments)}return i.React.useEffect((function(){for(var e=0,t=[0,200,500];e<t.length;e++)_(t[e])}),[]),i.React.createElement("div",{style:{overflowY:"auto",width:"100%",fontSize:"".concat(f,"px")},ref:h,onScroll:(0,c.throttle)((function(){return function(){var e=i.ReactDOM.findDOMNode(h.current);if(null!=e){var t=$(e).scrollTop();o.save_editor_state(n,{scroll:t})}}()}),250),className:"cocalc-editor-div"},i.React.createElement("div",{style:{maxWidth:l,margin:"10px auto",padding:"0 10px"}},i.React.createElement(u.s.Provider,{value:(t=v({},y),r={noSanitize:!1},r=null!=r?r:{},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r.push.apply(r,n)}return r}(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})),t)},i.React.createElement(s.Z,{value:null!=d?d:""}))))},buttons:(0,o.set)(["print","decrease_font_size","increase_font_size","set_zoom","save","time_travel","reload"])},terminal:_.terminal,settings:h.H,time_travel:w.Y},g=(0,n.J)({format_bar:!0,editor_spec:O,display_name:"HTMLEditor"})}}]);