UNPKG

@chentt/vuereact-combined

Version:

Vue和React快捷集成的工具包,并且适合复杂的集成场景

2 lines (1 loc) 37.3 kB
((t,e)=>{"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("react"),require("vue"),require("react-dom")):"function"==typeof define&&define.amd?define(["exports","react","vue","react-dom"],e):e((t=t||self).vuereact={},t.React,t.Vue,t.ReactDOM)})(this,function(t,n,d,k){var j="default"in n?n.default:n,T=(d=d&&d.hasOwnProperty("default")?d.default:d,"default"in k?k.default:k);function r(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function i(t,e,n){e=s(e);var r=t,e=a()?Reflect.construct(e,n||[],s(t).constructor):e.apply(t,n);if(!e||"object"!=typeof e&&"function"!=typeof e){if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");if(void 0===(e=r))throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return e}function c(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,v(r.key),r)}}function u(t,e,n){return e&&o(t.prototype,e),n&&o(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function l(t,e,n){return(e=v(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function A(){return(A=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n,r=arguments[e];for(n in r)!{}.hasOwnProperty.call(r,n)||(t[n]=r[n])}return t}).apply(null,arguments)}function s(t){return(s=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function p(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&D(t,e)}function a(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(a=function(){return!!t})()}function f(e,t){var n,r=Object.keys(e);return Object.getOwnPropertySymbols&&(n=Object.getOwnPropertySymbols(e),t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)),r}function W(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?f(Object(n),!0).forEach(function(t){l(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):f(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function V(t,e){if(null==t)return{};var n,r=((t,e)=>{if(null==t)return{};var n,r={};for(n in t)if({}.hasOwnProperty.call(t,n)){if(-1!==e.indexOf(n))continue;r[n]=t[n]}return r})(t,e);if(Object.getOwnPropertySymbols)for(var o=Object.getOwnPropertySymbols(t),s=0;s<o.length;s++)n=o[s],-1===e.indexOf(n)&&{}.propertyIsEnumerable.call(t,n)&&(r[n]=t[n]);return r}function D(t,e){return(D=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function y(t){return(t=>{if(Array.isArray(t))return r(t)})(t)||(t=>{if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)})(t)||((t,e)=>{var n;if(t)return"string"==typeof t?r(t,e):"Map"===(n="Object"===(n={}.toString.call(t).slice(8,-1))&&t.constructor?t.constructor.name:n)||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(t,e):void 0})(t)||(()=>{throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")})()}function v(t){t=((t,e)=>{if("object"!=typeof t||!t)return t;var n=t[Symbol.toPrimitive];if(void 0===n)return("string"===e?String:Number)(t);if("object"!=typeof(n=n.call(t,e||"default")))return n;throw new TypeError("@@toPrimitive must return a primitive value.")})(t,"string");return"symbol"==typeof t?t:t+""}function g(t){return(g="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var N={react:{componentWrap:"div",slotWrap:"div",componentWrapAttrs:{__use_react_component_wrap:"",style:{all:"unset"}},slotWrapAttrs:{__use_react_slot_wrap:"",style:{all:"unset"}}},vue:{componentWrapHOC:function(e){var n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:[];return function(){var t=(0<arguments.length&&void 0!==arguments[0]?arguments[0]:{}).portals,t=void 0===t?[]:t;return j.createElement("div",n,e,t.map(function(t){var e=t.Portal;return j.createElement(e,{key:t.key})}))}},componentWrapAttrs:{"data-use-vue-component-wrap":"",style:{all:"unset"}},slotWrapAttrs:{"data-use-vue-slot-wrap":"",style:{all:"unset"}}}};function M(t,e,n){t=0<arguments.length&&void 0!==t?t:{react:{},vue:{}},e=1<arguments.length&&void 0!==e?e:N,n=2<arguments.length?n:void 0,t.vue||(t.vue={}),t.react||(t.react={}),e=[e,W({},t,{react:W({},e.react,{},t.react,{componentWrapAttrs:W({},e.react.componentWrapAttrs,{},t.react.componentWrapAttrs),slotWrapAttrs:W({},e.react.slotWrapAttrs,{},t.react.slotWrapAttrs)}),vue:W({},e.vue,{},t.vue,{componentWrapAttrs:W({},e.vue.componentWrapAttrs,{},t.vue.componentWrapAttrs),slotWrapAttrs:W({},e.vue.slotWrapAttrs,{},t.vue.slotWrapAttrs)})})];return n&&e.unshift({}),Object.assign.apply(this,e)}var S={},L=["ref"],e=["style"],U=["key","data-passed-props"],F=["data-passed-props","hashList"],B=["style"],z=["on","$slots","$scopedSlots","children"],q=Number.parseInt(n.version),K=["getElementById","getElementsByClassName","getElementsByTagName","getElementsByTagNameNS","querySelector","querySelectorAll"],h={Document:{},Element:{}};function H(i){Object.keys(h).forEach(function(t){K.forEach(function(s){var a=h[t][s]||window[t].prototype[s];a&&(h[t][s]=a,window[t].prototype[s]=function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];var r=a.apply(this,e),o=e;return r&&(r.constructor!==NodeList||r.constructor===NodeList&&0<r.length)?r:("getElementById"===(r=s)&&(r="querySelector",o=["#".concat(e[0])]),(h.Element[r]||Element.prototype[r]).apply(i,o))})})})}function Y(){Object.keys(h).forEach(function(e){K.forEach(function(t){window[e].prototype[t]=h[e][t]})})}var G=(()=>{function t(){return c(this,t),i(this,t,arguments)}return p(t,j.Component),u(t,[{key:"render",value:function(){var t=this.props.component,e=this.props.passedProps,e=(e.ref,V(e,L));return j.createElement(t,e,this.props.children)}}])})(),J=function(h,d,m){var t=(()=>{function f(t){var e;return c(this,f),(e=i(this,f,[t])).state=W({},t,{},d.isSlots?{children:h}:{}),e.setRef=e.setRef.bind(e),e.vueInReactCall=e.vueInReactCall.bind(e),e.vueWrapperRef=m,e}return p(f,j.Component),u(f,[{key:"setRef",value:function(e){e&&(m.reactRef=e,Object.keys(e).forEach(function(t){m[t]||(m[t]=e[t])}),Promise.resolve().then(function(){Object.keys(e).forEach(function(t){m[t]||(m[t]=e[t])})}),(this.setRef.current=e).vueWrapperRef=m)}},{key:"createSlot",value:function(r){var t=d.react.slotWrapAttrs,o=t.style,s=V(t,e);return{inheritAttrs:!1,__fromReactSlot:!0,render:function(t){var e,n=r instanceof Function?r(this):r;return 1===n?.length&&n[0]?.data&&((e=this.$attrs).key,e=V(e,U),n[0].data.attrs=W({},e,{},n[0].data.attrs)),t(d.react.slotWrap,{attrs:s,style:o},n)}}}},{key:"componentWillUnmount",value:function(){m.reactRef&&(m.reactRef.vueWrapperRef=null,m.reactRef=null)}},{key:"vueInReactCall",value:function(t,n,e){var r=this;return e&&t?.[0]?t.map(function(t,e){return C(r.createSlot(t instanceof Function?t:[t]),W({},d,{},n,{isSlots:!0,wrapInstance:m})).render({key:t?.data?.key||e})}):C(this.createSlot(t),W({},d,{},n,{isSlots:!0,wrapInstance:m})).render()}},{key:"render",value:function(){var t,e,n,r,o=this,s=this.state,a=s["data-passed-props"],i=s.hashList,c=V(s,F),u={},l={};for(e in c)n=e,r=void 0,Object.hasOwn(c,n)&&null!=c[n]&&(c[n].__slot?(c[n].reactSlot?c[n]=c[n].reactSlot:(r=c[n],d.defaultSlotsFormatter?(c[n].__top__=o.vueWrapperRef,c[n]=d.defaultSlotsFormatter(c[n],o.vueInReactCall,i),Array.isArray(c[n])?c[n]=y(c[n]):-1<["string","number"].indexOf(g(c[n]))?c[n]=[c[n]]:"object"===g(c[n])&&(c[n]=W({},c[n]))):c[n]=W({},C(o.createSlot(c[n]),W({},d,{isSlots:!0,wrapInstance:m})).render()),c[n].vueSlot=r),u[n]=c[n]):c[n].__scopedSlot&&(c[n]=c[n](o.createSlot),l[n]=c[n]));c.children?.vueFunction||(t=c.children),u.default=t;var p,a=W({},a,{},{$slots:u,$scopedSlots:l},{children:t}),s={};return s.ref=this.setRef,d.isSlots?this.state.children||this.props.children:(p=c,p=W({},p=d.defaultPropsFormatter?d.defaultPropsFormatter(c,this.vueInReactCall,i):p,{},{"data-passed-props":a}),Object.getPrototypeOf(h)!==Function.prototype&&("object"!==g(h)||h.render)||f.catchVueRefs()?j.createElement(h,A({},p,{"data-passed-props":a},s),t||p.children):j.createElement(G,A({passedProps:p,component:h},s),t||p.children))}}],[{key:"catchVueRefs",value:function(){if(m.$parent)for(var t in m.$parent.$refs)if(m.$parent.$refs[t]===m)return!0;return!1}}])})();return l(t,"displayName","useReact_".concat(h.displayName||h.name||"Component")),t};function b(t){var E=t,I=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};return E.__esModule&&E.default&&(E=E.default),I.isSlots&&(E=E()),I=M(I,void 0,!0),{originReactComponent:E,data:function(){return{portals:[],portalKeyPool:[],maxPortalCount:0}},created:function(){this.cleanVnodeStyleClass(),this.$root.$options.router&&(S.router=this.$root.$options.router),this.$root.$options.router&&(S.store=this.$root.$options.store)},props:["dataPassedProps"],render:function(e){this.slotsInit();var t=I.react.componentWrapAttrs,n=t.style,t=V(t,B);return e(I.react.componentWrap,{ref:"react",attrs:t,style:n},this.portals.map(function(t){return(0,t.Portal)(e,t.key)}))},methods:{pushVuePortal:function(t){var e=this.portalKeyPool.shift()||this.maxPortalCount++;this.portals.push({Portal:t,key:e})},removeVuePortal:function(n){var r,t=this.portals.find(function(t,e){if(t.Portal===n)return r=e,!0});this.portalKeyPool.push(t.key),this.portals.splice(r,1)},slotsInit:function(e){var n=this;if(e)return e.componentOptions?.Ctor?.options&&!e.componentOptions?.Ctor?.options.originReactComponent?void 0:(e.data?.scopedSlots&&Object.keys(e.data?.scopedSlots).forEach(function(t){if("function"==typeof e.data.scopedSlots[t])try{e.data.scopedSlots[t]()}catch(t){}}),void(e.children||e.componentOptions?.children||[]).forEach(function(t){n.slotsInit(t)}));Object.keys(this.$slots).forEach(function(t){(n.$slots[t]||[]).forEach(function(t){n.slotsInit(t)})}),Object.keys(this.$scopedSlots).forEach(function(t){try{n.$scopedSlots[t]()}catch(t){}})},updateLastVnodeData:function(t){return this.lastVnodeData={style:W({},this.formatStyle(t.data.style),{},this.formatStyle(t.data.staticStyle)),class:Array.from(new Set([].concat(y(this.formatClass(t.data.class)),y(this.formatClass(t.data.staticClass))))).join(" ")},Object.assign(t.data,{staticStyle:null,style:null,staticClass:null,class:null}),t},cleanVnodeStyleClass:function(){var e=this,n=this.$vnode;this.updateLastVnodeData(n),Object.defineProperty(this,"$vnode",{get:function(){return n},set:function(t){return n=t!==n?e.updateLastVnodeData(t):n}})},toCamelCase:function(t){return t.replace(/-(\w)/g,function(t,e){return e.toUpperCase()})},formatStyle:function(t){var e,n=this,r=t;return r?"string"==typeof r?(r=r.trim()).split(/\s*;\s*/).reduce(function(t,e){return e&&2===(e=e.split(/\s*:\s*/)).length&&Object.assign(t,l({},n.toCamelCase(e[0]),e[1])),t},{}):"object"===g(r)?(e={},Object.keys(r).forEach(function(t){e[n.toCamelCase(t)]=r[t]}),e):{}:{}},formatClass:function(t){var e=t;return e?Array.isArray(e)?e:"string"==typeof e?(e=e.trim()).split(/\s+/):"object"===g(e)?Object.keys(e).map(function(t){return e[t]||""}):[]:[]},getScopeSlot:function(s,a,e){var i=this;function t(o){function t(){for(var t,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return s.reactFunction?s.reactFunction.apply(this,n):I.defaultSlotsFormatter?((t=s.apply(this,n)).__top__=i,t=I.defaultSlotsFormatter(t,i.vueInReactCall,a),Array.isArray(t)||-1<g(t).indexOf("string","number")?t=y(t):"object"===g(t)&&(t=W({},t)),t):C(o(s.apply(this,n)),W({},I,{isSlots:!0,wrapInstance:i})).render()}return I.pureTransformer&&e?t.vueFunction=e:t.vueFunction=s,t}return t.__scopedSlot=!0,t},__syncUpdateProps:function(t){this.reactInstance?.setState(t)},mountReactComponent:function(t,e){var n=this,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{},o=null!=this.$props.dataPassedProps?this.$props.dataPassedProps:{},s=o.on,a=o.$slots,i=o.$scopedSlots,c=o.children,o=V(o,z),u={},l=[],p=this.$vnode.context?.$vnode?.componentOptions?.Ctor?.extendOptions?._scopeId,f=(p&&(u[p]="",l.push(p)),{}),h={};if(!t||e?.slot){var d,m=W({},a,{},this.$slots);for(d in m)f[d]=m[d],f[d].__slot=!0;var y,v=W({},i,{},this.$scopedSlots);for(y in v)f[y]?this.$scopedSlots[y]&&(this.$scopedSlots[y].__slot=!0):v[y].__slot?(f[y]=v[y](),f[y].__slot=!0):h[y]=this.getScopeSlot(v[y],l,this.$vnode?.data?.scopedSlots?.[y])}var g,S=W({},o,{},W({},this.$attrs),{},!t||e?.slot?{$slots:f,$scopedSlots:h,children:c}:{},{on:W({},s,{},this.$listeners)}),b=(t&&!e?.slot||(g=W({},f),c=g.default,g.default=void 0),this.last=this.last||{},this.last.slot=this.last.slot||{},this.last.listeners=this.last.listeners||{},this.last.attrs=this.last.attrs||{},{slot:function(){n.last.slot=W({},c?{children:c}:{children:null},{},g,{},h)},listeners:function(){n.last.listeners=S.on},attrs:function(){n.last.attrs=n.$attrs}});if(e&&Object.keys(e).forEach(function(t){return b[t]()}),t){var _={},$=(Object.keys(this.last.listeners).forEach(function(t){_["on".concat(t.replace(/^(\w)/,function(t,e){return e.toUpperCase()}))]=n.$listeners[t]}),function(){n.reactInstance?.setState(function(e){return Object.keys(e).forEach(function(t){I.isSlots&&"children"===t||delete e[t]}),W({},n.cache,{},!I.isSlots&&n.last.slot,{},n.last.attrs,{},_)}),n.cache=null});!this.microTaskUpdate||this.cache||this.$nextTick(function(){$(),n.microTaskUpdate=!1}),this.macroTaskUpdate&&(clearTimeout(this.updateTimer),this.updateTimer=setTimeout(function(){clearTimeout(n.updateTimer),$(),n.macroTaskUpdate=!1})),this.cache=W({},this.cache||{},{},W({},o,{},r,{},{"data-passed-props":S},{},this.lastVnodeData.class?{className:this.lastVnodeData.class}:{},{},W({},u),{hashList:l,style:this.lastVnodeData.style})),this.macroTaskUpdate||this.microTaskUpdate||$()}else{b.slot(),b.listeners(),b.attrs();var p=J(E,I,this),R={},w=(Object.keys(S.on).forEach(function(t){R["on".concat(t.replace(/^(\w)/,function(t,e){return e.toUpperCase()}))]=S.on[t]}),j.createElement(p,A({},o,this.$attrs,R,{children:c},g,h,{"data-passed-props":S},this.lastVnodeData.class?{className:this.lastVnodeData.class}:{},u,{hashList:l,style:this.lastVnodeData.style,ref:function(t){return n.reactInstance=t}}))),O=(this.$redux?.store&&this.$redux.ReactReduxContext&&(a=this.$redux.ReactReduxContext,w=j.createElement(a.Provider,{value:{store:this.$redux.store}},w)),this.$refs.react),P=I.wrapInstance;if(P)(P=I.wrapInstance).vueWrapperRef=this;else for(var C=this.$parent;C;){if(C.parentReactWrapperRef){P=C.parentReactWrapperRef;break}if(C.reactWrapperRef){P=C.reactWrapperRef;break}C=C.$parent}P?(this.parentReactWrapperRef=P,this.reactPortal=function(){return k.createPortal(w,O)},P.pushReactPortal(this.reactPortal)):17<q?(void 0!==T.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED&&(T.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.usingClientEntryPoint=!0),this.__veauryReactApp__=T.createRoot(O),this.__veauryReactApp__.render(w)):T.render(w,O)}}},mounted:function(){clearTimeout(this.updateTimer),this.mountReactComponent()},beforeDestroy:function(){clearTimeout(this.updateTimer),this.reactPortal?(H(this.$refs.react),this.parentReactWrapperRef?.removeReactPortal(this.reactPortal)):(H(this.$refs.react),17<q?this.__veauryReactApp__.unmount():T.unmountComponentAtNode(this.$refs.react)),Y()},updated:function(){this.mountReactComponent(!0,{slot:!0})},inheritAttrs:!1,watch:{$attrs:{handler:function(){this.mountReactComponent(!0,{attrs:!0})},deep:!0},$listeners:{handler:function(){this.mountReactComponent(!0,{listeners:!0})},deep:!0},"$props.dataPassedProps":{handler:function(){this.mountReactComponent(!0,{passedProps:!0})},deep:!0}}}}var m={};function Q(t){Object.assign(m.vueInstance.$data,W({},t))}function X(t){return(X="function"==typeof Symbol&&"symbol"===g(Symbol.iterator)?function(t){return g(t)}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":g(t)})(t)}function Z(t){return(t=>{if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e<t.length;e++)n[e]=t[e];return n}})(t)||(t=>{if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)})(t)||(()=>{throw new TypeError("Invalid attempt to spread non-iterable instance")})()}var _="undefined"!=typeof window;function tt(n,t){return t.reduce(function(t,e){return n.hasOwnProperty(e)&&(t[e]=n[e]),t},{})}var et={},nt={},rt={},$=new(d.extend({data:function(){return{transports:et,targets:nt,sources:rt,trackInstances:_}},methods:{open:function(t){var e,n,r,o;_&&(e=t.to,r=t.from,n=t.passengers,t=void 0===(t=t.order)?1/0:t,e)&&r&&n&&(n={to:e,from:r,passengers:(r=n,Array.isArray(r)||"object"===X(r)?Object.freeze(r):r),order:t},-1===Object.keys(this.transports).indexOf(e)&&d.set(this.transports,e,[]),r=this.$_getTransportIndex(n),t=this.transports[e].slice(0),-1===r?t.push(n):t[r]=n,this.transports[e]=(o=function(t,e){return t.order-e.order},t.map(function(t,e){return[e,t]}).sort(function(t,e){return o(t[1],e[1])||t[0]-e[0]}).map(function(t){return t[1]})))},close:function(t){var e=1<arguments.length&&void 0!==arguments[1]&&arguments[1],n=t.to;n&&(t.from||!1!==e)&&this.transports[n]&&(e?this.transports[n]=[]:0<=(e=this.$_getTransportIndex(t))&&((t=this.transports[n].slice(0)).splice(e,1),this.transports[n]=t))},registerTarget:function(t,e,n){_&&(this.trackInstances&&!n&&this.targets[t]&&console.warn("[portal-vue]: Target ".concat(t," already exists")),this.$set(this.targets,t,Object.freeze([e])))},unregisterTarget:function(t){this.$delete(this.targets,t)},registerSource:function(t,e,n){_&&(this.trackInstances&&!n&&this.sources[t]&&console.warn("[portal-vue]: source ".concat(t," already exists")),this.$set(this.sources,t,Object.freeze([e])))},unregisterSource:function(t){this.$delete(this.sources,t)},hasTarget:function(t){return!(!this.targets[t]||!this.targets[t][0])},hasSource:function(t){return!(!this.sources[t]||!this.sources[t][0])},hasContentFor:function(t){return!!this.transports[t]&&!!this.transports[t].length},$_getTransportIndex:function(t){var e,n=t.to,r=t.from;for(e in this.transports[n])if(this.transports[n][e].from===r)return+e;return-1}}}))(et),ot=1,st=d.extend({name:"portal",props:{disabled:{type:Boolean},name:{type:String,default:function(){return String(ot++)}},order:{type:Number,default:0},slim:{type:Boolean},slotProps:{type:Object,default:function(){return{}}},tag:{type:String,default:"DIV"},to:{type:String,default:function(){return String(Math.round(1e7*Math.random()))}}},created:function(){var t=this;this.$nextTick(function(){$.registerSource(t.name,t)})},mounted:function(){this.disabled||this.sendUpdate()},updated:function(){this.disabled?this.clear():this.sendUpdate()},beforeDestroy:function(){$.unregisterSource(this.name),this.clear()},watch:{to:function(t,e){e&&e!==t&&this.clear(e),this.sendUpdate()}},methods:{clear:function(t){t={from:this.name,to:t||this.to};$.close(t)},normalizeSlots:function(){return this.$scopedSlots.default?[this.$scopedSlots.default]:this.$slots.default},normalizeOwnChildren:function(t){return"function"==typeof t?t(this.slotProps):t},sendUpdate:function(){var t=this.normalizeSlots();t?(t={from:this.name,to:this.to,passengers:Z(t),order:this.order},$.open(t)):this.clear()}},render:function(t){var e=this.$slots.default||this.$scopedSlots.default||[],n=this.tag;return e&&this.disabled?e.length<=1&&this.slim?this.normalizeOwnChildren(e)[0]:t(n,[this.normalizeOwnChildren(e)]):this.slim?t():t(n,{class:{"v-portal":!0},style:{display:"none"},key:"v-portal-placeholder"})}}),at=d.extend({name:"portalTarget",props:{multiple:{type:Boolean,default:!1},name:{type:String,required:!0},slim:{type:Boolean,default:!1},slotProps:{type:Object,default:function(){return{}}},tag:{type:String,default:"div"},transition:{type:[String,Object,Function]}},data:function(){return{transports:$.transports,firstRender:!0}},created:function(){var t=this;this.$nextTick(function(){$.registerTarget(t.name,t)})},watch:{ownTransports:function(){this.$emit("change",0<this.children().length)},name:function(t,e){$.unregisterTarget(e),$.registerTarget(t,this)}},mounted:function(){var t=this;this.transition&&this.$nextTick(function(){t.firstRender=!1})},beforeDestroy:function(){$.unregisterTarget(this.name)},computed:{ownTransports:function(){var t=this.transports[this.name]||[];return this.multiple?t:0===t.length?[]:[t[t.length-1]]},passengers:function(){return function(t,e){var r=1<arguments.length&&void 0!==e?e:{};return t.reduce(function(t,e){var n=e.passengers[0],n="function"==typeof n?n(r):e.passengers;return t.concat(n)},[])}(this.ownTransports,this.slotProps)}},methods:{children:function(){return 0!==this.passengers.length?this.passengers:this.$scopedSlots.default?this.$scopedSlots.default(this.slotProps):this.$slots.default||[]},noWrapper:function(){var t;return(t=this.slim&&!this.transition)&&1<this.children().length&&console.warn("[portal-vue]: PortalTarget with `slim` option received more than one child element."),t}},render:function(t){var e=this.noWrapper(),n=this.children(),r=this.transition||this.tag;return e?n[0]:this.slim&&!r?t():t(r,{props:{tag:this.transition&&this.tag?this.tag:void 0},class:{"vue-portal-target":!0}},n)}}),it=0,ct=["disabled","name","order","slim","slotProps","tag","to"],ut=["multiple","transition"],lt=d.extend({name:"MountingPortal",inheritAttrs:!1,props:{append:{type:[Boolean,String]},bail:{type:Boolean},mountTo:{type:String,required:!0},disabled:{type:Boolean},name:{type:String,default:function(){return"mounted_"+String(it++)}},order:{type:Number,default:0},slim:{type:Boolean},slotProps:{type:Object,default:function(){return{}}},tag:{type:String,default:"DIV"},to:{type:String,default:function(){return String(Math.round(1e7*Math.random()))}},multiple:{type:Boolean,default:!1},targetSlim:{type:Boolean},targetSlotProps:{type:Object,default:function(){return{}}},targetTag:{type:String,default:"div"},transition:{type:[String,Object,Function]}},created:function(){var t,e;"undefined"!=typeof document&&((t=document.querySelector(this.mountTo))?(e=this.$props,$.targets[e.name]?e.bail?console.warn("[portal-vue]: Target ".concat(e.name," is already mounted.\n Aborting because 'bail: true' is set")):this.portalTarget=$.targets[e.name]:((e=e.append)&&(e=document.createElement("string"==typeof e?e:"DIV"),t.appendChild(e),t=e),(e=tt(this.$props,ut)).slim=this.targetSlim,e.tag=this.targetTag,e.slotProps=this.targetSlotProps,e.name=this.to,this.portalTarget=new at({el:t,parent:this.$parent||this,propsData:e}))):console.error("[portal-vue]: Mount Point '".concat(this.mountTo,"' not found in document")))},beforeDestroy:function(){var t,e=this.portalTarget;this.append&&(t=e.$el).parentNode.removeChild(t),e.$destroy()},render:function(t){var e;return this.portalTarget?this.$scopedSlots.manual?(e=this.$scopedSlots.manual({to:this.to}),(e=Array.isArray(e)?e[0]:e)||t()):(e=tt(this.$props,ct),t(st,{props:e,attrs:this.$attrs,on:this.$listeners,scopedSlots:this.$scopedSlots},this.$slots.default)):(console.warn("[portal-vue] Target wasn't mounted"),t())}}),R=new Set(["onClick","onContextMenu","onDoubleClick","onDrag","onDragEnd","onDragEnter","onDragExit","onDragLeave","onDragOver","onDragStart","onDrop","onMouseDown","onMouseEnter","onMouseLeave","onMouseMove","onMouseOut","onMouseOver","onMouseUp","onChange","onInput","onInvalid","onReset","onSubmit","onError","onLoad","onPointerDown","onPointerMove","onPointerUp","onPointerCancel","onGotPointerCapture","onLostPointerCapture","onPointerEnter","onPointerLeave","onPointerOver","onPointerOut","onSelect","onTouchCancel","onTouchEnd","onTouchMove","onTouchStart","onScroll","onWheel","onAbort","onCanPlay","onCanPlayThrough","onDurationChange","onEmptied","onEncrypted","onEnded","onError","onLoadedData","onLoadedMetadata","onLoadStart","onPause","onPlay","onPlaying","onProgress","onRateChange","onSeeked","onSeeking","onStalled","onSuspend","onTimeUpdate","onVolumeChange","onWaiting","onLoad","onError","onAnimationStart","onAnimationEnd","onAnimationIteration","onTransitionEnd","onToggle"]),pt=["history","match","location"],ft=["$model"],ht=["$sync"],dt=["$slots","$scopedSlots","children","on"],mt=["component","on","$slots","$scopedSlots","children","class","style","data-passed-props"],yt=["className","classname"],vt=17<=parseFloat(n.version)?"UNSAFE_":"",w="vuereact-combined-options";function O(t){return"string"==typeof t?d.component(t):t}function gt(t){return"function"==typeof t?t.options:t}var St=(()=>{function r(t){c(this,r),e=i(this,r,[t]);var e,n=t.history;return n={history:n,match:t.match,location:t.location},m.vueInstance?Q(n):(m.vueInstance=new d({data:W({},n)}),d.prototype.$reactRouter=m.vueInstance.$data),e}return p(r,j.Component),u(r,[{key:"".concat(vt,"componentWillReceiveProps"),value:function(t){Q({history:t.history,match:t.match,location:t.location})}},{key:"render",value:function(){var t=this.props,t=(t.history,V(t,pt));return j.createElement(bt,A({},t,{ref:this.props.forwardRef}))}}])})(),P=j.forwardRef(function(t,e){var n=M(t[w]||{},void 0,!0);return m.withRouter?(P.RouterTargetComponent||(P.RouterTargetComponent=m.withRouter(St)),j.createElement(P.RouterTargetComponent,A({},W({},t,l({},w,n)),{forwardRef:e}))):j.createElement(bt,A({},W({},t,l({},w,n)),{ref:e}))}),bt=(()=>{function n(t){var e;return c(this,n),(e=i(this,n,[t])).state={portals:[]},e.portalKeyPool=[],e.maxPortalCount=0,e.currentVueComponent=O(t.component),e.createVueInstance=e.createVueInstance.bind(e),e.vueComponentContainer=e.createVueComponentContainer(),e}return p(n,j.Component),u(n,[{key:"pushReactPortal",value:function(t){var e=this.state.portals,n=this.portalKeyPool.shift()||this.maxPortalCount++;e.push({Portal:t,key:n}),this.setState({portals:e})}},{key:"removeReactPortal",value:function(n){var r,t=this.state.portals,e=t.find(function(t,e){if(t.Portal===n)return r=e,!0});this.portalKeyPool.push(e.key),t.splice(r,1),this.vueRef&&this.setState({portals:t})}},{key:"createVueComponentContainer",value:function(){var e=this,n={},t=this.props[w];return t.isSlots?(Object.keys(this.props).forEach(function(t){R.has(t)&&"function"==typeof e.props[t]&&(n[t]=e.props[t])}),t.vue.slotWrapAttrs&&(n=W({},n,{},t.vue.slotWrapAttrs))):t.vue.componentWrapAttrs&&(n=W({},n,{},t.vue.componentWrapAttrs)),t.vue.componentWrapHOC(j.createElement("div",{ref:this.createVueInstance,key:null}),n)}},{key:"".concat(vt,"componentWillReceiveProps"),value:function(t){var e,n=this,r=t.component,o=t.children,s=t.$slots,t=V(t,["component",w,"children","$slots"].map(v)),r=O(r);this.currentVueComponent!==r&&this.updateVueComponent(r),this.vueInstance&&(o=this.transferChildren(o),s=this.transferSlots(s),o&&(t.children=o),s&&(t.$slots=s),e=this.doSync(this.doVModel(t)),Object.keys(this.vueInstance.$data.reactProps).forEach(function(t){t in e||"data-passed-props"===t||n.vueInstance.$set(n.vueInstance.$data.reactProps,t,void 0)}),Object.keys(e).forEach(function(t){n.vueInstance.$set(n.vueInstance.$data.reactProps,t,e[t])}))}},{key:"componentWillUnmount",value:function(){this.vuePortal?this.parentVueWrapperRef.removeVuePortal(this.vuePortal):this.vueInstance&&this.vueInstance.$destroy()}},{key:"doVModel",value:function(t){var e,r,o=t.$model,n=V(t,ft);return void 0===o?t:(e=l({},(t=W({},{prop:"value",event:"input"},{},gt(this.currentVueComponent).model)).prop,o.value),n.on||(n.on={}),n.on[t.event]?(r=n.on[t.event],n.on[t.event]=function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];r.apply(this,e),o.setter&&o.setter.apply(this,e)}):n.on=W({},n.on,{},l({},t.event,o.setter||function(){})),W({},n,{},e))}},{key:"doSync",value:function(t){var s=t.$sync,e=V(t,ht);if(void 0===s)return t;var n,a={};for(n in s)(r=>{if(!s.hasOwnProperty(r)||!s[r]||null==s[r].value||null==s[r].setter)return;a[r]=s[r].value;var o,t="update:"+r;e.on||(e.on={}),e.on[t]?(o=e.on[t],e.on[t]=function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];o.apply(this,e),s[r].setter&&s[r].setter.apply(this,e)}):e.on=W({},e.on,{},l({},t,s[r].setter||function(){}))})(n);return W({},e,{},a)}},{key:"transferSlots",value:function(n){if(n)return Object.keys(n).forEach(function(t){var e=n[t];n[t]=function(){return e}}),n}},{key:"transferChildren",value:function(t){var e;if(t)return e=t,function(){return e}}},{key:"createVueInstance",value:function(t){var m=this,c=this,e=this.props,n=e.component,r=e["data-passed-props"],r=void 0===r?{}:r,u=e[w],o=e.children,s=e.$slots,e=V(e,["component","data-passed-props",w,"children","$slots"].map(v)),o=this.transferChildren(o),s=this.transferSlots(s),n=(o&&(e.children=o),s&&(e.$slots=s),O(n));function a(t){this.vueInstance||(this.vueInstance=t)}a=a.bind(this);var i=W({},this.doSync(this.doVModel(e)),{"data-passed-props":r}),l=W({},S,{data:function(){return{reactProps:i}},created:function(){this.reactWrapperRef=c,a(this)},methods:{getNamespaceSlots:function(o,t){var e,s=this,a=(this.getNamespaceSlots.__namespaceSlots||(this.getNamespaceSlots.__namespaceSlots={}),Object.assign({},t));for(e in a)(t=>{if(!a.hasOwnProperty(t)||!a[t])return;var e,n,r;"function"==typeof a[t]&&(a[t]=a[t]()),a[t]=(e=a[t],n=t,e.vueSlot||(s.getNamespaceSlots.__namespaceSlots[t]?.[0]?.child?.reactInstance?(r=s.getNamespaceSlots.__namespaceSlots[t],s.$nextTick(function(){r[0].child.reactInstance.setState({children:e})})):(r=[o(b(function(){return e},W({},u,{isSlots:!0,wrapInstance:c})),{slot:n})],s.getNamespaceSlots.__namespaceSlots[t]=r),r.reactSlot=e,r))})(e);return a},getScopedSlots:function(a,t){var e,i=this,n=(this.getScopedSlots.__scopeSlots||(this.getScopedSlots.__scopeSlots={}),W({},t));for(e in n)(o=>{if(!n.hasOwnProperty(o))return;var s,t=n[o];n[o]=(s=t,function(){for(var t,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return s.vueFunction?s.vueFunction.apply(i,n):(i.getScopedSlots.__scopeSlots[o]?.child?.reactInstance?(t=i.getScopedSlots.__scopeSlots[o],i.$nextTick(function(){t.child.reactInstance.setState({children:s.apply(i,n)})})):(t=a(b(function(){return s.apply(i,n)},W({},u,{isSlots:!0,wrapInstance:c}))),i.getScopedSlots.__scopeSlots[o]=t),t)}),n[o].reactFunction=t})(e);return n},getChildren:function(t,e){var n;if(null!=e)return(e="function"==typeof e?e():e).vueSlot?e.vueSlot:(this.getChildren.__vnode?.[0]?.child?.reactInstance?(n=this.getChildren.__vnode,this.$nextTick(function(){n[0].child.reactInstance.setState({children:e})})):(n=[t(b(function(){return e},W({},u,{isSlots:!0,wrapInstance:c})))],this.getChildren.__vnode=n),n.reactSlot=e,n)}},mounted:function(){c.vueRef=this.$children[0],this.$children[0].reactWrapperRef=c},beforeDestroy:function(){c.vueRef=null,this.$children[0].reactWrapperRef=null},render:function(t){var e=this.$data.reactProps,n=(e.component,e.on),r=e.$slots,o=e.$scopedSlots,s=e.class,s=void 0===s?"":s,a=e.style,a=void 0===a?"":a,i=e["data-passed-props"],c=i.$slots,u=i.$scopedSlots,l=i.children,p=i.on,i=V(i,dt),f=V(e,mt),e=(((t,e)=>{if(!t)return;if(e)for(var n in t)t.hasOwnProperty(n)&&e[n]&&delete t[n]})(u,c),this.getScopedSlots(t,W({},u,{},o))),u=this.getChildren(t,this.reactProps.children||l),h=this.getNamespaceSlots(t,W({},c,{},r)),o=(u&&(h.default=u),[u||[]].concat(y(Object.keys(h).map(function(t){if("default"!==t)return h[t]})))),l=W({},p,{},n),d={},c=(Object.keys(f).forEach(function(t){R.has(t)&&"function"==typeof f[t]&&(d[t.replace(/^on/,"").toLowerCase()]=f[t],delete f[t])}),W({},i,{},f,{"data-passed-props":W({},i,{},f,{on:l,children:u,$slots:h,$scopedSlots:e})})),r=(t=>{var e=[],n={},r=gt(m.currentVueComponent),o=(r.mixins&&r.mixins.forEach(function(t){t.props&&(t.props instanceof Array?e=y(t.props):n=W({},t.props))}),Object.assign({},t));if(t=r.props)if(t instanceof Array)[].concat(y(t),y(e)).forEach(function(t){delete o[t]});else{var s,a=W({},t,{},n);for(s in a)a.hasOwnProperty(s)&&delete o[s]}return o})(W({},c)),p=r.className,n=r.classname,i=V(r,yt);return t("use_vue_wrapper",{props:c,on:l,nativeOn:d,attrs:i,class:s||p||n||"",style:a,scopedSlots:W({},e)},o)},components:{use_vue_wrapper:n}});if(t){var p="__vue_wrapper_container_"+(Math.random()+"").substr(2),f=(t.id=p,u.wrapInstance);if(f)(f=u.wrapInstance).reactWrapperRef=c;else for(var h=(this._reactInternals||this._reactInternalFiber).return;h;){if(h.stateNode?.parentVueWrapperRef){f=h.stateNode.parentVueWrapperRef;break}if(h.stateNode?.vueWrapperRef){f=h.stateNode.vueWrapperRef;break}h=h.return}f&&document.getElementById(p)?(this.parentVueWrapperRef=f,this.vuePortal=function(t,e){return t(lt,{props:{mountTo:"#"+p,slim:!0,targetSlim:!0},key:p},[t(Object.assign(l,{router:m._router}))])},f.pushVuePortal(this.vuePortal)):this.vueInstance=new d(W({},l,{el:t}))}}},{key:"updateVueComponent",value:function(t){this.currentVueComponent=t,this.vueInstance&&(t.__fromReactSlot?Object.assign(this.vueInstance.$options.components.use_vue_wrapper._Ctor[0].options,t):this.vueInstance.$options.components.use_vue_wrapper=t,this.vueInstance.$forceUpdate())}},{key:"render",value:function(){return j.createElement(this.vueComponentContainer,{portals:this.state.portals})}}])})();function C(n){var r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};return n||console.warn("Component must be passed in applyVueInReact!"),n.__esModule&&n.default&&(n=n.default),j.forwardRef(function(t,e){return j.createElement(P,A({},t,{component:n,ref:e},l({},w,r)))})}var E,I,_t=(()=>u(function t(e){var n=this;if(c(this,t),!e||!e.subscribe||!e.getState)throw Error("incorrect store passed in, please check the function applyRedux's parameter must contains redux store");(this.store=e).subscribe(function(){n._vm.state=e.getState()}),this._vm=new d({data:function(){return{state:e.getState()}}})},[{key:"state",get:function(){return this._vm.state}},{key:"dispatch",get:function(){return this.store.dispatch}}]))();function $t(t){var e=t.store,t=t.ReactReduxContext;return E||(E=new _t(e),t&&(E.ReactReduxContext=t),d.prototype.$redux=E),E}function Rt(t){I=t}var x={};var wt=b,Ot=C,Pt=$t,Ct=Rt;t.REACT_ALL_HANDLERS=R,t.VueContainer=P,t.applyReactInVue=b,t.applyReactRouterInVue=function(t){return m.withRouter||(m.withRouter=t),m.withRouter},t.applyRedux=$t,t.applyVueInReact=C,t.applyVuex=Rt,t.connectVuex=function(t){var e=t.mapStateToProps,r=void 0===e?function(t){}:e,o=void 0===(e=t.mapGettersToProps)?function(t){}:e,s=void 0===(e=t.mapCommitToProps)?function(t){}:e,a=void 0===(e=t.mapDispatchToProps)?function(t){}:e;return function(t){var n=(()=>{function e(t){if(c(this,e),t=i(this,e,[t]),(I=S.store?S.store:I)&&I.state&&I.subscribe&&I.dispatch&&I.commit)return t.state=W({},r(I.state),{},o(I.getters)),t;throw Error("[vuereact-combined warn]Error: incorrect store passed in, please check the function applyVuex's parameter must be vuex store")}return p(e,j.Component),u(e,[{key:"componentDidMount",value:function(){var e=this;this.watch=I.watch(function(){return W({},r(I.state),{},o(I.getters))},function(t){e.setState(t)},{deep:!0})}},{key:"componentWillUnmount",value:function(){this.watch()}},{key:"render",value:function(){return j.createElement(t,A({},this.props,W({},this.state,{},s(I.commit),{},a(I.dispatch)),{ref:this.props.forwardedRef}))}}])})();return j.forwardRef(function(t,e){return j.createElement(n,A({forwardedRef:e},t))})}},t.lazyReactInVue=function(t,e){return function(){return t().then(function(t){return b(t.default,e)})}},t.lazyVueInReact=function(t,e){return n.lazy(function(){return t().then(function(t){return{default:C(t.default,e)}})})},t.useReactInVue=wt,t.useRedux=Pt,t.useVueInReact=Ot,t.useVuex=Ct,t.vueRootInfo=S,t.withVueRouter=function(t){var n=(()=>{function e(t){if(c(this,e),t=i(this,e,[t]),!x.instance){if(!S.router)throw Error("Vue router does not exist! You must setting the Vue router in the Vue Instance options first.");x.instance=new d({router:S.router})}return t.state={$vueRouter:x.instance.$router,$vueRoute:x.instance.$route},t}return p(e,j.Component),u(e,[{key:"componentDidMount",value:function(){var t=this;this.subscribe=x.instance.$watch("$route",function(){t.setState({$vueRouter:x.instance.$router,$vueRoute:x.instance.$route})})}},{key:"componentWillUnmount",value:function(){this.subscribe()}},{key:"render",value:function(){return j.createElement(t,A({},this.props,this.state,{ref:this.props.forwardedRef}))}}])})();return j.forwardRef(function(t,e){return j.createElement(n,A({forwardedRef:e},t))})},Object.defineProperty(t,"__esModule",{value:!0})});