Loading
function(e,t,n){n.d(t,{FV:()=>C,M3:()=>d,O7:()=>m,SQ:()=>y,cd:()=>x,ke:()=>v,n$:()=>g,pY:()=>E}),n(321073);var l=n(155718),i=n(721768),r=n(861382),a=n(203779),o=n(31717),s=n(522602),u=n(408018),p=n(323350),c=n(820066),h=n(551483);let f=/([\p{L}\p{N}\p{sc=Deva}\p{sc=Thai}_-]+):/gu;function g(e){let t=c.VW.richValue(e)[0];return null==t||"applicationCommand"!==t.type?null:[t,h.Xg]}function d(e){if(null==e.selection)return null;let t=c.VW.above(e,{at:e.selection.focus,match:e=>c.AS.isType(e,"applicationCommandOption")})??null;return null!=t||c.ZF.isCollapsed(e.selection)?t:c.VW.above(e,{at:e.selection.anchor,match:e=>c.AS.isType(e,"applicationCommandOption")})??null}function m(e){let t=g(e),n=[],l=t?.[0].children;if(null!=l)for(let e of l)c.AS.isType(e,"applicationCommandOption")&&n.push(e.optionName);return n}function y(e,t,n){let l={};if(null==t.options)return{};let i=g(e),r=Object.fromEntries(t.options.map(e=>[e.name,e])),a=i?.[0].children;if(null!=a){for(let t of a)if(c.AS.isType(t,"applicationCommandOption")){let i=r[t.optionName];null!=i&&(l[t.optionName]=C(e,i,t,n))}}return l}function C(e,t,n,i){let r=n.children.map(n=>{if(t.type===l.n4.ATTACHMENT){let e=s.A.getUpload(i,t.name,o.C.SlashCommand);if(null!=e)return{type:"text",text:e.filename??""}}if(c.l5.isText(n))return{type:"text",text:n.text};if(c.VW.isVoid(e,n)){let e=(0,u.QR)(n);if(null!=e)return e}return{type:"text",text:(0,p.IQ)(n,{mode:"raw"})}});if(t.type!==l.n4.STRING){for(;r.length>0&&"text"===r[0].type&&""===r[0].text.trim();)r.shift();for(;r.length>0&&"text"===r[r.length-1].type&&""===r[r.length-1].text.trim();)r.pop()}return r}function x(e,t,n,l,r){if(null==e.options)return{};let o=Object.fromEntries(e.options.map(e=>[e.name,a.J({option:e,content:l[e.name]??null,guildId:t,channelId:n,allowEmptyValues:r})]));return i._y(n,o),o}function v(e,t,n,l,o){let[s]=l,u=r.A.getActiveCommand(n),p=u?.options?.find(e=>e.name===s.optionName);if(null==p)return;let c=C(e,p,s,n),h=a.J({option:p,content:c,guildId:t,channelId:n,allowEmptyValues:o});return i.H2(n,{[s.optionName]:{lastValidationResult:h}}),h}function E(e,t){if(null==t.options||0===t.options.length)return[];let n=c.VW.richValue(e),l=[],i=new Set(m(e)),r={},a=new Set;for(let e of t.options)r[e.displayName]=e,i.has(e.name)||a.add(e.displayName);let o=null;for(let t=0;t<n.length;t++){let i=n[t];if("line"===i.type||"applicationCommand"===i.type)for(let s=0;s<i.children.length;s++){let u,h=i.children[s],g=[t,s];if(c.AS.isType(h,"applicationCommandOption")){null!=o&&(o.valueRange.focus=c.VW.before(e,g)??c.VW.start(e,[]),o.text=(0,p.WO)(n,{mode:"raw",range:o.valueRange}).trim(),l.push(o),o=null);continue}if(c.l5.isText(h))for(f.lastIndex=0;null!=(u=f.exec(h.text));){if(0!==u.index&&null==h.text.charAt(u.index-1).match(/(\t|\s)/))continue;let e=u[1];if(!a.has(e))continue;a.delete(e);let t=r[e];if(null==t)continue;let i={path:g,offset:u.index},s={path:g,offset:i.offset+u[0].length},c={path:g,offset:s.offset},f={name:t.name,displayName:t.displayName,type:t.type,keyRange:{anchor:i,focus:s},valueRange:{anchor:c,focus:c},text:""};null!=o&&(o.valueRange.focus=f.keyRange.anchor,o.text=(0,p.WO)(n,{mode:"raw",range:o.valueRange}).trim(),l.push(o)),o=f}}}return null!=o&&(o.valueRange.focus=c.VW.end(e,[]),o.text=(0,p.WO)(n,{mode:"raw",range:o.valueRange}).trim(),l.push(o)),l}}