@intelliweave/embedded 1.7.59 → 1.8.60

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import{b as Li,c as va,d as _a,e as J}from"./chunk-AIYMQX7V.js";var Sl=Li((sw,_l)=>{"use strict";var pi=Object.prototype.hasOwnProperty,vl=Object.prototype.toString,ml=Object.defineProperty,gl=Object.getOwnPropertyDescriptor,hl=function(n){return typeof Array.isArray=="function"?Array.isArray(n):vl.call(n)==="[object Array]"},fl=function(n){if(!n||vl.call(n)!=="[object Object]")return!1;var t=pi.call(n,"constructor"),i=n.constructor&&n.constructor.prototype&&pi.call(n.constructor.prototype,"isPrototypeOf");if(n.constructor&&!t&&!i)return!1;var r;for(r in n);return typeof r>"u"||pi.call(n,r)},yl=function(n,t){ml&&t.name==="__proto__"?ml(n,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):n[t.name]=t.newValue},bl=function(n,t){if(t==="__proto__")if(pi.call(n,t)){if(gl)return gl(n,t).value}else return;return n[t]};_l.exports=function e(){var n,t,i,r,a,o,s=arguments[0],l=1,c=arguments.length,u=!1;for(typeof s=="boolean"&&(u=s,s=arguments[1]||{},l=2),(s==null||typeof s!="object"&&typeof s!="function")&&(s={});l<c;++l)if(n=arguments[l],n!=null)for(t in n)i=bl(s,t),r=bl(n,t),s!==r&&(u&&r&&(fl(r)||(a=hl(r)))?(a?(a=!1,o=i&&hl(i)?i:[]):o=i&&fl(i)?i:{},yl(s,{name:t,newValue:e(u,o,r)})):typeof r<"u"&&yl(s,{name:t,newValue:r}));return s}});var Wl=Li(V=>{"use strict";var un=Symbol.for("react.element"),og=Symbol.for("react.portal"),sg=Symbol.for("react.fragment"),lg=Symbol.for("react.strict_mode"),cg=Symbol.for("react.profiler"),ug=Symbol.for("react.provider"),dg=Symbol.for("react.context"),pg=Symbol.for("react.forward_ref"),mg=Symbol.for("react.suspense"),gg=Symbol.for("react.memo"),hg=Symbol.for("react.lazy"),Ll=Symbol.iterator;function fg(e){return e===null||typeof e!="object"?null:(e=Ll&&e[Ll]||e["@@iterator"],typeof e=="function"?e:null)}var Ol={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Bl=Object.assign,Fl={};function Dt(e,n,t){this.props=e,this.context=n,this.refs=Fl,this.updater=t||Ol}Dt.prototype.isReactComponent={};Dt.prototype.setState=function(e,n){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,n,"setState")};Dt.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Gl(){}Gl.prototype=Dt.prototype;function ua(e,n,t){this.props=e,this.context=n,this.refs=Fl,this.updater=t||Ol}var da=ua.prototype=new Gl;da.constructor=ua;Bl(da,Dt.prototype);da.isPureReactComponent=!0;var Nl=Array.isArray,zl=Object.prototype.hasOwnProperty,pa={current:null},Ul={key:!0,ref:!0,__self:!0,__source:!0};function Hl(e,n,t){var i,r={},a=null,o=null;if(n!=null)for(i in n.ref!==void 0&&(o=n.ref),n.key!==void 0&&(a=""+n.key),n)zl.call(n,i)&&!Ul.hasOwnProperty(i)&&(r[i]=n[i]);var s=arguments.length-2;if(s===1)r.children=t;else if(1<s){for(var l=Array(s),c=0;c<s;c++)l[c]=arguments[c+2];r.children=l}if(e&&e.defaultProps)for(i in s=e.defaultProps,s)r[i]===void 0&&(r[i]=s[i]);return{$$typeof:un,type:e,key:a,ref:o,props:r,_owner:pa.current}}function yg(e,n){return{$$typeof:un,type:e.type,key:n,ref:e.ref,props:e.props,_owner:e._owner}}function ma(e){return typeof e=="object"&&e!==null&&e.$$typeof===un}function bg(e){var n={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(t){return n[t]})}var Ml=/\/+/g;function ca(e,n){return typeof e=="object"&&e!==null&&e.key!=null?bg(""+e.key):n.toString(36)}function Ii(e,n,t,i,r){var a=typeof e;(a==="undefined"||a==="boolean")&&(e=null);var o=!1;if(e===null)o=!0;else switch(a){case"string":case"number":o=!0;break;case"object":switch(e.$$typeof){case un:case og:o=!0}}if(o)return o=e,r=r(o),e=i===""?"."+ca(o,0):i,Nl(r)?(t="",e!=null&&(t=e.replace(Ml,"$&/")+"/"),Ii(r,n,t,"",function(c){return c})):r!=null&&(ma(r)&&(r=yg(r,t+(!r.key||o&&o.key===r.key?"":(""+r.key).replace(Ml,"$&/")+"/")+e)),n.push(r)),1;if(o=0,i=i===""?".":i+":",Nl(e))for(var s=0;s<e.length;s++){a=e[s];var l=i+ca(a,s);o+=Ii(a,n,t,l,r)}else if(l=fg(e),typeof l=="function")for(e=l.call(e),s=0;!(a=e.next()).done;)a=a.value,l=i+ca(a,s++),o+=Ii(a,n,t,l,r);else if(a==="object")throw n=String(e),Error("Objects are not valid as a React child (found: "+(n==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":n)+"). If you meant to render a collection of children, use an array instead.");return o}function xi(e,n,t){if(e==null)return e;var i=[],r=0;return Ii(e,i,"","",function(a){return n.call(t,a,r++)}),i}function vg(e){if(e._status===-1){var n=e._result;n=n(),n.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t)},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t)}),e._status===-1&&(e._status=0,e._result=n)}if(e._status===1)return e._result.default;throw e._result}var ge={current:null},Ri={transition:null},_g={ReactCurrentDispatcher:ge,ReactCurrentBatchConfig:Ri,ReactCurrentOwner:pa};function Vl(){throw Error("act(...) is not supported in production builds of React.")}V.Children={map:xi,forEach:function(e,n,t){xi(e,function(){n.apply(this,arguments)},t)},count:function(e){var n=0;return xi(e,function(){n++}),n},toArray:function(e){return xi(e,function(n){return n})||[]},only:function(e){if(!ma(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};V.Component=Dt;V.Fragment=sg;V.Profiler=cg;V.PureComponent=ua;V.StrictMode=lg;V.Suspense=mg;V.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=_g;V.act=Vl;V.cloneElement=function(e,n,t){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var i=Bl({},e.props),r=e.key,a=e.ref,o=e._owner;if(n!=null){if(n.ref!==void 0&&(a=n.ref,o=pa.current),n.key!==void 0&&(r=""+n.key),e.type&&e.type.defaultProps)var s=e.type.defaultProps;for(l in n)zl.call(n,l)&&!Ul.hasOwnProperty(l)&&(i[l]=n[l]===void 0&&s!==void 0?s[l]:n[l])}var l=arguments.length-2;if(l===1)i.children=t;else if(1<l){s=Array(l);for(var c=0;c<l;c++)s[c]=arguments[c+2];i.children=s}return{$$typeof:un,type:e.type,key:r,ref:a,props:i,_owner:o}};V.createContext=function(e){return e={$$typeof:dg,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:ug,_context:e},e.Consumer=e};V.createElement=Hl;V.createFactory=function(e){var n=Hl.bind(null,e);return n.type=e,n};V.createRef=function(){return{current:null}};V.forwardRef=function(e){return{$$typeof:pg,render:e}};V.isValidElement=ma;V.lazy=function(e){return{$$typeof:hg,_payload:{_status:-1,_result:e},_init:vg}};V.memo=function(e,n){return{$$typeof:gg,type:e,compare:n===void 0?null:n}};V.startTransition=function(e){var n=Ri.transition;Ri.transition={};try{e()}finally{Ri.transition=n}};V.unstable_act=Vl;V.useCallback=function(e,n){return ge.current.useCallback(e,n)};V.useContext=function(e){return ge.current.useContext(e)};V.useDebugValue=function(){};V.useDeferredValue=function(e){return ge.current.useDeferredValue(e)};V.useEffect=function(e,n){return ge.current.useEffect(e,n)};V.useId=function(){return ge.current.useId()};V.useImperativeHandle=function(e,n,t){return ge.current.useImperativeHandle(e,n,t)};V.useInsertionEffect=function(e,n){return ge.current.useInsertionEffect(e,n)};V.useLayoutEffect=function(e,n){return ge.current.useLayoutEffect(e,n)};V.useMemo=function(e,n){return ge.current.useMemo(e,n)};V.useReducer=function(e,n,t){return ge.current.useReducer(e,n,t)};V.useRef=function(e){return ge.current.useRef(e)};V.useState=function(e){return ge.current.useState(e)};V.useSyncExternalStore=function(e,n,t){return ge.current.useSyncExternalStore(e,n,t)};V.useTransition=function(){return ge.current.useTransition()};V.version="18.3.1"});var ql=Li((OT,jl)=>{"use strict";jl.exports=Wl()});var le=[];for(mn=0;mn<256;++mn)le.push((mn+256).toString(16).slice(1));var mn;function Sa(e,n=0){return(le[e[n+0]]+le[e[n+1]]+le[e[n+2]]+le[e[n+3]]+"-"+le[e[n+4]]+le[e[n+5]]+"-"+le[e[n+6]]+le[e[n+7]]+"-"+le[e[n+8]]+le[e[n+9]]+"-"+le[e[n+10]]+le[e[n+11]]+le[e[n+12]]+le[e[n+13]]+le[e[n+14]]+le[e[n+15]]).toLowerCase()}var gn,Ql=new Uint8Array(16);function Ni(){if(!gn&&(gn=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!gn))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return gn(Ql)}var ec=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Mi={randomUUID:ec};function tc(e,n,t){if(Mi.randomUUID&&!n&&!e)return Mi.randomUUID();e=e||{};var i=e.random||(e.rng||Ni)();if(i[6]=i[6]&15|64,i[8]=i[8]&63|128,n){t=t||0;for(var r=0;r<16;++r)n[t+r]=i[r];return n}return Sa(i)}var Te=tc;function Oi(e){let n=(e||"").split(`
1
+ import{b as Ni,c as va,d as _a,e as J}from"./chunk-AIYMQX7V.js";var Sl=Ni((sw,_l)=>{"use strict";var pi=Object.prototype.hasOwnProperty,vl=Object.prototype.toString,ml=Object.defineProperty,gl=Object.getOwnPropertyDescriptor,hl=function(n){return typeof Array.isArray=="function"?Array.isArray(n):vl.call(n)==="[object Array]"},fl=function(n){if(!n||vl.call(n)!=="[object Object]")return!1;var t=pi.call(n,"constructor"),i=n.constructor&&n.constructor.prototype&&pi.call(n.constructor.prototype,"isPrototypeOf");if(n.constructor&&!t&&!i)return!1;var r;for(r in n);return typeof r>"u"||pi.call(n,r)},yl=function(n,t){ml&&t.name==="__proto__"?ml(n,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):n[t.name]=t.newValue},bl=function(n,t){if(t==="__proto__")if(pi.call(n,t)){if(gl)return gl(n,t).value}else return;return n[t]};_l.exports=function e(){var n,t,i,r,a,o,s=arguments[0],l=1,c=arguments.length,u=!1;for(typeof s=="boolean"&&(u=s,s=arguments[1]||{},l=2),(s==null||typeof s!="object"&&typeof s!="function")&&(s={});l<c;++l)if(n=arguments[l],n!=null)for(t in n)i=bl(s,t),r=bl(n,t),s!==r&&(u&&r&&(fl(r)||(a=hl(r)))?(a?(a=!1,o=i&&hl(i)?i:[]):o=i&&fl(i)?i:{},yl(s,{name:t,newValue:e(u,o,r)})):typeof r<"u"&&yl(s,{name:t,newValue:r}));return s}});var Wl=Ni(V=>{"use strict";var un=Symbol.for("react.element"),og=Symbol.for("react.portal"),sg=Symbol.for("react.fragment"),lg=Symbol.for("react.strict_mode"),cg=Symbol.for("react.profiler"),ug=Symbol.for("react.provider"),dg=Symbol.for("react.context"),pg=Symbol.for("react.forward_ref"),mg=Symbol.for("react.suspense"),gg=Symbol.for("react.memo"),hg=Symbol.for("react.lazy"),Nl=Symbol.iterator;function fg(e){return e===null||typeof e!="object"?null:(e=Nl&&e[Nl]||e["@@iterator"],typeof e=="function"?e:null)}var Ol={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Bl=Object.assign,Fl={};function Dt(e,n,t){this.props=e,this.context=n,this.refs=Fl,this.updater=t||Ol}Dt.prototype.isReactComponent={};Dt.prototype.setState=function(e,n){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,n,"setState")};Dt.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Gl(){}Gl.prototype=Dt.prototype;function ua(e,n,t){this.props=e,this.context=n,this.refs=Fl,this.updater=t||Ol}var da=ua.prototype=new Gl;da.constructor=ua;Bl(da,Dt.prototype);da.isPureReactComponent=!0;var Ll=Array.isArray,zl=Object.prototype.hasOwnProperty,pa={current:null},Ul={key:!0,ref:!0,__self:!0,__source:!0};function Hl(e,n,t){var i,r={},a=null,o=null;if(n!=null)for(i in n.ref!==void 0&&(o=n.ref),n.key!==void 0&&(a=""+n.key),n)zl.call(n,i)&&!Ul.hasOwnProperty(i)&&(r[i]=n[i]);var s=arguments.length-2;if(s===1)r.children=t;else if(1<s){for(var l=Array(s),c=0;c<s;c++)l[c]=arguments[c+2];r.children=l}if(e&&e.defaultProps)for(i in s=e.defaultProps,s)r[i]===void 0&&(r[i]=s[i]);return{$$typeof:un,type:e,key:a,ref:o,props:r,_owner:pa.current}}function yg(e,n){return{$$typeof:un,type:e.type,key:n,ref:e.ref,props:e.props,_owner:e._owner}}function ma(e){return typeof e=="object"&&e!==null&&e.$$typeof===un}function bg(e){var n={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(t){return n[t]})}var Ml=/\/+/g;function ca(e,n){return typeof e=="object"&&e!==null&&e.key!=null?bg(""+e.key):n.toString(36)}function Ii(e,n,t,i,r){var a=typeof e;(a==="undefined"||a==="boolean")&&(e=null);var o=!1;if(e===null)o=!0;else switch(a){case"string":case"number":o=!0;break;case"object":switch(e.$$typeof){case un:case og:o=!0}}if(o)return o=e,r=r(o),e=i===""?"."+ca(o,0):i,Ll(r)?(t="",e!=null&&(t=e.replace(Ml,"$&/")+"/"),Ii(r,n,t,"",function(c){return c})):r!=null&&(ma(r)&&(r=yg(r,t+(!r.key||o&&o.key===r.key?"":(""+r.key).replace(Ml,"$&/")+"/")+e)),n.push(r)),1;if(o=0,i=i===""?".":i+":",Ll(e))for(var s=0;s<e.length;s++){a=e[s];var l=i+ca(a,s);o+=Ii(a,n,t,l,r)}else if(l=fg(e),typeof l=="function")for(e=l.call(e),s=0;!(a=e.next()).done;)a=a.value,l=i+ca(a,s++),o+=Ii(a,n,t,l,r);else if(a==="object")throw n=String(e),Error("Objects are not valid as a React child (found: "+(n==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":n)+"). If you meant to render a collection of children, use an array instead.");return o}function xi(e,n,t){if(e==null)return e;var i=[],r=0;return Ii(e,i,"","",function(a){return n.call(t,a,r++)}),i}function vg(e){if(e._status===-1){var n=e._result;n=n(),n.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t)},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t)}),e._status===-1&&(e._status=0,e._result=n)}if(e._status===1)return e._result.default;throw e._result}var ge={current:null},Ri={transition:null},_g={ReactCurrentDispatcher:ge,ReactCurrentBatchConfig:Ri,ReactCurrentOwner:pa};function Vl(){throw Error("act(...) is not supported in production builds of React.")}V.Children={map:xi,forEach:function(e,n,t){xi(e,function(){n.apply(this,arguments)},t)},count:function(e){var n=0;return xi(e,function(){n++}),n},toArray:function(e){return xi(e,function(n){return n})||[]},only:function(e){if(!ma(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};V.Component=Dt;V.Fragment=sg;V.Profiler=cg;V.PureComponent=ua;V.StrictMode=lg;V.Suspense=mg;V.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=_g;V.act=Vl;V.cloneElement=function(e,n,t){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var i=Bl({},e.props),r=e.key,a=e.ref,o=e._owner;if(n!=null){if(n.ref!==void 0&&(a=n.ref,o=pa.current),n.key!==void 0&&(r=""+n.key),e.type&&e.type.defaultProps)var s=e.type.defaultProps;for(l in n)zl.call(n,l)&&!Ul.hasOwnProperty(l)&&(i[l]=n[l]===void 0&&s!==void 0?s[l]:n[l])}var l=arguments.length-2;if(l===1)i.children=t;else if(1<l){s=Array(l);for(var c=0;c<l;c++)s[c]=arguments[c+2];i.children=s}return{$$typeof:un,type:e.type,key:r,ref:a,props:i,_owner:o}};V.createContext=function(e){return e={$$typeof:dg,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:ug,_context:e},e.Consumer=e};V.createElement=Hl;V.createFactory=function(e){var n=Hl.bind(null,e);return n.type=e,n};V.createRef=function(){return{current:null}};V.forwardRef=function(e){return{$$typeof:pg,render:e}};V.isValidElement=ma;V.lazy=function(e){return{$$typeof:hg,_payload:{_status:-1,_result:e},_init:vg}};V.memo=function(e,n){return{$$typeof:gg,type:e,compare:n===void 0?null:n}};V.startTransition=function(e){var n=Ri.transition;Ri.transition={};try{e()}finally{Ri.transition=n}};V.unstable_act=Vl;V.useCallback=function(e,n){return ge.current.useCallback(e,n)};V.useContext=function(e){return ge.current.useContext(e)};V.useDebugValue=function(){};V.useDeferredValue=function(e){return ge.current.useDeferredValue(e)};V.useEffect=function(e,n){return ge.current.useEffect(e,n)};V.useId=function(){return ge.current.useId()};V.useImperativeHandle=function(e,n,t){return ge.current.useImperativeHandle(e,n,t)};V.useInsertionEffect=function(e,n){return ge.current.useInsertionEffect(e,n)};V.useLayoutEffect=function(e,n){return ge.current.useLayoutEffect(e,n)};V.useMemo=function(e,n){return ge.current.useMemo(e,n)};V.useReducer=function(e,n,t){return ge.current.useReducer(e,n,t)};V.useRef=function(e){return ge.current.useRef(e)};V.useState=function(e){return ge.current.useState(e)};V.useSyncExternalStore=function(e,n,t){return ge.current.useSyncExternalStore(e,n,t)};V.useTransition=function(){return ge.current.useTransition()};V.version="18.3.1"});var ql=Ni((OT,jl)=>{"use strict";jl.exports=Wl()});var le=[];for(mn=0;mn<256;++mn)le.push((mn+256).toString(16).slice(1));var mn;function Sa(e,n=0){return(le[e[n+0]]+le[e[n+1]]+le[e[n+2]]+le[e[n+3]]+"-"+le[e[n+4]]+le[e[n+5]]+"-"+le[e[n+6]]+le[e[n+7]]+"-"+le[e[n+8]]+le[e[n+9]]+"-"+le[e[n+10]]+le[e[n+11]]+le[e[n+12]]+le[e[n+13]]+le[e[n+14]]+le[e[n+15]]).toLowerCase()}var gn,Ql=new Uint8Array(16);function Li(){if(!gn&&(gn=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!gn))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return gn(Ql)}var ec=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Mi={randomUUID:ec};function tc(e,n,t){if(Mi.randomUUID&&!n&&!e)return Mi.randomUUID();e=e||{};var i=e.random||(e.rng||Li)();if(i[6]=i[6]&15|64,i[8]=i[8]&63|128,n){t=t||0;for(var r=0;r<16;++r)n[t+r]=i[r];return n}return Sa(i)}var Te=tc;function Oi(e){let n=(e||"").split(`
2
2
  `);for(;n.length>0&&n[0].trim()=="";)n.shift();for(;n.length>0&&n[n.length-1].trim()=="";)n.pop();let t=1/0;for(let i of n){let r=i.match(/^\s*/)?.[0].length||0;t=Math.min(t,r)}return t>0&&t<1/0&&(n=n.map(i=>i.substring(t))),n.join(`
3
3
  `)}var nc={};function He(){return typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:nc}function $(){return He().intelliweave=He().intelliweave||He().webWeaver||{},He().intelliweave}async function*Ea(e){let n="",t=function*(){for(;;){let a=n.indexOf(`
4
4
 
@@ -3246,23 +3246,29 @@ import{b as Li,c as va,d as _a,e as J}from"./chunk-AIYMQX7V.js";var Sl=Li((sw,_l
3246
3246
  `," spac"," rookies","(describing","ngen",[224,174,191,224,174],".rdf",".Mutex"," kneeling"," QE","setMax","ReadStream"," ventas","sut","cmpeq",".WriteAllText"," Experienced","$__"," kaum"," LIS"," documentos","_HEALTH","icontains"," artisans","OWNER"," blinked","getDisplay"," toen"," rowNum"," avril"," invis"," Kear","toBeInTheDocument","apur"," racked"," McMaster","_ATTRIB","Haz"," factura","/ts"," \u0440\u0430\u0437\u043C\u0435\u0440"," zf"," shortfall",".fasta"," CONSTANT",".managed","gems","SharedPointer"," blurry","brightness","(components",` ..."
3247
3247
 
3248
3248
  `,"SELL"," Illustrator",".getChannel"," trouv\xE9","ysters"," vois"," Linden"," emojis"," brawl"," MSR"," Elo"," Croatian","PopupMenu","Lewis",".JWT"," astonished","Bush","(itemId"," detachment"," Encore","\u5C14"," rekl"," cram",")$/",".getHost","_recommend","-HT","_calibration","Authenticate",".firebaseapp","UNIX"," Camera"," HEAP","Ideal",".office"," goofy","(Symbol"," jouer","_partitions"," rapidement"," GNUNET","idUser"," supervise","(Contact","AWN","\u3058"," naam"," aust","\u5728\u7EBF","_softmax","AllowAnonymous","ammable","ROUTE","*D"," aden"," Cristina"," Cristiano"," bloodstream","subclass","_persona","CHILD","-know"," navigationOptions"," Zukunft"," Pixar","Tyler"," underworld"," sincerity"," dispenser"," kter","idders",".addNode","-checked"," keyst"," WTO",".signals"," adventurer"," Pang","\\R","=pos"," dispensaries"," Closet",'("{\\"',"ideon"," n\xE9cessaire",`()"
3249
- `,"_RECEIVED"," r\xE9sultats"," moden"," Icelandic",";d",".allowed","(newUser"," merciless",".WaitFor"," daycare"," Conveyor"],ic=ka.concat(wa);ka.length=0;wa.length=0;var Ta=ic;var mt="all";var Aa=e=>e<=127;function Bi(e){if(e.length===0)return!1;let n=e.charCodeAt(e.length-1);return n>=55296&&n<=56319}function rc(e){let n=0;for(;n<e.length;){let t=e[n],i=0,r=0;if(t<=127)i=1,r=t;else if((t&224)===192){if(i=2,r=t&31,t<=193)return!1}else if((t&240)===224)i=3,r=t&15;else if((t&248)===240){if(i=4,r=t&7,t>244)return!1}else return!1;if(n+i>e.length)return!1;for(let a=1;a<i;a++){let o=e[n+a];if(o===void 0||(o&192)!==128)return!1;r=r<<6|o&63}if(i===2&&r<128||i===3&&r<2048||i===4&&r<65536||r>=55296&&r<=57343||r>1114111)return!1;n+=i}return!0}var ac=new TextDecoder("utf8",{fatal:!1});function xa(e){if(rc(e))return ac.decode(e)}function Ia(e,n){let t=Math.min(e.length,n.length);for(let i=0;i<t;i++)if(e[i]!==n[i])return e[i]-n[i];return e.length-n.length}function Ra(e){let n=0;return e.forEach(t=>{n=Math.max(n,t)}),n}function Fi(e){return e.replace(/[$()*+.?[\\\]^{|}]/g,"\\$&")}function Gi(e){let t=[...e].map(Fi).join("|");return new RegExp(`(${t})`)}var fn=new Uint8Array(0),gt=new TextDecoder("utf8"),yn=class{constructor({bytePairRankDecoder:n,specialTokensEncoder:t,tokenSplitRegex:i,mergeCacheSize:r=1e5}){J(this,"mergeableBytePairRankCount");J(this,"bytePairRankDecoder");J(this,"bytePairNonUtfRankDecoder",new Map);J(this,"bytePairNonUtfSortedEncoder");J(this,"bytePairStringRankEncoder");J(this,"tokenSplitRegex");J(this,"specialTokensEncoder");J(this,"specialTokensDecoder");J(this,"specialTokenPatternRegex");J(this,"textEncoder",new TextEncoder);J(this,"mergeCache");J(this,"mergeCacheSize");this.bytePairRankDecoder=n,this.bytePairStringRankEncoder=new Map,this.mergeCacheSize=r,r>0&&(this.mergeCache=new Map),this.mergeableBytePairRankCount=Object.keys(n).length;let a=[];n.forEach((l,c)=>{if(typeof l=="string"){this.bytePairStringRankEncoder.set(l,c);return}let u=new Uint8Array(l);a.push([u,c]),this.bytePairNonUtfRankDecoder.set(c,u)}),this.bytePairNonUtfSortedEncoder=a.sort((l,c)=>Ia(l[0],c[0])),this.specialTokensEncoder=t??new Map,this.specialTokensDecoder=t?new Map([...t].map(([l,c])=>[c,l])):new Map,this.tokenSplitRegex=i;let s=[...this.specialTokensEncoder.keys()].map(Fi).join("|");try{this.specialTokenPatternRegex=new RegExp(s,"y")}catch{throw new Error("Invalid regular expression pattern.")}}setMergeCacheSize(n){this.mergeCacheSize===0&&n>0&&(this.mergeCache=new Map),this.mergeCacheSize=n,n===0&&(this.mergeCache=void 0)}clearMergeCache(){this.mergeCache?.clear()}*encodeNativeGenerator(n,t){let i=0,r=0;for(;;){let a=this.findNextSpecialToken(n,t,i),o=a?.[0],s=o??n.length,l=i===0&&s===n.length?n:n.slice(i,s);for(let[c]of l.matchAll(this.tokenSplitRegex)){let u=this.getBpeRankFromString(c);if(u!==void 0){r=1,yield[u];continue}let d=this.bytePairEncode(c);r=d.length,yield d}if(o!==void 0){let c=a[1],u=this.specialTokensEncoder.get(c);if(u===void 0)throw new Error(`Special token "${c}" is not in the special token encoder.`);yield[u],i=o+c.length,r=1}else break}return r}encodeNative(n,t){let i=0,r=[];for(;;){let a=this.findNextSpecialToken(n,t,i),o=a?.[0],s=o??n.length,l=i===0&&s===n.length?n:n.slice(i,s);for(let[c]of l.matchAll(this.tokenSplitRegex)){let u=this.getBpeRankFromString(c);if(u!==void 0){r.push(u);continue}let d=this.bytePairEncode(c);r.push(...d)}if(o!==void 0){let c=a[1],u=this.specialTokensEncoder.get(c);if(u===void 0)throw new Error(`Special token "${c}" is not in the special token encoder.`);r.push(u),i=o+c.length}else break}return r}countNative(n,t){let i=0,r=0;for(;;){let a=this.findNextSpecialToken(n,t,i),o=a?.[0],s=o??n.length,l=i===0&&s===n.length?n:n.slice(i,s);for(let[c]of l.matchAll(this.tokenSplitRegex)){if(this.getBpeRankFromString(c)!==void 0){r++;continue}let d=this.bytePairEncode(c);r+=d.length}if(o!==void 0){let c=a[1];if(this.specialTokensEncoder.get(c)===void 0)throw new Error(`Special token "${c}" is not in the special token encoder.`);r++,i=o+c.length}else break}return r}*decodeNativeGenerator(n){for(let t of n){let i=this.tryDecodeToken(t);i&&(yield i)}}decodeNative(n){let t="",i=fn;for(let r of n){let a=this.tryDecodeToken(r);if(a===void 0)throw new Error(`Token ${r} is not in the byte pair encoder.`);if(typeof a=="string")i!==fn&&(t+=gt.decode(i,{stream:!0}),i=fn),t+=a;else{let o=new Uint8Array(i.length+a.length);o.set(i),o.set(a,i.length),i=o}}return i!==fn&&(t+=gt.decode(i,{stream:!0})),t}async*decodeNativeAsyncIterable(n){for await(let t of n){let i=this.tryDecodeToken(t);i&&(yield i)}}getBpeRankFromString(n){return this.bytePairStringRankEncoder.get(n)}getBpeRankFromStringOrThrow(n){let t=this.getBpeRankFromString(n);if(t===void 0)throw new Error(`The byte-pair encoding does not contain a value for: ${n}`);return t}getBpeRankFromBytes(n){let t=xa(n);if(t!==void 0)return this.getBpeRankFromString(t);let i=this.binarySearch(n);if(i!==-1)return this.bytePairNonUtfSortedEncoder[i][1]}getBpeRankFromBytesOrThrow(n){let t=this.getBpeRankFromBytes(n);if(t===void 0)throw new Error(`The byte-pair encoding does not contain a value for: ${n.toString()}`);return t}binarySearch(n){let t=0,i=this.bytePairNonUtfSortedEncoder.length-1;for(;t<=i;){let r=t+i>>>1,a=this.bytePairNonUtfSortedEncoder[r][0],o=0,s=Math.min(a.length,n.length);for(let l=0;l<s&&(o=a[l]-n[l],o===0);l++);if(o===0&&(o=a.length-n.length),o===0)return r;o<0?t=r+1:i=r-1}return-1}findNextSpecialToken(n,t,i){let r=i;for(;;){this.specialTokenPatternRegex.lastIndex=r;let a=this.specialTokenPatternRegex.exec(n);if(!a)return;let o=a[0];if(t?.has(o))return[a.index+r,o];r=a.index+r+1}}tryDecodeToken(n){let t=this.bytePairRankDecoder[n];if(typeof t=="string")return t;if(typeof t=="object"){let i=this.bytePairNonUtfRankDecoder.get(n);if(i)return i}return this.specialTokensDecoder.get(n)}addToMergeCache(n,t){if(this.mergeCache){if(this.mergeCache.size>=this.mergeCacheSize){let i=this.mergeCache.keys().next().value;this.mergeCache.delete(i)}this.mergeCache.set(n,t)}}bytePairEncode(n){if(n.length===1&&Aa(n.codePointAt(0)))return[this.getBpeRankFromStringOrThrow(n)];if(this.mergeCache?.has(n)){let r=this.mergeCache.get(n);return this.mergeCache.delete(n),this.mergeCache.set(n,r),r}let t=this.textEncoder.encode(n),i=this.bytePairMerge(t);return this.addToMergeCache(n,i),i}bytePairMerge(n){let t=[],i=[],r=(o,s=t[o],l=t[o+2])=>{if(l===void 0)return Number.POSITIVE_INFINITY;let c=n.subarray(s,l);return this.getBpeRankFromBytes(c)??Number.POSITIVE_INFINITY};for(let o=0;o<=n.length;o++)t.push(o),o<n.length-1?i.push(r(o,o,o+2)):i.push(Number.POSITIVE_INFINITY);for(;t.length>1;){let o=Number.POSITIVE_INFINITY,s=-1;for(let l=0;l<i.length-1;l++){let c=i[l];c<o&&(o=c,s=l)}if(o===Number.POSITIVE_INFINITY||s===-1)break;t.splice(s+1,1),i.splice(s,1),i[s]=r(s),s>0&&(i[s-1]=r(s-1))}let a=[];for(let o=0;o<t.length-1;o++){let s=t[o],l=t[o+1],c=this.getBpeRankFromBytesOrThrow(n.subarray(s,l));a.push(c)}return a}};var Pa={humanName:"GPT-4o (Aug 2024)",description:"Our high-intelligence flagship model for complex, multi-step tasks. GPT-4o is cheaper and faster than GPT-4 Turbo. Currently points to gpt-4o-2024-08-06.",encoding:"o200k_base",context:128e3,maxOutput:16384,trainingData:"2023-10",cost:{input:2.5,output:10,batchInput:1.25,batchOutput:5,cachedInput:1.25}},sc={humanName:"GPT-4o (Nov 2024)",description:"November 2024 snapshot of the GPT-4o model with enhanced capabilities.",encoding:"o200k_base",context:128e3,maxOutput:16384,trainingData:"2023-10",cost:{input:2.5,output:10,batchInput:1.25,batchOutput:5,cachedInput:1.25}},lc={humanName:"GPT-4o",description:"Original gpt-4o snapshot from May 13, 2024, offering advanced multimodal capabilities.",encoding:"o200k_base",context:128e3,maxOutput:4096,trainingData:"2023-10",cost:{input:5,output:15,batchInput:2.5,batchOutput:7.5}},Da={humanName:"GPT-4o Mini",description:"Our affordable and intelligent small model for fast, lightweight tasks. GPT-4o mini is cheaper and more capable than GPT-3.5 Turbo. Currently points to gpt-4o-mini-2024-07-18.",encoding:"o200k_base",context:128e3,maxOutput:16384,trainingData:"2023-10",cost:{input:.15,output:.6,batchInput:.075,batchOutput:.3,cachedInput:.075}},La={humanName:"OpenAI o1",description:"Our most intelligent model, optimal for complex tasks requiring deep understanding and expertise. Currently points to o1-2024-12-17.",encoding:"o200k_base",context:128e3,maxOutput:32768,trainingData:"2023-10",cost:{input:15,output:60,batchInput:7.5,batchOutput:30,cachedInput:7.5}},Na={humanName:"OpenAI o1-preview",description:"Preview version of the o1 model: o1-preview-2024-09-12.",encoding:"o200k_base",context:128e3,maxOutput:32768,trainingData:"2023-10",cost:{input:15,output:60,batchInput:7.5,batchOutput:30,cachedInput:7.5}},Ma={humanName:"OpenAI o1-mini",description:"Points to the most recent o1-mini snapshot: o1-mini-2024-09-12.",encoding:"o200k_base",context:128e3,maxOutput:65536,trainingData:"2023-10",cost:{input:1.1,output:4.4,batchInput:.55,batchOutput:2.2,cachedInput:.55}},cc={humanName:"OpenAI o3-mini",description:"Small cost-efficient reasoning model that's optimized for coding, math, and science, and supports tools and Structured Outputs.",encoding:"o200k_base",context:2e5,maxOutput:65536,trainingData:"2023-10",cost:{input:1.1,output:4.4,batchInput:.55,batchOutput:2.2,cachedInput:.55}},uc={humanName:"Text Embedding 3 Small",description:"Embedding model for small-scale applications.",encoding:"cl100k_base",maxInput:8191,cost:{input:.02,batchInput:.01}},dc={humanName:"Text Embedding 3 Large",description:"Embedding model for large-scale applications.",encoding:"cl100k_base",maxInput:8191,cost:{input:.13,batchInput:.065}},pc={humanName:"Ada v2",description:"A versatile model suitable for text embeddings and lightweight NLP tasks.",encoding:"cl100k_base",maxInput:8191,cost:{input:.1,output:0,batchInput:.05,batchOutput:0}},mc={humanName:"GPT-4o Realtime Preview",encoding:"o200k_base",description:"Preview release for the Realtime API.",context:128e3,maxOutput:4096,trainingData:"2023-10",cost:{input:5,output:20,cachedInput:2.5}},gc={humanName:"GPT-4o Realtime Preview (Oct 2024)",encoding:"o200k_base",description:"Current snapshot for the Realtime API model.",context:128e3,maxOutput:4096,trainingData:"2023-10",cost:{input:5,output:20,cachedInput:2.5}},hc={humanName:"GPT-4o Realtime Preview (Dec 2024)",encoding:"o200k_base",description:"December 2024 snapshot for the Realtime API model.",context:128e3,maxOutput:4096,trainingData:"2023-10",cost:{input:5,output:20,cachedInput:2.5}},Oa={humanName:"GPT-4o Mini Realtime Preview (Dec 2024)",encoding:"o200k_base",description:"Mini version for the Realtime API with December 2024 snapshot.",context:128e3,maxOutput:4096,trainingData:"2023-10",cost:{input:.6,output:2.4,cachedInput:.3}},fc={humanName:"GPT-4o Audio Preview",encoding:"o200k_base",description:"Preview release for audio inputs in chat completions.",context:128e3,maxOutput:16384,trainingData:"2023-10",cost:{input:2.5,output:10}},yc={humanName:"GPT-4o Audio Preview (Oct 2024)",encoding:"o200k_base",description:"Current snapshot for the Audio API model.",context:128e3,maxOutput:16384,trainingData:"2023-10",cost:{input:2.5,output:10}},bc={humanName:"GPT-4o Audio Preview (Dec 2024)",encoding:"o200k_base",description:"December 2024 snapshot for the Audio API model.",context:128e3,maxOutput:16384,trainingData:"2023-10",cost:{input:2.5,output:10}},Ba={humanName:"GPT-4o Mini Audio Preview (Dec 2024)",encoding:"o200k_base",description:"Mini version for the Audio API with December 2024 snapshot.",context:128e3,maxOutput:16384,trainingData:"2023-10",cost:{input:.15,output:.6}},vc={humanName:"GPT-4o 2024-08-06 Finetuning",description:"GPT-4o finetuned for custom tasks.",encoding:"o200k_base",cost:{input:3.75,output:15,batchInput:1.875,batchOutput:7.5,cachedInput:1.875,training:25}},_c={humanName:"GPT-4o Mini 2024-07-18 Finetuning",description:"GPT-4o mini finetuned for custom tasks.",encoding:"o200k_base",cost:{input:.3,output:1.2,batchInput:.15,batchOutput:.6,cachedInput:.15,training:3}},Sc={humanName:"GPT-3.5 Turbo Finetuning",description:"Finetuning GPT-3.5 Turbo with custom data.",encoding:"cl100k_base",cost:{input:3,output:6,batchInput:1.5,batchOutput:3,training:8}},Fa={humanName:"GPT-4o Mini Training",description:"Training GPT-4o Mini with custom datasets.",encoding:"o200k_base",cost:{input:3,output:0,batchInput:1.5,batchOutput:0}},Ec={humanName:"GPT-3.5 Turbo 16k",description:"GPT-3.5 model with 16k token context.",encoding:"cl100k_base",cost:{input:3,output:4,batchInput:1.5,batchOutput:2}},Ga={humanName:"GPT-4 Turbo 2024-04-09",description:"The latest GPT-4 Turbo model with vision capabilities. Vision requests can now use JSON mode and function calling. Currently points to gpt-4-turbo-2024-04-09.",encoding:"cl100k_base",context:128e3,maxOutput:4096,trainingData:"2023-12",cost:{input:10,output:30,batchInput:5,batchOutput:15}},Cc={humanName:"ChatGPT 4o Latest",description:"The chatgpt-4o-latest model version continuously points to the version of GPT-4o used in ChatGPT, and is updated frequently when there are significant changes.",encoding:"o200k_base",context:128e3,maxOutput:16384,trainingData:"2023-10",cost:{input:5,output:15}},za={humanName:"GPT-4",description:"Currently points to gpt-4-0613. See continuous model upgrades.",encoding:"cl100k_base",context:8192,maxOutput:8192,trainingData:"2021-09",cost:{input:30,output:60,batchInput:15,batchOutput:30}},zi={humanName:"GPT-4 0125 Preview",description:"GPT-4 Turbo preview model intended to reduce cases of \u201Claziness\u201D where the model doesn\u2019t complete a task.",encoding:"cl100k_base",context:128e3,maxOutput:4096,trainingData:"2023-12",cost:{input:10,output:30,batchInput:5,batchOutput:15}},kc={...zi,humanName:"GPT-4 1106 Preview"},Ua={humanName:"GPT-3.5 Turbo 0125",description:"The latest GPT-3.5 Turbo model with higher accuracy at responding in requested formats and a fix for a bug which caused a text encoding issue for non-English language function calls.",encoding:"cl100k_base",context:16385,maxOutput:4096,trainingData:"2021-09",cost:{input:.5,output:1.5,batchInput:.25,batchOutput:.75}},Ha={humanName:"GPT-3.5 Turbo Instruct",description:"Similar capabilities as GPT-3 era models. Compatible with legacy Completions endpoint and not Chat Completions.",encoding:"cl100k_base",context:4096,maxOutput:4096,trainingData:"2021-09",cost:{input:1.5,output:2}},wc={humanName:"GPT-3.5 Turbo 1106",description:"GPT-3.5 Turbo model with improved instruction following, JSON mode, reproducible outputs, parallel function calling, and more.",encoding:"cl100k_base",context:16385,maxOutput:4096,trainingData:"2021-09",cost:{input:1,output:2,batchInput:.5,batchOutput:1}},Tc={humanName:"Davinci 002",description:"Replacement for the GPT-3 curie and davinci base models.",encoding:"p50k_base",context:16384,maxOutput:16384,trainingData:"2021-09",cost:{input:2,output:2,batchInput:1,batchOutput:1}},Ac={humanName:"Davinci-002 Finetuning",description:"Davinci-002 finetuned for custom tasks.",encoding:"p50k_base",cost:{input:12,output:12,batchInput:6,batchOutput:6,training:6}},xc={humanName:"Babbage 002",description:"Replacement for the GPT-3 ada and babbage base models.",encoding:"p50k_base",context:16384,trainingData:"2021-09",cost:{input:.4,output:.4,batchInput:.2,batchOutput:.2}},Ic={humanName:"Babbage-002 Finetuning",description:"Babbage-002 finetuned for custom tasks.",encoding:"p50k_base",cost:{input:1.6,output:1.6,batchInput:.8,batchOutput:.8,training:.4}},Ui={humanName:"GPT-4 32k",encoding:"cl100k_base",description:"Snapshot of gpt-4 from June 13th 2023 with improved function calling support.",shutdownDate:"2025-06-06",recommendedReplacement:"gpt-4o",context:32768,maxOutput:16384,trainingData:"2021-09",cost:{input:60,output:120,batchInput:30,batchOutput:60}},ja={humanName:"GPT-4 Vision Preview",encoding:"cl100k_base",description:"Vision capabilities preview of GPT-4.",shutdownDate:"2024-12-06",recommendedReplacement:"gpt-4o",context:128e3,maxOutput:4096,trainingData:"2023-12",cost:{input:10,output:30,batchInput:5,batchOutput:15}},Rc=ja,Pc={humanName:"GPT-3.5 Turbo 0613",encoding:"cl100k_base",description:"Version of GPT-3.5 Turbo from June 2013.",shutdownDate:"2024-09-13",recommendedReplacement:"gpt-3.5-turbo",context:16385,maxOutput:4096,trainingData:"2021-09",cost:{input:1.5,output:2,batchInput:.75,batchOutput:1}},Dc={humanName:"GPT-3.5 Turbo 16k 0613",encoding:"cl100k_base",description:"16k context version from June 2013.",shutdownDate:"2024-09-13",recommendedReplacement:"gpt-3.5-turbo",context:16385,maxOutput:4096,trainingData:"2021-09",cost:{input:3,output:4,batchInput:1.5,batchOutput:2}},Lc={humanName:"Text Ada 001",encoding:"r50k_base",description:"Model for lightweight tasks.",shutdownDate:"2024-01-04",recommendedReplacement:"gpt-3.5-turbo-instruct",cost:{input:.4}},Nc={humanName:"Text Babbage 001",encoding:"r50k_base",description:"Model for efficient processing.",shutdownDate:"2024-01-04",recommendedReplacement:"gpt-3.5-turbo-instruct",cost:{input:.5}},Mc={humanName:"Text Curie 001",encoding:"r50k_base",description:"Mid-range model for various tasks.",shutdownDate:"2024-01-04",recommendedReplacement:"gpt-3.5-turbo-instruct",cost:{input:2}},Oc={humanName:"Text Davinci 001",encoding:"r50k_base",description:"High-performance model for complex tasks.",shutdownDate:"2024-01-04",recommendedReplacement:"gpt-3.5-turbo-instruct",cost:{input:20}},Bc={humanName:"Text Davinci 002",encoding:"p50k_base",description:"Legacy high-performance model.",shutdownDate:"2024-01-04",recommendedReplacement:"gpt-3.5-turbo-instruct",cost:{input:20}},Fc={humanName:"Text Davinci 003",encoding:"p50k_base",description:"Latest of the Davinci series.",shutdownDate:"2024-01-04",recommendedReplacement:"gpt-3.5-turbo-instruct",cost:{input:20}},Gc={humanName:"Ada",encoding:"r50k_base",description:"Base model for lightweight tasks.",shutdownDate:"2024-01-04",recommendedReplacement:"babbage-002",cost:{input:.4}},zc={humanName:"Babbage",encoding:"r50k_base",description:"Model for efficient processing.",shutdownDate:"2024-01-04",recommendedReplacement:"babbage-002",cost:{input:.5}},Uc={humanName:"Curie",encoding:"r50k_base",description:"Mid-range model for a variety of applications.",shutdownDate:"2024-01-04",recommendedReplacement:"davinci-002",cost:{input:2}},Hc={humanName:"Davinci",encoding:"p50k_base",description:"High-performance legacy model.",shutdownDate:"2024-01-04",recommendedReplacement:"davinci-002",cost:{input:20}},Vc={humanName:"Code Davinci 002",encoding:"p50k_base",description:"Legacy coding model.",shutdownDate:"2023-03-23",recommendedReplacement:"gpt-4o"},Va={humanName:"Code Davinci 001",encoding:"p50k_base",description:"Older coding model.",shutdownDate:"2023-03-23",recommendedReplacement:"gpt-4o"},Wc={humanName:"Code Davinci 001",encoding:"p50k_edit",description:"Older coding model.",shutdownDate:"2023-03-23"},jc={humanName:"Code Cushman 002",encoding:"p50k_base",description:"Legacy model for coding.",shutdownDate:"2023-03-23",recommendedReplacement:"gpt-4o"},Wa={humanName:"Code Cushman 001",encoding:"p50k_base",description:"Older model for coding tasks.",shutdownDate:"2023-03-23",recommendedReplacement:"gpt-4o"},qc={humanName:"GPT-4 0314",encoding:"cl100k_base",description:"Variant of GPT-4 model.",shutdownDate:"2024-06-13",recommendedReplacement:"gpt-4o",context:8192,maxOutput:8192,trainingData:"2021-09",cost:{input:30,output:60}},Kc={humanName:"GPT-3.5 Turbo 0301",encoding:"cl100k_base",description:"Earlier version of GPT-3.5 Turbo.",shutdownDate:"2024-09-13",recommendedReplacement:"gpt-3.5-turbo",context:16385,maxOutput:4096,trainingData:"2021-09",cost:{input:1.5,output:2,batchInput:.75,batchOutput:1}},Xc={...Ui,humanName:"GPT-4 32k 0314"},Yc={humanName:"Text Similarity Ada 001",encoding:"r50k_base",description:"Embedding model for similarity tasks.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:4}},Jc={humanName:"Text Search Ada Doc 001",encoding:"r50k_base",description:"Embedding model for document search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:4}},Zc={humanName:"Text Search Ada Query 001",encoding:"r50k_base",description:"Embedding model for query search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:4}},$c={humanName:"Code Search Ada Code 001",encoding:"r50k_base",description:"Embedding model for code search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:4}},Qc={humanName:"Code Search Ada Text 001",encoding:"r50k_base",description:"Embedding model for text search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:4}},eu={humanName:"Text Davinci 001",encoding:"p50k_edit",description:"Older text model.",shutdownDate:"2023-03-23"},tu={humanName:"Text Similarity Babbage 001",encoding:"r50k_base",description:"Embedding model for similarity tasks.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:5}},nu={humanName:"Text Search Babbage Doc 001",encoding:"r50k_base",description:"Embedding model for document search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:5}},iu={humanName:"Text Search Babbage Query 001",encoding:"r50k_base",description:"Embedding model for query search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:5}},ru={humanName:"Code Search Babbage Code 001",encoding:"r50k_base",description:"Embedding model for code search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:5}},au={humanName:"Code Search Babbage Text 001",encoding:"r50k_base",description:"Embedding model for text search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:5}},ou={humanName:"Text Similarity Curie 001",encoding:"r50k_base",description:"Embedding model for similarity tasks.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:20}},su={humanName:"Text Search Curie Doc 001",encoding:"r50k_base",description:"Embedding model for document search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:20}},lu={humanName:"Text Search Curie Query 001",encoding:"r50k_base",description:"Embedding model for query search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:20}},cu={humanName:"Text Similarity Davinci 001",encoding:"r50k_base",description:"Embedding model for similarity tasks.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:200}},uu={humanName:"Text Search Davinci Doc 001",encoding:"r50k_base",description:"Embedding model for document search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:200}},du={humanName:"Text Search Davinci Query 001",encoding:"r50k_base",description:"Embedding model for query search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:200}},Hi={o1:La,"o1-2024-12-17":La,"o1-preview":Na,"o1-preview-2024-09-12":Na,"o1-mini":Ma,"o1-mini-2024-09-12":Ma,"o3-mini":cc,"chatgpt-4o-latest":Cc,"gpt-4o":Pa,"gpt-4o-2024-11-20":sc,"gpt-4o-2024-08-06":Pa,"gpt-4o-2024-05-13":lc,"gpt-4o-mini":Da,"gpt-4o-mini-2024-07-18":Da,"gpt-4o-realtime-preview":mc,"gpt-4o-realtime-preview-2024-10-01":gc,"gpt-4o-realtime-preview-2024-12-17":hc,"gpt-4o-mini-realtime-preview":Oa,"gpt-4o-mini-realtime-preview-2024-12-17":Oa,"gpt-4o-audio-preview":fc,"gpt-4o-audio-preview-2024-10-01":yc,"gpt-4o-audio-preview-2024-12-17":bc,"gpt-4o-mini-audio-preview":Ba,"gpt-4o-mini-audio-preview-2024-12-17":Ba,"gpt-4o-2024-08-06-finetune":vc,"gpt-4o-mini-2024-07-18-finetune":_c,"gpt-4o-mini-training":Fa,"gpt-4o-mini-training-2024-07-18":Fa,"davinci-002-finetune":Ac,"babbage-002-finetune":Ic,"gpt-4-turbo":Ga,"gpt-4-turbo-2024-04-09":Ga,"gpt-4-turbo-preview":zi,"gpt-4-0125-preview":zi,"gpt-4-1106-preview":kc,"gpt-4":za,"gpt-4-0613":za,"gpt-3.5-turbo":Ua,"gpt-3.5-turbo-0125":Ua,"gpt-3.5-turbo-1106":wc,"gpt-3.5-turbo-finetune":Sc,"gpt-3.5-turbo-16k":Ec,"gpt-4-32k":Ui,"gpt-4-32k-0613":Ui,"gpt-4-vision-preview":ja,"gpt-4-1106-vision-preview":Rc,"gpt-4-0314":qc,"gpt-4-32k-0314":Xc,"gpt-3.5-turbo-0613":Pc,"gpt-3.5-turbo-16k-0613":Dc,"gpt-3.5-turbo-0301":Kc},bn={...Hi,"text-embedding-3-small":uc,"text-embedding-3-large":dc,"text-embedding-ada-002":pc,"gpt-3.5-turbo-instruct":Ha,"gpt-3.5-turbo-instruct-0914":Ha,"davinci-002":Tc,"babbage-002":xc,"text-ada-001":Lc,"text-babbage-001":Nc,"text-curie-001":Mc,"text-davinci-001":Oc,"text-davinci-002":Bc,"text-davinci-003":Fc,ada:Gc,babbage:zc,curie:Uc,davinci:Hc,"code-davinci-002":Vc,"code-davinci-001":Va,"davinci-codex":Va,"code-davinci-edit-001":Wc,"code-cushman-002":jc,"code-cushman-001":Wa,"cushman-codex":Wa,"code-search-ada-code-001":$c,"code-search-ada-text-001":Qc,"text-davinci-edit-001":eu,"text-similarity-ada-001":Yc,"text-search-ada-doc-001":Jc,"text-search-ada-query-001":Zc,"text-similarity-babbage-001":tu,"text-search-babbage-doc-001":nu,"text-search-babbage-query-001":iu,"code-search-babbage-code-001":ru,"code-search-babbage-text-001":au,"text-similarity-curie-001":ou,"text-search-curie-doc-001":su,"text-search-curie-query-001":lu,"text-similarity-davinci-001":cu,"text-search-davinci-doc-001":uu,"text-search-davinci-query-001":du};var Ee="<|endoftext|>",Ve="<|fim_prefix|>",We="<|fim_middle|>",je="<|fim_suffix|>",ht="<|im_start|>",ft="<|im_end|>",qe="<|im_sep|>",yt="<|endofprompt|>";var qa=Object.fromEntries(Object.entries(Hi).map(([e,n])=>[e,n.encoding])),Ka=Object.fromEntries(Object.entries(bn).map(([e,n])=>[e,n.encoding])),pu={messageSeparator:`
3249
+ `,"_RECEIVED"," r\xE9sultats"," moden"," Icelandic",";d",".allowed","(newUser"," merciless",".WaitFor"," daycare"," Conveyor"],ic=ka.concat(wa);ka.length=0;wa.length=0;var Ta=ic;var mt="all";var Aa=e=>e<=127;function Bi(e){if(e.length===0)return!1;let n=e.charCodeAt(e.length-1);return n>=55296&&n<=56319}function rc(e){let n=0;for(;n<e.length;){let t=e[n],i=0,r=0;if(t<=127)i=1,r=t;else if((t&224)===192){if(i=2,r=t&31,t<=193)return!1}else if((t&240)===224)i=3,r=t&15;else if((t&248)===240){if(i=4,r=t&7,t>244)return!1}else return!1;if(n+i>e.length)return!1;for(let a=1;a<i;a++){let o=e[n+a];if(o===void 0||(o&192)!==128)return!1;r=r<<6|o&63}if(i===2&&r<128||i===3&&r<2048||i===4&&r<65536||r>=55296&&r<=57343||r>1114111)return!1;n+=i}return!0}var ac=new TextDecoder("utf8",{fatal:!1});function xa(e){if(rc(e))return ac.decode(e)}function Ia(e,n){let t=Math.min(e.length,n.length);for(let i=0;i<t;i++)if(e[i]!==n[i])return e[i]-n[i];return e.length-n.length}function Ra(e){let n=0;return e.forEach(t=>{n=Math.max(n,t)}),n}function Fi(e){return e.replace(/[$()*+.?[\\\]^{|}]/g,"\\$&")}function Gi(e){let t=[...e].map(Fi).join("|");return new RegExp(`(${t})`)}var fn=new Uint8Array(0),gt=new TextDecoder("utf8"),yn=class{constructor({bytePairRankDecoder:n,specialTokensEncoder:t,tokenSplitRegex:i,mergeCacheSize:r=1e5}){J(this,"mergeableBytePairRankCount");J(this,"bytePairRankDecoder");J(this,"bytePairNonUtfRankDecoder",new Map);J(this,"bytePairNonUtfSortedEncoder");J(this,"bytePairStringRankEncoder");J(this,"tokenSplitRegex");J(this,"specialTokensEncoder");J(this,"specialTokensDecoder");J(this,"specialTokenPatternRegex");J(this,"textEncoder",new TextEncoder);J(this,"mergeCache");J(this,"mergeCacheSize");this.bytePairRankDecoder=n,this.bytePairStringRankEncoder=new Map,this.mergeCacheSize=r,r>0&&(this.mergeCache=new Map),this.mergeableBytePairRankCount=Object.keys(n).length;let a=[];n.forEach((l,c)=>{if(typeof l=="string"){this.bytePairStringRankEncoder.set(l,c);return}let u=new Uint8Array(l);a.push([u,c]),this.bytePairNonUtfRankDecoder.set(c,u)}),this.bytePairNonUtfSortedEncoder=a.sort((l,c)=>Ia(l[0],c[0])),this.specialTokensEncoder=t??new Map,this.specialTokensDecoder=t?new Map([...t].map(([l,c])=>[c,l])):new Map,this.tokenSplitRegex=i;let s=[...this.specialTokensEncoder.keys()].map(Fi).join("|");try{this.specialTokenPatternRegex=new RegExp(s,"y")}catch{throw new Error("Invalid regular expression pattern.")}}setMergeCacheSize(n){this.mergeCacheSize===0&&n>0&&(this.mergeCache=new Map),this.mergeCacheSize=n,n===0&&(this.mergeCache=void 0)}clearMergeCache(){this.mergeCache?.clear()}*encodeNativeGenerator(n,t){let i=0,r=0;for(;;){let a=this.findNextSpecialToken(n,t,i),o=a?.[0],s=o??n.length,l=i===0&&s===n.length?n:n.slice(i,s);for(let[c]of l.matchAll(this.tokenSplitRegex)){let u=this.getBpeRankFromString(c);if(u!==void 0){r=1,yield[u];continue}let d=this.bytePairEncode(c);r=d.length,yield d}if(o!==void 0){let c=a[1],u=this.specialTokensEncoder.get(c);if(u===void 0)throw new Error(`Special token "${c}" is not in the special token encoder.`);yield[u],i=o+c.length,r=1}else break}return r}encodeNative(n,t){let i=0,r=[];for(;;){let a=this.findNextSpecialToken(n,t,i),o=a?.[0],s=o??n.length,l=i===0&&s===n.length?n:n.slice(i,s);for(let[c]of l.matchAll(this.tokenSplitRegex)){let u=this.getBpeRankFromString(c);if(u!==void 0){r.push(u);continue}let d=this.bytePairEncode(c);r.push(...d)}if(o!==void 0){let c=a[1],u=this.specialTokensEncoder.get(c);if(u===void 0)throw new Error(`Special token "${c}" is not in the special token encoder.`);r.push(u),i=o+c.length}else break}return r}countNative(n,t){let i=0,r=0;for(;;){let a=this.findNextSpecialToken(n,t,i),o=a?.[0],s=o??n.length,l=i===0&&s===n.length?n:n.slice(i,s);for(let[c]of l.matchAll(this.tokenSplitRegex)){if(this.getBpeRankFromString(c)!==void 0){r++;continue}let d=this.bytePairEncode(c);r+=d.length}if(o!==void 0){let c=a[1];if(this.specialTokensEncoder.get(c)===void 0)throw new Error(`Special token "${c}" is not in the special token encoder.`);r++,i=o+c.length}else break}return r}*decodeNativeGenerator(n){for(let t of n){let i=this.tryDecodeToken(t);i&&(yield i)}}decodeNative(n){let t="",i=fn;for(let r of n){let a=this.tryDecodeToken(r);if(a===void 0)throw new Error(`Token ${r} is not in the byte pair encoder.`);if(typeof a=="string")i!==fn&&(t+=gt.decode(i,{stream:!0}),i=fn),t+=a;else{let o=new Uint8Array(i.length+a.length);o.set(i),o.set(a,i.length),i=o}}return i!==fn&&(t+=gt.decode(i,{stream:!0})),t}async*decodeNativeAsyncIterable(n){for await(let t of n){let i=this.tryDecodeToken(t);i&&(yield i)}}getBpeRankFromString(n){return this.bytePairStringRankEncoder.get(n)}getBpeRankFromStringOrThrow(n){let t=this.getBpeRankFromString(n);if(t===void 0)throw new Error(`The byte-pair encoding does not contain a value for: ${n}`);return t}getBpeRankFromBytes(n){let t=xa(n);if(t!==void 0)return this.getBpeRankFromString(t);let i=this.binarySearch(n);if(i!==-1)return this.bytePairNonUtfSortedEncoder[i][1]}getBpeRankFromBytesOrThrow(n){let t=this.getBpeRankFromBytes(n);if(t===void 0)throw new Error(`The byte-pair encoding does not contain a value for: ${n.toString()}`);return t}binarySearch(n){let t=0,i=this.bytePairNonUtfSortedEncoder.length-1;for(;t<=i;){let r=t+i>>>1,a=this.bytePairNonUtfSortedEncoder[r][0],o=0,s=Math.min(a.length,n.length);for(let l=0;l<s&&(o=a[l]-n[l],o===0);l++);if(o===0&&(o=a.length-n.length),o===0)return r;o<0?t=r+1:i=r-1}return-1}findNextSpecialToken(n,t,i){let r=i;for(;;){this.specialTokenPatternRegex.lastIndex=r;let a=this.specialTokenPatternRegex.exec(n);if(!a)return;let o=a[0];if(t?.has(o))return[a.index+r,o];r=a.index+r+1}}tryDecodeToken(n){let t=this.bytePairRankDecoder[n];if(typeof t=="string")return t;if(typeof t=="object"){let i=this.bytePairNonUtfRankDecoder.get(n);if(i)return i}return this.specialTokensDecoder.get(n)}addToMergeCache(n,t){if(this.mergeCache){if(this.mergeCache.size>=this.mergeCacheSize){let i=this.mergeCache.keys().next().value;this.mergeCache.delete(i)}this.mergeCache.set(n,t)}}bytePairEncode(n){if(n.length===1&&Aa(n.codePointAt(0)))return[this.getBpeRankFromStringOrThrow(n)];if(this.mergeCache?.has(n)){let r=this.mergeCache.get(n);return this.mergeCache.delete(n),this.mergeCache.set(n,r),r}let t=this.textEncoder.encode(n),i=this.bytePairMerge(t);return this.addToMergeCache(n,i),i}bytePairMerge(n){let t=[],i=[],r=(o,s=t[o],l=t[o+2])=>{if(l===void 0)return Number.POSITIVE_INFINITY;let c=n.subarray(s,l);return this.getBpeRankFromBytes(c)??Number.POSITIVE_INFINITY};for(let o=0;o<=n.length;o++)t.push(o),o<n.length-1?i.push(r(o,o,o+2)):i.push(Number.POSITIVE_INFINITY);for(;t.length>1;){let o=Number.POSITIVE_INFINITY,s=-1;for(let l=0;l<i.length-1;l++){let c=i[l];c<o&&(o=c,s=l)}if(o===Number.POSITIVE_INFINITY||s===-1)break;t.splice(s+1,1),i.splice(s,1),i[s]=r(s),s>0&&(i[s-1]=r(s-1))}let a=[];for(let o=0;o<t.length-1;o++){let s=t[o],l=t[o+1],c=this.getBpeRankFromBytesOrThrow(n.subarray(s,l));a.push(c)}return a}};var Pa={humanName:"GPT-4o (Aug 2024)",description:"Our high-intelligence flagship model for complex, multi-step tasks. GPT-4o is cheaper and faster than GPT-4 Turbo. Currently points to gpt-4o-2024-08-06.",encoding:"o200k_base",context:128e3,maxOutput:16384,trainingData:"2023-10",cost:{input:2.5,output:10,batchInput:1.25,batchOutput:5,cachedInput:1.25}},sc={humanName:"GPT-4o (Nov 2024)",description:"November 2024 snapshot of the GPT-4o model with enhanced capabilities.",encoding:"o200k_base",context:128e3,maxOutput:16384,trainingData:"2023-10",cost:{input:2.5,output:10,batchInput:1.25,batchOutput:5,cachedInput:1.25}},lc={humanName:"GPT-4o",description:"Original gpt-4o snapshot from May 13, 2024, offering advanced multimodal capabilities.",encoding:"o200k_base",context:128e3,maxOutput:4096,trainingData:"2023-10",cost:{input:5,output:15,batchInput:2.5,batchOutput:7.5}},Da={humanName:"GPT-4o Mini",description:"Our affordable and intelligent small model for fast, lightweight tasks. GPT-4o mini is cheaper and more capable than GPT-3.5 Turbo. Currently points to gpt-4o-mini-2024-07-18.",encoding:"o200k_base",context:128e3,maxOutput:16384,trainingData:"2023-10",cost:{input:.15,output:.6,batchInput:.075,batchOutput:.3,cachedInput:.075}},Na={humanName:"OpenAI o1",description:"Our most intelligent model, optimal for complex tasks requiring deep understanding and expertise. Currently points to o1-2024-12-17.",encoding:"o200k_base",context:128e3,maxOutput:32768,trainingData:"2023-10",cost:{input:15,output:60,batchInput:7.5,batchOutput:30,cachedInput:7.5}},La={humanName:"OpenAI o1-preview",description:"Preview version of the o1 model: o1-preview-2024-09-12.",encoding:"o200k_base",context:128e3,maxOutput:32768,trainingData:"2023-10",cost:{input:15,output:60,batchInput:7.5,batchOutput:30,cachedInput:7.5}},Ma={humanName:"OpenAI o1-mini",description:"Points to the most recent o1-mini snapshot: o1-mini-2024-09-12.",encoding:"o200k_base",context:128e3,maxOutput:65536,trainingData:"2023-10",cost:{input:1.1,output:4.4,batchInput:.55,batchOutput:2.2,cachedInput:.55}},cc={humanName:"OpenAI o3-mini",description:"Small cost-efficient reasoning model that's optimized for coding, math, and science, and supports tools and Structured Outputs.",encoding:"o200k_base",context:2e5,maxOutput:65536,trainingData:"2023-10",cost:{input:1.1,output:4.4,batchInput:.55,batchOutput:2.2,cachedInput:.55}},uc={humanName:"Text Embedding 3 Small",description:"Embedding model for small-scale applications.",encoding:"cl100k_base",maxInput:8191,cost:{input:.02,batchInput:.01}},dc={humanName:"Text Embedding 3 Large",description:"Embedding model for large-scale applications.",encoding:"cl100k_base",maxInput:8191,cost:{input:.13,batchInput:.065}},pc={humanName:"Ada v2",description:"A versatile model suitable for text embeddings and lightweight NLP tasks.",encoding:"cl100k_base",maxInput:8191,cost:{input:.1,output:0,batchInput:.05,batchOutput:0}},mc={humanName:"GPT-4o Realtime Preview",encoding:"o200k_base",description:"Preview release for the Realtime API.",context:128e3,maxOutput:4096,trainingData:"2023-10",cost:{input:5,output:20,cachedInput:2.5}},gc={humanName:"GPT-4o Realtime Preview (Oct 2024)",encoding:"o200k_base",description:"Current snapshot for the Realtime API model.",context:128e3,maxOutput:4096,trainingData:"2023-10",cost:{input:5,output:20,cachedInput:2.5}},hc={humanName:"GPT-4o Realtime Preview (Dec 2024)",encoding:"o200k_base",description:"December 2024 snapshot for the Realtime API model.",context:128e3,maxOutput:4096,trainingData:"2023-10",cost:{input:5,output:20,cachedInput:2.5}},Oa={humanName:"GPT-4o Mini Realtime Preview (Dec 2024)",encoding:"o200k_base",description:"Mini version for the Realtime API with December 2024 snapshot.",context:128e3,maxOutput:4096,trainingData:"2023-10",cost:{input:.6,output:2.4,cachedInput:.3}},fc={humanName:"GPT-4o Audio Preview",encoding:"o200k_base",description:"Preview release for audio inputs in chat completions.",context:128e3,maxOutput:16384,trainingData:"2023-10",cost:{input:2.5,output:10}},yc={humanName:"GPT-4o Audio Preview (Oct 2024)",encoding:"o200k_base",description:"Current snapshot for the Audio API model.",context:128e3,maxOutput:16384,trainingData:"2023-10",cost:{input:2.5,output:10}},bc={humanName:"GPT-4o Audio Preview (Dec 2024)",encoding:"o200k_base",description:"December 2024 snapshot for the Audio API model.",context:128e3,maxOutput:16384,trainingData:"2023-10",cost:{input:2.5,output:10}},Ba={humanName:"GPT-4o Mini Audio Preview (Dec 2024)",encoding:"o200k_base",description:"Mini version for the Audio API with December 2024 snapshot.",context:128e3,maxOutput:16384,trainingData:"2023-10",cost:{input:.15,output:.6}},vc={humanName:"GPT-4o 2024-08-06 Finetuning",description:"GPT-4o finetuned for custom tasks.",encoding:"o200k_base",cost:{input:3.75,output:15,batchInput:1.875,batchOutput:7.5,cachedInput:1.875,training:25}},_c={humanName:"GPT-4o Mini 2024-07-18 Finetuning",description:"GPT-4o mini finetuned for custom tasks.",encoding:"o200k_base",cost:{input:.3,output:1.2,batchInput:.15,batchOutput:.6,cachedInput:.15,training:3}},Sc={humanName:"GPT-3.5 Turbo Finetuning",description:"Finetuning GPT-3.5 Turbo with custom data.",encoding:"cl100k_base",cost:{input:3,output:6,batchInput:1.5,batchOutput:3,training:8}},Fa={humanName:"GPT-4o Mini Training",description:"Training GPT-4o Mini with custom datasets.",encoding:"o200k_base",cost:{input:3,output:0,batchInput:1.5,batchOutput:0}},Ec={humanName:"GPT-3.5 Turbo 16k",description:"GPT-3.5 model with 16k token context.",encoding:"cl100k_base",cost:{input:3,output:4,batchInput:1.5,batchOutput:2}},Ga={humanName:"GPT-4 Turbo 2024-04-09",description:"The latest GPT-4 Turbo model with vision capabilities. Vision requests can now use JSON mode and function calling. Currently points to gpt-4-turbo-2024-04-09.",encoding:"cl100k_base",context:128e3,maxOutput:4096,trainingData:"2023-12",cost:{input:10,output:30,batchInput:5,batchOutput:15}},Cc={humanName:"ChatGPT 4o Latest",description:"The chatgpt-4o-latest model version continuously points to the version of GPT-4o used in ChatGPT, and is updated frequently when there are significant changes.",encoding:"o200k_base",context:128e3,maxOutput:16384,trainingData:"2023-10",cost:{input:5,output:15}},za={humanName:"GPT-4",description:"Currently points to gpt-4-0613. See continuous model upgrades.",encoding:"cl100k_base",context:8192,maxOutput:8192,trainingData:"2021-09",cost:{input:30,output:60,batchInput:15,batchOutput:30}},zi={humanName:"GPT-4 0125 Preview",description:"GPT-4 Turbo preview model intended to reduce cases of \u201Claziness\u201D where the model doesn\u2019t complete a task.",encoding:"cl100k_base",context:128e3,maxOutput:4096,trainingData:"2023-12",cost:{input:10,output:30,batchInput:5,batchOutput:15}},kc={...zi,humanName:"GPT-4 1106 Preview"},Ua={humanName:"GPT-3.5 Turbo 0125",description:"The latest GPT-3.5 Turbo model with higher accuracy at responding in requested formats and a fix for a bug which caused a text encoding issue for non-English language function calls.",encoding:"cl100k_base",context:16385,maxOutput:4096,trainingData:"2021-09",cost:{input:.5,output:1.5,batchInput:.25,batchOutput:.75}},Ha={humanName:"GPT-3.5 Turbo Instruct",description:"Similar capabilities as GPT-3 era models. Compatible with legacy Completions endpoint and not Chat Completions.",encoding:"cl100k_base",context:4096,maxOutput:4096,trainingData:"2021-09",cost:{input:1.5,output:2}},wc={humanName:"GPT-3.5 Turbo 1106",description:"GPT-3.5 Turbo model with improved instruction following, JSON mode, reproducible outputs, parallel function calling, and more.",encoding:"cl100k_base",context:16385,maxOutput:4096,trainingData:"2021-09",cost:{input:1,output:2,batchInput:.5,batchOutput:1}},Tc={humanName:"Davinci 002",description:"Replacement for the GPT-3 curie and davinci base models.",encoding:"p50k_base",context:16384,maxOutput:16384,trainingData:"2021-09",cost:{input:2,output:2,batchInput:1,batchOutput:1}},Ac={humanName:"Davinci-002 Finetuning",description:"Davinci-002 finetuned for custom tasks.",encoding:"p50k_base",cost:{input:12,output:12,batchInput:6,batchOutput:6,training:6}},xc={humanName:"Babbage 002",description:"Replacement for the GPT-3 ada and babbage base models.",encoding:"p50k_base",context:16384,trainingData:"2021-09",cost:{input:.4,output:.4,batchInput:.2,batchOutput:.2}},Ic={humanName:"Babbage-002 Finetuning",description:"Babbage-002 finetuned for custom tasks.",encoding:"p50k_base",cost:{input:1.6,output:1.6,batchInput:.8,batchOutput:.8,training:.4}},Ui={humanName:"GPT-4 32k",encoding:"cl100k_base",description:"Snapshot of gpt-4 from June 13th 2023 with improved function calling support.",shutdownDate:"2025-06-06",recommendedReplacement:"gpt-4o",context:32768,maxOutput:16384,trainingData:"2021-09",cost:{input:60,output:120,batchInput:30,batchOutput:60}},ja={humanName:"GPT-4 Vision Preview",encoding:"cl100k_base",description:"Vision capabilities preview of GPT-4.",shutdownDate:"2024-12-06",recommendedReplacement:"gpt-4o",context:128e3,maxOutput:4096,trainingData:"2023-12",cost:{input:10,output:30,batchInput:5,batchOutput:15}},Rc=ja,Pc={humanName:"GPT-3.5 Turbo 0613",encoding:"cl100k_base",description:"Version of GPT-3.5 Turbo from June 2013.",shutdownDate:"2024-09-13",recommendedReplacement:"gpt-3.5-turbo",context:16385,maxOutput:4096,trainingData:"2021-09",cost:{input:1.5,output:2,batchInput:.75,batchOutput:1}},Dc={humanName:"GPT-3.5 Turbo 16k 0613",encoding:"cl100k_base",description:"16k context version from June 2013.",shutdownDate:"2024-09-13",recommendedReplacement:"gpt-3.5-turbo",context:16385,maxOutput:4096,trainingData:"2021-09",cost:{input:3,output:4,batchInput:1.5,batchOutput:2}},Nc={humanName:"Text Ada 001",encoding:"r50k_base",description:"Model for lightweight tasks.",shutdownDate:"2024-01-04",recommendedReplacement:"gpt-3.5-turbo-instruct",cost:{input:.4}},Lc={humanName:"Text Babbage 001",encoding:"r50k_base",description:"Model for efficient processing.",shutdownDate:"2024-01-04",recommendedReplacement:"gpt-3.5-turbo-instruct",cost:{input:.5}},Mc={humanName:"Text Curie 001",encoding:"r50k_base",description:"Mid-range model for various tasks.",shutdownDate:"2024-01-04",recommendedReplacement:"gpt-3.5-turbo-instruct",cost:{input:2}},Oc={humanName:"Text Davinci 001",encoding:"r50k_base",description:"High-performance model for complex tasks.",shutdownDate:"2024-01-04",recommendedReplacement:"gpt-3.5-turbo-instruct",cost:{input:20}},Bc={humanName:"Text Davinci 002",encoding:"p50k_base",description:"Legacy high-performance model.",shutdownDate:"2024-01-04",recommendedReplacement:"gpt-3.5-turbo-instruct",cost:{input:20}},Fc={humanName:"Text Davinci 003",encoding:"p50k_base",description:"Latest of the Davinci series.",shutdownDate:"2024-01-04",recommendedReplacement:"gpt-3.5-turbo-instruct",cost:{input:20}},Gc={humanName:"Ada",encoding:"r50k_base",description:"Base model for lightweight tasks.",shutdownDate:"2024-01-04",recommendedReplacement:"babbage-002",cost:{input:.4}},zc={humanName:"Babbage",encoding:"r50k_base",description:"Model for efficient processing.",shutdownDate:"2024-01-04",recommendedReplacement:"babbage-002",cost:{input:.5}},Uc={humanName:"Curie",encoding:"r50k_base",description:"Mid-range model for a variety of applications.",shutdownDate:"2024-01-04",recommendedReplacement:"davinci-002",cost:{input:2}},Hc={humanName:"Davinci",encoding:"p50k_base",description:"High-performance legacy model.",shutdownDate:"2024-01-04",recommendedReplacement:"davinci-002",cost:{input:20}},Vc={humanName:"Code Davinci 002",encoding:"p50k_base",description:"Legacy coding model.",shutdownDate:"2023-03-23",recommendedReplacement:"gpt-4o"},Va={humanName:"Code Davinci 001",encoding:"p50k_base",description:"Older coding model.",shutdownDate:"2023-03-23",recommendedReplacement:"gpt-4o"},Wc={humanName:"Code Davinci 001",encoding:"p50k_edit",description:"Older coding model.",shutdownDate:"2023-03-23"},jc={humanName:"Code Cushman 002",encoding:"p50k_base",description:"Legacy model for coding.",shutdownDate:"2023-03-23",recommendedReplacement:"gpt-4o"},Wa={humanName:"Code Cushman 001",encoding:"p50k_base",description:"Older model for coding tasks.",shutdownDate:"2023-03-23",recommendedReplacement:"gpt-4o"},qc={humanName:"GPT-4 0314",encoding:"cl100k_base",description:"Variant of GPT-4 model.",shutdownDate:"2024-06-13",recommendedReplacement:"gpt-4o",context:8192,maxOutput:8192,trainingData:"2021-09",cost:{input:30,output:60}},Kc={humanName:"GPT-3.5 Turbo 0301",encoding:"cl100k_base",description:"Earlier version of GPT-3.5 Turbo.",shutdownDate:"2024-09-13",recommendedReplacement:"gpt-3.5-turbo",context:16385,maxOutput:4096,trainingData:"2021-09",cost:{input:1.5,output:2,batchInput:.75,batchOutput:1}},Xc={...Ui,humanName:"GPT-4 32k 0314"},Yc={humanName:"Text Similarity Ada 001",encoding:"r50k_base",description:"Embedding model for similarity tasks.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:4}},Jc={humanName:"Text Search Ada Doc 001",encoding:"r50k_base",description:"Embedding model for document search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:4}},Zc={humanName:"Text Search Ada Query 001",encoding:"r50k_base",description:"Embedding model for query search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:4}},$c={humanName:"Code Search Ada Code 001",encoding:"r50k_base",description:"Embedding model for code search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:4}},Qc={humanName:"Code Search Ada Text 001",encoding:"r50k_base",description:"Embedding model for text search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:4}},eu={humanName:"Text Davinci 001",encoding:"p50k_edit",description:"Older text model.",shutdownDate:"2023-03-23"},tu={humanName:"Text Similarity Babbage 001",encoding:"r50k_base",description:"Embedding model for similarity tasks.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:5}},nu={humanName:"Text Search Babbage Doc 001",encoding:"r50k_base",description:"Embedding model for document search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:5}},iu={humanName:"Text Search Babbage Query 001",encoding:"r50k_base",description:"Embedding model for query search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:5}},ru={humanName:"Code Search Babbage Code 001",encoding:"r50k_base",description:"Embedding model for code search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:5}},au={humanName:"Code Search Babbage Text 001",encoding:"r50k_base",description:"Embedding model for text search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:5}},ou={humanName:"Text Similarity Curie 001",encoding:"r50k_base",description:"Embedding model for similarity tasks.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:20}},su={humanName:"Text Search Curie Doc 001",encoding:"r50k_base",description:"Embedding model for document search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:20}},lu={humanName:"Text Search Curie Query 001",encoding:"r50k_base",description:"Embedding model for query search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:20}},cu={humanName:"Text Similarity Davinci 001",encoding:"r50k_base",description:"Embedding model for similarity tasks.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:200}},uu={humanName:"Text Search Davinci Doc 001",encoding:"r50k_base",description:"Embedding model for document search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:200}},du={humanName:"Text Search Davinci Query 001",encoding:"r50k_base",description:"Embedding model for query search.",shutdownDate:"2024-01-04",recommendedReplacement:"text-embedding-3-small",cost:{input:200}},Hi={o1:Na,"o1-2024-12-17":Na,"o1-preview":La,"o1-preview-2024-09-12":La,"o1-mini":Ma,"o1-mini-2024-09-12":Ma,"o3-mini":cc,"chatgpt-4o-latest":Cc,"gpt-4o":Pa,"gpt-4o-2024-11-20":sc,"gpt-4o-2024-08-06":Pa,"gpt-4o-2024-05-13":lc,"gpt-4o-mini":Da,"gpt-4o-mini-2024-07-18":Da,"gpt-4o-realtime-preview":mc,"gpt-4o-realtime-preview-2024-10-01":gc,"gpt-4o-realtime-preview-2024-12-17":hc,"gpt-4o-mini-realtime-preview":Oa,"gpt-4o-mini-realtime-preview-2024-12-17":Oa,"gpt-4o-audio-preview":fc,"gpt-4o-audio-preview-2024-10-01":yc,"gpt-4o-audio-preview-2024-12-17":bc,"gpt-4o-mini-audio-preview":Ba,"gpt-4o-mini-audio-preview-2024-12-17":Ba,"gpt-4o-2024-08-06-finetune":vc,"gpt-4o-mini-2024-07-18-finetune":_c,"gpt-4o-mini-training":Fa,"gpt-4o-mini-training-2024-07-18":Fa,"davinci-002-finetune":Ac,"babbage-002-finetune":Ic,"gpt-4-turbo":Ga,"gpt-4-turbo-2024-04-09":Ga,"gpt-4-turbo-preview":zi,"gpt-4-0125-preview":zi,"gpt-4-1106-preview":kc,"gpt-4":za,"gpt-4-0613":za,"gpt-3.5-turbo":Ua,"gpt-3.5-turbo-0125":Ua,"gpt-3.5-turbo-1106":wc,"gpt-3.5-turbo-finetune":Sc,"gpt-3.5-turbo-16k":Ec,"gpt-4-32k":Ui,"gpt-4-32k-0613":Ui,"gpt-4-vision-preview":ja,"gpt-4-1106-vision-preview":Rc,"gpt-4-0314":qc,"gpt-4-32k-0314":Xc,"gpt-3.5-turbo-0613":Pc,"gpt-3.5-turbo-16k-0613":Dc,"gpt-3.5-turbo-0301":Kc},bn={...Hi,"text-embedding-3-small":uc,"text-embedding-3-large":dc,"text-embedding-ada-002":pc,"gpt-3.5-turbo-instruct":Ha,"gpt-3.5-turbo-instruct-0914":Ha,"davinci-002":Tc,"babbage-002":xc,"text-ada-001":Nc,"text-babbage-001":Lc,"text-curie-001":Mc,"text-davinci-001":Oc,"text-davinci-002":Bc,"text-davinci-003":Fc,ada:Gc,babbage:zc,curie:Uc,davinci:Hc,"code-davinci-002":Vc,"code-davinci-001":Va,"davinci-codex":Va,"code-davinci-edit-001":Wc,"code-cushman-002":jc,"code-cushman-001":Wa,"cushman-codex":Wa,"code-search-ada-code-001":$c,"code-search-ada-text-001":Qc,"text-davinci-edit-001":eu,"text-similarity-ada-001":Yc,"text-search-ada-doc-001":Jc,"text-search-ada-query-001":Zc,"text-similarity-babbage-001":tu,"text-search-babbage-doc-001":nu,"text-search-babbage-query-001":iu,"code-search-babbage-code-001":ru,"code-search-babbage-text-001":au,"text-similarity-curie-001":ou,"text-search-curie-doc-001":su,"text-search-curie-query-001":lu,"text-similarity-davinci-001":cu,"text-search-davinci-doc-001":uu,"text-search-davinci-query-001":du};var Ee="<|endoftext|>",Ve="<|fim_prefix|>",We="<|fim_middle|>",je="<|fim_suffix|>",ht="<|im_start|>",ft="<|im_end|>",qe="<|im_sep|>",yt="<|endofprompt|>";var qa=Object.fromEntries(Object.entries(Hi).map(([e,n])=>[e,n.encoding])),Ka=Object.fromEntries(Object.entries(bn).map(([e,n])=>[e,n.encoding])),pu={messageSeparator:`
3250
3250
  `,roleSeparator:`
3251
- `},mu={messageSeparator:"",roleSeparator:qe},Xa=Object.fromEntries(Object.keys(qa).flatMap(e=>e.startsWith("gpt-4")?[[e,mu]]:e.startsWith("gpt-3.5-turbo")?[[e,pu]]:[])),Kg=Object.keys(qa);var bt=/'s|'t|'re|'ve|'m|'ll|'d| ?\p{L}+| ?\p{N}+| ?[^\s\p{L}\p{N}]+|\s+(?!\S)|\s+/gu,vn=/(?:'s|'t|'re|'ve|'m|'ll|'d)|[^\r\n\p{L}\p{N}]?\p{L}+|\p{N}{1,3}| ?[^\s\p{L}\p{N}]+[\r\n]*|\s*[\r\n]+|\s+(?!\S)|\s+/giu;function Ya(e){return{tokenSplitRegex:vn,bytePairRankDecoder:e,specialTokensEncoder:new Map([[Ee,100257],[Ve,100258],[We,100259],[je,100260],[ht,100264],[ft,100265],[qe,100266],[yt,100276]])}}function Ja(e){return{tokenSplitRegex:vn,bytePairRankDecoder:e,specialTokensEncoder:new Map([[Ee,199999],[Ve,2e5],[We,200001],[je,200002],[ht,200003],[ft,200004],[qe,200005],[yt,200006]])}}function Za(e){return{expectedVocabularySize:50281,tokenSplitRegex:bt,bytePairRankDecoder:e,specialTokensEncoder:new Map([[Ee,50256]])}}function $a(e){return{tokenSplitRegex:bt,bytePairRankDecoder:e,specialTokensEncoder:new Map([[Ee,50256],[Ve,50281],[We,50282],[je,50283]])}}function Qa(e){return{expectedVocabularySize:50257,tokenSplitRegex:bt,bytePairRankDecoder:e,specialTokensEncoder:new Map([[Ee,50256]])}}function Vi(e,n){let t=n(e);switch(e.toLowerCase()){case"r50k_base":return Qa(t);case"p50k_base":return Za(t);case"p50k_edit":return $a(t);case"cl100k_base":return Ya(t);case"o200k_base":return Ja(t);default:throw new Error(`Unknown encoding name: ${e}`)}}var Fe=class Fe{constructor({bytePairRankDecoder:n,specialTokensEncoder:t,expectedVocabularySize:i,modelName:r,...a}){J(this,"modelName");J(this,"bytePairEncodingCoreProcessor");J(this,"specialTokensEncoder");J(this,"specialTokensSet");J(this,"allSpecialTokenRegex");J(this,"defaultSpecialTokenConfig");J(this,"vocabularySize");this.specialTokensEncoder=t,this.specialTokensSet=new Set(this.specialTokensEncoder.keys()),this.allSpecialTokenRegex=Gi(this.specialTokensSet),this.bytePairEncodingCoreProcessor=new yn({bytePairRankDecoder:n,specialTokensEncoder:t,...a}),this.defaultSpecialTokenConfig=this.processSpecialTokens();let o=Math.max(n.length-1,Ra(t));if(this.vocabularySize=this.bytePairEncodingCoreProcessor.mergeableBytePairRankCount+t.size,i!==void 0){if(this.vocabularySize!==i)throw new Error("The number of mergeable tokens and special tokens must be equal to expectedVocabularySize.");if(o!==i-1)throw new Error(`The model encodings are invalid. The maximum token value must be equal to expectedVocabularySize - 1. Currently ${o}, expected ${i-1}`)}this.encode=this.encode.bind(this),this.decode=this.decode.bind(this),this.encodeGenerator=this.encodeGenerator.bind(this),this.decodeGenerator=this.decodeGenerator.bind(this),this.decodeAsyncGenerator=this.decodeAsyncGenerator.bind(this),this.decodeAsync=this.decodeAsync.bind(this),this.isWithinTokenLimit=this.isWithinTokenLimit.bind(this),this.encodeChat=this.encodeChat.bind(this),this.encodeChatGenerator=this.encodeChatGenerator.bind(this),this.countTokens=this.countTokens.bind(this),this.setMergeCacheSize=this.setMergeCacheSize.bind(this),this.clearMergeCache=this.clearMergeCache.bind(this),this.estimateCost=this.estimateCost.bind(this),this.modelName=r}static getEncodingApi(n,t){let i=Vi(n,t);return new Fe(i)}static getEncodingApiForModel(n,t){let i=Ka[n],r=Vi(i,t);return new Fe({...r,modelName:n})}processSpecialTokens({allowedSpecial:n,disallowedSpecial:t}={}){let i;if(n===mt||n?.has(mt)){n=new Set(this.specialTokensSet);let r=n;if(t===mt)throw new Error('allowedSpecial and disallowedSpecial cannot both be set to "all".');typeof t=="object"?t.forEach(a=>r.delete(a)):t=new Set}if(!t||t===mt||t.has(mt)){t=new Set(this.specialTokensSet);let r=t;n?.size?(n.forEach(a=>r.delete(a)),t.forEach(a=>n.delete(a)),t.size>0&&(i=Gi(t))):i=this.allSpecialTokenRegex}return{allowedSpecial:n,regexPattern:i}}encodeGenerator(n,t){let i=t?this.processSpecialTokens(t):this.defaultSpecialTokenConfig;if(i.regexPattern){let r=n.match(i.regexPattern);if(r!==null)throw new Error(`Disallowed special token found: ${r[0]}`)}return this.bytePairEncodingCoreProcessor.encodeNativeGenerator(n,i.allowedSpecial)}encode(n,t){let i=t?this.processSpecialTokens(t):this.defaultSpecialTokenConfig;if(i.regexPattern){let r=n.match(i.regexPattern);if(r!==null)throw new Error(`Disallowed special token found: ${r[0]}`)}return this.bytePairEncodingCoreProcessor.encodeNative(n,i.allowedSpecial)}*encodeChatGenerator(n,t=this.modelName){if(!t)throw new Error("Model name must be provided either during initialization or passed in to the method.");let i=Xa[t],r=this.specialTokensEncoder.get(ht),a=this.specialTokensEncoder.get(ft);if(!i||r===void 0||a===void 0)throw new Error(`Model '${t}' does not support chat.`);let o=new Set([qe]),{messageSeparator:s,roleSeparator:l}=i,c=s.length>0?this.encode(s):[],u=l.length>0?this.encode(l,{allowedSpecial:o}):[],d=new Map;for(let{role:m="system",name:p=m,content:f}of n){if(f===void 0)throw new Error("Content must be defined for all messages.");yield[r];let _=d.get(p)??this.encode(p);d.set(p,_),yield _,u.length>0&&(yield u),yield*this.encodeGenerator(f),yield[a],yield c}yield[r],yield*this.encodeGenerator("assistant"),u.length>0&&(yield u)}encodeChat(n,t=this.modelName){return[...this.encodeChatGenerator(n,t)].flat()}isWithinTokenLimit(n,t){let i=typeof n=="string"?this.encodeGenerator(n):this.encodeChatGenerator(n),r=0;for(let a of i)if(r+=a.length,r>t)return!1;return r}countTokens(n,t){if(typeof n=="string"){let a=t?this.processSpecialTokens(t):this.defaultSpecialTokenConfig;if(a.regexPattern){let o=n.match(a.regexPattern);if(o!==null)throw new Error(`Disallowed special token found: ${o[0]}`)}return this.bytePairEncodingCoreProcessor.countNative(n,a.allowedSpecial)}let i=this.encodeChatGenerator(n),r=0;for(let a of i)r+=a.length;return r}setMergeCacheSize(n){this.bytePairEncodingCoreProcessor.setMergeCacheSize(n)}clearMergeCache(){this.bytePairEncodingCoreProcessor.clearMergeCache()}decode(n){return this.bytePairEncodingCoreProcessor.decodeNative(n)}*decodeGenerator(n){let t=this.bytePairEncodingCoreProcessor.decodeNativeGenerator(n),i="";for(let r of t)i+=typeof r=="string"?r:gt.decode(r,{stream:!0}),!(i.length===0||Bi(i))&&(yield i,i="");i.length>0&&(yield i)}async*decodeAsyncGenerator(n){let t=this.bytePairEncodingCoreProcessor.decodeNativeAsyncIterable(n),i="";for await(let r of t)i+=typeof r=="string"?r:gt.decode(r,{stream:!0}),!(i.length===0||Bi(i))&&(yield i,i="");i.length>0&&(yield i)}async decodeAsync(n){let t=this.bytePairEncodingCoreProcessor.decodeNativeAsyncIterable(n),i="";for await(let r of t)i+=typeof r=="string"?r:gt.decode(r,{stream:!0});return i}estimateCost(n,t=this.modelName){if(!t)throw new Error("Model name must be provided either during initialization or passed in to the method.");let i=bn[t];if(!i)throw new Error(`Unknown model: ${t}`);if(!i.cost)throw new Error(`No cost information available for model: ${t}`);let r=i.cost,a={},o=n/1e6;return r.input!==void 0&&(a.input=r.input*o),r.output!==void 0&&(a.output=r.output*o),r.batchInput!==void 0&&(a.batchInput=r.batchInput*o),r.batchOutput!==void 0&&(a.batchOutput=r.batchOutput*o),a}};J(Fe,"EndOfPrompt",yt),J(Fe,"EndOfText",Ee),J(Fe,"FimMiddle",We),J(Fe,"FimPrefix",Ve),J(Fe,"FimSuffix",je);var _n=Fe;var gu=_n.getEncodingApi("cl100k_base",()=>Ta),{decode:Dh,decodeAsyncGenerator:Lh,decodeGenerator:Nh,encode:Mh,encodeGenerator:Oh,isWithinTokenLimit:Bh,countTokens:Ot,encodeChat:Fh,encodeChatGenerator:Gh,vocabularySize:zh,setMergeCacheSize:Uh,clearMergeCache:Hh,estimateCost:Vh}=gu;var Sn=class{constructor(){this.size=4096;this.groups=[]}createGroup(n){let t=new Wi;return t.id=n,this.groups.push(t),t}group(n){return this.groups.find(t=>t.id===n)}countTokens(){return this.groups.reduce((n,t)=>n+t.tokenCount,0)}removeOverflow(){let n=this.countTokens(),t=this.groups.reduce((i,r)=>i+r.weight,0);for(;n>this.size;){let i=this.groups.slice().sort((a,o)=>{let s=Math.floor(a.weight/t*this.size),l=Math.floor(o.weight/t*this.size),c=a.tokenCount-s;return o.tokenCount-l-c}),r=this.removeOneItem(i);if(!r)throw new Error("Too many items in the token window that cannot be removed.");n-=r.tokenCount}}removeOneItem(n){for(let t of n){let i=t.items.findIndex(a=>!a.cannotRemove);if(i===-1)continue;let r=t.items[i];return t.items.splice(i,1),t.tokenCount-=r.tokenCount,r}return null}},Wi=class{constructor(){this.id="";this.items=[];this.weight=1;this.tokenCount=0;this.separator=`
3251
+ `},mu={messageSeparator:"",roleSeparator:qe},Xa=Object.fromEntries(Object.keys(qa).flatMap(e=>e.startsWith("gpt-4")?[[e,mu]]:e.startsWith("gpt-3.5-turbo")?[[e,pu]]:[])),Kg=Object.keys(qa);var bt=/'s|'t|'re|'ve|'m|'ll|'d| ?\p{L}+| ?\p{N}+| ?[^\s\p{L}\p{N}]+|\s+(?!\S)|\s+/gu,vn=/(?:'s|'t|'re|'ve|'m|'ll|'d)|[^\r\n\p{L}\p{N}]?\p{L}+|\p{N}{1,3}| ?[^\s\p{L}\p{N}]+[\r\n]*|\s*[\r\n]+|\s+(?!\S)|\s+/giu;function Ya(e){return{tokenSplitRegex:vn,bytePairRankDecoder:e,specialTokensEncoder:new Map([[Ee,100257],[Ve,100258],[We,100259],[je,100260],[ht,100264],[ft,100265],[qe,100266],[yt,100276]])}}function Ja(e){return{tokenSplitRegex:vn,bytePairRankDecoder:e,specialTokensEncoder:new Map([[Ee,199999],[Ve,2e5],[We,200001],[je,200002],[ht,200003],[ft,200004],[qe,200005],[yt,200006]])}}function Za(e){return{expectedVocabularySize:50281,tokenSplitRegex:bt,bytePairRankDecoder:e,specialTokensEncoder:new Map([[Ee,50256]])}}function $a(e){return{tokenSplitRegex:bt,bytePairRankDecoder:e,specialTokensEncoder:new Map([[Ee,50256],[Ve,50281],[We,50282],[je,50283]])}}function Qa(e){return{expectedVocabularySize:50257,tokenSplitRegex:bt,bytePairRankDecoder:e,specialTokensEncoder:new Map([[Ee,50256]])}}function Vi(e,n){let t=n(e);switch(e.toLowerCase()){case"r50k_base":return Qa(t);case"p50k_base":return Za(t);case"p50k_edit":return $a(t);case"cl100k_base":return Ya(t);case"o200k_base":return Ja(t);default:throw new Error(`Unknown encoding name: ${e}`)}}var Fe=class Fe{constructor({bytePairRankDecoder:n,specialTokensEncoder:t,expectedVocabularySize:i,modelName:r,...a}){J(this,"modelName");J(this,"bytePairEncodingCoreProcessor");J(this,"specialTokensEncoder");J(this,"specialTokensSet");J(this,"allSpecialTokenRegex");J(this,"defaultSpecialTokenConfig");J(this,"vocabularySize");this.specialTokensEncoder=t,this.specialTokensSet=new Set(this.specialTokensEncoder.keys()),this.allSpecialTokenRegex=Gi(this.specialTokensSet),this.bytePairEncodingCoreProcessor=new yn({bytePairRankDecoder:n,specialTokensEncoder:t,...a}),this.defaultSpecialTokenConfig=this.processSpecialTokens();let o=Math.max(n.length-1,Ra(t));if(this.vocabularySize=this.bytePairEncodingCoreProcessor.mergeableBytePairRankCount+t.size,i!==void 0){if(this.vocabularySize!==i)throw new Error("The number of mergeable tokens and special tokens must be equal to expectedVocabularySize.");if(o!==i-1)throw new Error(`The model encodings are invalid. The maximum token value must be equal to expectedVocabularySize - 1. Currently ${o}, expected ${i-1}`)}this.encode=this.encode.bind(this),this.decode=this.decode.bind(this),this.encodeGenerator=this.encodeGenerator.bind(this),this.decodeGenerator=this.decodeGenerator.bind(this),this.decodeAsyncGenerator=this.decodeAsyncGenerator.bind(this),this.decodeAsync=this.decodeAsync.bind(this),this.isWithinTokenLimit=this.isWithinTokenLimit.bind(this),this.encodeChat=this.encodeChat.bind(this),this.encodeChatGenerator=this.encodeChatGenerator.bind(this),this.countTokens=this.countTokens.bind(this),this.setMergeCacheSize=this.setMergeCacheSize.bind(this),this.clearMergeCache=this.clearMergeCache.bind(this),this.estimateCost=this.estimateCost.bind(this),this.modelName=r}static getEncodingApi(n,t){let i=Vi(n,t);return new Fe(i)}static getEncodingApiForModel(n,t){let i=Ka[n],r=Vi(i,t);return new Fe({...r,modelName:n})}processSpecialTokens({allowedSpecial:n,disallowedSpecial:t}={}){let i;if(n===mt||n?.has(mt)){n=new Set(this.specialTokensSet);let r=n;if(t===mt)throw new Error('allowedSpecial and disallowedSpecial cannot both be set to "all".');typeof t=="object"?t.forEach(a=>r.delete(a)):t=new Set}if(!t||t===mt||t.has(mt)){t=new Set(this.specialTokensSet);let r=t;n?.size?(n.forEach(a=>r.delete(a)),t.forEach(a=>n.delete(a)),t.size>0&&(i=Gi(t))):i=this.allSpecialTokenRegex}return{allowedSpecial:n,regexPattern:i}}encodeGenerator(n,t){let i=t?this.processSpecialTokens(t):this.defaultSpecialTokenConfig;if(i.regexPattern){let r=n.match(i.regexPattern);if(r!==null)throw new Error(`Disallowed special token found: ${r[0]}`)}return this.bytePairEncodingCoreProcessor.encodeNativeGenerator(n,i.allowedSpecial)}encode(n,t){let i=t?this.processSpecialTokens(t):this.defaultSpecialTokenConfig;if(i.regexPattern){let r=n.match(i.regexPattern);if(r!==null)throw new Error(`Disallowed special token found: ${r[0]}`)}return this.bytePairEncodingCoreProcessor.encodeNative(n,i.allowedSpecial)}*encodeChatGenerator(n,t=this.modelName){if(!t)throw new Error("Model name must be provided either during initialization or passed in to the method.");let i=Xa[t],r=this.specialTokensEncoder.get(ht),a=this.specialTokensEncoder.get(ft);if(!i||r===void 0||a===void 0)throw new Error(`Model '${t}' does not support chat.`);let o=new Set([qe]),{messageSeparator:s,roleSeparator:l}=i,c=s.length>0?this.encode(s):[],u=l.length>0?this.encode(l,{allowedSpecial:o}):[],d=new Map;for(let{role:m="system",name:p=m,content:f}of n){if(f===void 0)throw new Error("Content must be defined for all messages.");yield[r];let _=d.get(p)??this.encode(p);d.set(p,_),yield _,u.length>0&&(yield u),yield*this.encodeGenerator(f),yield[a],yield c}yield[r],yield*this.encodeGenerator("assistant"),u.length>0&&(yield u)}encodeChat(n,t=this.modelName){return[...this.encodeChatGenerator(n,t)].flat()}isWithinTokenLimit(n,t){let i=typeof n=="string"?this.encodeGenerator(n):this.encodeChatGenerator(n),r=0;for(let a of i)if(r+=a.length,r>t)return!1;return r}countTokens(n,t){if(typeof n=="string"){let a=t?this.processSpecialTokens(t):this.defaultSpecialTokenConfig;if(a.regexPattern){let o=n.match(a.regexPattern);if(o!==null)throw new Error(`Disallowed special token found: ${o[0]}`)}return this.bytePairEncodingCoreProcessor.countNative(n,a.allowedSpecial)}let i=this.encodeChatGenerator(n),r=0;for(let a of i)r+=a.length;return r}setMergeCacheSize(n){this.bytePairEncodingCoreProcessor.setMergeCacheSize(n)}clearMergeCache(){this.bytePairEncodingCoreProcessor.clearMergeCache()}decode(n){return this.bytePairEncodingCoreProcessor.decodeNative(n)}*decodeGenerator(n){let t=this.bytePairEncodingCoreProcessor.decodeNativeGenerator(n),i="";for(let r of t)i+=typeof r=="string"?r:gt.decode(r,{stream:!0}),!(i.length===0||Bi(i))&&(yield i,i="");i.length>0&&(yield i)}async*decodeAsyncGenerator(n){let t=this.bytePairEncodingCoreProcessor.decodeNativeAsyncIterable(n),i="";for await(let r of t)i+=typeof r=="string"?r:gt.decode(r,{stream:!0}),!(i.length===0||Bi(i))&&(yield i,i="");i.length>0&&(yield i)}async decodeAsync(n){let t=this.bytePairEncodingCoreProcessor.decodeNativeAsyncIterable(n),i="";for await(let r of t)i+=typeof r=="string"?r:gt.decode(r,{stream:!0});return i}estimateCost(n,t=this.modelName){if(!t)throw new Error("Model name must be provided either during initialization or passed in to the method.");let i=bn[t];if(!i)throw new Error(`Unknown model: ${t}`);if(!i.cost)throw new Error(`No cost information available for model: ${t}`);let r=i.cost,a={},o=n/1e6;return r.input!==void 0&&(a.input=r.input*o),r.output!==void 0&&(a.output=r.output*o),r.batchInput!==void 0&&(a.batchInput=r.batchInput*o),r.batchOutput!==void 0&&(a.batchOutput=r.batchOutput*o),a}};J(Fe,"EndOfPrompt",yt),J(Fe,"EndOfText",Ee),J(Fe,"FimMiddle",We),J(Fe,"FimPrefix",Ve),J(Fe,"FimSuffix",je);var _n=Fe;var gu=_n.getEncodingApi("cl100k_base",()=>Ta),{decode:Dh,decodeAsyncGenerator:Nh,decodeGenerator:Lh,encode:Mh,encodeGenerator:Oh,isWithinTokenLimit:Bh,countTokens:Ot,encodeChat:Fh,encodeChatGenerator:Gh,vocabularySize:zh,setMergeCacheSize:Uh,clearMergeCache:Hh,estimateCost:Vh}=gu;var Sn=class{constructor(){this.size=4096;this.groups=[]}createGroup(n){let t=new Wi;return t.id=n,this.groups.push(t),t}group(n){return this.groups.find(t=>t.id===n)}countTokens(){return this.groups.reduce((n,t)=>n+t.tokenCount,0)}removeOverflow(){let n=this.countTokens(),t=this.groups.reduce((i,r)=>i+r.weight,0);for(;n>this.size;){let i=this.groups.slice().sort((a,o)=>{let s=Math.floor(a.weight/t*this.size),l=Math.floor(o.weight/t*this.size),c=a.tokenCount-s;return o.tokenCount-l-c}),r=this.removeOneItem(i);if(!r)throw new Error("Too many items in the token window that cannot be removed.");n-=r.tokenCount}}removeOneItem(n){for(let t of n){let i=t.items.findIndex(a=>!a.cannotRemove);if(i===-1)continue;let r=t.items[i];return t.items.splice(i,1),t.tokenCount-=r.tokenCount,r}return null}},Wi=class{constructor(){this.id="";this.items=[];this.weight=1;this.tokenCount=0;this.separator=`
3252
3252
  `;this.itemPadding=0;this.sortFunction=(n,t)=>n.sortOrder!==t.sortOrder?n.sortOrder-t.sortOrder:n.dateAdded!==t.dateAdded?n.dateAdded-t.dateAdded:n.content.localeCompare(t.content)}setItemPadding(n){return this.itemPadding=n,this.recalculateTokens(),this}sortBy(n){return this.sortFunction=n,this.items.sort(this.sortFunction),this}setSeparator(n){return this.separator==n?this:(this.separator=n,this.recalculateTokens(),this)}setWeight(n){return this.weight=n,this}recalculateTokens(){this.tokenCount=this.items.reduce((n,t)=>(t.tokenCount=Ot(t.content)+Ot(this.separator)+this.itemPadding,n+t.tokenCount),0)}add(n){typeof n=="string"&&(n={content:n});let t=n;t.id===void 0&&(t.id=Te());let i=this.items.find(r=>r.id===t.id);return i?(this.tokenCount-=i.tokenCount,Object.assign(i,t),t=i):this.items.push(t),t.dateAdded===void 0&&(t.dateAdded=Date.now()),t.sortOrder===void 0&&(t.sortOrder=0),t.disabled===void 0&&(t.disabled=!1),t.tokenCount=t.disabled?0:Ot(n.content)+Ot(this.separator)+this.itemPadding,this.tokenCount+=t.tokenCount,this.items.sort(this.sortFunction),t}getAllAsString(){return this.getAll().map(n=>n.content).join(this.separator)}getAll(){return this.items.filter(n=>!n.disabled)}empty(){this.items=[],this.tokenCount=0}};var vt=1,Ke=new q("ChatGPT"),En=class{constructor(n){this.id="";this.metadata={};this.config={apiKey:"",endpoint:"",model:"gpt-4-turbo",systemMessage:"",userID:"",stream:!0,maxTokens:4096};this.maxToolCallsPerMessage=10;this.stats={tokensUsed:0};this.tokenWindow=(()=>{let n=new Sn;return n.createGroup("context").setSeparator(`
3253
3253
 
3254
- `),n.createGroup("actions").setItemPadding(25),n.createGroup("messages").setItemPadding(10),n})();this.config={...this.config,...n},this.tokenWindow.size=this.config.maxTokens||4096}get contextGroup(){return this.tokenWindow.group("context")}get toolGroup(){return this.tokenWindow.group("actions")}get messageGroup(){return this.tokenWindow.group("messages")}async sendMessage(n){let t={role:"user",content:n};this.messageGroup.add({id:"msg-"+vt++,content:JSON.stringify(t),customData:t}),await this.processMessages();let r=this.messageGroup.items[this.messageGroup.items.length-1]?.customData;return r?.role=="assistant"&&r.content||""}addAssistantMessage(n){let t={role:"assistant",content:n};this.messageGroup.add({id:"msg-"+vt++,content:JSON.stringify(t),customData:t})}addUserMessage(n){let t={role:"user",content:n};this.messageGroup.add({id:"msg-"+vt++,content:JSON.stringify(t),customData:t})}getMessages(){return this.messageGroup.items.map(n=>n.customData)}getLatestMessage(){return this.messageGroup.items.length?this.messageGroup.items[this.messageGroup.items.length-1]?.customData:void 0}async processMessages(){await this.config.onBeforeMessageProcessing?.(),Ke.debugEnabled&&Ke.debug("Process message state:",{context:this.contextGroup.getAllAsString(),tools:this.toolGroup.getAll().map(i=>i.customData),messages:this.messageGroup.items.map(i=>i.customData),tokens:{used:this.tokenWindow.countTokens(),max:this.tokenWindow.size}});let t=this.messageGroup.items[this.messageGroup.items.length-1]?.customData;if(t?.role=="user"||t?.role=="tool")await this.sendToAPI(),await this.processMessages();else if(t?.role=="assistant"&&t?.tool_calls?.length){for(let i of t.tool_calls)await this.processToolCall(i);await this.processMessages()}}async trimMessages(){for(this.tokenWindow.removeOverflow();this.messageGroup.items.length&&this.messageGroup.items[0].customData?.role=="tool";)this.messageGroup.items.shift()}async sendToAPI(n){this.config.systemMessage&&this.contextGroup.add({id:"_gpt_context",cannotRemove:!0,sortOrder:0,content:this.config.systemMessage}),await this.trimMessages();let t=0;for(let l=this.messageGroup.items.length-1;l>=0;l--){let c=this.messageGroup.items[l].customData;if(c.role=="assistant"&&c.tool_calls){if(t+=1,t>=this.maxToolCallsPerMessage)throw new Error(`Exceeded the maximum tool calls per message limit of ${this.maxToolCallsPerMessage}.`)}else if(c.role=="user")break}Ke.debugEnabled&&Ke.debug("Before LLM state:",{context:this.contextGroup.getAllAsString(),tools:this.toolGroup.getAll().map(l=>l.customData),messages:this.messageGroup.items.map(l=>l.customData),tokens:{used:this.tokenWindow.countTokens(),max:this.tokenWindow.size}});let i={model:this.config.model,temperature:.2,user:this.config.userID,tools:[],stream:!!this.config.stream,max_tokens:1024,messages:[{role:"system",content:this.contextGroup.getAllAsString()},...this.messageGroup.getAll().map(l=>l.customData)]};for(let l of this.toolGroup.getAll()){let c=l.customData;c.description&&c.description.length>1024&&Ke.warn(`Tool description for "${c.name}" is too long, it will be truncated.`);let u={type:"function",function:{name:c.name,description:(c.description||"").substring(0,1024),parameters:{type:"object",properties:{}}}};if(Array.isArray(c.params))for(let d of c.params)u.function.parameters.properties[d.name]={type:d.type,description:d.description};else if(c.params){let d=c.params;for(let m in d)u.function.parameters.properties[m]={type:"string",description:d[m]}}i.tools.push(u)}i.user||delete i.user,i.tools.length||delete i.tools;let r={};if(r["Content-Type"]="application/json",this.config.apiKey&&(r.Authorization=`Bearer ${this.config.apiKey}`),n)return i;let a=await fetch(this.config.endpoint||"https://api.openai.com/v1/chat/completions",{method:"POST",headers:r,body:JSON.stringify(i)});if(!a.ok){let l=`${a.status} ${a.statusText}`;try{let u=await a.json();l=u.errorText||u.error?.message||u.error||l}catch{}let c=new Error(l);throw c.code=a.status,c}let o=null,s=null;if(this.config.stream)for await(let l of Ea(a.body)){if(l.data=="[DONE]")break;if(!l.data)continue;let c=JSON.parse(l.data);if(s){for(let u in c.choices[0].delta)if(typeof c.choices[0].delta[u]=="string"){if(u=="role"&&s[u]==c.choices[0].delta[u])continue;s[u]=(s[u]||"")+c.choices[0].delta[u]}for(let u of c.choices[0].delta.tool_calls||[]){if(s.tool_calls||(s.tool_calls=[]),!s.tool_calls[u.index]){s.tool_calls[u.index]=u;continue}let d=s.tool_calls[u.index];d.function=d.function||{},d.function.name=(d.function.name||"")+(u.function?.name||""),d.function.arguments=(d.function.arguments||"")+(u.function?.arguments||"")}}else s={chunkID:c.id,...c.choices[0].delta};s?.content&&!s.content.startsWith("{")&&this.config.onAIMessage?.(s.content,!0)}else o=await a.json(),this.stats.tokensUsed+=o.usage?.total_tokens||0,Ke.debug(`Used ${o.usage?.total_tokens||0} tokens, total used: ${this.stats.tokensUsed}`),s=o.choices?.[0]?.message;if(s||(Ke.warn("No response block in API response."),s={role:"assistant",content:""}),s.role=="user")throw new Error("API returned a user message, which is not allowed.");this.processIncomingMessage(s),this.messageGroup.add({id:"msg-"+vt++,content:JSON.stringify(s),customData:s}),s.content&&this.config.onAIMessage?.(s.content,!1)}processIncomingMessage(n){}registerTool(n){this.toolGroup.add({id:n.name,cannotRemove:!n.canRemove,content:JSON.stringify(n),customData:n})}async processToolCall(n){try{let i=this.toolGroup.items.find(s=>s.id==n.function.name)?.customData;if(!i)throw new Error(`Tool "${n.function.name}" not found.`);let r=JSON.parse(n.function.arguments);this.config.onAIToolStart?.(n.function.name,r);let a=await i.callback(r);typeof a!="string"&&(a=JSON.stringify(a)||""),(a===""||a==="undefined")&&(a="success");let o={role:"tool",content:a,tool_call_id:n.id};this.messageGroup.add({id:"msg-"+vt++,content:JSON.stringify(o),customData:o})}catch(t){Ke.warn(`Unable to process tool call for "${n?.function?.name}"`,t);let i={role:"tool",content:`Error: ${t.message}`,tool_call_id:n.id};this.messageGroup.add({id:"msg-"+vt++,content:JSON.stringify(i),customData:i})}}resetConversation(){this.messageGroup.empty()}};var Z=function(){return Z=Object.assign||function(n){for(var t,i=1,r=arguments.length;i<r;i++){t=arguments[i];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(n[a]=t[a])}return n},Z.apply(this,arguments)};function hu(e,n,t,i){function r(a){return a instanceof t?a:new t(function(o){o(a)})}return new(t||(t=Promise))(function(a,o){function s(u){try{c(i.next(u))}catch(d){o(d)}}function l(u){try{c(i.throw(u))}catch(d){o(d)}}function c(u){u.done?a(u.value):r(u.value).then(s,l)}c((i=i.apply(e,n||[])).next())})}function fu(e,n){var t={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},i,r,a,o;return o={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function s(c){return function(u){return l([c,u])}}function l(c){if(i)throw new TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(t=0)),t;)try{if(i=1,r&&(a=c[0]&2?r.return:c[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,c[1])).done)return a;switch(r=0,a&&(c=[c[0]&2,a.value]),c[0]){case 0:case 1:a=c;break;case 4:return t.label++,{value:c[1],done:!1};case 5:t.label++,r=c[1],c=[0];continue;case 7:c=t.ops.pop(),t.trys.pop();continue;default:if(a=t.trys,!(a=a.length>0&&a[a.length-1])&&(c[0]===6||c[0]===2)){t=0;continue}if(c[0]===3&&(!a||c[1]>a[0]&&c[1]<a[3])){t.label=c[1];break}if(c[0]===6&&t.label<a[1]){t.label=a[1],a=c;break}if(a&&t.label<a[2]){t.label=a[2],t.ops.push(c);break}a[2]&&t.ops.pop(),t.trys.pop();continue}c=n.call(e,t)}catch(u){c=[6,u],r=0}finally{i=a=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function U(e){var n=typeof Symbol=="function"&&Symbol.iterator,t=n&&e[n],i=0;if(t)return t.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(n?"Object is not iterable.":"Symbol.iterator is not defined.")}function ee(e,n){var t=typeof Symbol=="function"&&e[Symbol.iterator];if(!t)return e;var i=t.call(e),r,a=[],o;try{for(;(n===void 0||n-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(s){o={error:s}}finally{try{r&&!r.done&&(t=i.return)&&t.call(i)}finally{if(o)throw o.error}}return a}var yu="ENTRIES",ro="KEYS",ao="VALUES",ce="",ji=function(){function e(n,t){var i=n._tree,r=Array.from(i.keys());this.set=n,this._type=t,this._path=r.length>0?[{node:i,keys:r}]:[]}return e.prototype.next=function(){var n=this.dive();return this.backtrack(),n},e.prototype.dive=function(){if(this._path.length===0)return{done:!0,value:void 0};var n=_t(this._path),t=n.node,i=n.keys;if(_t(i)===ce)return{done:!1,value:this.result()};var r=t.get(_t(i));return this._path.push({node:r,keys:Array.from(r.keys())}),this.dive()},e.prototype.backtrack=function(){if(this._path.length!==0){var n=_t(this._path).keys;n.pop(),!(n.length>0)&&(this._path.pop(),this.backtrack())}},e.prototype.key=function(){return this.set._prefix+this._path.map(function(n){var t=n.keys;return _t(t)}).filter(function(n){return n!==ce}).join("")},e.prototype.value=function(){return _t(this._path).node.get(ce)},e.prototype.result=function(){switch(this._type){case ao:return this.value();case ro:return this.key();default:return[this.key(),this.value()]}},e.prototype[Symbol.iterator]=function(){return this},e}(),_t=function(e){return e[e.length-1]},bu=function(e,n,t){var i=new Map;if(n===void 0)return i;for(var r=n.length+1,a=r+t,o=new Uint8Array(a*r).fill(t+1),s=0;s<r;++s)o[s]=s;for(var l=1;l<a;++l)o[l*r]=l;return oo(e,n,t,i,o,1,r,""),i},oo=function(e,n,t,i,r,a,o,s){var l,c,u=a*o;try{e:for(var d=U(e.keys()),m=d.next();!m.done;m=d.next()){var p=m.value;if(p===ce){var f=r[u-1];f<=t&&i.set(s,[e.get(p),f])}else{for(var _=a,E=0;E<p.length;++E,++_){for(var y=p[E],T=o*_,S=T-o,L=r[T],N=Math.max(0,_-t-1),b=Math.min(o-1,_+t),I=N;I<b;++I){var D=y!==n[I],P=r[S+I]+ +D,M=r[S+I+1]+1,H=r[T+I]+1,R=r[T+I+1]=Math.min(P,M,H);R<L&&(L=R)}if(L>t)continue e}oo(e.get(p),n,t,i,r,_,o,s+p)}}}catch(w){l={error:w}}finally{try{m&&!m.done&&(c=d.return)&&c.call(d)}finally{if(l)throw l.error}}},qi=function(){function e(n,t){n===void 0&&(n=new Map),t===void 0&&(t=""),this._size=void 0,this._tree=n,this._prefix=t}return e.prototype.atPrefix=function(n){var t,i;if(!n.startsWith(this._prefix))throw new Error("Mismatched prefix");var r=ee(kn(this._tree,n.slice(this._prefix.length)),2),a=r[0],o=r[1];if(a===void 0){var s=ee(er(o),2),l=s[0],c=s[1];try{for(var u=U(l.keys()),d=u.next();!d.done;d=u.next()){var m=d.value;if(m!==ce&&m.startsWith(c)){var p=new Map;return p.set(m.slice(c.length),l.get(m)),new e(p,n)}}}catch(f){t={error:f}}finally{try{d&&!d.done&&(i=u.return)&&i.call(u)}finally{if(t)throw t.error}}}return new e(a,n)},e.prototype.clear=function(){this._size=void 0,this._tree.clear()},e.prototype.delete=function(n){return this._size=void 0,vu(this._tree,n)},e.prototype.entries=function(){return new ji(this,yu)},e.prototype.forEach=function(n){var t,i;try{for(var r=U(this),a=r.next();!a.done;a=r.next()){var o=ee(a.value,2),s=o[0],l=o[1];n(s,l,this)}}catch(c){t={error:c}}finally{try{a&&!a.done&&(i=r.return)&&i.call(r)}finally{if(t)throw t.error}}},e.prototype.fuzzyGet=function(n,t){return bu(this._tree,n,t)},e.prototype.get=function(n){var t=Zi(this._tree,n);return t!==void 0?t.get(ce):void 0},e.prototype.has=function(n){var t=Zi(this._tree,n);return t!==void 0&&t.has(ce)},e.prototype.keys=function(){return new ji(this,ro)},e.prototype.set=function(n,t){if(typeof n!="string")throw new Error("key must be a string");this._size=void 0;var i=Ki(this._tree,n);return i.set(ce,t),this},Object.defineProperty(e.prototype,"size",{get:function(){if(this._size)return this._size;this._size=0;for(var n=this.entries();!n.next().done;)this._size+=1;return this._size},enumerable:!1,configurable:!0}),e.prototype.update=function(n,t){if(typeof n!="string")throw new Error("key must be a string");this._size=void 0;var i=Ki(this._tree,n);return i.set(ce,t(i.get(ce))),this},e.prototype.fetch=function(n,t){if(typeof n!="string")throw new Error("key must be a string");this._size=void 0;var i=Ki(this._tree,n),r=i.get(ce);return r===void 0&&i.set(ce,r=t()),r},e.prototype.values=function(){return new ji(this,ao)},e.prototype[Symbol.iterator]=function(){return this.entries()},e.from=function(n){var t,i,r=new e;try{for(var a=U(n),o=a.next();!o.done;o=a.next()){var s=ee(o.value,2),l=s[0],c=s[1];r.set(l,c)}}catch(u){t={error:u}}finally{try{o&&!o.done&&(i=a.return)&&i.call(a)}finally{if(t)throw t.error}}return r},e.fromObject=function(n){return e.from(Object.entries(n))},e}(),kn=function(e,n,t){var i,r;if(t===void 0&&(t=[]),n.length===0||e==null)return[e,t];try{for(var a=U(e.keys()),o=a.next();!o.done;o=a.next()){var s=o.value;if(s!==ce&&n.startsWith(s))return t.push([e,s]),kn(e.get(s),n.slice(s.length),t)}}catch(l){i={error:l}}finally{try{o&&!o.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return t.push([e,n]),kn(void 0,"",t)},Zi=function(e,n){var t,i;if(n.length===0||e==null)return e;try{for(var r=U(e.keys()),a=r.next();!a.done;a=r.next()){var o=a.value;if(o!==ce&&n.startsWith(o))return Zi(e.get(o),n.slice(o.length))}}catch(s){t={error:s}}finally{try{a&&!a.done&&(i=r.return)&&i.call(r)}finally{if(t)throw t.error}}},Ki=function(e,n){var t,i,r=n.length;e:for(var a=0;e&&a<r;){try{for(var o=(t=void 0,U(e.keys())),s=o.next();!s.done;s=o.next()){var l=s.value;if(l!==ce&&n[a]===l[0]){for(var c=Math.min(r-a,l.length),u=1;u<c&&n[a+u]===l[u];)++u;var d=e.get(l);if(u===l.length)e=d;else{var m=new Map;m.set(l.slice(u),d),e.set(n.slice(a,a+u),m),e.delete(l),e=m}a+=u;continue e}}}catch(f){t={error:f}}finally{try{s&&!s.done&&(i=o.return)&&i.call(o)}finally{if(t)throw t.error}}var p=new Map;return e.set(n.slice(a),p),p}return e},vu=function(e,n){var t=ee(kn(e,n),2),i=t[0],r=t[1];if(i!==void 0){if(i.delete(ce),i.size===0)so(r);else if(i.size===1){var a=ee(i.entries().next().value,2),o=a[0],s=a[1];lo(r,o,s)}}},so=function(e){if(e.length!==0){var n=ee(er(e),2),t=n[0],i=n[1];if(t.delete(i),t.size===0)so(e.slice(0,-1));else if(t.size===1){var r=ee(t.entries().next().value,2),a=r[0],o=r[1];a!==ce&&lo(e.slice(0,-1),a,o)}}},lo=function(e,n,t){if(e.length!==0){var i=ee(er(e),2),r=i[0],a=i[1];r.set(a+n,t),r.delete(a)}},er=function(e){return e[e.length-1]},Bt,tr="or",co="and",_u="and_not",uo=function(){function e(n){if(n?.fields==null)throw new Error('MiniSearch: option "fields" must be provided');var t=n.autoVacuum==null||n.autoVacuum===!0?Ji:n.autoVacuum;this._options=Z(Z(Z({},Yi),n),{autoVacuum:t,searchOptions:Z(Z({},eo),n.searchOptions||{}),autoSuggestOptions:Z(Z({},wu),n.autoSuggestOptions||{})}),this._index=new qi,this._documentCount=0,this._documentIds=new Map,this._idToShortId=new Map,this._fieldIds={},this._fieldLength=new Map,this._avgFieldLength=[],this._nextId=0,this._storedFields=new Map,this._dirtCount=0,this._currentVacuum=null,this._enqueuedVacuum=null,this._enqueuedVacuumConditions=Qi,this.addFields(this._options.fields)}return e.prototype.add=function(n){var t,i,r,a,o,s,l=this._options,c=l.extractField,u=l.tokenize,d=l.processTerm,m=l.fields,p=l.idField,f=c(n,p);if(f==null)throw new Error('MiniSearch: document does not have ID field "'.concat(p,'"'));if(this._idToShortId.has(f))throw new Error("MiniSearch: duplicate ID ".concat(f));var _=this.addDocumentId(f);this.saveStoredFields(_,n);try{for(var E=U(m),y=E.next();!y.done;y=E.next()){var T=y.value,S=c(n,T);if(S!=null){var L=u(S.toString(),T),N=this._fieldIds[T],b=new Set(L).size;this.addFieldLength(_,N,this._documentCount-1,b);try{for(var I=(r=void 0,U(L)),D=I.next();!D.done;D=I.next()){var P=D.value,M=d(P,T);if(Array.isArray(M))try{for(var H=(o=void 0,U(M)),R=H.next();!R.done;R=H.next()){var w=R.value;this.addTerm(N,_,w)}}catch(x){o={error:x}}finally{try{R&&!R.done&&(s=H.return)&&s.call(H)}finally{if(o)throw o.error}}else M&&this.addTerm(N,_,M)}}catch(x){r={error:x}}finally{try{D&&!D.done&&(a=I.return)&&a.call(I)}finally{if(r)throw r.error}}}}}catch(x){t={error:x}}finally{try{y&&!y.done&&(i=E.return)&&i.call(E)}finally{if(t)throw t.error}}},e.prototype.addAll=function(n){var t,i;try{for(var r=U(n),a=r.next();!a.done;a=r.next()){var o=a.value;this.add(o)}}catch(s){t={error:s}}finally{try{a&&!a.done&&(i=r.return)&&i.call(r)}finally{if(t)throw t.error}}},e.prototype.addAllAsync=function(n,t){var i=this;t===void 0&&(t={});var r=t.chunkSize,a=r===void 0?10:r,o={chunk:[],promise:Promise.resolve()},s=n.reduce(function(u,d,m){var p=u.chunk,f=u.promise;return p.push(d),(m+1)%a===0?{chunk:[],promise:f.then(function(){return new Promise(function(_){return setTimeout(_,0)})}).then(function(){return i.addAll(p)})}:{chunk:p,promise:f}},o),l=s.chunk,c=s.promise;return c.then(function(){return i.addAll(l)})},e.prototype.remove=function(n){var t,i,r,a,o,s,l=this._options,c=l.tokenize,u=l.processTerm,d=l.extractField,m=l.fields,p=l.idField,f=d(n,p);if(f==null)throw new Error('MiniSearch: document does not have ID field "'.concat(p,'"'));var _=this._idToShortId.get(f);if(_==null)throw new Error("MiniSearch: cannot remove document with ID ".concat(f,": it is not in the index"));try{for(var E=U(m),y=E.next();!y.done;y=E.next()){var T=y.value,S=d(n,T);if(S!=null){var L=c(S.toString(),T),N=this._fieldIds[T],b=new Set(L).size;this.removeFieldLength(_,N,this._documentCount,b);try{for(var I=(r=void 0,U(L)),D=I.next();!D.done;D=I.next()){var P=D.value,M=u(P,T);if(Array.isArray(M))try{for(var H=(o=void 0,U(M)),R=H.next();!R.done;R=H.next()){var w=R.value;this.removeTerm(N,_,w)}}catch(x){o={error:x}}finally{try{R&&!R.done&&(s=H.return)&&s.call(H)}finally{if(o)throw o.error}}else M&&this.removeTerm(N,_,M)}}catch(x){r={error:x}}finally{try{D&&!D.done&&(a=I.return)&&a.call(I)}finally{if(r)throw r.error}}}}}catch(x){t={error:x}}finally{try{y&&!y.done&&(i=E.return)&&i.call(E)}finally{if(t)throw t.error}}this._storedFields.delete(_),this._documentIds.delete(_),this._idToShortId.delete(f),this._fieldLength.delete(_),this._documentCount-=1},e.prototype.removeAll=function(n){var t,i;if(n)try{for(var r=U(n),a=r.next();!a.done;a=r.next()){var o=a.value;this.remove(o)}}catch(s){t={error:s}}finally{try{a&&!a.done&&(i=r.return)&&i.call(r)}finally{if(t)throw t.error}}else{if(arguments.length>0)throw new Error("Expected documents to be present. Omit the argument to remove all documents.");this._index=new qi,this._documentCount=0,this._documentIds=new Map,this._idToShortId=new Map,this._fieldLength=new Map,this._avgFieldLength=[],this._storedFields=new Map,this._nextId=0}},e.prototype.discard=function(n){var t=this,i=this._idToShortId.get(n);if(i==null)throw new Error("MiniSearch: cannot discard document with ID ".concat(n,": it is not in the index"));this._idToShortId.delete(n),this._documentIds.delete(i),this._storedFields.delete(i),(this._fieldLength.get(i)||[]).forEach(function(r,a){t.removeFieldLength(i,a,t._documentCount,r)}),this._fieldLength.delete(i),this._documentCount-=1,this._dirtCount+=1,this.maybeAutoVacuum()},e.prototype.maybeAutoVacuum=function(){if(this._options.autoVacuum!==!1){var n=this._options.autoVacuum,t=n.minDirtFactor,i=n.minDirtCount,r=n.batchSize,a=n.batchWait;this.conditionalVacuum({batchSize:r,batchWait:a},{minDirtCount:i,minDirtFactor:t})}},e.prototype.discardAll=function(n){var t,i,r=this._options.autoVacuum;try{this._options.autoVacuum=!1;try{for(var a=U(n),o=a.next();!o.done;o=a.next()){var s=o.value;this.discard(s)}}catch(l){t={error:l}}finally{try{o&&!o.done&&(i=a.return)&&i.call(a)}finally{if(t)throw t.error}}}finally{this._options.autoVacuum=r}this.maybeAutoVacuum()},e.prototype.replace=function(n){var t=this._options,i=t.idField,r=t.extractField,a=r(n,i);this.discard(a),this.add(n)},e.prototype.vacuum=function(n){return n===void 0&&(n={}),this.conditionalVacuum(n)},e.prototype.conditionalVacuum=function(n,t){var i=this;return this._currentVacuum?(this._enqueuedVacuumConditions=this._enqueuedVacuumConditions&&t,this._enqueuedVacuum!=null?this._enqueuedVacuum:(this._enqueuedVacuum=this._currentVacuum.then(function(){var r=i._enqueuedVacuumConditions;return i._enqueuedVacuumConditions=Qi,i.performVacuuming(n,r)}),this._enqueuedVacuum)):this.vacuumConditionsMet(t)===!1?Promise.resolve():(this._currentVacuum=this.performVacuuming(n),this._currentVacuum)},e.prototype.performVacuuming=function(n,t){return hu(this,void 0,void 0,function(){var i,r,a,o,s,l,c,u,d,m,p,f,_,E,y,T,S,L,N,b,I,D,P,M,H;return fu(this,function(R){switch(R.label){case 0:if(i=this._dirtCount,!this.vacuumConditionsMet(t))return[3,10];r=n.batchSize||$i.batchSize,a=n.batchWait||$i.batchWait,o=1,R.label=1;case 1:R.trys.push([1,7,8,9]),s=U(this._index),l=s.next(),R.label=2;case 2:if(l.done)return[3,6];c=ee(l.value,2),u=c[0],d=c[1];try{for(m=(D=void 0,U(d)),p=m.next();!p.done;p=m.next()){f=ee(p.value,2),_=f[0],E=f[1];try{for(y=(M=void 0,U(E)),T=y.next();!T.done;T=y.next())S=ee(T.value,1),L=S[0],!this._documentIds.has(L)&&(E.size<=1?d.delete(_):E.delete(L))}catch(w){M={error:w}}finally{try{T&&!T.done&&(H=y.return)&&H.call(y)}finally{if(M)throw M.error}}}}catch(w){D={error:w}}finally{try{p&&!p.done&&(P=m.return)&&P.call(m)}finally{if(D)throw D.error}}return this._index.get(u).size===0&&this._index.delete(u),o%r!==0?[3,4]:[4,new Promise(function(w){return setTimeout(w,a)})];case 3:R.sent(),R.label=4;case 4:o+=1,R.label=5;case 5:return l=s.next(),[3,2];case 6:return[3,9];case 7:return N=R.sent(),b={error:N},[3,9];case 8:try{l&&!l.done&&(I=s.return)&&I.call(s)}finally{if(b)throw b.error}return[7];case 9:this._dirtCount-=i,R.label=10;case 10:return[4,null];case 11:return R.sent(),this._currentVacuum=this._enqueuedVacuum,this._enqueuedVacuum=null,[2]}})})},e.prototype.vacuumConditionsMet=function(n){if(n==null)return!0;var t=n.minDirtCount,i=n.minDirtFactor;return t=t||Ji.minDirtCount,i=i||Ji.minDirtFactor,this.dirtCount>=t&&this.dirtFactor>=i},Object.defineProperty(e.prototype,"isVacuuming",{get:function(){return this._currentVacuum!=null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"dirtCount",{get:function(){return this._dirtCount},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"dirtFactor",{get:function(){return this._dirtCount/(1+this._documentCount+this._dirtCount)},enumerable:!1,configurable:!0}),e.prototype.has=function(n){return this._idToShortId.has(n)},e.prototype.getStoredFields=function(n){var t=this._idToShortId.get(n);if(t!=null)return this._storedFields.get(t)},e.prototype.search=function(n,t){var i,r;t===void 0&&(t={});var a=this.executeQuery(n,t),o=[];try{for(var s=U(a),l=s.next();!l.done;l=s.next()){var c=ee(l.value,2),u=c[0],d=c[1],m=d.score,p=d.terms,f=d.match,_=p.length||1,E={id:this._documentIds.get(u),score:m*_,terms:Object.keys(f),queryTerms:p,match:f};Object.assign(E,this._storedFields.get(u)),(t.filter==null||t.filter(E))&&o.push(E)}}catch(y){i={error:y}}finally{try{l&&!l.done&&(r=s.return)&&r.call(s)}finally{if(i)throw i.error}}return n===e.wildcard&&t.boostDocument==null&&this._options.searchOptions.boostDocument==null||o.sort(no),o},e.prototype.autoSuggest=function(n,t){var i,r,a,o;t===void 0&&(t={}),t=Z(Z({},this._options.autoSuggestOptions),t);var s=new Map;try{for(var l=U(this.search(n,t)),c=l.next();!c.done;c=l.next()){var u=c.value,d=u.score,m=u.terms,p=m.join(" "),f=s.get(p);f!=null?(f.score+=d,f.count+=1):s.set(p,{score:d,terms:m,count:1})}}catch(N){i={error:N}}finally{try{c&&!c.done&&(r=l.return)&&r.call(l)}finally{if(i)throw i.error}}var _=[];try{for(var E=U(s),y=E.next();!y.done;y=E.next()){var T=ee(y.value,2),f=T[0],S=T[1],d=S.score,m=S.terms,L=S.count;_.push({suggestion:f,terms:m,score:d/L})}}catch(N){a={error:N}}finally{try{y&&!y.done&&(o=E.return)&&o.call(E)}finally{if(a)throw a.error}}return _.sort(no),_},Object.defineProperty(e.prototype,"documentCount",{get:function(){return this._documentCount},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"termCount",{get:function(){return this._index.size},enumerable:!1,configurable:!0}),e.loadJSON=function(n,t){if(t==null)throw new Error("MiniSearch: loadJSON should be given the same options used when serializing the index");return this.loadJS(JSON.parse(n),t)},e.getDefault=function(n){if(Yi.hasOwnProperty(n))return Xi(Yi,n);throw new Error('MiniSearch: unknown option "'.concat(n,'"'))},e.loadJS=function(n,t){var i,r,a,o,s,l,c=n.index,u=n.documentCount,d=n.nextId,m=n.documentIds,p=n.fieldIds,f=n.fieldLength,_=n.averageFieldLength,E=n.storedFields,y=n.dirtCount,T=n.serializationVersion;if(T!==1&&T!==2)throw new Error("MiniSearch: cannot deserialize an index created with an incompatible version");var S=new e(t);S._documentCount=u,S._nextId=d,S._documentIds=Cn(m),S._idToShortId=new Map,S._fieldIds=p,S._fieldLength=Cn(f),S._avgFieldLength=_,S._storedFields=Cn(E),S._dirtCount=y||0,S._index=new qi;try{for(var L=U(S._documentIds),N=L.next();!N.done;N=L.next()){var b=ee(N.value,2),I=b[0],D=b[1];S._idToShortId.set(D,I)}}catch(ie){i={error:ie}}finally{try{N&&!N.done&&(r=L.return)&&r.call(L)}finally{if(i)throw i.error}}try{for(var P=U(c),M=P.next();!M.done;M=P.next()){var H=ee(M.value,2),R=H[0],w=H[1],x=new Map;try{for(var O=(s=void 0,U(Object.keys(w))),j=O.next();!j.done;j=O.next()){var X=j.value,re=w[X];T===1&&(re=re.ds),x.set(parseInt(X,10),Cn(re))}}catch(ie){s={error:ie}}finally{try{j&&!j.done&&(l=O.return)&&l.call(O)}finally{if(s)throw s.error}}S._index.set(R,x)}}catch(ie){a={error:ie}}finally{try{M&&!M.done&&(o=P.return)&&o.call(P)}finally{if(a)throw a.error}}return S},e.prototype.executeQuery=function(n,t){var i=this;if(t===void 0&&(t={}),n===e.wildcard)return this.executeWildcardQuery(t);if(typeof n!="string"){var r=Z(Z(Z({},t),n),{queries:void 0}),a=n.queries.map(function(E){return i.executeQuery(E,r)});return this.combineResults(a,r.combineWith)}var o=this._options,s=o.tokenize,l=o.processTerm,c=o.searchOptions,u=Z(Z({tokenize:s,processTerm:l},c),t),d=u.tokenize,m=u.processTerm,p=d(n).flatMap(function(E){return m(E)}).filter(function(E){return!!E}),f=p.map(ku(u)),_=f.map(function(E){return i.executeQuerySpec(E,u)});return this.combineResults(_,u.combineWith)},e.prototype.executeQuerySpec=function(n,t){var i,r,a,o,s=Z(Z({},this._options.searchOptions),t),l=(s.fields||this._options.fields).reduce(function(X,re){var ie;return Z(Z({},X),(ie={},ie[re]=Xi(s.boost,re)||1,ie))},{}),c=s.boostDocument,u=s.weights,d=s.maxFuzzy,m=s.bm25,p=Z(Z({},eo.weights),u),f=p.fuzzy,_=p.prefix,E=this._index.get(n.term),y=this.termResults(n.term,n.term,1,E,l,c,m),T,S;if(n.prefix&&(T=this._index.atPrefix(n.term)),n.fuzzy){var L=n.fuzzy===!0?.2:n.fuzzy,N=L<1?Math.min(d,Math.round(n.term.length*L)):L;N&&(S=this._index.fuzzyGet(n.term,N))}if(T)try{for(var b=U(T),I=b.next();!I.done;I=b.next()){var D=ee(I.value,2),P=D[0],M=D[1],H=P.length-n.term.length;if(H){S?.delete(P);var R=_*P.length/(P.length+.3*H);this.termResults(n.term,P,R,M,l,c,m,y)}}}catch(X){i={error:X}}finally{try{I&&!I.done&&(r=b.return)&&r.call(b)}finally{if(i)throw i.error}}if(S)try{for(var w=U(S.keys()),x=w.next();!x.done;x=w.next()){var P=x.value,O=ee(S.get(P),2),j=O[0],H=O[1];if(H){var R=f*P.length/(P.length+H);this.termResults(n.term,P,R,j,l,c,m,y)}}}catch(X){a={error:X}}finally{try{x&&!x.done&&(o=w.return)&&o.call(w)}finally{if(a)throw a.error}}return y},e.prototype.executeWildcardQuery=function(n){var t,i,r=new Map,a=Z(Z({},this._options.searchOptions),n);try{for(var o=U(this._documentIds),s=o.next();!s.done;s=o.next()){var l=ee(s.value,2),c=l[0],u=l[1],d=a.boostDocument?a.boostDocument(u,"",this._storedFields.get(c)):1;r.set(c,{score:d,terms:[],match:{}})}}catch(m){t={error:m}}finally{try{s&&!s.done&&(i=o.return)&&i.call(o)}finally{if(t)throw t.error}}return r},e.prototype.combineResults=function(n,t){if(t===void 0&&(t=tr),n.length===0)return new Map;var i=t.toLowerCase();return n.reduce(Su[i])||new Map},e.prototype.toJSON=function(){var n,t,i,r,a=[];try{for(var o=U(this._index),s=o.next();!s.done;s=o.next()){var l=ee(s.value,2),c=l[0],u=l[1],d={};try{for(var m=(i=void 0,U(u)),p=m.next();!p.done;p=m.next()){var f=ee(p.value,2),_=f[0],E=f[1];d[_]=Object.fromEntries(E)}}catch(y){i={error:y}}finally{try{p&&!p.done&&(r=m.return)&&r.call(m)}finally{if(i)throw i.error}}a.push([c,d])}}catch(y){n={error:y}}finally{try{s&&!s.done&&(t=o.return)&&t.call(o)}finally{if(n)throw n.error}}return{documentCount:this._documentCount,nextId:this._nextId,documentIds:Object.fromEntries(this._documentIds),fieldIds:this._fieldIds,fieldLength:Object.fromEntries(this._fieldLength),averageFieldLength:this._avgFieldLength,storedFields:Object.fromEntries(this._storedFields),dirtCount:this._dirtCount,index:a,serializationVersion:2}},e.prototype.termResults=function(n,t,i,r,a,o,s,l){var c,u,d,m,p;if(l===void 0&&(l=new Map),r==null)return l;try{for(var f=U(Object.keys(a)),_=f.next();!_.done;_=f.next()){var E=_.value,y=a[E],T=this._fieldIds[E],S=r.get(T);if(S!=null){var L=S.size,N=this._avgFieldLength[T];try{for(var b=(d=void 0,U(S.keys())),I=b.next();!I.done;I=b.next()){var D=I.value;if(!this._documentIds.has(D)){this.removeTerm(T,D,t),L-=1;continue}var P=o?o(this._documentIds.get(D),t,this._storedFields.get(D)):1;if(P){var M=S.get(D),H=this._fieldLength.get(D)[T],R=Cu(M,L,this._documentCount,H,N,s),w=i*y*P*R,x=l.get(D);if(x){x.score+=w,Tu(x.terms,n);var O=Xi(x.match,t);O?O.push(E):x.match[t]=[E]}else l.set(D,{score:w,terms:[n],match:(p={},p[t]=[E],p)})}}}catch(j){d={error:j}}finally{try{I&&!I.done&&(m=b.return)&&m.call(b)}finally{if(d)throw d.error}}}}}catch(j){c={error:j}}finally{try{_&&!_.done&&(u=f.return)&&u.call(f)}finally{if(c)throw c.error}}return l},e.prototype.addTerm=function(n,t,i){var r=this._index.fetch(i,io),a=r.get(n);if(a==null)a=new Map,a.set(t,1),r.set(n,a);else{var o=a.get(t);a.set(t,(o||0)+1)}},e.prototype.removeTerm=function(n,t,i){if(!this._index.has(i)){this.warnDocumentChanged(t,n,i);return}var r=this._index.fetch(i,io),a=r.get(n);a==null||a.get(t)==null?this.warnDocumentChanged(t,n,i):a.get(t)<=1?a.size<=1?r.delete(n):a.delete(t):a.set(t,a.get(t)-1),this._index.get(i).size===0&&this._index.delete(i)},e.prototype.warnDocumentChanged=function(n,t,i){var r,a;try{for(var o=U(Object.keys(this._fieldIds)),s=o.next();!s.done;s=o.next()){var l=s.value;if(this._fieldIds[l]===t){this._options.logger("warn","MiniSearch: document with ID ".concat(this._documentIds.get(n),' has changed before removal: term "').concat(i,'" was not present in field "').concat(l,'". Removing a document after it has changed can corrupt the index!'),"version_conflict");return}}}catch(c){r={error:c}}finally{try{s&&!s.done&&(a=o.return)&&a.call(o)}finally{if(r)throw r.error}}},e.prototype.addDocumentId=function(n){var t=this._nextId;return this._idToShortId.set(n,t),this._documentIds.set(t,n),this._documentCount+=1,this._nextId+=1,t},e.prototype.addFields=function(n){for(var t=0;t<n.length;t++)this._fieldIds[n[t]]=t},e.prototype.addFieldLength=function(n,t,i,r){var a=this._fieldLength.get(n);a==null&&this._fieldLength.set(n,a=[]),a[t]=r;var o=this._avgFieldLength[t]||0,s=o*i+r;this._avgFieldLength[t]=s/(i+1)},e.prototype.removeFieldLength=function(n,t,i,r){if(i===1){this._avgFieldLength[t]=0;return}var a=this._avgFieldLength[t]*i-r;this._avgFieldLength[t]=a/(i-1)},e.prototype.saveStoredFields=function(n,t){var i,r,a=this._options,o=a.storeFields,s=a.extractField;if(!(o==null||o.length===0)){var l=this._storedFields.get(n);l==null&&this._storedFields.set(n,l={});try{for(var c=U(o),u=c.next();!u.done;u=c.next()){var d=u.value,m=s(t,d);m!==void 0&&(l[d]=m)}}catch(p){i={error:p}}finally{try{u&&!u.done&&(r=c.return)&&r.call(c)}finally{if(i)throw i.error}}}},e.wildcard=Symbol("*"),e}(),Xi=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)?e[n]:void 0},Su=(Bt={},Bt[tr]=function(e,n){var t,i;try{for(var r=U(n.keys()),a=r.next();!a.done;a=r.next()){var o=a.value,s=e.get(o);if(s==null)e.set(o,n.get(o));else{var l=n.get(o),c=l.score,u=l.terms,d=l.match;s.score=s.score+c,s.match=Object.assign(s.match,d),to(s.terms,u)}}}catch(m){t={error:m}}finally{try{a&&!a.done&&(i=r.return)&&i.call(r)}finally{if(t)throw t.error}}return e},Bt[co]=function(e,n){var t,i,r=new Map;try{for(var a=U(n.keys()),o=a.next();!o.done;o=a.next()){var s=o.value,l=e.get(s);if(l!=null){var c=n.get(s),u=c.score,d=c.terms,m=c.match;to(l.terms,d),r.set(s,{score:l.score+u,terms:l.terms,match:Object.assign(l.match,m)})}}}catch(p){t={error:p}}finally{try{o&&!o.done&&(i=a.return)&&i.call(a)}finally{if(t)throw t.error}}return r},Bt[_u]=function(e,n){var t,i;try{for(var r=U(n.keys()),a=r.next();!a.done;a=r.next()){var o=a.value;e.delete(o)}}catch(s){t={error:s}}finally{try{a&&!a.done&&(i=r.return)&&i.call(r)}finally{if(t)throw t.error}}return e},Bt),Eu={k:1.2,b:.7,d:.5},Cu=function(e,n,t,i,r,a){var o=a.k,s=a.b,l=a.d,c=Math.log(1+(t-n+.5)/(n+.5));return c*(l+e*(o+1)/(e+o*(1-s+s*i/r)))},ku=function(e){return function(n,t,i){var r=typeof e.fuzzy=="function"?e.fuzzy(n,t,i):e.fuzzy||!1,a=typeof e.prefix=="function"?e.prefix(n,t,i):e.prefix===!0;return{term:n,fuzzy:r,prefix:a}}},Yi={idField:"id",extractField:function(e,n){return e[n]},tokenize:function(e){return e.split(Au)},processTerm:function(e){return e.toLowerCase()},fields:void 0,searchOptions:void 0,storeFields:[],logger:function(e,n){typeof console?.[e]=="function"&&console[e](n)},autoVacuum:!0},eo={combineWith:tr,prefix:!1,fuzzy:!1,maxFuzzy:6,boost:{},weights:{fuzzy:.45,prefix:.375},bm25:Eu},wu={combineWith:co,prefix:function(e,n,t){return n===t.length-1}},$i={batchSize:1e3,batchWait:10},Qi={minDirtFactor:.1,minDirtCount:20},Ji=Z(Z({},$i),Qi),Tu=function(e,n){e.includes(n)||e.push(n)},to=function(e,n){var t,i;try{for(var r=U(n),a=r.next();!a.done;a=r.next()){var o=a.value;e.includes(o)||e.push(o)}}catch(s){t={error:s}}finally{try{a&&!a.done&&(i=r.return)&&i.call(r)}finally{if(t)throw t.error}}},no=function(e,n){var t=e.score,i=n.score;return i-t},io=function(){return new Map},Cn=function(e){var n,t,i=new Map;try{for(var r=U(Object.keys(e)),a=r.next();!a.done;a=r.next()){var o=a.value;i.set(parseInt(o,10),e[o])}}catch(s){n={error:s}}finally{try{a&&!a.done&&(t=r.return)&&t.call(r)}finally{if(n)throw n.error}}return i},Au=/[\n\r -#%-*,-/:;?@[-\]_{}\u00A0\u00A1\u00A7\u00AB\u00B6\u00B7\u00BB\u00BF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u1680\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2000-\u200A\u2010-\u2029\u202F-\u2043\u2045-\u2051\u2053-\u205F\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u3000-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]+/u;var po=[{id:"search",type:"action",name:"Search the knowledge base.",content:"Search the knowledge base for information, actions, tools, tours, UI elements, etc. Use this on EVERY request if you don't have information. If the user asks for personal information, use this. If the user asks you to do something, use this to find the tool you need.",isContext:!0,removeFromMessageHistory:!0,parameters:[{name:"query",type:"string",description:"The search query"}],action:async(e,n)=>{let t=await n.knowledgeBase.search(e.query),i=n;i._lastKBsearch=e.query,i._nextRequestUseKBitems=t,n.submitAnalyticsEvent({type:"kb-search",query:e.query,results:t});let r=t.filter(o=>o.type!="action").map(o=>"id="+o.id).join(", ")||"(none)",a=t.filter(o=>o.type=="action").map(o=>"name="+o._functionID).join(", ")||"(none)";return`Search complete, context has been updated. New info entries found: ${r}. New tools available: ${a}.`}}];var tt=new q("KnowledgeBase"),mo=1,wn=class e{constructor(n){this._sources=[{id:"core.internal",query:async()=>po}];this._windowSources=[];this.lastResults=[];this.manualEntries=[];this.ai=n}registerSource(n,t){let i=n;return typeof n=="function"&&(t=n,i=`source.${mo++}`),this._sources.push({id:i,query:t}),i}removeSource(n){this._sources=this.sources.filter(t=>t.id!==n&&t.query!==n)}addEntry(n){this.manualEntries.push(n)}removeEntry(n){this.manualEntries=this.manualEntries.filter(t=>t.id!==n)}get sources(){let n=this._sources;return $().knowledgeBaseSources&&(n=n.concat($().knowledgeBaseSources)),n=n.concat(this._windowSources),n=n.filter(t=>!t.disabled),n}async search(n){tt.debug(`Searching knowledge base for: ${n}`);let t=new Event("webweaver_kb_search",{bubbles:!0,cancelable:!0});t.query=n,t.entries=[],t.sources=[],typeof document<"u"&&document.dispatchEvent(t),this._windowSources=t.sources;let r=(await Promise.all(this.sources.map(async l=>{try{let c=Date.now(),u=await l.query(n);return tt.debug(`Source '${l.id}' took ${Date.now()-c}ms`),u||[]}catch(c){return tt.warn(`Knowledge source '${l.id}' failed:`,c),[]}}))).flat();r=r.concat(t.entries),r=r.concat(this.manualEntries),$().knowledgeBase&&(r=r.concat($().knowledgeBase)),r=r.filter(l=>l&&!l.disabled);for(let l=0;l<r.length;l++){let c=r[l];if(c.id=c.id||`temp.${l}`,c._functionID=c.id.replaceAll(/[^a-zA-Z0-9_]/g,"_"),!c.action&&c.type=="tour"&&(c.action=u=>{throw new Error("This tour does not have an action. You must perform the tour content manually.")}),!c.action&&c.type=="info"&&(c.action=u=>{throw new Error("This item does not have an action. Use the content to provide information to the user instead.")}),c.parameters&&!Array.isArray(c.parameters)){let u=c.parameters,d=[];for(let m in u)d.push({name:m,type:"string",description:c.parameters[m]});c.parameters=d}}let a=new uo({fields:["id","type","name","content","tags"],storeFields:[],searchOptions:{boost:{name:3,tags:2},fuzzy:.2}});a.addAll(r);let s=a.search(n).map(l=>r.find(c=>c.id==l.id));for(let l of r)l.isContext&&(s.find(c=>c.id===l.id)||s.push(l));return this.lastResults=s,tt.debug("Found results:",s),s}getCachedEntry(n){return this.lastResults.find(t=>t.id==n||t._functionID==n)}registerSourceFromURL(n,t){t||(t=`external.${mo++}`),tt.debug(`Registering remote knowledge base source: ${n}`);let i=[],r=[],a=!0,o=async(l,c)=>{tt.debug(`Calling remote knowledge base action: ${l.id}`);let u={type:"action",userID:this.ai.userID,extra:this.ai.extra,actionID:l.id,parameters:c},d=await fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(u)});if(!d.ok)throw new Error(`HTTP Error ${d.status} ${d.statusText}`);let m=await d.json();return s(m.updateItems||[]),m.response},s=l=>{for(let c of l){if(!c.id){tt.warn("KB item skipped since it has no ID.",c);continue}let u=i.find(d=>d.id==c.id);if(u){u.name=c.name||u.name||"",u.content=c.content||u.content||"",u.disabled=c.disabled??u.disabled,u.isContext=c.isContext??u.isContext,u.parameters=c.parameters||u.parameters||[],u.tags=c.tags||u.tags,u.type=c.type||u.type;continue}i.push({...c,action:d=>o(c,d)})}};this.registerSource(t,async l=>{if(a&&r.includes(l))return i;let c={type:"search",userID:this.ai?.userID||"",extra:this.ai?.extra||{},query:l},u=await fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)});if(!u.ok)throw new Error(`HTTP Error ${u.status} ${u.statusText}`);let d=await u.json();return a=!d.noCache,r.includes(l)||r.push(l),s(d.items),i})}clone(){let n=new e(this.ai);return n._sources=this._sources,n._windowSources=this._windowSources,n.manualEntries=this.manualEntries,n}};var go={name:"@intelliweave/embedded",version:"1.7.59",description:"Integrate IntelliWeave into your app or website.",main:"./dist/webpack/index.js",types:"./dist/webpack/index.d.ts",type:"module",exports:{".":"./dist/webpack/index.js","./component":"./dist/component/component.js","./node":"./dist/node/node.js","./react":"./dist/react/react.js","./webpack":"./dist/webpack/index.js"},scripts:{build:"npm run build:lib && npm run build:docs","build:lib":"tsx build.ts","build:dev":"cross-env DEVELOPMENT=1 npm run build","build:docs":"typedoc src/index.mts --out dist/docs/",deploy:'npm run build && gsutil cp ./dist/web-weaver.min.js gs://metapress-cdn/web-weaver.min.js && gcloud compute url-maps invalidate-cdn-cache mp-cdn-loadbalancer --project="mp-backend-api" --path "/web-weaver.min.js" --async',"start:server":"cd server && npm run start","deploy:server":"cd server && npm run deploy","llm:build":"cd llm-server && docker build -t web-weaver-llm .","llm:start":"npm run llm:build && docker run -it --rm -p 8000:80 --gpus=all web-weaver-llm","llm:deploy.docker":"npm run llm:build && gcloud auth configure-docker us-central1-docker.pkg.dev && docker tag web-weaver-llm us-central1-docker.pkg.dev/ydangle-web-companion/docker-artifacts/web-weaver-llm && docker push us-central1-docker.pkg.dev/ydangle-web-companion/docker-artifacts/web-weaver-llm","llm:deploy":'npm run llm:deploy.docker && gcloud run deploy web-weaver-llm --project=ydangle-web-companion --image=us-central1-docker.pkg.dev/ydangle-web-companion/docker-artifacts/web-weaver-llm --allow-unauthenticated --region=us-central1 --description="Web Weaver LLM" --concurrency=2 --min-instances=0 --timeout=5m --memory=16Gi --cpu=8',prepack:"npm run build",test:"npm run build && tsx --test"},keywords:["web","weaver","ai","assistant","chat"],author:"jjv360",license:"UNLICENSED",devDependencies:{"@types/audioworklet":"^0.0.64","@types/lodash":"^4.17.13","@types/react":"^18.3.12","@types/uuid":"^10.0.0",bestzip:"^2.2.1","cross-env":"^7.0.3","find-cache-dir":"^5.0.0",lodash:"^4.17.21","onnxruntime-web":"^1.20.0",react:"^18.3.1","replace-in-file":"^8.2.0",tsup:"^8.3.5",tsx:"^4.19.2",typedoc:"^0.27.6"},peerDependencies:{"onnxruntime-web":"^1.20.0",react:"^18 || ^19"},dependencies:{"gpt-tokenizer":"^2.9.0",minisearch:"^6.3.0","rehype-document":"^7.0.3","rehype-external-links":"^3.0.0","rehype-format":"^5.0.0","rehype-stringify":"^10.0.0","remark-parse":"^11.0.0","remark-rehype":"^11.1.0",unified:"^11.0.4","utility-types":"^3.11.0",uuid:"^10.0.0"}};var Tn=class{constructor(n){this.ai=n}async boolean(n,t){let i=this.ai.clone();i.resetConversation(),i.getContextPrefix=async()=>'You will receive a question and some data. Answer the question by replying only with the word "true" or "false".';let r=await i.sendMessage(n+`
3254
+ `),n.createGroup("actions").setItemPadding(25),n.createGroup("messages").setItemPadding(10),n})();this.config={...this.config,...n},this.tokenWindow.size=this.config.maxTokens||4096}get contextGroup(){return this.tokenWindow.group("context")}get toolGroup(){return this.tokenWindow.group("actions")}get messageGroup(){return this.tokenWindow.group("messages")}async sendMessage(n){let t={role:"user",content:n};this.messageGroup.add({id:"msg-"+vt++,content:JSON.stringify(t),customData:t}),await this.processMessages();let r=this.messageGroup.items[this.messageGroup.items.length-1]?.customData;return r?.role=="assistant"&&r.content||""}addAssistantMessage(n){let t={role:"assistant",content:n};this.messageGroup.add({id:"msg-"+vt++,content:JSON.stringify(t),customData:t})}addUserMessage(n){let t={role:"user",content:n};this.messageGroup.add({id:"msg-"+vt++,content:JSON.stringify(t),customData:t})}getMessages(){return this.messageGroup.items.map(n=>n.customData)}getLatestMessage(){return this.messageGroup.items.length?this.messageGroup.items[this.messageGroup.items.length-1]?.customData:void 0}async processMessages(){await this.config.onBeforeMessageProcessing?.(),Ke.debugEnabled&&Ke.debug("Process message state:",{context:this.contextGroup.getAllAsString(),tools:this.toolGroup.getAll().map(i=>i.customData),messages:this.messageGroup.items.map(i=>i.customData),tokens:{used:this.tokenWindow.countTokens(),max:this.tokenWindow.size}});let t=this.messageGroup.items[this.messageGroup.items.length-1]?.customData;if(t?.role=="user"||t?.role=="tool")await this.sendToAPI(),await this.processMessages();else if(t?.role=="assistant"&&t?.tool_calls?.length){for(let i of t.tool_calls)await this.processToolCall(i);await this.processMessages()}}async trimMessages(){for(this.tokenWindow.removeOverflow();this.messageGroup.items.length&&this.messageGroup.items[0].customData?.role=="tool";)this.messageGroup.items.shift()}async sendToAPI(n){this.config.systemMessage&&this.contextGroup.add({id:"_gpt_context",cannotRemove:!0,sortOrder:0,content:this.config.systemMessage}),await this.trimMessages();let t=0;for(let l=this.messageGroup.items.length-1;l>=0;l--){let c=this.messageGroup.items[l].customData;if(c.role=="assistant"&&c.tool_calls){if(t+=1,t>=this.maxToolCallsPerMessage)throw new Error(`Exceeded the maximum tool calls per message limit of ${this.maxToolCallsPerMessage}.`)}else if(c.role=="user")break}Ke.debugEnabled&&Ke.debug("Before LLM state:",{context:this.contextGroup.getAllAsString(),tools:this.toolGroup.getAll().map(l=>l.customData),messages:this.messageGroup.items.map(l=>l.customData),tokens:{used:this.tokenWindow.countTokens(),max:this.tokenWindow.size}});let i={model:this.config.model,temperature:.2,user:this.config.userID,tools:[],stream:!!this.config.stream,max_tokens:1024,messages:[{role:"system",content:this.contextGroup.getAllAsString()},...this.messageGroup.getAll().map(l=>l.customData)]};for(let l of this.toolGroup.getAll()){let c=l.customData;c.description&&c.description.length>1024&&Ke.warn(`Tool description for "${c.name}" is too long, it will be truncated.`);let u={type:"function",function:{name:c.name,description:(c.description||"").substring(0,1024),parameters:{type:"object",properties:{}}}};if(Array.isArray(c.params))for(let d of c.params)u.function.parameters.properties[d.name]={type:d.type,description:d.description};else if(c.params){let d=c.params;for(let m in d)u.function.parameters.properties[m]={type:"string",description:d[m]}}i.tools.push(u)}i.user||delete i.user,i.tools.length||delete i.tools;let r={};if(r["Content-Type"]="application/json",this.config.apiKey&&(r.Authorization=`Bearer ${this.config.apiKey}`),n)return i;let a=await fetch(this.config.endpoint||"https://api.openai.com/v1/chat/completions",{method:"POST",headers:r,body:JSON.stringify(i)});if(!a.ok){let l=`${a.status} ${a.statusText}`;try{let u=await a.json();l=u.errorText||u.error?.message||u.error||l}catch{}let c=new Error(l);throw c.code=a.status,c}let o=null,s=null;if(this.config.stream)for await(let l of Ea(a.body)){if(l.data=="[DONE]")break;if(!l.data)continue;let c=JSON.parse(l.data);if(s){for(let u in c.choices[0].delta)if(typeof c.choices[0].delta[u]=="string"){if(u=="role"&&s[u]==c.choices[0].delta[u])continue;s[u]=(s[u]||"")+c.choices[0].delta[u]}for(let u of c.choices[0].delta.tool_calls||[]){if(s.tool_calls||(s.tool_calls=[]),!s.tool_calls[u.index]){s.tool_calls[u.index]=u;continue}let d=s.tool_calls[u.index];d.function=d.function||{},d.function.name=(d.function.name||"")+(u.function?.name||""),d.function.arguments=(d.function.arguments||"")+(u.function?.arguments||"")}}else s={chunkID:c.id,...c.choices[0].delta};s?.content&&!s.content.startsWith("{")&&this.config.onAIMessage?.(s.content,!0)}else o=await a.json(),this.stats.tokensUsed+=o.usage?.total_tokens||0,Ke.debug(`Used ${o.usage?.total_tokens||0} tokens, total used: ${this.stats.tokensUsed}`),s=o.choices?.[0]?.message;if(s||(Ke.warn("No response block in API response."),s={role:"assistant",content:""}),s.role=="user")throw new Error("API returned a user message, which is not allowed.");this.processIncomingMessage(s),this.messageGroup.add({id:"msg-"+vt++,content:JSON.stringify(s),customData:s}),s.content&&this.config.onAIMessage?.(s.content,!1)}processIncomingMessage(n){}registerTool(n){this.toolGroup.add({id:n.name,cannotRemove:!n.canRemove,content:JSON.stringify(n),customData:n})}async processToolCall(n){try{let i=this.toolGroup.items.find(s=>s.id==n.function.name)?.customData;if(!i)throw new Error(`Tool "${n.function.name}" not found.`);let r=JSON.parse(n.function.arguments);this.config.onAIToolStart?.(n.function.name,r);let a=await i.callback(r);typeof a!="string"&&(a=JSON.stringify(a)||""),(a===""||a==="undefined")&&(a="success");let o={role:"tool",content:a,tool_call_id:n.id};this.messageGroup.add({id:"msg-"+vt++,content:JSON.stringify(o),customData:o})}catch(t){Ke.warn(`Unable to process tool call for "${n?.function?.name}"`,t);let i={role:"tool",content:`Error: ${t.message}`,tool_call_id:n.id};this.messageGroup.add({id:"msg-"+vt++,content:JSON.stringify(i),customData:i})}}resetConversation(){this.messageGroup.empty()}};var Z=function(){return Z=Object.assign||function(n){for(var t,i=1,r=arguments.length;i<r;i++){t=arguments[i];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(n[a]=t[a])}return n},Z.apply(this,arguments)};function hu(e,n,t,i){function r(a){return a instanceof t?a:new t(function(o){o(a)})}return new(t||(t=Promise))(function(a,o){function s(u){try{c(i.next(u))}catch(d){o(d)}}function l(u){try{c(i.throw(u))}catch(d){o(d)}}function c(u){u.done?a(u.value):r(u.value).then(s,l)}c((i=i.apply(e,n||[])).next())})}function fu(e,n){var t={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},i,r,a,o;return o={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function s(c){return function(u){return l([c,u])}}function l(c){if(i)throw new TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(t=0)),t;)try{if(i=1,r&&(a=c[0]&2?r.return:c[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,c[1])).done)return a;switch(r=0,a&&(c=[c[0]&2,a.value]),c[0]){case 0:case 1:a=c;break;case 4:return t.label++,{value:c[1],done:!1};case 5:t.label++,r=c[1],c=[0];continue;case 7:c=t.ops.pop(),t.trys.pop();continue;default:if(a=t.trys,!(a=a.length>0&&a[a.length-1])&&(c[0]===6||c[0]===2)){t=0;continue}if(c[0]===3&&(!a||c[1]>a[0]&&c[1]<a[3])){t.label=c[1];break}if(c[0]===6&&t.label<a[1]){t.label=a[1],a=c;break}if(a&&t.label<a[2]){t.label=a[2],t.ops.push(c);break}a[2]&&t.ops.pop(),t.trys.pop();continue}c=n.call(e,t)}catch(u){c=[6,u],r=0}finally{i=a=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function U(e){var n=typeof Symbol=="function"&&Symbol.iterator,t=n&&e[n],i=0;if(t)return t.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(n?"Object is not iterable.":"Symbol.iterator is not defined.")}function ee(e,n){var t=typeof Symbol=="function"&&e[Symbol.iterator];if(!t)return e;var i=t.call(e),r,a=[],o;try{for(;(n===void 0||n-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(s){o={error:s}}finally{try{r&&!r.done&&(t=i.return)&&t.call(i)}finally{if(o)throw o.error}}return a}var yu="ENTRIES",ro="KEYS",ao="VALUES",ce="",ji=function(){function e(n,t){var i=n._tree,r=Array.from(i.keys());this.set=n,this._type=t,this._path=r.length>0?[{node:i,keys:r}]:[]}return e.prototype.next=function(){var n=this.dive();return this.backtrack(),n},e.prototype.dive=function(){if(this._path.length===0)return{done:!0,value:void 0};var n=_t(this._path),t=n.node,i=n.keys;if(_t(i)===ce)return{done:!1,value:this.result()};var r=t.get(_t(i));return this._path.push({node:r,keys:Array.from(r.keys())}),this.dive()},e.prototype.backtrack=function(){if(this._path.length!==0){var n=_t(this._path).keys;n.pop(),!(n.length>0)&&(this._path.pop(),this.backtrack())}},e.prototype.key=function(){return this.set._prefix+this._path.map(function(n){var t=n.keys;return _t(t)}).filter(function(n){return n!==ce}).join("")},e.prototype.value=function(){return _t(this._path).node.get(ce)},e.prototype.result=function(){switch(this._type){case ao:return this.value();case ro:return this.key();default:return[this.key(),this.value()]}},e.prototype[Symbol.iterator]=function(){return this},e}(),_t=function(e){return e[e.length-1]},bu=function(e,n,t){var i=new Map;if(n===void 0)return i;for(var r=n.length+1,a=r+t,o=new Uint8Array(a*r).fill(t+1),s=0;s<r;++s)o[s]=s;for(var l=1;l<a;++l)o[l*r]=l;return oo(e,n,t,i,o,1,r,""),i},oo=function(e,n,t,i,r,a,o,s){var l,c,u=a*o;try{e:for(var d=U(e.keys()),m=d.next();!m.done;m=d.next()){var p=m.value;if(p===ce){var f=r[u-1];f<=t&&i.set(s,[e.get(p),f])}else{for(var _=a,E=0;E<p.length;++E,++_){for(var y=p[E],T=o*_,S=T-o,N=r[T],L=Math.max(0,_-t-1),b=Math.min(o-1,_+t),I=L;I<b;++I){var D=y!==n[I],P=r[S+I]+ +D,M=r[S+I+1]+1,H=r[T+I]+1,R=r[T+I+1]=Math.min(P,M,H);R<N&&(N=R)}if(N>t)continue e}oo(e.get(p),n,t,i,r,_,o,s+p)}}}catch(w){l={error:w}}finally{try{m&&!m.done&&(c=d.return)&&c.call(d)}finally{if(l)throw l.error}}},qi=function(){function e(n,t){n===void 0&&(n=new Map),t===void 0&&(t=""),this._size=void 0,this._tree=n,this._prefix=t}return e.prototype.atPrefix=function(n){var t,i;if(!n.startsWith(this._prefix))throw new Error("Mismatched prefix");var r=ee(kn(this._tree,n.slice(this._prefix.length)),2),a=r[0],o=r[1];if(a===void 0){var s=ee(er(o),2),l=s[0],c=s[1];try{for(var u=U(l.keys()),d=u.next();!d.done;d=u.next()){var m=d.value;if(m!==ce&&m.startsWith(c)){var p=new Map;return p.set(m.slice(c.length),l.get(m)),new e(p,n)}}}catch(f){t={error:f}}finally{try{d&&!d.done&&(i=u.return)&&i.call(u)}finally{if(t)throw t.error}}}return new e(a,n)},e.prototype.clear=function(){this._size=void 0,this._tree.clear()},e.prototype.delete=function(n){return this._size=void 0,vu(this._tree,n)},e.prototype.entries=function(){return new ji(this,yu)},e.prototype.forEach=function(n){var t,i;try{for(var r=U(this),a=r.next();!a.done;a=r.next()){var o=ee(a.value,2),s=o[0],l=o[1];n(s,l,this)}}catch(c){t={error:c}}finally{try{a&&!a.done&&(i=r.return)&&i.call(r)}finally{if(t)throw t.error}}},e.prototype.fuzzyGet=function(n,t){return bu(this._tree,n,t)},e.prototype.get=function(n){var t=Zi(this._tree,n);return t!==void 0?t.get(ce):void 0},e.prototype.has=function(n){var t=Zi(this._tree,n);return t!==void 0&&t.has(ce)},e.prototype.keys=function(){return new ji(this,ro)},e.prototype.set=function(n,t){if(typeof n!="string")throw new Error("key must be a string");this._size=void 0;var i=Ki(this._tree,n);return i.set(ce,t),this},Object.defineProperty(e.prototype,"size",{get:function(){if(this._size)return this._size;this._size=0;for(var n=this.entries();!n.next().done;)this._size+=1;return this._size},enumerable:!1,configurable:!0}),e.prototype.update=function(n,t){if(typeof n!="string")throw new Error("key must be a string");this._size=void 0;var i=Ki(this._tree,n);return i.set(ce,t(i.get(ce))),this},e.prototype.fetch=function(n,t){if(typeof n!="string")throw new Error("key must be a string");this._size=void 0;var i=Ki(this._tree,n),r=i.get(ce);return r===void 0&&i.set(ce,r=t()),r},e.prototype.values=function(){return new ji(this,ao)},e.prototype[Symbol.iterator]=function(){return this.entries()},e.from=function(n){var t,i,r=new e;try{for(var a=U(n),o=a.next();!o.done;o=a.next()){var s=ee(o.value,2),l=s[0],c=s[1];r.set(l,c)}}catch(u){t={error:u}}finally{try{o&&!o.done&&(i=a.return)&&i.call(a)}finally{if(t)throw t.error}}return r},e.fromObject=function(n){return e.from(Object.entries(n))},e}(),kn=function(e,n,t){var i,r;if(t===void 0&&(t=[]),n.length===0||e==null)return[e,t];try{for(var a=U(e.keys()),o=a.next();!o.done;o=a.next()){var s=o.value;if(s!==ce&&n.startsWith(s))return t.push([e,s]),kn(e.get(s),n.slice(s.length),t)}}catch(l){i={error:l}}finally{try{o&&!o.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return t.push([e,n]),kn(void 0,"",t)},Zi=function(e,n){var t,i;if(n.length===0||e==null)return e;try{for(var r=U(e.keys()),a=r.next();!a.done;a=r.next()){var o=a.value;if(o!==ce&&n.startsWith(o))return Zi(e.get(o),n.slice(o.length))}}catch(s){t={error:s}}finally{try{a&&!a.done&&(i=r.return)&&i.call(r)}finally{if(t)throw t.error}}},Ki=function(e,n){var t,i,r=n.length;e:for(var a=0;e&&a<r;){try{for(var o=(t=void 0,U(e.keys())),s=o.next();!s.done;s=o.next()){var l=s.value;if(l!==ce&&n[a]===l[0]){for(var c=Math.min(r-a,l.length),u=1;u<c&&n[a+u]===l[u];)++u;var d=e.get(l);if(u===l.length)e=d;else{var m=new Map;m.set(l.slice(u),d),e.set(n.slice(a,a+u),m),e.delete(l),e=m}a+=u;continue e}}}catch(f){t={error:f}}finally{try{s&&!s.done&&(i=o.return)&&i.call(o)}finally{if(t)throw t.error}}var p=new Map;return e.set(n.slice(a),p),p}return e},vu=function(e,n){var t=ee(kn(e,n),2),i=t[0],r=t[1];if(i!==void 0){if(i.delete(ce),i.size===0)so(r);else if(i.size===1){var a=ee(i.entries().next().value,2),o=a[0],s=a[1];lo(r,o,s)}}},so=function(e){if(e.length!==0){var n=ee(er(e),2),t=n[0],i=n[1];if(t.delete(i),t.size===0)so(e.slice(0,-1));else if(t.size===1){var r=ee(t.entries().next().value,2),a=r[0],o=r[1];a!==ce&&lo(e.slice(0,-1),a,o)}}},lo=function(e,n,t){if(e.length!==0){var i=ee(er(e),2),r=i[0],a=i[1];r.set(a+n,t),r.delete(a)}},er=function(e){return e[e.length-1]},Bt,tr="or",co="and",_u="and_not",uo=function(){function e(n){if(n?.fields==null)throw new Error('MiniSearch: option "fields" must be provided');var t=n.autoVacuum==null||n.autoVacuum===!0?Ji:n.autoVacuum;this._options=Z(Z(Z({},Yi),n),{autoVacuum:t,searchOptions:Z(Z({},eo),n.searchOptions||{}),autoSuggestOptions:Z(Z({},wu),n.autoSuggestOptions||{})}),this._index=new qi,this._documentCount=0,this._documentIds=new Map,this._idToShortId=new Map,this._fieldIds={},this._fieldLength=new Map,this._avgFieldLength=[],this._nextId=0,this._storedFields=new Map,this._dirtCount=0,this._currentVacuum=null,this._enqueuedVacuum=null,this._enqueuedVacuumConditions=Qi,this.addFields(this._options.fields)}return e.prototype.add=function(n){var t,i,r,a,o,s,l=this._options,c=l.extractField,u=l.tokenize,d=l.processTerm,m=l.fields,p=l.idField,f=c(n,p);if(f==null)throw new Error('MiniSearch: document does not have ID field "'.concat(p,'"'));if(this._idToShortId.has(f))throw new Error("MiniSearch: duplicate ID ".concat(f));var _=this.addDocumentId(f);this.saveStoredFields(_,n);try{for(var E=U(m),y=E.next();!y.done;y=E.next()){var T=y.value,S=c(n,T);if(S!=null){var N=u(S.toString(),T),L=this._fieldIds[T],b=new Set(N).size;this.addFieldLength(_,L,this._documentCount-1,b);try{for(var I=(r=void 0,U(N)),D=I.next();!D.done;D=I.next()){var P=D.value,M=d(P,T);if(Array.isArray(M))try{for(var H=(o=void 0,U(M)),R=H.next();!R.done;R=H.next()){var w=R.value;this.addTerm(L,_,w)}}catch(x){o={error:x}}finally{try{R&&!R.done&&(s=H.return)&&s.call(H)}finally{if(o)throw o.error}}else M&&this.addTerm(L,_,M)}}catch(x){r={error:x}}finally{try{D&&!D.done&&(a=I.return)&&a.call(I)}finally{if(r)throw r.error}}}}}catch(x){t={error:x}}finally{try{y&&!y.done&&(i=E.return)&&i.call(E)}finally{if(t)throw t.error}}},e.prototype.addAll=function(n){var t,i;try{for(var r=U(n),a=r.next();!a.done;a=r.next()){var o=a.value;this.add(o)}}catch(s){t={error:s}}finally{try{a&&!a.done&&(i=r.return)&&i.call(r)}finally{if(t)throw t.error}}},e.prototype.addAllAsync=function(n,t){var i=this;t===void 0&&(t={});var r=t.chunkSize,a=r===void 0?10:r,o={chunk:[],promise:Promise.resolve()},s=n.reduce(function(u,d,m){var p=u.chunk,f=u.promise;return p.push(d),(m+1)%a===0?{chunk:[],promise:f.then(function(){return new Promise(function(_){return setTimeout(_,0)})}).then(function(){return i.addAll(p)})}:{chunk:p,promise:f}},o),l=s.chunk,c=s.promise;return c.then(function(){return i.addAll(l)})},e.prototype.remove=function(n){var t,i,r,a,o,s,l=this._options,c=l.tokenize,u=l.processTerm,d=l.extractField,m=l.fields,p=l.idField,f=d(n,p);if(f==null)throw new Error('MiniSearch: document does not have ID field "'.concat(p,'"'));var _=this._idToShortId.get(f);if(_==null)throw new Error("MiniSearch: cannot remove document with ID ".concat(f,": it is not in the index"));try{for(var E=U(m),y=E.next();!y.done;y=E.next()){var T=y.value,S=d(n,T);if(S!=null){var N=c(S.toString(),T),L=this._fieldIds[T],b=new Set(N).size;this.removeFieldLength(_,L,this._documentCount,b);try{for(var I=(r=void 0,U(N)),D=I.next();!D.done;D=I.next()){var P=D.value,M=u(P,T);if(Array.isArray(M))try{for(var H=(o=void 0,U(M)),R=H.next();!R.done;R=H.next()){var w=R.value;this.removeTerm(L,_,w)}}catch(x){o={error:x}}finally{try{R&&!R.done&&(s=H.return)&&s.call(H)}finally{if(o)throw o.error}}else M&&this.removeTerm(L,_,M)}}catch(x){r={error:x}}finally{try{D&&!D.done&&(a=I.return)&&a.call(I)}finally{if(r)throw r.error}}}}}catch(x){t={error:x}}finally{try{y&&!y.done&&(i=E.return)&&i.call(E)}finally{if(t)throw t.error}}this._storedFields.delete(_),this._documentIds.delete(_),this._idToShortId.delete(f),this._fieldLength.delete(_),this._documentCount-=1},e.prototype.removeAll=function(n){var t,i;if(n)try{for(var r=U(n),a=r.next();!a.done;a=r.next()){var o=a.value;this.remove(o)}}catch(s){t={error:s}}finally{try{a&&!a.done&&(i=r.return)&&i.call(r)}finally{if(t)throw t.error}}else{if(arguments.length>0)throw new Error("Expected documents to be present. Omit the argument to remove all documents.");this._index=new qi,this._documentCount=0,this._documentIds=new Map,this._idToShortId=new Map,this._fieldLength=new Map,this._avgFieldLength=[],this._storedFields=new Map,this._nextId=0}},e.prototype.discard=function(n){var t=this,i=this._idToShortId.get(n);if(i==null)throw new Error("MiniSearch: cannot discard document with ID ".concat(n,": it is not in the index"));this._idToShortId.delete(n),this._documentIds.delete(i),this._storedFields.delete(i),(this._fieldLength.get(i)||[]).forEach(function(r,a){t.removeFieldLength(i,a,t._documentCount,r)}),this._fieldLength.delete(i),this._documentCount-=1,this._dirtCount+=1,this.maybeAutoVacuum()},e.prototype.maybeAutoVacuum=function(){if(this._options.autoVacuum!==!1){var n=this._options.autoVacuum,t=n.minDirtFactor,i=n.minDirtCount,r=n.batchSize,a=n.batchWait;this.conditionalVacuum({batchSize:r,batchWait:a},{minDirtCount:i,minDirtFactor:t})}},e.prototype.discardAll=function(n){var t,i,r=this._options.autoVacuum;try{this._options.autoVacuum=!1;try{for(var a=U(n),o=a.next();!o.done;o=a.next()){var s=o.value;this.discard(s)}}catch(l){t={error:l}}finally{try{o&&!o.done&&(i=a.return)&&i.call(a)}finally{if(t)throw t.error}}}finally{this._options.autoVacuum=r}this.maybeAutoVacuum()},e.prototype.replace=function(n){var t=this._options,i=t.idField,r=t.extractField,a=r(n,i);this.discard(a),this.add(n)},e.prototype.vacuum=function(n){return n===void 0&&(n={}),this.conditionalVacuum(n)},e.prototype.conditionalVacuum=function(n,t){var i=this;return this._currentVacuum?(this._enqueuedVacuumConditions=this._enqueuedVacuumConditions&&t,this._enqueuedVacuum!=null?this._enqueuedVacuum:(this._enqueuedVacuum=this._currentVacuum.then(function(){var r=i._enqueuedVacuumConditions;return i._enqueuedVacuumConditions=Qi,i.performVacuuming(n,r)}),this._enqueuedVacuum)):this.vacuumConditionsMet(t)===!1?Promise.resolve():(this._currentVacuum=this.performVacuuming(n),this._currentVacuum)},e.prototype.performVacuuming=function(n,t){return hu(this,void 0,void 0,function(){var i,r,a,o,s,l,c,u,d,m,p,f,_,E,y,T,S,N,L,b,I,D,P,M,H;return fu(this,function(R){switch(R.label){case 0:if(i=this._dirtCount,!this.vacuumConditionsMet(t))return[3,10];r=n.batchSize||$i.batchSize,a=n.batchWait||$i.batchWait,o=1,R.label=1;case 1:R.trys.push([1,7,8,9]),s=U(this._index),l=s.next(),R.label=2;case 2:if(l.done)return[3,6];c=ee(l.value,2),u=c[0],d=c[1];try{for(m=(D=void 0,U(d)),p=m.next();!p.done;p=m.next()){f=ee(p.value,2),_=f[0],E=f[1];try{for(y=(M=void 0,U(E)),T=y.next();!T.done;T=y.next())S=ee(T.value,1),N=S[0],!this._documentIds.has(N)&&(E.size<=1?d.delete(_):E.delete(N))}catch(w){M={error:w}}finally{try{T&&!T.done&&(H=y.return)&&H.call(y)}finally{if(M)throw M.error}}}}catch(w){D={error:w}}finally{try{p&&!p.done&&(P=m.return)&&P.call(m)}finally{if(D)throw D.error}}return this._index.get(u).size===0&&this._index.delete(u),o%r!==0?[3,4]:[4,new Promise(function(w){return setTimeout(w,a)})];case 3:R.sent(),R.label=4;case 4:o+=1,R.label=5;case 5:return l=s.next(),[3,2];case 6:return[3,9];case 7:return L=R.sent(),b={error:L},[3,9];case 8:try{l&&!l.done&&(I=s.return)&&I.call(s)}finally{if(b)throw b.error}return[7];case 9:this._dirtCount-=i,R.label=10;case 10:return[4,null];case 11:return R.sent(),this._currentVacuum=this._enqueuedVacuum,this._enqueuedVacuum=null,[2]}})})},e.prototype.vacuumConditionsMet=function(n){if(n==null)return!0;var t=n.minDirtCount,i=n.minDirtFactor;return t=t||Ji.minDirtCount,i=i||Ji.minDirtFactor,this.dirtCount>=t&&this.dirtFactor>=i},Object.defineProperty(e.prototype,"isVacuuming",{get:function(){return this._currentVacuum!=null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"dirtCount",{get:function(){return this._dirtCount},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"dirtFactor",{get:function(){return this._dirtCount/(1+this._documentCount+this._dirtCount)},enumerable:!1,configurable:!0}),e.prototype.has=function(n){return this._idToShortId.has(n)},e.prototype.getStoredFields=function(n){var t=this._idToShortId.get(n);if(t!=null)return this._storedFields.get(t)},e.prototype.search=function(n,t){var i,r;t===void 0&&(t={});var a=this.executeQuery(n,t),o=[];try{for(var s=U(a),l=s.next();!l.done;l=s.next()){var c=ee(l.value,2),u=c[0],d=c[1],m=d.score,p=d.terms,f=d.match,_=p.length||1,E={id:this._documentIds.get(u),score:m*_,terms:Object.keys(f),queryTerms:p,match:f};Object.assign(E,this._storedFields.get(u)),(t.filter==null||t.filter(E))&&o.push(E)}}catch(y){i={error:y}}finally{try{l&&!l.done&&(r=s.return)&&r.call(s)}finally{if(i)throw i.error}}return n===e.wildcard&&t.boostDocument==null&&this._options.searchOptions.boostDocument==null||o.sort(no),o},e.prototype.autoSuggest=function(n,t){var i,r,a,o;t===void 0&&(t={}),t=Z(Z({},this._options.autoSuggestOptions),t);var s=new Map;try{for(var l=U(this.search(n,t)),c=l.next();!c.done;c=l.next()){var u=c.value,d=u.score,m=u.terms,p=m.join(" "),f=s.get(p);f!=null?(f.score+=d,f.count+=1):s.set(p,{score:d,terms:m,count:1})}}catch(L){i={error:L}}finally{try{c&&!c.done&&(r=l.return)&&r.call(l)}finally{if(i)throw i.error}}var _=[];try{for(var E=U(s),y=E.next();!y.done;y=E.next()){var T=ee(y.value,2),f=T[0],S=T[1],d=S.score,m=S.terms,N=S.count;_.push({suggestion:f,terms:m,score:d/N})}}catch(L){a={error:L}}finally{try{y&&!y.done&&(o=E.return)&&o.call(E)}finally{if(a)throw a.error}}return _.sort(no),_},Object.defineProperty(e.prototype,"documentCount",{get:function(){return this._documentCount},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"termCount",{get:function(){return this._index.size},enumerable:!1,configurable:!0}),e.loadJSON=function(n,t){if(t==null)throw new Error("MiniSearch: loadJSON should be given the same options used when serializing the index");return this.loadJS(JSON.parse(n),t)},e.getDefault=function(n){if(Yi.hasOwnProperty(n))return Xi(Yi,n);throw new Error('MiniSearch: unknown option "'.concat(n,'"'))},e.loadJS=function(n,t){var i,r,a,o,s,l,c=n.index,u=n.documentCount,d=n.nextId,m=n.documentIds,p=n.fieldIds,f=n.fieldLength,_=n.averageFieldLength,E=n.storedFields,y=n.dirtCount,T=n.serializationVersion;if(T!==1&&T!==2)throw new Error("MiniSearch: cannot deserialize an index created with an incompatible version");var S=new e(t);S._documentCount=u,S._nextId=d,S._documentIds=Cn(m),S._idToShortId=new Map,S._fieldIds=p,S._fieldLength=Cn(f),S._avgFieldLength=_,S._storedFields=Cn(E),S._dirtCount=y||0,S._index=new qi;try{for(var N=U(S._documentIds),L=N.next();!L.done;L=N.next()){var b=ee(L.value,2),I=b[0],D=b[1];S._idToShortId.set(D,I)}}catch(ie){i={error:ie}}finally{try{L&&!L.done&&(r=N.return)&&r.call(N)}finally{if(i)throw i.error}}try{for(var P=U(c),M=P.next();!M.done;M=P.next()){var H=ee(M.value,2),R=H[0],w=H[1],x=new Map;try{for(var O=(s=void 0,U(Object.keys(w))),j=O.next();!j.done;j=O.next()){var X=j.value,re=w[X];T===1&&(re=re.ds),x.set(parseInt(X,10),Cn(re))}}catch(ie){s={error:ie}}finally{try{j&&!j.done&&(l=O.return)&&l.call(O)}finally{if(s)throw s.error}}S._index.set(R,x)}}catch(ie){a={error:ie}}finally{try{M&&!M.done&&(o=P.return)&&o.call(P)}finally{if(a)throw a.error}}return S},e.prototype.executeQuery=function(n,t){var i=this;if(t===void 0&&(t={}),n===e.wildcard)return this.executeWildcardQuery(t);if(typeof n!="string"){var r=Z(Z(Z({},t),n),{queries:void 0}),a=n.queries.map(function(E){return i.executeQuery(E,r)});return this.combineResults(a,r.combineWith)}var o=this._options,s=o.tokenize,l=o.processTerm,c=o.searchOptions,u=Z(Z({tokenize:s,processTerm:l},c),t),d=u.tokenize,m=u.processTerm,p=d(n).flatMap(function(E){return m(E)}).filter(function(E){return!!E}),f=p.map(ku(u)),_=f.map(function(E){return i.executeQuerySpec(E,u)});return this.combineResults(_,u.combineWith)},e.prototype.executeQuerySpec=function(n,t){var i,r,a,o,s=Z(Z({},this._options.searchOptions),t),l=(s.fields||this._options.fields).reduce(function(X,re){var ie;return Z(Z({},X),(ie={},ie[re]=Xi(s.boost,re)||1,ie))},{}),c=s.boostDocument,u=s.weights,d=s.maxFuzzy,m=s.bm25,p=Z(Z({},eo.weights),u),f=p.fuzzy,_=p.prefix,E=this._index.get(n.term),y=this.termResults(n.term,n.term,1,E,l,c,m),T,S;if(n.prefix&&(T=this._index.atPrefix(n.term)),n.fuzzy){var N=n.fuzzy===!0?.2:n.fuzzy,L=N<1?Math.min(d,Math.round(n.term.length*N)):N;L&&(S=this._index.fuzzyGet(n.term,L))}if(T)try{for(var b=U(T),I=b.next();!I.done;I=b.next()){var D=ee(I.value,2),P=D[0],M=D[1],H=P.length-n.term.length;if(H){S?.delete(P);var R=_*P.length/(P.length+.3*H);this.termResults(n.term,P,R,M,l,c,m,y)}}}catch(X){i={error:X}}finally{try{I&&!I.done&&(r=b.return)&&r.call(b)}finally{if(i)throw i.error}}if(S)try{for(var w=U(S.keys()),x=w.next();!x.done;x=w.next()){var P=x.value,O=ee(S.get(P),2),j=O[0],H=O[1];if(H){var R=f*P.length/(P.length+H);this.termResults(n.term,P,R,j,l,c,m,y)}}}catch(X){a={error:X}}finally{try{x&&!x.done&&(o=w.return)&&o.call(w)}finally{if(a)throw a.error}}return y},e.prototype.executeWildcardQuery=function(n){var t,i,r=new Map,a=Z(Z({},this._options.searchOptions),n);try{for(var o=U(this._documentIds),s=o.next();!s.done;s=o.next()){var l=ee(s.value,2),c=l[0],u=l[1],d=a.boostDocument?a.boostDocument(u,"",this._storedFields.get(c)):1;r.set(c,{score:d,terms:[],match:{}})}}catch(m){t={error:m}}finally{try{s&&!s.done&&(i=o.return)&&i.call(o)}finally{if(t)throw t.error}}return r},e.prototype.combineResults=function(n,t){if(t===void 0&&(t=tr),n.length===0)return new Map;var i=t.toLowerCase();return n.reduce(Su[i])||new Map},e.prototype.toJSON=function(){var n,t,i,r,a=[];try{for(var o=U(this._index),s=o.next();!s.done;s=o.next()){var l=ee(s.value,2),c=l[0],u=l[1],d={};try{for(var m=(i=void 0,U(u)),p=m.next();!p.done;p=m.next()){var f=ee(p.value,2),_=f[0],E=f[1];d[_]=Object.fromEntries(E)}}catch(y){i={error:y}}finally{try{p&&!p.done&&(r=m.return)&&r.call(m)}finally{if(i)throw i.error}}a.push([c,d])}}catch(y){n={error:y}}finally{try{s&&!s.done&&(t=o.return)&&t.call(o)}finally{if(n)throw n.error}}return{documentCount:this._documentCount,nextId:this._nextId,documentIds:Object.fromEntries(this._documentIds),fieldIds:this._fieldIds,fieldLength:Object.fromEntries(this._fieldLength),averageFieldLength:this._avgFieldLength,storedFields:Object.fromEntries(this._storedFields),dirtCount:this._dirtCount,index:a,serializationVersion:2}},e.prototype.termResults=function(n,t,i,r,a,o,s,l){var c,u,d,m,p;if(l===void 0&&(l=new Map),r==null)return l;try{for(var f=U(Object.keys(a)),_=f.next();!_.done;_=f.next()){var E=_.value,y=a[E],T=this._fieldIds[E],S=r.get(T);if(S!=null){var N=S.size,L=this._avgFieldLength[T];try{for(var b=(d=void 0,U(S.keys())),I=b.next();!I.done;I=b.next()){var D=I.value;if(!this._documentIds.has(D)){this.removeTerm(T,D,t),N-=1;continue}var P=o?o(this._documentIds.get(D),t,this._storedFields.get(D)):1;if(P){var M=S.get(D),H=this._fieldLength.get(D)[T],R=Cu(M,N,this._documentCount,H,L,s),w=i*y*P*R,x=l.get(D);if(x){x.score+=w,Tu(x.terms,n);var O=Xi(x.match,t);O?O.push(E):x.match[t]=[E]}else l.set(D,{score:w,terms:[n],match:(p={},p[t]=[E],p)})}}}catch(j){d={error:j}}finally{try{I&&!I.done&&(m=b.return)&&m.call(b)}finally{if(d)throw d.error}}}}}catch(j){c={error:j}}finally{try{_&&!_.done&&(u=f.return)&&u.call(f)}finally{if(c)throw c.error}}return l},e.prototype.addTerm=function(n,t,i){var r=this._index.fetch(i,io),a=r.get(n);if(a==null)a=new Map,a.set(t,1),r.set(n,a);else{var o=a.get(t);a.set(t,(o||0)+1)}},e.prototype.removeTerm=function(n,t,i){if(!this._index.has(i)){this.warnDocumentChanged(t,n,i);return}var r=this._index.fetch(i,io),a=r.get(n);a==null||a.get(t)==null?this.warnDocumentChanged(t,n,i):a.get(t)<=1?a.size<=1?r.delete(n):a.delete(t):a.set(t,a.get(t)-1),this._index.get(i).size===0&&this._index.delete(i)},e.prototype.warnDocumentChanged=function(n,t,i){var r,a;try{for(var o=U(Object.keys(this._fieldIds)),s=o.next();!s.done;s=o.next()){var l=s.value;if(this._fieldIds[l]===t){this._options.logger("warn","MiniSearch: document with ID ".concat(this._documentIds.get(n),' has changed before removal: term "').concat(i,'" was not present in field "').concat(l,'". Removing a document after it has changed can corrupt the index!'),"version_conflict");return}}}catch(c){r={error:c}}finally{try{s&&!s.done&&(a=o.return)&&a.call(o)}finally{if(r)throw r.error}}},e.prototype.addDocumentId=function(n){var t=this._nextId;return this._idToShortId.set(n,t),this._documentIds.set(t,n),this._documentCount+=1,this._nextId+=1,t},e.prototype.addFields=function(n){for(var t=0;t<n.length;t++)this._fieldIds[n[t]]=t},e.prototype.addFieldLength=function(n,t,i,r){var a=this._fieldLength.get(n);a==null&&this._fieldLength.set(n,a=[]),a[t]=r;var o=this._avgFieldLength[t]||0,s=o*i+r;this._avgFieldLength[t]=s/(i+1)},e.prototype.removeFieldLength=function(n,t,i,r){if(i===1){this._avgFieldLength[t]=0;return}var a=this._avgFieldLength[t]*i-r;this._avgFieldLength[t]=a/(i-1)},e.prototype.saveStoredFields=function(n,t){var i,r,a=this._options,o=a.storeFields,s=a.extractField;if(!(o==null||o.length===0)){var l=this._storedFields.get(n);l==null&&this._storedFields.set(n,l={});try{for(var c=U(o),u=c.next();!u.done;u=c.next()){var d=u.value,m=s(t,d);m!==void 0&&(l[d]=m)}}catch(p){i={error:p}}finally{try{u&&!u.done&&(r=c.return)&&r.call(c)}finally{if(i)throw i.error}}}},e.wildcard=Symbol("*"),e}(),Xi=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)?e[n]:void 0},Su=(Bt={},Bt[tr]=function(e,n){var t,i;try{for(var r=U(n.keys()),a=r.next();!a.done;a=r.next()){var o=a.value,s=e.get(o);if(s==null)e.set(o,n.get(o));else{var l=n.get(o),c=l.score,u=l.terms,d=l.match;s.score=s.score+c,s.match=Object.assign(s.match,d),to(s.terms,u)}}}catch(m){t={error:m}}finally{try{a&&!a.done&&(i=r.return)&&i.call(r)}finally{if(t)throw t.error}}return e},Bt[co]=function(e,n){var t,i,r=new Map;try{for(var a=U(n.keys()),o=a.next();!o.done;o=a.next()){var s=o.value,l=e.get(s);if(l!=null){var c=n.get(s),u=c.score,d=c.terms,m=c.match;to(l.terms,d),r.set(s,{score:l.score+u,terms:l.terms,match:Object.assign(l.match,m)})}}}catch(p){t={error:p}}finally{try{o&&!o.done&&(i=a.return)&&i.call(a)}finally{if(t)throw t.error}}return r},Bt[_u]=function(e,n){var t,i;try{for(var r=U(n.keys()),a=r.next();!a.done;a=r.next()){var o=a.value;e.delete(o)}}catch(s){t={error:s}}finally{try{a&&!a.done&&(i=r.return)&&i.call(r)}finally{if(t)throw t.error}}return e},Bt),Eu={k:1.2,b:.7,d:.5},Cu=function(e,n,t,i,r,a){var o=a.k,s=a.b,l=a.d,c=Math.log(1+(t-n+.5)/(n+.5));return c*(l+e*(o+1)/(e+o*(1-s+s*i/r)))},ku=function(e){return function(n,t,i){var r=typeof e.fuzzy=="function"?e.fuzzy(n,t,i):e.fuzzy||!1,a=typeof e.prefix=="function"?e.prefix(n,t,i):e.prefix===!0;return{term:n,fuzzy:r,prefix:a}}},Yi={idField:"id",extractField:function(e,n){return e[n]},tokenize:function(e){return e.split(Au)},processTerm:function(e){return e.toLowerCase()},fields:void 0,searchOptions:void 0,storeFields:[],logger:function(e,n){typeof console?.[e]=="function"&&console[e](n)},autoVacuum:!0},eo={combineWith:tr,prefix:!1,fuzzy:!1,maxFuzzy:6,boost:{},weights:{fuzzy:.45,prefix:.375},bm25:Eu},wu={combineWith:co,prefix:function(e,n,t){return n===t.length-1}},$i={batchSize:1e3,batchWait:10},Qi={minDirtFactor:.1,minDirtCount:20},Ji=Z(Z({},$i),Qi),Tu=function(e,n){e.includes(n)||e.push(n)},to=function(e,n){var t,i;try{for(var r=U(n),a=r.next();!a.done;a=r.next()){var o=a.value;e.includes(o)||e.push(o)}}catch(s){t={error:s}}finally{try{a&&!a.done&&(i=r.return)&&i.call(r)}finally{if(t)throw t.error}}},no=function(e,n){var t=e.score,i=n.score;return i-t},io=function(){return new Map},Cn=function(e){var n,t,i=new Map;try{for(var r=U(Object.keys(e)),a=r.next();!a.done;a=r.next()){var o=a.value;i.set(parseInt(o,10),e[o])}}catch(s){n={error:s}}finally{try{a&&!a.done&&(t=r.return)&&t.call(r)}finally{if(n)throw n.error}}return i},Au=/[\n\r -#%-*,-/:;?@[-\]_{}\u00A0\u00A1\u00A7\u00AB\u00B6\u00B7\u00BB\u00BF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u1680\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2000-\u200A\u2010-\u2029\u202F-\u2043\u2045-\u2051\u2053-\u205F\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u3000-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]+/u;var po=[{id:"search",type:"action",name:"Search the knowledge base.",content:"Search the knowledge base for information, actions, tools, tours, UI elements, etc. Use this on EVERY request if you don't have information. If the user asks for personal information, use this. If the user asks you to do something, use this to find the tool you need.",isContext:!0,removeFromMessageHistory:!0,parameters:[{name:"query",type:"string",description:"The search query"}],action:async(e,n)=>{let t=await n.knowledgeBase.search(e.query),i=n;i._lastKBsearch=e.query,i._nextRequestUseKBitems=t,n.submitAnalyticsEvent({type:"kb-search",query:e.query,results:t});let r=t.filter(o=>o.type!="action").map(o=>"id="+o.id).join(", ")||"(none)",a=t.filter(o=>o.type=="action").map(o=>"name="+o._functionID).join(", ")||"(none)";return`Search complete, context has been updated. New info entries found: ${r}. New tools available: ${a}.`}}];var tt=new q("KnowledgeBase"),mo=1,wn=class e{constructor(n){this._sources=[{id:"core.internal",query:async()=>po}];this._windowSources=[];this.lastResults=[];this.manualEntries=[];this.ai=n}registerSource(n,t){let i=n;return typeof n=="function"&&(t=n,i=`source.${mo++}`),this._sources.push({id:i,query:t}),i}removeSource(n){this._sources=this.sources.filter(t=>t.id!==n&&t.query!==n)}addEntry(n){this.manualEntries.push(n)}removeEntry(n){this.manualEntries=this.manualEntries.filter(t=>t.id!==n)}get sources(){let n=this._sources;return $().knowledgeBaseSources&&(n=n.concat($().knowledgeBaseSources)),n=n.concat(this._windowSources),n=n.filter(t=>!t.disabled),n}async search(n){tt.debug(`Searching knowledge base for: ${n}`);let t=new Event("webweaver_kb_search",{bubbles:!0,cancelable:!0});t.query=n,t.entries=[],t.sources=[],typeof document<"u"&&document.dispatchEvent(t),this._windowSources=t.sources;let r=(await Promise.all(this.sources.map(async l=>{try{let c=Date.now(),u=await l.query(n);return tt.debug(`Source '${l.id}' took ${Date.now()-c}ms`),u||[]}catch(c){return tt.warn(`Knowledge source '${l.id}' failed:`,c),[]}}))).flat();r=r.concat(t.entries),r=r.concat(this.manualEntries),$().knowledgeBase&&(r=r.concat($().knowledgeBase)),r=r.filter(l=>l&&!l.disabled);for(let l=0;l<r.length;l++){let c=r[l];if(c.id=c.id||`temp.${l}`,c._functionID=c.id.replaceAll(/[^a-zA-Z0-9_]/g,"_"),!c.action&&c.type=="tour"&&(c.action=u=>{throw new Error("This tour does not have an action. You must perform the tour content manually.")}),!c.action&&c.type=="info"&&(c.action=u=>{throw new Error("This item does not have an action. Use the content to provide information to the user instead.")}),c.parameters&&!Array.isArray(c.parameters)){let u=c.parameters,d=[];for(let m in u)d.push({name:m,type:"string",description:c.parameters[m]});c.parameters=d}}let a=new uo({fields:["id","type","name","content","tags"],storeFields:[],searchOptions:{boost:{name:3,tags:2},fuzzy:.2}});a.addAll(r);let s=a.search(n).map(l=>r.find(c=>c.id==l.id));for(let l of r)l.isContext&&(s.find(c=>c.id===l.id)||s.push(l));return this.lastResults=s,tt.debug("Found results:",s),s}getCachedEntry(n){return this.lastResults.find(t=>t.id==n||t._functionID==n)}registerSourceFromURL(n,t){t||(t=`external.${mo++}`),tt.debug(`Registering remote knowledge base source: ${n}`);let i=[],r=[],a=!0,o=async(l,c)=>{tt.debug(`Calling remote knowledge base action: ${l.id}`);let u={type:"action",userID:this.ai.userID,extra:this.ai.extra,actionID:l.id,parameters:c},d=await fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(u)});if(!d.ok)throw new Error(`HTTP Error ${d.status} ${d.statusText}`);let m=await d.json();return s(m.updateItems||[]),m.response},s=l=>{for(let c of l){if(!c.id){tt.warn("KB item skipped since it has no ID.",c);continue}let u=i.find(d=>d.id==c.id);if(u){u.name=c.name||u.name||"",u.content=c.content||u.content||"",u.disabled=c.disabled??u.disabled,u.isContext=c.isContext??u.isContext,u.parameters=c.parameters||u.parameters||[],u.tags=c.tags||u.tags,u.type=c.type||u.type;continue}i.push({...c,action:d=>o(c,d)})}};this.registerSource(t,async l=>{if(a&&r.includes(l))return i;let c={type:"search",userID:this.ai?.userID||"",extra:this.ai?.extra||{},query:l},u=await fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)});if(!u.ok)throw new Error(`HTTP Error ${u.status} ${u.statusText}`);let d=await u.json();return a=!d.noCache,r.includes(l)||r.push(l),s(d.items),i})}clone(){let n=new e(this.ai);return n._sources=this._sources,n._windowSources=this._windowSources,n.manualEntries=this.manualEntries,n}};var go={name:"@intelliweave/embedded",version:"1.8.60",description:"Integrate IntelliWeave into your app or website.",main:"./dist/webpack/index.js",types:"./dist/webpack/index.d.ts",type:"module",exports:{".":"./dist/webpack/index.js","./component":"./dist/component/component.js","./node":"./dist/node/node.js","./react":"./dist/react/react.js","./webpack":"./dist/webpack/index.js"},scripts:{build:"npm run build:lib && npm run build:docs","build:lib":"tsx build.ts","build:dev":"cross-env DEVELOPMENT=1 npm run build","build:docs":"typedoc src/index.mts --out dist/docs/",deploy:'npm run build && gsutil cp ./dist/web-weaver.min.js gs://metapress-cdn/web-weaver.min.js && gcloud compute url-maps invalidate-cdn-cache mp-cdn-loadbalancer --project="mp-backend-api" --path "/web-weaver.min.js" --async',"start:server":"cd server && npm run start","deploy:server":"cd server && npm run deploy","llm:build":"cd llm-server && docker build -t web-weaver-llm .","llm:start":"npm run llm:build && docker run -it --rm -p 8000:80 --gpus=all web-weaver-llm","llm:deploy.docker":"npm run llm:build && gcloud auth configure-docker us-central1-docker.pkg.dev && docker tag web-weaver-llm us-central1-docker.pkg.dev/ydangle-web-companion/docker-artifacts/web-weaver-llm && docker push us-central1-docker.pkg.dev/ydangle-web-companion/docker-artifacts/web-weaver-llm","llm:deploy":'npm run llm:deploy.docker && gcloud run deploy web-weaver-llm --project=ydangle-web-companion --image=us-central1-docker.pkg.dev/ydangle-web-companion/docker-artifacts/web-weaver-llm --allow-unauthenticated --region=us-central1 --description="Web Weaver LLM" --concurrency=2 --min-instances=0 --timeout=5m --memory=16Gi --cpu=8',prepack:"npm run build",test:"npm run build && tsx --test"},keywords:["web","weaver","ai","assistant","chat"],author:"jjv360",license:"UNLICENSED",devDependencies:{"@types/audioworklet":"^0.0.64","@types/lodash":"^4.17.13","@types/react":"^18.3.12","@types/uuid":"^10.0.0",bestzip:"^2.2.1","cross-env":"^7.0.3","find-cache-dir":"^5.0.0",lodash:"^4.17.21","onnxruntime-web":"^1.20.0",react:"^18.3.1","replace-in-file":"^8.2.0",tsup:"^8.3.5",tsx:"^4.19.2",typedoc:"^0.27.6"},peerDependencies:{"onnxruntime-web":"^1.20.0",react:"^18 || ^19"},dependencies:{"gpt-tokenizer":"^2.9.0",minisearch:"^6.3.0","rehype-document":"^7.0.3","rehype-external-links":"^3.0.0","rehype-format":"^5.0.0","rehype-stringify":"^10.0.0","remark-parse":"^11.0.0","remark-rehype":"^11.1.0",unified:"^11.0.4","utility-types":"^3.11.0",uuid:"^10.0.0"}};var Tn=class{constructor(n){this.ai=n}async boolean(n){let t=await this.instruct({...n,instruction:`${n.instruction}
3255
3255
 
3256
- `+JSON.stringify(t))||"";if(r.toLowerCase().includes("true"))return!0;if(r.toLowerCase().includes("false"))return!1;throw new Error("The AI did not give a boolean answer: "+r)}async choose(n,t,i){i=i.map(o=>o.trim());let r=this.ai.clone();r.resetConversation(),r.getContextPrefix=async()=>"You will receive a question and some data and options. Answer the question by replying with the option you want to choose. Only say the option you want, no additional text.";let a=await r.sendMessage("question:"+n+`
3256
+ Return only the text "true" or "false" to indicate the answer to the question. Do not include any additional text or explanations.`});if(t.toLowerCase().includes("true"))return!0;if(t.toLowerCase().includes("false"))return!1;throw new Error("The AI did not give a boolean answer: "+t)}async choose(n){let t=await this.instruct({...n,instruction:`${n.instruction}
3257
3257
 
3258
- data:`+JSON.stringify(t)+`
3258
+ Reply only with one of the following options:
3259
+ ${n.options.map(i=>`- "${i}"`).join(`
3260
+ `)}
3259
3261
 
3260
- options:`+i.join(`
3261
- `))||"";return i.find(o=>a.toLowerCase().includes(o.toLowerCase()))}async extract(n,t,i,r){let a=this.ai.clone();a.resetConversation(),a.getContextPrefix=async()=>"You will receive a question and some data. Answer the question by replying with the extracted data as valid json. If there are multiple extractions, separate them with commas.";let o=await a.sendMessage("question:"+n+`
3262
+ Do not include any additional text or explanations.`});return n.options.includes(t)?t:n.options.find(i=>t.toLowerCase().includes(i.toLowerCase()))}async extract(n){let t=`
3263
+ You will receive some data. Extraction instructions: ${n.instruction}
3262
3264
 
3263
- data:`+JSON.stringify(t)+`
3265
+ ${n.allowMultiple?"Return a JSONL string only, one JSON object on each line.":"Return a valid JSON object only."}
3264
3266
 
3265
- extractions:`+JSON.stringify(r))||"";o=o.replace(/```json/g,"").replace(/```/g,"").replace(/\n/g,"");let s=o.split(",").map(l=>l.trim()).join(",");return JSON.parse(s)}async generateMarkdown(n,t){return this.instruct("Generate a Markdown document based on the input text. Always include a header on every response. Give long detailed answers with many paragraphs, and explain concepts step by step.",n,t)}async instruct(n,t,i){let r=this.ai.clone();return r.resetConversation(),r.getContextPrefix=async()=>n,i&&r.addEventListener("output",o=>{i(o.detail.message)}),await r.sendMessage(t)}};var Ae=new q("Main"),An=class An extends EventTarget{constructor(){super(...arguments);this.conversationID=Te();this.knowledgeBase=new wn(this);this._lastKBsearch="";this.models=[];this.audio=null;this.apiKey="";this.logic=new Tn(this);this.userID=Ca();this.extra=$().extra||{};this.hubAPI="https://intelliweave.ai/api";this._lastSystemMsg="";this.isProcessing=!1}get loaded(){return!!(this.config&&this.currentModel)}async load(t){if(this.apiKey=t,!t)throw new Error("API key is required to load the AI.");try{await Promise.all([(async()=>{Ae.debug("Loading configuration...");let i=await fetch(this.hubAPI+"/config/get",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:t})});if(!i.ok)throw new Error(`Failed to load configuration: ${i.status} ${i.statusText}`);try{this.config=await i.json(),Ae.debug("Config loaded successfully:",this.config),this.config&&Ae.debug("UI Properties - logo:",this.config.logo,"background:",this.config.background,"textColor:",this.config.textColor)}catch(r){Ae.error("Failed to parse JSON response:",r);try{let a=await i.clone().text();Ae.error("Raw response that failed parsing:",a)}catch{Ae.error("Could not get raw response text either")}throw new Error(`Failed to parse configuration: ${r}`)}})(),(async()=>{try{let i=await fetch("https://cdn.intelliweave.ai/models/silero_vad_3.onnx");if(!i.ok)throw new Error(`Failed to load VAD model: ${i.status} ${i.statusText}`);this.vadModel=await i.blob()}catch(i){Ae.warn(`Failed to load VAD model, some features will be unavailable. ${i.message}`)}})()]),this.models=[{id:this.config.id,config:this.config.model}],this.setModel(this.config.id);for(let i of this.config.knowledge||[])i.url&&this.knowledgeBase.registerSourceFromURL(i.url);for(let i of this.config.knowledge||[])i.entries?.length&&this.knowledgeBase.registerSource(i.id,()=>i.entries||[]);return this.resetConversation(),this.dispatchEvent(new CustomEvent("load",{detail:{ai:this}})),typeof window<"u"&&window.dispatchEvent(new CustomEvent("webweaver_loaded",{detail:{ai:this}})),this.config}catch(i){throw Ae.warn("Failed to load:",i),this.error=i,this.dispatchEvent(new CustomEvent("error",{detail:{ai:this,error:i}})),typeof window<"u"&&window.dispatchEvent(new CustomEvent("webweaver_error",{detail:{ai:this,error:i}})),i}}setModel(t){let i=this.models.find(r=>r.id==t);if(!i)throw new Error(`Model with ID "${t}" not found.`);this.currentModel=new En({...i.config,systemMessage:"",onBeforeMessageProcessing:this.onBeforeMessageProcessing.bind(this),onAIMessage:this.processIncomingMessage.bind(this),onAIToolStart:(r,a)=>{let o=this.knowledgeBase.getCachedEntry(r);this.onAIToolStart?.(o?.id||r,a)}}),this.currentModel.id=i.id,this.currentModel.metadata=i}async getContextPrefix(){let t=$().pageSummary||`You are ${this.config?.name||"IntelliWeave"}. ${this.config?.instructions||"Speak in short sentences."}`;return typeof t=="function"&&(t=await t()),t}async onBeforeMessageProcessing(){this._lastKBsearch||(this._lastKBsearch="__intelliweaveblanksearchforcontextitems__");let t=await this.getContextPrefix();this.currentModel.contextGroup.add({id:"_iw_main",sortOrder:1,cannotRemove:!0,content:t}),this.currentModel.contextGroup.add({id:"_iw_kb_description",sortOrder:100,cannotRemove:!0,content:'You have access to a database of knowledge base items. These include "info" type items which provide information and "tour" type items which contain instructions you should follow (only do one item at a time). Current info and tour items:'});let i=this._nextRequestUseKBitems||await this.knowledgeBase.search(this._lastKBsearch);this._nextRequestUseKBitems=void 0;for(let a of i)if(a.type=="info"||a.type=="tour"||a.type=="input-event")this.currentModel.contextGroup.add({id:a.id,customData:a,cannotRemove:a.isContext,sortOrder:101,disabled:a.disabled,content:JSON.stringify({id:a.id,type:a.type,name:a.name,content:Oi(typeof a.content=="function"?a.content():a.content)})+`
3267
+ Objects should have the following keys:
3268
+ ${n.extractions.map(r=>`- ${r.name} (${r.type}): ${r.description||"No description provided."}`).join(`
3269
+ `)}
3270
+ `,i=await this.instruct({...n,instruction:t});if(i=i.replace(/```jsonl/g,"").replace(/```json/g,"").replace(/```/g,""),n.allowMultiple){let r=i.split(`
3271
+ `).map(o=>o.trim()).filter(o=>!!o.trim()),a=[];for(let o of r)try{a.push(JSON.parse(o))}catch(s){console.error("Failed to parse line as JSON:",o,s.message)}return a}else return[JSON.parse(i.trim())]}async generateMarkdown(n){return this.instruct({...n,instruction:"Generate a Markdown document based on the input text. Always include a header on every response. Give long detailed answers with many paragraphs, and explain concepts step by step."})}async instruct(n){let t=this.ai.clone();return t.resetConversation(),t.getContextPrefix=async()=>n.instruction,n.callback&&t.addEventListener("output",i=>{n.callback(i.detail.message)}),n.allowKB||(t.knowledgeBase._sources=[]),await t.sendMessage(typeof n.data=="string"?n.data:JSON.stringify(n.data))||""}};var Ae=new q("Main"),An=class An extends EventTarget{constructor(){super(...arguments);this.conversationID=Te();this.knowledgeBase=new wn(this);this._lastKBsearch="";this.models=[];this.audio=null;this.apiKey="";this.logic=new Tn(this);this.userID=Ca();this.extra=$().extra||{};this.hubAPI="https://intelliweave.ai/api";this._lastSystemMsg="";this.isProcessing=!1}get loaded(){return!!(this.config&&this.currentModel)}async load(t){if(this.apiKey=t,!t)throw new Error("API key is required to load the AI.");try{await Promise.all([(async()=>{Ae.debug("Loading configuration...");let i=await fetch(this.hubAPI+"/config/get",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:t})});if(!i.ok)throw new Error(`Failed to load configuration: ${i.status} ${i.statusText}`);try{this.config=await i.json(),Ae.debug("Config loaded successfully:",this.config),this.config&&Ae.debug("UI Properties - logo:",this.config.logo,"background:",this.config.background,"textColor:",this.config.textColor)}catch(r){Ae.error("Failed to parse JSON response:",r);try{let a=await i.clone().text();Ae.error("Raw response that failed parsing:",a)}catch{Ae.error("Could not get raw response text either")}throw new Error(`Failed to parse configuration: ${r}`)}})(),(async()=>{try{let i=await fetch("https://cdn.intelliweave.ai/models/silero_vad_3.onnx");if(!i.ok)throw new Error(`Failed to load VAD model: ${i.status} ${i.statusText}`);this.vadModel=await i.blob()}catch(i){Ae.warn(`Failed to load VAD model, some features will be unavailable. ${i.message}`)}})()]),this.models=[{id:this.config.id,config:this.config.model}],this.setModel(this.config.id);for(let i of this.config.knowledge||[])i.url&&this.knowledgeBase.registerSourceFromURL(i.url);for(let i of this.config.knowledge||[])i.entries?.length&&this.knowledgeBase.registerSource(i.id,()=>i.entries||[]);return this.resetConversation(),this.dispatchEvent(new CustomEvent("load",{detail:{ai:this}})),typeof window<"u"&&window.dispatchEvent(new CustomEvent("webweaver_loaded",{detail:{ai:this}})),this.config}catch(i){throw Ae.warn("Failed to load:",i),this.error=i,this.dispatchEvent(new CustomEvent("error",{detail:{ai:this,error:i}})),typeof window<"u"&&window.dispatchEvent(new CustomEvent("webweaver_error",{detail:{ai:this,error:i}})),i}}setModel(t){let i=this.models.find(r=>r.id==t);if(!i)throw new Error(`Model with ID "${t}" not found.`);this.currentModel=new En({...i.config,systemMessage:"",onBeforeMessageProcessing:this.onBeforeMessageProcessing.bind(this),onAIMessage:this.processIncomingMessage.bind(this),onAIToolStart:(r,a)=>{let o=this.knowledgeBase.getCachedEntry(r);this.onAIToolStart?.(o?.id||r,a)}}),this.currentModel.id=i.id,this.currentModel.metadata=i}async getContextPrefix(){let t=$().pageSummary||`You are ${this.config?.name||"IntelliWeave"}. ${this.config?.instructions||"Speak in short sentences."}`;return typeof t=="function"&&(t=await t()),t}async onBeforeMessageProcessing(){this._lastKBsearch||(this._lastKBsearch="__intelliweaveblanksearchforcontextitems__");let t=await this.getContextPrefix();this.currentModel.contextGroup.add({id:"_iw_main",sortOrder:1,cannotRemove:!0,content:t}),this.currentModel.contextGroup.add({id:"_iw_kb_description",sortOrder:100,cannotRemove:!0,content:'You have access to a database of knowledge base items. These include "info" type items which provide information and "tour" type items which contain instructions you should follow (only do one item at a time). Current info and tour items:'});let i=this._nextRequestUseKBitems||await this.knowledgeBase.search(this._lastKBsearch);this._nextRequestUseKBitems=void 0;for(let a of i)if(a.type=="info"||a.type=="tour"||a.type=="input-event")this.currentModel.contextGroup.add({id:a.id,customData:a,cannotRemove:a.isContext,sortOrder:101,disabled:a.disabled,content:JSON.stringify({id:a.id,type:a.type,name:a.name,content:Oi(typeof a.content=="function"?a.content():a.content)})+`
3266
3272
  `});else if(a.type=="action"){let o={name:a._functionID,description:Oi(typeof a.content=="function"?a.content():a.content),params:a.parameters||[{name:"value",type:"string",description:"Input"}],removeFromMessageHistory:!!a.removeFromMessageHistory,callback:s=>this.toolRunKBAction(a,s),kb:a};this.currentModel.toolGroup.add({id:a._functionID,customData:o,cannotRemove:a.isContext,sortOrder:101,disabled:a.disabled,content:JSON.stringify(o)})}else continue;let r=this.currentModel.contextGroup.getAllAsString();this._lastSystemMsg!=r&&(this._lastSystemMsg=r,this.submitAnalyticsEvent({type:"system-msg",txt:r}))}processIncomingMessage(t,i){i||this.submitAnalyticsEvent({type:"message",role:"assistant",message:t});let r="";this._lastOutput===void 0?(r=t,this._lastOutput=t):t.startsWith(this._lastOutput)?(r=t.substring(this._lastOutput.length),this._lastOutput=t):(Ae.warn("Message was changed during chunking. This should not happen.",t,this._lastOutput),r=t,this._lastOutput=t),i||(this._lastOutput=void 0),this.dispatchEvent(new CustomEvent("output",{detail:{ai:this,isChunk:i,message:t,messageChunk:r}})),this.onAIMessage?.(t,!!i)}async sendMessage(t){if(!this.currentModel)throw new Error("No model selected. Please call load() first.");if(this.isProcessing)return Ae.warn("Cannot send message while another message is being processed."),null;this.isProcessing=!0;try{return this.submitAnalyticsEvent({type:"message",role:"user",message:t}),this.dispatchEvent(new CustomEvent("input",{detail:{ai:this,message:t}})),await this.currentModel.sendMessage(t)}finally{this.isProcessing=!1}}async toolRunKBAction(t,i){try{this.dispatchEvent(new CustomEvent("toolstart",{detail:{knowledgeBaseEntry:t,input:i,ai:this}}));let r=await t.action(i,this);return this.submitAnalyticsEvent({type:"action",action:t.id,value:i,result:r}),this.dispatchEvent(new CustomEvent("tool",{detail:{knowledgeBaseEntry:t,input:i,ai:this,result:r}})),r}catch(r){throw this.submitAnalyticsEvent({type:"action",action:t.id,value:i,error:r.message}),this.dispatchEvent(new CustomEvent("tool",{detail:{knowledgeBaseEntry:t,input:i,ai:this,error:r}})),r}}submitAnalyticsEvent(t){$().analytics===!1||this.config?.analytics===!1||fetch(this.hubAPI+"/analytics/post",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...t,apiKey:this.apiKey,time:Date.now(),conversationID:this.conversationID,personaID:this.config?.id})}).catch(i=>{Ae.debug("Failed to submit analytics event:",i)})}resetConversation(){this.currentModel&&(this.currentModel.resetConversation(),this.conversationID=Te(),this._lastSystemMsg="")}insertAssistantMessage(t){if(!this.currentModel)throw new Error("No model selected. Please call load() first.");let i={role:"assistant",content:t};this.currentModel.messageGroup.add({id:Te(),content:JSON.stringify(i),customData:i})}exportState(){return{type:"intelliweave/state/v1",conversationID:this.conversationID,messages:this.currentModel?.messageGroup.getAll().map(t=>t.customData)}}importState(t){if(!this.currentModel)throw new Error("No model selected. Please call load() first.");if(t?.type!="intelliweave/state/v1")throw new Error(`Invalid state type: ${t.type}`);this.conversationID=t.conversationID;for(let i of t.messages)this.currentModel.messageGroup.add({id:Te(),content:JSON.stringify(i),customData:i})}clone(){let t=new An;return t.apiKey=this.apiKey,t.config=this.config,t.models=this.models,this.config?.id&&t.setModel(this.config.id),t.audio=this.audio,t.vadModel=this.vadModel,t.userID=this.userID,t.extra=this.extra,t.knowledgeBase=this.knowledgeBase.clone(),t}};An.version=go.version;var St=An;var be=class extends HTMLElement{constructor(){super(...arguments);this._state={}}get root(){return this._shadow}static register(){this._isRegistered||(this._isRegistered=!0,this.tagName||(this.tagName="anonymous-component-"+this.name.toLowerCase().replace(/[^a-z0-9-]/g,"-")+"--"+Math.random().toString(36).substring(2)),window.customElements.define(this.tagName,this))}static create(t={},i=""){this.register();let r=document.createElement(this.tagName);for(let a in t)r.setAttribute(a,t[a]);return r.onBeforeCreate(),r.innerHTML=i,r}static add(t={},i=""){return this.register(),`<${this.tagName} ${Object.keys(t).map(r=>`${r}="${(t[r]+"").replaceAll('"',"&quot;")}"`).join(" ")}>${i}</${this.tagName}>`}static createElement(){return this.register(),document.createElement(this.tagName)}connectedCallback(){this._shadow||(this._shadow=this.attachShadow({mode:"closed"}),this._shadow.innerHTML=this.html(),this.onCreate()),this.onUpdate()}disconnectedCallback(){this._shadow=void 0,this.onDestroy()}html(){return""}onBeforeCreate(){}onCreate(){}onUpdate(){}onDestroy(){}attributeChangedCallback(t,i,r){this._shadow&&this.onUpdate()}get attr(){if(this._attrProxy)return this._attrProxy;let t=i=>(xn=xn||document.createElement("div"),xn.innerText=i||"",xn.innerHTML);return this._attrProxy=new Proxy({},{get:(i,r)=>t(this.getAttribute(r.toString())||""),set:(i,r,a)=>(this.getAttribute(r.toString())===a||(a?this.setAttribute(r.toString(),a):this.removeAttribute(r.toString()),this._shadow&&this.onUpdate()),!0)}),this._attrProxy}get state(){return this._stateProxy?this._stateProxy:(this._stateProxy=new Proxy({},{get:(t,i)=>this._state[i],set:(t,i,r)=>(this._state[i]=r,this._shadow&&this.onUpdate(),!0)}),this._stateProxy)}hasChild(t){return!!this.root?.getElementById(t)}child(t){let i=this.root?.getElementById(t);if(!i)throw new Error(`Child with ID ${t} not found`);return i}};be.observedAttributes=[],be.tagName="",be._isRegistered=!1;var xn;var ho='data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" preserveAspectRatio="xMidYMid" width="200" height="200" style="shape-rendering: auto; display: block; " xmlns:xlink="http://www.w3.org/1999/xlink"><g><circle cx="84" cy="50" r="10" fill="%23797979">%0A <animate attributeName="r" repeatCount="indefinite" dur="0.5s" calcMode="spline" keyTimes="0;1" values="10;0" keySplines="0 0.5 0.5 1" begin="0s"></animate>%0A <animate attributeName="fill" repeatCount="indefinite" dur="2s" calcMode="discrete" keyTimes="0;0.25;0.5;0.75;1" values="%23797979;%23797979;%23797979;%23797979;%23797979" begin="0s"></animate>%0A</circle><circle cx="16" cy="50" r="10" fill="%23797979">%0A <animate attributeName="r" repeatCount="indefinite" dur="2s" calcMode="spline" keyTimes="0;0.25;0.5;0.75;1" values="0;0;10;10;10" keySplines="0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1" begin="0s"></animate>%0A <animate attributeName="cx" repeatCount="indefinite" dur="2s" calcMode="spline" keyTimes="0;0.25;0.5;0.75;1" values="16;16;16;50;84" keySplines="0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1" begin="0s"></animate>%0A</circle><circle cx="50" cy="50" r="10" fill="%23797979">%0A <animate attributeName="r" repeatCount="indefinite" dur="2s" calcMode="spline" keyTimes="0;0.25;0.5;0.75;1" values="0;0;10;10;10" keySplines="0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1" begin="-0.5s"></animate>%0A <animate attributeName="cx" repeatCount="indefinite" dur="2s" calcMode="spline" keyTimes="0;0.25;0.5;0.75;1" values="16;16;16;50;84" keySplines="0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1" begin="-0.5s"></animate>%0A</circle><circle cx="84" cy="50" r="10" fill="%23797979">%0A <animate attributeName="r" repeatCount="indefinite" dur="2s" calcMode="spline" keyTimes="0;0.25;0.5;0.75;1" values="0;0;10;10;10" keySplines="0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1" begin="-1s"></animate>%0A <animate attributeName="cx" repeatCount="indefinite" dur="2s" calcMode="spline" keyTimes="0;0.25;0.5;0.75;1" values="16;16;16;50;84" keySplines="0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1" begin="-1s"></animate>%0A</circle><circle cx="16" cy="50" r="10" fill="%23797979">%0A <animate attributeName="r" repeatCount="indefinite" dur="2s" calcMode="spline" keyTimes="0;0.25;0.5;0.75;1" values="0;0;10;10;10" keySplines="0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1" begin="-1.5s"></animate>%0A <animate attributeName="cx" repeatCount="indefinite" dur="2s" calcMode="spline" keyTimes="0;0.25;0.5;0.75;1" values="16;16;16;50;84" keySplines="0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1" begin="-1.5s"></animate>%0A</circle><g></g></g><!-- [ldio] generated by https://loading.io --></svg>';var fo='data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" width="512" height="512" x="0" y="0" viewBox="0 0 475.085 475.085" style="enable-background:new 0 0 512 512" xml:space="preserve" class=""><g><path d="M237.541 328.897c25.128 0 46.632-8.946 64.523-26.83 17.888-17.884 26.833-39.399 26.833-64.525V91.365c0-25.126-8.938-46.632-26.833-64.525C284.173 8.951 262.669 0 237.541 0c-25.125 0-46.632 8.951-64.524 26.84-17.893 17.89-26.838 39.399-26.838 64.525v146.177c0 25.125 8.949 46.641 26.838 64.525 17.889 17.884 39.399 26.83 64.524 26.83z" fill="%23ffffff" opacity="1" data-original="%23000000" class=""></path><path d="M396.563 188.15c-3.606-3.617-7.898-5.426-12.847-5.426-4.944 0-9.226 1.809-12.847 5.426-3.613 3.616-5.421 7.898-5.421 12.845v36.547c0 35.214-12.518 65.333-37.548 90.362-25.022 25.03-55.145 37.545-90.36 37.545-35.214 0-65.334-12.515-90.365-37.545-25.028-25.022-37.541-55.147-37.541-90.362v-36.547c0-4.947-1.809-9.229-5.424-12.845-3.617-3.617-7.895-5.426-12.847-5.426s-9.235 1.809-12.85 5.426c-3.618 3.616-5.426 7.898-5.426 12.845v36.547c0 42.065 14.04 78.659 42.112 109.776 28.073 31.118 62.762 48.961 104.068 53.526v37.691h-73.089c-4.949 0-9.231 1.811-12.847 5.428-3.617 3.614-5.426 7.898-5.426 12.847 0 4.941 1.809 9.233 5.426 12.847 3.616 3.614 7.898 5.428 12.847 5.428h182.719c4.948 0 9.236-1.813 12.847-5.428 3.621-3.613 5.431-7.905 5.431-12.847 0-4.948-1.81-9.232-5.431-12.847-3.61-3.617-7.898-5.428-12.847-5.428h-73.08v-37.691c41.299-4.565 75.985-22.408 104.061-53.526 28.076-31.117 42.12-67.711 42.12-109.776v-36.547c0-4.946-1.813-9.225-5.435-12.845z" fill="%23ffffff" opacity="1" data-original="%23000000" class=""></path></g></svg>';var yo='data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" width="512" height="512" x="0" y="0" viewBox="0 0 448.075 448.075" style="enable-background:new 0 0 512 512" xml:space="preserve" class=""><g><path d="M352.021 16.075c0-6.08-3.52-11.84-8.96-14.4-5.76-2.88-12.16-1.92-16.96 1.92l-141.76 112.96 167.68 167.68zM443.349 420.747l-416-416c-6.24-6.24-16.384-6.24-22.624 0s-6.24 16.384 0 22.624l100.672 100.704h-9.376c-9.92 0-18.56 4.48-24.32 11.52-4.8 5.44-7.68 12.8-7.68 20.48v128c0 17.6 14.4 32 32 32h74.24l155.84 124.48c2.88 2.24 6.4 3.52 9.92 3.52 2.24 0 4.8-.64 7.04-1.6 5.44-2.56 8.96-8.32 8.96-14.4v-57.376l68.672 68.672c3.136 3.136 7.232 4.704 11.328 4.704s8.192-1.568 11.328-4.672c6.24-6.272 6.24-16.384 0-22.656z" fill="%23ffffff" opacity="1" data-original="%23000000" class=""></path></g></svg>';var Ft=class extends be{constructor(){super(...arguments);this.html=()=>`
3267
3273
 
3268
3274
  <!-- Styling -->
@@ -3419,12 +3425,12 @@ extractions:`+JSON.stringify(r))||"";o=o.replace(/```json/g,"").replace(/```/g,"
3419
3425
  <!-- Logo -->
3420
3426
  <img id='root' src='${this.attr.logo||nr}' />
3421
3427
 
3422
- `;this._lastLogoSrc=""}onCreate(){this.layoutUpdateTimer=setInterval(()=>this.onUpdate(),250)}onDestroy(){clearInterval(this.layoutUpdateTimer)}onUpdate(){let t=this.child("root");if(!t)return;let i=this.attr.logo||nr;this._lastLogoSrc!=i&&(this._lastLogoSrc=i,t.src=i);let r=window.visualViewport?.offsetTop||0,a=window.visualViewport?.offsetLeft||0,o=this.attr.focusID?document.getElementById(this.attr.focusID):null;if(o){let s=o.getBoundingClientRect();if(!s)return;t.style.position="fixed",t.style.width="128px",t.style.height="128px",t.style.left=Math.round(s.x+s.width/2-128/2+a)+"px",t.style.top=Math.round(s.y+s.height/2-128/2+r)+"px"}else{let s=this.getBoundingClientRect();if(!s)return;t.style.width=s.width+"px",t.style.height=s.height+"px",t.style.left=Math.round(s.x+a)+"px",t.style.top=Math.round(s.y+r)+"px"}}refreshLayout(){setTimeout(()=>this.onUpdate(),100)}};Gt.observedAttributes=["logo","focusID"];var bo=typeof self=="object"?self:globalThis,Lu=(e,n)=>{let t=(r,a)=>(e.set(a,r),r),i=r=>{if(e.has(r))return e.get(r);let[a,o]=n[r];switch(a){case 0:case-1:return t(o,r);case 1:{let s=t([],r);for(let l of o)s.push(i(l));return s}case 2:{let s=t({},r);for(let[l,c]of o)s[i(l)]=i(c);return s}case 3:return t(new Date(o),r);case 4:{let{source:s,flags:l}=o;return t(new RegExp(s,l),r)}case 5:{let s=t(new Map,r);for(let[l,c]of o)s.set(i(l),i(c));return s}case 6:{let s=t(new Set,r);for(let l of o)s.add(i(l));return s}case 7:{let{name:s,message:l}=o;return t(new bo[s](l),r)}case 8:return t(BigInt(o),r);case"BigInt":return t(Object(BigInt(o)),r)}return t(new bo[a](o),r)};return i},or=e=>Lu(new Map,e)(0);var Et="",{toString:Nu}={},{keys:Mu}=Object,Vt=e=>{let n=typeof e;if(n!=="object"||!e)return[0,n];let t=Nu.call(e).slice(8,-1);switch(t){case"Array":return[1,Et];case"Object":return[2,Et];case"Date":return[3,Et];case"RegExp":return[4,Et];case"Map":return[5,Et];case"Set":return[6,Et]}return t.includes("Array")?[1,t]:t.includes("Error")?[7,t]:[2,t]},Ln=([e,n])=>e===0&&(n==="function"||n==="symbol"),Ou=(e,n,t,i)=>{let r=(o,s)=>{let l=i.push(o)-1;return t.set(s,l),l},a=o=>{if(t.has(o))return t.get(o);let[s,l]=Vt(o);switch(s){case 0:{let u=o;switch(l){case"bigint":s=8,u=o.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+l);u=null;break;case"undefined":return r([-1],o)}return r([s,u],o)}case 1:{if(l)return r([l,[...o]],o);let u=[],d=r([s,u],o);for(let m of o)u.push(a(m));return d}case 2:{if(l)switch(l){case"BigInt":return r([l,o.toString()],o);case"Boolean":case"Number":case"String":return r([l,o.valueOf()],o)}if(n&&"toJSON"in o)return a(o.toJSON());let u=[],d=r([s,u],o);for(let m of Mu(o))(e||!Ln(Vt(o[m])))&&u.push([a(m),a(o[m])]);return d}case 3:return r([s,o.toISOString()],o);case 4:{let{source:u,flags:d}=o;return r([s,{source:u,flags:d}],o)}case 5:{let u=[],d=r([s,u],o);for(let[m,p]of o)(e||!(Ln(Vt(m))||Ln(Vt(p))))&&u.push([a(m),a(p)]);return d}case 6:{let u=[],d=r([s,u],o);for(let m of o)(e||!Ln(Vt(m)))&&u.push(a(m));return d}}let{message:c}=o;return r([s,{name:l,message:c}],o)};return a},sr=(e,{json:n,lossy:t}={})=>{let i=[];return Ou(!(n||t),!!n,new Map,i)(e),i};var Pe=typeof structuredClone=="function"?(e,n)=>n&&("json"in n||"lossy"in n)?or(sr(e,n)):structuredClone(e):(e,n)=>or(sr(e,n));var De=function(e,n,t,i,r){let a=Le(n);if(t!=null&&(typeof t!="number"||t<0||t===Number.POSITIVE_INFINITY))throw new Error("Expected positive finite `index`");if(i!=null&&(!i.type||!i.children))throw new Error("Expected valid `parent`");if(t==null!=(i==null))throw new Error("Expected both `index` and `parent`");return vo(e)?a.call(r,e,t,i):!1},Le=function(e){if(e==null)return Gu;if(typeof e=="string")return Fu(e);if(typeof e=="object")return Bu(e);if(typeof e=="function")return lr(e);throw new Error("Expected function, string, or array as `test`")};function Bu(e){let n=[],t=-1;for(;++t<e.length;)n[t]=Le(e[t]);return lr(i);function i(...r){let a=-1;for(;++a<n.length;)if(n[a].apply(this,r))return!0;return!1}}function Fu(e){return lr(n);function n(t){return t.tagName===e}}function lr(e){return n;function n(t,i,r){return!!(vo(t)&&e.call(this,t,typeof i=="number"?i:void 0,r||void 0))}}function Gu(e){return!!(e&&typeof e=="object"&&"type"in e&&e.type==="element"&&"tagName"in e&&typeof e.tagName=="string")}function vo(e){return e!==null&&typeof e=="object"&&"type"in e&&"tagName"in e}var zu=/^[a-zA-Z][a-zA-Z\d+\-.]*?:/,Uu=/^[a-zA-Z]:\\/;function cr(e){if(typeof e!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);return Uu.test(e)?!1:zu.test(e)}function _o(e){let n=String(e||"").trim();return n?n.split(/[ \t\n\r\f]+/g):[]}function So(e){return e.join(" ").trim()}var Ct=function(e){if(e==null)return ju;if(typeof e=="function")return Nn(e);if(typeof e=="object")return Array.isArray(e)?Hu(e):Vu(e);if(typeof e=="string")return Wu(e);throw new Error("Expected function, string, or object as test")};function Hu(e){let n=[],t=-1;for(;++t<e.length;)n[t]=Ct(e[t]);return Nn(i);function i(...r){let a=-1;for(;++a<n.length;)if(n[a].apply(this,r))return!0;return!1}}function Vu(e){let n=e;return Nn(t);function t(i){let r=i,a;for(a in e)if(r[a]!==n[a])return!1;return!0}}function Wu(e){return Nn(n);function n(t){return t&&t.type===e}}function Nn(e){return n;function n(t,i,r){return!!(qu(t)&&e.call(this,t,typeof i=="number"?i:void 0,r||void 0))}}function ju(){return!0}function qu(e){return e!==null&&typeof e=="object"&&"type"in e}var Eo=[],ur=!0,Mn=!1,Wt="skip";function jt(e,n,t,i){let r;typeof n=="function"&&typeof t!="function"?(i=t,t=n):r=n;let a=Ct(r),o=i?-1:1;s(e,void 0,[])();function s(l,c,u){let d=l&&typeof l=="object"?l:{};if(typeof d.type=="string"){let p=typeof d.tagName=="string"?d.tagName:typeof d.name=="string"?d.name:void 0;Object.defineProperty(m,"name",{value:"node ("+(l.type+(p?"<"+p+">":""))+")"})}return m;function m(){let p=Eo,f,_,E;if((!n||a(l,c,u[u.length-1]||void 0))&&(p=Ku(t(l,u)),p[0]===Mn))return p;if("children"in l&&l.children){let y=l;if(y.children&&p[0]!==Wt)for(_=(i?y.children.length:-1)+o,E=u.concat(y);_>-1&&_<y.children.length;){let T=y.children[_];if(f=s(T,_,E)(),f[0]===Mn)return f;_=typeof f[1]=="number"?f[1]:_+o}}return p}}}function Ku(e){return Array.isArray(e)?e:typeof e=="number"?[ur,e]:e==null?Eo:[e]}function qt(e,n,t,i){let r,a,o;typeof n=="function"&&typeof t!="function"?(a=void 0,o=n,r=t):(a=n,o=t,r=i),jt(e,a,s,r);function s(l,c){let u=c[c.length-1],d=u?u.children.indexOf(l):void 0;return o(l,d,u)}}var Xu=["http","https"],Yu=["nofollow"],Ju={};function On(e){let n=e||Ju,t=n.protocols||Xu,i=Le(n.test);return function(r){qt(r,"element",function(a,o,s){if(a.tagName==="a"&&typeof a.properties.href=="string"&&i(a,o,s)){let l=a.properties.href;if(cr(l)?t.includes(l.slice(0,l.indexOf(":"))):l.startsWith("//")){let c=Kt(n.content,a),u=c&&!Array.isArray(c)?[c]:c,d=Kt(n.rel,a)||Yu,m=typeof d=="string"?_o(d):d,p=Kt(n.target,a),f=Kt(n.properties,a);if(f&&Object.assign(a.properties,Pe(f)),m.length>0&&(a.properties.rel=[...m]),p&&(a.properties.target=p),u){let _=Kt(n.contentProperties,a)||{};a.children.push({type:"element",tagName:"span",properties:Pe(_),children:Pe(u)})}}}})}}function Kt(e,n){return typeof e=="function"?e(n):e}var nt=Le(function(e){return e.tagName==="audio"||e.tagName==="canvas"||e.tagName==="embed"||e.tagName==="iframe"||e.tagName==="img"||e.tagName==="math"||e.tagName==="object"||e.tagName==="picture"||e.tagName==="svg"||e.tagName==="video"});var Zu={}.hasOwnProperty;function dr(e,n){let t=e.type==="element"&&Zu.call(e.properties,n)&&e.properties[n];return t!=null&&t!==!1}var $u=new Set(["pingback","prefetch","stylesheet"]);function pr(e){if(e.type!=="element"||e.tagName!=="link")return!1;if(e.properties.itemProp)return!0;let n=e.properties.rel,t=-1;if(!Array.isArray(n)||n.length===0)return!1;for(;++t<n.length;)if(!$u.has(String(n[t])))return!1;return!0}var Qu=Le(["a","abbr","area","b","bdi","bdo","br","button","cite","code","data","datalist","del","dfn","em","i","input","ins","kbd","keygen","label","map","mark","meter","noscript","output","progress","q","ruby","s","samp","script","select","small","span","strong","sub","sup","template","textarea","time","u","var","wbr"]),ed=Le("meta");function mr(e){return!!(e.type==="text"||Qu(e)||nt(e)||pr(e)||ed(e)&&dr(e,"itemProp"))}var td=/[ \t\n\f\r]/g;function ve(e){return typeof e=="object"?e.type==="text"?Co(e.value):!1:Co(e)}function Co(e){return e.replace(td,"")===""}var gr=["pre","script","style","textarea"];var ko=["address","article","aside","blockquote","body","br","caption","center","col","colgroup","dd","dialog","dir","div","dl","dt","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","legend","li","li","listing","main","menu","nav","ol","optgroup","option","p","plaintext","pre","section","summary","table","tbody","td","td","tfoot","th","th","thead","tr","ul","wbr","xmp"];var wo=["button","input","select","textarea"];var To=["area","base","basefont","dialog","datalist","head","link","meta","noembed","noframes","param","rp","script","source","style","template","track","title"];var nd={},hr=Ct(["doctype","comment"]);function Bn(e){let t=cd((e||nd).newlines?sd:ld);return function(i){xo(i,{collapse:t,whitespace:"normal"})}}function xo(e,n){if("children"in e){let t={...n};return(e.type==="root"||Po(e))&&(t.before=!0,t.after=!0),t.whitespace=ud(e,n),rd(e,t)}if(e.type==="text"){if(n.whitespace==="normal")return id(e,n);n.whitespace==="nowrap"&&(e.value=n.collapse(e.value))}return{ignore:hr(e),stripAtStart:!1,remove:!1}}function id(e,n){let t=n.collapse(e.value),i={ignore:!1,stripAtStart:!1,remove:!1},r=0,a=t.length;return n.before&&Ao(t.charAt(0))&&r++,r!==a&&Ao(t.charAt(a-1))&&(n.after?a--:i.stripAtStart=!0),r===a?i.remove=!0:e.value=t.slice(r,a),i}function rd(e,n){let t=n.before,i=n.after,r=e.children,a=r.length,o=-1;for(;++o<a;){let s=xo(r[o],{...n,after:Io(r,o,i),before:t});s.remove?(r.splice(o,1),o--,a--):s.ignore||(t=s.stripAtStart),Ro(r[o])&&(t=!1)}return{ignore:!1,stripAtStart:!!(t||i),remove:!1}}function Io(e,n,t){for(;++n<e.length;){let i=e[n],r=ad(i);if(r===void 0&&"children"in i&&!od(i)&&(r=Io(i.children,-1)),typeof r=="boolean")return r}return t}function ad(e){if(e.type==="element"){if(Ro(e))return!1;if(Po(e))return!0}else if(e.type==="text"){if(!ve(e))return!1}else if(!hr(e))return!1}function Ro(e){return nt(e)||De(e,wo)}function Po(e){return De(e,ko)}function od(e){return!!(e.type==="element"&&e.properties.hidden)||hr(e)||De(e,To)}function Ao(e){return e===" "||e===`
3428
+ `;this._lastLogoSrc=""}onCreate(){this.layoutUpdateTimer=setInterval(()=>this.onUpdate(),250)}onDestroy(){clearInterval(this.layoutUpdateTimer)}onUpdate(){let t=this.child("root");if(!t)return;let i=this.attr.logo||nr;this._lastLogoSrc!=i&&(this._lastLogoSrc=i,t.src=i);let r=window.visualViewport?.offsetTop||0,a=window.visualViewport?.offsetLeft||0,o=this.attr.focusID?document.getElementById(this.attr.focusID):null;if(o){let s=o.getBoundingClientRect();if(!s)return;t.style.position="fixed",t.style.width="128px",t.style.height="128px",t.style.left=Math.round(s.x+s.width/2-128/2+a)+"px",t.style.top=Math.round(s.y+s.height/2-128/2+r)+"px"}else{let s=this.getBoundingClientRect();if(!s)return;t.style.width=s.width+"px",t.style.height=s.height+"px",t.style.left=Math.round(s.x+a)+"px",t.style.top=Math.round(s.y+r)+"px"}}refreshLayout(){setTimeout(()=>this.onUpdate(),100)}};Gt.observedAttributes=["logo","focusID"];var bo=typeof self=="object"?self:globalThis,Nu=(e,n)=>{let t=(r,a)=>(e.set(a,r),r),i=r=>{if(e.has(r))return e.get(r);let[a,o]=n[r];switch(a){case 0:case-1:return t(o,r);case 1:{let s=t([],r);for(let l of o)s.push(i(l));return s}case 2:{let s=t({},r);for(let[l,c]of o)s[i(l)]=i(c);return s}case 3:return t(new Date(o),r);case 4:{let{source:s,flags:l}=o;return t(new RegExp(s,l),r)}case 5:{let s=t(new Map,r);for(let[l,c]of o)s.set(i(l),i(c));return s}case 6:{let s=t(new Set,r);for(let l of o)s.add(i(l));return s}case 7:{let{name:s,message:l}=o;return t(new bo[s](l),r)}case 8:return t(BigInt(o),r);case"BigInt":return t(Object(BigInt(o)),r)}return t(new bo[a](o),r)};return i},or=e=>Nu(new Map,e)(0);var Et="",{toString:Lu}={},{keys:Mu}=Object,Vt=e=>{let n=typeof e;if(n!=="object"||!e)return[0,n];let t=Lu.call(e).slice(8,-1);switch(t){case"Array":return[1,Et];case"Object":return[2,Et];case"Date":return[3,Et];case"RegExp":return[4,Et];case"Map":return[5,Et];case"Set":return[6,Et]}return t.includes("Array")?[1,t]:t.includes("Error")?[7,t]:[2,t]},Nn=([e,n])=>e===0&&(n==="function"||n==="symbol"),Ou=(e,n,t,i)=>{let r=(o,s)=>{let l=i.push(o)-1;return t.set(s,l),l},a=o=>{if(t.has(o))return t.get(o);let[s,l]=Vt(o);switch(s){case 0:{let u=o;switch(l){case"bigint":s=8,u=o.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+l);u=null;break;case"undefined":return r([-1],o)}return r([s,u],o)}case 1:{if(l)return r([l,[...o]],o);let u=[],d=r([s,u],o);for(let m of o)u.push(a(m));return d}case 2:{if(l)switch(l){case"BigInt":return r([l,o.toString()],o);case"Boolean":case"Number":case"String":return r([l,o.valueOf()],o)}if(n&&"toJSON"in o)return a(o.toJSON());let u=[],d=r([s,u],o);for(let m of Mu(o))(e||!Nn(Vt(o[m])))&&u.push([a(m),a(o[m])]);return d}case 3:return r([s,o.toISOString()],o);case 4:{let{source:u,flags:d}=o;return r([s,{source:u,flags:d}],o)}case 5:{let u=[],d=r([s,u],o);for(let[m,p]of o)(e||!(Nn(Vt(m))||Nn(Vt(p))))&&u.push([a(m),a(p)]);return d}case 6:{let u=[],d=r([s,u],o);for(let m of o)(e||!Nn(Vt(m)))&&u.push(a(m));return d}}let{message:c}=o;return r([s,{name:l,message:c}],o)};return a},sr=(e,{json:n,lossy:t}={})=>{let i=[];return Ou(!(n||t),!!n,new Map,i)(e),i};var Pe=typeof structuredClone=="function"?(e,n)=>n&&("json"in n||"lossy"in n)?or(sr(e,n)):structuredClone(e):(e,n)=>or(sr(e,n));var De=function(e,n,t,i,r){let a=Ne(n);if(t!=null&&(typeof t!="number"||t<0||t===Number.POSITIVE_INFINITY))throw new Error("Expected positive finite `index`");if(i!=null&&(!i.type||!i.children))throw new Error("Expected valid `parent`");if(t==null!=(i==null))throw new Error("Expected both `index` and `parent`");return vo(e)?a.call(r,e,t,i):!1},Ne=function(e){if(e==null)return Gu;if(typeof e=="string")return Fu(e);if(typeof e=="object")return Bu(e);if(typeof e=="function")return lr(e);throw new Error("Expected function, string, or array as `test`")};function Bu(e){let n=[],t=-1;for(;++t<e.length;)n[t]=Ne(e[t]);return lr(i);function i(...r){let a=-1;for(;++a<n.length;)if(n[a].apply(this,r))return!0;return!1}}function Fu(e){return lr(n);function n(t){return t.tagName===e}}function lr(e){return n;function n(t,i,r){return!!(vo(t)&&e.call(this,t,typeof i=="number"?i:void 0,r||void 0))}}function Gu(e){return!!(e&&typeof e=="object"&&"type"in e&&e.type==="element"&&"tagName"in e&&typeof e.tagName=="string")}function vo(e){return e!==null&&typeof e=="object"&&"type"in e&&"tagName"in e}var zu=/^[a-zA-Z][a-zA-Z\d+\-.]*?:/,Uu=/^[a-zA-Z]:\\/;function cr(e){if(typeof e!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);return Uu.test(e)?!1:zu.test(e)}function _o(e){let n=String(e||"").trim();return n?n.split(/[ \t\n\r\f]+/g):[]}function So(e){return e.join(" ").trim()}var Ct=function(e){if(e==null)return ju;if(typeof e=="function")return Ln(e);if(typeof e=="object")return Array.isArray(e)?Hu(e):Vu(e);if(typeof e=="string")return Wu(e);throw new Error("Expected function, string, or object as test")};function Hu(e){let n=[],t=-1;for(;++t<e.length;)n[t]=Ct(e[t]);return Ln(i);function i(...r){let a=-1;for(;++a<n.length;)if(n[a].apply(this,r))return!0;return!1}}function Vu(e){let n=e;return Ln(t);function t(i){let r=i,a;for(a in e)if(r[a]!==n[a])return!1;return!0}}function Wu(e){return Ln(n);function n(t){return t&&t.type===e}}function Ln(e){return n;function n(t,i,r){return!!(qu(t)&&e.call(this,t,typeof i=="number"?i:void 0,r||void 0))}}function ju(){return!0}function qu(e){return e!==null&&typeof e=="object"&&"type"in e}var Eo=[],ur=!0,Mn=!1,Wt="skip";function jt(e,n,t,i){let r;typeof n=="function"&&typeof t!="function"?(i=t,t=n):r=n;let a=Ct(r),o=i?-1:1;s(e,void 0,[])();function s(l,c,u){let d=l&&typeof l=="object"?l:{};if(typeof d.type=="string"){let p=typeof d.tagName=="string"?d.tagName:typeof d.name=="string"?d.name:void 0;Object.defineProperty(m,"name",{value:"node ("+(l.type+(p?"<"+p+">":""))+")"})}return m;function m(){let p=Eo,f,_,E;if((!n||a(l,c,u[u.length-1]||void 0))&&(p=Ku(t(l,u)),p[0]===Mn))return p;if("children"in l&&l.children){let y=l;if(y.children&&p[0]!==Wt)for(_=(i?y.children.length:-1)+o,E=u.concat(y);_>-1&&_<y.children.length;){let T=y.children[_];if(f=s(T,_,E)(),f[0]===Mn)return f;_=typeof f[1]=="number"?f[1]:_+o}}return p}}}function Ku(e){return Array.isArray(e)?e:typeof e=="number"?[ur,e]:e==null?Eo:[e]}function qt(e,n,t,i){let r,a,o;typeof n=="function"&&typeof t!="function"?(a=void 0,o=n,r=t):(a=n,o=t,r=i),jt(e,a,s,r);function s(l,c){let u=c[c.length-1],d=u?u.children.indexOf(l):void 0;return o(l,d,u)}}var Xu=["http","https"],Yu=["nofollow"],Ju={};function On(e){let n=e||Ju,t=n.protocols||Xu,i=Ne(n.test);return function(r){qt(r,"element",function(a,o,s){if(a.tagName==="a"&&typeof a.properties.href=="string"&&i(a,o,s)){let l=a.properties.href;if(cr(l)?t.includes(l.slice(0,l.indexOf(":"))):l.startsWith("//")){let c=Kt(n.content,a),u=c&&!Array.isArray(c)?[c]:c,d=Kt(n.rel,a)||Yu,m=typeof d=="string"?_o(d):d,p=Kt(n.target,a),f=Kt(n.properties,a);if(f&&Object.assign(a.properties,Pe(f)),m.length>0&&(a.properties.rel=[...m]),p&&(a.properties.target=p),u){let _=Kt(n.contentProperties,a)||{};a.children.push({type:"element",tagName:"span",properties:Pe(_),children:Pe(u)})}}}})}}function Kt(e,n){return typeof e=="function"?e(n):e}var nt=Ne(function(e){return e.tagName==="audio"||e.tagName==="canvas"||e.tagName==="embed"||e.tagName==="iframe"||e.tagName==="img"||e.tagName==="math"||e.tagName==="object"||e.tagName==="picture"||e.tagName==="svg"||e.tagName==="video"});var Zu={}.hasOwnProperty;function dr(e,n){let t=e.type==="element"&&Zu.call(e.properties,n)&&e.properties[n];return t!=null&&t!==!1}var $u=new Set(["pingback","prefetch","stylesheet"]);function pr(e){if(e.type!=="element"||e.tagName!=="link")return!1;if(e.properties.itemProp)return!0;let n=e.properties.rel,t=-1;if(!Array.isArray(n)||n.length===0)return!1;for(;++t<n.length;)if(!$u.has(String(n[t])))return!1;return!0}var Qu=Ne(["a","abbr","area","b","bdi","bdo","br","button","cite","code","data","datalist","del","dfn","em","i","input","ins","kbd","keygen","label","map","mark","meter","noscript","output","progress","q","ruby","s","samp","script","select","small","span","strong","sub","sup","template","textarea","time","u","var","wbr"]),ed=Ne("meta");function mr(e){return!!(e.type==="text"||Qu(e)||nt(e)||pr(e)||ed(e)&&dr(e,"itemProp"))}var td=/[ \t\n\f\r]/g;function ve(e){return typeof e=="object"?e.type==="text"?Co(e.value):!1:Co(e)}function Co(e){return e.replace(td,"")===""}var gr=["pre","script","style","textarea"];var ko=["address","article","aside","blockquote","body","br","caption","center","col","colgroup","dd","dialog","dir","div","dl","dt","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","legend","li","li","listing","main","menu","nav","ol","optgroup","option","p","plaintext","pre","section","summary","table","tbody","td","td","tfoot","th","th","thead","tr","ul","wbr","xmp"];var wo=["button","input","select","textarea"];var To=["area","base","basefont","dialog","datalist","head","link","meta","noembed","noframes","param","rp","script","source","style","template","track","title"];var nd={},hr=Ct(["doctype","comment"]);function Bn(e){let t=cd((e||nd).newlines?sd:ld);return function(i){xo(i,{collapse:t,whitespace:"normal"})}}function xo(e,n){if("children"in e){let t={...n};return(e.type==="root"||Po(e))&&(t.before=!0,t.after=!0),t.whitespace=ud(e,n),rd(e,t)}if(e.type==="text"){if(n.whitespace==="normal")return id(e,n);n.whitespace==="nowrap"&&(e.value=n.collapse(e.value))}return{ignore:hr(e),stripAtStart:!1,remove:!1}}function id(e,n){let t=n.collapse(e.value),i={ignore:!1,stripAtStart:!1,remove:!1},r=0,a=t.length;return n.before&&Ao(t.charAt(0))&&r++,r!==a&&Ao(t.charAt(a-1))&&(n.after?a--:i.stripAtStart=!0),r===a?i.remove=!0:e.value=t.slice(r,a),i}function rd(e,n){let t=n.before,i=n.after,r=e.children,a=r.length,o=-1;for(;++o<a;){let s=xo(r[o],{...n,after:Io(r,o,i),before:t});s.remove?(r.splice(o,1),o--,a--):s.ignore||(t=s.stripAtStart),Ro(r[o])&&(t=!1)}return{ignore:!1,stripAtStart:!!(t||i),remove:!1}}function Io(e,n,t){for(;++n<e.length;){let i=e[n],r=ad(i);if(r===void 0&&"children"in i&&!od(i)&&(r=Io(i.children,-1)),typeof r=="boolean")return r}return t}function ad(e){if(e.type==="element"){if(Ro(e))return!1;if(Po(e))return!0}else if(e.type==="text"){if(!ve(e))return!1}else if(!hr(e))return!1}function Ro(e){return nt(e)||De(e,wo)}function Po(e){return De(e,ko)}function od(e){return!!(e.type==="element"&&e.properties.hidden)||hr(e)||De(e,To)}function Ao(e){return e===" "||e===`
3423
3429
  `}function sd(e){let n=/\r?\n|\r/.exec(e);return n?n[0]:" "}function ld(){return" "}function cd(e){return n;function n(t){return String(t).replace(/[\t\n\v\f\r ]+/g,e)}}function ud(e,n){if("tagName"in e&&e.properties)switch(e.tagName){case"listing":case"plaintext":case"script":case"style":case"xmp":return"pre";case"nobr":return"nowrap";case"pre":return e.properties.wrap?"pre-wrap":"pre";case"td":case"th":return e.properties.noWrap?"nowrap":n.whitespace;case"textarea":return"pre-wrap";default:}return n.whitespace}var dd={},pd=Bn({newlines:!0});function Fn(e){let n=e||dd,t=n.indent||2,i=n.indentInitial;return typeof t=="number"&&(t=" ".repeat(t)),i==null&&(i=!0),function(o){let s;pd(o),jt(o,function(l,c){let u=-1;if(!("children"in l))return;if(De(l,"head")&&(s=!0),s&&De(l,"body")&&(s=void 0),De(l,gr))return Wt;let d=l.children,m=c.length;if(d.length===0||!fr(l,s))return;i||m--;let p;for(;++u<d.length;){let E=d[u];(E.type==="text"||E.type==="comment")&&(E.value.includes(`
3424
3430
  `)&&(p=!0),E.value=E.value.replace(/ *\n/g,"$&"+String(t).repeat(m)))}let f=[],_;for(u=-1;++u<d.length;){let E=d[u];(fr(E,s)||p&&!u)&&(r(f,m,E),p=!0),_=E,f.push(E)}_&&(p||fr(_,s))&&(ve(_)&&(f.pop(),_=f[f.length-1]),r(f,m-1)),l.children=f})};function r(o,s,l){let c=o[o.length-1],u=c&&ve(c)?o[o.length-2]:c,d=(a(u)&&a(l)?`
3425
3431
 
3426
3432
  `:`
3427
- `)+String(t).repeat(Math.max(s,0));c&&c.type==="text"?c.value=ve(c)?d:c.value+d:o.push({type:"text",value:d})}function a(o){return!!(o&&o.type==="element"&&n.blanks&&n.blanks.length>0&&n.blanks.includes(o.tagName))}}function fr(e,n){return e.type==="root"||(e.type==="element"?n||De(e,"script")||nt(e)||!mr(e):!1)}var Do=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"];var Ge=class{constructor(n,t,i){this.property=n,this.normal=t,i&&(this.space=i)}};Ge.prototype.property={};Ge.prototype.normal={};Ge.prototype.space=null;function yr(e,n){let t={},i={},r=-1;for(;++r<e.length;)Object.assign(t,e[r].property),Object.assign(i,e[r].normal);return new Ge(t,i,n)}function Xt(e){return e.toLowerCase()}var ue=class{constructor(n,t){this.property=n,this.attribute=t}};ue.prototype.space=null;ue.prototype.boolean=!1;ue.prototype.booleanish=!1;ue.prototype.overloadedBoolean=!1;ue.prototype.number=!1;ue.prototype.commaSeparated=!1;ue.prototype.spaceSeparated=!1;ue.prototype.commaOrSpaceSeparated=!1;ue.prototype.mustUseProperty=!1;ue.prototype.defined=!1;var Yt={};va(Yt,{boolean:()=>B,booleanish:()=>Q,commaOrSpaceSeparated:()=>he,commaSeparated:()=>Xe,number:()=>C,overloadedBoolean:()=>br,spaceSeparated:()=>K});var md=0,B=it(),Q=it(),br=it(),C=it(),K=it(),Xe=it(),he=it();function it(){return 2**++md}var vr=Object.keys(Yt),rt=class extends ue{constructor(n,t,i,r){let a=-1;if(super(n,t),Lo(this,"space",r),typeof i=="number")for(;++a<vr.length;){let o=vr[a];Lo(this,vr[a],(i&Yt[o])===Yt[o])}}};rt.prototype.defined=!0;function Lo(e,n,t){t&&(e[n]=t)}var gd={}.hasOwnProperty;function Ce(e){let n={},t={},i;for(i in e.properties)if(gd.call(e.properties,i)){let r=e.properties[i],a=new rt(i,e.transform(e.attributes||{},i),r,e.space);e.mustUseProperty&&e.mustUseProperty.includes(i)&&(a.mustUseProperty=!0),n[i]=a,t[Xt(i)]=i,t[Xt(a.attribute)]=i}return new Ge(n,t,e.space)}var _r=Ce({space:"xlink",transform(e,n){return"xlink:"+n.slice(5).toLowerCase()},properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null}});var Sr=Ce({space:"xml",transform(e,n){return"xml:"+n.slice(3).toLowerCase()},properties:{xmlLang:null,xmlBase:null,xmlSpace:null}});function Gn(e,n){return n in e?e[n]:n}function zn(e,n){return Gn(e,n.toLowerCase())}var Er=Ce({space:"xmlns",attributes:{xmlnsxlink:"xmlns:xlink"},transform:zn,properties:{xmlns:null,xmlnsXLink:null}});var Cr=Ce({transform(e,n){return n==="role"?n:"aria-"+n.slice(4).toLowerCase()},properties:{ariaActiveDescendant:null,ariaAtomic:Q,ariaAutoComplete:null,ariaBusy:Q,ariaChecked:Q,ariaColCount:C,ariaColIndex:C,ariaColSpan:C,ariaControls:K,ariaCurrent:null,ariaDescribedBy:K,ariaDetails:null,ariaDisabled:Q,ariaDropEffect:K,ariaErrorMessage:null,ariaExpanded:Q,ariaFlowTo:K,ariaGrabbed:Q,ariaHasPopup:null,ariaHidden:Q,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:K,ariaLevel:C,ariaLive:null,ariaModal:Q,ariaMultiLine:Q,ariaMultiSelectable:Q,ariaOrientation:null,ariaOwns:K,ariaPlaceholder:null,ariaPosInSet:C,ariaPressed:Q,ariaReadOnly:Q,ariaRelevant:null,ariaRequired:Q,ariaRoleDescription:K,ariaRowCount:C,ariaRowIndex:C,ariaRowSpan:C,ariaSelected:Q,ariaSetSize:C,ariaSort:null,ariaValueMax:C,ariaValueMin:C,ariaValueNow:C,ariaValueText:null,role:null}});var No=Ce({space:"html",attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},transform:zn,mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Xe,acceptCharset:K,accessKey:K,action:null,allow:null,allowFullScreen:B,allowPaymentRequest:B,allowUserMedia:B,alt:null,as:null,async:B,autoCapitalize:null,autoComplete:K,autoFocus:B,autoPlay:B,blocking:K,capture:null,charSet:null,checked:B,cite:null,className:K,cols:C,colSpan:null,content:null,contentEditable:Q,controls:B,controlsList:K,coords:C|Xe,crossOrigin:null,data:null,dateTime:null,decoding:null,default:B,defer:B,dir:null,dirName:null,disabled:B,download:br,draggable:Q,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:B,formTarget:null,headers:K,height:C,hidden:B,high:C,href:null,hrefLang:null,htmlFor:K,httpEquiv:K,id:null,imageSizes:null,imageSrcSet:null,inert:B,inputMode:null,integrity:null,is:null,isMap:B,itemId:null,itemProp:K,itemRef:K,itemScope:B,itemType:K,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:B,low:C,manifest:null,max:null,maxLength:C,media:null,method:null,min:null,minLength:C,multiple:B,muted:B,name:null,nonce:null,noModule:B,noValidate:B,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:B,optimum:C,pattern:null,ping:K,placeholder:null,playsInline:B,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:B,referrerPolicy:null,rel:K,required:B,reversed:B,rows:C,rowSpan:C,sandbox:K,scope:null,scoped:B,seamless:B,selected:B,shadowRootClonable:B,shadowRootDelegatesFocus:B,shadowRootMode:null,shape:null,size:C,sizes:null,slot:null,span:C,spellCheck:Q,src:null,srcDoc:null,srcLang:null,srcSet:null,start:C,step:null,style:null,tabIndex:C,target:null,title:null,translate:null,type:null,typeMustMatch:B,useMap:null,value:Q,width:C,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:K,axis:null,background:null,bgColor:null,border:C,borderColor:null,bottomMargin:C,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:B,declare:B,event:null,face:null,frame:null,frameBorder:null,hSpace:C,leftMargin:C,link:null,longDesc:null,lowSrc:null,marginHeight:C,marginWidth:C,noResize:B,noHref:B,noShade:B,noWrap:B,object:null,profile:null,prompt:null,rev:null,rightMargin:C,rules:null,scheme:null,scrolling:Q,standby:null,summary:null,text:null,topMargin:C,valueType:null,version:null,vAlign:null,vLink:null,vSpace:C,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:B,disableRemotePlayback:B,prefix:null,property:null,results:C,security:null,unselectable:null}});var Mo=Ce({space:"svg",attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},transform:Gn,properties:{about:he,accentHeight:C,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:C,amplitude:C,arabicForm:null,ascent:C,attributeName:null,attributeType:null,azimuth:C,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:C,by:null,calcMode:null,capHeight:C,className:K,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:C,diffuseConstant:C,direction:null,display:null,dur:null,divisor:C,dominantBaseline:null,download:B,dx:null,dy:null,edgeMode:null,editable:null,elevation:C,enableBackground:null,end:null,event:null,exponent:C,externalResourcesRequired:null,fill:null,fillOpacity:C,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Xe,g2:Xe,glyphName:Xe,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:C,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:C,horizOriginX:C,horizOriginY:C,id:null,ideographic:C,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:C,k:C,k1:C,k2:C,k3:C,k4:C,kernelMatrix:he,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:C,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:C,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:C,overlineThickness:C,paintOrder:null,panose1:null,path:null,pathLength:C,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:K,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:C,pointsAtY:C,pointsAtZ:C,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:he,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:he,rev:he,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:he,requiredFeatures:he,requiredFonts:he,requiredFormats:he,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:C,specularExponent:C,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:C,strikethroughThickness:C,string:null,stroke:null,strokeDashArray:he,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:C,strokeOpacity:C,strokeWidth:null,style:null,surfaceScale:C,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:he,tabIndex:C,tableValues:null,target:null,targetX:C,targetY:C,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:he,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:C,underlineThickness:C,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:C,values:null,vAlphabetic:C,vMathematical:C,vectorEffect:null,vHanging:C,vIdeographic:C,version:null,vertAdvY:C,vertOriginX:C,vertOriginY:C,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:C,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null}});var hd=/^data[-\w.:]+$/i,Oo=/-[a-z]/g,fd=/[A-Z]/g;function kr(e,n){let t=Xt(n),i=n,r=ue;if(t in e.normal)return e.property[e.normal[t]];if(t.length>4&&t.slice(0,4)==="data"&&hd.test(n)){if(n.charAt(4)==="-"){let a=n.slice(5).replace(Oo,bd);i="data"+a.charAt(0).toUpperCase()+a.slice(1)}else{let a=n.slice(4);if(!Oo.test(a)){let o=a.replace(fd,yd);o.charAt(0)!=="-"&&(o="-"+o),n="data"+o}}r=rt}return new r(i,n)}function yd(e){return"-"+e.toLowerCase()}function bd(e){return e.charAt(1).toUpperCase()}var Bo=yr([Sr,_r,Er,Cr,No],"html"),Un=yr([Sr,_r,Er,Cr,Mo],"svg");var Fo={}.hasOwnProperty;function Go(e,n){let t=n||{};function i(r,...a){let o=i.invalid,s=i.handlers;if(r&&Fo.call(r,e)){let l=String(r[e]);o=Fo.call(s,l)?s[l]:i.unknown}if(o)return o.call(this,r,...a)}return i.handlers=t.handlers||{},i.invalid=t.invalid,i.unknown=t.unknown,i}var vd=/["&'<>`]/g,_d=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,Sd=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,Ed=/[|\\{}()[\]^$+*?.]/g,zo=new WeakMap;function Uo(e,n){if(e=e.replace(n.subset?Cd(n.subset):vd,i),n.subset||n.escapeOnly)return e;return e.replace(_d,t).replace(Sd,i);function t(r,a,o){return n.format((r.charCodeAt(0)-55296)*1024+r.charCodeAt(1)-56320+65536,o.charCodeAt(a+2),n)}function i(r,a,o){return n.format(r.charCodeAt(0),o.charCodeAt(a+1),n)}}function Cd(e){let n=zo.get(e);return n||(n=kd(e),zo.set(e,n)),n}function kd(e){let n=[],t=-1;for(;++t<e.length;)n.push(e[t].replace(Ed,"\\$&"));return new RegExp("(?:"+n.join("|")+")","g")}var wd=/[\dA-Fa-f]/;function Ho(e,n,t){let i="&#x"+e.toString(16).toUpperCase();return t&&n&&!wd.test(String.fromCharCode(n))?i:i+";"}var Td=/\d/;function Vo(e,n,t){let i="&#"+String(e);return t&&n&&!Td.test(String.fromCharCode(n))?i:i+";"}var Wo=["AElig","AMP","Aacute","Acirc","Agrave","Aring","Atilde","Auml","COPY","Ccedil","ETH","Eacute","Ecirc","Egrave","Euml","GT","Iacute","Icirc","Igrave","Iuml","LT","Ntilde","Oacute","Ocirc","Ograve","Oslash","Otilde","Ouml","QUOT","REG","THORN","Uacute","Ucirc","Ugrave","Uuml","Yacute","aacute","acirc","acute","aelig","agrave","amp","aring","atilde","auml","brvbar","ccedil","cedil","cent","copy","curren","deg","divide","eacute","ecirc","egrave","eth","euml","frac12","frac14","frac34","gt","iacute","icirc","iexcl","igrave","iquest","iuml","laquo","lt","macr","micro","middot","nbsp","not","ntilde","oacute","ocirc","ograve","ordf","ordm","oslash","otilde","ouml","para","plusmn","pound","quot","raquo","reg","sect","shy","sup1","sup2","sup3","szlig","thorn","times","uacute","ucirc","ugrave","uml","uuml","yacute","yen","yuml"];var Hn={nbsp:"\xA0",iexcl:"\xA1",cent:"\xA2",pound:"\xA3",curren:"\xA4",yen:"\xA5",brvbar:"\xA6",sect:"\xA7",uml:"\xA8",copy:"\xA9",ordf:"\xAA",laquo:"\xAB",not:"\xAC",shy:"\xAD",reg:"\xAE",macr:"\xAF",deg:"\xB0",plusmn:"\xB1",sup2:"\xB2",sup3:"\xB3",acute:"\xB4",micro:"\xB5",para:"\xB6",middot:"\xB7",cedil:"\xB8",sup1:"\xB9",ordm:"\xBA",raquo:"\xBB",frac14:"\xBC",frac12:"\xBD",frac34:"\xBE",iquest:"\xBF",Agrave:"\xC0",Aacute:"\xC1",Acirc:"\xC2",Atilde:"\xC3",Auml:"\xC4",Aring:"\xC5",AElig:"\xC6",Ccedil:"\xC7",Egrave:"\xC8",Eacute:"\xC9",Ecirc:"\xCA",Euml:"\xCB",Igrave:"\xCC",Iacute:"\xCD",Icirc:"\xCE",Iuml:"\xCF",ETH:"\xD0",Ntilde:"\xD1",Ograve:"\xD2",Oacute:"\xD3",Ocirc:"\xD4",Otilde:"\xD5",Ouml:"\xD6",times:"\xD7",Oslash:"\xD8",Ugrave:"\xD9",Uacute:"\xDA",Ucirc:"\xDB",Uuml:"\xDC",Yacute:"\xDD",THORN:"\xDE",szlig:"\xDF",agrave:"\xE0",aacute:"\xE1",acirc:"\xE2",atilde:"\xE3",auml:"\xE4",aring:"\xE5",aelig:"\xE6",ccedil:"\xE7",egrave:"\xE8",eacute:"\xE9",ecirc:"\xEA",euml:"\xEB",igrave:"\xEC",iacute:"\xED",icirc:"\xEE",iuml:"\xEF",eth:"\xF0",ntilde:"\xF1",ograve:"\xF2",oacute:"\xF3",ocirc:"\xF4",otilde:"\xF5",ouml:"\xF6",divide:"\xF7",oslash:"\xF8",ugrave:"\xF9",uacute:"\xFA",ucirc:"\xFB",uuml:"\xFC",yacute:"\xFD",thorn:"\xFE",yuml:"\xFF",fnof:"\u0192",Alpha:"\u0391",Beta:"\u0392",Gamma:"\u0393",Delta:"\u0394",Epsilon:"\u0395",Zeta:"\u0396",Eta:"\u0397",Theta:"\u0398",Iota:"\u0399",Kappa:"\u039A",Lambda:"\u039B",Mu:"\u039C",Nu:"\u039D",Xi:"\u039E",Omicron:"\u039F",Pi:"\u03A0",Rho:"\u03A1",Sigma:"\u03A3",Tau:"\u03A4",Upsilon:"\u03A5",Phi:"\u03A6",Chi:"\u03A7",Psi:"\u03A8",Omega:"\u03A9",alpha:"\u03B1",beta:"\u03B2",gamma:"\u03B3",delta:"\u03B4",epsilon:"\u03B5",zeta:"\u03B6",eta:"\u03B7",theta:"\u03B8",iota:"\u03B9",kappa:"\u03BA",lambda:"\u03BB",mu:"\u03BC",nu:"\u03BD",xi:"\u03BE",omicron:"\u03BF",pi:"\u03C0",rho:"\u03C1",sigmaf:"\u03C2",sigma:"\u03C3",tau:"\u03C4",upsilon:"\u03C5",phi:"\u03C6",chi:"\u03C7",psi:"\u03C8",omega:"\u03C9",thetasym:"\u03D1",upsih:"\u03D2",piv:"\u03D6",bull:"\u2022",hellip:"\u2026",prime:"\u2032",Prime:"\u2033",oline:"\u203E",frasl:"\u2044",weierp:"\u2118",image:"\u2111",real:"\u211C",trade:"\u2122",alefsym:"\u2135",larr:"\u2190",uarr:"\u2191",rarr:"\u2192",darr:"\u2193",harr:"\u2194",crarr:"\u21B5",lArr:"\u21D0",uArr:"\u21D1",rArr:"\u21D2",dArr:"\u21D3",hArr:"\u21D4",forall:"\u2200",part:"\u2202",exist:"\u2203",empty:"\u2205",nabla:"\u2207",isin:"\u2208",notin:"\u2209",ni:"\u220B",prod:"\u220F",sum:"\u2211",minus:"\u2212",lowast:"\u2217",radic:"\u221A",prop:"\u221D",infin:"\u221E",ang:"\u2220",and:"\u2227",or:"\u2228",cap:"\u2229",cup:"\u222A",int:"\u222B",there4:"\u2234",sim:"\u223C",cong:"\u2245",asymp:"\u2248",ne:"\u2260",equiv:"\u2261",le:"\u2264",ge:"\u2265",sub:"\u2282",sup:"\u2283",nsub:"\u2284",sube:"\u2286",supe:"\u2287",oplus:"\u2295",otimes:"\u2297",perp:"\u22A5",sdot:"\u22C5",lceil:"\u2308",rceil:"\u2309",lfloor:"\u230A",rfloor:"\u230B",lang:"\u2329",rang:"\u232A",loz:"\u25CA",spades:"\u2660",clubs:"\u2663",hearts:"\u2665",diams:"\u2666",quot:'"',amp:"&",lt:"<",gt:">",OElig:"\u0152",oelig:"\u0153",Scaron:"\u0160",scaron:"\u0161",Yuml:"\u0178",circ:"\u02C6",tilde:"\u02DC",ensp:"\u2002",emsp:"\u2003",thinsp:"\u2009",zwnj:"\u200C",zwj:"\u200D",lrm:"\u200E",rlm:"\u200F",ndash:"\u2013",mdash:"\u2014",lsquo:"\u2018",rsquo:"\u2019",sbquo:"\u201A",ldquo:"\u201C",rdquo:"\u201D",bdquo:"\u201E",dagger:"\u2020",Dagger:"\u2021",permil:"\u2030",lsaquo:"\u2039",rsaquo:"\u203A",euro:"\u20AC"};var jo=["cent","copy","divide","gt","lt","not","para","times"];var qo={}.hasOwnProperty,wr={},Vn;for(Vn in Hn)qo.call(Hn,Vn)&&(wr[Hn[Vn]]=Vn);var Ad=/[^\dA-Za-z]/;function Ko(e,n,t,i){let r=String.fromCharCode(e);if(qo.call(wr,r)){let a=wr[r],o="&"+a;return t&&Wo.includes(a)&&!jo.includes(a)&&(!i||n&&n!==61&&Ad.test(String.fromCharCode(n)))?o:o+";"}return""}function Xo(e,n,t){let i=Ho(e,n,t.omitOptionalSemicolons),r;if((t.useNamedReferences||t.useShortestReferences)&&(r=Ko(e,n,t.omitOptionalSemicolons,t.attribute)),(t.useShortestReferences||!r)&&t.useShortestReferences){let a=Vo(e,n,t.omitOptionalSemicolons);a.length<i.length&&(i=a)}return r&&(!t.useShortestReferences||r.length<i.length)?r:i}function ze(e,n){return Uo(e,Object.assign({format:Xo},n))}var xd=/^>|^->|<!--|-->|--!>|<!-$/g,Id=[">"],Rd=["<",">"];function Yo(e,n,t,i){return i.settings.bogusComments?"<?"+ze(e.value,Object.assign({},i.settings.characterReferences,{subset:Id}))+">":"<!--"+e.value.replace(xd,r)+"-->";function r(a){return ze(a,Object.assign({},i.settings.characterReferences,{subset:Rd}))}}function Jo(e,n,t,i){return"<!"+(i.settings.upperDoctype?"DOCTYPE":"doctype")+(i.settings.tightDoctype?"":" ")+"html>"}function Tr(e,n){let t=String(e);if(typeof n!="string")throw new TypeError("Expected character");let i=0,r=t.indexOf(n);for(;r!==-1;)i++,r=t.indexOf(n,r+n.length);return i}function Zo(e,n){let t=n||{};return(e[e.length-1]===""?[...e,""]:e).join((t.padRight?" ":"")+","+(t.padLeft===!1?"":" ")).trim()}var te=$o(1),Ar=$o(-1),Pd=[];function $o(e){return n;function n(t,i,r){let a=t?t.children:Pd,o=(i||0)+e,s=a[o];if(!r)for(;s&&ve(s);)o+=e,s=a[o];return s}}var Dd={}.hasOwnProperty;function Wn(e){return n;function n(t,i,r){return Dd.call(e,t.tagName)&&e[t.tagName](t,i,r)}}var Jt=Wn({body:Nd,caption:xr,colgroup:xr,dd:Fd,dt:Bd,head:xr,html:Ld,li:Od,optgroup:Gd,option:zd,p:Md,rp:Qo,rt:Qo,tbody:Hd,td:es,tfoot:Vd,th:es,thead:Ud,tr:Wd});function xr(e,n,t){let i=te(t,n,!0);return!i||i.type!=="comment"&&!(i.type==="text"&&ve(i.value.charAt(0)))}function Ld(e,n,t){let i=te(t,n);return!i||i.type!=="comment"}function Nd(e,n,t){let i=te(t,n);return!i||i.type!=="comment"}function Md(e,n,t){let i=te(t,n);return i?i.type==="element"&&(i.tagName==="address"||i.tagName==="article"||i.tagName==="aside"||i.tagName==="blockquote"||i.tagName==="details"||i.tagName==="div"||i.tagName==="dl"||i.tagName==="fieldset"||i.tagName==="figcaption"||i.tagName==="figure"||i.tagName==="footer"||i.tagName==="form"||i.tagName==="h1"||i.tagName==="h2"||i.tagName==="h3"||i.tagName==="h4"||i.tagName==="h5"||i.tagName==="h6"||i.tagName==="header"||i.tagName==="hgroup"||i.tagName==="hr"||i.tagName==="main"||i.tagName==="menu"||i.tagName==="nav"||i.tagName==="ol"||i.tagName==="p"||i.tagName==="pre"||i.tagName==="section"||i.tagName==="table"||i.tagName==="ul"):!t||!(t.type==="element"&&(t.tagName==="a"||t.tagName==="audio"||t.tagName==="del"||t.tagName==="ins"||t.tagName==="map"||t.tagName==="noscript"||t.tagName==="video"))}function Od(e,n,t){let i=te(t,n);return!i||i.type==="element"&&i.tagName==="li"}function Bd(e,n,t){let i=te(t,n);return!!(i&&i.type==="element"&&(i.tagName==="dt"||i.tagName==="dd"))}function Fd(e,n,t){let i=te(t,n);return!i||i.type==="element"&&(i.tagName==="dt"||i.tagName==="dd")}function Qo(e,n,t){let i=te(t,n);return!i||i.type==="element"&&(i.tagName==="rp"||i.tagName==="rt")}function Gd(e,n,t){let i=te(t,n);return!i||i.type==="element"&&i.tagName==="optgroup"}function zd(e,n,t){let i=te(t,n);return!i||i.type==="element"&&(i.tagName==="option"||i.tagName==="optgroup")}function Ud(e,n,t){let i=te(t,n);return!!(i&&i.type==="element"&&(i.tagName==="tbody"||i.tagName==="tfoot"))}function Hd(e,n,t){let i=te(t,n);return!i||i.type==="element"&&(i.tagName==="tbody"||i.tagName==="tfoot")}function Vd(e,n,t){return!te(t,n)}function Wd(e,n,t){let i=te(t,n);return!i||i.type==="element"&&i.tagName==="tr"}function es(e,n,t){let i=te(t,n);return!i||i.type==="element"&&(i.tagName==="td"||i.tagName==="th")}var ts=Wn({body:Kd,colgroup:Xd,head:qd,html:jd,tbody:Yd});function jd(e){let n=te(e,-1);return!n||n.type!=="comment"}function qd(e){let n=e.children,t=[],i=-1;for(;++i<n.length;){let r=n[i];if(r.type==="element"&&(r.tagName==="title"||r.tagName==="base")){if(t.includes(r.tagName))return!1;t.push(r.tagName)}}return n.length>0}function Kd(e){let n=te(e,-1,!0);return!n||n.type!=="comment"&&!(n.type==="text"&&ve(n.value.charAt(0)))&&!(n.type==="element"&&(n.tagName==="meta"||n.tagName==="link"||n.tagName==="script"||n.tagName==="style"||n.tagName==="template"))}function Xd(e,n,t){let i=Ar(t,n),r=te(e,-1,!0);return t&&i&&i.type==="element"&&i.tagName==="colgroup"&&Jt(i,t.children.indexOf(i),t)?!1:!!(r&&r.type==="element"&&r.tagName==="col")}function Yd(e,n,t){let i=Ar(t,n),r=te(e,-1);return t&&i&&i.type==="element"&&(i.tagName==="thead"||i.tagName==="tbody")&&Jt(i,t.children.indexOf(i),t)?!1:!!(r&&r.type==="element"&&r.tagName==="tr")}var jn={name:[[`
3433
+ `)+String(t).repeat(Math.max(s,0));c&&c.type==="text"?c.value=ve(c)?d:c.value+d:o.push({type:"text",value:d})}function a(o){return!!(o&&o.type==="element"&&n.blanks&&n.blanks.length>0&&n.blanks.includes(o.tagName))}}function fr(e,n){return e.type==="root"||(e.type==="element"?n||De(e,"script")||nt(e)||!mr(e):!1)}var Do=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"];var Ge=class{constructor(n,t,i){this.property=n,this.normal=t,i&&(this.space=i)}};Ge.prototype.property={};Ge.prototype.normal={};Ge.prototype.space=null;function yr(e,n){let t={},i={},r=-1;for(;++r<e.length;)Object.assign(t,e[r].property),Object.assign(i,e[r].normal);return new Ge(t,i,n)}function Xt(e){return e.toLowerCase()}var ue=class{constructor(n,t){this.property=n,this.attribute=t}};ue.prototype.space=null;ue.prototype.boolean=!1;ue.prototype.booleanish=!1;ue.prototype.overloadedBoolean=!1;ue.prototype.number=!1;ue.prototype.commaSeparated=!1;ue.prototype.spaceSeparated=!1;ue.prototype.commaOrSpaceSeparated=!1;ue.prototype.mustUseProperty=!1;ue.prototype.defined=!1;var Yt={};va(Yt,{boolean:()=>B,booleanish:()=>Q,commaOrSpaceSeparated:()=>he,commaSeparated:()=>Xe,number:()=>C,overloadedBoolean:()=>br,spaceSeparated:()=>K});var md=0,B=it(),Q=it(),br=it(),C=it(),K=it(),Xe=it(),he=it();function it(){return 2**++md}var vr=Object.keys(Yt),rt=class extends ue{constructor(n,t,i,r){let a=-1;if(super(n,t),No(this,"space",r),typeof i=="number")for(;++a<vr.length;){let o=vr[a];No(this,vr[a],(i&Yt[o])===Yt[o])}}};rt.prototype.defined=!0;function No(e,n,t){t&&(e[n]=t)}var gd={}.hasOwnProperty;function Ce(e){let n={},t={},i;for(i in e.properties)if(gd.call(e.properties,i)){let r=e.properties[i],a=new rt(i,e.transform(e.attributes||{},i),r,e.space);e.mustUseProperty&&e.mustUseProperty.includes(i)&&(a.mustUseProperty=!0),n[i]=a,t[Xt(i)]=i,t[Xt(a.attribute)]=i}return new Ge(n,t,e.space)}var _r=Ce({space:"xlink",transform(e,n){return"xlink:"+n.slice(5).toLowerCase()},properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null}});var Sr=Ce({space:"xml",transform(e,n){return"xml:"+n.slice(3).toLowerCase()},properties:{xmlLang:null,xmlBase:null,xmlSpace:null}});function Gn(e,n){return n in e?e[n]:n}function zn(e,n){return Gn(e,n.toLowerCase())}var Er=Ce({space:"xmlns",attributes:{xmlnsxlink:"xmlns:xlink"},transform:zn,properties:{xmlns:null,xmlnsXLink:null}});var Cr=Ce({transform(e,n){return n==="role"?n:"aria-"+n.slice(4).toLowerCase()},properties:{ariaActiveDescendant:null,ariaAtomic:Q,ariaAutoComplete:null,ariaBusy:Q,ariaChecked:Q,ariaColCount:C,ariaColIndex:C,ariaColSpan:C,ariaControls:K,ariaCurrent:null,ariaDescribedBy:K,ariaDetails:null,ariaDisabled:Q,ariaDropEffect:K,ariaErrorMessage:null,ariaExpanded:Q,ariaFlowTo:K,ariaGrabbed:Q,ariaHasPopup:null,ariaHidden:Q,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:K,ariaLevel:C,ariaLive:null,ariaModal:Q,ariaMultiLine:Q,ariaMultiSelectable:Q,ariaOrientation:null,ariaOwns:K,ariaPlaceholder:null,ariaPosInSet:C,ariaPressed:Q,ariaReadOnly:Q,ariaRelevant:null,ariaRequired:Q,ariaRoleDescription:K,ariaRowCount:C,ariaRowIndex:C,ariaRowSpan:C,ariaSelected:Q,ariaSetSize:C,ariaSort:null,ariaValueMax:C,ariaValueMin:C,ariaValueNow:C,ariaValueText:null,role:null}});var Lo=Ce({space:"html",attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},transform:zn,mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Xe,acceptCharset:K,accessKey:K,action:null,allow:null,allowFullScreen:B,allowPaymentRequest:B,allowUserMedia:B,alt:null,as:null,async:B,autoCapitalize:null,autoComplete:K,autoFocus:B,autoPlay:B,blocking:K,capture:null,charSet:null,checked:B,cite:null,className:K,cols:C,colSpan:null,content:null,contentEditable:Q,controls:B,controlsList:K,coords:C|Xe,crossOrigin:null,data:null,dateTime:null,decoding:null,default:B,defer:B,dir:null,dirName:null,disabled:B,download:br,draggable:Q,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:B,formTarget:null,headers:K,height:C,hidden:B,high:C,href:null,hrefLang:null,htmlFor:K,httpEquiv:K,id:null,imageSizes:null,imageSrcSet:null,inert:B,inputMode:null,integrity:null,is:null,isMap:B,itemId:null,itemProp:K,itemRef:K,itemScope:B,itemType:K,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:B,low:C,manifest:null,max:null,maxLength:C,media:null,method:null,min:null,minLength:C,multiple:B,muted:B,name:null,nonce:null,noModule:B,noValidate:B,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:B,optimum:C,pattern:null,ping:K,placeholder:null,playsInline:B,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:B,referrerPolicy:null,rel:K,required:B,reversed:B,rows:C,rowSpan:C,sandbox:K,scope:null,scoped:B,seamless:B,selected:B,shadowRootClonable:B,shadowRootDelegatesFocus:B,shadowRootMode:null,shape:null,size:C,sizes:null,slot:null,span:C,spellCheck:Q,src:null,srcDoc:null,srcLang:null,srcSet:null,start:C,step:null,style:null,tabIndex:C,target:null,title:null,translate:null,type:null,typeMustMatch:B,useMap:null,value:Q,width:C,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:K,axis:null,background:null,bgColor:null,border:C,borderColor:null,bottomMargin:C,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:B,declare:B,event:null,face:null,frame:null,frameBorder:null,hSpace:C,leftMargin:C,link:null,longDesc:null,lowSrc:null,marginHeight:C,marginWidth:C,noResize:B,noHref:B,noShade:B,noWrap:B,object:null,profile:null,prompt:null,rev:null,rightMargin:C,rules:null,scheme:null,scrolling:Q,standby:null,summary:null,text:null,topMargin:C,valueType:null,version:null,vAlign:null,vLink:null,vSpace:C,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:B,disableRemotePlayback:B,prefix:null,property:null,results:C,security:null,unselectable:null}});var Mo=Ce({space:"svg",attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},transform:Gn,properties:{about:he,accentHeight:C,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:C,amplitude:C,arabicForm:null,ascent:C,attributeName:null,attributeType:null,azimuth:C,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:C,by:null,calcMode:null,capHeight:C,className:K,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:C,diffuseConstant:C,direction:null,display:null,dur:null,divisor:C,dominantBaseline:null,download:B,dx:null,dy:null,edgeMode:null,editable:null,elevation:C,enableBackground:null,end:null,event:null,exponent:C,externalResourcesRequired:null,fill:null,fillOpacity:C,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Xe,g2:Xe,glyphName:Xe,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:C,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:C,horizOriginX:C,horizOriginY:C,id:null,ideographic:C,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:C,k:C,k1:C,k2:C,k3:C,k4:C,kernelMatrix:he,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:C,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:C,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:C,overlineThickness:C,paintOrder:null,panose1:null,path:null,pathLength:C,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:K,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:C,pointsAtY:C,pointsAtZ:C,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:he,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:he,rev:he,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:he,requiredFeatures:he,requiredFonts:he,requiredFormats:he,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:C,specularExponent:C,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:C,strikethroughThickness:C,string:null,stroke:null,strokeDashArray:he,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:C,strokeOpacity:C,strokeWidth:null,style:null,surfaceScale:C,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:he,tabIndex:C,tableValues:null,target:null,targetX:C,targetY:C,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:he,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:C,underlineThickness:C,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:C,values:null,vAlphabetic:C,vMathematical:C,vectorEffect:null,vHanging:C,vIdeographic:C,version:null,vertAdvY:C,vertOriginX:C,vertOriginY:C,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:C,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null}});var hd=/^data[-\w.:]+$/i,Oo=/-[a-z]/g,fd=/[A-Z]/g;function kr(e,n){let t=Xt(n),i=n,r=ue;if(t in e.normal)return e.property[e.normal[t]];if(t.length>4&&t.slice(0,4)==="data"&&hd.test(n)){if(n.charAt(4)==="-"){let a=n.slice(5).replace(Oo,bd);i="data"+a.charAt(0).toUpperCase()+a.slice(1)}else{let a=n.slice(4);if(!Oo.test(a)){let o=a.replace(fd,yd);o.charAt(0)!=="-"&&(o="-"+o),n="data"+o}}r=rt}return new r(i,n)}function yd(e){return"-"+e.toLowerCase()}function bd(e){return e.charAt(1).toUpperCase()}var Bo=yr([Sr,_r,Er,Cr,Lo],"html"),Un=yr([Sr,_r,Er,Cr,Mo],"svg");var Fo={}.hasOwnProperty;function Go(e,n){let t=n||{};function i(r,...a){let o=i.invalid,s=i.handlers;if(r&&Fo.call(r,e)){let l=String(r[e]);o=Fo.call(s,l)?s[l]:i.unknown}if(o)return o.call(this,r,...a)}return i.handlers=t.handlers||{},i.invalid=t.invalid,i.unknown=t.unknown,i}var vd=/["&'<>`]/g,_d=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,Sd=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,Ed=/[|\\{}()[\]^$+*?.]/g,zo=new WeakMap;function Uo(e,n){if(e=e.replace(n.subset?Cd(n.subset):vd,i),n.subset||n.escapeOnly)return e;return e.replace(_d,t).replace(Sd,i);function t(r,a,o){return n.format((r.charCodeAt(0)-55296)*1024+r.charCodeAt(1)-56320+65536,o.charCodeAt(a+2),n)}function i(r,a,o){return n.format(r.charCodeAt(0),o.charCodeAt(a+1),n)}}function Cd(e){let n=zo.get(e);return n||(n=kd(e),zo.set(e,n)),n}function kd(e){let n=[],t=-1;for(;++t<e.length;)n.push(e[t].replace(Ed,"\\$&"));return new RegExp("(?:"+n.join("|")+")","g")}var wd=/[\dA-Fa-f]/;function Ho(e,n,t){let i="&#x"+e.toString(16).toUpperCase();return t&&n&&!wd.test(String.fromCharCode(n))?i:i+";"}var Td=/\d/;function Vo(e,n,t){let i="&#"+String(e);return t&&n&&!Td.test(String.fromCharCode(n))?i:i+";"}var Wo=["AElig","AMP","Aacute","Acirc","Agrave","Aring","Atilde","Auml","COPY","Ccedil","ETH","Eacute","Ecirc","Egrave","Euml","GT","Iacute","Icirc","Igrave","Iuml","LT","Ntilde","Oacute","Ocirc","Ograve","Oslash","Otilde","Ouml","QUOT","REG","THORN","Uacute","Ucirc","Ugrave","Uuml","Yacute","aacute","acirc","acute","aelig","agrave","amp","aring","atilde","auml","brvbar","ccedil","cedil","cent","copy","curren","deg","divide","eacute","ecirc","egrave","eth","euml","frac12","frac14","frac34","gt","iacute","icirc","iexcl","igrave","iquest","iuml","laquo","lt","macr","micro","middot","nbsp","not","ntilde","oacute","ocirc","ograve","ordf","ordm","oslash","otilde","ouml","para","plusmn","pound","quot","raquo","reg","sect","shy","sup1","sup2","sup3","szlig","thorn","times","uacute","ucirc","ugrave","uml","uuml","yacute","yen","yuml"];var Hn={nbsp:"\xA0",iexcl:"\xA1",cent:"\xA2",pound:"\xA3",curren:"\xA4",yen:"\xA5",brvbar:"\xA6",sect:"\xA7",uml:"\xA8",copy:"\xA9",ordf:"\xAA",laquo:"\xAB",not:"\xAC",shy:"\xAD",reg:"\xAE",macr:"\xAF",deg:"\xB0",plusmn:"\xB1",sup2:"\xB2",sup3:"\xB3",acute:"\xB4",micro:"\xB5",para:"\xB6",middot:"\xB7",cedil:"\xB8",sup1:"\xB9",ordm:"\xBA",raquo:"\xBB",frac14:"\xBC",frac12:"\xBD",frac34:"\xBE",iquest:"\xBF",Agrave:"\xC0",Aacute:"\xC1",Acirc:"\xC2",Atilde:"\xC3",Auml:"\xC4",Aring:"\xC5",AElig:"\xC6",Ccedil:"\xC7",Egrave:"\xC8",Eacute:"\xC9",Ecirc:"\xCA",Euml:"\xCB",Igrave:"\xCC",Iacute:"\xCD",Icirc:"\xCE",Iuml:"\xCF",ETH:"\xD0",Ntilde:"\xD1",Ograve:"\xD2",Oacute:"\xD3",Ocirc:"\xD4",Otilde:"\xD5",Ouml:"\xD6",times:"\xD7",Oslash:"\xD8",Ugrave:"\xD9",Uacute:"\xDA",Ucirc:"\xDB",Uuml:"\xDC",Yacute:"\xDD",THORN:"\xDE",szlig:"\xDF",agrave:"\xE0",aacute:"\xE1",acirc:"\xE2",atilde:"\xE3",auml:"\xE4",aring:"\xE5",aelig:"\xE6",ccedil:"\xE7",egrave:"\xE8",eacute:"\xE9",ecirc:"\xEA",euml:"\xEB",igrave:"\xEC",iacute:"\xED",icirc:"\xEE",iuml:"\xEF",eth:"\xF0",ntilde:"\xF1",ograve:"\xF2",oacute:"\xF3",ocirc:"\xF4",otilde:"\xF5",ouml:"\xF6",divide:"\xF7",oslash:"\xF8",ugrave:"\xF9",uacute:"\xFA",ucirc:"\xFB",uuml:"\xFC",yacute:"\xFD",thorn:"\xFE",yuml:"\xFF",fnof:"\u0192",Alpha:"\u0391",Beta:"\u0392",Gamma:"\u0393",Delta:"\u0394",Epsilon:"\u0395",Zeta:"\u0396",Eta:"\u0397",Theta:"\u0398",Iota:"\u0399",Kappa:"\u039A",Lambda:"\u039B",Mu:"\u039C",Nu:"\u039D",Xi:"\u039E",Omicron:"\u039F",Pi:"\u03A0",Rho:"\u03A1",Sigma:"\u03A3",Tau:"\u03A4",Upsilon:"\u03A5",Phi:"\u03A6",Chi:"\u03A7",Psi:"\u03A8",Omega:"\u03A9",alpha:"\u03B1",beta:"\u03B2",gamma:"\u03B3",delta:"\u03B4",epsilon:"\u03B5",zeta:"\u03B6",eta:"\u03B7",theta:"\u03B8",iota:"\u03B9",kappa:"\u03BA",lambda:"\u03BB",mu:"\u03BC",nu:"\u03BD",xi:"\u03BE",omicron:"\u03BF",pi:"\u03C0",rho:"\u03C1",sigmaf:"\u03C2",sigma:"\u03C3",tau:"\u03C4",upsilon:"\u03C5",phi:"\u03C6",chi:"\u03C7",psi:"\u03C8",omega:"\u03C9",thetasym:"\u03D1",upsih:"\u03D2",piv:"\u03D6",bull:"\u2022",hellip:"\u2026",prime:"\u2032",Prime:"\u2033",oline:"\u203E",frasl:"\u2044",weierp:"\u2118",image:"\u2111",real:"\u211C",trade:"\u2122",alefsym:"\u2135",larr:"\u2190",uarr:"\u2191",rarr:"\u2192",darr:"\u2193",harr:"\u2194",crarr:"\u21B5",lArr:"\u21D0",uArr:"\u21D1",rArr:"\u21D2",dArr:"\u21D3",hArr:"\u21D4",forall:"\u2200",part:"\u2202",exist:"\u2203",empty:"\u2205",nabla:"\u2207",isin:"\u2208",notin:"\u2209",ni:"\u220B",prod:"\u220F",sum:"\u2211",minus:"\u2212",lowast:"\u2217",radic:"\u221A",prop:"\u221D",infin:"\u221E",ang:"\u2220",and:"\u2227",or:"\u2228",cap:"\u2229",cup:"\u222A",int:"\u222B",there4:"\u2234",sim:"\u223C",cong:"\u2245",asymp:"\u2248",ne:"\u2260",equiv:"\u2261",le:"\u2264",ge:"\u2265",sub:"\u2282",sup:"\u2283",nsub:"\u2284",sube:"\u2286",supe:"\u2287",oplus:"\u2295",otimes:"\u2297",perp:"\u22A5",sdot:"\u22C5",lceil:"\u2308",rceil:"\u2309",lfloor:"\u230A",rfloor:"\u230B",lang:"\u2329",rang:"\u232A",loz:"\u25CA",spades:"\u2660",clubs:"\u2663",hearts:"\u2665",diams:"\u2666",quot:'"',amp:"&",lt:"<",gt:">",OElig:"\u0152",oelig:"\u0153",Scaron:"\u0160",scaron:"\u0161",Yuml:"\u0178",circ:"\u02C6",tilde:"\u02DC",ensp:"\u2002",emsp:"\u2003",thinsp:"\u2009",zwnj:"\u200C",zwj:"\u200D",lrm:"\u200E",rlm:"\u200F",ndash:"\u2013",mdash:"\u2014",lsquo:"\u2018",rsquo:"\u2019",sbquo:"\u201A",ldquo:"\u201C",rdquo:"\u201D",bdquo:"\u201E",dagger:"\u2020",Dagger:"\u2021",permil:"\u2030",lsaquo:"\u2039",rsaquo:"\u203A",euro:"\u20AC"};var jo=["cent","copy","divide","gt","lt","not","para","times"];var qo={}.hasOwnProperty,wr={},Vn;for(Vn in Hn)qo.call(Hn,Vn)&&(wr[Hn[Vn]]=Vn);var Ad=/[^\dA-Za-z]/;function Ko(e,n,t,i){let r=String.fromCharCode(e);if(qo.call(wr,r)){let a=wr[r],o="&"+a;return t&&Wo.includes(a)&&!jo.includes(a)&&(!i||n&&n!==61&&Ad.test(String.fromCharCode(n)))?o:o+";"}return""}function Xo(e,n,t){let i=Ho(e,n,t.omitOptionalSemicolons),r;if((t.useNamedReferences||t.useShortestReferences)&&(r=Ko(e,n,t.omitOptionalSemicolons,t.attribute)),(t.useShortestReferences||!r)&&t.useShortestReferences){let a=Vo(e,n,t.omitOptionalSemicolons);a.length<i.length&&(i=a)}return r&&(!t.useShortestReferences||r.length<i.length)?r:i}function ze(e,n){return Uo(e,Object.assign({format:Xo},n))}var xd=/^>|^->|<!--|-->|--!>|<!-$/g,Id=[">"],Rd=["<",">"];function Yo(e,n,t,i){return i.settings.bogusComments?"<?"+ze(e.value,Object.assign({},i.settings.characterReferences,{subset:Id}))+">":"<!--"+e.value.replace(xd,r)+"-->";function r(a){return ze(a,Object.assign({},i.settings.characterReferences,{subset:Rd}))}}function Jo(e,n,t,i){return"<!"+(i.settings.upperDoctype?"DOCTYPE":"doctype")+(i.settings.tightDoctype?"":" ")+"html>"}function Tr(e,n){let t=String(e);if(typeof n!="string")throw new TypeError("Expected character");let i=0,r=t.indexOf(n);for(;r!==-1;)i++,r=t.indexOf(n,r+n.length);return i}function Zo(e,n){let t=n||{};return(e[e.length-1]===""?[...e,""]:e).join((t.padRight?" ":"")+","+(t.padLeft===!1?"":" ")).trim()}var te=$o(1),Ar=$o(-1),Pd=[];function $o(e){return n;function n(t,i,r){let a=t?t.children:Pd,o=(i||0)+e,s=a[o];if(!r)for(;s&&ve(s);)o+=e,s=a[o];return s}}var Dd={}.hasOwnProperty;function Wn(e){return n;function n(t,i,r){return Dd.call(e,t.tagName)&&e[t.tagName](t,i,r)}}var Jt=Wn({body:Ld,caption:xr,colgroup:xr,dd:Fd,dt:Bd,head:xr,html:Nd,li:Od,optgroup:Gd,option:zd,p:Md,rp:Qo,rt:Qo,tbody:Hd,td:es,tfoot:Vd,th:es,thead:Ud,tr:Wd});function xr(e,n,t){let i=te(t,n,!0);return!i||i.type!=="comment"&&!(i.type==="text"&&ve(i.value.charAt(0)))}function Nd(e,n,t){let i=te(t,n);return!i||i.type!=="comment"}function Ld(e,n,t){let i=te(t,n);return!i||i.type!=="comment"}function Md(e,n,t){let i=te(t,n);return i?i.type==="element"&&(i.tagName==="address"||i.tagName==="article"||i.tagName==="aside"||i.tagName==="blockquote"||i.tagName==="details"||i.tagName==="div"||i.tagName==="dl"||i.tagName==="fieldset"||i.tagName==="figcaption"||i.tagName==="figure"||i.tagName==="footer"||i.tagName==="form"||i.tagName==="h1"||i.tagName==="h2"||i.tagName==="h3"||i.tagName==="h4"||i.tagName==="h5"||i.tagName==="h6"||i.tagName==="header"||i.tagName==="hgroup"||i.tagName==="hr"||i.tagName==="main"||i.tagName==="menu"||i.tagName==="nav"||i.tagName==="ol"||i.tagName==="p"||i.tagName==="pre"||i.tagName==="section"||i.tagName==="table"||i.tagName==="ul"):!t||!(t.type==="element"&&(t.tagName==="a"||t.tagName==="audio"||t.tagName==="del"||t.tagName==="ins"||t.tagName==="map"||t.tagName==="noscript"||t.tagName==="video"))}function Od(e,n,t){let i=te(t,n);return!i||i.type==="element"&&i.tagName==="li"}function Bd(e,n,t){let i=te(t,n);return!!(i&&i.type==="element"&&(i.tagName==="dt"||i.tagName==="dd"))}function Fd(e,n,t){let i=te(t,n);return!i||i.type==="element"&&(i.tagName==="dt"||i.tagName==="dd")}function Qo(e,n,t){let i=te(t,n);return!i||i.type==="element"&&(i.tagName==="rp"||i.tagName==="rt")}function Gd(e,n,t){let i=te(t,n);return!i||i.type==="element"&&i.tagName==="optgroup"}function zd(e,n,t){let i=te(t,n);return!i||i.type==="element"&&(i.tagName==="option"||i.tagName==="optgroup")}function Ud(e,n,t){let i=te(t,n);return!!(i&&i.type==="element"&&(i.tagName==="tbody"||i.tagName==="tfoot"))}function Hd(e,n,t){let i=te(t,n);return!i||i.type==="element"&&(i.tagName==="tbody"||i.tagName==="tfoot")}function Vd(e,n,t){return!te(t,n)}function Wd(e,n,t){let i=te(t,n);return!i||i.type==="element"&&i.tagName==="tr"}function es(e,n,t){let i=te(t,n);return!i||i.type==="element"&&(i.tagName==="td"||i.tagName==="th")}var ts=Wn({body:Kd,colgroup:Xd,head:qd,html:jd,tbody:Yd});function jd(e){let n=te(e,-1);return!n||n.type!=="comment"}function qd(e){let n=e.children,t=[],i=-1;for(;++i<n.length;){let r=n[i];if(r.type==="element"&&(r.tagName==="title"||r.tagName==="base")){if(t.includes(r.tagName))return!1;t.push(r.tagName)}}return n.length>0}function Kd(e){let n=te(e,-1,!0);return!n||n.type!=="comment"&&!(n.type==="text"&&ve(n.value.charAt(0)))&&!(n.type==="element"&&(n.tagName==="meta"||n.tagName==="link"||n.tagName==="script"||n.tagName==="style"||n.tagName==="template"))}function Xd(e,n,t){let i=Ar(t,n),r=te(e,-1,!0);return t&&i&&i.type==="element"&&i.tagName==="colgroup"&&Jt(i,t.children.indexOf(i),t)?!1:!!(r&&r.type==="element"&&r.tagName==="col")}function Yd(e,n,t){let i=Ar(t,n),r=te(e,-1);return t&&i&&i.type==="element"&&(i.tagName==="thead"||i.tagName==="tbody")&&Jt(i,t.children.indexOf(i),t)?!1:!!(r&&r.type==="element"&&r.tagName==="tr")}var jn={name:[[`
3428
3434
  \f\r &/=>`.split(""),`
3429
3435
  \f\r "&'/=>\``.split("")],[`\0
3430
3436
  \f\r "&'/<=>`.split(""),`\0
@@ -3432,13 +3438,13 @@ extractions:`+JSON.stringify(r))||"";o=o.replace(/```json/g,"").replace(/```/g,"
3432
3438
  \f\r &>`.split(""),`\0
3433
3439
  \f\r "&'<=>\``.split("")],[`\0
3434
3440
  \f\r "&'<=>\``.split(""),`\0
3435
- \f\r "&'<=>\``.split("")]],single:[["&'".split(""),"\"&'`".split("")],["\0&'".split(""),"\0\"&'`".split("")]],double:[['"&'.split(""),"\"&'`".split("")],['\0"&'.split(""),"\0\"&'`".split("")]]};function ns(e,n,t,i){let r=i.schema,a=r.space==="svg"?!1:i.settings.omitOptionalTags,o=r.space==="svg"?i.settings.closeEmptyElements:i.settings.voids.includes(e.tagName.toLowerCase()),s=[],l;r.space==="html"&&e.tagName==="svg"&&(i.schema=Un);let c=Jd(i,e.properties),u=i.all(r.space==="html"&&e.tagName==="template"?e.content:e);return i.schema=r,u&&(o=!1),(c||!a||!ts(e,n,t))&&(s.push("<",e.tagName,c?" "+c:""),o&&(r.space==="svg"||i.settings.closeSelfClosing)&&(l=c.charAt(c.length-1),(!i.settings.tightSelfClosing||l==="/"||l&&l!=='"'&&l!=="'")&&s.push(" "),s.push("/")),s.push(">")),s.push(u),!o&&(!a||!Jt(e,n,t))&&s.push("</"+e.tagName+">"),s.join("")}function Jd(e,n){let t=[],i=-1,r;if(n){for(r in n)if(n[r]!==null&&n[r]!==void 0){let a=Zd(e,r,n[r]);a&&t.push(a)}}for(;++i<t.length;){let a=e.settings.tightAttributes?t[i].charAt(t[i].length-1):void 0;i!==t.length-1&&a!=='"'&&a!=="'"&&(t[i]+=" ")}return t.join("")}function Zd(e,n,t){let i=kr(e.schema,n),r=e.settings.allowParseErrors&&e.schema.space==="html"?0:1,a=e.settings.allowDangerousCharacters?0:1,o=e.quote,s;if(i.overloadedBoolean&&(t===i.attribute||t==="")?t=!0:(i.boolean||i.overloadedBoolean&&typeof t!="string")&&(t=!!t),t==null||t===!1||typeof t=="number"&&Number.isNaN(t))return"";let l=ze(i.attribute,Object.assign({},e.settings.characterReferences,{subset:jn.name[r][a]}));return t===!0||(t=Array.isArray(t)?(i.commaSeparated?Zo:So)(t,{padLeft:!e.settings.tightCommaSeparatedLists}):String(t),e.settings.collapseEmptyAttributes&&!t)?l:(e.settings.preferUnquoted&&(s=ze(t,Object.assign({},e.settings.characterReferences,{attribute:!0,subset:jn.unquoted[r][a]}))),s!==t&&(e.settings.quoteSmart&&Tr(t,o)>Tr(t,e.alternative)&&(o=e.alternative),s=o+ze(t,Object.assign({},e.settings.characterReferences,{subset:(o==="'"?jn.single:jn.double)[r][a],attribute:!0}))+o),l+(s&&"="+s))}var $d=["<","&"];function qn(e,n,t,i){return t&&t.type==="element"&&(t.tagName==="script"||t.tagName==="style")?e.value:ze(e.value,Object.assign({},i.settings.characterReferences,{subset:$d}))}function is(e,n,t,i){return i.settings.allowDangerousHtml?e.value:qn(e,n,t,i)}function rs(e,n,t,i){return i.all(e)}var as=Go("type",{invalid:Qd,unknown:ep,handlers:{comment:Yo,doctype:Jo,element:ns,raw:is,root:rs,text:qn}});function Qd(e){throw new Error("Expected node, not `"+e+"`")}function ep(e){let n=e;throw new Error("Cannot compile unknown node `"+n.type+"`")}var tp={},np={},ip=[];function Ir(e,n){let t=n||tp,i=t.quote||'"',r=i==='"'?"'":'"';if(i!=='"'&&i!=="'")throw new Error("Invalid quote `"+i+"`, expected `'` or `\"`");return{one:rp,all:ap,settings:{omitOptionalTags:t.omitOptionalTags||!1,allowParseErrors:t.allowParseErrors||!1,allowDangerousCharacters:t.allowDangerousCharacters||!1,quoteSmart:t.quoteSmart||!1,preferUnquoted:t.preferUnquoted||!1,tightAttributes:t.tightAttributes||!1,upperDoctype:t.upperDoctype||!1,tightDoctype:t.tightDoctype||!1,bogusComments:t.bogusComments||!1,tightCommaSeparatedLists:t.tightCommaSeparatedLists||!1,tightSelfClosing:t.tightSelfClosing||!1,collapseEmptyAttributes:t.collapseEmptyAttributes||!1,allowDangerousHtml:t.allowDangerousHtml||!1,voids:t.voids||Do,characterReferences:t.characterReferences||np,closeSelfClosing:t.closeSelfClosing||!1,closeEmptyElements:t.closeEmptyElements||!1},schema:t.space==="svg"?Un:Bo,quote:i,alternative:r}.one(Array.isArray(e)?{type:"root",children:e}:e,void 0,void 0)}function rp(e,n,t){return as(e,n,t,this)}function ap(e){let n=[],t=e&&e.children||ip,i=-1;for(;++i<t.length;)n[i]=this.one(t[i],i,e);return n.join("")}function Kn(e){let n=this,t={...n.data("settings"),...e};n.compiler=i;function i(r){return Ir(r,t)}}var op={};function Rr(e,n){let t=n||op,i=typeof t.includeImageAlt=="boolean"?t.includeImageAlt:!0,r=typeof t.includeHtml=="boolean"?t.includeHtml:!0;return ss(e,i,r)}function ss(e,n,t){if(sp(e)){if("value"in e)return e.type==="html"&&!t?"":e.value;if(n&&"alt"in e&&e.alt)return e.alt;if("children"in e)return os(e.children,n,t)}return Array.isArray(e)?os(e,n,t):""}function os(e,n,t){let i=[],r=-1;for(;++r<e.length;)i[r]=ss(e[r],n,t);return i.join("")}function sp(e){return!!(e&&typeof e=="object")}var ls=document.createElement("i");function kt(e){let n="&"+e+";";ls.innerHTML=n;let t=ls.textContent;return t.charCodeAt(t.length-1)===59&&e!=="semi"||t===n?!1:t}function de(e,n,t,i){let r=e.length,a=0,o;if(n<0?n=-n>r?0:r+n:n=n>r?r:n,t=t>0?t:0,i.length<1e4)o=Array.from(i),o.unshift(n,t),e.splice(...o);else for(t&&e.splice(n,t);a<i.length;)o=i.slice(a,a+1e4),o.unshift(n,0),e.splice(...o),a+=1e4,n+=1e4}function me(e,n){return e.length>0?(de(e,e.length,0,n),e):n}var cs={}.hasOwnProperty;function us(e){let n={},t=-1;for(;++t<e.length;)lp(n,e[t]);return n}function lp(e,n){let t;for(t in n){let r=(cs.call(e,t)?e[t]:void 0)||(e[t]={}),a=n[t],o;if(a)for(o in a){cs.call(r,o)||(r[o]=[]);let s=a[o];cp(r[o],Array.isArray(s)?s:s?[s]:[])}}}function cp(e,n){let t=-1,i=[];for(;++t<n.length;)(n[t].add==="after"?e:i).push(n[t]);de(e,0,0,i)}function Xn(e,n){let t=Number.parseInt(e,n);return t<9||t===11||t>13&&t<32||t>126&&t<160||t>55295&&t<57344||t>64975&&t<65008||(t&65535)===65535||(t&65535)===65534||t>1114111?"\uFFFD":String.fromCodePoint(t)}function Ue(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}var _e=Ye(/[A-Za-z]/),ae=Ye(/[\dA-Za-z]/),ds=Ye(/[#-'*+\--9=?A-Z^-~]/);function Zt(e){return e!==null&&(e<32||e===127)}var $t=Ye(/\d/),ps=Ye(/[\dA-Fa-f]/),ms=Ye(/[!-/:-@[-`{-~]/);function A(e){return e!==null&&e<-2}function ne(e){return e!==null&&(e<0||e===32)}function F(e){return e===-2||e===-1||e===32}var gs=Ye(/\p{P}|\p{S}/u),hs=Ye(/\s/);function Ye(e){return n;function n(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function ke(e){let n=[],t=-1,i=0,r=0;for(;++t<e.length;){let a=e.charCodeAt(t),o="";if(a===37&&ae(e.charCodeAt(t+1))&&ae(e.charCodeAt(t+2)))r=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(o=String.fromCharCode(a));else if(a>55295&&a<57344){let s=e.charCodeAt(t+1);a<56320&&s>56319&&s<57344?(o=String.fromCharCode(a,s),r=1):o="\uFFFD"}else o=String.fromCharCode(a);o&&(n.push(e.slice(i,t),encodeURIComponent(o)),i=t+r+1,o=""),r&&(t+=r,r=0)}return n.join("")+e.slice(i)}function z(e,n,t,i){let r=i?i-1:Number.POSITIVE_INFINITY,a=0;return o;function o(l){return F(l)?(e.enter(t),s(l)):n(l)}function s(l){return F(l)&&a++<r?(e.consume(l),s):(e.exit(t),n(l))}}var fs={tokenize:up};function up(e){let n=e.attempt(this.parser.constructs.contentInitial,i,r),t;return n;function i(s){if(s===null){e.consume(s);return}return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),z(e,n,"linePrefix")}function r(s){return e.enter("paragraph"),a(s)}function a(s){let l=e.enter("chunkText",{contentType:"text",previous:t});return t&&(t.next=l),t=l,o(s)}function o(s){if(s===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(s);return}return A(s)?(e.consume(s),e.exit("chunkText"),a):(e.consume(s),o)}}var bs={tokenize:dp},ys={tokenize:pp};function dp(e){let n=this,t=[],i=0,r,a,o;return s;function s(S){if(i<t.length){let L=t[i];return n.containerState=L[1],e.attempt(L[0].continuation,l,c)(S)}return c(S)}function l(S){if(i++,n.containerState._closeFlow){n.containerState._closeFlow=void 0,r&&T();let L=n.events.length,N=L,b;for(;N--;)if(n.events[N][0]==="exit"&&n.events[N][1].type==="chunkFlow"){b=n.events[N][1].end;break}y(i);let I=L;for(;I<n.events.length;)n.events[I][1].end=Object.assign({},b),I++;return de(n.events,N+1,0,n.events.slice(L)),n.events.length=I,c(S)}return s(S)}function c(S){if(i===t.length){if(!r)return m(S);if(r.currentConstruct&&r.currentConstruct.concrete)return f(S);n.interrupt=!!(r.currentConstruct&&!r._gfmTableDynamicInterruptHack)}return n.containerState={},e.check(ys,u,d)(S)}function u(S){return r&&T(),y(i),m(S)}function d(S){return n.parser.lazy[n.now().line]=i!==t.length,o=n.now().offset,f(S)}function m(S){return n.containerState={},e.attempt(ys,p,f)(S)}function p(S){return i++,t.push([n.currentConstruct,n.containerState]),m(S)}function f(S){if(S===null){r&&T(),y(0),e.consume(S);return}return r=r||n.parser.flow(n.now()),e.enter("chunkFlow",{contentType:"flow",previous:a,_tokenizer:r}),_(S)}function _(S){if(S===null){E(e.exit("chunkFlow"),!0),y(0),e.consume(S);return}return A(S)?(e.consume(S),E(e.exit("chunkFlow")),i=0,n.interrupt=void 0,s):(e.consume(S),_)}function E(S,L){let N=n.sliceStream(S);if(L&&N.push(null),S.previous=a,a&&(a.next=S),a=S,r.defineSkip(S.start),r.write(N),n.parser.lazy[S.start.line]){let b=r.events.length;for(;b--;)if(r.events[b][1].start.offset<o&&(!r.events[b][1].end||r.events[b][1].end.offset>o))return;let I=n.events.length,D=I,P,M;for(;D--;)if(n.events[D][0]==="exit"&&n.events[D][1].type==="chunkFlow"){if(P){M=n.events[D][1].end;break}P=!0}for(y(i),b=I;b<n.events.length;)n.events[b][1].end=Object.assign({},M),b++;de(n.events,D+1,0,n.events.slice(I)),n.events.length=b}}function y(S){let L=t.length;for(;L-- >S;){let N=t[L];n.containerState=N[1],N[0].exit.call(n,e)}t.length=S}function T(){r.write([null]),a=void 0,r=void 0,n.containerState._closeFlow=void 0}}function pp(e,n,t){return z(e,e.attempt(this.parser.constructs.document,n,t),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Pr(e){if(e===null||ne(e)||hs(e))return 1;if(gs(e))return 2}function wt(e,n,t){let i=[],r=-1;for(;++r<e.length;){let a=e[r].resolveAll;a&&!i.includes(a)&&(n=a(n,t),i.push(a))}return n}var Qt={name:"attention",tokenize:gp,resolveAll:mp};function mp(e,n){let t=-1,i,r,a,o,s,l,c,u;for(;++t<e.length;)if(e[t][0]==="enter"&&e[t][1].type==="attentionSequence"&&e[t][1]._close){for(i=t;i--;)if(e[i][0]==="exit"&&e[i][1].type==="attentionSequence"&&e[i][1]._open&&n.sliceSerialize(e[i][1]).charCodeAt(0)===n.sliceSerialize(e[t][1]).charCodeAt(0)){if((e[i][1]._close||e[t][1]._open)&&(e[t][1].end.offset-e[t][1].start.offset)%3&&!((e[i][1].end.offset-e[i][1].start.offset+e[t][1].end.offset-e[t][1].start.offset)%3))continue;l=e[i][1].end.offset-e[i][1].start.offset>1&&e[t][1].end.offset-e[t][1].start.offset>1?2:1;let d=Object.assign({},e[i][1].end),m=Object.assign({},e[t][1].start);vs(d,-l),vs(m,l),o={type:l>1?"strongSequence":"emphasisSequence",start:d,end:Object.assign({},e[i][1].end)},s={type:l>1?"strongSequence":"emphasisSequence",start:Object.assign({},e[t][1].start),end:m},a={type:l>1?"strongText":"emphasisText",start:Object.assign({},e[i][1].end),end:Object.assign({},e[t][1].start)},r={type:l>1?"strong":"emphasis",start:Object.assign({},o.start),end:Object.assign({},s.end)},e[i][1].end=Object.assign({},o.start),e[t][1].start=Object.assign({},s.end),c=[],e[i][1].end.offset-e[i][1].start.offset&&(c=me(c,[["enter",e[i][1],n],["exit",e[i][1],n]])),c=me(c,[["enter",r,n],["enter",o,n],["exit",o,n],["enter",a,n]]),c=me(c,wt(n.parser.constructs.insideSpan.null,e.slice(i+1,t),n)),c=me(c,[["exit",a,n],["enter",s,n],["exit",s,n],["exit",r,n]]),e[t][1].end.offset-e[t][1].start.offset?(u=2,c=me(c,[["enter",e[t][1],n],["exit",e[t][1],n]])):u=0,de(e,i-1,t-i+3,c),t=i+c.length-u-2;break}}for(t=-1;++t<e.length;)e[t][1].type==="attentionSequence"&&(e[t][1].type="data");return e}function gp(e,n){let t=this.parser.constructs.attentionMarkers.null,i=this.previous,r=Pr(i),a;return o;function o(l){return a=l,e.enter("attentionSequence"),s(l)}function s(l){if(l===a)return e.consume(l),s;let c=e.exit("attentionSequence"),u=Pr(l),d=!u||u===2&&r||t.includes(l),m=!r||r===2&&u||t.includes(i);return c._open=!!(a===42?d:d&&(r||!m)),c._close=!!(a===42?m:m&&(u||!d)),n(l)}}function vs(e,n){e.column+=n,e.offset+=n,e._bufferIndex+=n}var Dr={name:"autolink",tokenize:hp};function hp(e,n,t){let i=0;return r;function r(p){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),a}function a(p){return _e(p)?(e.consume(p),o):p===64?t(p):c(p)}function o(p){return p===43||p===45||p===46||ae(p)?(i=1,s(p)):c(p)}function s(p){return p===58?(e.consume(p),i=0,l):(p===43||p===45||p===46||ae(p))&&i++<32?(e.consume(p),s):(i=0,c(p))}function l(p){return p===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),n):p===null||p===32||p===60||Zt(p)?t(p):(e.consume(p),l)}function c(p){return p===64?(e.consume(p),u):ds(p)?(e.consume(p),c):t(p)}function u(p){return ae(p)?d(p):t(p)}function d(p){return p===46?(e.consume(p),i=0,u):p===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),n):m(p)}function m(p){if((p===45||ae(p))&&i++<63){let f=p===45?m:d;return e.consume(p),f}return t(p)}}var Je={tokenize:fp,partial:!0};function fp(e,n,t){return i;function i(a){return F(a)?z(e,r,"linePrefix")(a):r(a)}function r(a){return a===null||A(a)?n(a):t(a)}}var Yn={name:"blockQuote",tokenize:yp,continuation:{tokenize:bp},exit:vp};function yp(e,n,t){let i=this;return r;function r(o){if(o===62){let s=i.containerState;return s.open||(e.enter("blockQuote",{_container:!0}),s.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(o),e.exit("blockQuoteMarker"),a}return t(o)}function a(o){return F(o)?(e.enter("blockQuotePrefixWhitespace"),e.consume(o),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),n):(e.exit("blockQuotePrefix"),n(o))}}function bp(e,n,t){let i=this;return r;function r(o){return F(o)?z(e,a,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):a(o)}function a(o){return e.attempt(Yn,n,t)(o)}}function vp(e){e.exit("blockQuote")}var Jn={name:"characterEscape",tokenize:_p};function _p(e,n,t){return i;function i(a){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(a),e.exit("escapeMarker"),r}function r(a){return ms(a)?(e.enter("characterEscapeValue"),e.consume(a),e.exit("characterEscapeValue"),e.exit("characterEscape"),n):t(a)}}var Zn={name:"characterReference",tokenize:Sp};function Sp(e,n,t){let i=this,r=0,a,o;return s;function s(d){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(d),e.exit("characterReferenceMarker"),l}function l(d){return d===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(d),e.exit("characterReferenceMarkerNumeric"),c):(e.enter("characterReferenceValue"),a=31,o=ae,u(d))}function c(d){return d===88||d===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(d),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),a=6,o=ps,u):(e.enter("characterReferenceValue"),a=7,o=$t,u(d))}function u(d){if(d===59&&r){let m=e.exit("characterReferenceValue");return o===ae&&!kt(i.sliceSerialize(m))?t(d):(e.enter("characterReferenceMarker"),e.consume(d),e.exit("characterReferenceMarker"),e.exit("characterReference"),n)}return o(d)&&r++<a?(e.consume(d),u):t(d)}}var _s={tokenize:Cp,partial:!0},$n={name:"codeFenced",tokenize:Ep,concrete:!0};function Ep(e,n,t){let i=this,r={tokenize:N,partial:!0},a=0,o=0,s;return l;function l(b){return c(b)}function c(b){let I=i.events[i.events.length-1];return a=I&&I[1].type==="linePrefix"?I[2].sliceSerialize(I[1],!0).length:0,s=b,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),u(b)}function u(b){return b===s?(o++,e.consume(b),u):o<3?t(b):(e.exit("codeFencedFenceSequence"),F(b)?z(e,d,"whitespace")(b):d(b))}function d(b){return b===null||A(b)?(e.exit("codeFencedFence"),i.interrupt?n(b):e.check(_s,_,L)(b)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),m(b))}function m(b){return b===null||A(b)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),d(b)):F(b)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),z(e,p,"whitespace")(b)):b===96&&b===s?t(b):(e.consume(b),m)}function p(b){return b===null||A(b)?d(b):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),f(b))}function f(b){return b===null||A(b)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),d(b)):b===96&&b===s?t(b):(e.consume(b),f)}function _(b){return e.attempt(r,L,E)(b)}function E(b){return e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),y}function y(b){return a>0&&F(b)?z(e,T,"linePrefix",a+1)(b):T(b)}function T(b){return b===null||A(b)?e.check(_s,_,L)(b):(e.enter("codeFlowValue"),S(b))}function S(b){return b===null||A(b)?(e.exit("codeFlowValue"),T(b)):(e.consume(b),S)}function L(b){return e.exit("codeFenced"),n(b)}function N(b,I,D){let P=0;return M;function M(O){return b.enter("lineEnding"),b.consume(O),b.exit("lineEnding"),H}function H(O){return b.enter("codeFencedFence"),F(O)?z(b,R,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(O):R(O)}function R(O){return O===s?(b.enter("codeFencedFenceSequence"),w(O)):D(O)}function w(O){return O===s?(P++,b.consume(O),w):P>=o?(b.exit("codeFencedFenceSequence"),F(O)?z(b,x,"whitespace")(O):x(O)):D(O)}function x(O){return O===null||A(O)?(b.exit("codeFencedFence"),I(O)):D(O)}}}function Cp(e,n,t){let i=this;return r;function r(o){return o===null?t(o):(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),a)}function a(o){return i.parser.lazy[i.now().line]?t(o):n(o)}}var en={name:"codeIndented",tokenize:wp},kp={tokenize:Tp,partial:!0};function wp(e,n,t){let i=this;return r;function r(c){return e.enter("codeIndented"),z(e,a,"linePrefix",5)(c)}function a(c){let u=i.events[i.events.length-1];return u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?o(c):t(c)}function o(c){return c===null?l(c):A(c)?e.attempt(kp,o,l)(c):(e.enter("codeFlowValue"),s(c))}function s(c){return c===null||A(c)?(e.exit("codeFlowValue"),o(c)):(e.consume(c),s)}function l(c){return e.exit("codeIndented"),n(c)}}function Tp(e,n,t){let i=this;return r;function r(o){return i.parser.lazy[i.now().line]?t(o):A(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),r):z(e,a,"linePrefix",5)(o)}function a(o){let s=i.events[i.events.length-1];return s&&s[1].type==="linePrefix"&&s[2].sliceSerialize(s[1],!0).length>=4?n(o):A(o)?r(o):t(o)}}var Lr={name:"codeText",tokenize:Ip,resolve:Ap,previous:xp};function Ap(e){let n=e.length-4,t=3,i,r;if((e[t][1].type==="lineEnding"||e[t][1].type==="space")&&(e[n][1].type==="lineEnding"||e[n][1].type==="space")){for(i=t;++i<n;)if(e[i][1].type==="codeTextData"){e[t][1].type="codeTextPadding",e[n][1].type="codeTextPadding",t+=2,n-=2;break}}for(i=t-1,n++;++i<=n;)r===void 0?i!==n&&e[i][1].type!=="lineEnding"&&(r=i):(i===n||e[i][1].type==="lineEnding")&&(e[r][1].type="codeTextData",i!==r+2&&(e[r][1].end=e[i-1][1].end,e.splice(r+2,i-r-2),n-=i-r-2,i=r+2),r=void 0);return e}function xp(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function Ip(e,n,t){let i=this,r=0,a,o;return s;function s(m){return e.enter("codeText"),e.enter("codeTextSequence"),l(m)}function l(m){return m===96?(e.consume(m),r++,l):(e.exit("codeTextSequence"),c(m))}function c(m){return m===null?t(m):m===32?(e.enter("space"),e.consume(m),e.exit("space"),c):m===96?(o=e.enter("codeTextSequence"),a=0,d(m)):A(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),c):(e.enter("codeTextData"),u(m))}function u(m){return m===null||m===32||m===96||A(m)?(e.exit("codeTextData"),c(m)):(e.consume(m),u)}function d(m){return m===96?(e.consume(m),a++,d):a===r?(e.exit("codeTextSequence"),e.exit("codeText"),n(m)):(o.type="codeTextData",u(m))}}var Qn=class{constructor(n){this.left=n?[...n]:[],this.right=[]}get(n){if(n<0||n>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+n+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return n<this.left.length?this.left[n]:this.right[this.right.length-n+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(n,t){let i=t??Number.POSITIVE_INFINITY;return i<this.left.length?this.left.slice(n,i):n>this.left.length?this.right.slice(this.right.length-i+this.left.length,this.right.length-n+this.left.length).reverse():this.left.slice(n).concat(this.right.slice(this.right.length-i+this.left.length).reverse())}splice(n,t,i){let r=t||0;this.setCursor(Math.trunc(n));let a=this.right.splice(this.right.length-r,Number.POSITIVE_INFINITY);return i&&tn(this.left,i),a.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(n){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(n)}pushMany(n){this.setCursor(Number.POSITIVE_INFINITY),tn(this.left,n)}unshift(n){this.setCursor(0),this.right.push(n)}unshiftMany(n){this.setCursor(0),tn(this.right,n.reverse())}setCursor(n){if(!(n===this.left.length||n>this.left.length&&this.right.length===0||n<0&&this.left.length===0))if(n<this.left.length){let t=this.left.splice(n,Number.POSITIVE_INFINITY);tn(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-n,Number.POSITIVE_INFINITY);tn(this.left,t.reverse())}}};function tn(e,n){let t=0;if(n.length<1e4)e.push(...n);else for(;t<n.length;)e.push(...n.slice(t,t+1e4)),t+=1e4}function ei(e){let n={},t=-1,i,r,a,o,s,l,c,u=new Qn(e);for(;++t<u.length;){for(;t in n;)t=n[t];if(i=u.get(t),t&&i[1].type==="chunkFlow"&&u.get(t-1)[1].type==="listItemPrefix"&&(l=i[1]._tokenizer.events,a=0,a<l.length&&l[a][1].type==="lineEndingBlank"&&(a+=2),a<l.length&&l[a][1].type==="content"))for(;++a<l.length&&l[a][1].type!=="content";)l[a][1].type==="chunkText"&&(l[a][1]._isInFirstContentOfListItem=!0,a++);if(i[0]==="enter")i[1].contentType&&(Object.assign(n,Rp(u,t)),t=n[t],c=!0);else if(i[1]._container){for(a=t,r=void 0;a--&&(o=u.get(a),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank");)o[0]==="enter"&&(r&&(u.get(r)[1].type="lineEndingBlank"),o[1].type="lineEnding",r=a);r&&(i[1].end=Object.assign({},u.get(r)[1].start),s=u.slice(r,t),s.unshift(i),u.splice(r,t-r+1,s))}}return de(e,0,Number.POSITIVE_INFINITY,u.slice(0)),!c}function Rp(e,n){let t=e.get(n)[1],i=e.get(n)[2],r=n-1,a=[],o=t._tokenizer||i.parser[t.contentType](t.start),s=o.events,l=[],c={},u,d,m=-1,p=t,f=0,_=0,E=[_];for(;p;){for(;e.get(++r)[1]!==p;);a.push(r),p._tokenizer||(u=i.sliceStream(p),p.next||u.push(null),d&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=p,p=p.next}for(p=t;++m<s.length;)s[m][0]==="exit"&&s[m-1][0]==="enter"&&s[m][1].type===s[m-1][1].type&&s[m][1].start.line!==s[m][1].end.line&&(_=m+1,E.push(_),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):E.pop(),m=E.length;m--;){let y=s.slice(E[m],E[m+1]),T=a.pop();l.push([T,T+y.length-1]),e.splice(T,2,y)}for(l.reverse(),m=-1;++m<l.length;)c[f+l[m][0]]=f+l[m][1],f+=l[m][1]-l[m][0]-1;return c}var Nr={tokenize:Lp,resolve:Dp},Pp={tokenize:Np,partial:!0};function Dp(e){return ei(e),e}function Lp(e,n){let t;return i;function i(s){return e.enter("content"),t=e.enter("chunkContent",{contentType:"content"}),r(s)}function r(s){return s===null?a(s):A(s)?e.check(Pp,o,a)(s):(e.consume(s),r)}function a(s){return e.exit("chunkContent"),e.exit("content"),n(s)}function o(s){return e.consume(s),e.exit("chunkContent"),t.next=e.enter("chunkContent",{contentType:"content",previous:t}),t=t.next,r}}function Np(e,n,t){let i=this;return r;function r(o){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),z(e,a,"linePrefix")}function a(o){if(o===null||A(o))return t(o);let s=i.events[i.events.length-1];return!i.parser.constructs.disable.null.includes("codeIndented")&&s&&s[1].type==="linePrefix"&&s[2].sliceSerialize(s[1],!0).length>=4?n(o):e.interrupt(i.parser.constructs.flow,t,n)(o)}}function ti(e,n,t,i,r,a,o,s,l){let c=l||Number.POSITIVE_INFINITY,u=0;return d;function d(y){return y===60?(e.enter(i),e.enter(r),e.enter(a),e.consume(y),e.exit(a),m):y===null||y===32||y===41||Zt(y)?t(y):(e.enter(i),e.enter(o),e.enter(s),e.enter("chunkString",{contentType:"string"}),_(y))}function m(y){return y===62?(e.enter(a),e.consume(y),e.exit(a),e.exit(r),e.exit(i),n):(e.enter(s),e.enter("chunkString",{contentType:"string"}),p(y))}function p(y){return y===62?(e.exit("chunkString"),e.exit(s),m(y)):y===null||y===60||A(y)?t(y):(e.consume(y),y===92?f:p)}function f(y){return y===60||y===62||y===92?(e.consume(y),p):p(y)}function _(y){return!u&&(y===null||y===41||ne(y))?(e.exit("chunkString"),e.exit(s),e.exit(o),e.exit(i),n(y)):u<c&&y===40?(e.consume(y),u++,_):y===41?(e.consume(y),u--,_):y===null||y===32||y===40||Zt(y)?t(y):(e.consume(y),y===92?E:_)}function E(y){return y===40||y===41||y===92?(e.consume(y),_):_(y)}}function ni(e,n,t,i,r,a){let o=this,s=0,l;return c;function c(p){return e.enter(i),e.enter(r),e.consume(p),e.exit(r),e.enter(a),u}function u(p){return s>999||p===null||p===91||p===93&&!l||p===94&&!s&&"_hiddenFootnoteSupport"in o.parser.constructs?t(p):p===93?(e.exit(a),e.enter(r),e.consume(p),e.exit(r),e.exit(i),n):A(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),u):(e.enter("chunkString",{contentType:"string"}),d(p))}function d(p){return p===null||p===91||p===93||A(p)||s++>999?(e.exit("chunkString"),u(p)):(e.consume(p),l||(l=!F(p)),p===92?m:d)}function m(p){return p===91||p===92||p===93?(e.consume(p),s++,d):d(p)}}function ii(e,n,t,i,r,a){let o;return s;function s(m){return m===34||m===39||m===40?(e.enter(i),e.enter(r),e.consume(m),e.exit(r),o=m===40?41:m,l):t(m)}function l(m){return m===o?(e.enter(r),e.consume(m),e.exit(r),e.exit(i),n):(e.enter(a),c(m))}function c(m){return m===o?(e.exit(a),l(o)):m===null?t(m):A(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),z(e,c,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),u(m))}function u(m){return m===o||m===null||A(m)?(e.exit("chunkString"),c(m)):(e.consume(m),m===92?d:u)}function d(m){return m===o||m===92?(e.consume(m),u):u(m)}}function at(e,n){let t;return i;function i(r){return A(r)?(e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),t=!0,i):F(r)?z(e,i,t?"linePrefix":"lineSuffix")(r):n(r)}}var Mr={name:"definition",tokenize:Op},Mp={tokenize:Bp,partial:!0};function Op(e,n,t){let i=this,r;return a;function a(p){return e.enter("definition"),o(p)}function o(p){return ni.call(i,e,s,t,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function s(p){return r=Ue(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)),p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),l):t(p)}function l(p){return ne(p)?at(e,c)(p):c(p)}function c(p){return ti(e,u,t,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function u(p){return e.attempt(Mp,d,d)(p)}function d(p){return F(p)?z(e,m,"whitespace")(p):m(p)}function m(p){return p===null||A(p)?(e.exit("definition"),i.parser.defined.push(r),n(p)):t(p)}}function Bp(e,n,t){return i;function i(s){return ne(s)?at(e,r)(s):t(s)}function r(s){return ii(e,a,t,"definitionTitle","definitionTitleMarker","definitionTitleString")(s)}function a(s){return F(s)?z(e,o,"whitespace")(s):o(s)}function o(s){return s===null||A(s)?n(s):t(s)}}var Or={name:"hardBreakEscape",tokenize:Fp};function Fp(e,n,t){return i;function i(a){return e.enter("hardBreakEscape"),e.consume(a),r}function r(a){return A(a)?(e.exit("hardBreakEscape"),n(a)):t(a)}}var Br={name:"headingAtx",tokenize:zp,resolve:Gp};function Gp(e,n){let t=e.length-2,i=3,r,a;return e[i][1].type==="whitespace"&&(i+=2),t-2>i&&e[t][1].type==="whitespace"&&(t-=2),e[t][1].type==="atxHeadingSequence"&&(i===t-1||t-4>i&&e[t-2][1].type==="whitespace")&&(t-=i+1===t?2:4),t>i&&(r={type:"atxHeadingText",start:e[i][1].start,end:e[t][1].end},a={type:"chunkText",start:e[i][1].start,end:e[t][1].end,contentType:"text"},de(e,i,t-i+1,[["enter",r,n],["enter",a,n],["exit",a,n],["exit",r,n]])),e}function zp(e,n,t){let i=0;return r;function r(u){return e.enter("atxHeading"),a(u)}function a(u){return e.enter("atxHeadingSequence"),o(u)}function o(u){return u===35&&i++<6?(e.consume(u),o):u===null||ne(u)?(e.exit("atxHeadingSequence"),s(u)):t(u)}function s(u){return u===35?(e.enter("atxHeadingSequence"),l(u)):u===null||A(u)?(e.exit("atxHeading"),n(u)):F(u)?z(e,s,"whitespace")(u):(e.enter("atxHeadingText"),c(u))}function l(u){return u===35?(e.consume(u),l):(e.exit("atxHeadingSequence"),s(u))}function c(u){return u===null||u===35||ne(u)?(e.exit("atxHeadingText"),s(u)):(e.consume(u),c)}}var Ss=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],Fr=["pre","script","style","textarea"];var Gr={name:"htmlFlow",tokenize:Wp,resolveTo:Vp,concrete:!0},Up={tokenize:qp,partial:!0},Hp={tokenize:jp,partial:!0};function Vp(e){let n=e.length;for(;n--&&!(e[n][0]==="enter"&&e[n][1].type==="htmlFlow"););return n>1&&e[n-2][1].type==="linePrefix"&&(e[n][1].start=e[n-2][1].start,e[n+1][1].start=e[n-2][1].start,e.splice(n-2,2)),e}function Wp(e,n,t){let i=this,r,a,o,s,l;return c;function c(h){return u(h)}function u(h){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(h),d}function d(h){return h===33?(e.consume(h),m):h===47?(e.consume(h),a=!0,_):h===63?(e.consume(h),r=3,i.interrupt?n:g):_e(h)?(e.consume(h),o=String.fromCharCode(h),E):t(h)}function m(h){return h===45?(e.consume(h),r=2,p):h===91?(e.consume(h),r=5,s=0,f):_e(h)?(e.consume(h),r=4,i.interrupt?n:g):t(h)}function p(h){return h===45?(e.consume(h),i.interrupt?n:g):t(h)}function f(h){let fe="CDATA[";return h===fe.charCodeAt(s++)?(e.consume(h),s===fe.length?i.interrupt?n:R:f):t(h)}function _(h){return _e(h)?(e.consume(h),o=String.fromCharCode(h),E):t(h)}function E(h){if(h===null||h===47||h===62||ne(h)){let fe=h===47,Qe=o.toLowerCase();return!fe&&!a&&Fr.includes(Qe)?(r=1,i.interrupt?n(h):R(h)):Ss.includes(o.toLowerCase())?(r=6,fe?(e.consume(h),y):i.interrupt?n(h):R(h)):(r=7,i.interrupt&&!i.parser.lazy[i.now().line]?t(h):a?T(h):S(h))}return h===45||ae(h)?(e.consume(h),o+=String.fromCharCode(h),E):t(h)}function y(h){return h===62?(e.consume(h),i.interrupt?n:R):t(h)}function T(h){return F(h)?(e.consume(h),T):M(h)}function S(h){return h===47?(e.consume(h),M):h===58||h===95||_e(h)?(e.consume(h),L):F(h)?(e.consume(h),S):M(h)}function L(h){return h===45||h===46||h===58||h===95||ae(h)?(e.consume(h),L):N(h)}function N(h){return h===61?(e.consume(h),b):F(h)?(e.consume(h),N):S(h)}function b(h){return h===null||h===60||h===61||h===62||h===96?t(h):h===34||h===39?(e.consume(h),l=h,I):F(h)?(e.consume(h),b):D(h)}function I(h){return h===l?(e.consume(h),l=null,P):h===null||A(h)?t(h):(e.consume(h),I)}function D(h){return h===null||h===34||h===39||h===47||h===60||h===61||h===62||h===96||ne(h)?N(h):(e.consume(h),D)}function P(h){return h===47||h===62||F(h)?S(h):t(h)}function M(h){return h===62?(e.consume(h),H):t(h)}function H(h){return h===null||A(h)?R(h):F(h)?(e.consume(h),H):t(h)}function R(h){return h===45&&r===2?(e.consume(h),j):h===60&&r===1?(e.consume(h),X):h===62&&r===4?(e.consume(h),Se):h===63&&r===3?(e.consume(h),g):h===93&&r===5?(e.consume(h),ie):A(h)&&(r===6||r===7)?(e.exit("htmlFlowData"),e.check(Up,Me,w)(h)):h===null||A(h)?(e.exit("htmlFlowData"),w(h)):(e.consume(h),R)}function w(h){return e.check(Hp,x,Me)(h)}function x(h){return e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),O}function O(h){return h===null||A(h)?w(h):(e.enter("htmlFlowData"),R(h))}function j(h){return h===45?(e.consume(h),g):R(h)}function X(h){return h===47?(e.consume(h),o="",re):R(h)}function re(h){if(h===62){let fe=o.toLowerCase();return Fr.includes(fe)?(e.consume(h),Se):R(h)}return _e(h)&&o.length<8?(e.consume(h),o+=String.fromCharCode(h),re):R(h)}function ie(h){return h===93?(e.consume(h),g):R(h)}function g(h){return h===62?(e.consume(h),Se):h===45&&r===2?(e.consume(h),g):R(h)}function Se(h){return h===null||A(h)?(e.exit("htmlFlowData"),Me(h)):(e.consume(h),Se)}function Me(h){return e.exit("htmlFlow"),n(h)}}function jp(e,n,t){let i=this;return r;function r(o){return A(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),a):t(o)}function a(o){return i.parser.lazy[i.now().line]?t(o):n(o)}}function qp(e,n,t){return i;function i(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),e.attempt(Je,n,t)}}var zr={name:"htmlText",tokenize:Kp};function Kp(e,n,t){let i=this,r,a,o;return s;function s(g){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(g),l}function l(g){return g===33?(e.consume(g),c):g===47?(e.consume(g),N):g===63?(e.consume(g),S):_e(g)?(e.consume(g),D):t(g)}function c(g){return g===45?(e.consume(g),u):g===91?(e.consume(g),a=0,f):_e(g)?(e.consume(g),T):t(g)}function u(g){return g===45?(e.consume(g),p):t(g)}function d(g){return g===null?t(g):g===45?(e.consume(g),m):A(g)?(o=d,X(g)):(e.consume(g),d)}function m(g){return g===45?(e.consume(g),p):d(g)}function p(g){return g===62?j(g):g===45?m(g):d(g)}function f(g){let Se="CDATA[";return g===Se.charCodeAt(a++)?(e.consume(g),a===Se.length?_:f):t(g)}function _(g){return g===null?t(g):g===93?(e.consume(g),E):A(g)?(o=_,X(g)):(e.consume(g),_)}function E(g){return g===93?(e.consume(g),y):_(g)}function y(g){return g===62?j(g):g===93?(e.consume(g),y):_(g)}function T(g){return g===null||g===62?j(g):A(g)?(o=T,X(g)):(e.consume(g),T)}function S(g){return g===null?t(g):g===63?(e.consume(g),L):A(g)?(o=S,X(g)):(e.consume(g),S)}function L(g){return g===62?j(g):S(g)}function N(g){return _e(g)?(e.consume(g),b):t(g)}function b(g){return g===45||ae(g)?(e.consume(g),b):I(g)}function I(g){return A(g)?(o=I,X(g)):F(g)?(e.consume(g),I):j(g)}function D(g){return g===45||ae(g)?(e.consume(g),D):g===47||g===62||ne(g)?P(g):t(g)}function P(g){return g===47?(e.consume(g),j):g===58||g===95||_e(g)?(e.consume(g),M):A(g)?(o=P,X(g)):F(g)?(e.consume(g),P):j(g)}function M(g){return g===45||g===46||g===58||g===95||ae(g)?(e.consume(g),M):H(g)}function H(g){return g===61?(e.consume(g),R):A(g)?(o=H,X(g)):F(g)?(e.consume(g),H):P(g)}function R(g){return g===null||g===60||g===61||g===62||g===96?t(g):g===34||g===39?(e.consume(g),r=g,w):A(g)?(o=R,X(g)):F(g)?(e.consume(g),R):(e.consume(g),x)}function w(g){return g===r?(e.consume(g),r=void 0,O):g===null?t(g):A(g)?(o=w,X(g)):(e.consume(g),w)}function x(g){return g===null||g===34||g===39||g===60||g===61||g===96?t(g):g===47||g===62||ne(g)?P(g):(e.consume(g),x)}function O(g){return g===47||g===62||ne(g)?P(g):t(g)}function j(g){return g===62?(e.consume(g),e.exit("htmlTextData"),e.exit("htmlText"),n):t(g)}function X(g){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(g),e.exit("lineEnding"),re}function re(g){return F(g)?z(e,ie,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(g):ie(g)}function ie(g){return e.enter("htmlTextData"),o(g)}}var ot={name:"labelEnd",tokenize:Qp,resolveTo:$p,resolveAll:Zp},Xp={tokenize:em},Yp={tokenize:tm},Jp={tokenize:nm};function Zp(e){let n=-1;for(;++n<e.length;){let t=e[n][1];(t.type==="labelImage"||t.type==="labelLink"||t.type==="labelEnd")&&(e.splice(n+1,t.type==="labelImage"?4:2),t.type="data",n++)}return e}function $p(e,n){let t=e.length,i=0,r,a,o,s;for(;t--;)if(r=e[t][1],a){if(r.type==="link"||r.type==="labelLink"&&r._inactive)break;e[t][0]==="enter"&&r.type==="labelLink"&&(r._inactive=!0)}else if(o){if(e[t][0]==="enter"&&(r.type==="labelImage"||r.type==="labelLink")&&!r._balanced&&(a=t,r.type!=="labelLink")){i=2;break}}else r.type==="labelEnd"&&(o=t);let l={type:e[a][1].type==="labelLink"?"link":"image",start:Object.assign({},e[a][1].start),end:Object.assign({},e[e.length-1][1].end)},c={type:"label",start:Object.assign({},e[a][1].start),end:Object.assign({},e[o][1].end)},u={type:"labelText",start:Object.assign({},e[a+i+2][1].end),end:Object.assign({},e[o-2][1].start)};return s=[["enter",l,n],["enter",c,n]],s=me(s,e.slice(a+1,a+i+3)),s=me(s,[["enter",u,n]]),s=me(s,wt(n.parser.constructs.insideSpan.null,e.slice(a+i+4,o-3),n)),s=me(s,[["exit",u,n],e[o-2],e[o-1],["exit",c,n]]),s=me(s,e.slice(o+1)),s=me(s,[["exit",l,n]]),de(e,a,e.length,s),e}function Qp(e,n,t){let i=this,r=i.events.length,a,o;for(;r--;)if((i.events[r][1].type==="labelImage"||i.events[r][1].type==="labelLink")&&!i.events[r][1]._balanced){a=i.events[r][1];break}return s;function s(m){return a?a._inactive?d(m):(o=i.parser.defined.includes(Ue(i.sliceSerialize({start:a.end,end:i.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(m),e.exit("labelMarker"),e.exit("labelEnd"),l):t(m)}function l(m){return m===40?e.attempt(Xp,u,o?u:d)(m):m===91?e.attempt(Yp,u,o?c:d)(m):o?u(m):d(m)}function c(m){return e.attempt(Jp,u,d)(m)}function u(m){return n(m)}function d(m){return a._balanced=!0,t(m)}}function em(e,n,t){return i;function i(d){return e.enter("resource"),e.enter("resourceMarker"),e.consume(d),e.exit("resourceMarker"),r}function r(d){return ne(d)?at(e,a)(d):a(d)}function a(d){return d===41?u(d):ti(e,o,s,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(d)}function o(d){return ne(d)?at(e,l)(d):u(d)}function s(d){return t(d)}function l(d){return d===34||d===39||d===40?ii(e,c,t,"resourceTitle","resourceTitleMarker","resourceTitleString")(d):u(d)}function c(d){return ne(d)?at(e,u)(d):u(d)}function u(d){return d===41?(e.enter("resourceMarker"),e.consume(d),e.exit("resourceMarker"),e.exit("resource"),n):t(d)}}function tm(e,n,t){let i=this;return r;function r(s){return ni.call(i,e,a,o,"reference","referenceMarker","referenceString")(s)}function a(s){return i.parser.defined.includes(Ue(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)))?n(s):t(s)}function o(s){return t(s)}}function nm(e,n,t){return i;function i(a){return e.enter("reference"),e.enter("referenceMarker"),e.consume(a),e.exit("referenceMarker"),r}function r(a){return a===93?(e.enter("referenceMarker"),e.consume(a),e.exit("referenceMarker"),e.exit("reference"),n):t(a)}}var Ur={name:"labelStartImage",tokenize:im,resolveAll:ot.resolveAll};function im(e,n,t){let i=this;return r;function r(s){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(s),e.exit("labelImageMarker"),a}function a(s){return s===91?(e.enter("labelMarker"),e.consume(s),e.exit("labelMarker"),e.exit("labelImage"),o):t(s)}function o(s){return s===94&&"_hiddenFootnoteSupport"in i.parser.constructs?t(s):n(s)}}var Hr={name:"labelStartLink",tokenize:rm,resolveAll:ot.resolveAll};function rm(e,n,t){let i=this;return r;function r(o){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),e.exit("labelLink"),a}function a(o){return o===94&&"_hiddenFootnoteSupport"in i.parser.constructs?t(o):n(o)}}var nn={name:"lineEnding",tokenize:am};function am(e,n){return t;function t(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),z(e,n,"linePrefix")}}var st={name:"thematicBreak",tokenize:om};function om(e,n,t){let i=0,r;return a;function a(c){return e.enter("thematicBreak"),o(c)}function o(c){return r=c,s(c)}function s(c){return c===r?(e.enter("thematicBreakSequence"),l(c)):i>=3&&(c===null||A(c))?(e.exit("thematicBreak"),n(c)):t(c)}function l(c){return c===r?(e.consume(c),i++,l):(e.exit("thematicBreakSequence"),F(c)?z(e,s,"whitespace")(c):s(c))}}var pe={name:"list",tokenize:cm,continuation:{tokenize:um},exit:pm},sm={tokenize:mm,partial:!0},lm={tokenize:dm,partial:!0};function cm(e,n,t){let i=this,r=i.events[i.events.length-1],a=r&&r[1].type==="linePrefix"?r[2].sliceSerialize(r[1],!0).length:0,o=0;return s;function s(p){let f=i.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(f==="listUnordered"?!i.containerState.marker||p===i.containerState.marker:$t(p)){if(i.containerState.type||(i.containerState.type=f,e.enter(f,{_container:!0})),f==="listUnordered")return e.enter("listItemPrefix"),p===42||p===45?e.check(st,t,c)(p):c(p);if(!i.interrupt||p===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),l(p)}return t(p)}function l(p){return $t(p)&&++o<10?(e.consume(p),l):(!i.interrupt||o<2)&&(i.containerState.marker?p===i.containerState.marker:p===41||p===46)?(e.exit("listItemValue"),c(p)):t(p)}function c(p){return e.enter("listItemMarker"),e.consume(p),e.exit("listItemMarker"),i.containerState.marker=i.containerState.marker||p,e.check(Je,i.interrupt?t:u,e.attempt(sm,m,d))}function u(p){return i.containerState.initialBlankLine=!0,a++,m(p)}function d(p){return F(p)?(e.enter("listItemPrefixWhitespace"),e.consume(p),e.exit("listItemPrefixWhitespace"),m):t(p)}function m(p){return i.containerState.size=a+i.sliceSerialize(e.exit("listItemPrefix"),!0).length,n(p)}}function um(e,n,t){let i=this;return i.containerState._closeFlow=void 0,e.check(Je,r,a);function r(s){return i.containerState.furtherBlankLines=i.containerState.furtherBlankLines||i.containerState.initialBlankLine,z(e,n,"listItemIndent",i.containerState.size+1)(s)}function a(s){return i.containerState.furtherBlankLines||!F(s)?(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,o(s)):(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,e.attempt(lm,n,o)(s))}function o(s){return i.containerState._closeFlow=!0,i.interrupt=void 0,z(e,e.attempt(pe,n,t),"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s)}}function dm(e,n,t){let i=this;return z(e,r,"listItemIndent",i.containerState.size+1);function r(a){let o=i.events[i.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===i.containerState.size?n(a):t(a)}}function pm(e){e.exit(this.containerState.type)}function mm(e,n,t){let i=this;return z(e,r,"listItemPrefixWhitespace",i.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function r(a){let o=i.events[i.events.length-1];return!F(a)&&o&&o[1].type==="listItemPrefixWhitespace"?n(a):t(a)}}var ri={name:"setextUnderline",tokenize:hm,resolveTo:gm};function gm(e,n){let t=e.length,i,r,a;for(;t--;)if(e[t][0]==="enter"){if(e[t][1].type==="content"){i=t;break}e[t][1].type==="paragraph"&&(r=t)}else e[t][1].type==="content"&&e.splice(t,1),!a&&e[t][1].type==="definition"&&(a=t);let o={type:"setextHeading",start:Object.assign({},e[r][1].start),end:Object.assign({},e[e.length-1][1].end)};return e[r][1].type="setextHeadingText",a?(e.splice(r,0,["enter",o,n]),e.splice(a+1,0,["exit",e[i][1],n]),e[i][1].end=Object.assign({},e[a][1].end)):e[i][1]=o,e.push(["exit",o,n]),e}function hm(e,n,t){let i=this,r;return a;function a(c){let u=i.events.length,d;for(;u--;)if(i.events[u][1].type!=="lineEnding"&&i.events[u][1].type!=="linePrefix"&&i.events[u][1].type!=="content"){d=i.events[u][1].type==="paragraph";break}return!i.parser.lazy[i.now().line]&&(i.interrupt||d)?(e.enter("setextHeadingLine"),r=c,o(c)):t(c)}function o(c){return e.enter("setextHeadingLineSequence"),s(c)}function s(c){return c===r?(e.consume(c),s):(e.exit("setextHeadingLineSequence"),F(c)?z(e,l,"lineSuffix")(c):l(c))}function l(c){return c===null||A(c)?(e.exit("setextHeadingLine"),n(c)):t(c)}}var Es={tokenize:fm};function fm(e){let n=this,t=e.attempt(Je,i,e.attempt(this.parser.constructs.flowInitial,r,z(e,e.attempt(this.parser.constructs.flow,r,e.attempt(Nr,r)),"linePrefix")));return t;function i(a){if(a===null){e.consume(a);return}return e.enter("lineEndingBlank"),e.consume(a),e.exit("lineEndingBlank"),n.currentConstruct=void 0,t}function r(a){if(a===null){e.consume(a);return}return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),n.currentConstruct=void 0,t}}var Cs={resolveAll:As()},ks=Ts("string"),ws=Ts("text");function Ts(e){return{tokenize:n,resolveAll:As(e==="text"?ym:void 0)};function n(t){let i=this,r=this.parser.constructs[e],a=t.attempt(r,o,s);return o;function o(u){return c(u)?a(u):s(u)}function s(u){if(u===null){t.consume(u);return}return t.enter("data"),t.consume(u),l}function l(u){return c(u)?(t.exit("data"),a(u)):(t.consume(u),l)}function c(u){if(u===null)return!0;let d=r[u],m=-1;if(d)for(;++m<d.length;){let p=d[m];if(!p.previous||p.previous.call(i,i.previous))return!0}return!1}}}function As(e){return n;function n(t,i){let r=-1,a;for(;++r<=t.length;)a===void 0?t[r]&&t[r][1].type==="data"&&(a=r,r++):(!t[r]||t[r][1].type!=="data")&&(r!==a+2&&(t[a][1].end=t[r-1][1].end,t.splice(a+2,r-a-2),r=a+2),a=void 0);return e?e(t,i):t}}function ym(e,n){let t=0;for(;++t<=e.length;)if((t===e.length||e[t][1].type==="lineEnding")&&e[t-1][1].type==="data"){let i=e[t-1][1],r=n.sliceStream(i),a=r.length,o=-1,s=0,l;for(;a--;){let c=r[a];if(typeof c=="string"){for(o=c.length;c.charCodeAt(o-1)===32;)s++,o--;if(o)break;o=-1}else if(c===-2)l=!0,s++;else if(c!==-1){a++;break}}if(s){let c={type:t===e.length||l||s<2?"lineSuffix":"hardBreakTrailing",start:{line:i.end.line,column:i.end.column-s,offset:i.end.offset-s,_index:i.start._index+a,_bufferIndex:a?o:i.start._bufferIndex+o},end:Object.assign({},i.end)};i.end=Object.assign({},c.start),i.start.offset===i.end.offset?Object.assign(i,c):(e.splice(t,0,["enter",c,n],["exit",c,n]),t+=2)}t++}return e}function xs(e,n,t){let i=Object.assign(t?Object.assign({},t):{line:1,column:1,offset:0},{_index:0,_bufferIndex:-1}),r={},a=[],o=[],s=[],l=!0,c={consume:L,enter:N,exit:b,attempt:P(I),check:P(D),interrupt:P(D,{interrupt:!0})},u={previous:null,code:null,containerState:{},events:[],parser:e,sliceStream:_,sliceSerialize:f,now:E,defineSkip:y,write:p},d=n.tokenize.call(u,c),m;return n.resolveAll&&a.push(n),u;function p(w){return o=me(o,w),T(),o[o.length-1]!==null?[]:(M(n,0),u.events=wt(a,u.events,u),u.events)}function f(w,x){return vm(_(w),x)}function _(w){return bm(o,w)}function E(){let{line:w,column:x,offset:O,_index:j,_bufferIndex:X}=i;return{line:w,column:x,offset:O,_index:j,_bufferIndex:X}}function y(w){r[w.line]=w.column,R()}function T(){let w;for(;i._index<o.length;){let x=o[i._index];if(typeof x=="string")for(w=i._index,i._bufferIndex<0&&(i._bufferIndex=0);i._index===w&&i._bufferIndex<x.length;)S(x.charCodeAt(i._bufferIndex));else S(x)}}function S(w){l=void 0,m=w,d=d(w)}function L(w){A(w)?(i.line++,i.column=1,i.offset+=w===-3?2:1,R()):w!==-1&&(i.column++,i.offset++),i._bufferIndex<0?i._index++:(i._bufferIndex++,i._bufferIndex===o[i._index].length&&(i._bufferIndex=-1,i._index++)),u.previous=w,l=!0}function N(w,x){let O=x||{};return O.type=w,O.start=E(),u.events.push(["enter",O,u]),s.push(O),O}function b(w){let x=s.pop();return x.end=E(),u.events.push(["exit",x,u]),x}function I(w,x){M(w,x.from)}function D(w,x){x.restore()}function P(w,x){return O;function O(j,X,re){let ie,g,Se,Me;return Array.isArray(j)?fe(j):"tokenize"in j?fe([j]):h(j);function h(se){return Lt;function Lt(Re){let ut=Re!==null&&se[Re],dt=Re!==null&&se.null,Di=[...Array.isArray(ut)?ut:ut?[ut]:[],...Array.isArray(dt)?dt:dt?[dt]:[]];return fe(Di)(Re)}}function fe(se){return ie=se,g=0,se.length===0?re:Qe(se[g])}function Qe(se){return Lt;function Lt(Re){return Me=H(),Se=se,se.partial||(u.currentConstruct=se),se.name&&u.parser.constructs.disable.null.includes(se.name)?pn(Re):se.tokenize.call(x?Object.assign(Object.create(u),x):u,c,Pi,pn)(Re)}}function Pi(se){return l=!0,w(Se,Me),X}function pn(se){return l=!0,Me.restore(),++g<ie.length?Qe(ie[g]):re}}}function M(w,x){w.resolveAll&&!a.includes(w)&&a.push(w),w.resolve&&de(u.events,x,u.events.length-x,w.resolve(u.events.slice(x),u)),w.resolveTo&&(u.events=w.resolveTo(u.events,u))}function H(){let w=E(),x=u.previous,O=u.currentConstruct,j=u.events.length,X=Array.from(s);return{restore:re,from:j};function re(){i=w,u.previous=x,u.currentConstruct=O,u.events.length=j,s=X,R()}}function R(){i.line in r&&i.column<2&&(i.column=r[i.line],i.offset+=r[i.line]-1)}}function bm(e,n){let t=n.start._index,i=n.start._bufferIndex,r=n.end._index,a=n.end._bufferIndex,o;if(t===r)o=[e[t].slice(i,a)];else{if(o=e.slice(t,r),i>-1){let s=o[0];typeof s=="string"?o[0]=s.slice(i):o.shift()}a>0&&o.push(e[r].slice(0,a))}return o}function vm(e,n){let t=-1,i=[],r;for(;++t<e.length;){let a=e[t],o;if(typeof a=="string")o=a;else switch(a){case-5:{o="\r";break}case-4:{o=`
3441
+ \f\r "&'<=>\``.split("")]],single:[["&'".split(""),"\"&'`".split("")],["\0&'".split(""),"\0\"&'`".split("")]],double:[['"&'.split(""),"\"&'`".split("")],['\0"&'.split(""),"\0\"&'`".split("")]]};function ns(e,n,t,i){let r=i.schema,a=r.space==="svg"?!1:i.settings.omitOptionalTags,o=r.space==="svg"?i.settings.closeEmptyElements:i.settings.voids.includes(e.tagName.toLowerCase()),s=[],l;r.space==="html"&&e.tagName==="svg"&&(i.schema=Un);let c=Jd(i,e.properties),u=i.all(r.space==="html"&&e.tagName==="template"?e.content:e);return i.schema=r,u&&(o=!1),(c||!a||!ts(e,n,t))&&(s.push("<",e.tagName,c?" "+c:""),o&&(r.space==="svg"||i.settings.closeSelfClosing)&&(l=c.charAt(c.length-1),(!i.settings.tightSelfClosing||l==="/"||l&&l!=='"'&&l!=="'")&&s.push(" "),s.push("/")),s.push(">")),s.push(u),!o&&(!a||!Jt(e,n,t))&&s.push("</"+e.tagName+">"),s.join("")}function Jd(e,n){let t=[],i=-1,r;if(n){for(r in n)if(n[r]!==null&&n[r]!==void 0){let a=Zd(e,r,n[r]);a&&t.push(a)}}for(;++i<t.length;){let a=e.settings.tightAttributes?t[i].charAt(t[i].length-1):void 0;i!==t.length-1&&a!=='"'&&a!=="'"&&(t[i]+=" ")}return t.join("")}function Zd(e,n,t){let i=kr(e.schema,n),r=e.settings.allowParseErrors&&e.schema.space==="html"?0:1,a=e.settings.allowDangerousCharacters?0:1,o=e.quote,s;if(i.overloadedBoolean&&(t===i.attribute||t==="")?t=!0:(i.boolean||i.overloadedBoolean&&typeof t!="string")&&(t=!!t),t==null||t===!1||typeof t=="number"&&Number.isNaN(t))return"";let l=ze(i.attribute,Object.assign({},e.settings.characterReferences,{subset:jn.name[r][a]}));return t===!0||(t=Array.isArray(t)?(i.commaSeparated?Zo:So)(t,{padLeft:!e.settings.tightCommaSeparatedLists}):String(t),e.settings.collapseEmptyAttributes&&!t)?l:(e.settings.preferUnquoted&&(s=ze(t,Object.assign({},e.settings.characterReferences,{attribute:!0,subset:jn.unquoted[r][a]}))),s!==t&&(e.settings.quoteSmart&&Tr(t,o)>Tr(t,e.alternative)&&(o=e.alternative),s=o+ze(t,Object.assign({},e.settings.characterReferences,{subset:(o==="'"?jn.single:jn.double)[r][a],attribute:!0}))+o),l+(s&&"="+s))}var $d=["<","&"];function qn(e,n,t,i){return t&&t.type==="element"&&(t.tagName==="script"||t.tagName==="style")?e.value:ze(e.value,Object.assign({},i.settings.characterReferences,{subset:$d}))}function is(e,n,t,i){return i.settings.allowDangerousHtml?e.value:qn(e,n,t,i)}function rs(e,n,t,i){return i.all(e)}var as=Go("type",{invalid:Qd,unknown:ep,handlers:{comment:Yo,doctype:Jo,element:ns,raw:is,root:rs,text:qn}});function Qd(e){throw new Error("Expected node, not `"+e+"`")}function ep(e){let n=e;throw new Error("Cannot compile unknown node `"+n.type+"`")}var tp={},np={},ip=[];function Ir(e,n){let t=n||tp,i=t.quote||'"',r=i==='"'?"'":'"';if(i!=='"'&&i!=="'")throw new Error("Invalid quote `"+i+"`, expected `'` or `\"`");return{one:rp,all:ap,settings:{omitOptionalTags:t.omitOptionalTags||!1,allowParseErrors:t.allowParseErrors||!1,allowDangerousCharacters:t.allowDangerousCharacters||!1,quoteSmart:t.quoteSmart||!1,preferUnquoted:t.preferUnquoted||!1,tightAttributes:t.tightAttributes||!1,upperDoctype:t.upperDoctype||!1,tightDoctype:t.tightDoctype||!1,bogusComments:t.bogusComments||!1,tightCommaSeparatedLists:t.tightCommaSeparatedLists||!1,tightSelfClosing:t.tightSelfClosing||!1,collapseEmptyAttributes:t.collapseEmptyAttributes||!1,allowDangerousHtml:t.allowDangerousHtml||!1,voids:t.voids||Do,characterReferences:t.characterReferences||np,closeSelfClosing:t.closeSelfClosing||!1,closeEmptyElements:t.closeEmptyElements||!1},schema:t.space==="svg"?Un:Bo,quote:i,alternative:r}.one(Array.isArray(e)?{type:"root",children:e}:e,void 0,void 0)}function rp(e,n,t){return as(e,n,t,this)}function ap(e){let n=[],t=e&&e.children||ip,i=-1;for(;++i<t.length;)n[i]=this.one(t[i],i,e);return n.join("")}function Kn(e){let n=this,t={...n.data("settings"),...e};n.compiler=i;function i(r){return Ir(r,t)}}var op={};function Rr(e,n){let t=n||op,i=typeof t.includeImageAlt=="boolean"?t.includeImageAlt:!0,r=typeof t.includeHtml=="boolean"?t.includeHtml:!0;return ss(e,i,r)}function ss(e,n,t){if(sp(e)){if("value"in e)return e.type==="html"&&!t?"":e.value;if(n&&"alt"in e&&e.alt)return e.alt;if("children"in e)return os(e.children,n,t)}return Array.isArray(e)?os(e,n,t):""}function os(e,n,t){let i=[],r=-1;for(;++r<e.length;)i[r]=ss(e[r],n,t);return i.join("")}function sp(e){return!!(e&&typeof e=="object")}var ls=document.createElement("i");function kt(e){let n="&"+e+";";ls.innerHTML=n;let t=ls.textContent;return t.charCodeAt(t.length-1)===59&&e!=="semi"||t===n?!1:t}function de(e,n,t,i){let r=e.length,a=0,o;if(n<0?n=-n>r?0:r+n:n=n>r?r:n,t=t>0?t:0,i.length<1e4)o=Array.from(i),o.unshift(n,t),e.splice(...o);else for(t&&e.splice(n,t);a<i.length;)o=i.slice(a,a+1e4),o.unshift(n,0),e.splice(...o),a+=1e4,n+=1e4}function me(e,n){return e.length>0?(de(e,e.length,0,n),e):n}var cs={}.hasOwnProperty;function us(e){let n={},t=-1;for(;++t<e.length;)lp(n,e[t]);return n}function lp(e,n){let t;for(t in n){let r=(cs.call(e,t)?e[t]:void 0)||(e[t]={}),a=n[t],o;if(a)for(o in a){cs.call(r,o)||(r[o]=[]);let s=a[o];cp(r[o],Array.isArray(s)?s:s?[s]:[])}}}function cp(e,n){let t=-1,i=[];for(;++t<n.length;)(n[t].add==="after"?e:i).push(n[t]);de(e,0,0,i)}function Xn(e,n){let t=Number.parseInt(e,n);return t<9||t===11||t>13&&t<32||t>126&&t<160||t>55295&&t<57344||t>64975&&t<65008||(t&65535)===65535||(t&65535)===65534||t>1114111?"\uFFFD":String.fromCodePoint(t)}function Ue(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}var _e=Ye(/[A-Za-z]/),ae=Ye(/[\dA-Za-z]/),ds=Ye(/[#-'*+\--9=?A-Z^-~]/);function Zt(e){return e!==null&&(e<32||e===127)}var $t=Ye(/\d/),ps=Ye(/[\dA-Fa-f]/),ms=Ye(/[!-/:-@[-`{-~]/);function A(e){return e!==null&&e<-2}function ne(e){return e!==null&&(e<0||e===32)}function F(e){return e===-2||e===-1||e===32}var gs=Ye(/\p{P}|\p{S}/u),hs=Ye(/\s/);function Ye(e){return n;function n(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function ke(e){let n=[],t=-1,i=0,r=0;for(;++t<e.length;){let a=e.charCodeAt(t),o="";if(a===37&&ae(e.charCodeAt(t+1))&&ae(e.charCodeAt(t+2)))r=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(o=String.fromCharCode(a));else if(a>55295&&a<57344){let s=e.charCodeAt(t+1);a<56320&&s>56319&&s<57344?(o=String.fromCharCode(a,s),r=1):o="\uFFFD"}else o=String.fromCharCode(a);o&&(n.push(e.slice(i,t),encodeURIComponent(o)),i=t+r+1,o=""),r&&(t+=r,r=0)}return n.join("")+e.slice(i)}function z(e,n,t,i){let r=i?i-1:Number.POSITIVE_INFINITY,a=0;return o;function o(l){return F(l)?(e.enter(t),s(l)):n(l)}function s(l){return F(l)&&a++<r?(e.consume(l),s):(e.exit(t),n(l))}}var fs={tokenize:up};function up(e){let n=e.attempt(this.parser.constructs.contentInitial,i,r),t;return n;function i(s){if(s===null){e.consume(s);return}return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),z(e,n,"linePrefix")}function r(s){return e.enter("paragraph"),a(s)}function a(s){let l=e.enter("chunkText",{contentType:"text",previous:t});return t&&(t.next=l),t=l,o(s)}function o(s){if(s===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(s);return}return A(s)?(e.consume(s),e.exit("chunkText"),a):(e.consume(s),o)}}var bs={tokenize:dp},ys={tokenize:pp};function dp(e){let n=this,t=[],i=0,r,a,o;return s;function s(S){if(i<t.length){let N=t[i];return n.containerState=N[1],e.attempt(N[0].continuation,l,c)(S)}return c(S)}function l(S){if(i++,n.containerState._closeFlow){n.containerState._closeFlow=void 0,r&&T();let N=n.events.length,L=N,b;for(;L--;)if(n.events[L][0]==="exit"&&n.events[L][1].type==="chunkFlow"){b=n.events[L][1].end;break}y(i);let I=N;for(;I<n.events.length;)n.events[I][1].end=Object.assign({},b),I++;return de(n.events,L+1,0,n.events.slice(N)),n.events.length=I,c(S)}return s(S)}function c(S){if(i===t.length){if(!r)return m(S);if(r.currentConstruct&&r.currentConstruct.concrete)return f(S);n.interrupt=!!(r.currentConstruct&&!r._gfmTableDynamicInterruptHack)}return n.containerState={},e.check(ys,u,d)(S)}function u(S){return r&&T(),y(i),m(S)}function d(S){return n.parser.lazy[n.now().line]=i!==t.length,o=n.now().offset,f(S)}function m(S){return n.containerState={},e.attempt(ys,p,f)(S)}function p(S){return i++,t.push([n.currentConstruct,n.containerState]),m(S)}function f(S){if(S===null){r&&T(),y(0),e.consume(S);return}return r=r||n.parser.flow(n.now()),e.enter("chunkFlow",{contentType:"flow",previous:a,_tokenizer:r}),_(S)}function _(S){if(S===null){E(e.exit("chunkFlow"),!0),y(0),e.consume(S);return}return A(S)?(e.consume(S),E(e.exit("chunkFlow")),i=0,n.interrupt=void 0,s):(e.consume(S),_)}function E(S,N){let L=n.sliceStream(S);if(N&&L.push(null),S.previous=a,a&&(a.next=S),a=S,r.defineSkip(S.start),r.write(L),n.parser.lazy[S.start.line]){let b=r.events.length;for(;b--;)if(r.events[b][1].start.offset<o&&(!r.events[b][1].end||r.events[b][1].end.offset>o))return;let I=n.events.length,D=I,P,M;for(;D--;)if(n.events[D][0]==="exit"&&n.events[D][1].type==="chunkFlow"){if(P){M=n.events[D][1].end;break}P=!0}for(y(i),b=I;b<n.events.length;)n.events[b][1].end=Object.assign({},M),b++;de(n.events,D+1,0,n.events.slice(I)),n.events.length=b}}function y(S){let N=t.length;for(;N-- >S;){let L=t[N];n.containerState=L[1],L[0].exit.call(n,e)}t.length=S}function T(){r.write([null]),a=void 0,r=void 0,n.containerState._closeFlow=void 0}}function pp(e,n,t){return z(e,e.attempt(this.parser.constructs.document,n,t),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Pr(e){if(e===null||ne(e)||hs(e))return 1;if(gs(e))return 2}function wt(e,n,t){let i=[],r=-1;for(;++r<e.length;){let a=e[r].resolveAll;a&&!i.includes(a)&&(n=a(n,t),i.push(a))}return n}var Qt={name:"attention",tokenize:gp,resolveAll:mp};function mp(e,n){let t=-1,i,r,a,o,s,l,c,u;for(;++t<e.length;)if(e[t][0]==="enter"&&e[t][1].type==="attentionSequence"&&e[t][1]._close){for(i=t;i--;)if(e[i][0]==="exit"&&e[i][1].type==="attentionSequence"&&e[i][1]._open&&n.sliceSerialize(e[i][1]).charCodeAt(0)===n.sliceSerialize(e[t][1]).charCodeAt(0)){if((e[i][1]._close||e[t][1]._open)&&(e[t][1].end.offset-e[t][1].start.offset)%3&&!((e[i][1].end.offset-e[i][1].start.offset+e[t][1].end.offset-e[t][1].start.offset)%3))continue;l=e[i][1].end.offset-e[i][1].start.offset>1&&e[t][1].end.offset-e[t][1].start.offset>1?2:1;let d=Object.assign({},e[i][1].end),m=Object.assign({},e[t][1].start);vs(d,-l),vs(m,l),o={type:l>1?"strongSequence":"emphasisSequence",start:d,end:Object.assign({},e[i][1].end)},s={type:l>1?"strongSequence":"emphasisSequence",start:Object.assign({},e[t][1].start),end:m},a={type:l>1?"strongText":"emphasisText",start:Object.assign({},e[i][1].end),end:Object.assign({},e[t][1].start)},r={type:l>1?"strong":"emphasis",start:Object.assign({},o.start),end:Object.assign({},s.end)},e[i][1].end=Object.assign({},o.start),e[t][1].start=Object.assign({},s.end),c=[],e[i][1].end.offset-e[i][1].start.offset&&(c=me(c,[["enter",e[i][1],n],["exit",e[i][1],n]])),c=me(c,[["enter",r,n],["enter",o,n],["exit",o,n],["enter",a,n]]),c=me(c,wt(n.parser.constructs.insideSpan.null,e.slice(i+1,t),n)),c=me(c,[["exit",a,n],["enter",s,n],["exit",s,n],["exit",r,n]]),e[t][1].end.offset-e[t][1].start.offset?(u=2,c=me(c,[["enter",e[t][1],n],["exit",e[t][1],n]])):u=0,de(e,i-1,t-i+3,c),t=i+c.length-u-2;break}}for(t=-1;++t<e.length;)e[t][1].type==="attentionSequence"&&(e[t][1].type="data");return e}function gp(e,n){let t=this.parser.constructs.attentionMarkers.null,i=this.previous,r=Pr(i),a;return o;function o(l){return a=l,e.enter("attentionSequence"),s(l)}function s(l){if(l===a)return e.consume(l),s;let c=e.exit("attentionSequence"),u=Pr(l),d=!u||u===2&&r||t.includes(l),m=!r||r===2&&u||t.includes(i);return c._open=!!(a===42?d:d&&(r||!m)),c._close=!!(a===42?m:m&&(u||!d)),n(l)}}function vs(e,n){e.column+=n,e.offset+=n,e._bufferIndex+=n}var Dr={name:"autolink",tokenize:hp};function hp(e,n,t){let i=0;return r;function r(p){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),a}function a(p){return _e(p)?(e.consume(p),o):p===64?t(p):c(p)}function o(p){return p===43||p===45||p===46||ae(p)?(i=1,s(p)):c(p)}function s(p){return p===58?(e.consume(p),i=0,l):(p===43||p===45||p===46||ae(p))&&i++<32?(e.consume(p),s):(i=0,c(p))}function l(p){return p===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),n):p===null||p===32||p===60||Zt(p)?t(p):(e.consume(p),l)}function c(p){return p===64?(e.consume(p),u):ds(p)?(e.consume(p),c):t(p)}function u(p){return ae(p)?d(p):t(p)}function d(p){return p===46?(e.consume(p),i=0,u):p===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),n):m(p)}function m(p){if((p===45||ae(p))&&i++<63){let f=p===45?m:d;return e.consume(p),f}return t(p)}}var Je={tokenize:fp,partial:!0};function fp(e,n,t){return i;function i(a){return F(a)?z(e,r,"linePrefix")(a):r(a)}function r(a){return a===null||A(a)?n(a):t(a)}}var Yn={name:"blockQuote",tokenize:yp,continuation:{tokenize:bp},exit:vp};function yp(e,n,t){let i=this;return r;function r(o){if(o===62){let s=i.containerState;return s.open||(e.enter("blockQuote",{_container:!0}),s.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(o),e.exit("blockQuoteMarker"),a}return t(o)}function a(o){return F(o)?(e.enter("blockQuotePrefixWhitespace"),e.consume(o),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),n):(e.exit("blockQuotePrefix"),n(o))}}function bp(e,n,t){let i=this;return r;function r(o){return F(o)?z(e,a,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):a(o)}function a(o){return e.attempt(Yn,n,t)(o)}}function vp(e){e.exit("blockQuote")}var Jn={name:"characterEscape",tokenize:_p};function _p(e,n,t){return i;function i(a){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(a),e.exit("escapeMarker"),r}function r(a){return ms(a)?(e.enter("characterEscapeValue"),e.consume(a),e.exit("characterEscapeValue"),e.exit("characterEscape"),n):t(a)}}var Zn={name:"characterReference",tokenize:Sp};function Sp(e,n,t){let i=this,r=0,a,o;return s;function s(d){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(d),e.exit("characterReferenceMarker"),l}function l(d){return d===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(d),e.exit("characterReferenceMarkerNumeric"),c):(e.enter("characterReferenceValue"),a=31,o=ae,u(d))}function c(d){return d===88||d===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(d),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),a=6,o=ps,u):(e.enter("characterReferenceValue"),a=7,o=$t,u(d))}function u(d){if(d===59&&r){let m=e.exit("characterReferenceValue");return o===ae&&!kt(i.sliceSerialize(m))?t(d):(e.enter("characterReferenceMarker"),e.consume(d),e.exit("characterReferenceMarker"),e.exit("characterReference"),n)}return o(d)&&r++<a?(e.consume(d),u):t(d)}}var _s={tokenize:Cp,partial:!0},$n={name:"codeFenced",tokenize:Ep,concrete:!0};function Ep(e,n,t){let i=this,r={tokenize:L,partial:!0},a=0,o=0,s;return l;function l(b){return c(b)}function c(b){let I=i.events[i.events.length-1];return a=I&&I[1].type==="linePrefix"?I[2].sliceSerialize(I[1],!0).length:0,s=b,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),u(b)}function u(b){return b===s?(o++,e.consume(b),u):o<3?t(b):(e.exit("codeFencedFenceSequence"),F(b)?z(e,d,"whitespace")(b):d(b))}function d(b){return b===null||A(b)?(e.exit("codeFencedFence"),i.interrupt?n(b):e.check(_s,_,N)(b)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),m(b))}function m(b){return b===null||A(b)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),d(b)):F(b)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),z(e,p,"whitespace")(b)):b===96&&b===s?t(b):(e.consume(b),m)}function p(b){return b===null||A(b)?d(b):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),f(b))}function f(b){return b===null||A(b)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),d(b)):b===96&&b===s?t(b):(e.consume(b),f)}function _(b){return e.attempt(r,N,E)(b)}function E(b){return e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),y}function y(b){return a>0&&F(b)?z(e,T,"linePrefix",a+1)(b):T(b)}function T(b){return b===null||A(b)?e.check(_s,_,N)(b):(e.enter("codeFlowValue"),S(b))}function S(b){return b===null||A(b)?(e.exit("codeFlowValue"),T(b)):(e.consume(b),S)}function N(b){return e.exit("codeFenced"),n(b)}function L(b,I,D){let P=0;return M;function M(O){return b.enter("lineEnding"),b.consume(O),b.exit("lineEnding"),H}function H(O){return b.enter("codeFencedFence"),F(O)?z(b,R,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(O):R(O)}function R(O){return O===s?(b.enter("codeFencedFenceSequence"),w(O)):D(O)}function w(O){return O===s?(P++,b.consume(O),w):P>=o?(b.exit("codeFencedFenceSequence"),F(O)?z(b,x,"whitespace")(O):x(O)):D(O)}function x(O){return O===null||A(O)?(b.exit("codeFencedFence"),I(O)):D(O)}}}function Cp(e,n,t){let i=this;return r;function r(o){return o===null?t(o):(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),a)}function a(o){return i.parser.lazy[i.now().line]?t(o):n(o)}}var en={name:"codeIndented",tokenize:wp},kp={tokenize:Tp,partial:!0};function wp(e,n,t){let i=this;return r;function r(c){return e.enter("codeIndented"),z(e,a,"linePrefix",5)(c)}function a(c){let u=i.events[i.events.length-1];return u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?o(c):t(c)}function o(c){return c===null?l(c):A(c)?e.attempt(kp,o,l)(c):(e.enter("codeFlowValue"),s(c))}function s(c){return c===null||A(c)?(e.exit("codeFlowValue"),o(c)):(e.consume(c),s)}function l(c){return e.exit("codeIndented"),n(c)}}function Tp(e,n,t){let i=this;return r;function r(o){return i.parser.lazy[i.now().line]?t(o):A(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),r):z(e,a,"linePrefix",5)(o)}function a(o){let s=i.events[i.events.length-1];return s&&s[1].type==="linePrefix"&&s[2].sliceSerialize(s[1],!0).length>=4?n(o):A(o)?r(o):t(o)}}var Nr={name:"codeText",tokenize:Ip,resolve:Ap,previous:xp};function Ap(e){let n=e.length-4,t=3,i,r;if((e[t][1].type==="lineEnding"||e[t][1].type==="space")&&(e[n][1].type==="lineEnding"||e[n][1].type==="space")){for(i=t;++i<n;)if(e[i][1].type==="codeTextData"){e[t][1].type="codeTextPadding",e[n][1].type="codeTextPadding",t+=2,n-=2;break}}for(i=t-1,n++;++i<=n;)r===void 0?i!==n&&e[i][1].type!=="lineEnding"&&(r=i):(i===n||e[i][1].type==="lineEnding")&&(e[r][1].type="codeTextData",i!==r+2&&(e[r][1].end=e[i-1][1].end,e.splice(r+2,i-r-2),n-=i-r-2,i=r+2),r=void 0);return e}function xp(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function Ip(e,n,t){let i=this,r=0,a,o;return s;function s(m){return e.enter("codeText"),e.enter("codeTextSequence"),l(m)}function l(m){return m===96?(e.consume(m),r++,l):(e.exit("codeTextSequence"),c(m))}function c(m){return m===null?t(m):m===32?(e.enter("space"),e.consume(m),e.exit("space"),c):m===96?(o=e.enter("codeTextSequence"),a=0,d(m)):A(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),c):(e.enter("codeTextData"),u(m))}function u(m){return m===null||m===32||m===96||A(m)?(e.exit("codeTextData"),c(m)):(e.consume(m),u)}function d(m){return m===96?(e.consume(m),a++,d):a===r?(e.exit("codeTextSequence"),e.exit("codeText"),n(m)):(o.type="codeTextData",u(m))}}var Qn=class{constructor(n){this.left=n?[...n]:[],this.right=[]}get(n){if(n<0||n>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+n+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return n<this.left.length?this.left[n]:this.right[this.right.length-n+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(n,t){let i=t??Number.POSITIVE_INFINITY;return i<this.left.length?this.left.slice(n,i):n>this.left.length?this.right.slice(this.right.length-i+this.left.length,this.right.length-n+this.left.length).reverse():this.left.slice(n).concat(this.right.slice(this.right.length-i+this.left.length).reverse())}splice(n,t,i){let r=t||0;this.setCursor(Math.trunc(n));let a=this.right.splice(this.right.length-r,Number.POSITIVE_INFINITY);return i&&tn(this.left,i),a.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(n){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(n)}pushMany(n){this.setCursor(Number.POSITIVE_INFINITY),tn(this.left,n)}unshift(n){this.setCursor(0),this.right.push(n)}unshiftMany(n){this.setCursor(0),tn(this.right,n.reverse())}setCursor(n){if(!(n===this.left.length||n>this.left.length&&this.right.length===0||n<0&&this.left.length===0))if(n<this.left.length){let t=this.left.splice(n,Number.POSITIVE_INFINITY);tn(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-n,Number.POSITIVE_INFINITY);tn(this.left,t.reverse())}}};function tn(e,n){let t=0;if(n.length<1e4)e.push(...n);else for(;t<n.length;)e.push(...n.slice(t,t+1e4)),t+=1e4}function ei(e){let n={},t=-1,i,r,a,o,s,l,c,u=new Qn(e);for(;++t<u.length;){for(;t in n;)t=n[t];if(i=u.get(t),t&&i[1].type==="chunkFlow"&&u.get(t-1)[1].type==="listItemPrefix"&&(l=i[1]._tokenizer.events,a=0,a<l.length&&l[a][1].type==="lineEndingBlank"&&(a+=2),a<l.length&&l[a][1].type==="content"))for(;++a<l.length&&l[a][1].type!=="content";)l[a][1].type==="chunkText"&&(l[a][1]._isInFirstContentOfListItem=!0,a++);if(i[0]==="enter")i[1].contentType&&(Object.assign(n,Rp(u,t)),t=n[t],c=!0);else if(i[1]._container){for(a=t,r=void 0;a--&&(o=u.get(a),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank");)o[0]==="enter"&&(r&&(u.get(r)[1].type="lineEndingBlank"),o[1].type="lineEnding",r=a);r&&(i[1].end=Object.assign({},u.get(r)[1].start),s=u.slice(r,t),s.unshift(i),u.splice(r,t-r+1,s))}}return de(e,0,Number.POSITIVE_INFINITY,u.slice(0)),!c}function Rp(e,n){let t=e.get(n)[1],i=e.get(n)[2],r=n-1,a=[],o=t._tokenizer||i.parser[t.contentType](t.start),s=o.events,l=[],c={},u,d,m=-1,p=t,f=0,_=0,E=[_];for(;p;){for(;e.get(++r)[1]!==p;);a.push(r),p._tokenizer||(u=i.sliceStream(p),p.next||u.push(null),d&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=p,p=p.next}for(p=t;++m<s.length;)s[m][0]==="exit"&&s[m-1][0]==="enter"&&s[m][1].type===s[m-1][1].type&&s[m][1].start.line!==s[m][1].end.line&&(_=m+1,E.push(_),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):E.pop(),m=E.length;m--;){let y=s.slice(E[m],E[m+1]),T=a.pop();l.push([T,T+y.length-1]),e.splice(T,2,y)}for(l.reverse(),m=-1;++m<l.length;)c[f+l[m][0]]=f+l[m][1],f+=l[m][1]-l[m][0]-1;return c}var Lr={tokenize:Np,resolve:Dp},Pp={tokenize:Lp,partial:!0};function Dp(e){return ei(e),e}function Np(e,n){let t;return i;function i(s){return e.enter("content"),t=e.enter("chunkContent",{contentType:"content"}),r(s)}function r(s){return s===null?a(s):A(s)?e.check(Pp,o,a)(s):(e.consume(s),r)}function a(s){return e.exit("chunkContent"),e.exit("content"),n(s)}function o(s){return e.consume(s),e.exit("chunkContent"),t.next=e.enter("chunkContent",{contentType:"content",previous:t}),t=t.next,r}}function Lp(e,n,t){let i=this;return r;function r(o){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),z(e,a,"linePrefix")}function a(o){if(o===null||A(o))return t(o);let s=i.events[i.events.length-1];return!i.parser.constructs.disable.null.includes("codeIndented")&&s&&s[1].type==="linePrefix"&&s[2].sliceSerialize(s[1],!0).length>=4?n(o):e.interrupt(i.parser.constructs.flow,t,n)(o)}}function ti(e,n,t,i,r,a,o,s,l){let c=l||Number.POSITIVE_INFINITY,u=0;return d;function d(y){return y===60?(e.enter(i),e.enter(r),e.enter(a),e.consume(y),e.exit(a),m):y===null||y===32||y===41||Zt(y)?t(y):(e.enter(i),e.enter(o),e.enter(s),e.enter("chunkString",{contentType:"string"}),_(y))}function m(y){return y===62?(e.enter(a),e.consume(y),e.exit(a),e.exit(r),e.exit(i),n):(e.enter(s),e.enter("chunkString",{contentType:"string"}),p(y))}function p(y){return y===62?(e.exit("chunkString"),e.exit(s),m(y)):y===null||y===60||A(y)?t(y):(e.consume(y),y===92?f:p)}function f(y){return y===60||y===62||y===92?(e.consume(y),p):p(y)}function _(y){return!u&&(y===null||y===41||ne(y))?(e.exit("chunkString"),e.exit(s),e.exit(o),e.exit(i),n(y)):u<c&&y===40?(e.consume(y),u++,_):y===41?(e.consume(y),u--,_):y===null||y===32||y===40||Zt(y)?t(y):(e.consume(y),y===92?E:_)}function E(y){return y===40||y===41||y===92?(e.consume(y),_):_(y)}}function ni(e,n,t,i,r,a){let o=this,s=0,l;return c;function c(p){return e.enter(i),e.enter(r),e.consume(p),e.exit(r),e.enter(a),u}function u(p){return s>999||p===null||p===91||p===93&&!l||p===94&&!s&&"_hiddenFootnoteSupport"in o.parser.constructs?t(p):p===93?(e.exit(a),e.enter(r),e.consume(p),e.exit(r),e.exit(i),n):A(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),u):(e.enter("chunkString",{contentType:"string"}),d(p))}function d(p){return p===null||p===91||p===93||A(p)||s++>999?(e.exit("chunkString"),u(p)):(e.consume(p),l||(l=!F(p)),p===92?m:d)}function m(p){return p===91||p===92||p===93?(e.consume(p),s++,d):d(p)}}function ii(e,n,t,i,r,a){let o;return s;function s(m){return m===34||m===39||m===40?(e.enter(i),e.enter(r),e.consume(m),e.exit(r),o=m===40?41:m,l):t(m)}function l(m){return m===o?(e.enter(r),e.consume(m),e.exit(r),e.exit(i),n):(e.enter(a),c(m))}function c(m){return m===o?(e.exit(a),l(o)):m===null?t(m):A(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),z(e,c,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),u(m))}function u(m){return m===o||m===null||A(m)?(e.exit("chunkString"),c(m)):(e.consume(m),m===92?d:u)}function d(m){return m===o||m===92?(e.consume(m),u):u(m)}}function at(e,n){let t;return i;function i(r){return A(r)?(e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),t=!0,i):F(r)?z(e,i,t?"linePrefix":"lineSuffix")(r):n(r)}}var Mr={name:"definition",tokenize:Op},Mp={tokenize:Bp,partial:!0};function Op(e,n,t){let i=this,r;return a;function a(p){return e.enter("definition"),o(p)}function o(p){return ni.call(i,e,s,t,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function s(p){return r=Ue(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)),p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),l):t(p)}function l(p){return ne(p)?at(e,c)(p):c(p)}function c(p){return ti(e,u,t,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function u(p){return e.attempt(Mp,d,d)(p)}function d(p){return F(p)?z(e,m,"whitespace")(p):m(p)}function m(p){return p===null||A(p)?(e.exit("definition"),i.parser.defined.push(r),n(p)):t(p)}}function Bp(e,n,t){return i;function i(s){return ne(s)?at(e,r)(s):t(s)}function r(s){return ii(e,a,t,"definitionTitle","definitionTitleMarker","definitionTitleString")(s)}function a(s){return F(s)?z(e,o,"whitespace")(s):o(s)}function o(s){return s===null||A(s)?n(s):t(s)}}var Or={name:"hardBreakEscape",tokenize:Fp};function Fp(e,n,t){return i;function i(a){return e.enter("hardBreakEscape"),e.consume(a),r}function r(a){return A(a)?(e.exit("hardBreakEscape"),n(a)):t(a)}}var Br={name:"headingAtx",tokenize:zp,resolve:Gp};function Gp(e,n){let t=e.length-2,i=3,r,a;return e[i][1].type==="whitespace"&&(i+=2),t-2>i&&e[t][1].type==="whitespace"&&(t-=2),e[t][1].type==="atxHeadingSequence"&&(i===t-1||t-4>i&&e[t-2][1].type==="whitespace")&&(t-=i+1===t?2:4),t>i&&(r={type:"atxHeadingText",start:e[i][1].start,end:e[t][1].end},a={type:"chunkText",start:e[i][1].start,end:e[t][1].end,contentType:"text"},de(e,i,t-i+1,[["enter",r,n],["enter",a,n],["exit",a,n],["exit",r,n]])),e}function zp(e,n,t){let i=0;return r;function r(u){return e.enter("atxHeading"),a(u)}function a(u){return e.enter("atxHeadingSequence"),o(u)}function o(u){return u===35&&i++<6?(e.consume(u),o):u===null||ne(u)?(e.exit("atxHeadingSequence"),s(u)):t(u)}function s(u){return u===35?(e.enter("atxHeadingSequence"),l(u)):u===null||A(u)?(e.exit("atxHeading"),n(u)):F(u)?z(e,s,"whitespace")(u):(e.enter("atxHeadingText"),c(u))}function l(u){return u===35?(e.consume(u),l):(e.exit("atxHeadingSequence"),s(u))}function c(u){return u===null||u===35||ne(u)?(e.exit("atxHeadingText"),s(u)):(e.consume(u),c)}}var Ss=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],Fr=["pre","script","style","textarea"];var Gr={name:"htmlFlow",tokenize:Wp,resolveTo:Vp,concrete:!0},Up={tokenize:qp,partial:!0},Hp={tokenize:jp,partial:!0};function Vp(e){let n=e.length;for(;n--&&!(e[n][0]==="enter"&&e[n][1].type==="htmlFlow"););return n>1&&e[n-2][1].type==="linePrefix"&&(e[n][1].start=e[n-2][1].start,e[n+1][1].start=e[n-2][1].start,e.splice(n-2,2)),e}function Wp(e,n,t){let i=this,r,a,o,s,l;return c;function c(h){return u(h)}function u(h){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(h),d}function d(h){return h===33?(e.consume(h),m):h===47?(e.consume(h),a=!0,_):h===63?(e.consume(h),r=3,i.interrupt?n:g):_e(h)?(e.consume(h),o=String.fromCharCode(h),E):t(h)}function m(h){return h===45?(e.consume(h),r=2,p):h===91?(e.consume(h),r=5,s=0,f):_e(h)?(e.consume(h),r=4,i.interrupt?n:g):t(h)}function p(h){return h===45?(e.consume(h),i.interrupt?n:g):t(h)}function f(h){let fe="CDATA[";return h===fe.charCodeAt(s++)?(e.consume(h),s===fe.length?i.interrupt?n:R:f):t(h)}function _(h){return _e(h)?(e.consume(h),o=String.fromCharCode(h),E):t(h)}function E(h){if(h===null||h===47||h===62||ne(h)){let fe=h===47,Qe=o.toLowerCase();return!fe&&!a&&Fr.includes(Qe)?(r=1,i.interrupt?n(h):R(h)):Ss.includes(o.toLowerCase())?(r=6,fe?(e.consume(h),y):i.interrupt?n(h):R(h)):(r=7,i.interrupt&&!i.parser.lazy[i.now().line]?t(h):a?T(h):S(h))}return h===45||ae(h)?(e.consume(h),o+=String.fromCharCode(h),E):t(h)}function y(h){return h===62?(e.consume(h),i.interrupt?n:R):t(h)}function T(h){return F(h)?(e.consume(h),T):M(h)}function S(h){return h===47?(e.consume(h),M):h===58||h===95||_e(h)?(e.consume(h),N):F(h)?(e.consume(h),S):M(h)}function N(h){return h===45||h===46||h===58||h===95||ae(h)?(e.consume(h),N):L(h)}function L(h){return h===61?(e.consume(h),b):F(h)?(e.consume(h),L):S(h)}function b(h){return h===null||h===60||h===61||h===62||h===96?t(h):h===34||h===39?(e.consume(h),l=h,I):F(h)?(e.consume(h),b):D(h)}function I(h){return h===l?(e.consume(h),l=null,P):h===null||A(h)?t(h):(e.consume(h),I)}function D(h){return h===null||h===34||h===39||h===47||h===60||h===61||h===62||h===96||ne(h)?L(h):(e.consume(h),D)}function P(h){return h===47||h===62||F(h)?S(h):t(h)}function M(h){return h===62?(e.consume(h),H):t(h)}function H(h){return h===null||A(h)?R(h):F(h)?(e.consume(h),H):t(h)}function R(h){return h===45&&r===2?(e.consume(h),j):h===60&&r===1?(e.consume(h),X):h===62&&r===4?(e.consume(h),Se):h===63&&r===3?(e.consume(h),g):h===93&&r===5?(e.consume(h),ie):A(h)&&(r===6||r===7)?(e.exit("htmlFlowData"),e.check(Up,Me,w)(h)):h===null||A(h)?(e.exit("htmlFlowData"),w(h)):(e.consume(h),R)}function w(h){return e.check(Hp,x,Me)(h)}function x(h){return e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),O}function O(h){return h===null||A(h)?w(h):(e.enter("htmlFlowData"),R(h))}function j(h){return h===45?(e.consume(h),g):R(h)}function X(h){return h===47?(e.consume(h),o="",re):R(h)}function re(h){if(h===62){let fe=o.toLowerCase();return Fr.includes(fe)?(e.consume(h),Se):R(h)}return _e(h)&&o.length<8?(e.consume(h),o+=String.fromCharCode(h),re):R(h)}function ie(h){return h===93?(e.consume(h),g):R(h)}function g(h){return h===62?(e.consume(h),Se):h===45&&r===2?(e.consume(h),g):R(h)}function Se(h){return h===null||A(h)?(e.exit("htmlFlowData"),Me(h)):(e.consume(h),Se)}function Me(h){return e.exit("htmlFlow"),n(h)}}function jp(e,n,t){let i=this;return r;function r(o){return A(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),a):t(o)}function a(o){return i.parser.lazy[i.now().line]?t(o):n(o)}}function qp(e,n,t){return i;function i(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),e.attempt(Je,n,t)}}var zr={name:"htmlText",tokenize:Kp};function Kp(e,n,t){let i=this,r,a,o;return s;function s(g){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(g),l}function l(g){return g===33?(e.consume(g),c):g===47?(e.consume(g),L):g===63?(e.consume(g),S):_e(g)?(e.consume(g),D):t(g)}function c(g){return g===45?(e.consume(g),u):g===91?(e.consume(g),a=0,f):_e(g)?(e.consume(g),T):t(g)}function u(g){return g===45?(e.consume(g),p):t(g)}function d(g){return g===null?t(g):g===45?(e.consume(g),m):A(g)?(o=d,X(g)):(e.consume(g),d)}function m(g){return g===45?(e.consume(g),p):d(g)}function p(g){return g===62?j(g):g===45?m(g):d(g)}function f(g){let Se="CDATA[";return g===Se.charCodeAt(a++)?(e.consume(g),a===Se.length?_:f):t(g)}function _(g){return g===null?t(g):g===93?(e.consume(g),E):A(g)?(o=_,X(g)):(e.consume(g),_)}function E(g){return g===93?(e.consume(g),y):_(g)}function y(g){return g===62?j(g):g===93?(e.consume(g),y):_(g)}function T(g){return g===null||g===62?j(g):A(g)?(o=T,X(g)):(e.consume(g),T)}function S(g){return g===null?t(g):g===63?(e.consume(g),N):A(g)?(o=S,X(g)):(e.consume(g),S)}function N(g){return g===62?j(g):S(g)}function L(g){return _e(g)?(e.consume(g),b):t(g)}function b(g){return g===45||ae(g)?(e.consume(g),b):I(g)}function I(g){return A(g)?(o=I,X(g)):F(g)?(e.consume(g),I):j(g)}function D(g){return g===45||ae(g)?(e.consume(g),D):g===47||g===62||ne(g)?P(g):t(g)}function P(g){return g===47?(e.consume(g),j):g===58||g===95||_e(g)?(e.consume(g),M):A(g)?(o=P,X(g)):F(g)?(e.consume(g),P):j(g)}function M(g){return g===45||g===46||g===58||g===95||ae(g)?(e.consume(g),M):H(g)}function H(g){return g===61?(e.consume(g),R):A(g)?(o=H,X(g)):F(g)?(e.consume(g),H):P(g)}function R(g){return g===null||g===60||g===61||g===62||g===96?t(g):g===34||g===39?(e.consume(g),r=g,w):A(g)?(o=R,X(g)):F(g)?(e.consume(g),R):(e.consume(g),x)}function w(g){return g===r?(e.consume(g),r=void 0,O):g===null?t(g):A(g)?(o=w,X(g)):(e.consume(g),w)}function x(g){return g===null||g===34||g===39||g===60||g===61||g===96?t(g):g===47||g===62||ne(g)?P(g):(e.consume(g),x)}function O(g){return g===47||g===62||ne(g)?P(g):t(g)}function j(g){return g===62?(e.consume(g),e.exit("htmlTextData"),e.exit("htmlText"),n):t(g)}function X(g){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(g),e.exit("lineEnding"),re}function re(g){return F(g)?z(e,ie,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(g):ie(g)}function ie(g){return e.enter("htmlTextData"),o(g)}}var ot={name:"labelEnd",tokenize:Qp,resolveTo:$p,resolveAll:Zp},Xp={tokenize:em},Yp={tokenize:tm},Jp={tokenize:nm};function Zp(e){let n=-1;for(;++n<e.length;){let t=e[n][1];(t.type==="labelImage"||t.type==="labelLink"||t.type==="labelEnd")&&(e.splice(n+1,t.type==="labelImage"?4:2),t.type="data",n++)}return e}function $p(e,n){let t=e.length,i=0,r,a,o,s;for(;t--;)if(r=e[t][1],a){if(r.type==="link"||r.type==="labelLink"&&r._inactive)break;e[t][0]==="enter"&&r.type==="labelLink"&&(r._inactive=!0)}else if(o){if(e[t][0]==="enter"&&(r.type==="labelImage"||r.type==="labelLink")&&!r._balanced&&(a=t,r.type!=="labelLink")){i=2;break}}else r.type==="labelEnd"&&(o=t);let l={type:e[a][1].type==="labelLink"?"link":"image",start:Object.assign({},e[a][1].start),end:Object.assign({},e[e.length-1][1].end)},c={type:"label",start:Object.assign({},e[a][1].start),end:Object.assign({},e[o][1].end)},u={type:"labelText",start:Object.assign({},e[a+i+2][1].end),end:Object.assign({},e[o-2][1].start)};return s=[["enter",l,n],["enter",c,n]],s=me(s,e.slice(a+1,a+i+3)),s=me(s,[["enter",u,n]]),s=me(s,wt(n.parser.constructs.insideSpan.null,e.slice(a+i+4,o-3),n)),s=me(s,[["exit",u,n],e[o-2],e[o-1],["exit",c,n]]),s=me(s,e.slice(o+1)),s=me(s,[["exit",l,n]]),de(e,a,e.length,s),e}function Qp(e,n,t){let i=this,r=i.events.length,a,o;for(;r--;)if((i.events[r][1].type==="labelImage"||i.events[r][1].type==="labelLink")&&!i.events[r][1]._balanced){a=i.events[r][1];break}return s;function s(m){return a?a._inactive?d(m):(o=i.parser.defined.includes(Ue(i.sliceSerialize({start:a.end,end:i.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(m),e.exit("labelMarker"),e.exit("labelEnd"),l):t(m)}function l(m){return m===40?e.attempt(Xp,u,o?u:d)(m):m===91?e.attempt(Yp,u,o?c:d)(m):o?u(m):d(m)}function c(m){return e.attempt(Jp,u,d)(m)}function u(m){return n(m)}function d(m){return a._balanced=!0,t(m)}}function em(e,n,t){return i;function i(d){return e.enter("resource"),e.enter("resourceMarker"),e.consume(d),e.exit("resourceMarker"),r}function r(d){return ne(d)?at(e,a)(d):a(d)}function a(d){return d===41?u(d):ti(e,o,s,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(d)}function o(d){return ne(d)?at(e,l)(d):u(d)}function s(d){return t(d)}function l(d){return d===34||d===39||d===40?ii(e,c,t,"resourceTitle","resourceTitleMarker","resourceTitleString")(d):u(d)}function c(d){return ne(d)?at(e,u)(d):u(d)}function u(d){return d===41?(e.enter("resourceMarker"),e.consume(d),e.exit("resourceMarker"),e.exit("resource"),n):t(d)}}function tm(e,n,t){let i=this;return r;function r(s){return ni.call(i,e,a,o,"reference","referenceMarker","referenceString")(s)}function a(s){return i.parser.defined.includes(Ue(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)))?n(s):t(s)}function o(s){return t(s)}}function nm(e,n,t){return i;function i(a){return e.enter("reference"),e.enter("referenceMarker"),e.consume(a),e.exit("referenceMarker"),r}function r(a){return a===93?(e.enter("referenceMarker"),e.consume(a),e.exit("referenceMarker"),e.exit("reference"),n):t(a)}}var Ur={name:"labelStartImage",tokenize:im,resolveAll:ot.resolveAll};function im(e,n,t){let i=this;return r;function r(s){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(s),e.exit("labelImageMarker"),a}function a(s){return s===91?(e.enter("labelMarker"),e.consume(s),e.exit("labelMarker"),e.exit("labelImage"),o):t(s)}function o(s){return s===94&&"_hiddenFootnoteSupport"in i.parser.constructs?t(s):n(s)}}var Hr={name:"labelStartLink",tokenize:rm,resolveAll:ot.resolveAll};function rm(e,n,t){let i=this;return r;function r(o){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),e.exit("labelLink"),a}function a(o){return o===94&&"_hiddenFootnoteSupport"in i.parser.constructs?t(o):n(o)}}var nn={name:"lineEnding",tokenize:am};function am(e,n){return t;function t(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),z(e,n,"linePrefix")}}var st={name:"thematicBreak",tokenize:om};function om(e,n,t){let i=0,r;return a;function a(c){return e.enter("thematicBreak"),o(c)}function o(c){return r=c,s(c)}function s(c){return c===r?(e.enter("thematicBreakSequence"),l(c)):i>=3&&(c===null||A(c))?(e.exit("thematicBreak"),n(c)):t(c)}function l(c){return c===r?(e.consume(c),i++,l):(e.exit("thematicBreakSequence"),F(c)?z(e,s,"whitespace")(c):s(c))}}var pe={name:"list",tokenize:cm,continuation:{tokenize:um},exit:pm},sm={tokenize:mm,partial:!0},lm={tokenize:dm,partial:!0};function cm(e,n,t){let i=this,r=i.events[i.events.length-1],a=r&&r[1].type==="linePrefix"?r[2].sliceSerialize(r[1],!0).length:0,o=0;return s;function s(p){let f=i.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(f==="listUnordered"?!i.containerState.marker||p===i.containerState.marker:$t(p)){if(i.containerState.type||(i.containerState.type=f,e.enter(f,{_container:!0})),f==="listUnordered")return e.enter("listItemPrefix"),p===42||p===45?e.check(st,t,c)(p):c(p);if(!i.interrupt||p===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),l(p)}return t(p)}function l(p){return $t(p)&&++o<10?(e.consume(p),l):(!i.interrupt||o<2)&&(i.containerState.marker?p===i.containerState.marker:p===41||p===46)?(e.exit("listItemValue"),c(p)):t(p)}function c(p){return e.enter("listItemMarker"),e.consume(p),e.exit("listItemMarker"),i.containerState.marker=i.containerState.marker||p,e.check(Je,i.interrupt?t:u,e.attempt(sm,m,d))}function u(p){return i.containerState.initialBlankLine=!0,a++,m(p)}function d(p){return F(p)?(e.enter("listItemPrefixWhitespace"),e.consume(p),e.exit("listItemPrefixWhitespace"),m):t(p)}function m(p){return i.containerState.size=a+i.sliceSerialize(e.exit("listItemPrefix"),!0).length,n(p)}}function um(e,n,t){let i=this;return i.containerState._closeFlow=void 0,e.check(Je,r,a);function r(s){return i.containerState.furtherBlankLines=i.containerState.furtherBlankLines||i.containerState.initialBlankLine,z(e,n,"listItemIndent",i.containerState.size+1)(s)}function a(s){return i.containerState.furtherBlankLines||!F(s)?(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,o(s)):(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,e.attempt(lm,n,o)(s))}function o(s){return i.containerState._closeFlow=!0,i.interrupt=void 0,z(e,e.attempt(pe,n,t),"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s)}}function dm(e,n,t){let i=this;return z(e,r,"listItemIndent",i.containerState.size+1);function r(a){let o=i.events[i.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===i.containerState.size?n(a):t(a)}}function pm(e){e.exit(this.containerState.type)}function mm(e,n,t){let i=this;return z(e,r,"listItemPrefixWhitespace",i.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function r(a){let o=i.events[i.events.length-1];return!F(a)&&o&&o[1].type==="listItemPrefixWhitespace"?n(a):t(a)}}var ri={name:"setextUnderline",tokenize:hm,resolveTo:gm};function gm(e,n){let t=e.length,i,r,a;for(;t--;)if(e[t][0]==="enter"){if(e[t][1].type==="content"){i=t;break}e[t][1].type==="paragraph"&&(r=t)}else e[t][1].type==="content"&&e.splice(t,1),!a&&e[t][1].type==="definition"&&(a=t);let o={type:"setextHeading",start:Object.assign({},e[r][1].start),end:Object.assign({},e[e.length-1][1].end)};return e[r][1].type="setextHeadingText",a?(e.splice(r,0,["enter",o,n]),e.splice(a+1,0,["exit",e[i][1],n]),e[i][1].end=Object.assign({},e[a][1].end)):e[i][1]=o,e.push(["exit",o,n]),e}function hm(e,n,t){let i=this,r;return a;function a(c){let u=i.events.length,d;for(;u--;)if(i.events[u][1].type!=="lineEnding"&&i.events[u][1].type!=="linePrefix"&&i.events[u][1].type!=="content"){d=i.events[u][1].type==="paragraph";break}return!i.parser.lazy[i.now().line]&&(i.interrupt||d)?(e.enter("setextHeadingLine"),r=c,o(c)):t(c)}function o(c){return e.enter("setextHeadingLineSequence"),s(c)}function s(c){return c===r?(e.consume(c),s):(e.exit("setextHeadingLineSequence"),F(c)?z(e,l,"lineSuffix")(c):l(c))}function l(c){return c===null||A(c)?(e.exit("setextHeadingLine"),n(c)):t(c)}}var Es={tokenize:fm};function fm(e){let n=this,t=e.attempt(Je,i,e.attempt(this.parser.constructs.flowInitial,r,z(e,e.attempt(this.parser.constructs.flow,r,e.attempt(Lr,r)),"linePrefix")));return t;function i(a){if(a===null){e.consume(a);return}return e.enter("lineEndingBlank"),e.consume(a),e.exit("lineEndingBlank"),n.currentConstruct=void 0,t}function r(a){if(a===null){e.consume(a);return}return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),n.currentConstruct=void 0,t}}var Cs={resolveAll:As()},ks=Ts("string"),ws=Ts("text");function Ts(e){return{tokenize:n,resolveAll:As(e==="text"?ym:void 0)};function n(t){let i=this,r=this.parser.constructs[e],a=t.attempt(r,o,s);return o;function o(u){return c(u)?a(u):s(u)}function s(u){if(u===null){t.consume(u);return}return t.enter("data"),t.consume(u),l}function l(u){return c(u)?(t.exit("data"),a(u)):(t.consume(u),l)}function c(u){if(u===null)return!0;let d=r[u],m=-1;if(d)for(;++m<d.length;){let p=d[m];if(!p.previous||p.previous.call(i,i.previous))return!0}return!1}}}function As(e){return n;function n(t,i){let r=-1,a;for(;++r<=t.length;)a===void 0?t[r]&&t[r][1].type==="data"&&(a=r,r++):(!t[r]||t[r][1].type!=="data")&&(r!==a+2&&(t[a][1].end=t[r-1][1].end,t.splice(a+2,r-a-2),r=a+2),a=void 0);return e?e(t,i):t}}function ym(e,n){let t=0;for(;++t<=e.length;)if((t===e.length||e[t][1].type==="lineEnding")&&e[t-1][1].type==="data"){let i=e[t-1][1],r=n.sliceStream(i),a=r.length,o=-1,s=0,l;for(;a--;){let c=r[a];if(typeof c=="string"){for(o=c.length;c.charCodeAt(o-1)===32;)s++,o--;if(o)break;o=-1}else if(c===-2)l=!0,s++;else if(c!==-1){a++;break}}if(s){let c={type:t===e.length||l||s<2?"lineSuffix":"hardBreakTrailing",start:{line:i.end.line,column:i.end.column-s,offset:i.end.offset-s,_index:i.start._index+a,_bufferIndex:a?o:i.start._bufferIndex+o},end:Object.assign({},i.end)};i.end=Object.assign({},c.start),i.start.offset===i.end.offset?Object.assign(i,c):(e.splice(t,0,["enter",c,n],["exit",c,n]),t+=2)}t++}return e}function xs(e,n,t){let i=Object.assign(t?Object.assign({},t):{line:1,column:1,offset:0},{_index:0,_bufferIndex:-1}),r={},a=[],o=[],s=[],l=!0,c={consume:N,enter:L,exit:b,attempt:P(I),check:P(D),interrupt:P(D,{interrupt:!0})},u={previous:null,code:null,containerState:{},events:[],parser:e,sliceStream:_,sliceSerialize:f,now:E,defineSkip:y,write:p},d=n.tokenize.call(u,c),m;return n.resolveAll&&a.push(n),u;function p(w){return o=me(o,w),T(),o[o.length-1]!==null?[]:(M(n,0),u.events=wt(a,u.events,u),u.events)}function f(w,x){return vm(_(w),x)}function _(w){return bm(o,w)}function E(){let{line:w,column:x,offset:O,_index:j,_bufferIndex:X}=i;return{line:w,column:x,offset:O,_index:j,_bufferIndex:X}}function y(w){r[w.line]=w.column,R()}function T(){let w;for(;i._index<o.length;){let x=o[i._index];if(typeof x=="string")for(w=i._index,i._bufferIndex<0&&(i._bufferIndex=0);i._index===w&&i._bufferIndex<x.length;)S(x.charCodeAt(i._bufferIndex));else S(x)}}function S(w){l=void 0,m=w,d=d(w)}function N(w){A(w)?(i.line++,i.column=1,i.offset+=w===-3?2:1,R()):w!==-1&&(i.column++,i.offset++),i._bufferIndex<0?i._index++:(i._bufferIndex++,i._bufferIndex===o[i._index].length&&(i._bufferIndex=-1,i._index++)),u.previous=w,l=!0}function L(w,x){let O=x||{};return O.type=w,O.start=E(),u.events.push(["enter",O,u]),s.push(O),O}function b(w){let x=s.pop();return x.end=E(),u.events.push(["exit",x,u]),x}function I(w,x){M(w,x.from)}function D(w,x){x.restore()}function P(w,x){return O;function O(j,X,re){let ie,g,Se,Me;return Array.isArray(j)?fe(j):"tokenize"in j?fe([j]):h(j);function h(se){return Nt;function Nt(Re){let ut=Re!==null&&se[Re],dt=Re!==null&&se.null,Di=[...Array.isArray(ut)?ut:ut?[ut]:[],...Array.isArray(dt)?dt:dt?[dt]:[]];return fe(Di)(Re)}}function fe(se){return ie=se,g=0,se.length===0?re:Qe(se[g])}function Qe(se){return Nt;function Nt(Re){return Me=H(),Se=se,se.partial||(u.currentConstruct=se),se.name&&u.parser.constructs.disable.null.includes(se.name)?pn(Re):se.tokenize.call(x?Object.assign(Object.create(u),x):u,c,Pi,pn)(Re)}}function Pi(se){return l=!0,w(Se,Me),X}function pn(se){return l=!0,Me.restore(),++g<ie.length?Qe(ie[g]):re}}}function M(w,x){w.resolveAll&&!a.includes(w)&&a.push(w),w.resolve&&de(u.events,x,u.events.length-x,w.resolve(u.events.slice(x),u)),w.resolveTo&&(u.events=w.resolveTo(u.events,u))}function H(){let w=E(),x=u.previous,O=u.currentConstruct,j=u.events.length,X=Array.from(s);return{restore:re,from:j};function re(){i=w,u.previous=x,u.currentConstruct=O,u.events.length=j,s=X,R()}}function R(){i.line in r&&i.column<2&&(i.column=r[i.line],i.offset+=r[i.line]-1)}}function bm(e,n){let t=n.start._index,i=n.start._bufferIndex,r=n.end._index,a=n.end._bufferIndex,o;if(t===r)o=[e[t].slice(i,a)];else{if(o=e.slice(t,r),i>-1){let s=o[0];typeof s=="string"?o[0]=s.slice(i):o.shift()}a>0&&o.push(e[r].slice(0,a))}return o}function vm(e,n){let t=-1,i=[],r;for(;++t<e.length;){let a=e[t],o;if(typeof a=="string")o=a;else switch(a){case-5:{o="\r";break}case-4:{o=`
3436
3442
  `;break}case-3:{o=`\r
3437
- `;break}case-2:{o=n?" ":" ";break}case-1:{if(!n&&r)continue;o=" ";break}default:o=String.fromCharCode(a)}r=a===-2,i.push(o)}return i.join("")}var Vr={};va(Vr,{attentionMarkers:()=>Am,contentInitial:()=>Sm,disable:()=>xm,document:()=>_m,flow:()=>Cm,flowInitial:()=>Em,insideSpan:()=>Tm,string:()=>km,text:()=>wm});var _m={42:pe,43:pe,45:pe,48:pe,49:pe,50:pe,51:pe,52:pe,53:pe,54:pe,55:pe,56:pe,57:pe,62:Yn},Sm={91:Mr},Em={[-2]:en,[-1]:en,32:en},Cm={35:Br,42:st,45:[ri,st],60:Gr,61:ri,95:st,96:$n,126:$n},km={38:Zn,92:Jn},wm={[-5]:nn,[-4]:nn,[-3]:nn,33:Ur,38:Zn,42:Qt,60:[Dr,zr],91:Hr,92:[Or,Jn],93:ot,95:Qt,96:Lr},Tm={null:[Qt,Cs]},Am={null:[42,95]},xm={null:[]};function Wr(e){let t=us([Vr,...(e||{}).extensions||[]]),i={defined:[],lazy:{},constructs:t,content:r(fs),document:r(bs),flow:r(Es),string:r(ks),text:r(ws)};return i;function r(a){return o;function o(s){return xs(i,a,s)}}}function jr(e){for(;!ei(e););return e}var Is=/[\0\t\n\r]/g;function qr(){let e=1,n="",t=!0,i;return r;function r(a,o,s){let l=[],c,u,d,m,p;for(a=n+(typeof a=="string"?a.toString():new TextDecoder(o||void 0).decode(a)),d=0,n="",t&&(a.charCodeAt(0)===65279&&d++,t=void 0);d<a.length;){if(Is.lastIndex=d,c=Is.exec(a),m=c&&c.index!==void 0?c.index:a.length,p=a.charCodeAt(m),!c){n=a.slice(d);break}if(p===10&&d===m&&i)l.push(-3),i=void 0;else switch(i&&(l.push(-5),i=void 0),d<m&&(l.push(a.slice(d,m)),e+=m-d),p){case 0:{l.push(65533),e++;break}case 9:{for(u=Math.ceil(e/4)*4,l.push(-2);e++<u;)l.push(-1);break}case 10:{l.push(-4),e=1;break}default:i=!0,e=1}d=m+1}return s&&(i&&l.push(-5),n&&l.push(n),l.push(null)),l}}var Im=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Rs(e){return e.replace(Im,Rm)}function Rm(e,n,t){if(n)return n;if(t.charCodeAt(0)===35){let r=t.charCodeAt(1),a=r===120||r===88;return Xn(t.slice(a?2:1),a?16:10)}return kt(t)||e}function Ze(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Ps(e.position):"start"in e||"end"in e?Ps(e):"line"in e||"column"in e?Kr(e):""}function Kr(e){return Ds(e&&e.line)+":"+Ds(e&&e.column)}function Ps(e){return Kr(e&&e.start)+"-"+Kr(e&&e.end)}function Ds(e){return e&&typeof e=="number"?e:1}var Ns={}.hasOwnProperty;function Xr(e,n,t){return typeof n!="string"&&(t=n,n=void 0),Pm(t)(jr(Wr(t).document().write(qr()(e,n,!0))))}function Pm(e){let n={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:a(ya),autolinkProtocol:P,autolinkEmail:P,atxHeading:a(ga),blockQuote:a(Lt),characterEscape:P,characterReference:P,codeFenced:a(Re),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:a(Re,o),codeText:a(ut,o),codeTextData:P,data:P,codeFlowValue:P,definition:a(dt),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:a(Di),hardBreakEscape:a(ha),hardBreakTrailing:a(ha),htmlFlow:a(fa,o),htmlFlowData:P,htmlText:a(fa,o),htmlTextData:P,image:a(Kl),label:o,link:a(ya),listItem:a(Xl),listItemValue:m,listOrdered:a(ba,d),listUnordered:a(ba),paragraph:a(Yl),reference:h,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:a(ga),strong:a(Jl),thematicBreak:a($l)},exit:{atxHeading:l(),atxHeadingSequence:N,autolink:l(),autolinkEmail:se,autolinkProtocol:pn,blockQuote:l(),characterEscapeValue:M,characterReferenceMarkerHexadecimal:Qe,characterReferenceMarkerNumeric:Qe,characterReferenceValue:Pi,codeFenced:l(E),codeFencedFence:_,codeFencedFenceInfo:p,codeFencedFenceMeta:f,codeFlowValue:M,codeIndented:l(y),codeText:l(O),codeTextData:M,data:M,definition:l(),definitionDestinationString:L,definitionLabelString:T,definitionTitleString:S,emphasis:l(),hardBreakEscape:l(R),hardBreakTrailing:l(R),htmlFlow:l(w),htmlFlowData:M,htmlText:l(x),htmlTextData:M,image:l(X),label:ie,labelText:re,lineEnding:H,link:l(j),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:fe,resourceDestinationString:g,resourceTitleString:Se,resource:Me,setextHeading:l(D),setextHeadingLineSequence:I,setextHeadingText:b,strong:l(),thematicBreak:l()}};Ms(n,(e||{}).mdastExtensions||[]);let t={};return i;function i(v){let k={type:"root",children:[]},G={stack:[k],tokenStack:[],config:n,enter:s,exit:c,buffer:o,resume:u,data:t},W=[],Y=-1;for(;++Y<v.length;)if(v[Y][1].type==="listOrdered"||v[Y][1].type==="listUnordered")if(v[Y][0]==="enter")W.push(Y);else{let we=W.pop();Y=r(v,we,Y)}for(Y=-1;++Y<v.length;){let we=n[v[Y][0]];Ns.call(we,v[Y][1].type)&&we[v[Y][1].type].call(Object.assign({sliceSerialize:v[Y][2].sliceSerialize},G),v[Y][1])}if(G.tokenStack.length>0){let we=G.tokenStack[G.tokenStack.length-1];(we[1]||Ls).call(G,void 0,we[0])}for(k.position={start:$e(v.length>0?v[0][1].start:{line:1,column:1,offset:0}),end:$e(v.length>0?v[v.length-2][1].end:{line:1,column:1,offset:0})},Y=-1;++Y<n.transforms.length;)k=n.transforms[Y](k)||k;return k}function r(v,k,G){let W=k-1,Y=-1,we=!1,et,Oe,Nt,Mt;for(;++W<=G;){let ye=v[W];switch(ye[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{ye[0]==="enter"?Y++:Y--,Mt=void 0;break}case"lineEndingBlank":{ye[0]==="enter"&&(et&&!Mt&&!Y&&!Nt&&(Nt=W),Mt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Mt=void 0}if(!Y&&ye[0]==="enter"&&ye[1].type==="listItemPrefix"||Y===-1&&ye[0]==="exit"&&(ye[1].type==="listUnordered"||ye[1].type==="listOrdered")){if(et){let pt=W;for(Oe=void 0;pt--;){let Be=v[pt];if(Be[1].type==="lineEnding"||Be[1].type==="lineEndingBlank"){if(Be[0]==="exit")continue;Oe&&(v[Oe][1].type="lineEndingBlank",we=!0),Be[1].type="lineEnding",Oe=pt}else if(!(Be[1].type==="linePrefix"||Be[1].type==="blockQuotePrefix"||Be[1].type==="blockQuotePrefixWhitespace"||Be[1].type==="blockQuoteMarker"||Be[1].type==="listItemIndent"))break}Nt&&(!Oe||Nt<Oe)&&(et._spread=!0),et.end=Object.assign({},Oe?v[Oe][1].start:ye[1].end),v.splice(Oe||W,0,["exit",et,ye[2]]),W++,G++}if(ye[1].type==="listItemPrefix"){let pt={type:"listItem",_spread:!1,start:Object.assign({},ye[1].start),end:void 0};et=pt,v.splice(W,0,["enter",pt,ye[2]]),W++,G++,Nt=void 0,Mt=!0}}}return v[k][1]._spread=we,G}function a(v,k){return G;function G(W){s.call(this,v(W),W),k&&k.call(this,W)}}function o(){this.stack.push({type:"fragment",children:[]})}function s(v,k,G){this.stack[this.stack.length-1].children.push(v),this.stack.push(v),this.tokenStack.push([k,G]),v.position={start:$e(k.start),end:void 0}}function l(v){return k;function k(G){v&&v.call(this,G),c.call(this,G)}}function c(v,k){let G=this.stack.pop(),W=this.tokenStack.pop();if(W)W[0].type!==v.type&&(k?k.call(this,v,W[0]):(W[1]||Ls).call(this,v,W[0]));else throw new Error("Cannot close `"+v.type+"` ("+Ze({start:v.start,end:v.end})+"): it\u2019s not open");G.position.end=$e(v.end)}function u(){return Rr(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function m(v){if(this.data.expectingFirstListItemValue){let k=this.stack[this.stack.length-2];k.start=Number.parseInt(this.sliceSerialize(v),10),this.data.expectingFirstListItemValue=void 0}}function p(){let v=this.resume(),k=this.stack[this.stack.length-1];k.lang=v}function f(){let v=this.resume(),k=this.stack[this.stack.length-1];k.meta=v}function _(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function E(){let v=this.resume(),k=this.stack[this.stack.length-1];k.value=v.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function y(){let v=this.resume(),k=this.stack[this.stack.length-1];k.value=v.replace(/(\r?\n|\r)$/g,"")}function T(v){let k=this.resume(),G=this.stack[this.stack.length-1];G.label=k,G.identifier=Ue(this.sliceSerialize(v)).toLowerCase()}function S(){let v=this.resume(),k=this.stack[this.stack.length-1];k.title=v}function L(){let v=this.resume(),k=this.stack[this.stack.length-1];k.url=v}function N(v){let k=this.stack[this.stack.length-1];if(!k.depth){let G=this.sliceSerialize(v).length;k.depth=G}}function b(){this.data.setextHeadingSlurpLineEnding=!0}function I(v){let k=this.stack[this.stack.length-1];k.depth=this.sliceSerialize(v).codePointAt(0)===61?1:2}function D(){this.data.setextHeadingSlurpLineEnding=void 0}function P(v){let G=this.stack[this.stack.length-1].children,W=G[G.length-1];(!W||W.type!=="text")&&(W=Zl(),W.position={start:$e(v.start),end:void 0},G.push(W)),this.stack.push(W)}function M(v){let k=this.stack.pop();k.value+=this.sliceSerialize(v),k.position.end=$e(v.end)}function H(v){let k=this.stack[this.stack.length-1];if(this.data.atHardBreak){let G=k.children[k.children.length-1];G.position.end=$e(v.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&n.canContainEols.includes(k.type)&&(P.call(this,v),M.call(this,v))}function R(){this.data.atHardBreak=!0}function w(){let v=this.resume(),k=this.stack[this.stack.length-1];k.value=v}function x(){let v=this.resume(),k=this.stack[this.stack.length-1];k.value=v}function O(){let v=this.resume(),k=this.stack[this.stack.length-1];k.value=v}function j(){let v=this.stack[this.stack.length-1];if(this.data.inReference){let k=this.data.referenceType||"shortcut";v.type+="Reference",v.referenceType=k,delete v.url,delete v.title}else delete v.identifier,delete v.label;this.data.referenceType=void 0}function X(){let v=this.stack[this.stack.length-1];if(this.data.inReference){let k=this.data.referenceType||"shortcut";v.type+="Reference",v.referenceType=k,delete v.url,delete v.title}else delete v.identifier,delete v.label;this.data.referenceType=void 0}function re(v){let k=this.sliceSerialize(v),G=this.stack[this.stack.length-2];G.label=Rs(k),G.identifier=Ue(k).toLowerCase()}function ie(){let v=this.stack[this.stack.length-1],k=this.resume(),G=this.stack[this.stack.length-1];if(this.data.inReference=!0,G.type==="link"){let W=v.children;G.children=W}else G.alt=k}function g(){let v=this.resume(),k=this.stack[this.stack.length-1];k.url=v}function Se(){let v=this.resume(),k=this.stack[this.stack.length-1];k.title=v}function Me(){this.data.inReference=void 0}function h(){this.data.referenceType="collapsed"}function fe(v){let k=this.resume(),G=this.stack[this.stack.length-1];G.label=k,G.identifier=Ue(this.sliceSerialize(v)).toLowerCase(),this.data.referenceType="full"}function Qe(v){this.data.characterReferenceType=v.type}function Pi(v){let k=this.sliceSerialize(v),G=this.data.characterReferenceType,W;G?(W=Xn(k,G==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):W=kt(k);let Y=this.stack.pop();Y.value+=W,Y.position.end=$e(v.end)}function pn(v){M.call(this,v);let k=this.stack[this.stack.length-1];k.url=this.sliceSerialize(v)}function se(v){M.call(this,v);let k=this.stack[this.stack.length-1];k.url="mailto:"+this.sliceSerialize(v)}function Lt(){return{type:"blockquote",children:[]}}function Re(){return{type:"code",lang:null,meta:null,value:""}}function ut(){return{type:"inlineCode",value:""}}function dt(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Di(){return{type:"emphasis",children:[]}}function ga(){return{type:"heading",depth:0,children:[]}}function ha(){return{type:"break"}}function fa(){return{type:"html",value:""}}function Kl(){return{type:"image",title:null,url:"",alt:null}}function ya(){return{type:"link",title:null,url:"",children:[]}}function ba(v){return{type:"list",ordered:v.type==="listOrdered",start:null,spread:v._spread,children:[]}}function Xl(v){return{type:"listItem",spread:v._spread,checked:null,children:[]}}function Yl(){return{type:"paragraph",children:[]}}function Jl(){return{type:"strong",children:[]}}function Zl(){return{type:"text",value:""}}function $l(){return{type:"thematicBreak"}}}function $e(e){return{line:e.line,column:e.column,offset:e.offset}}function Ms(e,n){let t=-1;for(;++t<n.length;){let i=n[t];Array.isArray(i)?Ms(e,i):Dm(e,i)}}function Dm(e,n){let t;for(t in n)if(Ns.call(n,t))switch(t){case"canContainEols":{let i=n[t];i&&e[t].push(...i);break}case"transforms":{let i=n[t];i&&e[t].push(...i);break}case"enter":case"exit":{let i=n[t];i&&Object.assign(e[t],i);break}}}function Ls(e,n){throw e?new Error("Cannot close `"+e.type+"` ("+Ze({start:e.start,end:e.end})+"): a different token (`"+n.type+"`, "+Ze({start:n.start,end:n.end})+") is open"):new Error("Cannot close document, a token (`"+n.type+"`, "+Ze({start:n.start,end:n.end})+") is still open")}function ai(e){let n=this;n.parser=t;function t(i){return Xr(i,{...n.data("settings"),...e,extensions:n.data("micromarkExtensions")||[],mdastExtensions:n.data("fromMarkdownExtensions")||[]})}}function Os(e,n){let t={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(n),!0)};return e.patch(n,t),e.applyData(n,t)}function Bs(e,n){let t={type:"element",tagName:"br",properties:{},children:[]};return e.patch(n,t),[e.applyData(n,t),{type:"text",value:`
3443
+ `;break}case-2:{o=n?" ":" ";break}case-1:{if(!n&&r)continue;o=" ";break}default:o=String.fromCharCode(a)}r=a===-2,i.push(o)}return i.join("")}var Vr={};va(Vr,{attentionMarkers:()=>Am,contentInitial:()=>Sm,disable:()=>xm,document:()=>_m,flow:()=>Cm,flowInitial:()=>Em,insideSpan:()=>Tm,string:()=>km,text:()=>wm});var _m={42:pe,43:pe,45:pe,48:pe,49:pe,50:pe,51:pe,52:pe,53:pe,54:pe,55:pe,56:pe,57:pe,62:Yn},Sm={91:Mr},Em={[-2]:en,[-1]:en,32:en},Cm={35:Br,42:st,45:[ri,st],60:Gr,61:ri,95:st,96:$n,126:$n},km={38:Zn,92:Jn},wm={[-5]:nn,[-4]:nn,[-3]:nn,33:Ur,38:Zn,42:Qt,60:[Dr,zr],91:Hr,92:[Or,Jn],93:ot,95:Qt,96:Nr},Tm={null:[Qt,Cs]},Am={null:[42,95]},xm={null:[]};function Wr(e){let t=us([Vr,...(e||{}).extensions||[]]),i={defined:[],lazy:{},constructs:t,content:r(fs),document:r(bs),flow:r(Es),string:r(ks),text:r(ws)};return i;function r(a){return o;function o(s){return xs(i,a,s)}}}function jr(e){for(;!ei(e););return e}var Is=/[\0\t\n\r]/g;function qr(){let e=1,n="",t=!0,i;return r;function r(a,o,s){let l=[],c,u,d,m,p;for(a=n+(typeof a=="string"?a.toString():new TextDecoder(o||void 0).decode(a)),d=0,n="",t&&(a.charCodeAt(0)===65279&&d++,t=void 0);d<a.length;){if(Is.lastIndex=d,c=Is.exec(a),m=c&&c.index!==void 0?c.index:a.length,p=a.charCodeAt(m),!c){n=a.slice(d);break}if(p===10&&d===m&&i)l.push(-3),i=void 0;else switch(i&&(l.push(-5),i=void 0),d<m&&(l.push(a.slice(d,m)),e+=m-d),p){case 0:{l.push(65533),e++;break}case 9:{for(u=Math.ceil(e/4)*4,l.push(-2);e++<u;)l.push(-1);break}case 10:{l.push(-4),e=1;break}default:i=!0,e=1}d=m+1}return s&&(i&&l.push(-5),n&&l.push(n),l.push(null)),l}}var Im=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Rs(e){return e.replace(Im,Rm)}function Rm(e,n,t){if(n)return n;if(t.charCodeAt(0)===35){let r=t.charCodeAt(1),a=r===120||r===88;return Xn(t.slice(a?2:1),a?16:10)}return kt(t)||e}function Ze(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Ps(e.position):"start"in e||"end"in e?Ps(e):"line"in e||"column"in e?Kr(e):""}function Kr(e){return Ds(e&&e.line)+":"+Ds(e&&e.column)}function Ps(e){return Kr(e&&e.start)+"-"+Kr(e&&e.end)}function Ds(e){return e&&typeof e=="number"?e:1}var Ls={}.hasOwnProperty;function Xr(e,n,t){return typeof n!="string"&&(t=n,n=void 0),Pm(t)(jr(Wr(t).document().write(qr()(e,n,!0))))}function Pm(e){let n={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:a(ya),autolinkProtocol:P,autolinkEmail:P,atxHeading:a(ga),blockQuote:a(Nt),characterEscape:P,characterReference:P,codeFenced:a(Re),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:a(Re,o),codeText:a(ut,o),codeTextData:P,data:P,codeFlowValue:P,definition:a(dt),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:a(Di),hardBreakEscape:a(ha),hardBreakTrailing:a(ha),htmlFlow:a(fa,o),htmlFlowData:P,htmlText:a(fa,o),htmlTextData:P,image:a(Kl),label:o,link:a(ya),listItem:a(Xl),listItemValue:m,listOrdered:a(ba,d),listUnordered:a(ba),paragraph:a(Yl),reference:h,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:a(ga),strong:a(Jl),thematicBreak:a($l)},exit:{atxHeading:l(),atxHeadingSequence:L,autolink:l(),autolinkEmail:se,autolinkProtocol:pn,blockQuote:l(),characterEscapeValue:M,characterReferenceMarkerHexadecimal:Qe,characterReferenceMarkerNumeric:Qe,characterReferenceValue:Pi,codeFenced:l(E),codeFencedFence:_,codeFencedFenceInfo:p,codeFencedFenceMeta:f,codeFlowValue:M,codeIndented:l(y),codeText:l(O),codeTextData:M,data:M,definition:l(),definitionDestinationString:N,definitionLabelString:T,definitionTitleString:S,emphasis:l(),hardBreakEscape:l(R),hardBreakTrailing:l(R),htmlFlow:l(w),htmlFlowData:M,htmlText:l(x),htmlTextData:M,image:l(X),label:ie,labelText:re,lineEnding:H,link:l(j),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:fe,resourceDestinationString:g,resourceTitleString:Se,resource:Me,setextHeading:l(D),setextHeadingLineSequence:I,setextHeadingText:b,strong:l(),thematicBreak:l()}};Ms(n,(e||{}).mdastExtensions||[]);let t={};return i;function i(v){let k={type:"root",children:[]},G={stack:[k],tokenStack:[],config:n,enter:s,exit:c,buffer:o,resume:u,data:t},W=[],Y=-1;for(;++Y<v.length;)if(v[Y][1].type==="listOrdered"||v[Y][1].type==="listUnordered")if(v[Y][0]==="enter")W.push(Y);else{let we=W.pop();Y=r(v,we,Y)}for(Y=-1;++Y<v.length;){let we=n[v[Y][0]];Ls.call(we,v[Y][1].type)&&we[v[Y][1].type].call(Object.assign({sliceSerialize:v[Y][2].sliceSerialize},G),v[Y][1])}if(G.tokenStack.length>0){let we=G.tokenStack[G.tokenStack.length-1];(we[1]||Ns).call(G,void 0,we[0])}for(k.position={start:$e(v.length>0?v[0][1].start:{line:1,column:1,offset:0}),end:$e(v.length>0?v[v.length-2][1].end:{line:1,column:1,offset:0})},Y=-1;++Y<n.transforms.length;)k=n.transforms[Y](k)||k;return k}function r(v,k,G){let W=k-1,Y=-1,we=!1,et,Oe,Lt,Mt;for(;++W<=G;){let ye=v[W];switch(ye[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{ye[0]==="enter"?Y++:Y--,Mt=void 0;break}case"lineEndingBlank":{ye[0]==="enter"&&(et&&!Mt&&!Y&&!Lt&&(Lt=W),Mt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Mt=void 0}if(!Y&&ye[0]==="enter"&&ye[1].type==="listItemPrefix"||Y===-1&&ye[0]==="exit"&&(ye[1].type==="listUnordered"||ye[1].type==="listOrdered")){if(et){let pt=W;for(Oe=void 0;pt--;){let Be=v[pt];if(Be[1].type==="lineEnding"||Be[1].type==="lineEndingBlank"){if(Be[0]==="exit")continue;Oe&&(v[Oe][1].type="lineEndingBlank",we=!0),Be[1].type="lineEnding",Oe=pt}else if(!(Be[1].type==="linePrefix"||Be[1].type==="blockQuotePrefix"||Be[1].type==="blockQuotePrefixWhitespace"||Be[1].type==="blockQuoteMarker"||Be[1].type==="listItemIndent"))break}Lt&&(!Oe||Lt<Oe)&&(et._spread=!0),et.end=Object.assign({},Oe?v[Oe][1].start:ye[1].end),v.splice(Oe||W,0,["exit",et,ye[2]]),W++,G++}if(ye[1].type==="listItemPrefix"){let pt={type:"listItem",_spread:!1,start:Object.assign({},ye[1].start),end:void 0};et=pt,v.splice(W,0,["enter",pt,ye[2]]),W++,G++,Lt=void 0,Mt=!0}}}return v[k][1]._spread=we,G}function a(v,k){return G;function G(W){s.call(this,v(W),W),k&&k.call(this,W)}}function o(){this.stack.push({type:"fragment",children:[]})}function s(v,k,G){this.stack[this.stack.length-1].children.push(v),this.stack.push(v),this.tokenStack.push([k,G]),v.position={start:$e(k.start),end:void 0}}function l(v){return k;function k(G){v&&v.call(this,G),c.call(this,G)}}function c(v,k){let G=this.stack.pop(),W=this.tokenStack.pop();if(W)W[0].type!==v.type&&(k?k.call(this,v,W[0]):(W[1]||Ns).call(this,v,W[0]));else throw new Error("Cannot close `"+v.type+"` ("+Ze({start:v.start,end:v.end})+"): it\u2019s not open");G.position.end=$e(v.end)}function u(){return Rr(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function m(v){if(this.data.expectingFirstListItemValue){let k=this.stack[this.stack.length-2];k.start=Number.parseInt(this.sliceSerialize(v),10),this.data.expectingFirstListItemValue=void 0}}function p(){let v=this.resume(),k=this.stack[this.stack.length-1];k.lang=v}function f(){let v=this.resume(),k=this.stack[this.stack.length-1];k.meta=v}function _(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function E(){let v=this.resume(),k=this.stack[this.stack.length-1];k.value=v.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function y(){let v=this.resume(),k=this.stack[this.stack.length-1];k.value=v.replace(/(\r?\n|\r)$/g,"")}function T(v){let k=this.resume(),G=this.stack[this.stack.length-1];G.label=k,G.identifier=Ue(this.sliceSerialize(v)).toLowerCase()}function S(){let v=this.resume(),k=this.stack[this.stack.length-1];k.title=v}function N(){let v=this.resume(),k=this.stack[this.stack.length-1];k.url=v}function L(v){let k=this.stack[this.stack.length-1];if(!k.depth){let G=this.sliceSerialize(v).length;k.depth=G}}function b(){this.data.setextHeadingSlurpLineEnding=!0}function I(v){let k=this.stack[this.stack.length-1];k.depth=this.sliceSerialize(v).codePointAt(0)===61?1:2}function D(){this.data.setextHeadingSlurpLineEnding=void 0}function P(v){let G=this.stack[this.stack.length-1].children,W=G[G.length-1];(!W||W.type!=="text")&&(W=Zl(),W.position={start:$e(v.start),end:void 0},G.push(W)),this.stack.push(W)}function M(v){let k=this.stack.pop();k.value+=this.sliceSerialize(v),k.position.end=$e(v.end)}function H(v){let k=this.stack[this.stack.length-1];if(this.data.atHardBreak){let G=k.children[k.children.length-1];G.position.end=$e(v.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&n.canContainEols.includes(k.type)&&(P.call(this,v),M.call(this,v))}function R(){this.data.atHardBreak=!0}function w(){let v=this.resume(),k=this.stack[this.stack.length-1];k.value=v}function x(){let v=this.resume(),k=this.stack[this.stack.length-1];k.value=v}function O(){let v=this.resume(),k=this.stack[this.stack.length-1];k.value=v}function j(){let v=this.stack[this.stack.length-1];if(this.data.inReference){let k=this.data.referenceType||"shortcut";v.type+="Reference",v.referenceType=k,delete v.url,delete v.title}else delete v.identifier,delete v.label;this.data.referenceType=void 0}function X(){let v=this.stack[this.stack.length-1];if(this.data.inReference){let k=this.data.referenceType||"shortcut";v.type+="Reference",v.referenceType=k,delete v.url,delete v.title}else delete v.identifier,delete v.label;this.data.referenceType=void 0}function re(v){let k=this.sliceSerialize(v),G=this.stack[this.stack.length-2];G.label=Rs(k),G.identifier=Ue(k).toLowerCase()}function ie(){let v=this.stack[this.stack.length-1],k=this.resume(),G=this.stack[this.stack.length-1];if(this.data.inReference=!0,G.type==="link"){let W=v.children;G.children=W}else G.alt=k}function g(){let v=this.resume(),k=this.stack[this.stack.length-1];k.url=v}function Se(){let v=this.resume(),k=this.stack[this.stack.length-1];k.title=v}function Me(){this.data.inReference=void 0}function h(){this.data.referenceType="collapsed"}function fe(v){let k=this.resume(),G=this.stack[this.stack.length-1];G.label=k,G.identifier=Ue(this.sliceSerialize(v)).toLowerCase(),this.data.referenceType="full"}function Qe(v){this.data.characterReferenceType=v.type}function Pi(v){let k=this.sliceSerialize(v),G=this.data.characterReferenceType,W;G?(W=Xn(k,G==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):W=kt(k);let Y=this.stack.pop();Y.value+=W,Y.position.end=$e(v.end)}function pn(v){M.call(this,v);let k=this.stack[this.stack.length-1];k.url=this.sliceSerialize(v)}function se(v){M.call(this,v);let k=this.stack[this.stack.length-1];k.url="mailto:"+this.sliceSerialize(v)}function Nt(){return{type:"blockquote",children:[]}}function Re(){return{type:"code",lang:null,meta:null,value:""}}function ut(){return{type:"inlineCode",value:""}}function dt(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Di(){return{type:"emphasis",children:[]}}function ga(){return{type:"heading",depth:0,children:[]}}function ha(){return{type:"break"}}function fa(){return{type:"html",value:""}}function Kl(){return{type:"image",title:null,url:"",alt:null}}function ya(){return{type:"link",title:null,url:"",children:[]}}function ba(v){return{type:"list",ordered:v.type==="listOrdered",start:null,spread:v._spread,children:[]}}function Xl(v){return{type:"listItem",spread:v._spread,checked:null,children:[]}}function Yl(){return{type:"paragraph",children:[]}}function Jl(){return{type:"strong",children:[]}}function Zl(){return{type:"text",value:""}}function $l(){return{type:"thematicBreak"}}}function $e(e){return{line:e.line,column:e.column,offset:e.offset}}function Ms(e,n){let t=-1;for(;++t<n.length;){let i=n[t];Array.isArray(i)?Ms(e,i):Dm(e,i)}}function Dm(e,n){let t;for(t in n)if(Ls.call(n,t))switch(t){case"canContainEols":{let i=n[t];i&&e[t].push(...i);break}case"transforms":{let i=n[t];i&&e[t].push(...i);break}case"enter":case"exit":{let i=n[t];i&&Object.assign(e[t],i);break}}}function Ns(e,n){throw e?new Error("Cannot close `"+e.type+"` ("+Ze({start:e.start,end:e.end})+"): a different token (`"+n.type+"`, "+Ze({start:n.start,end:n.end})+") is open"):new Error("Cannot close document, a token (`"+n.type+"`, "+Ze({start:n.start,end:n.end})+") is still open")}function ai(e){let n=this;n.parser=t;function t(i){return Xr(i,{...n.data("settings"),...e,extensions:n.data("micromarkExtensions")||[],mdastExtensions:n.data("fromMarkdownExtensions")||[]})}}function Os(e,n){let t={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(n),!0)};return e.patch(n,t),e.applyData(n,t)}function Bs(e,n){let t={type:"element",tagName:"br",properties:{},children:[]};return e.patch(n,t),[e.applyData(n,t),{type:"text",value:`
3438
3444
  `}]}function Fs(e,n){let t=n.value?n.value+`
3439
- `:"",i={};n.lang&&(i.className=["language-"+n.lang]);let r={type:"element",tagName:"code",properties:i,children:[{type:"text",value:t}]};return n.meta&&(r.data={meta:n.meta}),e.patch(n,r),r=e.applyData(n,r),r={type:"element",tagName:"pre",properties:{},children:[r]},e.patch(n,r),r}function Gs(e,n){let t={type:"element",tagName:"del",properties:{},children:e.all(n)};return e.patch(n,t),e.applyData(n,t)}function zs(e,n){let t={type:"element",tagName:"em",properties:{},children:e.all(n)};return e.patch(n,t),e.applyData(n,t)}function Us(e,n){let t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",i=String(n.identifier).toUpperCase(),r=ke(i.toLowerCase()),a=e.footnoteOrder.indexOf(i),o,s=e.footnoteCounts.get(i);s===void 0?(s=0,e.footnoteOrder.push(i),o=e.footnoteOrder.length):o=a+1,s+=1,e.footnoteCounts.set(i,s);let l={type:"element",tagName:"a",properties:{href:"#"+t+"fn-"+r,id:t+"fnref-"+r+(s>1?"-"+s:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(o)}]};e.patch(n,l);let c={type:"element",tagName:"sup",properties:{},children:[l]};return e.patch(n,c),e.applyData(n,c)}function Hs(e,n){let t={type:"element",tagName:"h"+n.depth,properties:{},children:e.all(n)};return e.patch(n,t),e.applyData(n,t)}function Vs(e,n){if(e.options.allowDangerousHtml){let t={type:"raw",value:n.value};return e.patch(n,t),e.applyData(n,t)}}function oi(e,n){let t=n.referenceType,i="]";if(t==="collapsed"?i+="[]":t==="full"&&(i+="["+(n.label||n.identifier)+"]"),n.type==="imageReference")return[{type:"text",value:"!["+n.alt+i}];let r=e.all(n),a=r[0];a&&a.type==="text"?a.value="["+a.value:r.unshift({type:"text",value:"["});let o=r[r.length-1];return o&&o.type==="text"?o.value+=i:r.push({type:"text",value:i}),r}function Ws(e,n){let t=String(n.identifier).toUpperCase(),i=e.definitionById.get(t);if(!i)return oi(e,n);let r={src:ke(i.url||""),alt:n.alt};i.title!==null&&i.title!==void 0&&(r.title=i.title);let a={type:"element",tagName:"img",properties:r,children:[]};return e.patch(n,a),e.applyData(n,a)}function js(e,n){let t={src:ke(n.url)};n.alt!==null&&n.alt!==void 0&&(t.alt=n.alt),n.title!==null&&n.title!==void 0&&(t.title=n.title);let i={type:"element",tagName:"img",properties:t,children:[]};return e.patch(n,i),e.applyData(n,i)}function qs(e,n){let t={type:"text",value:n.value.replace(/\r?\n|\r/g," ")};e.patch(n,t);let i={type:"element",tagName:"code",properties:{},children:[t]};return e.patch(n,i),e.applyData(n,i)}function Ks(e,n){let t=String(n.identifier).toUpperCase(),i=e.definitionById.get(t);if(!i)return oi(e,n);let r={href:ke(i.url||"")};i.title!==null&&i.title!==void 0&&(r.title=i.title);let a={type:"element",tagName:"a",properties:r,children:e.all(n)};return e.patch(n,a),e.applyData(n,a)}function Xs(e,n){let t={href:ke(n.url)};n.title!==null&&n.title!==void 0&&(t.title=n.title);let i={type:"element",tagName:"a",properties:t,children:e.all(n)};return e.patch(n,i),e.applyData(n,i)}function Ys(e,n,t){let i=e.all(n),r=t?Lm(t):Js(n),a={},o=[];if(typeof n.checked=="boolean"){let u=i[0],d;u&&u.type==="element"&&u.tagName==="p"?d=u:(d={type:"element",tagName:"p",properties:{},children:[]},i.unshift(d)),d.children.length>0&&d.children.unshift({type:"text",value:" "}),d.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:n.checked,disabled:!0},children:[]}),a.className=["task-list-item"]}let s=-1;for(;++s<i.length;){let u=i[s];(r||s!==0||u.type!=="element"||u.tagName!=="p")&&o.push({type:"text",value:`
3445
+ `:"",i={};n.lang&&(i.className=["language-"+n.lang]);let r={type:"element",tagName:"code",properties:i,children:[{type:"text",value:t}]};return n.meta&&(r.data={meta:n.meta}),e.patch(n,r),r=e.applyData(n,r),r={type:"element",tagName:"pre",properties:{},children:[r]},e.patch(n,r),r}function Gs(e,n){let t={type:"element",tagName:"del",properties:{},children:e.all(n)};return e.patch(n,t),e.applyData(n,t)}function zs(e,n){let t={type:"element",tagName:"em",properties:{},children:e.all(n)};return e.patch(n,t),e.applyData(n,t)}function Us(e,n){let t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",i=String(n.identifier).toUpperCase(),r=ke(i.toLowerCase()),a=e.footnoteOrder.indexOf(i),o,s=e.footnoteCounts.get(i);s===void 0?(s=0,e.footnoteOrder.push(i),o=e.footnoteOrder.length):o=a+1,s+=1,e.footnoteCounts.set(i,s);let l={type:"element",tagName:"a",properties:{href:"#"+t+"fn-"+r,id:t+"fnref-"+r+(s>1?"-"+s:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(o)}]};e.patch(n,l);let c={type:"element",tagName:"sup",properties:{},children:[l]};return e.patch(n,c),e.applyData(n,c)}function Hs(e,n){let t={type:"element",tagName:"h"+n.depth,properties:{},children:e.all(n)};return e.patch(n,t),e.applyData(n,t)}function Vs(e,n){if(e.options.allowDangerousHtml){let t={type:"raw",value:n.value};return e.patch(n,t),e.applyData(n,t)}}function oi(e,n){let t=n.referenceType,i="]";if(t==="collapsed"?i+="[]":t==="full"&&(i+="["+(n.label||n.identifier)+"]"),n.type==="imageReference")return[{type:"text",value:"!["+n.alt+i}];let r=e.all(n),a=r[0];a&&a.type==="text"?a.value="["+a.value:r.unshift({type:"text",value:"["});let o=r[r.length-1];return o&&o.type==="text"?o.value+=i:r.push({type:"text",value:i}),r}function Ws(e,n){let t=String(n.identifier).toUpperCase(),i=e.definitionById.get(t);if(!i)return oi(e,n);let r={src:ke(i.url||""),alt:n.alt};i.title!==null&&i.title!==void 0&&(r.title=i.title);let a={type:"element",tagName:"img",properties:r,children:[]};return e.patch(n,a),e.applyData(n,a)}function js(e,n){let t={src:ke(n.url)};n.alt!==null&&n.alt!==void 0&&(t.alt=n.alt),n.title!==null&&n.title!==void 0&&(t.title=n.title);let i={type:"element",tagName:"img",properties:t,children:[]};return e.patch(n,i),e.applyData(n,i)}function qs(e,n){let t={type:"text",value:n.value.replace(/\r?\n|\r/g," ")};e.patch(n,t);let i={type:"element",tagName:"code",properties:{},children:[t]};return e.patch(n,i),e.applyData(n,i)}function Ks(e,n){let t=String(n.identifier).toUpperCase(),i=e.definitionById.get(t);if(!i)return oi(e,n);let r={href:ke(i.url||"")};i.title!==null&&i.title!==void 0&&(r.title=i.title);let a={type:"element",tagName:"a",properties:r,children:e.all(n)};return e.patch(n,a),e.applyData(n,a)}function Xs(e,n){let t={href:ke(n.url)};n.title!==null&&n.title!==void 0&&(t.title=n.title);let i={type:"element",tagName:"a",properties:t,children:e.all(n)};return e.patch(n,i),e.applyData(n,i)}function Ys(e,n,t){let i=e.all(n),r=t?Nm(t):Js(n),a={},o=[];if(typeof n.checked=="boolean"){let u=i[0],d;u&&u.type==="element"&&u.tagName==="p"?d=u:(d={type:"element",tagName:"p",properties:{},children:[]},i.unshift(d)),d.children.length>0&&d.children.unshift({type:"text",value:" "}),d.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:n.checked,disabled:!0},children:[]}),a.className=["task-list-item"]}let s=-1;for(;++s<i.length;){let u=i[s];(r||s!==0||u.type!=="element"||u.tagName!=="p")&&o.push({type:"text",value:`
3440
3446
  `}),u.type==="element"&&u.tagName==="p"&&!r?o.push(...u.children):o.push(u)}let l=i[i.length-1];l&&(r||l.type!=="element"||l.tagName!=="p")&&o.push({type:"text",value:`
3441
- `});let c={type:"element",tagName:"li",properties:a,children:o};return e.patch(n,c),e.applyData(n,c)}function Lm(e){let n=!1;if(e.type==="list"){n=e.spread||!1;let t=e.children,i=-1;for(;!n&&++i<t.length;)n=Js(t[i])}return n}function Js(e){let n=e.spread;return n??e.children.length>1}function Zs(e,n){let t={},i=e.all(n),r=-1;for(typeof n.start=="number"&&n.start!==1&&(t.start=n.start);++r<i.length;){let o=i[r];if(o.type==="element"&&o.tagName==="li"&&o.properties&&Array.isArray(o.properties.className)&&o.properties.className.includes("task-list-item")){t.className=["contains-task-list"];break}}let a={type:"element",tagName:n.ordered?"ol":"ul",properties:t,children:e.wrap(i,!0)};return e.patch(n,a),e.applyData(n,a)}function $s(e,n){let t={type:"element",tagName:"p",properties:{},children:e.all(n)};return e.patch(n,t),e.applyData(n,t)}function Qs(e,n){let t={type:"root",children:e.wrap(e.all(n))};return e.patch(n,t),e.applyData(n,t)}function el(e,n){let t={type:"element",tagName:"strong",properties:{},children:e.all(n)};return e.patch(n,t),e.applyData(n,t)}var si=tl("end"),li=tl("start");function tl(e){return n;function n(t){let i=t&&t.position&&t.position[e]||{};if(typeof i.line=="number"&&i.line>0&&typeof i.column=="number"&&i.column>0)return{line:i.line,column:i.column,offset:typeof i.offset=="number"&&i.offset>-1?i.offset:void 0}}}function Yr(e){let n=li(e),t=si(e);if(n&&t)return{start:n,end:t}}function nl(e,n){let t=e.all(n),i=t.shift(),r=[];if(i){let o={type:"element",tagName:"thead",properties:{},children:e.wrap([i],!0)};e.patch(n.children[0],o),r.push(o)}if(t.length>0){let o={type:"element",tagName:"tbody",properties:{},children:e.wrap(t,!0)},s=li(n.children[1]),l=si(n.children[n.children.length-1]);s&&l&&(o.position={start:s,end:l}),r.push(o)}let a={type:"element",tagName:"table",properties:{},children:e.wrap(r,!0)};return e.patch(n,a),e.applyData(n,a)}function il(e,n,t){let i=t?t.children:void 0,a=(i?i.indexOf(n):1)===0?"th":"td",o=t&&t.type==="table"?t.align:void 0,s=o?o.length:n.children.length,l=-1,c=[];for(;++l<s;){let d=n.children[l],m={},p=o?o[l]:void 0;p&&(m.align=p);let f={type:"element",tagName:a,properties:m,children:[]};d&&(f.children=e.all(d),e.patch(d,f),f=e.applyData(d,f)),c.push(f)}let u={type:"element",tagName:"tr",properties:{},children:e.wrap(c,!0)};return e.patch(n,u),e.applyData(n,u)}function rl(e,n){let t={type:"element",tagName:"td",properties:{},children:e.all(n)};return e.patch(n,t),e.applyData(n,t)}function ol(e){let n=String(e),t=/\r?\n|\r/g,i=t.exec(n),r=0,a=[];for(;i;)a.push(al(n.slice(r,i.index),r>0,!0),i[0]),r=i.index+i[0].length,i=t.exec(n);return a.push(al(n.slice(r),r>0,!1)),a.join("")}function al(e,n,t){let i=0,r=e.length;if(n){let a=e.codePointAt(i);for(;a===9||a===32;)i++,a=e.codePointAt(i)}if(t){let a=e.codePointAt(r-1);for(;a===9||a===32;)r--,a=e.codePointAt(r-1)}return r>i?e.slice(i,r):""}function sl(e,n){let t={type:"text",value:ol(String(n.value))};return e.patch(n,t),e.applyData(n,t)}function ll(e,n){let t={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(n,t),e.applyData(n,t)}var cl={blockquote:Os,break:Bs,code:Fs,delete:Gs,emphasis:zs,footnoteReference:Us,heading:Hs,html:Vs,imageReference:Ws,image:js,inlineCode:qs,linkReference:Ks,link:Xs,listItem:Ys,list:Zs,paragraph:$s,root:Qs,strong:el,table:nl,tableCell:rl,tableRow:il,text:sl,thematicBreak:ll,toml:ci,yaml:ci,definition:ci,footnoteDefinition:ci};function ci(){}function Nm(e,n){let t=[{type:"text",value:"\u21A9"}];return n>1&&t.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(n)}]}),t}function Mm(e,n){return"Back to reference "+(e+1)+(n>1?"-"+n:"")}function ul(e){let n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",t=e.options.footnoteBackContent||Nm,i=e.options.footnoteBackLabel||Mm,r=e.options.footnoteLabel||"Footnotes",a=e.options.footnoteLabelTagName||"h2",o=e.options.footnoteLabelProperties||{className:["sr-only"]},s=[],l=-1;for(;++l<e.footnoteOrder.length;){let c=e.footnoteById.get(e.footnoteOrder[l]);if(!c)continue;let u=e.all(c),d=String(c.identifier).toUpperCase(),m=ke(d.toLowerCase()),p=0,f=[],_=e.footnoteCounts.get(d);for(;_!==void 0&&++p<=_;){f.length>0&&f.push({type:"text",value:" "});let T=typeof t=="string"?t:t(l,p);typeof T=="string"&&(T={type:"text",value:T}),f.push({type:"element",tagName:"a",properties:{href:"#"+n+"fnref-"+m+(p>1?"-"+p:""),dataFootnoteBackref:"",ariaLabel:typeof i=="string"?i:i(l,p),className:["data-footnote-backref"]},children:Array.isArray(T)?T:[T]})}let E=u[u.length-1];if(E&&E.type==="element"&&E.tagName==="p"){let T=E.children[E.children.length-1];T&&T.type==="text"?T.value+=" ":E.children.push({type:"text",value:" "}),E.children.push(...f)}else u.push(...f);let y={type:"element",tagName:"li",properties:{id:n+"fn-"+m},children:e.wrap(u,!0)};e.patch(c,y),s.push(y)}if(s.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:a,properties:{...Pe(o),id:"footnote-label"},children:[{type:"text",value:r}]},{type:"text",value:`
3447
+ `});let c={type:"element",tagName:"li",properties:a,children:o};return e.patch(n,c),e.applyData(n,c)}function Nm(e){let n=!1;if(e.type==="list"){n=e.spread||!1;let t=e.children,i=-1;for(;!n&&++i<t.length;)n=Js(t[i])}return n}function Js(e){let n=e.spread;return n??e.children.length>1}function Zs(e,n){let t={},i=e.all(n),r=-1;for(typeof n.start=="number"&&n.start!==1&&(t.start=n.start);++r<i.length;){let o=i[r];if(o.type==="element"&&o.tagName==="li"&&o.properties&&Array.isArray(o.properties.className)&&o.properties.className.includes("task-list-item")){t.className=["contains-task-list"];break}}let a={type:"element",tagName:n.ordered?"ol":"ul",properties:t,children:e.wrap(i,!0)};return e.patch(n,a),e.applyData(n,a)}function $s(e,n){let t={type:"element",tagName:"p",properties:{},children:e.all(n)};return e.patch(n,t),e.applyData(n,t)}function Qs(e,n){let t={type:"root",children:e.wrap(e.all(n))};return e.patch(n,t),e.applyData(n,t)}function el(e,n){let t={type:"element",tagName:"strong",properties:{},children:e.all(n)};return e.patch(n,t),e.applyData(n,t)}var si=tl("end"),li=tl("start");function tl(e){return n;function n(t){let i=t&&t.position&&t.position[e]||{};if(typeof i.line=="number"&&i.line>0&&typeof i.column=="number"&&i.column>0)return{line:i.line,column:i.column,offset:typeof i.offset=="number"&&i.offset>-1?i.offset:void 0}}}function Yr(e){let n=li(e),t=si(e);if(n&&t)return{start:n,end:t}}function nl(e,n){let t=e.all(n),i=t.shift(),r=[];if(i){let o={type:"element",tagName:"thead",properties:{},children:e.wrap([i],!0)};e.patch(n.children[0],o),r.push(o)}if(t.length>0){let o={type:"element",tagName:"tbody",properties:{},children:e.wrap(t,!0)},s=li(n.children[1]),l=si(n.children[n.children.length-1]);s&&l&&(o.position={start:s,end:l}),r.push(o)}let a={type:"element",tagName:"table",properties:{},children:e.wrap(r,!0)};return e.patch(n,a),e.applyData(n,a)}function il(e,n,t){let i=t?t.children:void 0,a=(i?i.indexOf(n):1)===0?"th":"td",o=t&&t.type==="table"?t.align:void 0,s=o?o.length:n.children.length,l=-1,c=[];for(;++l<s;){let d=n.children[l],m={},p=o?o[l]:void 0;p&&(m.align=p);let f={type:"element",tagName:a,properties:m,children:[]};d&&(f.children=e.all(d),e.patch(d,f),f=e.applyData(d,f)),c.push(f)}let u={type:"element",tagName:"tr",properties:{},children:e.wrap(c,!0)};return e.patch(n,u),e.applyData(n,u)}function rl(e,n){let t={type:"element",tagName:"td",properties:{},children:e.all(n)};return e.patch(n,t),e.applyData(n,t)}function ol(e){let n=String(e),t=/\r?\n|\r/g,i=t.exec(n),r=0,a=[];for(;i;)a.push(al(n.slice(r,i.index),r>0,!0),i[0]),r=i.index+i[0].length,i=t.exec(n);return a.push(al(n.slice(r),r>0,!1)),a.join("")}function al(e,n,t){let i=0,r=e.length;if(n){let a=e.codePointAt(i);for(;a===9||a===32;)i++,a=e.codePointAt(i)}if(t){let a=e.codePointAt(r-1);for(;a===9||a===32;)r--,a=e.codePointAt(r-1)}return r>i?e.slice(i,r):""}function sl(e,n){let t={type:"text",value:ol(String(n.value))};return e.patch(n,t),e.applyData(n,t)}function ll(e,n){let t={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(n,t),e.applyData(n,t)}var cl={blockquote:Os,break:Bs,code:Fs,delete:Gs,emphasis:zs,footnoteReference:Us,heading:Hs,html:Vs,imageReference:Ws,image:js,inlineCode:qs,linkReference:Ks,link:Xs,listItem:Ys,list:Zs,paragraph:$s,root:Qs,strong:el,table:nl,tableCell:rl,tableRow:il,text:sl,thematicBreak:ll,toml:ci,yaml:ci,definition:ci,footnoteDefinition:ci};function ci(){}function Lm(e,n){let t=[{type:"text",value:"\u21A9"}];return n>1&&t.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(n)}]}),t}function Mm(e,n){return"Back to reference "+(e+1)+(n>1?"-"+n:"")}function ul(e){let n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",t=e.options.footnoteBackContent||Lm,i=e.options.footnoteBackLabel||Mm,r=e.options.footnoteLabel||"Footnotes",a=e.options.footnoteLabelTagName||"h2",o=e.options.footnoteLabelProperties||{className:["sr-only"]},s=[],l=-1;for(;++l<e.footnoteOrder.length;){let c=e.footnoteById.get(e.footnoteOrder[l]);if(!c)continue;let u=e.all(c),d=String(c.identifier).toUpperCase(),m=ke(d.toLowerCase()),p=0,f=[],_=e.footnoteCounts.get(d);for(;_!==void 0&&++p<=_;){f.length>0&&f.push({type:"text",value:" "});let T=typeof t=="string"?t:t(l,p);typeof T=="string"&&(T={type:"text",value:T}),f.push({type:"element",tagName:"a",properties:{href:"#"+n+"fnref-"+m+(p>1?"-"+p:""),dataFootnoteBackref:"",ariaLabel:typeof i=="string"?i:i(l,p),className:["data-footnote-backref"]},children:Array.isArray(T)?T:[T]})}let E=u[u.length-1];if(E&&E.type==="element"&&E.tagName==="p"){let T=E.children[E.children.length-1];T&&T.type==="text"?T.value+=" ":E.children.push({type:"text",value:" "}),E.children.push(...f)}else u.push(...f);let y={type:"element",tagName:"li",properties:{id:n+"fn-"+m},children:e.wrap(u,!0)};e.patch(c,y),s.push(y)}if(s.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:a,properties:{...Pe(o),id:"footnote-label"},children:[{type:"text",value:r}]},{type:"text",value:`
3442
3448
  `},{type:"element",tagName:"ol",properties:{},children:e.wrap(s,!0)},{type:"text",value:`
3443
3449
  `}]}}var Jr={}.hasOwnProperty,Om={};function pl(e,n){let t=n||Om,i=new Map,r=new Map,a=new Map,o={...cl,...t.handlers},s={all:c,applyData:Fm,definitionById:i,footnoteById:r,footnoteCounts:a,footnoteOrder:[],handlers:o,one:l,options:t,patch:Bm,wrap:zm};return qt(e,function(u){if(u.type==="definition"||u.type==="footnoteDefinition"){let d=u.type==="definition"?i:r,m=String(u.identifier).toUpperCase();d.has(m)||d.set(m,u)}}),s;function l(u,d){let m=u.type,p=s.handlers[m];if(Jr.call(s.handlers,m)&&p)return p(s,u,d);if(s.options.passThrough&&s.options.passThrough.includes(m)){if("children"in u){let{children:_,...E}=u,y=Pe(E);return y.children=s.all(u),y}return Pe(u)}return(s.options.unknownHandler||Gm)(s,u,d)}function c(u){let d=[];if("children"in u){let m=u.children,p=-1;for(;++p<m.length;){let f=s.one(m[p],u);if(f){if(p&&m[p-1].type==="break"&&(!Array.isArray(f)&&f.type==="text"&&(f.value=dl(f.value)),!Array.isArray(f)&&f.type==="element")){let _=f.children[0];_&&_.type==="text"&&(_.value=dl(_.value))}Array.isArray(f)?d.push(...f):d.push(f)}}}return d}}function Bm(e,n){e.position&&(n.position=Yr(e))}function Fm(e,n){let t=n;if(e&&e.data){let i=e.data.hName,r=e.data.hChildren,a=e.data.hProperties;if(typeof i=="string")if(t.type==="element")t.tagName=i;else{let o="children"in t?t.children:[t];t={type:"element",tagName:i,properties:{},children:o}}t.type==="element"&&a&&Object.assign(t.properties,Pe(a)),"children"in t&&t.children&&r!==null&&r!==void 0&&(t.children=r)}return t}function Gm(e,n){let t=n.data||{},i="value"in n&&!(Jr.call(t,"hProperties")||Jr.call(t,"hChildren"))?{type:"text",value:n.value}:{type:"element",tagName:"div",properties:{},children:e.all(n)};return e.patch(n,i),e.applyData(n,i)}function zm(e,n){let t=[],i=-1;for(n&&t.push({type:"text",value:`
3444
3450
  `});++i<e.length;)i&&t.push({type:"text",value:`
@@ -3531,7 +3537,7 @@ extractions:`+JSON.stringify(r))||"";o=o.replace(/```json/g,"").replace(/```/g,"
3531
3537
  <div class='llm-selector-item-icon' style="background-image: url('${i.icon}'); "></div>
3532
3538
  <div class='llm-selector-item-name'>${i.name}</div>
3533
3539
  <div class='llm-selector-item-provider'>${i.provider}</div>
3534
- `,r.addEventListener("click",a=>{this.dispatchEvent(new CustomEvent("select",{detail:i.id}))}),t.appendChild(r)}}};sn.observedAttributes=["open"];var At=new q("ONNXModel"),Ie=class e{constructor(n){this.stateTensors={};this.constantTensors={};this._runActive=!1;this.ignoreIfBusy=!1;this.session=n,At.debug(`Model input parameters: ${n.inputNames.join(", ")}`),At.debug(`Model output parameters: ${n.outputNames.join(", ")}`)}static isSupported(){return!!e.lib}static async load(n){if(!e.lib)throw new Error("ONNX runtime not loaded, please set the runtime loader. Example: ONNXModel.lib = () => import('onnxruntime-web')");this.onnx||(At.debug("Loading ONNX runtime"),this.onnx=await e.lib()),At.debug(`Loading model: ${n}`);let t=await this.onnx.InferenceSession.create(n);return new e(t)}makeTensor(n,t,i=0){let r=1;for(let o of t)r*=o;let a;if(n=="float32")a=new e.onnx.Tensor(new Float32Array(r),t);else if(n=="int8")a=new e.onnx.Tensor(new Int8Array(r),t);else if(n=="int16")a=new e.onnx.Tensor(new Int16Array(r),t);else if(n=="int32")a=new e.onnx.Tensor(new Int32Array(r),t);else if(n=="int64")a=new e.onnx.Tensor(new BigInt64Array(r),t);else if(n=="uint8")a=new e.onnx.Tensor(new Uint8Array(r),t);else if(n=="uint16")a=new e.onnx.Tensor(new Uint16Array(r),t);else if(n=="uint32")a=new e.onnx.Tensor(new Uint32Array(r),t);else if(n=="uint64")a=new e.onnx.Tensor(new BigUint64Array(r),t);else throw new Error(`Invalid type: ${n}`);return i!==0&&(n=="int64"||n=="uint64")?a.data.fill(BigInt(i)):i!==0&&a.data.fill(i),a}registerConstant(n,t){if(!this.session.inputNames.includes(n))throw new Error(`Model does not have an input named: ${n}`);return this.constantTensors[n]=t,t}makeConstant(n,t,i,r=0){return this.registerConstant(n,this.makeTensor(t,i,r))}registerState(n,t,i){if(t||(t=n),!this.session.inputNames.includes(n))throw new Error(`Model does not have an input named: ${n}`);if(!this.session.outputNames.includes(t))throw new Error(`Model does not have an output named: ${t}`);return this.stateTensors[n]={outputName:t,tensor:i},i}makeState(n,t,i,r,a=0){return this.registerState(n,t,this.makeTensor(i,r,a))}async run(n={}){if(this._runActive&&this.ignoreIfBusy)return At.debug("Ignoring run request because a previous run is still active");if(this._runActive)throw new Error("A previous run is still active");this._runActive=!0;for(let t in this.stateTensors)n[t]=this.stateTensors[t].tensor;for(let t in this.constantTensors)n[t]=this.constantTensors[t];try{let t=await this.session.run(n);for(let i in this.stateTensors){let r=t[this.stateTensors[i].outputName];this.stateTensors[i].tensor=r}return t}finally{this._runActive=!1}}resetState(){At.debug("Resetting state tensors");for(let n in this.stateTensors)this.stateTensors[n].tensor.data.fill(0)}};var Il="data:application/javascript;base64,dmFyIGM9Y2xhc3N7Y29uc3RydWN0b3IoaSx0KXt0aGlzLm91dHB1dEJ1ZmZlclNpemU9MDt0aGlzLnBhcnRpYWxCdWZmZXJzPVtdO3RoaXMucGFydGlhbEJ1ZmZlck9mZnNldD0wO2lmKCFpKXRocm93IG5ldyBFcnJvcihgSW52YWxpZCBhcnJheSBjbGFzczogJHtpfWApO2lmKCF0fHx0PD0wKXRocm93IG5ldyBFcnJvcihgSW52YWxpZCBvdXRwdXQgYnVmZmVyIHNpemU6ICR7dH1gKTt0aGlzLkFycmF5Q2xhc3M9aSx0aGlzLm91dHB1dEJ1ZmZlclNpemU9dH1nZXQgcXVldWVkU2l6ZSgpe3JldHVybiB0aGlzLnBhcnRpYWxCdWZmZXJzLnJlZHVjZSgoaSx0KT0+aSt0Lmxlbmd0aCwwKX1mZWVkKGkpe3RoaXMucGFydGlhbEJ1ZmZlcnMucHVzaChpKX1nZXQgY2FuRHJhaW4oKXtyZXR1cm4gdGhpcy5wYXJ0aWFsQnVmZmVycy5yZWR1Y2UoKHQscik9PnQrci5sZW5ndGgsMCktdGhpcy5wYXJ0aWFsQnVmZmVyT2Zmc2V0Pj10aGlzLm91dHB1dEJ1ZmZlclNpemV9ZHJhaW4oKXtpZighdGhpcy5jYW5EcmFpbilyZXR1cm4gbnVsbDtsZXQgaT10aGlzLkFycmF5Q2xhc3MsdD1uZXcgaSh0aGlzLm91dHB1dEJ1ZmZlclNpemUpLHI9MDtmb3IoO3IhPXQubGVuZ3RoOyl7aWYocj50Lmxlbmd0aCl0aHJvdyBuZXcgRXJyb3IoYEJ1ZmZlciBvdmVyZmxvdzogJHtyfSA+ICR7dC5sZW5ndGh9YCk7bGV0IGE9dC5sZW5ndGgtcixzPXRoaXMucGFydGlhbEJ1ZmZlcnNbMF0sZj1zLmxlbmd0aC10aGlzLnBhcnRpYWxCdWZmZXJPZmZzZXQ7ZjxhPyh0LnNldChzLnN1YmFycmF5KHRoaXMucGFydGlhbEJ1ZmZlck9mZnNldCkscikscis9Zix0aGlzLnBhcnRpYWxCdWZmZXJzLnNoaWZ0KCksdGhpcy5wYXJ0aWFsQnVmZmVyT2Zmc2V0PTApOih0LnNldChzLnN1YmFycmF5KHRoaXMucGFydGlhbEJ1ZmZlck9mZnNldCx0aGlzLnBhcnRpYWxCdWZmZXJPZmZzZXQrYSkscikscis9YSx0aGlzLnBhcnRpYWxCdWZmZXJPZmZzZXQrPWEpfXJldHVybiB0fXBhZCgpe2xldCBpPXRoaXMucXVldWVkU2l6ZSV0aGlzLm91dHB1dEJ1ZmZlclNpemU7aWYoaT09MClyZXR1cm47bGV0IHQ9dGhpcy5BcnJheUNsYXNzLHI9bmV3IHQoaSk7dGhpcy5mZWVkKHIpfX07dmFyIGQ9Y2xhc3N7Y29uc3RydWN0b3IoaSx0LHIsYSl7aWYoIWl8fCF0fHwhcil0aHJvdyBuZXcgRXJyb3IoIkludmFsaWQgc2V0dGluZ3Mgc3BlY2lmaWVkIGZvciB0aGUgcmVzYW1wbGVyLiIpO3RoaXMucmVzYW1wbGVyPW51bGwsdGhpcy5mcm9tU2FtcGxlUmF0ZT1pLHRoaXMudG9TYW1wbGVSYXRlPXQsdGhpcy5jaGFubmVscz1yfHwwLHRoaXMuaW5wdXRCdWZmZXJTaXplPWEsdGhpcy5pbml0aWFsaXplKCl9aW5pdGlhbGl6ZSgpe3RoaXMuZnJvbVNhbXBsZVJhdGU9PXRoaXMudG9TYW1wbGVSYXRlPyh0aGlzLnJlc2FtcGxlcj1pPT5pLHRoaXMucmF0aW9XZWlnaHQ9MSk6KHRoaXMuZnJvbVNhbXBsZVJhdGU8dGhpcy50b1NhbXBsZVJhdGU/KHRoaXMubGluZWFySW50ZXJwb2xhdGlvbigpLHRoaXMubGFzdFdlaWdodD0xKToodGhpcy5tdWx0aVRhcCgpLHRoaXMudGFpbEV4aXN0cz0hMSx0aGlzLmxhc3RXZWlnaHQ9MCksdGhpcy5pbml0aWFsaXplQnVmZmVycygpLHRoaXMucmF0aW9XZWlnaHQ9dGhpcy5mcm9tU2FtcGxlUmF0ZS90aGlzLnRvU2FtcGxlUmF0ZSl9YnVmZmVyU2xpY2UoaSl7dHJ5e3JldHVybiB0aGlzLm91dHB1dEJ1ZmZlci5zdWJhcnJheSgwLGkpfWNhdGNoe3RyeXtyZXR1cm4gdGhpcy5vdXRwdXRCdWZmZXIubGVuZ3RoPWksdGhpcy5vdXRwdXRCdWZmZXJ9Y2F0Y2h7cmV0dXJuIHRoaXMub3V0cHV0QnVmZmVyLnNsaWNlKDAsaSl9fX1pbml0aWFsaXplQnVmZmVycygpe3RoaXMub3V0cHV0QnVmZmVyU2l6ZT1NYXRoLmNlaWwodGhpcy5pbnB1dEJ1ZmZlclNpemUqdGhpcy50b1NhbXBsZVJhdGUvdGhpcy5mcm9tU2FtcGxlUmF0ZS90aGlzLmNoYW5uZWxzKjEuMDAwMDAwNDc2ODM3MTU4MikrdGhpcy5jaGFubmVscyt0aGlzLmNoYW5uZWxzO3RyeXt0aGlzLm91dHB1dEJ1ZmZlcj1uZXcgRmxvYXQzMkFycmF5KHRoaXMub3V0cHV0QnVmZmVyU2l6ZSksdGhpcy5sYXN0T3V0cHV0PW5ldyBGbG9hdDMyQXJyYXkodGhpcy5jaGFubmVscyl9Y2F0Y2h7dGhpcy5vdXRwdXRCdWZmZXI9W10sdGhpcy5sYXN0T3V0cHV0PVtdfX1saW5lYXJJbnRlcnBvbGF0aW9uKCl7dGhpcy5yZXNhbXBsZXI9aT0+e2xldCB0PWkubGVuZ3RoLHI9dGhpcy5jaGFubmVscyxhLHMsZixoLGUsbix1LG8sbDtpZih0JXIhPT0wKXRocm93IG5ldyBFcnJvcigiQnVmZmVyIHdhcyBvZiBpbmNvcnJlY3Qgc2FtcGxlIGxlbmd0aC4iKTtpZih0PD0wKXJldHVybltdO2ZvcihhPXRoaXMub3V0cHV0QnVmZmVyU2l6ZSxzPXRoaXMucmF0aW9XZWlnaHQsZj10aGlzLmxhc3RXZWlnaHQsaD0wLGU9MCxuPTAsdT0wLG89dGhpcy5vdXRwdXRCdWZmZXI7ZjwxO2YrPXMpZm9yKGU9ZiUxLGg9MS1lLHRoaXMubGFzdFdlaWdodD1mJTEsbD0wO2w8dGhpcy5jaGFubmVsczsrK2wpb1t1KytdPXRoaXMubGFzdE91dHB1dFtsXSpoK2lbbF0qZTtmb3IoZi09MSx0LT1yLG49TWF0aC5mbG9vcihmKSpyO3U8YSYmbjx0Oyl7Zm9yKGU9ZiUxLGg9MS1lLGw9MDtsPHRoaXMuY2hhbm5lbHM7KytsKW9bdSsrXT1pW24rKGw+MD9sOjApXSpoK2lbbisocitsKV0qZTtmKz1zLG49TWF0aC5mbG9vcihmKSpyfWZvcihsPTA7bDxyOysrbCl0aGlzLmxhc3RPdXRwdXRbbF09aVtuKytdO3JldHVybiB0aGlzLmJ1ZmZlclNsaWNlKHUpfX1tdWx0aVRhcCgpe3RoaXMucmVzYW1wbGVyPWk9PntsZXQgdD1pLmxlbmd0aCxyLGEscz10aGlzLmNoYW5uZWxzLGYsaCxlLG4sdSxvLGwsbSxnO2lmKHQlcyE9PTApdGhyb3cgbmV3IEVycm9yKCJCdWZmZXIgd2FzIG9mIGluY29ycmVjdCBzYW1wbGUgbGVuZ3RoLiIpO2lmKHQ8PTApcmV0dXJuW107Zm9yKHI9dGhpcy5vdXRwdXRCdWZmZXJTaXplLGE9W10sZj10aGlzLnJhdGlvV2VpZ2h0LGg9MCxuPTAsdT0wLG89IXRoaXMudGFpbEV4aXN0cyx0aGlzLnRhaWxFeGlzdHM9ITEsbD10aGlzLm91dHB1dEJ1ZmZlcixtPTAsZz0wLGU9MDtlPHM7KytlKWFbZV09MDtkb3tpZihvKWZvcihoPWYsZT0wO2U8czsrK2UpYVtlXT0wO2Vsc2V7Zm9yKGg9dGhpcy5sYXN0V2VpZ2h0LGU9MDtlPHM7KytlKWFbZV09dGhpcy5sYXN0T3V0cHV0W2VdO289ITB9Zm9yKDtoPjAmJm48dDspaWYodT0xK24tZyxoPj11KXtmb3IoZT0wO2U8czsrK2UpYVtlXSs9aVtuKytdKnU7Zz1uLGgtPXV9ZWxzZXtmb3IoZT0wO2U8czsrK2UpYVtlXSs9aVtuKyhlPjA/ZTowKV0qaDtnKz1oLGg9MDticmVha31pZihoPT09MClmb3IoZT0wO2U8czsrK2UpbFttKytdPWFbZV0vZjtlbHNle2Zvcih0aGlzLmxhc3RXZWlnaHQ9aCxlPTA7ZTxzOysrZSl0aGlzLmxhc3RPdXRwdXRbZV09YVtlXTt0aGlzLnRhaWxFeGlzdHM9ITA7YnJlYWt9fXdoaWxlKG48dCYmbTxyKTtyZXR1cm4gdGhpcy5idWZmZXJTbGljZShtKX19cmVzYW1wbGUoaSl7cmV0dXJuIHRoaXMuZnJvbVNhbXBsZVJhdGU9PXRoaXMudG9TYW1wbGVSYXRlP3RoaXMucmF0aW9XZWlnaHQ9MToodGhpcy5mcm9tU2FtcGxlUmF0ZTx0aGlzLnRvU2FtcGxlUmF0ZT90aGlzLmxhc3RXZWlnaHQ9MToodGhpcy50YWlsRXhpc3RzPSExLHRoaXMubGFzdFdlaWdodD0wKSx0aGlzLmluaXRpYWxpemVCdWZmZXJzKCksdGhpcy5yYXRpb1dlaWdodD10aGlzLmZyb21TYW1wbGVSYXRlL3RoaXMudG9TYW1wbGVSYXRlKSx0aGlzLnJlc2FtcGxlcihpKX19O2Z1bmN0aW9uIFMocCl7bGV0IGk9cC5sZW5ndGgsdD1uZXcgRmxvYXQzMkFycmF5KGkpO2Zvcig7aS0tOyl7bGV0IHI9cFtpXTt0W2ldPXI+PTMyNzY4Py0oNjU1MzYtcikvMzI3Njg6ci8zMjc2N31yZXR1cm4gdH12YXIgeT0xMDI0KjgsQj1jbGFzcyBleHRlbmRzIEF1ZGlvV29ya2xldFByb2Nlc3Nvcntjb25zdHJ1Y3Rvcih0KXtzdXBlcih0KTt0aGlzLmNodW5rcz1bXTt0aGlzLmNodW5rUG9zaXRpb249MDt0aGlzLmlzRW5kZWQ9ITE7dGhpcy5pc0NhbmNlbGxlZD0hMTt0aGlzLnNhbXBsZVJhdGU9MDt0aGlzLmZvcm1hdD0iaW50MTYiO3RoaXMuYnVmZmVyT2Zmc2V0PTA7dGhpcy5sYXN0UGxheWVkQnVmZmVyU2l6ZT0wO3RoaXMuX2hhc1NlbnRFbmRFdmVudD0hMTt0aGlzLnBvcnQub25tZXNzYWdlPXI9PnRoaXMub25NZXNzYWdlKHIpfW9uTWVzc2FnZSh0KXtpZih0LmRhdGEuYWN0aW9uPT0ic3RhcnQiKXRoaXMuZm9ybWF0PXQuZGF0YS5mb3JtYXQsdGhpcy5zYW1wbGVSYXRlPXQuZGF0YS5pbnB1dFNhbXBsZVJhdGUsdGhpcy5yZXNhbXBsZXI9bmV3IGQodC5kYXRhLmlucHV0U2FtcGxlUmF0ZSx0LmRhdGEub3V0cHV0U2FtcGxlUmF0ZSwxLHkpLHRoaXMuZm9ybWF0PT0iaW50MTYiP3RoaXMuaW5wdXRCdWZmZXI9bmV3IGMoVWludDhBcnJheSx5KjIpOnRoaXMuZm9ybWF0PT0iZmxvYXQzMiImJih0aGlzLmlucHV0QnVmZmVyPW5ldyBjKFVpbnQ4QXJyYXkseSo0KSk7ZWxzZSBpZih0LmRhdGEuYWN0aW9uPT0iZGF0YSIpe2xldCByPW5ldyBVaW50OEFycmF5KHQuZGF0YS5idWZmZXIpO2Zvcih0aGlzLmlucHV0QnVmZmVyLmZlZWQocik7dGhpcy5pbnB1dEJ1ZmZlci5jYW5EcmFpbjspdGhpcy5kcmFpbkJ1ZmZlcigpfWVsc2UgdC5kYXRhLmFjdGlvbj09ImVuZCI/KHRoaXMubGFzdFBsYXllZEJ1ZmZlclNpemUmJnRoaXMuY2h1bmtzLnB1c2gobmV3IEZsb2F0MzJBcnJheSh0aGlzLmxhc3RQbGF5ZWRCdWZmZXJTaXplKjIpKSx0aGlzLmlzRW5kZWQ9ITApOnQuZGF0YS5hY3Rpb249PSJjYW5jZWwiJiYodGhpcy5pc0VuZGVkPSEwLHRoaXMuaXNDYW5jZWxsZWQ9ITApfWRyYWluQnVmZmVyKCl7bGV0IHQ9dGhpcy5pbnB1dEJ1ZmZlci5kcmFpbigpO2lmKCF0KXJldHVybjtsZXQgcjtpZih0aGlzLmZvcm1hdD09ImludDE2Iil7bGV0IHM9bmV3IEludDE2QXJyYXkodC5idWZmZXIsdC5ieXRlT2Zmc2V0LHQuYnl0ZUxlbmd0aC8yKTtyPVMocyl9ZWxzZSBpZih0aGlzLmZvcm1hdD09ImZsb2F0MzIiKXI9bmV3IEZsb2F0MzJBcnJheSh0LmJ1ZmZlcix0LmJ5dGVPZmZzZXQsdC5ieXRlTGVuZ3RoLzQpO2Vsc2UgdGhyb3cgbmV3IEVycm9yKGBJbnZhbGlkIGZvcm1hdDogJHt0aGlzLmZvcm1hdH1gKTtsZXQgYT10aGlzLnJlc2FtcGxlci5yZXNhbXBsZShyKTt0aGlzLmNodW5rcy5wdXNoKGEpfW5leHRGbG9hdCgpe2lmKCF0aGlzLmNodW5rcy5sZW5ndGgpcmV0dXJuIDA7bGV0IHQ9dGhpcy5jaHVua3NbMF1bdGhpcy5jaHVua1Bvc2l0aW9uXTtyZXR1cm4gdGhpcy5jaHVua1Bvc2l0aW9uKyssdGhpcy5jaHVua1Bvc2l0aW9uPHRoaXMuY2h1bmtzWzBdLmxlbmd0aHx8KHRoaXMuY2h1bmtzLnNoaWZ0KCksdGhpcy5jaHVua1Bvc2l0aW9uPTApLHR9cHJvY2Vzcyh0LHIsYSl7aWYodGhpcy5pc0NhbmNlbGxlZClyZXR1cm4hMTtpZih0aGlzLmlzRW5kZWQmJiF0aGlzLmNodW5rcy5sZW5ndGgpcmV0dXJuIHRoaXMuX2hhc1NlbnRFbmRFdmVudHx8KHRoaXMuX2hhc1NlbnRFbmRFdmVudD0hMCx0aGlzLnBvcnQucG9zdE1lc3NhZ2Uoe2FjdGlvbjoiZW5kIn0pKSwhMTtsZXQgcz1yWzBdPy5bMF0/Lmxlbmd0aDtpZighcylyZXR1cm4hMDt0aGlzLmxhc3RQbGF5ZWRCdWZmZXJTaXplPXM7Zm9yKGxldCBmPTA7ZjxzO2YrKyl7bGV0IGg9dGhpcy5uZXh0RmxvYXQoKTtmb3IobGV0IGU9MDtlPHIubGVuZ3RoO2UrKylmb3IobGV0IG49MDtuPHJbZV0ubGVuZ3RoO24rKylyW2VdW25dW2ZdPWh9cmV0dXJuITB9fTtyZWdpc3RlclByb2Nlc3NvcigicGNtLXBsYXllci1ub2RlIixCKTsK";var Rl="data:application/javascript;base64,dmFyIGc9Y2xhc3N7Y29uc3RydWN0b3IoZSx0LGksZil7aWYoIWV8fCF0fHwhaSl0aHJvdyBuZXcgRXJyb3IoIkludmFsaWQgc2V0dGluZ3Mgc3BlY2lmaWVkIGZvciB0aGUgcmVzYW1wbGVyLiIpO3RoaXMucmVzYW1wbGVyPW51bGwsdGhpcy5mcm9tU2FtcGxlUmF0ZT1lLHRoaXMudG9TYW1wbGVSYXRlPXQsdGhpcy5jaGFubmVscz1pfHwwLHRoaXMuaW5wdXRCdWZmZXJTaXplPWYsdGhpcy5pbml0aWFsaXplKCl9aW5pdGlhbGl6ZSgpe3RoaXMuZnJvbVNhbXBsZVJhdGU9PXRoaXMudG9TYW1wbGVSYXRlPyh0aGlzLnJlc2FtcGxlcj1lPT5lLHRoaXMucmF0aW9XZWlnaHQ9MSk6KHRoaXMuZnJvbVNhbXBsZVJhdGU8dGhpcy50b1NhbXBsZVJhdGU/KHRoaXMubGluZWFySW50ZXJwb2xhdGlvbigpLHRoaXMubGFzdFdlaWdodD0xKToodGhpcy5tdWx0aVRhcCgpLHRoaXMudGFpbEV4aXN0cz0hMSx0aGlzLmxhc3RXZWlnaHQ9MCksdGhpcy5pbml0aWFsaXplQnVmZmVycygpLHRoaXMucmF0aW9XZWlnaHQ9dGhpcy5mcm9tU2FtcGxlUmF0ZS90aGlzLnRvU2FtcGxlUmF0ZSl9YnVmZmVyU2xpY2UoZSl7dHJ5e3JldHVybiB0aGlzLm91dHB1dEJ1ZmZlci5zdWJhcnJheSgwLGUpfWNhdGNoe3RyeXtyZXR1cm4gdGhpcy5vdXRwdXRCdWZmZXIubGVuZ3RoPWUsdGhpcy5vdXRwdXRCdWZmZXJ9Y2F0Y2h7cmV0dXJuIHRoaXMub3V0cHV0QnVmZmVyLnNsaWNlKDAsZSl9fX1pbml0aWFsaXplQnVmZmVycygpe3RoaXMub3V0cHV0QnVmZmVyU2l6ZT1NYXRoLmNlaWwodGhpcy5pbnB1dEJ1ZmZlclNpemUqdGhpcy50b1NhbXBsZVJhdGUvdGhpcy5mcm9tU2FtcGxlUmF0ZS90aGlzLmNoYW5uZWxzKjEuMDAwMDAwNDc2ODM3MTU4MikrdGhpcy5jaGFubmVscyt0aGlzLmNoYW5uZWxzO3RyeXt0aGlzLm91dHB1dEJ1ZmZlcj1uZXcgRmxvYXQzMkFycmF5KHRoaXMub3V0cHV0QnVmZmVyU2l6ZSksdGhpcy5sYXN0T3V0cHV0PW5ldyBGbG9hdDMyQXJyYXkodGhpcy5jaGFubmVscyl9Y2F0Y2h7dGhpcy5vdXRwdXRCdWZmZXI9W10sdGhpcy5sYXN0T3V0cHV0PVtdfX1saW5lYXJJbnRlcnBvbGF0aW9uKCl7dGhpcy5yZXNhbXBsZXI9ZT0+e2xldCB0PWUubGVuZ3RoLGk9dGhpcy5jaGFubmVscyxmLGgsYSxzLHIsdSxuLHAsbDtpZih0JWkhPT0wKXRocm93IG5ldyBFcnJvcigiQnVmZmVyIHdhcyBvZiBpbmNvcnJlY3Qgc2FtcGxlIGxlbmd0aC4iKTtpZih0PD0wKXJldHVybltdO2ZvcihmPXRoaXMub3V0cHV0QnVmZmVyU2l6ZSxoPXRoaXMucmF0aW9XZWlnaHQsYT10aGlzLmxhc3RXZWlnaHQscz0wLHI9MCx1PTAsbj0wLHA9dGhpcy5vdXRwdXRCdWZmZXI7YTwxO2ErPWgpZm9yKHI9YSUxLHM9MS1yLHRoaXMubGFzdFdlaWdodD1hJTEsbD0wO2w8dGhpcy5jaGFubmVsczsrK2wpcFtuKytdPXRoaXMubGFzdE91dHB1dFtsXSpzK2VbbF0qcjtmb3IoYS09MSx0LT1pLHU9TWF0aC5mbG9vcihhKSppO248ZiYmdTx0Oyl7Zm9yKHI9YSUxLHM9MS1yLGw9MDtsPHRoaXMuY2hhbm5lbHM7KytsKXBbbisrXT1lW3UrKGw+MD9sOjApXSpzK2VbdSsoaStsKV0qcjthKz1oLHU9TWF0aC5mbG9vcihhKSppfWZvcihsPTA7bDxpOysrbCl0aGlzLmxhc3RPdXRwdXRbbF09ZVt1KytdO3JldHVybiB0aGlzLmJ1ZmZlclNsaWNlKG4pfX1tdWx0aVRhcCgpe3RoaXMucmVzYW1wbGVyPWU9PntsZXQgdD1lLmxlbmd0aCxpLGYsaD10aGlzLmNoYW5uZWxzLGEscyxyLHUsbixwLGwsbSxCO2lmKHQlaCE9PTApdGhyb3cgbmV3IEVycm9yKCJCdWZmZXIgd2FzIG9mIGluY29ycmVjdCBzYW1wbGUgbGVuZ3RoLiIpO2lmKHQ8PTApcmV0dXJuW107Zm9yKGk9dGhpcy5vdXRwdXRCdWZmZXJTaXplLGY9W10sYT10aGlzLnJhdGlvV2VpZ2h0LHM9MCx1PTAsbj0wLHA9IXRoaXMudGFpbEV4aXN0cyx0aGlzLnRhaWxFeGlzdHM9ITEsbD10aGlzLm91dHB1dEJ1ZmZlcixtPTAsQj0wLHI9MDtyPGg7KytyKWZbcl09MDtkb3tpZihwKWZvcihzPWEscj0wO3I8aDsrK3IpZltyXT0wO2Vsc2V7Zm9yKHM9dGhpcy5sYXN0V2VpZ2h0LHI9MDtyPGg7KytyKWZbcl09dGhpcy5sYXN0T3V0cHV0W3JdO3A9ITB9Zm9yKDtzPjAmJnU8dDspaWYobj0xK3UtQixzPj1uKXtmb3Iocj0wO3I8aDsrK3IpZltyXSs9ZVt1KytdKm47Qj11LHMtPW59ZWxzZXtmb3Iocj0wO3I8aDsrK3IpZltyXSs9ZVt1KyhyPjA/cjowKV0qcztCKz1zLHM9MDticmVha31pZihzPT09MClmb3Iocj0wO3I8aDsrK3IpbFttKytdPWZbcl0vYTtlbHNle2Zvcih0aGlzLmxhc3RXZWlnaHQ9cyxyPTA7cjxoOysrcil0aGlzLmxhc3RPdXRwdXRbcl09ZltyXTt0aGlzLnRhaWxFeGlzdHM9ITA7YnJlYWt9fXdoaWxlKHU8dCYmbTxpKTtyZXR1cm4gdGhpcy5idWZmZXJTbGljZShtKX19cmVzYW1wbGUoZSl7cmV0dXJuIHRoaXMuZnJvbVNhbXBsZVJhdGU9PXRoaXMudG9TYW1wbGVSYXRlP3RoaXMucmF0aW9XZWlnaHQ9MToodGhpcy5mcm9tU2FtcGxlUmF0ZTx0aGlzLnRvU2FtcGxlUmF0ZT90aGlzLmxhc3RXZWlnaHQ9MToodGhpcy50YWlsRXhpc3RzPSExLHRoaXMubGFzdFdlaWdodD0wKSx0aGlzLmluaXRpYWxpemVCdWZmZXJzKCksdGhpcy5yYXRpb1dlaWdodD10aGlzLmZyb21TYW1wbGVSYXRlL3RoaXMudG9TYW1wbGVSYXRlKSx0aGlzLnJlc2FtcGxlcihlKX19O2Z1bmN0aW9uIGQobyl7bGV0IGU9by5sZW5ndGgsdD1uZXcgSW50MTZBcnJheShlKTtmb3IoO2UtLTspe2xldCBpPU1hdGgubWF4KC0xLE1hdGgubWluKDEsb1tlXSkpO3RbZV09aTwwP2kqMzI3Njg6aSozMjc2N31yZXR1cm4gdH1mdW5jdGlvbiB3KG8pe2xldCBlPW8ubGVuZ3RoLHQ9bmV3IEJpZ0ludDY0QXJyYXkoZSk7Zm9yKDtlLS07KXtsZXQgaT1NYXRoLm1heCgtMSxNYXRoLm1pbigxLG9bZV0pKTt0W2VdPUJpZ0ludChNYXRoLmZsb29yKGk8MD9pKjMyNzY4OmkqMzI3NjcpKSoweDEwMDAwMDAwMDAwMG59cmV0dXJuIHR9dmFyIGM9Y2xhc3N7Y29uc3RydWN0b3IoZSx0KXt0aGlzLm91dHB1dEJ1ZmZlclNpemU9MDt0aGlzLnBhcnRpYWxCdWZmZXJzPVtdO3RoaXMucGFydGlhbEJ1ZmZlck9mZnNldD0wO2lmKCFlKXRocm93IG5ldyBFcnJvcihgSW52YWxpZCBhcnJheSBjbGFzczogJHtlfWApO2lmKCF0fHx0PD0wKXRocm93IG5ldyBFcnJvcihgSW52YWxpZCBvdXRwdXQgYnVmZmVyIHNpemU6ICR7dH1gKTt0aGlzLkFycmF5Q2xhc3M9ZSx0aGlzLm91dHB1dEJ1ZmZlclNpemU9dH1nZXQgcXVldWVkU2l6ZSgpe3JldHVybiB0aGlzLnBhcnRpYWxCdWZmZXJzLnJlZHVjZSgoZSx0KT0+ZSt0Lmxlbmd0aCwwKX1mZWVkKGUpe3RoaXMucGFydGlhbEJ1ZmZlcnMucHVzaChlKX1nZXQgY2FuRHJhaW4oKXtyZXR1cm4gdGhpcy5wYXJ0aWFsQnVmZmVycy5yZWR1Y2UoKHQsaSk9PnQraS5sZW5ndGgsMCktdGhpcy5wYXJ0aWFsQnVmZmVyT2Zmc2V0Pj10aGlzLm91dHB1dEJ1ZmZlclNpemV9ZHJhaW4oKXtpZighdGhpcy5jYW5EcmFpbilyZXR1cm4gbnVsbDtsZXQgZT10aGlzLkFycmF5Q2xhc3MsdD1uZXcgZSh0aGlzLm91dHB1dEJ1ZmZlclNpemUpLGk9MDtmb3IoO2khPXQubGVuZ3RoOyl7aWYoaT50Lmxlbmd0aCl0aHJvdyBuZXcgRXJyb3IoYEJ1ZmZlciBvdmVyZmxvdzogJHtpfSA+ICR7dC5sZW5ndGh9YCk7bGV0IGY9dC5sZW5ndGgtaSxoPXRoaXMucGFydGlhbEJ1ZmZlcnNbMF0sYT1oLmxlbmd0aC10aGlzLnBhcnRpYWxCdWZmZXJPZmZzZXQ7YTxmPyh0LnNldChoLnN1YmFycmF5KHRoaXMucGFydGlhbEJ1ZmZlck9mZnNldCksaSksaSs9YSx0aGlzLnBhcnRpYWxCdWZmZXJzLnNoaWZ0KCksdGhpcy5wYXJ0aWFsQnVmZmVyT2Zmc2V0PTApOih0LnNldChoLnN1YmFycmF5KHRoaXMucGFydGlhbEJ1ZmZlck9mZnNldCx0aGlzLnBhcnRpYWxCdWZmZXJPZmZzZXQrZiksaSksaSs9Zix0aGlzLnBhcnRpYWxCdWZmZXJPZmZzZXQrPWYpfXJldHVybiB0fXBhZCgpe2xldCBlPXRoaXMucXVldWVkU2l6ZSV0aGlzLm91dHB1dEJ1ZmZlclNpemU7aWYoZT09MClyZXR1cm47bGV0IHQ9dGhpcy5BcnJheUNsYXNzLGk9bmV3IHQoZSk7dGhpcy5mZWVkKGkpfX07dmFyIHk9Y2xhc3MgZXh0ZW5kcyBBdWRpb1dvcmtsZXRQcm9jZXNzb3J7Y29uc3RydWN0b3IodCl7c3VwZXIodCk7dGhpcy5mb3JtYXQ9ImludDE2Ijt0aGlzLmlucHV0QnVmZmVyPW5ldyBjKEZsb2F0MzJBcnJheSw0MDk2KTt0aGlzLnBvcnQub25tZXNzYWdlPWk9PnRoaXMub25NZXNzYWdlKGkpfW9uTWVzc2FnZSh0KXt0LmRhdGEuYWN0aW9uPT0ic3RhcnQiJiYodGhpcy5mb3JtYXQ9dC5kYXRhLmZvcm1hdCx0aGlzLnJlc2FtcGxlcj1uZXcgZyh0LmRhdGEuaW5wdXRTYW1wbGVSYXRlLHQuZGF0YS5vdXRwdXRTYW1wbGVSYXRlLDEsNDA5NiksdGhpcy5mb3JtYXQ9PSJpbnQxNiI/dGhpcy5vdXRwdXRCdWZmZXI9bmV3IGMoSW50MTZBcnJheSx0LmRhdGEuYnVmZmVyU2l6ZSk6dGhpcy5mb3JtYXQ9PSJpbnQ2NCI/dGhpcy5vdXRwdXRCdWZmZXI9bmV3IGMoQmlnSW50NjRBcnJheSx0LmRhdGEuYnVmZmVyU2l6ZSk6dGhpcy5mb3JtYXQ9PSJmbG9hdDMyIiYmKHRoaXMub3V0cHV0QnVmZmVyPW5ldyBjKEZsb2F0MzJBcnJheSx0LmRhdGEuYnVmZmVyU2l6ZSkpKX1wcm9jZXNzKHQsaSxmKXtmb3IobGV0IGE9MDthPGkubGVuZ3RoO2ErKyl7bGV0IHM9TWF0aC5taW4oaVthXS5sZW5ndGgsdFswXS5sZW5ndGgpO2ZvcihsZXQgcj0wO3I8cztyKyspaVthXVtyXS5zZXQodFswXVtyXSl9aWYoIXRoaXMucmVzYW1wbGVyKXJldHVybiEwO2xldCBoPW5ldyBGbG9hdDMyQXJyYXkoaVswXVswXS5sZW5ndGgpO2ZvcihoLnNldChpWzBdWzBdKSx0aGlzLmlucHV0QnVmZmVyLmZlZWQoaCk7dGhpcy5pbnB1dEJ1ZmZlci5jYW5EcmFpbjspe2xldCBhPXRoaXMuaW5wdXRCdWZmZXIuZHJhaW4oKSxzPXRoaXMucmVzYW1wbGVyLnJlc2FtcGxlKGEpO3RoaXMuZm9ybWF0PT0iaW50MTYiP3RoaXMub3V0cHV0QnVmZmVyLmZlZWQoZChzKSk6dGhpcy5mb3JtYXQ9PSJpbnQ2NCI/dGhpcy5vdXRwdXRCdWZmZXIuZmVlZCh3KHMpKTp0aGlzLmZvcm1hdD09ImZsb2F0MzIiJiZ0aGlzLm91dHB1dEJ1ZmZlci5mZWVkKHMpfWZvcig7dGhpcy5vdXRwdXRCdWZmZXIuY2FuRHJhaW47KXtsZXQgYT10aGlzLm91dHB1dEJ1ZmZlci5kcmFpbigpO2lmKCFhKWJyZWFrO3RoaXMucG9ydC5wb3N0TWVzc2FnZSh7YWN0aW9uOiJkYXRhIixidWZmZXI6YS5idWZmZXJ9LFthLmJ1ZmZlcl0pfXJldHVybiEwfX07cmVnaXN0ZXJQcm9jZXNzb3IoInBjbS1yZWNlaXZlci1ub2RlIix5KTsK";var ng=new q("PCMPlayerNode"),hi=class extends AudioWorkletNode{constructor(t,i,r){super(t,"pcm-player-node",{numberOfInputs:0});this.sampleRate=0;this.format="int16";this.isCancelled=!1;if(!i||i<=0)throw new Error(`Invalid sample rate: ${i}`);if(!r||r!="int16"&&r!="float32")throw new Error(`Invalid format: ${r}`);this.sampleRate=i,this.format=r,this.port.onmessage=a=>this.onWorkletMessage(a),this.port.postMessage({action:"start",inputSampleRate:i,outputSampleRate:t.sampleRate,format:r})}feed(t){this.port.postMessage({action:"data",buffer:t.buffer},[t.buffer])}async play(t){if(this.isCancelled)throw new Error("PCMPlayerNode has already been cancelled.");if(this._playPromise)throw new Error("Already playing a stream");this._playPromise=new Promise(i=>this._playPromiseResolve=i),this.dispatchEvent(new CustomEvent("start",{detail:{player:this,stream:t}}));try{let i=t.getReader();for(;!this.isCancelled;){let{done:r,value:a}=await i.read();if(r||!a)break;this.feed(a)}}catch(i){ng.warn("Stream error:",i),this.dispatchEvent(new CustomEvent("error",{detail:{player:this,stream:t,error:i}}))}this.port.postMessage({action:"end"}),await this._playPromise}onWorkletMessage(t){t.data.action=="end"&&(this._playPromiseResolve?.(),this.dispatchEvent(new CustomEvent("end",{detail:{player:this}})))}stop(){this.isCancelled=!0,this.port.postMessage({action:"cancel"}),this._playPromiseResolve?.()}};var fi=new q("SpeechOutput"),Pl=.5,ig=.8,yi=class extends EventTarget{constructor(n){super(),this.ai=n,this.ai.addEventListener("output",t=>this.onTextOutputFromAI(t)),this.ai.audio?.speechRecognition.addEventListener("speechstart",t=>this.interrupt()),this.ai.knowledgeBase.registerSource(()=>[{id:"system.voice",type:"info",name:"Voice active",isContext:!0,disabled:!1,content:"Text-to-speech is active. The user can hear your voice."}])}onTextOutputFromAI(n){n.detail.isChunk||this.ai?.audio?.speechRecognition.isRunning&&this.speak(n.detail.message)}async speak(n){if(!this.ai?.config?.voice?.providerID)return fi.warn("No voice provider configured");let t=`speech-${rg++}`;await this.ai.audio.beginAccess(t);try{await this._speakWithLock(n)}finally{this.ai.audio.endAccess(t)}}async _speakWithLock(n){this.interrupt(),this.ai.audio.speechRecognition.voiceDetection&&(this.ai.audio.speechRecognition.voiceDetection.sensitivity=ig);let t=this.ai?._voiceTracker||fi.timer(`${this.ai.config.voice.providerID} voice`);t(`Speak: ${n}`),this.currentPlayerVolume?.disconnect(),this.currentPlayerVolume=this.ai.audio.context.createGain(),this.currentPlayerVolume.connect(this.ai.audio.context.destination);let i=this.currentPlayerVolume,r=new hi(this.ai.audio.context,24e3,"int16");this.currentPlayer=r,r.connect(i),r.addEventListener("end",o=>{let s=o;t(`PCM stream ${s.detail.interrupted?"interrupted":"ended"}`),this.currentPlayer==r&&!s.detail.interrupted&&(this.currentPlayer=void 0,this.onSpeechEnd())});let a;if(this.ai.config.voice.providerID=="openai")a=await fetch("https://api.openai.com/v1/audio/speech",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.ai.config.voice.apiKey}`},body:JSON.stringify({model:"tts-1",input:n,voice:this.ai.config.voice.voiceID,response_format:"pcm"})});else if(this.ai.config.voice.providerID=="elevenlabs")a=await fetch(`https://api.elevenlabs.io/v1/text-to-speech/${this.ai.config.voice.voiceID}?output_format=pcm_24000`,{method:"POST",headers:{"xi-api-key":`${this.ai.config.voice.apiKey}`,"Content-Type":"application/json"},body:JSON.stringify({text:n})});else{fi.warn(`Unknown voice provider: ${this.ai.config.voice.providerID}`);return}if(t(`Received response ${a.status} ${a.statusText}`),!a.ok){fi.warn(`Failed to generate voice sample: ${a.status} ${a.statusText}`);return}this.dispatchEvent(new CustomEvent("speechstart",{detail:{ai:this.ai,message:n}})),t("Playing PCM stream"),await r.play(a.body),t("Audio has ended")}get isSpeaking(){return!!this.currentPlayer}async interrupt(){if(!this.currentPlayerVolume)return;let n=this.currentPlayerVolume,t=this.currentPlayer;this.currentPlayerVolume=void 0,this.currentPlayer=void 0,this.ai?.audio?.speechRecognition.voiceDetection&&(this.ai.audio.speechRecognition.voiceDetection.sensitivity=Pl);let i=400;n.gain.linearRampToValueAtTime(0,i/1e3),await new Promise(r=>setTimeout(r,i+250)),n.disconnect(),t?.stop(),t?.disconnect()}onSpeechEnd(){this.dispatchEvent(new CustomEvent("speechend",{detail:{ai:this.ai}})),this.ai?.audio?.speechRecognition.voiceDetection&&(this.ai.audio.speechRecognition.voiceDetection.sensitivity=Pl)}},rg=1;function bi(e,n){let t=n.reduce((l,c)=>l+c.byteLength,0),i=new DataView(new ArrayBuffer(44));i.setUint8(0,82),i.setUint8(1,73),i.setUint8(2,70),i.setUint8(3,70),i.setUint32(4,44+t,!0),i.setUint8(8,87),i.setUint8(9,65),i.setUint8(10,86),i.setUint8(11,69);let r=1,a=32,o=r*a/8,s=e*o;return i.setUint8(12,102),i.setUint8(13,109),i.setUint8(14,116),i.setUint8(15,32),i.setUint32(16,16,!0),i.setUint16(20,3,!0),i.setUint16(22,r,!0),i.setUint32(24,e,!0),i.setUint32(28,s,!0),i.setUint16(32,o,!0),i.setUint16(34,a,!0),i.setUint8(36,100),i.setUint8(37,97),i.setUint8(38,116),i.setUint8(39,97),i.setUint32(40,t,!0),new File([i,...n],"audio.wav",{type:"audio/wav"})}var vi=class extends AudioWorkletNode{constructor(t,i,r,a){super(t,"pcm-receiver-node",{numberOfInputs:1});this.format="int16";this.format=r;let o=["int16","int64","float32"];if(!i||i<=0)throw new Error(`Invalid sample rate: ${i}`);if(!o.includes(r))throw new Error(`Invalid format ${r}, must be one of: ${o.join(", ")}`);if(!a||a<=0)throw new Error(`Invalid buffer size: ${a}`);this.port.onmessage=s=>this.onWorkletMessage(s),this.port.postMessage({action:"start",inputSampleRate:t.sampleRate,outputSampleRate:i,format:r,bufferSize:a})}onWorkletMessage(t){if(t.data.action=="data"){let i=null;if(this.format=="int16"&&(i=new Int16Array(t.data.buffer)),this.format=="int64"&&(i=new BigInt64Array(t.data.buffer)),this.format=="float32"&&(i=new Float32Array(t.data.buffer)),!i)throw new Error(`Invalid format: ${this.format}`);this.onData(i),this.dispatchEvent(new CustomEvent("data",{detail:{data:i}}))}}onData(t){}};var sa=16e3,_i=256,xt=8,ln=new q("VoiceDetectionNode"),cn=class cn extends vi{constructor(t){super(t,sa,"float32",_i*xt);this.isVoiceActive=!1;this.lastVoiceActiveDate=0;this.voiceEndTimeout=50;this.sensitivity=.5;this.sentivityEnd=.2;this.nextVadReset=0;this.currentProbability=0;this._lastVoiceActive=!1;if(!cn.vadModelURL)throw new Error("VAD model url not set, please load it and set it to VoiceDetectionNode.vadModelURL");this.loadModel()}get isVoicePossiblyEnding(){return this.isVoiceActive&&this.currentProbability<this.sensitivity}get sampleRate(){return sa}get numberOfSamples(){return _i}get numberOfSampleChunks(){return xt}get outputBufferSize(){return _i*xt}get isModelLoaded(){return!!this.vad}async loadModel(){ln.debug("Loading VAD model"),this.vad=await Ie.load(cn.vadModelURL),this.vad.ignoreIfBusy=!0,ln.debug("Model loaded"),this.vad.makeConstant("sr","int64",[1],sa),this.vad.makeState("h","hn","float32",[2,xt,64]),this.vad.makeState("c","cn","float32",[2,xt,64])}async onData(t){if(this.vad)try{let i=await this.vad.run({input:new Ie.onnx.Tensor(t,[xt,_i])});if(!i)return;this.currentProbability=0;for(let o=0;o<i.output.data.length;o++)i.output.data[o]>this.currentProbability&&(this.currentProbability=i.output.data[o]);let r=this.isVoiceActive?this.sentivityEnd:this.sensitivity,a=this.currentProbability>r;if(!a&&this._lastVoiceActive&&(this.nextVadReset=Date.now(),this.vad.resetState()),this._lastVoiceActive=a,a&&!this.isVoiceActive?(this.lastVoiceActiveDate=Date.now(),this.isVoiceActive=!0,this.dispatchEvent(new CustomEvent("speechstart")),this.onSpeechStart(),ln.debug("Started speaking")):a?this.lastVoiceActiveDate=Date.now():!a&&this.isVoiceActive&&Date.now()<this.lastVoiceActiveDate+this.voiceEndTimeout||!a&&this.isVoiceActive&&(this.isVoiceActive=!1,this.dispatchEvent(new CustomEvent("speechend")),this.onSpeechEnd(),ln.debug("Stopped speaking after timeout")),!a){let o=Date.now();o>this.nextVadReset&&(this.nextVadReset=o+5e3,this.vad.resetState())}}catch(i){ln.error("VAD failed:",i)}}onSpeechStart(){}onSpeechEnd(){}};cn.vadModelURL="";var It=cn;var Dl=new q("VoiceChunkOutputNode"),Rt=class extends It{constructor(){super(...arguments);this.buffers=[];this.recordedBuffers=[];this._voiceRecording=!1;this.backBufferDurationSeconds=3}get bufferDuration(){return this.buffers.reduce((t,i)=>t+i.length,0)/8e3}async onData(t){if(await super.onData(t),this.isVoiceActive&&!this._voiceRecording){Dl.debug(`Voice detected, sending ${this.buffers.length} existing chunks`),this._voiceRecording=!0;for(let i of this.buffers)this.recordedBuffers.push(i),this.dispatchEvent(new CustomEvent("voicedata",{detail:{data:i,isFinal:!1}})),this.onVoiceChunk(i);this.recordedBuffers.push(t),this.dispatchEvent(new CustomEvent("voicedata",{detail:{data:t,isFinal:!1}})),this.onVoiceChunk(t),this.buffers=[]}else if(this.isVoiceActive)this.recordedBuffers.push(t),this.dispatchEvent(new CustomEvent("voicedata",{detail:{data:t,isFinal:!1}})),this.onVoiceChunk(t);else if(!this.isVoiceActive&&this._voiceRecording){this.recordedBuffers.push(t),this.dispatchEvent(new CustomEvent("voicedata",{detail:{data:t,isFinal:!0}})),this.onVoiceChunk(t),this._voiceRecording=!1;let i=this.recordedBuffers.reduce((r,a)=>r+a.length,0);Dl.debug(`Voice complete, recorded ${(i/8e3).toFixed(2)} seconds of audio, ${i*4/1024} KB of data`),this.dispatchEvent(new CustomEvent("voicedataend",{detail:{data:this.recordedBuffers}})),this.onVoiceEnd(this.recordedBuffers),this.recordedBuffers=[]}else for(this.buffers.push(t);this.bufferDuration>this.backBufferDurationSeconds;)this.buffers.shift()}onVoiceChunk(t){}onVoiceEnd(t){}};var Si=new q("OpenAITranscriptionNode"),Ei=class extends Rt{constructor(t,i){super(t);this.apiKey="";this.pendingBuffers=[];this.isTranscribing=!1;this.apiKey=i}async onVoiceEnd(t){let i=Si.timer("OpenAI Transcribe");this.isTranscribing=!0,this.pendingBuffers.push(...t);let r=bi(this.sampleRate,this.pendingBuffers);this.lastRequestAbortController?.abort(),this.lastRequestAbortController=new AbortController;let a="";try{let o=new FormData;o.append("file",r),o.append("model","whisper-1"),o.append("response_format","text");let s=await fetch("https://api.openai.com/v1/audio/transcriptions",{method:"POST",headers:{Authorization:`Bearer ${this.apiKey}`},body:o,signal:this.lastRequestAbortController.signal});if(!s.ok)throw new Error(`Failed to generate voice sample: ${s.status} ${s.statusText}`);i("Response received"),a=await s.text(),i("Content received: "+a),this.lastRequestAbortController=void 0}catch(o){Si.error(`Failed to transcribe speech: ${o.message}`);return}finally{this.isTranscribing=!1}if(this.pendingBuffers=[],!a)return Si.debug("Transcription complete, but no text was found");Si.debug(`Transcription: ${a}`),this.onVoiceTranscription(a),this.dispatchEvent(new CustomEvent("transcription",{detail:{text:a}}))}onVoiceTranscription(t){}};var Ci=class extends WebSocket{constructor(t){super(t);this.pendingData=[];this.addEventListener("open",()=>this._onOpen())}send(t){this.readyState==WebSocket.OPEN?super.send(t):this.pendingData.push(t)}_onOpen(){for(let t of this.pendingData)super.send(t);this.pendingData=[]}};var Ne=new q("IntelliWeaveTranscriptionNode"),ag="wss://speech.intelliweave.ai/api/v1/transcribe",wi=class wi extends Rt{constructor(t,i){super(t);this.apiAddress=ag;this.apiKey="";this.isTranscribing=!1;this.apiKey=i}async onVoiceChunk(t){this.isTranscribing=!0,this.ws?this.ws.send(t):(Ne.debug("Opening WebSocket connection"),this.ws=new Ci(this.apiAddress),this.ws.send(JSON.stringify({type:"hello",sampleRate:16e3,channels:1,format:"float32",apiKey:this.apiKey})),this.ws.send(t.buffer),this.ws.onopen=()=>{Ne.debug("WebSocket connection opened")},this.ws.addEventListener("message",r=>{let a=JSON.parse(r.data);if(a.error)return Ne.warn("Error: "+a.error);if(a.type!="transcription")return Ne.warn("Invalid response type",a);if(a.streaming&&!a.final)return Ne.debug("Partial transcription: "+a.partialText);if(this.isTranscribing=!1,!a.text.trim())return Ne.warn(`Empty transcription (${a.processingTime}ms)`);Ne.debug(`Transcription: ${a.text} (${a.processingTime}ms)`),this.onVoiceTranscription(a.text),this.dispatchEvent(new CustomEvent("transcription",{detail:{text:a.text}}))}),this.ws.addEventListener("close",()=>this.onSocketClose()),this.ws.addEventListener("error",r=>Ne.warn("WebSocket error")));let i=1e3*60*1;this.shutdownTimer&&clearTimeout(this.shutdownTimer),this.shutdownTimer=setTimeout(()=>{Ne.debug("Shutting down WebSocket connection"),this.ws?.close(),this.ws=void 0},i)}async onVoiceEnd(t){if(this.ws?.send(JSON.stringify({type:"end"})),wi.debugExportWav){let i=bi(this.sampleRate,t),r=document.createElement("a");r.href=URL.createObjectURL(i),r.download="recording.wav",r.click()}}onVoiceTranscription(t){}onSocketClose(){Ne.debug("WebSocket connection closed"),this.ws=void 0,this.isTranscribing=!1}};wi.debugExportWav=!1;var ki=wi;var la=new q("SpeechRecognition"),Ti=class extends EventTarget{constructor(t){super();this.isRunning=!1;this._skipEvents=!1;this.maxVolumeHeard=0;this.ai=t,this.ai.knowledgeBase.registerSource(()=>[{id:"system.microphone.enable",type:"action",name:"Enable or disable microphone",isContext:!0,content:`Starts or stops listening to input from the user through the microphone. ${this.isRunning?"Microphone access is currently enabled and you can hear the user.":"Microphone access is currently disabled."}.`,parameters:[{name:"enable",type:"boolean",description:"If true, enables the microphone. If false, disables it."}],action:async i=>{i.enable?await this.start():this.stop()}}])}get isSupported(){if(!Ie.lib||!this.ai?.vadModel||!He().AudioWorkletNode)return!1;if(this.ai?.config?.transcription?.providerID!="intelliweave"){if(!(this.ai?.config?.transcription?.providerID=="openai"&&this.ai.config?.transcription?.apiKey))return!1}return!0}async start(){if(!this.isSupported)throw new Error("Speech recognition not supported in this persona and browser.");if(!this.isRunning){this.isRunning=!0;try{await this.ai.audio.beginAccess("speech-recognition"),this.micStream=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1,echoCancellation:!0,autoGainControl:!0,noiseSuppression:!0}});let t=this.ai.audio.context.createMediaStreamSource(this.micStream);this.analyserNode=this.ai.audio.context.createAnalyser(),this.analyserNode.fftSize=32,t.connect(this.analyserNode),this.analyserBuffer=new Float32Array(this.analyserNode.fftSize),It.vadModelURL=URL.createObjectURL(this.ai.vadModel),this.ai?.config?.transcription?.providerID=="openai"?(this.voiceDetection=new Ei(this.ai.audio.context,this.ai.config.transcription.apiKey),t.connect(this.voiceDetection)):(this.voiceDetection=new ki(this.ai.audio.context,this.ai.apiKey),this.voiceDetection.apiAddress=this.ai?.config?.transcription?.url||this.voiceDetection.apiAddress,t.connect(this.voiceDetection)),this.voiceDetection.addEventListener("speechstart",i=>{this.ai._voiceTracker=la.timer("voice interaction","Speech started"),this.dispatchEvent(new CustomEvent(i.type,{detail:i.detail}))}),this.voiceDetection.addEventListener("speechend",i=>{this.ai._voiceTracker?.("Speech ended"),this.dispatchEvent(new CustomEvent(i.type,{detail:i.detail}))}),this.voiceDetection.addEventListener("transcription",i=>{this.ai._voiceTracker?.(`Transcription: ${i.detail.text}`),this.onTranscription(i)}),this._skipEvents||this.dispatchEvent(new CustomEvent("start",{detail:{speechRecognition:this}}))}catch(t){la.error("Failed to start speech recognition:",t),this.stop()}}}stop(){this.isRunning&&(this.isRunning=!1,this.ai.audio.endAccess("speech-recognition"),this.voiceDetection?.disconnect(),this.voiceDetection=void 0,this.micStream?.getTracks().forEach(t=>t.stop()),this.micStream=void 0,this.analyserNode=void 0,this.analyserBuffer=void 0,this._skipEvents||this.dispatchEvent(new CustomEvent("end",{detail:{speechRecognition:this}})))}get volumeLevel(){if(!this.analyserNode||!this.analyserBuffer)return 0;this.analyserNode.getFloatTimeDomainData(this.analyserBuffer);let t=0;for(let r of this.analyserBuffer)t+=r*r;let i=Math.sqrt(t/this.analyserBuffer.length);return i>this.maxVolumeHeard&&(this.maxVolumeHeard=i),this.maxVolumeHeard*=.999,this.maxVolumeHeard<.01&&(this.maxVolumeHeard=.01),Math.min(1,Math.max(0,i/this.maxVolumeHeard))}get wordsCurrentlyBeingSpoken(){return!!this.voiceDetection?.isVoiceActive}get isTranscribing(){return!!this.voiceDetection?.isTranscribing}onTranscription(t){let i=t.detail.text;la.debug("Heard:",i),this.dispatchEvent(new CustomEvent("speech",{detail:{transcript:i,isFinal:!0}}))}async reset(){if(this.isRunning){this._skipEvents=!0;try{this.stop(),await this.start(),this._skipEvents=!1}catch(t){throw this._skipEvents=!1,t}}}};var Ai=new q("AudioSystem"),Pt=class{constructor(n){this.locks=[];if(!n)throw new Error("AI reference is required. Please pass in the IntelliWeave instance to the constructor.");this.ai=n,this.ai.audio=this,this.speechRecognition=new Ti(this.ai),this.speechOutput=new yi(this.ai)}static get isSupported(){return!(!Ie.lib||!He().AudioWorkletNode)}async beginAccess(n){Ai.debug(`Began access for: ${n}`),this.locks.includes(n)||this.locks.push(n),!this.context&&(Ai.debug("Creating AudioContext"),this.context=new AudioContext({latencyHint:"interactive"}),this.context.resume(),await Promise.all([this.context.audioWorklet.addModule(Il),this.context.audioWorklet.addModule(Rl)]))}endAccess(n){Ai.debug(`Ended access for: ${n}`),this.locks=this.locks.filter(t=>t!=n),!this.locks.length&&(Ai.debug("Closing AudioContext"),this.context?.close(),this.context=void 0)}};var LT=new q("Stream");var lt=_a(ql(),1);var HT=new q("React");var VT=(0,lt.createContext)(void 0);var dn=new q("Embed"),ct=class extends be{constructor(){super();this.config={};this.suggestions=[];this.html=()=>`
3540
+ `,r.addEventListener("click",a=>{this.dispatchEvent(new CustomEvent("select",{detail:i.id}))}),t.appendChild(r)}}};sn.observedAttributes=["open"];var At=new q("ONNXModel"),Ie=class e{constructor(n){this.stateTensors={};this.constantTensors={};this._runActive=!1;this.ignoreIfBusy=!1;this.session=n,At.debug(`Model input parameters: ${n.inputNames.join(", ")}`),At.debug(`Model output parameters: ${n.outputNames.join(", ")}`)}static isSupported(){return!!e.lib}static async load(n){if(!e.lib)throw new Error("ONNX runtime not loaded, please set the runtime loader. Example: ONNXModel.lib = () => import('onnxruntime-web')");this.onnx||(At.debug("Loading ONNX runtime"),this.onnx=await e.lib()),At.debug(`Loading model: ${n}`);let t=await this.onnx.InferenceSession.create(n);return new e(t)}makeTensor(n,t,i=0){let r=1;for(let o of t)r*=o;let a;if(n=="float32")a=new e.onnx.Tensor(new Float32Array(r),t);else if(n=="int8")a=new e.onnx.Tensor(new Int8Array(r),t);else if(n=="int16")a=new e.onnx.Tensor(new Int16Array(r),t);else if(n=="int32")a=new e.onnx.Tensor(new Int32Array(r),t);else if(n=="int64")a=new e.onnx.Tensor(new BigInt64Array(r),t);else if(n=="uint8")a=new e.onnx.Tensor(new Uint8Array(r),t);else if(n=="uint16")a=new e.onnx.Tensor(new Uint16Array(r),t);else if(n=="uint32")a=new e.onnx.Tensor(new Uint32Array(r),t);else if(n=="uint64")a=new e.onnx.Tensor(new BigUint64Array(r),t);else throw new Error(`Invalid type: ${n}`);return i!==0&&(n=="int64"||n=="uint64")?a.data.fill(BigInt(i)):i!==0&&a.data.fill(i),a}registerConstant(n,t){if(!this.session.inputNames.includes(n))throw new Error(`Model does not have an input named: ${n}`);return this.constantTensors[n]=t,t}makeConstant(n,t,i,r=0){return this.registerConstant(n,this.makeTensor(t,i,r))}registerState(n,t,i){if(t||(t=n),!this.session.inputNames.includes(n))throw new Error(`Model does not have an input named: ${n}`);if(!this.session.outputNames.includes(t))throw new Error(`Model does not have an output named: ${t}`);return this.stateTensors[n]={outputName:t,tensor:i},i}makeState(n,t,i,r,a=0){return this.registerState(n,t,this.makeTensor(i,r,a))}async run(n={}){if(this._runActive&&this.ignoreIfBusy)return At.debug("Ignoring run request because a previous run is still active");if(this._runActive)throw new Error("A previous run is still active");this._runActive=!0;for(let t in this.stateTensors)n[t]=this.stateTensors[t].tensor;for(let t in this.constantTensors)n[t]=this.constantTensors[t];try{let t=await this.session.run(n);for(let i in this.stateTensors){let r=t[this.stateTensors[i].outputName];this.stateTensors[i].tensor=r}return t}finally{this._runActive=!1}}resetState(){At.debug("Resetting state tensors");for(let n in this.stateTensors)this.stateTensors[n].tensor.data.fill(0)}};var Il="data:application/javascript;base64,dmFyIGM9Y2xhc3N7Y29uc3RydWN0b3IoaSx0KXt0aGlzLm91dHB1dEJ1ZmZlclNpemU9MDt0aGlzLnBhcnRpYWxCdWZmZXJzPVtdO3RoaXMucGFydGlhbEJ1ZmZlck9mZnNldD0wO2lmKCFpKXRocm93IG5ldyBFcnJvcihgSW52YWxpZCBhcnJheSBjbGFzczogJHtpfWApO2lmKCF0fHx0PD0wKXRocm93IG5ldyBFcnJvcihgSW52YWxpZCBvdXRwdXQgYnVmZmVyIHNpemU6ICR7dH1gKTt0aGlzLkFycmF5Q2xhc3M9aSx0aGlzLm91dHB1dEJ1ZmZlclNpemU9dH1nZXQgcXVldWVkU2l6ZSgpe3JldHVybiB0aGlzLnBhcnRpYWxCdWZmZXJzLnJlZHVjZSgoaSx0KT0+aSt0Lmxlbmd0aCwwKX1mZWVkKGkpe3RoaXMucGFydGlhbEJ1ZmZlcnMucHVzaChpKX1nZXQgY2FuRHJhaW4oKXtyZXR1cm4gdGhpcy5wYXJ0aWFsQnVmZmVycy5yZWR1Y2UoKHQscik9PnQrci5sZW5ndGgsMCktdGhpcy5wYXJ0aWFsQnVmZmVyT2Zmc2V0Pj10aGlzLm91dHB1dEJ1ZmZlclNpemV9ZHJhaW4oKXtpZighdGhpcy5jYW5EcmFpbilyZXR1cm4gbnVsbDtsZXQgaT10aGlzLkFycmF5Q2xhc3MsdD1uZXcgaSh0aGlzLm91dHB1dEJ1ZmZlclNpemUpLHI9MDtmb3IoO3IhPXQubGVuZ3RoOyl7aWYocj50Lmxlbmd0aCl0aHJvdyBuZXcgRXJyb3IoYEJ1ZmZlciBvdmVyZmxvdzogJHtyfSA+ICR7dC5sZW5ndGh9YCk7bGV0IGE9dC5sZW5ndGgtcixzPXRoaXMucGFydGlhbEJ1ZmZlcnNbMF0sZj1zLmxlbmd0aC10aGlzLnBhcnRpYWxCdWZmZXJPZmZzZXQ7ZjxhPyh0LnNldChzLnN1YmFycmF5KHRoaXMucGFydGlhbEJ1ZmZlck9mZnNldCkscikscis9Zix0aGlzLnBhcnRpYWxCdWZmZXJzLnNoaWZ0KCksdGhpcy5wYXJ0aWFsQnVmZmVyT2Zmc2V0PTApOih0LnNldChzLnN1YmFycmF5KHRoaXMucGFydGlhbEJ1ZmZlck9mZnNldCx0aGlzLnBhcnRpYWxCdWZmZXJPZmZzZXQrYSkscikscis9YSx0aGlzLnBhcnRpYWxCdWZmZXJPZmZzZXQrPWEpfXJldHVybiB0fXBhZCgpe2xldCBpPXRoaXMucXVldWVkU2l6ZSV0aGlzLm91dHB1dEJ1ZmZlclNpemU7aWYoaT09MClyZXR1cm47bGV0IHQ9dGhpcy5BcnJheUNsYXNzLHI9bmV3IHQoaSk7dGhpcy5mZWVkKHIpfX07dmFyIGQ9Y2xhc3N7Y29uc3RydWN0b3IoaSx0LHIsYSl7aWYoIWl8fCF0fHwhcil0aHJvdyBuZXcgRXJyb3IoIkludmFsaWQgc2V0dGluZ3Mgc3BlY2lmaWVkIGZvciB0aGUgcmVzYW1wbGVyLiIpO3RoaXMucmVzYW1wbGVyPW51bGwsdGhpcy5mcm9tU2FtcGxlUmF0ZT1pLHRoaXMudG9TYW1wbGVSYXRlPXQsdGhpcy5jaGFubmVscz1yfHwwLHRoaXMuaW5wdXRCdWZmZXJTaXplPWEsdGhpcy5pbml0aWFsaXplKCl9aW5pdGlhbGl6ZSgpe3RoaXMuZnJvbVNhbXBsZVJhdGU9PXRoaXMudG9TYW1wbGVSYXRlPyh0aGlzLnJlc2FtcGxlcj1pPT5pLHRoaXMucmF0aW9XZWlnaHQ9MSk6KHRoaXMuZnJvbVNhbXBsZVJhdGU8dGhpcy50b1NhbXBsZVJhdGU/KHRoaXMubGluZWFySW50ZXJwb2xhdGlvbigpLHRoaXMubGFzdFdlaWdodD0xKToodGhpcy5tdWx0aVRhcCgpLHRoaXMudGFpbEV4aXN0cz0hMSx0aGlzLmxhc3RXZWlnaHQ9MCksdGhpcy5pbml0aWFsaXplQnVmZmVycygpLHRoaXMucmF0aW9XZWlnaHQ9dGhpcy5mcm9tU2FtcGxlUmF0ZS90aGlzLnRvU2FtcGxlUmF0ZSl9YnVmZmVyU2xpY2UoaSl7dHJ5e3JldHVybiB0aGlzLm91dHB1dEJ1ZmZlci5zdWJhcnJheSgwLGkpfWNhdGNoe3RyeXtyZXR1cm4gdGhpcy5vdXRwdXRCdWZmZXIubGVuZ3RoPWksdGhpcy5vdXRwdXRCdWZmZXJ9Y2F0Y2h7cmV0dXJuIHRoaXMub3V0cHV0QnVmZmVyLnNsaWNlKDAsaSl9fX1pbml0aWFsaXplQnVmZmVycygpe3RoaXMub3V0cHV0QnVmZmVyU2l6ZT1NYXRoLmNlaWwodGhpcy5pbnB1dEJ1ZmZlclNpemUqdGhpcy50b1NhbXBsZVJhdGUvdGhpcy5mcm9tU2FtcGxlUmF0ZS90aGlzLmNoYW5uZWxzKjEuMDAwMDAwNDc2ODM3MTU4MikrdGhpcy5jaGFubmVscyt0aGlzLmNoYW5uZWxzO3RyeXt0aGlzLm91dHB1dEJ1ZmZlcj1uZXcgRmxvYXQzMkFycmF5KHRoaXMub3V0cHV0QnVmZmVyU2l6ZSksdGhpcy5sYXN0T3V0cHV0PW5ldyBGbG9hdDMyQXJyYXkodGhpcy5jaGFubmVscyl9Y2F0Y2h7dGhpcy5vdXRwdXRCdWZmZXI9W10sdGhpcy5sYXN0T3V0cHV0PVtdfX1saW5lYXJJbnRlcnBvbGF0aW9uKCl7dGhpcy5yZXNhbXBsZXI9aT0+e2xldCB0PWkubGVuZ3RoLHI9dGhpcy5jaGFubmVscyxhLHMsZixoLGUsbix1LG8sbDtpZih0JXIhPT0wKXRocm93IG5ldyBFcnJvcigiQnVmZmVyIHdhcyBvZiBpbmNvcnJlY3Qgc2FtcGxlIGxlbmd0aC4iKTtpZih0PD0wKXJldHVybltdO2ZvcihhPXRoaXMub3V0cHV0QnVmZmVyU2l6ZSxzPXRoaXMucmF0aW9XZWlnaHQsZj10aGlzLmxhc3RXZWlnaHQsaD0wLGU9MCxuPTAsdT0wLG89dGhpcy5vdXRwdXRCdWZmZXI7ZjwxO2YrPXMpZm9yKGU9ZiUxLGg9MS1lLHRoaXMubGFzdFdlaWdodD1mJTEsbD0wO2w8dGhpcy5jaGFubmVsczsrK2wpb1t1KytdPXRoaXMubGFzdE91dHB1dFtsXSpoK2lbbF0qZTtmb3IoZi09MSx0LT1yLG49TWF0aC5mbG9vcihmKSpyO3U8YSYmbjx0Oyl7Zm9yKGU9ZiUxLGg9MS1lLGw9MDtsPHRoaXMuY2hhbm5lbHM7KytsKW9bdSsrXT1pW24rKGw+MD9sOjApXSpoK2lbbisocitsKV0qZTtmKz1zLG49TWF0aC5mbG9vcihmKSpyfWZvcihsPTA7bDxyOysrbCl0aGlzLmxhc3RPdXRwdXRbbF09aVtuKytdO3JldHVybiB0aGlzLmJ1ZmZlclNsaWNlKHUpfX1tdWx0aVRhcCgpe3RoaXMucmVzYW1wbGVyPWk9PntsZXQgdD1pLmxlbmd0aCxyLGEscz10aGlzLmNoYW5uZWxzLGYsaCxlLG4sdSxvLGwsbSxnO2lmKHQlcyE9PTApdGhyb3cgbmV3IEVycm9yKCJCdWZmZXIgd2FzIG9mIGluY29ycmVjdCBzYW1wbGUgbGVuZ3RoLiIpO2lmKHQ8PTApcmV0dXJuW107Zm9yKHI9dGhpcy5vdXRwdXRCdWZmZXJTaXplLGE9W10sZj10aGlzLnJhdGlvV2VpZ2h0LGg9MCxuPTAsdT0wLG89IXRoaXMudGFpbEV4aXN0cyx0aGlzLnRhaWxFeGlzdHM9ITEsbD10aGlzLm91dHB1dEJ1ZmZlcixtPTAsZz0wLGU9MDtlPHM7KytlKWFbZV09MDtkb3tpZihvKWZvcihoPWYsZT0wO2U8czsrK2UpYVtlXT0wO2Vsc2V7Zm9yKGg9dGhpcy5sYXN0V2VpZ2h0LGU9MDtlPHM7KytlKWFbZV09dGhpcy5sYXN0T3V0cHV0W2VdO289ITB9Zm9yKDtoPjAmJm48dDspaWYodT0xK24tZyxoPj11KXtmb3IoZT0wO2U8czsrK2UpYVtlXSs9aVtuKytdKnU7Zz1uLGgtPXV9ZWxzZXtmb3IoZT0wO2U8czsrK2UpYVtlXSs9aVtuKyhlPjA/ZTowKV0qaDtnKz1oLGg9MDticmVha31pZihoPT09MClmb3IoZT0wO2U8czsrK2UpbFttKytdPWFbZV0vZjtlbHNle2Zvcih0aGlzLmxhc3RXZWlnaHQ9aCxlPTA7ZTxzOysrZSl0aGlzLmxhc3RPdXRwdXRbZV09YVtlXTt0aGlzLnRhaWxFeGlzdHM9ITA7YnJlYWt9fXdoaWxlKG48dCYmbTxyKTtyZXR1cm4gdGhpcy5idWZmZXJTbGljZShtKX19cmVzYW1wbGUoaSl7cmV0dXJuIHRoaXMuZnJvbVNhbXBsZVJhdGU9PXRoaXMudG9TYW1wbGVSYXRlP3RoaXMucmF0aW9XZWlnaHQ9MToodGhpcy5mcm9tU2FtcGxlUmF0ZTx0aGlzLnRvU2FtcGxlUmF0ZT90aGlzLmxhc3RXZWlnaHQ9MToodGhpcy50YWlsRXhpc3RzPSExLHRoaXMubGFzdFdlaWdodD0wKSx0aGlzLmluaXRpYWxpemVCdWZmZXJzKCksdGhpcy5yYXRpb1dlaWdodD10aGlzLmZyb21TYW1wbGVSYXRlL3RoaXMudG9TYW1wbGVSYXRlKSx0aGlzLnJlc2FtcGxlcihpKX19O2Z1bmN0aW9uIFMocCl7bGV0IGk9cC5sZW5ndGgsdD1uZXcgRmxvYXQzMkFycmF5KGkpO2Zvcig7aS0tOyl7bGV0IHI9cFtpXTt0W2ldPXI+PTMyNzY4Py0oNjU1MzYtcikvMzI3Njg6ci8zMjc2N31yZXR1cm4gdH12YXIgeT0xMDI0KjgsQj1jbGFzcyBleHRlbmRzIEF1ZGlvV29ya2xldFByb2Nlc3Nvcntjb25zdHJ1Y3Rvcih0KXtzdXBlcih0KTt0aGlzLmNodW5rcz1bXTt0aGlzLmNodW5rUG9zaXRpb249MDt0aGlzLmlzRW5kZWQ9ITE7dGhpcy5pc0NhbmNlbGxlZD0hMTt0aGlzLnNhbXBsZVJhdGU9MDt0aGlzLmZvcm1hdD0iaW50MTYiO3RoaXMuYnVmZmVyT2Zmc2V0PTA7dGhpcy5sYXN0UGxheWVkQnVmZmVyU2l6ZT0wO3RoaXMuX2hhc1NlbnRFbmRFdmVudD0hMTt0aGlzLnBvcnQub25tZXNzYWdlPXI9PnRoaXMub25NZXNzYWdlKHIpfW9uTWVzc2FnZSh0KXtpZih0LmRhdGEuYWN0aW9uPT0ic3RhcnQiKXRoaXMuZm9ybWF0PXQuZGF0YS5mb3JtYXQsdGhpcy5zYW1wbGVSYXRlPXQuZGF0YS5pbnB1dFNhbXBsZVJhdGUsdGhpcy5yZXNhbXBsZXI9bmV3IGQodC5kYXRhLmlucHV0U2FtcGxlUmF0ZSx0LmRhdGEub3V0cHV0U2FtcGxlUmF0ZSwxLHkpLHRoaXMuZm9ybWF0PT0iaW50MTYiP3RoaXMuaW5wdXRCdWZmZXI9bmV3IGMoVWludDhBcnJheSx5KjIpOnRoaXMuZm9ybWF0PT0iZmxvYXQzMiImJih0aGlzLmlucHV0QnVmZmVyPW5ldyBjKFVpbnQ4QXJyYXkseSo0KSk7ZWxzZSBpZih0LmRhdGEuYWN0aW9uPT0iZGF0YSIpe2xldCByPW5ldyBVaW50OEFycmF5KHQuZGF0YS5idWZmZXIpO2Zvcih0aGlzLmlucHV0QnVmZmVyLmZlZWQocik7dGhpcy5pbnB1dEJ1ZmZlci5jYW5EcmFpbjspdGhpcy5kcmFpbkJ1ZmZlcigpfWVsc2UgdC5kYXRhLmFjdGlvbj09ImVuZCI/KHRoaXMubGFzdFBsYXllZEJ1ZmZlclNpemUmJnRoaXMuY2h1bmtzLnB1c2gobmV3IEZsb2F0MzJBcnJheSh0aGlzLmxhc3RQbGF5ZWRCdWZmZXJTaXplKjIpKSx0aGlzLmlzRW5kZWQ9ITApOnQuZGF0YS5hY3Rpb249PSJjYW5jZWwiJiYodGhpcy5pc0VuZGVkPSEwLHRoaXMuaXNDYW5jZWxsZWQ9ITApfWRyYWluQnVmZmVyKCl7bGV0IHQ9dGhpcy5pbnB1dEJ1ZmZlci5kcmFpbigpO2lmKCF0KXJldHVybjtsZXQgcjtpZih0aGlzLmZvcm1hdD09ImludDE2Iil7bGV0IHM9bmV3IEludDE2QXJyYXkodC5idWZmZXIsdC5ieXRlT2Zmc2V0LHQuYnl0ZUxlbmd0aC8yKTtyPVMocyl9ZWxzZSBpZih0aGlzLmZvcm1hdD09ImZsb2F0MzIiKXI9bmV3IEZsb2F0MzJBcnJheSh0LmJ1ZmZlcix0LmJ5dGVPZmZzZXQsdC5ieXRlTGVuZ3RoLzQpO2Vsc2UgdGhyb3cgbmV3IEVycm9yKGBJbnZhbGlkIGZvcm1hdDogJHt0aGlzLmZvcm1hdH1gKTtsZXQgYT10aGlzLnJlc2FtcGxlci5yZXNhbXBsZShyKTt0aGlzLmNodW5rcy5wdXNoKGEpfW5leHRGbG9hdCgpe2lmKCF0aGlzLmNodW5rcy5sZW5ndGgpcmV0dXJuIDA7bGV0IHQ9dGhpcy5jaHVua3NbMF1bdGhpcy5jaHVua1Bvc2l0aW9uXTtyZXR1cm4gdGhpcy5jaHVua1Bvc2l0aW9uKyssdGhpcy5jaHVua1Bvc2l0aW9uPHRoaXMuY2h1bmtzWzBdLmxlbmd0aHx8KHRoaXMuY2h1bmtzLnNoaWZ0KCksdGhpcy5jaHVua1Bvc2l0aW9uPTApLHR9cHJvY2Vzcyh0LHIsYSl7aWYodGhpcy5pc0NhbmNlbGxlZClyZXR1cm4hMTtpZih0aGlzLmlzRW5kZWQmJiF0aGlzLmNodW5rcy5sZW5ndGgpcmV0dXJuIHRoaXMuX2hhc1NlbnRFbmRFdmVudHx8KHRoaXMuX2hhc1NlbnRFbmRFdmVudD0hMCx0aGlzLnBvcnQucG9zdE1lc3NhZ2Uoe2FjdGlvbjoiZW5kIn0pKSwhMTtsZXQgcz1yWzBdPy5bMF0/Lmxlbmd0aDtpZighcylyZXR1cm4hMDt0aGlzLmxhc3RQbGF5ZWRCdWZmZXJTaXplPXM7Zm9yKGxldCBmPTA7ZjxzO2YrKyl7bGV0IGg9dGhpcy5uZXh0RmxvYXQoKTtmb3IobGV0IGU9MDtlPHIubGVuZ3RoO2UrKylmb3IobGV0IG49MDtuPHJbZV0ubGVuZ3RoO24rKylyW2VdW25dW2ZdPWh9cmV0dXJuITB9fTtyZWdpc3RlclByb2Nlc3NvcigicGNtLXBsYXllci1ub2RlIixCKTsK";var Rl="data:application/javascript;base64,dmFyIGc9Y2xhc3N7Y29uc3RydWN0b3IoZSx0LGksZil7aWYoIWV8fCF0fHwhaSl0aHJvdyBuZXcgRXJyb3IoIkludmFsaWQgc2V0dGluZ3Mgc3BlY2lmaWVkIGZvciB0aGUgcmVzYW1wbGVyLiIpO3RoaXMucmVzYW1wbGVyPW51bGwsdGhpcy5mcm9tU2FtcGxlUmF0ZT1lLHRoaXMudG9TYW1wbGVSYXRlPXQsdGhpcy5jaGFubmVscz1pfHwwLHRoaXMuaW5wdXRCdWZmZXJTaXplPWYsdGhpcy5pbml0aWFsaXplKCl9aW5pdGlhbGl6ZSgpe3RoaXMuZnJvbVNhbXBsZVJhdGU9PXRoaXMudG9TYW1wbGVSYXRlPyh0aGlzLnJlc2FtcGxlcj1lPT5lLHRoaXMucmF0aW9XZWlnaHQ9MSk6KHRoaXMuZnJvbVNhbXBsZVJhdGU8dGhpcy50b1NhbXBsZVJhdGU/KHRoaXMubGluZWFySW50ZXJwb2xhdGlvbigpLHRoaXMubGFzdFdlaWdodD0xKToodGhpcy5tdWx0aVRhcCgpLHRoaXMudGFpbEV4aXN0cz0hMSx0aGlzLmxhc3RXZWlnaHQ9MCksdGhpcy5pbml0aWFsaXplQnVmZmVycygpLHRoaXMucmF0aW9XZWlnaHQ9dGhpcy5mcm9tU2FtcGxlUmF0ZS90aGlzLnRvU2FtcGxlUmF0ZSl9YnVmZmVyU2xpY2UoZSl7dHJ5e3JldHVybiB0aGlzLm91dHB1dEJ1ZmZlci5zdWJhcnJheSgwLGUpfWNhdGNoe3RyeXtyZXR1cm4gdGhpcy5vdXRwdXRCdWZmZXIubGVuZ3RoPWUsdGhpcy5vdXRwdXRCdWZmZXJ9Y2F0Y2h7cmV0dXJuIHRoaXMub3V0cHV0QnVmZmVyLnNsaWNlKDAsZSl9fX1pbml0aWFsaXplQnVmZmVycygpe3RoaXMub3V0cHV0QnVmZmVyU2l6ZT1NYXRoLmNlaWwodGhpcy5pbnB1dEJ1ZmZlclNpemUqdGhpcy50b1NhbXBsZVJhdGUvdGhpcy5mcm9tU2FtcGxlUmF0ZS90aGlzLmNoYW5uZWxzKjEuMDAwMDAwNDc2ODM3MTU4MikrdGhpcy5jaGFubmVscyt0aGlzLmNoYW5uZWxzO3RyeXt0aGlzLm91dHB1dEJ1ZmZlcj1uZXcgRmxvYXQzMkFycmF5KHRoaXMub3V0cHV0QnVmZmVyU2l6ZSksdGhpcy5sYXN0T3V0cHV0PW5ldyBGbG9hdDMyQXJyYXkodGhpcy5jaGFubmVscyl9Y2F0Y2h7dGhpcy5vdXRwdXRCdWZmZXI9W10sdGhpcy5sYXN0T3V0cHV0PVtdfX1saW5lYXJJbnRlcnBvbGF0aW9uKCl7dGhpcy5yZXNhbXBsZXI9ZT0+e2xldCB0PWUubGVuZ3RoLGk9dGhpcy5jaGFubmVscyxmLGgsYSxzLHIsdSxuLHAsbDtpZih0JWkhPT0wKXRocm93IG5ldyBFcnJvcigiQnVmZmVyIHdhcyBvZiBpbmNvcnJlY3Qgc2FtcGxlIGxlbmd0aC4iKTtpZih0PD0wKXJldHVybltdO2ZvcihmPXRoaXMub3V0cHV0QnVmZmVyU2l6ZSxoPXRoaXMucmF0aW9XZWlnaHQsYT10aGlzLmxhc3RXZWlnaHQscz0wLHI9MCx1PTAsbj0wLHA9dGhpcy5vdXRwdXRCdWZmZXI7YTwxO2ErPWgpZm9yKHI9YSUxLHM9MS1yLHRoaXMubGFzdFdlaWdodD1hJTEsbD0wO2w8dGhpcy5jaGFubmVsczsrK2wpcFtuKytdPXRoaXMubGFzdE91dHB1dFtsXSpzK2VbbF0qcjtmb3IoYS09MSx0LT1pLHU9TWF0aC5mbG9vcihhKSppO248ZiYmdTx0Oyl7Zm9yKHI9YSUxLHM9MS1yLGw9MDtsPHRoaXMuY2hhbm5lbHM7KytsKXBbbisrXT1lW3UrKGw+MD9sOjApXSpzK2VbdSsoaStsKV0qcjthKz1oLHU9TWF0aC5mbG9vcihhKSppfWZvcihsPTA7bDxpOysrbCl0aGlzLmxhc3RPdXRwdXRbbF09ZVt1KytdO3JldHVybiB0aGlzLmJ1ZmZlclNsaWNlKG4pfX1tdWx0aVRhcCgpe3RoaXMucmVzYW1wbGVyPWU9PntsZXQgdD1lLmxlbmd0aCxpLGYsaD10aGlzLmNoYW5uZWxzLGEscyxyLHUsbixwLGwsbSxCO2lmKHQlaCE9PTApdGhyb3cgbmV3IEVycm9yKCJCdWZmZXIgd2FzIG9mIGluY29ycmVjdCBzYW1wbGUgbGVuZ3RoLiIpO2lmKHQ8PTApcmV0dXJuW107Zm9yKGk9dGhpcy5vdXRwdXRCdWZmZXJTaXplLGY9W10sYT10aGlzLnJhdGlvV2VpZ2h0LHM9MCx1PTAsbj0wLHA9IXRoaXMudGFpbEV4aXN0cyx0aGlzLnRhaWxFeGlzdHM9ITEsbD10aGlzLm91dHB1dEJ1ZmZlcixtPTAsQj0wLHI9MDtyPGg7KytyKWZbcl09MDtkb3tpZihwKWZvcihzPWEscj0wO3I8aDsrK3IpZltyXT0wO2Vsc2V7Zm9yKHM9dGhpcy5sYXN0V2VpZ2h0LHI9MDtyPGg7KytyKWZbcl09dGhpcy5sYXN0T3V0cHV0W3JdO3A9ITB9Zm9yKDtzPjAmJnU8dDspaWYobj0xK3UtQixzPj1uKXtmb3Iocj0wO3I8aDsrK3IpZltyXSs9ZVt1KytdKm47Qj11LHMtPW59ZWxzZXtmb3Iocj0wO3I8aDsrK3IpZltyXSs9ZVt1KyhyPjA/cjowKV0qcztCKz1zLHM9MDticmVha31pZihzPT09MClmb3Iocj0wO3I8aDsrK3IpbFttKytdPWZbcl0vYTtlbHNle2Zvcih0aGlzLmxhc3RXZWlnaHQ9cyxyPTA7cjxoOysrcil0aGlzLmxhc3RPdXRwdXRbcl09ZltyXTt0aGlzLnRhaWxFeGlzdHM9ITA7YnJlYWt9fXdoaWxlKHU8dCYmbTxpKTtyZXR1cm4gdGhpcy5idWZmZXJTbGljZShtKX19cmVzYW1wbGUoZSl7cmV0dXJuIHRoaXMuZnJvbVNhbXBsZVJhdGU9PXRoaXMudG9TYW1wbGVSYXRlP3RoaXMucmF0aW9XZWlnaHQ9MToodGhpcy5mcm9tU2FtcGxlUmF0ZTx0aGlzLnRvU2FtcGxlUmF0ZT90aGlzLmxhc3RXZWlnaHQ9MToodGhpcy50YWlsRXhpc3RzPSExLHRoaXMubGFzdFdlaWdodD0wKSx0aGlzLmluaXRpYWxpemVCdWZmZXJzKCksdGhpcy5yYXRpb1dlaWdodD10aGlzLmZyb21TYW1wbGVSYXRlL3RoaXMudG9TYW1wbGVSYXRlKSx0aGlzLnJlc2FtcGxlcihlKX19O2Z1bmN0aW9uIGQobyl7bGV0IGU9by5sZW5ndGgsdD1uZXcgSW50MTZBcnJheShlKTtmb3IoO2UtLTspe2xldCBpPU1hdGgubWF4KC0xLE1hdGgubWluKDEsb1tlXSkpO3RbZV09aTwwP2kqMzI3Njg6aSozMjc2N31yZXR1cm4gdH1mdW5jdGlvbiB3KG8pe2xldCBlPW8ubGVuZ3RoLHQ9bmV3IEJpZ0ludDY0QXJyYXkoZSk7Zm9yKDtlLS07KXtsZXQgaT1NYXRoLm1heCgtMSxNYXRoLm1pbigxLG9bZV0pKTt0W2VdPUJpZ0ludChNYXRoLmZsb29yKGk8MD9pKjMyNzY4OmkqMzI3NjcpKSoweDEwMDAwMDAwMDAwMG59cmV0dXJuIHR9dmFyIGM9Y2xhc3N7Y29uc3RydWN0b3IoZSx0KXt0aGlzLm91dHB1dEJ1ZmZlclNpemU9MDt0aGlzLnBhcnRpYWxCdWZmZXJzPVtdO3RoaXMucGFydGlhbEJ1ZmZlck9mZnNldD0wO2lmKCFlKXRocm93IG5ldyBFcnJvcihgSW52YWxpZCBhcnJheSBjbGFzczogJHtlfWApO2lmKCF0fHx0PD0wKXRocm93IG5ldyBFcnJvcihgSW52YWxpZCBvdXRwdXQgYnVmZmVyIHNpemU6ICR7dH1gKTt0aGlzLkFycmF5Q2xhc3M9ZSx0aGlzLm91dHB1dEJ1ZmZlclNpemU9dH1nZXQgcXVldWVkU2l6ZSgpe3JldHVybiB0aGlzLnBhcnRpYWxCdWZmZXJzLnJlZHVjZSgoZSx0KT0+ZSt0Lmxlbmd0aCwwKX1mZWVkKGUpe3RoaXMucGFydGlhbEJ1ZmZlcnMucHVzaChlKX1nZXQgY2FuRHJhaW4oKXtyZXR1cm4gdGhpcy5wYXJ0aWFsQnVmZmVycy5yZWR1Y2UoKHQsaSk9PnQraS5sZW5ndGgsMCktdGhpcy5wYXJ0aWFsQnVmZmVyT2Zmc2V0Pj10aGlzLm91dHB1dEJ1ZmZlclNpemV9ZHJhaW4oKXtpZighdGhpcy5jYW5EcmFpbilyZXR1cm4gbnVsbDtsZXQgZT10aGlzLkFycmF5Q2xhc3MsdD1uZXcgZSh0aGlzLm91dHB1dEJ1ZmZlclNpemUpLGk9MDtmb3IoO2khPXQubGVuZ3RoOyl7aWYoaT50Lmxlbmd0aCl0aHJvdyBuZXcgRXJyb3IoYEJ1ZmZlciBvdmVyZmxvdzogJHtpfSA+ICR7dC5sZW5ndGh9YCk7bGV0IGY9dC5sZW5ndGgtaSxoPXRoaXMucGFydGlhbEJ1ZmZlcnNbMF0sYT1oLmxlbmd0aC10aGlzLnBhcnRpYWxCdWZmZXJPZmZzZXQ7YTxmPyh0LnNldChoLnN1YmFycmF5KHRoaXMucGFydGlhbEJ1ZmZlck9mZnNldCksaSksaSs9YSx0aGlzLnBhcnRpYWxCdWZmZXJzLnNoaWZ0KCksdGhpcy5wYXJ0aWFsQnVmZmVyT2Zmc2V0PTApOih0LnNldChoLnN1YmFycmF5KHRoaXMucGFydGlhbEJ1ZmZlck9mZnNldCx0aGlzLnBhcnRpYWxCdWZmZXJPZmZzZXQrZiksaSksaSs9Zix0aGlzLnBhcnRpYWxCdWZmZXJPZmZzZXQrPWYpfXJldHVybiB0fXBhZCgpe2xldCBlPXRoaXMucXVldWVkU2l6ZSV0aGlzLm91dHB1dEJ1ZmZlclNpemU7aWYoZT09MClyZXR1cm47bGV0IHQ9dGhpcy5BcnJheUNsYXNzLGk9bmV3IHQoZSk7dGhpcy5mZWVkKGkpfX07dmFyIHk9Y2xhc3MgZXh0ZW5kcyBBdWRpb1dvcmtsZXRQcm9jZXNzb3J7Y29uc3RydWN0b3IodCl7c3VwZXIodCk7dGhpcy5mb3JtYXQ9ImludDE2Ijt0aGlzLmlucHV0QnVmZmVyPW5ldyBjKEZsb2F0MzJBcnJheSw0MDk2KTt0aGlzLnBvcnQub25tZXNzYWdlPWk9PnRoaXMub25NZXNzYWdlKGkpfW9uTWVzc2FnZSh0KXt0LmRhdGEuYWN0aW9uPT0ic3RhcnQiJiYodGhpcy5mb3JtYXQ9dC5kYXRhLmZvcm1hdCx0aGlzLnJlc2FtcGxlcj1uZXcgZyh0LmRhdGEuaW5wdXRTYW1wbGVSYXRlLHQuZGF0YS5vdXRwdXRTYW1wbGVSYXRlLDEsNDA5NiksdGhpcy5mb3JtYXQ9PSJpbnQxNiI/dGhpcy5vdXRwdXRCdWZmZXI9bmV3IGMoSW50MTZBcnJheSx0LmRhdGEuYnVmZmVyU2l6ZSk6dGhpcy5mb3JtYXQ9PSJpbnQ2NCI/dGhpcy5vdXRwdXRCdWZmZXI9bmV3IGMoQmlnSW50NjRBcnJheSx0LmRhdGEuYnVmZmVyU2l6ZSk6dGhpcy5mb3JtYXQ9PSJmbG9hdDMyIiYmKHRoaXMub3V0cHV0QnVmZmVyPW5ldyBjKEZsb2F0MzJBcnJheSx0LmRhdGEuYnVmZmVyU2l6ZSkpKX1wcm9jZXNzKHQsaSxmKXtmb3IobGV0IGE9MDthPGkubGVuZ3RoO2ErKyl7bGV0IHM9TWF0aC5taW4oaVthXS5sZW5ndGgsdFswXS5sZW5ndGgpO2ZvcihsZXQgcj0wO3I8cztyKyspaVthXVtyXS5zZXQodFswXVtyXSl9aWYoIXRoaXMucmVzYW1wbGVyKXJldHVybiEwO2xldCBoPW5ldyBGbG9hdDMyQXJyYXkoaVswXVswXS5sZW5ndGgpO2ZvcihoLnNldChpWzBdWzBdKSx0aGlzLmlucHV0QnVmZmVyLmZlZWQoaCk7dGhpcy5pbnB1dEJ1ZmZlci5jYW5EcmFpbjspe2xldCBhPXRoaXMuaW5wdXRCdWZmZXIuZHJhaW4oKSxzPXRoaXMucmVzYW1wbGVyLnJlc2FtcGxlKGEpO3RoaXMuZm9ybWF0PT0iaW50MTYiP3RoaXMub3V0cHV0QnVmZmVyLmZlZWQoZChzKSk6dGhpcy5mb3JtYXQ9PSJpbnQ2NCI/dGhpcy5vdXRwdXRCdWZmZXIuZmVlZCh3KHMpKTp0aGlzLmZvcm1hdD09ImZsb2F0MzIiJiZ0aGlzLm91dHB1dEJ1ZmZlci5mZWVkKHMpfWZvcig7dGhpcy5vdXRwdXRCdWZmZXIuY2FuRHJhaW47KXtsZXQgYT10aGlzLm91dHB1dEJ1ZmZlci5kcmFpbigpO2lmKCFhKWJyZWFrO3RoaXMucG9ydC5wb3N0TWVzc2FnZSh7YWN0aW9uOiJkYXRhIixidWZmZXI6YS5idWZmZXJ9LFthLmJ1ZmZlcl0pfXJldHVybiEwfX07cmVnaXN0ZXJQcm9jZXNzb3IoInBjbS1yZWNlaXZlci1ub2RlIix5KTsK";var ng=new q("PCMPlayerNode"),hi=class extends AudioWorkletNode{constructor(t,i,r){super(t,"pcm-player-node",{numberOfInputs:0});this.sampleRate=0;this.format="int16";this.isCancelled=!1;if(!i||i<=0)throw new Error(`Invalid sample rate: ${i}`);if(!r||r!="int16"&&r!="float32")throw new Error(`Invalid format: ${r}`);this.sampleRate=i,this.format=r,this.port.onmessage=a=>this.onWorkletMessage(a),this.port.postMessage({action:"start",inputSampleRate:i,outputSampleRate:t.sampleRate,format:r})}feed(t){this.port.postMessage({action:"data",buffer:t.buffer},[t.buffer])}async play(t){if(this.isCancelled)throw new Error("PCMPlayerNode has already been cancelled.");if(this._playPromise)throw new Error("Already playing a stream");this._playPromise=new Promise(i=>this._playPromiseResolve=i),this.dispatchEvent(new CustomEvent("start",{detail:{player:this,stream:t}}));try{let i=t.getReader();for(;!this.isCancelled;){let{done:r,value:a}=await i.read();if(r||!a)break;this.feed(a)}}catch(i){ng.warn("Stream error:",i),this.dispatchEvent(new CustomEvent("error",{detail:{player:this,stream:t,error:i}}))}this.port.postMessage({action:"end"}),await this._playPromise}onWorkletMessage(t){t.data.action=="end"&&(this._playPromiseResolve?.(),this.dispatchEvent(new CustomEvent("end",{detail:{player:this}})))}stop(){this.isCancelled=!0,this.port.postMessage({action:"cancel"}),this._playPromiseResolve?.()}};var fi=new q("SpeechOutput"),Pl=.5,ig=.8,yi=class extends EventTarget{constructor(t){super();this.maxVolumeHeard=0;this.ai=t,this.ai.addEventListener("output",i=>this.onTextOutputFromAI(i)),this.ai.audio?.speechRecognition.addEventListener("speechstart",i=>this.interrupt()),this.ai.knowledgeBase.registerSource(()=>[{id:"system.voice",type:"info",name:"Voice active",isContext:!0,disabled:!1,content:"Text-to-speech is active. The user can hear your voice."}])}onTextOutputFromAI(t){t.detail.isChunk||this.ai?.audio?.speechRecognition.isRunning&&this.speak(t.detail.message)}get volumeLevel(){if(!this.analyserNode||!this.analyserBuffer)return 0;this.analyserNode.getFloatTimeDomainData(this.analyserBuffer);let t=0;for(let r of this.analyserBuffer)t+=r*r;let i=Math.sqrt(t/this.analyserBuffer.length);return i>this.maxVolumeHeard&&(this.maxVolumeHeard=i),this.maxVolumeHeard*=.999,this.maxVolumeHeard<.01&&(this.maxVolumeHeard=.01),Math.min(1,Math.max(0,i/this.maxVolumeHeard))}async speak(t){if(!this.ai?.config?.voice?.providerID)return fi.warn("No voice provider configured");let i=`speech-${rg++}`;await this.ai.audio.beginAccess(i);try{await this._speakWithLock(t)}finally{this.ai.audio.endAccess(i)}}async _speakWithLock(t){this.interrupt(),this.ai.audio.speechRecognition.voiceDetection&&(this.ai.audio.speechRecognition.voiceDetection.sensitivity=ig);let i=this.ai?._voiceTracker||fi.timer(`${this.ai.config.voice.providerID} voice`);i(`Speak: ${t}`),this.currentPlayerVolume?.disconnect(),this.currentPlayerVolume=this.ai.audio.context.createGain(),this.currentPlayerVolume.connect(this.ai.audio.context.destination),this.analyserNode=this.ai.audio.context.createAnalyser(),this.analyserNode.fftSize=32,this.analyserNode.connect(this.currentPlayerVolume),this.maxVolumeHeard=0,this.analyserBuffer=new Float32Array(this.analyserNode.fftSize);let r=new hi(this.ai.audio.context,24e3,"int16");this.currentPlayer=r,r.connect(this.analyserNode),r.addEventListener("end",o=>{let s=o;i(`PCM stream ${s.detail.interrupted?"interrupted":"ended"}`),this.currentPlayer==r&&!s.detail.interrupted&&(this.currentPlayer=void 0,this.onSpeechEnd())});let a;if(this.ai.config.voice.providerID=="openai")a=await fetch("https://api.openai.com/v1/audio/speech",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.ai.config.voice.apiKey}`},body:JSON.stringify({model:"tts-1",input:t,voice:this.ai.config.voice.voiceID,response_format:"pcm"})});else if(this.ai.config.voice.providerID=="elevenlabs")a=await fetch(`https://api.elevenlabs.io/v1/text-to-speech/${this.ai.config.voice.voiceID}?output_format=pcm_24000`,{method:"POST",headers:{"xi-api-key":`${this.ai.config.voice.apiKey}`,"Content-Type":"application/json"},body:JSON.stringify({text:t})});else{fi.warn(`Unknown voice provider: ${this.ai.config.voice.providerID}`);return}if(i(`Received response ${a.status} ${a.statusText}`),!a.ok){fi.warn(`Failed to generate voice sample: ${a.status} ${a.statusText}`);return}this.dispatchEvent(new CustomEvent("speechstart",{detail:{ai:this.ai,message:t}})),i("Playing PCM stream"),await r.play(a.body),i("Audio has ended")}get isSpeaking(){return!!this.currentPlayer}async interrupt(){if(!this.currentPlayerVolume)return;let t=this.currentPlayerVolume,i=this.currentPlayer;this.currentPlayerVolume=void 0,this.currentPlayer=void 0,this.ai?.audio?.speechRecognition.voiceDetection&&(this.ai.audio.speechRecognition.voiceDetection.sensitivity=Pl);let r=400;t.gain.linearRampToValueAtTime(0,r/1e3),await new Promise(a=>setTimeout(a,r+250)),t.disconnect(),i?.stop(),i?.disconnect()}onSpeechEnd(){this.dispatchEvent(new CustomEvent("speechend",{detail:{ai:this.ai}})),this.ai?.audio?.speechRecognition.voiceDetection&&(this.ai.audio.speechRecognition.voiceDetection.sensitivity=Pl)}},rg=1;function bi(e,n){let t=n.reduce((l,c)=>l+c.byteLength,0),i=new DataView(new ArrayBuffer(44));i.setUint8(0,82),i.setUint8(1,73),i.setUint8(2,70),i.setUint8(3,70),i.setUint32(4,44+t,!0),i.setUint8(8,87),i.setUint8(9,65),i.setUint8(10,86),i.setUint8(11,69);let r=1,a=32,o=r*a/8,s=e*o;return i.setUint8(12,102),i.setUint8(13,109),i.setUint8(14,116),i.setUint8(15,32),i.setUint32(16,16,!0),i.setUint16(20,3,!0),i.setUint16(22,r,!0),i.setUint32(24,e,!0),i.setUint32(28,s,!0),i.setUint16(32,o,!0),i.setUint16(34,a,!0),i.setUint8(36,100),i.setUint8(37,97),i.setUint8(38,116),i.setUint8(39,97),i.setUint32(40,t,!0),new File([i,...n],"audio.wav",{type:"audio/wav"})}var vi=class extends AudioWorkletNode{constructor(t,i,r,a){super(t,"pcm-receiver-node",{numberOfInputs:1});this.format="int16";this.format=r;let o=["int16","int64","float32"];if(!i||i<=0)throw new Error(`Invalid sample rate: ${i}`);if(!o.includes(r))throw new Error(`Invalid format ${r}, must be one of: ${o.join(", ")}`);if(!a||a<=0)throw new Error(`Invalid buffer size: ${a}`);this.port.onmessage=s=>this.onWorkletMessage(s),this.port.postMessage({action:"start",inputSampleRate:t.sampleRate,outputSampleRate:i,format:r,bufferSize:a})}onWorkletMessage(t){if(t.data.action=="data"){let i=null;if(this.format=="int16"&&(i=new Int16Array(t.data.buffer)),this.format=="int64"&&(i=new BigInt64Array(t.data.buffer)),this.format=="float32"&&(i=new Float32Array(t.data.buffer)),!i)throw new Error(`Invalid format: ${this.format}`);this.onData(i),this.dispatchEvent(new CustomEvent("data",{detail:{data:i}}))}}onData(t){}};var sa=16e3,_i=256,xt=8,ln=new q("VoiceDetectionNode"),cn=class cn extends vi{constructor(t){super(t,sa,"float32",_i*xt);this.isVoiceActive=!1;this.lastVoiceActiveDate=0;this.voiceEndTimeout=50;this.sensitivity=.5;this.sentivityEnd=.2;this.nextVadReset=0;this.currentProbability=0;this._lastVoiceActive=!1;if(!cn.vadModelURL)throw new Error("VAD model url not set, please load it and set it to VoiceDetectionNode.vadModelURL");this.loadModel()}get isVoicePossiblyEnding(){return this.isVoiceActive&&this.currentProbability<this.sensitivity}get sampleRate(){return sa}get numberOfSamples(){return _i}get numberOfSampleChunks(){return xt}get outputBufferSize(){return _i*xt}get isModelLoaded(){return!!this.vad}async loadModel(){ln.debug("Loading VAD model"),this.vad=await Ie.load(cn.vadModelURL),this.vad.ignoreIfBusy=!0,ln.debug("Model loaded"),this.vad.makeConstant("sr","int64",[1],sa),this.vad.makeState("h","hn","float32",[2,xt,64]),this.vad.makeState("c","cn","float32",[2,xt,64])}async onData(t){if(this.vad)try{let i=await this.vad.run({input:new Ie.onnx.Tensor(t,[xt,_i])});if(!i)return;this.currentProbability=0;for(let o=0;o<i.output.data.length;o++)i.output.data[o]>this.currentProbability&&(this.currentProbability=i.output.data[o]);let r=this.isVoiceActive?this.sentivityEnd:this.sensitivity,a=this.currentProbability>r;if(!a&&this._lastVoiceActive&&(this.nextVadReset=Date.now(),this.vad.resetState()),this._lastVoiceActive=a,a&&!this.isVoiceActive?(this.lastVoiceActiveDate=Date.now(),this.isVoiceActive=!0,this.dispatchEvent(new CustomEvent("speechstart")),this.onSpeechStart(),ln.debug("Started speaking")):a?this.lastVoiceActiveDate=Date.now():!a&&this.isVoiceActive&&Date.now()<this.lastVoiceActiveDate+this.voiceEndTimeout||!a&&this.isVoiceActive&&(this.isVoiceActive=!1,this.dispatchEvent(new CustomEvent("speechend")),this.onSpeechEnd(),ln.debug("Stopped speaking after timeout")),!a){let o=Date.now();o>this.nextVadReset&&(this.nextVadReset=o+5e3,this.vad.resetState())}}catch(i){ln.error("VAD failed:",i)}}onSpeechStart(){}onSpeechEnd(){}};cn.vadModelURL="";var It=cn;var Dl=new q("VoiceChunkOutputNode"),Rt=class extends It{constructor(){super(...arguments);this.buffers=[];this.recordedBuffers=[];this._voiceRecording=!1;this.backBufferDurationSeconds=3}get bufferDuration(){return this.buffers.reduce((t,i)=>t+i.length,0)/8e3}async onData(t){if(await super.onData(t),this.isVoiceActive&&!this._voiceRecording){Dl.debug(`Voice detected, sending ${this.buffers.length} existing chunks`),this._voiceRecording=!0;for(let i of this.buffers)this.recordedBuffers.push(i),this.dispatchEvent(new CustomEvent("voicedata",{detail:{data:i,isFinal:!1}})),this.onVoiceChunk(i);this.recordedBuffers.push(t),this.dispatchEvent(new CustomEvent("voicedata",{detail:{data:t,isFinal:!1}})),this.onVoiceChunk(t),this.buffers=[]}else if(this.isVoiceActive)this.recordedBuffers.push(t),this.dispatchEvent(new CustomEvent("voicedata",{detail:{data:t,isFinal:!1}})),this.onVoiceChunk(t);else if(!this.isVoiceActive&&this._voiceRecording){this.recordedBuffers.push(t),this.dispatchEvent(new CustomEvent("voicedata",{detail:{data:t,isFinal:!0}})),this.onVoiceChunk(t),this._voiceRecording=!1;let i=this.recordedBuffers.reduce((r,a)=>r+a.length,0);Dl.debug(`Voice complete, recorded ${(i/8e3).toFixed(2)} seconds of audio, ${i*4/1024} KB of data`),this.dispatchEvent(new CustomEvent("voicedataend",{detail:{data:this.recordedBuffers}})),this.onVoiceEnd(this.recordedBuffers),this.recordedBuffers=[]}else for(this.buffers.push(t);this.bufferDuration>this.backBufferDurationSeconds;)this.buffers.shift()}onVoiceChunk(t){}onVoiceEnd(t){}};var Si=new q("OpenAITranscriptionNode"),Ei=class extends Rt{constructor(t,i){super(t);this.apiKey="";this.pendingBuffers=[];this.isTranscribing=!1;this.apiKey=i}async onVoiceEnd(t){let i=Si.timer("OpenAI Transcribe");this.isTranscribing=!0,this.pendingBuffers.push(...t);let r=bi(this.sampleRate,this.pendingBuffers);this.lastRequestAbortController?.abort(),this.lastRequestAbortController=new AbortController;let a="";try{let o=new FormData;o.append("file",r),o.append("model","whisper-1"),o.append("response_format","text");let s=await fetch("https://api.openai.com/v1/audio/transcriptions",{method:"POST",headers:{Authorization:`Bearer ${this.apiKey}`},body:o,signal:this.lastRequestAbortController.signal});if(!s.ok)throw new Error(`Failed to generate voice sample: ${s.status} ${s.statusText}`);i("Response received"),a=await s.text(),i("Content received: "+a),this.lastRequestAbortController=void 0}catch(o){Si.error(`Failed to transcribe speech: ${o.message}`);return}finally{this.isTranscribing=!1}if(this.pendingBuffers=[],!a)return Si.debug("Transcription complete, but no text was found");Si.debug(`Transcription: ${a}`),this.onVoiceTranscription(a),this.dispatchEvent(new CustomEvent("transcription",{detail:{text:a}}))}onVoiceTranscription(t){}};var Ci=class extends WebSocket{constructor(t){super(t);this.pendingData=[];this.addEventListener("open",()=>this._onOpen())}send(t){this.readyState==WebSocket.OPEN?super.send(t):this.pendingData.push(t)}_onOpen(){for(let t of this.pendingData)super.send(t);this.pendingData=[]}};var Le=new q("IntelliWeaveTranscriptionNode"),ag="wss://speech.intelliweave.ai/api/v1/transcribe",wi=class wi extends Rt{constructor(t,i){super(t);this.apiAddress=ag;this.apiKey="";this.isTranscribing=!1;this.apiKey=i}async onVoiceChunk(t){this.isTranscribing=!0,this.ws?this.ws.send(t):(Le.debug("Opening WebSocket connection"),this.ws=new Ci(this.apiAddress),this.ws.send(JSON.stringify({type:"hello",sampleRate:16e3,channels:1,format:"float32",apiKey:this.apiKey})),this.ws.send(t.buffer),this.ws.onopen=()=>{Le.debug("WebSocket connection opened")},this.ws.addEventListener("message",r=>{let a=JSON.parse(r.data);if(a.error)return Le.warn("Error: "+a.error);if(a.type!="transcription")return Le.warn("Invalid response type",a);if(a.streaming&&!a.final)return Le.debug("Partial transcription: "+a.partialText);if(this.isTranscribing=!1,!a.text.trim())return Le.warn(`Empty transcription (${a.processingTime}ms)`);Le.debug(`Transcription: ${a.text} (${a.processingTime}ms)`),this.onVoiceTranscription(a.text),this.dispatchEvent(new CustomEvent("transcription",{detail:{text:a.text}}))}),this.ws.addEventListener("close",()=>this.onSocketClose()),this.ws.addEventListener("error",r=>Le.warn("WebSocket error")));let i=1e3*60*1;this.shutdownTimer&&clearTimeout(this.shutdownTimer),this.shutdownTimer=setTimeout(()=>{Le.debug("Shutting down WebSocket connection"),this.ws?.close(),this.ws=void 0},i)}async onVoiceEnd(t){if(this.ws?.send(JSON.stringify({type:"end"})),wi.debugExportWav){let i=bi(this.sampleRate,t),r=document.createElement("a");r.href=URL.createObjectURL(i),r.download="recording.wav",r.click()}}onVoiceTranscription(t){}onSocketClose(){Le.debug("WebSocket connection closed"),this.ws=void 0,this.isTranscribing=!1}};wi.debugExportWav=!1;var ki=wi;var la=new q("SpeechRecognition"),Ti=class extends EventTarget{constructor(t){super();this.isRunning=!1;this._skipEvents=!1;this.maxVolumeHeard=0;this.ai=t,this.ai.knowledgeBase.registerSource(()=>[{id:"system.microphone.enable",type:"action",name:"Enable or disable microphone",isContext:!0,content:`Starts or stops listening to input from the user through the microphone. ${this.isRunning?"Microphone access is currently enabled and you can hear the user.":"Microphone access is currently disabled."}.`,parameters:[{name:"enable",type:"boolean",description:"If true, enables the microphone. If false, disables it."}],action:async i=>{i.enable?await this.start():this.stop()}}])}get isSupported(){if(!Ie.lib||!this.ai?.vadModel||!He().AudioWorkletNode)return!1;if(this.ai?.config?.transcription?.providerID!="intelliweave"){if(!(this.ai?.config?.transcription?.providerID=="openai"&&this.ai.config?.transcription?.apiKey))return!1}return!0}async start(){if(!this.isSupported)throw new Error("Speech recognition not supported in this persona and browser.");if(!this.isRunning){this.isRunning=!0;try{await this.ai.audio.beginAccess("speech-recognition"),this.micStream=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1,echoCancellation:!0,autoGainControl:!0,noiseSuppression:!0}});let t=this.ai.audio.context.createMediaStreamSource(this.micStream);this.analyserNode=this.ai.audio.context.createAnalyser(),this.analyserNode.fftSize=32,t.connect(this.analyserNode),this.analyserBuffer=new Float32Array(this.analyserNode.fftSize),It.vadModelURL=URL.createObjectURL(this.ai.vadModel),this.ai?.config?.transcription?.providerID=="openai"?(this.voiceDetection=new Ei(this.ai.audio.context,this.ai.config.transcription.apiKey),t.connect(this.voiceDetection)):(this.voiceDetection=new ki(this.ai.audio.context,this.ai.apiKey),this.voiceDetection.apiAddress=this.ai?.config?.transcription?.url||this.voiceDetection.apiAddress,t.connect(this.voiceDetection)),this.voiceDetection.addEventListener("speechstart",i=>{this.ai._voiceTracker=la.timer("voice interaction","Speech started"),this.dispatchEvent(new CustomEvent(i.type,{detail:i.detail}))}),this.voiceDetection.addEventListener("speechend",i=>{this.ai._voiceTracker?.("Speech ended"),this.dispatchEvent(new CustomEvent(i.type,{detail:i.detail}))}),this.voiceDetection.addEventListener("transcription",i=>{this.ai._voiceTracker?.(`Transcription: ${i.detail.text}`),this.onTranscription(i)}),this._skipEvents||this.dispatchEvent(new CustomEvent("start",{detail:{speechRecognition:this}}))}catch(t){la.error("Failed to start speech recognition:",t),this.stop()}}}stop(){this.isRunning&&(this.isRunning=!1,this.ai.audio.endAccess("speech-recognition"),this.voiceDetection?.disconnect(),this.voiceDetection=void 0,this.micStream?.getTracks().forEach(t=>t.stop()),this.micStream=void 0,this.analyserNode=void 0,this.analyserBuffer=void 0,this._skipEvents||this.dispatchEvent(new CustomEvent("end",{detail:{speechRecognition:this}})))}get volumeLevel(){if(!this.analyserNode||!this.analyserBuffer)return 0;this.analyserNode.getFloatTimeDomainData(this.analyserBuffer);let t=0;for(let r of this.analyserBuffer)t+=r*r;let i=Math.sqrt(t/this.analyserBuffer.length);return i>this.maxVolumeHeard&&(this.maxVolumeHeard=i),this.maxVolumeHeard*=.999,this.maxVolumeHeard<.01&&(this.maxVolumeHeard=.01),Math.min(1,Math.max(0,i/this.maxVolumeHeard))}get wordsCurrentlyBeingSpoken(){return!!this.voiceDetection?.isVoiceActive}get isTranscribing(){return!!this.voiceDetection?.isTranscribing}onTranscription(t){let i=t.detail.text;la.debug("Heard:",i),this.dispatchEvent(new CustomEvent("speech",{detail:{transcript:i,isFinal:!0}}))}async reset(){if(this.isRunning){this._skipEvents=!0;try{this.stop(),await this.start(),this._skipEvents=!1}catch(t){throw this._skipEvents=!1,t}}}};var Ai=new q("AudioSystem"),Pt=class{constructor(n){this.locks=[];if(!n)throw new Error("AI reference is required. Please pass in the IntelliWeave instance to the constructor.");this.ai=n,this.ai.audio=this,this.speechRecognition=new Ti(this.ai),this.speechOutput=new yi(this.ai)}static get isSupported(){return!(!Ie.lib||!He().AudioWorkletNode)}async beginAccess(n){Ai.debug(`Began access for: ${n}`),this.locks.includes(n)||this.locks.push(n),!this.context&&(Ai.debug("Creating AudioContext"),this.context=new AudioContext({latencyHint:"interactive"}),this.context.resume(),await Promise.all([this.context.audioWorklet.addModule(Il),this.context.audioWorklet.addModule(Rl)]))}endAccess(n){Ai.debug(`Ended access for: ${n}`),this.locks=this.locks.filter(t=>t!=n),!this.locks.length&&(Ai.debug("Closing AudioContext"),this.context?.close(),this.context=void 0)}};var NT=new q("Stream");var lt=_a(ql(),1);var HT=new q("React");var VT=(0,lt.createContext)(void 0);var dn=new q("Embed"),ct=class extends be{constructor(){super();this.config={};this.suggestions=[];this.html=()=>`
3535
3541
 
3536
3542
  <!-- Styling -->
3537
3543
  <style>