@kudoai/chatgpt.js 2.6.4 → 2.6.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (178) hide show
  1. package/README.md +341 -0
  2. package/chatgpt.js +22 -22
  3. package/dist/chatgpt.min.js +7 -0
  4. package/docs/README.md +341 -324
  5. package/docs/USERGUIDE.md +1812 -1814
  6. package/docs/de/README.md +341 -324
  7. package/docs/es/README.md +341 -324
  8. package/docs/fr/README.md +341 -324
  9. package/docs/hi/README.md +342 -325
  10. package/docs/it/README.md +341 -324
  11. package/docs/ja/README.md +341 -324
  12. package/docs/ko/README.md +346 -329
  13. package/docs/ne/README.md +342 -325
  14. package/docs/nl/README.md +341 -324
  15. package/docs/pt/README.md +341 -324
  16. package/docs/vi/README.md +341 -324
  17. package/docs/zh-cn/README.md +341 -324
  18. package/docs/zh-tw/README.md +340 -323
  19. package/package.json +51 -31
  20. package/starters/chrome/LICENSE.md +43 -0
  21. package/starters/chrome/docs/README.md +17 -1
  22. package/starters/chrome/docs/SECURITY.md +17 -0
  23. package/starters/chrome/docs/de/LICENSE.md +21 -3
  24. package/starters/chrome/docs/de/README.md +17 -1
  25. package/starters/chrome/docs/es/LICENSE.md +21 -3
  26. package/starters/chrome/docs/es/README.md +17 -1
  27. package/starters/chrome/docs/fr/LICENSE.md +21 -3
  28. package/starters/chrome/docs/fr/README.md +17 -1
  29. package/starters/chrome/docs/hi/LICENSE.md +21 -3
  30. package/starters/chrome/docs/hi/README.md +17 -2
  31. package/starters/chrome/docs/hi/SECURITY.md +17 -0
  32. package/starters/chrome/docs/it/LICENSE.md +21 -3
  33. package/starters/chrome/docs/it/README.md +17 -1
  34. package/starters/chrome/docs/ja/LICENSE.md +21 -3
  35. package/starters/chrome/docs/ja/README.md +17 -2
  36. package/starters/chrome/docs/ko/LICENSE.md +21 -3
  37. package/starters/chrome/docs/ko/README.md +17 -1
  38. package/starters/chrome/docs/nl/LICENSE.md +20 -3
  39. package/starters/chrome/docs/nl/README.md +17 -1
  40. package/starters/chrome/docs/pt/LICENSE.md +21 -3
  41. package/starters/chrome/docs/pt/README.md +17 -1
  42. package/starters/chrome/docs/vi/LICENSE.md +21 -3
  43. package/starters/chrome/docs/vi/README.md +17 -1
  44. package/starters/chrome/docs/zh-cn/LICENSE.md +21 -3
  45. package/starters/chrome/docs/zh-cn/README.md +17 -2
  46. package/starters/chrome/docs/zh-cn/SECURITY.md +17 -0
  47. package/starters/chrome/docs/zh-tw/LICENSE.md +21 -3
  48. package/starters/chrome/docs/zh-tw/README.md +17 -1
  49. package/starters/chrome/extension/content.js +1 -1
  50. package/starters/chrome/extension/lib/chatgpt.js +6 -4
  51. package/starters/chrome/extension/manifest.json +1 -1
  52. package/starters/greasemonkey/LICENSE.md +43 -0
  53. package/starters/greasemonkey/chatgpt.js-greasemonkey-starter.user.js +52 -52
  54. package/starters/greasemonkey/docs/SECURITY.md +17 -0
  55. package/starters/greasemonkey/docs/de/LICENSE.md +31 -0
  56. package/starters/greasemonkey/docs/es/LICENSE.md +31 -0
  57. package/starters/greasemonkey/docs/fr/LICENSE.md +31 -0
  58. package/starters/greasemonkey/docs/hi/LICENSE.md +31 -0
  59. package/starters/greasemonkey/docs/hi/SECURITY.md +17 -0
  60. package/starters/greasemonkey/docs/it/LICENSE.md +29 -0
  61. package/starters/greasemonkey/docs/ja/LICENSE.md +31 -0
  62. package/starters/greasemonkey/docs/ko/LICENSE.md +34 -0
  63. package/starters/greasemonkey/docs/nl/LICENSE.md +30 -0
  64. package/starters/greasemonkey/docs/pt/LICENSE.md +31 -0
  65. package/starters/greasemonkey/docs/vi/LICENSE.md +31 -0
  66. package/starters/greasemonkey/docs/zh-cn/LICENSE.md +31 -0
  67. package/starters/greasemonkey/docs/zh-cn/SECURITY.md +17 -0
  68. package/starters/greasemonkey/docs/zh-tw/LICENSE.md +31 -0
  69. package/dist/chatgpt-2.6.4.min.js +0 -1
  70. package/docs/.nojekyll +0 -0
  71. package/docs/CNAME +0 -1
  72. package/docs/_coverpage.md +0 -16
  73. package/docs/_utils/LICENSE.md +0 -21
  74. package/docs/_utils/minify.js +0 -50
  75. package/docs/assets/docsify/cursors/futuristic/pointer.cur +0 -0
  76. package/docs/assets/docsify/favicons/favicon16.png +0 -0
  77. package/docs/assets/docsify/favicons/favicon320.png +0 -0
  78. package/docs/assets/docsify/favicons/favicon48.png +0 -0
  79. package/docs/assets/docsify/favicons/favicon64.png +0 -0
  80. package/docs/assets/docsify/fonts/eurostile-extended-black/EurostileExtendedBlack.otf +0 -0
  81. package/docs/assets/docsify/fonts/eurostile-extended-black/EurostileExtendedBlack.ttf +0 -0
  82. package/docs/assets/docsify/fonts/eurostile-extended-black/EurostileExtendedBlack.woff +0 -0
  83. package/docs/assets/docsify/fonts/eurostile-extended-black/EurostileExtendedBlack.woff2 +0 -0
  84. package/docs/assets/docsify/fonts/ibm-plex-mono/OFL.txt +0 -93
  85. package/docs/assets/docsify/fonts/ibm-plex-mono/otf/IBMPlexMono-Bold.otf +0 -0
  86. package/docs/assets/docsify/fonts/ibm-plex-mono/otf/IBMPlexMono-BoldItalic.otf +0 -0
  87. package/docs/assets/docsify/fonts/ibm-plex-mono/otf/IBMPlexMono-ExtraLight.otf +0 -0
  88. package/docs/assets/docsify/fonts/ibm-plex-mono/otf/IBMPlexMono-ExtraLightItalic.otf +0 -0
  89. package/docs/assets/docsify/fonts/ibm-plex-mono/otf/IBMPlexMono-Italic.otf +0 -0
  90. package/docs/assets/docsify/fonts/ibm-plex-mono/otf/IBMPlexMono-Light.otf +0 -0
  91. package/docs/assets/docsify/fonts/ibm-plex-mono/otf/IBMPlexMono-LightItalic.otf +0 -0
  92. package/docs/assets/docsify/fonts/ibm-plex-mono/otf/IBMPlexMono-Medium.otf +0 -0
  93. package/docs/assets/docsify/fonts/ibm-plex-mono/otf/IBMPlexMono-MediumItalic.otf +0 -0
  94. package/docs/assets/docsify/fonts/ibm-plex-mono/otf/IBMPlexMono-Regular.otf +0 -0
  95. package/docs/assets/docsify/fonts/ibm-plex-mono/otf/IBMPlexMono-SemiBold.otf +0 -0
  96. package/docs/assets/docsify/fonts/ibm-plex-mono/otf/IBMPlexMono-SemiBoldItalic.otf +0 -0
  97. package/docs/assets/docsify/fonts/ibm-plex-mono/otf/IBMPlexMono-Thin.otf +0 -0
  98. package/docs/assets/docsify/fonts/ibm-plex-mono/otf/IBMPlexMono-ThinItalic.otf +0 -0
  99. package/docs/assets/docsify/fonts/ibm-plex-mono/ttf/IBMPlexMono-Bold.ttf +0 -0
  100. package/docs/assets/docsify/fonts/ibm-plex-mono/ttf/IBMPlexMono-BoldItalic.ttf +0 -0
  101. package/docs/assets/docsify/fonts/ibm-plex-mono/ttf/IBMPlexMono-ExtraLight.ttf +0 -0
  102. package/docs/assets/docsify/fonts/ibm-plex-mono/ttf/IBMPlexMono-ExtraLightItalic.ttf +0 -0
  103. package/docs/assets/docsify/fonts/ibm-plex-mono/ttf/IBMPlexMono-Italic.ttf +0 -0
  104. package/docs/assets/docsify/fonts/ibm-plex-mono/ttf/IBMPlexMono-Light.ttf +0 -0
  105. package/docs/assets/docsify/fonts/ibm-plex-mono/ttf/IBMPlexMono-LightItalic.ttf +0 -0
  106. package/docs/assets/docsify/fonts/ibm-plex-mono/ttf/IBMPlexMono-Medium.ttf +0 -0
  107. package/docs/assets/docsify/fonts/ibm-plex-mono/ttf/IBMPlexMono-MediumItalic.ttf +0 -0
  108. package/docs/assets/docsify/fonts/ibm-plex-mono/ttf/IBMPlexMono-Regular.ttf +0 -0
  109. package/docs/assets/docsify/fonts/ibm-plex-mono/ttf/IBMPlexMono-SemiBold.ttf +0 -0
  110. package/docs/assets/docsify/fonts/ibm-plex-mono/ttf/IBMPlexMono-SemiBoldItalic.ttf +0 -0
  111. package/docs/assets/docsify/fonts/ibm-plex-mono/ttf/IBMPlexMono-Thin.ttf +0 -0
  112. package/docs/assets/docsify/fonts/ibm-plex-mono/ttf/IBMPlexMono-ThinItalic.ttf +0 -0
  113. package/docs/assets/docsify/fonts/ibm-plex-mono/woff/IBMPlexMono-Bold.woff +0 -0
  114. package/docs/assets/docsify/fonts/ibm-plex-mono/woff/IBMPlexMono-BoldItalic.woff +0 -0
  115. package/docs/assets/docsify/fonts/ibm-plex-mono/woff/IBMPlexMono-ExtraLight.woff +0 -0
  116. package/docs/assets/docsify/fonts/ibm-plex-mono/woff/IBMPlexMono-ExtraLightItalic.woff +0 -0
  117. package/docs/assets/docsify/fonts/ibm-plex-mono/woff/IBMPlexMono-Italic.woff +0 -0
  118. package/docs/assets/docsify/fonts/ibm-plex-mono/woff/IBMPlexMono-Light.woff +0 -0
  119. package/docs/assets/docsify/fonts/ibm-plex-mono/woff/IBMPlexMono-LightItalic.woff +0 -0
  120. package/docs/assets/docsify/fonts/ibm-plex-mono/woff/IBMPlexMono-Medium.woff +0 -0
  121. package/docs/assets/docsify/fonts/ibm-plex-mono/woff/IBMPlexMono-MediumItalic.woff +0 -0
  122. package/docs/assets/docsify/fonts/ibm-plex-mono/woff/IBMPlexMono-Regular.woff +0 -0
  123. package/docs/assets/docsify/fonts/ibm-plex-mono/woff/IBMPlexMono-SemiBold.woff +0 -0
  124. package/docs/assets/docsify/fonts/ibm-plex-mono/woff/IBMPlexMono-SemiBoldItalic.woff +0 -0
  125. package/docs/assets/docsify/fonts/ibm-plex-mono/woff/IBMPlexMono-Thin.woff +0 -0
  126. package/docs/assets/docsify/fonts/ibm-plex-mono/woff/IBMPlexMono-ThinItalic.woff +0 -0
  127. package/docs/assets/docsify/fonts/ibm-plex-mono/woff2/IBMPlexMono-Bold.woff2 +0 -0
  128. package/docs/assets/docsify/fonts/ibm-plex-mono/woff2/IBMPlexMono-BoldItalic.woff2 +0 -0
  129. package/docs/assets/docsify/fonts/ibm-plex-mono/woff2/IBMPlexMono-ExtraLight.woff2 +0 -0
  130. package/docs/assets/docsify/fonts/ibm-plex-mono/woff2/IBMPlexMono-ExtraLightItalic.woff2 +0 -0
  131. package/docs/assets/docsify/fonts/ibm-plex-mono/woff2/IBMPlexMono-Italic.woff2 +0 -0
  132. package/docs/assets/docsify/fonts/ibm-plex-mono/woff2/IBMPlexMono-Light.woff2 +0 -0
  133. package/docs/assets/docsify/fonts/ibm-plex-mono/woff2/IBMPlexMono-LightItatlic.woff2 +0 -0
  134. package/docs/assets/docsify/fonts/ibm-plex-mono/woff2/IBMPlexMono-Medium.woff2 +0 -0
  135. package/docs/assets/docsify/fonts/ibm-plex-mono/woff2/IBMPlexMono-MediumItalic.woff2 +0 -0
  136. package/docs/assets/docsify/fonts/ibm-plex-mono/woff2/IBMPlexMono-Regular.woff2 +0 -0
  137. package/docs/assets/docsify/fonts/ibm-plex-mono/woff2/IBMPlexMono-SemiBold.woff2 +0 -0
  138. package/docs/assets/docsify/fonts/ibm-plex-mono/woff2/IBMPlexMono-SemiBoldItalic.woff2 +0 -0
  139. package/docs/assets/docsify/fonts/ibm-plex-mono/woff2/IBMPlexMono-Thin.woff2 +0 -0
  140. package/docs/assets/docsify/fonts/ibm-plex-mono/woff2/IBMPlexMono-ThinItalic.woff2 +0 -0
  141. package/docs/assets/docsify/fonts/major-mono-display/MajorMonoDisplay-Regular.otf +0 -0
  142. package/docs/assets/docsify/fonts/major-mono-display/MajorMonoDisplay-Regular.ttf +0 -0
  143. package/docs/assets/docsify/fonts/major-mono-display/MajorMonoDisplay-Regular.woff +0 -0
  144. package/docs/assets/docsify/fonts/major-mono-display/MajorMonoDisplay-Regular.woff2 +0 -0
  145. package/docs/assets/docsify/fonts/major-mono-display/OFL.txt +0 -93
  146. package/docs/assets/docsify/fonts/polysans-neutral/PolySansNeutral.eot +0 -0
  147. package/docs/assets/docsify/fonts/polysans-neutral/PolySansNeutral.ttf +0 -0
  148. package/docs/assets/docsify/fonts/polysans-neutral/PolySansNeutral.woff +0 -0
  149. package/docs/assets/docsify/fonts/polysans-neutral/PolySansNeutral.woff2 +0 -0
  150. package/docs/assets/docsify/html/footer.html +0 -23
  151. package/docs/assets/docsify/js/min/back-to-top-button.min.js +0 -1
  152. package/docs/assets/docsify/js/min/copy-code-button.min.js +0 -1
  153. package/docs/assets/docsify/js/min/onload-hacks.min.js +0 -3
  154. package/docs/assets/docsify/js/min/starry-background.min.js +0 -1
  155. package/docs/assets/docsify/js/src/back-to-top-button.js +0 -64
  156. package/docs/assets/docsify/js/src/copy-code-button.js +0 -91
  157. package/docs/assets/docsify/js/src/onload-hacks.js +0 -613
  158. package/docs/assets/docsify/js/src/starry-background.js +0 -111
  159. package/docs/assets/docsify/styles/css/style.min.css +0 -1
  160. package/docs/assets/docsify/styles/css/style.min.css.map +0 -1
  161. package/docs/assets/docsify/styles/scss/style.scss +0 -510
  162. package/docs/assets/separators/aqua.png +0 -0
  163. package/docs/de/_coverpage.md +0 -12
  164. package/docs/es/_coverpage.md +0 -12
  165. package/docs/fr/_coverpage.md +0 -12
  166. package/docs/hi/_coverpage.md +0 -12
  167. package/docs/index.html +0 -91
  168. package/docs/it/_coverpage.md +0 -12
  169. package/docs/ja/_coverpage.md +0 -12
  170. package/docs/ko/_coverpage.md +0 -12
  171. package/docs/ne/_coverpage.md +0 -12
  172. package/docs/nl/_coverpage.md +0 -12
  173. package/docs/pt/_coverpage.md +0 -12
  174. package/docs/vi/_coverpage.md +0 -12
  175. package/docs/zh-cn/_coverpage.md +0 -12
  176. package/docs/zh-tw/_coverpage.md +0 -12
  177. package/starters/chrome/LICENSE +0 -21
  178. package/starters/greasemonkey/LICENSE +0 -21
