{
  "schemaVersion": 1,
  "kind": "kittycord-studio",
  "language": "javascript",
  "metadata": {
    "id": "local.timestamp-studio",
    "name": "Timestamp Studio",
    "version": "1.0.0",
    "author": "Kittencord contributors"
  },
  "source": "globalThis.kittycordPlugin = /** @type {KittyPlugin} */ ({\n    start(api) {\n        let result = \"Use YYYY-MM-DDTHH:mm:ssZ or an explicit offset such as +03:00. Discord renders the result in each reader's timezone.\";\n        const show = () => api.publishPanel({title:\"Timestamp Studio\",text:result,actions:[{id:\"generate\",label:\"Generate timestamps\"},{id:\"now\",label:\"Use current time\"}],settings:[{id:\"date\",label:\"Date with timezone\",type:\"text\",default:\"2026-12-31T21:00:00Z\"}]});\n        api.onAction(id => {\n            try {\n                const input = String(api.settings.date ?? \"\");\n                if (id !== \"now\" && !/^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(Z|[+-]\\d{2}:\\d{2})$/.test(input)) throw new Error(\"Specify a date, seconds and timezone. Example: 2026-12-31T21:00:00+03:00.\");\n                const date = id === \"now\" ? new Date() : new Date(input);\n                if (!Number.isFinite(date.getTime())) throw new Error(\"Invalid date or timezone.\");\n                if (id !== \"now\") {\n                    const parts = input.slice(0, 19).split(/[-T:]/).map(Number);\n                    const calendar = new Date(0); calendar.setUTCFullYear(parts[0], parts[1] - 1, parts[2]); calendar.setUTCHours(parts[3], parts[4], parts[5], 0);\n                    if (calendar.getUTCFullYear() !== parts[0] || calendar.getUTCMonth() !== parts[1] - 1 || calendar.getUTCDate() !== parts[2] || parts[3] > 23 || parts[4] > 59 || parts[5] > 59) throw new Error(\"Invalid calendar date or time.\");\n                }\n                const seconds = Math.floor(date.getTime() / 1000);\n                result = \"UTC: \" + date.toISOString() + \"\\nUnix seconds: \" + seconds + \"\\n\" + ['t','T','d','D','f','F','R'].map(style => '<t:' + seconds + ':' + style + '>').join('\\n') + \"\\nCopy a tag into your message. Nothing is sent automatically.\";\n            } catch (error) { result = error instanceof Error ? error.message : \"Invalid date.\"; }\n            show();\n        }); show();\n    }\n});",
  "tokens": [],
  "tests": [],
  "api": "utility-v1"
}