{"version":3,"file":"Heart.js","sources":["../../../../src/lib/apis/tools/index.ts","../../../../src/lib/components/common/Valves.svelte","../../../../src/lib/components/icons/Heart.svelte"],"sourcesContent":["import { WEBUI_API_BASE_URL } from '$lib/constants';\n\nexport const createNewTool = async (token: string, tool: object) => {\n\tlet error = null;\n\n\tconst res = await fetch(`${WEBUI_API_BASE_URL}/tools/create`, {\n\t\tmethod: 'POST',\n\t\theaders: {\n\t\t\tAccept: 'application/json',\n\t\t\t'Content-Type': 'application/json',\n\t\t\tauthorization: `Bearer ${token}`\n\t\t},\n\t\tbody: JSON.stringify({\n\t\t\t...tool\n\t\t})\n\t})\n\t\t.then(async (res) => {\n\t\t\tif (!res.ok) throw await res.json();\n\t\t\treturn res.json();\n\t\t})\n\t\t.catch((err) => {\n\t\t\terror = err.detail;\n\t\t\tconsole.log(err);\n\t\t\treturn null;\n\t\t});\n\n\tif (error) {\n\t\tthrow error;\n\t}\n\n\treturn res;\n};\n\nexport const getTools = async (token: string = '') => {\n\tlet error = null;\n\n\tconst res = await fetch(`${WEBUI_API_BASE_URL}/tools/`, {\n\t\tmethod: 'GET',\n\t\theaders: {\n\t\t\tAccept: 'application/json',\n\t\t\t'Content-Type': 'application/json',\n\t\t\tauthorization: `Bearer ${token}`\n\t\t}\n\t})\n\t\t.then(async (res) => {\n\t\t\tif (!res.ok) throw await res.json();\n\t\t\treturn res.json();\n\t\t})\n\t\t.then((json) => {\n\t\t\treturn json;\n\t\t})\n\t\t.catch((err) => {\n\t\t\terror = err.detail;\n\t\t\tconsole.log(err);\n\t\t\treturn null;\n\t\t});\n\n\tif (error) {\n\t\tthrow error;\n\t}\n\n\treturn res;\n};\n\nexport const exportTools = async (token: string = '') => {\n\tlet error = null;\n\n\tconst res = await fetch(`${WEBUI_API_BASE_URL}/tools/export`, {\n\t\tmethod: 'GET',\n\t\theaders: {\n\t\t\tAccept: 'application/json',\n\t\t\t'Content-Type': 'application/json',\n\t\t\tauthorization: `Bearer ${token}`\n\t\t}\n\t})\n\t\t.then(async (res) => {\n\t\t\tif (!res.ok) throw await res.json();\n\t\t\treturn res.json();\n\t\t})\n\t\t.then((json) => {\n\t\t\treturn json;\n\t\t})\n\t\t.catch((err) => {\n\t\t\terror = err.detail;\n\t\t\tconsole.log(err);\n\t\t\treturn null;\n\t\t});\n\n\tif (error) {\n\t\tthrow error;\n\t}\n\n\treturn res;\n};\n\nexport const getToolById = async (token: string, id: string) => {\n\tlet error = null;\n\n\tconst res = await fetch(`${WEBUI_API_BASE_URL}/tools/id/${id}`, {\n\t\tmethod: 'GET',\n\t\theaders: {\n\t\t\tAccept: 'application/json',\n\t\t\t'Content-Type': 'application/json',\n\t\t\tauthorization: `Bearer ${token}`\n\t\t}\n\t})\n\t\t.then(async (res) => {\n\t\t\tif (!res.ok) throw await res.json();\n\t\t\treturn res.json();\n\t\t})\n\t\t.then((json) => {\n\t\t\treturn json;\n\t\t})\n\t\t.catch((err) => {\n\t\t\terror = err.detail;\n\n\t\t\tconsole.log(err);\n\t\t\treturn null;\n\t\t});\n\n\tif (error) {\n\t\tthrow error;\n\t}\n\n\treturn res;\n};\n\nexport const updateToolById = async (token: string, id: string, tool: object) => {\n\tlet error = null;\n\n\tconst res = await fetch(`${WEBUI_API_BASE_URL}/tools/id/${id}/update`, {\n\t\tmethod: 'POST',\n\t\theaders: {\n\t\t\tAccept: 'application/json',\n\t\t\t'Content-Type': 'application/json',\n\t\t\tauthorization: `Bearer ${token}`\n\t\t},\n\t\tbody: JSON.stringify({\n\t\t\t...tool\n\t\t})\n\t})\n\t\t.then(async (res) => {\n\t\t\tif (!res.ok) throw await res.json();\n\t\t\treturn res.json();\n\t\t})\n\t\t.then((json) => {\n\t\t\treturn json;\n\t\t})\n\t\t.catch((err) => {\n\t\t\terror = err.detail;\n\n\t\t\tconsole.log(err);\n\t\t\treturn null;\n\t\t});\n\n\tif (error) {\n\t\tthrow error;\n\t}\n\n\treturn res;\n};\n\nexport const deleteToolById = async (token: string, id: string) => {\n\tlet error = null;\n\n\tconst res = await fetch(`${WEBUI_API_BASE_URL}/tools/id/${id}/delete`, {\n\t\tmethod: 'DELETE',\n\t\theaders: {\n\t\t\tAccept: 'application/json',\n\t\t\t'Content-Type': 'application/json',\n\t\t\tauthorization: `Bearer ${token}`\n\t\t}\n\t})\n\t\t.then(async (res) => {\n\t\t\tif (!res.ok) throw await res.json();\n\t\t\treturn res.json();\n\t\t})\n\t\t.then((json) => {\n\t\t\treturn json;\n\t\t})\n\t\t.catch((err) => {\n\t\t\terror = err.detail;\n\n\t\t\tconsole.log(err);\n\t\t\treturn null;\n\t\t});\n\n\tif (error) {\n\t\tthrow error;\n\t}\n\n\treturn res;\n};\n\nexport const getToolValvesById = async (token: string, id: string) => {\n\tlet error = null;\n\n\tconst res = await fetch(`${WEBUI_API_BASE_URL}/tools/id/${id}/valves`, {\n\t\tmethod: 'GET',\n\t\theaders: {\n\t\t\tAccept: 'application/json',\n\t\t\t'Content-Type': 'application/json',\n\t\t\tauthorization: `Bearer ${token}`\n\t\t}\n\t})\n\t\t.then(async (res) => {\n\t\t\tif (!res.ok) throw await res.json();\n\t\t\treturn res.json();\n\t\t})\n\t\t.then((json) => {\n\t\t\treturn json;\n\t\t})\n\t\t.catch((err) => {\n\t\t\terror = err.detail;\n\n\t\t\tconsole.log(err);\n\t\t\treturn null;\n\t\t});\n\n\tif (error) {\n\t\tthrow error;\n\t}\n\n\treturn res;\n};\n\nexport const getToolValvesSpecById = async (token: string, id: string) => {\n\tlet error = null;\n\n\tconst res = await fetch(`${WEBUI_API_BASE_URL}/tools/id/${id}/valves/spec`, {\n\t\tmethod: 'GET',\n\t\theaders: {\n\t\t\tAccept: 'application/json',\n\t\t\t'Content-Type': 'application/json',\n\t\t\tauthorization: `Bearer ${token}`\n\t\t}\n\t})\n\t\t.then(async (res) => {\n\t\t\tif (!res.ok) throw await res.json();\n\t\t\treturn res.json();\n\t\t})\n\t\t.then((json) => {\n\t\t\treturn json;\n\t\t})\n\t\t.catch((err) => {\n\t\t\terror = err.detail;\n\n\t\t\tconsole.log(err);\n\t\t\treturn null;\n\t\t});\n\n\tif (error) {\n\t\tthrow error;\n\t}\n\n\treturn res;\n};\n\nexport const updateToolValvesById = async (token: string, id: string, valves: object) => {\n\tlet error = null;\n\n\tconst res = await fetch(`${WEBUI_API_BASE_URL}/tools/id/${id}/valves/update`, {\n\t\tmethod: 'POST',\n\t\theaders: {\n\t\t\tAccept: 'application/json',\n\t\t\t'Content-Type': 'application/json',\n\t\t\tauthorization: `Bearer ${token}`\n\t\t},\n\t\tbody: JSON.stringify({\n\t\t\t...valves\n\t\t})\n\t})\n\t\t.then(async (res) => {\n\t\t\tif (!res.ok) throw await res.json();\n\t\t\treturn res.json();\n\t\t})\n\t\t.then((json) => {\n\t\t\treturn json;\n\t\t})\n\t\t.catch((err) => {\n\t\t\terror = err.detail;\n\n\t\t\tconsole.log(err);\n\t\t\treturn null;\n\t\t});\n\n\tif (error) {\n\t\tthrow error;\n\t}\n\n\treturn res;\n};\n\nexport const getUserValvesById = async (token: string, id: string) => {\n\tlet error = null;\n\n\tconst res = await fetch(`${WEBUI_API_BASE_URL}/tools/id/${id}/valves/user`, {\n\t\tmethod: 'GET',\n\t\theaders: {\n\t\t\tAccept: 'application/json',\n\t\t\t'Content-Type': 'application/json',\n\t\t\tauthorization: `Bearer ${token}`\n\t\t}\n\t})\n\t\t.then(async (res) => {\n\t\t\tif (!res.ok) throw await res.json();\n\t\t\treturn res.json();\n\t\t})\n\t\t.then((json) => {\n\t\t\treturn json;\n\t\t})\n\t\t.catch((err) => {\n\t\t\terror = err.detail;\n\n\t\t\tconsole.log(err);\n\t\t\treturn null;\n\t\t});\n\n\tif (error) {\n\t\tthrow error;\n\t}\n\n\treturn res;\n};\n\nexport const getUserValvesSpecById = async (token: string, id: string) => {\n\tlet error = null;\n\n\tconst res = await fetch(`${WEBUI_API_BASE_URL}/tools/id/${id}/valves/user/spec`, {\n\t\tmethod: 'GET',\n\t\theaders: {\n\t\t\tAccept: 'application/json',\n\t\t\t'Content-Type': 'application/json',\n\t\t\tauthorization: `Bearer ${token}`\n\t\t}\n\t})\n\t\t.then(async (res) => {\n\t\t\tif (!res.ok) throw await res.json();\n\t\t\treturn res.json();\n\t\t})\n\t\t.then((json) => {\n\t\t\treturn json;\n\t\t})\n\t\t.catch((err) => {\n\t\t\terror = err.detail;\n\n\t\t\tconsole.log(err);\n\t\t\treturn null;\n\t\t});\n\n\tif (error) {\n\t\tthrow error;\n\t}\n\n\treturn res;\n};\n\nexport const updateUserValvesById = async (token: string, id: string, valves: object) => {\n\tlet error = null;\n\n\tconst res = await fetch(`${WEBUI_API_BASE_URL}/tools/id/${id}/valves/user/update`, {\n\t\tmethod: 'POST',\n\t\theaders: {\n\t\t\tAccept: 'application/json',\n\t\t\t'Content-Type': 'application/json',\n\t\t\tauthorization: `Bearer ${token}`\n\t\t},\n\t\tbody: JSON.stringify({\n\t\t\t...valves\n\t\t})\n\t})\n\t\t.then(async (res) => {\n\t\t\tif (!res.ok) throw await res.json();\n\t\t\treturn res.json();\n\t\t})\n\t\t.then((json) => {\n\t\t\treturn json;\n\t\t})\n\t\t.catch((err) => {\n\t\t\terror = err.detail;\n\n\t\t\tconsole.log(err);\n\t\t\treturn null;\n\t\t});\n\n\tif (error) {\n\t\tthrow error;\n\t}\n\n\treturn res;\n};\n","\n\n{#if valvesSpec && Object.keys(valvesSpec?.properties ?? {}).length}\n\t{#each Object.keys(valvesSpec.properties) as property, idx}\n\t\t