@obb871001/api-integration-sdk 1.0.48 → 1.0.49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +6 -6
- package/dist/index.js +147 -146
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const M=require("react"),Ae=require("@tanstack/react-query"),et=require("axios"),Ce=require("lodash"),rt=require("react-dom");function tt(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Re={exports:{}},Ee={};var ir;function nt(){if(ir)return Ee;ir=1;var r=M,b=Symbol.for("react.element"),O=Symbol.for("react.fragment"),E=Object.prototype.hasOwnProperty,f=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,_={key:!0,ref:!0,__self:!0,__source:!0};function S(d,c,
|
|
2
|
-
`+K+e}}var re=!1,pe;{var Pr=typeof WeakMap=="function"?WeakMap:Map;pe=new Pr}function Ye(e,
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const M=require("react"),Ae=require("@tanstack/react-query"),et=require("axios"),Ce=require("lodash"),rt=require("react-dom");function tt(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Re={exports:{}},Ee={};var ir;function nt(){if(ir)return Ee;ir=1;var r=M,b=Symbol.for("react.element"),O=Symbol.for("react.fragment"),E=Object.prototype.hasOwnProperty,f=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,_={key:!0,ref:!0,__self:!0,__source:!0};function S(d,c,s){var u,a={},i=null,t=null;s!==void 0&&(i=""+s),c.key!==void 0&&(i=""+c.key),c.ref!==void 0&&(t=c.ref);for(u in c)E.call(c,u)&&!_.hasOwnProperty(u)&&(a[u]=c[u]);if(d&&d.defaultProps)for(u in c=d.defaultProps,c)a[u]===void 0&&(a[u]=c[u]);return{$$typeof:b,type:d,key:i,ref:t,props:a,_owner:f.current}}return Ee.Fragment=O,Ee.jsx=S,Ee.jsxs=S,Ee}var _e={};var sr;function at(){return sr||(sr=1,process.env.NODE_ENV!=="production"&&(function(){var r=M,b=Symbol.for("react.element"),O=Symbol.for("react.portal"),E=Symbol.for("react.fragment"),f=Symbol.for("react.strict_mode"),_=Symbol.for("react.profiler"),S=Symbol.for("react.provider"),d=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),s=Symbol.for("react.suspense"),u=Symbol.for("react.suspense_list"),a=Symbol.for("react.memo"),i=Symbol.for("react.lazy"),t=Symbol.for("react.offscreen"),n=Symbol.iterator,v="@@iterator";function h(e){if(e===null||typeof e!="object")return null;var l=n&&e[n]||e[v];return typeof l=="function"?l:null}var o=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function y(e){{for(var l=arguments.length,g=new Array(l>1?l-1:0),p=1;p<l;p++)g[p-1]=arguments[p];R("error",e,g)}}function R(e,l,g){{var p=o.ReactDebugCurrentFrame,w=p.getStackAddendum();w!==""&&(l+="%s",g=g.concat([w]));var k=g.map(function(C){return String(C)});k.unshift("Warning: "+l),Function.prototype.apply.call(console[e],console,k)}}var P=!1,T=!1,A=!1,I=!1,le=!1,fe;fe=Symbol.for("react.module.reference");function ke(e){return!!(typeof e=="string"||typeof e=="function"||e===E||e===_||le||e===f||e===s||e===u||I||e===t||P||T||A||typeof e=="object"&&e!==null&&(e.$$typeof===i||e.$$typeof===a||e.$$typeof===S||e.$$typeof===d||e.$$typeof===c||e.$$typeof===fe||e.getModuleId!==void 0))}function be(e,l,g){var p=e.displayName;if(p)return p;var w=l.displayName||l.name||"";return w!==""?g+"("+w+")":g}function H(e){return e.displayName||"Context"}function j(e){if(e==null)return null;if(typeof e.tag=="number"&&y("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case E:return"Fragment";case O:return"Portal";case _:return"Profiler";case f:return"StrictMode";case s:return"Suspense";case u:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case d:var l=e;return H(l)+".Consumer";case S:var g=e;return H(g._context)+".Provider";case c:return be(e,e.render,"ForwardRef");case a:var p=e.displayName||null;return p!==null?p:j(e.type)||"Memo";case i:{var w=e,k=w._payload,C=w._init;try{return j(C(k))}catch{return null}}}return null}var J=Object.assign,Z=0,B,ye,ge,L,U,Y,ve;function ee(){}ee.__reactDisabledLog=!0;function X(){{if(Z===0){B=console.log,ye=console.info,ge=console.warn,L=console.error,U=console.group,Y=console.groupCollapsed,ve=console.groupEnd;var e={configurable:!0,enumerable:!0,value:ee,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}Z++}}function Oe(){{if(Z--,Z===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:J({},e,{value:B}),info:J({},e,{value:ye}),warn:J({},e,{value:ge}),error:J({},e,{value:L}),group:J({},e,{value:U}),groupCollapsed:J({},e,{value:Y}),groupEnd:J({},e,{value:ve})})}Z<0&&y("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var oe=o.ReactCurrentDispatcher,K;function ce(e,l,g){{if(K===void 0)try{throw Error()}catch(w){var p=w.stack.trim().match(/\n( *(at )?)/);K=p&&p[1]||""}return`
|
|
2
|
+
`+K+e}}var re=!1,pe;{var Pr=typeof WeakMap=="function"?WeakMap:Map;pe=new Pr}function Ye(e,l){if(!e||re)return"";{var g=pe.get(e);if(g!==void 0)return g}var p;re=!0;var w=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var k;k=oe.current,oe.current=null,X();try{if(l){var C=function(){throw Error()};if(Object.defineProperty(C.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(C,[])}catch(F){p=F}Reflect.construct(e,[],C)}else{try{C.call()}catch(F){p=F}e.call(C.prototype)}}else{try{throw Error()}catch(F){p=F}e()}}catch(F){if(F&&p&&typeof F.stack=="string"){for(var m=F.stack.split(`
|
|
3
3
|
`),W=p.stack.split(`
|
|
4
4
|
`),N=m.length-1,D=W.length-1;N>=1&&D>=0&&m[N]!==W[D];)D--;for(;N>=1&&D>=0;N--,D--)if(m[N]!==W[D]){if(N!==1||D!==1)do if(N--,D--,D<0||m[N]!==W[D]){var G=`
|
|
5
|
-
`+m[N].replace(" at new "," at ");return e.displayName&&G.includes("<anonymous>")&&(G=G.replace("<anonymous>",e.displayName)),typeof e=="function"&&pe.set(e,G),G}while(N>=1&&D>=0);break}}}finally{re=!1,oe.current=k,Oe(),Error.prepareStackTrace=w}var se=e?e.displayName||e.name:"",te=se?ce(se):"";return typeof e=="function"&&pe.set(e,te),te}function kr(e,
|
|
5
|
+
`+m[N].replace(" at new "," at ");return e.displayName&&G.includes("<anonymous>")&&(G=G.replace("<anonymous>",e.displayName)),typeof e=="function"&&pe.set(e,G),G}while(N>=1&&D>=0);break}}}finally{re=!1,oe.current=k,Oe(),Error.prepareStackTrace=w}var se=e?e.displayName||e.name:"",te=se?ce(se):"";return typeof e=="function"&&pe.set(e,te),te}function kr(e,l,g){return Ye(e,!1)}function Ir(e){var l=e.prototype;return!!(l&&l.isReactComponent)}function Te(e,l,g){if(e==null)return"";if(typeof e=="function")return Ye(e,Ir(e));if(typeof e=="string")return ce(e);switch(e){case s:return ce("Suspense");case u:return ce("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case c:return kr(e.render);case a:return Te(e.type,l,g);case i:{var p=e,w=p._payload,k=p._init;try{return Te(k(w),l,g)}catch{}}}return""}var de=Object.prototype.hasOwnProperty,Ke={},xe=o.ReactDebugCurrentFrame;function me(e){if(e){var l=e._owner,g=Te(e.type,e._source,l?l.type:null);xe.setExtraStackFrame(g)}else xe.setExtraStackFrame(null)}function Nr(e,l,g,p,w){{var k=Function.call.bind(de);for(var C in e)if(k(e,C)){var m=void 0;try{if(typeof e[C]!="function"){var W=Error((p||"React class")+": "+g+" type `"+C+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[C]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw W.name="Invariant Violation",W}m=e[C](l,C,p,g,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(N){m=N}m&&!(m instanceof Error)&&(me(w),y("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",p||"React class",g,C,typeof m),me(null)),m instanceof Error&&!(m.message in Ke)&&(Ke[m.message]=!0,me(w),y("Failed %s type: %s",g,m.message),me(null))}}}var Mr=Array.isArray;function Ie(e){return Mr(e)}function Dr(e){{var l=typeof Symbol=="function"&&Symbol.toStringTag,g=l&&e[Symbol.toStringTag]||e.constructor.name||"Object";return g}}function Lr(e){try{return Qe(e),!1}catch{return!0}}function Qe(e){return""+e}function ze(e){if(Lr(e))return y("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Dr(e)),Qe(e)}var Xe=o.ReactCurrentOwner,jr={key:!0,ref:!0,__self:!0,__source:!0},Ze,er;function Ur(e){if(de.call(e,"ref")){var l=Object.getOwnPropertyDescriptor(e,"ref").get;if(l&&l.isReactWarning)return!1}return e.ref!==void 0}function Wr(e){if(de.call(e,"key")){var l=Object.getOwnPropertyDescriptor(e,"key").get;if(l&&l.isReactWarning)return!1}return e.key!==void 0}function Fr(e,l){typeof e.ref=="string"&&Xe.current}function qr(e,l){{var g=function(){Ze||(Ze=!0,y("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",l))};g.isReactWarning=!0,Object.defineProperty(e,"key",{get:g,configurable:!0})}}function Gr(e,l){{var g=function(){er||(er=!0,y("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",l))};g.isReactWarning=!0,Object.defineProperty(e,"ref",{get:g,configurable:!0})}}var Jr=function(e,l,g,p,w,k,C){var m={$$typeof:b,type:e,key:l,ref:g,props:C,_owner:k};return m._store={},Object.defineProperty(m._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(m,"_self",{configurable:!1,enumerable:!1,writable:!1,value:p}),Object.defineProperty(m,"_source",{configurable:!1,enumerable:!1,writable:!1,value:w}),Object.freeze&&(Object.freeze(m.props),Object.freeze(m)),m};function Hr(e,l,g,p,w){{var k,C={},m=null,W=null;g!==void 0&&(ze(g),m=""+g),Wr(l)&&(ze(l.key),m=""+l.key),Ur(l)&&(W=l.ref,Fr(l,w));for(k in l)de.call(l,k)&&!jr.hasOwnProperty(k)&&(C[k]=l[k]);if(e&&e.defaultProps){var N=e.defaultProps;for(k in N)C[k]===void 0&&(C[k]=N[k])}if(m||W){var D=typeof e=="function"?e.displayName||e.name||"Unknown":e;m&&qr(C,D),W&&Gr(C,D)}return Jr(e,m,W,w,p,Xe.current,C)}}var Ne=o.ReactCurrentOwner,rr=o.ReactDebugCurrentFrame;function ie(e){if(e){var l=e._owner,g=Te(e.type,e._source,l?l.type:null);rr.setExtraStackFrame(g)}else rr.setExtraStackFrame(null)}var Me;Me=!1;function De(e){return typeof e=="object"&&e!==null&&e.$$typeof===b}function tr(){{if(Ne.current){var e=j(Ne.current.type);if(e)return`
|
|
6
6
|
|
|
7
|
-
Check the render method of \``+e+"`."}return""}}function Vr(e){return""}var nr={};function $r(e){{var
|
|
7
|
+
Check the render method of \``+e+"`."}return""}}function Vr(e){return""}var nr={};function $r(e){{var l=tr();if(!l){var g=typeof e=="string"?e:e.displayName||e.name;g&&(l=`
|
|
8
8
|
|
|
9
|
-
Check the top-level render call using <`+g+">.")}return
|
|
9
|
+
Check the top-level render call using <`+g+">.")}return l}}function ar(e,l){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var g=$r(l);if(nr[g])return;nr[g]=!0;var p="";e&&e._owner&&e._owner!==Ne.current&&(p=" It was passed a child from "+j(e._owner.type)+"."),ie(e),y('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',g,p),ie(null)}}function ur(e,l){{if(typeof e!="object")return;if(Ie(e))for(var g=0;g<e.length;g++){var p=e[g];De(p)&&ar(p,l)}else if(De(e))e._store&&(e._store.validated=!0);else if(e){var w=h(e);if(typeof w=="function"&&w!==e.entries)for(var k=w.call(e),C;!(C=k.next()).done;)De(C.value)&&ar(C.value,l)}}}function Br(e){{var l=e.type;if(l==null||typeof l=="string")return;var g;if(typeof l=="function")g=l.propTypes;else if(typeof l=="object"&&(l.$$typeof===c||l.$$typeof===a))g=l.propTypes;else return;if(g){var p=j(l);Nr(g,e.props,"prop",p,e)}else if(l.PropTypes!==void 0&&!Me){Me=!0;var w=j(l);y("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",w||"Unknown")}typeof l.getDefaultProps=="function"&&!l.getDefaultProps.isReactClassApproved&&y("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Yr(e){{for(var l=Object.keys(e.props),g=0;g<l.length;g++){var p=l[g];if(p!=="children"&&p!=="key"){ie(e),y("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",p),ie(null);break}}e.ref!==null&&(ie(e),y("Invalid attribute `ref` supplied to `React.Fragment`."),ie(null))}}var or={};function cr(e,l,g,p,w,k){{var C=ke(e);if(!C){var m="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(m+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var W=Vr();W?m+=W:m+=tr();var N;e===null?N="null":Ie(e)?N="array":e!==void 0&&e.$$typeof===b?(N="<"+(j(e.type)||"Unknown")+" />",m=" Did you accidentally export a JSX literal instead of a component?"):N=typeof e,y("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",N,m)}var D=Hr(e,l,g,w,k);if(D==null)return D;if(C){var G=l.children;if(G!==void 0)if(p)if(Ie(G)){for(var se=0;se<G.length;se++)ur(G[se],e);Object.freeze&&Object.freeze(G)}else y("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else ur(G,e)}if(de.call(l,"key")){var te=j(e),F=Object.keys(l).filter(function(Zr){return Zr!=="key"}),Le=F.length>0?"{key: someKey, "+F.join(": ..., ")+": ...}":"{key: someKey}";if(!or[te+Le]){var Xr=F.length>0?"{"+F.join(": ..., ")+": ...}":"{}";y(`A props object containing a "key" prop is being spread into JSX:
|
|
10
10
|
let props = %s;
|
|
11
11
|
<%s {...props} />
|
|
12
12
|
React keys must be passed directly to JSX without using spread:
|
|
13
13
|
let props = %s;
|
|
14
|
-
<%s key={someKey} {...props} />`,Le,te,Xr,te),or[te+Le]=!0}}return e===E?Yr(D):Br(D),D}}function Kr(e,s,g){return cr(e,s,g,!0)}function xr(e,s,g){return cr(e,s,g,!1)}var Qr=xr,zr=Kr;_e.Fragment=E,_e.jsx=Qr,_e.jsxs=zr})()),_e}var lr;function ut(){return lr||(lr=1,process.env.NODE_ENV==="production"?Re.exports=nt():Re.exports=at()),Re.exports}var fr=ut();const Ge=M.createContext(null),Pe=()=>{const r=M.useContext(Ge);if(!r)throw new Error("useApiContext must be used within ApiProvider");return r};function ot({baseURL:r,getToken:b,timeoutMs:O=15e3,currency:E="TWD",lng:f="tw",onError:_}={}){const S=et.create({baseURL:r,timeout:O,headers:{"Content-Type":"application/json"}});return S.interceptors.request.use(async d=>{if(d.headers=d.headers||{},b){const c=await b();c&&(d.headers.Authorization=`Bearer ${c}`)}return d.headers.Currency=E,d.headers["currency-code"]=E,d.headers.lang=f,d}),S.interceptors.response.use(d=>d.data,d=>_?_(d,{instance:S}):Promise.reject(d)),S}function ct({children:r,...b}){const O=M.useMemo(()=>ot(b),[b]),f=M.useMemo(()=>new Ae.QueryClient({defaultOptions:{queries:{refetchOnWindowFocus:!1,retry:1}}}),[]);return fr.jsx(Ae.QueryClientProvider,{client:f,children:fr.jsx(Ge.Provider,{value:{client:O,...b},children:r})})}const it=()=>{const r=(E,f)=>!E&&!f,b=E=>E.startsWith("pc.");return{executeLogout:({isCallBackInvalid:E=!1,hostname:f="",shouldRedirect:_,onShowError:S,onCleanup:d,onRemoveToken:c,onRedirect:l,onGoogleLogout:u})=>{const a=b(f);r(E,a)&&S?.(),d?.(),c?.(),_&&l?.("/"),u?.()},shouldShowErrorNotice:r,isMachineDomain:b}},wr=()=>{const{client:r}=Pe(),b=M.useCallback(async S=>{const{mac_address:d="",app_version:c="",anydesk_id:l=""}=S,{data:u}=await r.post("/cash-register/login",{mac_address:d,app_version:c,anydesk_id:l});return u},[r]),O=M.useCallback(async()=>r.get("/member/getMemberInfo"),[r]),E=M.useCallback(async()=>{const{data:S}=await r.get("/getGameList");return S},[r]),f=M.useCallback(async()=>await r.get("/member/getNowCurrencyExchange"),[r]),_=M.useCallback(async()=>{const{data:S}=await r.get("/getFavoriteGame");return S},[r]);return{machineLoginApi:b,userInfoApi:O,userGameListApi:E,userFavoriteGameApi:_,userCurrencyExchangeApi:f}},st=({otherQueryKey:r=[],options:b={}}={})=>{const{userCurrencyExchangeApi:O}=wr(),{getToken:E}=Pe(),{enabled:f,..._}=b,S=!!E&&(f?f.every(d=>d):!0);return Ae.useQueries({queries:[{queryKey:["userCurrencyExchange",...r],queryFn:()=>O(),enabled:S,..._}]})};var je={},q={},Ue={},vr;function $(){return vr||(vr=1,(function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.isEventSourceSupported=r.isReactNative=r.ReadyState=r.DEFAULT_HEARTBEAT=r.UNPARSABLE_JSON_OBJECT=r.DEFAULT_RECONNECT_INTERVAL_MS=r.DEFAULT_RECONNECT_LIMIT=r.SOCKET_IO_PING_CODE=r.SOCKET_IO_PATH=r.SOCKET_IO_PING_INTERVAL=r.DEFAULT_EVENT_SOURCE_OPTIONS=r.EMPTY_EVENT_HANDLERS=r.DEFAULT_OPTIONS=void 0;var b=1,O=1e3*b;r.DEFAULT_OPTIONS={},r.EMPTY_EVENT_HANDLERS={},r.DEFAULT_EVENT_SOURCE_OPTIONS={withCredentials:!1,events:r.EMPTY_EVENT_HANDLERS},r.SOCKET_IO_PING_INTERVAL=25*O,r.SOCKET_IO_PATH="/socket.io/?EIO=3&transport=websocket",r.SOCKET_IO_PING_CODE="2",r.DEFAULT_RECONNECT_LIMIT=20,r.DEFAULT_RECONNECT_INTERVAL_MS=5e3,r.UNPARSABLE_JSON_OBJECT={},r.DEFAULT_HEARTBEAT={message:"ping",timeout:6e4,interval:25e3};var E;(function(_){_[_.UNINSTANTIATED=-1]="UNINSTANTIATED",_[_.CONNECTING=0]="CONNECTING",_[_.OPEN=1]="OPEN",_[_.CLOSING=2]="CLOSING",_[_.CLOSED=3]="CLOSED"})(E||(r.ReadyState=E={}));var f=function(){try{return"EventSource"in globalThis}catch{return!1}};r.isReactNative=typeof navigator<"u"&&navigator.product==="ReactNative",r.isEventSourceSupported=!r.isReactNative&&f()})(Ue)),Ue}var Se={},We={},dr;function Je(){return dr||(dr=1,(function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.resetWebSockets=r.sharedWebSockets=void 0,r.sharedWebSockets={};var b=function(O){if(O&&r.sharedWebSockets.hasOwnProperty(O))delete r.sharedWebSockets[O];else for(var E in r.sharedWebSockets)r.sharedWebSockets.hasOwnProperty(E)&&delete r.sharedWebSockets[E]};r.resetWebSockets=b})(We)),We}var ne={},x={},Er;function He(){if(Er)return x;Er=1,Object.defineProperty(x,"__esModule",{value:!0}),x.setUpSocketIOPing=x.appendQueryParams=x.parseSocketIOUrl=void 0;var r=$(),b=function(f){if(f){var _=/^https|wss/.test(f),S=f.replace(/^(https?|wss?)(:\/\/)?/,""),d=S.replace(/\/$/,""),c=_?"wss":"ws";return"".concat(c,"://").concat(d).concat(r.SOCKET_IO_PATH)}else if(f===""){var _=/^https/.test(window.location.protocol),c=_?"wss":"ws",l=window.location.port?":".concat(window.location.port):"";return"".concat(c,"://").concat(window.location.hostname).concat(l).concat(r.SOCKET_IO_PATH)}return f};x.parseSocketIOUrl=b;var O=function(f,_){_===void 0&&(_={});var S=/\?([\w]+=[\w]+)/,d=S.test(f),c="".concat(Object.entries(_).reduce(function(l,u){var a=u[0],i=u[1];return l+"".concat(a,"=").concat(i,"&")},"").slice(0,-1));return"".concat(f).concat(d?"&":"?").concat(c)};x.appendQueryParams=O;var E=function(f,_){_===void 0&&(_=r.SOCKET_IO_PING_INTERVAL);var S=function(){return f(r.SOCKET_IO_PING_CODE)};return window.setInterval(S,_)};return x.setUpSocketIOPing=E,x}var we={},_r;function Ar(){if(_r)return we;_r=1,Object.defineProperty(we,"__esModule",{value:!0}),we.heartbeat=O;var r=$();function b(E){return Array.isArray(E)?E.reduce(function(f,_){return f.current>_.current?f:_}).current:E.current}function O(E,f,_){var S=_||{},d=S.interval,c=d===void 0?r.DEFAULT_HEARTBEAT.interval:d,l=S.timeout,u=l===void 0?r.DEFAULT_HEARTBEAT.timeout:l,a=S.message,i=a===void 0?r.DEFAULT_HEARTBEAT.message:a,t=Math.max(100,c/10),n=Date.now(),v=setInterval(function(){var h=Date.now(),o=b(f);if(o+u<=h)console.warn("Heartbeat timed out, closing connection, last message received ".concat(h-o,"ms ago, last ping sent ").concat(h-n,"ms ago")),E.close();else if(o+c<=h&&n+c<=h)try{typeof i=="function"?E.send(i()):E.send(i),n=h}catch(y){console.error("Heartbeat failed, closing connection",y instanceof Error?y.message:y),E.close()}},t);return E.addEventListener("close",function(){clearInterval(v)}),function(){}}return we}var he={},Fe={},Sr;function Ve(){return Sr||(Sr=1,(function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.resetSubscribers=r.removeSubscriber=r.addSubscriber=r.hasSubscribers=r.getSubscribers=void 0;var b={},O=[],E=function(c){return(0,r.hasSubscribers)(c)?Array.from(b[c]):O};r.getSubscribers=E;var f=function(c){var l;return((l=b[c])===null||l===void 0?void 0:l.size)>0};r.hasSubscribers=f;var _=function(c,l){b[c]=b[c]||new Set,b[c].add(l)};r.addSubscriber=_;var S=function(c,l){b[c].delete(l)};r.removeSubscriber=S;var d=function(c){if(c&&b.hasOwnProperty(c))delete b[c];else for(var l in b)b.hasOwnProperty(l)&&delete b[l]};r.resetSubscribers=d})(Fe)),Fe}var hr;function $e(){if(hr)return he;hr=1,Object.defineProperty(he,"__esModule",{value:!0}),he.assertIsWebSocket=O,he.resetGlobalState=E;var r=Je(),b=Ve();function O(f,_){if(!_&&!(f instanceof WebSocket))throw new Error("")}function E(f){(0,b.resetSubscribers)(f),(0,r.resetWebSockets)(f)}return he}var br;function lt(){if(br)return ne;br=1;var r=ne&&ne.__assign||function(){return r=Object.assign||function(u){for(var a,i=1,t=arguments.length;i<t;i++){a=arguments[i];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(u[n]=a[n])}return u},r.apply(this,arguments)};Object.defineProperty(ne,"__esModule",{value:!0}),ne.attachListeners=void 0;var b=He(),O=Ar(),E=$(),f=$e(),_=function(u,a,i,t){u.onmessage=function(n){var v;a.current.onMessage&&a.current.onMessage(n),typeof t?.current=="number"&&(t.current=Date.now()),!(typeof a.current.filter=="function"&&a.current.filter(n)!==!0)&&(a.current.heartbeat&&typeof a.current.heartbeat!="boolean"&&((v=a.current.heartbeat)===null||v===void 0?void 0:v.returnMessage)===n.data||i(n))}},S=function(u,a,i,t,n){u.onopen=function(v){if(a.current.onOpen&&a.current.onOpen(v),t.current=0,i(E.ReadyState.OPEN),a.current.heartbeat&&u instanceof WebSocket){var h=typeof a.current.heartbeat=="boolean"?void 0:a.current.heartbeat;n.current=Date.now(),(0,O.heartbeat)(u,n,h)}}},d=function(u,a,i,t,n){if(E.isEventSourceSupported&&u instanceof EventSource)return function(){};(0,f.assertIsWebSocket)(u,a.current.skipAssert);var v;return u.onclose=function(h){var o;if(a.current.onClose&&a.current.onClose(h),i(E.ReadyState.CLOSED),a.current.shouldReconnect&&a.current.shouldReconnect(h)){var y=(o=a.current.reconnectAttempts)!==null&&o!==void 0?o:E.DEFAULT_RECONNECT_LIMIT;if(n.current<y){var R=typeof a.current.reconnectInterval=="function"?a.current.reconnectInterval(n.current):a.current.reconnectInterval;v=window.setTimeout(function(){n.current++,t()},R??E.DEFAULT_RECONNECT_INTERVAL_MS)}else a.current.onReconnectStop&&a.current.onReconnectStop(y),console.warn("Max reconnect attempts of ".concat(y," exceeded"))}},function(){return v&&window.clearTimeout(v)}},c=function(u,a,i,t,n){var v;return u.onerror=function(h){var o;if(a.current.onError&&a.current.onError(h),E.isEventSourceSupported&&u instanceof EventSource&&(a.current.onClose&&a.current.onClose(r(r({},h),{code:1006,reason:"An error occurred with the EventSource: ".concat(h),wasClean:!1})),i(E.ReadyState.CLOSED),u.close()),a.current.retryOnError)if(n.current<((o=a.current.reconnectAttempts)!==null&&o!==void 0?o:E.DEFAULT_RECONNECT_LIMIT)){var y=typeof a.current.reconnectInterval=="function"?a.current.reconnectInterval(n.current):a.current.reconnectInterval;v=window.setTimeout(function(){n.current++,t()},y??E.DEFAULT_RECONNECT_INTERVAL_MS)}else a.current.onReconnectStop&&a.current.onReconnectStop(a.current.reconnectAttempts),console.warn("Max reconnect attempts of ".concat(a.current.reconnectAttempts," exceeded"))},function(){return v&&window.clearTimeout(v)}},l=function(u,a,i,t,n,v,h){var o=a.setLastMessage,y=a.setReadyState,R,P,T;return i.current.fromSocketIO&&(R=(0,b.setUpSocketIOPing)(h)),_(u,i,o,v),S(u,i,y,n,v),P=d(u,i,y,t,n),T=c(u,i,y,t,n),function(){y(E.ReadyState.CLOSING),P(),T(),u.close(),R&&clearInterval(R)}};return ne.attachListeners=l,ne}var ae={},yr;function ft(){if(yr)return ae;yr=1;var r=ae&&ae.__assign||function(){return r=Object.assign||function(a){for(var i,t=1,n=arguments.length;t<n;t++){i=arguments[t];for(var v in i)Object.prototype.hasOwnProperty.call(i,v)&&(a[v]=i[v])}return a},r.apply(this,arguments)};Object.defineProperty(ae,"__esModule",{value:!0}),ae.attachSharedListeners=void 0;var b=Je(),O=$(),E=Ve(),f=He(),_=Ar(),S=function(a,i,t){a.onmessage=function(n){(0,E.getSubscribers)(i).forEach(function(v){var h;v.optionsRef.current.onMessage&&v.optionsRef.current.onMessage(n),typeof((h=v?.lastMessageTime)===null||h===void 0?void 0:h.current)=="number"&&(v.lastMessageTime.current=Date.now()),!(typeof v.optionsRef.current.filter=="function"&&v.optionsRef.current.filter(n)!==!0)&&(t&&typeof t!="boolean"&&t?.returnMessage===n.data||v.setLastMessage(n))})}},d=function(a,i,t){a.onopen=function(n){var v=(0,E.getSubscribers)(i);v.forEach(function(h){h.reconnectCount.current=0,h.optionsRef.current.onOpen&&h.optionsRef.current.onOpen(n),h.setReadyState(O.ReadyState.OPEN),t&&a instanceof WebSocket&&(h.lastMessageTime.current=Date.now())}),t&&a instanceof WebSocket&&(0,_.heartbeat)(a,v.map(function(h){return h.lastMessageTime}),typeof t=="boolean"?void 0:t)}},c=function(a,i){a instanceof WebSocket&&(a.onclose=function(t){(0,E.getSubscribers)(i).forEach(function(n){n.optionsRef.current.onClose&&n.optionsRef.current.onClose(t),n.setReadyState(O.ReadyState.CLOSED)}),delete b.sharedWebSockets[i],(0,E.getSubscribers)(i).forEach(function(n){var v;if(n.optionsRef.current.shouldReconnect&&n.optionsRef.current.shouldReconnect(t)){var h=(v=n.optionsRef.current.reconnectAttempts)!==null&&v!==void 0?v:O.DEFAULT_RECONNECT_LIMIT;if(n.reconnectCount.current<h){var o=typeof n.optionsRef.current.reconnectInterval=="function"?n.optionsRef.current.reconnectInterval(n.reconnectCount.current):n.optionsRef.current.reconnectInterval;setTimeout(function(){n.reconnectCount.current++,n.reconnect.current()},o??O.DEFAULT_RECONNECT_INTERVAL_MS)}else n.optionsRef.current.onReconnectStop&&n.optionsRef.current.onReconnectStop(n.optionsRef.current.reconnectAttempts),console.warn("Max reconnect attempts of ".concat(h," exceeded"))}})})},l=function(a,i){a.onerror=function(t){(0,E.getSubscribers)(i).forEach(function(n){n.optionsRef.current.onError&&n.optionsRef.current.onError(t),O.isEventSourceSupported&&a instanceof EventSource&&(n.optionsRef.current.onClose&&n.optionsRef.current.onClose(r(r({},t),{code:1006,reason:"An error occurred with the EventSource: ".concat(t),wasClean:!1})),n.setReadyState(O.ReadyState.CLOSED))}),O.isEventSourceSupported&&a instanceof EventSource&&a.close()}},u=function(a,i,t,n){var v;return t.current.fromSocketIO&&(v=(0,f.setUpSocketIOPing)(n)),S(a,i,t.current.heartbeat),c(a,i),d(a,i,t.current.heartbeat),l(a,i),function(){v&&clearInterval(v)}};return ae.attachSharedListeners=u,ae}var gr;function vt(){if(gr)return Se;gr=1,Object.defineProperty(Se,"__esModule",{value:!0}),Se.createOrJoinSocket=void 0;var r=Je(),b=$(),O=lt(),E=ft(),f=Ve(),_=function(d,c,l,u,a){return function(){if((0,f.removeSubscriber)(d,c),!(0,f.hasSubscribers)(d)){try{var i=r.sharedWebSockets[d];i instanceof WebSocket&&(i.onclose=function(t){l.current.onClose&&l.current.onClose(t),u(b.ReadyState.CLOSED)}),i.close()}catch{}a&&a(),delete r.sharedWebSockets[d]}}},S=function(d,c,l,u,a,i,t,n,v){if(!b.isEventSourceSupported&&u.current.eventSourceOptions)throw b.isReactNative?new Error("EventSource is not supported in ReactNative"):new Error("EventSource is not supported");if(u.current.share){var h=null;r.sharedWebSockets[c]===void 0?(r.sharedWebSockets[c]=u.current.eventSourceOptions?new EventSource(c,u.current.eventSourceOptions):new WebSocket(c,u.current.protocols),d.current=r.sharedWebSockets[c],l(b.ReadyState.CONNECTING),h=(0,E.attachSharedListeners)(r.sharedWebSockets[c],c,u,v)):(d.current=r.sharedWebSockets[c],l(r.sharedWebSockets[c].readyState));var o={setLastMessage:a,setReadyState:l,optionsRef:u,reconnectCount:t,lastMessageTime:n,reconnect:i};return(0,f.addSubscriber)(c,o),_(c,o,u,l,h)}else{if(d.current=u.current.eventSourceOptions?new EventSource(c,u.current.eventSourceOptions):new WebSocket(c,u.current.protocols),l(b.ReadyState.CONNECTING),!d.current)throw new Error("WebSocket failed to be created");return(0,O.attachListeners)(d.current,{setLastMessage:a,setReadyState:l},u,i.current,t,n,v)}};return Se.createOrJoinSocket=S,Se}var Q={},Or;function dt(){return Or||(Or=1,(function(r){var b=Q&&Q.__awaiter||function(c,l,u,a){function i(t){return t instanceof u?t:new u(function(n){n(t)})}return new(u||(u=Promise))(function(t,n){function v(y){try{o(a.next(y))}catch(R){n(R)}}function h(y){try{o(a.throw(y))}catch(R){n(R)}}function o(y){y.done?t(y.value):i(y.value).then(v,h)}o((a=a.apply(c,l||[])).next())})},O=Q&&Q.__generator||function(c,l){var u={label:0,sent:function(){if(t[0]&1)throw t[1];return t[1]},trys:[],ops:[]},a,i,t,n=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return n.next=v(0),n.throw=v(1),n.return=v(2),typeof Symbol=="function"&&(n[Symbol.iterator]=function(){return this}),n;function v(o){return function(y){return h([o,y])}}function h(o){if(a)throw new TypeError("Generator is already executing.");for(;n&&(n=0,o[0]&&(u=0)),u;)try{if(a=1,i&&(t=o[0]&2?i.return:o[0]?i.throw||((t=i.return)&&t.call(i),0):i.next)&&!(t=t.call(i,o[1])).done)return t;switch(i=0,t&&(o=[o[0]&2,t.value]),o[0]){case 0:case 1:t=o;break;case 4:return u.label++,{value:o[1],done:!1};case 5:u.label++,i=o[1],o=[0];continue;case 7:o=u.ops.pop(),u.trys.pop();continue;default:if(t=u.trys,!(t=t.length>0&&t[t.length-1])&&(o[0]===6||o[0]===2)){u=0;continue}if(o[0]===3&&(!t||o[1]>t[0]&&o[1]<t[3])){u.label=o[1];break}if(o[0]===6&&u.label<t[1]){u.label=t[1],t=o;break}if(t&&u.label<t[2]){u.label=t[2],u.ops.push(o);break}t[2]&&u.ops.pop(),u.trys.pop();continue}o=l.call(c,u)}catch(y){o=[6,y],i=0}finally{a=t=0}if(o[0]&5)throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}},E=Q&&Q.__spreadArray||function(c,l,u){if(u||arguments.length===2)for(var a=0,i=l.length,t;a<i;a++)(t||!(a in l))&&(t||(t=Array.prototype.slice.call(l,0,a)),t[a]=l[a]);return c.concat(t||Array.prototype.slice.call(l))};Object.defineProperty(r,"__esModule",{value:!0}),r.getUrl=void 0;var f=He(),_=$(),S=function(c){return new Promise(function(l){return window.setTimeout(l,c)})},d=function(c,l){for(var u=[],a=2;a<arguments.length;a++)u[a-2]=arguments[a];return b(void 0,E([c,l],u,!0),void 0,function(i,t,n){var v,h,o,y,R,P,T,A;return n===void 0&&(n=0),O(this,function(I){switch(I.label){case 0:if(typeof i!="function")return[3,10];I.label=1;case 1:return I.trys.push([1,3,,9]),[4,i()];case 2:return v=I.sent(),[3,9];case 3:return I.sent(),t.current.retryOnError?(h=(P=t.current.reconnectAttempts)!==null&&P!==void 0?P:_.DEFAULT_RECONNECT_LIMIT,n<h?(o=typeof t.current.reconnectInterval=="function"?t.current.reconnectInterval(n):t.current.reconnectInterval,[4,S(o??_.DEFAULT_RECONNECT_INTERVAL_MS)]):[3,5]):[3,7];case 4:return I.sent(),[2,(0,r.getUrl)(i,t,n+1)];case 5:return(A=(T=t.current).onReconnectStop)===null||A===void 0||A.call(T,n),[2,null];case 6:return[3,8];case 7:return[2,null];case 8:return[3,9];case 9:return[3,11];case 10:v=i,I.label=11;case 11:return y=t.current.fromSocketIO?(0,f.parseSocketIOUrl)(v):v,R=t.current.queryParams?(0,f.appendQueryParams)(y,t.current.queryParams):y,[2,R]}})})};r.getUrl=d})(Q)),Q}var qe={},pr;function Et(){return pr||(pr=1,(function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.websocketWrapper=void 0;var b=function(O,E){return new Proxy(O,{get:function(f,_){var S=f[_];return _==="reconnect"?E:typeof S=="function"?(console.error("Calling methods directly on the websocket is not supported at this moment. You must use the methods returned by useWebSocket."),function(){}):S},set:function(f,_,S){return/^on/.test(_)?(console.warn("The websocket's event handlers should be defined through the options object passed into useWebSocket."),!1):(f[_]=S,!0)}})};r.websocketWrapper=b,r.default=r.websocketWrapper})(qe)),qe}var Tr;function Be(){if(Tr)return q;Tr=1;var r=q&&q.__assign||function(){return r=Object.assign||function(i){for(var t,n=1,v=arguments.length;n<v;n++){t=arguments[n];for(var h in t)Object.prototype.hasOwnProperty.call(t,h)&&(i[h]=t[h])}return i},r.apply(this,arguments)},b=q&&q.__awaiter||function(i,t,n,v){function h(o){return o instanceof n?o:new n(function(y){y(o)})}return new(n||(n=Promise))(function(o,y){function R(A){try{T(v.next(A))}catch(I){y(I)}}function P(A){try{T(v.throw(A))}catch(I){y(I)}}function T(A){A.done?o(A.value):h(A.value).then(R,P)}T((v=v.apply(i,t||[])).next())})},O=q&&q.__generator||function(i,t){var n={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},v,h,o,y=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return y.next=R(0),y.throw=R(1),y.return=R(2),typeof Symbol=="function"&&(y[Symbol.iterator]=function(){return this}),y;function R(T){return function(A){return P([T,A])}}function P(T){if(v)throw new TypeError("Generator is already executing.");for(;y&&(y=0,T[0]&&(n=0)),n;)try{if(v=1,h&&(o=T[0]&2?h.return:T[0]?h.throw||((o=h.return)&&o.call(h),0):h.next)&&!(o=o.call(h,T[1])).done)return o;switch(h=0,o&&(T=[T[0]&2,o.value]),T[0]){case 0:case 1:o=T;break;case 4:return n.label++,{value:T[1],done:!1};case 5:n.label++,h=T[1],T=[0];continue;case 7:T=n.ops.pop(),n.trys.pop();continue;default:if(o=n.trys,!(o=o.length>0&&o[o.length-1])&&(T[0]===6||T[0]===2)){n=0;continue}if(T[0]===3&&(!o||T[1]>o[0]&&T[1]<o[3])){n.label=T[1];break}if(T[0]===6&&n.label<o[1]){n.label=o[1],o=T;break}if(o&&n.label<o[2]){n.label=o[2],n.ops.push(T);break}o[2]&&n.ops.pop(),n.trys.pop();continue}T=t.call(i,n)}catch(A){T=[6,A],h=0}finally{v=o=0}if(T[0]&5)throw T[1];return{value:T[0]?T[1]:void 0,done:!0}}},E=q&&q.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(q,"__esModule",{value:!0}),q.useWebSocket=void 0;var f=M,_=rt,S=$(),d=vt(),c=dt(),l=E(Et()),u=$e(),a=function(i,t,n){t===void 0&&(t=S.DEFAULT_OPTIONS),n===void 0&&(n=!0);var v=(0,f.useState)(null),h=v[0],o=v[1],y=(0,f.useState)({}),R=y[0],P=y[1],T=(0,f.useMemo)(function(){if(!t.disableJson&&h)try{return JSON.parse(h.data)}catch{return S.UNPARSABLE_JSON_OBJECT}return null},[h,t.disableJson]),A=(0,f.useRef)(null),I=(0,f.useRef)(null),le=(0,f.useRef)(function(){}),fe=(0,f.useRef)(0),ke=(0,f.useRef)(Date.now()),be=(0,f.useRef)([]),H=(0,f.useRef)(null),j=(0,f.useRef)(t);j.current=t;var J=A.current&&R[A.current]!==void 0?R[A.current]:i!==null&&n===!0?S.ReadyState.CONNECTING:S.ReadyState.UNINSTANTIATED,Z=t.queryParams?JSON.stringify(t.queryParams):null,B=(0,f.useCallback)(function(L,U){var Y;if(U===void 0&&(U=!0),S.isEventSourceSupported&&I.current instanceof EventSource){console.warn("Unable to send a message from an eventSource");return}((Y=I.current)===null||Y===void 0?void 0:Y.readyState)===S.ReadyState.OPEN?((0,u.assertIsWebSocket)(I.current,j.current.skipAssert),I.current.send(L)):U&&be.current.push(L)},[]),ye=(0,f.useCallback)(function(L,U){U===void 0&&(U=!0),B(JSON.stringify(L),U)},[B]),ge=(0,f.useCallback)(function(){return j.current.share!==!0||S.isEventSourceSupported&&I.current instanceof EventSource?I.current:(H.current===null&&I.current&&((0,u.assertIsWebSocket)(I.current,j.current.skipAssert),H.current=(0,l.default)(I.current,le)),H.current)},[]);return(0,f.useEffect)(function(){if(i!==null&&n===!0){var L,U=!1,Y=!0,ve=function(){return b(void 0,void 0,void 0,function(){var ee,X,Oe;return O(this,function(oe){switch(oe.label){case 0:return ee=A,[4,(0,c.getUrl)(i,j)];case 1:return ee.current=oe.sent(),A.current===null?(console.error("Failed to get a valid URL. WebSocket connection aborted."),A.current="ABORTED",(0,_.flushSync)(function(){return P(function(K){return r(r({},K),{ABORTED:S.ReadyState.CLOSED})})}),[2]):(X=function(K){U||(0,_.flushSync)(function(){return o(K)})},Oe=function(K){U||(0,_.flushSync)(function(){return P(function(ce){var re;return r(r({},ce),A.current&&(re={},re[A.current]=K,re))})})},Y&&(L=(0,d.createOrJoinSocket)(I,A.current,Oe,j,X,le,fe,ke,B)),[2])}})})};return le.current=function(){U||(H.current&&(H.current=null),L?.(),ve())},ve(),function(){U=!0,Y=!1,H.current&&(H.current=null),L?.(),o(null)}}else(i===null||n===!1)&&(fe.current=0,P(function(ee){var X;return r(r({},ee),A.current&&(X={},X[A.current]=S.ReadyState.CLOSED,X))}))},[i,n,Z,B]),(0,f.useEffect)(function(){J===S.ReadyState.OPEN&&be.current.splice(0).forEach(function(L){B(L)})},[J]),{sendMessage:B,sendJsonMessage:ye,lastMessage:h,lastJsonMessage:T,readyState:J,getWebSocket:ge}};return q.useWebSocket=a,q}var ue={},mr;function _t(){if(mr)return ue;mr=1;var r=ue&&ue.__assign||function(){return r=Object.assign||function(d){for(var c,l=1,u=arguments.length;l<u;l++){c=arguments[l];for(var a in c)Object.prototype.hasOwnProperty.call(c,a)&&(d[a]=c[a])}return d},r.apply(this,arguments)};Object.defineProperty(ue,"__esModule",{value:!0}),ue.useSocketIO=void 0;var b=M,O=Be(),E=$(),f={type:"empty",payload:null},_=function(d){if(!d||!d.data)return f;var c=d.data.match(/\[.*]/);if(!c)return f;var l=JSON.parse(c);return!Array.isArray(l)||!l[1]?f:{type:l[0],payload:l[1]}},S=function(d,c,l){c===void 0&&(c=E.DEFAULT_OPTIONS),l===void 0&&(l=!0);var u=(0,b.useMemo)(function(){return r(r({},c),{fromSocketIO:!0})},[]),a=(0,O.useWebSocket)(d,u,l),i=a.sendMessage,t=a.sendJsonMessage,n=a.lastMessage,v=a.readyState,h=a.getWebSocket,o=(0,b.useMemo)(function(){return _(n)},[n]);return{sendMessage:i,sendJsonMessage:t,lastMessage:o,lastJsonMessage:o,readyState:v,getWebSocket:h}};return ue.useSocketIO=S,ue}var z={},Cr;function St(){if(Cr)return z;Cr=1;var r=z&&z.__assign||function(){return r=Object.assign||function(S){for(var d,c=1,l=arguments.length;c<l;c++){d=arguments[c];for(var u in d)Object.prototype.hasOwnProperty.call(d,u)&&(S[u]=d[u])}return S},r.apply(this,arguments)},b=z&&z.__rest||function(S,d){var c={};for(var l in S)Object.prototype.hasOwnProperty.call(S,l)&&d.indexOf(l)<0&&(c[l]=S[l]);if(S!=null&&typeof Object.getOwnPropertySymbols=="function")for(var u=0,l=Object.getOwnPropertySymbols(S);u<l.length;u++)d.indexOf(l[u])<0&&Object.prototype.propertyIsEnumerable.call(S,l[u])&&(c[l[u]]=S[l[u]]);return c};Object.defineProperty(z,"__esModule",{value:!0}),z.useEventSource=void 0;var O=M,E=Be(),f=$(),_=function(S,d,c){d===void 0&&(d=f.DEFAULT_EVENT_SOURCE_OPTIONS);var l=d.withCredentials,u=d.events,a=b(d,["withCredentials","events"]);c===void 0&&(c=!0);var i=r(r({},a),{eventSourceOptions:{withCredentials:l}}),t=(0,O.useRef)(f.EMPTY_EVENT_HANDLERS);u&&(t.current=u);var n=(0,E.useWebSocket)(S,i,c),v=n.lastMessage,h=n.readyState,o=n.getWebSocket;return(0,O.useEffect)(function(){v?.type&&Object.entries(t.current).forEach(function(y){var R=y[0],P=y[1];R===v.type&&P(v)})},[v]),{lastEvent:v,readyState:h,getEventSource:o}};return z.useEventSource=_,z}var Rr;function ht(){return Rr||(Rr=1,(function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.resetGlobalState=r.useEventSource=r.ReadyState=r.useSocketIO=r.default=void 0;var b=Be();Object.defineProperty(r,"default",{enumerable:!0,get:function(){return b.useWebSocket}});var O=_t();Object.defineProperty(r,"useSocketIO",{enumerable:!0,get:function(){return O.useSocketIO}});var E=$();Object.defineProperty(r,"ReadyState",{enumerable:!0,get:function(){return E.ReadyState}});var f=St();Object.defineProperty(r,"useEventSource",{enumerable:!0,get:function(){return f.useEventSource}});var _=$e();Object.defineProperty(r,"resetGlobalState",{enumerable:!0,get:function(){return _.resetGlobalState}})})(je)),je}var bt=ht();const yt=tt(bt),V={DEPOSIT:"deposit",TRANS_CODE:"transCode",ERROR:"error",UPDATE_MEMBER:"update_member",MAINTAIN_NOTICE:"maintain_notice",MAINTAIN_NOTICE_MEMBER:"maintain_notice_member",RELOAD:"reload",TRANSFER_IN_GAME:"transfer_in_game",CHECK_REQUEST:"CHECK_RREQUEST",CASH_REGISTER_LIMIT:"cash_register_limit"},gt=3e4,Ot=({socketUrl:r,socketHandlers:b={},options:O={}})=>{const E=M.useRef(!1),f=M.useRef(b),{sendMessage:_,sendJsonMessage:S,lastMessage:d,readyState:c}=yt(r,{queryParams:{key:"wsky"},onOpen:()=>console.log("連線成功"),shouldReconnect:()=>E.current===!1,reconnectAttempts:9999,reconnectInterval:1e3,...O}),l=M.useMemo(()=>{try{return JSON.parse(d?.data)}catch{return null}},[d?.data]);return M.useEffect(()=>{const u=setInterval(()=>_("ping"),gt);return()=>clearInterval(u)},[_]),M.useEffect(()=>{f.current=b},[b]),M.useEffect(()=>{if(!l)return;const{onDeposit:u,onTransCode:a,onError:i,onUpdateMember:t,onMaintainNotice:n,onMaintainNoticeMember:v,onReload:h,onTransferInGame:o,onCashRegisterLimit:y}=f.current,R=Ce.get(l,"type",""),P={memberInfoUid:Ce.get(l,"member_info_uid",null),data:Ce.get(l,"data",null),memo:Ce.get(l,"memo",null)};switch(R){case V.DEPOSIT:u?.(P);break;case V.TRANS_CODE:a?.(P);break;case V.ERROR:i?.(P);break;case V.UPDATE_MEMBER:t?.(P);break;case V.MAINTAIN_NOTICE:n?.(P);break;case V.MAINTAIN_NOTICE_MEMBER:v?.(P);break;case V.RELOAD:h?.(P);break;case V.TRANSFER_IN_GAME:case V.CHECK_REQUEST:o?.(P);break;case V.CASH_REGISTER_LIMIT:y?.(P);break;default:console.warn("Unknown socket type:",R);break}},[l]),M.useEffect(()=>()=>E.current=!0,[]),{sendMessage:_,sendJsonMessage:S,readyState:c}},pt=({refetchInterval:r=5e4,trigger:b=[],enabled:O=!0}={})=>{const{getToken:E}=Pe(),{userInfoApi:f}=wr(),_=Ae.useQueries({queries:[{queryKey:["getMemberInfo",...b],queryFn:async()=>await f(),refetchInterval:r,enabled:!!E&&O}]}),{data:S,isFetching:d,error:c}=_[0]||{};return{data:S,isFetching:d,error:c}};exports.ApiCtx=Ge;exports.ApiProvider=ct;exports.createLogoutHandler=it;exports.useApiContext=Pe;exports.useBalanceGetter=st;exports.useClientWebSocket=Ot;exports.useGetMemberInfo=pt;
|
|
14
|
+
<%s key={someKey} {...props} />`,Le,te,Xr,te),or[te+Le]=!0}}return e===E?Yr(D):Br(D),D}}function Kr(e,l,g){return cr(e,l,g,!0)}function xr(e,l,g){return cr(e,l,g,!1)}var Qr=xr,zr=Kr;_e.Fragment=E,_e.jsx=Qr,_e.jsxs=zr})()),_e}var lr;function ut(){return lr||(lr=1,process.env.NODE_ENV==="production"?Re.exports=nt():Re.exports=at()),Re.exports}var fr=ut();const Ge=M.createContext(null),Pe=()=>{const r=M.useContext(Ge);if(!r)throw new Error("useApiContext must be used within ApiProvider");return r};function ot({baseURL:r,getToken:b,timeoutMs:O=15e3,lng:E="tw",store:f,onError:_}={}){const S=et.create({baseURL:r,timeout:O,headers:{"Content-Type":"application/json"}});return S.interceptors.request.use(async d=>{if(d.headers=d.headers||{},b){const s=await b();s&&(d.headers.Authorization=`Bearer ${s}`)}const c=f?.getState()?.isWalletCurrency;return d.headers.Currency=c,d.headers["currency-code"]=c,d.headers.lang=E,d}),S.interceptors.response.use(d=>d.data,d=>_?_(d,{instance:S}):Promise.reject(d)),S}function ct({children:r,...b}){const O=M.useMemo(()=>ot(b),[b]),f=M.useMemo(()=>new Ae.QueryClient({defaultOptions:{queries:{refetchOnWindowFocus:!1,retry:1}}}),[]);return fr.jsx(Ae.QueryClientProvider,{client:f,children:fr.jsx(Ge.Provider,{value:{client:O,...b},children:r})})}const it=()=>{const r=(E,f)=>!E&&!f,b=E=>E.startsWith("pc.");return{executeLogout:({isCallBackInvalid:E=!1,hostname:f="",shouldRedirect:_,onShowError:S,onCleanup:d,onRemoveToken:c,onRedirect:s,onGoogleLogout:u})=>{const a=b(f);r(E,a)&&S?.(),d?.(),c?.(),_&&s?.("/"),u?.()},shouldShowErrorNotice:r,isMachineDomain:b}},wr=()=>{const{client:r}=Pe(),b=M.useCallback(async S=>{const{mac_address:d="",app_version:c="",anydesk_id:s=""}=S,{data:u}=await r.post("/cash-register/login",{mac_address:d,app_version:c,anydesk_id:s});return u},[r]),O=M.useCallback(async()=>r.get("/member/getMemberInfo"),[r]),E=M.useCallback(async()=>{const{data:S}=await r.get("/getGameList");return S},[r]),f=M.useCallback(async()=>await r.get("/member/getNowCurrencyExchange"),[r]),_=M.useCallback(async()=>{const{data:S}=await r.get("/getFavoriteGame");return S},[r]);return{machineLoginApi:b,userInfoApi:O,userGameListApi:E,userFavoriteGameApi:_,userCurrencyExchangeApi:f}},st=({otherQueryKey:r=[],options:b={}}={})=>{const{userCurrencyExchangeApi:O}=wr(),{getToken:E}=Pe(),{enabled:f,..._}=b,S=!!E&&(f?f.every(d=>d):!0);return Ae.useQueries({queries:[{queryKey:["userCurrencyExchange",...r],queryFn:()=>O(),enabled:S,..._}]})};var je={},q={},Ue={},vr;function $(){return vr||(vr=1,(function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.isEventSourceSupported=r.isReactNative=r.ReadyState=r.DEFAULT_HEARTBEAT=r.UNPARSABLE_JSON_OBJECT=r.DEFAULT_RECONNECT_INTERVAL_MS=r.DEFAULT_RECONNECT_LIMIT=r.SOCKET_IO_PING_CODE=r.SOCKET_IO_PATH=r.SOCKET_IO_PING_INTERVAL=r.DEFAULT_EVENT_SOURCE_OPTIONS=r.EMPTY_EVENT_HANDLERS=r.DEFAULT_OPTIONS=void 0;var b=1,O=1e3*b;r.DEFAULT_OPTIONS={},r.EMPTY_EVENT_HANDLERS={},r.DEFAULT_EVENT_SOURCE_OPTIONS={withCredentials:!1,events:r.EMPTY_EVENT_HANDLERS},r.SOCKET_IO_PING_INTERVAL=25*O,r.SOCKET_IO_PATH="/socket.io/?EIO=3&transport=websocket",r.SOCKET_IO_PING_CODE="2",r.DEFAULT_RECONNECT_LIMIT=20,r.DEFAULT_RECONNECT_INTERVAL_MS=5e3,r.UNPARSABLE_JSON_OBJECT={},r.DEFAULT_HEARTBEAT={message:"ping",timeout:6e4,interval:25e3};var E;(function(_){_[_.UNINSTANTIATED=-1]="UNINSTANTIATED",_[_.CONNECTING=0]="CONNECTING",_[_.OPEN=1]="OPEN",_[_.CLOSING=2]="CLOSING",_[_.CLOSED=3]="CLOSED"})(E||(r.ReadyState=E={}));var f=function(){try{return"EventSource"in globalThis}catch{return!1}};r.isReactNative=typeof navigator<"u"&&navigator.product==="ReactNative",r.isEventSourceSupported=!r.isReactNative&&f()})(Ue)),Ue}var Se={},We={},dr;function Je(){return dr||(dr=1,(function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.resetWebSockets=r.sharedWebSockets=void 0,r.sharedWebSockets={};var b=function(O){if(O&&r.sharedWebSockets.hasOwnProperty(O))delete r.sharedWebSockets[O];else for(var E in r.sharedWebSockets)r.sharedWebSockets.hasOwnProperty(E)&&delete r.sharedWebSockets[E]};r.resetWebSockets=b})(We)),We}var ne={},x={},Er;function He(){if(Er)return x;Er=1,Object.defineProperty(x,"__esModule",{value:!0}),x.setUpSocketIOPing=x.appendQueryParams=x.parseSocketIOUrl=void 0;var r=$(),b=function(f){if(f){var _=/^https|wss/.test(f),S=f.replace(/^(https?|wss?)(:\/\/)?/,""),d=S.replace(/\/$/,""),c=_?"wss":"ws";return"".concat(c,"://").concat(d).concat(r.SOCKET_IO_PATH)}else if(f===""){var _=/^https/.test(window.location.protocol),c=_?"wss":"ws",s=window.location.port?":".concat(window.location.port):"";return"".concat(c,"://").concat(window.location.hostname).concat(s).concat(r.SOCKET_IO_PATH)}return f};x.parseSocketIOUrl=b;var O=function(f,_){_===void 0&&(_={});var S=/\?([\w]+=[\w]+)/,d=S.test(f),c="".concat(Object.entries(_).reduce(function(s,u){var a=u[0],i=u[1];return s+"".concat(a,"=").concat(i,"&")},"").slice(0,-1));return"".concat(f).concat(d?"&":"?").concat(c)};x.appendQueryParams=O;var E=function(f,_){_===void 0&&(_=r.SOCKET_IO_PING_INTERVAL);var S=function(){return f(r.SOCKET_IO_PING_CODE)};return window.setInterval(S,_)};return x.setUpSocketIOPing=E,x}var we={},_r;function Ar(){if(_r)return we;_r=1,Object.defineProperty(we,"__esModule",{value:!0}),we.heartbeat=O;var r=$();function b(E){return Array.isArray(E)?E.reduce(function(f,_){return f.current>_.current?f:_}).current:E.current}function O(E,f,_){var S=_||{},d=S.interval,c=d===void 0?r.DEFAULT_HEARTBEAT.interval:d,s=S.timeout,u=s===void 0?r.DEFAULT_HEARTBEAT.timeout:s,a=S.message,i=a===void 0?r.DEFAULT_HEARTBEAT.message:a,t=Math.max(100,c/10),n=Date.now(),v=setInterval(function(){var h=Date.now(),o=b(f);if(o+u<=h)console.warn("Heartbeat timed out, closing connection, last message received ".concat(h-o,"ms ago, last ping sent ").concat(h-n,"ms ago")),E.close();else if(o+c<=h&&n+c<=h)try{typeof i=="function"?E.send(i()):E.send(i),n=h}catch(y){console.error("Heartbeat failed, closing connection",y instanceof Error?y.message:y),E.close()}},t);return E.addEventListener("close",function(){clearInterval(v)}),function(){}}return we}var he={},Fe={},Sr;function Ve(){return Sr||(Sr=1,(function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.resetSubscribers=r.removeSubscriber=r.addSubscriber=r.hasSubscribers=r.getSubscribers=void 0;var b={},O=[],E=function(c){return(0,r.hasSubscribers)(c)?Array.from(b[c]):O};r.getSubscribers=E;var f=function(c){var s;return((s=b[c])===null||s===void 0?void 0:s.size)>0};r.hasSubscribers=f;var _=function(c,s){b[c]=b[c]||new Set,b[c].add(s)};r.addSubscriber=_;var S=function(c,s){b[c].delete(s)};r.removeSubscriber=S;var d=function(c){if(c&&b.hasOwnProperty(c))delete b[c];else for(var s in b)b.hasOwnProperty(s)&&delete b[s]};r.resetSubscribers=d})(Fe)),Fe}var hr;function $e(){if(hr)return he;hr=1,Object.defineProperty(he,"__esModule",{value:!0}),he.assertIsWebSocket=O,he.resetGlobalState=E;var r=Je(),b=Ve();function O(f,_){if(!_&&!(f instanceof WebSocket))throw new Error("")}function E(f){(0,b.resetSubscribers)(f),(0,r.resetWebSockets)(f)}return he}var br;function lt(){if(br)return ne;br=1;var r=ne&&ne.__assign||function(){return r=Object.assign||function(u){for(var a,i=1,t=arguments.length;i<t;i++){a=arguments[i];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(u[n]=a[n])}return u},r.apply(this,arguments)};Object.defineProperty(ne,"__esModule",{value:!0}),ne.attachListeners=void 0;var b=He(),O=Ar(),E=$(),f=$e(),_=function(u,a,i,t){u.onmessage=function(n){var v;a.current.onMessage&&a.current.onMessage(n),typeof t?.current=="number"&&(t.current=Date.now()),!(typeof a.current.filter=="function"&&a.current.filter(n)!==!0)&&(a.current.heartbeat&&typeof a.current.heartbeat!="boolean"&&((v=a.current.heartbeat)===null||v===void 0?void 0:v.returnMessage)===n.data||i(n))}},S=function(u,a,i,t,n){u.onopen=function(v){if(a.current.onOpen&&a.current.onOpen(v),t.current=0,i(E.ReadyState.OPEN),a.current.heartbeat&&u instanceof WebSocket){var h=typeof a.current.heartbeat=="boolean"?void 0:a.current.heartbeat;n.current=Date.now(),(0,O.heartbeat)(u,n,h)}}},d=function(u,a,i,t,n){if(E.isEventSourceSupported&&u instanceof EventSource)return function(){};(0,f.assertIsWebSocket)(u,a.current.skipAssert);var v;return u.onclose=function(h){var o;if(a.current.onClose&&a.current.onClose(h),i(E.ReadyState.CLOSED),a.current.shouldReconnect&&a.current.shouldReconnect(h)){var y=(o=a.current.reconnectAttempts)!==null&&o!==void 0?o:E.DEFAULT_RECONNECT_LIMIT;if(n.current<y){var R=typeof a.current.reconnectInterval=="function"?a.current.reconnectInterval(n.current):a.current.reconnectInterval;v=window.setTimeout(function(){n.current++,t()},R??E.DEFAULT_RECONNECT_INTERVAL_MS)}else a.current.onReconnectStop&&a.current.onReconnectStop(y),console.warn("Max reconnect attempts of ".concat(y," exceeded"))}},function(){return v&&window.clearTimeout(v)}},c=function(u,a,i,t,n){var v;return u.onerror=function(h){var o;if(a.current.onError&&a.current.onError(h),E.isEventSourceSupported&&u instanceof EventSource&&(a.current.onClose&&a.current.onClose(r(r({},h),{code:1006,reason:"An error occurred with the EventSource: ".concat(h),wasClean:!1})),i(E.ReadyState.CLOSED),u.close()),a.current.retryOnError)if(n.current<((o=a.current.reconnectAttempts)!==null&&o!==void 0?o:E.DEFAULT_RECONNECT_LIMIT)){var y=typeof a.current.reconnectInterval=="function"?a.current.reconnectInterval(n.current):a.current.reconnectInterval;v=window.setTimeout(function(){n.current++,t()},y??E.DEFAULT_RECONNECT_INTERVAL_MS)}else a.current.onReconnectStop&&a.current.onReconnectStop(a.current.reconnectAttempts),console.warn("Max reconnect attempts of ".concat(a.current.reconnectAttempts," exceeded"))},function(){return v&&window.clearTimeout(v)}},s=function(u,a,i,t,n,v,h){var o=a.setLastMessage,y=a.setReadyState,R,P,T;return i.current.fromSocketIO&&(R=(0,b.setUpSocketIOPing)(h)),_(u,i,o,v),S(u,i,y,n,v),P=d(u,i,y,t,n),T=c(u,i,y,t,n),function(){y(E.ReadyState.CLOSING),P(),T(),u.close(),R&&clearInterval(R)}};return ne.attachListeners=s,ne}var ae={},yr;function ft(){if(yr)return ae;yr=1;var r=ae&&ae.__assign||function(){return r=Object.assign||function(a){for(var i,t=1,n=arguments.length;t<n;t++){i=arguments[t];for(var v in i)Object.prototype.hasOwnProperty.call(i,v)&&(a[v]=i[v])}return a},r.apply(this,arguments)};Object.defineProperty(ae,"__esModule",{value:!0}),ae.attachSharedListeners=void 0;var b=Je(),O=$(),E=Ve(),f=He(),_=Ar(),S=function(a,i,t){a.onmessage=function(n){(0,E.getSubscribers)(i).forEach(function(v){var h;v.optionsRef.current.onMessage&&v.optionsRef.current.onMessage(n),typeof((h=v?.lastMessageTime)===null||h===void 0?void 0:h.current)=="number"&&(v.lastMessageTime.current=Date.now()),!(typeof v.optionsRef.current.filter=="function"&&v.optionsRef.current.filter(n)!==!0)&&(t&&typeof t!="boolean"&&t?.returnMessage===n.data||v.setLastMessage(n))})}},d=function(a,i,t){a.onopen=function(n){var v=(0,E.getSubscribers)(i);v.forEach(function(h){h.reconnectCount.current=0,h.optionsRef.current.onOpen&&h.optionsRef.current.onOpen(n),h.setReadyState(O.ReadyState.OPEN),t&&a instanceof WebSocket&&(h.lastMessageTime.current=Date.now())}),t&&a instanceof WebSocket&&(0,_.heartbeat)(a,v.map(function(h){return h.lastMessageTime}),typeof t=="boolean"?void 0:t)}},c=function(a,i){a instanceof WebSocket&&(a.onclose=function(t){(0,E.getSubscribers)(i).forEach(function(n){n.optionsRef.current.onClose&&n.optionsRef.current.onClose(t),n.setReadyState(O.ReadyState.CLOSED)}),delete b.sharedWebSockets[i],(0,E.getSubscribers)(i).forEach(function(n){var v;if(n.optionsRef.current.shouldReconnect&&n.optionsRef.current.shouldReconnect(t)){var h=(v=n.optionsRef.current.reconnectAttempts)!==null&&v!==void 0?v:O.DEFAULT_RECONNECT_LIMIT;if(n.reconnectCount.current<h){var o=typeof n.optionsRef.current.reconnectInterval=="function"?n.optionsRef.current.reconnectInterval(n.reconnectCount.current):n.optionsRef.current.reconnectInterval;setTimeout(function(){n.reconnectCount.current++,n.reconnect.current()},o??O.DEFAULT_RECONNECT_INTERVAL_MS)}else n.optionsRef.current.onReconnectStop&&n.optionsRef.current.onReconnectStop(n.optionsRef.current.reconnectAttempts),console.warn("Max reconnect attempts of ".concat(h," exceeded"))}})})},s=function(a,i){a.onerror=function(t){(0,E.getSubscribers)(i).forEach(function(n){n.optionsRef.current.onError&&n.optionsRef.current.onError(t),O.isEventSourceSupported&&a instanceof EventSource&&(n.optionsRef.current.onClose&&n.optionsRef.current.onClose(r(r({},t),{code:1006,reason:"An error occurred with the EventSource: ".concat(t),wasClean:!1})),n.setReadyState(O.ReadyState.CLOSED))}),O.isEventSourceSupported&&a instanceof EventSource&&a.close()}},u=function(a,i,t,n){var v;return t.current.fromSocketIO&&(v=(0,f.setUpSocketIOPing)(n)),S(a,i,t.current.heartbeat),c(a,i),d(a,i,t.current.heartbeat),s(a,i),function(){v&&clearInterval(v)}};return ae.attachSharedListeners=u,ae}var gr;function vt(){if(gr)return Se;gr=1,Object.defineProperty(Se,"__esModule",{value:!0}),Se.createOrJoinSocket=void 0;var r=Je(),b=$(),O=lt(),E=ft(),f=Ve(),_=function(d,c,s,u,a){return function(){if((0,f.removeSubscriber)(d,c),!(0,f.hasSubscribers)(d)){try{var i=r.sharedWebSockets[d];i instanceof WebSocket&&(i.onclose=function(t){s.current.onClose&&s.current.onClose(t),u(b.ReadyState.CLOSED)}),i.close()}catch{}a&&a(),delete r.sharedWebSockets[d]}}},S=function(d,c,s,u,a,i,t,n,v){if(!b.isEventSourceSupported&&u.current.eventSourceOptions)throw b.isReactNative?new Error("EventSource is not supported in ReactNative"):new Error("EventSource is not supported");if(u.current.share){var h=null;r.sharedWebSockets[c]===void 0?(r.sharedWebSockets[c]=u.current.eventSourceOptions?new EventSource(c,u.current.eventSourceOptions):new WebSocket(c,u.current.protocols),d.current=r.sharedWebSockets[c],s(b.ReadyState.CONNECTING),h=(0,E.attachSharedListeners)(r.sharedWebSockets[c],c,u,v)):(d.current=r.sharedWebSockets[c],s(r.sharedWebSockets[c].readyState));var o={setLastMessage:a,setReadyState:s,optionsRef:u,reconnectCount:t,lastMessageTime:n,reconnect:i};return(0,f.addSubscriber)(c,o),_(c,o,u,s,h)}else{if(d.current=u.current.eventSourceOptions?new EventSource(c,u.current.eventSourceOptions):new WebSocket(c,u.current.protocols),s(b.ReadyState.CONNECTING),!d.current)throw new Error("WebSocket failed to be created");return(0,O.attachListeners)(d.current,{setLastMessage:a,setReadyState:s},u,i.current,t,n,v)}};return Se.createOrJoinSocket=S,Se}var Q={},Or;function dt(){return Or||(Or=1,(function(r){var b=Q&&Q.__awaiter||function(c,s,u,a){function i(t){return t instanceof u?t:new u(function(n){n(t)})}return new(u||(u=Promise))(function(t,n){function v(y){try{o(a.next(y))}catch(R){n(R)}}function h(y){try{o(a.throw(y))}catch(R){n(R)}}function o(y){y.done?t(y.value):i(y.value).then(v,h)}o((a=a.apply(c,s||[])).next())})},O=Q&&Q.__generator||function(c,s){var u={label:0,sent:function(){if(t[0]&1)throw t[1];return t[1]},trys:[],ops:[]},a,i,t,n=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return n.next=v(0),n.throw=v(1),n.return=v(2),typeof Symbol=="function"&&(n[Symbol.iterator]=function(){return this}),n;function v(o){return function(y){return h([o,y])}}function h(o){if(a)throw new TypeError("Generator is already executing.");for(;n&&(n=0,o[0]&&(u=0)),u;)try{if(a=1,i&&(t=o[0]&2?i.return:o[0]?i.throw||((t=i.return)&&t.call(i),0):i.next)&&!(t=t.call(i,o[1])).done)return t;switch(i=0,t&&(o=[o[0]&2,t.value]),o[0]){case 0:case 1:t=o;break;case 4:return u.label++,{value:o[1],done:!1};case 5:u.label++,i=o[1],o=[0];continue;case 7:o=u.ops.pop(),u.trys.pop();continue;default:if(t=u.trys,!(t=t.length>0&&t[t.length-1])&&(o[0]===6||o[0]===2)){u=0;continue}if(o[0]===3&&(!t||o[1]>t[0]&&o[1]<t[3])){u.label=o[1];break}if(o[0]===6&&u.label<t[1]){u.label=t[1],t=o;break}if(t&&u.label<t[2]){u.label=t[2],u.ops.push(o);break}t[2]&&u.ops.pop(),u.trys.pop();continue}o=s.call(c,u)}catch(y){o=[6,y],i=0}finally{a=t=0}if(o[0]&5)throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}},E=Q&&Q.__spreadArray||function(c,s,u){if(u||arguments.length===2)for(var a=0,i=s.length,t;a<i;a++)(t||!(a in s))&&(t||(t=Array.prototype.slice.call(s,0,a)),t[a]=s[a]);return c.concat(t||Array.prototype.slice.call(s))};Object.defineProperty(r,"__esModule",{value:!0}),r.getUrl=void 0;var f=He(),_=$(),S=function(c){return new Promise(function(s){return window.setTimeout(s,c)})},d=function(c,s){for(var u=[],a=2;a<arguments.length;a++)u[a-2]=arguments[a];return b(void 0,E([c,s],u,!0),void 0,function(i,t,n){var v,h,o,y,R,P,T,A;return n===void 0&&(n=0),O(this,function(I){switch(I.label){case 0:if(typeof i!="function")return[3,10];I.label=1;case 1:return I.trys.push([1,3,,9]),[4,i()];case 2:return v=I.sent(),[3,9];case 3:return I.sent(),t.current.retryOnError?(h=(P=t.current.reconnectAttempts)!==null&&P!==void 0?P:_.DEFAULT_RECONNECT_LIMIT,n<h?(o=typeof t.current.reconnectInterval=="function"?t.current.reconnectInterval(n):t.current.reconnectInterval,[4,S(o??_.DEFAULT_RECONNECT_INTERVAL_MS)]):[3,5]):[3,7];case 4:return I.sent(),[2,(0,r.getUrl)(i,t,n+1)];case 5:return(A=(T=t.current).onReconnectStop)===null||A===void 0||A.call(T,n),[2,null];case 6:return[3,8];case 7:return[2,null];case 8:return[3,9];case 9:return[3,11];case 10:v=i,I.label=11;case 11:return y=t.current.fromSocketIO?(0,f.parseSocketIOUrl)(v):v,R=t.current.queryParams?(0,f.appendQueryParams)(y,t.current.queryParams):y,[2,R]}})})};r.getUrl=d})(Q)),Q}var qe={},pr;function Et(){return pr||(pr=1,(function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.websocketWrapper=void 0;var b=function(O,E){return new Proxy(O,{get:function(f,_){var S=f[_];return _==="reconnect"?E:typeof S=="function"?(console.error("Calling methods directly on the websocket is not supported at this moment. You must use the methods returned by useWebSocket."),function(){}):S},set:function(f,_,S){return/^on/.test(_)?(console.warn("The websocket's event handlers should be defined through the options object passed into useWebSocket."),!1):(f[_]=S,!0)}})};r.websocketWrapper=b,r.default=r.websocketWrapper})(qe)),qe}var Tr;function Be(){if(Tr)return q;Tr=1;var r=q&&q.__assign||function(){return r=Object.assign||function(i){for(var t,n=1,v=arguments.length;n<v;n++){t=arguments[n];for(var h in t)Object.prototype.hasOwnProperty.call(t,h)&&(i[h]=t[h])}return i},r.apply(this,arguments)},b=q&&q.__awaiter||function(i,t,n,v){function h(o){return o instanceof n?o:new n(function(y){y(o)})}return new(n||(n=Promise))(function(o,y){function R(A){try{T(v.next(A))}catch(I){y(I)}}function P(A){try{T(v.throw(A))}catch(I){y(I)}}function T(A){A.done?o(A.value):h(A.value).then(R,P)}T((v=v.apply(i,t||[])).next())})},O=q&&q.__generator||function(i,t){var n={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},v,h,o,y=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return y.next=R(0),y.throw=R(1),y.return=R(2),typeof Symbol=="function"&&(y[Symbol.iterator]=function(){return this}),y;function R(T){return function(A){return P([T,A])}}function P(T){if(v)throw new TypeError("Generator is already executing.");for(;y&&(y=0,T[0]&&(n=0)),n;)try{if(v=1,h&&(o=T[0]&2?h.return:T[0]?h.throw||((o=h.return)&&o.call(h),0):h.next)&&!(o=o.call(h,T[1])).done)return o;switch(h=0,o&&(T=[T[0]&2,o.value]),T[0]){case 0:case 1:o=T;break;case 4:return n.label++,{value:T[1],done:!1};case 5:n.label++,h=T[1],T=[0];continue;case 7:T=n.ops.pop(),n.trys.pop();continue;default:if(o=n.trys,!(o=o.length>0&&o[o.length-1])&&(T[0]===6||T[0]===2)){n=0;continue}if(T[0]===3&&(!o||T[1]>o[0]&&T[1]<o[3])){n.label=T[1];break}if(T[0]===6&&n.label<o[1]){n.label=o[1],o=T;break}if(o&&n.label<o[2]){n.label=o[2],n.ops.push(T);break}o[2]&&n.ops.pop(),n.trys.pop();continue}T=t.call(i,n)}catch(A){T=[6,A],h=0}finally{v=o=0}if(T[0]&5)throw T[1];return{value:T[0]?T[1]:void 0,done:!0}}},E=q&&q.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(q,"__esModule",{value:!0}),q.useWebSocket=void 0;var f=M,_=rt,S=$(),d=vt(),c=dt(),s=E(Et()),u=$e(),a=function(i,t,n){t===void 0&&(t=S.DEFAULT_OPTIONS),n===void 0&&(n=!0);var v=(0,f.useState)(null),h=v[0],o=v[1],y=(0,f.useState)({}),R=y[0],P=y[1],T=(0,f.useMemo)(function(){if(!t.disableJson&&h)try{return JSON.parse(h.data)}catch{return S.UNPARSABLE_JSON_OBJECT}return null},[h,t.disableJson]),A=(0,f.useRef)(null),I=(0,f.useRef)(null),le=(0,f.useRef)(function(){}),fe=(0,f.useRef)(0),ke=(0,f.useRef)(Date.now()),be=(0,f.useRef)([]),H=(0,f.useRef)(null),j=(0,f.useRef)(t);j.current=t;var J=A.current&&R[A.current]!==void 0?R[A.current]:i!==null&&n===!0?S.ReadyState.CONNECTING:S.ReadyState.UNINSTANTIATED,Z=t.queryParams?JSON.stringify(t.queryParams):null,B=(0,f.useCallback)(function(L,U){var Y;if(U===void 0&&(U=!0),S.isEventSourceSupported&&I.current instanceof EventSource){console.warn("Unable to send a message from an eventSource");return}((Y=I.current)===null||Y===void 0?void 0:Y.readyState)===S.ReadyState.OPEN?((0,u.assertIsWebSocket)(I.current,j.current.skipAssert),I.current.send(L)):U&&be.current.push(L)},[]),ye=(0,f.useCallback)(function(L,U){U===void 0&&(U=!0),B(JSON.stringify(L),U)},[B]),ge=(0,f.useCallback)(function(){return j.current.share!==!0||S.isEventSourceSupported&&I.current instanceof EventSource?I.current:(H.current===null&&I.current&&((0,u.assertIsWebSocket)(I.current,j.current.skipAssert),H.current=(0,s.default)(I.current,le)),H.current)},[]);return(0,f.useEffect)(function(){if(i!==null&&n===!0){var L,U=!1,Y=!0,ve=function(){return b(void 0,void 0,void 0,function(){var ee,X,Oe;return O(this,function(oe){switch(oe.label){case 0:return ee=A,[4,(0,c.getUrl)(i,j)];case 1:return ee.current=oe.sent(),A.current===null?(console.error("Failed to get a valid URL. WebSocket connection aborted."),A.current="ABORTED",(0,_.flushSync)(function(){return P(function(K){return r(r({},K),{ABORTED:S.ReadyState.CLOSED})})}),[2]):(X=function(K){U||(0,_.flushSync)(function(){return o(K)})},Oe=function(K){U||(0,_.flushSync)(function(){return P(function(ce){var re;return r(r({},ce),A.current&&(re={},re[A.current]=K,re))})})},Y&&(L=(0,d.createOrJoinSocket)(I,A.current,Oe,j,X,le,fe,ke,B)),[2])}})})};return le.current=function(){U||(H.current&&(H.current=null),L?.(),ve())},ve(),function(){U=!0,Y=!1,H.current&&(H.current=null),L?.(),o(null)}}else(i===null||n===!1)&&(fe.current=0,P(function(ee){var X;return r(r({},ee),A.current&&(X={},X[A.current]=S.ReadyState.CLOSED,X))}))},[i,n,Z,B]),(0,f.useEffect)(function(){J===S.ReadyState.OPEN&&be.current.splice(0).forEach(function(L){B(L)})},[J]),{sendMessage:B,sendJsonMessage:ye,lastMessage:h,lastJsonMessage:T,readyState:J,getWebSocket:ge}};return q.useWebSocket=a,q}var ue={},mr;function _t(){if(mr)return ue;mr=1;var r=ue&&ue.__assign||function(){return r=Object.assign||function(d){for(var c,s=1,u=arguments.length;s<u;s++){c=arguments[s];for(var a in c)Object.prototype.hasOwnProperty.call(c,a)&&(d[a]=c[a])}return d},r.apply(this,arguments)};Object.defineProperty(ue,"__esModule",{value:!0}),ue.useSocketIO=void 0;var b=M,O=Be(),E=$(),f={type:"empty",payload:null},_=function(d){if(!d||!d.data)return f;var c=d.data.match(/\[.*]/);if(!c)return f;var s=JSON.parse(c);return!Array.isArray(s)||!s[1]?f:{type:s[0],payload:s[1]}},S=function(d,c,s){c===void 0&&(c=E.DEFAULT_OPTIONS),s===void 0&&(s=!0);var u=(0,b.useMemo)(function(){return r(r({},c),{fromSocketIO:!0})},[]),a=(0,O.useWebSocket)(d,u,s),i=a.sendMessage,t=a.sendJsonMessage,n=a.lastMessage,v=a.readyState,h=a.getWebSocket,o=(0,b.useMemo)(function(){return _(n)},[n]);return{sendMessage:i,sendJsonMessage:t,lastMessage:o,lastJsonMessage:o,readyState:v,getWebSocket:h}};return ue.useSocketIO=S,ue}var z={},Cr;function St(){if(Cr)return z;Cr=1;var r=z&&z.__assign||function(){return r=Object.assign||function(S){for(var d,c=1,s=arguments.length;c<s;c++){d=arguments[c];for(var u in d)Object.prototype.hasOwnProperty.call(d,u)&&(S[u]=d[u])}return S},r.apply(this,arguments)},b=z&&z.__rest||function(S,d){var c={};for(var s in S)Object.prototype.hasOwnProperty.call(S,s)&&d.indexOf(s)<0&&(c[s]=S[s]);if(S!=null&&typeof Object.getOwnPropertySymbols=="function")for(var u=0,s=Object.getOwnPropertySymbols(S);u<s.length;u++)d.indexOf(s[u])<0&&Object.prototype.propertyIsEnumerable.call(S,s[u])&&(c[s[u]]=S[s[u]]);return c};Object.defineProperty(z,"__esModule",{value:!0}),z.useEventSource=void 0;var O=M,E=Be(),f=$(),_=function(S,d,c){d===void 0&&(d=f.DEFAULT_EVENT_SOURCE_OPTIONS);var s=d.withCredentials,u=d.events,a=b(d,["withCredentials","events"]);c===void 0&&(c=!0);var i=r(r({},a),{eventSourceOptions:{withCredentials:s}}),t=(0,O.useRef)(f.EMPTY_EVENT_HANDLERS);u&&(t.current=u);var n=(0,E.useWebSocket)(S,i,c),v=n.lastMessage,h=n.readyState,o=n.getWebSocket;return(0,O.useEffect)(function(){v?.type&&Object.entries(t.current).forEach(function(y){var R=y[0],P=y[1];R===v.type&&P(v)})},[v]),{lastEvent:v,readyState:h,getEventSource:o}};return z.useEventSource=_,z}var Rr;function ht(){return Rr||(Rr=1,(function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.resetGlobalState=r.useEventSource=r.ReadyState=r.useSocketIO=r.default=void 0;var b=Be();Object.defineProperty(r,"default",{enumerable:!0,get:function(){return b.useWebSocket}});var O=_t();Object.defineProperty(r,"useSocketIO",{enumerable:!0,get:function(){return O.useSocketIO}});var E=$();Object.defineProperty(r,"ReadyState",{enumerable:!0,get:function(){return E.ReadyState}});var f=St();Object.defineProperty(r,"useEventSource",{enumerable:!0,get:function(){return f.useEventSource}});var _=$e();Object.defineProperty(r,"resetGlobalState",{enumerable:!0,get:function(){return _.resetGlobalState}})})(je)),je}var bt=ht();const yt=tt(bt),V={DEPOSIT:"deposit",TRANS_CODE:"transCode",ERROR:"error",UPDATE_MEMBER:"update_member",MAINTAIN_NOTICE:"maintain_notice",MAINTAIN_NOTICE_MEMBER:"maintain_notice_member",RELOAD:"reload",TRANSFER_IN_GAME:"transfer_in_game",CHECK_REQUEST:"CHECK_RREQUEST",CASH_REGISTER_LIMIT:"cash_register_limit"},gt=3e4,Ot=({socketUrl:r,socketHandlers:b={},options:O={}})=>{const E=M.useRef(!1),f=M.useRef(b),{sendMessage:_,sendJsonMessage:S,lastMessage:d,readyState:c}=yt(r,{queryParams:{key:"wsky"},onOpen:()=>console.log("連線成功"),shouldReconnect:()=>E.current===!1,reconnectAttempts:9999,reconnectInterval:1e3,...O}),s=M.useMemo(()=>{try{return JSON.parse(d?.data)}catch{return null}},[d?.data]);return M.useEffect(()=>{const u=setInterval(()=>_("ping"),gt);return()=>clearInterval(u)},[_]),M.useEffect(()=>{f.current=b},[b]),M.useEffect(()=>{if(!s)return;const{onDeposit:u,onTransCode:a,onError:i,onUpdateMember:t,onMaintainNotice:n,onMaintainNoticeMember:v,onReload:h,onTransferInGame:o,onCashRegisterLimit:y}=f.current,R=Ce.get(s,"type",""),P={memberInfoUid:Ce.get(s,"member_info_uid",null),data:Ce.get(s,"data",null),memo:Ce.get(s,"memo",null)};switch(R){case V.DEPOSIT:u?.(P);break;case V.TRANS_CODE:a?.(P);break;case V.ERROR:i?.(P);break;case V.UPDATE_MEMBER:t?.(P);break;case V.MAINTAIN_NOTICE:n?.(P);break;case V.MAINTAIN_NOTICE_MEMBER:v?.(P);break;case V.RELOAD:h?.(P);break;case V.TRANSFER_IN_GAME:case V.CHECK_REQUEST:o?.(P);break;case V.CASH_REGISTER_LIMIT:y?.(P);break;default:console.warn("Unknown socket type:",R);break}},[s]),M.useEffect(()=>()=>E.current=!0,[]),{sendMessage:_,sendJsonMessage:S,readyState:c}},pt=({refetchInterval:r=5e4,trigger:b=[],enabled:O=!0}={})=>{const{getToken:E}=Pe(),{userInfoApi:f}=wr(),_=Ae.useQueries({queries:[{queryKey:["getMemberInfo",...b],queryFn:async()=>await f(),refetchInterval:r,enabled:!!E&&O}]}),{data:S,isFetching:d,error:c}=_[0]||{};return{data:S,isFetching:d,error:c}};exports.ApiCtx=Ge;exports.ApiProvider=ct;exports.createLogoutHandler=it;exports.useApiContext=Pe;exports.useBalanceGetter=st;exports.useClientWebSocket=Ot;exports.useGetMemberInfo=pt;
|
package/dist/index.js
CHANGED
|
@@ -12,9 +12,9 @@ function ft() {
|
|
|
12
12
|
if (lr) return Ee;
|
|
13
13
|
lr = 1;
|
|
14
14
|
var r = ye, y = Symbol.for("react.element"), O = Symbol.for("react.fragment"), E = Object.prototype.hasOwnProperty, f = r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, _ = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
15
|
-
function S(d, c,
|
|
15
|
+
function S(d, c, s) {
|
|
16
16
|
var o, a = {}, i = null, t = null;
|
|
17
|
-
|
|
17
|
+
s !== void 0 && (i = "" + s), c.key !== void 0 && (i = "" + c.key), c.ref !== void 0 && (t = c.ref);
|
|
18
18
|
for (o in c) E.call(c, o) && !_.hasOwnProperty(o) && (a[o] = c[o]);
|
|
19
19
|
if (d && d.defaultProps) for (o in c = d.defaultProps, c) a[o] === void 0 && (a[o] = c[o]);
|
|
20
20
|
return { $$typeof: y, type: d, key: i, ref: t, props: a, _owner: f.current };
|
|
@@ -25,45 +25,45 @@ var _e = {};
|
|
|
25
25
|
var fr;
|
|
26
26
|
function vt() {
|
|
27
27
|
return fr || (fr = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
28
|
-
var r = ye, y = Symbol.for("react.element"), O = Symbol.for("react.portal"), E = Symbol.for("react.fragment"), f = Symbol.for("react.strict_mode"), _ = Symbol.for("react.profiler"), S = Symbol.for("react.provider"), d = Symbol.for("react.context"), c = Symbol.for("react.forward_ref"),
|
|
28
|
+
var r = ye, y = Symbol.for("react.element"), O = Symbol.for("react.portal"), E = Symbol.for("react.fragment"), f = Symbol.for("react.strict_mode"), _ = Symbol.for("react.profiler"), S = Symbol.for("react.provider"), d = Symbol.for("react.context"), c = Symbol.for("react.forward_ref"), s = Symbol.for("react.suspense"), o = Symbol.for("react.suspense_list"), a = Symbol.for("react.memo"), i = Symbol.for("react.lazy"), t = Symbol.for("react.offscreen"), n = Symbol.iterator, v = "@@iterator";
|
|
29
29
|
function h(e) {
|
|
30
30
|
if (e === null || typeof e != "object")
|
|
31
31
|
return null;
|
|
32
|
-
var
|
|
33
|
-
return typeof
|
|
32
|
+
var l = n && e[n] || e[v];
|
|
33
|
+
return typeof l == "function" ? l : null;
|
|
34
34
|
}
|
|
35
35
|
var u = r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
36
36
|
function b(e) {
|
|
37
37
|
{
|
|
38
|
-
for (var
|
|
38
|
+
for (var l = arguments.length, g = new Array(l > 1 ? l - 1 : 0), p = 1; p < l; p++)
|
|
39
39
|
g[p - 1] = arguments[p];
|
|
40
40
|
C("error", e, g);
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
|
-
function C(e,
|
|
43
|
+
function C(e, l, g) {
|
|
44
44
|
{
|
|
45
45
|
var p = u.ReactDebugCurrentFrame, w = p.getStackAddendum();
|
|
46
|
-
w !== "" && (
|
|
46
|
+
w !== "" && (l += "%s", g = g.concat([w]));
|
|
47
47
|
var k = g.map(function(R) {
|
|
48
48
|
return String(R);
|
|
49
49
|
});
|
|
50
|
-
k.unshift("Warning: " +
|
|
50
|
+
k.unshift("Warning: " + l), Function.prototype.apply.call(console[e], console, k);
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
var P = !1, m = !1, A = !1, I = !1, se = !1, le;
|
|
54
54
|
le = Symbol.for("react.module.reference");
|
|
55
55
|
function ke(e) {
|
|
56
|
-
return !!(typeof e == "string" || typeof e == "function" || e === E || e === _ || se || e === f || e ===
|
|
56
|
+
return !!(typeof e == "string" || typeof e == "function" || e === E || e === _ || se || e === f || e === s || e === o || I || e === t || P || m || A || typeof e == "object" && e !== null && (e.$$typeof === i || e.$$typeof === a || e.$$typeof === S || e.$$typeof === d || e.$$typeof === c || // This needs to include all possible module reference object
|
|
57
57
|
// types supported by any Flight configuration anywhere since
|
|
58
58
|
// we don't know which Flight build this will end up being used
|
|
59
59
|
// with.
|
|
60
60
|
e.$$typeof === le || e.getModuleId !== void 0));
|
|
61
61
|
}
|
|
62
|
-
function be(e,
|
|
62
|
+
function be(e, l, g) {
|
|
63
63
|
var p = e.displayName;
|
|
64
64
|
if (p)
|
|
65
65
|
return p;
|
|
66
|
-
var w =
|
|
66
|
+
var w = l.displayName || l.name || "";
|
|
67
67
|
return w !== "" ? g + "(" + w + ")" : g;
|
|
68
68
|
}
|
|
69
69
|
function J(e) {
|
|
@@ -85,7 +85,7 @@ function vt() {
|
|
|
85
85
|
return "Profiler";
|
|
86
86
|
case f:
|
|
87
87
|
return "StrictMode";
|
|
88
|
-
case
|
|
88
|
+
case s:
|
|
89
89
|
return "Suspense";
|
|
90
90
|
case o:
|
|
91
91
|
return "SuspenseList";
|
|
@@ -93,8 +93,8 @@ function vt() {
|
|
|
93
93
|
if (typeof e == "object")
|
|
94
94
|
switch (e.$$typeof) {
|
|
95
95
|
case d:
|
|
96
|
-
var
|
|
97
|
-
return J(
|
|
96
|
+
var l = e;
|
|
97
|
+
return J(l) + ".Consumer";
|
|
98
98
|
case S:
|
|
99
99
|
var g = e;
|
|
100
100
|
return J(g._context) + ".Provider";
|
|
@@ -177,7 +177,7 @@ function vt() {
|
|
|
177
177
|
}
|
|
178
178
|
}
|
|
179
179
|
var oe = u.ReactCurrentDispatcher, Y;
|
|
180
|
-
function ue(e,
|
|
180
|
+
function ue(e, l, g) {
|
|
181
181
|
{
|
|
182
182
|
if (Y === void 0)
|
|
183
183
|
try {
|
|
@@ -195,7 +195,7 @@ function vt() {
|
|
|
195
195
|
var Mr = typeof WeakMap == "function" ? WeakMap : Map;
|
|
196
196
|
me = new Mr();
|
|
197
197
|
}
|
|
198
|
-
function Ke(e,
|
|
198
|
+
function Ke(e, l) {
|
|
199
199
|
if (!e || ee)
|
|
200
200
|
return "";
|
|
201
201
|
{
|
|
@@ -210,7 +210,7 @@ function vt() {
|
|
|
210
210
|
var k;
|
|
211
211
|
k = oe.current, oe.current = null, z();
|
|
212
212
|
try {
|
|
213
|
-
if (
|
|
213
|
+
if (l) {
|
|
214
214
|
var R = function() {
|
|
215
215
|
throw Error();
|
|
216
216
|
};
|
|
@@ -266,14 +266,14 @@ function vt() {
|
|
|
266
266
|
var ie = e ? e.displayName || e.name : "", re = ie ? ue(ie) : "";
|
|
267
267
|
return typeof e == "function" && me.set(e, re), re;
|
|
268
268
|
}
|
|
269
|
-
function Dr(e,
|
|
269
|
+
function Dr(e, l, g) {
|
|
270
270
|
return Ke(e, !1);
|
|
271
271
|
}
|
|
272
272
|
function Lr(e) {
|
|
273
|
-
var
|
|
274
|
-
return !!(
|
|
273
|
+
var l = e.prototype;
|
|
274
|
+
return !!(l && l.isReactComponent);
|
|
275
275
|
}
|
|
276
|
-
function Te(e,
|
|
276
|
+
function Te(e, l, g) {
|
|
277
277
|
if (e == null)
|
|
278
278
|
return "";
|
|
279
279
|
if (typeof e == "function")
|
|
@@ -281,7 +281,7 @@ function vt() {
|
|
|
281
281
|
if (typeof e == "string")
|
|
282
282
|
return ue(e);
|
|
283
283
|
switch (e) {
|
|
284
|
-
case
|
|
284
|
+
case s:
|
|
285
285
|
return ue("Suspense");
|
|
286
286
|
case o:
|
|
287
287
|
return ue("SuspenseList");
|
|
@@ -291,11 +291,11 @@ function vt() {
|
|
|
291
291
|
case c:
|
|
292
292
|
return Dr(e.render);
|
|
293
293
|
case a:
|
|
294
|
-
return Te(e.type,
|
|
294
|
+
return Te(e.type, l, g);
|
|
295
295
|
case i: {
|
|
296
296
|
var p = e, w = p._payload, k = p._init;
|
|
297
297
|
try {
|
|
298
|
-
return Te(k(w),
|
|
298
|
+
return Te(k(w), l, g);
|
|
299
299
|
} catch {
|
|
300
300
|
}
|
|
301
301
|
}
|
|
@@ -305,12 +305,12 @@ function vt() {
|
|
|
305
305
|
var ve = Object.prototype.hasOwnProperty, xe = {}, Qe = u.ReactDebugCurrentFrame;
|
|
306
306
|
function Re(e) {
|
|
307
307
|
if (e) {
|
|
308
|
-
var
|
|
308
|
+
var l = e._owner, g = Te(e.type, e._source, l ? l.type : null);
|
|
309
309
|
Qe.setExtraStackFrame(g);
|
|
310
310
|
} else
|
|
311
311
|
Qe.setExtraStackFrame(null);
|
|
312
312
|
}
|
|
313
|
-
function jr(e,
|
|
313
|
+
function jr(e, l, g, p, w) {
|
|
314
314
|
{
|
|
315
315
|
var k = Function.call.bind(ve);
|
|
316
316
|
for (var R in e)
|
|
@@ -321,7 +321,7 @@ function vt() {
|
|
|
321
321
|
var U = Error((p || "React class") + ": " + g + " type `" + R + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[R] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
|
|
322
322
|
throw U.name = "Invariant Violation", U;
|
|
323
323
|
}
|
|
324
|
-
T = e[R](
|
|
324
|
+
T = e[R](l, R, p, g, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
|
325
325
|
} catch (N) {
|
|
326
326
|
T = N;
|
|
327
327
|
}
|
|
@@ -335,7 +335,7 @@ function vt() {
|
|
|
335
335
|
}
|
|
336
336
|
function Wr(e) {
|
|
337
337
|
{
|
|
338
|
-
var
|
|
338
|
+
var l = typeof Symbol == "function" && Symbol.toStringTag, g = l && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
|
339
339
|
return g;
|
|
340
340
|
}
|
|
341
341
|
}
|
|
@@ -361,27 +361,27 @@ function vt() {
|
|
|
361
361
|
}, er, rr;
|
|
362
362
|
function Gr(e) {
|
|
363
363
|
if (ve.call(e, "ref")) {
|
|
364
|
-
var
|
|
365
|
-
if (
|
|
364
|
+
var l = Object.getOwnPropertyDescriptor(e, "ref").get;
|
|
365
|
+
if (l && l.isReactWarning)
|
|
366
366
|
return !1;
|
|
367
367
|
}
|
|
368
368
|
return e.ref !== void 0;
|
|
369
369
|
}
|
|
370
370
|
function Jr(e) {
|
|
371
371
|
if (ve.call(e, "key")) {
|
|
372
|
-
var
|
|
373
|
-
if (
|
|
372
|
+
var l = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
373
|
+
if (l && l.isReactWarning)
|
|
374
374
|
return !1;
|
|
375
375
|
}
|
|
376
376
|
return e.key !== void 0;
|
|
377
377
|
}
|
|
378
|
-
function Hr(e,
|
|
378
|
+
function Hr(e, l) {
|
|
379
379
|
typeof e.ref == "string" && Ze.current;
|
|
380
380
|
}
|
|
381
|
-
function Vr(e,
|
|
381
|
+
function Vr(e, l) {
|
|
382
382
|
{
|
|
383
383
|
var g = function() {
|
|
384
|
-
er || (er = !0, b("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",
|
|
384
|
+
er || (er = !0, b("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", l));
|
|
385
385
|
};
|
|
386
386
|
g.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
387
387
|
get: g,
|
|
@@ -389,10 +389,10 @@ function vt() {
|
|
|
389
389
|
});
|
|
390
390
|
}
|
|
391
391
|
}
|
|
392
|
-
function $r(e,
|
|
392
|
+
function $r(e, l) {
|
|
393
393
|
{
|
|
394
394
|
var g = function() {
|
|
395
|
-
rr || (rr = !0, b("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",
|
|
395
|
+
rr || (rr = !0, b("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", l));
|
|
396
396
|
};
|
|
397
397
|
g.isReactWarning = !0, Object.defineProperty(e, "ref", {
|
|
398
398
|
get: g,
|
|
@@ -400,13 +400,13 @@ function vt() {
|
|
|
400
400
|
});
|
|
401
401
|
}
|
|
402
402
|
}
|
|
403
|
-
var Br = function(e,
|
|
403
|
+
var Br = function(e, l, g, p, w, k, R) {
|
|
404
404
|
var T = {
|
|
405
405
|
// This tag allows us to uniquely identify this as a React Element
|
|
406
406
|
$$typeof: y,
|
|
407
407
|
// Built-in properties that belong on the element
|
|
408
408
|
type: e,
|
|
409
|
-
key:
|
|
409
|
+
key: l,
|
|
410
410
|
ref: g,
|
|
411
411
|
props: R,
|
|
412
412
|
// Record the component responsible for creating this element.
|
|
@@ -429,12 +429,12 @@ function vt() {
|
|
|
429
429
|
value: w
|
|
430
430
|
}), Object.freeze && (Object.freeze(T.props), Object.freeze(T)), T;
|
|
431
431
|
};
|
|
432
|
-
function Yr(e,
|
|
432
|
+
function Yr(e, l, g, p, w) {
|
|
433
433
|
{
|
|
434
434
|
var k, R = {}, T = null, U = null;
|
|
435
|
-
g !== void 0 && (Xe(g), T = "" + g), Jr(
|
|
436
|
-
for (k in
|
|
437
|
-
ve.call(
|
|
435
|
+
g !== void 0 && (Xe(g), T = "" + g), Jr(l) && (Xe(l.key), T = "" + l.key), Gr(l) && (U = l.ref, Hr(l, w));
|
|
436
|
+
for (k in l)
|
|
437
|
+
ve.call(l, k) && !qr.hasOwnProperty(k) && (R[k] = l[k]);
|
|
438
438
|
if (e && e.defaultProps) {
|
|
439
439
|
var N = e.defaultProps;
|
|
440
440
|
for (k in N)
|
|
@@ -450,7 +450,7 @@ function vt() {
|
|
|
450
450
|
var Ne = u.ReactCurrentOwner, tr = u.ReactDebugCurrentFrame;
|
|
451
451
|
function ce(e) {
|
|
452
452
|
if (e) {
|
|
453
|
-
var
|
|
453
|
+
var l = e._owner, g = Te(e.type, e._source, l ? l.type : null);
|
|
454
454
|
tr.setExtraStackFrame(g);
|
|
455
455
|
} else
|
|
456
456
|
tr.setExtraStackFrame(null);
|
|
@@ -478,22 +478,22 @@ Check the render method of \`` + e + "`.";
|
|
|
478
478
|
var ar = {};
|
|
479
479
|
function xr(e) {
|
|
480
480
|
{
|
|
481
|
-
var
|
|
482
|
-
if (!
|
|
481
|
+
var l = nr();
|
|
482
|
+
if (!l) {
|
|
483
483
|
var g = typeof e == "string" ? e : e.displayName || e.name;
|
|
484
|
-
g && (
|
|
484
|
+
g && (l = `
|
|
485
485
|
|
|
486
486
|
Check the top-level render call using <` + g + ">.");
|
|
487
487
|
}
|
|
488
|
-
return
|
|
488
|
+
return l;
|
|
489
489
|
}
|
|
490
490
|
}
|
|
491
|
-
function or(e,
|
|
491
|
+
function or(e, l) {
|
|
492
492
|
{
|
|
493
493
|
if (!e._store || e._store.validated || e.key != null)
|
|
494
494
|
return;
|
|
495
495
|
e._store.validated = !0;
|
|
496
|
-
var g = xr(
|
|
496
|
+
var g = xr(l);
|
|
497
497
|
if (ar[g])
|
|
498
498
|
return;
|
|
499
499
|
ar[g] = !0;
|
|
@@ -501,14 +501,14 @@ Check the top-level render call using <` + g + ">.");
|
|
|
501
501
|
e && e._owner && e._owner !== Ne.current && (p = " It was passed a child from " + L(e._owner.type) + "."), ce(e), b('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', g, p), ce(null);
|
|
502
502
|
}
|
|
503
503
|
}
|
|
504
|
-
function ur(e,
|
|
504
|
+
function ur(e, l) {
|
|
505
505
|
{
|
|
506
506
|
if (typeof e != "object")
|
|
507
507
|
return;
|
|
508
508
|
if (Ie(e))
|
|
509
509
|
for (var g = 0; g < e.length; g++) {
|
|
510
510
|
var p = e[g];
|
|
511
|
-
De(p) && or(p,
|
|
511
|
+
De(p) && or(p, l);
|
|
512
512
|
}
|
|
513
513
|
else if (De(e))
|
|
514
514
|
e._store && (e._store.validated = !0);
|
|
@@ -516,39 +516,39 @@ Check the top-level render call using <` + g + ">.");
|
|
|
516
516
|
var w = h(e);
|
|
517
517
|
if (typeof w == "function" && w !== e.entries)
|
|
518
518
|
for (var k = w.call(e), R; !(R = k.next()).done; )
|
|
519
|
-
De(R.value) && or(R.value,
|
|
519
|
+
De(R.value) && or(R.value, l);
|
|
520
520
|
}
|
|
521
521
|
}
|
|
522
522
|
}
|
|
523
523
|
function Qr(e) {
|
|
524
524
|
{
|
|
525
|
-
var
|
|
526
|
-
if (
|
|
525
|
+
var l = e.type;
|
|
526
|
+
if (l == null || typeof l == "string")
|
|
527
527
|
return;
|
|
528
528
|
var g;
|
|
529
|
-
if (typeof
|
|
530
|
-
g =
|
|
531
|
-
else if (typeof
|
|
529
|
+
if (typeof l == "function")
|
|
530
|
+
g = l.propTypes;
|
|
531
|
+
else if (typeof l == "object" && (l.$$typeof === c || // Note: Memo only checks outer props here.
|
|
532
532
|
// Inner props are checked in the reconciler.
|
|
533
|
-
|
|
534
|
-
g =
|
|
533
|
+
l.$$typeof === a))
|
|
534
|
+
g = l.propTypes;
|
|
535
535
|
else
|
|
536
536
|
return;
|
|
537
537
|
if (g) {
|
|
538
|
-
var p = L(
|
|
538
|
+
var p = L(l);
|
|
539
539
|
jr(g, e.props, "prop", p, e);
|
|
540
|
-
} else if (
|
|
540
|
+
} else if (l.PropTypes !== void 0 && !Me) {
|
|
541
541
|
Me = !0;
|
|
542
|
-
var w = L(
|
|
542
|
+
var w = L(l);
|
|
543
543
|
b("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", w || "Unknown");
|
|
544
544
|
}
|
|
545
|
-
typeof
|
|
545
|
+
typeof l.getDefaultProps == "function" && !l.getDefaultProps.isReactClassApproved && b("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
|
|
546
546
|
}
|
|
547
547
|
}
|
|
548
548
|
function zr(e) {
|
|
549
549
|
{
|
|
550
|
-
for (var
|
|
551
|
-
var p =
|
|
550
|
+
for (var l = Object.keys(e.props), g = 0; g < l.length; g++) {
|
|
551
|
+
var p = l[g];
|
|
552
552
|
if (p !== "children" && p !== "key") {
|
|
553
553
|
ce(e), b("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", p), ce(null);
|
|
554
554
|
break;
|
|
@@ -558,7 +558,7 @@ Check the top-level render call using <` + g + ">.");
|
|
|
558
558
|
}
|
|
559
559
|
}
|
|
560
560
|
var cr = {};
|
|
561
|
-
function ir(e,
|
|
561
|
+
function ir(e, l, g, p, w, k) {
|
|
562
562
|
{
|
|
563
563
|
var R = ke(e);
|
|
564
564
|
if (!R) {
|
|
@@ -569,11 +569,11 @@ Check the top-level render call using <` + g + ">.");
|
|
|
569
569
|
var N;
|
|
570
570
|
e === null ? N = "null" : Ie(e) ? N = "array" : e !== void 0 && e.$$typeof === y ? (N = "<" + (L(e.type) || "Unknown") + " />", T = " Did you accidentally export a JSX literal instead of a component?") : N = typeof e, b("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", N, T);
|
|
571
571
|
}
|
|
572
|
-
var M = Yr(e,
|
|
572
|
+
var M = Yr(e, l, g, w, k);
|
|
573
573
|
if (M == null)
|
|
574
574
|
return M;
|
|
575
575
|
if (R) {
|
|
576
|
-
var q =
|
|
576
|
+
var q = l.children;
|
|
577
577
|
if (q !== void 0)
|
|
578
578
|
if (p)
|
|
579
579
|
if (Ie(q)) {
|
|
@@ -585,8 +585,8 @@ Check the top-level render call using <` + g + ">.");
|
|
|
585
585
|
else
|
|
586
586
|
ur(q, e);
|
|
587
587
|
}
|
|
588
|
-
if (ve.call(
|
|
589
|
-
var re = L(e), W = Object.keys(
|
|
588
|
+
if (ve.call(l, "key")) {
|
|
589
|
+
var re = L(e), W = Object.keys(l).filter(function(nt) {
|
|
590
590
|
return nt !== "key";
|
|
591
591
|
}), Le = W.length > 0 ? "{key: someKey, " + W.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
592
592
|
if (!cr[re + Le]) {
|
|
@@ -602,11 +602,11 @@ React keys must be passed directly to JSX without using spread:
|
|
|
602
602
|
return e === E ? zr(M) : Qr(M), M;
|
|
603
603
|
}
|
|
604
604
|
}
|
|
605
|
-
function Xr(e,
|
|
606
|
-
return ir(e,
|
|
605
|
+
function Xr(e, l, g) {
|
|
606
|
+
return ir(e, l, g, !0);
|
|
607
607
|
}
|
|
608
|
-
function Zr(e,
|
|
609
|
-
return ir(e,
|
|
608
|
+
function Zr(e, l, g) {
|
|
609
|
+
return ir(e, l, g, !1);
|
|
610
610
|
}
|
|
611
611
|
var et = Zr, rt = Xr;
|
|
612
612
|
_e.Fragment = E, _e.jsx = et, _e.jsxs = rt;
|
|
@@ -627,8 +627,8 @@ function Et({
|
|
|
627
627
|
baseURL: r,
|
|
628
628
|
getToken: y,
|
|
629
629
|
timeoutMs: O = 15e3,
|
|
630
|
-
|
|
631
|
-
|
|
630
|
+
lng: E = "tw",
|
|
631
|
+
store: f,
|
|
632
632
|
onError: _
|
|
633
633
|
} = {}) {
|
|
634
634
|
const S = it.create({
|
|
@@ -638,10 +638,11 @@ function Et({
|
|
|
638
638
|
});
|
|
639
639
|
return S.interceptors.request.use(async (d) => {
|
|
640
640
|
if (d.headers = d.headers || {}, y) {
|
|
641
|
-
const
|
|
642
|
-
|
|
641
|
+
const s = await y();
|
|
642
|
+
s && (d.headers.Authorization = `Bearer ${s}`);
|
|
643
643
|
}
|
|
644
|
-
|
|
644
|
+
const c = f?.getState()?.isWalletCurrency;
|
|
645
|
+
return d.headers.Currency = c, d.headers["currency-code"] = c, d.headers.lang = E, d;
|
|
645
646
|
}), S.interceptors.response.use(
|
|
646
647
|
(d) => d.data,
|
|
647
648
|
(d) => _ ? _(d, { instance: S }) : Promise.reject(d)
|
|
@@ -671,11 +672,11 @@ const Nt = () => {
|
|
|
671
672
|
onShowError: S,
|
|
672
673
|
onCleanup: d,
|
|
673
674
|
onRemoveToken: c,
|
|
674
|
-
onRedirect:
|
|
675
|
+
onRedirect: s,
|
|
675
676
|
onGoogleLogout: o
|
|
676
677
|
}) => {
|
|
677
678
|
const a = y(f);
|
|
678
|
-
r(E, a) && S?.(), d?.(), c?.(), _ &&
|
|
679
|
+
r(E, a) && S?.(), d?.(), c?.(), _ && s?.("/"), o?.();
|
|
679
680
|
},
|
|
680
681
|
shouldShowErrorNotice: r,
|
|
681
682
|
isMachineDomain: y
|
|
@@ -683,10 +684,10 @@ const Nt = () => {
|
|
|
683
684
|
}, Ir = () => {
|
|
684
685
|
const { client: r } = Je(), y = de(
|
|
685
686
|
async (S) => {
|
|
686
|
-
const { mac_address: d = "", app_version: c = "", anydesk_id:
|
|
687
|
+
const { mac_address: d = "", app_version: c = "", anydesk_id: s = "" } = S, { data: o } = await r.post("/cash-register/login", {
|
|
687
688
|
mac_address: d,
|
|
688
689
|
app_version: c,
|
|
689
|
-
anydesk_id:
|
|
690
|
+
anydesk_id: s
|
|
690
691
|
});
|
|
691
692
|
return o;
|
|
692
693
|
},
|
|
@@ -770,17 +771,17 @@ function Ve() {
|
|
|
770
771
|
var _ = /^https|wss/.test(f), S = f.replace(/^(https?|wss?)(:\/\/)?/, ""), d = S.replace(/\/$/, ""), c = _ ? "wss" : "ws";
|
|
771
772
|
return "".concat(c, "://").concat(d).concat(r.SOCKET_IO_PATH);
|
|
772
773
|
} else if (f === "") {
|
|
773
|
-
var _ = /^https/.test(window.location.protocol), c = _ ? "wss" : "ws",
|
|
774
|
-
return "".concat(c, "://").concat(window.location.hostname).concat(
|
|
774
|
+
var _ = /^https/.test(window.location.protocol), c = _ ? "wss" : "ws", s = window.location.port ? ":".concat(window.location.port) : "";
|
|
775
|
+
return "".concat(c, "://").concat(window.location.hostname).concat(s).concat(r.SOCKET_IO_PATH);
|
|
775
776
|
}
|
|
776
777
|
return f;
|
|
777
778
|
};
|
|
778
779
|
K.parseSocketIOUrl = y;
|
|
779
780
|
var O = function(f, _) {
|
|
780
781
|
_ === void 0 && (_ = {});
|
|
781
|
-
var S = /\?([\w]+=[\w]+)/, d = S.test(f), c = "".concat(Object.entries(_).reduce(function(
|
|
782
|
+
var S = /\?([\w]+=[\w]+)/, d = S.test(f), c = "".concat(Object.entries(_).reduce(function(s, o) {
|
|
782
783
|
var a = o[0], i = o[1];
|
|
783
|
-
return
|
|
784
|
+
return s + "".concat(a, "=").concat(i, "&");
|
|
784
785
|
}, "").slice(0, -1));
|
|
785
786
|
return "".concat(f).concat(d ? "&" : "?").concat(c);
|
|
786
787
|
};
|
|
@@ -805,7 +806,7 @@ function Nr() {
|
|
|
805
806
|
}).current : E.current;
|
|
806
807
|
}
|
|
807
808
|
function O(E, f, _) {
|
|
808
|
-
var S = _ || {}, d = S.interval, c = d === void 0 ? r.DEFAULT_HEARTBEAT.interval : d,
|
|
809
|
+
var S = _ || {}, d = S.interval, c = d === void 0 ? r.DEFAULT_HEARTBEAT.interval : d, s = S.timeout, o = s === void 0 ? r.DEFAULT_HEARTBEAT.timeout : s, a = S.message, i = a === void 0 ? r.DEFAULT_HEARTBEAT.message : a, t = Math.max(100, c / 10), n = Date.now(), v = setInterval(function() {
|
|
809
810
|
var h = Date.now(), u = y(f);
|
|
810
811
|
if (u + o <= h)
|
|
811
812
|
console.warn("Heartbeat timed out, closing connection, last message received ".concat(h - u, "ms ago, last ping sent ").concat(h - n, "ms ago")), E.close();
|
|
@@ -832,24 +833,24 @@ function $e() {
|
|
|
832
833
|
};
|
|
833
834
|
r.getSubscribers = E;
|
|
834
835
|
var f = function(c) {
|
|
835
|
-
var
|
|
836
|
-
return ((
|
|
836
|
+
var s;
|
|
837
|
+
return ((s = y[c]) === null || s === void 0 ? void 0 : s.size) > 0;
|
|
837
838
|
};
|
|
838
839
|
r.hasSubscribers = f;
|
|
839
|
-
var _ = function(c,
|
|
840
|
-
y[c] = y[c] || /* @__PURE__ */ new Set(), y[c].add(
|
|
840
|
+
var _ = function(c, s) {
|
|
841
|
+
y[c] = y[c] || /* @__PURE__ */ new Set(), y[c].add(s);
|
|
841
842
|
};
|
|
842
843
|
r.addSubscriber = _;
|
|
843
|
-
var S = function(c,
|
|
844
|
-
y[c].delete(
|
|
844
|
+
var S = function(c, s) {
|
|
845
|
+
y[c].delete(s);
|
|
845
846
|
};
|
|
846
847
|
r.removeSubscriber = S;
|
|
847
848
|
var d = function(c) {
|
|
848
849
|
if (c && y.hasOwnProperty(c))
|
|
849
850
|
delete y[c];
|
|
850
851
|
else
|
|
851
|
-
for (var
|
|
852
|
-
y.hasOwnProperty(
|
|
852
|
+
for (var s in y)
|
|
853
|
+
y.hasOwnProperty(s) && delete y[s];
|
|
853
854
|
};
|
|
854
855
|
r.resetSubscribers = d;
|
|
855
856
|
})(Fe)), Fe;
|
|
@@ -930,13 +931,13 @@ function _t() {
|
|
|
930
931
|
}, function() {
|
|
931
932
|
return v && window.clearTimeout(v);
|
|
932
933
|
};
|
|
933
|
-
},
|
|
934
|
+
}, s = function(o, a, i, t, n, v, h) {
|
|
934
935
|
var u = a.setLastMessage, b = a.setReadyState, C, P, m;
|
|
935
936
|
return i.current.fromSocketIO && (C = (0, y.setUpSocketIOPing)(h)), _(o, i, u, v), S(o, i, b, n, v), P = d(o, i, b, t, n), m = c(o, i, b, t, n), function() {
|
|
936
937
|
b(E.ReadyState.CLOSING), P(), m(), o.close(), C && clearInterval(C);
|
|
937
938
|
};
|
|
938
939
|
};
|
|
939
|
-
return te.attachListeners =
|
|
940
|
+
return te.attachListeners = s, te;
|
|
940
941
|
}
|
|
941
942
|
var ne = {}, Or;
|
|
942
943
|
function St() {
|
|
@@ -986,7 +987,7 @@ function St() {
|
|
|
986
987
|
}
|
|
987
988
|
});
|
|
988
989
|
});
|
|
989
|
-
},
|
|
990
|
+
}, s = function(a, i) {
|
|
990
991
|
a.onerror = function(t) {
|
|
991
992
|
(0, E.getSubscribers)(i).forEach(function(n) {
|
|
992
993
|
n.optionsRef.current.onError && n.optionsRef.current.onError(t), O.isEventSourceSupported && a instanceof EventSource && (n.optionsRef.current.onClose && n.optionsRef.current.onClose(r(r({}, t), { code: 1006, reason: "An error occurred with the EventSource: ".concat(t), wasClean: !1 })), n.setReadyState(O.ReadyState.CLOSED));
|
|
@@ -994,7 +995,7 @@ function St() {
|
|
|
994
995
|
};
|
|
995
996
|
}, o = function(a, i, t, n) {
|
|
996
997
|
var v;
|
|
997
|
-
return t.current.fromSocketIO && (v = (0, f.setUpSocketIOPing)(n)), S(a, i, t.current.heartbeat), c(a, i), d(a, i, t.current.heartbeat),
|
|
998
|
+
return t.current.fromSocketIO && (v = (0, f.setUpSocketIOPing)(n)), S(a, i, t.current.heartbeat), c(a, i), d(a, i, t.current.heartbeat), s(a, i), function() {
|
|
998
999
|
v && clearInterval(v);
|
|
999
1000
|
};
|
|
1000
1001
|
};
|
|
@@ -1004,40 +1005,40 @@ var pr;
|
|
|
1004
1005
|
function ht() {
|
|
1005
1006
|
if (pr) return Se;
|
|
1006
1007
|
pr = 1, Object.defineProperty(Se, "__esModule", { value: !0 }), Se.createOrJoinSocket = void 0;
|
|
1007
|
-
var r = He(), y = V(), O = _t(), E = St(), f = $e(), _ = function(d, c,
|
|
1008
|
+
var r = He(), y = V(), O = _t(), E = St(), f = $e(), _ = function(d, c, s, o, a) {
|
|
1008
1009
|
return function() {
|
|
1009
1010
|
if ((0, f.removeSubscriber)(d, c), !(0, f.hasSubscribers)(d)) {
|
|
1010
1011
|
try {
|
|
1011
1012
|
var i = r.sharedWebSockets[d];
|
|
1012
1013
|
i instanceof WebSocket && (i.onclose = function(t) {
|
|
1013
|
-
|
|
1014
|
+
s.current.onClose && s.current.onClose(t), o(y.ReadyState.CLOSED);
|
|
1014
1015
|
}), i.close();
|
|
1015
1016
|
} catch {
|
|
1016
1017
|
}
|
|
1017
1018
|
a && a(), delete r.sharedWebSockets[d];
|
|
1018
1019
|
}
|
|
1019
1020
|
};
|
|
1020
|
-
}, S = function(d, c,
|
|
1021
|
+
}, S = function(d, c, s, o, a, i, t, n, v) {
|
|
1021
1022
|
if (!y.isEventSourceSupported && o.current.eventSourceOptions)
|
|
1022
1023
|
throw y.isReactNative ? new Error("EventSource is not supported in ReactNative") : new Error("EventSource is not supported");
|
|
1023
1024
|
if (o.current.share) {
|
|
1024
1025
|
var h = null;
|
|
1025
|
-
r.sharedWebSockets[c] === void 0 ? (r.sharedWebSockets[c] = o.current.eventSourceOptions ? new EventSource(c, o.current.eventSourceOptions) : new WebSocket(c, o.current.protocols), d.current = r.sharedWebSockets[c],
|
|
1026
|
+
r.sharedWebSockets[c] === void 0 ? (r.sharedWebSockets[c] = o.current.eventSourceOptions ? new EventSource(c, o.current.eventSourceOptions) : new WebSocket(c, o.current.protocols), d.current = r.sharedWebSockets[c], s(y.ReadyState.CONNECTING), h = (0, E.attachSharedListeners)(r.sharedWebSockets[c], c, o, v)) : (d.current = r.sharedWebSockets[c], s(r.sharedWebSockets[c].readyState));
|
|
1026
1027
|
var u = {
|
|
1027
1028
|
setLastMessage: a,
|
|
1028
|
-
setReadyState:
|
|
1029
|
+
setReadyState: s,
|
|
1029
1030
|
optionsRef: o,
|
|
1030
1031
|
reconnectCount: t,
|
|
1031
1032
|
lastMessageTime: n,
|
|
1032
1033
|
reconnect: i
|
|
1033
1034
|
};
|
|
1034
|
-
return (0, f.addSubscriber)(c, u), _(c, u, o,
|
|
1035
|
+
return (0, f.addSubscriber)(c, u), _(c, u, o, s, h);
|
|
1035
1036
|
} else {
|
|
1036
|
-
if (d.current = o.current.eventSourceOptions ? new EventSource(c, o.current.eventSourceOptions) : new WebSocket(c, o.current.protocols),
|
|
1037
|
+
if (d.current = o.current.eventSourceOptions ? new EventSource(c, o.current.eventSourceOptions) : new WebSocket(c, o.current.protocols), s(y.ReadyState.CONNECTING), !d.current)
|
|
1037
1038
|
throw new Error("WebSocket failed to be created");
|
|
1038
1039
|
return (0, O.attachListeners)(d.current, {
|
|
1039
1040
|
setLastMessage: a,
|
|
1040
|
-
setReadyState:
|
|
1041
|
+
setReadyState: s
|
|
1041
1042
|
}, o, i.current, t, n, v);
|
|
1042
1043
|
}
|
|
1043
1044
|
};
|
|
@@ -1046,7 +1047,7 @@ function ht() {
|
|
|
1046
1047
|
var x = {}, mr;
|
|
1047
1048
|
function yt() {
|
|
1048
1049
|
return mr || (mr = 1, (function(r) {
|
|
1049
|
-
var y = x && x.__awaiter || function(c,
|
|
1050
|
+
var y = x && x.__awaiter || function(c, s, o, a) {
|
|
1050
1051
|
function i(t) {
|
|
1051
1052
|
return t instanceof o ? t : new o(function(n) {
|
|
1052
1053
|
n(t);
|
|
@@ -1070,9 +1071,9 @@ function yt() {
|
|
|
1070
1071
|
function u(b) {
|
|
1071
1072
|
b.done ? t(b.value) : i(b.value).then(v, h);
|
|
1072
1073
|
}
|
|
1073
|
-
u((a = a.apply(c,
|
|
1074
|
+
u((a = a.apply(c, s || [])).next());
|
|
1074
1075
|
});
|
|
1075
|
-
}, O = x && x.__generator || function(c,
|
|
1076
|
+
}, O = x && x.__generator || function(c, s) {
|
|
1076
1077
|
var o = { label: 0, sent: function() {
|
|
1077
1078
|
if (t[0] & 1) throw t[1];
|
|
1078
1079
|
return t[1];
|
|
@@ -1122,7 +1123,7 @@ function yt() {
|
|
|
1122
1123
|
t[2] && o.ops.pop(), o.trys.pop();
|
|
1123
1124
|
continue;
|
|
1124
1125
|
}
|
|
1125
|
-
u =
|
|
1126
|
+
u = s.call(c, o);
|
|
1126
1127
|
} catch (b) {
|
|
1127
1128
|
u = [6, b], i = 0;
|
|
1128
1129
|
} finally {
|
|
@@ -1131,20 +1132,20 @@ function yt() {
|
|
|
1131
1132
|
if (u[0] & 5) throw u[1];
|
|
1132
1133
|
return { value: u[0] ? u[1] : void 0, done: !0 };
|
|
1133
1134
|
}
|
|
1134
|
-
}, E = x && x.__spreadArray || function(c,
|
|
1135
|
-
if (o || arguments.length === 2) for (var a = 0, i =
|
|
1136
|
-
(t || !(a in
|
|
1137
|
-
return c.concat(t || Array.prototype.slice.call(
|
|
1135
|
+
}, E = x && x.__spreadArray || function(c, s, o) {
|
|
1136
|
+
if (o || arguments.length === 2) for (var a = 0, i = s.length, t; a < i; a++)
|
|
1137
|
+
(t || !(a in s)) && (t || (t = Array.prototype.slice.call(s, 0, a)), t[a] = s[a]);
|
|
1138
|
+
return c.concat(t || Array.prototype.slice.call(s));
|
|
1138
1139
|
};
|
|
1139
1140
|
Object.defineProperty(r, "__esModule", { value: !0 }), r.getUrl = void 0;
|
|
1140
1141
|
var f = Ve(), _ = V(), S = function(c) {
|
|
1141
|
-
return new Promise(function(
|
|
1142
|
-
return window.setTimeout(
|
|
1142
|
+
return new Promise(function(s) {
|
|
1143
|
+
return window.setTimeout(s, c);
|
|
1143
1144
|
});
|
|
1144
|
-
}, d = function(c,
|
|
1145
|
+
}, d = function(c, s) {
|
|
1145
1146
|
for (var o = [], a = 2; a < arguments.length; a++)
|
|
1146
1147
|
o[a - 2] = arguments[a];
|
|
1147
|
-
return y(void 0, E([c,
|
|
1148
|
+
return y(void 0, E([c, s], o, !0), void 0, function(i, t, n) {
|
|
1148
1149
|
var v, h, u, b, C, P, m, A;
|
|
1149
1150
|
return n === void 0 && (n = 0), O(this, function(I) {
|
|
1150
1151
|
switch (I.label) {
|
|
@@ -1300,7 +1301,7 @@ function Ye() {
|
|
|
1300
1301
|
return i && i.__esModule ? i : { default: i };
|
|
1301
1302
|
};
|
|
1302
1303
|
Object.defineProperty(F, "__esModule", { value: !0 }), F.useWebSocket = void 0;
|
|
1303
|
-
var f = ye, _ = st, S = V(), d = ht(), c = yt(),
|
|
1304
|
+
var f = ye, _ = st, S = V(), d = ht(), c = yt(), s = E(bt()), o = Be(), a = function(i, t, n) {
|
|
1304
1305
|
t === void 0 && (t = S.DEFAULT_OPTIONS), n === void 0 && (n = !0);
|
|
1305
1306
|
var v = (0, f.useState)(null), h = v[0], u = v[1], b = (0, f.useState)({}), C = b[0], P = b[1], m = (0, f.useMemo)(function() {
|
|
1306
1307
|
if (!t.disableJson && h)
|
|
@@ -1323,7 +1324,7 @@ function Ye() {
|
|
|
1323
1324
|
}, []), ge = (0, f.useCallback)(function(D, j) {
|
|
1324
1325
|
j === void 0 && (j = !0), $(JSON.stringify(D), j);
|
|
1325
1326
|
}, [$]), Oe = (0, f.useCallback)(function() {
|
|
1326
|
-
return L.current.share !== !0 || S.isEventSourceSupported && I.current instanceof EventSource ? I.current : (J.current === null && I.current && ((0, o.assertIsWebSocket)(I.current, L.current.skipAssert), J.current = (0,
|
|
1327
|
+
return L.current.share !== !0 || S.isEventSourceSupported && I.current instanceof EventSource ? I.current : (J.current === null && I.current && ((0, o.assertIsWebSocket)(I.current, L.current.skipAssert), J.current = (0, s.default)(I.current, se)), J.current);
|
|
1327
1328
|
}, []);
|
|
1328
1329
|
return (0, f.useEffect)(function() {
|
|
1329
1330
|
if (i !== null && n === !0) {
|
|
@@ -1391,8 +1392,8 @@ function gt() {
|
|
|
1391
1392
|
Cr = 1;
|
|
1392
1393
|
var r = ae && ae.__assign || function() {
|
|
1393
1394
|
return r = Object.assign || function(d) {
|
|
1394
|
-
for (var c,
|
|
1395
|
-
c = arguments[
|
|
1395
|
+
for (var c, s = 1, o = arguments.length; s < o; s++) {
|
|
1396
|
+
c = arguments[s];
|
|
1396
1397
|
for (var a in c) Object.prototype.hasOwnProperty.call(c, a) && (d[a] = c[a]);
|
|
1397
1398
|
}
|
|
1398
1399
|
return d;
|
|
@@ -1408,16 +1409,16 @@ function gt() {
|
|
|
1408
1409
|
var c = d.data.match(/\[.*]/);
|
|
1409
1410
|
if (!c)
|
|
1410
1411
|
return f;
|
|
1411
|
-
var
|
|
1412
|
-
return !Array.isArray(
|
|
1413
|
-
type:
|
|
1414
|
-
payload:
|
|
1412
|
+
var s = JSON.parse(c);
|
|
1413
|
+
return !Array.isArray(s) || !s[1] ? f : {
|
|
1414
|
+
type: s[0],
|
|
1415
|
+
payload: s[1]
|
|
1415
1416
|
};
|
|
1416
|
-
}, S = function(d, c,
|
|
1417
|
-
c === void 0 && (c = E.DEFAULT_OPTIONS),
|
|
1417
|
+
}, S = function(d, c, s) {
|
|
1418
|
+
c === void 0 && (c = E.DEFAULT_OPTIONS), s === void 0 && (s = !0);
|
|
1418
1419
|
var o = (0, y.useMemo)(function() {
|
|
1419
1420
|
return r(r({}, c), { fromSocketIO: !0 });
|
|
1420
|
-
}, []), a = (0, O.useWebSocket)(d, o,
|
|
1421
|
+
}, []), a = (0, O.useWebSocket)(d, o, s), i = a.sendMessage, t = a.sendJsonMessage, n = a.lastMessage, v = a.readyState, h = a.getWebSocket, u = (0, y.useMemo)(function() {
|
|
1421
1422
|
return _(n);
|
|
1422
1423
|
}, [n]);
|
|
1423
1424
|
return {
|
|
@@ -1437,7 +1438,7 @@ function Ot() {
|
|
|
1437
1438
|
wr = 1;
|
|
1438
1439
|
var r = Q && Q.__assign || function() {
|
|
1439
1440
|
return r = Object.assign || function(S) {
|
|
1440
|
-
for (var d, c = 1,
|
|
1441
|
+
for (var d, c = 1, s = arguments.length; c < s; c++) {
|
|
1441
1442
|
d = arguments[c];
|
|
1442
1443
|
for (var o in d) Object.prototype.hasOwnProperty.call(d, o) && (S[o] = d[o]);
|
|
1443
1444
|
}
|
|
@@ -1445,19 +1446,19 @@ function Ot() {
|
|
|
1445
1446
|
}, r.apply(this, arguments);
|
|
1446
1447
|
}, y = Q && Q.__rest || function(S, d) {
|
|
1447
1448
|
var c = {};
|
|
1448
|
-
for (var
|
|
1449
|
+
for (var s in S) Object.prototype.hasOwnProperty.call(S, s) && d.indexOf(s) < 0 && (c[s] = S[s]);
|
|
1449
1450
|
if (S != null && typeof Object.getOwnPropertySymbols == "function")
|
|
1450
|
-
for (var o = 0,
|
|
1451
|
-
d.indexOf(
|
|
1451
|
+
for (var o = 0, s = Object.getOwnPropertySymbols(S); o < s.length; o++)
|
|
1452
|
+
d.indexOf(s[o]) < 0 && Object.prototype.propertyIsEnumerable.call(S, s[o]) && (c[s[o]] = S[s[o]]);
|
|
1452
1453
|
return c;
|
|
1453
1454
|
};
|
|
1454
1455
|
Object.defineProperty(Q, "__esModule", { value: !0 }), Q.useEventSource = void 0;
|
|
1455
1456
|
var O = ye, E = Ye(), f = V(), _ = function(S, d, c) {
|
|
1456
1457
|
d === void 0 && (d = f.DEFAULT_EVENT_SOURCE_OPTIONS);
|
|
1457
|
-
var
|
|
1458
|
+
var s = d.withCredentials, o = d.events, a = y(d, ["withCredentials", "events"]);
|
|
1458
1459
|
c === void 0 && (c = !0);
|
|
1459
1460
|
var i = r(r({}, a), { eventSourceOptions: {
|
|
1460
|
-
withCredentials:
|
|
1461
|
+
withCredentials: s
|
|
1461
1462
|
} }), t = (0, O.useRef)(f.EMPTY_EVENT_HANDLERS);
|
|
1462
1463
|
o && (t.current = o);
|
|
1463
1464
|
var n = (0, E.useWebSocket)(S, i, c), v = n.lastMessage, h = n.readyState, u = n.getWebSocket;
|
|
@@ -1535,7 +1536,7 @@ const Tt = /* @__PURE__ */ lt(mt), H = {
|
|
|
1535
1536
|
reconnectAttempts: 9999,
|
|
1536
1537
|
reconnectInterval: 1e3,
|
|
1537
1538
|
...O
|
|
1538
|
-
}),
|
|
1539
|
+
}), s = Ge(() => {
|
|
1539
1540
|
try {
|
|
1540
1541
|
return JSON.parse(d?.data);
|
|
1541
1542
|
} catch {
|
|
@@ -1551,7 +1552,7 @@ const Tt = /* @__PURE__ */ lt(mt), H = {
|
|
|
1551
1552
|
}, [_]), Ce(() => {
|
|
1552
1553
|
f.current = y;
|
|
1553
1554
|
}, [y]), Ce(() => {
|
|
1554
|
-
if (!
|
|
1555
|
+
if (!s) return;
|
|
1555
1556
|
const {
|
|
1556
1557
|
onDeposit: o,
|
|
1557
1558
|
onTransCode: a,
|
|
@@ -1562,10 +1563,10 @@ const Tt = /* @__PURE__ */ lt(mt), H = {
|
|
|
1562
1563
|
onReload: h,
|
|
1563
1564
|
onTransferInGame: u,
|
|
1564
1565
|
onCashRegisterLimit: b
|
|
1565
|
-
} = f.current, C = we(
|
|
1566
|
-
memberInfoUid: we(
|
|
1567
|
-
data: we(
|
|
1568
|
-
memo: we(
|
|
1566
|
+
} = f.current, C = we(s, "type", ""), P = {
|
|
1567
|
+
memberInfoUid: we(s, "member_info_uid", null),
|
|
1568
|
+
data: we(s, "data", null),
|
|
1569
|
+
memo: we(s, "memo", null)
|
|
1569
1570
|
};
|
|
1570
1571
|
switch (C) {
|
|
1571
1572
|
case H.DEPOSIT:
|
|
@@ -1600,7 +1601,7 @@ const Tt = /* @__PURE__ */ lt(mt), H = {
|
|
|
1600
1601
|
console.warn("Unknown socket type:", C);
|
|
1601
1602
|
break;
|
|
1602
1603
|
}
|
|
1603
|
-
}, [
|
|
1604
|
+
}, [s]), Ce(() => () => E.current = !0, []), {
|
|
1604
1605
|
sendMessage: _,
|
|
1605
1606
|
sendJsonMessage: S,
|
|
1606
1607
|
readyState: c
|