2026-07-25 08:10:48 +00:00
// Module ID: 4793
// Function ID: 41689
2026-07-20 16:05:17 +00:00
// Name: getNameAndValue
2026-07-25 08:10:48 +00:00
// Dependencies: [77, 4749, 4765, 4777, 4746, 4753, 4779]
2026-07-20 16:05:17 +00:00
2026-07-25 08:10:48 +00:00
// Module 4793 (getNameAndValue)
2026-07-23 10:11:24 +00:00
import _defineProperty from "_defineProperty" ;
const require = arg1 ;
function getNameAndValue ( byteLength , offset , length , type , arg4 ) {
const _require = type ;
2026-07-20 16:05:17 +00:00
const items = [ ] ;
const items1 = [ ] ;
const items2 = [ ] ;
2026-07-23 10:11:24 +00:00
let tmp = STATE _KEYWORD ;
const COMPRESSION _METHOD _NONE = _require ( items1 [ 4 ] ) . COMPRESSION _METHOD _NONE ;
2026-07-20 16:05:17 +00:00
let dataView ;
let tmp3 = COMPRESSION _METHOD _NONE ;
2026-07-23 10:11:24 +00:00
if ( 0 < length ) {
2026-07-20 16:05:17 +00:00
let tmp4 = COMPRESSION _METHOD _NONE ;
let num2 = 0 ;
tmp3 = COMPRESSION _METHOD _NONE ;
2026-07-23 10:11:24 +00:00
if ( offset < byteLength . byteLength ) {
2026-07-20 16:05:17 +00:00
while ( true ) {
2026-07-23 10:11:24 +00:00
let tmp5 = STATE _COMPRESSION ;
2026-07-20 16:05:17 +00:00
let tmp6 = tmp4 ;
let tmp7 = num2 ;
2026-07-23 10:11:24 +00:00
if ( tmp !== STATE _COMPRESSION ) {
let tmp16 = STATE _TEXT ;
if ( tmp === STATE _TEXT ) {
2026-07-20 16:05:17 +00:00
break ;
} else {
2026-07-23 10:11:24 +00:00
let uint8 = byteLength . getUint8 ( offset + num2 ) ;
2026-07-20 16:05:17 +00:00
if ( 0 === uint8 ) {
let tmp27 = moveToNextState ;
let tmp15 = moveToNextState ( type , tmp ) ;
let tmp9 = tmp4 ;
let sum = num2 ;
let tmp28 = uint8 ;
} else {
2026-07-23 10:11:24 +00:00
let tmp17 = STATE _KEYWORD ;
if ( tmp === STATE _KEYWORD ) {
2026-07-20 16:05:17 +00:00
let arr = items . push ( uint8 ) ;
tmp15 = tmp ;
tmp9 = tmp4 ;
sum = num2 ;
let tmp26 = uint8 ;
} else {
2026-07-23 10:11:24 +00:00
let tmp18 = STATE _LANG ;
if ( tmp === STATE _LANG ) {
2026-07-20 16:05:17 +00:00
arr = items1 . push ( uint8 ) ;
tmp15 = tmp ;
tmp9 = tmp4 ;
sum = num2 ;
let tmp24 = uint8 ;
} else {
2026-07-23 10:11:24 +00:00
let tmp19 = STATE _TRANSLATED _KEYWORD ;
2026-07-20 16:05:17 +00:00
tmp15 = tmp ;
tmp9 = tmp4 ;
sum = num2 ;
let tmp20 = uint8 ;
2026-07-23 10:11:24 +00:00
if ( tmp === STATE _TRANSLATED _KEYWORD ) {
2026-07-20 16:05:17 +00:00
let arr1 = items2 . push ( uint8 ) ;
tmp15 = tmp ;
tmp9 = tmp4 ;
sum = num2 ;
let tmp22 = uint8 ;
}
}
}
}
}
} else {
let tmp8 = getCompressionMethod ;
2026-07-23 10:11:24 +00:00
let obj = { type , dataView : byteLength , offset : offset + num2 } ;
2026-07-20 16:05:17 +00:00
tmp9 = getCompressionMethod ( obj ) ;
2026-07-23 10:11:24 +00:00
let tmp10 = _require ;
let tmp11 = items1 ;
2026-07-20 16:05:17 +00:00
sum = num2 ;
2026-07-23 10:11:24 +00:00
if ( type === _require ( items1 [ 5 ] ) . TYPE _ITXT ) {
let tmp13 = c9 ;
sum = num2 + c9 ;
2026-07-20 16:05:17 +00:00
}
let tmp14 = moveToNextState ;
tmp15 = moveToNextState ( type , tmp ) ;
}
num2 = sum + 1 ;
tmp3 = tmp9 ;
2026-07-23 10:11:24 +00:00
if ( num2 < length ) {
2026-07-20 16:05:17 +00:00
tmp = tmp15 ;
tmp4 = tmp9 ;
tmp3 = tmp9 ;
}
}
const _DataView = DataView ;
const buffer = byteLength . buffer ;
2026-07-23 10:11:24 +00:00
dataView = new DataView ( buffer . slice ( offset + num2 , offset + length ) ) ;
2026-07-20 16:05:17 +00:00
tmp3 = tmp4 ;
}
}
2026-07-23 10:11:24 +00:00
if ( tmp3 !== _require ( items1 [ 4 ] ) . COMPRESSION _METHOD _NONE ) {
2026-07-20 16:05:17 +00:00
if ( ! arg4 ) {
return { } ;
}
}
2026-07-23 10:11:24 +00:00
if ( type === _require ( items1 [ 5 ] ) . TYPE _TEXT ) {
2026-07-20 16:05:17 +00:00
let str = "latin1" ;
} else {
str = "utf-8" ;
}
2026-07-23 10:11:24 +00:00
const decompressResult = _require ( items1 [ 4 ] ) . decompress ( dataView , tmp3 , str ) ;
2026-07-20 16:05:17 +00:00
if ( decompressResult instanceof Promise ) {
2026-07-23 10:11:24 +00:00
let catchPromise = decompressResult . then ( ( arg0 ) => outer1 _15 ( arg0 , closure _0 , items1 , items ) ) . catch ( ( ) => outer1 _15 ( "<text using unknown compression>" . split ( "" ) , closure _0 , items1 , items ) ) ;
const nextPromise = decompressResult . then ( ( arg0 ) => outer1 _15 ( arg0 , closure _0 , items1 , items ) ) ;
2026-07-20 16:05:17 +00:00
} else {
catchPromise = constructTag ( decompressResult , type , items1 , items ) ;
}
return catchPromise ;
}
function getCompressionMethod ( arg0 ) {
let dataView ;
let offset ;
let type ;
( { type , dataView , offset } = arg0 ) ;
2026-07-25 08:10:48 +00:00
if ( type === require ( 4753 ) /* isPngImageHeaderChunk */ . TYPE _ITXT ) {
2026-07-23 10:11:24 +00:00
if ( dataView . getUint8 ( offset ) === c10 ) {
2026-07-20 16:05:17 +00:00
return dataView . getUint8 ( offset + 1 ) ;
}
2026-07-25 08:10:48 +00:00
} else if ( type === require ( 4753 ) /* isPngImageHeaderChunk */ . TYPE _ZTXT ) {
2026-07-20 16:05:17 +00:00
return dataView . getUint8 ( offset ) ;
}
2026-07-25 08:10:48 +00:00
return require ( 4746 ) /* getStringFromDataView */ . COMPRESSION _METHOD _NONE ;
2026-07-20 16:05:17 +00:00
}
function moveToNextState ( type , arg1 ) {
2026-07-23 10:11:24 +00:00
if ( arg1 === STATE _KEYWORD ) {
2026-07-25 08:10:48 +00:00
const items = [ require ( 4753 ) /* isPngImageHeaderChunk */ . TYPE _ITXT , require ( 4753 ) /* isPngImageHeaderChunk */ . TYPE _ZTXT ] ;
2026-07-20 16:05:17 +00:00
if ( items . includes ( type ) ) {
2026-07-23 10:11:24 +00:00
let tmp4 = STATE _COMPRESSION ;
2026-07-20 16:05:17 +00:00
}
return tmp4 ;
}
2026-07-23 10:11:24 +00:00
if ( arg1 === STATE _COMPRESSION ) {
2026-07-25 08:10:48 +00:00
type === require ( 4753 ) /* isPngImageHeaderChunk */ . TYPE _ITXT ? STATE _LANG : STATE _TEXT ;
2026-07-20 16:05:17 +00:00
} else {
2026-07-23 10:11:24 +00:00
tmp4 = arg1 === STATE _LANG ? STATE _TRANSLATED _KEYWORD : STATE _TEXT ;
2026-07-20 16:05:17 +00:00
}
}
function constructTag ( decompressResult , type , items1 , items ) {
let stringFromDataView = decompressResult ;
if ( decompressResult instanceof DataView ) {
2026-07-25 08:10:48 +00:00
let obj = require ( 4746 ) /* getStringFromDataView */ ;
2026-07-20 16:05:17 +00:00
stringFromDataView = obj . getStringFromDataView ( decompressResult , 0 , decompressResult . byteLength ) ;
}
obj = { name : getName ( type , items1 , items ) , value : stringFromDataView } ;
2026-07-25 08:10:48 +00:00
if ( type === require ( 4753 ) /* isPngImageHeaderChunk */ . TYPE _ITXT ) {
2026-07-20 16:05:17 +00:00
stringFromDataView = getDescription ( decompressResult ) ;
}
obj . description = stringFromDataView ;
return obj ;
}
function getName ( arg0 , items , items ) {
2026-07-25 08:10:48 +00:00
const stringValueFromArray = require ( 4746 ) /* getStringFromDataView */ . getStringValueFromArray ( items ) ;
2026-07-20 16:05:17 +00:00
let combined = stringValueFromArray ;
2026-07-25 08:10:48 +00:00
if ( arg0 !== require ( 4753 ) /* isPngImageHeaderChunk */ . TYPE _TEXT ) {
2026-07-20 16:05:17 +00:00
combined = stringValueFromArray ;
if ( 0 !== items . length ) {
const _HermesInternal = HermesInternal ;
2026-07-25 08:10:48 +00:00
combined = "" + stringValueFromArray + " (" + require ( 4746 ) /* getStringFromDataView */ . getStringValueFromArray ( items ) + ")" ;
const obj2 = require ( 4746 ) /* getStringFromDataView */ ;
2026-07-20 16:05:17 +00:00
}
}
return combined ;
}
function getDescription ( arg0 ) {
2026-07-25 08:10:48 +00:00
return importDefault ( 4779 ) . decode ( "UTF-8" , arg0 ) ;
2026-07-20 16:05:17 +00:00
}
function isExifGroupTag ( str , str2 ) {
let tmp = "raw profile type exif" === str . toLowerCase ( ) ;
if ( tmp ) {
tmp = "exif" === str2 . substring ( 1 , 5 ) ;
}
return tmp ;
}
function isIptcGroupTag ( str , str2 ) {
let tmp = "raw profile type iptc" === str . toLowerCase ( ) ;
if ( tmp ) {
tmp = "iptc" === str2 . substring ( 1 , 5 ) ;
}
return tmp ;
}
function decodeRawData ( arg0 ) {
let length ;
let sum ;
const replaced = arg0 . match ( /\n(exif|iptc)\n\s*\d+\n([\s\S]*)$/ ) [ 2 ] . replace ( /\n/g , "" ) ;
const arrayBuffer = new ArrayBuffer ( replaced . length / 2 ) ;
const dataView = new DataView ( arrayBuffer ) ;
let num = 0 ;
if ( 0 < replaced . length ) {
do {
let _parseInt = parseInt ;
sum = num + 2 ;
let setUint8Result = dataView . setUint8 ( num / 2 , parseInt ( replaced . substring ( num , sum ) , 16 ) ) ;
num = sum ;
length = replaced . length ;
} while ( sum < length ) ;
}
return dataView ;
}
2026-07-23 10:11:24 +00:00
const STATE _KEYWORD = "STATE_KEYWORD" ;
const STATE _COMPRESSION = "STATE_COMPRESSION" ;
const STATE _LANG = "STATE_LANG" ;
const STATE _TRANSLATED _KEYWORD = "STATE_TRANSLATED_KEYWORD" ;
const STATE _TEXT = "STATE_TEXT" ;
let c9 = 1 ;
let c10 = 1 ;
let c11 = 6 ;
2026-07-20 16:05:17 +00:00
export default {
2026-07-23 10:11:24 +00:00
read ( byteLength ) {
2026-07-20 16:05:17 +00:00
let description ;
let name ;
let value ;
2026-07-23 10:11:24 +00:00
let closure _0 = arg3 ;
2026-07-20 16:05:17 +00:00
let obj = { } ;
const items = [ ] ;
let num = 0 ;
if ( 0 < arg1 . length ) {
do {
let arr2 = arg1 [ num ] ;
2026-07-23 10:11:24 +00:00
let tmp4 = getNameAndValue ;
let tmp5 = byteLength ;
2026-07-20 16:05:17 +00:00
let tmp6 = arg2 ;
2026-07-23 10:11:24 +00:00
let promise = getNameAndValue ( byteLength , arr2 . offset , arr2 . length , arr2 . type , arg2 ) ;
2026-07-20 16:05:17 +00:00
let _Promise = Promise ;
if ( promise instanceof Promise ) {
let arr = items . push ( promise . then ( ( description ) => {
let name ;
let value ;
( { name , value } = description ) ;
2026-07-23 10:11:24 +00:00
if ( outer1 _1 ( outer1 _2 [ 1 ] ) . USE _EXIF ) {
if ( outer1 _18 ( name , value ) ) {
let obj = { _ _exif : outer1 _1 ( outer1 _2 [ 2 ] ) . read ( outer1 _20 ( value ) , outer1 _11 , closure _0 ) . tags } ;
2026-07-20 16:05:17 +00:00
return obj ;
}
}
2026-07-23 10:11:24 +00:00
if ( outer1 _1 ( outer1 _2 [ 1 ] ) . USE _IPTC ) {
if ( outer1 _19 ( name , value ) ) {
obj = { _ _iptc : outer1 _1 ( outer1 _2 [ 3 ] ) . read ( outer1 _20 ( value ) , 0 , closure _0 ) } ;
2026-07-20 16:05:17 +00:00
return obj ;
}
}
if ( name ) {
2026-07-23 10:11:24 +00:00
if ( ! outer1 _18 ( name , value ) ) {
if ( ! outer1 _19 ( name , value ) ) {
2026-07-20 16:05:17 +00:00
obj = { value , description : description . description } ;
2026-07-23 10:11:24 +00:00
return outer1 _3 ( { } , name , obj ) ;
2026-07-20 16:05:17 +00:00
}
}
}
} ) ) ;
let tmp7 = tmp ;
let tmp8 = tmp2 ;
let tmp9 = tmp3 ;
} else {
( { name , value , description } = promise ) ;
tmp7 = name ;
tmp8 = value ;
tmp9 = description ;
if ( name ) {
obj = { value , description } ;
obj [ name ] = obj ;
tmp7 = name ;
tmp8 = value ;
tmp9 = description ;
}
}
num = num + 1 ;
2026-07-23 10:11:24 +00:00
tmp = tmp7 ;
tmp2 = tmp8 ;
tmp3 = tmp9 ;
2026-07-20 16:05:17 +00:00
} while ( num < arg1 . length ) ;
}
obj = { readTags : obj } ;
let allPromises ;
if ( items . length > 0 ) {
allPromises = Promise . all ( items ) ;
}
obj . readTagsPromise = allPromises ;
return obj ;
}
} ;