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,QAAS,KAAK,cACd,aACE,kHACF,OAAQ,EAAQ,QAAQ,eAAe,KAAK,OAAS,MAK3D,MAAO,CACL,OAAQ,EAAY,MAAM,QAC1B,SAAU,GAAe,EAAY,MAAM,gBAAkB,EAAY,MAAM,OAAS,IACxF,UAAW,EAAY,MAAM,WAC7B,OAAQ,cACR,QAAS,kCAEb,CAAE,MAAO,GACP,GAAI,aAAe,OAAS,EAAI,QAAQ,SAAS,oBAC/C,MAAM,IAAI,MAAM,8DAGlB,MADA,QAAQ,MAAM,SAAU,GAClB,CACR,CACF,CAEA,eAAA,CAAgB,EAAQ,EAAU,EAAO,EAAQ,GAC/C,MAAM,EAAO,CACX,OAAQ,EACR,MAAO,EACP,aAAc,EACd,gBAAiB,OAAO,IAK1B,OAHI,EAAO,OAAS,IAClB,EAAK,iBAAmB,EAAO,KAAK,MAAM,KAAK,SAAW,EAAO,UAE5D,CACT,CAEA,gBAAA,CAAiB,GACf,IAAK,MAAM,KAAO,KAAK,SACrB,EAAK,OAAO,EAAK,KAAK,SAAS,KAEnB,MAAM,QAAQ,KAAK,WAAa,KAAK,UAAY,CAAC,KAAK,YAC/D,SAAQ,GAAQ,EAAK,OAAO,SAAU,IAC9C,CAEA,yBAAA,CAA0B,GACxB,MAAM,EAAI,QAAQ,KAAK,EAAS,MAChC,OACE,EAAE,eAAe,QAAQ,QACzB,EAAE,qBAAqB,QAAQ,QAC/B,EAAE,eAAe,QAAQ,OACzB,EAAE,qBAAqB,QAAQ,KAEnC,EAGF,OAAO,QAAU","file":"/npm/abir-photo360-apis@1.0.2/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/abir-photo360-apis@1.0.2/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","// Copyright Faris Ali 2024-2025. All Rights Reserved\n// Modified by Mohammad Imran | Contact: www.facebook.com/Imran.Ahmed099\n\nconst axios = require(\"axios\");\nconst cheerio = require(\"cheerio\");\nconst FormData = require(\"form-data\");\n\nclass Photo360 {\n  constructor(url = \"https://en.ephoto360.com/handwritten-text-on-foggy-glass-online-680.html\") {\n    if (!url.includes(\"photo360.com\")) {\n      throw new Error(\"Invalid URL: Must be a photo360.com URL\");\n    }\n    this.effectPageUrl = url;\n    this.inputText = \"imran\";\n    this.formData = null;\n  }\n\n  setName(name) {\n    this.inputText = name;\n  }\n\n  async execute() {\n    try {\n      const getPage = await axios.get(this.effectPageUrl, {\n        headers: {\n          Accept: \"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8\",\n          Origin: new URL(this.effectPageUrl).origin,\n          Referer: this.effectPageUrl,\n          \"User-Agent\":\n            \"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36\",\n        },\n      });\n\n      const $ = cheerio.load(getPage.data);\n\n      const buildServer = $(\"#build_server\").val();\n      const buildServerId = $(\"#build_server_id\").val();\n      const token = $(\"#token\").val();\n      const submit = $(\"#submit\").val();\n      const radios = [];\n\n      $(\"input[name='radio0[radio]']\").each((_, el) => {\n        radios.push($(el).attr(\"value\"));\n      });\n\n      this.formData = this.prepareFormData(buildServer, buildServerId, token, submit, radios);\n\n      const uploadForm = new FormData();\n      this.appendTextToForm(uploadForm);\n\n      const postPage = await axios.post(this.effectPageUrl, uploadForm, {\n        headers: {\n          ...uploadForm.getHeaders(),\n          Accept: \"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8\",\n          Origin: new URL(this.effectPageUrl).origin,\n          Referer: this.effectPageUrl,\n          \"User-Agent\":\n            \"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36\",\n          Cookie: getPage.headers[\"set-cookie\"]?.join(\"; \") || \"\",\n        },\n      });\n\n      const formValue = this.extractGeneratedFormValue(postPage);\n      const createImage = await axios.post(\n        `${new URL(this.effectPageUrl).origin}/effect/create-image`,\n        JSON.parse(formValue),\n        {\n          headers: {\n            Accept: \"*/*\",\n            \"Content-Type\": \"application/x-www-form-urlencoded; charset=UTF-8\",\n            Origin: new URL(this.effectPageUrl).origin,\n            Referer: this.effectPageUrl,\n            \"User-Agent\":\n              \"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36\",\n            Cookie: getPage.headers[\"set-cookie\"]?.join(\"; \") || \"\",\n          },\n        }\n      );\n\n      return {\n        status: createImage.data?.success,\n        imageUrl: buildServer + (createImage.data?.fullsize_image || createImage.data?.image || \"\"),\n        sessionId: createImage.data?.session_id,\n        author: \"IMRAN AHMED\",\n        contact: \"www.facebook.com/Imran.Ahmed099\"\n      };\n    } catch (err) {\n      if (err instanceof Error && err.message.includes(\"Unexpected token\")) {\n        throw new Error(\"Please try using a URL that requires only one input field.\");\n      }\n      console.error(\"Error:\", err);\n      throw err;\n    }\n  }\n\n  prepareFormData(server, serverId, token, submit, radios) {\n    const form = {\n      submit: submit,\n      token: token,\n      build_server: server,\n      build_server_id: Number(serverId),\n    };\n    if (radios.length > 0) {\n      form[\"radio0[radio]\"] = radios[Math.floor(Math.random() * radios.length)];\n    }\n    return form;\n  }\n\n  appendTextToForm(form) {\n    for (const key in this.formData) {\n      form.append(key, this.formData[key]);\n    }\n    const texts = Array.isArray(this.inputText) ? this.inputText : [this.inputText];\n    texts.forEach(text => form.append(\"text[]\", text));\n  }\n\n  extractGeneratedFormValue(response) {\n    const $ = cheerio.load(response.data);\n    return (\n      $(\"#form_value\").first().text() ||\n      $(\"#form_value_input\").first().text() ||\n      $(\"#form_value\").first().val() ||\n      $(\"#form_value_input\").first().val()\n    );\n  }\n}\n\nmodule.exports = Photo360;\n"]}