Scripts/resources/[phone]/npwd/dist/html/7619.js

1 line
5.9 KiB
JavaScript
Raw Normal View History

2024-12-29 19:49:12 +00:00
"use strict";(self.webpackChunk_npwd_nui=self.webpackChunk_npwd_nui||[]).push([[7619],{48466:function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),u=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),u(n(20612),t),u(n(33723),t),u(n(98398),t),u(n(7339),t),u(n(88327),t),u(n(38006),t)},7339:function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.NuiContext=void 0;var r=n(53182);t.NuiContext=r.createContext(null)},33723:function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.useNuiCallback=void 0;var r=n(53182),u=n(7339),o=n(38006),i=n(20612);t.useNuiCallback=function(e,t,n,c){var a=r.useContext(u.NuiContext),s=a.sendAbortable,l=a.callbackTimeout,f=r.useRef(),d=r.useRef(),v=r.useRef(o.eventNameFactory(e,t)),p=r.useRef(t),b=r.useRef(e),h=r.useState(!1),y=h[0],m=h[1],w=r.useState(!1),_=w[0],N=w[1],C=r.useState(!1),k=C[0],g=C[1],E=r.useState(null),x=E[0],O=E[1],P=r.useState(null),j=P[0],R=P[1],S=r.useCallback((function(e){k&&(d.current&&clearTimeout(d.current),y||(R(e),O(null),g(!1),null==n||n(e)))}),[n,y,k]),M=r.useCallback((function(e){d.current&&clearTimeout(d.current),O(e),R(null),g(!1),null==c||c(e)}),[c]);return i.useNuiEvent(b.current,p.current+"Success",S),i.useNuiEvent(b.current,p.current+"Error",M),[r.useCallback((function(e,t){g((function(n){if(!n){m(!1),N(!1),O(null),R(null),f.current=s(p.current,e),f.current.promise.catch((function(e){y||(M(e),N(!0),d.current=void 0,f.current=void 0)}));var r=t||{timeout:l},u=!1!==r.timeout&&(r.timeout||l);return u&&!_&&(clearTimeout(d.current),d.current=setTimeout((function(){m(!0),M(new Error('fivem-nui-react-lib: "'+v.current+'" event callback timed out after '+u+" milliseconds")),f.current&&f.current.abort(),d.current=void 0,f.current=void 0}),u)),!0}return n}))}),[]),{loading:k,response:j,error:x}]}},20612:function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.useNuiEvent=void 0;var r=n(53182),u=n(38006);t.useNuiEvent=function(e,t,n){var o=r.useRef();r.useEffect((function(){o.current=n}),[n]),r.useEffect((function(){var n=u.eventNameFactory(e,t),r=function(e){if(o.current&&o.current.call){var t=e.data;o.current(t)}};return function(e,t,n){e.addEventListener(t,n)}(window,n,r),function(){return window.removeEventListener(n,r)}}),[e,t])}},98398:function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.useNuiRequest=void 0;var r=n(53182),u=n(7339);t.useNuiRequest=function(e){var t=(void 0===e?{}:e).resource,n=r.useContext(u.NuiContext);if(!n)throw new Error("fivem-nui-react-lib: useNuiRequest must be used inside NuiProvider passing the `resource` prop");var o=n.send,i=n.sendAbortable;return r.useMemo((function(){return{send:function(e,n){return void 0===n&&(n={}),o(e,n,t)},sendAbortable:function(e,n){return void 0===n&&(n={}),i(e,n,t)}}}),[o,i,t])}},88327:function(e,t,n){var r=this&&this.__assign||function(){return r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var u in t=arguments[n])Object.prototype.hasOwnProperty.call(t,u)&&(e[u]=t[u]);return e},r.apply(this,arguments)},u=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(u,o){function i(e){try{a(r.next(e))}catch(e){o(e)}}function c(e){try{a(r.throw(e))}catch(e){o(e)}}function a(e){var t;e.done?u(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,c)}a((r=r.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var n,r,u,o,i={label:0,sent:function(){if(1&u[0])throw u[1];return u[1]},trys:[],ops:[]};return o={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function c(o){return function(c){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(u=2&o[0]?r.return:o[0]?r.throw||((u=r.return)&&u.call(r),0):r.next)&&!(u=