UNPKG

@quick-tv/react

Version:

QuickTV react framework

1 lines 68 kB
import e from"@hippy/react-reconciler";import t from"react";global.__GLOBAL__||(global.__GLOBAL__={nodeId:0}),global.__GLOBAL__.nodeId=0,global.__GLOBAL__.animationId=0;const{asyncStorage:n,bridge:i,device:o,document:r,register:a,on:s,off:l,emit:c}=global.Hippy;var d=Object.freeze({__proto__:null,addEventListener:s,removeEventListener:l,dispatchEvent:c,AsyncStorage:n,Bridge:i,Device:o,HippyRegister:a,UIManager:r});var u=Object.freeze({__proto__:null,getString:function(){return i.callNativeWithPromise("ClipboardModule","getString")},setString:function(e){i.callNative("ClipboardModule","setString",e)}});var h=Object.freeze({__proto__:null,getCookies:function(e){return i.callNativeWithPromise("network","getCookie",e)},setCookie:function(e,t,n){let o="";"string"==typeof n&&(o=n),n instanceof Date&&(o=n.toUTCString()),i.callNative("network","setCookie",e,t,o)}});function p(e){return i.callNativeWithPromise("ImageLoaderModule","getSize",e)}function f(e){i.callNative("ImageLoaderModule","prefetch",e)}var m=Object.freeze({__proto__:null,getSize:p,prefetch:f});let y,g;const b=new Map;function v(e,t){g=e,y=t}function w(){if(!g)throw new Error("getRootViewId must execute after setRootContainer");return g}function C(e){if(!y)return null;const{current:t}=y,n=[t];for(;n.length;){const t=n.shift();if(!t)break;if(e(t))return t;t.child&&n.push(t.child),t.sibling&&n.push(t.sibling)}return null}function E(e,t){b.set(t,e)}function A(e){b.delete(e)}function N(e){return(null==e?void 0:e.stateNode)||null}function I(e){return b.get(e)||null}function k(e){!function(e,t){if(!global.requestIdleCallback)return setTimeout((()=>{e({didTimeout:!1,timeRemaining:()=>1/0})}),1);global.requestIdleCallback(e,t)}((t=>{(t.timeRemaining()>0||t.didTimeout)&&S(e)}),{timeout:50})}function S(e){"number"==typeof e?A(e):e&&(A(e.nodeId),Array.isArray(e.childNodes)&&e.childNodes.forEach((e=>S(e))))}const x={onTouchStart:["onTouchStart","onTouchDown"],onPress:["onPress","onClick"]},L=new RegExp(/^\d+$/);let R=!1,P=!1;function O(...e){z()&&!R&&console.log(...e)}function F(...e){z()&&console.warn(...e)}function T(e){return e.replace(/\\u[\dA-F]{4}|\\x[\dA-F]{2}/gi,(e=>String.fromCharCode(parseInt(e.replace(/\\u|\\x/g,""),16))))}const H=new RegExp("^on.+Capture$");const _=new RegExp("^(?=.+)[+-]?\\d*\\.?\\d*([Ee][+-]?\\d+)?$");function M(e){return"[object Function]"===Object.prototype.toString.call(e)}function j(e){R=e}function z(){return"production"!==process.env.NODE_ENV}function $(){return P}function D(e){if(e&&!/^(http|https):\/\//.test(e)&&e.indexOf("assets")>-1){if(z()){return`${"http://"}127.0.0.1:${process.env.PORT}/${e}`}return`${"hpfile://"}./${e}`}return e}function V(e){return 5===e}function W(e,t=new WeakMap){if("object"!=typeof e||null===e)throw new TypeError("deepCopy data is object");if(t.has(e))return t.get(e);const n={};return Object.keys(e).forEach((i=>{const o=e[i];"object"!=typeof o||null===o?n[i]=o:Array.isArray(o)?n[i]=[...o]:o instanceof Set?n[i]=new Set([...o]):o instanceof Map?n[i]=new Map([...o]):(t.set(e,e),n[i]=W(o,t))})),n}class B{constructor(e){this.handlerContainer={},this.nextIdForHandler=0,this.eventName=e}getEventListeners(){return Object.keys(this.handlerContainer).filter((e=>this.handlerContainer[e])).map((e=>this.handlerContainer[e]))}getHandlerSize(){return Object.keys(this.handlerContainer).length}addEventHandler(e,t){if(!e)throw new TypeError("Invalid arguments for addEventHandler");const n=this.nextIdForHandler;this.nextIdForHandler+=1;const i={id:n,eventHandler:e,context:t},o=`eventHandler_${n}`;return this.handlerContainer[o]=i,n}notifyEvent(...e){Object.keys(this.handlerContainer).forEach((t=>{const n=this.handlerContainer[t];n&&n.eventHandler&&(n.context?n.eventHandler.call(n.context,...e):n.eventHandler(...e))}))}removeEventHandler(e){if("number"!=typeof e)throw new TypeError("Invalid arguments for removeEventHandler");const t=`eventHandler_${e}`;this.handlerContainer[t]&&delete this.handlerContainer[t]}}class U{constructor(e,t,n){this.type=e,this.bubbles=!0,this.timeStamp=Date.now(),this.currentTarget=t,this.target=n}stopPropagation(){this.bubbles=!1}preventDefault(){}}const q=new Map,K=["%c[event]%c","color: green","color: auto"];function G(e,t){let n=e;if(t.memoizedProps&&!t.memoizedProps[e]){const i=Object.keys(x);for(let o=0;o<i.length;o+=1){const r=i[o],a=x[r];if(t.memoizedProps[r]&&e===a[1]){n=r;break}}}return n}function Y(e,t){return!(!t.memoizedProps||"function"!=typeof t.memoizedProps[e])}function X(e){if("string"!=typeof e)throw new TypeError(`Invalid eventName for getHippyEventHub: ${e}`);return q.get(e)||null}const J={registerNativeEventHub:function(e){if(O(...K,"registerNativeEventHub",e),"string"!=typeof e)throw new TypeError(`Invalid eventName for registerNativeEventHub: ${e}`);let t=q.get(e);return t||(t=new B(e),q.set(e,t)),t},getHippyEventHub:X,unregisterNativeEventHub:function(e){if("string"!=typeof e)throw new TypeError(`Invalid eventName for unregisterNativeEventHub: ${e}`);q.has(e)&&q.delete(e)},receiveNativeEvent:function(e){if(O(...K,"receiveNativeEvent",e),!e||!Array.isArray(e)||e.length<2)throw new TypeError(`Invalid params for receiveNativeEvent: ${JSON.stringify(e)}`);const[t,n]=e;if("string"!=typeof t)throw new TypeError("Invalid arguments for nativeEvent eventName");const i=X(t);i&&i.notifyEvent(n)},receiveNativeGesture:function(e){if(O(...K,"receiveNativeGesture",e),!e)return;const{id:t}=e,n=I(t);if(!n)return;let i=!0,{name:o}=e;o=G(o,n);const r=`${o}Capture`,a=n;n.memoizedProps&&"function"!=typeof n.memoizedProps[r]&&(i=!1),i?function(e,t,n){const i=[];let o=n,r=e;for(;o;){r=G(r,o);const e=`${r}Capture`;if(Y(e,o)&&i.unshift({eventName:e,listener:o.memoizedProps[e],isCapture:!0,currentTarget:N(o)}),Y(r,o)&&i.push({eventName:r,listener:o.memoizedProps[r],isCapture:!1,currentTarget:N(o)}),0===i.length)o=null;else for(o=o.return;o&&!V(o.tag);)o=o.return}if(i.length>0){let e,o=!1;const r=N(n);for(;!o&&void 0!==(e=i.shift());)try{const{eventName:n,currentTarget:i,listener:a,isCapture:s}=e,l=new U(n,i,r);Object.assign(l,t),s?(a(l),l.bubbles||(o=!0)):(o=a(l),"boolean"!=typeof o&&(o=!$()),l.bubbles||(o=!0))}catch(e){console.error(e)}}}(o,e,a):function(e,t,n){let i=!1,o=n,r=e;const a=N(n);do{if(r=G(r,o),Y(r,o))try{const e=N(o),n=new U(r,e,a);Object.assign(n,t),i=o.memoizedProps[r](n),"boolean"!=typeof i&&(i=!$()),n.bubbles||(i=!0)}catch(e){console.error(e)}if(!1===i)for(o=o.return;o&&!V(o.tag);)o=o.return}while(!i&&o)}(o,e,a)},receiveUIComponentEvent:function(e){if(O(...K,"receiveUIComponentEvent",e),!e||!Array.isArray(e)||e.length<2)return;const[t,n,i]=e;if("number"!=typeof t||"string"!=typeof n)return;const o=I(t);o&&Y(n,o)&&o.memoizedProps[n](i)}};global.__GLOBAL__&&(global.__GLOBAL__.jsModuleList.EventDispatcher=J);class Q{constructor(e,t){this.callback=e,this.bindListener=t}remove(){"number"==typeof this.callback&&this.bindListener&&(this.bindListener.removeCallback(this.callback),this.bindListener=void 0)}}class Z{constructor(e){this.eventName=e,this.listenerIdList=[]}unregister(){const e=J.getHippyEventHub(this.eventName);if(!e)throw new ReferenceError(`No listeners for ${this.eventName}`);const t=this.listenerIdList.length;for(let n=0;n<t;n+=1)e.removeEventHandler(this.listenerIdList[n]);this.listenerIdList=[],0===e.getHandlerSize()&&J.unregisterNativeEventHub(this.eventName)}getSize(){return this.listenerIdList.length}addCallback(e,t){if("function"!=typeof e)throw new TypeError("Invalid addCallback function arguments");const n=J.registerNativeEventHub(this.eventName);if(!n)throw new ReferenceError(`No listeners for ${this.eventName}`);const i=n.addEventHandler(e,t);if("number"!=typeof i)throw new Error("Fail to addEventHandler in addCallback function");return this.listenerIdList.push(i),i}removeCallback(e){if("number"!=typeof e)throw new TypeError("Invalid arguments for removeCallback");const t=J.getHippyEventHub(this.eventName);if(!t)throw new ReferenceError(`No listeners for ${this.eventName}`);t.removeEventHandler(e);const n=this.listenerIdList.length;for(let t=0;t<n;t+=1)if(e===this.listenerIdList[t]){this.listenerIdList.splice(t,1);break}}}const ee=Z;function te(e){if("string"!=typeof e)throw new TypeError("Invalid arguments for getNameForEvent");return`eventEmitter_${e}`}class ne{constructor(e){this.hippyEventListeners=e&&"object"==typeof e?e:{}}sharedListeners(){return this.hippyEventListeners}addListener(e,t,n){if("string"!=typeof e||"function"!=typeof t)throw new TypeError("Invalid arguments for addListener");let i=this.hippyEventListeners[te(e)];i||(i=new Z(e),this.hippyEventListeners[te(e)]=i);const o=i.addCallback(t,n);if("number"!=typeof o)throw new Error("Fail to addCallback in addListener");return new Q(o,i)}removeAllListeners(e){if("string"!=typeof e)throw new TypeError("Invalid arguments for removeAllListeners");const t=this.hippyEventListeners[te(e)];t&&(t.unregister(),delete this.hippyEventListeners[te(e)])}emit(e,t){if("string"!=typeof e)return!1;const n=J.getHippyEventHub(e);return!!n&&(n.notifyEvent(t),!0)}listenerSize(e){if("string"!=typeof e)throw new TypeError("Invalid arguments for listenerSize");const t=this.hippyEventListeners[te(e)];return t?t.getSize():0}}ne.emit=ne.prototype.emit;const ie=ne,oe={};function re(e,t,n){oe[e]||(oe[e]={eventListener:new Z(e),eventMap:new Map});const{eventListener:i,eventMap:o}=oe[e],r=i.addCallback(t,n);if("number"!=typeof r)throw new Error("Fail to addCallback in addListener");o.set(t,r)}function ae(e,t){const n=oe[e];if(!n)return F(`Event [${e}] has not been registered yet in EventBus`);const{eventListener:i,eventMap:o}=n;if(t){const n=o.get(t);if("number"!=typeof n)return F(`The listener for event [${e}] cannot be found to remove`);i.removeCallback(n),o.delete(t),0===o.size&&delete oe[e]}else i.unregister(),o.clear(),delete oe[e]}const se={on:(e,t,n)=>{if("string"!=typeof e&&!Array.isArray(e)||"function"!=typeof t)throw new TypeError("Invalid arguments for EventBus.on()");return Array.isArray(e)?e.forEach((e=>{re(e,t,n)})):re(e,t,n),se},off:(e,t)=>{if("string"!=typeof e&&!Array.isArray(e))throw new TypeError("The event argument is not string or array for EventBus.off()");return Array.isArray(e)?e.forEach((e=>{ae(e,t)})):ae(e,t),se},sizeOf(e){if("string"!=typeof e)throw new TypeError("The event argument is not string for EventBus.sizeOf()");const t=oe[e];return(null==t?void 0:t.eventMap)?t.eventMap.size:0},emit(e,...t){if("string"!=typeof e)throw new TypeError("The event argument is not string for EventBus.emit()");const n=J.getHippyEventHub(e);return n?(n.notifyEvent(...t),se):(F(`Event [${e}] has not been registered yet in EventBus`),se)}},le="networkStatusDidChange",ce=new Map,de=new ne;class ue{constructor(e,t){this.eventName=e,this.listener=t}remove(){this.eventName&&this.listener&&(he(this.eventName,this.listener),this.listener=void 0)}}function he(e,t){if(t instanceof ue)return void t.remove();let n=e;"change"===e&&(n=le);const o=ce.get(t);if(!o)return;o.remove(),ce.delete(t);de.listenerSize(n)<1&&i.callNative("NetInfo","removeListener",n)}var pe,fe=Object.freeze({__proto__:null,addEventListener:function(e,t){let n=e;n&&"change"===n&&(n=le),de.listenerSize(n)<1&&i.callNative("NetInfo","addListener",n);const o=de.addListener(n,(e=>{t(e)}));return ce.set(t,o),new ue(n,t)},removeEventListener:he,fetch:function(){return i.callNativeWithPromise("NetInfo","getCurrentConnectivity").then((e=>e.network_info))}});function me(e){return"loop"===e?-1:e}!function(e){e.android="android",e.ios="ios"}(pe||(pe={}));const ye=new ne;function ge(e,t){return"color"===e&&["number","string"].indexOf(typeof t)>=0?Mt(t):t}class be{constructor(e){var t;let n=0;if((null===(t=e.startValue)||void 0===t?void 0:t.constructor)&&"Animation"===e.startValue.constructor.name)n={animationId:e.startValue.animationId};else{const{startValue:t}=e;n=ge(e.valueType,t)}const i=ge(e.valueType,e.toValue);this.mode=e.mode||"timing",this.delay=e.delay||0,this.startValue=n||0,this.toValue=i||0,this.valueType=e.valueType||void 0,this.duration=e.duration||0,this.direction=e.direction||"center",this.timingFunction=e.timingFunction||"linear",this.repeatCount=me(e.repeatCount||0),this.inputRange=e.inputRange||[],this.outputRange=e.outputRange||[],this.animationId=Et.callNativeWithCallbackId("AnimationModule","createAnimation",!0,this.mode,Object.assign({delay:this.delay,startValue:this.startValue,toValue:this.toValue,duration:this.duration,direction:this.direction,timingFunction:this.timingFunction,repeatCount:this.repeatCount,inputRange:this.inputRange,outputRange:this.outputRange},this.valueType?{valueType:this.valueType}:{})),this.destroy=this.destroy.bind(this),this.onRNfqbAnimationStart=this.onAnimationStart.bind(this),this.onRNfqbAnimationEnd=this.onAnimationEnd.bind(this),this.onRNfqbAnimationCancel=this.onAnimationCancel.bind(this),this.onRNfqbAnimationRepeat=this.onAnimationRepeat.bind(this),this.onHippyAnimationStart=this.onAnimationStart.bind(this),this.onHippyAnimationEnd=this.onAnimationEnd.bind(this),this.onHippyAnimationCancel=this.onAnimationCancel.bind(this),this.onHippyAnimationRepeat=this.onAnimationRepeat.bind(this)}removeEventListener(){this.animationStartListener&&this.animationStartListener.remove(),this.animationEndListener&&this.animationEndListener.remove(),this.animationCancelListener&&this.animationCancelListener.remove(),this.animationRepeatListener&&this.animationRepeatListener.remove()}start(){this.removeEventListener();let e="onAnimation";__PLATFORM__!==pe.android&&At.platform.OS!==pe.android||(e="onHippyAnimation"),"function"==typeof this.onAnimationStartCallback&&(this.animationStartListener=ye.addListener(`${e}Start`,(e=>{e===this.animationId&&(this.animationStartListener.remove(),"function"==typeof this.onAnimationStartCallback&&this.onAnimationStartCallback())}))),"function"==typeof this.onAnimationEndCallback&&(this.animationEndListener=ye.addListener(`${e}End`,(e=>{e===this.animationId&&(this.animationEndListener.remove(),"function"==typeof this.onAnimationEndCallback&&this.onAnimationEndCallback())}))),"function"==typeof this.onAnimationCancelCallback&&(this.animationCancelListener=ye.addListener(`${e}Cancel`,(e=>{e===this.animationId&&(this.animationCancelListener.remove(),"function"==typeof this.onAnimationCancelCallback&&this.onAnimationCancelCallback())}))),"function"==typeof this.onAnimationRepeatCallback&&(this.animationRepeatListener=ye.addListener(`${e}Repeat`,(e=>{e===this.animationId&&"function"==typeof this.onAnimationRepeatCallback&&this.onAnimationRepeatCallback()}))),Et.callNative("AnimationModule","startAnimation",this.animationId)}destory(){F("Animation.destory() method will be deprecated soon, please use Animation.destroy() as soon as possible"),this.destroy()}destroy(){this.removeEventListener(),Et.callNative("AnimationModule","destroyAnimation",this.animationId)}pause(){Et.callNative("AnimationModule","pauseAnimation",this.animationId)}resume(){Et.callNative("AnimationModule","resumeAnimation",this.animationId)}updateAnimation(e){if("object"!=typeof e)throw new TypeError("Invalid arguments");if("string"==typeof e.mode&&e.mode!==this.mode)throw new TypeError("Update animation mode not supported");Object.keys(e).forEach((t=>{const n=e[t];if("startValue"===t){let t=0;if(e.startValue instanceof be)t={animationId:e.startValue.animationId};else{const{startValue:n}=e;t=ge(this.valueType,n)}this.startValue=t||0}else"repeatCount"===t?this.repeatCount=me(e.repeatCount||0):Object.defineProperty(this,t,{value:n})})),Et.callNative("AnimationModule","updateAnimation",this.animationId,Object.assign({delay:this.delay,startValue:this.startValue,toValue:ge(this.valueType,this.toValue),duration:this.duration,direction:this.direction,timingFunction:this.timingFunction,repeatCount:this.repeatCount,inputRange:this.inputRange,outputRange:this.outputRange},this.valueType?{valueType:this.valueType}:{}))}onAnimationStart(e){this.onAnimationStartCallback=e}onAnimationEnd(e){this.onAnimationEndCallback=e}onAnimationCancel(e){this.onAnimationCancelCallback=e}onAnimationRepeat(e){this.onAnimationRepeatCallback=e}}const ve=new ne;class we{constructor(e){this.animationList=[],e.children.forEach((e=>{this.animationList.push({animationId:e.animation.animationId,follow:e.follow||!1})})),this.animationId=Et.callNativeWithCallbackId("AnimationModule","createAnimationSet",!0,{repeatCount:me(e.repeatCount||0),children:this.animationList}),this.onRNfqbAnimationStart=this.onAnimationStart.bind(this),this.onRNfqbAnimationEnd=this.onAnimationEnd.bind(this),this.onRNfqbAnimationCancel=this.onAnimationCancel.bind(this),this.onRNfqbAnimationRepeat=this.onAnimationRepeat.bind(this),this.onHippyAnimationStart=this.onAnimationStart.bind(this),this.onHippyAnimationEnd=this.onAnimationEnd.bind(this),this.onHippyAnimationCancel=this.onAnimationCancel.bind(this),this.onHippyAnimationRepeat=this.onAnimationRepeat.bind(this)}removeEventListener(){this.animationStartListener&&this.animationStartListener.remove(),this.animationEndListener&&this.animationEndListener.remove(),this.animationCancelListener&&this.animationCancelListener.remove(),this.animationRepeatListener&&this.animationRepeatListener.remove()}start(){this.removeEventListener();let e="onAnimation";__PLATFORM__!==pe.android&&At.platform.OS!==pe.android||(e="onHippyAnimation"),"function"==typeof this.onAnimationStartCallback&&(this.animationStartListener=ve.addListener(`${e}Start`,(e=>{e===this.animationId&&(this.animationStartListener.remove(),"function"==typeof this.onAnimationStartCallback&&this.onAnimationStartCallback())}))),"function"==typeof this.onAnimationEndCallback&&(this.animationEndListener=ve.addListener(`${e}End`,(e=>{e===this.animationId&&(this.animationEndListener.remove(),"function"==typeof this.onAnimationEndCallback&&this.onAnimationEndCallback())}))),"function"==typeof this.onAnimationCancelCallback&&(this.animationCancelListener=ve.addListener(`${e}Cancel`,(e=>{e===this.animationId&&(this.animationCancelListener.remove(),"function"==typeof this.onAnimationCancelCallback&&this.onAnimationCancelCallback())}))),"function"==typeof this.onAnimationRepeatCallback&&(this.animationRepeatListener=ve.addListener(`${e}Repeat`,(e=>{e===this.animationId&&"function"==typeof this.onAnimationRepeatCallback&&this.onAnimationRepeatCallback()}))),Et.callNative("AnimationModule","startAnimation",this.animationId)}destory(){F("AnimationSet.destory() method will be deprecated soon, please use Animation.destroy() as soon as possible"),this.destroy()}destroy(){this.removeEventListener(),this.animationList.forEach((e=>Number.isInteger(e.animationId)&&Et.callNative("AnimationModule","destroyAnimation",e.animationId))),Et.callNative("AnimationModule","destroyAnimation",this.animationId)}pause(){Et.callNative("AnimationModule","pauseAnimation",this.animationId)}resume(){Et.callNative("AnimationModule","resumeAnimation",this.animationId)}onAnimationStart(e){this.onAnimationStartCallback=e}onAnimationEnd(e){this.onAnimationEndCallback=e}onAnimationCancel(e){this.onAnimationCancelCallback=e}onAnimationRepeat(e){this.onAnimationRepeatCallback=e}}const Ce=["%c[native]%c","color: red","color: auto"],Ee={createNode:Symbol("createNode"),updateNode:Symbol("updateNode"),deleteNode:Symbol("deleteNode")};let Ae=!0,Ne=[];function Ie(e){const t=function(e){const t=[];for(let n=0;n<e.length;n+=1){const i=e[n],{type:o,nodes:r}=i,a=t[t.length-1];a&&a.type===o?a.nodes=a.nodes.concat(r):t.push({type:o,nodes:r})}return t}(Ne);t.forEach((t=>{switch(t.type){case Ee.createNode:O(...Ce,"createNode",t.nodes),qe(e,t.nodes);break;case Ee.updateNode:O(...Ce,"updateNode",t.nodes),__PLATFORM__===pe.ios||o.platform.OS===pe.ios?t.nodes.forEach((t=>Ke(e,[t]))):Ke(e,t.nodes);break;case Ee.deleteNode:O(...Ce,"deleteNode",t.nodes),__PLATFORM__===pe.ios||o.platform.OS===pe.ios?t.nodes.forEach((t=>Ge(e,[t]))):Ge(e,t.nodes)}}))}function ke(e=!1){if(!Ae)return;if(Ae=!1,0===Ne.length)return void(Ae=!0);const t=w();Xe(),e?(Ie(t),Je(),Ne=[],Ae=!0):Promise.resolve().then((()=>{Ie(t),Je(),Ne=[],Ae=!0}))}function Se(e){const{children:t,...n}=e.attributes;return n}function xe(e){try{const t=W(e.attributes),{id:n,nodeId:i}=e,o={id:n,hippyNodeId:`${i}`,...t};return delete o.text,delete o.value,o}catch(e){return F("getTargetNodeAttributes error:",e),{}}}function Le(e,t){var n;if(!t.nativeName)return F("Component need to define the native name",t),null;if(t.meta.skipAddToDom)return null;if(!t.meta.component)throw new Error(`Specific tag is not supported yet: ${t.tagName}`);const i={id:t.nodeId,pId:(null===(n=t.parentNode)||void 0===n?void 0:n.nodeId)||e,index:t.index,name:t.nativeName,props:{...Se(t),style:t.style},tagName:t.nativeName};return z()&&(i.props.attributes=xe(t)),i}function Re(e,t,n,i){const o=[];let r=n;return void 0===r&&t&&t.parentNode&&(r=t.parentNode.childNodes.indexOf(t)),t.traverseChildren((t=>{const n=Le(e,t);n&&o.push(n),"function"==typeof i&&i(t)}),r),o}function Pe(e){return!!y&&e instanceof y.containerInfo.constructor}function Oe(e,t,n=-1){if(!e||!t)return;if(t.meta.skipAddToDom)return;const i=w(),o=Pe(e)&&!e.isMounted,r=e.isMounted&&!t.isMounted;if(o||r){const e=Re(i,t,n,(e=>{e.isMounted||(e.isMounted=!0)}));Ne.push({type:Ee.createNode,nodes:e})}}function Fe(e,t,n){if(!t||t.meta.skipAddToDom)return;t.isMounted=!1,t.index=n;const i=w(),o=[{id:t.nodeId,pId:t.parentNode?t.parentNode.nodeId:i,index:t.index}];Ne.push({type:Ee.deleteNode,nodes:o})}function Te(e){if(!e.isMounted)return;const t=Le(w(),e);t&&Ne.push({type:Ee.updateNode,nodes:[t]})}let He=0;class _e{constructor(){this.meta={component:{}},this.index=0,this.childNodes=[],this.parentNode=null,this.mounted=!1,this.nodeId=(He+=1,He%10==0&&(He+=1),He)}toString(){return this.constructor.name}get isMounted(){return this.mounted}set isMounted(e){this.mounted=e}insertBefore(e,t){if(!e)throw new Error("Can't insert child.");if(e.meta.skipAddToDom)return;if(!t)return this.appendChild(e);if(t.parentNode!==this)throw new Error("Can't insert child, because the reference node has a different parent.");if(e.parentNode&&e.parentNode!==this)throw new Error("Can't insert child, because it already has a different parent.");const n=this.childNodes.indexOf(t);return e.parentNode=this,this.childNodes.splice(n,0,e),Oe(this,e,n)}moveChild(e,t){if(!e)throw new Error("Can't move child.");if(e.meta.skipAddToDom)return;if(!t)return this.appendChild(e);if(t.parentNode!==this)throw new Error("Can't move child, because the reference node has a different parent.");if(e.parentNode&&e.parentNode!==this)throw new Error("Can't move child, because it already has a different parent.");const n=this.childNodes.indexOf(e);if(this.childNodes.indexOf(t)===n)return e;this.childNodes.splice(n,1),Fe(0,e,n);const i=this.childNodes.indexOf(t);return this.childNodes.splice(i,0,e),Oe(this,e,i)}appendChild(e){if(!e)throw new Error("Can't append child.");if(!e.meta.skipAddToDom){if(e.parentNode&&e.parentNode!==this)throw new Error("Can't append child, because it already has a different parent.");e.parentNode=this,this.childNodes.push(e),Oe(this,e,this.childNodes.length-1)}}removeChild(e){if(!e)throw new Error("Can't remove child.");if(e.meta.skipAddToDom)return;if(!e.parentNode)throw new Error("Can't remove child, because it has no parent.");if(e.parentNode!==this)throw new Error("Can't remove child, because it has a different parent.");const t=this.childNodes.indexOf(e);this.childNodes.splice(t,1),Fe(0,e,t)}findChild(e){if(e(this))return this;if(this.childNodes.length)for(let t=0;t<this.childNodes.length;t+=1){const n=this.childNodes[t],i=this.findChild.call(n,e);if(i)return i}return null}traverseChildren(e,t=0){this.index=this.parentNode?t:0,e(this),this.childNodes.length&&this.childNodes.forEach(((t,n)=>{this.traverseChildren.call(t,e,n)}))}}const Me={textDecoration:"textDecorationLine",boxShadowOffset:"shadowOffset",boxShadowOffsetX:"shadowOffsetX",boxShadowOffsetY:"shadowOffsetY",boxShadowOpacity:"shadowOpacity",boxShadowRadius:"shadowRadius",boxShadowSpread:"shadowSpread",boxShadowColor:"shadowColor"},je={totop:"0",totopright:"totopright",toright:"90",tobottomright:"tobottomright",tobottom:"180",tobottomleft:"tobottomleft",toleft:"270",totopleft:"totopleft"},ze="turn",$e="rad",De="deg";function Ve(e){const t=(e||"").replace(/\s*/g,"").toLowerCase(),n=/^([+-]?(?=(?<digit>\d+))\k<digit>\.?\d*)+(deg|turn|rad)|(to\w+)$/g.exec(t);if(!Array.isArray(n))return;let i="180";const[o,r,a]=n;return r&&a?i=function(e,t=De){const n=parseFloat(e);let i=e||"";const[,o]=e.split(".");switch(o&&o.length>2&&(i=n.toFixed(2)),t){case ze:i=`${(360*n).toFixed(2)}`;break;case $e:i=`${(180/Math.PI*n).toFixed(2)}`}return i}(r,a):o&&void 0!==je[o]?i=je[o]:F("linear-gradient direction or angle is invalid, default value [to bottom] would be used"),i}function We(e){const t=(e||"").replace(/\s+/g," ").trim(),[n,i]=t.split(/\s+(?![^(]*?\))/),o=/^([+-]?\d+\.?\d*)%$/g;return!n||o.exec(n)||i?n&&o.exec(i)?{ratio:parseFloat(i.split("%")[0])/100,color:Mt(n)}:void F("linear-gradient color stop is invalid"):{color:Mt(n)}}function Be(e){var t;return t=e,H.test(t)&&(e=e.replace("Capture","")),x[e]?x[e][1]:e}class Ue extends _e{constructor(e){super(),this.id="",this.style={},this.attributes={},this.events={},this.tagName=e}get nativeName(){return this.meta.component.name}toString(){return`${this.tagName}:(${this.nativeName})`}hasAttribute(e){return!!this.attributes[e]}getAttribute(e){return this.attributes[e]}setStyleAttribute(e){this.style={};let t=e;if(!Array.isArray(t)&&Object.hasOwnProperty.call(t,0)){const e=[],n={};Object.keys(t).forEach((i=>{var o;o=i,L.test(o)?e.push(t[i]):n[i]=t[i]})),t=[...e,n]}Array.isArray(t)||(t=[t]);let n={};t.forEach((e=>{Array.isArray(e)?e.forEach((e=>{n={...n,...e}})):"object"==typeof e&&e&&(n={...n,...e})})),Object.keys(n).forEach((e=>{const t=n[e];if(Object.prototype.hasOwnProperty.call(Me,e)&&(e=Me[e]),"transform"===e){const e={};if(!Array.isArray(t))throw new TypeError("transform only support array args");t.forEach((t=>{Object.keys(t).forEach((n=>{const i=t[n];i instanceof be||i instanceof we?e[n]={animationId:i.animationId}:null===i?e[n]&&delete e[n]:void 0!==i&&(e[n]=i)}))}));const n=Object.keys(e);n.length&&(Array.isArray(this.style.transform)||(this.style.transform=[]),n.forEach((t=>this.style.transform.push({[t]:e[t]}))))}else if(null===t&&void 0!==this.style[e])this.style[e]=void 0;else if(t instanceof be||t instanceof we)this.style[e]={animationId:t.animationId};else if(e.toLowerCase().indexOf("colors")>-1)this.style[e]=jt(t);else if(e.toLowerCase().indexOf("color")>-1)this.style[e]=Mt(t);else if("fontWeight"===e&&t)this.style[e]="string"!=typeof t?t.toString():t;else if("backgroundImage"===e&&t)this.style=function(e,t,n){if(0===t.indexOf("linear-gradient")){const e=t.substring(t.indexOf("(")+1,t.lastIndexOf(")")).split(/,(?![^(]*?\))/),i=[];n.linearGradient=n.linearGradient||{},e.forEach(((e,t)=>{if(0===t){const t=Ve(e);if(t)n.linearGradient.angle=t;else{n.linearGradient.angle="180";const t=We(e);t&&i.push(t)}}else{const t=We(e);t&&i.push(t)}})),n.linearGradient.colorStopList=i}else n[e]=D(t);return n}(e,t,this.style);else if("textShadowOffset"===e){const{x:n=0,width:i=0,y:o=0,height:r=0}=t||{};this.style[e]={width:n||i,height:o||r}}else["textShadowOffsetX","textShadowOffsetY"].indexOf(e)>=0?this.style=function(e,t,n){return n.textShadowOffset=n.textShadowOffset||{},Object.assign(n.textShadowOffset,{[{textShadowOffsetX:"width",textShadowOffsetY:"height"}[e]]:t||0}),n}(e,t,this.style):this.style[e]=t}))}setAttributes(e=[]){Array.isArray(e)&&e.length>0&&(e.forEach((e=>{if(Array.isArray(e)){const[t,n]=e;this.setAttribute(t,n,{notToNative:!0})}})),Te(this))}parseAnimationStyleProp(e){let t=!1;Object.keys(e).some((n=>{const i=e[n];if(i&&Array.isArray(i)&&"transform"===n)for(let e=0;e<i.length;e+=1){const n=i[e];for(const e in n){const i=n[e];if("object"==typeof i&&null!==i&&Number.isInteger(i.animationId))return t=!0,!0}}return!("object"!=typeof i||null===i||!Number.isInteger(i.animationId))&&(t=!0,!0)})),t?this.attributes.useAnimation=!0:"boolean"==typeof this.attributes.useAnimation&&(this.attributes.useAnimation=void 0)}parseAttributeProp(e,t){let n=!1;return[{match:()=>["id"].indexOf(e)>=0,action:()=>(t===this.id||(this.id=t,function(e){if(!e.isMounted)return;const t=Re(w(),e);Ne.push({type:Ee.updateNode,nodes:t})}(this)),!0)},{match:()=>["value","defaultValue","placeholder"].indexOf(e)>=0,action:()=>(this.attributes[e]=T(t),!1)},{match:()=>["text"].indexOf(e)>=0,action:()=>(this.attributes[e]=t,!1)},{match:()=>["style"].indexOf(e)>=0,action:()=>"object"!=typeof t||null==t||(this.setStyleAttribute(t),!1)},{match:()=>!0,action:()=>{if("function"==typeof t){const t=Be(e);this.attributes[t]=!0,this.events[`${t}`]=!0}else{this.attributes[e]=t;const n=Be(e);!0===this.events[`${n}`]&&"function"!=typeof t&&(this.attributes[n]=!1,delete this.events[`${n}`])}return!1}}].some((e=>!!e.match()&&(n=e.action(),!0))),n}setAttribute(e,t,n={}){try{if("boolean"==typeof this.attributes[e]&&""===t&&(t=!0),void 0===e)return void(!n.notToNative&&Te(this));if(this.parseAttributeProp(e,t))return;this.parseAnimationStyleProp(this.style),!n.notToNative&&Te(this)}catch(e){}}removeAttribute(e){delete this.attributes[e]}setStyle(e,t,n=!1){if(null===t)return void delete this.style[e];let i=t,o=e;Object.prototype.hasOwnProperty.call(Me,e)&&(o=Me[e]),"string"==typeof i&&(i=t.trim(),i=o.toLowerCase().indexOf("colors")>-1?jt(i):o.toLowerCase().indexOf("color")>-1?Mt(i):function(e){if("number"==typeof e)return e;if("string"==typeof e&&_.test(e))try{return parseFloat(e)}catch(t){return e}return e}(i)),null!=i&&this.style[o]!==i&&(this.style[o]=i,n||Te(this))}setNativeProps(e){if(e){const{style:t}=e;if(t){const e=t;Object.keys(e).forEach((t=>{this.setStyle(t,e[t],!0)})),Te(this),ke(!0)}}}setText(e){if("string"!=typeof e)try{e=e.toString()}catch(e){throw new Error("Only string type is acceptable for setText")}return(e=e.trim())||this.getAttribute("text")?(e=(e=T(e)).replace(/&nbsp;/g," ").replace(/Â/g," "),"textarea"===this.tagName?this.setAttribute("value",e):this.setAttribute("text",e)):null}}const{createNode:qe,updateNode:Ke,deleteNode:Ge,flushBatch:Ye,startBatch:Xe,endBatch:Je,sendRenderError:Qe}=r,Ze=function(e){return C((t=>t.stateNode&&t.stateNode.nodeId===e))};function et(e){if(e instanceof Ue)return e;if(!e)return null;const t=e._reactInternalFiber||e._reactInternals;if(null==t?void 0:t.child){let e=t.child;for(;e&&!(e.stateNode instanceof Ue);)e=e.child;return e&&e.stateNode?e.stateNode:null}return null}function tt(e){let t=e;if("string"==typeof e){F(`getNodeIdByRef('${e}') use string ref will affect to performance, recommend use reference to the ref instead`);const n=C((t=>!!(t.return&&t.return.ref&&t.return.ref._stringRef)&&t.return.ref._stringRef===e));if(!n||!n.stateNode)return 0;t=n.stateNode}if(!t.nodeId){const e=et(t);return e?e.nodeId:0}return t.nodeId}function nt(e,t,...n){let{nativeName:r,nodeId:a}=e;if(!a||!r){const t=et(e);t&&({nodeId:a,nativeName:r}=t)}if(!r)throw new Error("callUIFunction is calling a unnamed component");if(!a)throw new Error("callUIFunction is calling a component have no nodeId");let[s=[],l]=n;M(s)&&(l=s,s=[]);null!==w()&&(O("callUIFunction",{nodeId:a,funcName:t,paramList:s}),o.platform.OS===pe.ios?(M(l)&&Array.isArray(s)&&s.push(l),i.callNative("UIManagerModule","callUIFunction",[r,a,t,s])):o.platform.OS===pe.android&&(M(l)?i.callNative("UIManagerModule","callUIFunction",[a,t,s],l):i.callNative("UIManagerModule","callUIFunction",[a,t,s])))}function it(e,t,n){const o=tt(t);return new Promise(((t,r)=>o?(O("callUIFunction",{nodeId:o,funcName:e,paramList:[]}),i.callNative("UIManagerModule",e,o,(i=>(n&&M(n)&&n(i),i&&"object"==typeof i?t(i):r(new Error(`${e} error with response: ${i}`)))))):(n&&M(n)&&n("this view is null"),r(new Error(`${e} cannot get nodeId`)))))}var ot=Object.freeze({__proto__:null,createNode:qe,updateNode:Ke,deleteNode:Ge,flushBatch:Ye,startBatch:Xe,endBatch:Je,sendRenderError:Qe,getNodeById:Ze,getNodeIdByRef:tt,getElementFromFiberRef:et,callUIFunction:nt,getBoundingClientRect:function(e,t){const n=tt(e);return new Promise(((o,r)=>n?(O("UIManagerModule",{nodeId:n,funcName:"getBoundingClientRect",params:t}),i.callNative("UIManagerModule","getBoundingClientRect",n,t,(e=>{if(!e||e.errMsg)return r(new Error((null==e?void 0:e.errMsg)||"getBoundingClientRect error with no response"));const{x:t,y:n,width:i,height:a}=e;let s,l;return"number"==typeof n&&"number"==typeof a&&(s=n+a),"number"==typeof t&&"number"==typeof i&&(l=t+i),o({x:t,y:n,width:i,height:a,bottom:s,right:l,left:t,top:n})}))):r(new Error(`getBoundingClientRect cannot get nodeId of ${e}`))))},measureInWindow:function(e,t){return it("measureInWindow",e,t)},measureInAppWindow:function(e,t){return"android"===o.platform.OS?it("measureInWindow",e,t):it("measureInAppWindow",e,t)}});const rt=new ne,at=new Set,st={exitApp(){i.callNative("DeviceEventModule","invokeDefaultBackPressHandler")},addListener:e=>(i.callNative("DeviceEventModule","setListenBackPress",!0),at.add(e),{remove(){st.removeListener(e)}}),removeListener(e){at.delete(e),0===at.size&&i.callNative("DeviceEventModule","setListenBackPress",!1)},initEventListener(){rt.addListener("hardwareBackPress",(()=>{let e=!0;[...at].reverse().every((t=>"function"!=typeof t||!t()||(e=!1,!1))),e&&st.exitApp()}))}},lt={exitApp(){},addListener:e=>({remove(){}}),removeListener(e){},initEventListener(){}},ct=__PLATFORM__===pe.android||o.platform.OS===pe.android?(st.initEventListener(),st):lt;var dt=Array.isArray,ut=Object.keys,ht=Object.prototype.hasOwnProperty,pt=function e(t,n){if(t===n)return!0;if(t&&n&&"object"==typeof t&&"object"==typeof n){var i,o,r,a=dt(t),s=dt(n);if(a&&s){if((o=t.length)!=n.length)return!1;for(i=o;0!=i--;)if(!e(t[i],n[i]))return!1;return!0}if(a!=s)return!1;var l=t instanceof Date,c=n instanceof Date;if(l!=c)return!1;if(l&&c)return t.getTime()==n.getTime();var d=t instanceof RegExp,u=n instanceof RegExp;if(d!=u)return!1;if(d&&u)return t.toString()==n.toString();var h=ut(t);if((o=h.length)!==ut(n).length)return!1;for(i=o;0!=i--;)if(!ht.call(n,h[i]))return!1;for(i=o;0!=i--;)if(!e(t[r=h[i]],n[r]))return!1;return!0}return t!=t&&n!=n};const ft=setTimeout,mt=clearTimeout;const yt=e({...Object.freeze({__proto__:null,commitMutationEffectsBegin:function(){},commitMutationEffectsComplete:function(){ke(!0)},getCurrentEventPriority:function(){return 16},scheduleTimeout:ft,cancelTimeout:mt,noTimeout:-1,afterActiveInstanceBlur:function(){},appendChild:function(e,t){e.childNodes.indexOf(t)>=0&&e.removeChild(t),e.appendChild(t)},appendChildToContainer:function(e,t){e.appendChild(t)},appendInitialChild:function(e,t){e.appendChild(t)},beforeActiveInstanceBlur:function(){},commitMount:function(){},commitTextUpdate:function(){},commitUpdate:function(e,t,n,i,o,r){E(r,e.nodeId);const a=Object.keys(t||{});if(0===a.length)return;const s=a.map((e=>[e,t[e]]));e.setAttributes(s)},clearContainer:function(){},createContainerChildSet:function(){},createInstance:function(e,t,n,i,o){const r=n.createElement(e);return Object.keys(t).forEach((e=>{switch(e){case"children":break;case"nativeName":r.meta.component.name=t.nativeName;break;default:r.setAttribute(e,t[e])}})),[5,7].indexOf(o.tag)<0&&(r.meta.skipAddToDom=!0),E(o,r.nodeId),r},createTextInstance:function(e,t,n,i){const o=t.createElement("p");return o.setAttribute("text",T(e)),o.meta={component:{name:"Text"}},E(i,o.nodeId),o},detachDeletedInstance:function(){},finalizeContainerChildren:function(){},finalizeInitialChildren:function(){return!0},getChildHostContext:function(){return{}},getPublicInstance:function(e){return e},getInstanceFromNode:function(){throw new Error("Not yet implemented.")},getFundamentalComponentInstance:function(){throw new Error("Not yet implemented.")},getRootHostContext:function(){return{}},hideInstance:function(e){const t={style:{display:"none"}};Object.keys(t).forEach((n=>e.setAttribute(n,t[n])))},hideTextInstance:function(){throw new Error("Not yet implemented.")},insertBefore:function(e,t,n){e.childNodes.indexOf(t)>=0?e.moveChild(t,n):e.insertBefore(t,n)},isOpaqueHydratingObject:function(){throw new Error("Not yet implemented")},makeClientId:function(){throw new Error("Not yet implemented")},makeClientIdInDEV:function(){throw new Error("Not yet implemented")},makeOpaqueHydratingObject:function(){throw new Error("Not yet implemented.")},mountFundamentalComponent:function(){throw new Error("Not yet implemented.")},prepareForCommit:function(){return null},preparePortalMount:function(){},prepareUpdate:function(e,t,n,i){const o={};return Object.keys(n).forEach((e=>{const t=n[e],r=i[e];null!=t&&null==r&&(o[e]=r)})),Object.keys(i).forEach((e=>{const t=n[e],r=i[e];if("children"===e)t===r||"number"!=typeof r&&"string"!=typeof r||(o[e]=r);else null!=r&&null==t?o[e]=r:"function"==typeof r||pt(t,r)||(o[e]=r)})),o},replaceContainerChildren:function(){},removeChild:function(e,t){e.removeChild(t),k(t)},removeChildFromContainer:function(e,t){e.removeChild(t),k(t)},resetAfterCommit:function(){},resetTextContent:function(){},unmountFundamentalComponent:function(){throw new Error("Not yet implemented.")},updateFundamentalComponent:function(){throw new Error("Not yet implemented.")},unhideTextInstance:function(){throw new Error("Not yet implemented.")},unhideInstance:function(e,t){const n={...t,style:{...t.style,display:"flex"}};Object.keys(n).forEach((t=>e.setAttribute(t,n[t])))},shouldDeprioritizeSubtree:function(){return!0},shouldUpdateFundamentalComponent:function(){throw new Error("Not yet implemented.")},shouldSetTextContent:function(e,t){if(t&&"Text"===t.nativeName||-1!==["p","span"].indexOf(e)){const{children:e}=t;return"string"==typeof e||"number"==typeof e}return!1}}),clearTimeout:clearTimeout,setTimeout:setTimeout,isPrimaryRenderer:!0,noTimeout:-1,supportsMutation:!0,supportsHydration:!1,supportsPersistence:!1,now:Date.now,scheduleDeferredCallback:()=>{},cancelDeferredCallback:()=>{}}),{flushSync:gt}=yt,{addEventListener:bt,removeEventListener:vt,dispatchEvent:wt,AsyncStorage:Ct,Bridge:Et,Device:At,HippyRegister:Nt}=d;var It=Object.freeze({__proto__:null,addEventListener:bt,removeEventListener:vt,dispatchEvent:wt,AsyncStorage:Ct,BackAndroid:ct,Bridge:Et,Clipboard:u,Cookie:h,Device:At,HippyRegister:Nt,ImageLoader:m,NetworkInfo:fe,UIManager:ot,flushSync:gt});function kt(...e){return`\\(\\s*(${e.join(")\\s*,\\s*(")})\\s*\\)`}const St={transparent:0,aliceblue:4042850303,antiquewhite:4209760255,aqua:16777215,aquamarine:2147472639,azure:4043309055,beige:4126530815,bisque:4293182719,black:255,blanchedalmond:4293643775,blue:65535,blueviolet:2318131967,brown:2771004159,burlywood:3736635391,burntsienna:3934150143,cadetblue:1604231423,chartreuse:2147418367,chocolate:3530104575,coral:4286533887,cornflowerblue:1687547391,cornsilk:4294499583,crimson:3692313855,cyan:16777215,darkblue:35839,darkcyan:9145343,darkgoldenrod:3095792639,darkgray:2846468607,darkgreen:6553855,darkgrey:2846468607,darkkhaki:3182914559,darkmagenta:2332068863,darkolivegreen:1433087999,darkorange:4287365375,darkorchid:2570243327,darkred:2332033279,darksalmon:3918953215,darkseagreen:2411499519,darkslateblue:1211993087,darkslategray:793726975,darkslategrey:793726975,darkturquoise:13554175,darkviolet:2483082239,deeppink:4279538687,deepskyblue:12582911,dimgray:1768516095,dimgrey:1768516095,dodgerblue:512819199,firebrick:2988581631,floralwhite:4294635775,forestgreen:579543807,fuchsia:4278255615,gainsboro:3705462015,ghostwhite:4177068031,gold:4292280575,goldenrod:3668254975,gray:2155905279,green:8388863,greenyellow:2919182335,grey:2155905279,honeydew:4043305215,hotpink:4285117695,indianred:3445382399,indigo:1258324735,ivory:4294963455,khaki:4041641215,lavender:3873897215,lavenderblush:4293981695,lawngreen:2096890111,lemonchiffon:4294626815,lightblue:2916673279,lightcoral:4034953471,lightcyan:3774873599,lightgoldenrodyellow:4210742015,lightgray:3553874943,lightgreen:2431553791,lightgrey:3553874943,lightpink:4290167295,lightsalmon:4288707327,lightseagreen:548580095,lightskyblue:2278488831,lightslategray:2005441023,lightslategrey:2005441023,lightsteelblue:2965692159,lightyellow:4294959359,lime:16711935,limegreen:852308735,linen:4210091775,magenta:4278255615,maroon:2147483903,mediumaquamarine:1724754687,mediumblue:52735,mediumorchid:3126187007,mediumpurple:2473647103,mediumseagreen:1018393087,mediumslateblue:2070474495,mediumspringgreen:16423679,mediumturquoise:1221709055,mediumvioletred:3340076543,midnightblue:421097727,mintcream:4127193855,mistyrose:4293190143,moccasin:4293178879,navajowhite:4292783615,navy:33023,oldlace:4260751103,olive:2155872511,olivedrab:1804477439,orange:4289003775,orangered:4282712319,orchid:3664828159,palegoldenrod:4008225535,palegreen:2566625535,paleturquoise:2951671551,palevioletred:3681588223,papayawhip:4293907967,peachpuff:4292524543,peru:3448061951,pink:4290825215,plum:3718307327,powderblue:2967529215,purple:2147516671,rebeccapurple:1714657791,red:4278190335,rosybrown:3163525119,royalblue:1097458175,saddlebrown:2336560127,salmon:4202722047,sandybrown:4104413439,seagreen:780883967,seashell:4294307583,sienna:2689740287,silver:3233857791,skyblue:2278484991,slateblue:1784335871,slategray:1887473919,slategrey:1887473919,snow:4294638335,springgreen:16744447,steelblue:1182971135,tan:3535047935,teal:8421631,thistle:3636451583,tomato:4284696575,turquoise:1088475391,violet:4001558271,wheat:4125012991,white:4294967295,whitesmoke:4126537215,yellow:4294902015,yellowgreen:2597139199},xt="[-+]?\\d*\\.?\\d+",Lt=`${xt}%`,Rt={rgb:new RegExp(`rgb${kt(xt,xt,xt)}`),rgba:new RegExp(`rgba${kt(xt,xt,xt,xt)}`),hsl:new RegExp(`hsl${kt(xt,Lt,Lt)}`),hsla:new RegExp(`hsla${kt(xt,Lt,Lt,xt)}`),hex3:/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex4:/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#([0-9a-fA-F]{6})$/,hex8:/^#([0-9a-fA-F]{8})$/};function Pt(e){const t=parseInt(e,10);return t<0?0:t>255?255:t}function Ot(e){const t=parseFloat(e);return t<0?0:t>1?255:Math.round(255*t)}function Ft(e,t,n){let i=n;return i<0&&(i+=1),i>1&&(i-=1),i<1/6?e+6*(t-e)*i:i<.5?t:i<2/3?e+(t-e)*(2/3-i)*6:e}function Tt(e,t,n){const i=n<.5?n*(1+t):n+t-n*t,o=2*n-i,r=Ft(o,i,e+1/3),a=Ft(o,i,e),s=Ft(o,i,e-1/3);return Math.round(255*r)<<24|Math.round(255*a)<<16|Math.round(255*s)<<8}function Ht(e){return(parseFloat(e)%360+360)%360/360}function _t(e){const t=parseFloat(e);return t<0?0:t>100?1:t/100}function Mt(e,t={}){if(Number.isInteger(e))return e;let n=function(e){let t;return"number"==typeof e?e>>>0===e&&e>=0&&e<=4294967295?e:null:(t=Rt.hex6.exec(e),Array.isArray(t)?parseInt(`${t[1]}ff`,16)>>>0:Object.hasOwnProperty.call(St,e)?St[e]:(t=Rt.rgb.exec(e),Array.isArray(t)?(Pt(t[1])<<24|Pt(t[2])<<16|Pt(t[3])<<8|255)>>>0:(t=Rt.rgba.exec(e),t?(Pt(t[1])<<24|Pt(t[2])<<16|Pt(t[3])<<8|Ot(t[4]))>>>0:(t=Rt.hex3.exec(e),t?parseInt(`${t[1]+t[1]+t[2]+t[2]+t[3]+t[3]}ff`,16)>>>0:(t=Rt.hex8.exec(e),t?parseInt(t[1],16)>>>0:(t=Rt.hex4.exec(e),t?parseInt(t[1]+t[1]+t[2]+t[2]+t[3]+t[3]+t[4]+t[4],16)>>>0:(t=Rt.hsl.exec(e),t?(255|Tt(Ht(t[1]),_t(t[2]),_t(t[3])))>>>0:(t=Rt.hsla.exec(e),t?(Tt(Ht(t[1]),_t(t[2]),_t(t[3]))|Ot(t[4]))>>>0:null))))))))}(e);return t.platform||(t.platform=__PLATFORM__||At.platform.OS),null===n?0:(n=(n<<24|n>>>8)>>>0,t.platform===pe.android&&(n|=0),n)}function jt(e,t){return Array.isArray(e)?e.map((e=>Mt(e,t))):(F("Input color value is not a array",e),[0])}class zt extends _e{constructor(){super(),this.documentElement=new Ue("document")}createElement(e){return new Ue(e)}createElementNS(e,t){return new Ue(`${e}:${t}`)}}zt.createElement=zt.prototype.createElement,zt.createElementNS=zt.prototype.createElementNS;const{createContainer:$t,updateContainer:Dt,getPublicRootInstance:Vt,injectIntoDevTools:Wt}=yt,Bt=["%c[Hippy-React process.env.HIPPY_REACT_VERSION]%c","color: #61dafb","color: auto"];class Ut{static get Native(){return F("HippyReact.Native interface is not stable yet. DO NOT USE IT"),It}constructor(e){if(!e.appName||!e.entryPage)throw new TypeError("Invalid arguments");this.config=e,this.regist=this.start,this.render=this.render.bind(this);const t=new zt;this.rootContainer=$t(t,0,!1,null)}start(){Nt.regist(this.config.appName,this.render)}render(e){const{appName:n,entryPage:i,silent:o=!1,bubbles:r=!1,callback:a=()=>{}}=this.config,{__instanceId__:s}=e;O(...Bt,"Start",n,"with rootViewId",s,e),"development"===process.env.NODE_ENV&&Wt({bundleType:1,version:t.version,rendererPackageName:"hippy-react"}),this.rootContainer.containerInfo.nodeId=s,o&&j(o),r&&function(e=!1){P=e}(r),v(s,this.rootContainer);const l=t.createElement(i,e);return Dt(l,this.rootContainer,null,a),Vt(this.rootContainer)}}Ut.version=process.env.HIPPY_REACT_VERSION;const qt={registerComponent(e,t){new Ut({appName:e,entryPage:t}).start()}};class Kt extends t.Component{constructor(){super(...arguments),this.instance=null}setPressed(e){nt(this.instance,"setPressed",[e])}setHotspot(e,t){nt(this.instance,"setHotspot",[e,t])}render(){const{collapsable:e,style:n={},onFocus:i,...o}=this.props;let r=n;const{nativeBackgroundAndroid:a}=o;return"boolean"==typeof e&&(Array.isArray(n)?r=[...n,{collapsable:e}]:r.collapsable=e),void 0!==(null==a?void 0:a.color)&&(a.color=Mt(a.color)),t.createElement("div",{ref:e=>{this.instance=e},nativeName:"View",style:r,onFocus:i,...o})}}function Gt({style:e,forbidUnicodeToChar:n,...i},o){const r=e;e&&(Array.isArray(e)?-1===e.filter((e=>"object"==typeof e&&e)).findIndex((e=>e.color||e.colors))&&(r[0].color="#000"):"object"==typeof e&&void 0===e.color&&void 0===e.colors&&(r.color="#000"));const a=e=>n?e:T(e);if(i.text="","string"==typeof i.children)i.text=a(i.children);else if("number"==typeof i.children)i.text=a(i.children.toString());else if(Array.isArray(i.children)){const e=i.children.filter((e=>"string"==typeof e||"number"==typeof e)).join("");e&&(i.text=a(e),i.children=i.text)}return t.createElement("p",{ref:o,nativeName:"Text",style:r,...i})}Gt.displayName="Text";const Yt=t.forwardRef(Gt);Yt.displayName="Text";var Xt=Object.freeze({__proto__:null,Text:Yt,default:Yt});const Jt=At.window.scale;let Qt=Math.round(.4*Jt)/Jt;0===Qt&&(Qt=1/Jt);const Zt={hairlineWidth:Qt,create:function(e){return e},flatten:function e(t){if(null===t||"object"!=typeof t)return{};if(!Array.isArray(t))return t;const n={};for(let i=0,o=t.length;i<o;++i){const o=e(t[i]);o&&Object.entries(o).forEach((([e,t])=>{n[e]=t}))}return n}};class en extends t.Component{static get resizeMode(){return{contain:"contain",cover:"cover",stretch:"stretch",center:"center",repeat:"repeat"}}static getSize(e,t,n){if("string"!=typeof e)throw new TypeError("Image.getSize first argument must be a string url");const i=p(e);return"function"==typeof t&&i.then((e=>t(e.width,e.height))),"function"==typeof n?i.catch(n):i.catch((t=>F(`Failed to get size for image: ${e}`,t))),i}render(){const{children:e,style:n,imageStyle:i,imageRef:o,source:r,sources:a,src:s,srcs:l,tintColor:c,tintColors:d,...u}=this.props,h={...u},p=this.getImageUrls({src:s,srcs:l,source:r,sources:a});At.platform.OS===pe.ios?p.length&&(h.source=p.map((e=>({uri:e})))):At.platform.OS===pe.android&&(1===p.length?[h.src]=p:p.length>1&&(h.srcs=p)),"string"==typeof h.defaultSource&&(0!==h.defaultSource.indexOf("data:image/")&&F("[Image] defaultSource prop must be a local base64 image"),h.defaultSource=D(h.defaultSource));const f=Zt.flatten(n);return this.handleTintColor(f,c,d),h.style=f,e?t.createElement(Kt,{style:n},t.createElement("img",{...h,nativeName:"Image",alt:"",ref:o,style:[{position:"absolute",left:0,right:0,top:0,bottom:0,width:f.width,height:f.height},i]}),e):t.createElement("img",{...h,nativeName:"Image",alt:"",ref:o})}getImageUrls({src:e,srcs:t,source:n,sources:i}){let o=[];if("string"==typeof e&&o.push(e),Array.isArray(t)&&(o=[...o,...t]),n)if("string"==typeof n)o.push(n);else if("object"==typeof n&&null!==n){const{uri:e}=n;e&&o.push(e)}return i&&Array.isArray(i)&&i.forEach((e=>{"string"==typeof e?o.push(e):"object"==typeof e&&null!==e&&e.uri&&o.push(e.uri)})),o.length&&(o=o.map((e=>D(e)))),o}handleTintColor(e,t,n){t&&Object.assign(e,{tintColor:t}),n&&Array.isArray(n)&&Object.assign(e,{tintColors:n})}}en.prefetch=f;const tn=en;class nn{constructor(){this.Value=nn.Value}static Value(e){return e}static timing(e,t){return new be({mode:"timing",delay:0,startValue:e,toValue:t.toValue,duration:t.duration,timingFunction:t.easing||"linear"})}}nn.View=Kt,nn.Text=Xt,nn.Image=en;const on={step0:e=>e>0?1:0,step1:e=>e>=1?1:0,linear:()=>"linear",ease:()=>"ease",quad:e=>e**2,cubic:e=>e**3,poly:e=>t=>t**e,sin:e=>1-Math.cos(e*Math.PI/2),circle:e=>1-Math.sqrt(1-e*e),exp:e=>2**(10*(e-1)),elastic:()=>"elastic",back:(e=1.70158)=>t=>t*t*((e+1)*t-e),bounce(e){let t=e;return t<1/2.75?7.5625*t*t:t<2/2.75?(t-=1.5/2.75,7.5625*t*t+.75):t<2.5/2.75?(t-=2.25/2.75,7.5625*t*t+.9375):(t-=2.625/2.75,7.5625*t*t+.984375)},bezier:()=>"bezier",in:()=>"ease-in",out:()=>"ease-out",inOut:()=>"ease-in-out"},rn="websocket";let an;class sn{constructor(e,t,n){if(this.protocol="",this.onWebSocketEvent=this.onWebSocketEvent.bind(this),an||(an=new Z("hippyWebsocketEvents")),this.readyState=0,this.webSocketCallbacks={},!e||"string"!=typeof e)throw new TypeError("Invalid WebSocket url");const o={...n};if(void 0!==t)if(Array.isArray(t)&&t.length>0)o["Sec-WebSocket-Protocol"]=t.join(",");else{if("string"!=typeof t)throw new TypeError("Invalid WebSocket protocols");o["Sec-WebSocket-Protocol"]=t}const r={headers:o,url:e};this.url=e,this.webSocketCallbackId=an.addCallback(this.onWebSocketEvent),i.callNativeWithPromise(rn,"connect",r).then((e=>{e&&0===e.code&&"number"==typeof e.id?this.webSocketId=e.id:F("Fail to create websocket connection",e)}))}close(e,t){1===this.readyState?(this.readyState=2,i.callNative(rn,"close",{id:this.webSocketId,code:e,reason:t})):F("WebSocket is not connected")}send(e){if(1===this.readyState){if("string"!=typeof e)throw new TypeError("Unsupported websocket data type: "+typeof e);i.callNative(rn,"send",{id:this.webSocketId,data:e})}else