// Module ID: 13011 // Function ID: 13012 // Name: _createTwoWayLink // Dependencies: [5, 19, 13010, 4995, 8939, 38, 4996, 8952, 2] // Exports: useDeviceCodeAuthorizeCallback // Module 13011 (_createTwoWayLink) import module_38 from "module_38"; import noop from "noop"; const require = arg1; function _createTwoWayLink() { const self = this; const tmp = callback((arg0, arg1, arg2) => { let closure_0 = arg0; let closure_1 = arg1; let closure_2 = arg2; let c9 = 0; let c10 = 0; let c8 = 0; return (function*(arg0, body) { if (c10 === 2) { c10 = 3; HermesBuiltin.throwTypeError(); } else if (tmp8 === 3) { if (arg0 === 1) { throw body; } else if (arg0 === 2) { let obj = { value: null, done: true }; obj[0] = body; return obj; } else { return { value: "HermesInternal", done: null }; } } else { try { c10 = 2; if (0 === c9) { if (arg0 === 1) { c10 = 3; throw body; } else if (arg0 === 2) { c10 = 3; obj = { value: null, done: true }; obj[0] = body; return obj; } else { const callback3 = tmp4; let state = tmp9; const callback = callback2; callback2 = dependencyMap; dependencyMap = undefined; let url; let c4; state = undefined; const result = callback(13010).clientIdToActivateDevicePlatform(callback); dependencyMap = result; if (null == result) { c9 = 1; c10 = 1; const obj1 = { value: null, done: false }; obj1[0] = outer1_6(tmp84, 1, "authorize"); return obj1; } else { url = null; let c8 = 1; let obj10 = callback2(4995); const obj2 = { twoWayLinkType: null, userCode: null }; obj2[0] = callback(8939).TwoWayLinkType.DEVICE_CODE; obj2[1] = tmp84; c9 = 4; c10 = 1; const obj3 = { value: null, done: false }; obj3[0] = obj10.authorize(result, obj2); return obj3; } const obj20 = callback(13010); } } else if (1 === tmp9) { if (arg0 === 1) { c10 = 3; throw body; } else if (arg0 === 2) { c10 = 3; const obj4 = { value: null, done: true }; obj4[0] = body; return obj4; } else { const _Error4 = Error; const error = new Error("Unsupported client_id for two way link"); throw error; } } else if (2 === tmp9) { c8 = 0; let code; if (closure_7 != null) { const body2 = closure_7.body; if (body2 != null) { code = body2.code; } } url = code; if (code == null) { url = 0; } c9 = 5; c10 = 1; const obj5 = { value: null, done: false }; obj5[0] = callback3(callback2, url, "authorize"); return obj5; } else if (3 === tmp9) { c8 = 0; c9 = 6; c10 = 1; const obj6 = { value: null, done: false }; obj6[0] = callback3(callback2, 2, "authorize"); return obj6; } else if (4 === tmp9) { if (arg0 === 1) { c10 = 3; throw body; } else if (arg0 === 2) { c8 = 0; c10 = 3; const obj7 = { value: null, done: true }; obj7[0] = body; return obj7; } else { url = body.body.url; c4 = null; c8 = 2; callback2(38)(null != url, "No URL in authorize response"); state = callback(4996).getCallbackParamsFromURL(url).state; callback2(38)(null != state, "Authorize URL state query parameter must be present"); c4 = state; c8 = 3; const obj17 = callback(4996); const obj8 = { code: null, state: null }; obj8[0] = callback; obj8[1] = c4; c9 = 8; c10 = 1; const obj9 = { value: null, done: false }; obj9[0] = callback2(4995).callback(dependencyMap, obj8); return obj9; } } else if (5 === tmp9) { if (arg0 === 1) { c10 = 3; throw body; } else if (arg0 === 2) { c10 = 3; obj10 = { value: null, done: true }; obj10[0] = body; return obj10; } else { const _Error3 = Error; const error1 = new Error("error during two way authorize"); throw error1; } } else if (6 === tmp9) { if (arg0 === 1) { c10 = 3; throw body; } else if (arg0 === 2) { c10 = 3; const obj11 = { value: null, done: true }; obj11[0] = body; return obj11; } else { const _Error2 = Error; const error2 = new Error("error parsing callback params"); throw error2; } } else if (7 === tmp9) { c8 = 0; let code1; if (closure_7 != null) { body = closure_7.body; if (body != null) { code1 = body.code; } } c4 = code1; if (code1 == null) { c4 = 0; } c9 = 9; c10 = 1; const obj12 = { value: null, done: false }; obj12[0] = callback3(callback2, c4, "callback"); return obj12; } else if (8 === tmp9) { if (arg0 === 1) { c10 = 3; throw body; } else if (arg0 === 2) { c8 = 0; c10 = 3; const obj13 = { value: null, done: true }; obj13[0] = body; return obj13; } else { c8 = 0; c10 = 3; return { value: "HermesInternal", done: null }; } } else if (arg0 === 1) { c10 = 3; throw body; } else if (arg0 === 2) { c10 = 3; obj = { value: null, done: true }; obj[0] = body; return obj; } else { const _Error = Error; const error3 = new Error("error during two way callback"); throw error3; } } catch (tmp50) { closure_7 = tmp50; if (tmp5 === c8) { c10 = tmp3; throw tmp50; } else if (tmp2 === tmp52) { c9 = tmp; } else if (tmp === tmp52) { c9 = tmp3; } else { c9 = tmp6; } } } })(); }); const _createTwoWayLink = tmp; const apply = tmp.apply; if (typeof apply === "unknown") { let applyArgumentsResult = HermesBuiltin.applyArguments(self); } else { applyArgumentsResult = apply(self, arguments); } return applyArgumentsResult; } function silentlyFinishTwoWayLinkError() { const self = this; const apply = _silentlyFinishTwoWayLinkError.apply; if (typeof apply === "unknown") { let applyArgumentsResult = HermesBuiltin.applyArguments(self); } else { applyArgumentsResult = apply(self, arguments); } return applyArgumentsResult; } function _silentlyFinishTwoWayLinkError() { const self = this; const tmp = callback((arg0, arg1, arg2) => { let closure_0 = arg0; let closure_1 = arg1; let closure_2 = arg2; let c4 = 0; let c3 = 0; let c6 = 0; return (function*(arg0, arg1, arg2) { if (c3 === 2) { c3 = 3; HermesBuiltin.throwTypeError(); } else if (tmp5 === 3) { if (arg0 === 1) { throw arg1; } else if (arg0 === 2) { let obj = { value: null, done: true }; obj[0] = arg1; return obj; } else { return { value: "HermesInternal", done: null }; } } else { try { c3 = 2; if (0 === c4) { if (arg0 === 1) { c3 = 3; throw arg1; } else if (arg0 === 2) { c3 = 3; obj = { value: null, done: true }; obj[0] = arg1; return obj; } else { let c6 = 1; let obj1 = callback(table[7]); c4 = 2; c3 = 1; obj1 = { value: null, done: false }; obj1[0] = obj1.finishUserCodeTwoWayLinkError(callback, closure_1, table); return obj1; } } else { if (1 === tmp6) { c6 = 0; c3 = 3; } else if (arg0 === 1) { c3 = 3; throw arg1; } else if (arg0 !== 2) { c6 = 0; } c6 = 0; c3 = 3; obj = { value: null, done: true }; obj[0] = arg1; return obj; } } catch (tmp13) { let closure_5 = tmp13; if (tmp3 === c6) { c3 = tmp2; throw tmp13; } else { c4 = tmp; } } } })(); }); const _silentlyFinishTwoWayLinkError = tmp; const apply = tmp.apply; if (typeof apply === "unknown") { let applyArgumentsResult = HermesBuiltin.applyArguments(self); } else { applyArgumentsResult = apply(self, arguments); } return applyArgumentsResult; } let result = require("clientIdToActivateDevicePlatform").fileFinishedImporting("modules/activate_device/useDeviceCodeAuthorizeCallback.tsx"); export const useDeviceCodeAuthorizeCallback = function useDeviceCodeAuthorizeCallback(callback, callback2, callback1) { let closure_0 = callback; let closure_1 = callback2; let closure_2 = callback1; closure_0 = undefined; closure_0 = callback((arg0, arg1) => { let closure_0 = arg0; let closure_1 = arg1; let c6 = 0; let c7 = 0; let c5 = 0; return (function*(arg0, arg1) { if (c7 === 2) { c7 = 3; HermesBuiltin.throwTypeError(); } else if (tmp8 === 3) { if (arg0 === 1) { throw arg1; } else if (arg0 === 2) { let obj = { value: null, done: true }; obj[0] = arg1; return obj; } else { return { value: "HermesInternal", done: null }; } } else { try { c7 = 2; if (0 === c6) { if (arg0 === 1) { c7 = 3; throw arg1; } else if (arg0 === 2) { c7 = 3; obj = { value: null, done: true }; obj[0] = arg1; return obj; } else { let module_38 = tmp4; const dependencyMap = tmp6; if (callback2) { if (null == tmp49.twoWayLinkCode) { let c5 = 2; c6 = 4; c7 = 1; const obj1 = { value: null, done: false }; obj1[0] = callback(8952).finishUserCode(tmp49.userCode, "granted"); return obj1; } else { c5 = 3; c6 = 5; c7 = 1; const obj2 = { value: null, done: false }; obj2[0] = (function createTwoWayLink(clientId, twoWayLinkCode, userCode) { const self = this; const apply = c5.apply; if (typeof apply === "unknown") { let applyArgumentsResult = HermesBuiltin.applyArguments(self); } else { applyArgumentsResult = apply(self, arguments); } return applyArgumentsResult; })(tmp49.clientId, tmp49.twoWayLinkCode, tmp49.userCode); return obj2; } } else { c5 = 1; let obj3 = callback(8952); c6 = 6; c7 = 1; obj3 = { value: null, done: false }; obj3[0] = obj3.finishUserCode(tmp49.userCode, "denied"); return obj3; } } } else { if (1 === tmp9) { c5 = 0; callback(); } else { if (2 === tmp9) { c5 = 0; callback2(callback); } else if (3 === tmp9) { c5 = 0; callback2(callback); } else { if (4 === tmp9) { if (arg0 === 1) { c7 = 3; throw arg1; } else if (arg0 === 2) { c5 = 0; c7 = 3; const obj4 = { value: null, done: true }; obj4[0] = arg1; return obj4; } else { outer1_2(callback); c5 = 0; } } else if (5 === tmp9) { if (arg0 === 1) { c7 = 3; throw arg1; } else if (arg0 !== 2) { outer1_2(callback); c5 = 0; } } else if (arg0 === 1) { c7 = 3; throw arg1; } else if (arg0 !== 2) { c5 = 0; } c5 = 0; c7 = 3; const obj5 = { value: null, done: true }; obj5[0] = arg1; return obj5; } c7 = 3; } c5 = 0; c7 = 3; obj = { value: null, done: true }; obj[0] = arg1; return obj; } } catch (tmp40) { let noop = tmp40; if (tmp5 === c5) { c7 = tmp3; throw tmp40; } else if (tmp2 === tmp42) { c6 = tmp2; } else if (tmp === tmp42) { c6 = tmp; } else { c6 = tmp3; } } } })(); }); const items = [callback, callback2, callback1]; return React.useCallback(function() { const self = this; const apply = closure_0.apply; if (typeof apply === "unknown") { let applyArgumentsResult = HermesBuiltin.applyArguments(self); } else { applyArgumentsResult = apply(self, arguments); } return applyArgumentsResult; }, items); };