From e960190f7a3d27babb0b87383aa7e610b61d7ad8 Mon Sep 17 00:00:00 2001 From: Rizal Nurhidayat Date: Mon, 16 May 2022 17:42:16 +0700 Subject: [PATCH] chore(build): build & bump new version --- assets/wayfu-style.min.css | 2 +- update.meta.js | 31 ++++++++++++++++++++++++++++++- wayfu-install.user.js | 6 +++--- 3 files changed, 34 insertions(+), 5 deletions(-) diff --git a/assets/wayfu-style.min.css b/assets/wayfu-style.min.css index b4d48ad..1197216 100644 --- a/assets/wayfu-style.min.css +++ b/assets/wayfu-style.min.css @@ -1,5 +1,5 @@ /*! -* WayFu - Easy Follow Up v4.0.4 (https://wayfu.id/) +* WayFu - Easy Follow Up v4.0.5 (https://wayfu.id/) * Copyright 2018-2022, Rizal Nurhidayat (https://github.com/rzlnhd) * Licensed under CC BY-NC-ND 4.0; https://creativecommons.org/licenses/by-nc-nd/4.0/. */ diff --git a/update.meta.js b/update.meta.js index 007a928..7ef6f1d 100644 --- a/update.meta.js +++ b/update.meta.js @@ -1,5 +1,34 @@ // ==UserScript== // @name WayFu - Easy Follow Up -// @version 4.0.4 +// @description WhatsApp Easy Follow Up. +// @date 2022-05-16 +// @copyright 2018, Rizal Nurhidayat (https://github.com/rzlnhd) +// @license CC BY-NC-ND 4.0; https://creativecommons.org/licenses/by-nc-nd/4.0/ +// @icon https://wayfu.id/v4/assets/wayfu-icon.webp +// @homepage https://wayfu.id/ +// @supportURL https://wayfu.id/ +// @version 4.0.5 +// @author Rizal Nurhidayat (https://github.com/rzlnhd) +// @match https://web.whatsapp.com/* +// @grant GM_addStyle +// @grant GM_getValue +// @grant GM_setValue +// @grant GM_deleteValue +// @grant GM_listValues +// @grant GM_xmlhttpRequest +// @grant GM_getResourceText +// @grant GM_getResourceURL +// @grant GM_log +// @grant GM_openInTab +// @grant GM_setClipboard +// @grant GM_info +// @grant GM_notification +// @connect wayfu.id +// @updateURL https://wayfu.id/v4/update.meta.js +// @downloadURL https://wayfu.id/v4/wayfu-install.user.js +// @resource ico https://wayfu.id/v4/assets/wayfu-icon.webp +// @resource pnl https://wayfu.id/v4/assets/wayfu-view.html +// @resource clr https://wayfu.id/v4/assets/wayfu-colors.json +// @resource css https://wayfu.id/v4/assets/wayfu-style.min.css // ==/UserScript== diff --git a/wayfu-install.user.js b/wayfu-install.user.js index 87ba939..cff10b4 100644 --- a/wayfu-install.user.js +++ b/wayfu-install.user.js @@ -1,13 +1,13 @@ // ==UserScript== // @name WayFu - Easy Follow Up // @description WhatsApp Easy Follow Up. -// @date 2022-04-17 +// @date 2022-05-16 // @copyright 2018, Rizal Nurhidayat (https://github.com/rzlnhd) // @license CC BY-NC-ND 4.0; https://creativecommons.org/licenses/by-nc-nd/4.0/ // @icon https://wayfu.id/v4/assets/wayfu-icon.webp // @homepage https://wayfu.id/ // @supportURL https://wayfu.id/ -// @version 4.0.4 +// @version 4.0.5 // @author Rizal Nurhidayat (https://github.com/rzlnhd) // @match https://web.whatsapp.com/* // @grant GM_addStyle @@ -32,4 +32,4 @@ // @resource css https://wayfu.id/v4/assets/wayfu-style.min.css // ==/UserScript== -"use strict";var __webpack_exports__={};class HtmlModifier{constructor(){}getElement(e,...t){let s=null,n=!1;return 0!==t.length&&(s=t[0]instanceof window.HTMLElement?t[0]:"string"==typeof t[0]?document.querySelector(t[0].trim()):null,n="boolean"==typeof t[0]?t[0]:null!=t[1]&&t[1]),"string"==typeof e?(e=e.trim(),n?(s||document).querySelectorAll(e):(s||document).querySelector(e)):e instanceof window.HTMLElement||e instanceof window.NodeList?e:void 0}getParents(e,t){Element.prototype.matches||(Element.prototype.matches=Element.prototype.matchesSelector||Element.prototype.mozMatchesSelector||Element.prototype.msMatchesSelector||Element.prototype.oMatchesSelector||function(e){for(var t=(this.document||this.ownerDocument).querySelectorAll(e),s=t.length;--s>=0&&t.item(s)!==this;);return s>-1});let s=[],n=this.getElement(e);for(;n&&n!==document;n=n.parentNode)t?n.matches(t)&&s.push(n):s.push(n);return s}createElement(e){let t,s,n;for(const a in e)if(e.hasOwnProperty(a))switch(a){case"tag":s=document.createElement(e[a]);break;case"text":n="innerText"in document?"innerText":"textContent",s[n]=e[a];break;case"html":s.innerHTML=e[a];break;case"classid":if("array"==typeof e[a])for(let t of e[a])s.classList.add(t);else"string"==typeof e[a]&&(s.className=e[a]);break;case"append":t=this.getElement(e[a]),t.appendChild(s);break;case"prepend":t=this.getElement(e[a]),t.childNodes.length?t.insertBefore(s,t.childNodes[0]):t.appendChild(s);break;case"before":t=this.getElement(e[a]),t.parentNode.insertBefore(s,t);break;case"after":t=this.getElement(e[a]),t.parentNode.insertBefore(s,t.nextSibling);break;case"replace":t=this.getElement(e[a]),t.parentNode.replaceChild(s,t);break;case"event":for(const t in e.event)e.event.hasOwnProperty(t)&&this.onEvent(s,t,e.event[t]);break;case"callback":e[a](s);break;default:s.setAttribute(a,e[a])}return s}createElements(e=[],t){if(t=t?t instanceof window.HTMLElement?t:"object"==typeof t&&null!=t.tag?this.createElement(t):null:null,"object"==typeof e)for(let s of e)t&&(s.append=t),this.createElement(s);return t||this}createListElement(e,t,s={}){let n=this.createElement(Object.assign({tag:e||"ol"},s));return Array.isArray(t)&&t.forEach((t=>{if("object"==typeof t){let s=this.createElement({tag:"li",html:t.title,append:n});Array.isArray(t.content)&&this.createListElement(e||"ol",t.content,{append:s})}else"string"==typeof t&&this.createElement({tag:"li",html:t,append:n})})),n}createSVGElement(e){const{size:t,d:s,dPath:n,fill:a,viewBox:i}=e,r=this.createElement({tag:"path",d:s||n,fill:a||"currentColor"}),o={width:"16",height:"16"};if(t&&"string"==typeof t){let[e,s]=t.split(" ");o.width=e||o.width,o.height=s||o.height}return this.createElement({tag:"svg",width:o.width,height:o.height,viewBox:i,html:r.outerHTML})}setElementStyle(e,t){const s=e instanceof window.HTMLElement?[e]:this.getElement(e,!0);if(s&&0!==s.length&&s[0])for(const e of s)for(const s in t)if(t.hasOwnProperty(s))switch(s){case"zIndex":e.style.zIndex=t[s];break;case"margin":e.style.margin=t[s];break;case"padding":e.style.padding=t[s];break;case"display":e.style.display=t[s];break;default:e.style[s]=t[s]}return this}setElementsStyle(e,t){return Array.isArray(e)?e.forEach((e=>{this.setElementStyle(e.elm,e.props)})):"string"==typeof e&&this.getElement(e,!0).forEach((e=>{this.setElementStyle(e,t)})),this}setElement(e,t){const s=e instanceof window.HTMLElement?[e]:this.getElement(e,!0);let n;if(s&&0!==s.length&&s[0])for(const e of s)for(const s in t)if(t.hasOwnProperty(s))switch(s){case"text":n="innerText"in document?"innerText":"textContent",e[n]=t[s];break;case"html":e.innerHTML=t[s];break;case"class":e.className=t[s];break;case"addClass":e.classList.add(t[s]);break;case"removeClass":e.classList.remove(t[s]);break;case"toggleClass":e.classList.toggle(t[s]);break;case"disabled":e.disabled=t[s];break;case"value":e.value=t[s];break;case"dispatch":e.dispatchEvent(t[s]);break;case"readonly":case"readOnly":e.readOnly=t[s];break;default:e.setAttribute(s,t[s])}return this}setElements(e=[]){return Array.isArray(e)&&e.forEach((e=>{this.setElement(e.elm,e.props)})),this}hasElement(e,t=10){return new Promise((s=>{let n=setInterval((()=>{let a=this.getElement(e);a&&(s(a),clearInterval(n)),(t-=!1)&&(s(!1),clearInterval(n))}),1e3)}))}insertElement(e,t){return this.getElement(t||"body").appendChild(this.getElement(e)),this}removeElement(e,t){return this.getElement(t||"body").removeChild(this.getElement(e)),t||this}onEvent(e,t,s,n=!1){let a=this.getElement(e);return window.addEventListener&&(a||window).addEventListener(t,s,n),this}eventFire(e,t,s,n={bubbles:!0,composed:!0}){return this.setElement(e,{text:s||"",dispatch:t?new InputEvent(t,n):new MouseEvent("mousedown",n)}),this}addStyle(e,t={}){const s={tag:"style",html:e,append:"head"};return this.createElement(Object.assign({},s,t)),this}}const DOM=new HtmlModifier;class MyArray extends Array{get isEmpty(){return this.length<=0}changeIndex(e,t){if(t>=this.length){let e=t-this.length+1;for(;e--;)this.push(void 0)}return this.splice(t,0,this.splice(e,1)[0]),this}countValue(e){let t=0;return this.forEach((s=>{t+=s===e?1:0})),t}isOnArray(e){return this.some((t=>e===t))}static split(e,t){let s=e.split(t);return new MyArray(...s)}}class MyDate extends Date{addDays(e){let t=new MyDate(this.valueOf());return t.setDate(t.getDate()+e),t}addMonths(e){let t=new MyDate(this.valueOf());return t.setMonth(t.getMonth()+Number(e)),t}}const rgx={forVersion:/^\d+((\.|-)\d+[A-Za-z]?)*$/,phonePattern:/^(?:[\+\d]?[\- \d]{10,})$/,phoneValue:/^[0\+]*(?:(\d{9,})|([\d]{1,3}(?:[\- ]?[\d]{2,})+))$/,datePattern:/\d{1,4}[\/|-|:]\d{1,2}[\/|-|:]\d{2,4}/,formatedDate:/^\d{4}[\/|-|:]\d{1,2}[\/|-|:]\d{1,2}$/},eventLists=[{element:"#panelBody .menus",type:"click",event:"tabMenu"},{element:"#_mode",type:"click",event:"autoMode"},{element:"#useImage",type:"click",event:"useImage"},{element:"#getFile",type:"change",event:"loadData"},{element:"#imgFile",type:"change",event:"imagePreview"},{element:"#_deleteImg",type:"click",event:"imagePreview"},{element:"#toggleApp",type:"click",event:"toggleApp"},{element:"._input input[type='range']",type:"input",event:"inputRange"},{element:"._input input[type='checkbox']",type:"change",event:"inputChecks"},{element:"._input select",type:"change",event:"inputSelects"},{element:"#changeLogs",type:"click",event:"changeLog"},{element:"#_blast",type:"click",event:"runTasks"}],queryElm={send:"#main span[data-testid^='send']",input:"#main div[contenteditable='true']",linkElm:"div#panelBody span#_api-link a",errModal:".overlay div[role^='button']",chatMessage:"#main div.message-out"},dateOptDefault={year:"numeric",month:"long",day:"numeric"},storeObjects=[{id:"Store",conditions:e=>e.default&&e.default.Chat&&e.default.Msg?e.default:null},{id:"WebClasses",conditions:e=>e.default&&"object"==typeof e.default&&e.default.chat&&e.default.active?e.default:null},{id:"MediaCollection",conditions:e=>e.default&&e.default.prototype&&e.default.prototype.processAttachments?e.default:null},{id:"Features",conditions:e=>e.FEATURE_CHANGE_EVENT&&e.GK?e.GK:null},{id:"Debug",conditions:e=>e.Debug?e.Debug:null},{id:"Conn",conditions:e=>e.PLATFORMS&&e.Conn?e.Conn:null}],useComma=e=>{let t=String.raw`^\s*(?:'[^'\\]*(?:\\[\S\s][^'\\]*)*'|"[^"\\]*(?:\\[\S\s][^"\\]*)*"|[^,;"\s\\]*(?:\s+[^,;"\s\\]+)*)\s*(?:,\s*(?:'[^'\\]*(?:\\[\S\s][^'\\]*)*'|"[^"\\]*(?:\\[\S\s][^"\\]*)*"|[^,;"\s\\]*(?:\s+[^,;"\s\\]+)*)\s*)*$`;return new RegExp(t).test(e)},isNumeric=e=>"string"==typeof e?!isNaN(e)&&!isNaN(parseFloat(e)):"number"==typeof e,isDateStr=e=>"string"==typeof e&&"Invalid Date"!==new Date(e).toString()&&!isNaN(new Date(e)),JSONParse=e=>new Promise((t=>{try{t(JSON.parse(e))}catch(e){t(null)}})),parseValue=e=>{var t;return"string"==typeof e&&(e=isNumeric(e)?Number(e):"string"!=typeof(t=e)||"Invalid Date"===new Date(t).toString()||isNaN(new Date(t))?e:new MyDate(e)),e},rowValue=(e=",",t="")=>{let s=","==e?`${e};`:e,n=String.raw`(?!\s*$)\s*(?:'([^'\\]*(?:\\[\S\s][^'\\]*)*)'|"([^"\\]*(?:\\[\S\s][^"\\]*)*)"|([^${s}"\s\\]*(?:\s+[^${s}"\s\\]+)*))\s*(?:${e}|$)`;return t?new RegExp(n,t):new RegExp(n)},isUpToDate=(e,t)=>{const{forVersion:s}=rgx;if(!e||!t||0===e.length||0===t.length)return!1;if(e==t)return!0;if(s.test(e)&&s.test(t)){let s=e.includes(".")?".":"-",n=e.split(s).map((e=>isNumeric(e)?Number(e):e)),a=t.split(s).map((e=>isNumeric(e)?Number(e):e));for(let e=0;ea[e]}{let[t,s]=[Number(/\d+/.exec(n[e])),Number(/\d+/.exec(a[e]))],[i,r]=[/[A-Za-z]/.exec(n[e]),/[A-Za-z]/.exec(a[e])];if(t==s){if(i&&r&&i[0]==r[0])continue;return i&&r?i[0]>r[0]:!!i}return t>s}}}return e>=t},getSignDate=e=>(e=rgx.datePattern.exec(e))?e.toString():null,setName=(e,t=!1)=>{let s=[];return e.split(" ").forEach((e=>{s.push(titleCase(e))})),t?s.join(" "):s[0]},titleCase=e=>(e=e.toLowerCase()).charAt(0).toUpperCase()+e.slice(1),setPhone=e=>(e="string"==typeof e?e:e.join("")).replace(rgx.phoneValue,(function(e,t,s){let n=void 0!==t?t:s.replace(/(\-| )/g,"");return("8"===n.charAt(0)&&"+"!==e.charAt(0)?"62":"")+n})),dateFormat=(e,t=0)=>new Date(e).toLocaleDateString("id-ID",Object.assign({},dateOptDefault,{weekday:0==t?"long":void 0})),monthIndex=e=>{if(rgx.formatedDate.test(e[0]))return 2;let t=new MyArray,s=new MyArray;return e.forEach(((e,n)=>{[t[n],s[n]]=e.split(/\/|:|-/)})),t.some((e=>e>12))||s.some((e=>e>12))?t.some((e=>e>12))?1:0:t.countValue(t[0])>s.countValue(s[0])?0:1},isValidRow=(e,t)=>{const s=CSVtoArray(e,t),n=e=>rgx.phonePattern.test(e);return!!(""!=e&&s&&s.length>=2)&&!!s.some((e=>n(e)))&&(s.forEach(((e,t)=>{var a;s[t]=/^"(.*)"$/.test(e)?e.replace(/(^")|("$)/g,""):s[t],s[t]=n(e)?(a="string"==typeof(a=e)?a:a.join("")).replace(rgx.phoneValue,(function(e,t,s){let n=void 0!==t?t:s.replace(/(\-| )/g,"");return("8"===n.charAt(0)&&"+"!==e.charAt(0)?"62":"")+n})):isNumeric(e)?Number(e).toString():s[t]})),s)},CSVtoArray=(e,t=",")=>{let s=new MyArray;return e.replace(rowValue(t,"g"),(function(e,t,n,a){return void 0!==t?s.push(t.replace(/\\'/g,"'")):void 0!==n?s.push(n.replace(/\\"/g,'"')):void 0!==a&&s.push(a.replace(/^['"]?(.*)['"]?$/,"$1")),""})),/,\s*$/.test(e)&&s.push(""),s},loadFile=e=>{const t=e.length>1&&""!=e[1]?1:0,s=new MyArray,n=new MyArray,a=useComma(e[t])?",":";";let i,r;return e.forEach((e=>{var t;(i=isValidRow(e,a))&&(s.push(i),t=i,(r=(t=rgx.datePattern.exec(t))?t.toString():null)&&n.push(r))})),{option:{monthIndex:!n.isEmpty&&monthIndex(n),splitter:a},data:s}},exportToCsv=(e,t,s)=>{const n=function(e){let t="";for(let s=0;s=0&&(a='"'+a+'"'),s>0&&(t+=","),t+=a}return t+"\n"};let a="";for(let e=0;et[s]=e)):"object"==typeof e&&(t=e),0!==Object.keys(t).length)for(const e in t)t[e]=parseValue(t[e]);return t}findObjectValue(e,t){let s;return t=t||this,Object.keys(t).some((n=>n===e?(s=t[n],!0):t[n]&&"object"==typeof t[n]?(s=this.findObjectValue(e,t[n]),void 0!==s):void 0)),s}}class GM_Library extends BaseModel{constructor(){super()}get appInfo(){return this.getInfo("script")}get managerName(){return"object"!=typeof GM_info?"function"==typeof GM_getMetadata?"Scriptish":"undefined"!=typeof GM_setValue&&"undefined"==typeof GM_getResourceText&&"undefined"==typeof GM_getResourceURL&&"undefined"==typeof GM_openInTab&&"undefined"==typeof GM_setClipboard?"NinjaKit":"Native":void 0!==GM_info.uuid?"Greasemonkey":void 0!==GM_info.scriptHandler?"Tampermonkey":void 0}getInfo(e=""){return GM_info?""===e?GM_info:this.findObjectValue(e,GM_info):null}getResource(e,t="text"){return"undefined"!=typeof GM_getResourceText&&"text"===t?GM_getResourceText(e):"undefined"!=typeof GM_getResourceURL&&"url"===t?GM_getResourceURL(e):void 0}deleteValue(e){if("undefined"!=typeof GM_deleteValue){const t=GM_listValues();for(const s of t)e&&e!==s||GM_deleteValue(s)}}setValue(e,t){"undefined"!=typeof GM_setValue&&GM_setValue(e,t)}getValue(e,t=null){if("undefined"!=typeof GM_listValues&&"undefined"!=typeof GM_getValue){const s=GM_listValues();if(0!==s.length&&s.some((t=>e===t)))return GM_getValue(e,t)}return t}request(e){e.url=e.url||this.appInfo.homepage,e.method=e.method||"GET",e.headers=e.headers||{},e.timeout=e.timeout||2e4,(e.data||"POST"==e.method)&&(e.method="POST",e.data=this.serialize(e.data||{}),e.headers=Object.assign({},e.headers,{"X-Requested-With":"XMLHttpRequest","Content-Type":"application/x-www-form-urlencoded"}));const t=e.onload,s=e.onerror,n=e.ontimeout,a=e.onabort;e.onload=function(e){t(e)},e.onerror=function(e){console.log(`request error: ${e.error||"unknown error"}`),s(e)},e.ontimeout=function(e){console.log(`request error: ${e.error||"timed out"}`),n(e)},e.onabort=function(e){console.log(`request error: ${e.error||"aborted"}`),a(e)},"undefined"!=typeof GM_xmlhttpRequest?GM_xmlhttpRequest(e):console.log("XHR not Allowed!")}}class Modals{constructor(){this.contens=0,this.element=DOM.createElement({tag:"div",id:"wayfu-modal",classid:"wfu-modal",role:"alert"})}construct(e=!1,t,s=""){return new Promise((n=>{let a=`wfu-content-${this.contens+=1}`,i=DOM.createElement({tag:"div",classid:"wfu-modal-container",id:a});if(s&&DOM.createElement({tag:"h2",text:s,append:i}),t&&(t instanceof window.HTMLElement?DOM.insertElement(t,i):"string"==typeof t?DOM.createElement({tag:"p",html:t,append:i}):"object"==typeof t&&DOM.createElement(Object.assign({tag:"p",append:i},t))),e){let e=DOM.createElement({tag:"ul",classid:"wfu-buttons",append:i}),t=[{tag:"a",classid:"wfu-btn-ok",text:"Ya",event:{click:e=>{this.closed(e),n(!0)}}},{tag:"a",classid:"wfu-modal-close",text:"Tidak",event:{click:e=>{this.closed(e),n(!1)}}}];for(let s of t){let t=DOM.createElement({tag:"li",append:e});DOM.createElement(Object.assign({},s,{append:t}))}}else DOM.createElement({tag:"a",href:"#",html:"×",classid:"wfu-btn-close img-replace wfu-modal-close",append:i,event:{click:this.closed}});DOM.onEvent(window,"click",this.closed).insertElement(i,this.element),this.show()}))}async alert(e,t=""){return await this.construct(!1,e,t)}async confirm(e,t=""){return await this.construct(!0,e,t)}progressPanel(e,t=!1,s=null){if(e){let e=`wfu-content-${this.contens+=1}`,n=DOM.createElement({tag:"div",classid:"wfu-modal-container progress-panel",id:e}),a=[{tag:"h2",text:t?"Pesanmu sedang dikirim":"Linkmu sedang ditulis"},{tag:"div",html:"
",classid:"waProgress"},{tag:"p",html:(t?"Mengirim pesan ke ":"Menulis link ")+"()"},{tag:"a",href:"#",html:"×",classid:"wfu-btn-close img-replace",event:{click:s}}];n=DOM.createElements(a,n),DOM.insertElement(n,"#wayfu-modal"),this.show()}else{let e=DOM.getElement(".wfu-modal-container.progress-panel"),t=DOM.getElement(".wfu-modal-container",!0),s=DOM.getElement("#wayfu-modal");e&&DOM.removeElement(e,s),s&&0===t.length&&s.classList.remove("is-visible")}}show(){DOM.getElement("#wayfu-modal")||DOM.insertElement(this.element),DOM.getElement("#wayfu-modal").classList.add("is-visible")}closed(e){const t=e.target,s=DOM.getElement("#wayfu-modal"),n=DOM.getParents(t,".wfu-modal-container"),a=t.classList.contains("wfu-btn-ok");if(s&&(a||t.classList.contains("wfu-modal-close"))){0!==n.length&&DOM.removeElement(n[0],s);const e=DOM.getElement(".wfu-modal-container",!0);s&&0===e.length&&s.classList.remove("is-visible")}}}const modal=new Modals;class Settings extends GM_Library{constructor(){super(),this.default={themeColor:"var(--butterbar-connection-background)",autoMode:!1,hasImage:!1,imageFile:null,useImage:!1,fileName:"",activeTab:0,targetBp:100,maxQueue:500,dateFormat:"auto",openPanel:!0,useCaption:"caption",userType:"umum",splitter:",",monthIndex:0,isFormat:!1,alert:!0,queueLimit:1e3,bpLimit:300}}init(){const e=this.getValue("wayfu-options"),t=Object.assign({},this.default,this.intoObject(e));return this.setOptions(t).colorList()}setOptions(e={}){if(e!=={}){e=this.intoObject(e);for(let t in e)this.setOption(t,e[t])}return this}setOption(e,t){return t=parseValue(t),(this.hasOwnProperty(e)||this.default.hasOwnProperty(e))&&(this[e]=t),this.fillList().save()}fillList(){return Object.entries(this).forEach((e=>{const[t,s]=e,n=DOM.getElement(`#${t}`);n&&("checkbox"==n.type?n.checked=s:n.value=s)})),DOM.getElement("._input input[type='range']",!0).forEach((e=>{DOM.setElements([{elm:e,props:{max:"maxQueue"==e.id?this.queueLimit:this.bpLimit}},{elm:DOM.getElement("output",e.parentElement),props:{text:e.value}}])})),"oriflame"===this.userType&&DOM.setElementStyle(".panel-options .oriflame",{display:"flex"}),this}colorList(){let e=this.getResource("clr");return e="string"==typeof e?JSON.parse(e):e,e=Array.isArray(e)?e:e.colors,e.forEach((e=>{let t={tag:"option",value:e.key,text:e.val,append:"select#themeColor"};DOM.createElement(t)})),this}save(){const e=new MyArray("useImage","hasImage","imageFile","fileName","autoMode","alert","bpLimit","queueLimit","default"),t={};for(let s in this)this.default.hasOwnProperty(s)&&!e.isOnArray(s)&&(t[s]=this[s]);this.setValue("wayfu-options",t)}}const options=new Settings;class Users extends GM_Library{constructor(){super(),this.today=new MyDate,this.defaultOpt={method:"POST",url:`${this.appInfo.homepage}user/api`,headers:{"Content-Type":"application/json"}}}get isPremium(){return!!this.end&&this.today{let t=Object.assign({},this.defaultOpt,{data:JSON.stringify({phone:this.phone,version:this.appInfo.version}),onload:async t=>{const{status:s,responseText:n}=t;let a=null;200===s&&(a=await JSONParse(n)),user.setUser(a),e(200===s&&a)},onerror:e=>user.setUser(null),ontimeout:e=>user.setUser(null),onabort:e=>user.setUser(null)});this.request(t)}))}updateData(e){if(!e)return this;if((e=this.intoObject(e)).phone!==this.phone)return this;for(const t in e)"today"!==t&&(this[t]=e[t]);return this.end=this.reg&&this.mon?new MyDate(this.reg).addMonths(this.mon):this.end||null,this}setUser(e){const t=e||this.getValue("wayfu-user");t&&null!=t&&""!==t&&(this.reset().updateData(t).save(),options.setOption("userType",this.type)),this.isPremium||this.isTrial?this.showAlert(this.isPremium?0:1):setTimeout((()=>{this.gettingData()}),2e4)}async check(){return this.isPremium||await this.tryApp()}async tryApp(){return this.expires||this.isTrial?this.isTrial:!!await modal.confirm("Coba WayFu Gratis!","Apakah Anda mau mencoba 2 hari Trial?")&&await this.updateTrial()}updateTrial(e="add"){const t={version:this.appInfo.version,phone:this.phone,name:this.name,action:e},s={};return"add"===e?s.expires=new MyDate(this.today).addDays(2).toLocaleString("id-ID"):s.attempt=this.attempt+=1,new Promise(((e,n)=>{let a=Object.assign({},this.defaultOpt,{data:JSON.stringify(Object.assign({},t,s)),onload:async t=>{const{status:s,responseText:n}=t;let a=null;200===s&&(a=await JSONParse(n)),user.setUser(a),e(200===s&&a)},onerror:t=>e(!1),ontimeout:t=>e(!1),onabort:t=>e(!1)});this.request(a)}))}showAlert(e,t=!1){const s=[{title:`Halo kak ${setName(this.name,!0)}!`,text:`Selamat menggunakan fitur Pengguna Premium.\n\n Masa aktif Kakak berakhir hari ${dateFormat(this.end)} ya...`},{title:`Halo! Selamat Datang di ${this.appInfo.name}!`,text:`Anda dapat menggunakan fitur kirim otomatis sebanyak ${5-this.attempt} kali lagi,\n Masa Trial Anda berakhir hari ${dateFormat(this.expires)} ya...`},{title:`${this.appInfo.name} - Fitur Premium`,text:"Maaf, fitur ini hanya untuk Pengguna Premium. Informasi lebih lanjut, silahkan hubungi saya."},{title:`${this.appInfo.name} - Trial Mode`,text:`Saat ini Anda sedang menggunakan versi Trial. Anda masih dapat menggunakan fitur kirim otomatis sebanyak ${5-this.attempt} kali lagi.`},{title:`${this.appInfo.name} - Trial Mode`,text:"Masa Trial Anda sudah berakhir. Silahkan berlanganan untuk menggunakan fitur premium."}],{title:n,text:a}=s[e];let i=options.alert||t?(modal.alert(a,n),!1):options.alert;options.setOption("alert",i)}reset(){const e=new MyArray("attempt","type","reg","mon","end","expires");for(let t in this)this.hasOwnProperty(t)&&e.isOnArray(t)&&delete this[t];return this.init()}save(){const e=new MyArray("name","phone","attempt","type","reg","mon","end","expires"),t={};for(let s in this)if(this.hasOwnProperty(s)&&e.isOnArray(s)){let e=this[s]instanceof Date?this[s].toISOString():this[s];t[s]=e}this.setValue("wayfu-user",t)}}const user=new Users;class Chatroom{constructor(){this.chat,this.chatClass=""}get selected(){return""!==this.chatClass&&(this.chat=DOM.getElement(`div.${this.chatClass}`),!!this.chat)}init(e){return this.chatClass=e,this}}const chat=new Chatroom;class Reports{constructor(){this.sukses=0,this.gagal=new MyArray,this.error=new MyArray,this.auto=!1}reset(e){this.sukses=0,this.gagal=new MyArray,this.error=new MyArray,this.auto=e}createData(e){let t=this[e]||new MyArray;return{count:t.length,data:t}}success(){this.sukses++}fail(e,t=1){t?this.error.push(e):this.gagal.push(e)}}const report=new Reports;class Interval{constructor(){this.timer=!1,this.time=null,this.fn=null}get isRunning(){return!1!==this.timer}set(e,t){this.time=e,this.fn=t}start(e=null){this.isRunning||(this.timer=setInterval(this.fn,this.time)),e&&"function"==typeof e&&e(!0)}break(e=null){this.isRunning&&(clearInterval(this.timer),this.timer=!1),e&&"function"==typeof e&&e(!1)}stop(e=null){this.fn=null,this.time=null,this.break(e)}}const loop=new Interval;class Queue{constructor(){this.currentIndex=0,this.queue=new MyArray,this.stock=new MyArray,this.offset=0}get isEmpty(){return this.queue.isEmpty}get now(){return this.queue.isEmpty?void 0:this.queue[this.offset]}get size(){return this.queue.length-this.offset}get long(){return this.stock.length}setData(e){this.queue=e,this.stock=e}run(){if(this.queue.isEmpty)return;let e=this.queue[this.offset];return 2*++this.offset>=this.queue.length&&(this.queue=this.queue.slice(this.offset),this.offset=0),e}reset(){this.queue=new MyArray,this.stock=new MyArray,this.offset=0,this.currentIndex=0}reload(){this.queue=this.stock,this.currentIndex=0,this.offset=0}}const queue=new Queue;class Changelog extends GM_Library{constructor(){super();const e=this.getValue("wayfu-changelog",new MyArray);this.details=0!==e.length?new MyArray(...e):new MyArray}get getChanges(){const{homepage:e}=this.appInfo;return new Promise((t=>{let s={url:`${e}files/changelog.json`,onload:e=>{const{status:s,responseText:n}=e;if(200===s){let e=JSON.parse(n);e=Array.isArray(e)?e:e.changelog,t(e)}else t(200===s)}};this.request(s)}))}get Log(){return this.details}async doUpdate(e){const t=/\d+((\.|-)\d+[A-Za-z]?)*/.exec(e)[0],{version:s,name:n,downloadURL:a}=this.appInfo;if(!isUpToDate(s,t)){const e=`${n} ${t} sudah tersedia, perbaharui sekarang?`;await modal.confirm(e)&&(window.location.href=a)}}async checkUpdate(){const{updateURL:e}=this.appInfo,t=new Promise((t=>{const s={url:`${e}`,onload:e=>{const{status:s,responseText:n}=e;t(200===s&&n)}};this.request(s)}));return this.details=new MyArray(...await this.getChanges),this.save(),this.doUpdate(await t),this}save(){this.setValue("wayfu-changelog",this.details)}}const changes=new Changelog;class Messages extends BaseModel{constructor(){super(),this.apiLink="api.whatsapp.com/send?phone=",this.inputMessage="",this.inputCaption="",this.imageFile="",this.idNumber="",this.name="",this.phone="",this.poinValue="",this.date="",this.sponsorName="",this.other=[]}setData(e){var t;[this.idNumber,this.name,this.phone,this.poinValue,this.date,this.sponsorName,...this.other]=(t=e[2],rgx.phonePattern.test(t)?e:["",...e])}get encodedMsg(){const{autoMode:e,useImage:t,hasImage:s,useCaption:n}=options,a=!e||!t||!s||"caption"===n,i=this.inputMessage&&a?this.subtitute(this.inputMessage):"";return""!==i?encodeURIComponent(i).replace(/'/g,"%27").replace(/\(/g,"%28").replace(/\)/g,"%29"):i}get link(){return this.apiLink+this.phone+`&text=${this.encodedMsg}`}setMessage(e,t,s){const n=e=>new RegExp(String.raw`(DATA_${e})(\s|\D|$)`,"g");if("oriflame"===options.userType){for(let n=t;n<3;n++){const t=rgx.datePattern.test(s),a=isNumeric(s);if(0===n&&a){const t=e=>{const t=options.targetBp-Number(e);return t>0?t:0};e=e.replace(/P_BP/g,`${s} BP`).replace(/K_BP/g,`${t(s)} BP`)}else 1===n&&t?e=e.replace(/L_DAY/g,this.lastDay(s)).replace(/S_DAY/g,this.lastDay(s,1)):2!==n||a||t||(e=e.replace(/F_INVS/g,setName(s,!0)).replace(/INVS/g,setName(s)))}return t>2?e.replace(n(t-2),`${s}$2`):e}return e.replace(n(t+1),`${s}$2`)}subtitute(e){if(""!==e&&null!==e){const t=[this.poinValue,this.date,this.sponsorName,...this.other];e=(e=e.replace(/F_NAMA/g,setName(this.name,!0)).replace(/NAMA/g,setName(this.name))).replace(/PHONE/g,this.phone),e=""!==this.idNumber?e.replace("oriflame"===options.userType?/NO_KONS/g:/DATA_0/g,this.idNumber):e,t.forEach(((t,s)=>{e=t?this.setMessage(e,s,t):e}))}return e}lastDay(e,t=0){const s=options.monthIndex,n=options.default.monthIndex;let a=new MyDate(options.isFormat||n===s?e:MyArray.split(e,"/").changeIndex(s,n).join("/"));return 0===t&&(a=a.addDays(30)),dateFormat(a,t)}async sendImg(){const{useCaption:e}=options,t="caption"===e?this.inputCaption:this.inputMessage;return await window.WAPI.sendImage(this.phone,this.imageFile,this.subtitute(t))}}const message=new Messages;class Validators extends BaseModel{constructor(){super(),this.errors={}}get errorList(){const e=[];if(0!==Object.entries(this.errors).length){for(const t in this.errors)e.push(this.error(t));return e}return null}validate(e){this.errors={},e=this.intoObject(e);for(let t in e)e[t].rules.forEach((e=>this[e](t)));return 0===Object.entries(this.errors).length}notEmpty(e){let t,s,n=!1;switch(e){case"message":s=DOM.getElement("#message").value,n=""!==s&&null!=s,t="Silahkan Masukkan Pesan terlebih dahulu...";break;case"queue":n=void 0!==queue.now,t="Silahkan Masukkan File Penerima Pesan...";break;case"chatroom":n=chat.selected||options.autoMode,t="Silahkan Pilih Chatroom Terlebih dahulu"}return n||(this.errors[`${e}.isEmpty`]=t),n}belowMax(e){let t=options.maxQueue,s=queue.size<=t;return s||(this.errors[`${e}.overMax`]=`Blast Auto tidak boleh lebih dari ${t} Nomor!`),s}error(e){return this.errors[e]}showError(){const e=this.errorList;if(e){const t=DOM.createListElement("ul",e,{classid:"wfu-reports"});modal.alert(t,"[ERROR] Proses Gagal Dimulai")}}}const validator=new Validators;async function checkStatus(){if(loop.isRunning)return loop.break(setStatus),await modal.confirm("Stop Proses?")?(stopProcess(),!0):(startProcess(),!0);if(0!==queue.currentIndex&&queue.now)return!(await modal.confirm(`Lanjutkan Proses dari data ke-${queue.currentIndex+1}?`)||await modal.confirm("Proses ulang dari awal?")&&(reloadRecipient(),1));let e=validator.validate({message:{rules:["notEmpty"]},queue:{rules:["notEmpty","belowMax"]},chatroom:{rules:["notEmpty"]}});return e||validator.showError(),!e}function loadRecipient(e,t){const s=loadFile(e),n=t.name.split(".")[0];let a="auto"!==options.dateFormat?options.dateFormat:s.option.monthIndex||options.monthIndex,i=2==a;options.setOptions(Object.assign({},s.option,{monthIndex:a,isFormat:i,fileName:n})),queue.setData(s.data),updateUI()}function reloadRecipient(){queue.reload(),updateUI()}function resetRecipient(){queue.reset(),updateUI()}function printLink(e,t){if(options.autoMode)return DOM.setElement(queryElm.linkElm,{href:`https://${t}`}),!0;DOM.eventFire(queryElm.input,"input",`${e}). ${t}`);let s=DOM.getElement(queryElm.send);return!!s&&(s.click(),!0)}function setStatus(e){return DOM.setElements([{elm:"#blastIc",props:{d:e?"M505.16405,19.29688c-1.176-5.4629-6.98736-11.26563-12.45106-12.4336C460.61647,0,435.46433,0,410.41962,0,307.2013,0,245.30155,55.20312,199.09162,128H94.88878c-16.29733,0-35.599,11.92383-42.88913,26.49805L2.57831,253.29688A28.39645,28.39645,0,0,0,.06231,264a24.008,24.008,0,0,0,24.00353,24H128.01866a96.00682,96.00682,0,0,1,96.01414,96V488a24.008,24.008,0,0,0,24.00353,24,28.54751,28.54751,0,0,0,10.7047-2.51562l98.747-49.40626c14.56074-7.28515,26.4746-26.56445,26.4746-42.84374V312.79688c72.58882-46.3125,128.01886-108.40626,128.01886-211.09376C512.07522,76.55273,512.07522,51.40234,505.16405,19.29688ZM384.05637,168a40,40,0,1,1,40.00589-40A40.02,40.02,0,0,1,384.05637,168ZM35.68474,352.06641C9.82742,377.91992-2.94985,442.59375.57606,511.41016c69.11565,3.55859,133.61147-9.35157,159.36527-35.10547,40.28913-40.2793,42.8774-93.98633,6.31147-130.54883C129.68687,309.19727,75.97,311.78516,35.68474,352.06641Zm81.63312,84.03125c-8.58525,8.584-30.08256,12.88672-53.11915,11.69922-1.174-22.93555,3.08444-44.49219,11.70289-53.10938,13.42776-13.42578,31.33079-14.28906,43.51813-2.10352C131.60707,404.77148,130.74562,422.67188,117.31786,436.09766Z":"M505.12019,19.09375c-1.18945-5.53125-6.65819-11-12.207-12.1875C460.716,0,435.507,0,410.40747,0,307.17523,0,245.26909,55.20312,199.05238,128H94.83772c-16.34763.01562-35.55658,11.875-42.88664,26.48438L2.51562,253.29688A28.4,28.4,0,0,0,0,264a24.00867,24.00867,0,0,0,24.00582,24H127.81618l-22.47457,22.46875c-11.36521,11.36133-12.99607,32.25781,0,45.25L156.24582,406.625c11.15623,11.1875,32.15619,13.15625,45.27726,0l22.47457-22.46875V488a24.00867,24.00867,0,0,0,24.00581,24,28.55934,28.55934,0,0,0,10.707-2.51562l98.72834-49.39063c14.62888-7.29687,26.50776-26.5,26.50776-42.85937V312.79688c72.59753-46.3125,128.03493-108.40626,128.03493-211.09376C512.07526,76.5,512.07526,51.29688,505.12019,19.09375ZM384.04033,168A40,40,0,1,1,424.05,128,40.02322,40.02322,0,0,1,384.04033,168Z"}}]),e&&DOM.getElement(".progress-panel")||modal.progressPanel(e,options.autoMode,interupt),e}function initMessage(){const e=options.imageFile||0!==DOM.getElement("#imgFile").files.length?DOM.getElement("#imgFile").files[0]:"";message.setProperties({inputMessage:DOM.getElement("#message").value,inputCaption:DOM.getElement("#_caption").value,imageFile:e})}function startProcess(){if(loop.isRunning||loop.start(setStatus),loop.isRunning&&queue.now){let e=queue.currentIndex+=1,t=queue.run();if(message.setData(t),!printLink(e,message.link))return modal.alert("If You see this ERROR, Contact Developer!"),void loop.stop(setStatus);options.autoMode?(setTimeout((()=>{DOM.getElement(queryElm.linkElm).click()}),500),setTimeout((async()=>{const e=DOM.getElement(queryElm.errModal);let s="";if(e)s=e.innerText.includes("OK")?(report.fail(t),"ERROR"):(report.fail(t,0),"FAILED"),e.click();else{const{useCaption:e,useImage:n,hasImage:a}=options,i=DOM.getElement(queryElm.send);s=i?(i.click(),"SUCCESS"):"FAILED",n&&a&&("caption"!==e||"SUCCESS"===s)&&(s=!0===await message.sendImg()?"SUCCESS":"FAILED"),"SUCCESS"===s?report.success():report.fail(t,0)}}),4500)):report.success(),updateUI(e,message.phone)}else stopProcess()}async function interupt(){loop.break(),queue.now&&await modal.confirm("Stop Proses?")?stopProcess():startProcess()}function stopProcess(){options.autoMode&&!user.isPremium&&user.updateTrial("update"),loop.stop(setStatus),showReport()}function showReport(){queue.now||(DOM.setElement("#getFile",{value:""}),resetRecipient());const e=e=>{const{count:t,data:s}=report.createData(e);if(s.isEmpty)return t;const{fileUrl:n,fileName:a}=exportToCsv(options.fileName,e,s),i={tag:"a",href:n,html:DOM.createSVGElement({viewBox:"0 0 512 512",fill:"currentColor",d:"M480 352h-133.5l-45.25 45.25C289.2 409.3 273.1 416 256 416s-33.16-6.656-45.25-18.75L165.5 352H32c-17.67 0-32 14.33-32 32v96c0 17.67 14.33 32 32 32h448c17.67 0 32-14.33 32-32v-96C512 366.3 497.7 352 480 352zM432 456c-13.2 0-24-10.8-24-24c0-13.2 10.8-24 24-24s24 10.8 24 24C456 445.2 445.2 456 432 456zM233.4 374.6C239.6 380.9 247.8 384 256 384s16.38-3.125 22.62-9.375l128-128c12.49-12.5 12.49-32.75 0-45.25c-12.5-12.5-32.76-12.5-45.25 0L288 274.8V32c0-17.67-14.33-32-32-32C238.3 0 224 14.33 224 32v242.8L150.6 201.4c-12.49-12.5-32.75-12.5-45.25 0c-12.49 12.5-12.49 32.75 0 45.25L233.4 374.6z"}).outerHTML,download:`${a}`,classid:"wfu-export-csv",title:`Download "${a}.csv"`};return`${t} `+DOM.createElement(i).outerHTML};let t="[REPORT] Penulisan Link Selesai.",s={html:`${report.sukses} Link Berhasil Ditulis`,classid:"wfu-reports"};options.autoMode&&(t="[REPORT] Kirim Pesan Otomatis Selesai.",s=DOM.createListElement("ul",[`SUKSES = ${report.sukses}`,`GAGAL = ${e("gagal")}`,`ERROR = ${e("error")}`],{classid:"wfu-reports"})),modal.alert(s,t),options.autoMode&&!user.isPremium&&user.showAlert(user.isTrial?3:(DOM.getElement("#auto").click(),4),!0)}function updateUI(e=.5,t=null){let s=queue.size,n=s?"inline-block":"none",a=s?`Data: Loaded, ${s} Nomor`:"";DOM.setElements([{elm:"#_file-info",props:{title:a,style:`display:${n}`}},{elm:"#_data-count",props:{text:s}}]),DOM.setElement("span.curPhone",{text:`+${t||""}`}),showProgress(queue,e)}function showProgress(e,t){let s=e.long||100,n=t/s*100;t>=1&&DOM.setElements([{elm:".waBar",props:{title:`${t}/${s}`}},{elm:"span.curNumb",props:{text:`${t}/${s}`}}]),DOM.setElementStyle(".waBar",{width:`${n}%`})}class AppEvents{constructor(){}async runTasks(e){const{autoMode:t,useImage:s}=options;if(await checkStatus())return;let n=t?s?6e3:5500:10;initMessage(),report.reset(t),loop.set(n,(()=>startProcess())),startProcess()}tabMenu(e){const t=e.currentTarget||e.target,s=t.value,n=DOM.getElement("#panelBody .menus",!0);DOM.setElements([{elm:n,props:{removeClass:"active"}},{elm:t,props:{addClass:"active"}}]).setElementsStyle([{elm:"#panelBody .menu-content",props:{display:"none"}},{elm:`#${s}`,props:{display:"block"}}]),options.setOption("activeTab",Array.from(n).indexOf(t))}async autoMode(e){const t=DOM.getElement("#useImage"),s=e.currentTarget||e.target;s.checked&&(s.checked=await user.check()),t.checked&&t.click(),options.setOption("autoMode",s.checked)}async useImage(e){const t="caption"===options.useCaption,s=e.currentTarget||e.target,n=DOM.getElement("#_mode");s.checked&&(s.checked=await user.check(),n.checked=s.checked);const a=!t||!s.checked,i=t?"":"Caption menggunakan pesan",r=s.dataset.captId;DOM.setElements([{elm:`#${s.value}`,props:{disabled:!s.checked}},{elm:`#${r}`,props:{disabled:a,title:i}},{elm:"#useCaption",props:{disabled:!s.checked}}]),options.setOptions({autoMode:n.checked,useImage:s.checked})}loadData(e){const t=e.currentTarget||e.target,s=new FileReader,n=t.files[0];s.onloadend=function(e){return function(t){loadRecipient((t.target||t.currentTarget).result.split(/\r\n|\r|\n/),e)}}(n),resetRecipient(),s.readAsText(n)}imagePreview(e){const t=e.currentTarget||e.target,s=t.dataset.value,n=4*Math.pow(1024,2);let a=null;s?DOM.setElement(`#${s}`,{value:""}):(a=t.files[0],a&&a.size>n&&(modal.alert("Ukuran gambar tidak boleh lebih dari 4MB"),a=null)),DOM.setElement("#_img-output",{src:a?URL.createObjectURL(a):""}).setElementStyle("#_deleteImg",{display:a?"block":"none"}),options.setOptions({hasImage:!!a,imageFile:a})}toggleApp(e){const t=e.currentTarget||e.target,s=t.getAttribute("value"),n=DOM.getElement(`#${s}`),a=t.classList.toggle("active");n.style.height=n.style.height?null:`${n.scrollHeight}px`,options.setOption("openPanel",a)}inputRange(e){const t=e.currentTarget||e.target,{id:s,value:n}=t;DOM.setElements([{elm:t,props:{max:"maxQueue"===s?options.queueLimit:options.bpLimit}},{elm:DOM.getElement("output",t.parentElement),props:{text:n}}]),options.setOption(s,n)}inputChecks(e){const t=e.currentTarget||e.target,{id:s,value:n}=t;options.setOption(s,n)}inputSelects(e){const t=e.currentTarget||e.target,{id:s,value:n}=t;switch(s){case"themeColor":!function(e,t){DOM.setElementStyle("#wayfuPanel",{backgroundColor:t}),options.setOption(e,t)}(s,n);break;case"dateFormat":!function(e){if(isNumeric(e))e=2!==Number(e)?e:0,options.setOptions({isFormat:2===e,monthIndex:e,dateFormat:e});else{options.setOptions({isFormat:!1,dateFormat:e});const t=DOM.getElement("#getFile");queue.isEmpty&&""===t.value||(DOM.setElement(t,{value:""}),modal.alert("Untuk opsi Deteksi Otomatis, Silahkan masukkan ulang file penerima pesan.","[WARNING] Masukkan ulang CSV"),resetRecipient())}}(n);break;case"useCaption":!async function(e,t){let s="caption"!==t;s&&(s="caption"!==(t=await modal.confirm("Mengubah Pesan menjadi Caption akan menaikan potensi Banned dari WhatsApp. Apa Anda Yakin?")?t:"caption")),DOM.setElement("#_caption",{disabled:s,title:s?"Caption menggunakan pesan":""}),options.setOption(e,t)}(s,n)}}changeLog(e){const t=DOM.createElement({tag:"div",classid:"wfu-changelog",style:"overflow-y:scroll"});changes.Log.slice(0,5).forEach(((e,s)=>{let n=dateFormat(new MyDate(e.date),1),a=`${0==s?"WayFu - ":""}Version: ${e.version} (${n})`,i=DOM.createElement({tag:"div",classid:"wfu-changelog-items",append:t});DOM.createElement({tag:"span",text:a,append:i}),DOM.createListElement("ul",e.content,{append:i})})),modal.alert(t,"Detail Pembaruan.")}}const listeners=new AppEvents;function createView(e,t,s){const{name:n,version:a,icon:i}=s;DOM.createElement({tag:"header",id:"wayfuPanel",after:"header",html:e.replace(/VERSION/,a).replace(/APP_NAME/,n).replace(/WA_VERSION/,window.WAPI.Debug.VERSION)}),DOM.addStyle(t,{id:"wayfuStyle"}),DOM.setElement("img.appIco",{src:i}),initListener()}function initListener(){eventLists.forEach((e=>{DOM.getElement(e.element||document,!0).forEach((t=>{DOM.onEvent(t,e.type,(function(t){let s=listeners[e.event];if("function"==typeof s)return s(t)}))}))}))}const getWebpack=e=>{let t,s=Object.keys(e);for(let e of s)/[^|]?webpack./g.test(e)&&(t=e);return t||null};function setWAPI(e){window.WAPI=Object.assign({},e),Object.defineProperty(window.WAPI,"sendImage",{value:function(e,t,s=""){return new Promise((n=>{this.Chat.find(`${e}@c.us`).then((e=>{let a=new this.MediaCollection(e);a.processAttachments([{file:t},1],e,1).then((()=>{a.models[0].sendToChat(e,{caption:s}),n(!0)})).catch((e=>{n(!1)}))}))}))}})}const loadWapi=e=>{if(!window.Store||!window.Store.Msg){function t(e){let t=0;for(let s in e.m)if("object"==typeof e(s)&&null!==e(s)&&(storeObjects.forEach((n=>{if(!n.conditions||n.foundedModule)return;let a=n.conditions(e(s));null!==a&&(t++,n.foundedModule=a)})),t==storeObjects.length))break;let s=storeObjects.find((e=>"Store"===e.id));return window.Store=s.foundedModule?s.foundedModule:{},storeObjects.forEach((e=>{"Store"!==e.id&&e.foundedModule&&(window.Store[e.id]=e.foundedModule)})),window.Store}const s=`parasite${Date.now()}`,n=getWebpack(e);n&&"object"==typeof e[n]?(e[n].push([[s],{},(e,s,n)=>{t(e)}]),setWAPI(window.Store)):console.error("Failed to load WAPI Module!")}};class App extends GM_Library{constructor(){super(),this.initialize()}initialize(){loadWapi(unsafeWindow),this.registerPanel(),this.registerUser(),this.registerOptions(),this.onLoadView()}registerPanel(){chat.init(window.WAPI.WebClasses.active);const e=this.getResource("pnl"),t=this.getResource("css"),s=this.getResource("ico","url");createView(e,t,Object.assign({},this.appInfo,{icon:s}))}registerUser(){user.init().gettingData()}registerOptions(){options.init()}async onLoadView(){DOM.setElementStyle("#wayfuPanel",{"background-color":options.themeColor}),DOM.getElement("#panelBody .menus",!0)[options.activeTab||0].click(),options.openPanel&&DOM.getElement("#toggleApp").click(),changes.checkUpdate()}}async function init(){await DOM.hasElement("div.two")?new App:await init()}init(); \ No newline at end of file +"use strict";var __webpack_exports__={};class HtmlModifier{constructor(){}getElement(e,...t){let s=null,n=!1;return 0!==t.length&&(s=t[0]instanceof window.HTMLElement?t[0]:"string"==typeof t[0]?document.querySelector(t[0].trim()):null,n="boolean"==typeof t[0]?t[0]:null!=t[1]&&t[1]),"string"==typeof e?(e=e.trim(),n?(s||document).querySelectorAll(e):(s||document).querySelector(e)):e instanceof window.HTMLElement||e instanceof window.NodeList?e:void 0}getParents(e,t){Element.prototype.matches||(Element.prototype.matches=Element.prototype.matchesSelector||Element.prototype.mozMatchesSelector||Element.prototype.msMatchesSelector||Element.prototype.oMatchesSelector||function(e){for(var t=(this.document||this.ownerDocument).querySelectorAll(e),s=t.length;--s>=0&&t.item(s)!==this;);return s>-1});let s=[],n=this.getElement(e);for(;n&&n!==document;n=n.parentNode)t?n.matches(t)&&s.push(n):s.push(n);return s}createElement(e){let t,s,n;for(const a in e)if(e.hasOwnProperty(a))switch(a){case"tag":s=document.createElement(e[a]);break;case"text":n="innerText"in document?"innerText":"textContent",s[n]=e[a];break;case"html":s.innerHTML=e[a];break;case"classid":if("array"==typeof e[a])for(let t of e[a])s.classList.add(t);else"string"==typeof e[a]&&(s.className=e[a]);break;case"append":t=this.getElement(e[a]),t.appendChild(s);break;case"prepend":t=this.getElement(e[a]),t.childNodes.length?t.insertBefore(s,t.childNodes[0]):t.appendChild(s);break;case"before":t=this.getElement(e[a]),t.parentNode.insertBefore(s,t);break;case"after":t=this.getElement(e[a]),t.parentNode.insertBefore(s,t.nextSibling);break;case"replace":t=this.getElement(e[a]),t.parentNode.replaceChild(s,t);break;case"event":for(const t in e.event)e.event.hasOwnProperty(t)&&this.onEvent(s,t,e.event[t]);break;case"callback":e[a](s);break;default:s.setAttribute(a,e[a])}return s}createElements(e=[],t){if(t=t?t instanceof window.HTMLElement?t:"object"==typeof t&&null!=t.tag?this.createElement(t):null:null,"object"==typeof e)for(let s of e)t&&(s.append=t),this.createElement(s);return t||this}createListElement(e,t,s={}){let n=this.createElement(Object.assign({tag:e||"ol"},s));return Array.isArray(t)&&t.forEach((t=>{if("object"==typeof t){let s=this.createElement({tag:"li",html:t.title,append:n});Array.isArray(t.content)&&this.createListElement(e||"ol",t.content,{append:s})}else"string"==typeof t&&this.createElement({tag:"li",html:t,append:n})})),n}createSVGElement(e){const{size:t,d:s,dPath:n,fill:a,viewBox:i}=e,r=this.createElement({tag:"path",d:s||n,fill:a||"currentColor"}),o={width:"16",height:"16"};if(t&&"string"==typeof t){let[e,s]=t.split(" ");o.width=e||o.width,o.height=s||o.height}return this.createElement({tag:"svg",width:o.width,height:o.height,viewBox:i,html:r.outerHTML})}setElementStyle(e,t){const s=e instanceof window.HTMLElement?[e]:this.getElement(e,!0);if(s&&0!==s.length&&s[0])for(const e of s)for(const s in t)if(t.hasOwnProperty(s))switch(s){case"zIndex":e.style.zIndex=t[s];break;case"margin":e.style.margin=t[s];break;case"padding":e.style.padding=t[s];break;case"display":e.style.display=t[s];break;default:e.style[s]=t[s]}return this}setElementsStyle(e,t){return Array.isArray(e)?e.forEach((e=>{this.setElementStyle(e.elm,e.props)})):"string"==typeof e&&this.getElement(e,!0).forEach((e=>{this.setElementStyle(e,t)})),this}setElement(e,t){const s=e instanceof window.HTMLElement?[e]:this.getElement(e,!0);let n;if(s&&0!==s.length&&s[0])for(const e of s)for(const s in t)if(t.hasOwnProperty(s))switch(s){case"text":n="innerText"in document?"innerText":"textContent",e[n]=t[s];break;case"html":e.innerHTML=t[s];break;case"class":e.className=t[s];break;case"addClass":e.classList.add(t[s]);break;case"removeClass":e.classList.remove(t[s]);break;case"toggleClass":e.classList.toggle(t[s]);break;case"disabled":e.disabled=t[s];break;case"value":e.value=t[s];break;case"dispatch":e.dispatchEvent(t[s]);break;case"readonly":case"readOnly":e.readOnly=t[s];break;default:e.setAttribute(s,t[s])}return this}setElements(e=[]){return Array.isArray(e)&&e.forEach((e=>{this.setElement(e.elm,e.props)})),this}hasElement(e,t=10){return new Promise((s=>{let n=setInterval((()=>{let a=this.getElement(e);a&&(s(a),clearInterval(n)),(t-=!1)&&(s(!1),clearInterval(n))}),1e3)}))}insertElement(e,t){return this.getElement(t||"body").appendChild(this.getElement(e)),this}removeElement(e,t){return this.getElement(t||"body").removeChild(this.getElement(e)),t||this}onEvent(e,t,s,n=!1){let a=this.getElement(e);return window.addEventListener&&(a||window).addEventListener(t,s,n),this}eventFire(e,t,s,n={bubbles:!0,composed:!0}){return this.setElement(e,{text:s||"",dispatch:t?new InputEvent(t,n):new MouseEvent("mousedown",n)}),this}addStyle(e,t={}){const s={tag:"style",html:e,append:"head"};return this.createElement(Object.assign({},s,t)),this}}const DOM=new HtmlModifier;class MyDate extends Date{addDays(e){let t=new MyDate(this.valueOf());return t.setDate(t.getDate()+e),t}addMonths(e){let t=new MyDate(this.valueOf());return t.setMonth(t.getMonth()+Number(e)),t}}const rgx={forVersion:/^\d+((\.|-)\d+[A-Za-z]?)*$/,phonePattern:/^(?:[\+\d]?[\- \d]{10,})$/,phoneValue:/^[0\+]*(?:(\d{9,})|([\d]{1,3}(?:[\- ]?[\d]{2,})+))$/,datePattern:/\d{1,4}[\/|-|:]\d{1,2}[\/|-|:]\d{2,4}/,formatedDate:/^\d{4}[\/|-|:]\d{1,2}[\/|-|:]\d{1,2}$/,forFilename:/(?!\s*$)\s*(?:(gagal|error)|(?:\(?([0-9]*)\)?)|([^_]*))(?:_|\s|$)/g},eventLists=[{element:"#panelBody .menus",type:"click",event:"tabMenu"},{element:"#_mode",type:"click",event:"autoMode"},{element:"#useImage",type:"click",event:"useImage"},{element:"#getFile",type:"change",event:"loadData"},{element:"#imgFile",type:"change",event:"imagePreview"},{element:"#_deleteImg",type:"click",event:"imagePreview"},{element:"#toggleApp",type:"click",event:"toggleApp"},{element:"._input input[type='range']",type:"input",event:"inputRange"},{element:"._input input[type='checkbox']",type:"change",event:"inputChecks"},{element:"._input select",type:"change",event:"inputSelects"},{element:"#changeLogs",type:"click",event:"changeLog"},{element:"#_blast",type:"click",event:"runTasks"}],queryElm={send:"#main span[data-testid^='send']",input:"#main div[contenteditable='true']",linkElm:"div#panelBody span#_api-link a",errModal:".overlay div[role^='button']",chatMessage:"#main div.message-out"},dateOptDefault={year:"numeric",month:"long",day:"numeric"},storeObjects=[{id:"Store",conditions:e=>e.default&&e.default.Chat&&e.default.Msg?e.default:null},{id:"WebClasses",conditions:e=>e.default&&"object"==typeof e.default&&e.default.chat&&e.default.active?e.default:null},{id:"MediaCollection",conditions:e=>e.default&&e.default.prototype&&e.default.prototype.processAttachments?e.default:null},{id:"Features",conditions:e=>e.FEATURE_CHANGE_EVENT&&e.GK?e.GK:null},{id:"Debug",conditions:e=>e.Debug?e.Debug:null},{id:"Conn",conditions:e=>e.PLATFORMS&&e.Conn?e.Conn:null}],isNumeric=e=>"string"==typeof e?!isNaN(e)&&!isNaN(parseFloat(e)):"number"==typeof e,isDateStr=e=>"string"==typeof e&&"Invalid Date"!==new Date(e).toString()&&!isNaN(new Date(e)),JSONParse=e=>new Promise((t=>{try{t(JSON.parse(e))}catch(e){t(null)}})),parseValue=e=>{var t;return"string"==typeof e&&(e=isNumeric(e)?Number(e):"string"!=typeof(t=e)||"Invalid Date"===new Date(t).toString()||isNaN(new Date(t))?e:new MyDate(e)),e},isUpToDate=(e,t)=>{const{forVersion:s}=rgx;if(!e||!t||0===e.length||0===t.length)return!1;if(e==t)return!0;if(s.test(e)&&s.test(t)){let s=e.includes(".")?".":"-",n=e.split(s).map((e=>isNumeric(e)?Number(e):e)),a=t.split(s).map((e=>isNumeric(e)?Number(e):e));for(let e=0;ea[e]}{let[t,s]=[Number(/\d+/.exec(n[e])),Number(/\d+/.exec(a[e]))],[i,r]=[/[A-Za-z]/.exec(n[e]),/[A-Za-z]/.exec(a[e])];if(t==s){if(i&&r&&i[0]==r[0])continue;return i&&r?i[0]>r[0]:!!i}return t>s}}}return e>=t},setName=(e,t=!1)=>{let s=[];return e.split(" ").forEach((e=>{s.push(titleCase(e))})),t?s.join(" "):s[0]},titleCase=e=>(e=e.toLowerCase()).charAt(0).toUpperCase()+e.slice(1),dateFormat=(e,t=0)=>new Date(e).toLocaleDateString("id-ID",Object.assign({},dateOptDefault,{weekday:0==t?"long":void 0}));class BaseModel{setProperties(e){e=this.intoObject(e);for(let t in e)this.hasOwnProperty(t)&&(this[t]=e[t]);return this}serialize(e){if("object"==typeof e){let t=[];for(let s in e)e.hasOwnProperty(s)&&t.push(s+"="+encodeURI(e[s]));return t.join("&")}return e}intoObject(e){let t={};if(!e)return t;if("string"==typeof e?t=JSON.parse(e):Array.isArray(e)?e.forEach(((e,s)=>t[s]=e)):"object"==typeof e&&(t=e),0!==Object.keys(t).length)for(const e in t)t[e]=parseValue(t[e]);return t}findObjectValue(e,t){let s;return t=t||this,Object.keys(t).some((n=>n===e?(s=t[n],!0):t[n]&&"object"==typeof t[n]?(s=this.findObjectValue(e,t[n]),void 0!==s):void 0)),s}}class GM_Library extends BaseModel{constructor(){super()}get appInfo(){return this.getInfo("script")}get managerName(){return"object"!=typeof GM_info?"function"==typeof GM_getMetadata?"Scriptish":"undefined"!=typeof GM_setValue&&"undefined"==typeof GM_getResourceText&&"undefined"==typeof GM_getResourceURL&&"undefined"==typeof GM_openInTab&&"undefined"==typeof GM_setClipboard?"NinjaKit":"Native":void 0!==GM_info.uuid?"Greasemonkey":void 0!==GM_info.scriptHandler?"Tampermonkey":void 0}getInfo(e=""){return GM_info?""===e?GM_info:this.findObjectValue(e,GM_info):null}getResource(e,t="text"){return"undefined"!=typeof GM_getResourceText&&"text"===t?GM_getResourceText(e):"undefined"!=typeof GM_getResourceURL&&"url"===t?GM_getResourceURL(e):void 0}deleteValue(e){if("undefined"!=typeof GM_deleteValue){const t=GM_listValues();for(const s of t)e&&e!==s||GM_deleteValue(s)}}setValue(e,t){"undefined"!=typeof GM_setValue&&GM_setValue(e,t)}getValue(e,t=null){if("undefined"!=typeof GM_listValues&&"undefined"!=typeof GM_getValue){const s=GM_listValues();if(0!==s.length&&s.some((t=>e===t)))return GM_getValue(e,t)}return t}request(e){e.url=e.url||this.appInfo.homepage,e.method=e.method||"GET",e.headers=e.headers||{},e.timeout=e.timeout||2e4,(e.data||"POST"==e.method)&&(e.method="POST",e.data=this.serialize(e.data||{}),e.headers=Object.assign({},e.headers,{"X-Requested-With":"XMLHttpRequest","Content-Type":"application/x-www-form-urlencoded"}));const t=e.onload,s=e.onerror,n=e.ontimeout,a=e.onabort;e.onload=function(e){t(e)},e.onerror=function(e){console.log(`request error: ${e.error||"unknown error"}`),s(e)},e.ontimeout=function(e){console.log(`request error: ${e.error||"timed out"}`),n(e)},e.onabort=function(e){console.log(`request error: ${e.error||"aborted"}`),a(e)},"undefined"!=typeof GM_xmlhttpRequest?GM_xmlhttpRequest(e):console.log("XHR not Allowed!")}}class Modals{constructor(){this.contens=0,this.element=DOM.createElement({tag:"div",id:"wayfu-modal",classid:"wfu-modal",role:"alert"})}construct(e=!1,t,s=""){return new Promise((n=>{let a=`wfu-content-${this.contens+=1}`,i=DOM.createElement({tag:"div",classid:"wfu-modal-container",id:a});if(s&&DOM.createElement({tag:"h2",text:s,append:i}),t&&(t instanceof window.HTMLElement?DOM.insertElement(t,i):"string"==typeof t?DOM.createElement({tag:"p",html:t,append:i}):"object"==typeof t&&DOM.createElement(Object.assign({tag:"p",append:i},t))),e){let e=DOM.createElement({tag:"ul",classid:"wfu-buttons",append:i}),t=[{tag:"a",classid:"wfu-btn-ok",text:"Ya",event:{click:e=>{this.closed(e),n(!0)}}},{tag:"a",classid:"wfu-modal-close",text:"Tidak",event:{click:e=>{this.closed(e),n(!1)}}}];for(let s of t){let t=DOM.createElement({tag:"li",append:e});DOM.createElement(Object.assign({},s,{append:t}))}}else DOM.createElement({tag:"a",href:"#",html:"×",classid:"wfu-btn-close img-replace wfu-modal-close",append:i,event:{click:this.closed}});DOM.onEvent(window,"click",this.closed).insertElement(i,this.element),this.show()}))}async alert(e,t=""){return await this.construct(!1,e,t)}async confirm(e,t=""){return await this.construct(!0,e,t)}progressPanel(e,t=!1,s=null){if(e){let e=`wfu-content-${this.contens+=1}`,n=DOM.createElement({tag:"div",classid:"wfu-modal-container progress-panel",id:e}),a=[{tag:"h2",text:t?"Pesanmu sedang dikirim":"Linkmu sedang ditulis"},{tag:"div",html:"
",classid:"waProgress"},{tag:"p",html:(t?"Mengirim pesan ke ":"Menulis link ")+"()"},{tag:"a",href:"#",html:"×",classid:"wfu-btn-close img-replace",event:{click:s}}];n=DOM.createElements(a,n),DOM.insertElement(n,"#wayfu-modal"),this.show()}else{let e=DOM.getElement(".wfu-modal-container.progress-panel"),t=DOM.getElement(".wfu-modal-container",!0),s=DOM.getElement("#wayfu-modal");e&&DOM.removeElement(e,s),s&&0===t.length&&s.classList.remove("is-visible")}}show(){DOM.getElement("#wayfu-modal")||DOM.insertElement(this.element),DOM.getElement("#wayfu-modal").classList.add("is-visible")}closed(e){const t=e.target,s=DOM.getElement("#wayfu-modal"),n=DOM.getParents(t,".wfu-modal-container"),a=t.classList.contains("wfu-btn-ok");if(s&&(a||t.classList.contains("wfu-modal-close"))){0!==n.length&&DOM.removeElement(n[0],s);const e=DOM.getElement(".wfu-modal-container",!0);s&&0===e.length&&s.classList.remove("is-visible")}}}const modal=new Modals;class MyArray extends Array{get isEmpty(){return this.length<=0}changeIndex(e,t){if(t>=this.length){let e=t-this.length+1;for(;e--;)this.push(void 0)}return this.splice(t,0,this.splice(e,1)[0]),this}countValue(e){let t=0;return this.forEach((s=>{t+=s===e?1:0})),t}isOnArray(e){return this.some((t=>e===t))}static split(e,t){let s=e.split(t);return new MyArray(...s)}}class Settings extends GM_Library{constructor(){super(),this.default={themeColor:"var(--butterbar-connection-background)",autoMode:!1,hasImage:!1,imageFile:null,useImage:!1,activeTab:0,targetBp:100,maxQueue:500,dateFormat:"auto",openPanel:!0,useCaption:"caption",userType:"umum",splitter:",",monthIndex:0,isFormat:!1,alert:!0,queueLimit:1e3,bpLimit:300}}init(){const e=this.getValue("wayfu-options"),t=Object.assign({},this.default,this.intoObject(e));return this.setOptions(t).colorList()}setOptions(e={}){if(e!=={}){e=this.intoObject(e);for(let t in e)this.setOption(t,e[t])}return this}setOption(e,t){return t=parseValue(t),(this.hasOwnProperty(e)||this.default.hasOwnProperty(e))&&(this[e]=t),this.fillList().save()}fillList(){return Object.entries(this).forEach((e=>{const[t,s]=e,n=DOM.getElement(`#${t}`);n&&("checkbox"==n.type?n.checked=s:n.value=s)})),DOM.getElement("._input input[type='range']",!0).forEach((e=>{DOM.setElements([{elm:e,props:{max:"maxQueue"==e.id?this.queueLimit:this.bpLimit}},{elm:DOM.getElement("output",e.parentElement),props:{text:e.value}}])})),"oriflame"===this.userType&&DOM.setElementStyle(".panel-options .oriflame",{display:"flex"}),this}colorList(){let e=this.getResource("clr");return e="string"==typeof e?JSON.parse(e):e,e=Array.isArray(e)?e:e.colors,e.forEach((e=>{let t={tag:"option",value:e.key,text:e.val,append:"select#themeColor"};DOM.createElement(t)})),this}save(){const e=new MyArray("useImage","hasImage","imageFile","fileName","autoMode","alert","bpLimit","queueLimit","default"),t={};for(let s in this)this.default.hasOwnProperty(s)&&!e.isOnArray(s)&&(t[s]=this[s]);this.setValue("wayfu-options",t)}}const options=new Settings;class Users extends GM_Library{constructor(){super(),this.today=new MyDate,this.defaultOpt={method:"POST",url:`${this.appInfo.homepage}user/api`,headers:{"Content-Type":"application/json"}}}get isPremium(){return!!this.end&&this.today{let t=Object.assign({},this.defaultOpt,{data:JSON.stringify({phone:this.phone,version:this.appInfo.version}),onload:async t=>{const{status:s,responseText:n}=t;let a=null;200===s&&(a=await JSONParse(n)),user.setUser(a),e(200===s&&a)},onerror:e=>user.setUser(null),ontimeout:e=>user.setUser(null),onabort:e=>user.setUser(null)});this.request(t)}))}updateData(e){if(!e)return this;if((e=this.intoObject(e)).phone!==this.phone)return this;for(const t in e)"today"!==t&&(this[t]=e[t]);return this.end=this.reg&&this.mon?new MyDate(this.reg).addMonths(this.mon):this.end||null,this}setUser(e){const t=e||this.getValue("wayfu-user");t&&null!=t&&""!==t&&(this.reset().updateData(t).save(),options.setOption("userType",this.type)),this.isPremium||this.isTrial?this.showAlert(this.isPremium?0:1):setTimeout((()=>{this.gettingData()}),2e4)}async check(){return this.isPremium||await this.tryApp()}async tryApp(){return this.expires||this.isTrial?this.isTrial:!!await modal.confirm("Coba WayFu Gratis!","Apakah Anda mau mencoba 2 hari Trial?")&&await this.updateTrial()}updateTrial(e="add"){const t={version:this.appInfo.version,phone:this.phone,name:this.name,action:e},s={};return"add"===e?s.expires=new MyDate(this.today).addDays(2).toLocaleString("id-ID"):s.attempt=this.attempt+=1,new Promise(((e,n)=>{let a=Object.assign({},this.defaultOpt,{data:JSON.stringify(Object.assign({},t,s)),onload:async t=>{const{status:s,responseText:n}=t;let a=null;200===s&&(a=await JSONParse(n)),user.setUser(a),e(200===s&&a)},onerror:t=>e(!1),ontimeout:t=>e(!1),onabort:t=>e(!1)});this.request(a)}))}showAlert(e,t=!1){const s=[{title:`Halo kak ${setName(this.name,!0)}!`,text:`Selamat menggunakan fitur Pengguna Premium.\n\n Masa aktif Kakak berakhir hari ${dateFormat(this.end)} ya...`},{title:`Halo! Selamat Datang di ${this.appInfo.name}!`,text:`Anda dapat menggunakan fitur kirim otomatis sebanyak ${5-this.attempt} kali lagi,\n Masa Trial Anda berakhir hari ${dateFormat(this.expires)} ya...`},{title:`${this.appInfo.name} - Fitur Premium`,text:"Maaf, fitur ini hanya untuk Pengguna Premium. Informasi lebih lanjut, silahkan hubungi saya."},{title:`${this.appInfo.name} - Trial Mode`,text:`Saat ini Anda sedang menggunakan versi Trial. Anda masih dapat menggunakan fitur kirim otomatis sebanyak ${5-this.attempt} kali lagi.`},{title:`${this.appInfo.name} - Trial Mode`,text:"Masa Trial Anda sudah berakhir. Silahkan berlanganan untuk menggunakan fitur premium."}],{title:n,text:a}=s[e];let i=options.alert||t?(modal.alert(a,n),!1):options.alert;options.setOption("alert",i)}reset(){const e=new MyArray("attempt","type","reg","mon","end","expires");for(let t in this)this.hasOwnProperty(t)&&e.isOnArray(t)&&delete this[t];return this.init()}save(){const e=new MyArray("name","phone","attempt","type","reg","mon","end","expires"),t={};for(let s in this)if(this.hasOwnProperty(s)&&e.isOnArray(s)){let e=this[s]instanceof Date?this[s].toISOString():this[s];t[s]=e}this.setValue("wayfu-user",t)}}const user=new Users;class Chatroom{constructor(){this.chat,this.chatClass=""}get selected(){return""!==this.chatClass&&(this.chat=DOM.getElement(`div.${this.chatClass}`),!!this.chat)}init(e){return this.chatClass=e,this}}const chat=new Chatroom;class Reports{constructor(){this.sukses=0,this.gagal=new MyArray,this.error=new MyArray,this.auto=!1}reset(e){this.sukses=0,this.gagal=new MyArray,this.error=new MyArray,this.auto=e}createData(e){let t=this[e]||new MyArray;return{count:t.length,data:t}}success(){this.sukses++}fail(e,t=1){t?this.error.push(e):this.gagal.push(e)}}const report=new Reports;class Interval{constructor(){this.timer=!1,this.time=null,this.fn=null}get isRunning(){return!1!==this.timer}set(e,t){this.time=e,this.fn=t}start(e=null){this.isRunning||(this.timer=setInterval(this.fn,this.time)),e&&"function"==typeof e&&e(!0)}break(e=null){this.isRunning&&(clearInterval(this.timer),this.timer=!1),e&&"function"==typeof e&&e(!1)}stop(e=null){this.fn=null,this.time=null,this.break(e)}}const loop=new Interval;class Queue{constructor(){this.currentIndex=0,this.queue=new MyArray,this.stock=new MyArray,this.offset=0}get isEmpty(){return this.queue.isEmpty}get now(){return this.queue.isEmpty?void 0:this.queue[this.offset]}get size(){return this.queue.length-this.offset}get long(){return this.stock.length}setData(e){this.queue=e,this.stock=e}run(){if(this.queue.isEmpty)return;let e=this.queue[this.offset];return 2*++this.offset>=this.queue.length&&(this.queue=this.queue.slice(this.offset),this.offset=0),e}reset(){this.queue=new MyArray,this.stock=new MyArray,this.offset=0,this.currentIndex=0}reload(){this.queue=this.stock,this.currentIndex=0,this.offset=0}}const queue=new Queue;class Changelog extends GM_Library{constructor(){super();const e=this.getValue("wayfu-changelog",new MyArray);this.details=0!==e.length?new MyArray(...e):new MyArray}get getChanges(){const{homepage:e}=this.appInfo;return new Promise((t=>{let s={url:`${e}files/changelog.json`,onload:e=>{const{status:s,responseText:n}=e;if(200===s){let e=JSON.parse(n);e=Array.isArray(e)?e:e.changelog,t(e)}else t(200===s)}};this.request(s)}))}get Log(){return this.details}async doUpdate(e){const t=/\d+((\.|-)\d+[A-Za-z]?)*/.exec(e)[0],{version:s,name:n,downloadURL:a}=this.appInfo;if(!isUpToDate(s,t)){const e=`${n} ${t} sudah tersedia, perbaharui sekarang?`;await modal.confirm(e)&&(window.location.href=a)}}async checkUpdate(){const{updateURL:e}=this.appInfo,t=new Promise((t=>{const s={url:`${e}`,onload:e=>{const{status:s,responseText:n}=e;t(200===s&&n)}};this.request(s)}));return this.details=new MyArray(...await this.getChanges),this.save(),this.doUpdate(await t),this}save(){this.setValue("wayfu-changelog",this.details)}}const changes=new Changelog,monthIndex=e=>{if(rgx.formatedDate.test(e[0]))return 2;let t=new MyArray,s=new MyArray;return e.forEach(((e,n)=>{[t[n],s[n]]=e.split(/\/|:|-/)})),t.some((e=>e>12))||s.some((e=>e>12))?t.some((e=>e>12))?1:0:t.countValue(t[0])>s.countValue(s[0])?0:1},useComma=e=>{let t=String.raw`^\s*(?:'[^'\\]*(?:\\[\S\s][^'\\]*)*'|"[^"\\]*(?:\\[\S\s][^"\\]*)*"|[^,;"\s\\]*(?:\s+[^,;"\s\\]+)*)\s*(?:,\s*(?:'[^'\\]*(?:\\[\S\s][^'\\]*)*'|"[^"\\]*(?:\\[\S\s][^"\\]*)*"|[^,;"\s\\]*(?:\s+[^,;"\s\\]+)*)\s*)*$`;return new RegExp(t).test(e)},rowValue=(e=",",t="")=>{let s=","==e?`${e};`:e,n=String.raw`(?!\s*$)\s*(?:'([^'\\]*(?:\\[\S\s][^'\\]*)*)'|"([^"\\]*(?:\\[\S\s][^"\\]*)*)"|([^${s}"\s\\]*(?:\s+[^${s}"\s\\]+)*))\s*(?:${e}|$)`;return t?new RegExp(n,t):new RegExp(n)},getSignDate=e=>(e=rgx.datePattern.exec(e))?e.toString():null,setPhone=e=>(e="string"==typeof e?e:e.join("")).replace(rgx.phoneValue,(function(e,t,s){let n=void 0!==t?t:s.replace(/(\-| )/g,"");return("8"===n.charAt(0)&&"+"!==e.charAt(0)?"62":"")+n}));class CSVFile{constructor(){this.types=new MyArray("gagal","error"),this.fileName={fname:[],ftype:"",numb:1},this.options={}}async import(e){if(!e)return this;const t=await e.text();return t?(this.constructFileName(e.name.split(".")[0]),this.readData(t.split(/\r\n|\r|\n/),e)):this}constructFileName(e){const t={fname:[],ftype:"",numb:1};e.replace(rgx.forFilename,((e,s,n,a)=>(void 0!==a&&t.fname.push(a),void 0!==s&&this.types.isOnArray(s)&&(t.ftype=s||""),void 0!==n&&(t.numb=isNumeric(n)?Number(n):1),""))),this.fileName=Object.assign({},this.fileName,t)}readData(e){const t=(e,t)=>{const s=this.toArray(e,t),n=e=>rgx.phonePattern.test(e);return!!(""!=e&&s&&s.length>=2)&&!!s.some((e=>n(e)))&&(s.forEach(((e,t)=>{var a;s[t]=/^"(.*)"$/.test(e)?e.replace(/(^")|("$)/g,""):s[t],s[t]=n(e)?(a="string"==typeof(a=e)?a:a.join("")).replace(rgx.phoneValue,(function(e,t,s){let n=void 0!==t?t:s.replace(/(\-| )/g,"");return("8"===n.charAt(0)&&"+"!==e.charAt(0)?"62":"")+n})):isNumeric(e)?Number(e).toString():s[t]})),s)},s=e.length>1&&""!=e[1]?1:0,n=new MyArray,a=new MyArray,i=useComma(e[s])?",":";";return e.forEach((e=>{let s;if(s=t(e,i)){let e;n.push(s),r=s,(e=(r=rgx.datePattern.exec(r))?r.toString():null)&&a.push(e)}var r})),this.options=Object.assign({},this.options,{monthIndex:!a.isEmpty&&monthIndex(a),splitter:i}),this.data=n,this}toArray(e,t=","){let s=new MyArray;return e.replace(rowValue(t,"g"),(function(e,t,n,a){return void 0!==t?s.push(t.replace(/\\'/g,"'")):void 0!==n?s.push(n.replace(/\\"/g,'"')):void 0!==a&&s.push(a.replace(/^['"]?(.*)['"]?$/,"$1")),""})),/,\s*$/.test(e)&&s.push(""),s}export(e,t){const s=(e=>{function t(e){let t="";for(let s=0;s=0&&(a='"'+a+'"'),s>0&&(t+=","),t+=a}return t+"\n"}let s="";for(let n=0;n{let{fname:t}=this.fileName;return`${t.join("_")}_${e}${(()=>{let{ftype:t,numb:s}=this.fileName;return e!==t?"":`_${s+1}`})()}`})(e);return{fileUrl:URL.createObjectURL(s),fileName:n}}}const csvFile=new CSVFile;class Messages extends BaseModel{constructor(){super(),this.apiLink="api.whatsapp.com/send?phone=",this.inputMessage="",this.inputCaption="",this.imageFile="",this.idNumber="",this.name="",this.phone="",this.poinValue="",this.date="",this.sponsorName="",this.other=[]}setData(e){var t;[this.idNumber,this.name,this.phone,this.poinValue,this.date,this.sponsorName,...this.other]=(t=e[2],rgx.phonePattern.test(t)?e:["",...e])}get encodedMsg(){const{autoMode:e,useImage:t,hasImage:s,useCaption:n}=options,a=!e||!t||!s||"caption"===n,i=this.inputMessage&&a?this.subtitute(this.inputMessage):"";return""!==i?encodeURIComponent(i).replace(/'/g,"%27").replace(/\(/g,"%28").replace(/\)/g,"%29"):i}get link(){return this.apiLink+this.phone+`&text=${this.encodedMsg}`}setMessage(e,t,s){const n=e=>new RegExp(String.raw`(DATA_${e})(\s|\D|$)`,"g");if("oriflame"===options.userType){for(let n=t;n<3;n++){const t=rgx.datePattern.test(s),a=isNumeric(s);if(0===n&&a){const t=e=>{const t=options.targetBp-Number(e);return t>0?t:0};e=e.replace(/P_BP/g,`${s} BP`).replace(/K_BP/g,`${t(s)} BP`)}else 1===n&&t?e=e.replace(/L_DAY/g,this.lastDay(s)).replace(/S_DAY/g,this.lastDay(s,1)):2!==n||a||t||(e=e.replace(/F_INVS/g,setName(s,!0)).replace(/INVS/g,setName(s)))}return t>2?e.replace(n(t-2),`${s}$2`):e}return e.replace(n(t+1),`${s}$2`)}subtitute(e){if(""!==e&&null!==e){const t=[this.poinValue,this.date,this.sponsorName,...this.other];e=(e=e.replace(/F_NAMA/g,setName(this.name,!0)).replace(/NAMA/g,setName(this.name))).replace(/PHONE/g,this.phone),e=""!==this.idNumber?e.replace("oriflame"===options.userType?/NO_KONS/g:/DATA_0/g,this.idNumber):e,t.forEach(((t,s)=>{e=t?this.setMessage(e,s,t):e}))}return e}lastDay(e,t=0){const s=options.monthIndex,n=options.default.monthIndex;let a=new MyDate(options.isFormat||n===s?e:MyArray.split(e,"/").changeIndex(s,n).join("/"));return 0===t&&(a=a.addDays(30)),dateFormat(a,t)}async sendImg(){const{useCaption:e}=options,t="caption"===e?this.inputCaption:this.inputMessage;return await window.WAPI.sendImage(this.phone,this.imageFile,this.subtitute(t))}}const message=new Messages;class Validators extends BaseModel{constructor(){super(),this.errors={}}get errorList(){const e=[];if(0!==Object.entries(this.errors).length){for(const t in this.errors)e.push(this.error(t));return e}return null}validate(e){this.errors={},e=this.intoObject(e);for(let t in e)e[t].rules.forEach((e=>this[e](t)));return 0===Object.entries(this.errors).length}notEmpty(e){let t,s,n=!1;switch(e){case"message":s=DOM.getElement("#message").value,n=""!==s&&null!=s,t="Silahkan Masukkan Pesan terlebih dahulu...";break;case"queue":n=void 0!==queue.now,t="Silahkan Masukkan File Penerima Pesan...";break;case"chatroom":n=chat.selected||options.autoMode,t="Silahkan Pilih Chatroom Terlebih dahulu"}return n||(this.errors[`${e}.isEmpty`]=t),n}belowMax(e){let t=options.maxQueue,s=queue.size<=t;return s||(this.errors[`${e}.overMax`]=`Blast Auto tidak boleh lebih dari ${t} Nomor!`),s}error(e){return this.errors[e]}showError(){const e=this.errorList;if(e){const t=DOM.createListElement("ul",e,{classid:"wfu-reports"});modal.alert(t,"[ERROR] Proses Gagal Dimulai")}}}const validator=new Validators;async function checkStatus(){if(loop.isRunning)return loop.break(setStatus),await modal.confirm("Stop Proses?")?(stopProcess(),!0):(startProcess(),!0);if(0!==queue.currentIndex&&queue.now)return!(await modal.confirm(`Lanjutkan Proses dari data ke-${queue.currentIndex+1}?`)||await modal.confirm("Proses ulang dari awal?")&&(reloadRecipient(),1));let e=validator.validate({message:{rules:["notEmpty"]},queue:{rules:["notEmpty","belowMax"]},chatroom:{rules:["notEmpty"]}});return e||validator.showError(),!e}function loadRecipient(e){let t="auto"!==options.dateFormat?options.dateFormat:e.options.monthIndex||options.monthIndex,s=2==t;options.setOptions(Object.assign({},e.options,{monthIndex:t,isFormat:s})),queue.setData(e.data),updateUI()}function reloadRecipient(){queue.reload(),updateUI()}function resetRecipient(){queue.reset(),updateUI()}function printLink(e,t){if(options.autoMode)return DOM.setElement(queryElm.linkElm,{href:`https://${t}`}),!0;DOM.eventFire(queryElm.input,"input",`${e}). ${t}`);let s=DOM.getElement(queryElm.send);return!!s&&(s.click(),!0)}function setStatus(e){return DOM.setElements([{elm:"#_blast-ico",props:{d:e?"M505.16405,19.29688c-1.176-5.4629-6.98736-11.26563-12.45106-12.4336C460.61647,0,435.46433,0,410.41962,0,307.2013,0,245.30155,55.20312,199.09162,128H94.88878c-16.29733,0-35.599,11.92383-42.88913,26.49805L2.57831,253.29688A28.39645,28.39645,0,0,0,.06231,264a24.008,24.008,0,0,0,24.00353,24H128.01866a96.00682,96.00682,0,0,1,96.01414,96V488a24.008,24.008,0,0,0,24.00353,24,28.54751,28.54751,0,0,0,10.7047-2.51562l98.747-49.40626c14.56074-7.28515,26.4746-26.56445,26.4746-42.84374V312.79688c72.58882-46.3125,128.01886-108.40626,128.01886-211.09376C512.07522,76.55273,512.07522,51.40234,505.16405,19.29688ZM384.05637,168a40,40,0,1,1,40.00589-40A40.02,40.02,0,0,1,384.05637,168ZM35.68474,352.06641C9.82742,377.91992-2.94985,442.59375.57606,511.41016c69.11565,3.55859,133.61147-9.35157,159.36527-35.10547,40.28913-40.2793,42.8774-93.98633,6.31147-130.54883C129.68687,309.19727,75.97,311.78516,35.68474,352.06641Zm81.63312,84.03125c-8.58525,8.584-30.08256,12.88672-53.11915,11.69922-1.174-22.93555,3.08444-44.49219,11.70289-53.10938,13.42776-13.42578,31.33079-14.28906,43.51813-2.10352C131.60707,404.77148,130.74562,422.67188,117.31786,436.09766Z":"M505.12019,19.09375c-1.18945-5.53125-6.65819-11-12.207-12.1875C460.716,0,435.507,0,410.40747,0,307.17523,0,245.26909,55.20312,199.05238,128H94.83772c-16.34763.01562-35.55658,11.875-42.88664,26.48438L2.51562,253.29688A28.4,28.4,0,0,0,0,264a24.00867,24.00867,0,0,0,24.00582,24H127.81618l-22.47457,22.46875c-11.36521,11.36133-12.99607,32.25781,0,45.25L156.24582,406.625c11.15623,11.1875,32.15619,13.15625,45.27726,0l22.47457-22.46875V488a24.00867,24.00867,0,0,0,24.00581,24,28.55934,28.55934,0,0,0,10.707-2.51562l98.72834-49.39063c14.62888-7.29687,26.50776-26.5,26.50776-42.85937V312.79688c72.59753-46.3125,128.03493-108.40626,128.03493-211.09376C512.07526,76.5,512.07526,51.29688,505.12019,19.09375ZM384.04033,168A40,40,0,1,1,424.05,128,40.02322,40.02322,0,0,1,384.04033,168Z"}}]),e&&DOM.getElement(".progress-panel")||modal.progressPanel(e,options.autoMode,interupt),e}function initMessage(){const e=options.imageFile||0!==DOM.getElement("#imgFile").files.length?DOM.getElement("#imgFile").files[0]:"";message.setProperties({inputMessage:DOM.getElement("#message").value,inputCaption:DOM.getElement("#_caption").value,imageFile:e})}function startProcess(){if(loop.isRunning||loop.start(setStatus),loop.isRunning&&queue.now){let e=queue.currentIndex+=1,t=queue.run();if(message.setData(t),!printLink(e,message.link))return modal.alert("If You see this ERROR, Contact Developer!"),void loop.stop(setStatus);options.autoMode?(setTimeout((()=>{DOM.getElement(queryElm.linkElm).click()}),500),setTimeout((async()=>{const e=DOM.getElement(queryElm.errModal);let s="";if(e)s=e.innerText.includes("OK")?(report.fail(t),"ERROR"):(report.fail(t,0),"FAILED"),e.click();else{const{useCaption:e,useImage:n,hasImage:a}=options,i=DOM.getElement(queryElm.send);s=i?(i.click(),"SUCCESS"):"FAILED",n&&a&&("caption"!==e||"SUCCESS"===s)&&(s=!0===await message.sendImg()?"SUCCESS":"FAILED"),"SUCCESS"===s?report.success():report.fail(t,0)}}),4500)):report.success(),updateUI(e,message.phone)}else stopProcess()}async function interupt(){loop.break(),queue.now&&await modal.confirm("Stop Proses?")?stopProcess():startProcess()}function stopProcess(){options.autoMode&&!user.isPremium&&user.updateTrial("update"),loop.stop(setStatus),showReport()}function showReport(){queue.now||(DOM.setElement("#getFile",{value:""}),resetRecipient());const e=e=>{const{count:t,data:s}=report.createData(e);if(s.isEmpty)return t;const{fileUrl:n,fileName:a}=csvFile.export(e,s),i={tag:"a",href:n,html:DOM.createSVGElement({viewBox:"0 0 512 512",fill:"currentColor",d:"M480 352h-133.5l-45.25 45.25C289.2 409.3 273.1 416 256 416s-33.16-6.656-45.25-18.75L165.5 352H32c-17.67 0-32 14.33-32 32v96c0 17.67 14.33 32 32 32h448c17.67 0 32-14.33 32-32v-96C512 366.3 497.7 352 480 352zM432 456c-13.2 0-24-10.8-24-24c0-13.2 10.8-24 24-24s24 10.8 24 24C456 445.2 445.2 456 432 456zM233.4 374.6C239.6 380.9 247.8 384 256 384s16.38-3.125 22.62-9.375l128-128c12.49-12.5 12.49-32.75 0-45.25c-12.5-12.5-32.76-12.5-45.25 0L288 274.8V32c0-17.67-14.33-32-32-32C238.3 0 224 14.33 224 32v242.8L150.6 201.4c-12.49-12.5-32.75-12.5-45.25 0c-12.49 12.5-12.49 32.75 0 45.25L233.4 374.6z"}).outerHTML,download:`${a}`,classid:"wfu-export-csv",title:`Download "${a}.csv"`};return`${t} `+DOM.createElement(i).outerHTML};let t="[REPORT] Penulisan Link Selesai.",s={html:`${report.sukses} Link Berhasil Ditulis`,classid:"wfu-reports"};options.autoMode&&(t="[REPORT] Kirim Pesan Otomatis Selesai.",s=DOM.createListElement("ul",[`SUKSES = ${report.sukses}`,`GAGAL = ${e("gagal")}`,`ERROR = ${e("error")}`],{classid:"wfu-reports"})),modal.alert(s,t),options.autoMode&&!user.isPremium&&user.showAlert(user.isTrial?3:(DOM.getElement("#auto").click(),4),!0)}function updateUI(e=.5,t=null){let s=queue.size,n=s?"inline-block":"none",a=s?`Data: Loaded, ${s} Nomor`:"";DOM.setElements([{elm:"#_file-info",props:{title:a,style:`display:${n}`}},{elm:"#_data-count",props:{text:s}}]),DOM.setElement("span.curPhone",{text:`+${t||""}`}),showProgress(queue,e)}function showProgress(e,t){let s=e.long||100,n=t/s*100;t>=1&&DOM.setElements([{elm:".waBar",props:{title:`${t}/${s}`}},{elm:"span.curNumb",props:{text:`${t}/${s}`}}]),DOM.setElementStyle(".waBar",{width:`${n}%`})}class AppEvents{constructor(){}async runTasks(e){const{autoMode:t,useImage:s}=options;if(await checkStatus())return;let n=t?s?6e3:5500:10;initMessage(),report.reset(t),loop.set(n,(()=>startProcess())),startProcess()}tabMenu(e){const t=e.currentTarget||e.target,s=t.value,n=DOM.getElement("#panelBody .menus",!0);DOM.setElements([{elm:n,props:{removeClass:"active"}},{elm:t,props:{addClass:"active"}}]).setElementsStyle([{elm:"#panelBody .menu-content",props:{display:"none"}},{elm:`#${s}`,props:{display:"block"}}]),options.setOption("activeTab",Array.from(n).indexOf(t))}async autoMode(e){const t=DOM.getElement("#useImage"),s=e.currentTarget||e.target;s.checked&&(s.checked=await user.check()),t.checked&&t.click(),options.setOption("autoMode",s.checked)}async useImage(e){const t="caption"===options.useCaption,s=e.currentTarget||e.target,n=DOM.getElement("#_mode");s.checked&&(s.checked=await user.check(),n.checked=s.checked);const a=!t||!s.checked,i=t?"":"Caption menggunakan pesan",r=s.dataset.captId;DOM.setElements([{elm:`#${s.value}`,props:{disabled:!s.checked}},{elm:`#${r}`,props:{disabled:a,title:i}},{elm:"#useCaption",props:{disabled:!s.checked}}]),options.setOptions({autoMode:n.checked,useImage:s.checked})}async loadData(e){const t=(e.currentTarget||e.target).files[0];resetRecipient(),loadRecipient(await csvFile.import(t))}imagePreview(e){const t=e.currentTarget||e.target,s=t.dataset.value,n=4*Math.pow(1024,2);let a=null;s?DOM.setElement(`#${s}`,{value:""}):(a=t.files[0],a&&a.size>n&&(modal.alert("Ukuran gambar tidak boleh lebih dari 4MB"),a=null)),DOM.setElement("#_img-output",{src:a?URL.createObjectURL(a):""}).setElementStyle("#_deleteImg",{display:a?"block":"none"}),options.setOptions({hasImage:!!a,imageFile:a})}toggleApp(e){const t=e.currentTarget||e.target,s=t.getAttribute("value"),n=DOM.getElement(`#${s}`),a=t.classList.toggle("active");n.style.height=n.style.height?null:`${n.scrollHeight}px`,options.setOption("openPanel",a)}inputRange(e){const t=e.currentTarget||e.target,{id:s,value:n}=t;DOM.setElements([{elm:t,props:{max:"maxQueue"===s?options.queueLimit:options.bpLimit}},{elm:DOM.getElement("output",t.parentElement),props:{text:n}}]),options.setOption(s,n)}inputChecks(e){const t=e.currentTarget||e.target,{id:s,value:n}=t;options.setOption(s,n)}inputSelects(e){const t=e.currentTarget||e.target,{id:s,value:n}=t;switch(s){case"themeColor":!function(e,t){DOM.setElementStyle("#wayfuPanel",{backgroundColor:t}),options.setOption(e,t)}(s,n);break;case"dateFormat":!function(e){if(isNumeric(e))e=2!==Number(e)?e:0,options.setOptions({isFormat:2===e,monthIndex:e,dateFormat:e});else{options.setOptions({isFormat:!1,dateFormat:e});const t=DOM.getElement("#getFile");queue.isEmpty&&""===t.value||(DOM.setElement(t,{value:""}),modal.alert("Untuk opsi Deteksi Otomatis, Silahkan masukkan ulang file penerima pesan.","[WARNING] Masukkan ulang CSV"),resetRecipient())}}(n);break;case"useCaption":!async function(e,t){let s="caption"!==t;s&&(s="caption"!==(t=await modal.confirm("Mengubah Pesan menjadi Caption akan menaikan potensi Banned dari WhatsApp. Apa Anda Yakin?")?t:"caption")),DOM.setElement("#_caption",{disabled:s,title:s?"Caption menggunakan pesan":""}),options.setOption(e,t)}(s,n)}}changeLog(e){const t=DOM.createElement({tag:"div",classid:"wfu-changelog",style:"overflow-y:scroll"});changes.Log.slice(0,5).forEach(((e,s)=>{let n=dateFormat(new MyDate(e.date),1),a=`${0==s?"WayFu - ":""}Version: ${e.version} (${n})`,i=DOM.createElement({tag:"div",classid:"wfu-changelog-items",append:t});DOM.createElement({tag:"span",text:a,append:i}),DOM.createListElement("ul",e.content,{append:i})})),modal.alert(t,"Detail Pembaruan.")}}const listeners=new AppEvents;function createView(e,t,s){const{name:n,version:a,icon:i}=s;DOM.createElement({tag:"header",id:"wayfuPanel",after:"header",html:e.replace(/VERSION/,a).replace(/APP_NAME/,n).replace(/WA_VERSION/,window.WAPI.Debug.VERSION)}),DOM.addStyle(t,{id:"wayfuStyle"}),DOM.setElement("img.appIco",{src:i}),initListener()}function initListener(){eventLists.forEach((e=>{DOM.getElement(e.element||document,!0).forEach((t=>{DOM.onEvent(t,e.type,(function(t){let s=listeners[e.event];if("function"==typeof s)return s(t)}))}))}))}const getWebpack=e=>{let t,s=Object.keys(e);for(let e of s)/[^|]?webpack./g.test(e)&&(t=e);return t||null};function setWAPI(e){window.WAPI=Object.assign({},e),Object.defineProperty(window.WAPI,"sendImage",{value:function(e,t,s=""){return new Promise((n=>{this.Chat.find(`${e}@c.us`).then((e=>{let a=new this.MediaCollection(e);a.processAttachments([{file:t},1],e,1).then((()=>{a.models[0].sendToChat(e,{caption:s}),n(!0)})).catch((e=>{n(!1)}))}))}))}})}const loadWapi=e=>{if(!window.Store||!window.Store.Msg){function t(e){let t=0;for(let s in e.m)if("object"==typeof e(s)&&null!==e(s)&&(storeObjects.forEach((n=>{if(!n.conditions||n.foundedModule)return;let a=n.conditions(e(s));null!==a&&(t++,n.foundedModule=a)})),t==storeObjects.length))break;let s=storeObjects.find((e=>"Store"===e.id));return window.Store=s.foundedModule?s.foundedModule:{},storeObjects.forEach((e=>{"Store"!==e.id&&e.foundedModule&&(window.Store[e.id]=e.foundedModule)})),window.Store}const s=`parasite${Date.now()}`,n=getWebpack(e);n&&"object"==typeof e[n]?(e[n].push([[s],{},(e,s,n)=>{t(e)}]),setWAPI(window.Store)):console.error("Failed to load WAPI Module!")}};class App extends GM_Library{constructor(){super(),this.initialize()}initialize(){loadWapi(unsafeWindow),this.registerPanel(),this.registerUser(),this.registerOptions(),this.onLoadView()}registerPanel(){chat.init(window.WAPI.WebClasses.active);const e=this.getResource("pnl"),t=this.getResource("css"),s=this.getResource("ico","url");createView(e,t,Object.assign({},this.appInfo,{icon:s}))}registerUser(){user.init().gettingData()}registerOptions(){options.init()}async onLoadView(){DOM.setElementStyle("#wayfuPanel",{"background-color":options.themeColor}),DOM.getElement("#panelBody .menus",!0)[options.activeTab||0].click(),options.openPanel&&DOM.getElement("#toggleApp").click(),changes.checkUpdate()}}async function init(){await DOM.hasElement("div.two")?new App:await init()}init(); \ No newline at end of file