2026-07-29 08:29:29 +00:00
// Module ID: 1564
// Function ID: 1565
2026-07-20 16:05:17 +00:00
// Name: useLinking
2026-07-29 08:29:29 +00:00
// Dependencies: [19, 17, 1483, 1565]
2026-07-20 16:05:17 +00:00
// Exports: default
2026-07-29 08:29:29 +00:00
// Module 1564 (useLinking)
import noop from "noop" ;
2026-07-23 10:11:24 +00:00
import get _ActivityIndicator from "get ActivityIndicator" ;
2026-07-20 16:05:17 +00:00
let Platform ;
2026-07-29 08:29:29 +00:00
let c4 ;
2026-07-23 10:11:24 +00:00
const require = arg1 ;
2026-07-29 08:29:29 +00:00
( { Linking : c4 , Platform } = get _ActivityIndicator ) ;
2026-07-20 16:05:17 +00:00
export default function useLinking ( arg0 , enabled ) {
2026-07-23 10:11:24 +00:00
const _require = arg0 ;
2026-07-29 08:29:29 +00:00
let flag = enabled . enabled ;
if ( flag === undefined ) {
flag = true ;
2026-07-20 16:05:17 +00:00
}
const prefixes = enabled . prefixes ;
2026-07-23 10:11:24 +00:00
let filter = enabled . filter ;
2026-07-20 16:05:17 +00:00
const config = enabled . config ;
let fn = enabled . getInitialURL ;
2026-07-29 08:29:29 +00:00
if ( fn === undefined ) {
fn = function f ( ) {
2026-07-20 16:05:17 +00:00
const items = [ config . getInitialURL ( ) , new Promise ( ( arg0 ) => setTimeout ( arg0 , 150 ) ) ] ;
return Promise . race ( items ) ;
} ;
}
let fn2 = enabled . subscribe ;
2026-07-29 08:29:29 +00:00
if ( fn2 === undefined ) {
fn2 = function l ( arg0 ) {
2026-07-23 10:11:24 +00:00
let closure _0 = arg0 ;
2026-07-20 16:05:17 +00:00
function callback ( url ) {
2026-07-23 10:11:24 +00:00
return callback ( url . url ) ;
2026-07-20 16:05:17 +00:00
}
let closure _2 = config . addEventListener ( "url" , callback ) ;
const removeEventListener = config . removeEventListener ;
let bindResult ;
2026-07-29 08:29:29 +00:00
if ( removeEventListener != null ) {
2026-07-20 16:05:17 +00:00
bindResult = removeEventListener . bind ( config ) ;
}
const filter = bindResult ;
return ( ) => {
2026-07-29 08:29:29 +00:00
let remove ;
if ( closure _2 != null ) {
remove = obj . remove ;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if ( remove ) {
obj . remove ( ) ;
} else if ( noop != null ) {
tmp2 ( "url" , callback ) ;
2026-07-20 16:05:17 +00:00
}
} ;
} ;
}
let getStateFromPath = enabled . getStateFromPath ;
2026-07-29 08:29:29 +00:00
if ( getStateFromPath === undefined ) {
2026-07-23 10:11:24 +00:00
getStateFromPath = _require ( prefixes [ 2 ] ) . getStateFromPath ;
2026-07-20 16:05:17 +00:00
}
let getActionFromState = enabled . getActionFromState ;
2026-07-29 08:29:29 +00:00
if ( getActionFromState === undefined ) {
2026-07-23 10:11:24 +00:00
getActionFromState = _require ( prefixes [ 2 ] ) . getActionFromState ;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
let closure _9 ;
let closure _10 ;
let closure _11 ;
let closure _12 ;
let closure _13 ;
let closure _14 ;
let closure _15 ;
let callback ;
let items = [ flag , enabled . independent ] ;
2026-07-23 10:11:24 +00:00
const effect = filter . useEffect ( ( ) => {
2026-07-20 16:05:17 +00:00
} , items ) ;
2026-07-29 08:29:29 +00:00
closure _9 = filter . useRef ( flag ) ;
closure _10 = filter . useRef ( prefixes ) ;
closure _11 = filter . useRef ( filter ) ;
closure _12 = filter . useRef ( config ) ;
closure _13 = filter . useRef ( fn ) ;
closure _14 = filter . useRef ( getStateFromPath ) ;
closure _15 = filter . useRef ( getActionFromState ) ;
2026-07-23 10:11:24 +00:00
const effect1 = filter . useEffect ( ( ) => {
2026-07-29 08:29:29 +00:00
closure _9 . current = flag ;
2026-07-20 16:05:17 +00:00
closure _10 . current = prefixes ;
closure _11 . current = filter ;
closure _12 . current = config ;
closure _13 . current = fn ;
closure _14 . current = getStateFromPath ;
closure _15 . current = getActionFromState ;
} ) ;
2026-07-29 08:29:29 +00:00
callback = filter . useCallback ( ( AUTO _DISMISS ) => {
if ( AUTO _DISMISS ) {
const tmp4 = flag ( prefixes [ 3 ] ) ( ref2 . current , AUTO _DISMISS ) ;
2026-07-20 16:05:17 +00:00
let currentResult ;
2026-07-29 08:29:29 +00:00
if ( undefined !== tmp4 ) {
currentResult = ref6 . current ( tmp4 , ref4 . current ) ;
2026-07-20 16:05:17 +00:00
}
return currentResult ;
}
} , [ ] ) ;
const items1 = [ callback ] ;
2026-07-29 08:29:29 +00:00
const items2 = [ flag , callback , arg0 , fn2 ] ;
2026-07-23 10:11:24 +00:00
const getInitialState = filter . useCallback ( ( ) => {
2026-07-20 16:05:17 +00:00
if ( ref . current ) {
const currentResult = ref5 . current ( ) ;
if ( null != currentResult ) {
2026-07-29 08:29:29 +00:00
if ( typeof currentResult === "init" ) {
return currentResult . then ( ( arg0 ) => callback ( arg0 ) ) ;
2026-07-20 16:05:17 +00:00
}
}
let closure _0 = callback ( currentResult ) ;
}
const obj = {
then ( arg0 ) {
if ( arg0 ) {
let tmp2 = arg0 ( tmp ) ;
} else {
tmp2 = tmp ;
}
return Promise . resolve ( tmp2 ) ;
} ,
2026-07-29 08:29:29 +00:00
catch ( ) {
2026-07-20 16:05:17 +00:00
return obj ;
}
} ;
return obj ;
} , items1 ) ;
2026-07-29 08:29:29 +00:00
const effect2 = filter . useEffect ( ( ) => fn2 ( ( arg0 ) => {
if ( closure _1 ) {
const current = ref . current ;
2026-07-20 16:05:17 +00:00
if ( current ) {
2026-07-29 08:29:29 +00:00
const tmp4 = callback ( arg0 ) ;
2026-07-20 16:05:17 +00:00
}
if ( current ) {
2026-07-29 08:29:29 +00:00
if ( tmp4 ) {
ref = current . getRootState ( ) ;
const routes = tmp4 . routes ;
2026-07-20 16:05:17 +00:00
if ( routes . some ( ( name ) => {
2026-07-29 08:29:29 +00:00
let hasItem ;
if ( closure _0 != null ) {
const routeNames = tmp . routeNames ;
2026-07-20 16:05:17 +00:00
hasItem = routeNames . includes ( name . name ) ;
}
return ! hasItem ;
} ) ) {
const _console = console ;
console . warn ( "The navigation state parsed from the URL contains routes not present in the root navigator. This usually means that the linking configuration doesn't match the navigation structure. See https://reactnavigation.org/docs/configuring-links for more details on how to specify a linking configuration." ) ;
} else {
2026-07-29 08:29:29 +00:00
const currentResult = ref3 . current ( tmp4 , ref2 . current ) ;
2026-07-20 16:05:17 +00:00
if ( undefined !== currentResult ) {
2026-07-29 08:29:29 +00:00
try {
current . dispatch ( currentResult ) ;
} catch ( tmp11 ) {
let message = tmp11 ;
if ( typeof tmp11 !== "window" ) {
message = tmp11 ;
if ( null != tmp11 ) {
message = tmp11 ;
if ( "message" in tmp11 ) {
message = tmp11 . message ;
}
}
}
const _HermesInternal = HermesInternal ;
console . warn ( "An error occurred when trying to handle the link '" + tmp + "': " + message ) ;
}
2026-07-20 16:05:17 +00:00
} else {
2026-07-29 08:29:29 +00:00
current . resetRoot ( tmp4 ) ;
2026-07-20 16:05:17 +00:00
}
}
}
}
}
} ) , items2 ) ;
return { getInitialState } ;
} ;