UNPKG

n8n-editor-ui

Version:

Workflow Editor UI for n8n

1 lines 202 kB
!function(){try{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{}).SENTRY_RELEASE={id:"n8n@2.16.1"}}catch(e){}}(),function(){System.register(["./chunk-legacy-Dz3fjYb5.js","./vue.runtime.esm-bundler-legacy-BW6xDdqj.js","./core-legacy-VD8c7QJ-.js","./get-legacy-CLCnFf3e.js","./empty-legacy-CvitQtk3.js","./users.store-legacy-azRUgFdP.js","./constants-legacy-2_ytuuS3.js","./useRootStore-legacy-CC08el-l.js"],(function(_export,_context){var __toCommonJS,__require,__toESM,__commonJSMin,unref,useI18n,require_get,process$1,init_dist$1,init_dist,init_empty,Buffer,empty_exports,require_path_browserify,importCurlEventBus,useToast,CURL_IMPORT_NODES_PROTOCOLS,CURL_IMPORT_NOT_SUPPORTED_PROTOCOLS,assert,import_get,CCError,UTF8encoder,Word,require_tree_sitter,import_tree_sitter,Bash,parser,BACKSLASHES,DOUBLE_QUOTE_BACKSLASHES,ANSI_BACKSLASHES,CURLAUTH_BASIC,CURLAUTH_DIGEST,CURLAUTH_NEGOTIATE,CURLAUTH_NTLM,CURLAUTH_DIGEST_IE,CURLAUTH_NTLM_WB,CURLAUTH_BEARER,CURLAUTH_AWS_SIGV4,CURLAUTH_ANY,curlLongOpts,curlLongOptsShortened,COMMON_SUPPORTED_ARGS,curlShortOpts,changedShortOpts,canBeList,COMMA_SEPARATED,SEMICOLON_SEPARATED,Headers,MAX_IP6LEN,require_Pattern,require_Utils,require_Unescaper,require_Escaper,require_ParseException,require_ParseMore,require_DumpException,require_Inline,require_Parser,require_Dumper,require_Yaml,import_Yaml,supportedArgs$43,supportedArgs$42,require_jsesc,import_jsesc,javaScriptSupportedArgs,nodeSupportedArgs,FORBIDDEN_HEADERS,supportedArgs$41,supportedArgs$40,supportedArgs$39,supportedArgs$38,supportedArgs$37,supportedArgs$36,supportedArgs$35,supportedArgs$34,supportedArgs$33,supportedArgs$32,supportedArgs$31,supportedArgs$30,supportedArgs$29,supportedArgs$28,supportedArgs$27,supportedArgs$26,supportedArgs$25,supportedArgs$24,supportedArgs$23,supportedArgs$22,supportedArgs$21,supportedArgs$20,supportedArgs$19,supportedArgs$18,supportedArgs$17,supportedArgs$16,supportedArgs$15,supportedArgs$14,supportedArgs$13,reservedHeaders,supportedArgs$12,supportedArgs$11,supportedArgs$10,supportedArgs$9,supportedArgs$8,supportedArgs$7,supportedArgs$6,supportedArgs$5,supportedArgs$4,supportedArgs$3,supportedArgs$2,supportedArgs$1,INDENTATION,supportedArgs,SUPPORTED_CONTENT_TYPES,CONTENT_TYPE_KEY,getContentTypeHeader,isContentType,isJsonRequest,isFormUrlEncodedRequest,isMultipartRequest,isBinaryRequest,toKeyValueArray,extractHeaders,extractQueries,keyValueBodyToNodeParameters,jsonBodyToNodeParameters,multipartToNodeParameters,lowerCaseContentTypeKey,encodeBasicAuthentication,jsonHasNestedObjects,mapCookies,flattenObject,toHttpNodeParameters;function has(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function isInt(e){return/^\s*[+-]?\d+$/.test(e)}function eq(e,t){return null==e||null==t?e===t:"string"==typeof t?1===e.tokens.length&&"string"==typeof e.tokens[0]&&e.tokens[0]===t:e.tokens.length===t.tokens.length&&e.tokens.every(((e,r)=>{const s=t.tokens[r];return"string"==typeof e?e===s:"string"!=typeof s&&e.text===s.text}))}function firstShellToken(e){return"string"==typeof e?null:e.firstShellToken()}function mergeWords(...e){const t=[];for(const r of e)r instanceof Word?t.push(...r.tokens):t.push(r);return new Word(t)}function joinWords(e,t){const r=[];for(const s of e)r.length&&r.push(t),r.push(...s.tokens);return new Word(r)}function warnf(e,t){e.warnings.push(t)}function underline(e,t,r,s){t===r&&r++;let n=t;t>0&&(n=s.lastIndexOf("\n",t-1)+1);let o=r-t,a=s.indexOf("\n",t);-1===a?a=s.length:a<r&&(o=a-t+1);return s.slice(n,a)+"\n"+(" ".repeat(t-n)+"^".repeat(o))}function underlineCursor(e,t){return underline(e,e.startIndex,e.endIndex,t)}function underlineNode(e,t){const r=e.tree.rootNode;let s=e.startIndex,n=e.endIndex;return t||(t=r.text,s-=r.startIndex,n-=r.startIndex),underline(e,s,n,t)}function warnIfPartsIgnored(e,t,r){e.urls.length>1&&!(null==r?void 0:r.multipleUrls)&&t.push(["multiple-urls","found "+e.urls.length+" URLs, only the first one will be used: "+e.urls.map((e=>JSON.stringify(e.originalUrl.toString()))).join(", ")]),e.dataReadsFile&&!(null==r?void 0:r.dataReadsFile)&&t.push(["unsafe-data","the generated data content is wrong, "+JSON.stringify("@"+e.dataReadsFile)+" means read the file "+JSON.stringify(e.dataReadsFile)]),e.urls[0].queryReadsFile&&!(null==r?void 0:r.queryReadsFile)&&t.push(["unsafe-query","the generated URL query string is wrong, "+JSON.stringify("@"+e.urls[0].queryReadsFile)+" means read the file "+JSON.stringify(e.urls[0].queryReadsFile)]),e.cookieFiles&&!(null==r?void 0:r.cookieFiles)&&t.push(["cookie-files","passing a file for --cookie/-b is not supported: "+e.cookieFiles.map((e=>JSON.stringify(e.toString()))).join(", ")])}function removeBackslash(e){return"\n"===e.charAt(1)?"":e.charAt(1)}function removeBackslashes(e){return e.replace(BACKSLASHES,removeBackslash)}function removeDoubleQuoteBackslashes(e){return e.replace(DOUBLE_QUOTE_BACKSLASHES,removeBackslash)}function removeAnsiCBackslashes(e){return e.replace(ANSI_BACKSLASHES,(function(e){switch(e.charAt(1)){case"\\":return"\\";case"a":return"";case"b":return"\b";case"e":case"E":return"";case"f":return"\f";case"n":return"\n";case"r":return"\r";case"t":return"\t";case"v":return"\v";case"'":return"'";case'"':return'"';case"?":return"?";case"c":if(e.codePointAt(2)>127)throw new CCError('non-ASCII control character in ANSI-C quoted string: "\\u{'+e.codePointAt(2).toString(16)+'}"');return"?"===e[2]?"":String.fromCodePoint(31&e[2].toUpperCase().codePointAt(0));case"x":case"u":case"U":return String.fromCodePoint(parseInt(e.slice(2),16));case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":return String.fromCodePoint(parseInt(e.slice(1),8)%256);default:throw new CCError("unhandled character in ANSI-C escape code: "+JSON.stringify(e))}}))}function toTokens(e,t,r){let s=[];switch(e.type){case"$":return["$"];case"word":case"number":return[removeBackslashes(e.text)];case"raw_string":return[e.text.slice(1,-1)];case"ansi_c_string":return[removeAnsiCBackslashes(e.text.slice(2,-1))];case"string":case"translated_string":{let n="";for(const o of e.namedChildren)if("string_content"===o.type)n+=removeDoubleQuoteBackslashes(o.text);else{const e=toTokens(o,t,r);"string"==typeof e?n+=e:(n&&(s.push(n),n=""),s=s.concat(e))}return(n||0===s.length)&&s.push(n),s}case"simple_expansion":return r.push(["expansion","found environment variable\n"+underlineNode(e,t)]),e.firstNamedChild&&"special_variable_name"===e.firstNamedChild.type&&r.push(["special_variable_name",e.text+" is a special Bash variable\n"+underlineNode(e.firstNamedChild,t)]),[{type:"variable",value:e.text.slice(1),text:e.text,syntaxNode:e}];case"expansion":return r.push(["expansion","found expansion expression\n"+underlineNode(e,t)]),[{type:"variable",value:e.text.slice(2,-1),text:e.text,syntaxNode:e}];case"command_substitution":return r.push(["expansion","found command substitution expression\n"+underlineNode(e,t)]),[{type:"command",value:e.text.slice(e.text.startsWith("$(")?2:1,-1),text:e.text,syntaxNode:e}];case"concatenation":{let n=0,o="";for(const a of e.children){o+=e.text.slice(n,a.startIndex-e.startIndex),n=a.endIndex-e.startIndex;const i=toTokens(a,t,r);"string"==typeof i?o+=i:(o&&(s.push(o),o=""),s=s.concat(i))}return o+=e.text.slice(n),(o||0===s.length)&&s.push(o),s}default:throw new CCError("unexpected syntax node type "+JSON.stringify(e.type)+'. Must be one of "word", "number", "string", "raw_string", "ansi_c_string", "expansion", "simple_expansion", "translated_string", "command_substitution" or "concatenation"\n'+underlineNode(e,t))}}function toWord(e,t,r){return new Word(toTokens(e,t,r))}function*traverseLookingForBadNodes(e){const t=e.walk();let r=!1;for(;!r;){if(("ERROR"===t.nodeType||t.nodeIsMissing)&&(yield t),t.gotoFirstChild())continue;if(t.gotoNextSibling())continue;let e=!0;for(;e;)t.gotoParent()||(e=!1,r=!0),t.gotoNextSibling()&&(e=!1)}}function warnAboutBadNodes(e,t,r){let s=0;for(const a of traverseLookingForBadNodes(e)){if(s<3){let e="";try{e=":\n"+underlineCursor(a,t)}catch(o){}const s=a.startPosition.row,n=a.startPosition.column;r.push(["bash",`Bash parsing error on line ${s+1}`+(0!==n?`, column ${n+1}`:"")+e])}s+=1}const n=s-3;n>0&&r.push(["bash",`${n} more Bash parsing error${n>1?"s":""} omitted`])}function warnAboutUselessBackslash(e,t,r){const s=t[e.endPosition.row],n=s.match(/\\\s+$/);n&&t.length>e.endPosition.row+1&&void 0!==n.index&&r.push(["unescaped-newline","The trailling '\\' on line "+(e.endPosition.row+1)+" is followed by whitespace, so it won't escape the newline after it:\n"+s+"\n"+" ".repeat(n.index)+"^".repeat(n[0].length)])}function extractRedirect(e,t,r){if(!e.namedChildCount)throw new CCError('got empty "redirected_statement" AST node');let s,n;const[o,...a]=e.namedChildren;if("command"!==o.type)throw new CCError('got "redirected_statement" AST node whose first child is not a "command", got '+o.type+" instead\n"+underlineNode(o,t));if(e.childCount<2)throw new CCError('got "redirected_statement" AST node with only one child - no redirect');a.length>1&&r.push(["multiple-redirects","found "+a.length+" redirect nodes. Only the first one will be used:\n"+underlineNode(a[1],t)]);const i=a[0];if("file_redirect"===i.type){const e=i.childForFieldName("destination");if(!e)throw new CCError('got "file_redirect" AST node with no "destination" child');n=toWord(e,t,r)}else if("heredoc_redirect"===i.type){const e=i.descendantsOfType("heredoc_body")[0];if(!e)throw new CCError('got "redirected_statement" AST node without heredoc_body');s=new Word(e.text)}else{if("herestring_redirect"!==i.type)throw new CCError('got "redirected_statement" AST node whose second child is not one of "file_redirect", "heredoc_redirect" or "herestring_redirect", got '+o.type+" instead");if(i.namedChildCount<1||!i.firstNamedChild)throw new CCError('got "redirected_statement" AST node with empty herestring');s=toWord(i.firstNamedChild,t,r)}return[o,s,n]}function _findCurlInPipeline(e,t,r){let s,n,o;for(const a of e.namedChildren)if("command"===a.type){const e=a.namedChildren[0];if("command_name"!==e.type)throw new CCError('got "command" AST node whose first child is not a "command_name", got '+e.type+" instead\n"+underlineNode(e,t));const n=e.namedChildren[0];if("word"!==n.type)throw new CCError('got "command_name" AST node whose first child is not a "word", got '+n.type+" instead\n"+underlineNode(n,t));"curl"===n.text&&(s?r.push(["multiple-curl-in-pipeline","found multiple curl commands in pipeline:\n"+underlineNode(a,t)]):s=a)}else if("redirected_statement"===a.type){const[e,i,l]=extractRedirect(a,t,r);"curl"===e.namedChildren[0].text&&(s?r.push(["multiple-curl-in-pipeline","found multiple curl commands in pipeline:\n"+underlineNode(e,t)]):[s,n,o]=[e,i,l])}else if("pipeline"===a.type){const[e,i,l]=_findCurlInPipeline(a,t,r);if(!e)continue;"curl"===e.namedChildren[0].text&&(s?r.push(["multiple-curl-in-pipeline","found multiple curl commands in pipeline:\n"+underlineNode(e,t)]):[s,n,o]=[e,i,l])}return[s,n,o]}function findCurlInPipeline(e,t,r){const[s,n,o]=_findCurlInPipeline(e,t,r);if(!s)throw new CCError("could not find curl command in pipeline\n"+underlineNode(e,t));return[s,n,o]}function extractCommandNodes(e,t,r){if("program"!==e.rootNode.type)throw new CCError('expected a "program" top-level AST node, got '+e.rootNode.type+" instead");if(e.rootNode.namedChildCount<1||!e.rootNode.namedChildren)throw new CCError('empty "program" node');const s=t.split("\n");let n=!1;const o=[];for(const a of e.rootNode.namedChildren)switch(a.type){case"comment":n=!0;continue;case"command":o.push([a,void 0,void 0]),warnAboutUselessBackslash(a,s,r);break;case"redirected_statement":o.push(extractRedirect(a,t,r)),warnAboutUselessBackslash(a,s,r);break;case"pipeline":o.push(findCurlInPipeline(a,t,r)),warnAboutUselessBackslash(a,s,r);break;case"heredoc_body":continue;case"ERROR":throw new CCError(`Bash parsing error on line ${a.startPosition.row+1}:\n`+underlineNode(a,t));default:throw new CCError("found "+JSON.stringify(a.type)+' AST node, only "command", "pipeline" or "redirected_statement" are supported\n'+underlineNode(a,t))}if(!o.length)throw new CCError('expected a "command" or "redirected_statement" AST node'+(n?', only found "comment" nodes':""));return o}function toNameAndArgv(e,t,r){if(e.childCount<1)throw new CCError('empty "command" node\n'+underlineNode(e,t));const s=e.childForFieldName("name"),n=e.childrenForFieldName("argument");if(!s)throw new CCError('found "command" AST node with no "command_name" child\n'+underlineNode(e,t));return[s,n]}function nameToWord(e,t,r){if(e.childCount<1||!e.firstChild)throw new CCError('found empty "command_name" AST node\n'+underlineNode(e,t));e.childCount>1&&r.push(["extra-command_name-children",'expected "command_name" node to only have one child but it has '+e.childCount]);const s=e.firstChild,n=toWord(s,t,r),o=n.toString(),a=firstShellToken(n);if(a){if("$curl"!==o)throw new CCError("expected command name to be a simple value but found a "+a.type+"\n"+underlineNode(a.syntaxNode,t))}else if("curl"!==o.trim()){const e=o.trim();if(!e)throw new CCError("found command without a command_name\n"+underlineNode(s,t));throw new CCError('command should begin with "curl" but instead begins with '+JSON.stringify(clip(e))+"\n"+underlineNode(s,t))}return n}function tokenize(e,t=[]){const r=parser.parse(e);warnAboutBadNodes(r,e,t);const s=extractCommandNodes(r,e,t),n=[];for(const[o,a,i]of s){const[r,s]=toNameAndArgv(o,e,t);n.push([[nameToWord(r,e,t),...s.map((r=>toWord(r,e,t)))],a,i])}return n}function pickAuth(e){if(-17===e)return"basic";const t=[[4,"negotiate"],[64,"bearer"],[2,"digest"],[8,"ntlm"],[32,"ntlm-wb"],[1,"basic"],[128,"aws-sigv4"]];for(const[r,s]of t)if(e&r)return s;return"none"}function toBoolean(e){return!!e.startsWith("no-disable-")||!e.startsWith("disable-")&&!e.startsWith("no-")}function checkSupported(e,t,r,s){s&&!s.has(r.name)&&warnf(e,[r.name,t+" is not a supported option"+(r.removed?", it was removed in curl "+r.removed:"")])}function pushProp(e,t,r){return Object.prototype.hasOwnProperty.call(e,t)||(e[t]=[]),e[t].push(r),e}function pushArgValue(e,t,r,s){switch(r){case"data":case"data-ascii":return pushProp(t,"data",["data",s]);case"data-binary":return pushProp(t,"data",[s.startsWith("@")?"binary":"data",s]);case"data-raw":return pushProp(t,"data",[s.startsWith("@")?"raw":"data",s]);case"data-urlencode":return pushProp(t,"data",["urlencode",s]);case"json":return t.json=!0,pushProp(t,"data",["json",s]);case"url-query":return s.startsWith("+")?pushProp(t,"url-query",["raw",s.slice(1)]):pushProp(t,"url-query",["urlencode",s]);case"form":return pushProp(t,"form",{value:s,type:"form"});case"form-string":return pushProp(t,"form",{value:s,type:"string"});case"aws-sigv4":t.authtype|=128;break;case"oauth2-bearer":t.authtype|=64;break;case"unix-socket":case"abstract-unix-socket":pushProp(t,"unix-socket",s);break;case"trace":case"trace-ascii":case"stderr":case"libcurl":case"config":case"parallel-max":e[r]=s;break;case"language":return void(e[r]=s.toString())}return pushProp(t,r,s)}function setArgValue(e,t,r,s){switch(r){case"digest":s?t.authtype|=2:t.authtype&=-3;break;case"proxy-digest":s?t.proxyauthtype|=2:t.proxyauthtype&=-3;break;case"negotiate":s?t.authtype|=4:t.authtype&=-5;break;case"proxy-negotiate":s?t.proxyauthtype|=4:t.proxyauthtype&=-5;break;case"ntlm":s?t.authtype|=8:t.authtype&=-9;break;case"proxy-ntlm":s?t.proxyauthtype|=8:t.proxyauthtype&=-9;break;case"ntlm-wb":s?t.authtype|=32:t.authtype&=-33;break;case"basic":s?t.authtype|=1:t.authtype&=-2;break;case"proxy-basic":s?t.proxyauthtype|=1:t.proxyauthtype&=-2;break;case"anyauth":s&&(t.authtype=-17);break;case"proxy-anyauth":s&&(t.proxyauthtype=-17);break;case"location":t.location=s;break;case"location-trusted":t.location=s,t["location-trusted"]=s;break;case"http1.0":t.httpVersion="1.0";break;case"http1.1":t.httpVersion="1.1";break;case"http2":t.httpVersion="2";break;case"http2-prior-knowledge":t.httpVersion="2-prior-knowledge";break;case"http3":t.httpVersion="3";break;case"http3-only":t.httpVersion="3-only";break;case"tlsv1":t.tlsVersion="1";break;case"tlsv1.0":t.tlsVersion="1.0";break;case"tlsv1.1":t.tlsVersion="1.1";break;case"tlsv1.2":t.tlsVersion="1.2";break;case"tlsv1.3":t.tlsVersion="1.3";break;case"verbose":case"version":case"trace-time":case"test-event":case"progress-bar":case"progress-meter":case"fail-early":case"styled-output":case"help":case"silent":case"show-error":case"parallel":case"parallel-immediate":case"stdin":e[r]=s;break;case"next":s&&t.url&&t.url.length>0&&t.url.length>=(t["upload-file"]||[]).length&&t.url.length>=(t.output||[]).length&&(t={authtype:1,proxyauthtype:1},e.configs.push(t));break;default:t[r]=s}return t}function parseArgs(e,t=curlLongOpts,r=curlLongOptsShortened,s=curlShortOpts,n,o=[]){let a={authtype:1,proxyauthtype:1};const i={configs:[a],warnings:o},l=[];for(let _=1,u=!0;_<e.length;_++){const p=e[_];if(u&&p.startsWith("-"))if(eq(p,"--"))u=!1;else if(p.startsWith("--")){const s=firstShellToken(p);if(s)throw new CCError("this "+s.type+" could "+("command"===s.type?"return":"be")+" anything\n"+underlineNode(s.syntaxNode));const o=p.toString(),u=o.slice(2);let c=r[u];if(void 0===c&&(c=t[u]),null===c)throw new CCError("option "+o+": is ambiguous");if(void 0===c)throw new CCError("option "+o+": is unknown");if("string"===c.type){if(_++,_>=e.length)throw new CCError("option "+o+": requires parameter");pushArgValue(i,a,c.name,e[_])}else a=setArgValue(i,a,c.name,toBoolean(o.slice(2)));checkSupported(i,o,c,n),l.push([c.name,o])}else{if(1===p.length){if(!Object.prototype.hasOwnProperty.call(s,""))throw new CCError("option -: is unknown");{const e=s[""],r=t[e];if(null===r)throw new CCError("option -: is unknown");a=setArgValue(i,a,r.name,toBoolean(e)),l.push([r.name,"-"])}}for(let r=1;r<p.length;r++){const o=p.get(r);if("string"!=typeof o)throw new CCError("this "+o.type+" could "+("command"===o.type?"return":"be")+" anything\n"+underlineNode(o.syntaxNode));if(!has(s,o)){if(has(changedShortOpts,o))throw new CCError("option "+p+": "+changedShortOpts[o]);throw new CCError("option "+p+": is unknown")}const u=o,c=s[u],d=t[c];if(null===d)throw new CCError("ambiguous short option -"+o);if("string"===d.type){let t;if(r+1<p.length)t=p.slice(r+1),r=p.length;else{if(!(_+1<e.length))throw new CCError("option "+p.toString()+": requires parameter");_++,t=e[_]}pushArgValue(i,a,d.name,t)}else a=setArgValue(i,a,d.name,toBoolean(c));u&&(checkSupported(i,"-"+u,d,n),l.push([d.name,"-"+u]))}}else{if("string"!=typeof p&&p.tokens.length&&"string"!=typeof p.tokens[0]){const e=1===p.tokens.length?"is":"begins with";o.push(["ambiguous argument","argument "+e+" a "+p.tokens[0].type+", assuming it's a URL\n"+underlineNode(p.tokens[0].syntaxNode)])}pushArgValue(i,a,"url",p),l.push(["url","--url"])}}for(const _ of i.configs)for(const[e,t]of Object.entries(_))Array.isArray(t)&&!canBeList.has(e)&&(_[e]=t[t.length-1]);return[i,l]}function parseCookiesStrict(e){const t=[];for(let r of e.split(";")){r=r.replace(/^ /,"");const[e,s]=r.split("=",2);if(void 0===s)return null;t.push([e,s])}return new Set(t.map((e=>e[0]))).size!==t.length?null:t}function parseCookies(e){const t=[];for(let r of e.split(";")){if(r=r.trim(),!r)continue;const[e,s]=r.split("=",2);t.push([e.trim(),(s||"").trim()])}return new Set(t.map((e=>e[0]))).size!==t.length?null:t}function isIpv6(e){return!(e.length>MAX_IP6LEN)&&!e.includes("-")}function warnAboutGlobs(e,t){let r="";for(let s=0;s<t.length;s++){const n=t[s];if("["===n&&"\\"!==r){let n=s+1;for(;n<t.length&&"]"!==t[n];)n++;if(!(n<t.length&&"]"===t[n]))return void warnf(e,["unbalanced-glob",`bracket doesn't have a closing bracket:\n${t}\n${" ".repeat(s)}^`]);{const o=t.slice(s,n+1);isIpv6(o)||warnf(e,["glob-in-url",`globs in the URL are not supported:\n${t}\n`+" ".repeat(s)+"^".repeat(o.length)]),r=""}}else if("{"===n&&"\\"!==r){let n=s+1;for(;n<t.length&&"}"!==t[n];)n++;if(!(n<t.length&&"}"===t[n]))return void warnf(e,["unbalanced-glob",`bracket doesn't have a closing bracket:\n${t}\n${" ".repeat(s)}^`]);{const o=t.slice(s,n+1);warnf(e,["glob-in-url",`globs in the URL are not supported:\n${t}\n`+" ".repeat(s)+"^".repeat(o.length)]),r=""}}r=n}}function parseurl(e,t,r){var s;const n={scheme:new Word,host:new Word,port:new Word,path:new Word,query:new Word,fragment:new Word};t.globoff||(r.isString()&&warnAboutGlobs(e,r.toString()),r=r.replace(/\\([[\]{}])/g,"$1"));let o=null;if(r.tokens.length&&"string"==typeof r.tokens[0]&&(o=r.tokens[0].match(/^([a-zA-Z0-9+-.]*):\/\/*/)),o){const[e,t]=o;n.scheme=new Word(t.toLowerCase()),r=r.slice(e.length)}else n.scheme=null!==(s=t["proto-default"])&&void 0!==s?s:new Word("http");eq(n.scheme,"http")||eq(n.scheme,"https")||warnf(e,["bad-scheme",`Protocol "${n.scheme}" not supported`]);const a=r.indexOfFirstChar("/?#");if(-1!==a){n.host=r.slice(0,a),n.path=r.slice(a);const e=n.path.indexOf("#"),t=n.path.indexOf("?");-1!==e?(n.fragment=n.path.slice(e),-1!==t&&t<e?(n.query=n.path.slice(t,e),n.path=n.path.slice(0,t)):n.path=n.path.slice(0,e)):-1!==t&&(n.query=n.path.slice(t),n.path=n.path.slice(0,t))}else n.host=r;const i=n.host.indexOf("@");if(-1!==i){const r=n.host.slice(0,i);n.host=n.host.slice(i+1),t["disallow-username-in-url"]?warnf(e,["login-denied",`Found auth in URL but --disallow-username-in-url was passed: ${r.toString()}`]):(n.auth=r,r.includes(":")?[n.user,n.password]=r.split(":",2):(n.user=r,n.password=new Word))}return n}function _percentEncode(e){return[...UTF8encoder.encode(e)].map((e=>e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||45===e||46===e||95===e||126===e?String.fromCharCode(e):"%"+e.toString(16).toUpperCase().padStart(2,"0"))).join("")}function percentEncode(e){const t=[];for(const r of e.tokens)"string"==typeof r?t.push(_percentEncode(r)):t.push(r);return new Word(t)}function percentEncodePlus(e){const t=[];for(const r of e.tokens)"string"==typeof r?t.push(_percentEncode(r).replace(/%20/g,"+")):t.push(r);return new Word(t)}function wordDecodeURIComponent(e){const t=[];for(const r of e.tokens)"string"==typeof r?t.push(decodeURIComponent(r)):t.push(r);return new Word(t)}function parseQueryString(e){if(!e||e.isEmpty())return[null,null];const t=[];for(const i of e.split("&")){if(!i.includes("="))return[null,null];const[e,r]=i.split("=",2);let s,n;try{s=wordDecodeURIComponent(e.replace(/\+/g," ")),n=wordDecodeURIComponent(r.replace(/\+/g," "))}catch(a){if(a instanceof URIError)return[null,null];throw a}const o=percentEncode(s),l=percentEncode(n);if(!eq(o,e)&&!eq(o.replace(/%20/g,"+"),e)||!eq(l,r)&&!eq(l.replace(/%20/g,"+"),r))return[null,null];t.push([s,n])}const r={},s={};let n=null;for(const[i,l]of t){const e=i.toString();if(n===e)s[e].push(l);else{if(Object.prototype.hasOwnProperty.call(s,e))return[t,null];s[e]=[l],r[e]=i}n=e}const o=[];for(const[i,l]of Object.entries(s))o.push([r[i],1===l.length?l[0]:l]);return[t,o]}function parseDetails(e,t,r,s,n){for(;r<t.length&&";"===t.charAt(r);){for(r+=1;r<t.length&&isSpace(t.charAt(r));)r+=1;if(r>=t.length)return e;const o=t.slice(r);if(o.startsWith("type="))[e.contentType,r]=getParamWord(t,r+5,n);else if(o.startsWith("filename=")){const[o,a]=getParamWord(t,r+9,n);r=a,s.filename?e.filename=o:n.push(["unsupported-form-detail","Field file name not allowed here: "+o.toString()])}else if(o.startsWith("encoder=")){const[o,a]=getParamWord(t,r+8,n);r=a,s.encoder?e.encoder=o:n.push(["unsupported-form-detail","Field encoder not allowed here: "+o.toString()])}else if(o.startsWith("headers=")){const[o,a]=getParamWord(t,r+8,n);r=a,s.headers?o.startsWith("@")?(void 0===e.headerFiles&&(e.headerFiles=[]),e.headerFiles.push(o.slice(1))):(void 0===e.headers&&(e.headers=[]),e.headers.push(o)):n.push(["unsupported-form-detail","Field headers not allowed here: "+o.toString()])}else r=getParamWord(t,r,n)[1],n.push(["unknown-form-detail","skip unknown form field: "+o.toString()])}return e}function isSpace(e){return"string"==typeof e&&(" "===e||"\t"===e||e>="\n"&&e<="\r")}function getParamWord(e,t,r){let s=t;if('"'===e.charAt(s)){s+=1;const t=[];for(;s<e.length;){let n=e.charAt(s);if("\\"===n){if(s+1<e.length){const t=e.charAt(s+1);'"'!==t&&"\\"!==t||(s+=1,n=e.charAt(s))}}else if('"'===n){s+=1;let n=!1;for(;s<e.length&&";"!==e.charAt(s);)isSpace(e.charAt(s))||(n=!0),s+=1;return n&&r.push(["trailing-form-data","Trailing data after quoted form parameter"]),[new Word(t),s]}t.push(n),s+=1}}let n=e.indexOf(";",t);return-1===n&&(n=e.length),[e.slice(t,n),n]}function getParamPart(e,t,r,s,n){for(;r<t.length&&isSpace(t.charAt(r));)r+=1;const[o,a]=getParamWord(t,r,n);return e.content=o,parseDetails(e,t,a,s,n),e}function parseForm(e,t){const r=[];let s=0;for(const n of e){const e="string"===n.type;if(!n.value.includes("="))throw new CCError('invalid value for --form/-F, missing "=": '+JSON.stringify(n.value.toString()));const[o,a]=n.value.split("=",2),i={name:o};if(e||"("!==a.charAt(0))if(!e&&0===o.length&&eq(a,")")){if(s-=1,s<0)throw new CCError("no multipart to terminate: "+JSON.stringify(n.value.toString()))}else e||"@"!==a.charAt(0)?e||"<"!==a.charAt(0)?e?i.content=a:getParamPart(i,a,0,{filename:!0,encoder:!0,headers:!0},t):(getParamPart(i,a,1,{encoder:!0,headers:!0},t),i.contentFile=i.content,delete i.content,null===i.contentType||i.contentType):(getParamPart(i,a,1,{filename:!0,encoder:!0,headers:!0},t),i.contentFile=i.content,delete i.content,null!==i.filename&&void 0!==i.filename||(i.filename=i.contentFile),null===i.contentType||i.contentType);else s+=1,t.push(["nested-form",'Nested form data with "=(" is not supported, it will be flattened']),getParamPart(i,a,1,{headers:!0},t);r.push(i)}return r}function buildURL(e,t,r,s,n,o,a){const i=r,l=parseurl(e,t,r);s&&(l.path.isEmpty()?l.path=s.prepend("/"):l.path.endsWith("/")&&(l.path=l.path.add(s)),t.get&&warnf(e,["data-ignored","curl doesn't let you pass --get and --upload-file together"]));const _=mergeWords(l.scheme,"://",l.host,l.path,l.query,l.fragment);let u=null,p=null,c=null;if(l.query.toBool()||t["url-query"]&&t["url-query"].length){let e=null,r=[];l.query.toBool()&&(r.push(["raw",l.query.slice(1)]),[p,e,c]=buildData(r,o,a),u=p),t["url-query"]&&(r=r.concat(t["url-query"]),[p,e,c]=buildData(r,o,a)),l.query=new Word,e&&e.toBool()&&(l.query=e.prepend("?"))}const d=mergeWords(l.scheme,"://",l.host,l.path,l.fragment);let m=r=mergeWords(l.scheme,"://",l.host,l.path,l.query,l.fragment),[h,y]=parseQueryString(l.query.toBool()?l.query.slice(1):new Word);h&&h.length?m=mergeWords(l.scheme,"://",l.host,l.path,l.fragment):(h=null,y=null);let g=new Word("GET");t.request&&!eq(t.request,"null")?g=t.request:t.head?g=new Word("HEAD"):s&&s.toBool()?g=new Word("PUT"):t.get||!has(t,"data")&&!has(t,"form")||(g=new Word("POST"));const f={originalUrl:i,urlWithoutQueryList:m,url:r,urlObj:l,urlWithOriginalQuery:_,urlWithoutQueryArray:d,method:g};c&&(f.queryReadsFile=c),h&&(f.queryList=h,y&&(f.queryDict=y)),p&&(f.queryArray=p),u&&(f.urlQueryArray=u),s&&(eq(s,"-")||eq(s,".")?a?f.uploadFile=a:o?(warnf(e,["upload-file-with-stdin-content","--upload-file with stdin content is not supported"]),f.uploadFile=s):f.uploadFile=s:f.uploadFile=s),n&&(f.output=n);const w=t.user||l.auth;if(w){const[e,t]=w.split(":",2);f.auth=[e,t||new Word]}return f}function buildData(e,t,r){const s=[];let n=new Word;for(const[a,i]of e.entries()){const e=i[0];let o=i[1],l=null;if(a>0&&"json"!==e&&(n=n.append("&")),"urlencode"===e){const e=o.includes("=")||!o.includes("@")?"=":"@";if((o.includes("@")||o.includes("="))&&([l,o]=o.split(e,2)),"="===e){l&&l.toBool()&&(n=n.add(l).append("=")),n=n.add(percentEncodePlus(o));continue}l=l&&l.toBool()?l:null,o=o.prepend("@")}let _=null;if("raw"!==e&&o.startsWith("@")&&(_=o.slice(1),eq(_,"-")))if(void 0!==t){switch(e){case"binary":case"json":o=t;break;case"urlencode":o=mergeWords(l&&l.length?l.append("="):new Word,percentEncodePlus(t));break;default:o=t.replace(/[\n\r]/g,"")}_=null}else void 0!==r&&(_=r);if(null!==_){n.toBool()&&(s.push(n),n=new Word);const t={filetype:e,filename:_};l&&(t.name=l),s.push(t)}else n=n.add(o)}n.toBool()&&s.push(n);let o=null;return[s,mergeWords(...s.map((e=>e instanceof Word?e:(o||(o=e.filename.toString()),e.name?mergeWords(e.name,"=@",e.filename):e.filename.prepend("@"))))),o]}function parseContentType(e){if(!e.includes(";"))return[e,[]];const t=e.indexOf(";"),r=e.slice(0,t),s=e.slice(t),n=s.match(/;\s*([^;=]+)=(?:("[^"]*")|([^()<>@,;:\\"/[\]?.=]*))/g);if(s.trim()&&!n)return null;const o=[];for(const a of n||[]){const e=a.match(/;\s*([^;=]+)=(?:("[^"]*")|([^()<>@,;:\\"/[\]?.=]*))/);if(!e)return null;const t=e[1],r=e[3]||e[2].slice(1,-1);o.push([t,r])}return[r,o]}function parseBoundary(e){const t=parseContentType(e);if(!t)return null;for(const[r,s]of t[1])if("boundary"===r)return s;return null}function parseRawForm(e,t){const r="\r\n--"+t+"--\r\n";if(!e.endsWith(r))return null;if(t="--"+t+"\r\n",(e=e.slice(0,-r.length))&&!e.startsWith(t))return null;const s=(e=e.slice(t.length)).split("\r\n"+t),n=[];let o=!0;for(const a of s){const e=a.split("\r\n");if(e.length<2)return null;const t={name:new Word,content:new Word};let r=!1;const s=[];let i=0;for(;i<e.length&&0!==e[i].length;i++){const[n,a]=e[i].split(": ",2);if(void 0===n||void 0===a)return null;if("content-disposition"===n.toLowerCase()){if(r)return null;const e=parseContentType(a);if(!e)return null;const[s,n]=e;if("form-data"!==s)return null;let i=0;for(const[r,o]of n)switch(r){case"name":t.name=new Word(o);break;case"filename":t.filename=new Word(o);break;default:i++}i&&(o=!1),r=!0}else"content-type"===n.toLowerCase()?t.contentType=new Word(a):s.push(new Word(e[i]))}if(s.length&&(t.headers=s),!r)return null;if(i===e.length)return null;if(t.name.isEmpty())return null;t.content=new Word(e.slice(i+1).join("\n")),n.push(t)}return[n,o]}function buildRequest(e,t,r,s){var n,o;if(!t.url||!t.url.length)throw new CCError("no URL specified!");const a=new Headers(t.header,e.warnings),i=new Headers(t["proxy-header"],e.warnings,"--proxy-header");let l;const _=[],u=a.get("cookie");if(u){const e=parseCookiesStrict(u);e&&(l=e)}else if(void 0===u&&t.cookie){const e=[];for(const r of t.cookie)r.includes("=")?e.push(r):_.push(r);if(e.length){const e=joinWords(t.cookie,"; ");a.setIfMissing("Cookie",e);const r=parseCookies(e);r&&(l=r)}}let p,c,d,m,h=!1;if(t["user-agent"]&&a.setIfMissing("User-Agent",t["user-agent"]),t.referer){t.referer.includes(";auto")&&(h=!0);const e=t.referer.replace(/;auto$/,"");e.length&&a.setIfMissing("Referer",e)}if(t.range){let e=t.range.prepend("bytes=");e.includes("-")||(e=e.append("-")),a.setIfMissing("Range",e)}if(t["time-cond"]){let e=t["time-cond"],r="If-Modified-Since";switch(e.charAt(0)){case"+":e=e.slice(1);break;case"-":e=e.slice(1),r="If-Unmodified-Since";break;case"=":e=e.slice(1),r="Last-Modified"}a.setIfMissing(r,e)}t.data&&t.data.length&&(t.get?(t["url-query"]=t.data,delete t.data):[p,c,d]=buildData(t.data,r,s)),t["url-query"]&&([m]=buildData(t["url-query"],r,s));const y=[],g=t["upload-file"]||[],f=t.output||[];for(const[T,S]of t.url.entries())y.push(buildURL(e,t,S,g[T],f[T],r,s));t.get&&t.data&&delete t.data,(t["upload-file"]||[]).length>t.url.length&&warnf(e,["too-many-upload-files","Got more --upload-file/-T options than URLs: "+(null===(n=t["upload-file"])||void 0===n?void 0:n.map((e=>JSON.stringify(e.toString()))).join(", "))]),(t.output||[]).length>t.url.length&&warnf(e,["too-many-output-files","Got more --output/-o options than URLs: "+(null===(o=t.output)||void 0===o?void 0:o.map((e=>JSON.stringify(e.toString()))).join(", "))]);const w={urls:y,authType:pickAuth(t.authtype),proxyAuthType:pickAuth(t.proxyauthtype),headers:a,proxyHeaders:i};r&&(w.stdin=r),s&&(w.stdinFile=s),Object.prototype.hasOwnProperty.call(t,"globoff")&&(w.globoff=t.globoff),Object.prototype.hasOwnProperty.call(t,"disallow-username-in-url")&&(w.disallowUsernameInUrl=t["disallow-username-in-url"]),Object.prototype.hasOwnProperty.call(t,"path-as-is")&&(w.pathAsIs=t["path-as-is"]),h&&(w.refererAuto=!0),l&&(w.cookies=l),_.length&&(w.cookieFiles=_),t["cookie-jar"]&&(w.cookieJar=t["cookie-jar"]),Object.prototype.hasOwnProperty.call(t,"junk-session-cookies")&&(w.junkSessionCookies=t["junk-session-cookies"]),Object.prototype.hasOwnProperty.call(t,"compressed")&&(w.compressed=t.compressed),Object.prototype.hasOwnProperty.call(t,"tr-encoding")&&(w.transferEncoding=t["tr-encoding"]),t.include&&(w.include=!0),t.json?(a.setIfMissing("Content-Type","application/json"),a.setIfMissing("Accept","application/json")):t.data?a.setIfMissing("Content-Type","application/x-www-form-urlencoded"):t.form&&(w.multipartUploads=parseForm(t.form,e.warnings));const b=a.getContentType(),E=a.get("Content-Type");if(t.data&&!d&&c&&c.isString()&&!t.form&&!w.multipartUploads&&"multipart/form-data"===b&&E&&E.isString()){const e=parseBoundary(E.toString());if(e){const t=parseRawForm(c.toString(),e);if(t){const[e,r]=t;w.multipartUploads=e,r||(w.multipartUploadsDoesntRoundtrip=!0)}}}if(Object.prototype.hasOwnProperty.call(t,"form-escape")&&(w.formEscape=t["form-escape"]),t["aws-sigv4"]&&(w.authType="aws-sigv4",w.awsSigV4=t["aws-sigv4"]),"bearer"===w.authType&&t["oauth2-bearer"]){const e=t["oauth2-bearer"].prepend("Bearer ");a.setIfMissing("Authorization",e),w.oauth2Bearer=t["oauth2-bearer"]}if(t.delegation&&(w.delegation=t.delegation),t.krb&&(w.krb=t.krb),t["sasl-authzid"]&&(w.saslAuthzid=t["sasl-authzid"]),Object.prototype.hasOwnProperty.call(t,"sasl-ir")&&(w.saslIr=t["sasl-ir"]),t.negotiate&&(w.authType="negotiate"),t["service-name"]&&(w.serviceName=t["service-name"]),a.clearNulls(),t.data&&t.data.length&&(w.data=c,d&&(w.dataReadsFile=d),w.dataArray=p,w.isDataRaw=!1,w.isDataBinary=(p||[]).some((e=>!(e instanceof Word)&&"binary"===e.filetype))),m&&(w.queryArray=m),Object.prototype.hasOwnProperty.call(t,"ipv4")&&(w.ipv4=t.ipv4),Object.prototype.hasOwnProperty.call(t,"ipv6")&&(w.ipv6=t.ipv6),t.proto&&(w.proto=t.proto),t["proto-redir"]&&(w.protoRedir=t["proto-redir"]),t["proto-default"]&&(w.protoDefault=t["proto-default"]),t["tcp-fastopen"]&&(w.tcpFastopen=t["tcp-fastopen"]),t["local-port"]){const[e,r]=t["local-port"].split("-",1);r&&r.toBool()?w.localPort=[e,r]:w.localPort=[t["local-port"],null]}if(Object.prototype.hasOwnProperty.call(t,"ignore-content-length")&&(w.ignoreContentLength=t["ignore-content-length"]),t.interface&&(w.interface=t.interface),t.ciphers&&(w.ciphers=t.ciphers),t.curves&&(w.curves=t.curves),t.insecure&&(w.insecure=!0),Object.prototype.hasOwnProperty.call(t,"cert-status")&&(w.certStatus=t["cert-status"]),t.cert)if(t.cert.startsWith("pkcs11:")||!t.cert.match(/[:\\]/))w.cert=[t.cert,null];else{let e=-1;try{e=t.cert.search(/(?<!\\)(?:\\\\)*:/)}catch(x){e=t.cert.search(/:/)}if(-1===e)w.cert=[t.cert,null];else{const r=t.cert.slice(0,e),s=t.cert.slice(e+1);s.toBool()?w.cert=[r,s]:w.cert=[r,null]}}if(t["cert-type"]){const r=t["cert-type"];w.certType=r,r.isString()&&!["PEM","DER","ENG","P12"].includes(r.toString().toUpperCase())&&warnf(e,["cert-type-unknown","not supported file type "+JSON.stringify(r.toString())+" for certificate"])}return t.key&&(w.key=t.key),t["key-type"]&&(w.keyType=t["key-type"]),t.pass&&(w.pass=t.pass),t.cacert&&(w.cacert=t.cacert),Object.prototype.hasOwnProperty.call(t,"ca-native")&&(w.caNative=t["ca-native"]),Object.prototype.hasOwnProperty.call(t,"ssl-allow-beast")&&(w.sslAllowBeast=t["ssl-allow-beast"]),t.capath&&(w.capath=t.capath),t.crlfile&&(w.crlfile=t.crlfile),t.pinnedpubkey&&(w.pinnedpubkey=t.pinnedpubkey),t["random-file"]&&(w.randomFile=t["random-file"]),t["egd-file"]&&(w.egdFile=t["egd-file"]),t.hsts&&(w.hsts=t.hsts),Object.prototype.hasOwnProperty.call(t,"alpn")&&(w.alpn=t.alpn),t.tlsVersion&&(w.tlsVersion=t.tlsVersion),t["tls-max"]&&(w.tlsMax=t["tls-max"]),t["tls13-ciphers"]&&(w.tls13Ciphers=t["tls13-ciphers"]),t.tlsauthtype&&(w.tlsauthtype=t.tlsauthtype),t.tlspassword&&(w.tlspassword=t.tlspassword),t.tlsuser&&(w.tlsuser=t.tlsuser),Object.prototype.hasOwnProperty.call(t,"ssl-allow-beast")&&(w.sslAllowBeast=t["ssl-allow-beast"]),Object.prototype.hasOwnProperty.call(t,"ssl-auto-client-cert")&&(w.sslAutoClientCert=t["ssl-auto-client-cert"]),Object.prototype.hasOwnProperty.call(t,"ssl-no-revoke")&&(w.sslNoRevoke=t["ssl-no-revoke"]),Object.prototype.hasOwnProperty.call(t,"ssl-reqd")&&(w.sslReqd=t["ssl-reqd"]),Object.prototype.hasOwnProperty.call(t,"ssl-revoke-best-effort")&&(w.sslRevokeBestEffort=t["ssl-revoke-best-effort"]),Object.prototype.hasOwnProperty.call(t,"ssl")&&(w.ssl=t.ssl),Object.prototype.hasOwnProperty.call(t,"sslv2")&&(w.sslv2=t.sslv2),Object.prototype.hasOwnProperty.call(t,"sslv3")&&(w.sslv3=t.sslv3),t["doh-url"]&&(w.dohUrl=t["doh-url"]),Object.prototype.hasOwnProperty.call(t,"doh-insecure")&&(w.dohInsecure=t["doh-insecure"]),Object.prototype.hasOwnProperty.call(t,"doh-cert-status")&&(w.dohCertStatus=t["doh-cert-status"]),t.proxy&&(w.proxy=t.proxy,w.proxyType&&"http2"!==w.proxyType&&delete w.proxyType,t["proxy-user"]&&(w.proxyAuth=t["proxy-user"])),Object.prototype.hasOwnProperty.call(t,"proxytunnel")&&(w.proxytunnel=t.proxytunnel),t.noproxy&&(w.noproxy=t.noproxy),t.preproxy&&(w.preproxy=t.preproxy),Object.prototype.hasOwnProperty.call(t,"proxy-anyauth")&&(w.proxyAnyauth=t["proxy-anyauth"]),Object.prototype.hasOwnProperty.call(t,"proxy-basic")&&(w.proxyBasic=t["proxy-basic"]),Object.prototype.hasOwnProperty.call(t,"proxy-digest")&&(w.proxyDigest=t["proxy-digest"]),Object.prototype.hasOwnProperty.call(t,"proxy-negotiate")&&(w.proxyNegotiate=t["proxy-negotiate"]),Object.prototype.hasOwnProperty.call(t,"proxy-ntlm")&&(w.proxyNtlm=t["proxy-ntlm"]),Object.prototype.hasOwnProperty.call(t,"proxy-ca-native")&&(w.proxyCaNative=t["proxy-ca-native"]),t["proxy-cacert"]&&(w.proxyCacert=t["proxy-cacert"]),t["proxy-capath"]&&(w.proxyCapath=t["proxy-capath"]),t["proxy-cert-type"]&&(w.proxyCertType=t["proxy-cert-type"]),t["proxy-cert"]&&(w.proxyCert=t["proxy-cert"]),t["proxy-ciphers"]&&(w.proxyCiphers=t["proxy-ciphers"]),t["proxy-crlfile"]&&(w.proxyCrlfile=t["proxy-crlfile"]),t["proxy-http2"]&&(w.proxyType="http2"),t["proxy1.0"]&&(w.proxy=t["proxy1.0"],w.proxyType="http1"),Object.prototype.hasOwnProperty.call(t,"proxy-insecure")&&(w.proxyInsecure=t["proxy-insecure"]),t["proxy-key"]&&(w.proxyKey=t["proxy-key"]),t["proxy-key-type"]&&(w.proxyKeyType=t["proxy-key-type"]),t["proxy-pass"]&&(w.proxyPass=t["proxy-pass"]),t["proxy-pinnedpubkey"]&&(w.proxyPinnedpubkey=t["proxy-pinnedpubkey"]),t["proxy-pinnedpubkey"]&&(w.proxyPinnedpubkey=t["proxy-pinnedpubkey"]),t["proxy-service-name"]&&(w.proxyServiceName=t["proxy-service-name"]),Object.prototype.hasOwnProperty.call(t,"proxy-ssl-allow-beast")&&(w.proxySslAllowBeast=t["proxy-ssl-allow-beast"]),Object.prototype.hasOwnProperty.call(t,"proxy-ssl-auto-client-cert")&&(w.proxySslAutoClientCert=t["proxy-ssl-auto-client-cert"]),t["proxy-tls13-ciphers"]&&(w.proxyTls13Ciphers=t["proxy-tls13-ciphers"]),t["proxy-tlsauthtype"]&&(w.proxyTlsauthtype=t["proxy-tlsauthtype"],w.proxyTlsauthtype.isString()&&!eq(w.proxyTlsauthtype,"SRP")&&warnf(e,["proxy-tlsauthtype","proxy-tlsauthtype is not supported: "+w.proxyTlsauthtype])),t["proxy-tlspassword"]&&(w.proxyTlspassword=t["proxy-tlspassword"]),t["proxy-tlsuser"]&&(w.proxyTlsuser=t["proxy-tlsuser"]),Object.prototype.hasOwnProperty.call(t,"proxy-tlsv1")&&(w.proxyTlsv1=t["proxy-tlsv1"]),t["proxy-user"]&&(w.proxyUser=t["proxy-user"]),Object.prototype.hasOwnProperty.call(t,"proxytunnel")&&(w.proxytunnel=t.proxytunnel),t.socks4&&(w.proxy=t.socks4,w.proxyType="socks4"),t.socks4a&&(w.proxy=t.socks4a,w.proxyType="socks4a"),t.socks5&&(w.proxy=t.socks5,w.proxyType="socks5"),t["socks5-hostname"]&&(w.proxy=t["socks5-hostname"],w.proxyType="socks5-hostname"),Object.prototype.hasOwnProperty.call(t,"socks5-basic")&&(w.socks5Basic=t["socks5-basic"]),Object.prototype.hasOwnProperty.call(t,"socks5-gssapi-nec")&&(w.socks5GssapiNec=t["socks5-gssapi-nec"]),t["socks5-gssapi-service"]&&(w.socks5GssapiService=t["socks5-gssapi-service"]),Object.prototype.hasOwnProperty.call(t,"socks5-gssapi")&&(w.socks5Gssapi=t["socks5-gssapi"]),t["haproxy-clientip"]&&(w.haproxyClientIp=t["haproxy-clientip"]),Object.prototype.hasOwnProperty.call(t,"haproxy-protocol")&&(w.haproxyProtocol=t["haproxy-protocol"]),t["max-time"]&&(w.timeout=t["max-time"],t["max-time"].isString()&&isNaN(parseFloat(t["max-time"].toString()))&&warnf(e,["max-time-not-number","option --max-time: expected a proper numerical parameter: "+JSON.stringify(t["max-time"].toString())])),t["connect-timeout"]&&(w.connectTimeout=t["connect-timeout"],t["connect-timeout"].isString()&&isNaN(parseFloat(t["connect-timeout"].toString()))&&warnf(e,["connect-timeout-not-number","option --connect-timeout: expected a proper numerical parameter: "+JSON.stringify(t["connect-timeout"].toString())])),t["expect100-timeout"]&&(w.expect100Timeout=t["expect100-timeout"],t["expect100-timeout"].isString()&&isNaN(parseFloat(t["expect100-timeout"].toString()))&&warnf(e,["expect100-timeout-not-number","option --expect100-timeout: expected a proper numerical parameter: "+JSON.stringify(t["expect100-timeout"].toString())])),t["happy-eyeballs-timeout-ms"]&&(w.happyEyeballsTimeoutMs=t["happy-eyeballs-timeout-ms"]),t["speed-limit"]&&(w.speedLimit=t["speed-limit"]),t["speed-time"]&&(w.speedTime=t["speed-time"]),t["limit-rate"]&&(w.limitRate=t["limit-rate"]),t["max-filesize"]&&(w.maxFilesize=t["max-filesize"]),Object.prototype.hasOwnProperty.call(t,"keepalive")&&(w.keepAlive=t.keepalive),t["keepalive-time"]&&(w.keepAliveTime=t["keepalive-time"]),t["alt-svc"]&&(w.altSvc=t["alt-svc"]),Object.prototype.hasOwnProperty.call(t,"location")&&(w.followRedirects=t.location),t["location-trusted"]&&(w.followRedirectsTrusted=t["location-trusted"]),t["max-redirs"]&&(w.maxRedirects=t["max-redirs"].trim(),t["max-redirs"].isString()&&!isInt(t["max-redirs"].toString())&&warnf(e,["max-redirs-not-int","option --max-redirs: expected a proper numerical parameter: "+JSON.stringify(t["max-redirs"].toString())])),Object.prototype.hasOwnProperty.call(t,"post301")&&(w.post301=t.post301),Object.prototype.hasOwnProperty.call(t,"post302")&&(w.post302=t.post302),Object.prototype.hasOwnProperty.call(t,"post303")&&(w.post303=t.post303),t.fail&&(w.fail=t.fail),t.retry&&(w.retry=t.retry),t["retry-max-time"]&&(w.retryMaxTime=t["retry-max-time"]),Object.prototype.hasOwnProperty.call(t,"ftp-skip-pasv-ip")&&(w.ftpSkipPasvIp=t["ftp-skip-pasv-ip"]),t.httpVersion&&("2"!==t.httpVersion&&"2-prior-knowledge"!==t.httpVersion||(w.http2=!0),"3"!==t.httpVersion&&"3-only"!==t.httpVersion||(w.http3=!0),w.httpVersion=t.httpVersion),Object.prototype.hasOwnProperty.call(t,"http0.9")&&(w.http0_9=t["http0.9"]),t.resolve&&t.resolve.length&&(w.resolve=t.resolve),t["connect-to"]&&t["connect-to"].length&&(w.connectTo=t["connect-to"]),t["unix-socket"]&&(w.unixSocket=t["unix-socket"]),t["abstract-unix-socket"]&&(w.abstractUnixSocket=t["abstract-unix-socket"]),t["netrc-optional"]?w.netrc="optional":t.netrc||t["netrc-file"]?w.netrc="required":!1===t.netrc&&(w.netrc="ignored"),t["netrc-file"]&&(w.netrcFile=t["netrc-file"]),t["use-ascii"]&&(w.useAscii=t["use-ascii"]),t["continue-at"]&&(w.continueAt=t["continue-at"]),Object.prototype.hasOwnProperty.call(t,"crlf")&&(w.crlf=t.crlf),Object.prototype.hasOwnProperty.call(t,"clobber")&&(w.clobber=t.clobber),Object.prototype.hasOwnProperty.call(t,"remote-time")&&(w.remoteTime=t["remote-time"]),Object.prototype.hasOwnProperty.call(e,"verbose")&&(w.verbose=e.verbose),Object.prototype.hasOwnProperty.call(e,"silent")&&(w.silent=e.silent),w}function buildRequests(e,t,r){return e.configs.length||warnf(e,["no-configs","got empty config object"]),e.configs.map((s=>buildRequest(e,s,t,r)))}function getFirst(e,t,r){e.length>1&&t.push(["next","got "+e.length+" curl requests, only converting the first one"]);const s=e[0];return warnIfPartsIgnored(s,t,r),s}function clip(e,t=30){return e.length>t?e.slice(0,t-3)+"...":e}function findCommands(e,t){if("string"==typeof e)return tokenize(e,t);if(0===e.length)throw new CCError("no arguments provided");if("curl"!==e[0].trim())throw new CCError('command should begin with "curl" but instead begins with '+JSON.stringify(clip(e[0])));return[[e.map((e=>new Word(e))),void 0,void 0]]}function parse(e,t,r=[]){let s=[];const n=findCommands(e,r);for(const[o,a,i]of n){const[e]=parseArgs(o,curlLongOpts,curlLongOptsShortened,curlShortOpts,t,r);s=s.concat(buildRequests(e,a,i))}return s}function getDataString(e){if(!e.data)return{};const t=e.headers.getContentType();if("application/json"===t)try{return JSON.parse(e.data.toString())}catch(r){}if("application/x-www-form-urlencoded"===t){const[t,r]=parseQueryString(e.data);if(r)return Object.fromEntries(r.map((e=>[e[0].toString(),Array.isArray(e[1])?e[1].map((e=>e.toString())):e[1].toString()])));if(t)return Object.fromEntries(t.map((e=>[e[0].toString(),e[1].toString()])))}return e.data.toString()}function getFilesString(e){if(!e.multipartUploads)return;const t={files:{},data:{}};for(const r of e.multipartUploads)"contentFile"in r?t.files[r.name.toString()]=r.contentFile.toString():t.data[r.name.toString()]=r.content.toString();return{files:Object.keys(t.files).length?t.files:void 0,data:Object.keys(t.data).length?t.data:void 0}}function _toJsonObject(e,t=[]){const r=getFirst(e,t),s=r.urls[0],n={url:(s.queryDict?s.urlWithoutQueryList:s.url).toString().replace(/\/$/,""),raw_url:s.url.toString(),method:s.method.toLowerCase().toString()};if(r.cookies&&(n.cookies=Object.fromEntries(r.cookies.map((e=>[e[0].toString(),e[1].toString()])))),r.headers.length){const e=r.headers.headers.filter((e=>null!==e[1])).map((e=>[e[0].toString(),e[1].toString()]));n.headers=Object.fromEntries(e)}if(s.queryDict&&(n.queries=Object.fromEntries(s.queryDict.map((e=>[e[0].toString(),Array.isArray(e[1])?e[1].map((e=>e.toString())):e[1].toString()])))),r.data?n.data=getDataString(r):r.multipartUploads&&Object.assign(n,getFilesString(r)),r.compressed&&(n.compressed=!0),r.insecure&&(n.insecure=!1),r.include&&(n.include=!0),s.auth){const[e,t]=s.auth;n.auth={user:e.toString(),password:t.toString()},r.authType&&(n.auth_type=r.authType)}return r.awsSigV4&&(n.aws_sigv4=r.awsSigV4.toString()),r.delegation&&(n.delegation=r.delegation.toString()),Object.prototype.hasOwnProperty.call(r,"followRedirects")&&(n.follow_redirects=r.followRedirects,r.maxRedirects&&(n.max_redirects=parseInt(r.maxRedirects.toString(),10))),r.proxy&&(n.proxy=r.proxy.toString()),r.timeout&&(n.timeout=parseFloat(r.timeout.toString())),r.connectTimeout&&(n.connect_timeout=parseFloat(r.connectTimeout.toString())),s.output&&(n.output=s.output.toString()),n}function toJsonObjectWarn(e,t=[]){return[_toJsonObject(parse(e,supportedArgs$24,t),t),t]}function toJsonObject(e){return toJsonObjectWarn(e)[0]}function sanitizeCurlUrlPlaceholders(e){const t=e.match(/curl\s+(['"]?)(https?:\/\/[^\s'"]+)\1/);if(!t||!t[2])return e;const r=t[2],s=r.replaceAll(/<([A-Za-z0-9_-]+)>/g,"{$1}");return e.replace(r,s)}function useImportCurlCommand(e){const t=useToast(),r=useI18n(),s={invalidCurCommand:{title:"importCurlParameter.showError.invalidCurlCommand.title",message:"importCurlParameter.showError.invalidCurlCommand.message"},...e?.i18n};return{importCurlCommand:function(n){const o=unref(n);var a,i;if(""!==o)try{const s=flattenObject(toHttpNodeParameters(o),"parameters");assert("string"==typeof s["parameters.url"],"parameters.url has to be string");const n=s["parameters.url"].replaceAll("%7B","{").replaceAll("%7D","}"),l=CURL_IMPORT_NOT_SUPPORTED_PROTOCOLS.find((e=>n.includes(`${e}://`)));if(!l)return s["parameters.url"]=n,importCurlEventBus.emit("setHttpNodeParameters",s),void e?.onImportSuccess?.();if(CURL_IMPORT_NODES_PROTOCOLS[l]){const e=CURL_IMPORT_NODES_PROTOCOLS[l];a=l,i=e,t.showToast({title:r.baseText("importCurlParameter.showError.invalidProtocol1.title",{interpolate:{node:i}}),message:r.baseText("importCurlParameter.showError.invalidProtocol.message",{interpolate:{protocol:a.toUpperCase()}}),type:"error",duration:0})}else!function(e){t.showToast({title:r.baseText("importCurlParameter.showError.invalidProtocol2.title"),message:r.baseText("importCurlParameter.showError.invalidProtocol.message",{interpolate:{protocol:e}}),type:"error",duration:0})}(l);e?.onImportFailure?.({invalidProtocol:!0,protocol:l})}catch(l){t.showToast({title:r.baseText(s.invalidCurCommand.title),message:r.baseText(s.invalidCurCommand.message),type:"error",duration:0}),e?.onImportFailure?.({invalidProtocol:!1})}finally{e?.onAfterImport?.()}}}}return _export("useImportCurlCommand",useImportCurlCommand),{setters:[function(e){__toCommonJS=e.a,__require=e.i,__toESM=e.o,__commonJSMin=e.t},function(e){unref=e.Wt},function(e){useI18n=e.at},function(e){require_get=e.t},function(e){process$1=e.C,init_dist$1=e.S,init_dist=e.i,init_empty=e.n,Buffer=e.r,empty_exports=e.t,require_path_browserify=e.x},function(e){importCurlEventBus=e.Mt,useToast=e.Pn},function(e){CURL_IMPORT_NODES_PROTOCOLS=e.ll,CURL_IMPORT_NOT_SUPPORTED_PROTOCOLS=e.ul},function(e){assert=e.h}],execute:async function(){try{e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack,n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="e1f86f19-44a6-48ae-b442-ffae42c97a97",e._sentryDebugIdIdentifier="sentry-dbid-e1f86f19-44a6-48ae-b442-ffae42c97a97")}catch(e){}var e,n;import_get=__toESM(require_get(),1),init_dist(),CCError=class extends Error{},UTF8encoder=new TextEncoder,Word=class e{constructor(t){this.valueOf=e.toString,"string"==typeof t&&(t=[t]),void 0!==t&&0!==t.length||(t=[""]),this.tokens=[];for(const e of t)"string"==typeof e?this.tokens.length>0&&"string"==typeof this.tokens[this.tokens.length-1]?this.tokens[this.tokens.length-1]+=e:e&&this.tokens.push(e):this.tokens.push(e);0===this.tokens.length&&this.tokens.push("")}get length(){let e=0;for(const t of this.tokens)e+="string"==typeof t?t.length:1;return e}*[Symbol.iterator](){for(const e of