{"version":3,"file":"getSelectOptionsFromUrl.mjs","sources":[""],"sourcesContent":["import type { TGetFromServerArgs } from \"@web3r/flowerkit/net\";\r\nimport { getFromServer } from \"@web3r/flowerkit/net\";\r\nimport { selectEmptyOptions } from \"../config/constants\";\r\nimport type { TOptionType } from \"../config/types\";\r\n\r\ntype TSelectOptionsResponse = {\r\n  isSuccess?: boolean;\r\n  data?: {\r\n    options?: TOptionType[];\r\n  };\r\n};\r\n\r\n/**\r\n * Fetches options from a remote URL using a standardized response format.\r\n * Expects the response to contain `data.options` when successful.\r\n * @returns {Promise<TOptionType[]>}\r\n */\r\nexport const getSelectOptionsFromUrl = async (\r\n  requestCfg: TGetFromServerArgs<TSelectOptionsResponse> = {}\r\n): Promise<TOptionType[]> => {\r\n  const resp = await getFromServer<TSelectOptionsResponse>({\r\n    ...requestCfg,\r\n  });\r\n\r\n  return resp.isSuccess ? resp.data?.options ?? selectEmptyOptions : selectEmptyOptions;\r\n};\r\n"],"names":["getSelectOptionsFromUrl","async","requestCfg","resp","getFromServer","isSuccess","data","options","selectEmptyOptions"],"mappings":";;;;;GAiBO,MAAMA,wBAA0BC,MACrCC,WAAyD,MAEzD,MAAMC,WAAaC,cAAsC,IACpDF,aAGL,OAAOC,KAAKE,UAAYF,KAAKG,MAAMC,SAAWC,mBAAqBA"}