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