{"version":3,"file":"tooldata.min.js","sources":["https:\/\/moodle.sonsbeekmedia.nl\/caie_39\/mod\/teachingtools\/amd\/src\/tooldata.js"],"sourcesContent":["\/\/ This file is part of Moodle - http:\/\/moodle.org\/\n\/\/\n\/\/ Moodle is free software: you can redistribute it and\/or modify\n\/\/ it under the terms of the GNU General Public License as published by\n\/\/ the Free Software Foundation, either version 3 of the License, or\n\/\/ (at your option) any later version.\n\/\/\n\/\/ Moodle is distributed in the hope that it will be useful,\n\/\/ but WITHOUT ANY WARRANTY; without even the implied warranty of\n\/\/ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\/\/ GNU General Public License for more details.\n\/\/\n\/\/ You should have received a copy of the GNU General Public License\n\/\/ along with Moodle. If not, see .\n\n\/**\n * Data management for the teaching tools.\n *\n * @module mod_teachingtools\/tooldata\n * @copyright 2023 Sonsbeekmedia\n * @author Bas Brands \n * @license http:\/\/www.gnu.org\/copyleft\/gpl.html GNU GPL v3 or later\n *\/\n\nimport Ajax from 'core\/ajax';\nimport Notification from 'core\/notification';\n\n\/**\n * Save data for the teaching tool.\n *\n * @param {int} cmid The course module id.\n * @param {string} app The app name.\n * @param {string} storage The storage type.\n * @param {string} data The data to save.\n *\n * @return {Promise} Resolved with the data.\n *\/\nconst storeData = (cmid, app, storage, data) => {\n\n \/\/ Store the label in the database\n var args = {\n 'cmid': cmid,\n 'app': app,\n 'storage': storage,\n 'data': data\n };\n\n const request = {\n methodname: 'mod_teachingtools_storedata',\n args: args\n };\n\n let promise = Ajax.call([request])[0]\n .fail(Notification.exception);\n\n return promise;\n};\n\n\/**\n * Get the data for the teaching tool.\n * @param {*} cmid The course module id.\n * @param {*} app The app name.\n * @param {*} storage The storage type.\n * @returns {Promise} Resolved with the data.\n *\/\nconst getData = async(cmid, app, storage) => {\n var args = {\n 'cmid': cmid,\n 'app': app,\n 'storage': storage\n };\n\n const request = {\n methodname: 'mod_teachingtools_getdata',\n args: args\n };\n\n let promise = Ajax.call([request])[0]\n .fail(Notification.exception);\n\n return promise;\n};\n\n\/**\n * Get the remote feed data for the teaching tool.\n * @param {*} cmid The course module id.\n * @returns {Promise} Resolved with the data.\n *\/\nconst getFeed = async(cmid) => {\n var args = {\n 'cmid': cmid,\n };\n\n const request = {\n methodname: 'mod_teachingtools_getfeed',\n args: args\n };\n\n let promise = Ajax.call([request])[0]\n .fail(Notification.exception);\n\n return promise;\n};\n\n\/**\n * Get a reponse from openAi.\n * @param {*} cmid The course module id.\n * @param {*} prompt The prompt.\n * @returns {Promise} Resolved with the data.\n *\/\nconst openAiRequest = async(cmid, prompt) => {\n\n var args = {\n 'prompt': prompt,\n 'cmid': cmid\n };\n\n const request = {\n methodname: 'mod_teachingtools_openairequest',\n args: args\n };\n\n let promise = Ajax.call([request])[0]\n .fail(Notification.exception);\n\n return promise;\n};\n\n\nexport default {\n storeData: storeData,\n getData: getData,\n getFeed: getFeed,\n openAiRequest: openAiRequest\n};\n"],"names":["storeData","cmid","app","storage","data","request","methodname","args","Ajax","call","fail","Notification","exception","getData","async","getFeed","openAiRequest","prompt"],"mappings":";;;;;;;;0LAiIe,CACXA,UA7Fc,CAACC,KAAMC,IAAKC,QAASC,cAU7BC,QAAU,CACZC,WAAY,8BACZC,KATO,MACCN,SACDC,YACIC,aACHC,cAQEI,cAAKC,KAAK,CAACJ,UAAU,GAC9BK,KAAKC,sBAAaC,YA8EvBC,QAlEYC,MAAMb,KAAMC,IAAKC,iBAOvBE,QAAU,CACZC,WAAY,4BACZC,KARO,MACCN,SACDC,YACIC,iBAQDK,cAAKC,KAAK,CAACJ,UAAU,GAC9BK,KAAKC,sBAAaC,YAsDvBG,QA5CYD,MAAAA,aAKNT,QAAU,CACZC,WAAY,4BACZC,KANO,MACCN,cAQEO,cAAKC,KAAK,CAACJ,UAAU,GAC9BK,KAAKC,sBAAaC,YAkCvBI,cAvBkBF,MAAMb,KAAMgB,gBAOxBZ,QAAU,CACZC,WAAY,kCACZC,KAPO,QACGU,YACFhB,cAQEO,cAAKC,KAAK,CAACJ,UAAU,GAC9BK,KAAKC,sBAAaC"}