vuereact-combined
Version:
Vue和React快捷集成的工具包,并且适合复杂的集成场景
2 lines (1 loc) • 38.8 kB
JavaScript
!function(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,m,D){"use strict";var N="default"in n?n.default:n;m=m&&Object.prototype.hasOwnProperty.call(m,"default")?m.default:m;var M="default"in D?D.default:D;function r(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 L(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(Object(n),!0).forEach(function(t){u(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function y(t){return(y="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)}function i(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,r.key,r)}}function c(t,e,n){return e&&o(t.prototype,e),n&&o(t,n),t}function u(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function U(){return(U=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n,r=arguments[e];for(n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t}).apply(this,arguments)}function l(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}}),e&&a(t,e)}function s(t){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function a(t,e){return(a=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function F(t,e){if(null==t)return{};var n,r=function(t,e){if(null==t)return{};for(var n,r={},o=Object.keys(t),s=0;s<o.length;s++)n=o[s],0<=e.indexOf(n)||(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],0<=e.indexOf(n)||Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n]);return r}function p(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function g(n){var r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}();return function(){var t,e=s(n);return t=r?(t=s(this).constructor,Reflect.construct(e,arguments,t)):e.apply(this,arguments),e=this,!(t=t)||"object"!=typeof t&&"function"!=typeof t?p(e):t}}function S(t){return function(t){if(Array.isArray(t))return f(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return f(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Map"===(n="Object"===n&&t.constructor?t.constructor.name:n)||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?f(t,e):void 0}}(t)||function(){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 f(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function b(t){t=function(t,e){if("object"!=typeof t||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0===n)return("string"===e?String:Number)(t);if("object"!=typeof(e=n.call(t,e||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"==typeof t?t:String(t)}var d={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 N.createElement("div",n,e,t.map(function(t){var e=t.Portal,t=t.key;return N.createElement(e,{key:t})}))}},componentWrapAttrs:{"data-use-vue-component-wrap":"",style:{all:"unset"}},slotWrapAttrs:{"data-use-vue-slot-wrap":"",style:{all:"unset"}}}};function h(t,e,n){t=0<arguments.length&&void 0!==t?t:{react:{},vue:{}},e=1<arguments.length&&void 0!==e?e:d,n=2<arguments.length?n:void 0;t.vue||(t.vue={}),t.react||(t.react={});t=[e,L(L({},t),{},{react:L(L(L({},e.react),t.react),{},{componentWrapAttrs:L(L({},e.react.componentWrapAttrs),t.react.componentWrapAttrs),slotWrapAttrs:L(L({},e.react.slotWrapAttrs),t.react.slotWrapAttrs)}),vue:L(L(L({},e.vue),t.vue),{},{componentWrapAttrs:L(L({},e.vue.componentWrapAttrs),t.vue.componentWrapAttrs),slotWrapAttrs:L(L({},e.vue.slotWrapAttrs),t.vue.slotWrapAttrs)})})];return n&&t.unshift({}),Object.assign.apply(this,t)}var _={},v=["ref"],$=["style"],R=["key","data-passed-props"],w=["data-passed-props","hashList"],O=["style"],B=["on","$slots","$scopedSlots","children"],z=parseInt(n.version),P=["getElementById","getElementsByClassName","getElementsByTagName","getElementsByTagNameNS","querySelector","querySelectorAll"],C={Document:{},Element:{}};function e(a){Object.keys(C).forEach(function(t){P.forEach(function(o){var s=window[t].prototype[o];C[t][o]=s,window[t].prototype[o]=function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];var r=s.apply(this,e);return r&&r.constructor!==NodeList||r&&r.constructor===NodeList&&0<r.length?r:Element.prototype[o].apply(a,e)}})})}function I(){Object.keys(C).forEach(function(e){P.forEach(function(t){window[e].prototype[t]=C[e][t]})})}var k=function(){l(n,N.Component);var e=g(n);function n(t){return i(this,n),e.call(this,t)}return c(n,[{key:"render",value:function(){var t=this.props.component,e=this.props.passedProps,e=(e.ref,F(e,v));return N.createElement(t,e,this.props.children)}}]),n}(),q=function(d,h,v){var t,e=t=function(){l(f,N.Component);var n=g(f);function f(t){var e;return i(this,f),(e=n.call(this,t)).state=L(L({},t),h.isSlots?{children:d}:{}),e.setRef=e.setRef.bind(p(e)),e.vueInReactCall=e.vueInReactCall.bind(p(e)),e.vueWrapperRef=v,e}return c(f,[{key:"setRef",value:function(e){e&&(v.reactRef=e,Object.keys(e).forEach(function(t){v[t]||(v[t]=e[t])}),Promise.resolve().then(function(){Object.keys(e).forEach(function(t){v[t]||(v[t]=e[t])})}),(this.setRef.current=e).vueWrapperRef=v)}},{key:"createSlot",value:function(n){var t=h.react.slotWrapAttrs,r=t.style,o=F(t,$);return{inheritAttrs:!1,__fromReactSlot:!0,render:function(t){var e;return 1===(null===(n=n instanceof Function?n(this):n)||void 0===n?void 0:n.length)&&null!==(e=n[0])&&void 0!==e&&e.data&&((e=this.$attrs).key,e["data-passed-props"],e=F(e,R),n[0].data.attrs=L(L({},e),n[0].data.attrs)),t(h.react.slotWrap,{attrs:o,style:r},n)}}}},{key:"componentWillUnmount",value:function(){v.reactRef&&(v.reactRef.vueWrapperRef=null,v.reactRef=null)}},{key:"vueInReactCall",value:function(t){var r=this,o=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};return(2<arguments.length?arguments[2]:void 0)&&t&&t[0]?t.map(function(t,e){var n;return yt(r.createSlot(t instanceof Function?t:[t]),L(L(L({},h),o),{},{isSlots:!0,wrapInstance:v})).render({key:(null==t||null===(n=t.data)||void 0===n?void 0:n.key)||e})}):yt(this.createSlot(t),L(L(L({},h),o),{},{isSlots:!0,wrapInstance:v})).render()}},{key:"render",value:function(){var t,e,n,r,o=this,s=this.state,a=s["data-passed-props"],i=s.hashList,c=F(s,w),u={},l={};for(e in c)n=e,r=void 0,c.hasOwnProperty(n)&&null!=c[n]&&(c[n].__slot?(c[n].reactSlot?c[n]=c[n].reactSlot:(r=c[n],h.defaultSlotsFormatter?(c[n].__top__=o.vueWrapperRef,c[n]=h.defaultSlotsFormatter(c[n],o.vueInReactCall,i),c[n]instanceof Array?c[n]=S(c[n]):-1<["string","number"].indexOf(y(c[n]))?c[n]=[c[n]]:"object"===y(c[n])&&(c[n]=L({},c[n]))):c[n]=L({},yt(o.createSlot(c[n]),L(L({},h),{},{isSlots:!0,wrapInstance:v})).render()),c[n].vueSlot=r),u[n]=c[n]):c[n].__scopedSlot&&(c[n]=c[n](o.createSlot),l[n]=c[n]));null!==(p=c.children)&&void 0!==p&&p.vueFunction||(t=c.children),u.default=t;a=L(L(L({},a),{$slots:u,$scopedSlots:l}),{},{children:t}),s={};if(s.ref=this.setRef,h.isSlots)return this.state.children||this.props.children;var p=c,p=L(L({},p=h.defaultPropsFormatter?h.defaultPropsFormatter(c,this.vueInReactCall,i):p),{"data-passed-props":a});return Object.getPrototypeOf(d)!==Function.prototype&&("object"!==y(d)||d.render)||f.catchVueRefs()?N.createElement(d,U({},p,{"data-passed-props":a},s),t||p.children):N.createElement(k,U({passedProps:p,component:d},s),t||p.children)}}],[{key:"catchVueRefs",value:function(){if(!v.$parent)return!1;for(var t in v.$parent.$refs)if(v.$parent.$refs[t]===v)return!0;return!1}}]),f}();return u(t,"displayName","useReact_".concat(d.displayName||d.name||"Component")),e};function E(x){var V=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};return x.__esModule&&x.default&&(x=x.default),V.isSlots&&(x=x()),V=h(V,void 0,!0),{originReactComponent:x,data:function(){return{portals:[],portalKeyPool:[],maxPortalCount:0}},created:function(){this.cleanVnodeStyleClass(),this.$root.$options.router&&(_.router=this.$root.$options.router),this.$root.$options.router&&(_.store=this.$root.$options.store)},props:["dataPassedProps"],render:function(n){this.slotsInit();var t=V.react.componentWrapAttrs,e=t.style,t=F(t,O);return n(V.react.componentWrap,{ref:"react",attrs:t,style:e},this.portals.map(function(t){var e=t.Portal,t=t.key;return e(n,t)}))},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 t,n,r,o,s=this;if(e)return null===(t=e.componentOptions)||void 0===t||null===(n=t.Ctor)||void 0===n||!n.options||null!==(n=e.componentOptions)&&void 0!==n&&null!==(r=n.Ctor)&&void 0!==r&&r.options.originReactComponent?(null!==(r=e.data)&&void 0!==r&&r.scopedSlots&&Object.keys(null===(o=e.data)||void 0===o?void 0:o.scopedSlots).forEach(function(t){if("function"==typeof e.data.scopedSlots[t])try{e.data.scopedSlots[t]()}catch(t){}}),void(e.children||(null===(o=e.componentOptions)||void 0===o?void 0:o.children)||[]).forEach(function(t){s.slotsInit(t)})):void 0;Object.keys(this.$slots).forEach(function(t){(s.$slots[t]||[]).forEach(function(t){s.slotsInit(t)})}),Object.keys(this.$scopedSlots).forEach(function(t){try{s.$scopedSlots[t]()}catch(t){}})},updateLastVnodeData:function(t){return this.lastVnodeData={style:L(L({},this.formatStyle(t.data.style)),this.formatStyle(t.data.staticStyle)),class:Array.from(new Set([].concat(S(this.formatClass(t.data.class)),S(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 t===n?n:n=e.updateLastVnodeData(t)}})},toCamelCase:function(t){return t.replace(/-(\w)/g,function(t,e){return e.toUpperCase()})},formatStyle:function(e){var n=this;if(!e)return{};if("string"==typeof e)return(e=e.trim()).split(/\s*;\s*/).reduce(function(t,e){return e&&(2!==(e=e.split(/\s*:\s*/)).length||Object.assign(t,u({},n.toCamelCase(e[0]),e[1]))),t},{});if("object"!==y(e))return{};var r={};return Object.keys(e).forEach(function(t){r[n.toCamelCase(t)]=e[t]}),r},formatClass:function(e){return e?e instanceof Array?e:"string"==typeof e?(e=e.trim()).split(/\s+/):"object"===y(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=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];if(s.reactFunction)return s.reactFunction.apply(this,e);if(V.defaultSlotsFormatter){var r=s.apply(this,e);return r.__top__=i,(r=V.defaultSlotsFormatter(r,i.vueInReactCall,a))instanceof Array||-1<y(r).indexOf("string","number")?r=S(r):"object"===y(r)&&(r=L({},r)),r}return yt(o(s.apply(this,e)),L(L({},V),{},{isSlots:!0,wrapInstance:i})).render()}return V.pureTransformer&&e?t.vueFunction=e:t.vueFunction=s,t}return t.__scopedSlot=!0,t},__syncUpdateProps:function(t){this.reactInstance&&this.reactInstance.setState(t)},mountReactComponent:function(t,e){var n,r,o,s=this,a=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{},i=null!=this.$props.dataPassedProps?this.$props.dataPassedProps:{},c=i.on,u=i.$slots,l=i.$scopedSlots,p=i.children,f=F(i,B),d={},h=[],v=null===(i=this.$vnode.context)||void 0===i||null===(n=i.$vnode)||void 0===n||null===(r=n.componentOptions)||void 0===r||null===(o=r.Ctor)||void 0===o||null===(v=o.extendOptions)||void 0===v?void 0:v._scopeId;v&&(d[v]="",h.push(v));var m={},y={};if(!t||t&&null!=e&&e.slot){var g,S=L(L({},u),this.$slots);for(g in S)m[g]=S[g],m[g].__slot=!0;var b,_,$,R,w=L(L({},l),this.$scopedSlots);for(b in w)m[b]?this.$scopedSlots[b]&&(this.$scopedSlots[b].__slot=!0):w[b].__slot?(m[b]=w[b](),m[b].__slot=!0):y[b]=this.getScopeSlot(w[b],h,null===(_=this.$vnode)||void 0===_||null===($=_.data)||void 0===$||null===(R=$.scopedSlots)||void 0===R?void 0:R[b])}var O,P=L(L(L(L({},f),L({},this.$attrs)),!t||t&&null!=e&&e.slot?{$slots:m,$scopedSlots:y,children:p}:{}),{},{on:L(L({},c),this.$listeners)});(!t||t&&null!=e&&e.slot)&&(O=L({},m),p=O.default,delete O.default),this.last=this.last||{},this.last.slot=this.last.slot||{},this.last.listeners=this.last.listeners||{},this.last.attrs=this.last.attrs||{};var C={slot:function(){s.last.slot=L(L(L({},p?{children:p}:{children:null}),O),y)},listeners:function(){s.last.listeners=P.on},attrs:function(){s.last.attrs=s.$attrs}};if(e&&Object.keys(e).forEach(function(t){return C[t]()}),t){var I=function(){s.reactInstance&&s.reactInstance.setState(function(e){return Object.keys(e).forEach(function(t){V.isSlots&&"children"===t||delete e[t]}),L(L(L(L({},s.cache),!V.isSlots&&s.last.slot),s.last.attrs),k)}),s.cache=null};this.microTaskUpdate&&(this.cache||this.$nextTick(function(){I(),s.microTaskUpdate=!1})),this.macroTaskUpdate&&(clearTimeout(this.updateTimer),this.updateTimer=setTimeout(function(){clearTimeout(s.updateTimer),I(),s.macroTaskUpdate=!1}));var k={};Object.keys(this.last.listeners).forEach(function(t){k["on".concat(t.replace(/^(\w)/,function(t,e){return e.toUpperCase()}))]=s.$listeners[t]}),this.cache=L(L({},this.cache||{}),L(L(L(L(L(L({},f),a),{"data-passed-props":P}),this.lastVnodeData.class?{className:this.lastVnodeData.class}:{}),L({},d)),{},{hashList:h,style:this.lastVnodeData.style})),this.macroTaskUpdate||this.microTaskUpdate||I()}else{C.slot(),C.listeners(),C.attrs();var a=q(x,V,this),E={};Object.keys(P.on).forEach(function(t){E["on".concat(t.replace(/^(\w)/,function(t,e){return e.toUpperCase()}))]=P.on[t]});var j=N.createElement(a,U({},f,this.$attrs,E,{children:p},O,y,{"data-passed-props":P},this.lastVnodeData.class?{className:this.lastVnodeData.class}:{},d,{hashList:h,style:this.lastVnodeData.style,ref:function(t){return s.reactInstance=t}}));this.$redux&&this.$redux.store&&this.$redux.ReactReduxContext&&(d=this.$redux.ReactReduxContext,j=N.createElement(d.Provider,{value:{store:this.$redux.store}},j));var T=this.$refs.react,A=V.wrapInstance;if(A)(A=V.wrapInstance).vueWrapperRef=this;else for(var W=this.$parent;W;){if(W.parentReactWrapperRef){A=W.parentReactWrapperRef;break}if(W.reactWrapperRef){A=W.reactWrapperRef;break}W=W.$parent}if(A)return this.parentReactWrapperRef=A,this.reactPortal=function(){return D.createPortal(j,T)},void A.pushReactPortal(this.reactPortal);if(17<z)return void 0!==M.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED&&(M.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.usingClientEntryPoint=!0),this.__veauryReactApp__=M.createRoot(T),void this.__veauryReactApp__.render(j);M.render(j,T)}}},mounted:function(){clearTimeout(this.updateTimer),this.mountReactComponent()},beforeDestroy:function(){if(clearTimeout(this.updateTimer),this.reactPortal)return e(this.$refs.react),this.parentReactWrapperRef&&this.parentReactWrapperRef.removeReactPortal(this.reactPortal),void I();e(this.$refs.react),17<z?this.__veauryReactApp__.unmount():M.unmountComponentAtNode(this.$refs.react),I()},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 j={};function T(t){Object.assign(j.vueInstance.$data,L({},t))}function A(t){return(A="function"==typeof Symbol&&"symbol"===y(Symbol.iterator)?function(t){return y(t)}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":y(t)})(t)}function W(t){return function(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)||function(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}var x="undefined"!=typeof window;function V(n,t){return t.reduce(function(t,e){return n.hasOwnProperty(e)&&(t[e]=n[e]),t},{})}var K={},H={},Y={},G=new(m.extend({data:function(){return{transports:K,targets:H,sources:Y,trackInstances:x}},methods:{open:function(t){var e,n,r,o;x&&(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"===A(r)?Object.freeze(r):r),order:t},-1===Object.keys(this.transports).indexOf(e)&&m.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,r=t.from;n&&(r||!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){x&&(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){x&&(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}}}))(K),J=1,Q=m.extend({name:"portal",props:{disabled:{type:Boolean},name:{type:String,default:function(){return String(J++)}},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(){G.registerSource(t.name,t)})},mounted:function(){this.disabled||this.sendUpdate()},updated:function(){this.disabled?this.clear():this.sendUpdate()},beforeDestroy:function(){G.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};G.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:W(t),order:this.order},G.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"})}}),X=m.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:G.transports,firstRender:!0}},created:function(){var t=this;this.$nextTick(function(){G.registerTarget(t.name,t)})},watch:{ownTransports:function(){this.$emit("change",0<this.children().length)},name:function(t,e){G.unregisterTarget(e),G.registerTarget(t,this)}},mounted:function(){var t=this;this.transition&&this.$nextTick(function(){t.firstRender=!1})},beforeDestroy:function(){G.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],e="function"==typeof n?n(r):e.passengers;return t.concat(e)},[])}(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)}}),Z=0,tt=["disabled","name","order","slim","slotProps","tag","to"],et=["multiple","transition"],nt=m.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(Z++)}},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,n;"undefined"!=typeof document&&((t=document.querySelector(this.mountTo))?(e=this.$props,G.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=G.targets[e.name]:((e=e.append)&&(n=document.createElement("string"==typeof e?e:"DIV"),t.appendChild(n),t=n),(n=V(this.$props,et)).slim=this.targetSlim,n.tag=this.targetTag,n.slotProps=this.targetSlotProps,n.name=this.to,this.portalTarget=new X({el:t,parent:this.$parent||this,propsData:n}))):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){if(!this.portalTarget)return console.warn("[portal-vue] Target wasn't mounted"),t();if(!this.$scopedSlots.manual){var e=V(this.$props,tt);return t(Q,{props:e,attrs:this.$attrs,on:this.$listeners,scopedSlots:this.$scopedSlots},this.$slots.default)}e=this.$scopedSlots.manual({to:this.to});return(e=Array.isArray(e)?e[0]:e)?e:t()}}),rt=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"]),ot=["history","match","location"],st=["$model"],at=["$sync"],it=["$slots","$scopedSlots","children","on"],ct=["component","on","$slots","$scopedSlots","children","class","style","data-passed-props"],ut=["className","classname"],lt=17<=parseFloat(n.version)?"UNSAFE_":"",pt="vuereact-combined-options";function ft(t){return"string"==typeof t?m.component(t):t}function dt(t){return"function"==typeof t?t.options:t}var ht=function(){l(s,N.Component);var o=g(s);function s(t){i(this,s);var e=o.call(this,t),n=t.history,r=t.match,t=t.location;return t={history:n,match:r,location:t},j.vueInstance?T(t):(j.vueInstance=new m({data:L({},t)}),m.prototype.$reactRouter=j.vueInstance.$data),e}return c(s,[{key:"".concat(lt,"componentWillReceiveProps"),value:function(t){T({history:t.history,match:t.match,location:t.location})}},{key:"render",value:function(){var t=this.props,t=(t.history,t.match,t.location,F(t,ot));return N.createElement(mt,U({},t,{ref:this.props.forwardRef}))}}]),s}(),vt=N.forwardRef(function(t,e){var n=h(t[pt]||{},void 0,!0);return j.withRouter?(vt.RouterTargetComponent||(vt.RouterTargetComponent=j.withRouter(ht)),N.createElement(vt.RouterTargetComponent,U({},L(L({},t),{},u({},pt,n)),{forwardRef:e}))):N.createElement(mt,U({},L(L({},t),{},u({},pt,n)),{ref:e}))}),mt=function(){l(r,N.Component);var n=g(r);function r(t){var e;return i(this,r),(e=n.call(this,t)).state={portals:[]},e.portalKeyPool=[],e.maxPortalCount=0,e.currentVueComponent=ft(t.component),e.createVueInstance=e.createVueInstance.bind(p(e)),e.vueComponentContainer=e.createVueComponentContainer(),e}return c(r,[{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[pt];return t.isSlots?(Object.keys(this.props).forEach(function(t){rt.has(t)&&"function"==typeof e.props[t]&&(n[t]=e.props[t])}),t.vue.slotWrapAttrs&&(n=L(L({},n),t.vue.slotWrapAttrs))):t.vue.componentWrapAttrs&&(n=L(L({},n),t.vue.componentWrapAttrs)),t.vue.componentWrapHOC(N.createElement("div",{ref:this.createVueInstance,key:null}),n)}},{key:"".concat(lt,"componentWillReceiveProps"),value:function(t){var e,n=this,r=t.component,o=(t[pt],t.children),s=t.$slots,t=F(t,["component",pt,"children","$slots"].map(b)),r=ft(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 r=t.$model,e=F(t,st);if(void 0===r)return t;var o,n=L(L({},{prop:"value",event:"input"}),dt(this.currentVueComponent).model),t=u({},n.prop,r.value);return e.on||(e.on={}),e.on[n.event]?(o=e.on[n.event],e.on[n.event]=function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];o.apply(this,e),r.setter&&r.setter.apply(this,e)}):e.on=L(L({},e.on),u({},n.event,r.setter||function(){})),L(L({},e),t)}},{key:"doSync",value:function(t){var s=t.$sync,e=F(t,at);if(void 0===s)return t;var n,a={};for(n in s)(function(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=L(L({},e.on),u({},t,s[r].setter||function(){}))})(n);return L(L({},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){if(t){var e=t;return t=function(){return e}}}},{key:"createVueInstance",value:function(t){var v=this,l=this,e=this.props,n=e.component,r=e["data-passed-props"],o=void 0===r?{}:r,p=e[pt],s=e.children,r=e.$slots,e=F(e,["component","data-passed-props",pt,"children","$slots"].map(b)),s=this.transferChildren(s),r=this.transferSlots(r);s&&(e.children=s),r&&(e.$slots=r);n=ft(n);function a(t){this.vueInstance||(this.vueInstance=t)}a=a.bind(this);var i=L(L({},this.doSync(this.doVModel(e))),{},{"data-passed-props":o}),c=L(L({},_),{},{data:function(){return{reactProps:i}},created:function(){this.reactWrapperRef=l,a(this)},methods:{getNamespaceSlots:function(i,t){var c=this;this.getNamespaceSlots.__namespaceSlots||(this.getNamespaceSlots.__namespaceSlots={});var e,u=Object.assign({},t);for(e in u)(function(t){if(!u.hasOwnProperty(t)||!u[t])return;var e,n,r,o,s,a;"function"==typeof u[t]&&(u[t]=u[t]()),u[t]=(e=u[t],n=t,e.vueSlot||(null!==(r=c.getNamespaceSlots.__namespaceSlots[t])&&void 0!==r&&null!==(o=r[0])&&void 0!==o&&null!==(s=o.child)&&void 0!==s&&s.reactInstance?(a=c.getNamespaceSlots.__namespaceSlots[t],c.$nextTick(function(){a[0].child.reactInstance.setState({children:e})})):(a=[i(E(function(){return e},L(L({},p),{},{isSlots:!0,wrapInstance:l})),{slot:n})],c.getNamespaceSlots.__namespaceSlots[t]=a),a.reactSlot=e,a))})(e);return u},getScopedSlots:function(c,t){var u=this;this.getScopedSlots.__scopeSlots||(this.getScopedSlots.__scopeSlots={});var e,n=L({},t);for(e in n)(function(a){if(!n.hasOwnProperty(a))return;var i,t=n[a];n[a]=(i=t,function(){for(var t,e,n,r=arguments.length,o=new Array(r),s=0;s<r;s++)o[s]=arguments[s];return i.vueFunction?i.vueFunction.apply(u,o):(null!==(t=u.getScopedSlots.__scopeSlots[a])&&void 0!==t&&null!==(e=t.child)&&void 0!==e&&e.reactInstance?(n=u.getScopedSlots.__scopeSlots[a],u.$nextTick(function(){n.child.reactInstance.setState({children:i.apply(u,o)})})):(n=c(E(function(){return i.apply(u,o)},L(L({},p),{},{isSlots:!0,wrapInstance:l}))),u.getScopedSlots.__scopeSlots[a]=n),n)}),n[a].reactFunction=t})(e);return n},getChildren:function(t,e){var n,r,o,s;if(null!=e)return(e="function"==typeof e?e():e).vueSlot?e.vueSlot:(null!==(n=this.getChildren.__vnode)&&void 0!==n&&null!==(r=n[0])&&void 0!==r&&null!==(o=r.child)&&void 0!==o&&o.reactInstance?(s=this.getChildren.__vnode,this.$nextTick(function(){s[0].child.reactInstance.setState({children:e})})):(s=[t(E(function(){return e},L(L({},p),{},{isSlots:!0,wrapInstance:l})))],this.getChildren.__vnode=s),s.reactSlot=e,s)}},mounted:function(){l.vueRef=this.$children[0],this.$children[0].reactWrapperRef=l},beforeDestroy:function(){l.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.children,e.class),a=void 0===s?"":s,i=e.style,c=void 0===i?"":i,u=e["data-passed-props"],l=u.$slots,p=u.$scopedSlots,s=u.children,i=u.on,u=F(u,it),f=F(e,ct);!function(t,e){if(!t)return;if(!e)return;for(var n in t)t.hasOwnProperty(n)&&e[n]&&delete t[n]}(p,l);var o=this.getScopedSlots(t,L(L({},p),o)),s=this.getChildren(t,this.reactProps.children||s),d=this.getNamespaceSlots(t,L(L({},l),r));s&&(d.default=s);var l=[s||[]].concat(S(Object.keys(d).map(function(t){if("default"!==t)return d[t]}))),r=L(L({},i),n),h={};Object.keys(f).forEach(function(t){rt.has(t)&&"function"==typeof f[t]&&(h[t.replace(/^on/,"").toLowerCase()]=f[t],delete f[t])});i=L(L(L({},u),f),{},{"data-passed-props":L(L(L({},u),f),{},{on:r,children:s,$slots:d,$scopedSlots:o})}),n=function(t){var e=[],n={},r=dt(v.currentVueComponent);r.mixins&&r.mixins.forEach(function(t){t.props&&(t.props instanceof Array?e=S(t.props):n=L({},t.props))});var o=Object.assign({},t),r=r.props;if(r)if(r instanceof Array)[].concat(S(r),S(e)).forEach(function(t){delete o[t]});else{var s,a=L(L({},r),n);for(s in a)a.hasOwnProperty(s)&&delete o[s]}return o}(L({},i)),u=n.className,s=n.classname,n=F(n,ut);return t("use_vue_wrapper",{props:i,on:r,nativeOn:h,attrs:n,class:a||u||s||"",style:c,scopedSlots:L({},o)},l)},components:{use_vue_wrapper:n}});if(t){var u="__vue_wrapper_container_"+(Math.random()+"").substr(2);t.id=u;var f=p.wrapInstance;if(f)(f=p.wrapInstance).reactWrapperRef=l;else for(var d,h=(this._reactInternals||this._reactInternalFiber).return;h;){if(null!==(d=h.stateNode)&&void 0!==d&&d.parentVueWrapperRef){f=h.stateNode.parentVueWrapperRef;break}if(null!==(d=h.stateNode)&&void 0!==d&&d.vueWrapperRef){f=h.stateNode.vueWrapperRef;break}h=h.return}if(f&&document.getElementById(u))return this.parentVueWrapperRef=f,this.vuePortal=function(t,e){return t(nt,{props:{mountTo:"#"+u,slim:!0,targetSlim:!0},key:u},[t(Object.assign(c,{router:v._router}))])},void f.pushVuePortal(this.vuePortal);this.vueInstance=new m(L(L({},c),{},{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 N.createElement(this.vueComponentContainer,{portals:this.state.portals})}}]),r}();function yt(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),N.forwardRef(function(t,e){return N.createElement(vt,U({},t,{component:n,ref:e},u({},pt,r)))})}var gt,St,bt=function(){function n(t){var e=this;if(i(this,n),!t||!t.subscribe||!t.getState)throw Error("incorrect store passed in, please check the function applyRedux's parameter must contains redux store");(this.store=t).subscribe(function(){e._vm.state=t.getState()}),this._vm=new m({data:function(){return{state:t.getState()}}})}return c(n,[{key:"state",get:function(){return this._vm.state}},{key:"dispatch",get:function(){return this.store.dispatch}}]),n}();function _t(t){var e=t.store,t=t.ReactReduxContext;return gt||(gt=new bt(e),t&&(gt.ReactReduxContext=t),m.prototype.$redux=gt)}function $t(t){St=t}var Rt={};var wt=E,Ot=yt,Pt=_t,Ct=$t;t.REACT_ALL_HANDLERS=rt,t.VueContainer=vt,t.applyReactInVue=E,t.applyReactRouterInVue=function(t){return j.withRouter||(j.withRouter=t,j.withRouter)},t.applyRedux=_t,t.applyVueInReact=yt,t.applyVuex=$t,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===(t=t.mapDispatchToProps)?function(t){}:t;return function(t){var n=function(){l(n,N.Component);var e=g(n);function n(t){if(i(this,n),t=e.call(this,t),!((St=_.store?_.store:St)&&St.state&&St.subscribe&&St.dispatch&&St.commit))throw Error("[vuereact-combined warn]Error: incorrect store passed in, please check the function applyVuex's parameter must be vuex store");return t.state=L(L({},r(St.state)),o(St.getters)),t}return c(n,[{key:"componentDidMount",value:function(){var e=this;this.watch=St.watch(function(){return L(L({},r(St.state)),o(St.getters))},function(t){e.setState(t)},{deep:!0})}},{key:"componentWillUnmount",value:function(){this.watch()}},{key:"render",value:function(){return N.createElement(t,U({},this.props,L(L(L({},this.state),s(St.commit)),a(St.dispatch)),{ref:this.props.forwardedRef}))}}]),n}();return N.forwardRef(function(t,e){return N.createElement(n,U({forwardedRef:e},t))})}},t.lazyReactInVue=function(t,e){return function(){return t().then(function(t){return E(t.default,e)})}},t.lazyVueInReact=function(t,e){return n.lazy(function(){return t().then(function(t){return{default:yt(t.default,e)}})})},t.useReactInVue=wt,t.useRedux=Pt,t.useVueInReact=Ot,t.useVuex=Ct,t.vueRootInfo=_,t.withVueRouter=function(t){var n=function(){l(n,N.Component);var e=g(n);function n(t){if(i(this,n),t=e.call(this,t),!Rt.instance){if(!_.router)throw Error("Vue router does not exist! You must setting the Vue router in the Vue Instance options first.");Rt.instance=new m({router:_.router})}return t.state={$vueRouter:Rt.instance.$router,$vueRoute:Rt.instance.$route},t}return c(n,[{key:"componentDidMount",value:function(){var t=this;this.subscribe=Rt.instance.$watch("$route",function(){t.setState({$vueRouter:Rt.instance.$router,$vueRoute:Rt.instance.$route})})}},{key:"componentWillUnmount",value:function(){this.subscribe()}},{key:"render",value:function(){return N.createElement(t,U({},this.props,this.state,{ref:this.props.forwardedRef}))}}]),n}();return N.forwardRef(function(t,e){return N.createElement(n,U({forwardedRef:e},t))})},Object.defineProperty(t,"__esModule",{value:!0})});