!function(){try{var 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]="d77c4f1f-e24e-5555-a220-5313925b415d")}catch(e){}}();
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,261115,475932,258561,t=>{"use strict";t.s(["parseToolUsageText",()=>z],261115);var e=t.i(486492);t.s([],475932);let i=":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",r=RegExp("^"+("["+i+"]["+i)+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$");function s(t,e){let i=[],r=e.exec(t);for(;r;){let s=[];s.startIndex=e.lastIndex-r[0].length;let n=r.length;for(let t=0;t<n;t++)s.push(r[t]);i.push(s),r=e.exec(t)}return i}let n=function(t){return null!=r.exec(t)},a={allowBooleanAttributes:!1,unpairedTags:[]};function o(t){return" "===t||"	"===t||"\n"===t||"\r"===t}function l(t,e){let i=e;for(;e<t.length;e++)if("?"==t[e]||" "==t[e]){let r=t.substr(i,e-i);if(e>5&&"xml"===r)return c("InvalidXml","XML declaration allowed only at the start of the document.",g(t,e));if("?"!=t[e]||">"!=t[e+1])continue;e++;break}return e}function u(t,e){if(t.length>e+5&&"-"===t[e+1]&&"-"===t[e+2]){for(e+=3;e<t.length;e++)if("-"===t[e]&&"-"===t[e+1]&&">"===t[e+2]){e+=2;break}}else if(t.length>e+8&&"D"===t[e+1]&&"O"===t[e+2]&&"C"===t[e+3]&&"T"===t[e+4]&&"Y"===t[e+5]&&"P"===t[e+6]&&"E"===t[e+7]){let i=1;for(e+=8;e<t.length;e++)if("<"===t[e])i++;else if(">"===t[e]&&0==--i)break}else if(t.length>e+9&&"["===t[e+1]&&"C"===t[e+2]&&"D"===t[e+3]&&"A"===t[e+4]&&"T"===t[e+5]&&"A"===t[e+6]&&"["===t[e+7]){for(e+=8;e<t.length;e++)if("]"===t[e]&&"]"===t[e+1]&&">"===t[e+2]){e+=2;break}}return e}let h=RegExp("(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['\"])(([\\s\\S])*?)\\5)?","g");function p(t,e){let i=s(t,h),r={};for(let t=0;t<i.length;t++){if(0===i[t][1].length)return c("InvalidAttr","Attribute '"+i[t][2]+"' has no space in starting.",d(i[t]));if(void 0!==i[t][3]&&void 0===i[t][4])return c("InvalidAttr","Attribute '"+i[t][2]+"' is without value.",d(i[t]));if(void 0===i[t][3]&&!e.allowBooleanAttributes)return c("InvalidAttr","boolean attribute '"+i[t][2]+"' is not allowed.",d(i[t]));let s=i[t][2];if(!n(s))return c("InvalidAttr","Attribute '"+s+"' is an invalid name.",d(i[t]));if(r.hasOwnProperty(s))return c("InvalidAttr","Attribute '"+s+"' is repeated.",d(i[t]));r[s]=1}return!0}function c(t,e,i){return{err:{code:t,msg:e,line:i.line||i,col:i.col}}}function g(t,e){let i=t.substring(0,e).split(/\r?\n/);return{line:i.length,col:i[i.length-1].length+1}}function d(t){return t.startIndex+t[1].length}let f={preserveOrder:!1,attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,parseTagValue:!0,parseAttributeValue:!1,trimValues:!0,cdataPropName:!1,numberParseOptions:{hex:!0,leadingZeros:!0,eNotation:!0},tagValueProcessor:function(t,e){return e},attributeValueProcessor:function(t,e){return e},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(t,e,i){return t}};class E{add(t,e){"__proto__"===t&&(t="#__proto__"),this.child.push({[t]:e})}addChild(t){"__proto__"===t.tagname&&(t.tagname="#__proto__"),t[":@"]&&Object.keys(t[":@"]).length>0?this.child.push({[t.tagname]:t.child,":@":t[":@"]}):this.child.push({[t.tagname]:t.child})}constructor(t){this.tagname=t,this.child=[],this[":@"]={}}}let N=/^[-+]?0x[a-fA-F0-9]+$/,m=/^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/,x={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};function b(t){return"function"==typeof t?t:Array.isArray(t)?e=>{for(let i of t)if("string"==typeof i&&e===i||i instanceof RegExp&&i.test(e))return!0}:()=>!1}class A{constructor(t){this.options=t,this.currentNode=null,this.tagsNodeStack=[],this.docTypeEntities={},this.lastEntities={apos:{regex:/&(apos|#39|#x27);/g,val:"'"},gt:{regex:/&(gt|#62|#x3E);/g,val:">"},lt:{regex:/&(lt|#60|#x3C);/g,val:"<"},quot:{regex:/&(quot|#34|#x22);/g,val:'"'}},this.ampEntity={regex:/&(amp|#38|#x26);/g,val:"&"},this.htmlEntities={space:{regex:/&(nbsp|#160);/g,val:" "},cent:{regex:/&(cent|#162);/g,val:"¢"},pound:{regex:/&(pound|#163);/g,val:"£"},yen:{regex:/&(yen|#165);/g,val:"¥"},euro:{regex:/&(euro|#8364);/g,val:"€"},copyright:{regex:/&(copy|#169);/g,val:"©"},reg:{regex:/&(reg|#174);/g,val:"®"},inr:{regex:/&(inr|#8377);/g,val:"₹"},num_dec:{regex:/&#([0-9]{1,7});/g,val:(t,e)=>String.fromCodePoint(Number.parseInt(e,10))},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(t,e)=>String.fromCodePoint(Number.parseInt(e,16))}},this.addExternalEntities=I,this.parseXml=S,this.parseTextData=T,this.resolveNameSpace=_,this.buildAttributesMap=O,this.isItStopNode=P,this.replaceEntitiesValue=R,this.readStopNodeData=k,this.saveTextToParentTag=C,this.addChild=y,this.ignoreAttributesFn=b(this.options.ignoreAttributes)}}function I(t){let e=Object.keys(t);for(let i=0;i<e.length;i++){let r=e[i];this.lastEntities[r]={regex:RegExp("&"+r+";","g"),val:t[r]}}}function T(t,e,i,r,s,n,a){if(void 0!==t&&(this.options.trimValues&&!r&&(t=t.trim()),t.length>0)){a||(t=this.replaceEntitiesValue(t));let r=this.options.tagValueProcessor(e,t,i,s,n);return null==r?t:typeof r!=typeof t||r!==t?r:this.options.trimValues||t.trim()===t?F(t,this.options.parseTagValue,this.options.numberParseOptions):t}}function _(t){if(this.options.removeNSPrefix){let e=t.split(":"),i="/"===t.charAt(0)?"/":"";if("xmlns"===e[0])return"";2===e.length&&(t=i+e[1])}return t}let v=RegExp("([^\\s=]+)\\s*(=\\s*(['\"])([\\s\\S]*?)\\3)?","gm");function O(t,e,i){if(!0!==this.options.ignoreAttributes&&"string"==typeof t){let i=s(t,v),r=i.length,n={};for(let t=0;t<r;t++){let r=this.resolveNameSpace(i[t][1]);if(this.ignoreAttributesFn(r,e))continue;let s=i[t][4],a=this.options.attributeNamePrefix+r;if(r.length)if(this.options.transformAttributeName&&(a=this.options.transformAttributeName(a)),"__proto__"===a&&(a="#__proto__"),void 0!==s){this.options.trimValues&&(s=s.trim()),s=this.replaceEntitiesValue(s);let t=this.options.attributeValueProcessor(r,s,e);null==t?n[a]=s:typeof t!=typeof s||t!==s?n[a]=t:n[a]=F(s,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(n[a]=!0)}if(Object.keys(n).length){if(this.options.attributesGroupName){let t={};return t[this.options.attributesGroupName]=n,t}return n}}}let S=function(t){t=t.replace(/\r\n?/g,"\n");let e=new E("!xml"),i=e,r="",s="";for(let a=0;a<t.length;a++)if("<"===t[a])if("/"===t[a+1]){let e=D(t,">",a,"Closing Tag is not closed."),n=t.substring(a+2,e).trim();if(this.options.removeNSPrefix){let t=n.indexOf(":");-1!==t&&(n=n.substr(t+1))}this.options.transformTagName&&(n=this.options.transformTagName(n)),i&&(r=this.saveTextToParentTag(r,i,s));let o=s.substring(s.lastIndexOf(".")+1);if(n&&-1!==this.options.unpairedTags.indexOf(n))throw Error("Unpaired tag can not be used as closing tag: </".concat(n,">"));let l=0;o&&-1!==this.options.unpairedTags.indexOf(o)?(l=s.lastIndexOf(".",s.lastIndexOf(".")-1),this.tagsNodeStack.pop()):l=s.lastIndexOf("."),s=s.substring(0,l),i=this.tagsNodeStack.pop(),r="",a=e}else if("?"===t[a+1]){let e=w(t,a,!1,"?>");if(!e)throw Error("Pi Tag is not closed.");if(r=this.saveTextToParentTag(r,i,s),this.options.ignoreDeclaration&&"?xml"===e.tagName||this.options.ignorePiTags);else{let t=new E(e.tagName);t.add(this.options.textNodeName,""),e.tagName!==e.tagExp&&e.attrExpPresent&&(t[":@"]=this.buildAttributesMap(e.tagExp,s,e.tagName)),this.addChild(i,t,s)}a=e.closeIndex+1}else if("!--"===t.substr(a+1,3)){let e=D(t,"-->",a+4,"Comment is not closed.");if(this.options.commentPropName){let n=t.substring(a+4,e-2);r=this.saveTextToParentTag(r,i,s),i.add(this.options.commentPropName,[{[this.options.textNodeName]:n}])}a=e}else if("!D"===t.substr(a+1,2)){let e=function(t,e){let i={};if("O"===t[e+3]&&"C"===t[e+4]&&"T"===t[e+5]&&"Y"===t[e+6]&&"P"===t[e+7]&&"E"===t[e+8]){e+=9;let c=1,g=!1,d=!1;for(;e<t.length;e++)if("<"!==t[e]||d)if(">"===t[e]){if(d?"-"===t[e-1]&&"-"===t[e-2]&&(d=!1,c--):c--,0===c)break}else"["===t[e]?g=!0:t[e];else{var r,s,a,o,l,u,h,p;if(g&&"!"===(r=t)[(s=e)+1]&&"E"===r[s+2]&&"N"===r[s+3]&&"T"===r[s+4]&&"I"===r[s+5]&&"T"===r[s+6]&&"Y"===r[s+7]){let r,s;e+=7,[r,s,e]=function(t,e){let i="";for(;e<t.length&&"'"!==t[e]&&'"'!==t[e];e++)i+=t[e];if(-1!==(i=i.trim()).indexOf(" "))throw Error("External entites are not supported");let r=t[e++],s="";for(;e<t.length&&t[e]!==r;e++)s+=t[e];return[i,s,e]}(t,e+1),-1===s.indexOf("&")&&(i[function(t){if(n(t))return t;throw Error("Invalid entity name ".concat(t))}(r)]={regx:RegExp("&".concat(r,";"),"g"),val:s})}else{g&&"!"===(a=t)[(o=e)+1]&&"E"===a[o+2]&&"L"===a[o+3]&&"E"===a[o+4]&&"M"===a[o+5]&&"E"===a[o+6]&&"N"===a[o+7]&&"T"===a[o+8]||g&&"!"===(l=t)[(u=e)+1]&&"A"===l[u+2]&&"T"===l[u+3]&&"T"===l[u+4]&&"L"===l[u+5]&&"I"===l[u+6]&&"S"===l[u+7]&&"T"===l[u+8]?e+=8:g&&"!"===(h=t)[(p=e)+1]&&"N"===h[p+2]&&"O"===h[p+3]&&"T"===h[p+4]&&"A"===h[p+5]&&"T"===h[p+6]&&"I"===h[p+7]&&"O"===h[p+8]&&"N"===h[p+9]?e+=9:d=!0}c++}if(0!==c)throw Error("Unclosed DOCTYPE")}else throw Error("Invalid Tag instead of DOCTYPE");return{entities:i,i:e}}(t,a);this.docTypeEntities=e.entities,a=e.i}else if("!["===t.substr(a+1,2)){let e=D(t,"]]>",a,"CDATA is not closed.")-2,n=t.substring(a+9,e);r=this.saveTextToParentTag(r,i,s);let o=this.parseTextData(n,i.tagname,s,!0,!1,!0,!0);void 0==o&&(o=""),this.options.cdataPropName?i.add(this.options.cdataPropName,[{[this.options.textNodeName]:n}]):i.add(this.options.textNodeName,o),a=e+2}else{let n=w(t,a,this.options.removeNSPrefix),o=n.tagName,l=n.rawTagName,u=n.tagExp,h=n.attrExpPresent,p=n.closeIndex;this.options.transformTagName&&(o=this.options.transformTagName(o)),i&&r&&"!xml"!==i.tagname&&(r=this.saveTextToParentTag(r,i,s,!1));let c=i;if(c&&-1!==this.options.unpairedTags.indexOf(c.tagname)&&(i=this.tagsNodeStack.pop(),s=s.substring(0,s.lastIndexOf("."))),o!==e.tagname&&(s+=s?"."+o:o),this.isItStopNode(this.options.stopNodes,s,o)){let e="";if(u.length>0&&u.lastIndexOf("/")===u.length-1)"/"===o[o.length-1]?(o=o.substr(0,o.length-1),s=s.substr(0,s.length-1),u=o):u=u.substr(0,u.length-1),a=n.closeIndex;else if(-1!==this.options.unpairedTags.indexOf(o))a=n.closeIndex;else{let i=this.readStopNodeData(t,l,p+1);if(!i)throw Error("Unexpected end of ".concat(l));a=i.i,e=i.tagContent}let r=new E(o);o!==u&&h&&(r[":@"]=this.buildAttributesMap(u,s,o)),e&&(e=this.parseTextData(e,o,s,!0,h,!0,!0)),s=s.substr(0,s.lastIndexOf(".")),r.add(this.options.textNodeName,e),this.addChild(i,r,s)}else{if(u.length>0&&u.lastIndexOf("/")===u.length-1){"/"===o[o.length-1]?(o=o.substr(0,o.length-1),s=s.substr(0,s.length-1),u=o):u=u.substr(0,u.length-1),this.options.transformTagName&&(o=this.options.transformTagName(o));let t=new E(o);o!==u&&h&&(t[":@"]=this.buildAttributesMap(u,s,o)),this.addChild(i,t,s),s=s.substr(0,s.lastIndexOf("."))}else{let t=new E(o);this.tagsNodeStack.push(i),o!==u&&h&&(t[":@"]=this.buildAttributesMap(u,s,o)),this.addChild(i,t,s),i=t}r="",a=p}}else r+=t[a];return e.child};function y(t,e,i){let r=this.options.updateTag(e.tagname,i,e[":@"]);!1===r||("string"==typeof r&&(e.tagname=r),t.addChild(e))}let R=function(t){if(this.options.processEntities){for(let e in this.docTypeEntities){let i=this.docTypeEntities[e];t=t.replace(i.regx,i.val)}for(let e in this.lastEntities){let i=this.lastEntities[e];t=t.replace(i.regex,i.val)}if(this.options.htmlEntities)for(let e in this.htmlEntities){let i=this.htmlEntities[e];t=t.replace(i.regex,i.val)}t=t.replace(this.ampEntity.regex,this.ampEntity.val)}return t};function C(t,e,i,r){return t&&(void 0===r&&(r=0===e.child.length),void 0!==(t=this.parseTextData(t,e.tagname,i,!1,!!e[":@"]&&0!==Object.keys(e[":@"]).length,r))&&""!==t&&e.add(this.options.textNodeName,t),t=""),t}function P(t,e,i){let r="*."+i;for(let i in t){let s=t[i];if(r===s||e===s)return!0}return!1}function D(t,e,i,r){let s=t.indexOf(e,i);if(-1!==s)return s+e.length-1;throw Error(r)}function w(t,e,i){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:">",s=function(t,e){let i,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:">",s="";for(let n=e;n<t.length;n++){let e=t[n];if(i)e===i&&(i="");else if('"'===e||"'"===e)i=e;else if(e===r[0]){if(!r[1])return{data:s,index:n};else if(t[n+1]===r[1])return{data:s,index:n}}else"	"===e&&(e=" ");s+=e}}(t,e+1,r);if(!s)return;let n=s.data,a=s.index,o=n.search(/\s/),l=n,u=!0;-1!==o&&(l=n.substring(0,o),n=n.substring(o+1).trimStart());let h=l;if(i){let t=l.indexOf(":");-1!==t&&(u=(l=l.substr(t+1))!==s.data.substr(t+1))}return{tagName:l,tagExp:n,closeIndex:a,attrExpPresent:u,rawTagName:h}}function k(t,e,i){let r=i,s=1;for(;i<t.length;i++)if("<"===t[i])if("/"===t[i+1]){let n=D(t,">",i,"".concat(e," is not closed"));if(t.substring(i+2,n).trim()===e&&0==--s)return{tagContent:t.substring(r,i),i:n};i=n}else if("?"===t[i+1])i=D(t,"?>",i+1,"StopNode is not closed.");else if("!--"===t.substr(i+1,3))i=D(t,"-->",i+3,"StopNode is not closed.");else if("!["===t.substr(i+1,2))i=D(t,"]]>",i,"StopNode is not closed.")-2;else{let r=w(t,i,">");r&&((r&&r.tagName)===e&&"/"!==r.tagExp[r.tagExp.length-1]&&s++,i=r.closeIndex)}}function F(t,e,i){if(e&&"string"==typeof t){let e=t.trim();return"true"===e||"false"!==e&&function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(e=Object.assign({},x,e),!t||"string"!=typeof t)return t;let i=t.trim();if(void 0!==e.skipLike&&e.skipLike.test(i))return t;if("0"===t)return 0;if(e.hex&&N.test(i)){var r,s=i,n=16;if(parseInt)return parseInt(s,16);if(Number.parseInt)return Number.parseInt(s,n);if(window&&window.parseInt)return window.parseInt(s,n);throw Error("parseInt, Number.parseInt, window.parseInt are not supported")}if(-1!==i.search(/[eE]/)){let r=i.match(/^([-\+])?(0*)([0-9]*(\.[0-9]*)?[eE][-\+]?[0-9]+)$/);if(!r)return t;if(e.leadingZeros)i=(r[1]||"")+r[3];else if("0"!==r[2]||"."!==r[3][0])return t;return e.eNotation?Number(i):t}{let s=m.exec(i);if(!s)return t;{let n=s[1],a=s[2],o=((r=s[3])&&-1!==r.indexOf(".")&&("."===(r=r.replace(/0+$/,""))?r="0":"."===r[0]?r="0"+r:"."===r[r.length-1]&&(r=r.substr(0,r.length-1))),r);if(!e.leadingZeros&&a.length>0&&n&&"."!==i[2])return t;{if(!e.leadingZeros&&a.length>0&&!n&&"."!==i[1])return t;if(e.leadingZeros&&a===t)return 0;let r=Number(i),s=""+r;if(-1!==s.search(/[eE]/))if(e.eNotation)return r;else return t;if(-1!==i.indexOf("."))if("0"===s&&""===o)return r;else if(s===o)return r;else if(n&&s==="-"+o)return r;else return t;return a?o===s||n+o===s?r:t:i===s||i===n+s?r:t}}}}(t,i)}return void 0!==t?t:""}class V{parse(t,e){if("string"==typeof t);else if(t.toString)t=t.toString();else throw Error("XML data is accepted in String or Bytes[] form.");if(e){!0===e&&(e={});let i=function(t,e){e=Object.assign({},a,e);let i=[],r=!1,s=!1;"\uFEFF"===t[0]&&(t=t.substr(1));for(let a=0;a<t.length;a++)if("<"===t[a]&&"?"===t[a+1]){if(a+=2,(a=l(t,a)).err)return a}else if("<"===t[a]){let h=a;if("!"===t[++a]){a=u(t,a);continue}{let d=!1;"/"===t[a]&&(d=!0,a++);let f="";for(;a<t.length&&">"!==t[a]&&" "!==t[a]&&"	"!==t[a]&&"\n"!==t[a]&&"\r"!==t[a];a++)f+=t[a];if("/"===(f=f.trim())[f.length-1]&&(f=f.substring(0,f.length-1),a--),!n(f))return c("InvalidTag",0===f.trim().length?"Invalid space after '<'.":"Tag '"+f+"' is an invalid name.",g(t,a));let E=function(t,e){let i="",r="",s=!1;for(;e<t.length;e++){if('"'===t[e]||"'"===t[e])""===r?r=t[e]:r!==t[e]||(r="");else if(">"===t[e]&&""===r){s=!0;break}i+=t[e]}return""===r&&{value:i,index:e,tagClosed:s}}(t,a);if(!1===E)return c("InvalidAttr","Attributes for '"+f+"' have open quote.",g(t,a));let N=E.value;if(a=E.index,"/"===N[N.length-1]){let i=a-N.length,s=p(N=N.substring(0,N.length-1),e);if(!0!==s)return c(s.err.code,s.err.msg,g(t,i+s.err.line));r=!0}else if(d)if(!E.tagClosed)return c("InvalidTag","Closing tag '"+f+"' doesn't have proper closing.",g(t,a));else{if(N.trim().length>0)return c("InvalidTag","Closing tag '"+f+"' can't have attributes or invalid starting.",g(t,h));if(0===i.length)return c("InvalidTag","Closing tag '"+f+"' has not been opened.",g(t,h));let e=i.pop();if(f!==e.tagName){let i=g(t,e.tagStartPos);return c("InvalidTag","Expected closing tag '"+e.tagName+"' (opened in line "+i.line+", col "+i.col+") instead of closing tag '"+f+"'.",g(t,h))}0==i.length&&(s=!0)}else{let n=p(N,e);if(!0!==n)return c(n.err.code,n.err.msg,g(t,a-N.length+n.err.line));if(!0===s)return c("InvalidXml","Multiple possible root nodes found.",g(t,a));-1!==e.unpairedTags.indexOf(f)||i.push({tagName:f,tagStartPos:h}),r=!0}for(a++;a<t.length;a++)if("<"===t[a])if("!"===t[a+1]){a=u(t,++a);continue}else if("?"===t[a+1]){if((a=l(t,++a)).err)return a}else break;else if("&"===t[a]){let e=function(t,e){if(";"===t[++e])return -1;if("#"===t[e]){var i=++e;let r=/\d/;for("x"===t[i]&&(i++,r=/[\da-fA-F]/);i<t.length;i++){if(";"===t[i])return i;if(!t[i].match(r))break}return -1}let r=0;for(;e<t.length;e++,r++)if(!t[e].match(/\w/)||!(r<20)){if(";"===t[e])break;return -1}return e}(t,a);if(-1==e)return c("InvalidChar","char '&' is not expected.",g(t,a));a=e}else if(!0===s&&!o(t[a]))return c("InvalidXml","Extra text at the end",g(t,a));"<"===t[a]&&a--}}else{if(o(t[a]))continue;return c("InvalidChar","char '"+t[a]+"' is not expected.",g(t,a))}return r?1==i.length?c("InvalidTag","Unclosed tag '"+i[0].tagName+"'.",g(t,i[0].tagStartPos)):!(i.length>0)||c("InvalidXml","Invalid '"+JSON.stringify(i.map(t=>t.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1}):c("InvalidXml","Start tag expected.",1)}(t,e);if(!0!==i)throw Error("".concat(i.err.msg,":").concat(i.err.line,":").concat(i.err.col))}let i=new A(this.options);i.addExternalEntities(this.externalEntities);let r=i.parseXml(t);return this.options.preserveOrder||void 0===r?r:function t(e,i,r){let s,n={};for(let a=0;a<e.length;a++){let o=e[a],l=function(t){let e=Object.keys(t);for(let t=0;t<e.length;t++){let i=e[t];if(":@"!==i)return i}}(o),u="";if(u=void 0===r?l:r+"."+l,l===i.textNodeName)void 0===s?s=o[l]:s+=""+o[l];else if(void 0===l)continue;else if(o[l]){let e=t(o[l],i,u),r=function(t,e){let{textNodeName:i}=e,r=Object.keys(t).length;return 0===r||1===r&&(!!t[i]||"boolean"==typeof t[i]||0===t[i])}(e,i);o[":@"]?function(t,e,i,r){if(e){let s=Object.keys(e),n=s.length;for(let a=0;a<n;a++){let n=s[a];r.isArray(n,i+"."+n,!0,!0)?t[n]=[e[n]]:t[n]=e[n]}}}(e,o[":@"],u,i):1!==Object.keys(e).length||void 0===e[i.textNodeName]||i.alwaysCreateTextNode?0===Object.keys(e).length&&(i.alwaysCreateTextNode?e[i.textNodeName]="":e=""):e=e[i.textNodeName],void 0!==n[l]&&n.hasOwnProperty(l)?(Array.isArray(n[l])||(n[l]=[n[l]]),n[l].push(e)):i.isArray(l,u,r)?n[l]=[e]:n[l]=e}}return"string"==typeof s?s.length>0&&(n[i.textNodeName]=s):void 0!==s&&(n[i.textNodeName]=s),n}(r,this.options)}addEntity(t,e){if(-1!==e.indexOf("&"))throw Error("Entity value can't have '&'");if(-1!==t.indexOf("&")||-1!==t.indexOf(";"))throw Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '&#xD;'");if("&"===e)throw Error("An entity with value '&' is not permitted");this.externalEntities[t]=e}constructor(t){this.externalEntities={},this.options=Object.assign({},f,t)}}function B(t,e){let i="";if(t&&!e.ignoreAttributes)for(let r in t){if(!t.hasOwnProperty(r))continue;let s=e.attributeValueProcessor(r,t[r]);!0===(s=L(s,e))&&e.suppressBooleanAttributes?i+=" ".concat(r.substr(e.attributeNamePrefix.length)):i+=" ".concat(r.substr(e.attributeNamePrefix.length),'="').concat(s,'"')}return i}function L(t,e){if(t&&t.length>0&&e.processEntities)for(let i=0;i<e.entities.length;i++){let r=e.entities[i];t=t.replace(r.regex,r.val)}return t}let j={attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,cdataPropName:!1,format:!1,indentBy:"  ",suppressEmptyNode:!1,suppressUnpairedNode:!0,suppressBooleanAttributes:!0,tagValueProcessor:function(t,e){return e},attributeValueProcessor:function(t,e){return e},preserveOrder:!1,commentPropName:!1,unpairedTags:[],entities:[{regex:RegExp("&","g"),val:"&amp;"},{regex:RegExp(">","g"),val:"&gt;"},{regex:RegExp("<","g"),val:"&lt;"},{regex:RegExp("'","g"),val:"&apos;"},{regex:RegExp('"',"g"),val:"&quot;"}],processEntities:!0,stopNodes:[],oneListGroup:!1};function U(t){this.options=Object.assign({},j,t),!0===this.options.ignoreAttributes||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.ignoreAttributesFn=b(this.options.ignoreAttributes),this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=Y),this.processTextOrObjNode=J,this.options.format?(this.indentate=M,this.tagEndChar=">\n",this.newLine="\n"):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}function J(t,e,i,r){let s=this.j2x(t,i+1,r.concat(e));return void 0!==t[this.options.textNodeName]&&1===Object.keys(t).length?this.buildTextValNode(t[this.options.textNodeName],e,s.attrStr,i):this.buildObjectNode(s.val,e,s.attrStr,i)}function M(t){return this.options.indentBy.repeat(t)}function Y(t){return!!t.startsWith(this.options.attributeNamePrefix)&&t!==this.options.textNodeName&&t.substr(this.attrPrefixLen)}U.prototype.build=function(t){var e,i;let r;if(!this.options.preserveOrder)return Array.isArray(t)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(t={[this.options.arrayNodeName]:t}),this.j2x(t,0,[]).val;return e=t,i=this.options,r="",i.format&&i.indentBy.length>0&&(r="\n"),function t(e,i,r,s){let n="",a=!1;for(let o=0;o<e.length;o++){let l=e[o],u=function(t){let e=Object.keys(t);for(let i=0;i<e.length;i++){let r=e[i];if(t.hasOwnProperty(r)&&":@"!==r)return r}}(l);if(void 0===u)continue;let h="";if(h=0===r.length?u:"".concat(r,".").concat(u),u===i.textNodeName){let t=l[u];!function(t,e){let i=(t=t.substr(0,t.length-e.textNodeName.length-1)).substr(t.lastIndexOf(".")+1);for(let r in e.stopNodes)if(e.stopNodes[r]===t||e.stopNodes[r]==="*."+i)return!0;return!1}(h,i)&&(t=L(t=i.tagValueProcessor(u,t),i)),a&&(n+=s),n+=t,a=!1;continue}if(u===i.cdataPropName){a&&(n+=s),n+="<![CDATA[".concat(l[u][0][i.textNodeName],"]]>"),a=!1;continue}if(u===i.commentPropName){n+=s+"<!--".concat(l[u][0][i.textNodeName],"-->"),a=!0;continue}else if("?"===u[0]){let t=B(l[":@"],i),e="?xml"===u?"":s,r=l[u][0][i.textNodeName];r=0!==r.length?" "+r:"",n+=e+"<".concat(u).concat(r).concat(t,"?>"),a=!0;continue}let p=s;""!==p&&(p+=i.indentBy);let c=B(l[":@"],i),g=s+"<".concat(u).concat(c),d=t(l[u],i,h,p);-1!==i.unpairedTags.indexOf(u)?i.suppressUnpairedNode?n+=g+">":n+=g+"/>":(!d||0===d.length)&&i.suppressEmptyNode?n+=g+"/>":d&&d.endsWith(">")?n+=g+">".concat(d).concat(s,"</").concat(u,">"):(n+=g+">",d&&""!==s&&(d.includes("/>")||d.includes("</"))?n+=s+i.indentBy+d+s:n+=d,n+="</".concat(u,">")),a=!0}return n}(e,i,"",r)},U.prototype.j2x=function(t,e,i){let r="",s="",n=i.join(".");for(let a in t)if(Object.prototype.hasOwnProperty.call(t,a))if(void 0===t[a])this.isAttribute(a)&&(s+="");else if(null===t[a])this.isAttribute(a)||a===this.options.cdataPropName?s+="":"?"===a[0]?s+=this.indentate(e)+"<"+a+"?"+this.tagEndChar:s+=this.indentate(e)+"<"+a+"/"+this.tagEndChar;else if(t[a]instanceof Date)s+=this.buildTextValNode(t[a],a,"",e);else if("object"!=typeof t[a]){let i=this.isAttribute(a);if(i&&!this.ignoreAttributesFn(i,n))r+=this.buildAttrPairStr(i,""+t[a]);else if(!i)if(a===this.options.textNodeName){let e=this.options.tagValueProcessor(a,""+t[a]);s+=this.replaceEntitiesValue(e)}else s+=this.buildTextValNode(t[a],a,"",e)}else if(Array.isArray(t[a])){let r=t[a].length,n="",o="";for(let l=0;l<r;l++){let r=t[a][l];if(void 0===r);else if(null===r)"?"===a[0]?s+=this.indentate(e)+"<"+a+"?"+this.tagEndChar:s+=this.indentate(e)+"<"+a+"/"+this.tagEndChar;else if("object"==typeof r)if(this.options.oneListGroup){let t=this.j2x(r,e+1,i.concat(a));n+=t.val,this.options.attributesGroupName&&r.hasOwnProperty(this.options.attributesGroupName)&&(o+=t.attrStr)}else n+=this.processTextOrObjNode(r,a,e,i);else if(this.options.oneListGroup){let t=this.options.tagValueProcessor(a,r);n+=t=this.replaceEntitiesValue(t)}else n+=this.buildTextValNode(r,a,"",e)}this.options.oneListGroup&&(n=this.buildObjectNode(n,a,o,e)),s+=n}else if(this.options.attributesGroupName&&a===this.options.attributesGroupName){let e=Object.keys(t[a]),i=e.length;for(let s=0;s<i;s++)r+=this.buildAttrPairStr(e[s],""+t[a][e[s]])}else s+=this.processTextOrObjNode(t[a],a,e,i);return{attrStr:r,val:s}},U.prototype.buildAttrPairStr=function(t,e){return(e=this.options.attributeValueProcessor(t,""+e),e=this.replaceEntitiesValue(e),this.options.suppressBooleanAttributes&&"true"===e)?" "+t:" "+t+'="'+e+'"'},U.prototype.buildObjectNode=function(t,e,i,r){if(""===t)if("?"===e[0])return this.indentate(r)+"<"+e+i+"?"+this.tagEndChar;else return this.indentate(r)+"<"+e+i+this.closeTag(e)+this.tagEndChar;{let s="</"+e+this.tagEndChar,n="";return("?"===e[0]&&(n="?",s=""),(i||""===i)&&-1===t.indexOf("<"))?this.indentate(r)+"<"+e+i+n+">"+t+s:!1!==this.options.commentPropName&&e===this.options.commentPropName&&0===n.length?this.indentate(r)+"<!--".concat(t,"-->")+this.newLine:this.indentate(r)+"<"+e+i+n+this.tagEndChar+t+this.indentate(r)+s}},U.prototype.closeTag=function(t){let e="";return -1!==this.options.unpairedTags.indexOf(t)?this.options.suppressUnpairedNode||(e="/"):e=this.options.suppressEmptyNode?"/":"></".concat(t),e},U.prototype.buildTextValNode=function(t,e,i,r){if(!1!==this.options.cdataPropName&&e===this.options.cdataPropName)return this.indentate(r)+"<![CDATA[".concat(t,"]]>")+this.newLine;{if(!1!==this.options.commentPropName&&e===this.options.commentPropName)return this.indentate(r)+"<!--".concat(t,"-->")+this.newLine;if("?"===e[0])return this.indentate(r)+"<"+e+i+"?"+this.tagEndChar;let s=this.options.tagValueProcessor(e,t);return""===(s=this.replaceEntitiesValue(s))?this.indentate(r)+"<"+e+i+this.closeTag(e)+this.tagEndChar:this.indentate(r)+"<"+e+i+">"+s+"</"+e+this.tagEndChar}},U.prototype.replaceEntitiesValue=function(t){if(t&&t.length>0&&this.options.processEntities)for(let e=0;e<this.options.entities.length;e++){let i=this.options.entities[e];t=t.replace(i.regex,i.val)}return t},t.s(["XMLParser",()=>V],258561);var G=t.i(290583);let X=G.z.object({name:G.z.string(),args:G.z.record(G.z.string(),G.z.any()),toolUsageCardId:G.z.string().optional()}),K="</xai:tool_usage_card>",W="</xai:tool_args>";function z(t){var i,r;let s,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{isStreaming:a=!1,responseId:o}=n,l=t,u=(l.match(RegExp("<xai:tool_args>","g"))||[]).length-(l.match(RegExp(W,"g"))||[]).length,h=((l+=W.repeat(u)).match(RegExp("<xai:tool_usage_card>","g"))||[]).length-(l.match(RegExp(K,"g"))||[]).length;l+=K.repeat(h);let p=new V({ignoreAttributes:!1,alwaysCreateTextNode:!0,attributeNamePrefix:"xai:"}),c=!0;for(;c;){c=!1;try{s=p.parse(l)}catch(t){if(!(t instanceof Error))break;if(a||(0,e.logError)("tool-usage.xml-parse",t,{xmlText:l,...o?{responseId:o}:{}}),"CDATA is not closed."===t.message){l+="]]>",c=!0;continue}}}let g=null!=(r=s["xai:tool_usage_card"])?r:[];Array.isArray(g)||(g=[g]);let d=(null==(i=g[0])?void 0:i.xai_notification)||"",f=[],E=t=>{var e;return"object"==typeof t?null!=(e=t["#text"])?e:"":null!=t?t:""};for(let t of g){let i,r=E(t["xai:tool_usage_card_id"]),s=E(t["xai:tool_name"]),n=E(t["xai:tool_args"]);try{i=JSON.parse(n)}catch(t){try{i=JSON.parse(function(t){let e=["ROOT"],i=-1,r=null;function s(t,s,n){switch(t){case'"':i=s,e.pop(),e.push(n),e.push("INSIDE_STRING");break;case"f":case"t":case"n":i=s,r=s,e.pop(),e.push(n),e.push("INSIDE_LITERAL");break;case"-":e.pop(),e.push(n),e.push("INSIDE_NUMBER");break;case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":i=s,e.pop(),e.push(n),e.push("INSIDE_NUMBER");break;case"{":i=s,e.pop(),e.push(n),e.push("INSIDE_OBJECT_START");break;case"[":i=s,e.pop(),e.push(n),e.push("INSIDE_ARRAY_START")}}function n(t,r){switch(t){case",":e.pop(),e.push("INSIDE_OBJECT_AFTER_COMMA");break;case"}":i=r,e.pop()}}function a(t,r){switch(t){case",":e.pop(),e.push("INSIDE_ARRAY_AFTER_COMMA");break;case"]":i=r,e.pop()}}for(let o=0;o<t.length;o++){let l=t[o];if(void 0===l)throw Error("fixJson: Unexpected undefined character at index "+o);switch(e[e.length-1]){case"ROOT":s(l,o,"FINISH");break;case"INSIDE_OBJECT_START":switch(l){case'"':e.pop(),e.push("INSIDE_OBJECT_KEY");break;case"}":i=o,e.pop()}break;case"INSIDE_OBJECT_AFTER_COMMA":'"'===l&&(e.pop(),e.push("INSIDE_OBJECT_KEY"));break;case"INSIDE_OBJECT_KEY":'"'===l&&(e.pop(),e.push("INSIDE_OBJECT_AFTER_KEY"));break;case"INSIDE_OBJECT_AFTER_KEY":":"===l&&(e.pop(),e.push("INSIDE_OBJECT_BEFORE_VALUE"));break;case"INSIDE_OBJECT_BEFORE_VALUE":s(l,o,"INSIDE_OBJECT_AFTER_VALUE");break;case"INSIDE_OBJECT_AFTER_VALUE":n(l,o);break;case"INSIDE_STRING":switch(l){case'"':e.pop(),i=o;break;case"\\":e.push("INSIDE_STRING_ESCAPE");break;default:i=o}break;case"INSIDE_ARRAY_START":"]"===l?(i=o,e.pop()):(i=o,s(l,o,"INSIDE_ARRAY_AFTER_VALUE"));break;case"INSIDE_ARRAY_AFTER_VALUE":switch(l){case",":e.pop(),e.push("INSIDE_ARRAY_AFTER_COMMA");break;case"]":i=o,e.pop();break;default:i=o}break;case"INSIDE_ARRAY_AFTER_COMMA":s(l,o,"INSIDE_ARRAY_AFTER_VALUE");break;case"INSIDE_STRING_ESCAPE":e.pop(),i=o;break;case"INSIDE_NUMBER":switch(l){case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":i=o;break;case"e":case"E":case"-":case".":break;case",":e.pop(),"INSIDE_ARRAY_AFTER_VALUE"===e[e.length-1]&&a(l,o),"INSIDE_OBJECT_AFTER_VALUE"===e[e.length-1]&&n(l,o);break;case"}":e.pop(),"INSIDE_OBJECT_AFTER_VALUE"===e[e.length-1]&&n(l,o);break;case"]":e.pop(),"INSIDE_ARRAY_AFTER_VALUE"===e[e.length-1]&&a(l,o);break;default:e.pop()}break;case"INSIDE_LITERAL":{if(null===r)throw Error("fixJson: literalStart is null in INSIDE_LITERAL state");let s=t.substring(r,o+1);"false".startsWith(s)||"true".startsWith(s)||"null".startsWith(s)?i=o:(e.pop(),"INSIDE_OBJECT_AFTER_VALUE"===e[e.length-1]?n(l,o):"INSIDE_ARRAY_AFTER_VALUE"===e[e.length-1]&&a(l,o))}}}let o=t.slice(0,i+1);for(let i=e.length-1;i>=0;i--)switch(e[i]){case"INSIDE_STRING":o+='"';break;case"INSIDE_OBJECT_KEY":case"INSIDE_OBJECT_AFTER_KEY":case"INSIDE_OBJECT_AFTER_COMMA":case"INSIDE_OBJECT_START":case"INSIDE_OBJECT_BEFORE_VALUE":case"INSIDE_OBJECT_AFTER_VALUE":o+="}";break;case"INSIDE_ARRAY_START":case"INSIDE_ARRAY_AFTER_COMMA":case"INSIDE_ARRAY_AFTER_VALUE":o+="]";break;case"INSIDE_LITERAL":{if(null===r)throw Error("fixJson: literalStart is null in INSIDE_LITERAL state at end");let e=t.substring(r,t.length);"true".startsWith(e)?o+="true".slice(e.length):"false".startsWith(e)?o+="false".slice(e.length):"null".startsWith(e)&&(o+="null".slice(e.length))}}return o}(n||"{}"))}catch(t){a||(0,e.logError)("tool-usage.fix-json",t,{args:n,...o?{responseId:o}:{}}),i={}}}let l=X.safeParse({name:s,args:i,toolUsageCardId:r});l.success?f.push(l.data):(0,e.logError)("tool-usage.parse",l.error)}return{notification:d,calls:f}}},130317,t=>{"use strict";t.s(["processChunks",()=>s]);var e=t.i(363848);async function*i(t){if(null===t.body)throw Error("Cannot process response chunks of a response without body.");let e=t.body.getReader(),i=new TextDecoder,s="";for(;;){let{done:t,value:n}=await e.read();if(t)break;let[a,o]=r(s+=i.decode(n,{stream:!0}));for(let t of a)yield t;s=o}let[n,a]=r(s);for(let t of n)yield t;a.length>0&&(yield a)}function r(t){let e=t.split("\n"),i=e.pop();return[e,i]}async function*s(t){for await(let r of i(t))try{let i=JSON.parse(r);(0,e.recordStreamError)(i,t),yield i}catch(i){(0,e.recordStreamError)(i,t)}}}]);

//# sourceMappingURL=e33cef89c07d99ba.js.map
//# debugId=d77c4f1f-e24e-5555-a220-5313925b415d