@@ -1 +0,0 @@
1
- const functionAliases=[["actAs","actas","act","become","persona","premadePrompt","preMadePrompt","prePrompt","preprompt","roleplay","rolePlay","rp"],["activateAutoRefresh","activateAutoRefresher","activateRefresher","activateSessionRefresher","autoRefresh","autoRefresher","autoRefreshSession","refresher","sessionRefresher"],["deactivateAutoRefresh","deactivateAutoRefresher","deactivateRefresher","deactivateSessionRefresher"],["detectLanguage","getLanguage"],["executeCode","codeExecute"],["exportChat","chatExport","export"],["getLastPrompt","getLastQuery","getMyLastMsg","getMyLastQuery"],["getTextarea","getTextArea","getChatbox","getChatBox"],["isFullScreen","isFullscreen"],["logOut","logout","logOff","logoff","signOut","signout","signOff","signoff"],["minify","codeMinify","minifyCode"],["new","newChat","startNewChat"],["obfuscate","codeObfuscate","obfuscateCode"],["printAllFunctions","showAllFunctions"],["refactor","codeRefactor","refactorCode"],["refreshReply","regenerate","regenerateReply"],["refreshSession","sessionRefresh"],["renderHTML","renderHtml","renderLinks","renderTags"],["reviewCode","codeReview"],["send","sendChat","sendMsg"],["sendInNewChat","sendNewChat"],["sentiment","analyzeSentiment","sentimentAnalysis"],["stop","stopGenerating"],["suggest","suggestion","recommend"],["toggleAutoRefresh","toggleAutoRefresher","toggleRefresher","toggleSessionRefresher"],["toggleScheme","toggleMode"],["translate","translation","translator"],["unminify","unminifyCode","codeUnminify"],["writeCode","codeWrite"]];const synonyms=[["account","acct"],["activate","turnOn"],["analyze","check","evaluate","review"],["ask","send","submit"],["chat","conversation","convo"],["data","details"],["deactivate","deActivate","turnOff"],["execute","interpret","interpreter","run"],["generating","generation"],["minify","uglify"],["refactor","rewrite"],["regenerate","regen"],["render","parse"],["reply","response"],["sentiment","attitude","emotion","feeling","opinion","perception"],["speak","say","speech","talk","tts"],["summarize","tldr"],["unminify","beautify","prettify","prettyPrint"]];const endpoints={assets:"https://raw.githubusercontent.com/KudoAI/chatgpt.js/main",openAI:{session:"https://chat.openai.com/api/auth/session",chats:"https://chat.openai.com/backend-api/conversations",chat:"https://chat.openai.com/backend-api/conversation",share_create:"https://chat.openai.com/backend-api/share/create",share:"https://chat.openai.com/backend-api/share",instructions:"https://chat.openai.com/backend-api/user_system_messages"}};localStorage.alertQueue=JSON.stringify([]);localStorage.notifyProps=JSON.stringify({queue:{topRight:[],bottomRight:[],bottomLeft:[],topLeft:[]},lastNthAudio:0});const isChromeUserScript=navigator.userAgent.includes("Chrome")&&typeof unsafeWindow!="undefined",isFFuserScript=navigator.userAgent.includes("Firefox")&&typeof unsafeWindow!="undefined",isFFtmScript=isFFuserScript&&GM_info.scriptHandler=="Tampermonkey";let cjsMessages;if(!isChromeUserScript&&!(isFFuserScript&&!isFFtmScript)){(async()=>{const cjsMsgsLoaded=new Promise(resolve=>{const userLanguage=navigator.languages[0]||navigator.language||navigator.browserLanguage||navigator.systemLanguage||navigator.userLanguage||"",msgHostDir=endpoints.assets+"/data/_locales/",msgLocaleDir=(userLanguage?userLanguage.replace("-","_"):"en")+"/";let msgHref=msgHostDir+msgLocaleDir+"messages.json",msgXHRtries=0;(function loadMsgs(){const xhr=new XMLHttpRequest;xhr.open("GET",msgHref);xhr.send();xhr.onload=()=>{try{const messages=new Proxy(JSON.parse(xhr.responseText),{get(target,prop){if(typeof target[prop]=="object"&&target[prop]!==null&&"message"in target[prop]){return target[prop].message}}});resolve(messages)}catch(err){msgXHRtries++;if(msgXHRtries===3)resolve({});msgHref=userLanguage.includes("-")&&msgXHRtries===1?msgHref.replace(/(.*)_.*(\/.*)/,"$1$2"):msgHostDir+"en/messages.json";loadMsgs()}};xhr.onerror=()=>{resolve({})}})()});cjsMessages=await cjsMsgsLoaded})()}const chatgpt={openAIaccessToken:{},actAs:function(persona){const promptsUrl="https://raw.githubusercontent.com/KudoAI/chat-prompts/main/dist/personas.min.json";return new Promise((resolve,reject)=>{const xhr=new XMLHttpRequest;xhr.open("GET",promptsUrl,true);xhr.send();xhr.onload=()=>{if(xhr.status!==200)return reject("🤖 chatgpt.js >> Request failed. Cannot retrieve prompts data.");const data=JSON.parse(xhr.responseText).personas;if(!persona){console.log("\n%c🤖 chatgpt.js personas\n","font-family: sans-serif ; font-size: xxx-large ; font-weight: bold");for(const prompt of data)console.log(`%c${prompt.title}`,"font-family: monospace ; font-size: larger ;");return resolve()}const selectedPrompt=data.find(obj=>obj.title.toLowerCase()==persona.toLowerCase());if(!selectedPrompt)return reject(`🤖 chatgpt.js >> Persona '${persona}' was not found!`);chatgpt.send(selectedPrompt.prompt,"click");console.info(`Loading ${persona} persona...`);chatgpt.isIdle().then(()=>{console.info("Persona activated!")});return resolve()}})},activateDarkMode:function(){document.documentElement.classList.replace("light","dark");document.documentElement.style.colorScheme="dark";localStorage.setItem("theme","dark")},activateLightMode:function(){document.documentElement.classList.replace("dark","light");document.documentElement.style.colorScheme="light";localStorage.setItem("theme","light")},alert:function(title,msg,btns,checkbox,width){const scheme=chatgpt.isDarkMode()?"dark":"light",isMobile=chatgpt.browser.isMobile();const modalContainer=document.createElement("div");modalContainer.id=Math.floor(chatgpt.randomFloat()*1e6)+Date.now();modalContainer.classList.add("chatgpt-modal");const modal=document.createElement("div"),modalTitle=document.createElement("h2"),modalMessage=document.createElement("p");const thisUpdated=20231203;let modalStyle=document.querySelector("#chatgpt-modal-style");if(!modalStyle||parseInt(modalStyle.getAttribute("last-updated"),10)<thisUpdated){if(!modalStyle){modalStyle=document.createElement("style");modalStyle.id="chatgpt-modal-style";modalStyle.setAttribute("last-updated",thisUpdated.toString());document.head.append(modalStyle)}modalStyle.innerText=".chatgpt-modal {"+"position: fixed ; top: 0 ; left: 0 ; width: 100% ; height: 100% ;"+"background-color: rgba(67, 70, 72, 0) ;"+"transition: background-color 0.05s ease ;"+"display: flex ; justify-content: center ; align-items: center ; z-index: 9999 }"+".chatgpt-modal > div {"+"opacity: 0 ; transform: translateX(-2px) translateY(5px) ; max-width: 75vw ; word-wrap: break-word ;"+"transition: opacity 0.1s cubic-bezier(.165,.84,.44,1), transform 0.2s cubic-bezier(.165,.84,.44,1) ;"+`background-color: ${scheme=="dark"?"black":"white"} ;`+(scheme!="dark"?"border: 1px solid rgba(0, 0, 0, 0.3) ;":"")+"padding: 20px ; margin: 12px 23px ; border-radius: 15px ; box-shadow: 0 30px 60px rgba(0, 0, 0, .12) ;"+" -webkit-user-select: none ; -moz-user-select: none ; -ms-user-select: none ; user-select: none ; }"+".chatgpt-modal h2 { margin-bottom: 9px }"+`.chatgpt-modal a { color: ${scheme=="dark"?"#00cfff":"#1e9ebb"}}`+".chatgpt-modal.animated > div { opacity: 1 ; transform: translateX(0) translateY(0) }"+"@keyframes alert-zoom-fade-out { 0% { opacity: 1 ; transform: scale(1) }"+"50% { opacity: 0.25 ; transform: scale(1.05) }"+"100% { opacity: 0 ; transform: scale(1.35) }}"+".modal-buttons { display: flex ; justify-content: flex-end ; margin: 20px -5px -3px 0 ;"+(isMobile?"flex-direction: column-reverse":"")+"}"+".chatgpt-modal button {"+`margin-left: ${isMobile?0:10}px ; padding: ${isMobile?15:4}px 18px ; border-radius: 15px ;`+(isMobile?"margin-top: 5px ; margin-bottom: 3px ;":"")+`border: 1px solid ${scheme=="dark"?"white":"black"}}`+".primary-modal-btn {"+`border: 1px solid ${scheme=="dark"?"white":"black"} ;`+`background: ${scheme=="dark"?"white":"black"} ;`+`color: ${scheme=="dark"?"black":"white"}}`+".chatgpt-modal button:hover { color: #3d5d71 ; border-color: #6d9cb9 ;"+"background-color: "+(scheme=="dark"?"#00cfff":"#9cdaff")+";"+"box-shadow: 2px 1px "+(scheme=="dark"?"54px #00cfff":"30px #9cdaff")+"}"+".modal-close-btn {"+"cursor: pointer ; width: 20px ; height: 20px ; float: right ; position: relative ; right: -2px }"+".modal-close-btn svg { margin: 5px 5px }"+`.modal-close-btn:hover { background-color: #f2f2f2${scheme=="dark"?"00":""}}`+".chatgpt-modal .checkbox-group { display: flex ; margin-top: -18px }"+".chatgpt-modal .checkbox-group label {"+"font-size: .7rem ; margin: -.04rem 0 0px .3rem ;"+`color: ${scheme=="dark"?"#e1e1e1":"#1e1e1e"}}`+'.chatgpt-modal input[type="checkbox"] { transform: scale(0.7) ;'+`border: 1px solid ${scheme=="dark"?"white":"black"}}`+'.chatgpt-modal input[type="checkbox"]:checked {'+`border: 1px solid ${scheme=="dark"?"white":"black"} ;`+"background-color: black ; position: inherit }"+'.chatgpt-modal input[type="checkbox"]:focus { outline: none ; box-shadow: none }'}modalTitle.innerText=title||"";modalMessage.innerText=msg||"";this.renderHTML(modalMessage);const modalButtons=document.createElement("div");modalButtons.classList.add("modal-buttons");if(btns){if(!Array.isArray(btns))btns=[btns];btns.forEach(buttonFn=>{const button=document.createElement("button");button.textContent=buttonFn.name.replace(/[_-]\w/g,match=>match.slice(1).toUpperCase()).replace(/([A-Z])/g," $1").replace(/^\w/,firstChar=>firstChar.toUpperCase());button.addEventListener("click",()=>{dismissAlert();buttonFn()});modalButtons.insertBefore(button,modalButtons.firstChild)})}const dismissBtn=document.createElement("button");dismissBtn.textContent=btns?"Dismiss":"OK";modalButtons.insertBefore(dismissBtn,modalButtons.firstChild);modalButtons.lastChild.classList.add("primary-modal-btn");const checkboxDiv=document.createElement("div");if(checkbox){checkboxDiv.classList.add("checkbox-group");const checkboxFn=checkbox,checkboxInput=document.createElement("input");checkboxInput.type="checkbox";checkboxInput.addEventListener("change",checkboxFn);const checkboxLabel=document.createElement("label");checkboxLabel.addEventListener("click",()=>{checkboxInput.checked=!checkboxInput.checked;checkboxFn()});checkboxLabel.textContent=checkboxFn.name.charAt(0).toUpperCase()+checkboxFn.name.slice(1).replace(/([A-Z])/g,(match,letter)=>" "+letter.toLowerCase()).replace(/\b(\w+)nt\b/gi,"$1n't").trim();checkboxDiv.append(checkboxInput);checkboxDiv.append(checkboxLabel)}const closeBtn=document.createElement("div");closeBtn.title=cjsMessages?.tooltip_close||"Close";closeBtn.classList.add("modal-close-btn");const closeSVG=document.createElementNS("http://www.w3.org/2000/svg","svg");closeSVG.setAttribute("height","10px");closeSVG.setAttribute("viewBox","0 0 14 14");closeSVG.setAttribute("fill","none");const closeSVGpath=document.createElementNS("http://www.w3.org/2000/svg","path");closeSVGpath.setAttribute("fill-rule","evenodd");closeSVGpath.setAttribute("clip-rule","evenodd");closeSVGpath.setAttribute("fill",chatgpt.isDarkMode()?"white":"black");closeSVGpath.setAttribute("d","M13.7071 1.70711C14.0976 1.31658 14.0976 0.683417 13.7071 0.292893C13.3166 -0.0976312 12.6834 -0.0976312 12.2929 0.292893L7 5.58579L1.70711 0.292893C1.31658 -0.0976312 0.683417 -0.0976312 0.292893 0.292893C-0.0976312 0.683417 -0.0976312 1.31658 0.292893 1.70711L5.58579 7L0.292893 12.2929C-0.0976312 12.6834 -0.0976312 13.3166 0.292893 13.7071C0.683417 14.0976 1.31658 14.0976 1.70711 13.7071L7 8.41421L12.2929 13.7071C12.6834 14.0976 13.3166 14.0976 13.7071 13.7071C14.0976 13.3166 14.0976 12.6834 13.7071 12.2929L8.41421 7L13.7071 1.70711Z");closeSVG.append(closeSVGpath);closeBtn.append(closeSVG);const modalElems=[closeBtn,modalTitle,modalMessage,modalButtons,checkboxDiv];modalElems.forEach(elem=>{modal.append(elem)});modal.style.width=`${width||458}px`;modalContainer.append(modal);document.body.append(modalContainer);let alertQueue=JSON.parse(localStorage.alertQueue);alertQueue.push(modalContainer.id);localStorage.alertQueue=JSON.stringify(alertQueue);modalContainer.style.display="none";if(alertQueue.length===1){modalContainer.style.display="";setTimeout(()=>{modalContainer.style.backgroundColor=`rgba(67, 70, 72, ${scheme==="dark"?.62:0})`;modalContainer.classList.add("animated")},100)}const clickHandler=event=>{if(event.target==event.currentTarget||event.target instanceof SVGPathElement)dismissAlert()};const keyHandler=event=>{const dismissKeys=[13,27];if(dismissKeys.includes(event.keyCode)){for(const alertId of alertQueue){const alert=document.getElementById(alertId);if(alert&&alert.style.display!=="none"){if(event.keyCode===27)dismissAlert();else if(event.keyCode===13){const mainButton=alert.querySelector(".modal-buttons").lastChild;if(mainButton){mainButton.click();event.preventDefault()}}return}}}};const dismissElems=[modalContainer,closeBtn,closeSVG,dismissBtn];dismissElems.forEach(elem=>{elem.addEventListener("click",clickHandler)});document.addEventListener("keydown",keyHandler);const dismissAlert=()=>{modalContainer.style.backgroundColor="transparent";modal.style.animation="alert-zoom-fade-out 0.075s ease-out";setTimeout(()=>{modalContainer.remove();alertQueue=JSON.parse(localStorage.alertQueue);alertQueue.shift();localStorage.alertQueue=JSON.stringify(alertQueue);dismissElems.forEach(elem=>{elem.removeEventListener("click",clickHandler)});document.removeEventListener("keydown",keyHandler);if(alertQueue.length>0){const nextAlert=document.getElementById(alertQueue[0]);setTimeout(()=>{nextAlert.style.display="";setTimeout(()=>{nextAlert.classList.add("animated")},100)},500)}},50)};return modalContainer.id},askAndGetReply:async function(query){chatgpt.send(query);await chatgpt.isIdle();return chatgpt.getChatData("active","msg","chatgpt","latest")},autoRefresh:{activate:function(interval){if(this.isActive){console.log("↻ ChatGPT >> ["+chatgpt.autoRefresh.nowTimeStamp()+"] Auto refresh already active!");return}const autoRefresh=this;this.toggle.refreshFrame();const scheduleRefreshes=interval=>{const randomDelay=Math.max(2,Math.floor(chatgpt.randomFloat()*21-10));autoRefresh.isActive=setTimeout(()=>{const manifestScript=document.querySelector('script[src*="_ssgManifest.js"]');document.querySelector("#refresh-frame").src=manifestScript.src+"?"+Date.now();console.log("↻ ChatGPT >> ["+autoRefresh.nowTimeStamp()+"] ChatGPT session refreshed");scheduleRefreshes(interval)},(interval+randomDelay)*1e3)};scheduleRefreshes(interval?parseInt(interval,10):30);console.log("↻ ChatGPT >> ["+chatgpt.autoRefresh.nowTimeStamp()+"] Auto refresh activated");if(navigator.userAgent.includes("Chrome")&&typeof document.hidden!=="undefined"){document.addEventListener("visibilitychange",this.toggle.beacons)}},deactivate:function(){if(this.isActive){this.toggle.refreshFrame();document.removeEventListener("visibilitychange",this.toggle.beacons);clearTimeout(this.isActive);this.isActive=null;console.log("↻ ChatGPT >> ["+chatgpt.autoRefresh.nowTimeStamp()+"] Auto refresh de-activated")}else{console.log("↻ ChatGPT >> ["+chatgpt.autoRefresh.nowTimeStamp()+"] Auto refresh already inactive!")}},nowTimeStamp:function(){const now=new Date;const hours=now.getHours()%12||12;let minutes=now.getMinutes(),seconds=now.getSeconds();if(minutes<10)minutes="0"+minutes;if(seconds<10)seconds="0"+seconds;const meridiem=now.getHours()<12?"AM":"PM";return hours+":"+minutes+":"+seconds+" "+meridiem},toggle:{beacons:function(){if(chatgpt.autoRefresh.beaconID){clearInterval(chatgpt.autoRefresh.beaconID);chatgpt.autoRefresh.beaconID=null;console.log("↻ ChatGPT >> ["+chatgpt.autoRefresh.nowTimeStamp()+"] Beacons de-activated")}else{chatgpt.autoRefresh.beaconID=setInterval(()=>{navigator.sendBeacon("https://httpbin.org/post",new Uint8Array);console.log("↻ ChatGPT >> ["+chatgpt.autoRefresh.nowTimeStamp()+"] Beacon sent")},9e4);console.log("↻ ChatGPT >> ["+chatgpt.autoRefresh.nowTimeStamp()+"] Beacons activated")}},refreshFrame:function(){let refreshFrame=document.querySelector("#refresh-frame");if(refreshFrame)refreshFrame.remove();else{refreshFrame=Object.assign(document.createElement("iframe"),{id:"refresh-frame",style:"display: none"});document.head.prepend(refreshFrame)}}}},browser:{isLightMode:function(){return window.matchMedia?.("(prefers-color-scheme: light)")?.matches},isDarkMode:function(){return window.matchMedia?.("(prefers-color-scheme: dark)")?.matches},isChromium:function(){return navigator.userAgent.includes("Chrome")},isFirefox:function(){return navigator.userAgent.includes("Firefox")},isFullScreen:function(){const userAgentStr=navigator.userAgent;return userAgentStr.includes("Chrome")?window.matchMedia("(display-mode: fullscreen)").matches:userAgentStr.includes("Firefox")?window.fullScreen:/MSIE|rv:/.test(userAgentStr)?document.msFullscreenElement:document.webkitIsFullScreen},isMobile:function(){return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)}},clearChats:async function(method){const validMethods=["api","dom"];method=(method||"dom").trim().toLowerCase();if(method&&!validMethods.includes(method))return console.log(`Method argument must be one of: [${validMethods}]`);if(method=="dom"){try{await chatgpt.getChatData()}catch{return}chatgpt.menu.open();setTimeout(()=>{const menuItems=document.querySelectorAll('a[role="menuitem"]')||[];for(const menuItem of menuItems)if(/settings/i.test(menuItem.text)){menuItem.click();break}setTimeout(()=>{const settingsBtns=document.querySelectorAll("[id*=radix] button");for(const settingsBtn of settingsBtns)if(/^clear/i.test(settingsBtn.textContent)){settingsBtn.click();break}setTimeout(()=>{document.querySelector("[id*=radix] button").click();setTimeout(()=>{exitMenu();try{document.querySelector("#prompt-textarea").focus()}catch(err){}},10)},10)},333)},10);const exitMenu=()=>{document.querySelector("div[id*=radix] button").click()}}else{return new Promise((resolve,reject)=>{chatgpt.getAccessToken().then(token=>{const xhr=new XMLHttpRequest;xhr.open("PATCH",endpoints.openAI.chats,true);xhr.setRequestHeader("Content-Type","application/json");xhr.setRequestHeader("Authorization","Bearer "+token);xhr.onload=()=>{if(xhr.status!==200)return reject("🤖 chatgpt.js >> Request failed. Cannot clear chats.");console.info("Chats successfully cleared");resolve()};xhr.send(JSON.stringify({is_visible:false}))}).catch(reject)})}},code:{execute:async function(code){if(!code)return console.error("Code argument not supplied. Pass some code!");if(typeof code!=="string")return console.error("Code argument must be a string!");chatgpt.send("Display the output as if you were terminal:\n\n"+code);console.info("Executing code...");await chatgpt.isIdle();return chatgpt.code.extract(await chatgpt.getChatData("active","msg","chatgpt","latest"))},extract:function(msg){const codeBlocks=msg.match(/(?<=```.*\n)[\s\S]*?(?=```)/g);return codeBlocks?codeBlocks[codeBlocks.length-1]:msg},minify:async function(code){if(!code)return console.error("Code argument not supplied. Pass some code!");if(typeof code!=="string")return console.error("Code argument must be a string!");chatgpt.send("Minify the following code:\n\n"+code);console.info("Minifying code...");await chatgpt.isIdle();return chatgpt.code.extract(await chatgpt.getChatData("active","msg","chatgpt","latest"))},obfuscate:async function(code){if(!code)return console.error("Code argument not supplied. Pass some code!");if(typeof code!=="string")return console.error("Code argument must be a string!");chatgpt.send("Obfuscate the following code:\n\n"+code);console.info("Obfuscating code...");await chatgpt.isIdle();return chatgpt.code.extract(await chatgpt.getChatData("active","msg","chatgpt","latest"))},refactor:async function(code,objective){if(!code)return console.error("Code (1st) argument not supplied. Pass some code!");for(let i=0;i<arguments.length;i++)if(typeof arguments[i]!=="string")return console.error(`Argument ${i+1} must be a string.`);chatgpt.send("Refactor the following code for "+(objective||"brevity")+":\n\n"+code);console.info("Refactoring code...");await chatgpt.isIdle();return chatgpt.code.extract(await chatgpt.getChatData("active","msg","chatgpt","latest"))},review:async function(code){if(!code)return console.error("Code argument not supplied. Pass some code!");if(typeof code!=="string")return console.error("Code argument must be a string!");chatgpt.send("Review the following code for me:\n\n"+code);console.info("Reviewing code...");await chatgpt.isIdle();return chatgpt.getChatData("active","msg","chatgpt","latest")},unminify:async function(code){if(!code)return console.error("Code argument not supplied. Pass some code!");if(typeof code!=="string")return console.error("Code argument must be a string!");chatgpt.send("Unminify the following code.:\n\n"+code);console.info("Unminifying code...");await chatgpt.isIdle();return chatgpt.code.extract(await chatgpt.getChatData("active","msg","chatgpt","latest"))},write:async function(prompt,outputLang){if(!prompt)return console.error("Prompt (1st) argument not supplied. Pass a prompt!");if(!outputLang)return console.error("outputLang (2nd) argument not supplied. Pass a language!");for(let i=0;i<arguments.length;i++)if(typeof arguments[i]!=="string")return console.error(`Argument ${i+1} must be a string.`);chatgpt.send(prompt+"\n\nWrite this as code in "+outputLang);console.info("Writing code...");await chatgpt.isIdle();return chatgpt.code.extract(await chatgpt.getChatData("active","msg","chatgpt","latest"))}},detectLanguage:async function(text){if(!text)return console.error("Text argument not supplied. Pass some text!");if(typeof text!=="string")return console.error("Text argument must be a string!");chatgpt.send("Detect the language of the following text:\n\n"+text+"\n\nOnly respond with the name of the language");console.info("Reviewing text...");await chatgpt.isIdle();return chatgpt.getChatData("active","msg","chatgpt","latest")},executeCode:function(){chatgpt.code.execute()},exportChat:async function(chatToGet,format){chatToGet=!chatToGet?"active":Number.isInteger(chatToGet)||/^\d+$/.test(chatToGet)?parseInt(chatToGet,10):chatToGet;format=format.toLowerCase()||"html";console.info("Generating transcript...");let transcript="",filename;if(/te?xt/.test(format)){const now=new Date,day=now.getDate().toString().padStart(2,"0"),month=(now.getMonth()+1).toString().padStart(2,"0"),year=now.getFullYear(),hour=now.getHours().toString().padStart(2,"0"),minute=now.getMinutes().toString().padStart(2,"0");filename=`ChatGPT_${day}-${month}-${year}_${hour}-${minute}.txt`;if(chatToGet=="active"&&/\/\w{8}-\w{4}-\w{4}-\w{4}-\w{12}$/.test(window.location.href)){const chatDivs=document.querySelectorAll("main > div > div > div > div > div > div[class*=group]");if(chatDivs.length===0)return console.error("Chat is empty!");const msgs=[];let isUserMsg=true;chatDivs.forEach(div=>{const sender=isUserMsg?"USER":"CHATGPT";isUserMsg=!isUserMsg;let msg=Array.from(div.childNodes).map(node=>node.innerText).join("\n\n").replace("Copy code","");msgs.push(sender+": "+msg)});transcript=msgs.join("\n\n")}else{for(const entry of await chatgpt.getChatData(chatToGet,"msg","both","all")){transcript+=`USER: ${entry.user}\n\n`;transcript+=`CHATGPT: ${entry.chatgpt}\n\n`}}}else{const response=await fetch(await chatgpt.shareChat(chatToGet)),htmlContent=await response.text();const parser=new DOMParser,parsedHtml=parser.parseFromString(htmlContent,"text/html");filename=parsedHtml.querySelector("title").textContent+".html";const cssLinks=parsedHtml.querySelectorAll('link[rel="stylesheet"]');cssLinks.forEach(link=>{const href=link.getAttribute("href");if(href?.startsWith("/"))link.setAttribute("href","https://chat.openai.com"+href)});transcript=(new XMLSerializer).serializeToString(parsedHtml)}console.info(`Exporting transcript as ${format.toUpperCase()}...`);if(format=="pdf"){transcript=transcript.replace(/<svg.*?<\/svg>/g,match=>{const dataURL="data:image/svg+xml,"+encodeURIComponent(match);return`<img src="${dataURL}">`});const transcriptPopup=window.open("","","toolbar=0, location=0, menubar=0, height=600, width=800");transcriptPopup.document.write(transcript);setTimeout(()=>{transcriptPopup.print({toPDF:true})},100)}else{if(format=="md"){const mdMatch=/<!?.*(<h1(.|\n)*?href=".*?continue.*?".*?\/a>.*?)<[^/]/.exec(transcript)[1];transcript=mdMatch||transcript;filename=filename.replace(".html",".md")}const blob=new Blob([transcript],{type:"text/"+(format=="html"?"html":format=="md"?"markdown":"plain")});const link=document.createElement("a"),blobURL=URL.createObjectURL(blob);link.href=blobURL;link.download=filename;document.body.append(link);link.click();document.body.removeChild(link);URL.revokeObjectURL(blobURL)}},extractCode:function(){chatgpt.code.extract()},generateRandomIP:function(){const ip=Array.from({length:4},()=>Math.floor(chatgpt.randomFloat()*256)).join(".");console.info("IP generated: "+ip);return ip},get:function(targetType,targetName=""){if(typeof targetType!=="string"||typeof targetName!=="string"){throw new TypeError("Invalid arguments. Both arguments must be strings.")}if(!targetTypes.includes(targetType.toLowerCase())){throw new Error("Invalid targetType: "+targetType+". Valid values are: "+JSON.stringify(targetTypes))}const targetNames=[],reTargetName=new RegExp("^get(.*)"+targetType+"$","i");for(const prop in chatgpt){if(typeof chatgpt[prop]=="function"&&reTargetName.test(prop)){targetNames.push(prop.replace(reTargetName,"$1").toLowerCase())}}if(!targetNames.includes(targetName.toLowerCase())){throw new Error("Invalid targetName: "+targetName+". "+(targetNames.length>0?"Valid values are: "+JSON.stringify(targetNames):"targetType "+targetType.toLowerCase()+" does not require additional options."))}const targetFuncNameLower=("get"+targetName+targetType).toLowerCase();const targetFuncName=Object.keys(this).find(name=>{return name.toLowerCase()==targetFuncNameLower});return this[targetFuncName]()},getAccessToken:function(){return new Promise((resolve,reject)=>{if(Object.keys(chatgpt.openAIaccessToken).length>0&&Date.parse(chatgpt.openAIaccessToken.expireDate)-Date.parse(new Date)>=0)return resolve(chatgpt.openAIaccessToken.token);const xhr=new XMLHttpRequest;xhr.open("GET",endpoints.openAI.session,true);xhr.setRequestHeader("Content-Type","application/json");xhr.onload=()=>{if(xhr.status!==200)return reject("🤖 chatgpt.js >> Request failed. Cannot retrieve access token.");console.info("Token expiration: "+new Date(JSON.parse(xhr.responseText).expires).toLocaleString().replace(","," at"));chatgpt.openAIaccessToken={token:JSON.parse(xhr.responseText).accessToken,expireDate:JSON.parse(xhr.responseText).expires};return resolve(chatgpt.openAIaccessToken.token)};xhr.send()})},getAccountDetails:function(...details){const validDetails=["email","id","image","name","picture"];details=!arguments[0]?validDetails:Array.isArray(arguments[0])?arguments[0]:Array.from(arguments);for(const detail of details){if(!validDetails.includes(detail)){return console.error("Invalid detail arg '"+detail+"' supplied. Valid details are:\n"+" ["+validDetails+"]")}}return new Promise((resolve,reject)=>{const xhr=new XMLHttpRequest;xhr.open("GET",endpoints.openAI.session,true);xhr.setRequestHeader("Content-Type","application/json");xhr.onload=()=>{if(xhr.status===200){const data=JSON.parse(xhr.responseText).user,detailsToReturn={};for(const detail of details)detailsToReturn[detail]=data[detail];return resolve(detailsToReturn)}else return reject("🤖 chatgpt.js >> Request failed. Cannot retrieve account details.")};xhr.send()})},getChatBox:function(){return document.getElementById("prompt-textarea")},getChatData:function(chatToGet=1,detailsToGet="all",sender="all",msgToGet="all"){const validDetails=["all","id","title","create_time","update_time","msg"];const validSenders=["all","both","user","chatgpt"];chatToGet=!chatToGet?"active":Number.isInteger(chatToGet)||/^\d+$/.test(chatToGet)?parseInt(chatToGet,10)===0?0:parseInt(chatToGet,10)-1:chatToGet;detailsToGet=["all",""].includes(detailsToGet)?validDetails.filter(detail=>/^(?!all$|msg$).*/.test(detail)):Array.isArray(detailsToGet)?detailsToGet:[detailsToGet];sender=!sender?"all":validSenders.includes(sender)?sender:"invalid";msgToGet=Number.isInteger(msgToGet)||/^\d+$/.test(msgToGet)?parseInt(msgToGet,10)===0?0:parseInt(msgToGet,10)-1:["all","latest"].includes(msgToGet.toLowerCase())?msgToGet.toLowerCase():!msgToGet?"all":"invalid";for(const detail of detailsToGet){if(!validDetails.includes(detail)){return console.error("Invalid detail arg '"+detail+"' passed. Valid details are:\n"+" ["+validDetails+"]")}}if(sender=="invalid"){return console.error("Invalid sender arg passed. Valid senders are:\n"+" ["+validSenders+"]")}if(msgToGet=="invalid"){return console.error("Invalid msgToGet arg passed. Valid msg's to get are:\n"+" [ 'all' | 'latest' | index of msg to get ]")}const getChatDetails=(token,detailsToGet)=>{const re_chatID=/\w{8}-\w{4}-\w{4}-\w{4}-\w{12}/;return new Promise((resolve,reject)=>{const xhr=new XMLHttpRequest;xhr.open("GET",endpoints.openAI.chats,true);xhr.setRequestHeader("Content-Type","application/json");xhr.setRequestHeader("Authorization","Bearer "+token);xhr.onload=()=>{if(xhr.status!==200)return reject("🤖 chatgpt.js >> Request failed. Cannot retrieve chat details.");const data=JSON.parse(xhr.responseText).items;if(data.length<=0)return reject("🤖 chatgpt.js >> Chat list is empty.");const detailsToReturn={};if(Number.isInteger(chatToGet)||chatToGet=="latest"||chatToGet=="active"&&!new RegExp("/"+re_chatID.source+"$").test(window.location.href)){chatToGet=Number.isInteger(chatToGet)?chatToGet:0;if(chatToGet>data.length){return reject("🤖 chatgpt.js >> Chat with index "+(chatToGet+1)+" is out of bounds. Only "+data.length+" chats exist!")}for(const detail of detailsToGet)detailsToReturn[detail]=data[chatToGet][detail];return resolve(detailsToReturn)}const chatIdentifier=chatToGet=="active"||new RegExp("^"+re_chatID.source+"$").test(chatToGet)?"id":"title";if(chatToGet=="active")chatToGet=re_chatID.exec(window.location.href)[0];let idx,chatFound;for(idx=0;idx<data.length;idx++){if(data[idx][chatIdentifier]==chatToGet){chatFound=true;break}}if(!chatFound)return reject("🤖 chatgpt.js >> No chat with "+chatIdentifier+" = "+chatToGet+" found.");for(const detail of detailsToGet)detailsToReturn[detail]=data[idx][detail];return resolve(detailsToReturn)};xhr.send()})};const getChatMsgs=token=>{return new Promise((resolve,reject)=>{const xhr=new XMLHttpRequest;getChatDetails(token,["id"]).then(chat=>{xhr.open("GET",`${endpoints.openAI.chat}/${chat.id}`,true);xhr.setRequestHeader("Content-Type","application/json");xhr.setRequestHeader("Authorization","Bearer "+token);xhr.onload=()=>{if(xhr.status!==200)return reject("🤖 chatgpt.js >> Request failed. Cannot retrieve chat messages.");const data=JSON.parse(xhr.responseText).mapping;const userMessages=[],chatGPTMessages=[],msgsToReturn=[];for(const key in data)if("message"in data[key]&&data[key].message.author.role=="user")userMessages.push({id:data[key].id,msg:data[key].message});userMessages.sort((a,b)=>a.msg.create_time-b.msg.create_time);if(parseInt(msgToGet,10)+1>userMessages.length)return reject("🤖 chatgpt.js >> Message/response with index "+(msgToGet+1)+" is out of bounds. Only "+userMessages.length+" messages/responses exist!");for(const userMessage of userMessages){let sub=[];for(const key in data){if("message"in data[key]&&data[key].message.author.role=="assistant"&&data[key].parent==userMessage.id){sub.push(data[key].message)}}sub.sort((a,b)=>a.create_time-b.create_time);sub=sub.map(x=>{switch(x.content.content_type){case"code":return x.content.text;case"text":return x.content.parts[0];default:return}});sub=sub.length===1?sub[0]:sub;chatGPTMessages.push(sub)}if(sender=="user")for(const userMessage in userMessages)msgsToReturn.push(userMessages[userMessage].msg.content.parts[0]);else if(sender=="chatgpt")for(const chatGPTMessage of chatGPTMessages)msgsToReturn.push(msgToGet=="latest"?chatGPTMessages[chatGPTMessages.length-1]:chatGPTMessage);else{let i=0;for(const message in userMessages){msgsToReturn.push({user:userMessages[message].msg.content.parts[0],chatgpt:msgToGet=="latest"?chatGPTMessages[i][chatGPTMessages[i].length-1]:chatGPTMessages[i]});i++}}return resolve(msgToGet=="all"?msgsToReturn:msgToGet=="latest"?msgsToReturn[msgsToReturn.length-1]:msgsToReturn[msgToGet])};xhr.send()})})};return new Promise(resolve=>{chatgpt.getAccessToken().then(token=>{if(!detailsToGet.includes("msg"))getChatDetails(token,detailsToGet).then(data=>{return resolve(data)});else getChatMsgs(token).then(messages=>{return resolve(messages)})})})},getChatInput:function(){return chatgpt.getChatBox().value},getContinueGeneratingButton:function(){for(const formButton of document.querySelectorAll("form button")){if(formButton.textContent.toLowerCase().includes("continue")){return formButton}}},getLastPrompt:function(){return chatgpt.getChatData("active","msg","user","latest")},getLastResponse:function(){return chatgpt.getChatData("active","msg","chatgpt","latest")},getNewChatLink:function(){for(const navLink of document.querySelectorAll('nav[aria-label="Chat history"] a')){if(/(new|clear) chat/i.test(navLink.text)){return navLink}}},getRegenerateButton:function(){for(const mainSVG of document.querySelectorAll("main svg")){if(mainSVG.querySelector('path[d*="M4.5 2.5C5.05228"]'))return mainSVG.parentNode.parentNode}},getResponse:function(){if(window.location.href.startsWith("https://chat.openai.com/c/"))return chatgpt.getResponseFromDOM.apply(null,arguments);else return chatgpt.getResponseFromAPI.apply(null,arguments)},getResponseFromAPI:function(chatToGet,responseToGet){return chatgpt.response.getFromAPI(chatToGet,responseToGet)},getResponseFromDOM:function(pos){return chatgpt.response.getFromDOM(pos)},getSendButton:function(){return document.querySelector('form button[class*="bottom"]')},getStopGeneratingButton:function(){for(const formButton of document.querySelectorAll("form button")){if(formButton.textContent.toLowerCase().includes("stop")){return formButton}}},getUserLanguage:function(){return navigator.languages[0]||navigator.language||navigator.browserLanguage||navigator.systemLanguage||navigator.userLanguage||""},history:{activate:function(){this.isOff()?this.toggle():console.info("Chat history is already enabled!")},deactivate:function(){this.isOn()?this.toggle():console.info("Chat history is already disabled!")},isOn:function(){const navDivs=document.querySelectorAll('nav[aria-label="Chat history"] div'),offDiv=[...navDivs].find(div=>div.textContent.includes("Chat History is off"))||{};return offDiv.classList.toString().includes("invisible")},isOff:function(){return!this.isOn()},isLoaded:function(){return new Promise(resolve=>{const checkChatHistory=()=>{if(document.querySelector('nav[aria-label="Chat history"]'))resolve(true);else setTimeout(checkChatHistory,100)};checkChatHistory()})},toggle:function(){for(const navBtn of document.querySelectorAll('nav[aria-label="Chat history"] button')){if(/chat history/i.test(navBtn.textContent)){navBtn.click();return}}}},instructions:{add:function(instruction,target){if(!instruction)return console.error("Please provide an instruction");if(typeof instruction!=="string")return console.error("Instruction must be a string");const validTargets=["user","chatgpt"];if(!target)return console.error("Please provide a valid target!");if(typeof target!=="string")return console.error("Target must be a string");target=target.toLowerCase();if(!validTargets.includes(target))return console.error(`Invalid target ${target}. Valid targets are [${validTargets}]`);instruction=`\n\n${instruction}`;return new Promise(resolve=>{chatgpt.getAccessToken().then(async token=>{const instructionsData=await this.fetchData();if(target=="user")instructionsData.about_user_message+=instruction;else if(target=="chatgpt")instructionsData.about_model_message+=instruction;await this.sendRequest("POST",token,instructionsData);return resolve()})})},clear:function(target){const validTargets=["user","chatgpt"];if(!target)return console.error("Please provide a valid target!");if(typeof target!=="string")return console.error("Target must be a string");target=target.toLowerCase();if(!validTargets.includes(target))return console.error(`Invalid target ${target}. Valid targets are [${validTargets}]`);return new Promise(resolve=>{chatgpt.getAccessToken().then(async token=>{const instructionsData=await this.fetchData();if(target=="user")instructionsData.about_user_message="";else if(target=="chatgpt")instructionsData.about_model_message="";await this.sendRequest("POST",token,instructionsData);return resolve()})})},fetchData:function(){return new Promise(resolve=>{chatgpt.getAccessToken().then(async token=>{return resolve(await this.sendRequest("GET",token))})})},sendRequest:function(method,token,body){for(let i=0;i<arguments.length-1;i++)if(typeof arguments[i]!=="string")return console.error(`Argument ${i+1} must be a string`);const validMethods=["POST","GET"];method=(method||"").trim().toUpperCase();if(!method||!validMethods.includes(method))return console.error(`Valid methods are ${validMethods}`);if(!token)return console.error("Please provide a valid access token!");if(body&&typeof body!=="object")return console.error(`Invalid body data type. Got ${typeof body}, expected object`);return new Promise((resolve,reject)=>{const xhr=new XMLHttpRequest;xhr.open(method,endpoints.openAI.instructions,true);xhr.setRequestHeader("Accept-Language","en-US");xhr.setRequestHeader("Authorization","Bearer "+token);if(method=="POST")xhr.setRequestHeader("Content-Type","application/json");xhr.onload=()=>{const responseData=JSON.parse(xhr.responseText);if(xhr.status===422)return reject("🤖 chatgpt.js >> Character limit exceeded. Custom instructions can have a maximum length of 1500 characters.");else if(xhr.status===403&&responseData.detail.reason=="content_policy")return reject("🤖 chatgpt.js >> "+responseData.detail.description);else if(xhr.status!==200)return reject("🤖 chatgpt.js >> Request failed. Cannot contact custom instructions endpoint.");console.info(`Custom instructions successfully contacted with method ${method}`);return resolve(responseData||{})};xhr.send(JSON.stringify(body)||"")})},turnOff:function(){return new Promise(resolve=>{chatgpt.getAccessToken().then(async token=>{const instructionsData=await this.fetchData();instructionsData.enabled=false;await this.sendRequest("POST",token,instructionsData);return resolve()})})},turnOn:function(){return new Promise(resolve=>{chatgpt.getAccessToken().then(async token=>{const instructionsData=await this.fetchData();instructionsData.enabled=true;await this.sendRequest("POST",token,instructionsData);return resolve()})})},toggle:function(){return new Promise(resolve=>{this.fetchData().then(async instructionsData=>{await(instructionsData.enabled?this.turnOff():this.turnOn());return resolve()})})}},isChromium:function(){return chatgpt.browser.isChromium()},isDarkMode:function(){return document.documentElement.classList.toString().includes("dark")},isFirefox:function(){return chatgpt.browser.isFirefox()},isFullScreen:function(){return chatgpt.browser.isFullScreen()},isIdle:function(){return new Promise(resolve=>{const intervalId=setInterval(()=>{if(chatgpt.getRegenerateButton()){clearInterval(intervalId);resolve(true)}},100)})},isLoaded:function(){return new Promise(resolve=>{const intervalId=setInterval(()=>{if(document.querySelector('nav button[id*="menu"]')){clearInterval(intervalId);setTimeout(()=>{resolve(true)},500)}},100)})},isLightMode:function(){return document.documentElement.classList.toString().includes("light")},isMobileDevice:function(){return chatgpt.browser.isMobile()},logout:function(){window.location.href="https://chat.openai.com/auth/logout"},menu:{elements:[],addedEvent:false,append:function(element,attrs={}){const validElements=["button","dropdown"];if(!element||typeof element!=="string")return console.error("🤖 chatgpt.js >> Please supply a valid string element name!");element=element.toLowerCase();if(!validElements.includes(element))return console.error(`🤖 chatgpt.js >> Invalid element! Valid elements are [${validElements}]`);const newElement=document.createElement(element=="dropdown"?"select":element=="button"?"a":element);newElement.id=Math.floor(chatgpt.randomFloat()*1e6)+Date.now();if(element=="button"){newElement.textContent=attrs?.label&&typeof attrs.label=="string"?attrs.label:"chatgpt.js button";const icon=document.createElement("img");icon.src=attrs?.icon&&typeof attrs.icon=="string"?attrs.icon:endpoints.assets+"/starters/chrome/extension/icons/icon128.png";icon.width=18;newElement.insertBefore(icon,newElement.firstChild);newElement.onclick=attrs?.onclick&&typeof attrs.onclick=="function"?attrs.onclick:function(){}}else if(element=="dropdown"){if(!attrs?.items||!Array.isArray(attrs.items)||!attrs.items.length)attrs.items=[{text:"🤖 chatgpt.js option",value:"chatgpt.js option value"}];if(!attrs.items.every(el=>typeof el=="object"))return console.error("'items' must be an array of objects!");newElement.style="background-color: #000; width: 100%; border: none;";attrs.items.forEach(item=>{const optionElement=document.createElement("option");optionElement.textContent=item?.text;optionElement.value=item?.value;newElement.add(optionElement)})}const addElementsToMenu=()=>{const optionButtons=document.querySelectorAll('a[role="menuitem"]');let cssClasses;for(let navLink of optionButtons)if(navLink.textContent=="Settings"){cssClasses=navLink.classList;break}const headlessNav=optionButtons[0].parentNode;chatgpt.menu.elements.forEach(element=>{element.setAttribute("class",cssClasses);if(!headlessNav.contains(element))try{headlessNav.insertBefore(element,headlessNav.firstChild)}catch(err){console.error(err)}})};this.elements.push(newElement);const menuBtn=document.querySelector('nav button[id*="headless"]');if(!this.addedEvent){menuBtn.addEventListener("click",()=>{setTimeout(addElementsToMenu,25)});this.addedEvent=true}return newElement.id},close:function(){const menuBtn=document.querySelector('nav [id*="menu-button"][aria-expanded="true"]');if(menuBtn)try{menuBtn.click()}catch(err){console.error("Error while closing the menu");throw new Error(err)}else{console.error("Menu already hidden!");throw new Error}},open:function(){const menuBtn=document.querySelector('nav [id*="menu-button"][aria-expanded="false"]');if(menuBtn)try{menuBtn.click()}catch(err){console.error("Error while closing the menu");throw new Error(err)}else{console.error("Menu already hidden!");throw new Error}}},minify:function(){chatgpt.code.minify()},notify:async function(msg,position,notifDuration,shadow){notifDuration=notifDuration?+notifDuration:1.75;const fadeDuration=.3,vpYoffset=23,vpXoffset=27;const notificationDiv=document.createElement("div");notificationDiv.id=Math.floor(chatgpt.randomFloat()*1e6)+Date.now();notificationDiv.classList.add("chatgpt-notif");notificationDiv.innerText=msg;document.body.append(notificationDiv);const closeBtn=document.createElement("div");closeBtn.title=cjsMessages?.tooltip_dismiss||"Dismiss";closeBtn.classList.add("notif-close-btn");const closeSVG=document.createElementNS("http://www.w3.org/2000/svg","svg");closeSVG.setAttribute("height","8px");closeSVG.setAttribute("viewBox","0 0 14 14");closeSVG.setAttribute("fill","none");closeSVG.style.height=closeSVG.style.width="8px";const closeSVGpath=document.createElementNS("http://www.w3.org/2000/svg","path");closeSVGpath.setAttribute("fill-rule","evenodd");closeSVGpath.setAttribute("clip-rule","evenodd");closeSVGpath.setAttribute("fill","white");closeSVGpath.setAttribute("d","M13.7071 1.70711C14.0976 1.31658 14.0976 0.683417 13.7071 0.292893C13.3166 -0.0976312 12.6834 -0.0976312 12.2929 0.292893L7 5.58579L1.70711 0.292893C1.31658 -0.0976312 0.683417 -0.0976312 0.292893 0.292893C-0.0976312 0.683417 -0.0976312 1.31658 0.292893 1.70711L5.58579 7L0.292893 12.2929C-0.0976312 12.6834 -0.0976312 13.3166 0.292893 13.7071C0.683417 14.0976 1.31658 14.0976 1.70711 13.7071L7 8.41421L12.2929 13.7071C12.6834 14.0976 13.3166 14.0976 13.7071 13.7071C14.0976 13.3166 14.0976 12.6834 13.7071 12.2929L8.41421 7L13.7071 1.70711Z");closeSVG.append(closeSVGpath);closeBtn.append(closeSVG);notificationDiv.append(closeBtn);notificationDiv.isTop=!position||!/low|bottom/i.test(position);notificationDiv.isRight=!position||!/left/i.test(position);notificationDiv.quadrant=(notificationDiv.isTop?"top":"bottom")+(notificationDiv.isRight?"Right":"Left");const thisUpdated=20231110;let notifStyle=document.querySelector("#chatgpt-notif-style");if(!notifStyle||parseInt(notifStyle.getAttribute("last-updated"),10)<thisUpdated){if(!notifStyle){notifStyle=document.createElement("style");notifStyle.id="chatgpt-notif-style";notifStyle.setAttribute("last-updated",thisUpdated.toString());document.head.append(notifStyle)}notifStyle.innerText=".chatgpt-notif {"+"background-color: black ; padding: 10px 13px 10px 18px ; border-radius: 11px ; border: 1px solid #f5f5f7 ;"+"opacity: 0 ; position: fixed ; z-index: 9999 ; font-size: 1.8rem ; color: white ;"+"-webkit-user-select: none ; -moz-user-select: none ; -ms-user-select: none ; user-select: none ;"+`transform: translateX(${!notificationDiv.isRight?"-":""}35px) ;`+(shadow?"box-shadow: -8px 13px 25px 0 "+(/\b(shadow|on)\b/gi.test(shadow)?"gray":shadow):"")+"}"+".notif-close-btn { cursor: pointer ; float: right ; position: relative ; right: -4px ; margin-left: -3px ;"+"display: grid }"+"@keyframes notif-zoom-fade-out { 0% { opacity: 1 ; transform: scale(1) }"+"15% { opacity: 0.35 ; transform: rotateX(-27deg) scale(1.05) }"+"45% { opacity: 0.05 ; transform: rotateX(-81deg) }"+"100% { opacity: 0 ; transform: rotateX(-180deg) scale(1.15) }}"}let notifyProps=JSON.parse(localStorage.notifyProps);notifyProps.queue[notificationDiv.quadrant].push(notificationDiv.id);localStorage.notifyProps=JSON.stringify(notifyProps);notificationDiv.style.top=notificationDiv.isTop?vpYoffset.toString()+"px":"";notificationDiv.style.bottom=!notificationDiv.isTop?vpYoffset.toString()+"px":"";notificationDiv.style.right=notificationDiv.isRight?vpXoffset.toString()+"px":"";notificationDiv.style.left=!notificationDiv.isRight?vpXoffset.toString()+"px":"";const thisQuadrantQueue=notifyProps.queue[notificationDiv.quadrant];if(thisQuadrantQueue.length>1){try{for(const divId of thisQuadrantQueue.slice(0,-1)){const oldDiv=document.getElementById(divId),offsetProp=oldDiv.style.top?"top":"bottom",vOffset=+/\d+/.exec(oldDiv.style[offsetProp])[0]+5+oldDiv.getBoundingClientRect().height;oldDiv.style[offsetProp]=`${vOffset}px`}}catch(err){}}setTimeout(()=>{notificationDiv.style.opacity=chatgpt.isDarkMode()?.8:.67;notificationDiv.style.transform="translateX(0)";notificationDiv.style.transition="transform 0.15s ease, opacity 0.15s ease"},10);const hideDelay=fadeDuration>notifDuration?0:notifDuration-fadeDuration;let dismissAudio,dismissAudioTID;if(isFFtmScript){let nthAudio;do{nthAudio=Math.floor(Math.random()*3)+1}while(nthAudio===notifyProps.lastNthAudio);notifyProps.lastNthAudio=nthAudio;localStorage.notifyProps=JSON.stringify(notifyProps);dismissAudio=new Audio;dismissAudio.src=endpoints.assets+"/media/audio/notifications/bubble-pop/"+`${nthAudio}-${notificationDiv.isRight?"right":"left"}.mp3`;dismissAudioTID=setTimeout(()=>dismissAudio.play().catch(()=>{}),hideDelay*1e3)}const dismissNotif=()=>{notificationDiv.style.animation=`notif-zoom-fade-out ${fadeDuration}s ease-out`;if(isFFtmScript)dismissAudio?.play().catch(()=>{});clearTimeout(dismissFuncTID);clearTimeout(dismissAudioTID)};const dismissFuncTID=setTimeout(dismissNotif,hideDelay*1e3);closeSVG.addEventListener("click",dismissNotif,{once:true});notificationDiv.addEventListener("animationend",()=>{notificationDiv.remove();notifyProps=JSON.parse(localStorage.notifyProps);notifyProps.queue[notificationDiv.quadrant].shift();localStorage.notifyProps=JSON.stringify(notifyProps)},{once:true})},obfuscate:function(){chatgpt.code.obfuscate()},printAllFunctions:function(){const colors={cmdPrompt:["#ff00ff","#00ff00"],objName:["#0611e9","#f9ee16"],methodName:["#005aff","#ffa500"],entryType:["#467e06","#b981f9"],srcMethod:["#ff0000","#00ffff"]};Object.keys(colors).forEach(element=>{colors[element][1]=colors[element][1]||"#"+(Number(`0x1${colors[element][0].replace(/^#/,"")}`)^16777215).toString(16).substring(1).toUpperCase()});const functionNames=[];for(const prop in this){if(typeof this[prop]=="function"){const chatgptIsParent=!Object.keys(this).find(obj=>Object.keys(this[obj]).includes(this[prop].name)),functionParent=chatgptIsParent?"chatgpt":"other";functionNames.push([functionParent,prop])}else if(typeof this[prop]=="object"){for(const nestedProp in this[prop]){if(typeof this[prop][nestedProp]=="function"){functionNames.push([prop,nestedProp])}}}}functionNames.sort((a,b)=>{return a[0].localeCompare(b[0])||a[1].localeCompare(b[1])});const isDarkMode=window.matchMedia("(prefers-color-scheme: dark)").matches,baseFontStyles="font-family: monospace ; font-size: larger ; ";console.log("\n%c🤖 chatgpt.js methods\n","font-family: sans-serif ; font-size: xxx-large ; font-weight: bold");for(const functionName of functionNames){const isChatGptObjParent=/chatgpt|other/.test(functionName[0]),rootFunction=functionName[0]=="chatgpt"?this[functionName[1]].name:functionName[0]!=="other"?functionName[0]+"."+functionName[1]:Object.keys(this).find(obj=>Object.keys(this[obj]).includes(this[functionName[1]].name))+"."+this[functionName[1]].name,isAsync=this[functionName[1]]?.constructor.name=="AsyncFunction";console.log("%c>> %c"+(isChatGptObjParent?"":`${functionName[0]}.%c`)+functionName[1]+" - https://chatgptjs.org/userguide/"+/(?:.*\.)?(.*)/.exec(rootFunction)[1].toLowerCase()+(isAsync?"-async":"")+"\n%c[%c"+(functionName[0]=="chatgpt"&&functionName[1]==this[functionName[1]].name||!isChatGptObjParent?"Function":"Alias of")+"%c: %c"+rootFunction+"%c]",baseFontStyles+"font-weight: bold ; color:"+colors.cmdPrompt[+isDarkMode],baseFontStyles+"font-weight: bold ;"+"color:"+colors[isChatGptObjParent?"methodName":"objName"][+isDarkMode],baseFontStyles+"font-weight: "+(isChatGptObjParent?"initial":"bold")+";"+"color:"+(isChatGptObjParent?"initial":colors.methodName[+isDarkMode]),baseFontStyles+"font-weight: "+(isChatGptObjParent?"bold":"initial")+";"+"color:"+(isChatGptObjParent?colors.entryType[+isDarkMode]:"initial"),baseFontStyles+"font-weight: "+(isChatGptObjParent?"initial":"bold")+";"+"color:"+(isChatGptObjParent?"initial":colors.entryType[+isDarkMode]),baseFontStyles+(isChatGptObjParent?"font-style: italic":"font-weight: initial")+";"+"color:"+(isChatGptObjParent?colors.srcMethod[+isDarkMode]:"initial"),baseFontStyles+(isChatGptObjParent?"font-weight: initial":"font-style: italic")+";"+"color:"+(isChatGptObjParent?"initial":colors.srcMethod[+isDarkMode]),isChatGptObjParent?"":baseFontStyles+"color: initial ; font-weight: initial")}},randomFloat:function(){const crypto=window.crypto||window.msCrypto;return crypto.getRandomValues(new Uint32Array(1))[0]/4294967295},refactor:function(){chatgpt.code.refactor()},regenerate:function(){for(const formButton of document.querySelectorAll("form button")){if(formButton.textContent.toLowerCase().includes("regenerate")){formButton.click();return}}},renderHTML:function(node){const reTags=/<([a-z\d]+)\b([^>]*)>([\s\S]*?)<\/\1>/g,reAttributes=/(\S+)=['"]?((?:.(?!['"]?\s+(?:\S+)=|[>']))+.)['"]?/g,nodeContent=node.childNodes;if(!this.renderHTML.preWrapSet){node.style.whiteSpace="pre-wrap";this.renderHTML.preWrapSet=true;setTimeout(()=>{this.renderHTML.preWrapSet=false},100)}for(const childNode of nodeContent){if(childNode.nodeType==Node.TEXT_NODE){const text=childNode.nodeValue,elems=Array.from(text.matchAll(reTags));if(elems.length>0){const elem=elems[0],[tagContent,tagName,tagAttributes,tagText]=elem.slice(0,4),tagNode=document.createElement(tagName);tagNode.textContent=tagText;const attributes=Array.from(tagAttributes.matchAll(reAttributes));attributes.forEach(attribute=>{const name=attribute[1],value=attribute[2].replace(/['"]/g,"");tagNode.setAttribute(name,value)});const renderedNode=this.renderHTML(tagNode);const beforeTextNode=document.createTextNode(text.substring(0,elem.index)),afterTextNode=document.createTextNode(text.substring(elem.index+tagContent.length));node.replaceChild(beforeTextNode,childNode);node.insertBefore(renderedNode,beforeTextNode.nextSibling);node.insertBefore(afterTextNode,renderedNode.nextSibling)}}else if(childNode.nodeType==Node.ELEMENT_NODE)this.renderHTML(childNode)}return node},resend:async function(){chatgpt.send(await chatgpt.getChatData("latest","msg","user","latest"))},response:{get:function(){if(window.location.href.startsWith("https://chat.openai.com/c/"))return this.getFromDOM.apply(null,arguments);else return this.getFromAPI.apply(null,arguments)},getFromAPI:function(chatToGet,responseToGet){chatToGet=chatToGet||"latest";responseToGet=responseToGet||"latest";return chatgpt.getChatData(chatToGet,"msg","chatgpt",responseToGet)},getFromDOM:function(pos){const responseDivs=document.querySelectorAll('div[data-testid*="conversation-turn"]:nth-child(odd)'),strPos=pos.toString().toLowerCase();let response="";if(responseDivs.length){if(/last|final/.test(strPos))response=responseDivs[responseDivs.length-1].textContent;else{const nthOfResponse=Number.isInteger(pos)?pos:/^\d+/.test(strPos)?/^\d+/.exec(strPos)[0]:(/^(?:1|one|fir)(?:st)?$/.test(strPos)?1:/^(?:2|tw(?:o|en|el(?:ve|f))|seco)(?:nd|t[yi])?(?:e?th)?$/.test(strPos)?2:/^(?:3|th(?:ree|ir?))(?:rd|teen|t[yi])?(?:e?th)?$/.test(strPos)?3:/^(?:4|fou?r)(?:teen|t[yi])?(?:e?th)?$/.test(strPos)?4:/^(?:5|fi(?:ve|f))(?:teen|t[yi])?(?:e?th)?$/.test(strPos)?5:/^(?:6|six)(?:teen|t[yi])?(?:e?th)?$/.test(strPos)?6:/^(?:7|seven)(?:teen|t[yi])?(?:e?th)?$/.test(strPos)?7:/^(?:8|eight?)(?:teen|t[yi])?(?:e?th)?$/.test(strPos)?8:/^(?:9|nine?)(?:teen|t[yi])?(?:e?th)?$/.test(strPos)?9:/^(?:10|ten)(?:th)?$/.test(strPos)?10:1)*(/(ty|ieth)$/.test(strPos)?10:1)+(/teen(th)?$/.test(strPos)?10:0);response=responseDivs[nthOfResponse-1].textContent}response=response.replace(/^ChatGPTChatGPT/,"")}return response},getLast:function(){return chatgpt.getChatData("active","msg","chatgpt","latest")},regenerate:function(){for(const formButton of document.querySelectorAll("form button")){if(formButton.textContent.toLowerCase().includes("regenerate")){formButton.click();return}}},stopGenerating:function(){for(const formButton of document.querySelectorAll("form button")){if(formButton.textContent.toLowerCase().includes("stop")){formButton.click();return}}}},reviewCode:function(){chatgpt.code.review()},scrollToBottom:function(){try{document.querySelector('button[class*="cursor"][class*="bottom"]').click()}catch(err){console.error("",err)}},send:function(msg,method=""){for(let i=0;i<arguments.length;i++)if(typeof arguments[i]!=="string")return console.error(`Argument ${i+1} must be a string!`);const textArea=document.querySelector("form textarea"),sendButton=document.querySelector('form button[class*="bottom"]');textArea.value=msg;textArea.dispatchEvent(new Event("input",{bubbles:true}));const delaySend=setInterval(()=>{if(!sendButton?.hasAttribute("disabled")){method.toLowerCase()=="click"||chatgpt.browser.isMobile()?sendButton.click():textArea.dispatchEvent(new KeyboardEvent("keydown",{keyCode:13,bubbles:true}));clearInterval(delaySend)}},25)},sendInNewChat:function(msg){if(typeof msg!=="string")return console.error("Message must be a string!");for(const navLink of document.querySelectorAll('nav[aria-label="Chat history"] a')){if(/(new|clear) chat/i.test(navLink.text)){navLink.click();break}}setTimeout(()=>{chatgpt.send(msg)},500)},settings:{scheme:{isDark:function(){return document.documentElement.classList.contains("dark")},isLight:function(){return document.documentElement.classList.contains("light")},set:function(value){const validValues=["dark","light","system"];if(!value)return console.error("Please specify a scheme value!");if(!validValues.includes(value))return console.error(`Invalid scheme value. Valid values are [${validValues}]`);let schemeToSet=value;if(value=="system")schemeToSet=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";localStorage.setItem("theme",value);console.info(`Scheme set to ${value.toUpperCase()}.`);if(!document.documentElement.classList.contains(schemeToSet))this.toggle()},toggle:function(){const[schemeToRemove,schemeToAdd]=this.isDark()?["dark","light"]:["light","dark"];document.documentElement.classList.replace(schemeToRemove,schemeToAdd);document.documentElement.style.colorScheme=schemeToAdd;localStorage.setItem("theme",schemeToAdd)}}},sentiment:async function(text,entity){for(let i=0;i<arguments.length;i++)if(typeof arguments[i]!=="string")return console.error(`Argument ${i+1} must be a string.`);chatgpt.send("What is the sentiment of the following text"+(entity?` towards the entity ${entity},`:"")+" from strongly negative to strongly positive?\n\n"+text);console.info("Analyzing sentiment...");await chatgpt.isIdle();return chatgpt.getChatData("active","msg","chatgpt","latest")},setScheme:function(value){chatgpt.settings.scheme.set(value)},shareChat:function(chatToGet,method="clipboard"){const validMethods=["alert","notify","notification","clipboard","copy"];if(!validMethods.includes(method))return console.error("Invalid method '"+method+"' passed. Valid methods are ["+validMethods+"].");const getChatNode=token=>{return new Promise((resolve,reject)=>{const xhr=new XMLHttpRequest;chatgpt.getChatData(chatToGet).then(chat=>{xhr.open("GET",`${endpoints.openAI.chat}/${chat.id}`,true);xhr.setRequestHeader("Content-Type","application/json");xhr.setRequestHeader("Authorization","Bearer "+token);xhr.onload=()=>{if(xhr.status!==200)return reject("🤖 chatgpt.js >> Request failed. Cannot retrieve chat node.");return resolve(JSON.parse(xhr.responseText).current_node)};xhr.send()})})};const makeChatToShare=(token,node)=>{return new Promise((resolve,reject)=>{const xhr=new XMLHttpRequest;chatgpt.getChatData(chatToGet).then(chat=>{xhr.open("POST",endpoints.openAI.share_create,true);xhr.setRequestHeader("Content-Type","application/json");xhr.setRequestHeader("Authorization","Bearer "+token);xhr.onload=()=>{if(xhr.status!==200)return reject("🤖 chatgpt.js >> Request failed. Cannot initialize share chat.");return resolve(JSON.parse(xhr.responseText))};xhr.send(JSON.stringify({current_node_id:node,conversation_id:chat.id,is_anonymous:true}))})})};const confirmShareChat=(token,data)=>{return new Promise((resolve,reject)=>{const xhr=new XMLHttpRequest;xhr.open("PATCH",`${endpoints.openAI.share}/${data.share_id}`,true);xhr.setRequestHeader("Content-Type","application/json");xhr.setRequestHeader("Authorization","Bearer "+token);xhr.onload=()=>{if(xhr.status!==200)return reject("🤖 chatgpt.js >> Request failed. Cannot share chat.");console.info(`Chat shared at '${data.share_url}'`);return resolve()};xhr.send(JSON.stringify({share_id:data.share_id,highlighted_message_id:data.highlighted_message_id,title:data.title,is_public:true,is_visible:data.is_visible,is_anonymous:data.is_anonymous}))})};return new Promise(resolve=>{chatgpt.getAccessToken().then(token=>{getChatNode(token).then(node=>{makeChatToShare(token,node).then(data=>{confirmShareChat(token,data).then(()=>{if(["copy","clipboard"].includes(method))navigator.clipboard.writeText(data.share_url);else chatgpt.alert("🚀 Share link created!",'"'+data.title+'" is available at: <a target="blank" rel="noopener" href="'+data.share_url+'" >'+data.share_url+"</a>",[function openLink(){window.open(data.share_url,"_blank","noopener")},function copyLink(){navigator.clipboard.writeText(data.share_url)}]);resolve(data.share_url)})})})})})},sidebar:{elements:[],observer:{},activateObserver:function(){const chatHistoryNav=document.querySelector('nav[aria-label="Chat history"]'),firstButton=chatHistoryNav.querySelector("a");if(chatgpt.history.isOff())try{firstButton.parentNode.nextElementSibling.style.display="none"}catch(err){}if(this.observer instanceof MutationObserver)try{this.observer.disconnect()}catch(e){}if(!this.elements.length)return console.error("🤖 chatgpt.js >> No elements to append!");let cssClasses;for(let navLink of document.querySelectorAll('nav[aria-label="Chat history"] a')){if(/.*chat/.exec(navLink.text)[0]){cssClasses=navLink.classList;navLink.parentNode.style.margin="2px 0";break}}this.elements.forEach(element=>{element.setAttribute("class",cssClasses);element.style.maxHeight=element.style.minHeight="44px";element.style.margin="2px 0"});const navBar=document.querySelector('nav[aria-label="Chat history"]');this.observer=new MutationObserver(mutations=>{mutations.forEach(mutation=>{if(mutation.type=="childList"&&mutation.addedNodes.length||mutation.type=="attributes"&&mutation.attributeName=="data-chatgptjs")this.elements.forEach(element=>{if(!navBar.contains(element))try{navBar.insertBefore(element,navBar.querySelector("a").parentNode)}catch(err){console.error(err)}})})});this.observer.observe(document.documentElement,{childList:true,subtree:true,attributes:true})},append:function(element,attrs={}){const validElements=["button","dropdown"];if(!element||typeof element!=="string")return console.error("🤖 chatgpt.js >> Please supply a valid string element name!");element=element.toLowerCase();if(!validElements.includes(element))return console.error(`🤖 chatgpt.js >> Invalid element! Valid elements are [${validElements}]`);const newElement=document.createElement(element=="dropdown"?"select":element);newElement.id=Math.floor(chatgpt.randomFloat()*1e6)+Date.now();if(element=="button"){newElement.textContent=attrs?.label&&typeof attrs.label=="string"?attrs.label:"chatgpt.js button";const icon=document.createElement("img");icon.src=attrs?.icon&&typeof attrs.icon=="string"?attrs.icon:endpoints.assets+"/starters/chrome/extension/icons/icon128.png";icon.width=18;newElement.insertBefore(icon,newElement.firstChild);newElement.onclick=attrs?.onclick&&typeof attrs.onclick=="function"?attrs.onclick:function(){}}else if(element=="dropdown"){if(!attrs?.items||!Array.isArray(attrs.items)||!attrs.items.length)attrs.items=[{text:"🤖 chatgpt.js option",value:"chatgpt.js option value"}];if(!attrs.items.every(el=>typeof el=="object"))return console.error("'items' must be an array of objects!");attrs.items.forEach(item=>{const optionElement=document.createElement("option");optionElement.textContent=item?.text;optionElement.value=item?.value;newElement.add(optionElement)})}if(element=="dropdown")newElement.style.backgroundColor="var(--gray-900, rgb(32, 33, 35))";this.elements.push(newElement);this.activateObserver();document.body.setAttribute("data-chatgptjs","observer-trigger");return newElement.id},hide:function(){this.isOn()?this.toggle():console.info("Sidebar already hidden!")},show:function(){this.isOff()?this.toggle():console.info("Sidebar already shown!")},isOff:function(){return!this.isOn()},isOn:function(){return chatgpt.browser.isMobile()?document.documentElement.style.overflow=="hidden":document.querySelector("#__next > div > div").style.visibility!="hidden"},toggle:function(){const isMobileDevice=chatgpt.browser.isMobile(),navBtnSelector=isMobileDevice?"#__next button":"main button",isToggleBtn=isMobileDevice?()=>true:btn=>Array.from(btn.querySelectorAll("*")).some(child=>child.style.transform.includes("translateY"));for(const btn of document.querySelectorAll(navBtnSelector))if(isToggleBtn(btn)){btn.click();return}}},startNewChat:function(){for(const navLink of document.querySelectorAll('nav[aria-label="Chat history"] a')){if(/(new|clear) chat/i.test(navLink.text)){navLink.click();return}}},stop:function(){for(const formButton of document.querySelectorAll("form button")){if(formButton.textContent.toLowerCase().includes("stop")){formButton.click();return}}},suggest:async function(ideaType,details){if(!ideaType)return console.error("ideaType (1st argument) not supplied"+"(e.g. 'gifts', 'names', 'recipes', etc.)");for(let i=0;i<arguments.length;i++)if(typeof arguments[i]!=="string")return console.error(`Argument ${i+1} must be a string.`);chatgpt.send("Suggest some names. "+(details||""));console.info(`Creating ${ideaType}...`);await chatgpt.isIdle();return chatgpt.getChatData("active","msg","chatgpt","latest")},speak:function(msg,options={}){const{voice=2,pitch=2,speed=1.1}=options;if(typeof msg!=="string")return console.error("Message must be a string!");for(let key in options){const value=options[key];if(typeof value!=="number"&&!/^\d+$/.test(value))return console.error(`Invalid ${key} index '${value}'. Must be a number!`)}try{const voices=speechSynthesis.getVoices(),utterance=new SpeechSynthesisUtterance;utterance.text=msg;utterance.voice=voices[voice];utterance.pitch=pitch;utterance.rate=speed;speechSynthesis.speak(utterance)}catch(err){console.error(err)}},summarize:async function(text){if(!text)return console.error("Text (1st) argument not supplied. Pass some text!");if(typeof text!=="string")return console.error("Text argument must be a string!");chatgpt.send("Summarize the following text:\n\n"+text);console.info("Summarizing text...");await chatgpt.isIdle();return chatgpt.getChatData("active","msg","chatgpt","latest")},toggleScheme:function(){chatgpt.settings.scheme.toggle()},translate:async function(text,outputLang){if(!text)return console.error("Text (1st) argument not supplied. Pass some text!");if(!outputLang)return console.error("outputLang (2nd) argument not supplied. Pass a language!");for(let i=0;i<arguments.length;i++)if(typeof arguments[i]!=="string")return console.error(`Argument ${i+1} must be a string!`);chatgpt.send("Translate the following text to "+outputLang+". Only reply with the translation.\n\n"+text);console.info("Translating text...");await chatgpt.isIdle();return chatgpt.getChatData("active","msg","chatgpt","latest")},unminify:function(){chatgpt.code.unminify()},uuidv4:function(){let d=(new Date).getTime();const uuid="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,c=>{const r=(d+window.crypto.getRandomValues(new Uint32Array(1))[0]/(Math.pow(2,32)-1)*16)%16|0;d=Math.floor(d/16);return(c=="x"?r:r&3|8).toString(16)});return uuid},writeCode:function(){chatgpt.code.write()}};chatgpt.scheme={...chatgpt.settings.scheme};const buttonActions=["click","get"],targetTypes=["button","link","div","response"];for(const buttonAction of buttonActions){chatgpt[buttonAction+"Button"]=function handleButton(buttonIdentifier){const button=/^[.#]/.test(buttonIdentifier)?document.querySelector(buttonIdentifier):/send/i.test(buttonIdentifier)?document.querySelector('form button[class*="bottom"]'):/scroll/i.test(buttonIdentifier)?document.querySelector('button[class*="cursor"]'):function(){for(const button of document.querySelectorAll("button")){if(button.textContent.toLowerCase().includes(buttonIdentifier.toLowerCase())){return button}}for(const navLink of document.querySelectorAll("nav a")){if(navLink.textContent.toLowerCase().includes(buttonIdentifier.toLowerCase())){return navLink}}}();if(buttonAction=="click"){button.click()}else{return button}}}const camelCaser=words=>{return words.map((word,index)=>index===0||word=="s"?word:word.charAt(0).toUpperCase()+word.slice(1)).join("")};for(const prop in chatgpt){for(const subAliases of functionAliases){if(subAliases.includes(prop)){if(subAliases.some(element=>element.includes("."))){const nestedFunction=subAliases.find(element=>element.includes(".")).split(".")[1];for(const nestAlias of subAliases){if(/^(\w+)/.exec(nestAlias)[1]!==prop){chatgpt[nestAlias]=chatgpt[prop][nestedFunction]}}}else{for(const dirAlias of subAliases){if(dirAlias!==prop){chatgpt[dirAlias]=chatgpt[prop]}}}}}do{var newFunctionsCreated=false;for(const funcName in chatgpt){if(typeof chatgpt[funcName]=="function"){const funcWords=funcName.split(/(?=[A-Zs])/);for(const funcWord of funcWords){const synonymValues=[].concat(...synonyms.filter(arr=>arr.includes(funcWord.toLowerCase())).map(arr=>arr.filter(synonym=>synonym!==funcWord.toLowerCase())));for(const synonym of synonymValues){const newFuncName=camelCaser(funcWords.map(word=>word==funcWord?synonym:word));if(!chatgpt[newFuncName]){chatgpt[newFuncName]=chatgpt[funcName];newFunctionsCreated=true}}}}}}while(newFunctionsCreated)}const consolePrefix="🤖 chatgpt.js >> ",ogError=console.error,ogInfo=console.info;console.error=(...args)=>{if(!args[0].startsWith(consolePrefix))ogError(consolePrefix+args[0],...args.slice(1));else ogError(...args)};console.info=msg=>{if(!msg.startsWith(consolePrefix))ogInfo(consolePrefix+msg);else ogInfo(msg)};try{window.chatgpt=chatgpt}catch(err){}try{module.exports=chatgpt}catch(err){}
package/docs/.nojekyll DELETED
File without changes
package/docs/CNAME DELETED
@@ -1 +0,0 @@
1
- chatgpt.js.org
@@ -1,16 +0,0 @@
1
- <!-- _coverpage.md -->
2
-
3
- <img class="logo" src="https://raw.githubusercontent.com/kudoai/chatgpt.js/main/media/images/chatgpt.js-logo-dark-mode-padded-7000x777.png">
4
-
5
- <blockquote>
6
- <p>
7
- <span id="tagline-pre-adj">🤖 A </span><span id="tagline-adj">Award-winning|User friendly|Powerful|Feature-rich|Lightweight|Popular|Easy-to-use|Open source</span><span id="tagline-post-adj"> client-side JavaScript library for ChatGPT_</span>
8
- </p>
9
- </blockquote>
10
-
11
- [GitHub](https://github.com/kudoai/chatgpt.js)
12
- [Get Started](#⚡-importing-the-library)
13
-
14
- <!-- background color -->
15
-
16
- ![color](transparent)
@@ -1,21 +0,0 @@
1
- # MIT License
2
-
3
- Copyright (c) 2023–2024 [Adam Lui](https://github.com/adamlui)
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
@@ -1,50 +0,0 @@
1
- /* ========================================================
2
- Script: minify.js
3
- Version: 2023.8.11
4
- Description: Minify all JavaScript in a directory
5
- Author: Adam Lui
6
- URL: https://github.com/adamlui/js-utils
7
- =========================================================== */
8
-
9
- // Import libs
10
- const fs = require('fs'),
11
- path = require('path'),
12
- uglifyJS = require('uglify-js');
13
-
14
- // Init config
15
- const inputDir = path.join(__dirname, '../assets/docsify/js/src'),
16
- outputDir = path.join(__dirname, '../assets/docsify/js/min');
17
-
18
- try { // to minify `inputDir` contents
19
- if (!fs.existsSync(outputDir)) fs.mkdirSync(outputDir, { recursive: true });
20
- minifyDirectory(inputDir, outputDir);
21
- } catch (err) { console.error('Error occurred during minification:', err.message); }
22
-
23
- // Define FUNCTIONS
24
-
25
- // Check if a file is already minified
26
- function isMinifiedFile(filename) { return filename.includes('.min.js'); }
27
-
28
- // Minify a single file
29
- function minifyFile(inputFilePath, outputFilePath) {
30
- console.log(`Minifying: ${inputFilePath}`);
31
- const code = fs.readFileSync(inputFilePath, 'utf8');
32
- const minifiedCode = uglifyJS.minify(code).code;
33
- fs.writeFileSync(outputFilePath, minifiedCode, 'utf8');
34
- }
35
-
36
- // Minify all files in a dir recursively
37
- function minifyDirectory(inputDir, outputDir) {
38
- fs.readdirSync(inputDir).forEach(file => {
39
- const inputFilePath = path.join(inputDir, file);
40
- const stats = fs.statSync(inputFilePath);
41
- if (stats.isDirectory()) { // create corresponding output dir & continue minification
42
- const newOutputDir = outputDir; // keep track of output dir at this level
43
- fs.mkdirSync(newOutputDir, { recursive: true });
44
- minifyDirectory(inputFilePath, newOutputDir);
45
- } else if (stats.isFile() && file.endsWith('.js') && !isMinifiedFile(file)) { // proceed w/ minification
46
- const minFileName = path.basename(file, '.js') + '.min.js',
47
- minOutputFilePath = path.join(outputDir, minFileName);
48
- minifyFile(inputFilePath, minOutputFilePath);
49
- }
50
- });}
@@ -1,93 +0,0 @@
1
- Copyright © 2017 IBM Corp. with Reserved Font Name "Plex"
2
-
3
- This Font Software is licensed under the SIL Open Font License, Version 1.1.
4
- This license is copied below, and is also available with a FAQ at:
5
- http://scripts.sil.org/OFL
6
-
7
-
8
- -----------------------------------------------------------
9
- SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
10
- -----------------------------------------------------------
11
-
12
- PREAMBLE
13
- The goals of the Open Font License (OFL) are to stimulate worldwide
14
- development of collaborative font projects, to support the font creation
15
- efforts of academic and linguistic communities, and to provide a free and
16
- open framework in which fonts may be shared and improved in partnership
17
- with others.
18
-
19
- The OFL allows the licensed fonts to be used, studied, modified and
20
- redistributed freely as long as they are not sold by themselves. The
21
- fonts, including any derivative works, can be bundled, embedded,
22
- redistributed and/or sold with any software provided that any reserved
23
- names are not used by derivative works. The fonts and derivatives,
24
- however, cannot be released under any other type of license. The
25
- requirement for fonts to remain under this license does not apply
26
- to any document created using the fonts or their derivatives.
27
-
28
- DEFINITIONS
29
- "Font Software" refers to the set of files released by the Copyright
30
- Holder(s) under this license and clearly marked as such. This may
31
- include source files, build scripts and documentation.
32
-
33
- "Reserved Font Name" refers to any names specified as such after the
34
- copyright statement(s).
35
-
36
- "Original Version" refers to the collection of Font Software components as
37
- distributed by the Copyright Holder(s).
38
-
39
- "Modified Version" refers to any derivative made by adding to, deleting,
40
- or substituting -- in part or in whole -- any of the components of the
41
- Original Version, by changing formats or by porting the Font Software to a
42
- new environment.
43
-
44
- "Author" refers to any designer, engineer, programmer, technical
45
- writer or other person who contributed to the Font Software.
46
-
47
- PERMISSION & CONDITIONS
48
- Permission is hereby granted, free of charge, to any person obtaining
49
- a copy of the Font Software, to use, study, copy, merge, embed, modify,
50
- redistribute, and sell modified and unmodified copies of the Font
51
- Software, subject to the following conditions:
52
-
53
- 1) Neither the Font Software nor any of its individual components,
54
- in Original or Modified Versions, may be sold by itself.
55
-
56
- 2) Original or Modified Versions of the Font Software may be bundled,
57
- redistributed and/or sold with any software, provided that each copy
58
- contains the above copyright notice and this license. These can be
59
- included either as stand-alone text files, human-readable headers or
60
- in the appropriate machine-readable metadata fields within text or
61
- binary files as long as those fields can be easily viewed by the user.
62
-
63
- 3) No Modified Version of the Font Software may use the Reserved Font
64
- Name(s) unless explicit written permission is granted by the corresponding
65
- Copyright Holder. This restriction only applies to the primary font name as
66
- presented to the users.
67
-
68
- 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
69
- Software shall not be used to promote, endorse or advertise any
70
- Modified Version, except to acknowledge the contribution(s) of the
71
- Copyright Holder(s) and the Author(s) or with their explicit written
72
- permission.
73
-
74
- 5) The Font Software, modified or unmodified, in part or in whole,
75
- must be distributed entirely under this license, and must not be
76
- distributed under any other license. The requirement for fonts to
77
- remain under this license does not apply to any document created
78
- using the Font Software.
79
-
80
- TERMINATION
81
- This license becomes null and void if any of the above conditions are
82
- not met.
83
-
84
- DISCLAIMER
85
- THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
86
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
87
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
88
- OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
89
- COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
90
- INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
91
- DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
92
- FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
93
- OTHER DEALINGS IN THE FONT SOFTWARE.