????
Current Path : C:/inetpub/vhost/sdoc.nextform.vn/www/assets/ |
Current File : C:/inetpub/vhost/sdoc.nextform.vn/www/assets/EditPDF-c11840d6.js |
import{P as p,R as C,F as Pe,M as De,r as v,O as c,j as f,Z as Be,i as w,n as F,C as $}from"./index-727ccf4d.js";import{F as Ae}from"./FullScreenDialog-84a3de57.js";import{N as fe,a as pe,b as Fe,c as $e,T as Ge}from"./TabsBasic-ac34a1aa.js";import{t as Oe,m as we,_ as M,B as te}from"./Button-9330b92c.js";import{v as Ie}from"./DataTable-2f4d7f97.js";import{d as Ue}from"./capitalize-f7a57a5c.js";import{m as Ke}from"./withStyles-da525f81.js";import{C as G}from"./Card-8b4f40d9.js";import{C as U}from"./CardBody-4a2e5616.js";import{R as Se}from"./Row-4ad47f29.js";import{C as K}from"./Col-ed66bf37.js";import{N as ze}from"./Nav-12db6fea.js";import"./InputNumber-dceb4c1c.js";import"./InputTime-0a0b65be.js";import{T as Ve}from"./TextArea-56268c1b.js";import{C as ne}from"./CardHeader-dcb844ec.js";import{C as We}from"./Collapse-da981db3.js";import{F as j}from"./DropdownList-ca18995c.js";var qe=["className","cssModule","tag","flush","horizontal","numbered"];function oe(){return oe=Object.assign?Object.assign.bind():function(o){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var e in i)Object.prototype.hasOwnProperty.call(i,e)&&(o[e]=i[e])}return o},oe.apply(this,arguments)}function Xe(o,t){if(o==null)return{};var i=Ye(o,t),e,n;if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(o);for(n=0;n<r.length;n++)e=r[n],!(t.indexOf(e)>=0)&&Object.prototype.propertyIsEnumerable.call(o,e)&&(i[e]=o[e])}return i}function Ye(o,t){if(o==null)return{};var i={},e=Object.keys(o),n,r;for(r=0;r<e.length;r++)n=e[r],!(t.indexOf(n)>=0)&&(i[n]=o[n]);return i}var Je={className:p.string,cssModule:p.object,flush:p.bool,horizontal:p.oneOfType([p.bool,p.string]),numbered:p.bool,tag:Oe},Ze=function(t){return t===!1?!1:t===!0||t==="xs"?"list-group-horizontal":"list-group-horizontal-".concat(t)};function xe(o){var t=o.className,i=o.cssModule,e=o.tag,n=e===void 0?"ul":e,r=o.flush,a=o.horizontal,s=a===void 0?!1:a,l=o.numbered,u=l===void 0?!1:l,d=Xe(o,qe),m=we(M(t,"list-group",r?"list-group-flush":Ze(s),{"list-group-numbered":u}),i);return C.createElement(n,oe({},d,{className:m}))}xe.propTypes=Je;var Qe=["className","cssModule","tag","active","disabled","action","color"];function ie(){return ie=Object.assign?Object.assign.bind():function(o){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var e in i)Object.prototype.hasOwnProperty.call(i,e)&&(o[e]=i[e])}return o},ie.apply(this,arguments)}function et(o,t){if(o==null)return{};var i=tt(o,t),e,n;if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(o);for(n=0;n<r.length;n++)e=r[n],!(t.indexOf(e)>=0)&&Object.prototype.propertyIsEnumerable.call(o,e)&&(i[e]=o[e])}return i}function tt(o,t){if(o==null)return{};var i={},e=Object.keys(o),n,r;for(r=0;r<e.length;r++)n=e[r],!(t.indexOf(n)>=0)&&(i[n]=o[n]);return i}var nt={action:p.bool,active:p.bool,className:p.string,cssModule:p.object,color:p.string,disabled:p.bool,tag:Oe},ot=function(t){t.preventDefault()};function je(o){var t=o.className,i=o.cssModule,e=o.tag,n=e===void 0?"li":e,r=o.active,a=o.disabled,s=o.action,l=o.color,u=et(o,Qe),d=we(M(t,r?"active":!1,a?"disabled":!1,s?"list-group-item-action":!1,l?"list-group-item-".concat(l):!1,"list-group-item"),i);return a&&(u.onClick=ot),C.createElement(n,ie({},u,{className:d}))}je.propTypes=nt;function it(o){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return Ke(o,Pe({defaultTheme:Ue},t))}class rt{constructor(t){this._undoStack=[],this._redoStack=[],this._redoStack.push(t)}insert(t){this._undoStack.push(this._redoStack.pop()),this._redoStack.length=0,this._redoStack.push(t)}getPrevState(){if(this._undoStack.length>=1){let t=this._undoStack.pop();return this._redoStack.push(t),t}}getNextState(){if(this._redoStack.length>=2){let t=this._redoStack.pop();return this._undoStack.push(t),this._redoStack[this._redoStack.length-1]}}clear(){if(this._redoStack.length>=1){let t=this._redoStack.pop();this._undoStack.length=0,this._redoStack.length=0,this._redoStack.push(t)}}}/* object-assign (c) Sindre Sorhus @license MIT */var he=Object.getOwnPropertySymbols,at=Object.prototype.hasOwnProperty,st=Object.prototype.propertyIsEnumerable;function ut(o){if(o==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(o)}function lt(){try{if(!Object.assign)return!1;var o=new String("abc");if(o[5]="de",Object.getOwnPropertyNames(o)[0]==="5")return!1;for(var t={},i=0;i<10;i++)t["_"+String.fromCharCode(i)]=i;var e=Object.getOwnPropertyNames(t).map(function(r){return t[r]});if(e.join("")!=="0123456789")return!1;var n={};return"abcdefghijklmnopqrst".split("").forEach(function(r){n[r]=r}),Object.keys(Object.assign({},n)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}var ct=lt()?Object.assign:function(o,t){for(var i,e=ut(o),n,r=1;r<arguments.length;r++){i=Object(arguments[r]);for(var a in i)at.call(i,a)&&(e[a]=i[a]);if(he){n=he(i);for(var s=0;s<n.length;s++)st.call(i,n[s])&&(e[n[s]]=i[n[s]])}}return e};const O=De(ct);function E(o){for(var t=arguments.length,i=Array(t>1?t-1:0),e=1;e<t;e++)i[e-1]=arguments[e];return typeof o=="function"&&o.apply(void 0,i)}function R(o,t){return Object.prototype.hasOwnProperty.call(o,t)}function dt(){return Math.random().toString(36).substring(7)}var T={menu:"react-contextmenu",menuVisible:"react-contextmenu--visible",menuWrapper:"react-contextmenu-wrapper",menuItem:"react-contextmenu-item",menuItemActive:"react-contextmenu-item--active",menuItemDisabled:"react-contextmenu-item--disabled",menuItemDivider:"react-contextmenu-item--divider",menuItemSelected:"react-contextmenu-item--selected",subMenu:"react-contextmenu-submenu"},H={},ft=!!(typeof window<"u"&&window.document&&window.document.createElement),re="REACT_CONTEXTMENU_SHOW",ae="REACT_CONTEXTMENU_HIDE";function Ne(o,t){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:window,e=void 0;typeof window.CustomEvent=="function"?e=new window.CustomEvent(o,{detail:t}):(e=document.createEvent("CustomEvent"),e.initCustomEvent(o,!1,!0,t)),i&&(i.dispatchEvent(e),O(H,t))}function me(){var o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments[1];Ne(re,O({},o,{type:re}),t)}function P(){var o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments[1];Ne(ae,O({},o,{type:ae}),t)}function pt(o,t){if(!(o instanceof t))throw new TypeError("Cannot call a class as a function")}var ht=function o(){var t=this;pt(this,o),this.handleShowEvent=function(i){for(var e in t.callbacks)R(t.callbacks,e)&&t.callbacks[e].show(i)},this.handleHideEvent=function(i){for(var e in t.callbacks)R(t.callbacks,e)&&t.callbacks[e].hide(i)},this.register=function(i,e){var n=dt();return t.callbacks[n]={show:i,hide:e},n},this.unregister=function(i){i&&t.callbacks[i]&&delete t.callbacks[i]},this.callbacks={},ft&&(window.addEventListener(re,this.handleShowEvent),window.addEventListener(ae,this.handleHideEvent))};const z=new ht;var mt=Object.assign||function(o){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var e in i)Object.prototype.hasOwnProperty.call(i,e)&&(o[e]=i[e])}return o},vt=function(){function o(t,i){for(var e=0;e<i.length;e++){var n=i[e];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(t,i,e){return i&&o(t.prototype,i),e&&o(t,e),t}}();function q(o,t,i){return t in o?Object.defineProperty(o,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):o[t]=i,o}function bt(o,t){if(!(o instanceof t))throw new TypeError("Cannot call a class as a function")}function ve(o,t){if(!o)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t&&(typeof t=="object"||typeof t=="function")?t:o}function gt(o,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof t);o.prototype=Object.create(t&&t.prototype,{constructor:{value:o,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(o,t):o.__proto__=t)}var V=function(o){gt(t,o);function t(){var i,e,n,r;bt(this,t);for(var a=arguments.length,s=Array(a),l=0;l<a;l++)s[l]=arguments[l];return r=(e=(n=ve(this,(i=t.__proto__||Object.getPrototypeOf(t)).call.apply(i,[this].concat(s))),n),n.handleClick=function(u){u.button!==0&&u.button!==1&&u.preventDefault(),!(n.props.disabled||n.props.divider)&&(E(n.props.onClick,u,O({},n.props.data,H.data),H.target),!n.props.preventClose&&P())},e),ve(n,r)}return vt(t,[{key:"render",value:function(){var e,n=this,r=this.props,a=r.attributes,s=r.children,l=r.className,u=r.disabled,d=r.divider,m=r.selected,h=M(l,T.menuItem,a.className,(e={},q(e,M(T.menuItemDisabled,a.disabledClassName),u),q(e,M(T.menuItemDivider,a.dividerClassName),d),q(e,M(T.menuItemSelected,a.selectedClassName),m),e));return C.createElement("div",mt({},a,{className:h,role:"menuitem",tabIndex:"-1","aria-disabled":u?"true":"false","aria-orientation":d?"horizontal":null,ref:function(y){n.ref=y},onMouseMove:this.props.onMouseMove,onMouseLeave:this.props.onMouseLeave,onTouchEnd:this.handleClick,onClick:this.handleClick}),d?null:s)}}]),t}(v.Component);V.propTypes={attributes:p.object,children:p.node,className:p.string,data:p.object,disabled:p.bool,divider:p.bool,onClick:p.func,onMouseLeave:p.func,onMouseMove:p.func,preventClose:p.bool,selected:p.bool};V.defaultProps={attributes:{},children:null,className:"",data:{},disabled:!1,divider:!1,onClick:function(){return null},onMouseMove:function(){return null},onMouseLeave:function(){return null},preventClose:!1,selected:!1};function yt(o,t){if(!(o instanceof t))throw new TypeError("Cannot call a class as a function")}function Tt(o,t){if(!o)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t&&(typeof t=="object"||typeof t=="function")?t:o}function Ct(o,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof t);o.prototype=Object.create(t&&t.prototype,{constructor:{value:o,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(o,t):o.__proto__=t)}var le=function(o){Ct(t,o);function t(i){yt(this,t);var e=Tt(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,i));return Mt.call(e),e.seletedItemRef=null,e.state={selectedItem:null,forceSubMenuOpen:!1},e}return t}(v.Component);le.propTypes={children:p.node.isRequired};var Mt=function(){var t=this;this.handleKeyNavigation=function(i){if(t.state.isVisible!==!1)switch(i.keyCode){case 37:case 27:i.preventDefault(),t.hideMenu(i);break;case 38:i.preventDefault(),t.selectChildren(!0);break;case 40:i.preventDefault(),t.selectChildren(!1);break;case 39:t.tryToOpenSubMenu(i);break;case 13:i.preventDefault(),t.tryToOpenSubMenu(i);{var e=t.seletedItemRef&&t.seletedItemRef.props&&t.seletedItemRef.props.disabled;t.seletedItemRef&&t.seletedItemRef.ref instanceof HTMLElement&&!e?t.seletedItemRef.ref.click():t.hideMenu(i)}break}},this.handleForceClose=function(){t.setState({forceSubMenuOpen:!1})},this.tryToOpenSubMenu=function(i){t.state.selectedItem&&t.state.selectedItem.type===t.getSubMenuType()&&(i.preventDefault(),t.setState({forceSubMenuOpen:!0}))},this.selectChildren=function(i){var e=t.state.selectedItem,n=[],r=0,a={},s=function m(h,b){h&&([V,t.getSubMenuType()].indexOf(h.type)<0?C.Children.forEach(h.props.children,m):h.props.divider||(h.props.disabled&&(++r,a[b]=!0),n.push(h)))};if(C.Children.forEach(t.props.children,s),r===n.length)return;function l(m){var h=m,b=function(){i?--h:++h,h<0?h=n.length-1:h>=n.length&&(h=0)};do b();while(h!==m&&a[h]);return h===m?null:h}var u=n.indexOf(e),d=l(u);d!==null&&t.setState({selectedItem:n[d],forceSubMenuOpen:!1})},this.onChildMouseMove=function(i){t.state.selectedItem!==i&&t.setState({selectedItem:i,forceSubMenuOpen:!1})},this.onChildMouseLeave=function(){t.setState({selectedItem:null,forceSubMenuOpen:!1})},this.renderChildren=function(i){return C.Children.map(i,function(e){var n={};return C.isValidElement(e)?[V,t.getSubMenuType()].indexOf(e.type)<0?(n.children=t.renderChildren(e.props.children),C.cloneElement(e,n)):(n.onMouseLeave=t.onChildMouseLeave.bind(t),e.type===t.getSubMenuType()&&(n.forceOpen=t.state.forceSubMenuOpen&&t.state.selectedItem===e,n.forceClose=t.handleForceClose,n.parentKeyNavigationHandler=t.handleKeyNavigation),!e.props.divider&&t.state.selectedItem===e?(n.selected=!0,n.ref=function(r){t.seletedItemRef=r},C.cloneElement(e,n)):(n.onMouseMove=function(){return t.onChildMouseMove(e)},C.cloneElement(e,n))):e})}},X=Object.assign||function(o){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var e in i)Object.prototype.hasOwnProperty.call(i,e)&&(o[e]=i[e])}return o},_t=function(){function o(t,i){for(var e=0;e<i.length;e++){var n=i[e];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(t,i,e){return i&&o(t.prototype,i),e&&o(t,e),t}}();function Y(o,t,i){return t in o?Object.defineProperty(o,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):o[t]=i,o}function Et(o,t){if(!(o instanceof t))throw new TypeError("Cannot call a class as a function")}function Ot(o,t){if(!o)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t&&(typeof t=="object"||typeof t=="function")?t:o}function wt(o,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof t);o.prototype=Object.create(t&&t.prototype,{constructor:{value:o,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(o,t):o.__proto__=t)}var ce=function(o){wt(t,o);function t(i){Et(this,t);var e=Ot(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,i));return e.getMenuPosition=function(){var n=window,r=n.innerWidth,a=n.innerHeight,s=e.subMenu.getBoundingClientRect(),l={};return s.bottom>a?l.bottom=0:l.top=0,s.right<r?l.left="100%":l.right="100%",l},e.getRTLMenuPosition=function(){var n=window,r=n.innerHeight,a=e.subMenu.getBoundingClientRect(),s={};return a.bottom>r?s.bottom=0:s.top=0,a.left<0?s.left="100%":s.right="100%",s},e.hideSubMenu=function(n){n.detail&&n.detail.id&&e.menu&&n.detail.id!==e.menu.id||(e.props.forceOpen&&e.props.forceClose(),e.setState({visible:!1,selectedItem:null}),e.unregisterHandlers())},e.handleClick=function(n){n.preventDefault(),!e.props.disabled&&(E(e.props.onClick,n,O({},e.props.data,H.data),H.target),!(!e.props.onClick||e.props.preventCloseOnClick)&&P())},e.handleMouseEnter=function(){e.closetimer&&clearTimeout(e.closetimer),!(e.props.disabled||e.state.visible)&&(e.opentimer=setTimeout(function(){return e.setState({visible:!0,selectedItem:null})},e.props.hoverDelay))},e.handleMouseLeave=function(){e.opentimer&&clearTimeout(e.opentimer),e.state.visible&&(e.closetimer=setTimeout(function(){return e.setState({visible:!1,selectedItem:null})},e.props.hoverDelay))},e.menuRef=function(n){e.menu=n},e.subMenuRef=function(n){e.subMenu=n},e.registerHandlers=function(){document.removeEventListener("keydown",e.props.parentKeyNavigationHandler),document.addEventListener("keydown",e.handleKeyNavigation)},e.unregisterHandlers=function(n){document.removeEventListener("keydown",e.handleKeyNavigation),n||document.addEventListener("keydown",e.props.parentKeyNavigationHandler)},e.state=O({},e.state,{visible:!1}),e}return _t(t,[{key:"componentDidMount",value:function(){this.listenId=z.register(function(){},this.hideSubMenu)}},{key:"getSubMenuType",value:function(){return t}},{key:"shouldComponentUpdate",value:function(e,n){return this.isVisibilityChange=(this.state.visible!==n.visible||this.props.forceOpen!==e.forceOpen)&&!(this.state.visible&&e.forceOpen)&&!(this.props.forceOpen&&n.visible),!0}},{key:"componentDidUpdate",value:function(){var e=this;if(this.isVisibilityChange)if(this.props.forceOpen||this.state.visible){var n=window.requestAnimationFrame||setTimeout;n(function(){var a=e.props.rtl?e.getRTLMenuPosition():e.getMenuPosition();e.subMenu.style.removeProperty("top"),e.subMenu.style.removeProperty("bottom"),e.subMenu.style.removeProperty("left"),e.subMenu.style.removeProperty("right"),R(a,"top")&&(e.subMenu.style.top=a.top),R(a,"left")&&(e.subMenu.style.left=a.left),R(a,"bottom")&&(e.subMenu.style.bottom=a.bottom),R(a,"right")&&(e.subMenu.style.right=a.right),e.subMenu.classList.add(T.menuVisible),e.registerHandlers(),e.setState({selectedItem:null})})}else{var r=function a(){e.subMenu.removeEventListener("transitionend",a),e.subMenu.style.removeProperty("bottom"),e.subMenu.style.removeProperty("right"),e.subMenu.style.top=0,e.subMenu.style.left="100%",e.unregisterHandlers()};this.subMenu.addEventListener("transitionend",r),this.subMenu.classList.remove(T.menuVisible)}}},{key:"componentWillUnmount",value:function(){this.listenId&&z.unregister(this.listenId),this.opentimer&&clearTimeout(this.opentimer),this.closetimer&&clearTimeout(this.closetimer),this.unregisterHandlers(!0)}},{key:"render",value:function(){var e,n=this.props,r=n.children,a=n.attributes,s=n.disabled,l=n.title,u=n.selected,d=this.state.visible,m={ref:this.menuRef,onMouseEnter:this.handleMouseEnter,onMouseLeave:this.handleMouseLeave,className:M(T.menuItem,T.subMenu,a.listClassName),style:{position:"relative"}},h={className:M(T.menuItem,a.className,(e={},Y(e,M(T.menuItemDisabled,a.disabledClassName),s),Y(e,M(T.menuItemActive,a.visibleClassName),d),Y(e,M(T.menuItemSelected,a.selectedClassName),u),e)),onMouseMove:this.props.onMouseMove,onMouseOut:this.props.onMouseOut,onClick:this.handleClick},b={ref:this.subMenuRef,style:{position:"absolute",transition:"opacity 1ms",top:0,left:"100%"},className:M(T.menu,this.props.className)};return C.createElement("nav",X({},m,{role:"menuitem",tabIndex:"-1","aria-haspopup":"true"}),C.createElement("div",X({},a,h),l),C.createElement("nav",X({},b,{role:"menu",tabIndex:"-1"}),this.renderChildren(r)))}}]),t}(le);ce.propTypes={children:p.node.isRequired,attributes:p.object,title:p.node.isRequired,className:p.string,disabled:p.bool,hoverDelay:p.number,rtl:p.bool,selected:p.bool,onMouseMove:p.func,onMouseOut:p.func,forceOpen:p.bool,forceClose:p.func,parentKeyNavigationHandler:p.func};ce.defaultProps={disabled:!1,hoverDelay:500,attributes:{},className:"",rtl:!1,selected:!1,onMouseMove:function(){return null},onMouseOut:function(){return null},forceOpen:!1,forceClose:function(){return null},parentKeyNavigationHandler:function(){return null}};var It=function(){function o(t,i){for(var e=0;e<i.length;e++){var n=i[e];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(t,i,e){return i&&o(t.prototype,i),e&&o(t,e),t}}();function St(o,t,i){return t in o?Object.defineProperty(o,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):o[t]=i,o}function xt(o,t){if(!(o instanceof t))throw new TypeError("Cannot call a class as a function")}function jt(o,t){if(!o)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t&&(typeof t=="object"||typeof t=="function")?t:o}function Nt(o,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof t);o.prototype=Object.create(t&&t.prototype,{constructor:{value:o,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(o,t):o.__proto__=t)}var ke=function(o){Nt(t,o);function t(i){xt(this,t);var e=jt(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,i));return e.registerHandlers=function(){document.addEventListener("mousedown",e.handleOutsideClick),document.addEventListener("touchstart",e.handleOutsideClick),e.props.preventHideOnScroll||document.addEventListener("scroll",e.handleHide),e.props.preventHideOnContextMenu||document.addEventListener("contextmenu",e.handleHide),document.addEventListener("keydown",e.handleKeyNavigation),e.props.preventHideOnResize||window.addEventListener("resize",e.handleHide)},e.unregisterHandlers=function(){document.removeEventListener("mousedown",e.handleOutsideClick),document.removeEventListener("touchstart",e.handleOutsideClick),document.removeEventListener("scroll",e.handleHide),document.removeEventListener("contextmenu",e.handleHide),document.removeEventListener("keydown",e.handleKeyNavigation),window.removeEventListener("resize",e.handleHide)},e.handleShow=function(n){if(!(n.detail.id!==e.props.id||e.state.isVisible)){var r=n.detail.position,a=r.x,s=r.y;e.setState({isVisible:!0,x:a,y:s}),e.registerHandlers(),E(e.props.onShow,n)}},e.handleHide=function(n){e.state.isVisible&&(!n.detail||!n.detail.id||n.detail.id===e.props.id)&&(e.unregisterHandlers(),e.setState({isVisible:!1,selectedItem:null,forceSubMenuOpen:!1}),E(e.props.onHide,n))},e.handleOutsideClick=function(n){e.menu.contains(n.target)||P()},e.handleMouseLeave=function(n){n.preventDefault(),E(e.props.onMouseLeave,n,O({},e.props.data,H.data),H.target),e.props.hideOnLeave&&P()},e.handleContextMenu=function(n){n.preventDefault(),e.handleHide(n)},e.hideMenu=function(n){(n.keyCode===27||n.keyCode===13)&&P()},e.getMenuPosition=function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a={top:r,left:n};if(!e.menu)return a;var s=window,l=s.innerWidth,u=s.innerHeight,d=e.menu.getBoundingClientRect();return r+d.height>u&&(a.top-=d.height),n+d.width>l&&(a.left-=d.width),a.top<0&&(a.top=d.height<u?(u-d.height)/2:0),a.left<0&&(a.left=d.width<l?(l-d.width)/2:0),a},e.getRTLMenuPosition=function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a={top:r,left:n};if(!e.menu)return a;var s=window,l=s.innerWidth,u=s.innerHeight,d=e.menu.getBoundingClientRect();return a.left=n-d.width,r+d.height>u&&(a.top-=d.height),a.left<0&&(a.left+=d.width),a.top<0&&(a.top=d.height<u?(u-d.height)/2:0),a.left+d.width>l&&(a.left=d.width<l?(l-d.width)/2:0),a},e.menuRef=function(n){e.menu=n},e.state=O({},e.state,{x:0,y:0,isVisible:!1}),e}return It(t,[{key:"getSubMenuType",value:function(){return ce}},{key:"componentDidMount",value:function(){this.listenId=z.register(this.handleShow,this.handleHide)}},{key:"componentDidUpdate",value:function(){var e=this,n=window.requestAnimationFrame||setTimeout;this.state.isVisible?n(function(){var r=e.state,a=r.x,s=r.y,l=e.props.rtl?e.getRTLMenuPosition(a,s):e.getMenuPosition(a,s),u=l.top,d=l.left;n(function(){e.menu&&(e.menu.style.top=u+"px",e.menu.style.left=d+"px",e.menu.style.opacity=1,e.menu.style.pointerEvents="auto")})}):n(function(){e.menu&&(e.menu.style.opacity=0,e.menu.style.pointerEvents="none")})}},{key:"componentWillUnmount",value:function(){this.listenId&&z.unregister(this.listenId),this.unregisterHandlers()}},{key:"render",value:function(){var e=this.props,n=e.children,r=e.className,a=e.style,s=this.state.isVisible,l=O({},a,{position:"fixed",opacity:0,pointerEvents:"none"}),u=M(T.menu,r,St({},T.menuVisible,s));return C.createElement("nav",{role:"menu",tabIndex:"-1",ref:this.menuRef,style:l,className:u,onContextMenu:this.handleContextMenu,onMouseLeave:this.handleMouseLeave},this.renderChildren(n))}}]),t}(le);ke.propTypes={id:p.string.isRequired,children:p.node.isRequired,data:p.object,className:p.string,hideOnLeave:p.bool,rtl:p.bool,onHide:p.func,onMouseLeave:p.func,onShow:p.func,preventHideOnContextMenu:p.bool,preventHideOnResize:p.bool,preventHideOnScroll:p.bool,style:p.object};ke.defaultProps={className:"",data:{},hideOnLeave:!1,rtl:!1,onHide:function(){return null},onMouseLeave:function(){return null},onShow:function(){return null},preventHideOnContextMenu:!1,preventHideOnResize:!1,preventHideOnScroll:!1,style:{}};var kt=function(){function o(t,i){for(var e=0;e<i.length;e++){var n=i[e];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(t,i,e){return i&&o(t.prototype,i),e&&o(t,e),t}}();function Ht(o,t){if(!(o instanceof t))throw new TypeError("Cannot call a class as a function")}function be(o,t){if(!o)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t&&(typeof t=="object"||typeof t=="function")?t:o}function Lt(o,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof t);o.prototype=Object.create(t&&t.prototype,{constructor:{value:o,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(o,t):o.__proto__=t)}var de=function(o){Lt(t,o);function t(){var i,e,n,r;Ht(this,t);for(var a=arguments.length,s=Array(a),l=0;l<a;l++)s[l]=arguments[l];return r=(e=(n=be(this,(i=t.__proto__||Object.getPrototypeOf(t)).call.apply(i,[this].concat(s))),n),n.touchHandled=!1,n.handleMouseDown=function(u){n.props.holdToDisplay>=0&&u.button===0&&(u.persist(),u.stopPropagation(),n.mouseDownTimeoutId=setTimeout(function(){return n.handleContextClick(u)},n.props.holdToDisplay)),E(n.props.attributes.onMouseDown,u)},n.handleMouseUp=function(u){u.button===0&&clearTimeout(n.mouseDownTimeoutId),E(n.props.attributes.onMouseUp,u)},n.handleMouseOut=function(u){u.button===0&&clearTimeout(n.mouseDownTimeoutId),E(n.props.attributes.onMouseOut,u)},n.handleTouchstart=function(u){n.touchHandled=!1,n.props.holdToDisplay>=0&&(u.persist(),u.stopPropagation(),n.touchstartTimeoutId=setTimeout(function(){n.handleContextClick(u),n.touchHandled=!0},n.props.holdToDisplay)),E(n.props.attributes.onTouchStart,u)},n.handleTouchEnd=function(u){n.touchHandled&&u.preventDefault(),clearTimeout(n.touchstartTimeoutId),E(n.props.attributes.onTouchEnd,u)},n.handleContextMenu=function(u){u.button===n.props.mouseButton&&n.handleContextClick(u),E(n.props.attributes.onContextMenu,u)},n.handleMouseClick=function(u){u.button===n.props.mouseButton&&n.handleContextClick(u),E(n.props.attributes.onClick,u)},n.handleContextClick=function(u){if(!n.props.disable&&!(n.props.disableIfShiftIsPressed&&u.shiftKey)){u.preventDefault(),u.stopPropagation();var d=u.clientX||u.touches&&u.touches[0].pageX,m=u.clientY||u.touches&&u.touches[0].pageY;n.props.posX&&(d-=n.props.posX),n.props.posY&&(m-=n.props.posY),P();var h=E(n.props.collect,n.props),b={position:{x:d,y:m},target:n.elem,id:n.props.id};h&&typeof h.then=="function"?h.then(function(y){b.data=O({},y,{target:u.target}),me(b)}):(b.data=O({},h,{target:u.target}),me(b))}},n.elemRef=function(u){n.elem=u},e),be(n,r)}return kt(t,[{key:"render",value:function(){var e=this.props,n=e.renderTag,r=e.attributes,a=e.children,s=O({},r,{className:M(T.menuWrapper,r.className),onContextMenu:this.handleContextMenu,onClick:this.handleMouseClick,onMouseDown:this.handleMouseDown,onMouseUp:this.handleMouseUp,onTouchStart:this.handleTouchstart,onTouchEnd:this.handleTouchEnd,onMouseOut:this.handleMouseOut,ref:this.elemRef});return C.createElement(n,s,a)}}]),t}(v.Component);de.propTypes={id:p.string.isRequired,children:p.node.isRequired,attributes:p.object,collect:p.func,disable:p.bool,holdToDisplay:p.number,posX:p.number,posY:p.number,renderTag:p.elementType,mouseButton:p.number,disableIfShiftIsPressed:p.bool};de.defaultProps={attributes:{},collect:function(){return null},disable:!1,holdToDisplay:1e3,renderTag:"div",posX:0,posY:0,mouseButton:2,disableIfShiftIsPressed:!1};function Rt(o){if(Array.isArray(o)){for(var t=0,i=Array(o.length);t<o.length;t++)i[t]=o[t];return i}else return Array.from(o)}[].concat(Rt(Object.keys(de.propTypes)),["children"]);p.array.isRequired,p.string.isRequired;Ie();Ie();const N={INSERTRIGHT:"INSERTRIGHT",INSERTLEFT:"INSERTLEFT",GROUPCREATE:"GROUPCREATE",GROUPDELETE:"GROUPDELETE",DELETE:"DELETE",CREATE:"CREATE",FORTMATNUMBER:"FORTMATNUMBER",FORTMATTEXT:"FORTMATTEXT"},Pt=[{name:"Chèn cột bên phải",action:N.INSERTRIGHT,type:"Insert",disabled:!1},{name:"Chèn cột bên trái",action:N.INSERTLEFT,type:"Insert",disabled:!1},{name:"Tạo cột nhóm",action:N.GROUPCREATE,type:"Create",disabled:!1},{name:"Định dạng số",action:N.FORTMATNUMBER,type:"Number",disabled:!1},{name:"Định dạng văn bản",action:N.FORTMATTEXT,type:"Text",disabled:!1},{name:"Bỏ cột nhóm",action:N.GROUPDELETE,type:"Delete",disabled:!1},{name:"Xóa cột",action:N.DELETE,type:"Delete",disabled:!1}],L={INSERTTOP:"INSERTTOP",INSERTBOTTOM:"INSERTBOTTOM",INSERTCHILD:"INSERTCHILD",DELETE:"DELETE",CREATE:"CREATE",ALLOW:"ALLOW",COPY:"COPY",PAST:"PAST",MERGE:"MERGE"},Dt=[{name:"Tạo hàng con",action:L.INSERTCHILD,type:"Insert"},{name:"Chèn hàng phía trên",action:L.INSERTTOP,type:"Insert"},{name:"Chèn hàng phía dưới",action:L.INSERTBOTTOM,type:"Insert"},{name:"Cho phép thao tác",action:L.ALLOW,type:"Insert"},{name:"Hợp nhất ô",action:L.MERGE,type:"Merge"},{name:"Xóa hàng",action:L.DELETE,type:"Delete"}];v.createContext();new rt({});it(o=>({root:{width:"100%","& > * + *":{marginTop:o.spacing(2)}}}));var se=globalThis&&globalThis.__assign||function(){return se=Object.assign||function(o){for(var t,i=1,e=arguments.length;i<e;i++){t=arguments[i];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(o[n]=t[n])}return o},se.apply(this,arguments)},He={onActivate:c.func,onAddUndo:c.func,onBeforeAddUndo:c.func,onBeforeExecCommand:c.func,onBeforeGetContent:c.func,onBeforeRenderUI:c.func,onBeforeSetContent:c.func,onBeforePaste:c.func,onBlur:c.func,onChange:c.func,onClearUndos:c.func,onClick:c.func,onContextMenu:c.func,onCopy:c.func,onCut:c.func,onDblclick:c.func,onDeactivate:c.func,onDirty:c.func,onDrag:c.func,onDragDrop:c.func,onDragEnd:c.func,onDragGesture:c.func,onDragOver:c.func,onDrop:c.func,onExecCommand:c.func,onFocus:c.func,onFocusIn:c.func,onFocusOut:c.func,onGetContent:c.func,onHide:c.func,onInit:c.func,onKeyDown:c.func,onKeyPress:c.func,onKeyUp:c.func,onLoadContent:c.func,onMouseDown:c.func,onMouseEnter:c.func,onMouseLeave:c.func,onMouseMove:c.func,onMouseOut:c.func,onMouseOver:c.func,onMouseUp:c.func,onNodeChange:c.func,onObjectResizeStart:c.func,onObjectResized:c.func,onObjectSelected:c.func,onPaste:c.func,onPostProcess:c.func,onPostRender:c.func,onPreProcess:c.func,onProgressState:c.func,onRedo:c.func,onRemove:c.func,onReset:c.func,onSaveContent:c.func,onSelectionChange:c.func,onSetAttrib:c.func,onSetContent:c.func,onShow:c.func,onSubmit:c.func,onUndo:c.func,onVisualAid:c.func},Bt=se({apiKey:c.string,id:c.string,inline:c.bool,init:c.object,initialValue:c.string,onEditorChange:c.func,outputFormat:c.oneOf(["html","text"]),value:c.string,tagName:c.string,cloudChannel:c.string,plugins:c.oneOfType([c.string,c.array]),toolbar:c.oneOfType([c.string,c.array]),disabled:c.bool,textareaName:c.string,tinymceScriptSrc:c.string,rollback:c.oneOfType([c.number,c.oneOf([!1])]),scriptLoading:c.shape({async:c.bool,defer:c.bool,delay:c.number})},He),J=function(o){return typeof o=="function"},ge=function(o){return o in He},ye=function(o){return o.substr(2)},At=function(o,t,i,e,n,r,a){var s=Object.keys(n).filter(ge),l=Object.keys(r).filter(ge),u=s.filter(function(m){return r[m]===void 0}),d=l.filter(function(m){return n[m]===void 0});u.forEach(function(m){var h=ye(m),b=a[h];i(h,b),delete a[h]}),d.forEach(function(m){var h=e(o,m),b=ye(m);a[b]=h,t(b,h)})},Ft=function(o,t,i,e,n){return At(n,o.on.bind(o),o.off.bind(o),function(r,a){return function(s){var l;return(l=r(a))===null||l===void 0?void 0:l(s,o)}},t,i,e)},Te=0,Le=function(o){var t=Date.now(),i=Math.floor(Math.random()*1e9);return Te++,o+"_"+i+Te+String(t)},Ce=function(o){return o!==null&&(o.tagName.toLowerCase()==="textarea"||o.tagName.toLowerCase()==="input")},Me=function(o){return typeof o>"u"||o===""?[]:Array.isArray(o)?o:o.split(" ")},$t=function(o,t){return Me(o).concat(Me(t))},Gt=function(){return window.InputEvent&&typeof InputEvent.prototype.getTargetRanges=="function"},Ut=function(o){if(!("isConnected"in Node.prototype)){for(var t=o,i=o.parentNode;i!=null;)t=i,i=t.parentNode;return t===o.ownerDocument}return o.isConnected},_e=function(o,t){o!==void 0&&(o.mode!=null&&typeof o.mode=="object"&&typeof o.mode.set=="function"?o.mode.set(t):o.setMode(t))},Ee=function(){return{listeners:[],scriptId:Le("tiny-script"),scriptLoading:!1,scriptLoaded:!1}},Kt=function(){var o=Ee(),t=function(n,r,a,s,l,u){var d=r.createElement("script");d.referrerPolicy="origin",d.type="application/javascript",d.id=n,d.src=a,d.async=s,d.defer=l;var m=function(){d.removeEventListener("load",m),u()};d.addEventListener("load",m),r.head&&r.head.appendChild(d)},i=function(n,r,a,s,l,u){var d=function(){return t(o.scriptId,n,r,a,s,function(){o.listeners.forEach(function(m){return m()}),o.scriptLoaded=!0})};o.scriptLoaded?u():(o.listeners.push(u),o.scriptLoading||(o.scriptLoading=!0,l>0?setTimeout(d,l):d()))},e=function(){o=Ee()};return{load:i,reinitialize:e}},zt=Kt(),Vt=function(){return typeof window<"u"?window:global},ue=function(){var o=Vt();return o&&o.tinymce?o.tinymce:null},Wt=globalThis&&globalThis.__extends||function(){var o=function(t,i){return o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])},o(t,i)};return function(t,i){if(typeof i!="function"&&i!==null)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");o(t,i);function e(){this.constructor=t}t.prototype=i===null?Object.create(i):(e.prototype=i.prototype,new e)}}(),W=globalThis&&globalThis.__assign||function(){return W=Object.assign||function(o){for(var t,i=1,e=arguments.length;i<e;i++){t=arguments[i];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(o[n]=t[n])}return o},W.apply(this,arguments)},Z=function(){var o,t,i;return!((i=(t=(o=ue())===null||o===void 0?void 0:o.Env)===null||t===void 0?void 0:t.browser)===null||i===void 0)&&i.isIE()?"change keyup compositionend setcontent":"change input compositionend setcontent"},Q=function(){return Gt()?"beforeinput SelectionChange":"SelectionChange"},qt=function(o){Wt(t,o);function t(i){var e=this,n,r,a;return e=o.call(this,i)||this,e.rollbackTimer=void 0,e.valueCursor=void 0,e.rollbackChange=function(){var s=e.editor,l=e.props.value;s&&l&&l!==e.currentContent&&s.undoManager.ignore(function(){if(s.setContent(l),e.valueCursor&&(!e.inline||s.hasFocus()))try{s.selection.moveToBookmark(e.valueCursor)}catch{}}),e.rollbackTimer=void 0},e.handleBeforeInput=function(s){if(e.props.value!==void 0&&e.props.value===e.currentContent&&e.editor&&(!e.inline||e.editor.hasFocus))try{e.valueCursor=e.editor.selection.getBookmark(3)}catch{}},e.handleBeforeInputSpecial=function(s){(s.key==="Enter"||s.key==="Backspace"||s.key==="Delete")&&e.handleBeforeInput(s)},e.handleEditorChange=function(s){var l=e.editor;if(l&&l.initialized){var u=l.getContent();if(e.props.value!==void 0&&e.props.value!==u&&e.props.rollback!==!1&&(e.rollbackTimer||(e.rollbackTimer=window.setTimeout(e.rollbackChange,typeof e.props.rollback=="number"?e.props.rollback:200))),u!==e.currentContent&&(e.currentContent=u,J(e.props.onEditorChange))){var d=e.props.outputFormat,m=d==="html"?u:l.getContent({format:d});e.props.onEditorChange(m,l)}}},e.handleEditorChangeSpecial=function(s){(s.key==="Backspace"||s.key==="Delete")&&e.handleEditorChange(s)},e.initialise=function(s){var l,u,d;s===void 0&&(s=0);var m=e.elementRef.current;if(m){if(!Ut(m)){if(s===0)setTimeout(function(){return e.initialise(1)},1);else if(s<100)setTimeout(function(){return e.initialise(s+1)},100);else throw new Error("tinymce can only be initialised when in a document");return}var h=ue();if(!h)throw new Error("tinymce should have been loaded into global scope");var b=W(W({},e.props.init),{selector:void 0,target:m,readonly:e.props.disabled,inline:e.inline,plugins:$t((l=e.props.init)===null||l===void 0?void 0:l.plugins,e.props.plugins),toolbar:(u=e.props.toolbar)!==null&&u!==void 0?u:(d=e.props.init)===null||d===void 0?void 0:d.toolbar,setup:function(y){e.editor=y,e.bindHandlers({}),e.inline&&!Ce(m)&&y.once("PostRender",function(I){y.setContent(e.getInitialValue(),{no_events:!0})}),e.props.init&&J(e.props.init.setup)&&e.props.init.setup(y)},init_instance_callback:function(y){var I,S,x=e.getInitialValue();e.currentContent=(I=e.currentContent)!==null&&I!==void 0?I:y.getContent(),e.currentContent!==x&&(e.currentContent=x,y.setContent(x),y.undoManager.clear(),y.undoManager.add(),y.setDirty(!1));var D=(S=e.props.disabled)!==null&&S!==void 0?S:!1;_e(e.editor,D?"readonly":"design"),e.props.init&&J(e.props.init.init_instance_callback)&&e.props.init.init_instance_callback(y)}});e.inline||(m.style.visibility=""),Ce(m)&&(m.value=e.getInitialValue()),h.init(b)}},e.id=e.props.id||Le("tiny-react"),e.elementRef=v.createRef(),e.inline=(a=(n=e.props.inline)!==null&&n!==void 0?n:(r=e.props.init)===null||r===void 0?void 0:r.inline)!==null&&a!==void 0?a:!1,e.boundHandlers={},e}return t.prototype.componentDidUpdate=function(i){var e=this,n,r;if(this.rollbackTimer&&(clearTimeout(this.rollbackTimer),this.rollbackTimer=void 0),this.editor&&(this.bindHandlers(i),this.editor.initialized)){if(this.currentContent=(n=this.currentContent)!==null&&n!==void 0?n:this.editor.getContent(),typeof this.props.initialValue=="string"&&this.props.initialValue!==i.initialValue)this.editor.setContent(this.props.initialValue),this.editor.undoManager.clear(),this.editor.undoManager.add(),this.editor.setDirty(!1);else if(typeof this.props.value=="string"&&this.props.value!==this.currentContent){var a=this.editor;a.undoManager.transact(function(){var l;if(!e.inline||a.hasFocus())try{l=a.selection.getBookmark(3)}catch{}var u=e.valueCursor;if(a.setContent(e.props.value),!e.inline||a.hasFocus())for(var d=0,m=[l,u];d<m.length;d++){var h=m[d];if(h)try{a.selection.moveToBookmark(h),e.valueCursor=h;break}catch{}}})}if(this.props.disabled!==i.disabled){var s=(r=this.props.disabled)!==null&&r!==void 0?r:!1;_e(this.editor,s?"readonly":"design")}}},t.prototype.componentDidMount=function(){var i,e,n,r,a,s;ue()!==null?this.initialise():this.elementRef.current&&this.elementRef.current.ownerDocument&&zt.load(this.elementRef.current.ownerDocument,this.getScriptSrc(),(e=(i=this.props.scriptLoading)===null||i===void 0?void 0:i.async)!==null&&e!==void 0?e:!1,(r=(n=this.props.scriptLoading)===null||n===void 0?void 0:n.defer)!==null&&r!==void 0?r:!1,(s=(a=this.props.scriptLoading)===null||a===void 0?void 0:a.delay)!==null&&s!==void 0?s:0,this.initialise)},t.prototype.componentWillUnmount=function(){var i=this,e=this.editor;e&&(e.off(Z(),this.handleEditorChange),e.off(Q(),this.handleBeforeInput),e.off("keypress",this.handleEditorChangeSpecial),e.off("keydown",this.handleBeforeInputSpecial),e.off("NewBlock",this.handleEditorChange),Object.keys(this.boundHandlers).forEach(function(n){e.off(n,i.boundHandlers[n])}),this.boundHandlers={},e.remove(),this.editor=void 0)},t.prototype.render=function(){return this.inline?this.renderInline():this.renderIframe()},t.prototype.renderInline=function(){var i=this.props.tagName,e=i===void 0?"div":i;return v.createElement(e,{ref:this.elementRef,id:this.id})},t.prototype.renderIframe=function(){return v.createElement("textarea",{ref:this.elementRef,style:{visibility:"hidden"},name:this.props.textareaName,id:this.id})},t.prototype.getScriptSrc=function(){if(typeof this.props.tinymceScriptSrc=="string")return this.props.tinymceScriptSrc;var i=this.props.cloudChannel,e=this.props.apiKey?this.props.apiKey:"no-api-key";return"https://cdn.tiny.cloud/1/".concat(e,"/tinymce/").concat(i,"/tinymce.min.js")},t.prototype.getInitialValue=function(){return typeof this.props.initialValue=="string"?this.props.initialValue:typeof this.props.value=="string"?this.props.value:""},t.prototype.bindHandlers=function(i){var e=this;if(this.editor!==void 0){Ft(this.editor,i,this.props,this.boundHandlers,function(s){return e.props[s]});var n=function(s){return s.onEditorChange!==void 0||s.value!==void 0},r=n(i),a=n(this.props);!r&&a?(this.editor.on(Z(),this.handleEditorChange),this.editor.on(Q(),this.handleBeforeInput),this.editor.on("keydown",this.handleBeforeInputSpecial),this.editor.on("keyup",this.handleEditorChangeSpecial),this.editor.on("NewBlock",this.handleEditorChange)):r&&!a&&(this.editor.off(Z(),this.handleEditorChange),this.editor.off(Q(),this.handleBeforeInput),this.editor.off("keydown",this.handleBeforeInputSpecial),this.editor.off("keyup",this.handleEditorChangeSpecial),this.editor.off("NewBlock",this.handleEditorChange))}},t.propTypes=Bt,t.defaultProps={cloudChannel:"5"},t}(v.Component);function Xt({initialValue:o,value:t,disabled:i,handleChange:e,handleSave:n,titleButton:r,height:a},s){const l=v.useRef(null);v.useEffect(()=>{i===!0&&(l.current.innerHTML=o)},[i,o]);const u=v.useCallback((h,b)=>{e&&e(h)},[e]),d=v.useCallback(h=>{n&&n(h)},[n]),m=v.useCallback(()=>`savedata | undo redo | formatselect | bold italic | contenteditable | alignleft aligncenter alignright alignjustify | table tableinsertdialog tablecellprops tableprops | fullscreen | removeformat | code`,[]);return v.useImperativeHandle(s,()=>l.current),f.jsx(f.Fragment,{children:i?f.jsx("div",{className:"editor-view",ref:l}):f.jsx(qt,{initialValue:o,value:t,init:{height:a||250,menubar:!1,plugins:"table code lists fullscreen",toolbar:m(),setup:h=>{h.ui.registry.addButton("contenteditable",{text:"",icon:"highlight-bg-color",onAction:b=>{h.insertContent(' <span contenteditable="true" style="display: inline-block; border-bottom: 2px dotted #c8ced3; min-width: 50px"></span> ')}}),h.ui.registry.addButton("savedata",{text:r||"Lưu",icon:"notice",onAction:b=>d(h.getContent({format:"html"}))})},forced_root_block:"div",entity_encoding:"numeric",font_formats:"Times New Roman"},tinymceScriptSrc:"https://cdnjs.cloudflare.com/ajax/libs/tinymce/5.6.2/tinymce.min.js",scriptLoading:{async:!0},onEditorChange:u,disabled:i})})}v.forwardRef(Xt);const Yt=o=>{const[t,i]=v.useState(0),e=n=>{t!==n&&i(n)};return f.jsx("div",{className:"win10-container",children:f.jsxs(Se,{children:[f.jsx(K,{md:"12",children:f.jsx(ze,{tabs:!0,children:o.data&&o.data.map((n,r)=>{let a=n.MaChucNang;const s=Be.filter(l=>l.ma_chuc_nang===a);return a?s[0]&&s[0].access&&f.jsx(fe,{children:f.jsx(pe,{className:M({active:t===r}),onClick:()=>{e(r),o.onChangeTab&&o.onChangeTab(r)},children:n.TabName})},r):f.jsx(fe,{children:f.jsx(pe,{className:M({active:t===r}),onClick:()=>{e(r),o.onChangeTab&&o.onChangeTab(r)},children:n.TabName})},r)})})}),f.jsx(K,{md:"12",children:f.jsx(Fe,{activeTab:t,style:{border:"none"},children:o.data&&o.data.map((n,r)=>f.jsx($e,{tabId:r,children:t===r&&n.TabContent},r))})})]})})};function Jt({MaBaoCao:o}){const[t,i]=v.useState(!0),[e,n]=v.useState(null),r=v.useCallback(()=>{w("HeaderFooter/Variable","GET",null,{odata:!1}).then(a=>{n(a)})},[]);return v.useEffect(()=>{r()},[r]),f.jsx(C.Fragment,{children:f.jsxs(G,{children:[f.jsx(ne,{onClick:()=>i(!t),children:"Model"}),f.jsx(U,{className:"p-0",children:f.jsx(We,{isOpen:t,children:f.jsx(xe,{children:e&&e.map((a,s)=>f.jsxs(je,{className:"p-0",children:[f.jsx("b",{children:a.Kieu})," : ",a.Mota]}))})})})]})})}function ee(o){const{type:t,Id:i,IdMauBaoCao2:e}=o,[n,r]=v.useState({}),a=v.useCallback(()=>{i&&w(`DM_MauBaoCao(guid'${i}')`,"GET",null).then(l=>{r(l)}),e&&w(`DM_MauBaoCao_HTML('${e}')`,"GET",null).then(l=>{r(l)})},[i,e]);v.useEffect(()=>{e&&a()},[e,a]),v.useEffect(()=>{i&&a()},[i,a]);const s=v.useCallback(()=>{let l={Id:i,IdMauBaoCao2:e,[t]:n[t]},u={[t]:n[t]};i&&w(`DM_MauBaoCao(guid'${l.Id}')`,"PATCH",JSON.stringify(l)).then(d=>{F("Cập nhật thành công","THÔNG BÁO")}).catch(d=>$("Cập nhật không thành công","Thông báo")),e&&w(`DM_MauBaoCao_HTML('${l.IdMauBaoCao2}')`,"PATCH",JSON.stringify(u)).then(d=>{F("Cập nhật thành công","THÔNG BÁO")}).catch(d=>$("Cập nhật không thành công","Thông báo"))},[i,e,n,t]);return f.jsx("div",{children:f.jsxs("div",{className:"edit-mau-in",children:[f.jsx(te,{className:"me-2 btn btn-success btn-sm",onClick:s,children:"Cập nhật"}),f.jsx(te,{className:"btnXemTruoc btn-sm",color:"primary",children:"Xem trước"}),f.jsxs(Se,{children:[f.jsx(K,{md:"9",children:f.jsx(Ve,{style:{height:"100%",color:"black"},value:n[t],onChange:l=>r({...n,[t]:l.target.value})})}),f.jsxs(K,{md:"3",children:[f.jsx(Jt,{data:n}),f.jsx("div",{children:"<!DOCTYPE html>"}),f.jsx("div",{children:"<html>"}),f.jsx("div",{children:"<head>"}),f.jsx("div",{children:'<meta charset="UTF-8"/>'}),f.jsx("div",{children:"</head>"}),f.jsx("div",{children:"<body>"}),f.jsx("div",{children:""}),f.jsx("div",{children:"</body>"}),f.jsx("div",{children:"</html>"})]})]})]})})}var k={MaMauBaoCao:{field_name:"MaMauBaoCao",title:"Mã mẫu báo cáo:",type:"textbox"},CodeMauTongHop:{field_name:"CodeMauTongHop",title:"Code Mẫu tổng hợp:",type:"textbox"},IsLandscape:{field_name:"IsLandscape",title:"Chiều ngang:",type:"checkbox"},KhoGiay_Id:{field_name:"KhoGiay_Id",title:"Khổ giấy",type:"data-select",required:!0,dataSelect:{url:"DM_KhoGiay",column:["Id","Name"],value_field:"Id",text_field:"Name"}},FontSize:{field_name:"FontSize",title:"Cỡ chữ:",type:"numeric"},HieuLuc_TuNam:{field_name:"HieuLuc_TuNam",title:"Hiệu lực từ năm:",type:"date"},HieuLuc_DenNam:{field_name:"HieuLuc_DenNam",title:"Hiệu lực đến năm:",type:"date"}};const Zt=o=>{const{Id:t,reloadList:i,Id_HTML:e,IdMauBaoCao2:n}=o,[r,a]=v.useState(!0),[s,l]=v.useState(null),[u,d]=v.useState(null),[m,h]=v.useState(null),[b,y]=v.useState(null),[I,S]=v.useState(null),[x,D]=v.useState(null),Re=()=>{var g={Id:t,IdMauBaoCao2:n,IsLandscape:r,KhoGiay_Id:s,FontSize:b,HieuLuc_TuNam:I,HieuLuc_DenNam:x,MauTongHop_Code:m},_={IsLandscape:r,KhoGiay_Id:s,FontSize:b,HieuLuc_TuNam:I,HieuLuc_DenNam:x,MauTongHop_Code:m};t&&w(`DM_MauBaoCao(guid'${g.Id}')`,"PATCH",JSON.stringify(g)).then(B=>F("Cập nhật thành công","THÔNG BÁO").then(()=>{i&&i()})).catch(B=>$(B,"THÔNG BÁO")),n&&w(`DM_MauBaoCao_HTML('${g.IdMauBaoCao2}')`,"PATCH",JSON.stringify(_)).then(B=>F("Cập nhật thành công","THÔNG BÁO").then(()=>{i&&i()})).catch(B=>$(B,"THÔNG BÁO"))},A=v.useCallback(()=>{t&&w(`DM_MauBaoCao(guid'${t}')`,"GET",null).then(g=>{a(g.IsLandscape),l(g.KhoGiay_Id),d(g.MaMauBaoCao),h(g.MauTongHop_Code),y(g.FontSize),S(g.HieuLuc_TuNam),D(g.HieuLuc_DenNam)}),n&&w(`DM_MauBaoCao_HTML(${n})`,"GET",null).then(g=>{a(g.IsLandscape),l(g.KhoGiay_Id),d(g.MaMauBaoCao),h(g.MauTongHop_Code),y(g.FontSize),S(g.HieuLuc_TuNam),D(g.HieuLuc_DenNam)})},[t,n]);return v.useEffect(()=>{n&&A()},[n,e,A]),v.useEffect(()=>{t&&A()},[t,A]),f.jsxs("div",{className:"edit-mau-in",children:[f.jsx(te,{className:"me-2 btn btn-success btn-sm",onClick:Re,children:"Cập nhật"}),f.jsxs("div",{className:"edit-thiet-lap-khac",children:[f.jsxs(G,{className:"mb-3",children:[f.jsx(ne,{children:f.jsx("b",{children:"Thiết lập khổ giấy"})}),f.jsxs(U,{children:[f.jsx(j,{data:k.IsLandscape,value:r,onChange:(g,_)=>a(_)}),f.jsx(j,{data:k.KhoGiay_Id,value:s,onChange:(g,_)=>l(_)}),f.jsx(j,{data:k.MaMauBaoCao,value:u,onChange:(g,_)=>d(_)}),f.jsx(j,{data:k.CodeMauTongHop,value:m,onChange:(g,_)=>h(_)}),f.jsx(j,{data:k.FontSize,value:b,onChange:(g,_)=>y(_)})]})]}),f.jsxs(G,{className:"mb-3",children:[f.jsx(ne,{children:f.jsx("b",{children:"Thiết lập hiệu lực"})}),f.jsxs(U,{children:[f.jsx(j,{data:k.HieuLuc_TuNam,value:I,onChange:(g,_)=>S(_)}),f.jsx(j,{data:k.HieuLuc_DenNam,value:x,onChange:(g,_)=>D(_)})]})]})]})]})};function Qt({IdMauBaoCao2:o,open:t,onClose:i,IdMauBaoCao:e,title:n,IdBaoCao:r,afterCreate:a,MauBaoCao_ID:s}){return f.jsx(G,{children:f.jsx(U,{children:f.jsx(Yt,{data:[{TabName:"Header",TabContent:f.jsx(ee,{Id:e,IdMauBaoCao2:o,Id_HTML:s,type:"Header"})},{TabName:"Body",TabContent:f.jsx(ee,{Id:e,IdMauBaoCao2:o,Id_HTML:s,type:"Body"})},{TabName:"Footer",TabContent:f.jsx(ee,{Id:e,IdMauBaoCao2:o,Id_HTML:s,type:"Footer"})},{TabName:"Thiết lập khác",TabContent:f.jsx(Zt,{Id:e,Id_HTML:s,IdMauBaoCao2:o})}]})})})}function yn({open:o,onClose:t,IdMauBaoCao:i,title:e,MauBaoCao_ID:n,reportTemplate:r,IdMauBaoCao2:a}){return f.jsx(Ae,{open:o,title:e,onClose:t,toggle:t,size:"xl",className:"dialog-mau-in",children:f.jsx(Ge,{data:[{TabName:"Cấu hình mẫu kiểu 1 ",TabContent:f.jsx(Qt,{IdMauBaoCao2:a,IdMauBaoCao:i,Id_HTML:n})}]})})}export{yn as E};