setta 0.0.3.dev10__py3-none-any.whl → 0.0.3.dev11__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
@@ -224,7 +224,7 @@ ${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.pus
224
224
  `)),r}function TT(t){const e=t.split(/\r?\n/);return NS(e,0,0).result}function NS(t,e,n){let r=e,i,s=!1,o=!1;for(;r<t.length;){const a=t[r];if(!a.trim()){r++;continue}const l=PT(a);if(l<n)break;const c=a.trim();if(c.indexOf("- ")===0||c==="-"){if(!s&&!o)s=!0,i=[];else if(o)throw new Error("Mixed list and object at same level.");const f=c==="-"?"":c.slice(2).trim();if(!f||f.endsWith(":")||f.endsWith(": |")){const{parsedValue:h,isBlock:d,extraIndent:p}=oRe(f);if(d){const g=NS(t,r+1,n+p);h===void 0?Nx(g.result)?i.push(""):i.push(g.result):Nx(g.result)?i.push({[h]:""}):i.push({[h]:g.result}),r=g.nextIndex}else{const g=NS(t,r+1,l+2);Nx(g.result)?i.push(""):i.push(g.result),r=g.nextIndex}}else i.push(f),r++}else{if(!o&&!s)o=!0,i={};else if(s)throw new Error("Mixed list and object at same level.");const f=c.match(/^([^:]+):\s*(.*)$/);if(!f)throw new Error(`Line doesn't match "key: value": ${c}`);const h=f[1].trim();let d=f[2];if(d==="|"){const{textBlock:p,nextIdx:g}=aRe(t,r+1,l+2);i[h]=p,r=g}else if(d===""){const p=NS(t,r+1,l+2);Nx(p.result)?i[h]="":i[h]=p.result,r=p.nextIndex}else i[h]=d,r++}}return i===void 0&&(i={}),{result:i,nextIndex:r}}function oRe(t){const e=t.match(/^([^:]+):\s*(.*)$/);if(!e)return{parsedValue:void 0,isBlock:!1,extraIndent:2};const n=e[1].trim(),r=e[2].trim();return!r||r==="|"?{parsedValue:n,isBlock:!0,extraIndent:2}:{parsedValue:void 0,isBlock:!1,extraIndent:2}}function aRe(t,e,n){let r="",i=e;for(;i<t.length;){const s=t[i];if(!s.trim()){if(PT(s)<n)break;r+=dF(s,n)+`
225
225
  `,i++;continue}if(PT(s)<n)break;r+=dF(s,n)+`
226
226
  `,i++}return r.endsWith(`
227
- `)&&(r=r.slice(0,-1)),{textBlock:r,nextIdx:i}}function Nx(t){return Array.isArray(t)?t.length===0:typeof t=="object"&&t!==null?Object.keys(t).length===0:!1}function PT(t){let e=0;for(let n of t)if(n===" ")e++;else break;return e}function dF(t,e){let n=0,r="";for(let i of t)n<e&&i===" "?n++:r+=i;return r}async function Ene(t,e){const n=await VAe(t,e);if(n.status===200){const{originalObj:r,yamlValue:i}=n.data;Kee.setState({[e]:r}),u_.setState({[e]:i})}}function V$(t){const e=te.getState().x[t].variantId,n=dn(t),r=u_.getState()[e]??"";switch(n){case Y.PARAM_SWEEP:lRe(t,r);break;case Y.GLOBAL_PARAM_SWEEP:uRe(r,e);break;case Y.GLOBAL_VARIABLES:case Y.SECTION:const i=Kee.getState()[e]??{};hRe(t,r,i);break}}function lRe(t,e){const n=te.getState(),r=ky(t,n.x),s=Cne(e).map(c=>c.trim()?TT(c):{}),o=Jo(r,n).children,a=Object.keys(o),l=[];for(const c of s){const u=!Array.isArray(c);let f=null,h;if(u){if(h=Object.keys(c)[0],!h){l.push({selectedItem:null,params:[]});continue}if(f=cRe(h,a,n.codeInfo),!f)continue}const{pathMap:d}=_y({allCodeInfo:n.codeInfo,codeInfoChildren:o,startingId:f});let p=h?c[h]:c;ae.size(p)===0&&(p=[]);const g=[];for(const m of p){const v=Object.keys(m)[0];let y;for(const S of Object.keys(d))if(C$(n.codeInfo,d,S)===v){y=S;break}if(!y)continue;const b=m[v];ae.size(b)>0&&g.push({paramInfoId:y,values:b})}l.push({selectedItem:f,params:g})}te.setState(c=>{Yt(t,c).sweep=l})}function cRe(t,e,n){return e.find(r=>{var i;return((i=n[r])==null?void 0:i.name)===t})}function uRe(t,e){const n=sRe(t)[0].toJS(),r=te.getState(),i=r.x,s=r.variants,o={};for(const[a,l]of Object.entries(n))AT(a,l,i,s,o,null,null);te.setState(a=>{a.variants[e].runGroup=o})}function AT(t,e,n,r,i,s,o){let a=s,l=o;const[c,u]=fRe(t,s,n,r);if(u==="section"?(c in i||(i[c]={}),i[c][o]={selected:!0,versions:{},paramSweeps:{}},a=c):u==="sectionVariant"?(i[s][o].versions[c]=!0,l=c):u==="paramSweep"&&(i[s][o].paramSweeps[c]=!0),e)for(const[f,h]of Object.entries(ae.pickBy(e,(d,p)=>p.startsWith("~"))))AT(f,h,n,r,i,a,l);if(u==="section"&&(!e||!Object.keys(e).some(f=>f.startsWith("@")))&&(l=n[c].variantId,i[c][o].versions[l]=!0),!!e)for(const[f,h]of Object.entries(ae.pickBy(e,(d,p)=>!p.startsWith("~"))))AT(f,h,n,r,i,a,l)}function fRe(t,e,n,r){let i,s;if(e&&t.startsWith("@")){const o=t.slice(1);for(const a of n[e].variantIds)if(r[a].name===o){i=a,s="sectionVariant";break}}else if(e&&t.startsWith("~")){const o=t.slice(1),{paramSweepSectionId:a}=n[e];for(const l of n[a].variantIds)if(r[l].name===o){i=l,s="paramSweep";break}}else if(e){for(const o of r[n[e].variantId].children)if(n[o].name===t){i=o,s="section";break}}else for(const o of Object.values(n))if(o.name===t){i=o.id,s="section";break}return[i,s]}function hRe(t,e,n){var T,C;const r=te.getState(),i=Cne(e);let s=null,o={},a={};i.length===3?[s,o,a]=i:i.length===2?[o,a]=i:[a]=i;try{o=(T=o.trim)!=null&&T.call(o)?TT(o):{},a=(C=a.trim)!=null&&C.call(a)?TT(a):{}}catch{return}const l=vF(Qx(n.pinned),Qx(n.unpinned)),c=vF(Qx(o,!0),Qx(a,!0)),u=[],f=new Set,h=new Set;for(const A of l){if(f.has(A.id))continue;let R=c.filter(Q=>Q.key===A.key&&!h.has(JSON.stringify(Q.keyPath)));R.length>0&&(gF(R,A.keyPath),pF({v:A,matches:R,usedOriginalIds:f,usedPaths:h,output:u}))}for(const A of l){if(f.has(A.id))continue;let R=c.filter(Q=>Q.value===A.value&&!h.has(JSON.stringify(Q.keyPath)));R.length>0&&(gF(R,A.keyPath),pF({v:A,matches:R,usedOriginalIds:f,usedPaths:h,output:u}))}const{jsonSource:d,jsonSourceKeys:p}=r.x[t];for(const A of c){if(h.has(JSON.stringify(A.keyPath)))continue;const R={key:A.key,keyPath:A.keyPath,value:A.value,isPinned:A.isPinned};R.id=_te(R.keyPath,d,p),R.isNewParam=!0,u.push(R)}const g={};for(const[A,R]of c.entries())g[JSON.stringify(R.keyPath)]=A;u.sort((A,R)=>{const Q=g[JSON.stringify(A.keyPath)],L=g[JSON.stringify(R.keyPath)];return Q-L});const{parentCodeInfoId:m}=Ry(t,r),v={[m]:[]};for(const A of u)v[A.id]=[];OF({sectionId:t,idsToChildren:v,output:u,toProcess:u.filter(A=>!(A.isPinned&&!A.isNewParam)),inputParentId:m,insertAtOriginalIdx:!1}),OF({sectionId:t,idsToChildren:v,output:u,toProcess:u.filter(A=>A.isPinned&&!A.isNewParam),inputParentId:m,insertAtOriginalIdx:!0});const y=r.codeInfo,b={},S={},k={},E=Fm().value;for(const A of u)A.id in y?S[A.id]={name:A.key,isPinned:A.isPinned}:b[A.id]=E5({id:A.id,name:A.key,editable:A.editable??!0,rcType:Y.PARAMETER,isPinned:A.isPinned}),A.value!==E&&(k[A.id]=A.value);te.setState(A=>{A.codeInfo={...A.codeInfo,...b};for(const[L,z]of Object.entries(S))for(const[B,q]of Object.entries(z))A.codeInfo[L][B]=q;const R=A.x[t].variantId,Q=A.variants[R];for(const[L,z]of Object.entries(v))W$(Q,A).children[L]=z;for(const[L,z]of Object.entries(k))Y$(R,L,z,A)})}function pF({v:t,matches:e,usedOriginalIds:n,usedPaths:r,output:i}){const s={key:e[0].key,keyPath:e[0].keyPath,value:e[0].value,isPinned:e[0].isPinned};s.id=t.id,s.editable=t.editable,i.push(s),n.add(t.id),r.add(JSON.stringify(s.keyPath))}function Qx(t,e=!1){let n=[];function r(i,s,o,a){if(typeof s=="object"&&!Array.isArray(s)&&s!==null){a.length>0&&n.push({id:i,keyPath:a,value:null,editable:o,key:a[a.length-1]});for(const[l,c]of Object.entries(s)){const u=[...a,l];e?r(null,c,null,u):r(c.id,c.value,c.editable,u)}}else n.push({id:i,keyPath:a,value:s,editable:o,key:a[a.length-1]})}return r(null,t,null,[]),n}function mF(t,e){const n=Math.min(t.length,e.length),r=Math.max(t.length,e.length);let i=0;for(let s=0;s<n&&t[t.length-1-s]===e[e.length-1-s];s++)i++;return i/r*(n/r)}function gF(t,e){return t.sort((n,r)=>{const i=mF(n.keyPath,e);return mF(r.keyPath,e)-i})}function vF(t,e){for(const r of e)r.isPinned=!1;const n=[];for(const r of t)e.find(s=>ae.isEqual(s.keyPath,r.keyPath))||n.push({...r,isPinned:!0});return[...n,...e]}function OF({sectionId:t,idsToChildren:e,output:n,toProcess:r,inputParentId:i,insertAtOriginalIdx:s}){for(const o of r){let a=i;if(o.keyPath.length>1){const l=ae.find(n,c=>ae.isEqual(c.keyPath,o.keyPath.slice(0,-1)));if(l)a=l.id;else continue}if(s){const l=Jo(t).children[a].indexOf(o.id);e[a].splice(l,0,o.id)}else e[a].push(o.id)}}async function Nd(t,e){Pi(t).displayMode===so.YAML&&await Ene(t,e)}async function p_(t=!1){const e=te.getState();for(const[n,r]of Object.entries(e.x)){const i=t?z5(n):r.variantId;await Nd(n,i)}}function Vi(t){mT.setState(e=>{e.timeoutId!==null&&clearTimeout(e.timeoutId);const n=setTimeout(()=>mT.setState({message:""}),3e3);return{message:t,timeoutId:n}})}function Q5({withArtifacts:t=!1,convertYamlToGUI:e=!0}){let n=ae.cloneDeep(te.getState().x);if(n=ae.pickBy(n,d=>!d.isTemporary),e)for(const d of Object.values(n))d.displayMode===so.YAML&&V$(d.id);n=ae.mapValues(n,d=>(d.columnWidth=jm.getState()[d.id],d));const r=t?MAe():{},i=ae.mapValues(te.getState().variants,d=>({...d,children:d.children.filter(p=>p in n)})),s=te.getState().artifactGroups,o=ae.pickBy(te.getState().uiTypes,d=>d.presetType!==Y.PRESET_UI_TYPE_BASE),a=te.getState().uiTypeCols,l=te.getState().codeInfo,c=te.getState().codeInfoCols,u=mRe(),f={};for(const d of mr.getState().x.values())d.id in n&&(f[d.id]={x:d.position.x,y:d.position.y,zIndex:d.zIndex,w:d.width,h:d.height});return u.children=f,{projectConfig:u,sectionVariants:i,artifacts:r,artifactGroups:s,uiTypes:o,uiTypeCols:a,sections:n,codeInfo:l,codeInfoCols:c}}async function j5(){let t;Vi("Saving..."),vo.getState().name===HR?(t=await SAe(Q5({})),t.status===200&&Nt.setState(t.data)):t=await pAe({project:await U$()}),t.status===200&&Vi("Saved!")}async function dRe({newConfigName:t,withRefs:e}){return await Tne({fn:mAe,otherArgs:{newConfigName:t,withRefs:e}})}async function pRe({configName:t}){return await Tne({fn:gAe,otherArgs:{configName:t}})}async function Tne({fn:t,otherArgs:e}){await t({project:await U$(),...e})}function mRe(){const t=vo.getState(),e={id:t.id,name:t.name,previewImgColor:t.previewImgColor};return e.viewport=qe.getState().fitViewOnInit?null:bee(),e}async function U$(){const t=Q5({withArtifacts:!0,convertYamlToGUI:!0});return Nt.getState().backend.saveRenderedValues&&await gRe(t.sections),t}async function gRe(t){for(const e of Object.keys(t))[Y.DRAW,Y.CHART].includes(dn(e))&&(t[e].renderedValue=await Ine(e))}async function vRe(t){return await jt({body:{projects:t},address:Y.ROUTE_UPDATE_INTERACTIVE_CODE})}async function ORe(){const t=Q5({}),e={};for(const n of Object.values(t.sections))dn(n.id)===Y.CODE&&(e[n.id]=O$(n.id,Yt(n.id).code));return await jt({body:{project:t,candidateTemplateVars:e},address:Y.ROUTE_FORMAT_CODE})}async function yRe(){const t=await ORe();t.status===200&&te.setState(e=>{for(const[n,r]of Object.entries(t.data))r!==null&&(Yt(n,e).code=r)})}function Pne(t,e){const n=JSON.stringify(t),{throttledSendFns:r}=pT.getState();n in r?r[n](n,e):null in r&&r[null](n,e)}async function bRe(t){if(t.length===0)return;const e=ti.getState().namePathTypeToId,n=[],r=[];for(const[s,o]of t.entries()){"path"in o||(o.path="");const a=e[_$(o)];a?o.id=a:(n.push(s),r.push(ae.pick(o,["name","path","type"])))}const i=await iAe(r);if(i.status==200)for(const[s,o]of i.data.entries()){const a=n[s];t[a].id=o??Kn()}}async function Ane(t){if(t.length===0)return;const e={},n=ti.getState();for(const r of t)"path"in r||(r.path=""),r.type==="img"&&(r.value=await g$(r.value)),e[r.id??n.namePathTypeToId[_$(r)]]=r;ti.setState(r=>({x:{...r.x,...e}}))}function Rne(t){const e=xRe(t),n=wRe(e);for(const r of Object.values(pT.getState().throttledSendFns))r.cancel();pT.setState({inMemorySubprocessInfo:e,throttledSendFns:n})}function xRe(t){const e=ae.cloneDeep(t);for(const n of Object.values(e))for(const r of Object.values(n.fnInfo)){const i=new Set;for(const s of r.dependencies){const o=s===null?s:JSON.stringify(s);i.add(o)}r.dependencies=i}return e}function wRe(t){const e={};for(const n of Object.values(t))for(const r of Object.values(n.fnInfo))for(const i of r.dependencies)e[i]=ae.throttle((s,o)=>{Ay({id:Kn(),content:{[s]:o},messageType:"inMemoryFn"})},SRe(t,i));return e}function SRe(t,e){let n=0;for(const r of Object.values(t))for(const i of Object.values(r.fnInfo))(i.dependencies.has(e)||i.dependencies.has(null))&&i.averageRunTime>n&&(n=i.averageRunTime);return Math.max(n*1e3,50)}function _Re(t){const{projectConfigId:e,codeSectionId:n,diagnostics:r}=t;if(e!==vo.getState().id)return;const i={};for(const s of r){const{sectionId:o,paramInfoId:a,message:l}=s;te.getState().codeInfo[a].ignoreTypeErrors||(o in i||(i[o]={}),a in i[o]||(i[o][a]=[]),i[o][a].push(l))}gp.getState().userRequested&&Vi(ae.size(i)===0?"No type errors":`Found ${ae.size(i)} type errors`),gp.getState().reset(),gp.setState({errors:i})}function kRe(t,e){for(const n of Object.values(e.errors))t in n&&delete n[t]}function CRe(t){const{connections:e}=t,n=e.filter(r=>r.isCLI);n.map(r=>r.websocketId).includes(Qm.getState().connectedTo)||(n.length>0?RT(n[0].websocketId):RT(null)),ERe(e)}function RT(t){Qm.setState({connectedTo:t})}function ERe(t){Qm.setState({connections:t})}let ro;const $ne=ae.debounce(t=>{q$()||(ro=new WebSocket(`${Hp.WEBSOCKET}${Y.ROUTE_WEBSOCKET_MANAGER}`),ro.addEventListener("open",()=>{Mne(t)}),ro.addEventListener("message",e=>{PRe(e.data)}),ro.addEventListener("error",TRe),ro.addEventListener("close",()=>{ro=null,setTimeout(()=>{$ne(t)},3e3)}))},1e3,{leading:!0});function TRe(){ro&&(ro.close(),ro=null)}function q$(){return ro&&ro.readyState===1}function PRe(t){const e=JSON.parse(t);e.messageType===Y.WS_ALL_CONNECTIONS?CRe(e):e.messageType===Y.WS_LSP_DIAGNOSTICS?_Re(e.content):e.messageType===Y.WS_LSP_STATUS?Vi(`Language Server ${e.content.data}`):e.messageType===Y.WS_ARTIFACT||e.messageType===Y.WS_IN_MEMORY_FN_RETURN?Ane(e.content):e.messageType===Y.WS_IN_MEMORY_FN_AVG_RUN_TIME?Rne(e.content):e.id&&oO(e.id,e.content)}function Mne(t){q$()&&ro.send(JSON.stringify({location:t}))}async function Ay({content:t,id:e,messageType:n}){const r=Qm.getState().connectedTo;q$()&&r&&ro.send(JSON.stringify({id:e,content:t,toWebsocketId:r,messageType:n}))}function ARe(t){y5.setState(e=>ae.omit(e,[t]),!0)}function oO(t,e){y5.setState({[t]:e})}function X$({id:t,condition:e,fn:n}){return new Promise(r=>{const i=t||Kn(),s=y5.subscribe(o=>o[i],o=>{(!e||e(o))&&(s(),r(o),ARe(i))});n==null||n(i)})}async function im({id:t,messageType:e,content:n,condition:r}){return await X$({id:t,condition:r,fn:s=>Ay({id:s,messageType:e,content:n})})}async function Ine(t){const e=i=>oO(i,!0),n=Dne(t);return await X$({id:n,condition:()=>!0,fn:e})}function Dne(t){return`${t}-base64-request`}function Lne(t,e){const n=Dne(t);return y5.subscribe(i=>i[n],i=>{i===!0&&oO(n,Ete(e.current))})}async function RRe(t){let e=!1;return await X$({id:$T(t),condition:n=>(e=n,!0)}),e}function $T(t){return`${t}-delete-request`}function Pi(t){return te.getState().x[t]}function sm(t){return Pi(t).parentId}function dn(t,e){const n=e??te.getState();return n.uiTypes[n.x[t].uiTypeId].type}function Yt(t,e){const n=e??te.getState();return n.variants[n.x[t].variantId]}function B5(t,e=sm){let n=e(t),r=t;for(;n;)r=n,n=e(n);return r}function H$(t,e){let n=e.x[t].parentId;if(!n)return e.x[t].name;let r=t,i="";for(;n;)dn(n,e)===Y.LIST_ROOT?i=`[${Yt(n,e).children.indexOf(t)}]${i}`:i=`["${e.x[r].name}"]${i}`,r=n,n=e.x[n].parentId;return`${e.x[r].name}${i}`}function $Re(t,e){const n=[t];let r=0;for(;r<n.length;){const i=n[r];n.push(...Yt(i,e).children),r+=1}return n}function MRe(t){te.setState(e=>{e.x[t].isHorizontalOrientation=!e.x[t].isHorizontalOrientation})}function IRe(t){te.setState(e=>{e.x[t].positionAndSizeLocked=!e.x[t].positionAndSizeLocked})}function m_(){qf.getState().update(G$())}function Nne(){te.setState(t=>{for(const e of Object.values(t.x))e.previewVariantId=null})}function Z$({sections:t,sectionVariants:e,uiTypes:n,uiTypeCols:r,codeInfo:i,codeInfoCols:s,state:o}){o.x={...o.x,...t},o.variants={...o.variants,...e},o.uiTypes={...o.uiTypes,...n},o.uiTypeCols={...o.uiTypeCols,...r},o.codeInfo={...o.codeInfo,...i},o.codeInfoCols={...o.codeInfoCols,...s}}function Y$(t,e,n,r){e in r.variants[t].values||(r.variants[t].values[e]=Fm()),r.variants[t].values[e].value=n}function MT(t,e,n,r){Y$(r.x[t].variantId,e,n,r)}function Jo(t,e){const n=e??te.getState(),r=Yt(t,n).codeInfoColId;return r?n.codeInfoCols[r]:k5()}function Qne(t,e){const n=e??te.getState();return n.codeInfoCols[Ll(t,n).codeInfoColId]}function Ll(t,e){const n=e??te.getState();return n.variants[z5(t,n)]}function z5(t,e){const n=e??te.getState();return n.x[t].previewVariantId??n.x[t].variantId}function om(t,e,n){const r=Yt(t,n);r.children=e(r.children)}function jne(t,e,n){const r=Ll(t,e).children;if(n[t]=r,r)for(const i of r)jne(i,e,n)}function G$(t,e=!1){const n={},r=t??te.getState();for(const i of Object.values(r.x))i.parentId||(jne(i.id,r,n),e&&(null in n||(n[null]=[]),n[null].push(i.id)));return n}function DRe(t){const e={},n=t??te.getState();for(const r of Object.values(n.x))e[r.id]=r.parentId;return e}function LRe(t,e){const n=[];for(const r of e.x[t].variantIds)n.push(...e.variants[r].children);return n}function Bne(t,e){const n=[...t];let r=0;for(;r<n.length;){const i=LRe(n[r],e),{paramSweepSectionId:s}=e.x[n[r]];i&&n.push(...i),s&&n.push(s),r+=1}return n}function NRe(t){te.setState(e=>{e.variants[t].isFrozen=!e.variants[t].isFrozen})}function QRe(t,e){te.setState(n=>{n.x[t].defaultVariantId=e})}function zne(t){te.setState(e=>{for(const n of t){const r=e.x[n];r.variantId=r.defaultVariantId}})}function jRe(){zne(Object.keys(te.getState().x))}function BRe(t,e){const n=Kn(),r=e.codeInfoCols;return r[n]=ae.cloneDeep(r[t]),n}function zRe(t,e,n,r){const i=Kn(),s=r.variants;return s[i]=ae.cloneDeep(s[t]),s[i].name=e,s[i].codeInfoColId=n,s[i].isFrozen=!1,i}function Ry(t,e,n=null){const r=n?e.variants[n]:Ll(t,e),{codeInfoColId:i}=r,s=r.selectedItem;return{codeInfoChildren:i?e.codeInfoCols[i].children:k5().children,parentCodeInfoId:s}}async function FRe(t,e,n){const r=te.getState(),{jsonSource:i}=r.x[t];if(i){const{name:s}=r.variants[e],o=await yPe(s);o.status==200&&(YPe(o.data),await RRe(o.data)&&yF(t,e,n))}else yF(t,e,n)}function yF(t,e,n){te.setState(r=>{const i=r.x[t];i.variantIds=i.variantIds.filter(s=>s!==e),i.defaultVariantId===e&&(i.defaultVariantId=i.variantIds[0]),n&&(i.variantId=i.variantIds[0]),delete r.variants[e]})}const bF={activeId:null,activeIsTopLevel:!1,overId:null,triggerDistCondition:!1,isSorting:!1,isMovingFree:!1,disabled:{},width:null,height:null,times:{}},cn=qr(vn($d(Sn((t,e)=>({...bF,setActive:({id:n,isTopLevel:r,width:i,height:s})=>t({activeId:n,activeIsTopLevel:r,width:i,height:s}),activateSortingMode:()=>t({isSorting:!0,isMovingFree:!1}),activateMovingFreeMode:()=>{t({isMovingFree:!0,isSorting:!1})},deactivate:()=>{t({...bF,disabled:e().disabled}),m_()},setDisabled:(n,r)=>t(i=>{i.disabled[n]=r}),setTime:n=>t(r=>{r.times[n]=Date.now()})}))))),IT="-TempDND";function $y(t){return`${t}${IT}`}function F5(t){return t.slice(-IT.length)===IT}function Fne(){return cn(t=>({isSorting:t.isSorting,isMovingFree:t.isMovingFree}),ae.isEqual)}const qf=qr(vn($d(Sn(t=>({x:{},y:{},addChild:({oldParentId:e,newParentId:n,childId:r,index:i})=>t(s=>{e&&(s.x[e]=s.x[e].filter(o=>o!==r)),s.x[n]=[...s.x[n].slice(0,i),r,...s.x[n].slice(i)],s.y[r]=n}),removeChild:e=>t(n=>{const r=n.y[e];r&&(n.x[r]=n.x[r].filter(i=>i!==e),n.y[e]=void 0)}),replaceWithTemp:e=>t(n=>{const r=n.y[e];if(r){const i=n.x[r].indexOf(e),s=$y(e);n.x[r][i]=s,n.y[s]=r,n.y[e]=void 0}}),update:e=>t(n=>{n.x=e,n.y={};for(const[r,i]of Object.entries(e))for(const s of i)n.y[s]=r})})))));function WRe(t){const e=[],n={};for(const o of Object.keys(t.details))if(t.details[o].isTopLevelAndCanHaveEVRefs)if(t.globalVariableId===o)K$(t,o,null,e,n,"",[],!0);else{const a=t.details[o].name;Wne(t,e,n,o,a,[a.length])}if(e.length===0)return{pattern:Jp(),codeAreaPattern:Jp(),fullNameToInfo:n};const r=`(?<![A-Za-z."'_])(${e.join("|")})(?![A-Za-z"'_])`,i=new RegExp(r,"g"),s=new RegExp(`(?<=.*?\\${Y.TEMPLATE_PREFIX}${Y.SETTA_GENERATED_PYTHON}.*?)${r}`,"gs");return{pattern:i,codeAreaPattern:s,fullNameToInfo:n}}function Wne(t,e,n,r,i,s){const o=t.details[r].sectionTypeName;for(const[u,f]of t.details[r].sectionChildren.entries()){const h=t.details[f].name,d=o===Y.LIST_ROOT?`[${u.toString()}]`:`["${h}"]`,p=`${i}${d}`;Wne(t,e,n,f,p,[...s,p.length])}const a=i,l=`${Y.ARGS_PREFIX}${i}`,c=s.map(u=>u+Y.ARGS_PREFIX.length);K$(t,r,t.details[r].selectedItem,e,n,l,c),e.push(o_(a)),n[a]={sectionId:r,paramInfoId:null,componentIndices:s,isArgsObj:!1},o===Y.SECTION&&(e.push(o_(l)),n[l]={sectionId:r,paramInfoId:null,componentIndices:c,isArgsObj:!0})}function K$(t,e,n,r,i,s,o,a=!1){const c=t.details[e].codeInfoChildren[n].map(u=>t.codeInfo[u]);for(const u of c){if(!u.name||u.rcType!==Y.PARAMETER)continue;const f=a?u.name:`${s}["${u.name}"]`,h=[...o,f.length];K$(t,e,u.id,r,i,f,h),r.push(o_(f)),i[f]={sectionId:e,paramInfoId:u.id,componentIndices:h,isArgsObj:!1}}}function Vne(t={}){const{width:e,height:n,d3Zoom:r,d3Selection:i,fitViewOnInitDone:s,fitViewOnInit:o}=qe.getState(),{minZoom:a,maxZoom:l}=Nt.getState().gui,c=t.initial&&!s&&o;if(r&&i&&(c||!t.initial)){const f=Xm().filter(d=>{var p;return(p=t.nodes)!=null&&p.length?t.nodes.some(g=>g.id===d.id):!0}),h=f.every(d=>d.width&&d.height);if(f.length>0&&h){const d=d5(f),{x:p,y:g,zoom:m}=_ee(d,e,n,t.minZoom??a,t.maxZoom??l,t.padding??.1),v=ou.translate(p,g).scale(m);return typeof t.duration=="number"&&t.duration>0?r.transform(Id(i,t.duration),v):r.transform(i,v),!0}}return!1}function Une(){if(qe.getState().fitViewOnInit)return;const t=Nt.getState().gui.transitionDuration;Vne({duration:t}),setTimeout(()=>qe.setState({fitViewOnInit:!0}),t+10)}function J$(t){return!t.fitViewOnInit||t.fitViewOnInitDone}function Xm(t=null){return Array.from(t?t.x.values():mr.getState().x.values())}function eM(t){const e=Qd();for(const n of t)e.set(n.id,n);mr.setState({x:e})}function qne(t){const e=Qd();for(const n of t)e.delete(n);mr.setState({x:e})}function Xne(t){const{fitViewOnInit:e,fitViewOnInitDone:n,fitViewOnInitOptions:r,domNode:i}=qe.getState();if(!(i==null?void 0:i.querySelector(".react-flow__viewport")))return;const o=Qd();for(const c of t){const u=o.get(c.id);if(u){const f=cEe(c.nodeElement);!!(f.width&&f.height&&(u.width!==f.width||u.height!==f.height||c.forceUpdate))&&o.set(u.id,{...u,...f})}}mr.setState({x:o});const a=Ut.getState();if(a.numInitializedCodeAreas!==a.numDisplayedCodeAreas)return;const l=n||e&&!n&&Vne({initial:!0,...r});qe.setState({fitViewOnInitDone:l})}function Hne(t){const e=Qd();for(const n of t)e.get(n.id).position=n.position;mr.setState({x:e})}function VRe(t){const e=Qd();for(const[,n]of e)n.tempZIndex=n.zIndex;for(const n of t)e.get(n.id).tempZIndex=e.get(n.id).zIndex+1e3;mr.setState({x:e})}function URe(t,e){const n=Qd();n.get(t).position=e,mr.setState({x:n})}function Qd(){return ae.cloneDeep(mr.getState().x)}function Zne(t,e){if(e)return t.map(i=>({id:i.target.getAttribute("data-id"),nodeElement:i.target,forceUpdate:!0}));const n=[],r=ka.getState().withNested;return t.forEach(i=>{r[i]&&n.push({id:i,nodeElement:r[i],forceUpdate:!0})}),n}async function qRe(t,e,n){return await jt({body:{codeAreaReplacements:t,codeInfoReplacements:e,paramEVReplacements:n},address:Y.ROUTE_MAKE_EV_REF_TEMPLATE_VAR_REPLACEMENTS})}function XRe(){const t={},e={},n={},r=te.getState(),i=Tte();let s=!1,o=!1;for(const a of Object.keys(te.getState().variants))o=HRe(a,t,e,n,r,i),s||(s=o),o=ZRe(a,t,r),s||(s=o);return[t,e,n,s]}function HRe(t,e,n,r,i,s){let o,a,l=!1;const c=i.variants[t];for(const u of c.evRefs)o=Yne(e,t,i),a=$6(u,s,o),l||(l=a);if(c.selectedItem){const u=c.selectedItem;for(const f of i.codeInfo[u].evRefs)o=GRe(n,u,i),a=$6(f,s,o),l||(l=a)}for(const[u,f]of Object.entries(c.values))for(const h of f.evRefs)o=YRe(r,t,u,i),a=$6(h,s,o),l||(l=a);return l}function $6(t,e,n){const r=e[Pte(t)];return n.replacements.push({originalEVRef:t,newName:r}),t.keyword!==r}function ZRe(t,e,n){let r,i=!1;for(const s of n.variants[t].templateVars)if(r=Yne(e,t,n),s.sectionId){const o=Object.values(n.x).find(a=>a.id===s.sectionId);if(o){const a=cAe(s.keyword),l=`${o$(H$(o.id,n))}${a}`;r.replacements.push({originalTemplateVar:s,newName:l}),s.keyword!==l&&(i=!0)}}else r.replacements.push({originalTemplateVar:s,newName:s.keyword});return i}function tM(t){return{string:t,replacements:[]}}function YRe(t,e,n,r){return e in t||(t[e]={}),n in t[e]||(t[e][n]=tM(r.variants[e].values[n].value)),t[e][n]}function GRe(t,e,n){return e in t||(t[e]=tM(n.codeInfo[e].name)),t[e]}function Yne(t,e,n){return e in t||(t[e]=tM(n.variants[e].code)),t[e]}async function KRe(){const t=Nt.getState().backend.renameReferencesOnSectionMoveMode;if(t===G1.NEVER_RENAME)return;const[e,n,r,i]=XRe();i&&(t===G1.ALWAYS_ASK?ZPe(e,n,r):t===G1.ALWAYS_RENAME&&await Gne(e,n,r))}async function Gne(t,e,n){const r=await qRe(t,e,n);if(r.status===200){const{newCodeAreaValues:i,newCodeInfoValues:s,newParamEVValues:o}=r.data;te.setState(a=>{let l;for(const[c,u]of Object.entries(i))l=a.variants[c],l.code=u[0],l.evRefs=u[1],l.templateVars=u[2];for(const[c,u]of Object.entries(s))l=a.codeInfo[c],l.name=u[0],l.evRefs=u[1];for(const[c,u]of Object.entries(o))for(const[f,h]of Object.entries(u))l=a.variants[c].values[f],l.value=h[0],l.evRefs=h[1]})}}const nM=[Y.SECTION,Y.LIST_ROOT,Y.DICT_ROOT,Y.GROUP,Y.GLOBAL_VARIABLES,Y.CODE,Y.DRAW];function Kne(t,e){e.variants[t].runGroup={sections:{}};for(const n of mr.getState().x.keys())nM.includes(dn(n))&&W5(t,n,null,e)}function JRe(t,e){te.setState(n=>{const r=n.x[t].selectedVariantIds;e in r?delete r[e]:r[e]=!0})}function Jne(t,e,n){return{selected:!0,paramSweeps:{},versions:{[e??n.x[t].variantId]:!0}}}function W5(t,e,n,r,i=null){let s=!1;return e in r.variants[t].runGroup||(r.variants[t].runGroup[e]={},ere(t,i??r.x[e].variantId,r),s=!0),n in r.variants[t].runGroup[e]||(r.variants[t].runGroup[e][n]=Jne(e,i,r),s=!0),s}function ere(t,e,n){for(const r of n.variants[e].children)W5(t,r,e,n)}function e$e(t,e,n){for(const[r,i]of e.entries()){const s=r===0?null:e[r-1].variantId;W5(t,i.id,s,n);const o=n.variants[t].runGroup[i.id][s];o.versions[i.variantId]=!0,o.selected=!0}}function t$e(t,e,n){var r;for(const[i,s]of e.entries()){const o=i===0?null:e[i-1].variantId;if(!((r=n.variants[t].runGroup[s.id])!=null&&r[o].versions[s.variantId])||!tre(t,s.id,o,n))return!1}return!0}function tre(t,e,n,r){var i;return(i=r.variants[t].runGroup[e])==null?void 0:i[n].selected}function rM({runGroupId:t,ancestors:e,sectionId:n,attrName:r,attrId:i,parentVariantId:s}){te.setState(o=>{const a=W5(t,n,s,o,r==="versions"?i:null);let l;const c=o.variants[t].runGroup[n][s];if(!a&&t$e(t,e,o)&&(r==="selected"||tre(t,n,s,o))?l=i?!c[r][i]:!c[r]:l=!0,i?c[r][i]=l:c[r]=l,l&&(c.selected=!0,e$e(t,e,o),r==="selected"||r==="versions")){const u=r==="versions"?i:o.x[n].variantId;ere(t,u,o)}})}function n$e({id:t,ancestors:e,sectionId:n,parentVariantId:r}){rM({runGroupId:t,ancestors:e,sectionId:n,attrName:"selected",parentVariantId:r})}function r$e({id:t,paramSweepId:e,ancestors:n,sectionId:r,parentVariantId:i}){rM({runGroupId:t,ancestors:n,sectionId:r,attrName:"paramSweeps",attrId:e,parentVariantId:i})}function i$e({id:t,versionId:e,ancestors:n,sectionId:r,parentVariantId:i}){rM({runGroupId:t,ancestors:n,sectionId:r,attrName:"versions",attrId:e,parentVariantId:i})}function s$e(t){return te(e=>{const n=[];for(const r of e.variants[t].children)nM.includes(e.uiTypes[e.x[r].uiTypeId].type)&&n.push({id:r,name:e.x[r].name});return n},ae.isEqual)}function o$e(){return te(t=>{const e=[];for(const[n,r]of Object.entries(t.x))!r.parentId&&nM.includes(t.uiTypes[t.x[n].uiTypeId].type)&&e.push({id:n,name:r.name});return e},ae.isEqual)}function a$e(t,e){te.setState(n=>{const r=n.singletonSections[Y.GLOBAL_PARAM_SWEEP];if(r)for(const[i,s]of Object.entries(t)){if(!(i in e)||s===e[i])continue;const{variantIds:o}=n.x[r];for(const a of o){const l=n.variants[a].runGroup;if(!(i in l))continue;const c=s?n.x[s].variantIds:[null];for(const u of c)l[i][u]=Jne(i,void 0,n)}}})}function l$e(t){const e=[Y.SETTA_GENERATED_PYTHON,Y.SETTA_GENERATED_PYTHON_IMPORTS],n={};for(const a of e)n[a]=null;const r=te.getState();for(const[a,l]of Object.entries(t.templateVarEligibleSections)){const c=H$(a,r);for(const u of l){const f=c+`${Y.TEMPLATE_PREFIX}${u}`;e.push(o_(f)),n[f]=a}}const i=ae.mapKeys(n,(a,l)=>o$(l));if(e.length===0)return{pattern:Jp(),fullNameToSectionId:i};const s=`(?<![A-Za-z."'_])\\${Y.TEMPLATE_PREFIX}(${e.join("|")})(?![A-Za-z"'_])`;return{pattern:new RegExp(s,"g"),fullNameToSectionId:i}}function c$e(){te.subscribe(u$e,t=>{te.setState(e=>{e.singletonSections=t})},{equalityFn:ae.isEqual}),te.subscribe(f$e,t=>{Dd.setState(WRe(t)),O5.setState(l$e(t)),te.getState().shouldRenameReferences&&(te.setState({shouldRenameReferences:!1}),KRe())},{equalityFn:ae.isEqual}),te.subscribe(G$,t=>{qf.getState().update(t)},{equalityFn:ae.isEqual}),te.subscribe(DRe,(t,e)=>{a$e(t,e)},{equalityFn:ae.isEqual}),qe.subscribe(h$e,(t,e)=>{e.fitViewOnInit&&e.fitViewOnInitDone&&t.fitViewOnInit&&t.fitViewOnInitDone&&qe.setState({fitViewOnInit:!1}),window.reactFlowZoom=t.transform[2]},{equalityFn:ae.isEqual}),Ut.subscribe(d$e,t=>{t&&(Xne(Zne(mr.getState().x.keys(),!1)),Ut.setState({requestUpdateNodeDimensions:!1}))},{equalityFn:ae.isEqual}),Ut.subscribe(t=>t.undoOrRedoWasTriggered,t=>{t&&Ut.setState(e=>({updateDrawAreas:e.updateDrawAreas+1,undoOrRedoWasTriggered:!1}))}),ti.subscribe(p$e,t=>{ti.setState(()=>{const e={};for(const[n,r]of Object.entries(t))e[_$(r)]=n;return{namePathTypeToId:e}})},{equalityFn:ae.isEqual})}function u$e(t){var n;const e={[Y.GLOBAL_VARIABLES]:null,[Y.GLOBAL_PARAM_SWEEP]:null,inMemoryFnStdoutTerminal:null};for(const r of Object.values(t.x)){const i=(n=t.uiTypes[r.uiTypeId])==null?void 0:n.type;if(e[Y.GLOBAL_VARIABLES]&&e[Y.GLOBAL_PARAM_SWEEP]&&e.inMemoryFnStdoutTerminal&&e.temporaryTerminalGroup)break;!e[Y.GLOBAL_VARIABLES]&&i===Y.GLOBAL_VARIABLES&&(e[Y.GLOBAL_VARIABLES]=r.id),!e[Y.GLOBAL_PARAM_SWEEP]&&i===Y.GLOBAL_PARAM_SWEEP&&(e[Y.GLOBAL_PARAM_SWEEP]=r.id),!e.inMemoryFnStdoutTerminal&&i===Y.TERMINAL&&r.isReadOnlyTerminal&&(e.inMemoryFnStdoutTerminal=r.id),!e.temporaryTerminalGroup&&i===Y.GROUP&&r.isTemporary&&(e.temporaryTerminalGroup=r.id)}return e}function f$e(t){const e={details:{},codeInfo:ae.mapValues(t.codeInfo,i=>({id:i.id,name:i.name,rcType:i.rcType})),globalVariableId:t.singletonSections[Y.GLOBAL_VARIABLES],templateVarEligibleSections:{}};let n,r;for(const[i,s]of Object.entries(t.x))n=Yt(i,t),r=dn(i,t),e.details[i]={name:s.name,sectionChildren:n.children,codeInfoChildren:Jo(i,t).children,sectionTypeName:r,selectedItem:n.selectedItem,isTopLevelAndCanHaveEVRefs:!s.parentId&&[Y.GLOBAL_VARIABLES,Y.SECTION,Y.LIST_ROOT,Y.DICT_ROOT,Y.GROUP].includes(r)},r===Y.CODE?e.templateVarEligibleSections[i]=[Y.TEMPLATE_VAR_VERSION_SUFFIX,Y.TEMPLATE_VAR_IMPORT_PATH_SUFFIX,Y.TEMPLATE_VAR_FILE_PATH_SUFFIX]:e.templateVarEligibleSections[i]=[Y.TEMPLATE_VAR_VERSION_SUFFIX];return e}function h$e(t){return{transform:t.transform,fitViewOnInit:t.fitViewOnInit,fitViewOnInitDone:t.fitViewOnInitDone}}function d$e(t){return t.undoOrRedoWasTriggered||t.requestUpdateNodeDimensions}function p$e(t){const e={};for(const[n,r]of Object.entries(t.x))e[n]={name:r.name,path:r.path,type:r.type};return e}function Ee(){return Ee=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Ee.apply(this,arguments)}function gt(t,e,{checkForDefaultPrevented:n=!0}={}){return function(i){if(t==null||t(i),n===!1||!i.defaultPrevented)return e==null?void 0:e(i)}}function m$e(t,e){typeof t=="function"?t(e):t!=null&&(t.current=e)}function nre(...t){return e=>t.forEach(n=>m$e(n,e))}function In(...t){return _.useCallback(nre(...t),t)}function Oo(t,e=[]){let n=[];function r(s,o){const a=_.createContext(o),l=n.length;n=[...n,o];function c(f){const{scope:h,children:d,...p}=f,g=(h==null?void 0:h[t][l])||a,m=_.useMemo(()=>p,Object.values(p));return _.createElement(g.Provider,{value:m},d)}function u(f,h){const d=(h==null?void 0:h[t][l])||a,p=_.useContext(d);if(p)return p;if(o!==void 0)return o;throw new Error(`\`${f}\` must be used within \`${s}\``)}return c.displayName=s+"Provider",[c,u]}const i=()=>{const s=n.map(o=>_.createContext(o));return function(a){const l=(a==null?void 0:a[t])||s;return _.useMemo(()=>({[`__scope${t}`]:{...a,[t]:l}}),[a,l])}};return i.scopeName=t,[r,g$e(i,...e)]}function g$e(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(s){const o=r.reduce((a,{useScope:l,scopeName:c})=>{const f=l(s)[`__scope${c}`];return{...a,...f}},{});return _.useMemo(()=>({[`__scope${e.scopeName}`]:o}),[o])}};return n.scopeName=e.scopeName,n}function $a(t){const e=_.useRef(t);return _.useEffect(()=>{e.current=t}),_.useMemo(()=>(...n)=>{var r;return(r=e.current)===null||r===void 0?void 0:r.call(e,...n)},[])}function Nl({prop:t,defaultProp:e,onChange:n=()=>{}}){const[r,i]=v$e({defaultProp:e,onChange:n}),s=t!==void 0,o=s?t:r,a=$a(n),l=_.useCallback(c=>{if(s){const f=typeof c=="function"?c(t):c;f!==t&&a(f)}else i(c)},[s,t,i,a]);return[o,l]}function v$e({defaultProp:t,onChange:e}){const n=_.useState(t),[r]=n,i=_.useRef(r),s=$a(e);return _.useEffect(()=>{i.current!==r&&(s(r),i.current=r)},[r,i,s]),n}function iM(t){const e=_.useRef({value:t,previous:t});return _.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}const Pc=globalThis!=null&&globalThis.document?_.useLayoutEffect:()=>{};function V5(t){const[e,n]=_.useState(void 0);return Pc(()=>{if(t){n({width:t.offsetWidth,height:t.offsetHeight});const r=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const s=i[0];let o,a;if("borderBoxSize"in s){const l=s.borderBoxSize,c=Array.isArray(l)?l[0]:l;o=c.inlineSize,a=c.blockSize}else o=t.offsetWidth,a=t.offsetHeight;n({width:o,height:a})});return r.observe(t,{box:"border-box"}),()=>r.unobserve(t)}else n(void 0)},[t]),e}const am=_.forwardRef((t,e)=>{const{children:n,...r}=t,i=_.Children.toArray(n),s=i.find(y$e);if(s){const o=s.props.children,a=i.map(l=>l===s?_.Children.count(o)>1?_.Children.only(null):_.isValidElement(o)?o.props.children:null:l);return _.createElement(DT,Ee({},r,{ref:e}),_.isValidElement(o)?_.cloneElement(o,void 0,a):null)}return _.createElement(DT,Ee({},r,{ref:e}),n)});am.displayName="Slot";const DT=_.forwardRef((t,e)=>{const{children:n,...r}=t;return _.isValidElement(n)?_.cloneElement(n,{...b$e(r,n.props),ref:nre(e,n.ref)}):_.Children.count(n)>1?_.Children.only(null):null});DT.displayName="SlotClone";const O$e=({children:t})=>_.createElement(_.Fragment,null,t);function y$e(t){return _.isValidElement(t)&&t.type===O$e}function b$e(t,e){const n={...e};for(const r in e){const i=t[r],s=e[r];/^on[A-Z]/.test(r)?i&&s?n[r]=(...a)=>{s(...a),i(...a)}:i&&(n[r]=i):r==="style"?n[r]={...i,...s}:r==="className"&&(n[r]=[i,s].filter(Boolean).join(" "))}return{...t,...n}}const x$e=["a","button","div","h2","h3","img","label","li","nav","ol","p","span","svg","ul"],gn=x$e.reduce((t,e)=>{const n=_.forwardRef((r,i)=>{const{asChild:s,...o}=r,a=s?am:e;return _.useEffect(()=>{window[Symbol.for("radix-ui")]=!0},[]),_.createElement(a,Ee({},o,{ref:i}))});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});function rre(t,e){t&&Qi.flushSync(()=>t.dispatchEvent(e))}const ire="Switch",[w$e,iEt]=Oo(ire),[S$e,_$e]=w$e(ire),k$e=_.forwardRef((t,e)=>{const{__scopeSwitch:n,name:r,checked:i,defaultChecked:s,required:o,disabled:a,value:l="on",onCheckedChange:c,...u}=t,[f,h]=_.useState(null),d=In(e,y=>h(y)),p=_.useRef(!1),g=f?!!f.closest("form"):!0,[m=!1,v]=Nl({prop:i,defaultProp:s,onChange:c});return _.createElement(S$e,{scope:n,checked:m,disabled:a},_.createElement(gn.button,Ee({type:"button",role:"switch","aria-checked":m,"aria-required":o,"data-state":sre(m),"data-disabled":a?"":void 0,disabled:a,value:l},u,{ref:d,onClick:gt(t.onClick,y=>{v(b=>!b),g&&(p.current=y.isPropagationStopped(),p.current||y.stopPropagation())})})),g&&_.createElement(T$e,{control:f,bubbles:!p.current,name:r,value:l,checked:m,required:o,disabled:a,style:{transform:"translateX(-100%)"}}))}),C$e="SwitchThumb",E$e=_.forwardRef((t,e)=>{const{__scopeSwitch:n,...r}=t,i=_$e(C$e,n);return _.createElement(gn.span,Ee({"data-state":sre(i.checked),"data-disabled":i.disabled?"":void 0},r,{ref:e}))}),T$e=t=>{const{control:e,checked:n,bubbles:r=!0,...i}=t,s=_.useRef(null),o=iM(n),a=V5(e);return _.useEffect(()=>{const l=s.current,c=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(c,"checked").set;if(o!==n&&f){const h=new Event("click",{bubbles:r});f.call(l,n),l.dispatchEvent(h)}},[o,n,r]),_.createElement("input",Ee({type:"checkbox","aria-hidden":!0,defaultChecked:n},i,{tabIndex:-1,ref:s,style:{...t.style,...a,position:"absolute",pointerEvents:"none",opacity:0,margin:0}}))};function sre(t){return t?"checked":"unchecked"}const P$e=k$e,A$e=E$e;function sM(t){const{twRootClasses:e="",twThumbClasses:n="",icon:r,disableBg:i=!1,height:s,width:o,children:a,...l}=t,c=`items-center p-[0.2rem] w-7 min-w-7 ${s||"h-2.5"} bg-setta-400 dark:bg-setta-600 rounded-full relative inline-flex cursor-pointer [-webkit-tap-highlight-color:rgba(0,_0,_0,_0)] focus-visible:shadow-black data-[state='checked']:bg-blue-500 dark:data-[state='checked']:bg-blue-700 focus-visible:ring-2 ${e} disabled:pointer-events-none`,u=`block ${o||"w-2.5"} ${s||"h-2.5"} ${!i&&"bg-white dark:bg-setta-800"} rounded-full transition-all will-change-transform data-[state='checked']:translate-x-4 ${n}`;return x.jsx(P$e,{className:c,...l,children:x.jsx(A$e,{className:u,children:r})})}var ore={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},xF=ke.createContext&&ke.createContext(ore),R$e=["attr","size","title"];function $$e(t,e){if(t==null)return{};var n=M$e(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function M$e(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function g_(){return g_=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},g_.apply(this,arguments)}function wF(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function v_(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?wF(Object(n),!0).forEach(function(r){I$e(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):wF(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function I$e(t,e,n){return e=D$e(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function D$e(t){var e=L$e(t,"string");return typeof e=="symbol"?e:e+""}function L$e(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function are(t){return t&&t.map((e,n)=>ke.createElement(e.tag,v_({key:n},e.attr),are(e.child)))}function ft(t){return e=>ke.createElement(N$e,g_({attr:v_({},t.attr)},e),are(t.child))}function N$e(t){var e=n=>{var{attr:r,size:i,title:s}=t,o=$$e(t,R$e),a=i||n.size||"1em",l;return n.className&&(l=n.className),t.className&&(l=(l?l+" ":"")+t.className),ke.createElement("svg",g_({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},n.attr,r,o,{className:l,style:v_(v_({color:t.color||n.color},n.style),t.style),height:a,width:a,xmlns:"http://www.w3.org/2000/svg"}),s&&ke.createElement("title",null,s),t.children)};return xF!==void 0?ke.createElement(xF.Consumer,null,n=>e(n)):e(ore)}function Q$e(t){return ft({tag:"svg",attr:{viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true"},child:[{tag:"path",attr:{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"},child:[]}]})(t)}function lre(t){return ft({tag:"svg",attr:{viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true"},child:[{tag:"path",attr:{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"},child:[]}]})(t)}function oM(t){return ft({tag:"svg",attr:{viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true"},child:[{tag:"path",attr:{d:"M10.707 2.293a1 1 0 00-1.414 0l-7 7a1 1 0 001.414 1.414L4 10.414V17a1 1 0 001 1h2a1 1 0 001-1v-2a1 1 0 011-1h2a1 1 0 011 1v2a1 1 0 001 1h2a1 1 0 001-1v-6.586l.293.293a1 1 0 001.414-1.414l-7-7z"},child:[]}]})(t)}function j$e(t){return ft({tag:"svg",attr:{viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true"},child:[{tag:"path",attr:{d:"M17.293 13.293A8 8 0 016.707 2.707a8.001 8.001 0 1010.586 10.586z"},child:[]}]})(t)}function B$e(t){return ft({tag:"svg",attr:{viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true"},child:[{tag:"path",attr:{fillRule:"evenodd",d:"M10 3a1 1 0 011 1v5h5a1 1 0 110 2h-5v5a1 1 0 11-2 0v-5H4a1 1 0 110-2h5V4a1 1 0 011-1z",clipRule:"evenodd"},child:[]}]})(t)}function U5(t){return ft({tag:"svg",attr:{fill:"none",viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor","aria-hidden":"true"},child:[{tag:"path",attr:{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"},child:[]}]})(t)}function z$e(t){return ft({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M2.04932 12.9999H7.52725C7.70624 16.2688 8.7574 19.3053 10.452 21.8809C5.98761 21.1871 2.5001 17.5402 2.04932 12.9999ZM2.04932 10.9999C2.5001 6.45968 5.98761 2.81276 10.452 2.11902C8.7574 4.69456 7.70624 7.73111 7.52725 10.9999H2.04932ZM21.9506 10.9999H16.4726C16.2936 7.73111 15.2425 4.69456 13.5479 2.11902C18.0123 2.81276 21.4998 6.45968 21.9506 10.9999ZM21.9506 12.9999C21.4998 17.5402 18.0123 21.1871 13.5479 21.8809C15.2425 19.3053 16.2936 16.2688 16.4726 12.9999H21.9506ZM9.53068 12.9999H14.4692C14.2976 15.7828 13.4146 18.3732 11.9999 20.5915C10.5852 18.3732 9.70229 15.7828 9.53068 12.9999ZM9.53068 10.9999C9.70229 8.21709 10.5852 5.62672 11.9999 3.40841C13.4146 5.62672 14.2976 8.21709 14.4692 10.9999H9.53068Z"},child:[]}]})(t)}function F$e(t){return ft({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M14 6H16V8H21C21.5523 8 22 8.44772 22 9V16.5L16 13L16.0359 21.0622L18.2592 18.9129L20.041 22H9C8.44772 22 8 21.5523 8 21V16H6V14H8V9C8 8.44772 8.44772 8 9 8H14V6ZM22 17.338V21C22 21.107 21.9832 21.2101 21.9521 21.3068L19.9913 17.9129L22 17.338ZM4 14V16H2V14H4ZM4 10V12H2V10H4ZM4 6V8H2V6H4ZM4 2V4H2V2H4ZM8 2V4H6V2H8ZM12 2V4H10V2H12ZM16 2V4H14V2H16Z"},child:[]}]})(t)}function cre(t){return ft({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M7.75194 5.43872L18.2596 11.5682C18.4981 11.7073 18.5787 12.0135 18.4396 12.252C18.3961 12.3265 18.3341 12.3885 18.2596 12.432L7.75194 18.5615C7.51341 18.7006 7.20725 18.62 7.06811 18.3815C7.0235 18.305 7 18.2181 7 18.1296V5.87061C7 5.59446 7.22386 5.37061 7.5 5.37061C7.58853 5.37061 7.67547 5.39411 7.75194 5.43872Z"},child:[]}]})(t)}function W$e(t){return ft({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M12 18C8.68629 18 6 15.3137 6 12C6 8.68629 8.68629 6 12 6C15.3137 6 18 8.68629 18 12C18 15.3137 15.3137 18 12 18ZM11 1H13V4H11V1ZM11 20H13V23H11V20ZM3.51472 4.92893L4.92893 3.51472L7.05025 5.63604L5.63604 7.05025L3.51472 4.92893ZM16.9497 18.364L18.364 16.9497L20.4853 19.0711L19.0711 20.4853L16.9497 18.364ZM19.0711 3.51472L20.4853 4.92893L18.364 7.05025L16.9497 5.63604L19.0711 3.51472ZM5.63604 16.9497L7.05025 18.364L4.92893 20.4853L3.51472 19.0711L5.63604 16.9497ZM23 11V13H20V11H23ZM4 11V13H1V11H4Z"},child:[]}]})(t)}function q5(t){const[e,n]=t;n(!e)}function V$e(){q5(Ot.darkMode.state())}function U$e(){q5(Ot.showMinimap.state())}function q$e(){q5(Ot.projectConfigPreviewEnabled.state())}function X$e(){q5(Ot.snapToGrid.state())}function H$e(){const[t,e]=Ot.showNavBarHelpMessage.hook(),n=Nt(r=>Br(r.shortcuts.showTooltipShortcut));return t&&x.jsx("aside",{className:"ml-auto mr-4 flex items-center gap-2",children:x.jsxs("div",{className:"hidden items-center gap-2 lg:flex",children:[x.jsxs("p",{className:"text-xs font-bold text-setta-400 dark:text-setta-500",children:['Hold down "',n,'" to see tool tips']}),x.jsx("button",{className:"flex cursor-pointer items-center text-setta-300 hover:text-setta-700 dark:text-setta-500 dark:hover:text-setta-400",onClick:()=>e(!1),children:x.jsx("i",{className:"gg-close"})})]})})}function Z$e(){const t=Y$e();return x.jsxs("div",{className:"flex flex-1 items-center justify-end",children:[x.jsx(H$e,{}),x.jsx(sM,{checked:t,onCheckedChange:V$e,twThumbClasses:"flex",disableBg:!0,height:"h-3",width:"w-3",icon:t?x.jsx(j$e,{className:"h-3 text-blue-200"}):x.jsx(W$e,{className:"h-3 text-white"})})]})}function Y$e(){const[t]=Ot.darkMode.hook();return _.useEffect(()=>{t?document.querySelector("html").classList.add("dark"):document.querySelector("html").classList.remove("dark")},[t]),t}function G$e(t){return ft({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{fillRule:"evenodd",clipRule:"evenodd",d:"M11.105 4.561l-3.43 3.427-1.134-1.12 2.07-2.08h-4.8a2.4 2.4 0 1 0 0 4.8h.89v1.6h-.88a4 4 0 0 1 0-7.991h4.8L6.54 1.13 7.675 0l3.43 3.432v1.13zM16.62 24h-9.6l-.8-.8V10.412l.8-.8h9.6l.8.8V23.2l-.8.8zm-8.8-1.6h8V11.212h-8V22.4zm5.6-20.798h9.6l.8.8v12.786l-.8.8h-4v-1.6h3.2V3.2h-8v4.787h-1.6V2.401l.8-.8zm.8 11.186h-4.8v1.6h4.8v-1.6zm-4.8 3.2h4.8v1.6h-4.8v-1.6zm4.8 3.2h-4.8v1.6h4.8v-1.6zm1.6-14.4h4.8v1.6h-4.8v-1.6zm4.8 6.4h-1.6v1.6h1.6v-1.6zm-3.338-3.176v-.024h3.338v1.6h-1.762l-1.576-1.576z"},child:[]}]})(t)}function SF(t){return ft({tag:"svg",attr:{viewBox:"0 0 16 16",fill:"currentColor"},child:[{tag:"path",attr:{fillRule:"evenodd",clipRule:"evenodd",d:"M11.04 1.33L12.71 3l.29.71v.33h-.5l-.5.5v-.83l-1.67-1.67H10v4H4v-4H2v10h3l-.5 1H2l-1-1v-10l1-1h8.33l.71.29zM7 5h2V2H7v3zm6.5 0L15 6.5l-.02.69-5.5 5.5-.13.12-.37.37-.1.09-3 1.5-.67-.67 1.5-3 .09-.1.37-.37.12-.13 5.5-5.5h.71zm-6.22 7.24l-.52 1 1.04-.48-.52-.52zm.69-1.03l.79.79 5.15-5.15-.79-.79-5.15 5.15z"},child:[]}]})(t)}function ure(t){return ft({tag:"svg",attr:{viewBox:"0 0 16 16",fill:"currentColor"},child:[{tag:"path",attr:{fillRule:"evenodd",clipRule:"evenodd",d:"M13.353 1.146l1.5 1.5L15 3v11.5l-.5.5h-13l-.5-.5v-13l.5-.5H13l.353.146zM2 2v12h12V3.208L12.793 2H11v4H4V2H2zm6 0v3h2V2H8z"},child:[]}]})(t)}function K$e(){const t=mT(e=>e.message);return t&&x.jsxs(x.Fragment,{children:[x.jsx(ure,{className:"ml-4 h-3 w-3 text-setta-400 dark:text-setta-50"}),x.jsx("p",{className:"ml-2 self-center text-xs text-setta-500 dark:text-setta-100",children:t})]})}function Hm(t){const e=t+"CollectionProvider",[n,r]=Oo(e),[i,s]=n(e,{collectionRef:{current:null},itemMap:new Map}),o=d=>{const{scope:p,children:g}=d,m=ke.useRef(null),v=ke.useRef(new Map).current;return ke.createElement(i,{scope:p,itemMap:v,collectionRef:m},g)},a=t+"CollectionSlot",l=ke.forwardRef((d,p)=>{const{scope:g,children:m}=d,v=s(a,g),y=In(p,v.collectionRef);return ke.createElement(am,{ref:y},m)}),c=t+"CollectionItemSlot",u="data-radix-collection-item",f=ke.forwardRef((d,p)=>{const{scope:g,children:m,...v}=d,y=ke.useRef(null),b=In(p,y),S=s(c,g);return ke.useEffect(()=>(S.itemMap.set(y,{ref:y,...v}),()=>void S.itemMap.delete(y))),ke.createElement(am,{[u]:"",ref:b},m)});function h(d){const p=s(t+"CollectionConsumer",d);return ke.useCallback(()=>{const m=p.collectionRef.current;if(!m)return[];const v=Array.from(m.querySelectorAll(`[${u}]`));return Array.from(p.itemMap.values()).sort((S,k)=>v.indexOf(S.ref.current)-v.indexOf(k.ref.current))},[p.collectionRef,p.itemMap])}return[{Provider:o,Slot:l,ItemSlot:f},h,r]}const J$e=_.createContext(void 0);function jd(t){const e=_.useContext(J$e);return t||e||"ltr"}const eMe=Dp["useId".toString()]||(()=>{});let tMe=0;function ff(t){const[e,n]=_.useState(eMe());return Pc(()=>{t||n(r=>r??String(tMe++))},[t]),t||(e?`radix-${e}`:"")}function nMe(t,e=globalThis==null?void 0:globalThis.document){const n=$a(t);_.useEffect(()=>{const r=i=>{i.key==="Escape"&&n(i)};return e.addEventListener("keydown",r),()=>e.removeEventListener("keydown",r)},[n,e])}const LT="dismissableLayer.update",rMe="dismissableLayer.pointerDownOutside",iMe="dismissableLayer.focusOutside";let _F;const sMe=_.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),fre=_.forwardRef((t,e)=>{var n;const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:i,onPointerDownOutside:s,onFocusOutside:o,onInteractOutside:a,onDismiss:l,...c}=t,u=_.useContext(sMe),[f,h]=_.useState(null),d=(n=f==null?void 0:f.ownerDocument)!==null&&n!==void 0?n:globalThis==null?void 0:globalThis.document,[,p]=_.useState({}),g=In(e,C=>h(C)),m=Array.from(u.layers),[v]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),y=m.indexOf(v),b=f?m.indexOf(f):-1,S=u.layersWithOutsidePointerEventsDisabled.size>0,k=b>=y,E=oMe(C=>{const A=C.target,R=[...u.branches].some(Q=>Q.contains(A));!k||R||(s==null||s(C),a==null||a(C),C.defaultPrevented||l==null||l())},d),T=aMe(C=>{const A=C.target;[...u.branches].some(Q=>Q.contains(A))||(o==null||o(C),a==null||a(C),C.defaultPrevented||l==null||l())},d);return nMe(C=>{b===u.layers.size-1&&(i==null||i(C),!C.defaultPrevented&&l&&(C.preventDefault(),l()))},d),_.useEffect(()=>{if(f)return r&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(_F=d.body.style.pointerEvents,d.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(f)),u.layers.add(f),kF(),()=>{r&&u.layersWithOutsidePointerEventsDisabled.size===1&&(d.body.style.pointerEvents=_F)}},[f,d,r,u]),_.useEffect(()=>()=>{f&&(u.layers.delete(f),u.layersWithOutsidePointerEventsDisabled.delete(f),kF())},[f,u]),_.useEffect(()=>{const C=()=>p({});return document.addEventListener(LT,C),()=>document.removeEventListener(LT,C)},[]),_.createElement(gn.div,Ee({},c,{ref:g,style:{pointerEvents:S?k?"auto":"none":void 0,...t.style},onFocusCapture:gt(t.onFocusCapture,T.onFocusCapture),onBlurCapture:gt(t.onBlurCapture,T.onBlurCapture),onPointerDownCapture:gt(t.onPointerDownCapture,E.onPointerDownCapture)}))});function oMe(t,e=globalThis==null?void 0:globalThis.document){const n=$a(t),r=_.useRef(!1),i=_.useRef(()=>{});return _.useEffect(()=>{const s=a=>{if(a.target&&!r.current){let u=function(){hre(rMe,n,c,{discrete:!0})};var l=u;const c={originalEvent:a};a.pointerType==="touch"?(e.removeEventListener("click",i.current),i.current=u,e.addEventListener("click",i.current,{once:!0})):u()}r.current=!1},o=window.setTimeout(()=>{e.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(o),e.removeEventListener("pointerdown",s),e.removeEventListener("click",i.current)}},[e,n]),{onPointerDownCapture:()=>r.current=!0}}function aMe(t,e=globalThis==null?void 0:globalThis.document){const n=$a(t),r=_.useRef(!1);return _.useEffect(()=>{const i=s=>{s.target&&!r.current&&hre(iMe,n,{originalEvent:s},{discrete:!1})};return e.addEventListener("focusin",i),()=>e.removeEventListener("focusin",i)},[e,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function kF(){const t=new CustomEvent(LT);document.dispatchEvent(t)}function hre(t,e,n,{discrete:r}){const i=n.originalEvent.target,s=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:n});e&&i.addEventListener(t,e,{once:!0}),r?rre(i,s):i.dispatchEvent(s)}let M6=0;function dre(){_.useEffect(()=>{var t,e;const n=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",(t=n[0])!==null&&t!==void 0?t:CF()),document.body.insertAdjacentElement("beforeend",(e=n[1])!==null&&e!==void 0?e:CF()),M6++,()=>{M6===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(r=>r.remove()),M6--}},[])}function CF(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.cssText="outline: none; opacity: 0; position: fixed; pointer-events: none",t}const I6="focusScope.autoFocusOnMount",D6="focusScope.autoFocusOnUnmount",EF={bubbles:!1,cancelable:!0},pre=_.forwardRef((t,e)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:s,...o}=t,[a,l]=_.useState(null),c=$a(i),u=$a(s),f=_.useRef(null),h=In(e,g=>l(g)),d=_.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;_.useEffect(()=>{if(r){let v=function(b){if(d.paused||!a)return;const S=b.target;a.contains(S)?f.current=S:Eh(f.current,{select:!0})},y=function(b){d.paused||!a||a.contains(b.relatedTarget)||Eh(f.current,{select:!0})};var g=v,m=y;return document.addEventListener("focusin",v),document.addEventListener("focusout",y),()=>{document.removeEventListener("focusin",v),document.removeEventListener("focusout",y)}}},[r,a,d.paused]),_.useEffect(()=>{if(a){PF.add(d);const g=document.activeElement;if(!a.contains(g)){const v=new CustomEvent(I6,EF);a.addEventListener(I6,c),a.dispatchEvent(v),v.defaultPrevented||(lMe(dMe(mre(a)),{select:!0}),document.activeElement===g&&Eh(a))}return()=>{a.removeEventListener(I6,c),setTimeout(()=>{const v=new CustomEvent(D6,EF);a.addEventListener(D6,u),a.dispatchEvent(v),v.defaultPrevented||Eh(g??document.body,{select:!0}),a.removeEventListener(D6,u),PF.remove(d)},0)}}},[a,c,u,d]);const p=_.useCallback(g=>{if(!n&&!r||d.paused)return;const m=g.key==="Tab"&&!g.altKey&&!g.ctrlKey&&!g.metaKey,v=document.activeElement;if(m&&v){const y=g.currentTarget,[b,S]=cMe(y);b&&S?!g.shiftKey&&v===S?(g.preventDefault(),n&&Eh(b,{select:!0})):g.shiftKey&&v===b&&(g.preventDefault(),n&&Eh(S,{select:!0})):v===y&&g.preventDefault()}},[n,r,d.paused]);return _.createElement(gn.div,Ee({tabIndex:-1},o,{ref:h,onKeyDown:p}))});function lMe(t,{select:e=!1}={}){const n=document.activeElement;for(const r of t)if(Eh(r,{select:e}),document.activeElement!==n)return}function cMe(t){const e=mre(t),n=TF(e,t),r=TF(e.reverse(),t);return[n,r]}function mre(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const i=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||i?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)e.push(n.currentNode);return e}function TF(t,e){for(const n of t)if(!uMe(n,{upTo:e}))return n}function uMe(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function fMe(t){return t instanceof HTMLInputElement&&"select"in t}function Eh(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&fMe(t)&&e&&t.select()}}const PF=hMe();function hMe(){let t=[];return{add(e){const n=t[0];e!==n&&(n==null||n.pause()),t=AF(t,e),t.unshift(e)},remove(e){var n;t=AF(t,e),(n=t[0])===null||n===void 0||n.resume()}}}function AF(t,e){const n=[...t],r=n.indexOf(e);return r!==-1&&n.splice(r,1),n}function dMe(t){return t.filter(e=>e.tagName!=="A")}function Bd(t){return t.split("-")[0]}function My(t){return t.split("-")[1]}function Zm(t){return["top","bottom"].includes(Bd(t))?"x":"y"}function aM(t){return t==="y"?"height":"width"}function RF(t,e,n){let{reference:r,floating:i}=t;const s=r.x+r.width/2-i.width/2,o=r.y+r.height/2-i.height/2,a=Zm(e),l=aM(a),c=r[l]/2-i[l]/2,u=a==="x";let f;switch(Bd(e)){case"top":f={x:s,y:r.y-i.height};break;case"bottom":f={x:s,y:r.y+r.height};break;case"right":f={x:r.x+r.width,y:o};break;case"left":f={x:r.x-i.width,y:o};break;default:f={x:r.x,y:r.y}}switch(My(e)){case"start":f[a]-=c*(n&&u?-1:1);break;case"end":f[a]+=c*(n&&u?-1:1)}return f}const pMe=async(t,e,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:s=[],platform:o}=n,a=await(o.isRTL==null?void 0:o.isRTL(e));let l=await o.getElementRects({reference:t,floating:e,strategy:i}),{x:c,y:u}=RF(l,r,a),f=r,h={},d=0;for(let p=0;p<s.length;p++){const{name:g,fn:m}=s[p],{x:v,y,data:b,reset:S}=await m({x:c,y:u,initialPlacement:r,placement:f,strategy:i,middlewareData:h,rects:l,platform:o,elements:{reference:t,floating:e}});c=v??c,u=y??u,h={...h,[g]:{...h[g],...b}},S&&d<=50&&(d++,typeof S=="object"&&(S.placement&&(f=S.placement),S.rects&&(l=S.rects===!0?await o.getElementRects({reference:t,floating:e,strategy:i}):S.rects),{x:c,y:u}=RF(l,f,a)),p=-1)}return{x:c,y:u,placement:f,strategy:i,middlewareData:h}};function gre(t){return typeof t!="number"?function(e){return{top:0,right:0,bottom:0,left:0,...e}}(t):{top:t,right:t,bottom:t,left:t}}function O_(t){return{...t,top:t.y,left:t.x,right:t.x+t.width,bottom:t.y+t.height}}async function aO(t,e){var n;e===void 0&&(e={});const{x:r,y:i,platform:s,rects:o,elements:a,strategy:l}=t,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:f="floating",altBoundary:h=!1,padding:d=0}=e,p=gre(d),g=a[h?f==="floating"?"reference":"floating":f],m=O_(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(g)))==null||n?g:g.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(a.floating)),boundary:c,rootBoundary:u,strategy:l})),v=O_(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({rect:f==="floating"?{...o.floating,x:r,y:i}:o.reference,offsetParent:await(s.getOffsetParent==null?void 0:s.getOffsetParent(a.floating)),strategy:l}):o[f]);return{top:m.top-v.top+p.top,bottom:v.bottom-m.bottom+p.bottom,left:m.left-v.left+p.left,right:v.right-m.right+p.right}}const mMe=Math.min,Th=Math.max;function NT(t,e,n){return Th(t,mMe(e,n))}const $F=t=>({name:"arrow",options:t,async fn(e){const{element:n,padding:r=0}=t??{},{x:i,y:s,placement:o,rects:a,platform:l}=e;if(n==null)return{};const c=gre(r),u={x:i,y:s},f=Zm(o),h=My(o),d=aM(f),p=await l.getDimensions(n),g=f==="y"?"top":"left",m=f==="y"?"bottom":"right",v=a.reference[d]+a.reference[f]-u[f]-a.floating[d],y=u[f]-a.reference[f],b=await(l.getOffsetParent==null?void 0:l.getOffsetParent(n));let S=b?f==="y"?b.clientHeight||0:b.clientWidth||0:0;S===0&&(S=a.floating[d]);const k=v/2-y/2,E=c[g],T=S-p[d]-c[m],C=S/2-p[d]/2+k,A=NT(E,C,T),R=(h==="start"?c[g]:c[m])>0&&C!==A&&a.reference[d]<=a.floating[d];return{[f]:u[f]-(R?C<E?E-C:T-C:0),data:{[f]:A,centerOffset:C-A}}}}),gMe={left:"right",right:"left",bottom:"top",top:"bottom"};function y_(t){return t.replace(/left|right|bottom|top/g,e=>gMe[e])}function vMe(t,e,n){n===void 0&&(n=!1);const r=My(t),i=Zm(t),s=aM(i);let o=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(o=y_(o)),{main:o,cross:y_(o)}}const OMe={start:"end",end:"start"};function MF(t){return t.replace(/start|end/g,e=>OMe[e])}const vre=["top","right","bottom","left"];vre.reduce((t,e)=>t.concat(e,e+"-start",e+"-end"),[]);const yMe=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n;const{placement:r,middlewareData:i,rects:s,initialPlacement:o,platform:a,elements:l}=e,{mainAxis:c=!0,crossAxis:u=!0,fallbackPlacements:f,fallbackStrategy:h="bestFit",flipAlignment:d=!0,...p}=t,g=Bd(r),m=f||(g===o||!d?[y_(o)]:function(C){const A=y_(C);return[MF(C),A,MF(A)]}(o)),v=[o,...m],y=await aO(e,p),b=[];let S=((n=i.flip)==null?void 0:n.overflows)||[];if(c&&b.push(y[g]),u){const{main:C,cross:A}=vMe(r,s,await(a.isRTL==null?void 0:a.isRTL(l.floating)));b.push(y[C],y[A])}if(S=[...S,{placement:r,overflows:b}],!b.every(C=>C<=0)){var k,E;const C=((k=(E=i.flip)==null?void 0:E.index)!=null?k:0)+1,A=v[C];if(A)return{data:{index:C,overflows:S},reset:{placement:A}};let R="bottom";switch(h){case"bestFit":{var T;const Q=(T=S.map(L=>[L,L.overflows.filter(z=>z>0).reduce((z,B)=>z+B,0)]).sort((L,z)=>L[1]-z[1])[0])==null?void 0:T[0].placement;Q&&(R=Q);break}case"initialPlacement":R=o}if(r!==R)return{reset:{placement:R}}}return{}}}};function IF(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function DF(t){return vre.some(e=>t[e]>=0)}const bMe=function(t){let{strategy:e="referenceHidden",...n}=t===void 0?{}:t;return{name:"hide",async fn(r){const{rects:i}=r;switch(e){case"referenceHidden":{const s=IF(await aO(r,{...n,elementContext:"reference"}),i.reference);return{data:{referenceHiddenOffsets:s,referenceHidden:DF(s)}}}case"escaped":{const s=IF(await aO(r,{...n,altBoundary:!0}),i.floating);return{data:{escapedOffsets:s,escaped:DF(s)}}}default:return{}}}}},xMe=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){const{x:n,y:r}=e,i=await async function(s,o){const{placement:a,platform:l,elements:c}=s,u=await(l.isRTL==null?void 0:l.isRTL(c.floating)),f=Bd(a),h=My(a),d=Zm(a)==="x",p=["left","top"].includes(f)?-1:1,g=u&&d?-1:1,m=typeof o=="function"?o(s):o;let{mainAxis:v,crossAxis:y,alignmentAxis:b}=typeof m=="number"?{mainAxis:m,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...m};return h&&typeof b=="number"&&(y=h==="end"?-1*b:b),d?{x:y*g,y:v*p}:{x:v*p,y:y*g}}(e,t);return{x:n+i.x,y:r+i.y,data:i}}}};function Ore(t){return t==="x"?"y":"x"}const wMe=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:r,placement:i}=e,{mainAxis:s=!0,crossAxis:o=!1,limiter:a={fn:m=>{let{x:v,y}=m;return{x:v,y}}},...l}=t,c={x:n,y:r},u=await aO(e,l),f=Zm(Bd(i)),h=Ore(f);let d=c[f],p=c[h];if(s){const m=f==="y"?"bottom":"right";d=NT(d+u[f==="y"?"top":"left"],d,d-u[m])}if(o){const m=h==="y"?"bottom":"right";p=NT(p+u[h==="y"?"top":"left"],p,p-u[m])}const g=a.fn({...e,[f]:d,[h]:p});return{...g,data:{x:g.x-n,y:g.y-r}}}}},SMe=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:n,y:r,placement:i,rects:s,middlewareData:o}=e,{offset:a=0,mainAxis:l=!0,crossAxis:c=!0}=t,u={x:n,y:r},f=Zm(i),h=Ore(f);let d=u[f],p=u[h];const g=typeof a=="function"?a({...s,placement:i}):a,m=typeof g=="number"?{mainAxis:g,crossAxis:0}:{mainAxis:0,crossAxis:0,...g};if(l){const k=f==="y"?"height":"width",E=s.reference[f]-s.floating[k]+m.mainAxis,T=s.reference[f]+s.reference[k]-m.mainAxis;d<E?d=E:d>T&&(d=T)}if(c){var v,y,b,S;const k=f==="y"?"width":"height",E=["top","left"].includes(Bd(i)),T=s.reference[h]-s.floating[k]+(E&&(v=(y=o.offset)==null?void 0:y[h])!=null?v:0)+(E?0:m.crossAxis),C=s.reference[h]+s.reference[k]+(E?0:(b=(S=o.offset)==null?void 0:S[h])!=null?b:0)-(E?m.crossAxis:0);p<T?p=T:p>C&&(p=C)}return{[f]:d,[h]:p}}}},_Me=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){const{placement:n,rects:r,platform:i,elements:s}=e,{apply:o,...a}=t,l=await aO(e,a),c=Bd(n),u=My(n);let f,h;c==="top"||c==="bottom"?(f=c,h=u===(await(i.isRTL==null?void 0:i.isRTL(s.floating))?"start":"end")?"left":"right"):(h=c,f=u==="end"?"top":"bottom");const d=Th(l.left,0),p=Th(l.right,0),g=Th(l.top,0),m=Th(l.bottom,0),v={availableHeight:r.floating.height-(["left","right"].includes(n)?2*(g!==0||m!==0?g+m:Th(l.top,l.bottom)):l[f]),availableWidth:r.floating.width-(["top","bottom"].includes(n)?2*(d!==0||p!==0?d+p:Th(l.left,l.right)):l[h])},y=await i.getDimensions(s.floating);o==null||o({...e,...v});const b=await i.getDimensions(s.floating);return y.width!==b.width||y.height!==b.height?{reset:{rects:!0}}:{}}}};function yre(t){return t&&t.document&&t.location&&t.alert&&t.setInterval}function lu(t){if(t==null)return window;if(!yre(t)){const e=t.ownerDocument;return e&&e.defaultView||window}return t}function Iy(t){return lu(t).getComputedStyle(t)}function Lc(t){return yre(t)?"":t?(t.nodeName||"").toLowerCase():""}function bre(){const t=navigator.userAgentData;return t!=null&&t.brands?t.brands.map(e=>e.brand+"/"+e.version).join(" "):navigator.userAgent}function Tl(t){return t instanceof lu(t).HTMLElement}function _f(t){return t instanceof lu(t).Element}function lM(t){return typeof ShadowRoot>"u"?!1:t instanceof lu(t).ShadowRoot||t instanceof ShadowRoot}function X5(t){const{overflow:e,overflowX:n,overflowY:r}=Iy(t);return/auto|scroll|overlay|hidden/.test(e+r+n)}function kMe(t){return["table","td","th"].includes(Lc(t))}function LF(t){const e=/firefox/i.test(bre()),n=Iy(t);return n.transform!=="none"||n.perspective!=="none"||n.contain==="paint"||["transform","perspective"].includes(n.willChange)||e&&n.willChange==="filter"||e&&!!n.filter&&n.filter!=="none"}function xre(){return!/^((?!chrome|android).)*safari/i.test(bre())}const NF=Math.min,nv=Math.max,b_=Math.round;function Nc(t,e,n){var r,i,s,o;e===void 0&&(e=!1),n===void 0&&(n=!1);const a=t.getBoundingClientRect();let l=1,c=1;e&&Tl(t)&&(l=t.offsetWidth>0&&b_(a.width)/t.offsetWidth||1,c=t.offsetHeight>0&&b_(a.height)/t.offsetHeight||1);const u=_f(t)?lu(t):window,f=!xre()&&n,h=(a.left+(f&&(r=(i=u.visualViewport)==null?void 0:i.offsetLeft)!=null?r:0))/l,d=(a.top+(f&&(s=(o=u.visualViewport)==null?void 0:o.offsetTop)!=null?s:0))/c,p=a.width/l,g=a.height/c;return{width:p,height:g,top:d,right:h+p,bottom:d+g,left:h,x:h,y:d}}function hf(t){return(e=t,(e instanceof lu(e).Node?t.ownerDocument:t.document)||window.document).documentElement;var e}function H5(t){return _f(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}function wre(t){return Nc(hf(t)).left+H5(t).scrollLeft}function CMe(t,e,n){const r=Tl(e),i=hf(e),s=Nc(t,r&&function(l){const c=Nc(l);return b_(c.width)!==l.offsetWidth||b_(c.height)!==l.offsetHeight}(e),n==="fixed");let o={scrollLeft:0,scrollTop:0};const a={x:0,y:0};if(r||!r&&n!=="fixed")if((Lc(e)!=="body"||X5(i))&&(o=H5(e)),Tl(e)){const l=Nc(e,!0);a.x=l.x+e.clientLeft,a.y=l.y+e.clientTop}else i&&(a.x=wre(i));return{x:s.left+o.scrollLeft-a.x,y:s.top+o.scrollTop-a.y,width:s.width,height:s.height}}function Sre(t){return Lc(t)==="html"?t:t.assignedSlot||t.parentNode||(lM(t)?t.host:null)||hf(t)}function QF(t){return Tl(t)&&getComputedStyle(t).position!=="fixed"?t.offsetParent:null}function QT(t){const e=lu(t);let n=QF(t);for(;n&&kMe(n)&&getComputedStyle(n).position==="static";)n=QF(n);return n&&(Lc(n)==="html"||Lc(n)==="body"&&getComputedStyle(n).position==="static"&&!LF(n))?e:n||function(r){let i=Sre(r);for(lM(i)&&(i=i.host);Tl(i)&&!["html","body"].includes(Lc(i));){if(LF(i))return i;i=i.parentNode}return null}(t)||e}function jF(t){if(Tl(t))return{width:t.offsetWidth,height:t.offsetHeight};const e=Nc(t);return{width:e.width,height:e.height}}function _re(t){const e=Sre(t);return["html","body","#document"].includes(Lc(e))?t.ownerDocument.body:Tl(e)&&X5(e)?e:_re(e)}function x_(t,e){var n;e===void 0&&(e=[]);const r=_re(t),i=r===((n=t.ownerDocument)==null?void 0:n.body),s=lu(r),o=i?[s].concat(s.visualViewport||[],X5(r)?r:[]):r,a=e.concat(o);return i?a:a.concat(x_(o))}function BF(t,e,n){return e==="viewport"?O_(function(r,i){const s=lu(r),o=hf(r),a=s.visualViewport;let l=o.clientWidth,c=o.clientHeight,u=0,f=0;if(a){l=a.width,c=a.height;const h=xre();(h||!h&&i==="fixed")&&(u=a.offsetLeft,f=a.offsetTop)}return{width:l,height:c,x:u,y:f}}(t,n)):_f(e)?function(r,i){const s=Nc(r,!1,i==="fixed"),o=s.top+r.clientTop,a=s.left+r.clientLeft;return{top:o,left:a,x:a,y:o,right:a+r.clientWidth,bottom:o+r.clientHeight,width:r.clientWidth,height:r.clientHeight}}(e,n):O_(function(r){var i;const s=hf(r),o=H5(r),a=(i=r.ownerDocument)==null?void 0:i.body,l=nv(s.scrollWidth,s.clientWidth,a?a.scrollWidth:0,a?a.clientWidth:0),c=nv(s.scrollHeight,s.clientHeight,a?a.scrollHeight:0,a?a.clientHeight:0);let u=-o.scrollLeft+wre(r);const f=-o.scrollTop;return Iy(a||s).direction==="rtl"&&(u+=nv(s.clientWidth,a?a.clientWidth:0)-l),{width:l,height:c,x:u,y:f}}(hf(t)))}function EMe(t){const e=x_(t),n=["absolute","fixed"].includes(Iy(t).position)&&Tl(t)?QT(t):t;return _f(n)?e.filter(r=>_f(r)&&function(i,s){const o=s.getRootNode==null?void 0:s.getRootNode();if(i.contains(s))return!0;if(o&&lM(o)){let a=s;do{if(a&&i===a)return!0;a=a.parentNode||a.host}while(a)}return!1}(r,n)&&Lc(r)!=="body"):[]}const TMe={getClippingRect:function(t){let{element:e,boundary:n,rootBoundary:r,strategy:i}=t;const s=[...n==="clippingAncestors"?EMe(e):[].concat(n),r],o=s[0],a=s.reduce((l,c)=>{const u=BF(e,c,i);return l.top=nv(u.top,l.top),l.right=NF(u.right,l.right),l.bottom=NF(u.bottom,l.bottom),l.left=nv(u.left,l.left),l},BF(e,o,i));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}},convertOffsetParentRelativeRectToViewportRelativeRect:function(t){let{rect:e,offsetParent:n,strategy:r}=t;const i=Tl(n),s=hf(n);if(n===s)return e;let o={scrollLeft:0,scrollTop:0};const a={x:0,y:0};if((i||!i&&r!=="fixed")&&((Lc(n)!=="body"||X5(s))&&(o=H5(n)),Tl(n))){const l=Nc(n,!0);a.x=l.x+n.clientLeft,a.y=l.y+n.clientTop}return{...e,x:e.x-o.scrollLeft+a.x,y:e.y-o.scrollTop+a.y}},isElement:_f,getDimensions:jF,getOffsetParent:QT,getDocumentElement:hf,getElementRects:t=>{let{reference:e,floating:n,strategy:r}=t;return{reference:CMe(e,QT(n),r),floating:{...jF(n),x:0,y:0}}},getClientRects:t=>Array.from(t.getClientRects()),isRTL:t=>Iy(t).direction==="rtl"};function PMe(t,e,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:s=!0,elementResize:o=!0,animationFrame:a=!1}=r,l=i&&!a,c=s&&!a,u=l||c?[..._f(t)?x_(t):[],...x_(e)]:[];u.forEach(p=>{l&&p.addEventListener("scroll",n,{passive:!0}),c&&p.addEventListener("resize",n)});let f,h=null;if(o){let p=!0;h=new ResizeObserver(()=>{p||n(),p=!1}),_f(t)&&!a&&h.observe(t),h.observe(e)}let d=a?Nc(t):null;return a&&function p(){const g=Nc(t);!d||g.x===d.x&&g.y===d.y&&g.width===d.width&&g.height===d.height||n(),d=g,f=requestAnimationFrame(p)}(),n(),()=>{var p;u.forEach(g=>{l&&g.removeEventListener("scroll",n),c&&g.removeEventListener("resize",n)}),(p=h)==null||p.disconnect(),h=null,a&&cancelAnimationFrame(f)}}const AMe=(t,e,n)=>pMe(t,e,{platform:TMe,...n});var jT=typeof document<"u"?_.useLayoutEffect:_.useEffect;function BT(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let n,r,i;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(n=t.length,n!=e.length)return!1;for(r=n;r--!==0;)if(!BT(t[r],e[r]))return!1;return!0}if(i=Object.keys(t),n=i.length,n!==Object.keys(e).length)return!1;for(r=n;r--!==0;)if(!Object.prototype.hasOwnProperty.call(e,i[r]))return!1;for(r=n;r--!==0;){const s=i[r];if(!(s==="_owner"&&t.$$typeof)&&!BT(t[s],e[s]))return!1}return!0}return t!==t&&e!==e}function RMe(t){const e=_.useRef(t);return jT(()=>{e.current=t}),e}function $Me(t){let{middleware:e,placement:n="bottom",strategy:r="absolute",whileElementsMounted:i}=t===void 0?{}:t;const s=_.useRef(null),o=_.useRef(null),a=RMe(i),l=_.useRef(null),[c,u]=_.useState({x:null,y:null,strategy:r,placement:n,middlewareData:{}}),[f,h]=_.useState(e);BT(f==null?void 0:f.map(b=>{let{options:S}=b;return S}),e==null?void 0:e.map(b=>{let{options:S}=b;return S}))||h(e);const d=_.useCallback(()=>{!s.current||!o.current||AMe(s.current,o.current,{middleware:f,placement:n,strategy:r}).then(b=>{p.current&&Qi.flushSync(()=>{u(b)})})},[f,n,r]);jT(()=>{p.current&&d()},[d]);const p=_.useRef(!1);jT(()=>(p.current=!0,()=>{p.current=!1}),[]);const g=_.useCallback(()=>{if(typeof l.current=="function"&&(l.current(),l.current=null),s.current&&o.current)if(a.current){const b=a.current(s.current,o.current,d);l.current=b}else d()},[d,a]),m=_.useCallback(b=>{s.current=b,g()},[g]),v=_.useCallback(b=>{o.current=b,g()},[g]),y=_.useMemo(()=>({reference:s,floating:o}),[]);return _.useMemo(()=>({...c,update:d,refs:y,reference:m,floating:v}),[c,d,y,m,v])}const MMe=t=>{const{element:e,padding:n}=t;function r(i){return Object.prototype.hasOwnProperty.call(i,"current")}return{name:"arrow",options:t,fn(i){return r(e)?e.current!=null?$F({element:e.current,padding:n}).fn(i):{}:e?$F({element:e,padding:n}).fn(i):{}}}},IMe=_.forwardRef((t,e)=>{const{children:n,width:r=10,height:i=5,...s}=t;return _.createElement(gn.svg,Ee({},s,{ref:e,width:r,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none"}),t.asChild?n:_.createElement("polygon",{points:"0,0 30,0 15,10"}))}),DMe=IMe,kre="Popper",[cM,Z5]=Oo(kre),[LMe,Cre]=cM(kre),NMe=t=>{const{__scopePopper:e,children:n}=t,[r,i]=_.useState(null);return _.createElement(LMe,{scope:e,anchor:r,onAnchorChange:i},n)},QMe="PopperAnchor",jMe=_.forwardRef((t,e)=>{const{__scopePopper:n,virtualRef:r,...i}=t,s=Cre(QMe,n),o=_.useRef(null),a=In(e,o);return _.useEffect(()=>{s.onAnchorChange((r==null?void 0:r.current)||o.current)}),r?null:_.createElement(gn.div,Ee({},i,{ref:a}))}),w_="PopperContent",[BMe,zMe]=cM(w_),[FMe,WMe]=cM(w_,{hasParent:!1,positionUpdateFns:new Set}),VMe=_.forwardRef((t,e)=>{var n,r,i,s,o,a,l,c;const{__scopePopper:u,side:f="bottom",sideOffset:h=0,align:d="center",alignOffset:p=0,arrowPadding:g=0,collisionBoundary:m=[],collisionPadding:v=0,sticky:y="partial",hideWhenDetached:b=!1,avoidCollisions:S=!0,onPlaced:k,...E}=t,T=Cre(w_,u),[C,A]=_.useState(null),R=In(e,ze=>A(ze)),[Q,L]=_.useState(null),z=V5(Q),B=(n=z==null?void 0:z.width)!==null&&n!==void 0?n:0,q=(r=z==null?void 0:z.height)!==null&&r!==void 0?r:0,Z=f+(d!=="center"?"-"+d:""),J=typeof v=="number"?v:{top:0,right:0,bottom:0,left:0,...v},I=Array.isArray(m)?m:[m],j=I.length>0,M={padding:J,boundary:I.filter(ZMe),altBoundary:j},{reference:X,floating:se,strategy:H,x:de,y:fe,placement:ve,middlewareData:F,update:oe}=$Me({strategy:"fixed",placement:Z,whileElementsMounted:PMe,middleware:[YMe(),xMe({mainAxis:h+q,alignmentAxis:p}),S?wMe({mainAxis:!0,crossAxis:!1,limiter:y==="partial"?SMe():void 0,...M}):void 0,Q?MMe({element:Q,padding:g}):void 0,S?yMe({...M}):void 0,_Me({...M,apply:({elements:ze,availableWidth:Ye,availableHeight:we})=>{ze.floating.style.setProperty("--radix-popper-available-width",`${Ye}px`),ze.floating.style.setProperty("--radix-popper-available-height",`${we}px`)}}),GMe({arrowWidth:B,arrowHeight:q}),b?bMe({strategy:"referenceHidden"}):void 0].filter(HMe)});Pc(()=>{X(T.anchor)},[X,T.anchor]);const le=de!==null&&fe!==null,[pe,De]=Ere(ve),xe=$a(k);Pc(()=>{le&&(xe==null||xe())},[le,xe]);const je=(i=F.arrow)===null||i===void 0?void 0:i.x,He=(s=F.arrow)===null||s===void 0?void 0:s.y,nt=((o=F.arrow)===null||o===void 0?void 0:o.centerOffset)!==0,[xt,Ze]=_.useState();Pc(()=>{C&&Ze(window.getComputedStyle(C).zIndex)},[C]);const{hasParent:Oe,positionUpdateFns:be}=WMe(w_,u),Re=!Oe;_.useLayoutEffect(()=>{if(!Re)return be.add(oe),()=>{be.delete(oe)}},[Re,be,oe]),Pc(()=>{Re&&le&&Array.from(be).reverse().forEach(ze=>requestAnimationFrame(ze))},[Re,le,be]);const Ke={"data-side":pe,"data-align":De,...E,ref:R,style:{...E.style,animation:le?void 0:"none",opacity:(a=F.hide)!==null&&a!==void 0&&a.referenceHidden?0:void 0}};return _.createElement("div",{ref:se,"data-radix-popper-content-wrapper":"",style:{position:H,left:0,top:0,transform:le?`translate3d(${Math.round(de)}px, ${Math.round(fe)}px, 0)`:"translate3d(0, -200%, 0)",minWidth:"max-content",zIndex:xt,["--radix-popper-transform-origin"]:[(l=F.transformOrigin)===null||l===void 0?void 0:l.x,(c=F.transformOrigin)===null||c===void 0?void 0:c.y].join(" ")},dir:t.dir},_.createElement(BMe,{scope:u,placedSide:pe,onArrowChange:L,arrowX:je,arrowY:He,shouldHideArrow:nt},Re?_.createElement(FMe,{scope:u,hasParent:!0,positionUpdateFns:be},_.createElement(gn.div,Ke)):_.createElement(gn.div,Ke)))}),UMe="PopperArrow",qMe={top:"bottom",right:"left",bottom:"top",left:"right"},XMe=_.forwardRef(function(e,n){const{__scopePopper:r,...i}=e,s=zMe(UMe,r),o=qMe[s.placedSide];return _.createElement("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0}},_.createElement(DMe,Ee({},i,{ref:n,style:{...i.style,display:"block"}})))});function HMe(t){return t!==void 0}function ZMe(t){return t!==null}const YMe=()=>({name:"anchorCssProperties",fn(t){const{rects:e,elements:n}=t,{width:r,height:i}=e.reference;return n.floating.style.setProperty("--radix-popper-anchor-width",`${r}px`),n.floating.style.setProperty("--radix-popper-anchor-height",`${i}px`),{}}}),GMe=t=>({name:"transformOrigin",options:t,fn(e){var n,r,i,s,o;const{placement:a,rects:l,middlewareData:c}=e,f=((n=c.arrow)===null||n===void 0?void 0:n.centerOffset)!==0,h=f?0:t.arrowWidth,d=f?0:t.arrowHeight,[p,g]=Ere(a),m={start:"0%",center:"50%",end:"100%"}[g],v=((r=(i=c.arrow)===null||i===void 0?void 0:i.x)!==null&&r!==void 0?r:0)+h/2,y=((s=(o=c.arrow)===null||o===void 0?void 0:o.y)!==null&&s!==void 0?s:0)+d/2;let b="",S="";return p==="bottom"?(b=f?m:`${v}px`,S=`${-d}px`):p==="top"?(b=f?m:`${v}px`,S=`${l.floating.height+d}px`):p==="right"?(b=`${-d}px`,S=f?m:`${y}px`):p==="left"&&(b=`${l.floating.width+d}px`,S=f?m:`${y}px`),{data:{x:b,y:S}}}});function Ere(t){const[e,n="center"]=t.split("-");return[e,n]}const Tre=NMe,Pre=jMe,Are=VMe,KMe=XMe,Rre=_.forwardRef((t,e)=>{var n;const{container:r=globalThis==null||(n=globalThis.document)===null||n===void 0?void 0:n.body,...i}=t;return r?MR.createPortal(_.createElement(gn.div,Ee({},i,{ref:e})),r):null});function JMe(t,e){return _.useReducer((n,r)=>{const i=e[n][r];return i??n},t)}const zd=t=>{const{present:e,children:n}=t,r=eIe(e),i=typeof n=="function"?n({present:r.isPresent}):_.Children.only(n),s=In(r.ref,i.ref);return typeof n=="function"||r.isPresent?_.cloneElement(i,{ref:s}):null};zd.displayName="Presence";function eIe(t){const[e,n]=_.useState(),r=_.useRef({}),i=_.useRef(t),s=_.useRef("none"),o=t?"mounted":"unmounted",[a,l]=JMe(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return _.useEffect(()=>{const c=jx(r.current);s.current=a==="mounted"?c:"none"},[a]),Pc(()=>{const c=r.current,u=i.current;if(u!==t){const h=s.current,d=jx(c);t?l("MOUNT"):d==="none"||(c==null?void 0:c.display)==="none"?l("UNMOUNT"):l(u&&h!==d?"ANIMATION_OUT":"UNMOUNT"),i.current=t}},[t,l]),Pc(()=>{if(e){const c=f=>{const d=jx(r.current).includes(f.animationName);f.target===e&&d&&Qi.flushSync(()=>l("ANIMATION_END"))},u=f=>{f.target===e&&(s.current=jx(r.current))};return e.addEventListener("animationstart",u),e.addEventListener("animationcancel",c),e.addEventListener("animationend",c),()=>{e.removeEventListener("animationstart",u),e.removeEventListener("animationcancel",c),e.removeEventListener("animationend",c)}}else l("ANIMATION_END")},[e,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:_.useCallback(c=>{c&&(r.current=getComputedStyle(c)),n(c)},[])}}function jx(t){return(t==null?void 0:t.animationName)||"none"}const L6="rovingFocusGroup.onEntryFocus",tIe={bubbles:!1,cancelable:!0},uM="RovingFocusGroup",[zT,$re,nIe]=Hm(uM),[rIe,Y5]=Oo(uM,[nIe]),[iIe,sIe]=rIe(uM),oIe=_.forwardRef((t,e)=>_.createElement(zT.Provider,{scope:t.__scopeRovingFocusGroup},_.createElement(zT.Slot,{scope:t.__scopeRovingFocusGroup},_.createElement(aIe,Ee({},t,{ref:e}))))),aIe=_.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:s,currentTabStopId:o,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:l,onEntryFocus:c,...u}=t,f=_.useRef(null),h=In(e,f),d=jd(s),[p=null,g]=Nl({prop:o,defaultProp:a,onChange:l}),[m,v]=_.useState(!1),y=$a(c),b=$re(n),S=_.useRef(!1),[k,E]=_.useState(0);return _.useEffect(()=>{const T=f.current;if(T)return T.addEventListener(L6,y),()=>T.removeEventListener(L6,y)},[y]),_.createElement(iIe,{scope:n,orientation:r,dir:d,loop:i,currentTabStopId:p,onItemFocus:_.useCallback(T=>g(T),[g]),onItemShiftTab:_.useCallback(()=>v(!0),[]),onFocusableItemAdd:_.useCallback(()=>E(T=>T+1),[]),onFocusableItemRemove:_.useCallback(()=>E(T=>T-1),[])},_.createElement(gn.div,Ee({tabIndex:m||k===0?-1:0,"data-orientation":r},u,{ref:h,style:{outline:"none",...t.style},onMouseDown:gt(t.onMouseDown,()=>{S.current=!0}),onFocus:gt(t.onFocus,T=>{const C=!S.current;if(T.target===T.currentTarget&&C&&!m){const A=new CustomEvent(L6,tIe);if(T.currentTarget.dispatchEvent(A),!A.defaultPrevented){const R=b().filter(q=>q.focusable),Q=R.find(q=>q.active),L=R.find(q=>q.id===p),B=[Q,L,...R].filter(Boolean).map(q=>q.ref.current);Mre(B)}}S.current=!1}),onBlur:gt(t.onBlur,()=>v(!1))})))}),lIe="RovingFocusGroupItem",cIe=_.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:s,...o}=t,a=ff(),l=s||a,c=sIe(lIe,n),u=c.currentTabStopId===l,f=$re(n),{onFocusableItemAdd:h,onFocusableItemRemove:d}=c;return _.useEffect(()=>{if(r)return h(),()=>d()},[r,h,d]),_.createElement(zT.ItemSlot,{scope:n,id:l,focusable:r,active:i},_.createElement(gn.span,Ee({tabIndex:u?0:-1,"data-orientation":c.orientation},o,{ref:e,onMouseDown:gt(t.onMouseDown,p=>{r?c.onItemFocus(l):p.preventDefault()}),onFocus:gt(t.onFocus,()=>c.onItemFocus(l)),onKeyDown:gt(t.onKeyDown,p=>{if(p.key==="Tab"&&p.shiftKey){c.onItemShiftTab();return}if(p.target!==p.currentTarget)return;const g=hIe(p,c.orientation,c.dir);if(g!==void 0){p.preventDefault();let v=f().filter(y=>y.focusable).map(y=>y.ref.current);if(g==="last")v.reverse();else if(g==="prev"||g==="next"){g==="prev"&&v.reverse();const y=v.indexOf(p.currentTarget);v=c.loop?dIe(v,y+1):v.slice(y+1)}setTimeout(()=>Mre(v))}})})))}),uIe={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function fIe(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function hIe(t,e,n){const r=fIe(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return uIe[r]}function Mre(t){const e=document.activeElement;for(const n of t)if(n===e||(n.focus(),document.activeElement!==e))return}function dIe(t,e){return t.map((n,r)=>t[(e+r)%t.length])}const Ire=oIe,Dre=cIe;var pIe=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},x0=new WeakMap,Bx=new WeakMap,zx={},N6=0,Lre=function(t){return t&&(t.host||Lre(t.parentNode))},mIe=function(t,e){return e.map(function(n){if(t.contains(n))return n;var r=Lre(n);return r&&t.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",t,". Doing nothing"),null)}).filter(function(n){return!!n})},gIe=function(t,e,n,r){var i=mIe(e,Array.isArray(t)?t:[t]);zx[n]||(zx[n]=new WeakMap);var s=zx[n],o=[],a=new Set,l=new Set(i),c=function(f){!f||a.has(f)||(a.add(f),c(f.parentNode))};i.forEach(c);var u=function(f){!f||l.has(f)||Array.prototype.forEach.call(f.children,function(h){if(a.has(h))u(h);else try{var d=h.getAttribute(r),p=d!==null&&d!=="false",g=(x0.get(h)||0)+1,m=(s.get(h)||0)+1;x0.set(h,g),s.set(h,m),o.push(h),g===1&&p&&Bx.set(h,!0),m===1&&h.setAttribute(n,"true"),p||h.setAttribute(r,"true")}catch(v){console.error("aria-hidden: cannot operate on ",h,v)}})};return u(e),a.clear(),N6++,function(){o.forEach(function(f){var h=x0.get(f)-1,d=s.get(f)-1;x0.set(f,h),s.set(f,d),h||(Bx.has(f)||f.removeAttribute(r),Bx.delete(f)),d||f.removeAttribute(n)}),N6--,N6||(x0=new WeakMap,x0=new WeakMap,Bx=new WeakMap,zx={})}},G5=function(t,e,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(t)?t:[t]),i=e||pIe(t);return i?(r.push.apply(r,Array.from(i.querySelectorAll("[aria-live]"))),gIe(r,i,n,"aria-hidden")):function(){return null}},Fr=function(){return Fr=Object.assign||function(e){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},Fr.apply(this,arguments)};function fM(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]]);return n}function Ym(t,e,n,r){function i(s){return s instanceof n?s:new n(function(o){o(s)})}return new(n||(n=Promise))(function(s,o){function a(u){try{c(r.next(u))}catch(f){o(f)}}function l(u){try{c(r.throw(u))}catch(f){o(f)}}function c(u){u.done?s(u.value):i(u.value).then(a,l)}c((r=r.apply(t,e||[])).next())})}function Gm(t,e){var n={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},r,i,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(c){return function(u){return l([c,u])}}function l(c){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(n=0)),n;)try{if(r=1,i&&(s=c[0]&2?i.return:c[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,c[1])).done)return s;switch(i=0,s&&(c=[c[0]&2,s.value]),c[0]){case 0:case 1:s=c;break;case 4:return n.label++,{value:c[1],done:!1};case 5:n.label++,i=c[1],c=[0];continue;case 7:c=n.ops.pop(),n.trys.pop();continue;default:if(s=n.trys,!(s=s.length>0&&s[s.length-1])&&(c[0]===6||c[0]===2)){n=0;continue}if(c[0]===3&&(!s||c[1]>s[0]&&c[1]<s[3])){n.label=c[1];break}if(c[0]===6&&n.label<s[1]){n.label=s[1],s=c;break}if(s&&n.label<s[2]){n.label=s[2],n.ops.push(c);break}s[2]&&n.ops.pop(),n.trys.pop();continue}c=e.call(t,n)}catch(u){c=[6,u],i=0}finally{r=s=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function zF(t,e){var n=typeof Symbol=="function"&&t[Symbol.iterator];if(!n)return t;var r=n.call(t),i,s=[],o;try{for(;(e===void 0||e-- >0)&&!(i=r.next()).done;)s.push(i.value)}catch(a){o={error:a}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return s}function S_(t,e,n){if(n||arguments.length===2)for(var r=0,i=e.length,s;r<i;r++)(s||!(r in e))&&(s||(s=Array.prototype.slice.call(e,0,r)),s[r]=e[r]);return t.concat(s||Array.prototype.slice.call(e))}var rv="right-scroll-bar-position",iv="width-before-scroll-bar",vIe="with-scroll-bars-hidden",OIe="--removed-body-scroll-bar-size";function Q6(t,e){return typeof t=="function"?t(e):t&&(t.current=e),t}function yIe(t,e){var n=_.useState(function(){return{value:t,callback:e,facade:{get current(){return n.value},set current(r){var i=n.value;i!==r&&(n.value=r,n.callback(r,i))}}}})[0];return n.callback=e,n.facade}var bIe=typeof window<"u"?_.useLayoutEffect:_.useEffect,FF=new WeakMap;function Nre(t,e){var n=yIe(e||null,function(r){return t.forEach(function(i){return Q6(i,r)})});return bIe(function(){var r=FF.get(n);if(r){var i=new Set(r),s=new Set(t),o=n.current;i.forEach(function(a){s.has(a)||Q6(a,null)}),s.forEach(function(a){i.has(a)||Q6(a,o)})}FF.set(n,t)},[t]),n}function xIe(t){return t}function wIe(t,e){e===void 0&&(e=xIe);var n=[],r=!1,i={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:t},useMedium:function(s){var o=e(s,r);return n.push(o),function(){n=n.filter(function(a){return a!==o})}},assignSyncMedium:function(s){for(r=!0;n.length;){var o=n;n=[],o.forEach(s)}n={push:function(a){return s(a)},filter:function(){return n}}},assignMedium:function(s){r=!0;var o=[];if(n.length){var a=n;n=[],a.forEach(s),o=n}var l=function(){var u=o;o=[],u.forEach(s)},c=function(){return Promise.resolve().then(l)};c(),n={push:function(u){o.push(u),c()},filter:function(u){return o=o.filter(u),n}}}};return i}function Qre(t){t===void 0&&(t={});var e=wIe(null);return e.options=Fr({async:!0,ssr:!1},t),e}var jre=function(t){var e=t.sideCar,n=fM(t,["sideCar"]);if(!e)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=e.read();if(!r)throw new Error("Sidecar medium not found");return _.createElement(r,Fr({},n))};jre.isSideCarExport=!0;function Bre(t,e){return t.useMedium(e),jre}var zre=Qre(),j6=function(){},K5=_.forwardRef(function(t,e){var n=_.useRef(null),r=_.useState({onScrollCapture:j6,onWheelCapture:j6,onTouchMoveCapture:j6}),i=r[0],s=r[1],o=t.forwardProps,a=t.children,l=t.className,c=t.removeScrollBar,u=t.enabled,f=t.shards,h=t.sideCar,d=t.noIsolation,p=t.inert,g=t.allowPinchZoom,m=t.as,v=m===void 0?"div":m,y=fM(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as"]),b=h,S=Nre([n,e]),k=Fr(Fr({},y),i);return _.createElement(_.Fragment,null,u&&_.createElement(b,{sideCar:zre,removeScrollBar:c,shards:f,noIsolation:d,inert:p,setCallbacks:s,allowPinchZoom:!!g,lockRef:n}),o?_.cloneElement(_.Children.only(a),Fr(Fr({},k),{ref:S})):_.createElement(v,Fr({},k,{className:l,ref:S}),a))});K5.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};K5.classNames={fullWidth:iv,zeroRight:rv};var WF,SIe=function(){if(WF)return WF;if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function _Ie(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var e=SIe();return e&&t.setAttribute("nonce",e),t}function kIe(t,e){t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}function CIe(t){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(t)}var EIe=function(){var t=0,e=null;return{add:function(n){t==0&&(e=_Ie())&&(kIe(e,n),CIe(e)),t++},remove:function(){t--,!t&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}},TIe=function(){var t=EIe();return function(e,n){_.useEffect(function(){return t.add(e),function(){t.remove()}},[e&&n])}},hM=function(){var t=TIe(),e=function(n){var r=n.styles,i=n.dynamic;return t(r,i),null};return e},PIe={left:0,top:0,right:0,gap:0},B6=function(t){return parseInt(t||"",10)||0},AIe=function(t){var e=window.getComputedStyle(document.body),n=e[t==="padding"?"paddingLeft":"marginLeft"],r=e[t==="padding"?"paddingTop":"marginTop"],i=e[t==="padding"?"paddingRight":"marginRight"];return[B6(n),B6(r),B6(i)]},RIe=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return PIe;var e=AIe(t),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,r-n+e[2]-e[0])}},$Ie=hM(),yp="data-scroll-locked",MIe=function(t,e,n,r){var i=t.left,s=t.top,o=t.right,a=t.gap;return n===void 0&&(n="margin"),`
227
+ `)&&(r=r.slice(0,-1)),{textBlock:r,nextIdx:i}}function Nx(t){return Array.isArray(t)?t.length===0:typeof t=="object"&&t!==null?Object.keys(t).length===0:!1}function PT(t){let e=0;for(let n of t)if(n===" ")e++;else break;return e}function dF(t,e){let n=0,r="";for(let i of t)n<e&&i===" "?n++:r+=i;return r}async function Ene(t,e){const n=await VAe(t,e);if(n.status===200){const{originalObj:r,yamlValue:i}=n.data;Kee.setState({[e]:r}),u_.setState({[e]:i})}}function V$(t){const e=te.getState().x[t].variantId,n=dn(t),r=u_.getState()[e]??"";switch(n){case Y.PARAM_SWEEP:lRe(t,r);break;case Y.GLOBAL_PARAM_SWEEP:uRe(r,e);break;case Y.GLOBAL_VARIABLES:case Y.SECTION:const i=Kee.getState()[e]??{};hRe(t,r,i);break}}function lRe(t,e){const n=te.getState(),r=ky(t,n.x),s=Cne(e).map(c=>c.trim()?TT(c):{}),o=Jo(r,n).children,a=Object.keys(o),l=[];for(const c of s){const u=!Array.isArray(c);let f=null,h;if(u){if(h=Object.keys(c)[0],!h){l.push({selectedItem:null,params:[]});continue}if(f=cRe(h,a,n.codeInfo),!f)continue}const{pathMap:d}=_y({allCodeInfo:n.codeInfo,codeInfoChildren:o,startingId:f});let p=h?c[h]:c;ae.size(p)===0&&(p=[]);const g=[];for(const m of p){const v=Object.keys(m)[0];let y;for(const S of Object.keys(d))if(C$(n.codeInfo,d,S)===v){y=S;break}if(!y)continue;const b=m[v];ae.size(b)>0&&g.push({paramInfoId:y,values:b})}l.push({selectedItem:f,params:g})}te.setState(c=>{Yt(t,c).sweep=l})}function cRe(t,e,n){return e.find(r=>{var i;return((i=n[r])==null?void 0:i.name)===t})}function uRe(t,e){const n=sRe(t)[0].toJS(),r=te.getState(),i=r.x,s=r.variants,o={};for(const[a,l]of Object.entries(n))AT(a,l,i,s,o,null,null);te.setState(a=>{a.variants[e].runGroup=o})}function AT(t,e,n,r,i,s,o){let a=s,l=o;const[c,u]=fRe(t,s,n,r);if(u==="section"?(c in i||(i[c]={}),i[c][o]={selected:!0,versions:{},paramSweeps:{}},a=c):u==="sectionVariant"?(i[s][o].versions[c]=!0,l=c):u==="paramSweep"&&(i[s][o].paramSweeps[c]=!0),e)for(const[f,h]of Object.entries(ae.pickBy(e,(d,p)=>p.startsWith("~"))))AT(f,h,n,r,i,a,l);if(u==="section"&&(!e||!Object.keys(e).some(f=>f.startsWith("@")))&&(l=n[c].variantId,i[c][o].versions[l]=!0),!!e)for(const[f,h]of Object.entries(ae.pickBy(e,(d,p)=>!p.startsWith("~"))))AT(f,h,n,r,i,a,l)}function fRe(t,e,n,r){let i,s;if(e&&t.startsWith("@")){const o=t.slice(1);for(const a of n[e].variantIds)if(r[a].name===o){i=a,s="sectionVariant";break}}else if(e&&t.startsWith("~")){const o=t.slice(1),{paramSweepSectionId:a}=n[e];for(const l of n[a].variantIds)if(r[l].name===o){i=l,s="paramSweep";break}}else if(e){for(const o of r[n[e].variantId].children)if(n[o].name===t){i=o,s="section";break}}else for(const o of Object.values(n))if(o.name===t){i=o.id,s="section";break}return[i,s]}function hRe(t,e,n){var T,C;const r=te.getState(),i=Cne(e);let s=null,o={},a={};i.length===3?[s,o,a]=i:i.length===2?[o,a]=i:[a]=i;try{o=(T=o.trim)!=null&&T.call(o)?TT(o):{},a=(C=a.trim)!=null&&C.call(a)?TT(a):{}}catch{return}const l=vF(Qx(n.pinned),Qx(n.unpinned)),c=vF(Qx(o,!0),Qx(a,!0)),u=[],f=new Set,h=new Set;for(const A of l){if(f.has(A.id))continue;let R=c.filter(Q=>Q.key===A.key&&!h.has(JSON.stringify(Q.keyPath)));R.length>0&&(gF(R,A.keyPath),pF({v:A,matches:R,usedOriginalIds:f,usedPaths:h,output:u}))}for(const A of l){if(f.has(A.id))continue;let R=c.filter(Q=>Q.value===A.value&&!h.has(JSON.stringify(Q.keyPath)));R.length>0&&(gF(R,A.keyPath),pF({v:A,matches:R,usedOriginalIds:f,usedPaths:h,output:u}))}const{jsonSource:d,jsonSourceKeys:p}=r.x[t];for(const A of c){if(h.has(JSON.stringify(A.keyPath)))continue;const R={key:A.key,keyPath:A.keyPath,value:A.value,isPinned:A.isPinned};R.id=_te(R.keyPath,d,p),R.isNewParam=!0,u.push(R)}const g={};for(const[A,R]of c.entries())g[JSON.stringify(R.keyPath)]=A;u.sort((A,R)=>{const Q=g[JSON.stringify(A.keyPath)],L=g[JSON.stringify(R.keyPath)];return Q-L});const{parentCodeInfoId:m}=Ry(t,r),v={[m]:[]};for(const A of u)v[A.id]=[];OF({sectionId:t,idsToChildren:v,output:u,toProcess:u.filter(A=>!(A.isPinned&&!A.isNewParam)),inputParentId:m,insertAtOriginalIdx:!1}),OF({sectionId:t,idsToChildren:v,output:u,toProcess:u.filter(A=>A.isPinned&&!A.isNewParam),inputParentId:m,insertAtOriginalIdx:!0});const y=r.codeInfo,b={},S={},k={},E=Fm().value;for(const A of u)A.id in y?S[A.id]={name:A.key,isPinned:A.isPinned}:b[A.id]=E5({id:A.id,name:A.key,editable:A.editable??!0,rcType:Y.PARAMETER,isPinned:A.isPinned}),A.value!==E&&(k[A.id]=A.value);te.setState(A=>{A.codeInfo={...A.codeInfo,...b};for(const[L,z]of Object.entries(S))for(const[B,q]of Object.entries(z))A.codeInfo[L][B]=q;const R=A.x[t].variantId,Q=A.variants[R];for(const[L,z]of Object.entries(v))W$(Q,A).children[L]=z;for(const[L,z]of Object.entries(k))Y$(R,L,z,A)})}function pF({v:t,matches:e,usedOriginalIds:n,usedPaths:r,output:i}){const s={key:e[0].key,keyPath:e[0].keyPath,value:e[0].value,isPinned:e[0].isPinned};s.id=t.id,s.editable=t.editable,i.push(s),n.add(t.id),r.add(JSON.stringify(s.keyPath))}function Qx(t,e=!1){let n=[];function r(i,s,o,a){if(typeof s=="object"&&!Array.isArray(s)&&s!==null){a.length>0&&n.push({id:i,keyPath:a,value:null,editable:o,key:a[a.length-1]});for(const[l,c]of Object.entries(s)){const u=[...a,l];e?r(null,c,null,u):r(c.id,c.value,c.editable,u)}}else n.push({id:i,keyPath:a,value:s,editable:o,key:a[a.length-1]})}return r(null,t,null,[]),n}function mF(t,e){const n=Math.min(t.length,e.length),r=Math.max(t.length,e.length);let i=0;for(let s=0;s<n&&t[t.length-1-s]===e[e.length-1-s];s++)i++;return i/r*(n/r)}function gF(t,e){return t.sort((n,r)=>{const i=mF(n.keyPath,e);return mF(r.keyPath,e)-i})}function vF(t,e){for(const r of e)r.isPinned=!1;const n=[];for(const r of t)e.find(s=>ae.isEqual(s.keyPath,r.keyPath))||n.push({...r,isPinned:!0});return[...n,...e]}function OF({sectionId:t,idsToChildren:e,output:n,toProcess:r,inputParentId:i,insertAtOriginalIdx:s}){for(const o of r){let a=i;if(o.keyPath.length>1){const l=ae.find(n,c=>ae.isEqual(c.keyPath,o.keyPath.slice(0,-1)));if(l)a=l.id;else continue}if(s){const l=Jo(t).children[a].indexOf(o.id);e[a].splice(l,0,o.id)}else e[a].push(o.id)}}async function Nd(t,e){Pi(t).displayMode===so.YAML&&await Ene(t,e)}async function p_(t=!1){const e=te.getState();for(const[n,r]of Object.entries(e.x)){const i=t?z5(n):r.variantId;await Nd(n,i)}}function Vi(t){mT.setState(e=>{e.timeoutId!==null&&clearTimeout(e.timeoutId);const n=setTimeout(()=>mT.setState({message:""}),3e3);return{message:t,timeoutId:n}})}function Q5({withArtifacts:t=!1,convertYamlToGUI:e=!0}){let n=ae.cloneDeep(te.getState().x);if(n=ae.pickBy(n,d=>!d.isTemporary),e)for(const d of Object.values(n))d.displayMode===so.YAML&&V$(d.id);n=ae.mapValues(n,d=>(d.columnWidth=jm.getState()[d.id],d));const r=t?MAe():{},i=ae.mapValues(te.getState().variants,d=>({...d,children:d.children.filter(p=>p in n)})),s=te.getState().artifactGroups,o=ae.pickBy(te.getState().uiTypes,d=>d.presetType!==Y.PRESET_UI_TYPE_BASE),a=te.getState().uiTypeCols,l=te.getState().codeInfo,c=te.getState().codeInfoCols,u=mRe(),f={};for(const d of mr.getState().x.values())d.id in n&&(f[d.id]={x:d.position.x,y:d.position.y,zIndex:d.zIndex,w:d.width,h:d.height});return u.children=f,{projectConfig:u,sectionVariants:i,artifacts:r,artifactGroups:s,uiTypes:o,uiTypeCols:a,sections:n,codeInfo:l,codeInfoCols:c}}async function j5(){let t;Vi("Saving..."),vo.getState().name===HR?(t=await SAe(Q5({})),t.status===200&&Nt.setState(t.data)):t=await pAe({project:await U$()}),t.status===200&&Vi("Saved!")}async function dRe({newConfigName:t,withRefs:e}){return await Tne({fn:mAe,otherArgs:{newConfigName:t,withRefs:e}})}async function pRe({configName:t}){return await Tne({fn:gAe,otherArgs:{configName:t}})}async function Tne({fn:t,otherArgs:e}){await t({project:await U$(),...e})}function mRe(){const t=vo.getState(),e={id:t.id,name:t.name,previewImgColor:t.previewImgColor};return e.viewport=qe.getState().fitViewOnInit?null:bee(),e}async function U$(){const t=Q5({withArtifacts:!0,convertYamlToGUI:!0});return Nt.getState().backend.saveRenderedValues&&await gRe(t.sections),t}async function gRe(t){for(const e of Object.keys(t))[Y.DRAW,Y.CHART].includes(dn(e))&&(t[e].renderedValue=await Ine(e))}async function vRe(t){return await jt({body:{projects:t},address:Y.ROUTE_UPDATE_INTERACTIVE_CODE})}async function ORe(){const t=Q5({}),e={};for(const n of Object.values(t.sections))dn(n.id)===Y.CODE&&(e[n.id]=O$(n.id,Yt(n.id).code));return await jt({body:{project:t,candidateTemplateVars:e},address:Y.ROUTE_FORMAT_CODE})}async function yRe(){const t=await ORe();t.status===200&&te.setState(e=>{for(const[n,r]of Object.entries(t.data))r!==null&&(Yt(n,e).code=r)})}function Pne(t,e,n){const r=JSON.stringify(t),{throttledSendFns:i}=pT.getState();r in i?i[r](r,e,n):null in i&&i[null](r,e,n)}async function bRe(t){if(t.length===0)return;const e=ti.getState().namePathTypeToId,n=[],r=[];for(const[s,o]of t.entries()){"path"in o||(o.path="");const a=e[_$(o)];a?o.id=a:(n.push(s),r.push(ae.pick(o,["name","path","type"])))}const i=await iAe(r);if(i.status==200)for(const[s,o]of i.data.entries()){const a=n[s];t[a].id=o??Kn()}}async function Ane(t){if(t.length===0)return;const e={},n=ti.getState();for(const r of t)"path"in r||(r.path=""),r.type==="img"&&(r.value=await g$(r.value)),e[r.id??n.namePathTypeToId[_$(r)]]=r;ti.setState(r=>({x:{...r.x,...e}}))}function Rne(t){const e=xRe(t),n=wRe(e);for(const r of Object.values(pT.getState().throttledSendFns))r.cancel();pT.setState({inMemorySubprocessInfo:e,throttledSendFns:n})}function xRe(t){const e=ae.cloneDeep(t);for(const n of Object.values(e))for(const r of Object.values(n.fnInfo)){const i=new Set;for(const s of r.dependencies){const o=s===null?s:JSON.stringify(s);i.add(o)}r.dependencies=i}return e}function wRe(t){const e={};for(const n of Object.values(t))for(const r of Object.values(n.fnInfo))for(const i of r.dependencies)e[i]=ae.throttle((s,o,a)=>{Ay({id:Kn(),content:{[s]:a?a():o},messageType:"inMemoryFn"})},SRe(t,i));return e}function SRe(t,e){let n=0;for(const r of Object.values(t))for(const i of Object.values(r.fnInfo))(i.dependencies.has(e)||i.dependencies.has(null))&&i.averageRunTime>n&&(n=i.averageRunTime);return Math.max(n*1e3,50)}function _Re(t){const{projectConfigId:e,codeSectionId:n,diagnostics:r}=t;if(e!==vo.getState().id)return;const i={};for(const s of r){const{sectionId:o,paramInfoId:a,message:l}=s;te.getState().codeInfo[a].ignoreTypeErrors||(o in i||(i[o]={}),a in i[o]||(i[o][a]=[]),i[o][a].push(l))}gp.getState().userRequested&&Vi(ae.size(i)===0?"No type errors":`Found ${ae.size(i)} type errors`),gp.getState().reset(),gp.setState({errors:i})}function kRe(t,e){for(const n of Object.values(e.errors))t in n&&delete n[t]}function CRe(t){const{connections:e}=t,n=e.filter(r=>r.isCLI);n.map(r=>r.websocketId).includes(Qm.getState().connectedTo)||(n.length>0?RT(n[0].websocketId):RT(null)),ERe(e)}function RT(t){Qm.setState({connectedTo:t})}function ERe(t){Qm.setState({connections:t})}let ro;const $ne=ae.debounce(t=>{q$()||(ro=new WebSocket(`${Hp.WEBSOCKET}${Y.ROUTE_WEBSOCKET_MANAGER}`),ro.addEventListener("open",()=>{Mne(t)}),ro.addEventListener("message",e=>{PRe(e.data)}),ro.addEventListener("error",TRe),ro.addEventListener("close",()=>{ro=null,setTimeout(()=>{$ne(t)},3e3)}))},1e3,{leading:!0});function TRe(){ro&&(ro.close(),ro=null)}function q$(){return ro&&ro.readyState===1}function PRe(t){const e=JSON.parse(t);e.messageType===Y.WS_ALL_CONNECTIONS?CRe(e):e.messageType===Y.WS_LSP_DIAGNOSTICS?_Re(e.content):e.messageType===Y.WS_LSP_STATUS?Vi(`Language Server ${e.content.data}`):e.messageType===Y.WS_ARTIFACT||e.messageType===Y.WS_IN_MEMORY_FN_RETURN?Ane(e.content):e.messageType===Y.WS_IN_MEMORY_FN_AVG_RUN_TIME?Rne(e.content):e.id&&oO(e.id,e.content)}function Mne(t){q$()&&ro.send(JSON.stringify({location:t}))}async function Ay({content:t,id:e,messageType:n}){const r=Qm.getState().connectedTo;q$()&&r&&ro.send(JSON.stringify({id:e,content:t,toWebsocketId:r,messageType:n}))}function ARe(t){y5.setState(e=>ae.omit(e,[t]),!0)}function oO(t,e){y5.setState({[t]:e})}function X$({id:t,condition:e,fn:n}){return new Promise(r=>{const i=t||Kn(),s=y5.subscribe(o=>o[i],o=>{(!e||e(o))&&(s(),r(o),ARe(i))});n==null||n(i)})}async function im({id:t,messageType:e,content:n,condition:r}){return await X$({id:t,condition:r,fn:s=>Ay({id:s,messageType:e,content:n})})}async function Ine(t){const e=i=>oO(i,!0),n=Dne(t);return await X$({id:n,condition:()=>!0,fn:e})}function Dne(t){return`${t}-base64-request`}function Lne(t,e){const n=Dne(t);return y5.subscribe(i=>i[n],i=>{i===!0&&oO(n,Ete(e.current))})}async function RRe(t){let e=!1;return await X$({id:$T(t),condition:n=>(e=n,!0)}),e}function $T(t){return`${t}-delete-request`}function Pi(t){return te.getState().x[t]}function sm(t){return Pi(t).parentId}function dn(t,e){const n=e??te.getState();return n.uiTypes[n.x[t].uiTypeId].type}function Yt(t,e){const n=e??te.getState();return n.variants[n.x[t].variantId]}function B5(t,e=sm){let n=e(t),r=t;for(;n;)r=n,n=e(n);return r}function H$(t,e){let n=e.x[t].parentId;if(!n)return e.x[t].name;let r=t,i="";for(;n;)dn(n,e)===Y.LIST_ROOT?i=`[${Yt(n,e).children.indexOf(t)}]${i}`:i=`["${e.x[r].name}"]${i}`,r=n,n=e.x[n].parentId;return`${e.x[r].name}${i}`}function $Re(t,e){const n=[t];let r=0;for(;r<n.length;){const i=n[r];n.push(...Yt(i,e).children),r+=1}return n}function MRe(t){te.setState(e=>{e.x[t].isHorizontalOrientation=!e.x[t].isHorizontalOrientation})}function IRe(t){te.setState(e=>{e.x[t].positionAndSizeLocked=!e.x[t].positionAndSizeLocked})}function m_(){qf.getState().update(G$())}function Nne(){te.setState(t=>{for(const e of Object.values(t.x))e.previewVariantId=null})}function Z$({sections:t,sectionVariants:e,uiTypes:n,uiTypeCols:r,codeInfo:i,codeInfoCols:s,state:o}){o.x={...o.x,...t},o.variants={...o.variants,...e},o.uiTypes={...o.uiTypes,...n},o.uiTypeCols={...o.uiTypeCols,...r},o.codeInfo={...o.codeInfo,...i},o.codeInfoCols={...o.codeInfoCols,...s}}function Y$(t,e,n,r){e in r.variants[t].values||(r.variants[t].values[e]=Fm()),r.variants[t].values[e].value=n}function MT(t,e,n,r){Y$(r.x[t].variantId,e,n,r)}function Jo(t,e){const n=e??te.getState(),r=Yt(t,n).codeInfoColId;return r?n.codeInfoCols[r]:k5()}function Qne(t,e){const n=e??te.getState();return n.codeInfoCols[Ll(t,n).codeInfoColId]}function Ll(t,e){const n=e??te.getState();return n.variants[z5(t,n)]}function z5(t,e){const n=e??te.getState();return n.x[t].previewVariantId??n.x[t].variantId}function om(t,e,n){const r=Yt(t,n);r.children=e(r.children)}function jne(t,e,n){const r=Ll(t,e).children;if(n[t]=r,r)for(const i of r)jne(i,e,n)}function G$(t,e=!1){const n={},r=t??te.getState();for(const i of Object.values(r.x))i.parentId||(jne(i.id,r,n),e&&(null in n||(n[null]=[]),n[null].push(i.id)));return n}function DRe(t){const e={},n=t??te.getState();for(const r of Object.values(n.x))e[r.id]=r.parentId;return e}function LRe(t,e){const n=[];for(const r of e.x[t].variantIds)n.push(...e.variants[r].children);return n}function Bne(t,e){const n=[...t];let r=0;for(;r<n.length;){const i=LRe(n[r],e),{paramSweepSectionId:s}=e.x[n[r]];i&&n.push(...i),s&&n.push(s),r+=1}return n}function NRe(t){te.setState(e=>{e.variants[t].isFrozen=!e.variants[t].isFrozen})}function QRe(t,e){te.setState(n=>{n.x[t].defaultVariantId=e})}function zne(t){te.setState(e=>{for(const n of t){const r=e.x[n];r.variantId=r.defaultVariantId}})}function jRe(){zne(Object.keys(te.getState().x))}function BRe(t,e){const n=Kn(),r=e.codeInfoCols;return r[n]=ae.cloneDeep(r[t]),n}function zRe(t,e,n,r){const i=Kn(),s=r.variants;return s[i]=ae.cloneDeep(s[t]),s[i].name=e,s[i].codeInfoColId=n,s[i].isFrozen=!1,i}function Ry(t,e,n=null){const r=n?e.variants[n]:Ll(t,e),{codeInfoColId:i}=r,s=r.selectedItem;return{codeInfoChildren:i?e.codeInfoCols[i].children:k5().children,parentCodeInfoId:s}}async function FRe(t,e,n){const r=te.getState(),{jsonSource:i}=r.x[t];if(i){const{name:s}=r.variants[e],o=await yPe(s);o.status==200&&(YPe(o.data),await RRe(o.data)&&yF(t,e,n))}else yF(t,e,n)}function yF(t,e,n){te.setState(r=>{const i=r.x[t];i.variantIds=i.variantIds.filter(s=>s!==e),i.defaultVariantId===e&&(i.defaultVariantId=i.variantIds[0]),n&&(i.variantId=i.variantIds[0]),delete r.variants[e]})}const bF={activeId:null,activeIsTopLevel:!1,overId:null,triggerDistCondition:!1,isSorting:!1,isMovingFree:!1,disabled:{},width:null,height:null,times:{}},cn=qr(vn($d(Sn((t,e)=>({...bF,setActive:({id:n,isTopLevel:r,width:i,height:s})=>t({activeId:n,activeIsTopLevel:r,width:i,height:s}),activateSortingMode:()=>t({isSorting:!0,isMovingFree:!1}),activateMovingFreeMode:()=>{t({isMovingFree:!0,isSorting:!1})},deactivate:()=>{t({...bF,disabled:e().disabled}),m_()},setDisabled:(n,r)=>t(i=>{i.disabled[n]=r}),setTime:n=>t(r=>{r.times[n]=Date.now()})}))))),IT="-TempDND";function $y(t){return`${t}${IT}`}function F5(t){return t.slice(-IT.length)===IT}function Fne(){return cn(t=>({isSorting:t.isSorting,isMovingFree:t.isMovingFree}),ae.isEqual)}const qf=qr(vn($d(Sn(t=>({x:{},y:{},addChild:({oldParentId:e,newParentId:n,childId:r,index:i})=>t(s=>{e&&(s.x[e]=s.x[e].filter(o=>o!==r)),s.x[n]=[...s.x[n].slice(0,i),r,...s.x[n].slice(i)],s.y[r]=n}),removeChild:e=>t(n=>{const r=n.y[e];r&&(n.x[r]=n.x[r].filter(i=>i!==e),n.y[e]=void 0)}),replaceWithTemp:e=>t(n=>{const r=n.y[e];if(r){const i=n.x[r].indexOf(e),s=$y(e);n.x[r][i]=s,n.y[s]=r,n.y[e]=void 0}}),update:e=>t(n=>{n.x=e,n.y={};for(const[r,i]of Object.entries(e))for(const s of i)n.y[s]=r})})))));function WRe(t){const e=[],n={};for(const o of Object.keys(t.details))if(t.details[o].isTopLevelAndCanHaveEVRefs)if(t.globalVariableId===o)K$(t,o,null,e,n,"",[],!0);else{const a=t.details[o].name;Wne(t,e,n,o,a,[a.length])}if(e.length===0)return{pattern:Jp(),codeAreaPattern:Jp(),fullNameToInfo:n};const r=`(?<![A-Za-z."'_])(${e.join("|")})(?![A-Za-z"'_])`,i=new RegExp(r,"g"),s=new RegExp(`(?<=.*?\\${Y.TEMPLATE_PREFIX}${Y.SETTA_GENERATED_PYTHON}.*?)${r}`,"gs");return{pattern:i,codeAreaPattern:s,fullNameToInfo:n}}function Wne(t,e,n,r,i,s){const o=t.details[r].sectionTypeName;for(const[u,f]of t.details[r].sectionChildren.entries()){const h=t.details[f].name,d=o===Y.LIST_ROOT?`[${u.toString()}]`:`["${h}"]`,p=`${i}${d}`;Wne(t,e,n,f,p,[...s,p.length])}const a=i,l=`${Y.ARGS_PREFIX}${i}`,c=s.map(u=>u+Y.ARGS_PREFIX.length);K$(t,r,t.details[r].selectedItem,e,n,l,c),e.push(o_(a)),n[a]={sectionId:r,paramInfoId:null,componentIndices:s,isArgsObj:!1},o===Y.SECTION&&(e.push(o_(l)),n[l]={sectionId:r,paramInfoId:null,componentIndices:c,isArgsObj:!0})}function K$(t,e,n,r,i,s,o,a=!1){const c=t.details[e].codeInfoChildren[n].map(u=>t.codeInfo[u]);for(const u of c){if(!u.name||u.rcType!==Y.PARAMETER)continue;const f=a?u.name:`${s}["${u.name}"]`,h=[...o,f.length];K$(t,e,u.id,r,i,f,h),r.push(o_(f)),i[f]={sectionId:e,paramInfoId:u.id,componentIndices:h,isArgsObj:!1}}}function Vne(t={}){const{width:e,height:n,d3Zoom:r,d3Selection:i,fitViewOnInitDone:s,fitViewOnInit:o}=qe.getState(),{minZoom:a,maxZoom:l}=Nt.getState().gui,c=t.initial&&!s&&o;if(r&&i&&(c||!t.initial)){const f=Xm().filter(d=>{var p;return(p=t.nodes)!=null&&p.length?t.nodes.some(g=>g.id===d.id):!0}),h=f.every(d=>d.width&&d.height);if(f.length>0&&h){const d=d5(f),{x:p,y:g,zoom:m}=_ee(d,e,n,t.minZoom??a,t.maxZoom??l,t.padding??.1),v=ou.translate(p,g).scale(m);return typeof t.duration=="number"&&t.duration>0?r.transform(Id(i,t.duration),v):r.transform(i,v),!0}}return!1}function Une(){if(qe.getState().fitViewOnInit)return;const t=Nt.getState().gui.transitionDuration;Vne({duration:t}),setTimeout(()=>qe.setState({fitViewOnInit:!0}),t+10)}function J$(t){return!t.fitViewOnInit||t.fitViewOnInitDone}function Xm(t=null){return Array.from(t?t.x.values():mr.getState().x.values())}function eM(t){const e=Qd();for(const n of t)e.set(n.id,n);mr.setState({x:e})}function qne(t){const e=Qd();for(const n of t)e.delete(n);mr.setState({x:e})}function Xne(t){const{fitViewOnInit:e,fitViewOnInitDone:n,fitViewOnInitOptions:r,domNode:i}=qe.getState();if(!(i==null?void 0:i.querySelector(".react-flow__viewport")))return;const o=Qd();for(const c of t){const u=o.get(c.id);if(u){const f=cEe(c.nodeElement);!!(f.width&&f.height&&(u.width!==f.width||u.height!==f.height||c.forceUpdate))&&o.set(u.id,{...u,...f})}}mr.setState({x:o});const a=Ut.getState();if(a.numInitializedCodeAreas!==a.numDisplayedCodeAreas)return;const l=n||e&&!n&&Vne({initial:!0,...r});qe.setState({fitViewOnInitDone:l})}function Hne(t){const e=Qd();for(const n of t)e.get(n.id).position=n.position;mr.setState({x:e})}function VRe(t){const e=Qd();for(const[,n]of e)n.tempZIndex=n.zIndex;for(const n of t)e.get(n.id).tempZIndex=e.get(n.id).zIndex+1e3;mr.setState({x:e})}function URe(t,e){const n=Qd();n.get(t).position=e,mr.setState({x:n})}function Qd(){return ae.cloneDeep(mr.getState().x)}function Zne(t,e){if(e)return t.map(i=>({id:i.target.getAttribute("data-id"),nodeElement:i.target,forceUpdate:!0}));const n=[],r=ka.getState().withNested;return t.forEach(i=>{r[i]&&n.push({id:i,nodeElement:r[i],forceUpdate:!0})}),n}async function qRe(t,e,n){return await jt({body:{codeAreaReplacements:t,codeInfoReplacements:e,paramEVReplacements:n},address:Y.ROUTE_MAKE_EV_REF_TEMPLATE_VAR_REPLACEMENTS})}function XRe(){const t={},e={},n={},r=te.getState(),i=Tte();let s=!1,o=!1;for(const a of Object.keys(te.getState().variants))o=HRe(a,t,e,n,r,i),s||(s=o),o=ZRe(a,t,r),s||(s=o);return[t,e,n,s]}function HRe(t,e,n,r,i,s){let o,a,l=!1;const c=i.variants[t];for(const u of c.evRefs)o=Yne(e,t,i),a=$6(u,s,o),l||(l=a);if(c.selectedItem){const u=c.selectedItem;for(const f of i.codeInfo[u].evRefs)o=GRe(n,u,i),a=$6(f,s,o),l||(l=a)}for(const[u,f]of Object.entries(c.values))for(const h of f.evRefs)o=YRe(r,t,u,i),a=$6(h,s,o),l||(l=a);return l}function $6(t,e,n){const r=e[Pte(t)];return n.replacements.push({originalEVRef:t,newName:r}),t.keyword!==r}function ZRe(t,e,n){let r,i=!1;for(const s of n.variants[t].templateVars)if(r=Yne(e,t,n),s.sectionId){const o=Object.values(n.x).find(a=>a.id===s.sectionId);if(o){const a=cAe(s.keyword),l=`${o$(H$(o.id,n))}${a}`;r.replacements.push({originalTemplateVar:s,newName:l}),s.keyword!==l&&(i=!0)}}else r.replacements.push({originalTemplateVar:s,newName:s.keyword});return i}function tM(t){return{string:t,replacements:[]}}function YRe(t,e,n,r){return e in t||(t[e]={}),n in t[e]||(t[e][n]=tM(r.variants[e].values[n].value)),t[e][n]}function GRe(t,e,n){return e in t||(t[e]=tM(n.codeInfo[e].name)),t[e]}function Yne(t,e,n){return e in t||(t[e]=tM(n.variants[e].code)),t[e]}async function KRe(){const t=Nt.getState().backend.renameReferencesOnSectionMoveMode;if(t===G1.NEVER_RENAME)return;const[e,n,r,i]=XRe();i&&(t===G1.ALWAYS_ASK?ZPe(e,n,r):t===G1.ALWAYS_RENAME&&await Gne(e,n,r))}async function Gne(t,e,n){const r=await qRe(t,e,n);if(r.status===200){const{newCodeAreaValues:i,newCodeInfoValues:s,newParamEVValues:o}=r.data;te.setState(a=>{let l;for(const[c,u]of Object.entries(i))l=a.variants[c],l.code=u[0],l.evRefs=u[1],l.templateVars=u[2];for(const[c,u]of Object.entries(s))l=a.codeInfo[c],l.name=u[0],l.evRefs=u[1];for(const[c,u]of Object.entries(o))for(const[f,h]of Object.entries(u))l=a.variants[c].values[f],l.value=h[0],l.evRefs=h[1]})}}const nM=[Y.SECTION,Y.LIST_ROOT,Y.DICT_ROOT,Y.GROUP,Y.GLOBAL_VARIABLES,Y.CODE,Y.DRAW];function Kne(t,e){e.variants[t].runGroup={sections:{}};for(const n of mr.getState().x.keys())nM.includes(dn(n))&&W5(t,n,null,e)}function JRe(t,e){te.setState(n=>{const r=n.x[t].selectedVariantIds;e in r?delete r[e]:r[e]=!0})}function Jne(t,e,n){return{selected:!0,paramSweeps:{},versions:{[e??n.x[t].variantId]:!0}}}function W5(t,e,n,r,i=null){let s=!1;return e in r.variants[t].runGroup||(r.variants[t].runGroup[e]={},ere(t,i??r.x[e].variantId,r),s=!0),n in r.variants[t].runGroup[e]||(r.variants[t].runGroup[e][n]=Jne(e,i,r),s=!0),s}function ere(t,e,n){for(const r of n.variants[e].children)W5(t,r,e,n)}function e$e(t,e,n){for(const[r,i]of e.entries()){const s=r===0?null:e[r-1].variantId;W5(t,i.id,s,n);const o=n.variants[t].runGroup[i.id][s];o.versions[i.variantId]=!0,o.selected=!0}}function t$e(t,e,n){var r;for(const[i,s]of e.entries()){const o=i===0?null:e[i-1].variantId;if(!((r=n.variants[t].runGroup[s.id])!=null&&r[o].versions[s.variantId])||!tre(t,s.id,o,n))return!1}return!0}function tre(t,e,n,r){var i;return(i=r.variants[t].runGroup[e])==null?void 0:i[n].selected}function rM({runGroupId:t,ancestors:e,sectionId:n,attrName:r,attrId:i,parentVariantId:s}){te.setState(o=>{const a=W5(t,n,s,o,r==="versions"?i:null);let l;const c=o.variants[t].runGroup[n][s];if(!a&&t$e(t,e,o)&&(r==="selected"||tre(t,n,s,o))?l=i?!c[r][i]:!c[r]:l=!0,i?c[r][i]=l:c[r]=l,l&&(c.selected=!0,e$e(t,e,o),r==="selected"||r==="versions")){const u=r==="versions"?i:o.x[n].variantId;ere(t,u,o)}})}function n$e({id:t,ancestors:e,sectionId:n,parentVariantId:r}){rM({runGroupId:t,ancestors:e,sectionId:n,attrName:"selected",parentVariantId:r})}function r$e({id:t,paramSweepId:e,ancestors:n,sectionId:r,parentVariantId:i}){rM({runGroupId:t,ancestors:n,sectionId:r,attrName:"paramSweeps",attrId:e,parentVariantId:i})}function i$e({id:t,versionId:e,ancestors:n,sectionId:r,parentVariantId:i}){rM({runGroupId:t,ancestors:n,sectionId:r,attrName:"versions",attrId:e,parentVariantId:i})}function s$e(t){return te(e=>{const n=[];for(const r of e.variants[t].children)nM.includes(e.uiTypes[e.x[r].uiTypeId].type)&&n.push({id:r,name:e.x[r].name});return n},ae.isEqual)}function o$e(){return te(t=>{const e=[];for(const[n,r]of Object.entries(t.x))!r.parentId&&nM.includes(t.uiTypes[t.x[n].uiTypeId].type)&&e.push({id:n,name:r.name});return e},ae.isEqual)}function a$e(t,e){te.setState(n=>{const r=n.singletonSections[Y.GLOBAL_PARAM_SWEEP];if(r)for(const[i,s]of Object.entries(t)){if(!(i in e)||s===e[i])continue;const{variantIds:o}=n.x[r];for(const a of o){const l=n.variants[a].runGroup;if(!(i in l))continue;const c=s?n.x[s].variantIds:[null];for(const u of c)l[i][u]=Jne(i,void 0,n)}}})}function l$e(t){const e=[Y.SETTA_GENERATED_PYTHON,Y.SETTA_GENERATED_PYTHON_IMPORTS],n={};for(const a of e)n[a]=null;const r=te.getState();for(const[a,l]of Object.entries(t.templateVarEligibleSections)){const c=H$(a,r);for(const u of l){const f=c+`${Y.TEMPLATE_PREFIX}${u}`;e.push(o_(f)),n[f]=a}}const i=ae.mapKeys(n,(a,l)=>o$(l));if(e.length===0)return{pattern:Jp(),fullNameToSectionId:i};const s=`(?<![A-Za-z."'_])\\${Y.TEMPLATE_PREFIX}(${e.join("|")})(?![A-Za-z"'_])`;return{pattern:new RegExp(s,"g"),fullNameToSectionId:i}}function c$e(){te.subscribe(u$e,t=>{te.setState(e=>{e.singletonSections=t})},{equalityFn:ae.isEqual}),te.subscribe(f$e,t=>{Dd.setState(WRe(t)),O5.setState(l$e(t)),te.getState().shouldRenameReferences&&(te.setState({shouldRenameReferences:!1}),KRe())},{equalityFn:ae.isEqual}),te.subscribe(G$,t=>{qf.getState().update(t)},{equalityFn:ae.isEqual}),te.subscribe(DRe,(t,e)=>{a$e(t,e)},{equalityFn:ae.isEqual}),qe.subscribe(h$e,(t,e)=>{e.fitViewOnInit&&e.fitViewOnInitDone&&t.fitViewOnInit&&t.fitViewOnInitDone&&qe.setState({fitViewOnInit:!1}),window.reactFlowZoom=t.transform[2]},{equalityFn:ae.isEqual}),Ut.subscribe(d$e,t=>{t&&(Xne(Zne(mr.getState().x.keys(),!1)),Ut.setState({requestUpdateNodeDimensions:!1}))},{equalityFn:ae.isEqual}),Ut.subscribe(t=>t.undoOrRedoWasTriggered,t=>{t&&Ut.setState(e=>({updateDrawAreas:e.updateDrawAreas+1,undoOrRedoWasTriggered:!1}))}),ti.subscribe(p$e,t=>{ti.setState(()=>{const e={};for(const[n,r]of Object.entries(t))e[_$(r)]=n;return{namePathTypeToId:e}})},{equalityFn:ae.isEqual})}function u$e(t){var n;const e={[Y.GLOBAL_VARIABLES]:null,[Y.GLOBAL_PARAM_SWEEP]:null,inMemoryFnStdoutTerminal:null};for(const r of Object.values(t.x)){const i=(n=t.uiTypes[r.uiTypeId])==null?void 0:n.type;if(e[Y.GLOBAL_VARIABLES]&&e[Y.GLOBAL_PARAM_SWEEP]&&e.inMemoryFnStdoutTerminal&&e.temporaryTerminalGroup)break;!e[Y.GLOBAL_VARIABLES]&&i===Y.GLOBAL_VARIABLES&&(e[Y.GLOBAL_VARIABLES]=r.id),!e[Y.GLOBAL_PARAM_SWEEP]&&i===Y.GLOBAL_PARAM_SWEEP&&(e[Y.GLOBAL_PARAM_SWEEP]=r.id),!e.inMemoryFnStdoutTerminal&&i===Y.TERMINAL&&r.isReadOnlyTerminal&&(e.inMemoryFnStdoutTerminal=r.id),!e.temporaryTerminalGroup&&i===Y.GROUP&&r.isTemporary&&(e.temporaryTerminalGroup=r.id)}return e}function f$e(t){const e={details:{},codeInfo:ae.mapValues(t.codeInfo,i=>({id:i.id,name:i.name,rcType:i.rcType})),globalVariableId:t.singletonSections[Y.GLOBAL_VARIABLES],templateVarEligibleSections:{}};let n,r;for(const[i,s]of Object.entries(t.x))n=Yt(i,t),r=dn(i,t),e.details[i]={name:s.name,sectionChildren:n.children,codeInfoChildren:Jo(i,t).children,sectionTypeName:r,selectedItem:n.selectedItem,isTopLevelAndCanHaveEVRefs:!s.parentId&&[Y.GLOBAL_VARIABLES,Y.SECTION,Y.LIST_ROOT,Y.DICT_ROOT,Y.GROUP].includes(r)},r===Y.CODE?e.templateVarEligibleSections[i]=[Y.TEMPLATE_VAR_VERSION_SUFFIX,Y.TEMPLATE_VAR_IMPORT_PATH_SUFFIX,Y.TEMPLATE_VAR_FILE_PATH_SUFFIX]:e.templateVarEligibleSections[i]=[Y.TEMPLATE_VAR_VERSION_SUFFIX];return e}function h$e(t){return{transform:t.transform,fitViewOnInit:t.fitViewOnInit,fitViewOnInitDone:t.fitViewOnInitDone}}function d$e(t){return t.undoOrRedoWasTriggered||t.requestUpdateNodeDimensions}function p$e(t){const e={};for(const[n,r]of Object.entries(t.x))e[n]={name:r.name,path:r.path,type:r.type};return e}function Ee(){return Ee=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Ee.apply(this,arguments)}function gt(t,e,{checkForDefaultPrevented:n=!0}={}){return function(i){if(t==null||t(i),n===!1||!i.defaultPrevented)return e==null?void 0:e(i)}}function m$e(t,e){typeof t=="function"?t(e):t!=null&&(t.current=e)}function nre(...t){return e=>t.forEach(n=>m$e(n,e))}function In(...t){return _.useCallback(nre(...t),t)}function Oo(t,e=[]){let n=[];function r(s,o){const a=_.createContext(o),l=n.length;n=[...n,o];function c(f){const{scope:h,children:d,...p}=f,g=(h==null?void 0:h[t][l])||a,m=_.useMemo(()=>p,Object.values(p));return _.createElement(g.Provider,{value:m},d)}function u(f,h){const d=(h==null?void 0:h[t][l])||a,p=_.useContext(d);if(p)return p;if(o!==void 0)return o;throw new Error(`\`${f}\` must be used within \`${s}\``)}return c.displayName=s+"Provider",[c,u]}const i=()=>{const s=n.map(o=>_.createContext(o));return function(a){const l=(a==null?void 0:a[t])||s;return _.useMemo(()=>({[`__scope${t}`]:{...a,[t]:l}}),[a,l])}};return i.scopeName=t,[r,g$e(i,...e)]}function g$e(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(s){const o=r.reduce((a,{useScope:l,scopeName:c})=>{const f=l(s)[`__scope${c}`];return{...a,...f}},{});return _.useMemo(()=>({[`__scope${e.scopeName}`]:o}),[o])}};return n.scopeName=e.scopeName,n}function $a(t){const e=_.useRef(t);return _.useEffect(()=>{e.current=t}),_.useMemo(()=>(...n)=>{var r;return(r=e.current)===null||r===void 0?void 0:r.call(e,...n)},[])}function Nl({prop:t,defaultProp:e,onChange:n=()=>{}}){const[r,i]=v$e({defaultProp:e,onChange:n}),s=t!==void 0,o=s?t:r,a=$a(n),l=_.useCallback(c=>{if(s){const f=typeof c=="function"?c(t):c;f!==t&&a(f)}else i(c)},[s,t,i,a]);return[o,l]}function v$e({defaultProp:t,onChange:e}){const n=_.useState(t),[r]=n,i=_.useRef(r),s=$a(e);return _.useEffect(()=>{i.current!==r&&(s(r),i.current=r)},[r,i,s]),n}function iM(t){const e=_.useRef({value:t,previous:t});return _.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}const Pc=globalThis!=null&&globalThis.document?_.useLayoutEffect:()=>{};function V5(t){const[e,n]=_.useState(void 0);return Pc(()=>{if(t){n({width:t.offsetWidth,height:t.offsetHeight});const r=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const s=i[0];let o,a;if("borderBoxSize"in s){const l=s.borderBoxSize,c=Array.isArray(l)?l[0]:l;o=c.inlineSize,a=c.blockSize}else o=t.offsetWidth,a=t.offsetHeight;n({width:o,height:a})});return r.observe(t,{box:"border-box"}),()=>r.unobserve(t)}else n(void 0)},[t]),e}const am=_.forwardRef((t,e)=>{const{children:n,...r}=t,i=_.Children.toArray(n),s=i.find(y$e);if(s){const o=s.props.children,a=i.map(l=>l===s?_.Children.count(o)>1?_.Children.only(null):_.isValidElement(o)?o.props.children:null:l);return _.createElement(DT,Ee({},r,{ref:e}),_.isValidElement(o)?_.cloneElement(o,void 0,a):null)}return _.createElement(DT,Ee({},r,{ref:e}),n)});am.displayName="Slot";const DT=_.forwardRef((t,e)=>{const{children:n,...r}=t;return _.isValidElement(n)?_.cloneElement(n,{...b$e(r,n.props),ref:nre(e,n.ref)}):_.Children.count(n)>1?_.Children.only(null):null});DT.displayName="SlotClone";const O$e=({children:t})=>_.createElement(_.Fragment,null,t);function y$e(t){return _.isValidElement(t)&&t.type===O$e}function b$e(t,e){const n={...e};for(const r in e){const i=t[r],s=e[r];/^on[A-Z]/.test(r)?i&&s?n[r]=(...a)=>{s(...a),i(...a)}:i&&(n[r]=i):r==="style"?n[r]={...i,...s}:r==="className"&&(n[r]=[i,s].filter(Boolean).join(" "))}return{...t,...n}}const x$e=["a","button","div","h2","h3","img","label","li","nav","ol","p","span","svg","ul"],gn=x$e.reduce((t,e)=>{const n=_.forwardRef((r,i)=>{const{asChild:s,...o}=r,a=s?am:e;return _.useEffect(()=>{window[Symbol.for("radix-ui")]=!0},[]),_.createElement(a,Ee({},o,{ref:i}))});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});function rre(t,e){t&&Qi.flushSync(()=>t.dispatchEvent(e))}const ire="Switch",[w$e,iEt]=Oo(ire),[S$e,_$e]=w$e(ire),k$e=_.forwardRef((t,e)=>{const{__scopeSwitch:n,name:r,checked:i,defaultChecked:s,required:o,disabled:a,value:l="on",onCheckedChange:c,...u}=t,[f,h]=_.useState(null),d=In(e,y=>h(y)),p=_.useRef(!1),g=f?!!f.closest("form"):!0,[m=!1,v]=Nl({prop:i,defaultProp:s,onChange:c});return _.createElement(S$e,{scope:n,checked:m,disabled:a},_.createElement(gn.button,Ee({type:"button",role:"switch","aria-checked":m,"aria-required":o,"data-state":sre(m),"data-disabled":a?"":void 0,disabled:a,value:l},u,{ref:d,onClick:gt(t.onClick,y=>{v(b=>!b),g&&(p.current=y.isPropagationStopped(),p.current||y.stopPropagation())})})),g&&_.createElement(T$e,{control:f,bubbles:!p.current,name:r,value:l,checked:m,required:o,disabled:a,style:{transform:"translateX(-100%)"}}))}),C$e="SwitchThumb",E$e=_.forwardRef((t,e)=>{const{__scopeSwitch:n,...r}=t,i=_$e(C$e,n);return _.createElement(gn.span,Ee({"data-state":sre(i.checked),"data-disabled":i.disabled?"":void 0},r,{ref:e}))}),T$e=t=>{const{control:e,checked:n,bubbles:r=!0,...i}=t,s=_.useRef(null),o=iM(n),a=V5(e);return _.useEffect(()=>{const l=s.current,c=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(c,"checked").set;if(o!==n&&f){const h=new Event("click",{bubbles:r});f.call(l,n),l.dispatchEvent(h)}},[o,n,r]),_.createElement("input",Ee({type:"checkbox","aria-hidden":!0,defaultChecked:n},i,{tabIndex:-1,ref:s,style:{...t.style,...a,position:"absolute",pointerEvents:"none",opacity:0,margin:0}}))};function sre(t){return t?"checked":"unchecked"}const P$e=k$e,A$e=E$e;function sM(t){const{twRootClasses:e="",twThumbClasses:n="",icon:r,disableBg:i=!1,height:s,width:o,children:a,...l}=t,c=`items-center p-[0.2rem] w-7 min-w-7 ${s||"h-2.5"} bg-setta-400 dark:bg-setta-600 rounded-full relative inline-flex cursor-pointer [-webkit-tap-highlight-color:rgba(0,_0,_0,_0)] focus-visible:shadow-black data-[state='checked']:bg-blue-500 dark:data-[state='checked']:bg-blue-700 focus-visible:ring-2 ${e} disabled:pointer-events-none`,u=`block ${o||"w-2.5"} ${s||"h-2.5"} ${!i&&"bg-white dark:bg-setta-800"} rounded-full transition-all will-change-transform data-[state='checked']:translate-x-4 ${n}`;return x.jsx(P$e,{className:c,...l,children:x.jsx(A$e,{className:u,children:r})})}var ore={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},xF=ke.createContext&&ke.createContext(ore),R$e=["attr","size","title"];function $$e(t,e){if(t==null)return{};var n=M$e(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function M$e(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function g_(){return g_=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},g_.apply(this,arguments)}function wF(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function v_(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?wF(Object(n),!0).forEach(function(r){I$e(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):wF(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function I$e(t,e,n){return e=D$e(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function D$e(t){var e=L$e(t,"string");return typeof e=="symbol"?e:e+""}function L$e(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function are(t){return t&&t.map((e,n)=>ke.createElement(e.tag,v_({key:n},e.attr),are(e.child)))}function ft(t){return e=>ke.createElement(N$e,g_({attr:v_({},t.attr)},e),are(t.child))}function N$e(t){var e=n=>{var{attr:r,size:i,title:s}=t,o=$$e(t,R$e),a=i||n.size||"1em",l;return n.className&&(l=n.className),t.className&&(l=(l?l+" ":"")+t.className),ke.createElement("svg",g_({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},n.attr,r,o,{className:l,style:v_(v_({color:t.color||n.color},n.style),t.style),height:a,width:a,xmlns:"http://www.w3.org/2000/svg"}),s&&ke.createElement("title",null,s),t.children)};return xF!==void 0?ke.createElement(xF.Consumer,null,n=>e(n)):e(ore)}function Q$e(t){return ft({tag:"svg",attr:{viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true"},child:[{tag:"path",attr:{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"},child:[]}]})(t)}function lre(t){return ft({tag:"svg",attr:{viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true"},child:[{tag:"path",attr:{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"},child:[]}]})(t)}function oM(t){return ft({tag:"svg",attr:{viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true"},child:[{tag:"path",attr:{d:"M10.707 2.293a1 1 0 00-1.414 0l-7 7a1 1 0 001.414 1.414L4 10.414V17a1 1 0 001 1h2a1 1 0 001-1v-2a1 1 0 011-1h2a1 1 0 011 1v2a1 1 0 001 1h2a1 1 0 001-1v-6.586l.293.293a1 1 0 001.414-1.414l-7-7z"},child:[]}]})(t)}function j$e(t){return ft({tag:"svg",attr:{viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true"},child:[{tag:"path",attr:{d:"M17.293 13.293A8 8 0 016.707 2.707a8.001 8.001 0 1010.586 10.586z"},child:[]}]})(t)}function B$e(t){return ft({tag:"svg",attr:{viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true"},child:[{tag:"path",attr:{fillRule:"evenodd",d:"M10 3a1 1 0 011 1v5h5a1 1 0 110 2h-5v5a1 1 0 11-2 0v-5H4a1 1 0 110-2h5V4a1 1 0 011-1z",clipRule:"evenodd"},child:[]}]})(t)}function U5(t){return ft({tag:"svg",attr:{fill:"none",viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor","aria-hidden":"true"},child:[{tag:"path",attr:{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"},child:[]}]})(t)}function z$e(t){return ft({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M2.04932 12.9999H7.52725C7.70624 16.2688 8.7574 19.3053 10.452 21.8809C5.98761 21.1871 2.5001 17.5402 2.04932 12.9999ZM2.04932 10.9999C2.5001 6.45968 5.98761 2.81276 10.452 2.11902C8.7574 4.69456 7.70624 7.73111 7.52725 10.9999H2.04932ZM21.9506 10.9999H16.4726C16.2936 7.73111 15.2425 4.69456 13.5479 2.11902C18.0123 2.81276 21.4998 6.45968 21.9506 10.9999ZM21.9506 12.9999C21.4998 17.5402 18.0123 21.1871 13.5479 21.8809C15.2425 19.3053 16.2936 16.2688 16.4726 12.9999H21.9506ZM9.53068 12.9999H14.4692C14.2976 15.7828 13.4146 18.3732 11.9999 20.5915C10.5852 18.3732 9.70229 15.7828 9.53068 12.9999ZM9.53068 10.9999C9.70229 8.21709 10.5852 5.62672 11.9999 3.40841C13.4146 5.62672 14.2976 8.21709 14.4692 10.9999H9.53068Z"},child:[]}]})(t)}function F$e(t){return ft({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M14 6H16V8H21C21.5523 8 22 8.44772 22 9V16.5L16 13L16.0359 21.0622L18.2592 18.9129L20.041 22H9C8.44772 22 8 21.5523 8 21V16H6V14H8V9C8 8.44772 8.44772 8 9 8H14V6ZM22 17.338V21C22 21.107 21.9832 21.2101 21.9521 21.3068L19.9913 17.9129L22 17.338ZM4 14V16H2V14H4ZM4 10V12H2V10H4ZM4 6V8H2V6H4ZM4 2V4H2V2H4ZM8 2V4H6V2H8ZM12 2V4H10V2H12ZM16 2V4H14V2H16Z"},child:[]}]})(t)}function cre(t){return ft({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M7.75194 5.43872L18.2596 11.5682C18.4981 11.7073 18.5787 12.0135 18.4396 12.252C18.3961 12.3265 18.3341 12.3885 18.2596 12.432L7.75194 18.5615C7.51341 18.7006 7.20725 18.62 7.06811 18.3815C7.0235 18.305 7 18.2181 7 18.1296V5.87061C7 5.59446 7.22386 5.37061 7.5 5.37061C7.58853 5.37061 7.67547 5.39411 7.75194 5.43872Z"},child:[]}]})(t)}function W$e(t){return ft({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M12 18C8.68629 18 6 15.3137 6 12C6 8.68629 8.68629 6 12 6C15.3137 6 18 8.68629 18 12C18 15.3137 15.3137 18 12 18ZM11 1H13V4H11V1ZM11 20H13V23H11V20ZM3.51472 4.92893L4.92893 3.51472L7.05025 5.63604L5.63604 7.05025L3.51472 4.92893ZM16.9497 18.364L18.364 16.9497L20.4853 19.0711L19.0711 20.4853L16.9497 18.364ZM19.0711 3.51472L20.4853 4.92893L18.364 7.05025L16.9497 5.63604L19.0711 3.51472ZM5.63604 16.9497L7.05025 18.364L4.92893 20.4853L3.51472 19.0711L5.63604 16.9497ZM23 11V13H20V11H23ZM4 11V13H1V11H4Z"},child:[]}]})(t)}function q5(t){const[e,n]=t;n(!e)}function V$e(){q5(Ot.darkMode.state())}function U$e(){q5(Ot.showMinimap.state())}function q$e(){q5(Ot.projectConfigPreviewEnabled.state())}function X$e(){q5(Ot.snapToGrid.state())}function H$e(){const[t,e]=Ot.showNavBarHelpMessage.hook(),n=Nt(r=>Br(r.shortcuts.showTooltipShortcut));return t&&x.jsx("aside",{className:"ml-auto mr-4 flex items-center gap-2",children:x.jsxs("div",{className:"hidden items-center gap-2 lg:flex",children:[x.jsxs("p",{className:"text-xs font-bold text-setta-400 dark:text-setta-500",children:['Hold down "',n,'" to see tool tips']}),x.jsx("button",{className:"flex cursor-pointer items-center text-setta-300 hover:text-setta-700 dark:text-setta-500 dark:hover:text-setta-400",onClick:()=>e(!1),children:x.jsx("i",{className:"gg-close"})})]})})}function Z$e(){const t=Y$e();return x.jsxs("div",{className:"flex flex-1 items-center justify-end",children:[x.jsx(H$e,{}),x.jsx(sM,{checked:t,onCheckedChange:V$e,twThumbClasses:"flex",disableBg:!0,height:"h-3",width:"w-3",icon:t?x.jsx(j$e,{className:"h-3 text-blue-200"}):x.jsx(W$e,{className:"h-3 text-white"})})]})}function Y$e(){const[t]=Ot.darkMode.hook();return _.useEffect(()=>{t?document.querySelector("html").classList.add("dark"):document.querySelector("html").classList.remove("dark")},[t]),t}function G$e(t){return ft({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{fillRule:"evenodd",clipRule:"evenodd",d:"M11.105 4.561l-3.43 3.427-1.134-1.12 2.07-2.08h-4.8a2.4 2.4 0 1 0 0 4.8h.89v1.6h-.88a4 4 0 0 1 0-7.991h4.8L6.54 1.13 7.675 0l3.43 3.432v1.13zM16.62 24h-9.6l-.8-.8V10.412l.8-.8h9.6l.8.8V23.2l-.8.8zm-8.8-1.6h8V11.212h-8V22.4zm5.6-20.798h9.6l.8.8v12.786l-.8.8h-4v-1.6h3.2V3.2h-8v4.787h-1.6V2.401l.8-.8zm.8 11.186h-4.8v1.6h4.8v-1.6zm-4.8 3.2h4.8v1.6h-4.8v-1.6zm4.8 3.2h-4.8v1.6h4.8v-1.6zm1.6-14.4h4.8v1.6h-4.8v-1.6zm4.8 6.4h-1.6v1.6h1.6v-1.6zm-3.338-3.176v-.024h3.338v1.6h-1.762l-1.576-1.576z"},child:[]}]})(t)}function SF(t){return ft({tag:"svg",attr:{viewBox:"0 0 16 16",fill:"currentColor"},child:[{tag:"path",attr:{fillRule:"evenodd",clipRule:"evenodd",d:"M11.04 1.33L12.71 3l.29.71v.33h-.5l-.5.5v-.83l-1.67-1.67H10v4H4v-4H2v10h3l-.5 1H2l-1-1v-10l1-1h8.33l.71.29zM7 5h2V2H7v3zm6.5 0L15 6.5l-.02.69-5.5 5.5-.13.12-.37.37-.1.09-3 1.5-.67-.67 1.5-3 .09-.1.37-.37.12-.13 5.5-5.5h.71zm-6.22 7.24l-.52 1 1.04-.48-.52-.52zm.69-1.03l.79.79 5.15-5.15-.79-.79-5.15 5.15z"},child:[]}]})(t)}function ure(t){return ft({tag:"svg",attr:{viewBox:"0 0 16 16",fill:"currentColor"},child:[{tag:"path",attr:{fillRule:"evenodd",clipRule:"evenodd",d:"M13.353 1.146l1.5 1.5L15 3v11.5l-.5.5h-13l-.5-.5v-13l.5-.5H13l.353.146zM2 2v12h12V3.208L12.793 2H11v4H4V2H2zm6 0v3h2V2H8z"},child:[]}]})(t)}function K$e(){const t=mT(e=>e.message);return t&&x.jsxs(x.Fragment,{children:[x.jsx(ure,{className:"ml-4 h-3 w-3 text-setta-400 dark:text-setta-50"}),x.jsx("p",{className:"ml-2 self-center text-xs text-setta-500 dark:text-setta-100",children:t})]})}function Hm(t){const e=t+"CollectionProvider",[n,r]=Oo(e),[i,s]=n(e,{collectionRef:{current:null},itemMap:new Map}),o=d=>{const{scope:p,children:g}=d,m=ke.useRef(null),v=ke.useRef(new Map).current;return ke.createElement(i,{scope:p,itemMap:v,collectionRef:m},g)},a=t+"CollectionSlot",l=ke.forwardRef((d,p)=>{const{scope:g,children:m}=d,v=s(a,g),y=In(p,v.collectionRef);return ke.createElement(am,{ref:y},m)}),c=t+"CollectionItemSlot",u="data-radix-collection-item",f=ke.forwardRef((d,p)=>{const{scope:g,children:m,...v}=d,y=ke.useRef(null),b=In(p,y),S=s(c,g);return ke.useEffect(()=>(S.itemMap.set(y,{ref:y,...v}),()=>void S.itemMap.delete(y))),ke.createElement(am,{[u]:"",ref:b},m)});function h(d){const p=s(t+"CollectionConsumer",d);return ke.useCallback(()=>{const m=p.collectionRef.current;if(!m)return[];const v=Array.from(m.querySelectorAll(`[${u}]`));return Array.from(p.itemMap.values()).sort((S,k)=>v.indexOf(S.ref.current)-v.indexOf(k.ref.current))},[p.collectionRef,p.itemMap])}return[{Provider:o,Slot:l,ItemSlot:f},h,r]}const J$e=_.createContext(void 0);function jd(t){const e=_.useContext(J$e);return t||e||"ltr"}const eMe=Dp["useId".toString()]||(()=>{});let tMe=0;function ff(t){const[e,n]=_.useState(eMe());return Pc(()=>{t||n(r=>r??String(tMe++))},[t]),t||(e?`radix-${e}`:"")}function nMe(t,e=globalThis==null?void 0:globalThis.document){const n=$a(t);_.useEffect(()=>{const r=i=>{i.key==="Escape"&&n(i)};return e.addEventListener("keydown",r),()=>e.removeEventListener("keydown",r)},[n,e])}const LT="dismissableLayer.update",rMe="dismissableLayer.pointerDownOutside",iMe="dismissableLayer.focusOutside";let _F;const sMe=_.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),fre=_.forwardRef((t,e)=>{var n;const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:i,onPointerDownOutside:s,onFocusOutside:o,onInteractOutside:a,onDismiss:l,...c}=t,u=_.useContext(sMe),[f,h]=_.useState(null),d=(n=f==null?void 0:f.ownerDocument)!==null&&n!==void 0?n:globalThis==null?void 0:globalThis.document,[,p]=_.useState({}),g=In(e,C=>h(C)),m=Array.from(u.layers),[v]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),y=m.indexOf(v),b=f?m.indexOf(f):-1,S=u.layersWithOutsidePointerEventsDisabled.size>0,k=b>=y,E=oMe(C=>{const A=C.target,R=[...u.branches].some(Q=>Q.contains(A));!k||R||(s==null||s(C),a==null||a(C),C.defaultPrevented||l==null||l())},d),T=aMe(C=>{const A=C.target;[...u.branches].some(Q=>Q.contains(A))||(o==null||o(C),a==null||a(C),C.defaultPrevented||l==null||l())},d);return nMe(C=>{b===u.layers.size-1&&(i==null||i(C),!C.defaultPrevented&&l&&(C.preventDefault(),l()))},d),_.useEffect(()=>{if(f)return r&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(_F=d.body.style.pointerEvents,d.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(f)),u.layers.add(f),kF(),()=>{r&&u.layersWithOutsidePointerEventsDisabled.size===1&&(d.body.style.pointerEvents=_F)}},[f,d,r,u]),_.useEffect(()=>()=>{f&&(u.layers.delete(f),u.layersWithOutsidePointerEventsDisabled.delete(f),kF())},[f,u]),_.useEffect(()=>{const C=()=>p({});return document.addEventListener(LT,C),()=>document.removeEventListener(LT,C)},[]),_.createElement(gn.div,Ee({},c,{ref:g,style:{pointerEvents:S?k?"auto":"none":void 0,...t.style},onFocusCapture:gt(t.onFocusCapture,T.onFocusCapture),onBlurCapture:gt(t.onBlurCapture,T.onBlurCapture),onPointerDownCapture:gt(t.onPointerDownCapture,E.onPointerDownCapture)}))});function oMe(t,e=globalThis==null?void 0:globalThis.document){const n=$a(t),r=_.useRef(!1),i=_.useRef(()=>{});return _.useEffect(()=>{const s=a=>{if(a.target&&!r.current){let u=function(){hre(rMe,n,c,{discrete:!0})};var l=u;const c={originalEvent:a};a.pointerType==="touch"?(e.removeEventListener("click",i.current),i.current=u,e.addEventListener("click",i.current,{once:!0})):u()}r.current=!1},o=window.setTimeout(()=>{e.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(o),e.removeEventListener("pointerdown",s),e.removeEventListener("click",i.current)}},[e,n]),{onPointerDownCapture:()=>r.current=!0}}function aMe(t,e=globalThis==null?void 0:globalThis.document){const n=$a(t),r=_.useRef(!1);return _.useEffect(()=>{const i=s=>{s.target&&!r.current&&hre(iMe,n,{originalEvent:s},{discrete:!1})};return e.addEventListener("focusin",i),()=>e.removeEventListener("focusin",i)},[e,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function kF(){const t=new CustomEvent(LT);document.dispatchEvent(t)}function hre(t,e,n,{discrete:r}){const i=n.originalEvent.target,s=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:n});e&&i.addEventListener(t,e,{once:!0}),r?rre(i,s):i.dispatchEvent(s)}let M6=0;function dre(){_.useEffect(()=>{var t,e;const n=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",(t=n[0])!==null&&t!==void 0?t:CF()),document.body.insertAdjacentElement("beforeend",(e=n[1])!==null&&e!==void 0?e:CF()),M6++,()=>{M6===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(r=>r.remove()),M6--}},[])}function CF(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.cssText="outline: none; opacity: 0; position: fixed; pointer-events: none",t}const I6="focusScope.autoFocusOnMount",D6="focusScope.autoFocusOnUnmount",EF={bubbles:!1,cancelable:!0},pre=_.forwardRef((t,e)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:s,...o}=t,[a,l]=_.useState(null),c=$a(i),u=$a(s),f=_.useRef(null),h=In(e,g=>l(g)),d=_.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;_.useEffect(()=>{if(r){let v=function(b){if(d.paused||!a)return;const S=b.target;a.contains(S)?f.current=S:Eh(f.current,{select:!0})},y=function(b){d.paused||!a||a.contains(b.relatedTarget)||Eh(f.current,{select:!0})};var g=v,m=y;return document.addEventListener("focusin",v),document.addEventListener("focusout",y),()=>{document.removeEventListener("focusin",v),document.removeEventListener("focusout",y)}}},[r,a,d.paused]),_.useEffect(()=>{if(a){PF.add(d);const g=document.activeElement;if(!a.contains(g)){const v=new CustomEvent(I6,EF);a.addEventListener(I6,c),a.dispatchEvent(v),v.defaultPrevented||(lMe(dMe(mre(a)),{select:!0}),document.activeElement===g&&Eh(a))}return()=>{a.removeEventListener(I6,c),setTimeout(()=>{const v=new CustomEvent(D6,EF);a.addEventListener(D6,u),a.dispatchEvent(v),v.defaultPrevented||Eh(g??document.body,{select:!0}),a.removeEventListener(D6,u),PF.remove(d)},0)}}},[a,c,u,d]);const p=_.useCallback(g=>{if(!n&&!r||d.paused)return;const m=g.key==="Tab"&&!g.altKey&&!g.ctrlKey&&!g.metaKey,v=document.activeElement;if(m&&v){const y=g.currentTarget,[b,S]=cMe(y);b&&S?!g.shiftKey&&v===S?(g.preventDefault(),n&&Eh(b,{select:!0})):g.shiftKey&&v===b&&(g.preventDefault(),n&&Eh(S,{select:!0})):v===y&&g.preventDefault()}},[n,r,d.paused]);return _.createElement(gn.div,Ee({tabIndex:-1},o,{ref:h,onKeyDown:p}))});function lMe(t,{select:e=!1}={}){const n=document.activeElement;for(const r of t)if(Eh(r,{select:e}),document.activeElement!==n)return}function cMe(t){const e=mre(t),n=TF(e,t),r=TF(e.reverse(),t);return[n,r]}function mre(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const i=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||i?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)e.push(n.currentNode);return e}function TF(t,e){for(const n of t)if(!uMe(n,{upTo:e}))return n}function uMe(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function fMe(t){return t instanceof HTMLInputElement&&"select"in t}function Eh(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&fMe(t)&&e&&t.select()}}const PF=hMe();function hMe(){let t=[];return{add(e){const n=t[0];e!==n&&(n==null||n.pause()),t=AF(t,e),t.unshift(e)},remove(e){var n;t=AF(t,e),(n=t[0])===null||n===void 0||n.resume()}}}function AF(t,e){const n=[...t],r=n.indexOf(e);return r!==-1&&n.splice(r,1),n}function dMe(t){return t.filter(e=>e.tagName!=="A")}function Bd(t){return t.split("-")[0]}function My(t){return t.split("-")[1]}function Zm(t){return["top","bottom"].includes(Bd(t))?"x":"y"}function aM(t){return t==="y"?"height":"width"}function RF(t,e,n){let{reference:r,floating:i}=t;const s=r.x+r.width/2-i.width/2,o=r.y+r.height/2-i.height/2,a=Zm(e),l=aM(a),c=r[l]/2-i[l]/2,u=a==="x";let f;switch(Bd(e)){case"top":f={x:s,y:r.y-i.height};break;case"bottom":f={x:s,y:r.y+r.height};break;case"right":f={x:r.x+r.width,y:o};break;case"left":f={x:r.x-i.width,y:o};break;default:f={x:r.x,y:r.y}}switch(My(e)){case"start":f[a]-=c*(n&&u?-1:1);break;case"end":f[a]+=c*(n&&u?-1:1)}return f}const pMe=async(t,e,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:s=[],platform:o}=n,a=await(o.isRTL==null?void 0:o.isRTL(e));let l=await o.getElementRects({reference:t,floating:e,strategy:i}),{x:c,y:u}=RF(l,r,a),f=r,h={},d=0;for(let p=0;p<s.length;p++){const{name:g,fn:m}=s[p],{x:v,y,data:b,reset:S}=await m({x:c,y:u,initialPlacement:r,placement:f,strategy:i,middlewareData:h,rects:l,platform:o,elements:{reference:t,floating:e}});c=v??c,u=y??u,h={...h,[g]:{...h[g],...b}},S&&d<=50&&(d++,typeof S=="object"&&(S.placement&&(f=S.placement),S.rects&&(l=S.rects===!0?await o.getElementRects({reference:t,floating:e,strategy:i}):S.rects),{x:c,y:u}=RF(l,f,a)),p=-1)}return{x:c,y:u,placement:f,strategy:i,middlewareData:h}};function gre(t){return typeof t!="number"?function(e){return{top:0,right:0,bottom:0,left:0,...e}}(t):{top:t,right:t,bottom:t,left:t}}function O_(t){return{...t,top:t.y,left:t.x,right:t.x+t.width,bottom:t.y+t.height}}async function aO(t,e){var n;e===void 0&&(e={});const{x:r,y:i,platform:s,rects:o,elements:a,strategy:l}=t,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:f="floating",altBoundary:h=!1,padding:d=0}=e,p=gre(d),g=a[h?f==="floating"?"reference":"floating":f],m=O_(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(g)))==null||n?g:g.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(a.floating)),boundary:c,rootBoundary:u,strategy:l})),v=O_(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({rect:f==="floating"?{...o.floating,x:r,y:i}:o.reference,offsetParent:await(s.getOffsetParent==null?void 0:s.getOffsetParent(a.floating)),strategy:l}):o[f]);return{top:m.top-v.top+p.top,bottom:v.bottom-m.bottom+p.bottom,left:m.left-v.left+p.left,right:v.right-m.right+p.right}}const mMe=Math.min,Th=Math.max;function NT(t,e,n){return Th(t,mMe(e,n))}const $F=t=>({name:"arrow",options:t,async fn(e){const{element:n,padding:r=0}=t??{},{x:i,y:s,placement:o,rects:a,platform:l}=e;if(n==null)return{};const c=gre(r),u={x:i,y:s},f=Zm(o),h=My(o),d=aM(f),p=await l.getDimensions(n),g=f==="y"?"top":"left",m=f==="y"?"bottom":"right",v=a.reference[d]+a.reference[f]-u[f]-a.floating[d],y=u[f]-a.reference[f],b=await(l.getOffsetParent==null?void 0:l.getOffsetParent(n));let S=b?f==="y"?b.clientHeight||0:b.clientWidth||0:0;S===0&&(S=a.floating[d]);const k=v/2-y/2,E=c[g],T=S-p[d]-c[m],C=S/2-p[d]/2+k,A=NT(E,C,T),R=(h==="start"?c[g]:c[m])>0&&C!==A&&a.reference[d]<=a.floating[d];return{[f]:u[f]-(R?C<E?E-C:T-C:0),data:{[f]:A,centerOffset:C-A}}}}),gMe={left:"right",right:"left",bottom:"top",top:"bottom"};function y_(t){return t.replace(/left|right|bottom|top/g,e=>gMe[e])}function vMe(t,e,n){n===void 0&&(n=!1);const r=My(t),i=Zm(t),s=aM(i);let o=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(o=y_(o)),{main:o,cross:y_(o)}}const OMe={start:"end",end:"start"};function MF(t){return t.replace(/start|end/g,e=>OMe[e])}const vre=["top","right","bottom","left"];vre.reduce((t,e)=>t.concat(e,e+"-start",e+"-end"),[]);const yMe=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n;const{placement:r,middlewareData:i,rects:s,initialPlacement:o,platform:a,elements:l}=e,{mainAxis:c=!0,crossAxis:u=!0,fallbackPlacements:f,fallbackStrategy:h="bestFit",flipAlignment:d=!0,...p}=t,g=Bd(r),m=f||(g===o||!d?[y_(o)]:function(C){const A=y_(C);return[MF(C),A,MF(A)]}(o)),v=[o,...m],y=await aO(e,p),b=[];let S=((n=i.flip)==null?void 0:n.overflows)||[];if(c&&b.push(y[g]),u){const{main:C,cross:A}=vMe(r,s,await(a.isRTL==null?void 0:a.isRTL(l.floating)));b.push(y[C],y[A])}if(S=[...S,{placement:r,overflows:b}],!b.every(C=>C<=0)){var k,E;const C=((k=(E=i.flip)==null?void 0:E.index)!=null?k:0)+1,A=v[C];if(A)return{data:{index:C,overflows:S},reset:{placement:A}};let R="bottom";switch(h){case"bestFit":{var T;const Q=(T=S.map(L=>[L,L.overflows.filter(z=>z>0).reduce((z,B)=>z+B,0)]).sort((L,z)=>L[1]-z[1])[0])==null?void 0:T[0].placement;Q&&(R=Q);break}case"initialPlacement":R=o}if(r!==R)return{reset:{placement:R}}}return{}}}};function IF(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function DF(t){return vre.some(e=>t[e]>=0)}const bMe=function(t){let{strategy:e="referenceHidden",...n}=t===void 0?{}:t;return{name:"hide",async fn(r){const{rects:i}=r;switch(e){case"referenceHidden":{const s=IF(await aO(r,{...n,elementContext:"reference"}),i.reference);return{data:{referenceHiddenOffsets:s,referenceHidden:DF(s)}}}case"escaped":{const s=IF(await aO(r,{...n,altBoundary:!0}),i.floating);return{data:{escapedOffsets:s,escaped:DF(s)}}}default:return{}}}}},xMe=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){const{x:n,y:r}=e,i=await async function(s,o){const{placement:a,platform:l,elements:c}=s,u=await(l.isRTL==null?void 0:l.isRTL(c.floating)),f=Bd(a),h=My(a),d=Zm(a)==="x",p=["left","top"].includes(f)?-1:1,g=u&&d?-1:1,m=typeof o=="function"?o(s):o;let{mainAxis:v,crossAxis:y,alignmentAxis:b}=typeof m=="number"?{mainAxis:m,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...m};return h&&typeof b=="number"&&(y=h==="end"?-1*b:b),d?{x:y*g,y:v*p}:{x:v*p,y:y*g}}(e,t);return{x:n+i.x,y:r+i.y,data:i}}}};function Ore(t){return t==="x"?"y":"x"}const wMe=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:r,placement:i}=e,{mainAxis:s=!0,crossAxis:o=!1,limiter:a={fn:m=>{let{x:v,y}=m;return{x:v,y}}},...l}=t,c={x:n,y:r},u=await aO(e,l),f=Zm(Bd(i)),h=Ore(f);let d=c[f],p=c[h];if(s){const m=f==="y"?"bottom":"right";d=NT(d+u[f==="y"?"top":"left"],d,d-u[m])}if(o){const m=h==="y"?"bottom":"right";p=NT(p+u[h==="y"?"top":"left"],p,p-u[m])}const g=a.fn({...e,[f]:d,[h]:p});return{...g,data:{x:g.x-n,y:g.y-r}}}}},SMe=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:n,y:r,placement:i,rects:s,middlewareData:o}=e,{offset:a=0,mainAxis:l=!0,crossAxis:c=!0}=t,u={x:n,y:r},f=Zm(i),h=Ore(f);let d=u[f],p=u[h];const g=typeof a=="function"?a({...s,placement:i}):a,m=typeof g=="number"?{mainAxis:g,crossAxis:0}:{mainAxis:0,crossAxis:0,...g};if(l){const k=f==="y"?"height":"width",E=s.reference[f]-s.floating[k]+m.mainAxis,T=s.reference[f]+s.reference[k]-m.mainAxis;d<E?d=E:d>T&&(d=T)}if(c){var v,y,b,S;const k=f==="y"?"width":"height",E=["top","left"].includes(Bd(i)),T=s.reference[h]-s.floating[k]+(E&&(v=(y=o.offset)==null?void 0:y[h])!=null?v:0)+(E?0:m.crossAxis),C=s.reference[h]+s.reference[k]+(E?0:(b=(S=o.offset)==null?void 0:S[h])!=null?b:0)-(E?m.crossAxis:0);p<T?p=T:p>C&&(p=C)}return{[f]:d,[h]:p}}}},_Me=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){const{placement:n,rects:r,platform:i,elements:s}=e,{apply:o,...a}=t,l=await aO(e,a),c=Bd(n),u=My(n);let f,h;c==="top"||c==="bottom"?(f=c,h=u===(await(i.isRTL==null?void 0:i.isRTL(s.floating))?"start":"end")?"left":"right"):(h=c,f=u==="end"?"top":"bottom");const d=Th(l.left,0),p=Th(l.right,0),g=Th(l.top,0),m=Th(l.bottom,0),v={availableHeight:r.floating.height-(["left","right"].includes(n)?2*(g!==0||m!==0?g+m:Th(l.top,l.bottom)):l[f]),availableWidth:r.floating.width-(["top","bottom"].includes(n)?2*(d!==0||p!==0?d+p:Th(l.left,l.right)):l[h])},y=await i.getDimensions(s.floating);o==null||o({...e,...v});const b=await i.getDimensions(s.floating);return y.width!==b.width||y.height!==b.height?{reset:{rects:!0}}:{}}}};function yre(t){return t&&t.document&&t.location&&t.alert&&t.setInterval}function lu(t){if(t==null)return window;if(!yre(t)){const e=t.ownerDocument;return e&&e.defaultView||window}return t}function Iy(t){return lu(t).getComputedStyle(t)}function Lc(t){return yre(t)?"":t?(t.nodeName||"").toLowerCase():""}function bre(){const t=navigator.userAgentData;return t!=null&&t.brands?t.brands.map(e=>e.brand+"/"+e.version).join(" "):navigator.userAgent}function Tl(t){return t instanceof lu(t).HTMLElement}function _f(t){return t instanceof lu(t).Element}function lM(t){return typeof ShadowRoot>"u"?!1:t instanceof lu(t).ShadowRoot||t instanceof ShadowRoot}function X5(t){const{overflow:e,overflowX:n,overflowY:r}=Iy(t);return/auto|scroll|overlay|hidden/.test(e+r+n)}function kMe(t){return["table","td","th"].includes(Lc(t))}function LF(t){const e=/firefox/i.test(bre()),n=Iy(t);return n.transform!=="none"||n.perspective!=="none"||n.contain==="paint"||["transform","perspective"].includes(n.willChange)||e&&n.willChange==="filter"||e&&!!n.filter&&n.filter!=="none"}function xre(){return!/^((?!chrome|android).)*safari/i.test(bre())}const NF=Math.min,nv=Math.max,b_=Math.round;function Nc(t,e,n){var r,i,s,o;e===void 0&&(e=!1),n===void 0&&(n=!1);const a=t.getBoundingClientRect();let l=1,c=1;e&&Tl(t)&&(l=t.offsetWidth>0&&b_(a.width)/t.offsetWidth||1,c=t.offsetHeight>0&&b_(a.height)/t.offsetHeight||1);const u=_f(t)?lu(t):window,f=!xre()&&n,h=(a.left+(f&&(r=(i=u.visualViewport)==null?void 0:i.offsetLeft)!=null?r:0))/l,d=(a.top+(f&&(s=(o=u.visualViewport)==null?void 0:o.offsetTop)!=null?s:0))/c,p=a.width/l,g=a.height/c;return{width:p,height:g,top:d,right:h+p,bottom:d+g,left:h,x:h,y:d}}function hf(t){return(e=t,(e instanceof lu(e).Node?t.ownerDocument:t.document)||window.document).documentElement;var e}function H5(t){return _f(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}function wre(t){return Nc(hf(t)).left+H5(t).scrollLeft}function CMe(t,e,n){const r=Tl(e),i=hf(e),s=Nc(t,r&&function(l){const c=Nc(l);return b_(c.width)!==l.offsetWidth||b_(c.height)!==l.offsetHeight}(e),n==="fixed");let o={scrollLeft:0,scrollTop:0};const a={x:0,y:0};if(r||!r&&n!=="fixed")if((Lc(e)!=="body"||X5(i))&&(o=H5(e)),Tl(e)){const l=Nc(e,!0);a.x=l.x+e.clientLeft,a.y=l.y+e.clientTop}else i&&(a.x=wre(i));return{x:s.left+o.scrollLeft-a.x,y:s.top+o.scrollTop-a.y,width:s.width,height:s.height}}function Sre(t){return Lc(t)==="html"?t:t.assignedSlot||t.parentNode||(lM(t)?t.host:null)||hf(t)}function QF(t){return Tl(t)&&getComputedStyle(t).position!=="fixed"?t.offsetParent:null}function QT(t){const e=lu(t);let n=QF(t);for(;n&&kMe(n)&&getComputedStyle(n).position==="static";)n=QF(n);return n&&(Lc(n)==="html"||Lc(n)==="body"&&getComputedStyle(n).position==="static"&&!LF(n))?e:n||function(r){let i=Sre(r);for(lM(i)&&(i=i.host);Tl(i)&&!["html","body"].includes(Lc(i));){if(LF(i))return i;i=i.parentNode}return null}(t)||e}function jF(t){if(Tl(t))return{width:t.offsetWidth,height:t.offsetHeight};const e=Nc(t);return{width:e.width,height:e.height}}function _re(t){const e=Sre(t);return["html","body","#document"].includes(Lc(e))?t.ownerDocument.body:Tl(e)&&X5(e)?e:_re(e)}function x_(t,e){var n;e===void 0&&(e=[]);const r=_re(t),i=r===((n=t.ownerDocument)==null?void 0:n.body),s=lu(r),o=i?[s].concat(s.visualViewport||[],X5(r)?r:[]):r,a=e.concat(o);return i?a:a.concat(x_(o))}function BF(t,e,n){return e==="viewport"?O_(function(r,i){const s=lu(r),o=hf(r),a=s.visualViewport;let l=o.clientWidth,c=o.clientHeight,u=0,f=0;if(a){l=a.width,c=a.height;const h=xre();(h||!h&&i==="fixed")&&(u=a.offsetLeft,f=a.offsetTop)}return{width:l,height:c,x:u,y:f}}(t,n)):_f(e)?function(r,i){const s=Nc(r,!1,i==="fixed"),o=s.top+r.clientTop,a=s.left+r.clientLeft;return{top:o,left:a,x:a,y:o,right:a+r.clientWidth,bottom:o+r.clientHeight,width:r.clientWidth,height:r.clientHeight}}(e,n):O_(function(r){var i;const s=hf(r),o=H5(r),a=(i=r.ownerDocument)==null?void 0:i.body,l=nv(s.scrollWidth,s.clientWidth,a?a.scrollWidth:0,a?a.clientWidth:0),c=nv(s.scrollHeight,s.clientHeight,a?a.scrollHeight:0,a?a.clientHeight:0);let u=-o.scrollLeft+wre(r);const f=-o.scrollTop;return Iy(a||s).direction==="rtl"&&(u+=nv(s.clientWidth,a?a.clientWidth:0)-l),{width:l,height:c,x:u,y:f}}(hf(t)))}function EMe(t){const e=x_(t),n=["absolute","fixed"].includes(Iy(t).position)&&Tl(t)?QT(t):t;return _f(n)?e.filter(r=>_f(r)&&function(i,s){const o=s.getRootNode==null?void 0:s.getRootNode();if(i.contains(s))return!0;if(o&&lM(o)){let a=s;do{if(a&&i===a)return!0;a=a.parentNode||a.host}while(a)}return!1}(r,n)&&Lc(r)!=="body"):[]}const TMe={getClippingRect:function(t){let{element:e,boundary:n,rootBoundary:r,strategy:i}=t;const s=[...n==="clippingAncestors"?EMe(e):[].concat(n),r],o=s[0],a=s.reduce((l,c)=>{const u=BF(e,c,i);return l.top=nv(u.top,l.top),l.right=NF(u.right,l.right),l.bottom=NF(u.bottom,l.bottom),l.left=nv(u.left,l.left),l},BF(e,o,i));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}},convertOffsetParentRelativeRectToViewportRelativeRect:function(t){let{rect:e,offsetParent:n,strategy:r}=t;const i=Tl(n),s=hf(n);if(n===s)return e;let o={scrollLeft:0,scrollTop:0};const a={x:0,y:0};if((i||!i&&r!=="fixed")&&((Lc(n)!=="body"||X5(s))&&(o=H5(n)),Tl(n))){const l=Nc(n,!0);a.x=l.x+n.clientLeft,a.y=l.y+n.clientTop}return{...e,x:e.x-o.scrollLeft+a.x,y:e.y-o.scrollTop+a.y}},isElement:_f,getDimensions:jF,getOffsetParent:QT,getDocumentElement:hf,getElementRects:t=>{let{reference:e,floating:n,strategy:r}=t;return{reference:CMe(e,QT(n),r),floating:{...jF(n),x:0,y:0}}},getClientRects:t=>Array.from(t.getClientRects()),isRTL:t=>Iy(t).direction==="rtl"};function PMe(t,e,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:s=!0,elementResize:o=!0,animationFrame:a=!1}=r,l=i&&!a,c=s&&!a,u=l||c?[..._f(t)?x_(t):[],...x_(e)]:[];u.forEach(p=>{l&&p.addEventListener("scroll",n,{passive:!0}),c&&p.addEventListener("resize",n)});let f,h=null;if(o){let p=!0;h=new ResizeObserver(()=>{p||n(),p=!1}),_f(t)&&!a&&h.observe(t),h.observe(e)}let d=a?Nc(t):null;return a&&function p(){const g=Nc(t);!d||g.x===d.x&&g.y===d.y&&g.width===d.width&&g.height===d.height||n(),d=g,f=requestAnimationFrame(p)}(),n(),()=>{var p;u.forEach(g=>{l&&g.removeEventListener("scroll",n),c&&g.removeEventListener("resize",n)}),(p=h)==null||p.disconnect(),h=null,a&&cancelAnimationFrame(f)}}const AMe=(t,e,n)=>pMe(t,e,{platform:TMe,...n});var jT=typeof document<"u"?_.useLayoutEffect:_.useEffect;function BT(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let n,r,i;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(n=t.length,n!=e.length)return!1;for(r=n;r--!==0;)if(!BT(t[r],e[r]))return!1;return!0}if(i=Object.keys(t),n=i.length,n!==Object.keys(e).length)return!1;for(r=n;r--!==0;)if(!Object.prototype.hasOwnProperty.call(e,i[r]))return!1;for(r=n;r--!==0;){const s=i[r];if(!(s==="_owner"&&t.$$typeof)&&!BT(t[s],e[s]))return!1}return!0}return t!==t&&e!==e}function RMe(t){const e=_.useRef(t);return jT(()=>{e.current=t}),e}function $Me(t){let{middleware:e,placement:n="bottom",strategy:r="absolute",whileElementsMounted:i}=t===void 0?{}:t;const s=_.useRef(null),o=_.useRef(null),a=RMe(i),l=_.useRef(null),[c,u]=_.useState({x:null,y:null,strategy:r,placement:n,middlewareData:{}}),[f,h]=_.useState(e);BT(f==null?void 0:f.map(b=>{let{options:S}=b;return S}),e==null?void 0:e.map(b=>{let{options:S}=b;return S}))||h(e);const d=_.useCallback(()=>{!s.current||!o.current||AMe(s.current,o.current,{middleware:f,placement:n,strategy:r}).then(b=>{p.current&&Qi.flushSync(()=>{u(b)})})},[f,n,r]);jT(()=>{p.current&&d()},[d]);const p=_.useRef(!1);jT(()=>(p.current=!0,()=>{p.current=!1}),[]);const g=_.useCallback(()=>{if(typeof l.current=="function"&&(l.current(),l.current=null),s.current&&o.current)if(a.current){const b=a.current(s.current,o.current,d);l.current=b}else d()},[d,a]),m=_.useCallback(b=>{s.current=b,g()},[g]),v=_.useCallback(b=>{o.current=b,g()},[g]),y=_.useMemo(()=>({reference:s,floating:o}),[]);return _.useMemo(()=>({...c,update:d,refs:y,reference:m,floating:v}),[c,d,y,m,v])}const MMe=t=>{const{element:e,padding:n}=t;function r(i){return Object.prototype.hasOwnProperty.call(i,"current")}return{name:"arrow",options:t,fn(i){return r(e)?e.current!=null?$F({element:e.current,padding:n}).fn(i):{}:e?$F({element:e,padding:n}).fn(i):{}}}},IMe=_.forwardRef((t,e)=>{const{children:n,width:r=10,height:i=5,...s}=t;return _.createElement(gn.svg,Ee({},s,{ref:e,width:r,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none"}),t.asChild?n:_.createElement("polygon",{points:"0,0 30,0 15,10"}))}),DMe=IMe,kre="Popper",[cM,Z5]=Oo(kre),[LMe,Cre]=cM(kre),NMe=t=>{const{__scopePopper:e,children:n}=t,[r,i]=_.useState(null);return _.createElement(LMe,{scope:e,anchor:r,onAnchorChange:i},n)},QMe="PopperAnchor",jMe=_.forwardRef((t,e)=>{const{__scopePopper:n,virtualRef:r,...i}=t,s=Cre(QMe,n),o=_.useRef(null),a=In(e,o);return _.useEffect(()=>{s.onAnchorChange((r==null?void 0:r.current)||o.current)}),r?null:_.createElement(gn.div,Ee({},i,{ref:a}))}),w_="PopperContent",[BMe,zMe]=cM(w_),[FMe,WMe]=cM(w_,{hasParent:!1,positionUpdateFns:new Set}),VMe=_.forwardRef((t,e)=>{var n,r,i,s,o,a,l,c;const{__scopePopper:u,side:f="bottom",sideOffset:h=0,align:d="center",alignOffset:p=0,arrowPadding:g=0,collisionBoundary:m=[],collisionPadding:v=0,sticky:y="partial",hideWhenDetached:b=!1,avoidCollisions:S=!0,onPlaced:k,...E}=t,T=Cre(w_,u),[C,A]=_.useState(null),R=In(e,ze=>A(ze)),[Q,L]=_.useState(null),z=V5(Q),B=(n=z==null?void 0:z.width)!==null&&n!==void 0?n:0,q=(r=z==null?void 0:z.height)!==null&&r!==void 0?r:0,Z=f+(d!=="center"?"-"+d:""),J=typeof v=="number"?v:{top:0,right:0,bottom:0,left:0,...v},I=Array.isArray(m)?m:[m],j=I.length>0,M={padding:J,boundary:I.filter(ZMe),altBoundary:j},{reference:X,floating:se,strategy:H,x:de,y:fe,placement:ve,middlewareData:F,update:oe}=$Me({strategy:"fixed",placement:Z,whileElementsMounted:PMe,middleware:[YMe(),xMe({mainAxis:h+q,alignmentAxis:p}),S?wMe({mainAxis:!0,crossAxis:!1,limiter:y==="partial"?SMe():void 0,...M}):void 0,Q?MMe({element:Q,padding:g}):void 0,S?yMe({...M}):void 0,_Me({...M,apply:({elements:ze,availableWidth:Ye,availableHeight:we})=>{ze.floating.style.setProperty("--radix-popper-available-width",`${Ye}px`),ze.floating.style.setProperty("--radix-popper-available-height",`${we}px`)}}),GMe({arrowWidth:B,arrowHeight:q}),b?bMe({strategy:"referenceHidden"}):void 0].filter(HMe)});Pc(()=>{X(T.anchor)},[X,T.anchor]);const le=de!==null&&fe!==null,[pe,De]=Ere(ve),xe=$a(k);Pc(()=>{le&&(xe==null||xe())},[le,xe]);const je=(i=F.arrow)===null||i===void 0?void 0:i.x,He=(s=F.arrow)===null||s===void 0?void 0:s.y,nt=((o=F.arrow)===null||o===void 0?void 0:o.centerOffset)!==0,[xt,Ze]=_.useState();Pc(()=>{C&&Ze(window.getComputedStyle(C).zIndex)},[C]);const{hasParent:Oe,positionUpdateFns:be}=WMe(w_,u),Re=!Oe;_.useLayoutEffect(()=>{if(!Re)return be.add(oe),()=>{be.delete(oe)}},[Re,be,oe]),Pc(()=>{Re&&le&&Array.from(be).reverse().forEach(ze=>requestAnimationFrame(ze))},[Re,le,be]);const Ke={"data-side":pe,"data-align":De,...E,ref:R,style:{...E.style,animation:le?void 0:"none",opacity:(a=F.hide)!==null&&a!==void 0&&a.referenceHidden?0:void 0}};return _.createElement("div",{ref:se,"data-radix-popper-content-wrapper":"",style:{position:H,left:0,top:0,transform:le?`translate3d(${Math.round(de)}px, ${Math.round(fe)}px, 0)`:"translate3d(0, -200%, 0)",minWidth:"max-content",zIndex:xt,["--radix-popper-transform-origin"]:[(l=F.transformOrigin)===null||l===void 0?void 0:l.x,(c=F.transformOrigin)===null||c===void 0?void 0:c.y].join(" ")},dir:t.dir},_.createElement(BMe,{scope:u,placedSide:pe,onArrowChange:L,arrowX:je,arrowY:He,shouldHideArrow:nt},Re?_.createElement(FMe,{scope:u,hasParent:!0,positionUpdateFns:be},_.createElement(gn.div,Ke)):_.createElement(gn.div,Ke)))}),UMe="PopperArrow",qMe={top:"bottom",right:"left",bottom:"top",left:"right"},XMe=_.forwardRef(function(e,n){const{__scopePopper:r,...i}=e,s=zMe(UMe,r),o=qMe[s.placedSide];return _.createElement("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0}},_.createElement(DMe,Ee({},i,{ref:n,style:{...i.style,display:"block"}})))});function HMe(t){return t!==void 0}function ZMe(t){return t!==null}const YMe=()=>({name:"anchorCssProperties",fn(t){const{rects:e,elements:n}=t,{width:r,height:i}=e.reference;return n.floating.style.setProperty("--radix-popper-anchor-width",`${r}px`),n.floating.style.setProperty("--radix-popper-anchor-height",`${i}px`),{}}}),GMe=t=>({name:"transformOrigin",options:t,fn(e){var n,r,i,s,o;const{placement:a,rects:l,middlewareData:c}=e,f=((n=c.arrow)===null||n===void 0?void 0:n.centerOffset)!==0,h=f?0:t.arrowWidth,d=f?0:t.arrowHeight,[p,g]=Ere(a),m={start:"0%",center:"50%",end:"100%"}[g],v=((r=(i=c.arrow)===null||i===void 0?void 0:i.x)!==null&&r!==void 0?r:0)+h/2,y=((s=(o=c.arrow)===null||o===void 0?void 0:o.y)!==null&&s!==void 0?s:0)+d/2;let b="",S="";return p==="bottom"?(b=f?m:`${v}px`,S=`${-d}px`):p==="top"?(b=f?m:`${v}px`,S=`${l.floating.height+d}px`):p==="right"?(b=`${-d}px`,S=f?m:`${y}px`):p==="left"&&(b=`${l.floating.width+d}px`,S=f?m:`${y}px`),{data:{x:b,y:S}}}});function Ere(t){const[e,n="center"]=t.split("-");return[e,n]}const Tre=NMe,Pre=jMe,Are=VMe,KMe=XMe,Rre=_.forwardRef((t,e)=>{var n;const{container:r=globalThis==null||(n=globalThis.document)===null||n===void 0?void 0:n.body,...i}=t;return r?MR.createPortal(_.createElement(gn.div,Ee({},i,{ref:e})),r):null});function JMe(t,e){return _.useReducer((n,r)=>{const i=e[n][r];return i??n},t)}const zd=t=>{const{present:e,children:n}=t,r=eIe(e),i=typeof n=="function"?n({present:r.isPresent}):_.Children.only(n),s=In(r.ref,i.ref);return typeof n=="function"||r.isPresent?_.cloneElement(i,{ref:s}):null};zd.displayName="Presence";function eIe(t){const[e,n]=_.useState(),r=_.useRef({}),i=_.useRef(t),s=_.useRef("none"),o=t?"mounted":"unmounted",[a,l]=JMe(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return _.useEffect(()=>{const c=jx(r.current);s.current=a==="mounted"?c:"none"},[a]),Pc(()=>{const c=r.current,u=i.current;if(u!==t){const h=s.current,d=jx(c);t?l("MOUNT"):d==="none"||(c==null?void 0:c.display)==="none"?l("UNMOUNT"):l(u&&h!==d?"ANIMATION_OUT":"UNMOUNT"),i.current=t}},[t,l]),Pc(()=>{if(e){const c=f=>{const d=jx(r.current).includes(f.animationName);f.target===e&&d&&Qi.flushSync(()=>l("ANIMATION_END"))},u=f=>{f.target===e&&(s.current=jx(r.current))};return e.addEventListener("animationstart",u),e.addEventListener("animationcancel",c),e.addEventListener("animationend",c),()=>{e.removeEventListener("animationstart",u),e.removeEventListener("animationcancel",c),e.removeEventListener("animationend",c)}}else l("ANIMATION_END")},[e,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:_.useCallback(c=>{c&&(r.current=getComputedStyle(c)),n(c)},[])}}function jx(t){return(t==null?void 0:t.animationName)||"none"}const L6="rovingFocusGroup.onEntryFocus",tIe={bubbles:!1,cancelable:!0},uM="RovingFocusGroup",[zT,$re,nIe]=Hm(uM),[rIe,Y5]=Oo(uM,[nIe]),[iIe,sIe]=rIe(uM),oIe=_.forwardRef((t,e)=>_.createElement(zT.Provider,{scope:t.__scopeRovingFocusGroup},_.createElement(zT.Slot,{scope:t.__scopeRovingFocusGroup},_.createElement(aIe,Ee({},t,{ref:e}))))),aIe=_.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:s,currentTabStopId:o,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:l,onEntryFocus:c,...u}=t,f=_.useRef(null),h=In(e,f),d=jd(s),[p=null,g]=Nl({prop:o,defaultProp:a,onChange:l}),[m,v]=_.useState(!1),y=$a(c),b=$re(n),S=_.useRef(!1),[k,E]=_.useState(0);return _.useEffect(()=>{const T=f.current;if(T)return T.addEventListener(L6,y),()=>T.removeEventListener(L6,y)},[y]),_.createElement(iIe,{scope:n,orientation:r,dir:d,loop:i,currentTabStopId:p,onItemFocus:_.useCallback(T=>g(T),[g]),onItemShiftTab:_.useCallback(()=>v(!0),[]),onFocusableItemAdd:_.useCallback(()=>E(T=>T+1),[]),onFocusableItemRemove:_.useCallback(()=>E(T=>T-1),[])},_.createElement(gn.div,Ee({tabIndex:m||k===0?-1:0,"data-orientation":r},u,{ref:h,style:{outline:"none",...t.style},onMouseDown:gt(t.onMouseDown,()=>{S.current=!0}),onFocus:gt(t.onFocus,T=>{const C=!S.current;if(T.target===T.currentTarget&&C&&!m){const A=new CustomEvent(L6,tIe);if(T.currentTarget.dispatchEvent(A),!A.defaultPrevented){const R=b().filter(q=>q.focusable),Q=R.find(q=>q.active),L=R.find(q=>q.id===p),B=[Q,L,...R].filter(Boolean).map(q=>q.ref.current);Mre(B)}}S.current=!1}),onBlur:gt(t.onBlur,()=>v(!1))})))}),lIe="RovingFocusGroupItem",cIe=_.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:s,...o}=t,a=ff(),l=s||a,c=sIe(lIe,n),u=c.currentTabStopId===l,f=$re(n),{onFocusableItemAdd:h,onFocusableItemRemove:d}=c;return _.useEffect(()=>{if(r)return h(),()=>d()},[r,h,d]),_.createElement(zT.ItemSlot,{scope:n,id:l,focusable:r,active:i},_.createElement(gn.span,Ee({tabIndex:u?0:-1,"data-orientation":c.orientation},o,{ref:e,onMouseDown:gt(t.onMouseDown,p=>{r?c.onItemFocus(l):p.preventDefault()}),onFocus:gt(t.onFocus,()=>c.onItemFocus(l)),onKeyDown:gt(t.onKeyDown,p=>{if(p.key==="Tab"&&p.shiftKey){c.onItemShiftTab();return}if(p.target!==p.currentTarget)return;const g=hIe(p,c.orientation,c.dir);if(g!==void 0){p.preventDefault();let v=f().filter(y=>y.focusable).map(y=>y.ref.current);if(g==="last")v.reverse();else if(g==="prev"||g==="next"){g==="prev"&&v.reverse();const y=v.indexOf(p.currentTarget);v=c.loop?dIe(v,y+1):v.slice(y+1)}setTimeout(()=>Mre(v))}})})))}),uIe={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function fIe(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function hIe(t,e,n){const r=fIe(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return uIe[r]}function Mre(t){const e=document.activeElement;for(const n of t)if(n===e||(n.focus(),document.activeElement!==e))return}function dIe(t,e){return t.map((n,r)=>t[(e+r)%t.length])}const Ire=oIe,Dre=cIe;var pIe=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},x0=new WeakMap,Bx=new WeakMap,zx={},N6=0,Lre=function(t){return t&&(t.host||Lre(t.parentNode))},mIe=function(t,e){return e.map(function(n){if(t.contains(n))return n;var r=Lre(n);return r&&t.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",t,". Doing nothing"),null)}).filter(function(n){return!!n})},gIe=function(t,e,n,r){var i=mIe(e,Array.isArray(t)?t:[t]);zx[n]||(zx[n]=new WeakMap);var s=zx[n],o=[],a=new Set,l=new Set(i),c=function(f){!f||a.has(f)||(a.add(f),c(f.parentNode))};i.forEach(c);var u=function(f){!f||l.has(f)||Array.prototype.forEach.call(f.children,function(h){if(a.has(h))u(h);else try{var d=h.getAttribute(r),p=d!==null&&d!=="false",g=(x0.get(h)||0)+1,m=(s.get(h)||0)+1;x0.set(h,g),s.set(h,m),o.push(h),g===1&&p&&Bx.set(h,!0),m===1&&h.setAttribute(n,"true"),p||h.setAttribute(r,"true")}catch(v){console.error("aria-hidden: cannot operate on ",h,v)}})};return u(e),a.clear(),N6++,function(){o.forEach(function(f){var h=x0.get(f)-1,d=s.get(f)-1;x0.set(f,h),s.set(f,d),h||(Bx.has(f)||f.removeAttribute(r),Bx.delete(f)),d||f.removeAttribute(n)}),N6--,N6||(x0=new WeakMap,x0=new WeakMap,Bx=new WeakMap,zx={})}},G5=function(t,e,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(t)?t:[t]),i=e||pIe(t);return i?(r.push.apply(r,Array.from(i.querySelectorAll("[aria-live]"))),gIe(r,i,n,"aria-hidden")):function(){return null}},Fr=function(){return Fr=Object.assign||function(e){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},Fr.apply(this,arguments)};function fM(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]]);return n}function Ym(t,e,n,r){function i(s){return s instanceof n?s:new n(function(o){o(s)})}return new(n||(n=Promise))(function(s,o){function a(u){try{c(r.next(u))}catch(f){o(f)}}function l(u){try{c(r.throw(u))}catch(f){o(f)}}function c(u){u.done?s(u.value):i(u.value).then(a,l)}c((r=r.apply(t,e||[])).next())})}function Gm(t,e){var n={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},r,i,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(c){return function(u){return l([c,u])}}function l(c){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(n=0)),n;)try{if(r=1,i&&(s=c[0]&2?i.return:c[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,c[1])).done)return s;switch(i=0,s&&(c=[c[0]&2,s.value]),c[0]){case 0:case 1:s=c;break;case 4:return n.label++,{value:c[1],done:!1};case 5:n.label++,i=c[1],c=[0];continue;case 7:c=n.ops.pop(),n.trys.pop();continue;default:if(s=n.trys,!(s=s.length>0&&s[s.length-1])&&(c[0]===6||c[0]===2)){n=0;continue}if(c[0]===3&&(!s||c[1]>s[0]&&c[1]<s[3])){n.label=c[1];break}if(c[0]===6&&n.label<s[1]){n.label=s[1],s=c;break}if(s&&n.label<s[2]){n.label=s[2],n.ops.push(c);break}s[2]&&n.ops.pop(),n.trys.pop();continue}c=e.call(t,n)}catch(u){c=[6,u],i=0}finally{r=s=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function zF(t,e){var n=typeof Symbol=="function"&&t[Symbol.iterator];if(!n)return t;var r=n.call(t),i,s=[],o;try{for(;(e===void 0||e-- >0)&&!(i=r.next()).done;)s.push(i.value)}catch(a){o={error:a}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return s}function S_(t,e,n){if(n||arguments.length===2)for(var r=0,i=e.length,s;r<i;r++)(s||!(r in e))&&(s||(s=Array.prototype.slice.call(e,0,r)),s[r]=e[r]);return t.concat(s||Array.prototype.slice.call(e))}var rv="right-scroll-bar-position",iv="width-before-scroll-bar",vIe="with-scroll-bars-hidden",OIe="--removed-body-scroll-bar-size";function Q6(t,e){return typeof t=="function"?t(e):t&&(t.current=e),t}function yIe(t,e){var n=_.useState(function(){return{value:t,callback:e,facade:{get current(){return n.value},set current(r){var i=n.value;i!==r&&(n.value=r,n.callback(r,i))}}}})[0];return n.callback=e,n.facade}var bIe=typeof window<"u"?_.useLayoutEffect:_.useEffect,FF=new WeakMap;function Nre(t,e){var n=yIe(e||null,function(r){return t.forEach(function(i){return Q6(i,r)})});return bIe(function(){var r=FF.get(n);if(r){var i=new Set(r),s=new Set(t),o=n.current;i.forEach(function(a){s.has(a)||Q6(a,null)}),s.forEach(function(a){i.has(a)||Q6(a,o)})}FF.set(n,t)},[t]),n}function xIe(t){return t}function wIe(t,e){e===void 0&&(e=xIe);var n=[],r=!1,i={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:t},useMedium:function(s){var o=e(s,r);return n.push(o),function(){n=n.filter(function(a){return a!==o})}},assignSyncMedium:function(s){for(r=!0;n.length;){var o=n;n=[],o.forEach(s)}n={push:function(a){return s(a)},filter:function(){return n}}},assignMedium:function(s){r=!0;var o=[];if(n.length){var a=n;n=[],a.forEach(s),o=n}var l=function(){var u=o;o=[],u.forEach(s)},c=function(){return Promise.resolve().then(l)};c(),n={push:function(u){o.push(u),c()},filter:function(u){return o=o.filter(u),n}}}};return i}function Qre(t){t===void 0&&(t={});var e=wIe(null);return e.options=Fr({async:!0,ssr:!1},t),e}var jre=function(t){var e=t.sideCar,n=fM(t,["sideCar"]);if(!e)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=e.read();if(!r)throw new Error("Sidecar medium not found");return _.createElement(r,Fr({},n))};jre.isSideCarExport=!0;function Bre(t,e){return t.useMedium(e),jre}var zre=Qre(),j6=function(){},K5=_.forwardRef(function(t,e){var n=_.useRef(null),r=_.useState({onScrollCapture:j6,onWheelCapture:j6,onTouchMoveCapture:j6}),i=r[0],s=r[1],o=t.forwardProps,a=t.children,l=t.className,c=t.removeScrollBar,u=t.enabled,f=t.shards,h=t.sideCar,d=t.noIsolation,p=t.inert,g=t.allowPinchZoom,m=t.as,v=m===void 0?"div":m,y=fM(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as"]),b=h,S=Nre([n,e]),k=Fr(Fr({},y),i);return _.createElement(_.Fragment,null,u&&_.createElement(b,{sideCar:zre,removeScrollBar:c,shards:f,noIsolation:d,inert:p,setCallbacks:s,allowPinchZoom:!!g,lockRef:n}),o?_.cloneElement(_.Children.only(a),Fr(Fr({},k),{ref:S})):_.createElement(v,Fr({},k,{className:l,ref:S}),a))});K5.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};K5.classNames={fullWidth:iv,zeroRight:rv};var WF,SIe=function(){if(WF)return WF;if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function _Ie(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var e=SIe();return e&&t.setAttribute("nonce",e),t}function kIe(t,e){t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}function CIe(t){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(t)}var EIe=function(){var t=0,e=null;return{add:function(n){t==0&&(e=_Ie())&&(kIe(e,n),CIe(e)),t++},remove:function(){t--,!t&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}},TIe=function(){var t=EIe();return function(e,n){_.useEffect(function(){return t.add(e),function(){t.remove()}},[e&&n])}},hM=function(){var t=TIe(),e=function(n){var r=n.styles,i=n.dynamic;return t(r,i),null};return e},PIe={left:0,top:0,right:0,gap:0},B6=function(t){return parseInt(t||"",10)||0},AIe=function(t){var e=window.getComputedStyle(document.body),n=e[t==="padding"?"paddingLeft":"marginLeft"],r=e[t==="padding"?"paddingTop":"marginTop"],i=e[t==="padding"?"paddingRight":"marginRight"];return[B6(n),B6(r),B6(i)]},RIe=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return PIe;var e=AIe(t),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,r-n+e[2]-e[0])}},$Ie=hM(),yp="data-scroll-locked",MIe=function(t,e,n,r){var i=t.left,s=t.top,o=t.right,a=t.gap;return n===void 0&&(n="margin"),`
228
228
  .`.concat(vIe,` {
229
229
  overflow: hidden `).concat(r,`;
230
230
  padding-right: `).concat(a,"px ").concat(r,`;
@@ -370,7 +370,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
370
370
  * Released under the MIT License
371
371
  */class j0t{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(e,n,r,i){const s=n.listeners[i],o=n.duration;s.forEach(a=>a({chart:e,initial:n.initial,numSteps:o,currentStep:Math.min(r-n.start,o)}))}_refresh(){this._request||(this._running=!0,this._request=b0e.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(e=Date.now()){let n=0;this._charts.forEach((r,i)=>{if(!r.running||!r.items.length)return;const s=r.items;let o=s.length-1,a=!1,l;for(;o>=0;--o)l=s[o],l._active?(l._total>r.duration&&(r.duration=l._total),l.tick(e),a=!0):(s[o]=s[s.length-1],s.pop());a&&(i.draw(),this._notify(i,r,e,"progress")),s.length||(r.running=!1,this._notify(i,r,e,"complete"),r.initial=!1),n+=s.length}),this._lastDate=e,n===0&&(this._running=!1)}_getAnims(e){const n=this._charts;let r=n.get(e);return r||(r={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},n.set(e,r)),r}listen(e,n,r){this._getAnims(e).listeners[n].push(r)}add(e,n){!n||!n.length||this._getAnims(e).items.push(...n)}has(e){return this._getAnims(e).items.length>0}start(e){const n=this._charts.get(e);n&&(n.running=!0,n.start=Date.now(),n.duration=n.items.reduce((r,i)=>Math.max(r,i._duration),0),this._refresh())}running(e){if(!this._running)return!1;const n=this._charts.get(e);return!(!n||!n.running||!n.items.length)}stop(e){const n=this._charts.get(e);if(!n||!n.items.length)return;const r=n.items;let i=r.length-1;for(;i>=0;--i)r[i].cancel();n.items=[],this._notify(e,n,Date.now(),"complete")}remove(e){return this._charts.delete(e)}}var mc=new j0t;const eH="transparent",B0t={boolean(t,e,n){return n>.5?e:t},color(t,e,n){const r=VX(t||eH),i=r.valid&&VX(e||eH);return i&&i.valid?i.mix(r,n).hexString():e},number(t,e,n){return t+(e-t)*n}};class z0t{constructor(e,n,r,i){const s=n[r];i=I1([e.to,i,s,e.from]);const o=I1([e.from,s,i]);this._active=!0,this._fn=e.fn||B0t[e.type||typeof o],this._easing=yv[e.easing]||yv.linear,this._start=Math.floor(Date.now()+(e.delay||0)),this._duration=this._total=Math.floor(e.duration),this._loop=!!e.loop,this._target=n,this._prop=r,this._from=o,this._to=i,this._promises=void 0}active(){return this._active}update(e,n,r){if(this._active){this._notify(!1);const i=this._target[this._prop],s=r-this._start,o=this._duration-s;this._start=r,this._duration=Math.floor(Math.max(o,e.duration)),this._total+=s,this._loop=!!e.loop,this._to=I1([e.to,n,i,e.from]),this._from=I1([e.from,i,n])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(e){const n=e-this._start,r=this._duration,i=this._prop,s=this._from,o=this._loop,a=this._to;let l;if(this._active=s!==a&&(o||n<r),!this._active){this._target[i]=a,this._notify(!0);return}if(n<0){this._target[i]=s;return}l=n/r%2,l=o&&l>1?2-l:l,l=this._easing(Math.min(1,Math.max(0,l))),this._target[i]=this._fn(s,a,l)}wait(){const e=this._promises||(this._promises=[]);return new Promise((n,r)=>{e.push({res:n,rej:r})})}_notify(e){const n=e?"res":"rej",r=this._promises||[];for(let i=0;i<r.length;i++)r[i][n]()}}class Q0e{constructor(e,n){this._chart=e,this._properties=new Map,this.configure(n)}configure(e){if(!Zt(e))return;const n=Object.keys(rr.animation),r=this._properties;Object.getOwnPropertyNames(e).forEach(i=>{const s=e[i];if(!Zt(s))return;const o={};for(const a of n)o[a]=s[a];(Xn(s.properties)&&s.properties||[i]).forEach(a=>{(a===i||!r.has(a))&&r.set(a,o)})})}_animateOptions(e,n){const r=n.options,i=W0t(e,r);if(!i)return[];const s=this._createAnimations(i,r);return r.$shared&&F0t(e.options.$animations,r).then(()=>{e.options=r},()=>{}),s}_createAnimations(e,n){const r=this._properties,i=[],s=e.$animations||(e.$animations={}),o=Object.keys(n),a=Date.now();let l;for(l=o.length-1;l>=0;--l){const c=o[l];if(c.charAt(0)==="$")continue;if(c==="options"){i.push(...this._animateOptions(e,n));continue}const u=n[c];let f=s[c];const h=r.get(c);if(f)if(h&&f.active()){f.update(h,u,a);continue}else f.cancel();if(!h||!h.duration){e[c]=u;continue}s[c]=f=new z0t(h,e,c,u),i.push(f)}return i}update(e,n){if(this._properties.size===0){Object.assign(e,n);return}const r=this._createAnimations(e,n);if(r.length)return mc.add(this._chart,r),!0}}function F0t(t,e){const n=[],r=Object.keys(e);for(let i=0;i<r.length;i++){const s=t[r[i]];s&&s.active()&&n.push(s.wait())}return Promise.all(n)}function W0t(t,e){if(!e)return;let n=t.options;if(!n){t.options=e;return}return n.$shared&&(t.options=n=Object.assign({},n,{$shared:!1,$animations:{}})),n}function tH(t,e){const n=t&&t.options||{},r=n.reverse,i=n.min===void 0?e:0,s=n.max===void 0?e:0;return{start:r?s:i,end:r?i:s}}function V0t(t,e,n){if(n===!1)return!1;const r=tH(t,n),i=tH(e,n);return{top:i.end,right:r.end,bottom:i.start,left:r.start}}function U0t(t){let e,n,r,i;return Zt(t)?(e=t.top,n=t.right,r=t.bottom,i=t.left):e=n=r=i=t,{top:e,right:n,bottom:r,left:i,disabled:t===!1}}function j0e(t,e){const n=[],r=t._getSortedDatasetMetas(e);let i,s;for(i=0,s=r.length;i<s;++i)n.push(r[i].index);return n}function nH(t,e,n,r={}){const i=t.keys,s=r.mode==="single";let o,a,l,c;if(e===null)return;let u=!1;for(o=0,a=i.length;o<a;++o){if(l=+i[o],l===n){if(u=!0,r.all)continue;break}c=t.values[l],wr(c)&&(s||e===0||kl(e)===kl(c))&&(e+=c)}return!u&&!r.all?0:e}function q0t(t,e){const{iScale:n,vScale:r}=e,i=n.axis==="x"?"x":"y",s=r.axis==="x"?"x":"y",o=Object.keys(t),a=new Array(o.length);let l,c,u;for(l=0,c=o.length;l<c;++l)u=o[l],a[l]={[i]:u,[s]:t[u]};return a}function J7(t,e){const n=t&&t.options.stacked;return n||n===void 0&&e.stack!==void 0}function X0t(t,e,n){return`${t.id}.${e.id}.${n.stack||n.type}`}function H0t(t){const{min:e,max:n,minDefined:r,maxDefined:i}=t.getUserBounds();return{min:r?e:Number.NEGATIVE_INFINITY,max:i?n:Number.POSITIVE_INFINITY}}function Z0t(t,e,n){const r=t[e]||(t[e]={});return r[n]||(r[n]={})}function rH(t,e,n,r){for(const i of e.getMatchingVisibleMetas(r).reverse()){const s=t[i.index];if(n&&s>0||!n&&s<0)return i.index}return null}function iH(t,e){const{chart:n,_cachedMeta:r}=t,i=n._stacks||(n._stacks={}),{iScale:s,vScale:o,index:a}=r,l=s.axis,c=o.axis,u=X0t(s,o,r),f=e.length;let h;for(let d=0;d<f;++d){const p=e[d],{[l]:g,[c]:m}=p,v=p._stacks||(p._stacks={});h=v[c]=Z0t(i,u,g),h[a]=m,h._top=rH(h,o,!0,r.type),h._bottom=rH(h,o,!1,r.type);const y=h._visualValues||(h._visualValues={});y[a]=m}}function eE(t,e){const n=t.scales;return Object.keys(n).filter(r=>n[r].axis===e).shift()}function Y0t(t,e){return Kf(t,{active:!1,dataset:void 0,datasetIndex:e,index:e,mode:"default",type:"dataset"})}function G0t(t,e,n){return Kf(t,{active:!1,dataIndex:e,parsed:void 0,raw:void 0,element:n,index:e,mode:"default",type:"data"})}function i1(t,e){const n=t.controller.index,r=t.vScale&&t.vScale.axis;if(r){e=e||t._parsed;for(const i of e){const s=i._stacks;if(!s||s[r]===void 0||s[r][n]===void 0)return;delete s[r][n],s[r]._visualValues!==void 0&&s[r]._visualValues[n]!==void 0&&delete s[r]._visualValues[n]}}}const tE=t=>t==="reset"||t==="none",sH=(t,e)=>e?t:Object.assign({},t),K0t=(t,e,n)=>t&&!e.hidden&&e._stacked&&{keys:j0e(n,!0),values:null};class Ea{constructor(e,n){this.chart=e,this._ctx=e.ctx,this.index=n,this._cachedDataOpts={},this._cachedMeta=this.getMeta(),this._type=this._cachedMeta.type,this.options=void 0,this._parsing=!1,this._data=void 0,this._objectData=void 0,this._sharedOptions=void 0,this._drawStart=void 0,this._drawCount=void 0,this.enableOptionSharing=!1,this.supportsDecimation=!1,this.$context=void 0,this._syncList=[],this.datasetElementType=new.target.datasetElementType,this.dataElementType=new.target.dataElementType,this.initialize()}initialize(){const e=this._cachedMeta;this.configure(),this.linkScales(),e._stacked=J7(e.vScale,e),this.addElements(),this.options.fill&&!this.chart.isPluginEnabled("filler")&&console.warn("Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options")}updateIndex(e){this.index!==e&&i1(this._cachedMeta),this.index=e}linkScales(){const e=this.chart,n=this._cachedMeta,r=this.getDataset(),i=(f,h,d,p)=>f==="x"?h:f==="r"?p:d,s=n.xAxisID=Mt(r.xAxisID,eE(e,"x")),o=n.yAxisID=Mt(r.yAxisID,eE(e,"y")),a=n.rAxisID=Mt(r.rAxisID,eE(e,"r")),l=n.indexAxis,c=n.iAxisID=i(l,s,o,a),u=n.vAxisID=i(l,o,s,a);n.xScale=this.getScaleForId(s),n.yScale=this.getScaleForId(o),n.rScale=this.getScaleForId(a),n.iScale=this.getScaleForId(c),n.vScale=this.getScaleForId(u)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(e){return this.chart.scales[e]}_getOtherScale(e){const n=this._cachedMeta;return e===n.iScale?n.vScale:n.iScale}reset(){this._update("reset")}_destroy(){const e=this._cachedMeta;this._data&&zX(this._data,this),e._stacked&&i1(e)}_dataCheck(){const e=this.getDataset(),n=e.data||(e.data=[]),r=this._data;if(Zt(n)){const i=this._cachedMeta;this._data=q0t(n,i)}else if(r!==n){if(r){zX(r,this);const i=this._cachedMeta;i1(i),i._parsed=[]}n&&Object.isExtensible(n)&&Ndt(n,this),this._syncList=[],this._data=n}}addElements(){const e=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(e.dataset=new this.datasetElementType)}buildOrUpdateElements(e){const n=this._cachedMeta,r=this.getDataset();let i=!1;this._dataCheck();const s=n._stacked;n._stacked=J7(n.vScale,n),n.stack!==r.stack&&(i=!0,i1(n),n.stack=r.stack),this._resyncElements(e),(i||s!==n._stacked)&&(iH(this,n._parsed),n._stacked=J7(n.vScale,n))}configure(){const e=this.chart.config,n=e.datasetScopeKeys(this._type),r=e.getOptionScopes(this.getDataset(),n,!0);this.options=e.createResolver(r,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(e,n){const{_cachedMeta:r,_data:i}=this,{iScale:s,_stacked:o}=r,a=s.axis;let l=e===0&&n===i.length?!0:r._sorted,c=e>0&&r._parsed[e-1],u,f,h;if(this._parsing===!1)r._parsed=i,r._sorted=!0,h=i;else{Xn(i[e])?h=this.parseArrayData(r,i,e,n):Zt(i[e])?h=this.parseObjectData(r,i,e,n):h=this.parsePrimitiveData(r,i,e,n);const d=()=>f[a]===null||c&&f[a]<c[a];for(u=0;u<n;++u)r._parsed[u+e]=f=h[u],l&&(d()&&(l=!1),c=f);r._sorted=l}o&&iH(this,h)}parsePrimitiveData(e,n,r,i){const{iScale:s,vScale:o}=e,a=s.axis,l=o.axis,c=s.getLabels(),u=s===o,f=new Array(i);let h,d,p;for(h=0,d=i;h<d;++h)p=h+r,f[h]={[a]:u||s.parse(c[p],p),[l]:o.parse(n[p],p)};return f}parseArrayData(e,n,r,i){const{xScale:s,yScale:o}=e,a=new Array(i);let l,c,u,f;for(l=0,c=i;l<c;++l)u=l+r,f=n[u],a[l]={x:s.parse(f[0],u),y:o.parse(f[1],u)};return a}parseObjectData(e,n,r,i){const{xScale:s,yScale:o}=e,{xAxisKey:a="x",yAxisKey:l="y"}=this._parsing,c=new Array(i);let u,f,h,d;for(u=0,f=i;u<f;++u)h=u+r,d=n[h],c[u]={x:s.parse(If(d,a),h),y:o.parse(If(d,l),h)};return c}getParsed(e){return this._cachedMeta._parsed[e]}getDataElement(e){return this._cachedMeta.data[e]}applyStack(e,n,r){const i=this.chart,s=this._cachedMeta,o=n[e.axis],a={keys:j0e(i,!0),values:n._stacks[e.axis]._visualValues};return nH(a,o,s.index,{mode:r})}updateRangeFromParsed(e,n,r,i){const s=r[n.axis];let o=s===null?NaN:s;const a=i&&r._stacks[n.axis];i&&a&&(i.values=a,o=nH(i,s,this._cachedMeta.index)),e.min=Math.min(e.min,o),e.max=Math.max(e.max,o)}getMinMax(e,n){const r=this._cachedMeta,i=r._parsed,s=r._sorted&&e===r.iScale,o=i.length,a=this._getOtherScale(e),l=K0t(n,r,this.chart),c={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:u,max:f}=H0t(a);let h,d;function p(){d=i[h];const g=d[a.axis];return!wr(d[e.axis])||u>g||f<g}for(h=0;h<o&&!(!p()&&(this.updateRangeFromParsed(c,e,d,l),s));++h);if(s){for(h=o-1;h>=0;--h)if(!p()){this.updateRangeFromParsed(c,e,d,l);break}}return c}getAllParsedValues(e){const n=this._cachedMeta._parsed,r=[];let i,s,o;for(i=0,s=n.length;i<s;++i)o=n[i][e.axis],wr(o)&&r.push(o);return r}getMaxOverflow(){return!1}getLabelAndValue(e){const n=this._cachedMeta,r=n.iScale,i=n.vScale,s=this.getParsed(e);return{label:r?""+r.getLabelForValue(s[r.axis]):"",value:i?""+i.getLabelForValue(s[i.axis]):""}}_update(e){const n=this._cachedMeta;this.update(e||"default"),n._clip=U0t(Mt(this.options.clip,V0t(n.xScale,n.yScale,this.getMaxOverflow())))}update(e){}draw(){const e=this._ctx,n=this.chart,r=this._cachedMeta,i=r.data||[],s=n.chartArea,o=[],a=this._drawStart||0,l=this._drawCount||i.length-a,c=this.options.drawActiveElementsOnTop;let u;for(r.dataset&&r.dataset.draw(e,s,a,l),u=a;u<a+l;++u){const f=i[u];f.hidden||(f.active&&c?o.push(f):f.draw(e,s))}for(u=0;u<o.length;++u)o[u].draw(e,s)}getStyle(e,n){const r=n?"active":"default";return e===void 0&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(r):this.resolveDataElementOptions(e||0,r)}getContext(e,n,r){const i=this.getDataset();let s;if(e>=0&&e<this._cachedMeta.data.length){const o=this._cachedMeta.data[e];s=o.$context||(o.$context=G0t(this.getContext(),e,o)),s.parsed=this.getParsed(e),s.raw=i.data[e],s.index=s.dataIndex=e}else s=this.$context||(this.$context=Y0t(this.chart.getContext(),this.index)),s.dataset=i,s.index=s.datasetIndex=this.index;return s.active=!!n,s.mode=r,s}resolveDatasetElementOptions(e){return this._resolveElementOptions(this.datasetElementType.id,e)}resolveDataElementOptions(e,n){return this._resolveElementOptions(this.dataElementType.id,n,e)}_resolveElementOptions(e,n="default",r){const i=n==="active",s=this._cachedDataOpts,o=e+"-"+n,a=s[o],l=this.enableOptionSharing&&VO(r);if(a)return sH(a,l);const c=this.chart.config,u=c.datasetElementScopeKeys(this._type,e),f=i?[`${e}Hover`,"hover",e,""]:[e,""],h=c.getOptionScopes(this.getDataset(),u),d=Object.keys(rr.elements[e]),p=()=>this.getContext(r,i,n),g=c.resolveNamedOptions(h,d,p,f);return g.$shared&&(g.$shared=l,s[o]=Object.freeze(sH(g,l))),g}_resolveAnimations(e,n,r){const i=this.chart,s=this._cachedDataOpts,o=`animation-${n}`,a=s[o];if(a)return a;let l;if(i.options.animation!==!1){const u=this.chart.config,f=u.datasetAnimationScopeKeys(this._type,n),h=u.getOptionScopes(this.getDataset(),f);l=u.createResolver(h,this.getContext(e,r,n))}const c=new Q0e(i,l&&l.animations);return l&&l._cacheable&&(s[o]=Object.freeze(c)),c}getSharedOptions(e){if(e.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},e))}includeOptions(e,n){return!n||tE(e)||this.chart._animationsDisabled}_getSharedOptions(e,n){const r=this.resolveDataElementOptions(e,n),i=this._sharedOptions,s=this.getSharedOptions(r),o=this.includeOptions(n,s)||s!==i;return this.updateSharedOptions(s,n,r),{sharedOptions:s,includeOptions:o}}updateElement(e,n,r,i){tE(i)?Object.assign(e,r):this._resolveAnimations(n,i).update(e,r)}updateSharedOptions(e,n,r){e&&!tE(n)&&this._resolveAnimations(void 0,n).update(e,r)}_setStyle(e,n,r,i){e.active=i;const s=this.getStyle(n,i);this._resolveAnimations(n,r,i).update(e,{options:!i&&this.getSharedOptions(s)||s})}removeHoverStyle(e,n,r){this._setStyle(e,r,"active",!1)}setHoverStyle(e,n,r){this._setStyle(e,r,"active",!0)}_removeDatasetHoverStyle(){const e=this._cachedMeta.dataset;e&&this._setStyle(e,void 0,"active",!1)}_setDatasetHoverStyle(){const e=this._cachedMeta.dataset;e&&this._setStyle(e,void 0,"active",!0)}_resyncElements(e){const n=this._data,r=this._cachedMeta.data;for(const[a,l,c]of this._syncList)this[a](l,c);this._syncList=[];const i=r.length,s=n.length,o=Math.min(s,i);o&&this.parse(0,o),s>i?this._insertElements(i,s-i,e):s<i&&this._removeElements(s,i-s)}_insertElements(e,n,r=!0){const i=this._cachedMeta,s=i.data,o=e+n;let a;const l=c=>{for(c.length+=n,a=c.length-1;a>=o;a--)c[a]=c[a-n]};for(l(s),a=e;a<o;++a)s[a]=new this.dataElementType;this._parsing&&l(i._parsed),this.parse(e,n),r&&this.updateElements(s,e,n,"reset")}updateElements(e,n,r,i){}_removeElements(e,n){const r=this._cachedMeta;if(this._parsing){const i=r._parsed.splice(e,n);r._stacked&&i1(r,i)}r.data.splice(e,n)}_sync(e){if(this._parsing)this._syncList.push(e);else{const[n,r,i]=e;this[n](r,i)}this.chart._dataChanges.push([this.index,...e])}_onDataPush(){const e=arguments.length;this._sync(["_insertElements",this.getDataset().data.length-e,e])}_onDataPop(){this._sync(["_removeElements",this._cachedMeta.data.length-1,1])}_onDataShift(){this._sync(["_removeElements",0,1])}_onDataSplice(e,n){n&&this._sync(["_removeElements",e,n]);const r=arguments.length-2;r&&this._sync(["_insertElements",e,r])}_onDataUnshift(){this._sync(["_insertElements",0,arguments.length])}}Le(Ea,"defaults",{}),Le(Ea,"datasetElementType",null),Le(Ea,"dataElementType",null);function J0t(t,e){if(!t._cache.$bar){const n=t.getMatchingVisibleMetas(e);let r=[];for(let i=0,s=n.length;i<s;i++)r=r.concat(n[i].controller.getAllParsedValues(t));t._cache.$bar=y0e(r.sort((i,s)=>i-s))}return t._cache.$bar}function ept(t){const e=t.iScale,n=J0t(e,t.type);let r=e._length,i,s,o,a;const l=()=>{o===32767||o===-32768||(VO(a)&&(r=Math.min(r,Math.abs(o-a)||r)),a=o)};for(i=0,s=n.length;i<s;++i)o=e.getPixelForValue(n[i]),l();for(a=void 0,i=0,s=e.ticks.length;i<s;++i)o=e.getPixelForTick(i),l();return r}function tpt(t,e,n,r){const i=n.barThickness;let s,o;return ln(i)?(s=e.min*n.categoryPercentage,o=n.barPercentage):(s=i*r,o=1),{chunk:s/r,ratio:o,start:e.pixels[t]-s/2}}function npt(t,e,n,r){const i=e.pixels,s=i[t];let o=t>0?i[t-1]:null,a=t<i.length-1?i[t+1]:null;const l=n.categoryPercentage;o===null&&(o=s-(a===null?e.end-e.start:a-s)),a===null&&(a=s+s-o);const c=s-(s-Math.min(o,a))/2*l;return{chunk:Math.abs(a-o)/2*l/r,ratio:n.barPercentage,start:c}}function rpt(t,e,n,r){const i=n.parse(t[0],r),s=n.parse(t[1],r),o=Math.min(i,s),a=Math.max(i,s);let l=o,c=a;Math.abs(o)>Math.abs(a)&&(l=a,c=o),e[n.axis]=c,e._custom={barStart:l,barEnd:c,start:i,end:s,min:o,max:a}}function B0e(t,e,n,r){return Xn(t)?rpt(t,e,n,r):e[n.axis]=n.parse(t,r),e}function oH(t,e,n,r){const i=t.iScale,s=t.vScale,o=i.getLabels(),a=i===s,l=[];let c,u,f,h;for(c=n,u=n+r;c<u;++c)h=e[c],f={},f[i.axis]=a||i.parse(o[c],c),l.push(B0e(h,f,s,c));return l}function nE(t){return t&&t.barStart!==void 0&&t.barEnd!==void 0}function ipt(t,e,n){return t!==0?kl(t):(e.isHorizontal()?1:-1)*(e.min>=n?1:-1)}function spt(t){let e,n,r,i,s;return t.horizontal?(e=t.base>t.x,n="left",r="right"):(e=t.base<t.y,n="bottom",r="top"),e?(i="end",s="start"):(i="start",s="end"),{start:n,end:r,reverse:e,top:i,bottom:s}}function opt(t,e,n,r){let i=e.borderSkipped;const s={};if(!i){t.borderSkipped=s;return}if(i===!0){t.borderSkipped={top:!0,right:!0,bottom:!0,left:!0};return}const{start:o,end:a,reverse:l,top:c,bottom:u}=spt(t);i==="middle"&&n&&(t.enableBorderRadius=!0,(n._top||0)===r?i=c:(n._bottom||0)===r?i=u:(s[aH(u,o,a,l)]=!0,i=c)),s[aH(i,o,a,l)]=!0,t.borderSkipped=s}function aH(t,e,n,r){return r?(t=apt(t,e,n),t=lH(t,n,e)):t=lH(t,e,n),t}function apt(t,e,n){return t===e?n:t===n?e:t}function lH(t,e,n){return t==="start"?e:t==="end"?n:t}function lpt(t,{inflateAmount:e},n){t.inflateAmount=e==="auto"?n===1?.33:0:e}class s2 extends Ea{parsePrimitiveData(e,n,r,i){return oH(e,n,r,i)}parseArrayData(e,n,r,i){return oH(e,n,r,i)}parseObjectData(e,n,r,i){const{iScale:s,vScale:o}=e,{xAxisKey:a="x",yAxisKey:l="y"}=this._parsing,c=s.axis==="x"?a:l,u=o.axis==="x"?a:l,f=[];let h,d,p,g;for(h=r,d=r+i;h<d;++h)g=n[h],p={},p[s.axis]=s.parse(If(g,c),h),f.push(B0e(If(g,u),p,o,h));return f}updateRangeFromParsed(e,n,r,i){super.updateRangeFromParsed(e,n,r,i);const s=r._custom;s&&n===this._cachedMeta.vScale&&(e.min=Math.min(e.min,s.min),e.max=Math.max(e.max,s.max))}getMaxOverflow(){return 0}getLabelAndValue(e){const n=this._cachedMeta,{iScale:r,vScale:i}=n,s=this.getParsed(e),o=s._custom,a=nE(o)?"["+o.start+", "+o.end+"]":""+i.getLabelForValue(s[i.axis]);return{label:""+r.getLabelForValue(s[r.axis]),value:a}}initialize(){this.enableOptionSharing=!0,super.initialize();const e=this._cachedMeta;e.stack=this.getDataset().stack}update(e){const n=this._cachedMeta;this.updateElements(n.data,0,n.data.length,e)}updateElements(e,n,r,i){const s=i==="reset",{index:o,_cachedMeta:{vScale:a}}=this,l=a.getBasePixel(),c=a.isHorizontal(),u=this._getRuler(),{sharedOptions:f,includeOptions:h}=this._getSharedOptions(n,i);for(let d=n;d<n+r;d++){const p=this.getParsed(d),g=s||ln(p[a.axis])?{base:l,head:l}:this._calculateBarValuePixels(d),m=this._calculateBarIndexPixels(d,u),v=(p._stacks||{})[a.axis],y={horizontal:c,base:g.base,enableBorderRadius:!v||nE(p._custom)||o===v._top||o===v._bottom,x:c?g.head:m.center,y:c?m.center:g.head,height:c?m.size:Math.abs(g.size),width:c?Math.abs(g.size):m.size};h&&(y.options=f||this.resolveDataElementOptions(d,e[d].active?"active":i));const b=y.options||e[d].options;opt(y,b,v,o),lpt(y,b,u.ratio),this.updateElement(e[d],d,y,i)}}_getStacks(e,n){const{iScale:r}=this._cachedMeta,i=r.getMatchingVisibleMetas(this._type).filter(u=>u.controller.options.grouped),s=r.options.stacked,o=[],a=this._cachedMeta.controller.getParsed(n),l=a&&a[r.axis],c=u=>{const f=u._parsed.find(d=>d[r.axis]===l),h=f&&f[u.vScale.axis];if(ln(h)||isNaN(h))return!0};for(const u of i)if(!(n!==void 0&&c(u))&&((s===!1||o.indexOf(u.stack)===-1||s===void 0&&u.stack===void 0)&&o.push(u.stack),u.index===e))break;return o.length||o.push(void 0),o}_getStackCount(e){return this._getStacks(void 0,e).length}_getStackIndex(e,n,r){const i=this._getStacks(e,r),s=n!==void 0?i.indexOf(n):-1;return s===-1?i.length-1:s}_getRuler(){const e=this.options,n=this._cachedMeta,r=n.iScale,i=[];let s,o;for(s=0,o=n.data.length;s<o;++s)i.push(r.getPixelForValue(this.getParsed(s)[r.axis],s));const a=e.barThickness;return{min:a||ept(n),pixels:i,start:r._startPixel,end:r._endPixel,stackCount:this._getStackCount(),scale:r,grouped:e.grouped,ratio:a?1:e.categoryPercentage*e.barPercentage}}_calculateBarValuePixels(e){const{_cachedMeta:{vScale:n,_stacked:r,index:i},options:{base:s,minBarLength:o}}=this,a=s||0,l=this.getParsed(e),c=l._custom,u=nE(c);let f=l[n.axis],h=0,d=r?this.applyStack(n,l,r):f,p,g;d!==f&&(h=d-f,d=f),u&&(f=c.barStart,d=c.barEnd-c.barStart,f!==0&&kl(f)!==kl(c.barEnd)&&(h=0),h+=f);const m=!ln(s)&&!u?s:h;let v=n.getPixelForValue(m);if(this.chart.getDataVisibility(e)?p=n.getPixelForValue(h+d):p=v,g=p-v,Math.abs(g)<o){g=ipt(g,n,a)*o,f===a&&(v-=g/2);const y=n.getPixelForDecimal(0),b=n.getPixelForDecimal(1),S=Math.min(y,b),k=Math.max(y,b);v=Math.max(Math.min(v,k),S),p=v+g,r&&!u&&(l._stacks[n.axis]._visualValues[i]=n.getValueForPixel(p)-n.getValueForPixel(v))}if(v===n.getPixelForValue(a)){const y=kl(g)*n.getLineWidthForValue(a)/2;v+=y,g-=y}return{size:g,base:v,head:p,center:p+g/2}}_calculateBarIndexPixels(e,n){const r=n.scale,i=this.options,s=i.skipNull,o=Mt(i.maxBarThickness,1/0);let a,l;if(n.grouped){const c=s?this._getStackCount(e):n.stackCount,u=i.barThickness==="flex"?npt(e,n,i,c):tpt(e,n,i,c),f=this._getStackIndex(this.index,this._cachedMeta.stack,s?e:void 0);a=u.start+u.chunk*f+u.chunk/2,l=Math.min(o,u.chunk*u.ratio)}else a=r.getPixelForValue(this.getParsed(e)[r.axis],e),l=Math.min(o,n.min*n.ratio);return{base:a-l/2,head:a+l/2,center:a,size:l}}draw(){const e=this._cachedMeta,n=e.vScale,r=e.data,i=r.length;let s=0;for(;s<i;++s)this.getParsed(s)[n.axis]!==null&&!r[s].hidden&&r[s].draw(this._ctx)}}Le(s2,"id","bar"),Le(s2,"defaults",{datasetElementType:!1,dataElementType:"bar",categoryPercentage:.8,barPercentage:.9,grouped:!0,animations:{numbers:{type:"number",properties:["x","y","base","width","height"]}}}),Le(s2,"overrides",{scales:{_index_:{type:"category",offset:!0,grid:{offset:!0}},_value_:{type:"linear",beginAtZero:!0}}});class o2 extends Ea{initialize(){this.enableOptionSharing=!0,super.initialize()}parsePrimitiveData(e,n,r,i){const s=super.parsePrimitiveData(e,n,r,i);for(let o=0;o<s.length;o++)s[o]._custom=this.resolveDataElementOptions(o+r).radius;return s}parseArrayData(e,n,r,i){const s=super.parseArrayData(e,n,r,i);for(let o=0;o<s.length;o++){const a=n[r+o];s[o]._custom=Mt(a[2],this.resolveDataElementOptions(o+r).radius)}return s}parseObjectData(e,n,r,i){const s=super.parseObjectData(e,n,r,i);for(let o=0;o<s.length;o++){const a=n[r+o];s[o]._custom=Mt(a&&a.r&&+a.r,this.resolveDataElementOptions(o+r).radius)}return s}getMaxOverflow(){const e=this._cachedMeta.data;let n=0;for(let r=e.length-1;r>=0;--r)n=Math.max(n,e[r].size(this.resolveDataElementOptions(r))/2);return n>0&&n}getLabelAndValue(e){const n=this._cachedMeta,r=this.chart.data.labels||[],{xScale:i,yScale:s}=n,o=this.getParsed(e),a=i.getLabelForValue(o.x),l=s.getLabelForValue(o.y),c=o._custom;return{label:r[e]||"",value:"("+a+", "+l+(c?", "+c:"")+")"}}update(e){const n=this._cachedMeta.data;this.updateElements(n,0,n.length,e)}updateElements(e,n,r,i){const s=i==="reset",{iScale:o,vScale:a}=this._cachedMeta,{sharedOptions:l,includeOptions:c}=this._getSharedOptions(n,i),u=o.axis,f=a.axis;for(let h=n;h<n+r;h++){const d=e[h],p=!s&&this.getParsed(h),g={},m=g[u]=s?o.getPixelForDecimal(.5):o.getPixelForValue(p[u]),v=g[f]=s?a.getBasePixel():a.getPixelForValue(p[f]);g.skip=isNaN(m)||isNaN(v),c&&(g.options=l||this.resolveDataElementOptions(h,d.active?"active":i),s&&(g.options.radius=0)),this.updateElement(d,h,g,i)}}resolveDataElementOptions(e,n){const r=this.getParsed(e);let i=super.resolveDataElementOptions(e,n);i.$shared&&(i=Object.assign({},i,{$shared:!1}));const s=i.radius;return n!=="active"&&(i.radius=0),i.radius+=Mt(r&&r._custom,s),i}}Le(o2,"id","bubble"),Le(o2,"defaults",{datasetElementType:!1,dataElementType:"point",animations:{numbers:{type:"number",properties:["x","y","borderWidth","radius"]}}}),Le(o2,"overrides",{scales:{x:{type:"linear"},y:{type:"linear"}}});function cpt(t,e,n){let r=1,i=1,s=0,o=0;if(e<Yn){const a=t,l=a+e,c=Math.cos(a),u=Math.sin(a),f=Math.cos(l),h=Math.sin(l),d=(b,S,k)=>UO(b,a,l,!0)?1:Math.max(S,S*n,k,k*n),p=(b,S,k)=>UO(b,a,l,!0)?-1:Math.min(S,S*n,k,k*n),g=d(0,c,f),m=d(Mr,u,h),v=p(Gn,c,f),y=p(Gn+Mr,u,h);r=(g-v)/2,i=(m-y)/2,s=-(g+v)/2,o=-(m+y)/2}return{ratioX:r,ratioY:i,offsetX:s,offsetY:o}}class ed extends Ea{constructor(e,n){super(e,n),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(e,n){const r=this.getDataset().data,i=this._cachedMeta;if(this._parsing===!1)i._parsed=r;else{let s=l=>+r[l];if(Zt(r[e])){const{key:l="value"}=this._parsing;s=c=>+If(r[c],l)}let o,a;for(o=e,a=e+n;o<a;++o)i._parsed[o]=s(o)}}_getRotation(){return wa(this.options.rotation-90)}_getCircumference(){return wa(this.options.circumference)}_getRotationExtents(){let e=Yn,n=-Yn;for(let r=0;r<this.chart.data.datasets.length;++r)if(this.chart.isDatasetVisible(r)&&this.chart.getDatasetMeta(r).type===this._type){const i=this.chart.getDatasetMeta(r).controller,s=i._getRotation(),o=i._getCircumference();e=Math.min(e,s),n=Math.max(n,s+o)}return{rotation:e,circumference:n-e}}update(e){const n=this.chart,{chartArea:r}=n,i=this._cachedMeta,s=i.data,o=this.getMaxBorderWidth()+this.getMaxOffset(s)+this.options.spacing,a=Math.max((Math.min(r.width,r.height)-o)/2,0),l=Math.min(Sdt(this.options.cutout,a),1),c=this._getRingWeight(this.index),{circumference:u,rotation:f}=this._getRotationExtents(),{ratioX:h,ratioY:d,offsetX:p,offsetY:g}=cpt(f,u,l),m=(r.width-o)/h,v=(r.height-o)/d,y=Math.max(Math.min(m,v)/2,0),b=p0e(this.options.radius,y),S=Math.max(b*l,0),k=(b-S)/this._getVisibleDatasetWeightTotal();this.offsetX=p*b,this.offsetY=g*b,i.total=this.calculateTotal(),this.outerRadius=b-k*this._getRingWeightOffset(this.index),this.innerRadius=Math.max(this.outerRadius-k*c,0),this.updateElements(s,0,s.length,e)}_circumference(e,n){const r=this.options,i=this._cachedMeta,s=this._getCircumference();return n&&r.animation.animateRotate||!this.chart.getDataVisibility(e)||i._parsed[e]===null||i.data[e].hidden?0:this.calculateCircumference(i._parsed[e]*s/Yn)}updateElements(e,n,r,i){const s=i==="reset",o=this.chart,a=o.chartArea,c=o.options.animation,u=(a.left+a.right)/2,f=(a.top+a.bottom)/2,h=s&&c.animateScale,d=h?0:this.innerRadius,p=h?0:this.outerRadius,{sharedOptions:g,includeOptions:m}=this._getSharedOptions(n,i);let v=this._getRotation(),y;for(y=0;y<n;++y)v+=this._circumference(y,s);for(y=n;y<n+r;++y){const b=this._circumference(y,s),S=e[y],k={x:u+this.offsetX,y:f+this.offsetY,startAngle:v,endAngle:v+b,circumference:b,outerRadius:p,innerRadius:d};m&&(k.options=g||this.resolveDataElementOptions(y,S.active?"active":i)),v+=b,this.updateElement(S,y,k,i)}}calculateTotal(){const e=this._cachedMeta,n=e.data;let r=0,i;for(i=0;i<n.length;i++){const s=e._parsed[i];s!==null&&!isNaN(s)&&this.chart.getDataVisibility(i)&&!n[i].hidden&&(r+=Math.abs(s))}return r}calculateCircumference(e){const n=this._cachedMeta.total;return n>0&&!isNaN(e)?Yn*(Math.abs(e)/n):0}getLabelAndValue(e){const n=this._cachedMeta,r=this.chart,i=r.data.labels||[],s=ab(n._parsed[e],r.options.locale);return{label:i[e]||"",value:s}}getMaxBorderWidth(e){let n=0;const r=this.chart;let i,s,o,a,l;if(!e){for(i=0,s=r.data.datasets.length;i<s;++i)if(r.isDatasetVisible(i)){o=r.getDatasetMeta(i),e=o.data,a=o.controller;break}}if(!e)return 0;for(i=0,s=e.length;i<s;++i)l=a.resolveDataElementOptions(i),l.borderAlign!=="inner"&&(n=Math.max(n,l.borderWidth||0,l.hoverBorderWidth||0));return n}getMaxOffset(e){let n=0;for(let r=0,i=e.length;r<i;++r){const s=this.resolveDataElementOptions(r);n=Math.max(n,s.offset||0,s.hoverOffset||0)}return n}_getRingWeightOffset(e){let n=0;for(let r=0;r<e;++r)this.chart.isDatasetVisible(r)&&(n+=this._getRingWeight(r));return n}_getRingWeight(e){return Math.max(Mt(this.chart.data.datasets[e].weight,1),0)}_getVisibleDatasetWeightTotal(){return this._getRingWeightOffset(this.chart.data.datasets.length)||1}}Le(ed,"id","doughnut"),Le(ed,"defaults",{datasetElementType:!1,dataElementType:"arc",animation:{animateRotate:!0,animateScale:!1},animations:{numbers:{type:"number",properties:["circumference","endAngle","innerRadius","outerRadius","startAngle","x","y","offset","borderWidth","spacing"]}},cutout:"50%",rotation:0,circumference:360,radius:"100%",spacing:0,indexAxis:"r"}),Le(ed,"descriptors",{_scriptable:e=>e!=="spacing",_indexable:e=>e!=="spacing"&&!e.startsWith("borderDash")&&!e.startsWith("hoverBorderDash")}),Le(ed,"overrides",{aspectRatio:1,plugins:{legend:{labels:{generateLabels(e){const n=e.data;if(n.labels.length&&n.datasets.length){const{labels:{pointStyle:r,color:i}}=e.legend.options;return n.labels.map((s,o)=>{const l=e.getDatasetMeta(0).controller.getStyle(o);return{text:s,fillStyle:l.backgroundColor,strokeStyle:l.borderColor,fontColor:i,lineWidth:l.borderWidth,pointStyle:r,hidden:!e.getDataVisibility(o),index:o}})}return[]}},onClick(e,n,r){r.chart.toggleDataVisibility(n.index),r.chart.update()}}}});class a2 extends Ea{initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(e){const n=this._cachedMeta,{dataset:r,data:i=[],_dataset:s}=n,o=this.chart._animationsDisabled;let{start:a,count:l}=w0e(n,i,o);this._drawStart=a,this._drawCount=l,S0e(n)&&(a=0,l=i.length),r._chart=this.chart,r._datasetIndex=this.index,r._decimated=!!s._decimated,r.points=i;const c=this.resolveDatasetElementOptions(e);this.options.showLine||(c.borderWidth=0),c.segment=this.options.segment,this.updateElement(r,void 0,{animated:!o,options:c},e),this.updateElements(i,a,l,e)}updateElements(e,n,r,i){const s=i==="reset",{iScale:o,vScale:a,_stacked:l,_dataset:c}=this._cachedMeta,{sharedOptions:u,includeOptions:f}=this._getSharedOptions(n,i),h=o.axis,d=a.axis,{spanGaps:p,segment:g}=this.options,m=_m(p)?p:Number.POSITIVE_INFINITY,v=this.chart._animationsDisabled||s||i==="none",y=n+r,b=e.length;let S=n>0&&this.getParsed(n-1);for(let k=0;k<b;++k){const E=e[k],T=v?E:{};if(k<n||k>=y){T.skip=!0;continue}const C=this.getParsed(k),A=ln(C[d]),R=T[h]=o.getPixelForValue(C[h],k),Q=T[d]=s||A?a.getBasePixel():a.getPixelForValue(l?this.applyStack(a,C,l):C[d],k);T.skip=isNaN(R)||isNaN(Q)||A,T.stop=k>0&&Math.abs(C[h]-S[h])>m,g&&(T.parsed=C,T.raw=c.data[k]),f&&(T.options=u||this.resolveDataElementOptions(k,E.active?"active":i)),v||this.updateElement(E,k,T,i),S=C}}getMaxOverflow(){const e=this._cachedMeta,n=e.dataset,r=n.options&&n.options.borderWidth||0,i=e.data||[];if(!i.length)return r;const s=i[0].size(this.resolveDataElementOptions(0)),o=i[i.length-1].size(this.resolveDataElementOptions(i.length-1));return Math.max(r,s,o)/2}draw(){const e=this._cachedMeta;e.dataset.updateControlPoints(this.chart.chartArea,e.iScale.axis),super.draw()}}Le(a2,"id","line"),Le(a2,"defaults",{datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1}),Le(a2,"overrides",{scales:{_index_:{type:"category"},_value_:{type:"linear"}}});class xv extends Ea{constructor(e,n){super(e,n),this.innerRadius=void 0,this.outerRadius=void 0}getLabelAndValue(e){const n=this._cachedMeta,r=this.chart,i=r.data.labels||[],s=ab(n._parsed[e].r,r.options.locale);return{label:i[e]||"",value:s}}parseObjectData(e,n,r,i){return R0e.bind(this)(e,n,r,i)}update(e){const n=this._cachedMeta.data;this._updateRadius(),this.updateElements(n,0,n.length,e)}getMinMax(){const e=this._cachedMeta,n={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};return e.data.forEach((r,i)=>{const s=this.getParsed(i).r;!isNaN(s)&&this.chart.getDataVisibility(i)&&(s<n.min&&(n.min=s),s>n.max&&(n.max=s))}),n}_updateRadius(){const e=this.chart,n=e.chartArea,r=e.options,i=Math.min(n.right-n.left,n.bottom-n.top),s=Math.max(i/2,0),o=Math.max(r.cutoutPercentage?s/100*r.cutoutPercentage:1,0),a=(s-o)/e.getVisibleDatasetCount();this.outerRadius=s-a*this.index,this.innerRadius=this.outerRadius-a}updateElements(e,n,r,i){const s=i==="reset",o=this.chart,l=o.options.animation,c=this._cachedMeta.rScale,u=c.xCenter,f=c.yCenter,h=c.getIndexAngle(0)-.5*Gn;let d=h,p;const g=360/this.countVisibleElements();for(p=0;p<n;++p)d+=this._computeAngle(p,i,g);for(p=n;p<n+r;p++){const m=e[p];let v=d,y=d+this._computeAngle(p,i,g),b=o.getDataVisibility(p)?c.getDistanceFromCenterForValue(this.getParsed(p).r):0;d=y,s&&(l.animateScale&&(b=0),l.animateRotate&&(v=y=h));const S={x:u,y:f,innerRadius:0,outerRadius:b,startAngle:v,endAngle:y,options:this.resolveDataElementOptions(p,m.active?"active":i)};this.updateElement(m,p,S,i)}}countVisibleElements(){const e=this._cachedMeta;let n=0;return e.data.forEach((r,i)=>{!isNaN(this.getParsed(i).r)&&this.chart.getDataVisibility(i)&&n++}),n}_computeAngle(e,n,r){return this.chart.getDataVisibility(e)?wa(this.resolveDataElementOptions(e,n).angle||r):0}}Le(xv,"id","polarArea"),Le(xv,"defaults",{dataElementType:"arc",animation:{animateRotate:!0,animateScale:!0},animations:{numbers:{type:"number",properties:["x","y","startAngle","endAngle","innerRadius","outerRadius"]}},indexAxis:"r",startAngle:0}),Le(xv,"overrides",{aspectRatio:1,plugins:{legend:{labels:{generateLabels(e){const n=e.data;if(n.labels.length&&n.datasets.length){const{labels:{pointStyle:r,color:i}}=e.legend.options;return n.labels.map((s,o)=>{const l=e.getDatasetMeta(0).controller.getStyle(o);return{text:s,fillStyle:l.backgroundColor,strokeStyle:l.borderColor,fontColor:i,lineWidth:l.borderWidth,pointStyle:r,hidden:!e.getDataVisibility(o),index:o}})}return[]}},onClick(e,n,r){r.chart.toggleDataVisibility(n.index),r.chart.update()}}},scales:{r:{type:"radialLinear",angleLines:{display:!1},beginAtZero:!0,grid:{circular:!0},pointLabels:{display:!1},startAngle:0}}});class zA extends ed{}Le(zA,"id","pie"),Le(zA,"defaults",{cutout:0,rotation:0,circumference:360,radius:"100%"});class l2 extends Ea{getLabelAndValue(e){const n=this._cachedMeta.vScale,r=this.getParsed(e);return{label:n.getLabels()[e],value:""+n.getLabelForValue(r[n.axis])}}parseObjectData(e,n,r,i){return R0e.bind(this)(e,n,r,i)}update(e){const n=this._cachedMeta,r=n.dataset,i=n.data||[],s=n.iScale.getLabels();if(r.points=i,e!=="resize"){const o=this.resolveDatasetElementOptions(e);this.options.showLine||(o.borderWidth=0);const a={_loop:!0,_fullLoop:s.length===i.length,options:o};this.updateElement(r,void 0,a,e)}this.updateElements(i,0,i.length,e)}updateElements(e,n,r,i){const s=this._cachedMeta.rScale,o=i==="reset";for(let a=n;a<n+r;a++){const l=e[a],c=this.resolveDataElementOptions(a,l.active?"active":i),u=s.getPointPositionForValue(a,this.getParsed(a).r),f=o?s.xCenter:u.x,h=o?s.yCenter:u.y,d={x:f,y:h,angle:u.angle,skip:isNaN(f)||isNaN(h),options:c};this.updateElement(l,a,d,i)}}}Le(l2,"id","radar"),Le(l2,"defaults",{datasetElementType:"line",dataElementType:"point",indexAxis:"r",showLine:!0,elements:{line:{fill:"start"}}}),Le(l2,"overrides",{aspectRatio:1,scales:{r:{type:"radialLinear"}}});class c2 extends Ea{getLabelAndValue(e){const n=this._cachedMeta,r=this.chart.data.labels||[],{xScale:i,yScale:s}=n,o=this.getParsed(e),a=i.getLabelForValue(o.x),l=s.getLabelForValue(o.y);return{label:r[e]||"",value:"("+a+", "+l+")"}}update(e){const n=this._cachedMeta,{data:r=[]}=n,i=this.chart._animationsDisabled;let{start:s,count:o}=w0e(n,r,i);if(this._drawStart=s,this._drawCount=o,S0e(n)&&(s=0,o=r.length),this.options.showLine){this.datasetElementType||this.addElements();const{dataset:a,_dataset:l}=n;a._chart=this.chart,a._datasetIndex=this.index,a._decimated=!!l._decimated,a.points=r;const c=this.resolveDatasetElementOptions(e);c.segment=this.options.segment,this.updateElement(a,void 0,{animated:!i,options:c},e)}else this.datasetElementType&&(delete n.dataset,this.datasetElementType=!1);this.updateElements(r,s,o,e)}addElements(){const{showLine:e}=this.options;!this.datasetElementType&&e&&(this.datasetElementType=this.chart.registry.getElement("line")),super.addElements()}updateElements(e,n,r,i){const s=i==="reset",{iScale:o,vScale:a,_stacked:l,_dataset:c}=this._cachedMeta,u=this.resolveDataElementOptions(n,i),f=this.getSharedOptions(u),h=this.includeOptions(i,f),d=o.axis,p=a.axis,{spanGaps:g,segment:m}=this.options,v=_m(g)?g:Number.POSITIVE_INFINITY,y=this.chart._animationsDisabled||s||i==="none";let b=n>0&&this.getParsed(n-1);for(let S=n;S<n+r;++S){const k=e[S],E=this.getParsed(S),T=y?k:{},C=ln(E[p]),A=T[d]=o.getPixelForValue(E[d],S),R=T[p]=s||C?a.getBasePixel():a.getPixelForValue(l?this.applyStack(a,E,l):E[p],S);T.skip=isNaN(A)||isNaN(R)||C,T.stop=S>0&&Math.abs(E[d]-b[d])>v,m&&(T.parsed=E,T.raw=c.data[S]),h&&(T.options=f||this.resolveDataElementOptions(S,k.active?"active":i)),y||this.updateElement(k,S,T,i),b=E}this.updateSharedOptions(f,i,u)}getMaxOverflow(){const e=this._cachedMeta,n=e.data||[];if(!this.options.showLine){let a=0;for(let l=n.length-1;l>=0;--l)a=Math.max(a,n[l].size(this.resolveDataElementOptions(l))/2);return a>0&&a}const r=e.dataset,i=r.options&&r.options.borderWidth||0;if(!n.length)return i;const s=n[0].size(this.resolveDataElementOptions(0)),o=n[n.length-1].size(this.resolveDataElementOptions(n.length-1));return Math.max(i,s,o)/2}}Le(c2,"id","scatter"),Le(c2,"defaults",{datasetElementType:!1,dataElementType:"point",showLine:!1,fill:!1}),Le(c2,"overrides",{interaction:{mode:"point"},scales:{x:{type:"linear"},y:{type:"linear"}}});var upt=Object.freeze({__proto__:null,BarController:s2,BubbleController:o2,DoughnutController:ed,LineController:a2,PieController:zA,PolarAreaController:xv,RadarController:l2,ScatterController:c2});function gh(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class mL{constructor(e){Le(this,"options");this.options=e||{}}static override(e){Object.assign(mL.prototype,e)}init(){}formats(){return gh()}parse(){return gh()}format(){return gh()}add(){return gh()}diff(){return gh()}startOf(){return gh()}endOf(){return gh()}}var fpt={_date:mL};function hpt(t,e,n,r){const{controller:i,data:s,_sorted:o}=t,a=i._cachedMeta.iScale;if(a&&e===a.axis&&e!=="r"&&o&&s.length){const l=a._reversePixels?Ddt:Rc;if(r){if(i._sharedOptions){const c=s[0],u=typeof c.getRange=="function"&&c.getRange(e);if(u){const f=l(s,e,n-u),h=l(s,e,n+u);return{lo:f.lo,hi:h.hi}}}}else return l(s,e,n)}return{lo:0,hi:s.length-1}}function lb(t,e,n,r,i){const s=t.getSortedVisibleDatasetMetas(),o=n[e];for(let a=0,l=s.length;a<l;++a){const{index:c,data:u}=s[a],{lo:f,hi:h}=hpt(s[a],e,o,i);for(let d=f;d<=h;++d){const p=u[d];p.skip||r(p,c,d)}}}function dpt(t){const e=t.indexOf("x")!==-1,n=t.indexOf("y")!==-1;return function(r,i){const s=e?Math.abs(r.x-i.x):0,o=n?Math.abs(r.y-i.y):0;return Math.sqrt(Math.pow(s,2)+Math.pow(o,2))}}function rE(t,e,n,r,i){const s=[];return!i&&!t.isPointInArea(e)||lb(t,n,e,function(a,l,c){!i&&!$c(a,t.chartArea,0)||a.inRange(e.x,e.y,r)&&s.push({element:a,datasetIndex:l,index:c})},!0),s}function ppt(t,e,n,r){let i=[];function s(o,a,l){const{startAngle:c,endAngle:u}=o.getProps(["startAngle","endAngle"],r),{angle:f}=v0e(o,{x:e.x,y:e.y});UO(f,c,u)&&i.push({element:o,datasetIndex:a,index:l})}return lb(t,n,e,s),i}function mpt(t,e,n,r,i,s){let o=[];const a=dpt(n);let l=Number.POSITIVE_INFINITY;function c(u,f,h){const d=u.inRange(e.x,e.y,i);if(r&&!d)return;const p=u.getCenterPoint(i);if(!(!!s||t.isPointInArea(p))&&!d)return;const m=a(e,p);m<l?(o=[{element:u,datasetIndex:f,index:h}],l=m):m===l&&o.push({element:u,datasetIndex:f,index:h})}return lb(t,n,e,c),o}function iE(t,e,n,r,i,s){return!s&&!t.isPointInArea(e)?[]:n==="r"&&!r?ppt(t,e,n,i):mpt(t,e,n,r,i,s)}function cH(t,e,n,r,i){const s=[],o=n==="x"?"inXRange":"inYRange";let a=!1;return lb(t,n,e,(l,c,u)=>{l[o]&&l[o](e[n],i)&&(s.push({element:l,datasetIndex:c,index:u}),a=a||l.inRange(e.x,e.y,i))}),r&&!a?[]:s}var gpt={evaluateInteractionItems:lb,modes:{index(t,e,n,r){const i=Rh(e,t),s=n.axis||"x",o=n.includeInvisible||!1,a=n.intersect?rE(t,i,s,r,o):iE(t,i,s,!1,r,o),l=[];return a.length?(t.getSortedVisibleDatasetMetas().forEach(c=>{const u=a[0].index,f=c.data[u];f&&!f.skip&&l.push({element:f,datasetIndex:c.index,index:u})}),l):[]},dataset(t,e,n,r){const i=Rh(e,t),s=n.axis||"xy",o=n.includeInvisible||!1;let a=n.intersect?rE(t,i,s,r,o):iE(t,i,s,!1,r,o);if(a.length>0){const l=a[0].datasetIndex,c=t.getDatasetMeta(l).data;a=[];for(let u=0;u<c.length;++u)a.push({element:c[u],datasetIndex:l,index:u})}return a},point(t,e,n,r){const i=Rh(e,t),s=n.axis||"xy",o=n.includeInvisible||!1;return rE(t,i,s,r,o)},nearest(t,e,n,r){const i=Rh(e,t),s=n.axis||"xy",o=n.includeInvisible||!1;return iE(t,i,s,n.intersect,r,o)},x(t,e,n,r){const i=Rh(e,t);return cH(t,i,"x",n.intersect,r)},y(t,e,n,r){const i=Rh(e,t);return cH(t,i,"y",n.intersect,r)}}};const z0e=["left","top","right","bottom"];function s1(t,e){return t.filter(n=>n.pos===e)}function uH(t,e){return t.filter(n=>z0e.indexOf(n.pos)===-1&&n.box.axis===e)}function o1(t,e){return t.sort((n,r)=>{const i=e?r:n,s=e?n:r;return i.weight===s.weight?i.index-s.index:i.weight-s.weight})}function vpt(t){const e=[];let n,r,i,s,o,a;for(n=0,r=(t||[]).length;n<r;++n)i=t[n],{position:s,options:{stack:o,stackWeight:a=1}}=i,e.push({index:n,box:i,pos:s,horizontal:i.isHorizontal(),weight:i.weight,stack:o&&s+o,stackWeight:a});return e}function Opt(t){const e={};for(const n of t){const{stack:r,pos:i,stackWeight:s}=n;if(!r||!z0e.includes(i))continue;const o=e[r]||(e[r]={count:0,placed:0,weight:0,size:0});o.count++,o.weight+=s}return e}function ypt(t,e){const n=Opt(t),{vBoxMaxWidth:r,hBoxMaxHeight:i}=e;let s,o,a;for(s=0,o=t.length;s<o;++s){a=t[s];const{fullSize:l}=a.box,c=n[a.stack],u=c&&a.stackWeight/c.weight;a.horizontal?(a.width=u?u*r:l&&e.availableWidth,a.height=i):(a.width=r,a.height=u?u*i:l&&e.availableHeight)}return n}function bpt(t){const e=vpt(t),n=o1(e.filter(c=>c.box.fullSize),!0),r=o1(s1(e,"left"),!0),i=o1(s1(e,"right")),s=o1(s1(e,"top"),!0),o=o1(s1(e,"bottom")),a=uH(e,"x"),l=uH(e,"y");return{fullSize:n,leftAndTop:r.concat(s),rightAndBottom:i.concat(l).concat(o).concat(a),chartArea:s1(e,"chartArea"),vertical:r.concat(i).concat(l),horizontal:s.concat(o).concat(a)}}function fH(t,e,n,r){return Math.max(t[n],e[n])+Math.max(t[r],e[r])}function F0e(t,e){t.top=Math.max(t.top,e.top),t.left=Math.max(t.left,e.left),t.bottom=Math.max(t.bottom,e.bottom),t.right=Math.max(t.right,e.right)}function xpt(t,e,n,r){const{pos:i,box:s}=n,o=t.maxPadding;if(!Zt(i)){n.size&&(t[i]-=n.size);const f=r[n.stack]||{size:0,count:1};f.size=Math.max(f.size,n.horizontal?s.height:s.width),n.size=f.size/f.count,t[i]+=n.size}s.getPadding&&F0e(o,s.getPadding());const a=Math.max(0,e.outerWidth-fH(o,t,"left","right")),l=Math.max(0,e.outerHeight-fH(o,t,"top","bottom")),c=a!==t.w,u=l!==t.h;return t.w=a,t.h=l,n.horizontal?{same:c,other:u}:{same:u,other:c}}function wpt(t){const e=t.maxPadding;function n(r){const i=Math.max(e[r]-t[r],0);return t[r]+=i,i}t.y+=n("top"),t.x+=n("left"),n("right"),n("bottom")}function Spt(t,e){const n=e.maxPadding;function r(i){const s={left:0,top:0,right:0,bottom:0};return i.forEach(o=>{s[o]=Math.max(e[o],n[o])}),s}return r(t?["left","right"]:["top","bottom"])}function D1(t,e,n,r){const i=[];let s,o,a,l,c,u;for(s=0,o=t.length,c=0;s<o;++s){a=t[s],l=a.box,l.update(a.width||e.w,a.height||e.h,Spt(a.horizontal,e));const{same:f,other:h}=xpt(e,n,a,r);c|=f&&i.length,u=u||h,l.fullSize||i.push(a)}return c&&D1(i,e,n,r)||u}function Qw(t,e,n,r,i){t.top=n,t.left=e,t.right=e+r,t.bottom=n+i,t.width=r,t.height=i}function hH(t,e,n,r){const i=n.padding;let{x:s,y:o}=e;for(const a of t){const l=a.box,c=r[a.stack]||{count:1,placed:0,weight:1},u=a.stackWeight/c.weight||1;if(a.horizontal){const f=e.w*u,h=c.size||l.height;VO(c.start)&&(o=c.start),l.fullSize?Qw(l,i.left,o,n.outerWidth-i.right-i.left,h):Qw(l,e.left+c.placed,o,f,h),c.start=o,c.placed+=f,o=l.bottom}else{const f=e.h*u,h=c.size||l.width;VO(c.start)&&(s=c.start),l.fullSize?Qw(l,s,i.top,h,n.outerHeight-i.bottom-i.top):Qw(l,s,e.top+c.placed,h,f),c.start=s,c.placed+=f,s=l.right}}e.x=s,e.y=o}var Bi={addBox(t,e){t.boxes||(t.boxes=[]),e.fullSize=e.fullSize||!1,e.position=e.position||"top",e.weight=e.weight||0,e._layers=e._layers||function(){return[{z:0,draw(n){e.draw(n)}}]},t.boxes.push(e)},removeBox(t,e){const n=t.boxes?t.boxes.indexOf(e):-1;n!==-1&&t.boxes.splice(n,1)},configure(t,e,n){e.fullSize=n.fullSize,e.position=n.position,e.weight=n.weight},update(t,e,n,r){if(!t)return;const i=Ui(t.options.layout.padding),s=Math.max(e-i.width,0),o=Math.max(n-i.height,0),a=bpt(t.boxes),l=a.vertical,c=a.horizontal;xn(t.boxes,g=>{typeof g.beforeLayout=="function"&&g.beforeLayout()});const u=l.reduce((g,m)=>m.box.options&&m.box.options.display===!1?g:g+1,0)||1,f=Object.freeze({outerWidth:e,outerHeight:n,padding:i,availableWidth:s,availableHeight:o,vBoxMaxWidth:s/2/u,hBoxMaxHeight:o/2}),h=Object.assign({},i);F0e(h,Ui(r));const d=Object.assign({maxPadding:h,w:s,h:o,x:i.left,y:i.top},i),p=ypt(l.concat(c),f);D1(a.fullSize,d,f,p),D1(l,d,f,p),D1(c,d,f,p)&&D1(l,d,f,p),wpt(d),hH(a.leftAndTop,d,f,p),d.x+=d.w,d.y+=d.h,hH(a.rightAndBottom,d,f,p),t.chartArea={left:d.left,top:d.top,right:d.left+d.w,bottom:d.top+d.h,height:d.h,width:d.w},xn(a.chartArea,g=>{const m=g.box;Object.assign(m,t.chartArea),m.update(d.w,d.h,{left:0,top:0,right:0,bottom:0})})}};class W0e{acquireContext(e,n){}releaseContext(e){return!1}addEventListener(e,n,r){}removeEventListener(e,n,r){}getDevicePixelRatio(){return 1}getMaximumSize(e,n,r,i){return n=Math.max(0,n||e.width),r=r||e.height,{width:n,height:Math.max(0,i?Math.floor(n/i):r)}}isAttached(e){return!0}updateConfig(e){}}class _pt extends W0e{acquireContext(e){return e&&e.getContext&&e.getContext("2d")||null}updateConfig(e){e.options.animation=!1}}const u2="$chartjs",kpt={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},dH=t=>t===null||t==="";function Cpt(t,e){const n=t.style,r=t.getAttribute("height"),i=t.getAttribute("width");if(t[u2]={initial:{height:r,width:i,style:{display:n.display,height:n.height,width:n.width}}},n.display=n.display||"block",n.boxSizing=n.boxSizing||"border-box",dH(i)){const s=YX(t,"width");s!==void 0&&(t.width=s)}if(dH(r))if(t.style.height==="")t.height=t.width/(e||2);else{const s=YX(t,"height");s!==void 0&&(t.height=s)}return t}const V0e=T0t?{passive:!0}:!1;function Ept(t,e,n){t&&t.addEventListener(e,n,V0e)}function Tpt(t,e,n){t&&t.canvas&&t.canvas.removeEventListener(e,n,V0e)}function Ppt(t,e){const n=kpt[t.type]||t.type,{x:r,y:i}=Rh(t,e);return{type:n,chart:e,native:t,x:r!==void 0?r:null,y:i!==void 0?i:null}}function k4(t,e){for(const n of t)if(n===e||n.contains(e))return!0}function Apt(t,e,n){const r=t.canvas,i=new MutationObserver(s=>{let o=!1;for(const a of s)o=o||k4(a.addedNodes,r),o=o&&!k4(a.removedNodes,r);o&&n()});return i.observe(document,{childList:!0,subtree:!0}),i}function Rpt(t,e,n){const r=t.canvas,i=new MutationObserver(s=>{let o=!1;for(const a of s)o=o||k4(a.removedNodes,r),o=o&&!k4(a.addedNodes,r);o&&n()});return i.observe(document,{childList:!0,subtree:!0}),i}const XO=new Map;let pH=0;function U0e(){const t=window.devicePixelRatio;t!==pH&&(pH=t,XO.forEach((e,n)=>{n.currentDevicePixelRatio!==t&&e()}))}function $pt(t,e){XO.size||window.addEventListener("resize",U0e),XO.set(t,e)}function Mpt(t){XO.delete(t),XO.size||window.removeEventListener("resize",U0e)}function Ipt(t,e,n){const r=t.canvas,i=r&&pL(r);if(!i)return;const s=x0e((a,l)=>{const c=i.clientWidth;n(a,l),c<i.clientWidth&&n()},window),o=new ResizeObserver(a=>{const l=a[0],c=l.contentRect.width,u=l.contentRect.height;c===0&&u===0||s(c,u)});return o.observe(i),$pt(t,s),o}function sE(t,e,n){n&&n.disconnect(),e==="resize"&&Mpt(t)}function Dpt(t,e,n){const r=t.canvas,i=x0e(s=>{t.ctx!==null&&n(Ppt(s,t))},t);return Ept(r,e,i),i}class Lpt extends W0e{acquireContext(e,n){const r=e&&e.getContext&&e.getContext("2d");return r&&r.canvas===e?(Cpt(e,n),r):null}releaseContext(e){const n=e.canvas;if(!n[u2])return!1;const r=n[u2].initial;["height","width"].forEach(s=>{const o=r[s];ln(o)?n.removeAttribute(s):n.setAttribute(s,o)});const i=r.style||{};return Object.keys(i).forEach(s=>{n.style[s]=i[s]}),n.width=n.width,delete n[u2],!0}addEventListener(e,n,r){this.removeEventListener(e,n);const i=e.$proxies||(e.$proxies={}),o={attach:Apt,detach:Rpt,resize:Ipt}[n]||Dpt;i[n]=o(e,n,r)}removeEventListener(e,n){const r=e.$proxies||(e.$proxies={}),i=r[n];if(!i)return;({attach:sE,detach:sE,resize:sE}[n]||Tpt)(e,n,i),r[n]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(e,n,r,i){return E0t(e,n,r,i)}isAttached(e){const n=e&&pL(e);return!!(n&&n.isConnected)}}function Npt(t){return!dL()||typeof OffscreenCanvas<"u"&&t instanceof OffscreenCanvas?_pt:Lpt}var dS;let fu=(dS=class{constructor(){Le(this,"x");Le(this,"y");Le(this,"active",!1);Le(this,"options");Le(this,"$animations")}tooltipPosition(e){const{x:n,y:r}=this.getProps(["x","y"],e);return{x:n,y:r}}hasValue(){return _m(this.x)&&_m(this.y)}getProps(e,n){const r=this.$animations;if(!n||!r)return this;const i={};return e.forEach(s=>{i[s]=r[s]&&r[s].active()?r[s]._to:this[s]}),i}},Le(dS,"defaults",{}),Le(dS,"defaultRoutes"),dS);function Qpt(t,e){const n=t.options.ticks,r=jpt(t),i=Math.min(n.maxTicksLimit||r,r),s=n.major.enabled?zpt(e):[],o=s.length,a=s[0],l=s[o-1],c=[];if(o>i)return Fpt(e,c,s,o/i),c;const u=Bpt(s,e,i);if(o>0){let f,h;const d=o>1?Math.round((l-a)/(o-1)):null;for(jw(e,c,u,ln(d)?0:a-d,a),f=0,h=o-1;f<h;f++)jw(e,c,u,s[f],s[f+1]);return jw(e,c,u,l,ln(d)?e.length:l+d),c}return jw(e,c,u),c}function jpt(t){const e=t.options.offset,n=t._tickSize(),r=t._length/n+(e?0:1),i=t._maxLength/n;return Math.floor(Math.min(r,i))}function Bpt(t,e,n){const r=Wpt(t),i=e.length/n;if(!r)return Math.max(i,1);const s=Rdt(r);for(let o=0,a=s.length-1;o<a;o++){const l=s[o];if(l>i)return l}return Math.max(i,1)}function zpt(t){const e=[];let n,r;for(n=0,r=t.length;n<r;n++)t[n].major&&e.push(n);return e}function Fpt(t,e,n,r){let i=0,s=n[0],o;for(r=Math.ceil(r),o=0;o<t.length;o++)o===s&&(e.push(t[o]),i++,s=n[i*r])}function jw(t,e,n,r,i){const s=Mt(r,0),o=Math.min(Mt(i,t.length),t.length);let a=0,l,c,u;for(n=Math.ceil(n),i&&(l=i-r,n=l/Math.floor(l/n)),u=s;u<0;)a++,u=Math.round(s+a*n);for(c=Math.max(s,0);c<o;c++)c===u&&(e.push(t[c]),a++,u=Math.round(s+a*n))}function Wpt(t){const e=t.length;let n,r;if(e<2)return!1;for(r=t[0],n=1;n<e;++n)if(t[n]-t[n-1]!==r)return!1;return r}const Vpt=t=>t==="left"?"right":t==="right"?"left":t,mH=(t,e,n)=>e==="top"||e==="left"?t[e]+n:t[e]-n,gH=(t,e)=>Math.min(e||t,t);function vH(t,e){const n=[],r=t.length/e,i=t.length;let s=0;for(;s<i;s+=r)n.push(t[Math.floor(s)]);return n}function Upt(t,e,n){const r=t.ticks.length,i=Math.min(e,r-1),s=t._startPixel,o=t._endPixel,a=1e-6;let l=t.getPixelForTick(i),c;if(!(n&&(r===1?c=Math.max(l-s,o-l):e===0?c=(t.getPixelForTick(1)-l)/2:c=(l-t.getPixelForTick(i-1))/2,l+=i<e?c:-c,l<s-a||l>o+a)))return l}function qpt(t,e){xn(t,n=>{const r=n.gc,i=r.length/2;let s;if(i>e){for(s=0;s<i;++s)delete n.data[r[s]];r.splice(0,i)}})}function a1(t){return t.drawTicks?t.tickLength:0}function OH(t,e){if(!t.display)return 0;const n=ei(t.font,e),r=Ui(t.padding);return(Xn(t.text)?t.text.length:1)*n.lineHeight+r.height}function Xpt(t,e){return Kf(t,{scale:e,type:"scale"})}function Hpt(t,e,n){return Kf(t,{tick:n,index:e,type:"tick"})}function Zpt(t,e,n){let r=aL(t);return(n&&e!=="right"||!n&&e==="right")&&(r=Vpt(r)),r}function Ypt(t,e,n,r){const{top:i,left:s,bottom:o,right:a,chart:l}=t,{chartArea:c,scales:u}=l;let f=0,h,d,p;const g=o-i,m=a-s;if(t.isHorizontal()){if(d=Ii(r,s,a),Zt(n)){const v=Object.keys(n)[0],y=n[v];p=u[v].getPixelForValue(y)+g-e}else n==="center"?p=(c.bottom+c.top)/2+g-e:p=mH(t,n,e);h=a-s}else{if(Zt(n)){const v=Object.keys(n)[0],y=n[v];d=u[v].getPixelForValue(y)-m+e}else n==="center"?d=(c.left+c.right)/2-m+e:d=mH(t,n,e);p=Ii(r,o,i),f=n==="left"?-Mr:Mr}return{titleX:d,titleY:p,maxWidth:h,rotation:f}}class Jd extends fu{constructor(e){super(),this.id=e.id,this.type=e.type,this.options=void 0,this.ctx=e.ctx,this.chart=e.chart,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this._margins={left:0,right:0,top:0,bottom:0},this.maxWidth=void 0,this.maxHeight=void 0,this.paddingTop=void 0,this.paddingBottom=void 0,this.paddingLeft=void 0,this.paddingRight=void 0,this.axis=void 0,this.labelRotation=void 0,this.min=void 0,this.max=void 0,this._range=void 0,this.ticks=[],this._gridLineItems=null,this._labelItems=null,this._labelSizes=null,this._length=0,this._maxLength=0,this._longestTextCache={},this._startPixel=void 0,this._endPixel=void 0,this._reversePixels=!1,this._userMax=void 0,this._userMin=void 0,this._suggestedMax=void 0,this._suggestedMin=void 0,this._ticksLength=0,this._borderValue=0,this._cache={},this._dataLimitsCached=!1,this.$context=void 0}init(e){this.options=e.setContext(this.getContext()),this.axis=e.axis,this._userMin=this.parse(e.min),this._userMax=this.parse(e.max),this._suggestedMin=this.parse(e.suggestedMin),this._suggestedMax=this.parse(e.suggestedMax)}parse(e,n){return e}getUserBounds(){let{_userMin:e,_userMax:n,_suggestedMin:r,_suggestedMax:i}=this;return e=Ks(e,Number.POSITIVE_INFINITY),n=Ks(n,Number.NEGATIVE_INFINITY),r=Ks(r,Number.POSITIVE_INFINITY),i=Ks(i,Number.NEGATIVE_INFINITY),{min:Ks(e,r),max:Ks(n,i),minDefined:wr(e),maxDefined:wr(n)}}getMinMax(e){let{min:n,max:r,minDefined:i,maxDefined:s}=this.getUserBounds(),o;if(i&&s)return{min:n,max:r};const a=this.getMatchingVisibleMetas();for(let l=0,c=a.length;l<c;++l)o=a[l].controller.getMinMax(this,e),i||(n=Math.min(n,o.min)),s||(r=Math.max(r,o.max));return n=s&&n>r?r:n,r=i&&n>r?n:r,{min:Ks(n,Ks(r,n)),max:Ks(r,Ks(n,r))}}getPadding(){return{left:this.paddingLeft||0,top:this.paddingTop||0,right:this.paddingRight||0,bottom:this.paddingBottom||0}}getTicks(){return this.ticks}getLabels(){const e=this.chart.data;return this.options.labels||(this.isHorizontal()?e.xLabels:e.yLabels)||e.labels||[]}getLabelItems(e=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(e))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){jn(this.options.beforeUpdate,[this])}update(e,n,r){const{beginAtZero:i,grace:s,ticks:o}=this.options,a=o.sampleSize;this.beforeUpdate(),this.maxWidth=e,this.maxHeight=n,this._margins=r=Object.assign({left:0,right:0,top:0,bottom:0},r),this.ticks=null,this._labelSizes=null,this._gridLineItems=null,this._labelItems=null,this.beforeSetDimensions(),this.setDimensions(),this.afterSetDimensions(),this._maxLength=this.isHorizontal()?this.width+r.left+r.right:this.height+r.top+r.bottom,this._dataLimitsCached||(this.beforeDataLimits(),this.determineDataLimits(),this.afterDataLimits(),this._range=s0t(this,s,i),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const l=a<this.ticks.length;this._convertTicksToLabels(l?vH(this.ticks,a):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),o.display&&(o.autoSkip||o.source==="auto")&&(this.ticks=Qpt(this,this.ticks),this._labelSizes=null,this.afterAutoSkip()),l&&this._convertTicksToLabels(this.ticks),this.beforeFit(),this.fit(),this.afterFit(),this.afterUpdate()}configure(){let e=this.options.reverse,n,r;this.isHorizontal()?(n=this.left,r=this.right):(n=this.top,r=this.bottom,e=!e),this._startPixel=n,this._endPixel=r,this._reversePixels=e,this._length=r-n,this._alignToPixels=this.options.alignToPixels}afterUpdate(){jn(this.options.afterUpdate,[this])}beforeSetDimensions(){jn(this.options.beforeSetDimensions,[this])}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=0,this.right=this.width):(this.height=this.maxHeight,this.top=0,this.bottom=this.height),this.paddingLeft=0,this.paddingTop=0,this.paddingRight=0,this.paddingBottom=0}afterSetDimensions(){jn(this.options.afterSetDimensions,[this])}_callHooks(e){this.chart.notifyPlugins(e,this.getContext()),jn(this.options[e],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){jn(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(e){const n=this.options.ticks;let r,i,s;for(r=0,i=e.length;r<i;r++)s=e[r],s.label=jn(n.callback,[s.value,r,e],this)}afterTickToLabelConversion(){jn(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){jn(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){const e=this.options,n=e.ticks,r=gH(this.ticks.length,e.ticks.maxTicksLimit),i=n.minRotation||0,s=n.maxRotation;let o=i,a,l,c;if(!this._isVisible()||!n.display||i>=s||r<=1||!this.isHorizontal()){this.labelRotation=i;return}const u=this._getLabelSizes(),f=u.widest.width,h=u.highest.height,d=ui(this.chart.width-f,0,this.maxWidth);a=e.offset?this.maxWidth/r:d/(r-1),f+6>a&&(a=d/(r-(e.offset?.5:1)),l=this.maxHeight-a1(e.grid)-n.padding-OH(e.title,this.chart.options.font),c=Math.sqrt(f*f+h*h),o=sL(Math.min(Math.asin(ui((u.highest.height+6)/a,-1,1)),Math.asin(ui(l/c,-1,1))-Math.asin(ui(h/c,-1,1)))),o=Math.max(i,Math.min(s,o))),this.labelRotation=o}afterCalculateLabelRotation(){jn(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){jn(this.options.beforeFit,[this])}fit(){const e={width:0,height:0},{chart:n,options:{ticks:r,title:i,grid:s}}=this,o=this._isVisible(),a=this.isHorizontal();if(o){const l=OH(i,n.options.font);if(a?(e.width=this.maxWidth,e.height=a1(s)+l):(e.height=this.maxHeight,e.width=a1(s)+l),r.display&&this.ticks.length){const{first:c,last:u,widest:f,highest:h}=this._getLabelSizes(),d=r.padding*2,p=wa(this.labelRotation),g=Math.cos(p),m=Math.sin(p);if(a){const v=r.mirror?0:m*f.width+g*h.height;e.height=Math.min(this.maxHeight,e.height+v+d)}else{const v=r.mirror?0:g*f.width+m*h.height;e.width=Math.min(this.maxWidth,e.width+v+d)}this._calculatePadding(c,u,m,g)}}this._handleMargins(),a?(this.width=this._length=n.width-this._margins.left-this._margins.right,this.height=e.height):(this.width=e.width,this.height=this._length=n.height-this._margins.top-this._margins.bottom)}_calculatePadding(e,n,r,i){const{ticks:{align:s,padding:o},position:a}=this.options,l=this.labelRotation!==0,c=a!=="top"&&this.axis==="x";if(this.isHorizontal()){const u=this.getPixelForTick(0)-this.left,f=this.right-this.getPixelForTick(this.ticks.length-1);let h=0,d=0;l?c?(h=i*e.width,d=r*n.height):(h=r*e.height,d=i*n.width):s==="start"?d=n.width:s==="end"?h=e.width:s!=="inner"&&(h=e.width/2,d=n.width/2),this.paddingLeft=Math.max((h-u+o)*this.width/(this.width-u),0),this.paddingRight=Math.max((d-f+o)*this.width/(this.width-f),0)}else{let u=n.height/2,f=e.height/2;s==="start"?(u=0,f=e.height):s==="end"&&(u=n.height,f=0),this.paddingTop=u+o,this.paddingBottom=f+o}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){jn(this.options.afterFit,[this])}isHorizontal(){const{axis:e,position:n}=this.options;return n==="top"||n==="bottom"||e==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(e){this.beforeTickToLabelConversion(),this.generateTickLabels(e);let n,r;for(n=0,r=e.length;n<r;n++)ln(e[n].label)&&(e.splice(n,1),r--,n--);this.afterTickToLabelConversion()}_getLabelSizes(){let e=this._labelSizes;if(!e){const n=this.options.ticks.sampleSize;let r=this.ticks;n<r.length&&(r=vH(r,n)),this._labelSizes=e=this._computeLabelSizes(r,r.length,this.options.ticks.maxTicksLimit)}return e}_computeLabelSizes(e,n,r){const{ctx:i,_longestTextCache:s}=this,o=[],a=[],l=Math.floor(n/gH(n,r));let c=0,u=0,f,h,d,p,g,m,v,y,b,S,k;for(f=0;f<n;f+=l){if(p=e[f].label,g=this._resolveTickFontOptions(f),i.font=m=g.string,v=s[m]=s[m]||{data:{},gc:[]},y=g.lineHeight,b=S=0,!ln(p)&&!Xn(p))b=S4(i,v.data,v.gc,b,p),S=y;else if(Xn(p))for(h=0,d=p.length;h<d;++h)k=p[h],!ln(k)&&!Xn(k)&&(b=S4(i,v.data,v.gc,b,k),S+=y);o.push(b),a.push(S),c=Math.max(b,c),u=Math.max(S,u)}qpt(s,n);const E=o.indexOf(c),T=a.indexOf(u),C=A=>({width:o[A]||0,height:a[A]||0});return{first:C(0),last:C(n-1),widest:C(E),highest:C(T),widths:o,heights:a}}getLabelForValue(e){return e}getPixelForValue(e,n){return NaN}getValueForPixel(e){}getPixelForTick(e){const n=this.ticks;return e<0||e>n.length-1?null:this.getPixelForValue(n[e].value)}getPixelForDecimal(e){this._reversePixels&&(e=1-e);const n=this._startPixel+e*this._length;return Idt(this._alignToPixels?mh(this.chart,n,0):n)}getDecimalForPixel(e){const n=(e-this._startPixel)/this._length;return this._reversePixels?1-n:n}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:e,max:n}=this;return e<0&&n<0?n:e>0&&n>0?e:0}getContext(e){const n=this.ticks||[];if(e>=0&&e<n.length){const r=n[e];return r.$context||(r.$context=Hpt(this.getContext(),e,r))}return this.$context||(this.$context=Xpt(this.chart.getContext(),this))}_tickSize(){const e=this.options.ticks,n=wa(this.labelRotation),r=Math.abs(Math.cos(n)),i=Math.abs(Math.sin(n)),s=this._getLabelSizes(),o=e.autoSkipPadding||0,a=s?s.widest.width+o:0,l=s?s.highest.height+o:0;return this.isHorizontal()?l*r>a*i?a/r:l/i:l*i<a*r?l/r:a/i}_isVisible(){const e=this.options.display;return e!=="auto"?!!e:this.getMatchingVisibleMetas().length>0}_computeGridLineItems(e){const n=this.axis,r=this.chart,i=this.options,{grid:s,position:o,border:a}=i,l=s.offset,c=this.isHorizontal(),f=this.ticks.length+(l?1:0),h=a1(s),d=[],p=a.setContext(this.getContext()),g=p.display?p.width:0,m=g/2,v=function(Z){return mh(r,Z,g)};let y,b,S,k,E,T,C,A,R,Q,L,z;if(o==="top")y=v(this.bottom),T=this.bottom-h,A=y-m,Q=v(e.top)+m,z=e.bottom;else if(o==="bottom")y=v(this.top),Q=e.top,z=v(e.bottom)-m,T=y+m,A=this.top+h;else if(o==="left")y=v(this.right),E=this.right-h,C=y-m,R=v(e.left)+m,L=e.right;else if(o==="right")y=v(this.left),R=e.left,L=v(e.right)-m,E=y+m,C=this.left+h;else if(n==="x"){if(o==="center")y=v((e.top+e.bottom)/2+.5);else if(Zt(o)){const Z=Object.keys(o)[0],J=o[Z];y=v(this.chart.scales[Z].getPixelForValue(J))}Q=e.top,z=e.bottom,T=y+m,A=T+h}else if(n==="y"){if(o==="center")y=v((e.left+e.right)/2);else if(Zt(o)){const Z=Object.keys(o)[0],J=o[Z];y=v(this.chart.scales[Z].getPixelForValue(J))}E=y-m,C=E-h,R=e.left,L=e.right}const B=Mt(i.ticks.maxTicksLimit,f),q=Math.max(1,Math.ceil(f/B));for(b=0;b<f;b+=q){const Z=this.getContext(b),J=s.setContext(Z),I=a.setContext(Z),j=J.lineWidth,M=J.color,X=I.dash||[],se=I.dashOffset,H=J.tickWidth,de=J.tickColor,fe=J.tickBorderDash||[],ve=J.tickBorderDashOffset;S=Upt(this,b,l),S!==void 0&&(k=mh(r,S,j),c?E=C=R=L=k:T=A=Q=z=k,d.push({tx1:E,ty1:T,tx2:C,ty2:A,x1:R,y1:Q,x2:L,y2:z,width:j,color:M,borderDash:X,borderDashOffset:se,tickWidth:H,tickColor:de,tickBorderDash:fe,tickBorderDashOffset:ve}))}return this._ticksLength=f,this._borderValue=y,d}_computeLabelItems(e){const n=this.axis,r=this.options,{position:i,ticks:s}=r,o=this.isHorizontal(),a=this.ticks,{align:l,crossAlign:c,padding:u,mirror:f}=s,h=a1(r.grid),d=h+u,p=f?-u:d,g=-wa(this.labelRotation),m=[];let v,y,b,S,k,E,T,C,A,R,Q,L,z="middle";if(i==="top")E=this.bottom-p,T=this._getXAxisLabelAlignment();else if(i==="bottom")E=this.top+p,T=this._getXAxisLabelAlignment();else if(i==="left"){const q=this._getYAxisLabelAlignment(h);T=q.textAlign,k=q.x}else if(i==="right"){const q=this._getYAxisLabelAlignment(h);T=q.textAlign,k=q.x}else if(n==="x"){if(i==="center")E=(e.top+e.bottom)/2+d;else if(Zt(i)){const q=Object.keys(i)[0],Z=i[q];E=this.chart.scales[q].getPixelForValue(Z)+d}T=this._getXAxisLabelAlignment()}else if(n==="y"){if(i==="center")k=(e.left+e.right)/2-d;else if(Zt(i)){const q=Object.keys(i)[0],Z=i[q];k=this.chart.scales[q].getPixelForValue(Z)}T=this._getYAxisLabelAlignment(h).textAlign}n==="y"&&(l==="start"?z="top":l==="end"&&(z="bottom"));const B=this._getLabelSizes();for(v=0,y=a.length;v<y;++v){b=a[v],S=b.label;const q=s.setContext(this.getContext(v));C=this.getPixelForTick(v)+s.labelOffset,A=this._resolveTickFontOptions(v),R=A.lineHeight,Q=Xn(S)?S.length:1;const Z=Q/2,J=q.color,I=q.textStrokeColor,j=q.textStrokeWidth;let M=T;o?(k=C,T==="inner"&&(v===y-1?M=this.options.reverse?"left":"right":v===0?M=this.options.reverse?"right":"left":M="center"),i==="top"?c==="near"||g!==0?L=-Q*R+R/2:c==="center"?L=-B.highest.height/2-Z*R+R:L=-B.highest.height+R/2:c==="near"||g!==0?L=R/2:c==="center"?L=B.highest.height/2-Z*R:L=B.highest.height-Q*R,f&&(L*=-1),g!==0&&!q.showLabelBackdrop&&(k+=R/2*Math.sin(g))):(E=C,L=(1-Q)*R/2);let X;if(q.showLabelBackdrop){const se=Ui(q.backdropPadding),H=B.heights[v],de=B.widths[v];let fe=L-se.top,ve=0-se.left;switch(z){case"middle":fe-=H/2;break;case"bottom":fe-=H;break}switch(T){case"center":ve-=de/2;break;case"right":ve-=de;break;case"inner":v===y-1?ve-=de:v>0&&(ve-=de/2);break}X={left:ve,top:fe,width:de+se.width,height:H+se.height,color:q.backdropColor}}m.push({label:S,font:A,textOffset:L,options:{rotation:g,color:J,strokeColor:I,strokeWidth:j,textAlign:M,textBaseline:z,translation:[k,E],backdrop:X}})}return m}_getXAxisLabelAlignment(){const{position:e,ticks:n}=this.options;if(-wa(this.labelRotation))return e==="top"?"left":"right";let i="center";return n.align==="start"?i="left":n.align==="end"?i="right":n.align==="inner"&&(i="inner"),i}_getYAxisLabelAlignment(e){const{position:n,ticks:{crossAlign:r,mirror:i,padding:s}}=this.options,o=this._getLabelSizes(),a=e+s,l=o.widest.width;let c,u;return n==="left"?i?(u=this.right+s,r==="near"?c="left":r==="center"?(c="center",u+=l/2):(c="right",u+=l)):(u=this.right-a,r==="near"?c="right":r==="center"?(c="center",u-=l/2):(c="left",u=this.left)):n==="right"?i?(u=this.left+s,r==="near"?c="right":r==="center"?(c="center",u-=l/2):(c="left",u-=l)):(u=this.left+a,r==="near"?c="left":r==="center"?(c="center",u+=l/2):(c="right",u=this.right)):c="right",{textAlign:c,x:u}}_computeLabelArea(){if(this.options.ticks.mirror)return;const e=this.chart,n=this.options.position;if(n==="left"||n==="right")return{top:0,left:this.left,bottom:e.height,right:this.right};if(n==="top"||n==="bottom")return{top:this.top,left:0,bottom:this.bottom,right:e.width}}drawBackground(){const{ctx:e,options:{backgroundColor:n},left:r,top:i,width:s,height:o}=this;n&&(e.save(),e.fillStyle=n,e.fillRect(r,i,s,o),e.restore())}getLineWidthForValue(e){const n=this.options.grid;if(!this._isVisible()||!n.display)return 0;const i=this.ticks.findIndex(s=>s.value===e);return i>=0?n.setContext(this.getContext(i)).lineWidth:0}drawGrid(e){const n=this.options.grid,r=this.ctx,i=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(e));let s,o;const a=(l,c,u)=>{!u.width||!u.color||(r.save(),r.lineWidth=u.width,r.strokeStyle=u.color,r.setLineDash(u.borderDash||[]),r.lineDashOffset=u.borderDashOffset,r.beginPath(),r.moveTo(l.x,l.y),r.lineTo(c.x,c.y),r.stroke(),r.restore())};if(n.display)for(s=0,o=i.length;s<o;++s){const l=i[s];n.drawOnChartArea&&a({x:l.x1,y:l.y1},{x:l.x2,y:l.y2},l),n.drawTicks&&a({x:l.tx1,y:l.ty1},{x:l.tx2,y:l.ty2},{color:l.tickColor,width:l.tickWidth,borderDash:l.tickBorderDash,borderDashOffset:l.tickBorderDashOffset})}}drawBorder(){const{chart:e,ctx:n,options:{border:r,grid:i}}=this,s=r.setContext(this.getContext()),o=r.display?s.width:0;if(!o)return;const a=i.setContext(this.getContext(0)).lineWidth,l=this._borderValue;let c,u,f,h;this.isHorizontal()?(c=mh(e,this.left,o)-o/2,u=mh(e,this.right,a)+a/2,f=h=l):(f=mh(e,this.top,o)-o/2,h=mh(e,this.bottom,a)+a/2,c=u=l),n.save(),n.lineWidth=s.width,n.strokeStyle=s.color,n.beginPath(),n.moveTo(c,f),n.lineTo(u,h),n.stroke(),n.restore()}drawLabels(e){if(!this.options.ticks.display)return;const r=this.ctx,i=this._computeLabelArea();i&&ak(r,i);const s=this.getLabelItems(e);for(const o of s){const a=o.options,l=o.font,c=o.label,u=o.textOffset;Ed(r,c,0,u,l,a)}i&&lk(r)}drawTitle(){const{ctx:e,options:{position:n,title:r,reverse:i}}=this;if(!r.display)return;const s=ei(r.font),o=Ui(r.padding),a=r.align;let l=s.lineHeight/2;n==="bottom"||n==="center"||Zt(n)?(l+=o.bottom,Xn(r.text)&&(l+=s.lineHeight*(r.text.length-1))):l+=o.top;const{titleX:c,titleY:u,maxWidth:f,rotation:h}=Ypt(this,l,n,a);Ed(e,r.text,0,0,s,{color:r.color,maxWidth:f,rotation:h,textAlign:Zpt(a,n,i),textBaseline:"middle",translation:[c,u]})}draw(e){this._isVisible()&&(this.drawBackground(),this.drawGrid(e),this.drawBorder(),this.drawTitle(),this.drawLabels(e))}_layers(){const e=this.options,n=e.ticks&&e.ticks.z||0,r=Mt(e.grid&&e.grid.z,-1),i=Mt(e.border&&e.border.z,0);return!this._isVisible()||this.draw!==Jd.prototype.draw?[{z:n,draw:s=>{this.draw(s)}}]:[{z:r,draw:s=>{this.drawBackground(),this.drawGrid(s),this.drawTitle()}},{z:i,draw:()=>{this.drawBorder()}},{z:n,draw:s=>{this.drawLabels(s)}}]}getMatchingVisibleMetas(e){const n=this.chart.getSortedVisibleDatasetMetas(),r=this.axis+"AxisID",i=[];let s,o;for(s=0,o=n.length;s<o;++s){const a=n[s];a[r]===this.id&&(!e||a.type===e)&&i.push(a)}return i}_resolveTickFontOptions(e){const n=this.options.ticks.setContext(this.getContext(e));return ei(n.font)}_maxDigits(){const e=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/e}}class Bw{constructor(e,n,r){this.type=e,this.scope=n,this.override=r,this.items=Object.create(null)}isForType(e){return Object.prototype.isPrototypeOf.call(this.type.prototype,e.prototype)}register(e){const n=Object.getPrototypeOf(e);let r;Jpt(n)&&(r=this.register(n));const i=this.items,s=e.id,o=this.scope+"."+s;if(!s)throw new Error("class does not have id: "+e);return s in i||(i[s]=e,Gpt(e,o,r),this.override&&rr.override(e.id,e.overrides)),o}get(e){return this.items[e]}unregister(e){const n=this.items,r=e.id,i=this.scope;r in n&&delete n[r],i&&r in rr[i]&&(delete rr[i][r],this.override&&delete Cd[r])}}function Gpt(t,e,n){const r=WO(Object.create(null),[n?rr.get(n):{},rr.get(e),t.defaults]);rr.set(e,r),t.defaultRoutes&&Kpt(e,t.defaultRoutes),t.descriptors&&rr.describe(e,t.descriptors)}function Kpt(t,e){Object.keys(e).forEach(n=>{const r=n.split("."),i=r.pop(),s=[t].concat(r).join("."),o=e[n].split("."),a=o.pop(),l=o.join(".");rr.route(s,i,l,a)})}function Jpt(t){return"id"in t&&"defaults"in t}class emt{constructor(){this.controllers=new Bw(Ea,"datasets",!0),this.elements=new Bw(fu,"elements"),this.plugins=new Bw(Object,"plugins"),this.scales=new Bw(Jd,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...e){this._each("register",e)}remove(...e){this._each("unregister",e)}addControllers(...e){this._each("register",e,this.controllers)}addElements(...e){this._each("register",e,this.elements)}addPlugins(...e){this._each("register",e,this.plugins)}addScales(...e){this._each("register",e,this.scales)}getController(e){return this._get(e,this.controllers,"controller")}getElement(e){return this._get(e,this.elements,"element")}getPlugin(e){return this._get(e,this.plugins,"plugin")}getScale(e){return this._get(e,this.scales,"scale")}removeControllers(...e){this._each("unregister",e,this.controllers)}removeElements(...e){this._each("unregister",e,this.elements)}removePlugins(...e){this._each("unregister",e,this.plugins)}removeScales(...e){this._each("unregister",e,this.scales)}_each(e,n,r){[...n].forEach(i=>{const s=r||this._getRegistryForType(i);r||s.isForType(i)||s===this.plugins&&i.id?this._exec(e,s,i):xn(i,o=>{const a=r||this._getRegistryForType(o);this._exec(e,a,o)})})}_exec(e,n,r){const i=iL(e);jn(r["before"+i],[],r),n[e](r),jn(r["after"+i],[],r)}_getRegistryForType(e){for(let n=0;n<this._typedRegistries.length;n++){const r=this._typedRegistries[n];if(r.isForType(e))return r}return this.plugins}_get(e,n,r){const i=n.get(e);if(i===void 0)throw new Error('"'+e+'" is not a registered '+r+".");return i}}var il=new emt;class tmt{constructor(){this._init=[]}notify(e,n,r,i){n==="beforeInit"&&(this._init=this._createDescriptors(e,!0),this._notify(this._init,e,"install"));const s=i?this._descriptors(e).filter(i):this._descriptors(e),o=this._notify(s,e,n,r);return n==="afterDestroy"&&(this._notify(s,e,"stop"),this._notify(this._init,e,"uninstall")),o}_notify(e,n,r,i){i=i||{};for(const s of e){const o=s.plugin,a=o[r],l=[n,i,s.options];if(jn(a,l,o)===!1&&i.cancelable)return!1}return!0}invalidate(){ln(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(e){if(this._cache)return this._cache;const n=this._cache=this._createDescriptors(e);return this._notifyStateChanges(e),n}_createDescriptors(e,n){const r=e&&e.config,i=Mt(r.options&&r.options.plugins,{}),s=nmt(r);return i===!1&&!n?[]:imt(e,s,i,n)}_notifyStateChanges(e){const n=this._oldCache||[],r=this._cache,i=(s,o)=>s.filter(a=>!o.some(l=>a.plugin.id===l.plugin.id));this._notify(i(n,r),e,"stop"),this._notify(i(r,n),e,"start")}}function nmt(t){const e={},n=[],r=Object.keys(il.plugins.items);for(let s=0;s<r.length;s++)n.push(il.getPlugin(r[s]));const i=t.plugins||[];for(let s=0;s<i.length;s++){const o=i[s];n.indexOf(o)===-1&&(n.push(o),e[o.id]=!0)}return{plugins:n,localIds:e}}function rmt(t,e){return!e&&t===!1?null:t===!0?{}:t}function imt(t,{plugins:e,localIds:n},r,i){const s=[],o=t.getContext();for(const a of e){const l=a.id,c=rmt(r[l],i);c!==null&&s.push({plugin:a,options:smt(t.config,{plugin:a,local:n[l]},c,o)})}return s}function smt(t,{plugin:e,local:n},r,i){const s=t.pluginScopeKeys(e),o=t.getOptionScopes(r,s);return n&&e.defaults&&o.push(e.defaults),t.createResolver(o,i,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function FA(t,e){const n=rr.datasets[t]||{};return((e.datasets||{})[t]||{}).indexAxis||e.indexAxis||n.indexAxis||"x"}function omt(t,e){let n=t;return t==="_index_"?n=e:t==="_value_"&&(n=e==="x"?"y":"x"),n}function amt(t,e){return t===e?"_index_":"_value_"}function yH(t){if(t==="x"||t==="y"||t==="r")return t}function lmt(t){if(t==="top"||t==="bottom")return"x";if(t==="left"||t==="right")return"y"}function WA(t,...e){if(yH(t))return t;for(const n of e){const r=n.axis||lmt(n.position)||t.length>1&&yH(t[0].toLowerCase());if(r)return r}throw new Error(`Cannot determine type of '${t}' axis. Please provide 'axis' or 'position' option.`)}function bH(t,e,n){if(n[e+"AxisID"]===t)return{axis:e}}function cmt(t,e){if(e.data&&e.data.datasets){const n=e.data.datasets.filter(r=>r.xAxisID===t||r.yAxisID===t);if(n.length)return bH(t,"x",n[0])||bH(t,"y",n[0])}return{}}function umt(t,e){const n=Cd[t.type]||{scales:{}},r=e.scales||{},i=FA(t.type,e),s=Object.create(null);return Object.keys(r).forEach(o=>{const a=r[o];if(!Zt(a))return console.error(`Invalid scale configuration for scale: ${o}`);if(a._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${o}`);const l=WA(o,a,cmt(o,t),rr.scales[a.type]),c=amt(l,i),u=n.scales||{};s[o]=vv(Object.create(null),[{axis:l},a,u[l],u[c]])}),t.data.datasets.forEach(o=>{const a=o.type||t.type,l=o.indexAxis||FA(a,e),u=(Cd[a]||{}).scales||{};Object.keys(u).forEach(f=>{const h=omt(f,l),d=o[h+"AxisID"]||h;s[d]=s[d]||Object.create(null),vv(s[d],[{axis:h},r[d],u[f]])})}),Object.keys(s).forEach(o=>{const a=s[o];vv(a,[rr.scales[a.type],rr.scale])}),s}function q0e(t){const e=t.options||(t.options={});e.plugins=Mt(e.plugins,{}),e.scales=umt(t,e)}function X0e(t){return t=t||{},t.datasets=t.datasets||[],t.labels=t.labels||[],t}function fmt(t){return t=t||{},t.data=X0e(t.data),q0e(t),t}const xH=new Map,H0e=new Set;function zw(t,e){let n=xH.get(t);return n||(n=e(),xH.set(t,n),H0e.add(n)),n}const l1=(t,e,n)=>{const r=If(e,n);r!==void 0&&t.add(r)};class hmt{constructor(e){this._config=fmt(e),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(e){this._config.type=e}get data(){return this._config.data}set data(e){this._config.data=X0e(e)}get options(){return this._config.options}set options(e){this._config.options=e}get plugins(){return this._config.plugins}update(){const e=this._config;this.clearCache(),q0e(e)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(e){return zw(e,()=>[[`datasets.${e}`,""]])}datasetAnimationScopeKeys(e,n){return zw(`${e}.transition.${n}`,()=>[[`datasets.${e}.transitions.${n}`,`transitions.${n}`],[`datasets.${e}`,""]])}datasetElementScopeKeys(e,n){return zw(`${e}-${n}`,()=>[[`datasets.${e}.elements.${n}`,`datasets.${e}`,`elements.${n}`,""]])}pluginScopeKeys(e){const n=e.id,r=this.type;return zw(`${r}-plugin-${n}`,()=>[[`plugins.${n}`,...e.additionalOptionScopes||[]]])}_cachedScopes(e,n){const r=this._scopeCache;let i=r.get(e);return(!i||n)&&(i=new Map,r.set(e,i)),i}getOptionScopes(e,n,r){const{options:i,type:s}=this,o=this._cachedScopes(e,r),a=o.get(n);if(a)return a;const l=new Set;n.forEach(u=>{e&&(l.add(e),u.forEach(f=>l1(l,e,f))),u.forEach(f=>l1(l,i,f)),u.forEach(f=>l1(l,Cd[s]||{},f)),u.forEach(f=>l1(l,rr,f)),u.forEach(f=>l1(l,jA,f))});const c=Array.from(l);return c.length===0&&c.push(Object.create(null)),H0e.has(n)&&o.set(n,c),c}chartOptionScopes(){const{options:e,type:n}=this;return[e,Cd[n]||{},rr.datasets[n]||{},{type:n},rr,jA]}resolveNamedOptions(e,n,r,i=[""]){const s={$shared:!0},{resolver:o,subPrefixes:a}=wH(this._resolverCache,e,i);let l=o;if(pmt(o,n)){s.$shared=!1,r=Df(r)?r():r;const c=this.createResolver(e,r,a);l=km(o,r,c)}for(const c of n)s[c]=l[c];return s}createResolver(e,n,r=[""],i){const{resolver:s}=wH(this._resolverCache,e,r);return Zt(n)?km(s,n,void 0,i):s}}function wH(t,e,n){let r=t.get(e);r||(r=new Map,t.set(e,r));const i=n.join();let s=r.get(i);return s||(s={resolver:uL(e,n),subPrefixes:n.filter(a=>!a.toLowerCase().includes("hover"))},r.set(i,s)),s}const dmt=t=>Zt(t)&&Object.getOwnPropertyNames(t).some(e=>Df(t[e]));function pmt(t,e){const{isScriptable:n,isIndexable:r}=E0e(t);for(const i of e){const s=n(i),o=r(i),a=(o||s)&&t[i];if(s&&(Df(a)||dmt(a))||o&&Xn(a))return!0}return!1}var mmt="4.4.7";const gmt=["top","bottom","left","right","chartArea"];function SH(t,e){return t==="top"||t==="bottom"||gmt.indexOf(t)===-1&&e==="x"}function _H(t,e){return function(n,r){return n[t]===r[t]?n[e]-r[e]:n[t]-r[t]}}function kH(t){const e=t.chart,n=e.options.animation;e.notifyPlugins("afterRender"),jn(n&&n.onComplete,[t],e)}function vmt(t){const e=t.chart,n=e.options.animation;jn(n&&n.onProgress,[t],e)}function Z0e(t){return dL()&&typeof t=="string"?t=document.getElementById(t):t&&t.length&&(t=t[0]),t&&t.canvas&&(t=t.canvas),t}const f2={},CH=t=>{const e=Z0e(t);return Object.values(f2).filter(n=>n.canvas===e).pop()};function Omt(t,e,n){const r=Object.keys(t);for(const i of r){const s=+i;if(s>=e){const o=t[i];delete t[i],(n>0||s>e)&&(t[s+n]=o)}}}function ymt(t,e,n,r){return!n||t.type==="mouseout"?null:r?e:t}function Fw(t,e,n){return t.options.clip?t[n]:e[n]}function bmt(t,e){const{xScale:n,yScale:r}=t;return n&&r?{left:Fw(n,e,"left"),right:Fw(n,e,"right"),top:Fw(r,e,"top"),bottom:Fw(r,e,"bottom")}:e}class ll{static register(...e){il.add(...e),EH()}static unregister(...e){il.remove(...e),EH()}constructor(e,n){const r=this.config=new hmt(n),i=Z0e(e),s=CH(i);if(s)throw new Error("Canvas is already in use. Chart with ID '"+s.id+"' must be destroyed before the canvas with ID '"+s.canvas.id+"' can be reused.");const o=r.createResolver(r.chartOptionScopes(),this.getContext());this.platform=new(r.platform||Npt(i)),this.platform.updateConfig(r);const a=this.platform.acquireContext(i,o.aspectRatio),l=a&&a.canvas,c=l&&l.height,u=l&&l.width;if(this.id=wdt(),this.ctx=a,this.canvas=l,this.width=u,this.height=c,this._options=o,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new tmt,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=Qdt(f=>this.update(f),o.resizeDelay||0),this._dataChanges=[],f2[this.id]=this,!a||!l){console.error("Failed to create chart: can't acquire context from the given item");return}mc.listen(this,"complete",kH),mc.listen(this,"progress",vmt),this._initialize(),this.attached&&this.update()}get aspectRatio(){const{options:{aspectRatio:e,maintainAspectRatio:n},width:r,height:i,_aspectRatio:s}=this;return ln(e)?n&&s?s:i?r/i:null:e}get data(){return this.config.data}set data(e){this.config.data=e}get options(){return this._options}set options(e){this.config.options=e}get registry(){return il}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():ZX(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return qX(this.canvas,this.ctx),this}stop(){return mc.stop(this),this}resize(e,n){mc.running(this)?this._resizeBeforeDraw={width:e,height:n}:this._resize(e,n)}_resize(e,n){const r=this.options,i=this.canvas,s=r.maintainAspectRatio&&this.aspectRatio,o=this.platform.getMaximumSize(i,e,n,s),a=r.devicePixelRatio||this.platform.getDevicePixelRatio(),l=this.width?"resize":"attach";this.width=o.width,this.height=o.height,this._aspectRatio=this.aspectRatio,ZX(this,a,!0)&&(this.notifyPlugins("resize",{size:o}),jn(r.onResize,[this,o],this),this.attached&&this._doResize(l)&&this.render())}ensureScalesHaveIDs(){const n=this.options.scales||{};xn(n,(r,i)=>{r.id=i})}buildOrUpdateScales(){const e=this.options,n=e.scales,r=this.scales,i=Object.keys(r).reduce((o,a)=>(o[a]=!1,o),{});let s=[];n&&(s=s.concat(Object.keys(n).map(o=>{const a=n[o],l=WA(o,a),c=l==="r",u=l==="x";return{options:a,dposition:c?"chartArea":u?"bottom":"left",dtype:c?"radialLinear":u?"category":"linear"}}))),xn(s,o=>{const a=o.options,l=a.id,c=WA(l,a),u=Mt(a.type,o.dtype);(a.position===void 0||SH(a.position,c)!==SH(o.dposition))&&(a.position=o.dposition),i[l]=!0;let f=null;if(l in r&&r[l].type===u)f=r[l];else{const h=il.getScale(u);f=new h({id:l,type:u,ctx:this.ctx,chart:this}),r[f.id]=f}f.init(a,e)}),xn(i,(o,a)=>{o||delete r[a]}),xn(r,o=>{Bi.configure(this,o,o.options),Bi.addBox(this,o)})}_updateMetasets(){const e=this._metasets,n=this.data.datasets.length,r=e.length;if(e.sort((i,s)=>i.index-s.index),r>n){for(let i=n;i<r;++i)this._destroyDatasetMeta(i);e.splice(n,r-n)}this._sortedMetasets=e.slice(0).sort(_H("order","index"))}_removeUnreferencedMetasets(){const{_metasets:e,data:{datasets:n}}=this;e.length>n.length&&delete this._stacks,e.forEach((r,i)=>{n.filter(s=>s===r._dataset).length===0&&this._destroyDatasetMeta(i)})}buildOrUpdateControllers(){const e=[],n=this.data.datasets;let r,i;for(this._removeUnreferencedMetasets(),r=0,i=n.length;r<i;r++){const s=n[r];let o=this.getDatasetMeta(r);const a=s.type||this.config.type;if(o.type&&o.type!==a&&(this._destroyDatasetMeta(r),o=this.getDatasetMeta(r)),o.type=a,o.indexAxis=s.indexAxis||FA(a,this.options),o.order=s.order||0,o.index=r,o.label=""+s.label,o.visible=this.isDatasetVisible(r),o.controller)o.controller.updateIndex(r),o.controller.linkScales();else{const l=il.getController(a),{datasetElementType:c,dataElementType:u}=rr.datasets[a];Object.assign(l,{dataElementType:il.getElement(u),datasetElementType:c&&il.getElement(c)}),o.controller=new l(this,r),e.push(o.controller)}}return this._updateMetasets(),e}_resetElements(){xn(this.data.datasets,(e,n)=>{this.getDatasetMeta(n).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(e){const n=this.config;n.update();const r=this._options=n.createResolver(n.chartOptionScopes(),this.getContext()),i=this._animationsDisabled=!r.animation;if(this._updateScales(),this._checkEventBindings(),this._updateHiddenIndices(),this._plugins.invalidate(),this.notifyPlugins("beforeUpdate",{mode:e,cancelable:!0})===!1)return;const s=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let o=0;for(let c=0,u=this.data.datasets.length;c<u;c++){const{controller:f}=this.getDatasetMeta(c),h=!i&&s.indexOf(f)===-1;f.buildOrUpdateElements(h),o=Math.max(+f.getMaxOverflow(),o)}o=this._minPadding=r.layout.autoPadding?o:0,this._updateLayout(o),i||xn(s,c=>{c.reset()}),this._updateDatasets(e),this.notifyPlugins("afterUpdate",{mode:e}),this._layers.sort(_H("z","_idx"));const{_active:a,_lastEvent:l}=this;l?this._eventHandler(l,!0):a.length&&this._updateHoverStyles(a,a,!0),this.render()}_updateScales(){xn(this.scales,e=>{Bi.removeBox(this,e)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const e=this.options,n=new Set(Object.keys(this._listeners)),r=new Set(e.events);(!NX(n,r)||!!this._responsiveListeners!==e.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:e}=this,n=this._getUniformDataChanges()||[];for(const{method:r,start:i,count:s}of n){const o=r==="_removeElements"?-s:s;Omt(e,i,o)}}_getUniformDataChanges(){const e=this._dataChanges;if(!e||!e.length)return;this._dataChanges=[];const n=this.data.datasets.length,r=s=>new Set(e.filter(o=>o[0]===s).map((o,a)=>a+","+o.splice(1).join(","))),i=r(0);for(let s=1;s<n;s++)if(!NX(i,r(s)))return;return Array.from(i).map(s=>s.split(",")).map(s=>({method:s[1],start:+s[2],count:+s[3]}))}_updateLayout(e){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;Bi.update(this,this.width,this.height,e);const n=this.chartArea,r=n.width<=0||n.height<=0;this._layers=[],xn(this.boxes,i=>{r&&i.position==="chartArea"||(i.configure&&i.configure(),this._layers.push(...i._layers()))},this),this._layers.forEach((i,s)=>{i._idx=s}),this.notifyPlugins("afterLayout")}_updateDatasets(e){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:e,cancelable:!0})!==!1){for(let n=0,r=this.data.datasets.length;n<r;++n)this.getDatasetMeta(n).controller.configure();for(let n=0,r=this.data.datasets.length;n<r;++n)this._updateDataset(n,Df(e)?e({datasetIndex:n}):e);this.notifyPlugins("afterDatasetsUpdate",{mode:e})}}_updateDataset(e,n){const r=this.getDatasetMeta(e),i={meta:r,index:e,mode:n,cancelable:!0};this.notifyPlugins("beforeDatasetUpdate",i)!==!1&&(r.controller._update(n),i.cancelable=!1,this.notifyPlugins("afterDatasetUpdate",i))}render(){this.notifyPlugins("beforeRender",{cancelable:!0})!==!1&&(mc.has(this)?this.attached&&!mc.running(this)&&mc.start(this):(this.draw(),kH({chart:this})))}draw(){let e;if(this._resizeBeforeDraw){const{width:r,height:i}=this._resizeBeforeDraw;this._resizeBeforeDraw=null,this._resize(r,i)}if(this.clear(),this.width<=0||this.height<=0||this.notifyPlugins("beforeDraw",{cancelable:!0})===!1)return;const n=this._layers;for(e=0;e<n.length&&n[e].z<=0;++e)n[e].draw(this.chartArea);for(this._drawDatasets();e<n.length;++e)n[e].draw(this.chartArea);this.notifyPlugins("afterDraw")}_getSortedDatasetMetas(e){const n=this._sortedMetasets,r=[];let i,s;for(i=0,s=n.length;i<s;++i){const o=n[i];(!e||o.visible)&&r.push(o)}return r}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(this.notifyPlugins("beforeDatasetsDraw",{cancelable:!0})===!1)return;const e=this.getSortedVisibleDatasetMetas();for(let n=e.length-1;n>=0;--n)this._drawDataset(e[n]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(e){const n=this.ctx,r=e._clip,i=!r.disabled,s=bmt(e,this.chartArea),o={meta:e,index:e.index,cancelable:!0};this.notifyPlugins("beforeDatasetDraw",o)!==!1&&(i&&ak(n,{left:r.left===!1?0:s.left-r.left,right:r.right===!1?this.width:s.right+r.right,top:r.top===!1?0:s.top-r.top,bottom:r.bottom===!1?this.height:s.bottom+r.bottom}),e.controller.draw(),i&&lk(n),o.cancelable=!1,this.notifyPlugins("afterDatasetDraw",o))}isPointInArea(e){return $c(e,this.chartArea,this._minPadding)}getElementsAtEventForMode(e,n,r,i){const s=gpt.modes[n];return typeof s=="function"?s(this,e,r,i):[]}getDatasetMeta(e){const n=this.data.datasets[e],r=this._metasets;let i=r.filter(s=>s&&s._dataset===n).pop();return i||(i={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:n&&n.order||0,index:e,_dataset:n,_parsed:[],_sorted:!1},r.push(i)),i}getContext(){return this.$context||(this.$context=Kf(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(e){const n=this.data.datasets[e];if(!n)return!1;const r=this.getDatasetMeta(e);return typeof r.hidden=="boolean"?!r.hidden:!n.hidden}setDatasetVisibility(e,n){const r=this.getDatasetMeta(e);r.hidden=!n}toggleDataVisibility(e){this._hiddenIndices[e]=!this._hiddenIndices[e]}getDataVisibility(e){return!this._hiddenIndices[e]}_updateVisibility(e,n,r){const i=r?"show":"hide",s=this.getDatasetMeta(e),o=s.controller._resolveAnimations(void 0,i);VO(n)?(s.data[n].hidden=!r,this.update()):(this.setDatasetVisibility(e,r),o.update(s,{visible:r}),this.update(a=>a.datasetIndex===e?i:void 0))}hide(e,n){this._updateVisibility(e,n,!1)}show(e,n){this._updateVisibility(e,n,!0)}_destroyDatasetMeta(e){const n=this._metasets[e];n&&n.controller&&n.controller._destroy(),delete this._metasets[e]}_stop(){let e,n;for(this.stop(),mc.remove(this),e=0,n=this.data.datasets.length;e<n;++e)this._destroyDatasetMeta(e)}destroy(){this.notifyPlugins("beforeDestroy");const{canvas:e,ctx:n}=this;this._stop(),this.config.clearCache(),e&&(this.unbindEvents(),qX(e,n),this.platform.releaseContext(n),this.canvas=null,this.ctx=null),delete f2[this.id],this.notifyPlugins("afterDestroy")}toBase64Image(...e){return this.canvas.toDataURL(...e)}bindEvents(){this.bindUserEvents(),this.options.responsive?this.bindResponsiveEvents():this.attached=!0}bindUserEvents(){const e=this._listeners,n=this.platform,r=(s,o)=>{n.addEventListener(this,s,o),e[s]=o},i=(s,o,a)=>{s.offsetX=o,s.offsetY=a,this._eventHandler(s)};xn(this.options.events,s=>r(s,i))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const e=this._responsiveListeners,n=this.platform,r=(l,c)=>{n.addEventListener(this,l,c),e[l]=c},i=(l,c)=>{e[l]&&(n.removeEventListener(this,l,c),delete e[l])},s=(l,c)=>{this.canvas&&this.resize(l,c)};let o;const a=()=>{i("attach",a),this.attached=!0,this.resize(),r("resize",s),r("detach",o)};o=()=>{this.attached=!1,i("resize",s),this._stop(),this._resize(0,0),r("attach",a)},n.isAttached(this.canvas)?a():o()}unbindEvents(){xn(this._listeners,(e,n)=>{this.platform.removeEventListener(this,n,e)}),this._listeners={},xn(this._responsiveListeners,(e,n)=>{this.platform.removeEventListener(this,n,e)}),this._responsiveListeners=void 0}updateHoverStyle(e,n,r){const i=r?"set":"remove";let s,o,a,l;for(n==="dataset"&&(s=this.getDatasetMeta(e[0].datasetIndex),s.controller["_"+i+"DatasetHoverStyle"]()),a=0,l=e.length;a<l;++a){o=e[a];const c=o&&this.getDatasetMeta(o.datasetIndex).controller;c&&c[i+"HoverStyle"](o.element,o.datasetIndex,o.index)}}getActiveElements(){return this._active||[]}setActiveElements(e){const n=this._active||[],r=e.map(({datasetIndex:s,index:o})=>{const a=this.getDatasetMeta(s);if(!a)throw new Error("No dataset found at index "+s);return{datasetIndex:s,element:a.data[o],index:o}});!b4(r,n)&&(this._active=r,this._lastEvent=null,this._updateHoverStyles(r,n))}notifyPlugins(e,n,r){return this._plugins.notify(this,e,n,r)}isPluginEnabled(e){return this._plugins._cache.filter(n=>n.plugin.id===e).length===1}_updateHoverStyles(e,n,r){const i=this.options.hover,s=(l,c)=>l.filter(u=>!c.some(f=>u.datasetIndex===f.datasetIndex&&u.index===f.index)),o=s(n,e),a=r?e:s(e,n);o.length&&this.updateHoverStyle(o,i.mode,!1),a.length&&i.mode&&this.updateHoverStyle(a,i.mode,!0)}_eventHandler(e,n){const r={event:e,replay:n,cancelable:!0,inChartArea:this.isPointInArea(e)},i=o=>(o.options.events||this.options.events).includes(e.native.type);if(this.notifyPlugins("beforeEvent",r,i)===!1)return;const s=this._handleEvent(e,n,r.inChartArea);return r.cancelable=!1,this.notifyPlugins("afterEvent",r,i),(s||r.changed)&&this.render(),this}_handleEvent(e,n,r){const{_active:i=[],options:s}=this,o=n,a=this._getActiveElements(e,i,r,o),l=Tdt(e),c=ymt(e,this._lastEvent,r,l);r&&(this._lastEvent=null,jn(s.onHover,[e,a,this],this),l&&jn(s.onClick,[e,a,this],this));const u=!b4(a,i);return(u||n)&&(this._active=a,this._updateHoverStyles(a,i,n)),this._lastEvent=c,u}_getActiveElements(e,n,r,i){if(e.type==="mouseout")return[];if(!r)return n;const s=this.options.hover;return this.getElementsAtEventForMode(e,s.mode,s,i)}}Le(ll,"defaults",rr),Le(ll,"instances",f2),Le(ll,"overrides",Cd),Le(ll,"registry",il),Le(ll,"version",mmt),Le(ll,"getChart",CH);function EH(){return xn(ll.instances,t=>t._plugins.invalidate())}function xmt(t,e,n){const{startAngle:r,pixelMargin:i,x:s,y:o,outerRadius:a,innerRadius:l}=e;let c=i/a;t.beginPath(),t.arc(s,o,a,r-c,n+c),l>i?(c=i/l,t.arc(s,o,l,n+c,r-c,!0)):t.arc(s,o,i,n+Mr,r-Mr),t.closePath(),t.clip()}function wmt(t){return cL(t,["outerStart","outerEnd","innerStart","innerEnd"])}function Smt(t,e,n,r){const i=wmt(t.options.borderRadius),s=(n-e)/2,o=Math.min(s,r*e/2),a=l=>{const c=(n-Math.min(s,l))*r/2;return ui(l,0,Math.min(s,c))};return{outerStart:a(i.outerStart),outerEnd:a(i.outerEnd),innerStart:ui(i.innerStart,0,o),innerEnd:ui(i.innerEnd,0,o)}}function P0(t,e,n,r){return{x:n+t*Math.cos(e),y:r+t*Math.sin(e)}}function C4(t,e,n,r,i,s){const{x:o,y:a,startAngle:l,pixelMargin:c,innerRadius:u}=e,f=Math.max(e.outerRadius+r+n-c,0),h=u>0?u+r+n+c:0;let d=0;const p=i-l;if(r){const q=u>0?u-r:0,Z=f>0?f-r:0,J=(q+Z)/2,I=J!==0?p*J/(J+r):p;d=(p-I)/2}const g=Math.max(.001,p*f-n/Gn)/f,m=(p-g)/2,v=l+m+d,y=i-m-d,{outerStart:b,outerEnd:S,innerStart:k,innerEnd:E}=Smt(e,h,f,y-v),T=f-b,C=f-S,A=v+b/T,R=y-S/C,Q=h+k,L=h+E,z=v+k/Q,B=y-E/L;if(t.beginPath(),s){const q=(A+R)/2;if(t.arc(o,a,f,A,q),t.arc(o,a,f,q,R),S>0){const j=P0(C,R,o,a);t.arc(j.x,j.y,S,R,y+Mr)}const Z=P0(L,y,o,a);if(t.lineTo(Z.x,Z.y),E>0){const j=P0(L,B,o,a);t.arc(j.x,j.y,E,y+Mr,B+Math.PI)}const J=(y-E/h+(v+k/h))/2;if(t.arc(o,a,h,y-E/h,J,!0),t.arc(o,a,h,J,v+k/h,!0),k>0){const j=P0(Q,z,o,a);t.arc(j.x,j.y,k,z+Math.PI,v-Mr)}const I=P0(T,v,o,a);if(t.lineTo(I.x,I.y),b>0){const j=P0(T,A,o,a);t.arc(j.x,j.y,b,v-Mr,A)}}else{t.moveTo(o,a);const q=Math.cos(A)*f+o,Z=Math.sin(A)*f+a;t.lineTo(q,Z);const J=Math.cos(R)*f+o,I=Math.sin(R)*f+a;t.lineTo(J,I)}t.closePath()}function _mt(t,e,n,r,i){const{fullCircles:s,startAngle:o,circumference:a}=e;let l=e.endAngle;if(s){C4(t,e,n,r,l,i);for(let c=0;c<s;++c)t.fill();isNaN(a)||(l=o+(a%Yn||Yn))}return C4(t,e,n,r,l,i),t.fill(),l}function kmt(t,e,n,r,i){const{fullCircles:s,startAngle:o,circumference:a,options:l}=e,{borderWidth:c,borderJoinStyle:u,borderDash:f,borderDashOffset:h}=l,d=l.borderAlign==="inner";if(!c)return;t.setLineDash(f||[]),t.lineDashOffset=h,d?(t.lineWidth=c*2,t.lineJoin=u||"round"):(t.lineWidth=c,t.lineJoin=u||"bevel");let p=e.endAngle;if(s){C4(t,e,n,r,p,i);for(let g=0;g<s;++g)t.stroke();isNaN(a)||(p=o+(a%Yn||Yn))}d&&xmt(t,e,p),s||(C4(t,e,n,r,p,i),t.stroke())}class L1 extends fu{constructor(n){super();Le(this,"circumference");Le(this,"endAngle");Le(this,"fullCircles");Le(this,"innerRadius");Le(this,"outerRadius");Le(this,"pixelMargin");Le(this,"startAngle");this.options=void 0,this.circumference=void 0,this.startAngle=void 0,this.endAngle=void 0,this.innerRadius=void 0,this.outerRadius=void 0,this.pixelMargin=0,this.fullCircles=0,n&&Object.assign(this,n)}inRange(n,r,i){const s=this.getProps(["x","y"],i),{angle:o,distance:a}=v0e(s,{x:n,y:r}),{startAngle:l,endAngle:c,innerRadius:u,outerRadius:f,circumference:h}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],i),d=(this.options.spacing+this.options.borderWidth)/2,p=Mt(h,c-l),g=UO(o,l,c)&&l!==c,m=p>=Yn||g,v=Ac(a,u+d,f+d);return m&&v}getCenterPoint(n){const{x:r,y:i,startAngle:s,endAngle:o,innerRadius:a,outerRadius:l}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],n),{offset:c,spacing:u}=this.options,f=(s+o)/2,h=(a+l+u+c)/2;return{x:r+Math.cos(f)*h,y:i+Math.sin(f)*h}}tooltipPosition(n){return this.getCenterPoint(n)}draw(n){const{options:r,circumference:i}=this,s=(r.offset||0)/4,o=(r.spacing||0)/2,a=r.circular;if(this.pixelMargin=r.borderAlign==="inner"?.33:0,this.fullCircles=i>Yn?Math.floor(i/Yn):0,i===0||this.innerRadius<0||this.outerRadius<0)return;n.save();const l=(this.startAngle+this.endAngle)/2;n.translate(Math.cos(l)*s,Math.sin(l)*s);const c=1-Math.sin(Math.min(Gn,i||0)),u=s*c;n.fillStyle=r.backgroundColor,n.strokeStyle=r.borderColor,_mt(n,this,u,o,a),kmt(n,this,u,o,a),n.restore()}}Le(L1,"id","arc"),Le(L1,"defaults",{borderAlign:"center",borderColor:"#fff",borderDash:[],borderDashOffset:0,borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0}),Le(L1,"defaultRoutes",{backgroundColor:"backgroundColor"}),Le(L1,"descriptors",{_scriptable:!0,_indexable:n=>n!=="borderDash"});function Y0e(t,e,n=e){t.lineCap=Mt(n.borderCapStyle,e.borderCapStyle),t.setLineDash(Mt(n.borderDash,e.borderDash)),t.lineDashOffset=Mt(n.borderDashOffset,e.borderDashOffset),t.lineJoin=Mt(n.borderJoinStyle,e.borderJoinStyle),t.lineWidth=Mt(n.borderWidth,e.borderWidth),t.strokeStyle=Mt(n.borderColor,e.borderColor)}function Cmt(t,e,n){t.lineTo(n.x,n.y)}function Emt(t){return t.stepped?Ydt:t.tension||t.cubicInterpolationMode==="monotone"?Gdt:Cmt}function G0e(t,e,n={}){const r=t.length,{start:i=0,end:s=r-1}=n,{start:o,end:a}=e,l=Math.max(i,o),c=Math.min(s,a),u=i<o&&s<o||i>a&&s>a;return{count:r,start:l,loop:e.loop,ilen:c<l&&!u?r+c-l:c-l}}function Tmt(t,e,n,r){const{points:i,options:s}=e,{count:o,start:a,loop:l,ilen:c}=G0e(i,n,r),u=Emt(s);let{move:f=!0,reverse:h}=r||{},d,p,g;for(d=0;d<=c;++d)p=i[(a+(h?c-d:d))%o],!p.skip&&(f?(t.moveTo(p.x,p.y),f=!1):u(t,g,p,h,s.stepped),g=p);return l&&(p=i[(a+(h?c:0))%o],u(t,g,p,h,s.stepped)),!!l}function Pmt(t,e,n,r){const i=e.points,{count:s,start:o,ilen:a}=G0e(i,n,r),{move:l=!0,reverse:c}=r||{};let u=0,f=0,h,d,p,g,m,v;const y=S=>(o+(c?a-S:S))%s,b=()=>{g!==m&&(t.lineTo(u,m),t.lineTo(u,g),t.lineTo(u,v))};for(l&&(d=i[y(0)],t.moveTo(d.x,d.y)),h=0;h<=a;++h){if(d=i[y(h)],d.skip)continue;const S=d.x,k=d.y,E=S|0;E===p?(k<g?g=k:k>m&&(m=k),u=(f*u+S)/++f):(b(),t.lineTo(S,k),p=E,f=0,g=m=k),v=k}b()}function VA(t){const e=t.options,n=e.borderDash&&e.borderDash.length;return!t._decimated&&!t._loop&&!e.tension&&e.cubicInterpolationMode!=="monotone"&&!e.stepped&&!n?Pmt:Tmt}function Amt(t){return t.stepped?P0t:t.tension||t.cubicInterpolationMode==="monotone"?A0t:$h}function Rmt(t,e,n,r){let i=e._path;i||(i=e._path=new Path2D,e.path(i,n,r)&&i.closePath()),Y0e(t,e.options),t.stroke(i)}function $mt(t,e,n,r){const{segments:i,options:s}=e,o=VA(e);for(const a of i)Y0e(t,s,a.style),t.beginPath(),o(t,e,a,{start:n,end:n+r-1})&&t.closePath(),t.stroke()}const Mmt=typeof Path2D=="function";function Imt(t,e,n,r){Mmt&&!e.options.segment?Rmt(t,e,n,r):$mt(t,e,n,r)}class Gu extends fu{constructor(e){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,e&&Object.assign(this,e)}updateControlPoints(e,n){const r=this.options;if((r.tension||r.cubicInterpolationMode==="monotone")&&!r.stepped&&!this._pointsUpdated){const i=r.spanGaps?this._loop:this._fullLoop;x0t(this._points,r,e,i,n),this._pointsUpdated=!0}}set points(e){this._points=e,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=L0t(this,this.options.segment))}first(){const e=this.segments,n=this.points;return e.length&&n[e[0].start]}last(){const e=this.segments,n=this.points,r=e.length;return r&&n[e[r-1].end]}interpolate(e,n){const r=this.options,i=e[n],s=this.points,o=N0e(this,{property:n,start:i,end:i});if(!o.length)return;const a=[],l=Amt(r);let c,u;for(c=0,u=o.length;c<u;++c){const{start:f,end:h}=o[c],d=s[f],p=s[h];if(d===p){a.push(d);continue}const g=Math.abs((i-d[n])/(p[n]-d[n])),m=l(d,p,g,r.stepped);m[n]=e[n],a.push(m)}return a.length===1?a[0]:a}pathSegment(e,n,r){return VA(this)(e,this,n,r)}path(e,n,r){const i=this.segments,s=VA(this);let o=this._loop;n=n||0,r=r||this.points.length-n;for(const a of i)o&=s(e,this,a,{start:n,end:n+r-1});return!!o}draw(e,n,r,i){const s=this.options||{};(this.points||[]).length&&s.borderWidth&&(e.save(),Imt(e,this,r,i),e.restore()),this.animated&&(this._pointsUpdated=!1,this._path=void 0)}}Le(Gu,"id","line"),Le(Gu,"defaults",{borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0}),Le(Gu,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"}),Le(Gu,"descriptors",{_scriptable:!0,_indexable:e=>e!=="borderDash"&&e!=="fill"});function TH(t,e,n,r){const i=t.options,{[n]:s}=t.getProps([n],r);return Math.abs(e-s)<i.radius+i.hitRadius}class h2 extends fu{constructor(n){super();Le(this,"parsed");Le(this,"skip");Le(this,"stop");this.options=void 0,this.parsed=void 0,this.skip=void 0,this.stop=void 0,n&&Object.assign(this,n)}inRange(n,r,i){const s=this.options,{x:o,y:a}=this.getProps(["x","y"],i);return Math.pow(n-o,2)+Math.pow(r-a,2)<Math.pow(s.hitRadius+s.radius,2)}inXRange(n,r){return TH(this,n,"x",r)}inYRange(n,r){return TH(this,n,"y",r)}getCenterPoint(n){const{x:r,y:i}=this.getProps(["x","y"],n);return{x:r,y:i}}size(n){n=n||this.options||{};let r=n.radius||0;r=Math.max(r,r&&n.hoverRadius||0);const i=r&&n.borderWidth||0;return(r+i)*2}draw(n,r){const i=this.options;this.skip||i.radius<.1||!$c(this,r,this.size(i)/2)||(n.strokeStyle=i.borderColor,n.lineWidth=i.borderWidth,n.fillStyle=i.backgroundColor,BA(n,i,this.x,this.y))}getRange(){const n=this.options||{};return n.radius+n.hitRadius}}Le(h2,"id","point"),Le(h2,"defaults",{borderWidth:1,hitRadius:1,hoverBorderWidth:1,hoverRadius:4,pointStyle:"circle",radius:3,rotation:0}),Le(h2,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"});function K0e(t,e){const{x:n,y:r,base:i,width:s,height:o}=t.getProps(["x","y","base","width","height"],e);let a,l,c,u,f;return t.horizontal?(f=o/2,a=Math.min(n,i),l=Math.max(n,i),c=r-f,u=r+f):(f=s/2,a=n-f,l=n+f,c=Math.min(r,i),u=Math.max(r,i)),{left:a,top:c,right:l,bottom:u}}function Ku(t,e,n,r){return t?0:ui(e,n,r)}function Dmt(t,e,n){const r=t.options.borderWidth,i=t.borderSkipped,s=C0e(r);return{t:Ku(i.top,s.top,0,n),r:Ku(i.right,s.right,0,e),b:Ku(i.bottom,s.bottom,0,n),l:Ku(i.left,s.left,0,e)}}function Lmt(t,e,n){const{enableBorderRadius:r}=t.getProps(["enableBorderRadius"]),i=t.options.borderRadius,s=id(i),o=Math.min(e,n),a=t.borderSkipped,l=r||Zt(i);return{topLeft:Ku(!l||a.top||a.left,s.topLeft,0,o),topRight:Ku(!l||a.top||a.right,s.topRight,0,o),bottomLeft:Ku(!l||a.bottom||a.left,s.bottomLeft,0,o),bottomRight:Ku(!l||a.bottom||a.right,s.bottomRight,0,o)}}function Nmt(t){const e=K0e(t),n=e.right-e.left,r=e.bottom-e.top,i=Dmt(t,n/2,r/2),s=Lmt(t,n/2,r/2);return{outer:{x:e.left,y:e.top,w:n,h:r,radius:s},inner:{x:e.left+i.l,y:e.top+i.t,w:n-i.l-i.r,h:r-i.t-i.b,radius:{topLeft:Math.max(0,s.topLeft-Math.max(i.t,i.l)),topRight:Math.max(0,s.topRight-Math.max(i.t,i.r)),bottomLeft:Math.max(0,s.bottomLeft-Math.max(i.b,i.l)),bottomRight:Math.max(0,s.bottomRight-Math.max(i.b,i.r))}}}}function oE(t,e,n,r){const i=e===null,s=n===null,a=t&&!(i&&s)&&K0e(t,r);return a&&(i||Ac(e,a.left,a.right))&&(s||Ac(n,a.top,a.bottom))}function Qmt(t){return t.topLeft||t.topRight||t.bottomLeft||t.bottomRight}function jmt(t,e){t.rect(e.x,e.y,e.w,e.h)}function aE(t,e,n={}){const r=t.x!==n.x?-e:0,i=t.y!==n.y?-e:0,s=(t.x+t.w!==n.x+n.w?e:0)-r,o=(t.y+t.h!==n.y+n.h?e:0)-i;return{x:t.x+r,y:t.y+i,w:t.w+s,h:t.h+o,radius:t.radius}}class d2 extends fu{constructor(e){super(),this.options=void 0,this.horizontal=void 0,this.base=void 0,this.width=void 0,this.height=void 0,this.inflateAmount=void 0,e&&Object.assign(this,e)}draw(e){const{inflateAmount:n,options:{borderColor:r,backgroundColor:i}}=this,{inner:s,outer:o}=Nmt(this),a=Qmt(o.radius)?qO:jmt;e.save(),(o.w!==s.w||o.h!==s.h)&&(e.beginPath(),a(e,aE(o,n,s)),e.clip(),a(e,aE(s,-n,o)),e.fillStyle=r,e.fill("evenodd")),e.beginPath(),a(e,aE(s,n)),e.fillStyle=i,e.fill(),e.restore()}inRange(e,n,r){return oE(this,e,n,r)}inXRange(e,n){return oE(this,e,null,n)}inYRange(e,n){return oE(this,null,e,n)}getCenterPoint(e){const{x:n,y:r,base:i,horizontal:s}=this.getProps(["x","y","base","horizontal"],e);return{x:s?(n+i)/2:n,y:s?r:(r+i)/2}}getRange(e){return e==="x"?this.width/2:this.height/2}}Le(d2,"id","bar"),Le(d2,"defaults",{borderSkipped:"start",borderWidth:0,borderRadius:0,inflateAmount:"auto",pointStyle:void 0}),Le(d2,"defaultRoutes",{backgroundColor:"backgroundColor",borderColor:"borderColor"});var Bmt=Object.freeze({__proto__:null,ArcElement:L1,BarElement:d2,LineElement:Gu,PointElement:h2});const UA=["rgb(54, 162, 235)","rgb(255, 99, 132)","rgb(255, 159, 64)","rgb(255, 205, 86)","rgb(75, 192, 192)","rgb(153, 102, 255)","rgb(201, 203, 207)"],PH=UA.map(t=>t.replace("rgb(","rgba(").replace(")",", 0.5)"));function J0e(t){return UA[t%UA.length]}function epe(t){return PH[t%PH.length]}function zmt(t,e){return t.borderColor=J0e(e),t.backgroundColor=epe(e),++e}function Fmt(t,e){return t.backgroundColor=t.data.map(()=>J0e(e++)),e}function Wmt(t,e){return t.backgroundColor=t.data.map(()=>epe(e++)),e}function Vmt(t){let e=0;return(n,r)=>{const i=t.getDatasetMeta(r).controller;i instanceof ed?e=Fmt(n,e):i instanceof xv?e=Wmt(n,e):i&&(e=zmt(n,e))}}function AH(t){let e;for(e in t)if(t[e].borderColor||t[e].backgroundColor)return!0;return!1}function Umt(t){return t&&(t.borderColor||t.backgroundColor)}function qmt(){return rr.borderColor!=="rgba(0,0,0,0.1)"||rr.backgroundColor!=="rgba(0,0,0,0.1)"}var Xmt={id:"colors",defaults:{enabled:!0,forceOverride:!1},beforeLayout(t,e,n){if(!n.enabled)return;const{data:{datasets:r},options:i}=t.config,{elements:s}=i,o=AH(r)||Umt(i)||s&&AH(s)||qmt();if(!n.forceOverride&&o)return;const a=Vmt(t);r.forEach(a)}};function Hmt(t,e,n,r,i){const s=i.samples||r;if(s>=n)return t.slice(e,e+n);const o=[],a=(n-2)/(s-2);let l=0;const c=e+n-1;let u=e,f,h,d,p,g;for(o[l++]=t[u],f=0;f<s-2;f++){let m=0,v=0,y;const b=Math.floor((f+1)*a)+1+e,S=Math.min(Math.floor((f+2)*a)+1,n)+e,k=S-b;for(y=b;y<S;y++)m+=t[y].x,v+=t[y].y;m/=k,v/=k;const E=Math.floor(f*a)+1+e,T=Math.min(Math.floor((f+1)*a)+1,n)+e,{x:C,y:A}=t[u];for(d=p=-1,y=E;y<T;y++)p=.5*Math.abs((C-m)*(t[y].y-A)-(C-t[y].x)*(v-A)),p>d&&(d=p,h=t[y],g=y);o[l++]=h,u=g}return o[l++]=t[c],o}function Zmt(t,e,n,r){let i=0,s=0,o,a,l,c,u,f,h,d,p,g;const m=[],v=e+n-1,y=t[e].x,S=t[v].x-y;for(o=e;o<e+n;++o){a=t[o],l=(a.x-y)/S*r,c=a.y;const k=l|0;if(k===u)c<p?(p=c,f=o):c>g&&(g=c,h=o),i=(s*i+a.x)/++s;else{const E=o-1;if(!ln(f)&&!ln(h)){const T=Math.min(f,h),C=Math.max(f,h);T!==d&&T!==E&&m.push({...t[T],x:i}),C!==d&&C!==E&&m.push({...t[C],x:i})}o>0&&E!==d&&m.push(t[E]),m.push(a),u=k,s=0,p=g=c,f=h=d=o}}return m}function tpe(t){if(t._decimated){const e=t._data;delete t._decimated,delete t._data,Object.defineProperty(t,"data",{configurable:!0,enumerable:!0,writable:!0,value:e})}}function RH(t){t.data.datasets.forEach(e=>{tpe(e)})}function Ymt(t,e){const n=e.length;let r=0,i;const{iScale:s}=t,{min:o,max:a,minDefined:l,maxDefined:c}=s.getUserBounds();return l&&(r=ui(Rc(e,s.axis,o).lo,0,n-1)),c?i=ui(Rc(e,s.axis,a).hi+1,r,n)-r:i=n-r,{start:r,count:i}}var Gmt={id:"decimation",defaults:{algorithm:"min-max",enabled:!1},beforeElementsUpdate:(t,e,n)=>{if(!n.enabled){RH(t);return}const r=t.width;t.data.datasets.forEach((i,s)=>{const{_data:o,indexAxis:a}=i,l=t.getDatasetMeta(s),c=o||i.data;if(I1([a,t.options.indexAxis])==="y"||!l.controller.supportsDecimation)return;const u=t.scales[l.xAxisID];if(u.type!=="linear"&&u.type!=="time"||t.options.parsing)return;let{start:f,count:h}=Ymt(l,c);const d=n.threshold||4*r;if(h<=d){tpe(i);return}ln(o)&&(i._data=c,delete i.data,Object.defineProperty(i,"data",{configurable:!0,enumerable:!0,get:function(){return this._decimated},set:function(g){this._data=g}}));let p;switch(n.algorithm){case"lttb":p=Hmt(c,f,h,r,n);break;case"min-max":p=Zmt(c,f,h,r);break;default:throw new Error(`Unsupported decimation algorithm '${n.algorithm}'`)}i._decimated=p})},destroy(t){RH(t)}};function Kmt(t,e,n){const r=t.segments,i=t.points,s=e.points,o=[];for(const a of r){let{start:l,end:c}=a;c=gL(l,c,i);const u=qA(n,i[l],i[c],a.loop);if(!e.segments){o.push({source:a,target:u,start:i[l],end:i[c]});continue}const f=N0e(e,u);for(const h of f){const d=qA(n,s[h.start],s[h.end],h.loop),p=L0e(a,i,d);for(const g of p)o.push({source:g,target:h,start:{[n]:$H(u,d,"start",Math.max)},end:{[n]:$H(u,d,"end",Math.min)}})}}return o}function qA(t,e,n,r){if(r)return;let i=e[t],s=n[t];return t==="angle"&&(i=to(i),s=to(s)),{property:t,start:i,end:s}}function Jmt(t,e){const{x:n=null,y:r=null}=t||{},i=e.points,s=[];return e.segments.forEach(({start:o,end:a})=>{a=gL(o,a,i);const l=i[o],c=i[a];r!==null?(s.push({x:l.x,y:r}),s.push({x:c.x,y:r})):n!==null&&(s.push({x:n,y:l.y}),s.push({x:n,y:c.y}))}),s}function gL(t,e,n){for(;e>t;e--){const r=n[e];if(!isNaN(r.x)&&!isNaN(r.y))break}return e}function $H(t,e,n,r){return t&&e?r(t[n],e[n]):t?t[n]:e?e[n]:0}function npe(t,e){let n=[],r=!1;return Xn(t)?(r=!0,n=t):n=Jmt(t,e),n.length?new Gu({points:n,options:{tension:0},_loop:r,_fullLoop:r}):null}function MH(t){return t&&t.fill!==!1}function egt(t,e,n){let i=t[e].fill;const s=[e];let o;if(!n)return i;for(;i!==!1&&s.indexOf(i)===-1;){if(!wr(i))return i;if(o=t[i],!o)return!1;if(o.visible)return i;s.push(i),i=o.fill}return!1}function tgt(t,e,n){const r=sgt(t);if(Zt(r))return isNaN(r.value)?!1:r;let i=parseFloat(r);return wr(i)&&Math.floor(i)===i?ngt(r[0],e,i,n):["origin","start","end","stack","shape"].indexOf(r)>=0&&r}function ngt(t,e,n,r){return(t==="-"||t==="+")&&(n=e+n),n===e||n<0||n>=r?!1:n}function rgt(t,e){let n=null;return t==="start"?n=e.bottom:t==="end"?n=e.top:Zt(t)?n=e.getPixelForValue(t.value):e.getBasePixel&&(n=e.getBasePixel()),n}function igt(t,e,n){let r;return t==="start"?r=n:t==="end"?r=e.options.reverse?e.min:e.max:Zt(t)?r=t.value:r=e.getBaseValue(),r}function sgt(t){const e=t.options,n=e.fill;let r=Mt(n&&n.target,n);return r===void 0&&(r=!!e.backgroundColor),r===!1||r===null?!1:r===!0?"origin":r}function ogt(t){const{scale:e,index:n,line:r}=t,i=[],s=r.segments,o=r.points,a=agt(e,n);a.push(npe({x:null,y:e.bottom},r));for(let l=0;l<s.length;l++){const c=s[l];for(let u=c.start;u<=c.end;u++)lgt(i,o[u],a)}return new Gu({points:i,options:{}})}function agt(t,e){const n=[],r=t.getMatchingVisibleMetas("line");for(let i=0;i<r.length;i++){const s=r[i];if(s.index===e)break;s.hidden||n.unshift(s.dataset)}return n}function lgt(t,e,n){const r=[];for(let i=0;i<n.length;i++){const s=n[i],{first:o,last:a,point:l}=cgt(s,e,"x");if(!(!l||o&&a)){if(o)r.unshift(l);else if(t.push(l),!a)break}}t.push(...r)}function cgt(t,e,n){const r=t.interpolate(e,n);if(!r)return{};const i=r[n],s=t.segments,o=t.points;let a=!1,l=!1;for(let c=0;c<s.length;c++){const u=s[c],f=o[u.start][n],h=o[u.end][n];if(Ac(i,f,h)){a=i===f,l=i===h;break}}return{first:a,last:l,point:r}}class rpe{constructor(e){this.x=e.x,this.y=e.y,this.radius=e.radius}pathSegment(e,n,r){const{x:i,y:s,radius:o}=this;return n=n||{start:0,end:Yn},e.arc(i,s,o,n.end,n.start,!0),!r.bounds}interpolate(e){const{x:n,y:r,radius:i}=this,s=e.angle;return{x:n+Math.cos(s)*i,y:r+Math.sin(s)*i,angle:s}}}function ugt(t){const{chart:e,fill:n,line:r}=t;if(wr(n))return fgt(e,n);if(n==="stack")return ogt(t);if(n==="shape")return!0;const i=hgt(t);return i instanceof rpe?i:npe(i,r)}function fgt(t,e){const n=t.getDatasetMeta(e);return n&&t.isDatasetVisible(e)?n.dataset:null}function hgt(t){return(t.scale||{}).getPointPositionForValue?pgt(t):dgt(t)}function dgt(t){const{scale:e={},fill:n}=t,r=rgt(n,e);if(wr(r)){const i=e.isHorizontal();return{x:i?r:null,y:i?null:r}}return null}function pgt(t){const{scale:e,fill:n}=t,r=e.options,i=e.getLabels().length,s=r.reverse?e.max:e.min,o=igt(n,e,s),a=[];if(r.grid.circular){const l=e.getPointPositionForValue(0,s);return new rpe({x:l.x,y:l.y,radius:e.getDistanceFromCenterForValue(o)})}for(let l=0;l<i;++l)a.push(e.getPointPositionForValue(l,o));return a}function lE(t,e,n){const r=ugt(e),{line:i,scale:s,axis:o}=e,a=i.options,l=a.fill,c=a.backgroundColor,{above:u=c,below:f=c}=l||{};r&&i.points.length&&(ak(t,n),mgt(t,{line:i,target:r,above:u,below:f,area:n,scale:s,axis:o}),lk(t))}function mgt(t,e){const{line:n,target:r,above:i,below:s,area:o,scale:a}=e,l=n._loop?"angle":e.axis;t.save(),l==="x"&&s!==i&&(IH(t,r,o.top),DH(t,{line:n,target:r,color:i,scale:a,property:l}),t.restore(),t.save(),IH(t,r,o.bottom)),DH(t,{line:n,target:r,color:s,scale:a,property:l}),t.restore()}function IH(t,e,n){const{segments:r,points:i}=e;let s=!0,o=!1;t.beginPath();for(const a of r){const{start:l,end:c}=a,u=i[l],f=i[gL(l,c,i)];s?(t.moveTo(u.x,u.y),s=!1):(t.lineTo(u.x,n),t.lineTo(u.x,u.y)),o=!!e.pathSegment(t,a,{move:o}),o?t.closePath():t.lineTo(f.x,n)}t.lineTo(e.first().x,n),t.closePath(),t.clip()}function DH(t,e){const{line:n,target:r,property:i,color:s,scale:o}=e,a=Kmt(n,r,i);for(const{source:l,target:c,start:u,end:f}of a){const{style:{backgroundColor:h=s}={}}=l,d=r!==!0;t.save(),t.fillStyle=h,ggt(t,o,d&&qA(i,u,f)),t.beginPath();const p=!!n.pathSegment(t,l);let g;if(d){p?t.closePath():LH(t,r,f,i);const m=!!r.pathSegment(t,c,{move:p,reverse:!0});g=p&&m,g||LH(t,r,u,i)}t.closePath(),t.fill(g?"evenodd":"nonzero"),t.restore()}}function ggt(t,e,n){const{top:r,bottom:i}=e.chart.chartArea,{property:s,start:o,end:a}=n||{};s==="x"&&(t.beginPath(),t.rect(o,r,a-o,i-r),t.clip())}function LH(t,e,n,r){const i=e.interpolate(n,r);i&&t.lineTo(i.x,i.y)}var vgt={id:"filler",afterDatasetsUpdate(t,e,n){const r=(t.data.datasets||[]).length,i=[];let s,o,a,l;for(o=0;o<r;++o)s=t.getDatasetMeta(o),a=s.dataset,l=null,a&&a.options&&a instanceof Gu&&(l={visible:t.isDatasetVisible(o),index:o,fill:tgt(a,o,r),chart:t,axis:s.controller.options.indexAxis,scale:s.vScale,line:a}),s.$filler=l,i.push(l);for(o=0;o<r;++o)l=i[o],!(!l||l.fill===!1)&&(l.fill=egt(i,o,n.propagate))},beforeDraw(t,e,n){const r=n.drawTime==="beforeDraw",i=t.getSortedVisibleDatasetMetas(),s=t.chartArea;for(let o=i.length-1;o>=0;--o){const a=i[o].$filler;a&&(a.line.updateControlPoints(s,a.axis),r&&a.fill&&lE(t.ctx,a,s))}},beforeDatasetsDraw(t,e,n){if(n.drawTime!=="beforeDatasetsDraw")return;const r=t.getSortedVisibleDatasetMetas();for(let i=r.length-1;i>=0;--i){const s=r[i].$filler;MH(s)&&lE(t.ctx,s,t.chartArea)}},beforeDatasetDraw(t,e,n){const r=e.meta.$filler;!MH(r)||n.drawTime!=="beforeDatasetDraw"||lE(t.ctx,r,t.chartArea)},defaults:{propagate:!0,drawTime:"beforeDatasetDraw"}};const NH=(t,e)=>{let{boxHeight:n=e,boxWidth:r=e}=t;return t.usePointStyle&&(n=Math.min(n,e),r=t.pointStyleWidth||Math.min(r,e)),{boxWidth:r,boxHeight:n,itemHeight:Math.max(e,n)}},Ogt=(t,e)=>t!==null&&e!==null&&t.datasetIndex===e.datasetIndex&&t.index===e.index;class QH extends fu{constructor(e){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=e.chart,this.options=e.options,this.ctx=e.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(e,n,r){this.maxWidth=e,this.maxHeight=n,this._margins=r,this.setDimensions(),this.buildLabels(),this.fit()}setDimensions(){this.isHorizontal()?(this.width=this.maxWidth,this.left=this._margins.left,this.right=this.width):(this.height=this.maxHeight,this.top=this._margins.top,this.bottom=this.height)}buildLabels(){const e=this.options.labels||{};let n=jn(e.generateLabels,[this.chart],this)||[];e.filter&&(n=n.filter(r=>e.filter(r,this.chart.data))),e.sort&&(n=n.sort((r,i)=>e.sort(r,i,this.chart.data))),this.options.reverse&&n.reverse(),this.legendItems=n}fit(){const{options:e,ctx:n}=this;if(!e.display){this.width=this.height=0;return}const r=e.labels,i=ei(r.font),s=i.size,o=this._computeTitleHeight(),{boxWidth:a,itemHeight:l}=NH(r,s);let c,u;n.font=i.string,this.isHorizontal()?(c=this.maxWidth,u=this._fitRows(o,s,a,l)+10):(u=this.maxHeight,c=this._fitCols(o,i,a,l)+10),this.width=Math.min(c,e.maxWidth||this.maxWidth),this.height=Math.min(u,e.maxHeight||this.maxHeight)}_fitRows(e,n,r,i){const{ctx:s,maxWidth:o,options:{labels:{padding:a}}}=this,l=this.legendHitBoxes=[],c=this.lineWidths=[0],u=i+a;let f=e;s.textAlign="left",s.textBaseline="middle";let h=-1,d=-u;return this.legendItems.forEach((p,g)=>{const m=r+n/2+s.measureText(p.text).width;(g===0||c[c.length-1]+m+2*a>o)&&(f+=u,c[c.length-(g>0?0:1)]=0,d+=u,h++),l[g]={left:0,top:d,row:h,width:m,height:i},c[c.length-1]+=m+a}),f}_fitCols(e,n,r,i){const{ctx:s,maxHeight:o,options:{labels:{padding:a}}}=this,l=this.legendHitBoxes=[],c=this.columnSizes=[],u=o-e;let f=a,h=0,d=0,p=0,g=0;return this.legendItems.forEach((m,v)=>{const{itemWidth:y,itemHeight:b}=ygt(r,n,s,m,i);v>0&&d+b+2*a>u&&(f+=h+a,c.push({width:h,height:d}),p+=h+a,g++,h=d=0),l[v]={left:p,top:d,col:g,width:y,height:b},h=Math.max(h,y),d+=b+a}),f+=h,c.push({width:h,height:d}),f}adjustHitBoxes(){if(!this.options.display)return;const e=this._computeTitleHeight(),{legendHitBoxes:n,options:{align:r,labels:{padding:i},rtl:s}}=this,o=Rp(s,this.left,this.width);if(this.isHorizontal()){let a=0,l=Ii(r,this.left+i,this.right-this.lineWidths[a]);for(const c of n)a!==c.row&&(a=c.row,l=Ii(r,this.left+i,this.right-this.lineWidths[a])),c.top+=this.top+e+i,c.left=o.leftForLtr(o.x(l),c.width),l+=c.width+i}else{let a=0,l=Ii(r,this.top+e+i,this.bottom-this.columnSizes[a].height);for(const c of n)c.col!==a&&(a=c.col,l=Ii(r,this.top+e+i,this.bottom-this.columnSizes[a].height)),c.top=l,c.left+=this.left+i,c.left=o.leftForLtr(o.x(c.left),c.width),l+=c.height+i}}isHorizontal(){return this.options.position==="top"||this.options.position==="bottom"}draw(){if(this.options.display){const e=this.ctx;ak(e,this),this._draw(),lk(e)}}_draw(){const{options:e,columnSizes:n,lineWidths:r,ctx:i}=this,{align:s,labels:o}=e,a=rr.color,l=Rp(e.rtl,this.left,this.width),c=ei(o.font),{padding:u}=o,f=c.size,h=f/2;let d;this.drawTitle(),i.textAlign=l.textAlign("left"),i.textBaseline="middle",i.lineWidth=.5,i.font=c.string;const{boxWidth:p,boxHeight:g,itemHeight:m}=NH(o,f),v=function(E,T,C){if(isNaN(p)||p<=0||isNaN(g)||g<0)return;i.save();const A=Mt(C.lineWidth,1);if(i.fillStyle=Mt(C.fillStyle,a),i.lineCap=Mt(C.lineCap,"butt"),i.lineDashOffset=Mt(C.lineDashOffset,0),i.lineJoin=Mt(C.lineJoin,"miter"),i.lineWidth=A,i.strokeStyle=Mt(C.strokeStyle,a),i.setLineDash(Mt(C.lineDash,[])),o.usePointStyle){const R={radius:g*Math.SQRT2/2,pointStyle:C.pointStyle,rotation:C.rotation,borderWidth:A},Q=l.xPlus(E,p/2),L=T+h;k0e(i,R,Q,L,o.pointStyleWidth&&p)}else{const R=T+Math.max((f-g)/2,0),Q=l.leftForLtr(E,p),L=id(C.borderRadius);i.beginPath(),Object.values(L).some(z=>z!==0)?qO(i,{x:Q,y:R,w:p,h:g,radius:L}):i.rect(Q,R,p,g),i.fill(),A!==0&&i.stroke()}i.restore()},y=function(E,T,C){Ed(i,C.text,E,T+m/2,c,{strikethrough:C.hidden,textAlign:l.textAlign(C.textAlign)})},b=this.isHorizontal(),S=this._computeTitleHeight();b?d={x:Ii(s,this.left+u,this.right-r[0]),y:this.top+u+S,line:0}:d={x:this.left+u,y:Ii(s,this.top+S+u,this.bottom-n[0].height),line:0},M0e(this.ctx,e.textDirection);const k=m+u;this.legendItems.forEach((E,T)=>{i.strokeStyle=E.fontColor,i.fillStyle=E.fontColor;const C=i.measureText(E.text).width,A=l.textAlign(E.textAlign||(E.textAlign=o.textAlign)),R=p+h+C;let Q=d.x,L=d.y;l.setWidth(this.width),b?T>0&&Q+R+u>this.right&&(L=d.y+=k,d.line++,Q=d.x=Ii(s,this.left+u,this.right-r[d.line])):T>0&&L+k>this.bottom&&(Q=d.x=Q+n[d.line].width+u,d.line++,L=d.y=Ii(s,this.top+S+u,this.bottom-n[d.line].height));const z=l.x(Q);if(v(z,L,E),Q=jdt(A,Q+p+h,b?Q+R:this.right,e.rtl),y(l.x(Q),L,E),b)d.x+=R+u;else if(typeof E.text!="string"){const B=c.lineHeight;d.y+=ipe(E,B)+u}else d.y+=k}),I0e(this.ctx,e.textDirection)}drawTitle(){const e=this.options,n=e.title,r=ei(n.font),i=Ui(n.padding);if(!n.display)return;const s=Rp(e.rtl,this.left,this.width),o=this.ctx,a=n.position,l=r.size/2,c=i.top+l;let u,f=this.left,h=this.width;if(this.isHorizontal())h=Math.max(...this.lineWidths),u=this.top+c,f=Ii(e.align,f,this.right-h);else{const p=this.columnSizes.reduce((g,m)=>Math.max(g,m.height),0);u=c+Ii(e.align,this.top,this.bottom-p-e.labels.padding-this._computeTitleHeight())}const d=Ii(a,f,f+h);o.textAlign=s.textAlign(aL(a)),o.textBaseline="middle",o.strokeStyle=n.color,o.fillStyle=n.color,o.font=r.string,Ed(o,n.text,d,u,r)}_computeTitleHeight(){const e=this.options.title,n=ei(e.font),r=Ui(e.padding);return e.display?n.lineHeight+r.height:0}_getLegendItemAt(e,n){let r,i,s;if(Ac(e,this.left,this.right)&&Ac(n,this.top,this.bottom)){for(s=this.legendHitBoxes,r=0;r<s.length;++r)if(i=s[r],Ac(e,i.left,i.left+i.width)&&Ac(n,i.top,i.top+i.height))return this.legendItems[r]}return null}handleEvent(e){const n=this.options;if(!wgt(e.type,n))return;const r=this._getLegendItemAt(e.x,e.y);if(e.type==="mousemove"||e.type==="mouseout"){const i=this._hoveredItem,s=Ogt(i,r);i&&!s&&jn(n.onLeave,[e,i,this],this),this._hoveredItem=r,r&&!s&&jn(n.onHover,[e,r,this],this)}else r&&jn(n.onClick,[e,r,this],this)}}function ygt(t,e,n,r,i){const s=bgt(r,t,e,n),o=xgt(i,r,e.lineHeight);return{itemWidth:s,itemHeight:o}}function bgt(t,e,n,r){let i=t.text;return i&&typeof i!="string"&&(i=i.reduce((s,o)=>s.length>o.length?s:o)),e+n.size/2+r.measureText(i).width}function xgt(t,e,n){let r=t;return typeof e.text!="string"&&(r=ipe(e,n)),r}function ipe(t,e){const n=t.text?t.text.length:0;return e*n}function wgt(t,e){return!!((t==="mousemove"||t==="mouseout")&&(e.onHover||e.onLeave)||e.onClick&&(t==="click"||t==="mouseup"))}var Sgt={id:"legend",_element:QH,start(t,e,n){const r=t.legend=new QH({ctx:t.ctx,options:n,chart:t});Bi.configure(t,r,n),Bi.addBox(t,r)},stop(t){Bi.removeBox(t,t.legend),delete t.legend},beforeUpdate(t,e,n){const r=t.legend;Bi.configure(t,r,n),r.options=n},afterUpdate(t){const e=t.legend;e.buildLabels(),e.adjustHitBoxes()},afterEvent(t,e){e.replay||t.legend.handleEvent(e.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(t,e,n){const r=e.datasetIndex,i=n.chart;i.isDatasetVisible(r)?(i.hide(r),e.hidden=!0):(i.show(r),e.hidden=!1)},onHover:null,onLeave:null,labels:{color:t=>t.chart.options.color,boxWidth:40,padding:10,generateLabels(t){const e=t.data.datasets,{labels:{usePointStyle:n,pointStyle:r,textAlign:i,color:s,useBorderRadius:o,borderRadius:a}}=t.legend.options;return t._getSortedDatasetMetas().map(l=>{const c=l.controller.getStyle(n?0:void 0),u=Ui(c.borderWidth);return{text:e[l.index].label,fillStyle:c.backgroundColor,fontColor:s,hidden:!l.visible,lineCap:c.borderCapStyle,lineDash:c.borderDash,lineDashOffset:c.borderDashOffset,lineJoin:c.borderJoinStyle,lineWidth:(u.width+u.height)/4,strokeStyle:c.borderColor,pointStyle:r||c.pointStyle,rotation:c.rotation,textAlign:i||c.textAlign,borderRadius:o&&(a||c.borderRadius),datasetIndex:l.index}},this)}},title:{color:t=>t.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:t=>!t.startsWith("on"),labels:{_scriptable:t=>!["generateLabels","filter","sort"].includes(t)}}};class vL extends fu{constructor(e){super(),this.chart=e.chart,this.options=e.options,this.ctx=e.ctx,this._padding=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(e,n){const r=this.options;if(this.left=0,this.top=0,!r.display){this.width=this.height=this.right=this.bottom=0;return}this.width=this.right=e,this.height=this.bottom=n;const i=Xn(r.text)?r.text.length:1;this._padding=Ui(r.padding);const s=i*ei(r.font).lineHeight+this._padding.height;this.isHorizontal()?this.height=s:this.width=s}isHorizontal(){const e=this.options.position;return e==="top"||e==="bottom"}_drawArgs(e){const{top:n,left:r,bottom:i,right:s,options:o}=this,a=o.align;let l=0,c,u,f;return this.isHorizontal()?(u=Ii(a,r,s),f=n+e,c=s-r):(o.position==="left"?(u=r+e,f=Ii(a,i,n),l=Gn*-.5):(u=s-e,f=Ii(a,n,i),l=Gn*.5),c=i-n),{titleX:u,titleY:f,maxWidth:c,rotation:l}}draw(){const e=this.ctx,n=this.options;if(!n.display)return;const r=ei(n.font),s=r.lineHeight/2+this._padding.top,{titleX:o,titleY:a,maxWidth:l,rotation:c}=this._drawArgs(s);Ed(e,n.text,0,0,r,{color:n.color,maxWidth:l,rotation:c,textAlign:aL(n.align),textBaseline:"middle",translation:[o,a]})}}function _gt(t,e){const n=new vL({ctx:t.ctx,options:e,chart:t});Bi.configure(t,n,e),Bi.addBox(t,n),t.titleBlock=n}var kgt={id:"title",_element:vL,start(t,e,n){_gt(t,n)},stop(t){const e=t.titleBlock;Bi.removeBox(t,e),delete t.titleBlock},beforeUpdate(t,e,n){const r=t.titleBlock;Bi.configure(t,r,n),r.options=n},defaults:{align:"center",display:!1,font:{weight:"bold"},fullSize:!0,padding:10,position:"top",text:"",weight:2e3},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const Ww=new WeakMap;var Cgt={id:"subtitle",start(t,e,n){const r=new vL({ctx:t.ctx,options:n,chart:t});Bi.configure(t,r,n),Bi.addBox(t,r),Ww.set(t,r)},stop(t){Bi.removeBox(t,Ww.get(t)),Ww.delete(t)},beforeUpdate(t,e,n){const r=Ww.get(t);Bi.configure(t,r,n),r.options=n},defaults:{align:"center",display:!1,font:{weight:"normal"},fullSize:!0,padding:0,position:"top",text:"",weight:1500},defaultRoutes:{color:"color"},descriptors:{_scriptable:!0,_indexable:!1}};const N1={average(t){if(!t.length)return!1;let e,n,r=new Set,i=0,s=0;for(e=0,n=t.length;e<n;++e){const a=t[e].element;if(a&&a.hasValue()){const l=a.tooltipPosition();r.add(l.x),i+=l.y,++s}}return s===0||r.size===0?!1:{x:[...r].reduce((a,l)=>a+l)/r.size,y:i/s}},nearest(t,e){if(!t.length)return!1;let n=e.x,r=e.y,i=Number.POSITIVE_INFINITY,s,o,a;for(s=0,o=t.length;s<o;++s){const l=t[s].element;if(l&&l.hasValue()){const c=l.getCenterPoint(),u=QA(e,c);u<i&&(i=u,a=l)}}if(a){const l=a.tooltipPosition();n=l.x,r=l.y}return{x:n,y:r}}};function tl(t,e){return e&&(Xn(e)?Array.prototype.push.apply(t,e):t.push(e)),t}function gc(t){return(typeof t=="string"||t instanceof String)&&t.indexOf(`
372
372
  `)>-1?t.split(`
373
- `):t}function Egt(t,e){const{element:n,datasetIndex:r,index:i}=e,s=t.getDatasetMeta(r).controller,{label:o,value:a}=s.getLabelAndValue(i);return{chart:t,label:o,parsed:s.getParsed(i),raw:t.data.datasets[r].data[i],formattedValue:a,dataset:s.getDataset(),dataIndex:i,datasetIndex:r,element:n}}function jH(t,e){const n=t.chart.ctx,{body:r,footer:i,title:s}=t,{boxWidth:o,boxHeight:a}=e,l=ei(e.bodyFont),c=ei(e.titleFont),u=ei(e.footerFont),f=s.length,h=i.length,d=r.length,p=Ui(e.padding);let g=p.height,m=0,v=r.reduce((S,k)=>S+k.before.length+k.lines.length+k.after.length,0);if(v+=t.beforeBody.length+t.afterBody.length,f&&(g+=f*c.lineHeight+(f-1)*e.titleSpacing+e.titleMarginBottom),v){const S=e.displayColors?Math.max(a,l.lineHeight):l.lineHeight;g+=d*S+(v-d)*l.lineHeight+(v-1)*e.bodySpacing}h&&(g+=e.footerMarginTop+h*u.lineHeight+(h-1)*e.footerSpacing);let y=0;const b=function(S){m=Math.max(m,n.measureText(S).width+y)};return n.save(),n.font=c.string,xn(t.title,b),n.font=l.string,xn(t.beforeBody.concat(t.afterBody),b),y=e.displayColors?o+2+e.boxPadding:0,xn(r,S=>{xn(S.before,b),xn(S.lines,b),xn(S.after,b)}),y=0,n.font=u.string,xn(t.footer,b),n.restore(),m+=p.width,{width:m,height:g}}function Tgt(t,e){const{y:n,height:r}=e;return n<r/2?"top":n>t.height-r/2?"bottom":"center"}function Pgt(t,e,n,r){const{x:i,width:s}=r,o=n.caretSize+n.caretPadding;if(t==="left"&&i+s+o>e.width||t==="right"&&i-s-o<0)return!0}function Agt(t,e,n,r){const{x:i,width:s}=n,{width:o,chartArea:{left:a,right:l}}=t;let c="center";return r==="center"?c=i<=(a+l)/2?"left":"right":i<=s/2?c="left":i>=o-s/2&&(c="right"),Pgt(c,t,e,n)&&(c="center"),c}function BH(t,e,n){const r=n.yAlign||e.yAlign||Tgt(t,n);return{xAlign:n.xAlign||e.xAlign||Agt(t,e,n,r),yAlign:r}}function Rgt(t,e){let{x:n,width:r}=t;return e==="right"?n-=r:e==="center"&&(n-=r/2),n}function $gt(t,e,n){let{y:r,height:i}=t;return e==="top"?r+=n:e==="bottom"?r-=i+n:r-=i/2,r}function zH(t,e,n,r){const{caretSize:i,caretPadding:s,cornerRadius:o}=t,{xAlign:a,yAlign:l}=n,c=i+s,{topLeft:u,topRight:f,bottomLeft:h,bottomRight:d}=id(o);let p=Rgt(e,a);const g=$gt(e,l,c);return l==="center"?a==="left"?p+=c:a==="right"&&(p-=c):a==="left"?p-=Math.max(u,h)+i:a==="right"&&(p+=Math.max(f,d)+i),{x:ui(p,0,r.width-e.width),y:ui(g,0,r.height-e.height)}}function Vw(t,e,n){const r=Ui(n.padding);return e==="center"?t.x+t.width/2:e==="right"?t.x+t.width-r.right:t.x+r.left}function FH(t){return tl([],gc(t))}function Mgt(t,e,n){return Kf(t,{tooltip:e,tooltipItems:n,type:"tooltip"})}function WH(t,e){const n=e&&e.dataset&&e.dataset.tooltip&&e.dataset.tooltip.callbacks;return n?t.override(n):t}const spe={beforeTitle:lc,title(t){if(t.length>0){const e=t[0],n=e.chart.data.labels,r=n?n.length:0;if(this&&this.options&&this.options.mode==="dataset")return e.dataset.label||"";if(e.label)return e.label;if(r>0&&e.dataIndex<r)return n[e.dataIndex]}return""},afterTitle:lc,beforeBody:lc,beforeLabel:lc,label(t){if(this&&this.options&&this.options.mode==="dataset")return t.label+": "+t.formattedValue||t.formattedValue;let e=t.dataset.label||"";e&&(e+=": ");const n=t.formattedValue;return ln(n)||(e+=n),e},labelColor(t){const n=t.chart.getDatasetMeta(t.datasetIndex).controller.getStyle(t.dataIndex);return{borderColor:n.borderColor,backgroundColor:n.backgroundColor,borderWidth:n.borderWidth,borderDash:n.borderDash,borderDashOffset:n.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(t){const n=t.chart.getDatasetMeta(t.datasetIndex).controller.getStyle(t.dataIndex);return{pointStyle:n.pointStyle,rotation:n.rotation}},afterLabel:lc,afterBody:lc,beforeFooter:lc,footer:lc,afterFooter:lc};function xs(t,e,n,r){const i=t[e].call(n,r);return typeof i>"u"?spe[e].call(n,r):i}class XA extends fu{constructor(e){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=e.chart,this.options=e.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(e){this.options=e,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const e=this._cachedAnimations;if(e)return e;const n=this.chart,r=this.options.setContext(this.getContext()),i=r.enabled&&n.options.animation&&r.animations,s=new Q0e(this.chart,i);return i._cacheable&&(this._cachedAnimations=Object.freeze(s)),s}getContext(){return this.$context||(this.$context=Mgt(this.chart.getContext(),this,this._tooltipItems))}getTitle(e,n){const{callbacks:r}=n,i=xs(r,"beforeTitle",this,e),s=xs(r,"title",this,e),o=xs(r,"afterTitle",this,e);let a=[];return a=tl(a,gc(i)),a=tl(a,gc(s)),a=tl(a,gc(o)),a}getBeforeBody(e,n){return FH(xs(n.callbacks,"beforeBody",this,e))}getBody(e,n){const{callbacks:r}=n,i=[];return xn(e,s=>{const o={before:[],lines:[],after:[]},a=WH(r,s);tl(o.before,gc(xs(a,"beforeLabel",this,s))),tl(o.lines,xs(a,"label",this,s)),tl(o.after,gc(xs(a,"afterLabel",this,s))),i.push(o)}),i}getAfterBody(e,n){return FH(xs(n.callbacks,"afterBody",this,e))}getFooter(e,n){const{callbacks:r}=n,i=xs(r,"beforeFooter",this,e),s=xs(r,"footer",this,e),o=xs(r,"afterFooter",this,e);let a=[];return a=tl(a,gc(i)),a=tl(a,gc(s)),a=tl(a,gc(o)),a}_createItems(e){const n=this._active,r=this.chart.data,i=[],s=[],o=[];let a=[],l,c;for(l=0,c=n.length;l<c;++l)a.push(Egt(this.chart,n[l]));return e.filter&&(a=a.filter((u,f,h)=>e.filter(u,f,h,r))),e.itemSort&&(a=a.sort((u,f)=>e.itemSort(u,f,r))),xn(a,u=>{const f=WH(e.callbacks,u);i.push(xs(f,"labelColor",this,u)),s.push(xs(f,"labelPointStyle",this,u)),o.push(xs(f,"labelTextColor",this,u))}),this.labelColors=i,this.labelPointStyles=s,this.labelTextColors=o,this.dataPoints=a,a}update(e,n){const r=this.options.setContext(this.getContext()),i=this._active;let s,o=[];if(!i.length)this.opacity!==0&&(s={opacity:0});else{const a=N1[r.position].call(this,i,this._eventPosition);o=this._createItems(r),this.title=this.getTitle(o,r),this.beforeBody=this.getBeforeBody(o,r),this.body=this.getBody(o,r),this.afterBody=this.getAfterBody(o,r),this.footer=this.getFooter(o,r);const l=this._size=jH(this,r),c=Object.assign({},a,l),u=BH(this.chart,r,c),f=zH(r,c,u,this.chart);this.xAlign=u.xAlign,this.yAlign=u.yAlign,s={opacity:1,x:f.x,y:f.y,width:l.width,height:l.height,caretX:a.x,caretY:a.y}}this._tooltipItems=o,this.$context=void 0,s&&this._resolveAnimations().update(this,s),e&&r.external&&r.external.call(this,{chart:this.chart,tooltip:this,replay:n})}drawCaret(e,n,r,i){const s=this.getCaretPosition(e,r,i);n.lineTo(s.x1,s.y1),n.lineTo(s.x2,s.y2),n.lineTo(s.x3,s.y3)}getCaretPosition(e,n,r){const{xAlign:i,yAlign:s}=this,{caretSize:o,cornerRadius:a}=r,{topLeft:l,topRight:c,bottomLeft:u,bottomRight:f}=id(a),{x:h,y:d}=e,{width:p,height:g}=n;let m,v,y,b,S,k;return s==="center"?(S=d+g/2,i==="left"?(m=h,v=m-o,b=S+o,k=S-o):(m=h+p,v=m+o,b=S-o,k=S+o),y=m):(i==="left"?v=h+Math.max(l,u)+o:i==="right"?v=h+p-Math.max(c,f)-o:v=this.caretX,s==="top"?(b=d,S=b-o,m=v-o,y=v+o):(b=d+g,S=b+o,m=v+o,y=v-o),k=b),{x1:m,x2:v,x3:y,y1:b,y2:S,y3:k}}drawTitle(e,n,r){const i=this.title,s=i.length;let o,a,l;if(s){const c=Rp(r.rtl,this.x,this.width);for(e.x=Vw(this,r.titleAlign,r),n.textAlign=c.textAlign(r.titleAlign),n.textBaseline="middle",o=ei(r.titleFont),a=r.titleSpacing,n.fillStyle=r.titleColor,n.font=o.string,l=0;l<s;++l)n.fillText(i[l],c.x(e.x),e.y+o.lineHeight/2),e.y+=o.lineHeight+a,l+1===s&&(e.y+=r.titleMarginBottom-a)}}_drawColorBox(e,n,r,i,s){const o=this.labelColors[r],a=this.labelPointStyles[r],{boxHeight:l,boxWidth:c}=s,u=ei(s.bodyFont),f=Vw(this,"left",s),h=i.x(f),d=l<u.lineHeight?(u.lineHeight-l)/2:0,p=n.y+d;if(s.usePointStyle){const g={radius:Math.min(c,l)/2,pointStyle:a.pointStyle,rotation:a.rotation,borderWidth:1},m=i.leftForLtr(h,c)+c/2,v=p+l/2;e.strokeStyle=s.multiKeyBackground,e.fillStyle=s.multiKeyBackground,BA(e,g,m,v),e.strokeStyle=o.borderColor,e.fillStyle=o.backgroundColor,BA(e,g,m,v)}else{e.lineWidth=Zt(o.borderWidth)?Math.max(...Object.values(o.borderWidth)):o.borderWidth||1,e.strokeStyle=o.borderColor,e.setLineDash(o.borderDash||[]),e.lineDashOffset=o.borderDashOffset||0;const g=i.leftForLtr(h,c),m=i.leftForLtr(i.xPlus(h,1),c-2),v=id(o.borderRadius);Object.values(v).some(y=>y!==0)?(e.beginPath(),e.fillStyle=s.multiKeyBackground,qO(e,{x:g,y:p,w:c,h:l,radius:v}),e.fill(),e.stroke(),e.fillStyle=o.backgroundColor,e.beginPath(),qO(e,{x:m,y:p+1,w:c-2,h:l-2,radius:v}),e.fill()):(e.fillStyle=s.multiKeyBackground,e.fillRect(g,p,c,l),e.strokeRect(g,p,c,l),e.fillStyle=o.backgroundColor,e.fillRect(m,p+1,c-2,l-2))}e.fillStyle=this.labelTextColors[r]}drawBody(e,n,r){const{body:i}=this,{bodySpacing:s,bodyAlign:o,displayColors:a,boxHeight:l,boxWidth:c,boxPadding:u}=r,f=ei(r.bodyFont);let h=f.lineHeight,d=0;const p=Rp(r.rtl,this.x,this.width),g=function(C){n.fillText(C,p.x(e.x+d),e.y+h/2),e.y+=h+s},m=p.textAlign(o);let v,y,b,S,k,E,T;for(n.textAlign=o,n.textBaseline="middle",n.font=f.string,e.x=Vw(this,m,r),n.fillStyle=r.bodyColor,xn(this.beforeBody,g),d=a&&m!=="right"?o==="center"?c/2+u:c+2+u:0,S=0,E=i.length;S<E;++S){for(v=i[S],y=this.labelTextColors[S],n.fillStyle=y,xn(v.before,g),b=v.lines,a&&b.length&&(this._drawColorBox(n,e,S,p,r),h=Math.max(f.lineHeight,l)),k=0,T=b.length;k<T;++k)g(b[k]),h=f.lineHeight;xn(v.after,g)}d=0,h=f.lineHeight,xn(this.afterBody,g),e.y-=s}drawFooter(e,n,r){const i=this.footer,s=i.length;let o,a;if(s){const l=Rp(r.rtl,this.x,this.width);for(e.x=Vw(this,r.footerAlign,r),e.y+=r.footerMarginTop,n.textAlign=l.textAlign(r.footerAlign),n.textBaseline="middle",o=ei(r.footerFont),n.fillStyle=r.footerColor,n.font=o.string,a=0;a<s;++a)n.fillText(i[a],l.x(e.x),e.y+o.lineHeight/2),e.y+=o.lineHeight+r.footerSpacing}}drawBackground(e,n,r,i){const{xAlign:s,yAlign:o}=this,{x:a,y:l}=e,{width:c,height:u}=r,{topLeft:f,topRight:h,bottomLeft:d,bottomRight:p}=id(i.cornerRadius);n.fillStyle=i.backgroundColor,n.strokeStyle=i.borderColor,n.lineWidth=i.borderWidth,n.beginPath(),n.moveTo(a+f,l),o==="top"&&this.drawCaret(e,n,r,i),n.lineTo(a+c-h,l),n.quadraticCurveTo(a+c,l,a+c,l+h),o==="center"&&s==="right"&&this.drawCaret(e,n,r,i),n.lineTo(a+c,l+u-p),n.quadraticCurveTo(a+c,l+u,a+c-p,l+u),o==="bottom"&&this.drawCaret(e,n,r,i),n.lineTo(a+d,l+u),n.quadraticCurveTo(a,l+u,a,l+u-d),o==="center"&&s==="left"&&this.drawCaret(e,n,r,i),n.lineTo(a,l+f),n.quadraticCurveTo(a,l,a+f,l),n.closePath(),n.fill(),i.borderWidth>0&&n.stroke()}_updateAnimationTarget(e){const n=this.chart,r=this.$animations,i=r&&r.x,s=r&&r.y;if(i||s){const o=N1[e.position].call(this,this._active,this._eventPosition);if(!o)return;const a=this._size=jH(this,e),l=Object.assign({},o,this._size),c=BH(n,e,l),u=zH(e,l,c,n);(i._to!==u.x||s._to!==u.y)&&(this.xAlign=c.xAlign,this.yAlign=c.yAlign,this.width=a.width,this.height=a.height,this.caretX=o.x,this.caretY=o.y,this._resolveAnimations().update(this,u))}}_willRender(){return!!this.opacity}draw(e){const n=this.options.setContext(this.getContext());let r=this.opacity;if(!r)return;this._updateAnimationTarget(n);const i={width:this.width,height:this.height},s={x:this.x,y:this.y};r=Math.abs(r)<.001?0:r;const o=Ui(n.padding),a=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;n.enabled&&a&&(e.save(),e.globalAlpha=r,this.drawBackground(s,e,i,n),M0e(e,n.textDirection),s.y+=o.top,this.drawTitle(s,e,n),this.drawBody(s,e,n),this.drawFooter(s,e,n),I0e(e,n.textDirection),e.restore())}getActiveElements(){return this._active||[]}setActiveElements(e,n){const r=this._active,i=e.map(({datasetIndex:a,index:l})=>{const c=this.chart.getDatasetMeta(a);if(!c)throw new Error("Cannot find a dataset at index "+a);return{datasetIndex:a,element:c.data[l],index:l}}),s=!b4(r,i),o=this._positionChanged(i,n);(s||o)&&(this._active=i,this._eventPosition=n,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(e,n,r=!0){if(n&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const i=this.options,s=this._active||[],o=this._getActiveElements(e,s,n,r),a=this._positionChanged(o,e),l=n||!b4(o,s)||a;return l&&(this._active=o,(i.enabled||i.external)&&(this._eventPosition={x:e.x,y:e.y},this.update(!0,n))),l}_getActiveElements(e,n,r,i){const s=this.options;if(e.type==="mouseout")return[];if(!i)return n.filter(a=>this.chart.data.datasets[a.datasetIndex]&&this.chart.getDatasetMeta(a.datasetIndex).controller.getParsed(a.index)!==void 0);const o=this.chart.getElementsAtEventForMode(e,s.mode,s,r);return s.reverse&&o.reverse(),o}_positionChanged(e,n){const{caretX:r,caretY:i,options:s}=this,o=N1[s.position].call(this,e,n);return o!==!1&&(r!==o.x||i!==o.y)}}Le(XA,"positioners",N1);var OL={id:"tooltip",_element:XA,positioners:N1,afterInit(t,e,n){n&&(t.tooltip=new XA({chart:t,options:n}))},beforeUpdate(t,e,n){t.tooltip&&t.tooltip.initialize(n)},reset(t,e,n){t.tooltip&&t.tooltip.initialize(n)},afterDraw(t){const e=t.tooltip;if(e&&e._willRender()){const n={tooltip:e};if(t.notifyPlugins("beforeTooltipDraw",{...n,cancelable:!0})===!1)return;e.draw(t.ctx),t.notifyPlugins("afterTooltipDraw",n)}},afterEvent(t,e){if(t.tooltip){const n=e.replay;t.tooltip.handleEvent(e.event,n,e.inChartArea)&&(e.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(t,e)=>e.bodyFont.size,boxWidth:(t,e)=>e.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:spe},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:t=>t!=="filter"&&t!=="itemSort"&&t!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]},Igt=Object.freeze({__proto__:null,Colors:Xmt,Decimation:Gmt,Filler:vgt,Legend:Sgt,SubTitle:Cgt,Title:kgt,Tooltip:OL});const Dgt=(t,e,n,r)=>(typeof e=="string"?(n=t.push(e)-1,r.unshift({index:n,label:e})):isNaN(e)&&(n=null),n);function Lgt(t,e,n,r){const i=t.indexOf(e);if(i===-1)return Dgt(t,e,n,r);const s=t.lastIndexOf(e);return i!==s?n:i}const Ngt=(t,e)=>t===null?null:ui(Math.round(t),0,e);function VH(t){const e=this.getLabels();return t>=0&&t<e.length?e[t]:t}class HA extends Jd{constructor(e){super(e),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(e){const n=this._addedLabels;if(n.length){const r=this.getLabels();for(const{index:i,label:s}of n)r[i]===s&&r.splice(i,1);this._addedLabels=[]}super.init(e)}parse(e,n){if(ln(e))return null;const r=this.getLabels();return n=isFinite(n)&&r[n]===e?n:Lgt(r,e,Mt(n,e),this._addedLabels),Ngt(n,r.length-1)}determineDataLimits(){const{minDefined:e,maxDefined:n}=this.getUserBounds();let{min:r,max:i}=this.getMinMax(!0);this.options.bounds==="ticks"&&(e||(r=0),n||(i=this.getLabels().length-1)),this.min=r,this.max=i}buildTicks(){const e=this.min,n=this.max,r=this.options.offset,i=[];let s=this.getLabels();s=e===0&&n===s.length-1?s:s.slice(e,n+1),this._valueRange=Math.max(s.length-(r?0:1),1),this._startValue=this.min-(r?.5:0);for(let o=e;o<=n;o++)i.push({value:o});return i}getLabelForValue(e){return VH.call(this,e)}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(e){return typeof e!="number"&&(e=this.parse(e)),e===null?NaN:this.getPixelForDecimal((e-this._startValue)/this._valueRange)}getPixelForTick(e){const n=this.ticks;return e<0||e>n.length-1?null:this.getPixelForValue(n[e].value)}getValueForPixel(e){return Math.round(this._startValue+this.getDecimalForPixel(e)*this._valueRange)}getBasePixel(){return this.bottom}}Le(HA,"id","category"),Le(HA,"defaults",{ticks:{callback:VH}});function Qgt(t,e){const n=[],{bounds:i,step:s,min:o,max:a,precision:l,count:c,maxTicks:u,maxDigits:f,includeBounds:h}=t,d=s||1,p=u-1,{min:g,max:m}=e,v=!ln(o),y=!ln(a),b=!ln(c),S=(m-g)/(f+1);let k=jX((m-g)/p/d)*d,E,T,C,A;if(k<1e-14&&!v&&!y)return[{value:g},{value:m}];A=Math.ceil(m/k)-Math.floor(g/k),A>p&&(k=jX(A*k/p/d)*d),ln(l)||(E=Math.pow(10,l),k=Math.ceil(k*E)/E),i==="ticks"?(T=Math.floor(g/k)*k,C=Math.ceil(m/k)*k):(T=g,C=m),v&&y&&s&&$dt((a-o)/s,k/1e3)?(A=Math.round(Math.min((a-o)/k,u)),k=(a-o)/A,T=o,C=a):b?(T=v?o:T,C=y?a:C,A=c-1,k=(C-T)/A):(A=(C-T)/k,Ov(A,Math.round(A),k/1e3)?A=Math.round(A):A=Math.ceil(A));const R=Math.max(BX(k),BX(T));E=Math.pow(10,ln(l)?R:l),T=Math.round(T*E)/E,C=Math.round(C*E)/E;let Q=0;for(v&&(h&&T!==o?(n.push({value:o}),T<o&&Q++,Ov(Math.round((T+Q*k)*E)/E,o,UH(o,S,t))&&Q++):T<o&&Q++);Q<A;++Q){const L=Math.round((T+Q*k)*E)/E;if(y&&L>a)break;n.push({value:L})}return y&&h&&C!==a?n.length&&Ov(n[n.length-1].value,a,UH(a,S,t))?n[n.length-1].value=a:n.push({value:a}):(!y||C===a)&&n.push({value:C}),n}function UH(t,e,{horizontal:n,minRotation:r}){const i=wa(r),s=(n?Math.sin(i):Math.cos(i))||.001,o=.75*e*(""+t).length;return Math.min(e/s,o)}class E4 extends Jd{constructor(e){super(e),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(e,n){return ln(e)||(typeof e=="number"||e instanceof Number)&&!isFinite(+e)?null:+e}handleTickRangeOptions(){const{beginAtZero:e}=this.options,{minDefined:n,maxDefined:r}=this.getUserBounds();let{min:i,max:s}=this;const o=l=>i=n?i:l,a=l=>s=r?s:l;if(e){const l=kl(i),c=kl(s);l<0&&c<0?a(0):l>0&&c>0&&o(0)}if(i===s){let l=s===0?1:Math.abs(s*.05);a(s+l),e||o(i-l)}this.min=i,this.max=s}getTickLimit(){const e=this.options.ticks;let{maxTicksLimit:n,stepSize:r}=e,i;return r?(i=Math.ceil(this.max/r)-Math.floor(this.min/r)+1,i>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${r} would result generating up to ${i} ticks. Limiting to 1000.`),i=1e3)):(i=this.computeTickLimit(),n=n||11),n&&(i=Math.min(n,i)),i}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const e=this.options,n=e.ticks;let r=this.getTickLimit();r=Math.max(2,r);const i={maxTicks:r,bounds:e.bounds,min:e.min,max:e.max,precision:n.precision,step:n.stepSize,count:n.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:n.minRotation||0,includeBounds:n.includeBounds!==!1},s=this._range||this,o=Qgt(i,s);return e.bounds==="ticks"&&g0e(o,this,"value"),e.reverse?(o.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),o}configure(){const e=this.ticks;let n=this.min,r=this.max;if(super.configure(),this.options.offset&&e.length){const i=(r-n)/Math.max(e.length-1,1)/2;n-=i,r+=i}this._startValue=n,this._endValue=r,this._valueRange=r-n}getLabelForValue(e){return ab(e,this.chart.options.locale,this.options.ticks.format)}}class ZA extends E4{determineDataLimits(){const{min:e,max:n}=this.getMinMax(!0);this.min=wr(e)?e:0,this.max=wr(n)?n:1,this.handleTickRangeOptions()}computeTickLimit(){const e=this.isHorizontal(),n=e?this.width:this.height,r=wa(this.options.ticks.minRotation),i=(e?Math.sin(r):Math.cos(r))||.001,s=this._resolveTickFontOptions(0);return Math.ceil(n/Math.min(40,s.lineHeight/i))}getPixelForValue(e){return e===null?NaN:this.getPixelForDecimal((e-this._startValue)/this._valueRange)}getValueForPixel(e){return this._startValue+this.getDecimalForPixel(e)*this._valueRange}}Le(ZA,"id","linear"),Le(ZA,"defaults",{ticks:{callback:ok.formatters.numeric}});const HO=t=>Math.floor(Yu(t)),vh=(t,e)=>Math.pow(10,HO(t)+e);function qH(t){return t/Math.pow(10,HO(t))===1}function XH(t,e,n){const r=Math.pow(10,n),i=Math.floor(t/r);return Math.ceil(e/r)-i}function jgt(t,e){const n=e-t;let r=HO(n);for(;XH(t,e,r)>10;)r++;for(;XH(t,e,r)<10;)r--;return Math.min(r,HO(t))}function Bgt(t,{min:e,max:n}){e=Ks(t.min,e);const r=[],i=HO(e);let s=jgt(e,n),o=s<0?Math.pow(10,Math.abs(s)):1;const a=Math.pow(10,s),l=i>s?Math.pow(10,i):0,c=Math.round((e-l)*o)/o,u=Math.floor((e-l)/a/10)*a*10;let f=Math.floor((c-u)/Math.pow(10,s)),h=Ks(t.min,Math.round((l+u+f*Math.pow(10,s))*o)/o);for(;h<n;)r.push({value:h,major:qH(h),significand:f}),f>=10?f=f<15?15:20:f++,f>=20&&(s++,f=2,o=s>=0?1:o),h=Math.round((l+u+f*Math.pow(10,s))*o)/o;const d=Ks(t.max,h);return r.push({value:d,major:qH(d),significand:f}),r}class YA extends Jd{constructor(e){super(e),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(e,n){const r=E4.prototype.parse.apply(this,[e,n]);if(r===0){this._zero=!0;return}return wr(r)&&r>0?r:null}determineDataLimits(){const{min:e,max:n}=this.getMinMax(!0);this.min=wr(e)?Math.max(0,e):null,this.max=wr(n)?Math.max(0,n):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!wr(this._userMin)&&(this.min=e===vh(this.min,0)?vh(this.min,-1):vh(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){const{minDefined:e,maxDefined:n}=this.getUserBounds();let r=this.min,i=this.max;const s=a=>r=e?r:a,o=a=>i=n?i:a;r===i&&(r<=0?(s(1),o(10)):(s(vh(r,-1)),o(vh(i,1)))),r<=0&&s(vh(i,-1)),i<=0&&o(vh(r,1)),this.min=r,this.max=i}buildTicks(){const e=this.options,n={min:this._userMin,max:this._userMax},r=Bgt(n,this);return e.bounds==="ticks"&&g0e(r,this,"value"),e.reverse?(r.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),r}getLabelForValue(e){return e===void 0?"0":ab(e,this.chart.options.locale,this.options.ticks.format)}configure(){const e=this.min;super.configure(),this._startValue=Yu(e),this._valueRange=Yu(this.max)-Yu(e)}getPixelForValue(e){return(e===void 0||e===0)&&(e=this.min),e===null||isNaN(e)?NaN:this.getPixelForDecimal(e===this.min?0:(Yu(e)-this._startValue)/this._valueRange)}getValueForPixel(e){const n=this.getDecimalForPixel(e);return Math.pow(10,this._startValue+n*this._valueRange)}}Le(YA,"id","logarithmic"),Le(YA,"defaults",{ticks:{callback:ok.formatters.logarithmic,major:{enabled:!0}}});function GA(t){const e=t.ticks;if(e.display&&t.display){const n=Ui(e.backdropPadding);return Mt(e.font&&e.font.size,rr.font.size)+n.height}return 0}function zgt(t,e,n){return n=Xn(n)?n:[n],{w:Zdt(t,e.string,n),h:n.length*e.lineHeight}}function HH(t,e,n,r,i){return t===r||t===i?{start:e-n/2,end:e+n/2}:t<r||t>i?{start:e-n,end:e}:{start:e,end:e+n}}function Fgt(t){const e={l:t.left+t._padding.left,r:t.right-t._padding.right,t:t.top+t._padding.top,b:t.bottom-t._padding.bottom},n=Object.assign({},e),r=[],i=[],s=t._pointLabels.length,o=t.options.pointLabels,a=o.centerPointLabels?Gn/s:0;for(let l=0;l<s;l++){const c=o.setContext(t.getPointLabelContext(l));i[l]=c.padding;const u=t.getPointPosition(l,t.drawingArea+i[l],a),f=ei(c.font),h=zgt(t.ctx,f,t._pointLabels[l]);r[l]=h;const d=to(t.getIndexAngle(l)+a),p=Math.round(sL(d)),g=HH(p,u.x,h.w,0,180),m=HH(p,u.y,h.h,90,270);Wgt(n,e,d,g,m)}t.setCenterPoint(e.l-n.l,n.r-e.r,e.t-n.t,n.b-e.b),t._pointLabelItems=qgt(t,r,i)}function Wgt(t,e,n,r,i){const s=Math.abs(Math.sin(n)),o=Math.abs(Math.cos(n));let a=0,l=0;r.start<e.l?(a=(e.l-r.start)/s,t.l=Math.min(t.l,e.l-a)):r.end>e.r&&(a=(r.end-e.r)/s,t.r=Math.max(t.r,e.r+a)),i.start<e.t?(l=(e.t-i.start)/o,t.t=Math.min(t.t,e.t-l)):i.end>e.b&&(l=(i.end-e.b)/o,t.b=Math.max(t.b,e.b+l))}function Vgt(t,e,n){const r=t.drawingArea,{extra:i,additionalAngle:s,padding:o,size:a}=n,l=t.getPointPosition(e,r+i+o,s),c=Math.round(sL(to(l.angle+Mr))),u=Zgt(l.y,a.h,c),f=Xgt(c),h=Hgt(l.x,a.w,f);return{visible:!0,x:l.x,y:u,textAlign:f,left:h,top:u,right:h+a.w,bottom:u+a.h}}function Ugt(t,e){if(!e)return!0;const{left:n,top:r,right:i,bottom:s}=t;return!($c({x:n,y:r},e)||$c({x:n,y:s},e)||$c({x:i,y:r},e)||$c({x:i,y:s},e))}function qgt(t,e,n){const r=[],i=t._pointLabels.length,s=t.options,{centerPointLabels:o,display:a}=s.pointLabels,l={extra:GA(s)/2,additionalAngle:o?Gn/i:0};let c;for(let u=0;u<i;u++){l.padding=n[u],l.size=e[u];const f=Vgt(t,u,l);r.push(f),a==="auto"&&(f.visible=Ugt(f,c),f.visible&&(c=f))}return r}function Xgt(t){return t===0||t===180?"center":t<180?"left":"right"}function Hgt(t,e,n){return n==="right"?t-=e:n==="center"&&(t-=e/2),t}function Zgt(t,e,n){return n===90||n===270?t-=e/2:(n>270||n<90)&&(t-=e),t}function Ygt(t,e,n){const{left:r,top:i,right:s,bottom:o}=n,{backdropColor:a}=e;if(!ln(a)){const l=id(e.borderRadius),c=Ui(e.backdropPadding);t.fillStyle=a;const u=r-c.left,f=i-c.top,h=s-r+c.width,d=o-i+c.height;Object.values(l).some(p=>p!==0)?(t.beginPath(),qO(t,{x:u,y:f,w:h,h:d,radius:l}),t.fill()):t.fillRect(u,f,h,d)}}function Ggt(t,e){const{ctx:n,options:{pointLabels:r}}=t;for(let i=e-1;i>=0;i--){const s=t._pointLabelItems[i];if(!s.visible)continue;const o=r.setContext(t.getPointLabelContext(i));Ygt(n,o,s);const a=ei(o.font),{x:l,y:c,textAlign:u}=s;Ed(n,t._pointLabels[i],l,c+a.lineHeight/2,a,{color:o.color,textAlign:u,textBaseline:"middle"})}}function ope(t,e,n,r){const{ctx:i}=t;if(n)i.arc(t.xCenter,t.yCenter,e,0,Yn);else{let s=t.getPointPosition(0,e);i.moveTo(s.x,s.y);for(let o=1;o<r;o++)s=t.getPointPosition(o,e),i.lineTo(s.x,s.y)}}function Kgt(t,e,n,r,i){const s=t.ctx,o=e.circular,{color:a,lineWidth:l}=e;!o&&!r||!a||!l||n<0||(s.save(),s.strokeStyle=a,s.lineWidth=l,s.setLineDash(i.dash||[]),s.lineDashOffset=i.dashOffset,s.beginPath(),ope(t,n,o,r),s.closePath(),s.stroke(),s.restore())}function Jgt(t,e,n){return Kf(t,{label:n,index:e,type:"pointLabel"})}class Q1 extends E4{constructor(e){super(e),this.xCenter=void 0,this.yCenter=void 0,this.drawingArea=void 0,this._pointLabels=[],this._pointLabelItems=[]}setDimensions(){const e=this._padding=Ui(GA(this.options)/2),n=this.width=this.maxWidth-e.width,r=this.height=this.maxHeight-e.height;this.xCenter=Math.floor(this.left+n/2+e.left),this.yCenter=Math.floor(this.top+r/2+e.top),this.drawingArea=Math.floor(Math.min(n,r)/2)}determineDataLimits(){const{min:e,max:n}=this.getMinMax(!1);this.min=wr(e)&&!isNaN(e)?e:0,this.max=wr(n)&&!isNaN(n)?n:0,this.handleTickRangeOptions()}computeTickLimit(){return Math.ceil(this.drawingArea/GA(this.options))}generateTickLabels(e){E4.prototype.generateTickLabels.call(this,e),this._pointLabels=this.getLabels().map((n,r)=>{const i=jn(this.options.pointLabels.callback,[n,r],this);return i||i===0?i:""}).filter((n,r)=>this.chart.getDataVisibility(r))}fit(){const e=this.options;e.display&&e.pointLabels.display?Fgt(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(e,n,r,i){this.xCenter+=Math.floor((e-n)/2),this.yCenter+=Math.floor((r-i)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(e,n,r,i))}getIndexAngle(e){const n=Yn/(this._pointLabels.length||1),r=this.options.startAngle||0;return to(e*n+wa(r))}getDistanceFromCenterForValue(e){if(ln(e))return NaN;const n=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-e)*n:(e-this.min)*n}getValueForDistanceFromCenter(e){if(ln(e))return NaN;const n=e/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-n:this.min+n}getPointLabelContext(e){const n=this._pointLabels||[];if(e>=0&&e<n.length){const r=n[e];return Jgt(this.getContext(),e,r)}}getPointPosition(e,n,r=0){const i=this.getIndexAngle(e)-Mr+r;return{x:Math.cos(i)*n+this.xCenter,y:Math.sin(i)*n+this.yCenter,angle:i}}getPointPositionForValue(e,n){return this.getPointPosition(e,this.getDistanceFromCenterForValue(n))}getBasePosition(e){return this.getPointPositionForValue(e||0,this.getBaseValue())}getPointLabelPosition(e){const{left:n,top:r,right:i,bottom:s}=this._pointLabelItems[e];return{left:n,top:r,right:i,bottom:s}}drawBackground(){const{backgroundColor:e,grid:{circular:n}}=this.options;if(e){const r=this.ctx;r.save(),r.beginPath(),ope(this,this.getDistanceFromCenterForValue(this._endValue),n,this._pointLabels.length),r.closePath(),r.fillStyle=e,r.fill(),r.restore()}}drawGrid(){const e=this.ctx,n=this.options,{angleLines:r,grid:i,border:s}=n,o=this._pointLabels.length;let a,l,c;if(n.pointLabels.display&&Ggt(this,o),i.display&&this.ticks.forEach((u,f)=>{if(f!==0||f===0&&this.min<0){l=this.getDistanceFromCenterForValue(u.value);const h=this.getContext(f),d=i.setContext(h),p=s.setContext(h);Kgt(this,d,l,o,p)}}),r.display){for(e.save(),a=o-1;a>=0;a--){const u=r.setContext(this.getPointLabelContext(a)),{color:f,lineWidth:h}=u;!h||!f||(e.lineWidth=h,e.strokeStyle=f,e.setLineDash(u.borderDash),e.lineDashOffset=u.borderDashOffset,l=this.getDistanceFromCenterForValue(n.reverse?this.min:this.max),c=this.getPointPosition(a,l),e.beginPath(),e.moveTo(this.xCenter,this.yCenter),e.lineTo(c.x,c.y),e.stroke())}e.restore()}}drawBorder(){}drawLabels(){const e=this.ctx,n=this.options,r=n.ticks;if(!r.display)return;const i=this.getIndexAngle(0);let s,o;e.save(),e.translate(this.xCenter,this.yCenter),e.rotate(i),e.textAlign="center",e.textBaseline="middle",this.ticks.forEach((a,l)=>{if(l===0&&this.min>=0&&!n.reverse)return;const c=r.setContext(this.getContext(l)),u=ei(c.font);if(s=this.getDistanceFromCenterForValue(this.ticks[l].value),c.showLabelBackdrop){e.font=u.string,o=e.measureText(a.label).width,e.fillStyle=c.backdropColor;const f=Ui(c.backdropPadding);e.fillRect(-o/2-f.left,-s-u.size/2-f.top,o+f.width,u.size+f.height)}Ed(e,a.label,0,-s,u,{color:c.color,strokeColor:c.textStrokeColor,strokeWidth:c.textStrokeWidth})}),e.restore()}drawTitle(){}}Le(Q1,"id","radialLinear"),Le(Q1,"defaults",{display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:ok.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback(e){return e},padding:5,centerPointLabels:!1}}),Le(Q1,"defaultRoutes",{"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"}),Le(Q1,"descriptors",{angleLines:{_fallback:"grid"}});const uk={millisecond:{common:!0,size:1,steps:1e3},second:{common:!0,size:1e3,steps:60},minute:{common:!0,size:6e4,steps:60},hour:{common:!0,size:36e5,steps:24},day:{common:!0,size:864e5,steps:30},week:{common:!1,size:6048e5,steps:4},month:{common:!0,size:2628e6,steps:12},quarter:{common:!1,size:7884e6,steps:4},year:{common:!0,size:3154e7}},As=Object.keys(uk);function ZH(t,e){return t-e}function YH(t,e){if(ln(e))return null;const n=t._adapter,{parser:r,round:i,isoWeekday:s}=t._parseOpts;let o=e;return typeof r=="function"&&(o=r(o)),wr(o)||(o=typeof r=="string"?n.parse(o,r):n.parse(o)),o===null?null:(i&&(o=i==="week"&&(_m(s)||s===!0)?n.startOf(o,"isoWeek",s):n.startOf(o,i)),+o)}function GH(t,e,n,r){const i=As.length;for(let s=As.indexOf(t);s<i-1;++s){const o=uk[As[s]],a=o.steps?o.steps:Number.MAX_SAFE_INTEGER;if(o.common&&Math.ceil((n-e)/(a*o.size))<=r)return As[s]}return As[i-1]}function e1t(t,e,n,r,i){for(let s=As.length-1;s>=As.indexOf(n);s--){const o=As[s];if(uk[o].common&&t._adapter.diff(i,r,o)>=e-1)return o}return As[n?As.indexOf(n):0]}function t1t(t){for(let e=As.indexOf(t)+1,n=As.length;e<n;++e)if(uk[As[e]].common)return As[e]}function KH(t,e,n){if(!n)t[e]=!0;else if(n.length){const{lo:r,hi:i}=oL(n,e),s=n[r]>=e?n[r]:n[i];t[s]=!0}}function n1t(t,e,n,r){const i=t._adapter,s=+i.startOf(e[0].value,r),o=e[e.length-1].value;let a,l;for(a=s;a<=o;a=+i.add(a,1,r))l=n[a],l>=0&&(e[l].major=!0);return e}function JH(t,e,n){const r=[],i={},s=e.length;let o,a;for(o=0;o<s;++o)a=e[o],i[a]=o,r.push({value:a,major:!1});return s===0||!n?r:n1t(t,r,i,n)}class ZO extends Jd{constructor(e){super(e),this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(e,n={}){const r=e.time||(e.time={}),i=this._adapter=new fpt._date(e.adapters.date);i.init(n),vv(r.displayFormats,i.formats()),this._parseOpts={parser:r.parser,round:r.round,isoWeekday:r.isoWeekday},super.init(e),this._normalized=n.normalized}parse(e,n){return e===void 0?null:YH(this,e)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){const e=this.options,n=this._adapter,r=e.time.unit||"day";let{min:i,max:s,minDefined:o,maxDefined:a}=this.getUserBounds();function l(c){!o&&!isNaN(c.min)&&(i=Math.min(i,c.min)),!a&&!isNaN(c.max)&&(s=Math.max(s,c.max))}(!o||!a)&&(l(this._getLabelBounds()),(e.bounds!=="ticks"||e.ticks.source!=="labels")&&l(this.getMinMax(!1))),i=wr(i)&&!isNaN(i)?i:+n.startOf(Date.now(),r),s=wr(s)&&!isNaN(s)?s:+n.endOf(Date.now(),r)+1,this.min=Math.min(i,s-1),this.max=Math.max(i+1,s)}_getLabelBounds(){const e=this.getLabelTimestamps();let n=Number.POSITIVE_INFINITY,r=Number.NEGATIVE_INFINITY;return e.length&&(n=e[0],r=e[e.length-1]),{min:n,max:r}}buildTicks(){const e=this.options,n=e.time,r=e.ticks,i=r.source==="labels"?this.getLabelTimestamps():this._generate();e.bounds==="ticks"&&i.length&&(this.min=this._userMin||i[0],this.max=this._userMax||i[i.length-1]);const s=this.min,o=this.max,a=Ldt(i,s,o);return this._unit=n.unit||(r.autoSkip?GH(n.minUnit,this.min,this.max,this._getLabelCapacity(s)):e1t(this,a.length,n.minUnit,this.min,this.max)),this._majorUnit=!r.major.enabled||this._unit==="year"?void 0:t1t(this._unit),this.initOffsets(i),e.reverse&&a.reverse(),JH(this,a,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map(e=>+e.value))}initOffsets(e=[]){let n=0,r=0,i,s;this.options.offset&&e.length&&(i=this.getDecimalForValue(e[0]),e.length===1?n=1-i:n=(this.getDecimalForValue(e[1])-i)/2,s=this.getDecimalForValue(e[e.length-1]),e.length===1?r=s:r=(s-this.getDecimalForValue(e[e.length-2]))/2);const o=e.length<3?.5:.25;n=ui(n,0,o),r=ui(r,0,o),this._offsets={start:n,end:r,factor:1/(n+1+r)}}_generate(){const e=this._adapter,n=this.min,r=this.max,i=this.options,s=i.time,o=s.unit||GH(s.minUnit,n,r,this._getLabelCapacity(n)),a=Mt(i.ticks.stepSize,1),l=o==="week"?s.isoWeekday:!1,c=_m(l)||l===!0,u={};let f=n,h,d;if(c&&(f=+e.startOf(f,"isoWeek",l)),f=+e.startOf(f,c?"day":o),e.diff(r,n,o)>1e5*a)throw new Error(n+" and "+r+" are too far apart with stepSize of "+a+" "+o);const p=i.ticks.source==="data"&&this.getDataTimestamps();for(h=f,d=0;h<r;h=+e.add(h,a,o),d++)KH(u,h,p);return(h===r||i.bounds==="ticks"||d===1)&&KH(u,h,p),Object.keys(u).sort(ZH).map(g=>+g)}getLabelForValue(e){const n=this._adapter,r=this.options.time;return r.tooltipFormat?n.format(e,r.tooltipFormat):n.format(e,r.displayFormats.datetime)}format(e,n){const i=this.options.time.displayFormats,s=this._unit,o=n||i[s];return this._adapter.format(e,o)}_tickFormatFunction(e,n,r,i){const s=this.options,o=s.ticks.callback;if(o)return jn(o,[e,n,r],this);const a=s.time.displayFormats,l=this._unit,c=this._majorUnit,u=l&&a[l],f=c&&a[c],h=r[n],d=c&&f&&h&&h.major;return this._adapter.format(e,i||(d?f:u))}generateTickLabels(e){let n,r,i;for(n=0,r=e.length;n<r;++n)i=e[n],i.label=this._tickFormatFunction(i.value,n,e)}getDecimalForValue(e){return e===null?NaN:(e-this.min)/(this.max-this.min)}getPixelForValue(e){const n=this._offsets,r=this.getDecimalForValue(e);return this.getPixelForDecimal((n.start+r)*n.factor)}getValueForPixel(e){const n=this._offsets,r=this.getDecimalForPixel(e)/n.factor-n.end;return this.min+r*(this.max-this.min)}_getLabelSize(e){const n=this.options.ticks,r=this.ctx.measureText(e).width,i=wa(this.isHorizontal()?n.maxRotation:n.minRotation),s=Math.cos(i),o=Math.sin(i),a=this._resolveTickFontOptions(0).size;return{w:r*s+a*o,h:r*o+a*s}}_getLabelCapacity(e){const n=this.options.time,r=n.displayFormats,i=r[n.unit]||r.millisecond,s=this._tickFormatFunction(e,0,JH(this,[e],this._majorUnit),i),o=this._getLabelSize(s),a=Math.floor(this.isHorizontal()?this.width/o.w:this.height/o.h)-1;return a>0?a:1}getDataTimestamps(){let e=this._cache.data||[],n,r;if(e.length)return e;const i=this.getMatchingVisibleMetas();if(this._normalized&&i.length)return this._cache.data=i[0].controller.getAllParsedValues(this);for(n=0,r=i.length;n<r;++n)e=e.concat(i[n].controller.getAllParsedValues(this));return this._cache.data=this.normalize(e)}getLabelTimestamps(){const e=this._cache.labels||[];let n,r;if(e.length)return e;const i=this.getLabels();for(n=0,r=i.length;n<r;++n)e.push(YH(this,i[n]));return this._cache.labels=this._normalized?e:this.normalize(e)}normalize(e){return y0e(e.sort(ZH))}}Le(ZO,"id","time"),Le(ZO,"defaults",{bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",callback:!1,major:{enabled:!1}}});function Uw(t,e,n){let r=0,i=t.length-1,s,o,a,l;n?(e>=t[r].pos&&e<=t[i].pos&&({lo:r,hi:i}=Rc(t,"pos",e)),{pos:s,time:a}=t[r],{pos:o,time:l}=t[i]):(e>=t[r].time&&e<=t[i].time&&({lo:r,hi:i}=Rc(t,"time",e)),{time:s,pos:a}=t[r],{time:o,pos:l}=t[i]);const c=o-s;return c?a+(l-a)*(e-s)/c:a}class KA extends ZO{constructor(e){super(e),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const e=this._getTimestampsForTable(),n=this._table=this.buildLookupTable(e);this._minPos=Uw(n,this.min),this._tableRange=Uw(n,this.max)-this._minPos,super.initOffsets(e)}buildLookupTable(e){const{min:n,max:r}=this,i=[],s=[];let o,a,l,c,u;for(o=0,a=e.length;o<a;++o)c=e[o],c>=n&&c<=r&&i.push(c);if(i.length<2)return[{time:n,pos:0},{time:r,pos:1}];for(o=0,a=i.length;o<a;++o)u=i[o+1],l=i[o-1],c=i[o],Math.round((u+l)/2)!==c&&s.push({time:c,pos:o/(a-1)});return s}_generate(){const e=this.min,n=this.max;let r=super.getDataTimestamps();return(!r.includes(e)||!r.length)&&r.splice(0,0,e),(!r.includes(n)||r.length===1)&&r.push(n),r.sort((i,s)=>i-s)}_getTimestampsForTable(){let e=this._cache.all||[];if(e.length)return e;const n=this.getDataTimestamps(),r=this.getLabelTimestamps();return n.length&&r.length?e=this.normalize(n.concat(r)):e=n.length?n:r,e=this._cache.all=e,e}getDecimalForValue(e){return(Uw(this._table,e)-this._minPos)/this._tableRange}getValueForPixel(e){const n=this._offsets,r=this.getDecimalForPixel(e)/n.factor-n.end;return Uw(this._table,r*this._tableRange+this._minPos,!0)}}Le(KA,"id","timeseries"),Le(KA,"defaults",ZO.defaults);var r1t=Object.freeze({__proto__:null,CategoryScale:HA,LinearScale:ZA,LogarithmicScale:YA,RadialLinearScale:Q1,TimeScale:ZO,TimeSeriesScale:KA});const i1t=[upt,Bmt,Igt,r1t];ll.register(...i1t);OL.positioners.lineChartTooltipMousePosition=function(t,e){return{x:e.x,y:e.y}};function s1t(){return{type:"line",data:{datasets:[]},plugins:[a1t],options:{spanGaps:!0,plugins:{tooltip:{mode:"index",intersect:!1,position:"lineChartTooltipMousePosition",callbacks:{title:t=>`X: ${t[0].label}`,label:t=>`${t.dataset.label||""}: ${t.formattedValue}`}}}}}}function o1t({chartRef:t,artifacts:e,datasetHidden:n,darkMode:r,chartSettings:i}){const s=[],o=S$(e,"line");let a=null;for(const[l,c]of Object.entries(o)){if(l===i.xAxisColumn){a=c;continue}s.push({label:l,data:c,yAxisID:i.secondYAxisColumns.includes(l)?"y2":"y1",hidden:n[l]})}if(s.length>0&&!a){const l=s[0].data.length;a=[...Array(l).keys()]}return t.current.verticalLinePlugin.color=r?"white":"black",{labels:a,datasets:s}}const a1t={id:"verticalLinePlugin",afterInit:t=>{t.verticalLinePlugin={x:0,y:0,draw:!1,width:1,color:"black",dash:[3,3]}},afterEvent:(t,e)=>{const{inChartArea:n}=e,{x:r,y:i}=e.event;if(n){const s=t.scales.x,o=t.data.labels,a=s.getValueForPixel(r);let l=o[0],c=Math.abs(a-o[0]);for(const f of o){const h=Math.abs(a-f);h<c&&(c=h,l=f)}const u=s.getPixelForValue(l);t.verticalLinePlugin={...t.verticalLinePlugin,x:u,y:i,draw:!0}}else t.verticalLinePlugin={...t.verticalLinePlugin,x:r,y:i,draw:!1};t.draw()},beforeDatasetsDraw:t=>{const{ctx:e}=t,{top:n,bottom:r}=t.chartArea,{x:i,draw:s,width:o,color:a,dash:l}=t.verticalLinePlugin;s&&(e.save(),e.beginPath(),e.lineWidth=o,e.strokeStyle=a,e.setLineDash(l),e.moveTo(i,r),e.lineTo(i,n),e.stroke(),e.restore())}};OL.positioners.scatterChartTooltipMousePosition=function(t,e){return e?{x:e.x,y:e.y}:!1};function l1t(){return{type:"scatter",plugins:[u1t],options:{plugins:{tooltip:{enabled:!0,mode:"nearest",intersect:!1,position:"scatterChartTooltipMousePosition",callbacks:{title:t=>{const e=t[0];return`(${e.parsed.x.toFixed(2)}, ${e.parsed.y.toFixed(2)})`},label:t=>t.dataset.label||""}}}}}}function c1t({chartRef:t,artifacts:e,datasetHidden:n,darkMode:r,chartSettings:i}){var d;const s=S$(e,"scatter");let o="No Category";const a=(d=Object.values(s)[0])==null?void 0:d.length;if(!a)return{datasets:[]};const l=i.categoryColumn;let c=Object.keys(s)[0];i.xAxisColumn&&(c=i.xAxisColumn);const u=Object.keys(s).find(p=>![l,c].includes(p));if(!u)return{datasets:[]};const f={};for(let p=0;p<a;p++)l&&(o=s[l][p]),o in f||(f[o]=[]),f[o].push({x:s[c][p],y:s[u][p],columnName:u});const h=Object.entries(f).map(([p,g])=>{var m;return{label:p,data:g,yAxisID:i.secondYAxisColumns.includes((m=g[0])==null?void 0:m.columnName)?"y2":"y1",hidden:n[p],pointRadius:4,pointHoverRadius:6}});return t.current.crosshairPlugin.color=r?"white":"black",{datasets:h}}const u1t={id:"crosshairPlugin",afterInit:t=>{t.crosshairPlugin={x:0,y:0,xValue:0,yValue:0,draw:!1,width:1,color:"black",dash:[3,3]}},afterEvent:(t,e)=>{const{inChartArea:n}=e,{x:r,y:i}=e.event;if(n){let s=1/0,o=null;if(t.data.datasets.forEach((a,l)=>{a.hidden||a.data.forEach((c,u)=>{const f=t.scales.x.getPixelForValue(c.x),h=t.scales[a.yAxisID].getPixelForValue(c.y),d=Math.sqrt(Math.pow(r-f,2)+Math.pow(i-h,2));d<s&&(s=d,o={x:f,y:h,xValue:c.x,yValue:c.y,datasetIndex:l,pointIndex:u})})}),o){t.crosshairPlugin={...t.crosshairPlugin,x:o.x,y:o.y,xValue:o.xValue,yValue:o.yValue,draw:!0};const a=[{datasetIndex:o.datasetIndex,index:o.pointIndex}];t.tooltip.setActiveElements(a),t.tooltip.update()}}else t.crosshairPlugin={...t.crosshairPlugin,x:r,y:i,draw:!1},t.tooltip.setActiveElements([],{x:r,y:i});t.draw()},beforeDatasetsDraw:t=>{const{ctx:e}=t,{x:n,y:r,draw:i,width:s,color:o,dash:a}=t.crosshairPlugin,{top:l,bottom:c,left:u,right:f}=t.chartArea;i&&(e.save(),e.beginPath(),e.lineWidth=s,e.strokeStyle=o,e.setLineDash(a),e.moveTo(n,c),e.lineTo(n,l),e.stroke(),e.beginPath(),e.moveTo(u,r),e.lineTo(f,r),e.stroke(),e.beginPath(),e.arc(n,r,4,0,2*Math.PI),e.fillStyle=o,e.fill(),e.restore())}};function f1t({sectionId:t}){const{getRootProps:e,isDragActive:n}=gD(t,!1,"list");return x.jsx("figure",{className:`section-w-full section-row-main single-cell-container flex h-auto w-full max-w-full items-center justify-items-center overflow-clip ${n?"outline outline-4 outline-green-500 dark:outline-green-500/80":""}`,...e(),children:x.jsx(d1t,{sectionId:t})})}function h1t({sectionId:t}){const e=Afe(t,c=>ae.pick(c,["name","value"])),[n]=Ot.darkMode.hook(),r=te(c=>c.x[t].size,ae.isEqual),i=te(c=>c.x[t].chartSettings,ae.isEqual),s=_.useRef(),o=_.useRef(null),[a,l]=_.useState({});return _.useEffect(()=>{const c=m1t(i.type);o.current=new ll(s.current,ae.merge({data:{datasets:[]},options:{animation:!1,responsive:!1,maintainAspectRatio:!1,scales:{x:{type:"linear",position:"bottom"},y1:{type:"linear",position:"left"},y2:{type:"linear",position:"right",grid:{drawOnChartArea:!1}}},plugins:{legend:{onClick:(f,h,d)=>{l(p=>({...p,[h.text]:!p[h.text]})),ll.defaults.plugins.legend.onClick(f,h,d)}}}}},c())),o.current.resize(r.width-25,r.height-50);const u=Lne(t,s);return()=>{o.current&&(o.current.destroy(),o.current=null),u()}},[i.type]),zy(()=>{var d;const c=Object.values(e);if(!o.current)return;const f=g1t(i.type)({chartRef:o,artifacts:c,datasetHidden:a,darkMode:n,chartSettings:i});o.current.data=f;const h=o.current.options.scales;h.x.type=cE(i.xAxisLog,(d=f.labels)==null?void 0:d[0]),h.y1.type=cE(i.y1AxisLog),h.y2.type=cE(i.y2AxisLog),h.y2.display=i.secondYAxisColumns.length>0,o.current.resize(r.width-25,r.height-50),o.current.update()},[e,r,a,n,i]),x.jsx("canvas",{ref:s})}const d1t=ke.memo(h1t),p1t=ke.memo(f1t);function m1t(t){switch(t){case"line":return s1t;case"scatter":return l1t}}function g1t(t){switch(t){case"line":return o1t;case"scatter":return c1t}}function cE(t,e){return typeof e=="string"?"category":t?"logarithmic":"linear"}const op=16;function v1t({draftCanvasRef:t,color:e,brushSize:n,brushShape:r,brushOpacity:i,layerOpacity:s}){const o=Of(t.current);o.globalCompositeOperation="source-over",o.strokeStyle=S1t(e,i),o.lineWidth=n,o.lineCap=r,o.globalAlpha=s}function O1t(t,e,n){const r=Of(t.current),{globalCompositeOperation:i,strokeStyle:s,lineWidth:o,lineCap:a,globalAlpha:l}=r;t.current.width=e,t.current.height=n,r.globalCompositeOperation=i,r.strokeStyle=s,r.lineWidth=o,r.lineCap=a,r.globalAlpha=l}function y1t({sectionId:t,canvasRef:e,tempCanvasRefs:n,draftCanvasRef:r,height:i,width:s,artifactIdUsedToSetCanvasSize:o,state:a}){const l=te.getState(),c=ti.getState().x;let u=tZ(c[o]),f=!1;if(!u)for(const d of l.x[t].artifactGroupIds){const p=l.artifactGroups[d];for(const g of p.artifactTransforms){const m=g.artifactId;if(!(m in c))continue;const v=c[m];if(u=tZ(v),u){a.x[t].canvasSettings.artifactIdUsedToSetCanvasSize=m,f=!0;break}}if(u)break}const h=Oht({sectionId:t,imgSize:u,isNewImg:f,sectionHeight:i,sectionWidth:s,state:a});e.current.width=h.width,e.current.height=h.height;for(const d of Object.values(n.current))d.width=h.width,d.height=h.height;O1t(r,h.width,h.height)}function ape(t){const{offsetX:e,offsetY:n}=t.nativeEvent;return[e,n]}function p2(t){Of(t).clearRect(0,0,t.width,t.height)}function Of(t){return t.getContext("2d")}function yL(t,e,n,r,i,s,o=!0){ti.setState(a=>({x:{...a.x,[e]:{...a.x[e],value:ae.cloneDeep(n.current)}}})),Lf(t,r,i),p2(s.current),hn(o)}function b1t(t,e,n,r,i,s){te.setState(o=>{for(const[a,l]of o.artifactGroups[e].artifactTransforms.entries()){const{transform:c,eraserStrokes:u}=n.current[a];l.transform=ae.cloneDeep(c),l.eraserStrokes=ae.cloneDeep(u)}}),Lf(t,i,s,{},{},{[e]:r.current}),hn(!0)}function Lf(t,e,n,r={},i={},s={},o={}){var p,g,m,v;const a=Of(e.current),l=n.current.layer,c=Of(n.current.layer),u=n.current.artifact,f=Of(n.current.artifact);p2(e.current);const h=te.getState(),d=ti.getState().x;for(const y of h.x[t].artifactGroupIds){const b=h.artifactGroups[y];if(!b.visible)continue;const{layerOpacity:S}=b;for(const[k,E]of b.artifactTransforms.entries()){const T=E.artifactId;if(!(T in d))return;const C=d[T];if(f.globalAlpha=1,f.globalCompositeOperation="source-over",C.type==="img"&&C.value instanceof Image&&C.value.complete){const A=((p=r[y])==null?void 0:p[T])??C.value,R=((g=i[y])==null?void 0:g[k])??E;f.setTransform(...R.transform),f.drawImage(A,0,0,A.width,A.height),uE(f,R.eraserStrokes,R.transform)}else if(C.type==="brushStrokes"&&C.value.length>0){const A=((m=r[y])==null?void 0:m[T])??C.value,R=((v=i[y])==null?void 0:v[k])??E;uE(f,A,R.transform,R.eraserStrokes)}f.resetTransform(),c.globalAlpha=1,c.globalCompositeOperation="source-over",c.drawImage(u,0,0),p2(n.current.artifact)}o[y]&&uE(c,o[y]),a.globalCompositeOperation="source-over",a.globalAlpha=S,a.drawImage(l,0,0),s[y]&&w1t(a,s[y]),p2(n.current.layer)}}function lpe(t,e,n,r){const i=Of(t.current);e.current.push({strokeStyle:i.strokeStyle,lineWidth:i.lineWidth,lineCap:i.lineCap,points:[n],globalCompositeOperation:i.globalCompositeOperation,transform:ae.cloneDeep(r)}),cpe(t,n,n)}function x1t(t,e,n,r){t.current.push({strokeStyle:"rgba(0,0,0,1)",lineWidth:e,lineCap:n,points:[r],globalCompositeOperation:"destination-out"})}function uE(t,e,n=null,r={}){for(const[i,s]of e.entries())if(eZ(t,s,n),r[i])for(const o of r[i])eZ(t,o,n)}function eZ(t,e,n){const r=bL(n,e.transform);r&&t.setTransform(...r),t.beginPath(),t.globalCompositeOperation=e.globalCompositeOperation,t.strokeStyle=e.strokeStyle,t.globalAlpha=1,t.lineWidth=e.lineWidth,t.lineCap=e.lineCap;let i=e.points[0];e.points.forEach(s=>{t.moveTo(i[0],i[1]),t.lineTo(s[0],s[1]),i=s}),t.stroke()}function cpe(t,e,n){const r=Of(t.current);r.beginPath(),r.moveTo(e[0],e[1]),r.lineTo(n[0],n[1]),r.stroke()}function w1t(t,e){t.globalAlpha=1,t.fillStyle="#4299e1",e.forEach(n=>{t.fillRect(n.x-op/2,n.y-op/2,op,op)})}function bL(t,e){return!t&&!e?null:e?t?[t[0]*e[0],0,0,t[3]*e[3],t[4]+e[4]*t[0],t[5]+e[5]*t[3]]:e:t}function xL(t){return[1/t[0],0,0,1/t[3],-t[4]/t[0],-t[5]/t[3]]}function S1t(t,e){const n=t.replace("#",""),r=parseInt(n.substring(0,2),16),i=parseInt(n.substring(2,4),16),s=parseInt(n.substring(4,6),16);return`rgba(${r}, ${i}, ${s}, ${e})`}function tZ(t){var e;if((t==null?void 0:t.type)==="img"&&((e=t==null?void 0:t.value)!=null&&e.complete)){const n=t.value;return{width:n.width,height:n.height}}return null}const A0=ae.throttle((t,e)=>{Pne([t,"drawing"],e())},200);function _1t({sectionId:t,activeLayerId:e,color:n,brushOpacity:r,brushSize:i,brushShape:s,eraserBrushSize:o,isEraser:a,setIsEraser:l,layerOpacity:c,mode:u,clearStrokes:f}){function h(R){Eu(t,"color",R)}function d(R){fE(e,"brushOpacity",R)}function p(R){Eu(t,"brushSize",R)}function g(R){Eu(t,"brushShape",R)}function m(R){fE(e,"layerOpacity",R)}function v(R){Eu(t,"eraserBrushSize",R)}function y(R,Q){fE(R,"visible",Q)}function b(R){Eu(t,"activeLayerId",R)}function S(){l(!1),Eu(t,"mode","draw")}function k(){l(!0),Eu(t,"mode","draw")}function E(){Eu(t,"mode","edit")}function T(){te.setState(R=>{Ite(t,R)})}function C(R){te.setState(Q=>{delete Q.artifactGroups[R];const L=Q.x[t],z=L.artifactGroupIds.findIndex(B=>B===R);L.artifactGroupIds=L.artifactGroupIds.filter(B=>B!==R),L.artifactGroupIds.length>0?L.canvasSettings.activeLayerId=L.artifactGroupIds[z!==-1?z-1:0]:L.canvasSettings.activeLayerId=null})}function A(R,Q){te.setState(L=>{L.x[t].artifactGroupIds=v5(L.x[t].artifactGroupIds,R,Q)})}return x.jsxs("div",{className:"section-search section-w-full z-10 flex flex-wrap items-center gap-2 rounded-xl border-b border-solid border-white px-3 py-3 shadow-sm @container dark:border-setta-700 [&_.colorpicker]:!max-h-6 [&_.colorpicker]:max-w-24 ",children:[x.jsx(k1t,{sectionId:t,color:n,setColor:h}),x.jsxs("div",{className:"flex self-stretch",children:[x.jsx("button",{className:`flex w-8 cursor-pointer items-center justify-center gap-1 rounded-l-lg bg-setta-200/30 py-1 text-xs ${u==="draw"&&!a?"text-blue-500":"text-setta-700 dark:text-setta-400"} hover:bg-setta-200 dark:bg-setta-800/50 dark:hover:bg-setta-900`,onClick:S,children:x.jsx(tI,{})}),x.jsx($1,{arrowClasses:"fill-white dark:fill-setta-800",contentClasses:"z-20 bg-white dark:bg-setta-800 flex relative px-2 py-1 rounded-lg min-w-48",trigger:x.jsx("button",{className:"flex w-6 cursor-pointer items-center justify-center gap-1 rounded-r-lg border border-setta-300/5 bg-setta-200 py-1 text-xs text-setta-700 hover:bg-setta-200 dark:bg-setta-800 dark:text-setta-400 dark:hover:bg-setta-900",children:x.jsx("i",{className:"gg-chevron-down"})}),header:"Brush Settings",children:x.jsx(C1t,{opacity:r,setOpacity:d,brushSize:i,setBrushSize:p,brushShape:s,setBrushShape:g})})]}),x.jsxs("div",{className:"flex self-stretch",children:[x.jsx("button",{className:`flex w-8 cursor-pointer items-center justify-center gap-1 rounded-l-lg bg-setta-200/30 py-1 text-xs ${u==="draw"&&a?"text-blue-500":"text-setta-700 dark:text-setta-400"} hover:bg-setta-300 dark:bg-setta-800/50 dark:hover:bg-setta-900`,onClick:k,children:x.jsx("i",{className:"gg-erase"})}),x.jsx($1,{arrowClasses:"fill-white dark:fill-setta-800",contentClasses:"z-20 bg-white dark:bg-setta-800 flex relative px-2 py-1 rounded-lg min-w-48",trigger:x.jsx("button",{className:"flex w-6 cursor-pointer items-center justify-center gap-1 rounded-r-lg border border-setta-300/5 bg-setta-200 py-1 text-xs text-setta-700 hover:bg-setta-300 dark:bg-setta-800 dark:text-setta-400 dark:hover:bg-setta-900",children:x.jsx("i",{className:"gg-chevron-down"})}),header:"Brush Settings",children:x.jsx(E1t,{brushSize:o,setBrushSize:v})})]}),x.jsx("button",{className:`flex w-8 cursor-pointer items-center justify-center gap-1 self-stretch rounded-lg bg-setta-200/30 py-1 text-xs ${u==="edit"?"text-blue-500":"text-setta-700 dark:text-setta-400"} hover:bg-setta-300 dark:bg-setta-800/50 dark:hover:bg-setta-900`,onClick:E,children:x.jsx(ZFe,{})}),x.jsx($1,{arrowClasses:"fill-white dark:fill-setta-800",contentClasses:"z-20 bg-white dark:bg-setta-800 flex relative px-2 py-1 rounded-lg min-w-48",trigger:x.jsxs("button",{className:"flex w-12 cursor-pointer items-center justify-center gap-0 self-stretch rounded-lg bg-setta-200/30 py-1 text-xs text-setta-700 hover:bg-setta-200 dark:bg-setta-800/50 dark:text-setta-400 dark:hover:bg-setta-900",children:[x.jsx("i",{className:"gg-image"}),x.jsx("i",{className:"gg-chevron-down"})]}),header:"Layer Opacity",children:x.jsx(T1t,{opacity:c,setOpacity:m})}),x.jsx($1,{arrowClasses:"fill-white dark:fill-setta-800",contentClasses:"z-20 bg-white dark:bg-setta-800 flex relative px-2 py-1 rounded-lg min-w-48",trigger:x.jsxs("button",{className:"flex w-12 cursor-pointer items-center justify-center gap-0 self-stretch rounded-lg bg-setta-200/30 py-1 text-xs text-setta-700 hover:bg-setta-200 dark:bg-setta-800/50 dark:text-setta-400 dark:hover:bg-setta-900",children:[x.jsx(tHe,{className:"w-5"}),x.jsx("i",{className:"gg-chevron-down"})]}),header:"Layer Selection",children:x.jsx(P1t,{sectionId:t,activeLayerId:e,setActiveLayerId:b,setLayerVisibility:y,addLayer:T,reorderLayers:A,deleteLayer:C})}),x.jsx("button",{className:"flex w-8 cursor-pointer items-center justify-center gap-1 self-stretch rounded-lg bg-setta-200/30 py-1 text-xs text-setta-700 hover:bg-red-600 hover:text-white dark:bg-setta-800/50 dark:text-setta-400 dark:hover:bg-red-800 dark:hover:text-white",onClick:f,children:x.jsx("i",{className:"gg-trash"})})]})}function k1t({sectionId:t,color:e,setColor:n}){const r=te(i=>{var s;return(s=i.x[t].canvasSettings)==null?void 0:s.colorChoices},ae.isEqual);return x.jsx(FD,{colorChoices:r,value:e,onChange:n,colorPickerChoicesClasses:"inline-flex cursor-pointer items-center overflow-hidden rounded-lg single-cell-container h-8 min-h-0 w-full min-w-0 max-w-24 items-center text-white",wrapperClassName:"single-cell-container justify-self-start self-center min-w-8 max-w-48 h-full"})}function C1t({opacity:t,setOpacity:e,brushSize:n,setBrushSize:r,brushShape:i,setBrushShape:s}){const[o,a]=_.useState(t),[l,c]=_.useState(n);_.useEffect(()=>{a(t)},[t]),_.useEffect(()=>{c(n)},[n]);const u="data[orientation='vertical']:flex-col data[orientation='vertical']:w-5 data[orientation='vertical']:h-24 SliderRoot relative flex flex-1 min-w-16 touch-none select-none items-center my-auto data-[orientation='horizontal']:h-5",f="relative flex-grow rounded-full bg-setta-200 data-[orientation='horizontal']:h-[3px] data-[orientation='vertical']:w-[3px] dark:bg-setta-700",h="absolute h-full rounded-full bg-blue-500",d="block h-3 w-3 cursor-pointer rounded-full border-2 border-setta-300 bg-white shadow-sm drop-shadow-md hover:bg-setta-100 focus:border-blue-500 focus-visible:outline-none dark:border-setta-400 dark:bg-setta-600",p="my-auto w-7 rounded-lg border border-solid border-setta-600/10 px-2 py-1 text-center font-mono text-xs text-setta-700 dark:border-setta-600/30 dark:text-setta-400";return x.jsxs("div",{className:"grid w-full grid-cols-[1fr,_2fr] gap-2",children:[x.jsx("p",{className:"self-center text-xs font-bold text-setta-600 dark:text-setta-400",children:"Opacity"}),x.jsx(xm,{sliderRootClassName:u,sliderTrackClassName:f,sliderRangeClassName:h,sliderThumbClassName:d,textInputClassName:p,wrapperDivClass:"flex gap-2",min:.1,max:1,step:.1,value:o,onChange:a,onCommit:e}),x.jsx("p",{className:"self-center text-xs font-bold text-setta-600 dark:text-setta-400",children:"Size"}),x.jsx(xm,{sliderRootClassName:u,sliderTrackClassName:f,sliderRangeClassName:h,sliderThumbClassName:d,textInputClassName:p,wrapperDivClass:"flex gap-2",min:1,max:100,step:1,value:l,onChange:c,onCommit:r}),x.jsx("p",{className:"self-center text-xs font-bold text-setta-600 dark:text-setta-400",children:"Brush Shape"}),x.jsxs("div",{className:"flex gap-1",children:[x.jsx("button",{className:`flex w-min cursor-pointer gap-2 rounded-lg border-solid ${i==="butt"?"border-setta-300 text-blue-500 dark:border-setta-700":"border-transparent text-setta-600 dark:text-setta-400"} p-1 text-xs font-bold hover:bg-setta-200/50 dark:hover:bg-setta-900/50`,onClick:()=>s("butt"),children:x.jsx("i",{className:"gg-shape-square"})}),x.jsx("button",{className:`flex w-min cursor-pointer gap-2 rounded-lg border-solid ${i==="round"?"border-setta-300 text-blue-500 dark:border-setta-700":"border-transparent text-setta-600 dark:text-setta-400"} p-1 text-xs font-bold hover:bg-setta-200/50 focus-visible:ring-1 dark:hover:bg-setta-900/50`,onClick:()=>s("round"),children:x.jsx("i",{className:"gg-shape-circle"})})]})]})}function E1t({brushSize:t,setBrushSize:e}){const[n,r]=_.useState(t);_.useEffect(()=>{r(t)},[t]);const i="data[orientation='vertical']:flex-col data[orientation='vertical']:w-5 data[orientation='vertical']:h-24 SliderRoot relative flex flex-1 min-w-16 touch-none select-none items-center my-auto data-[orientation='horizontal']:h-5",s="relative flex-grow rounded-full bg-setta-200 data-[orientation='horizontal']:h-[3px] data-[orientation='vertical']:w-[3px] dark:bg-setta-700",o="absolute h-full rounded-full bg-blue-500",a="block h-3 w-3 cursor-pointer rounded-full border-2 border-setta-300 bg-white shadow-sm drop-shadow-md hover:bg-setta-100 focus:border-blue-500 focus-visible:outline-none dark:border-setta-400 dark:bg-setta-600",l="my-auto w-7 rounded-lg border border-solid border-setta-600/10 px-2 py-1 text-center font-mono text-xs text-setta-700 dark:border-setta-600/30 dark:text-setta-400";return x.jsxs("div",{className:"grid w-full grid-cols-[1fr,_2fr] gap-2",children:[x.jsx("p",{className:"self-center text-xs font-bold text-setta-600 dark:text-setta-400",children:"Size"}),x.jsx(xm,{sliderRootClassName:i,sliderTrackClassName:s,sliderRangeClassName:o,sliderThumbClassName:a,textInputClassName:l,wrapperDivClass:"flex gap-2",min:1,max:100,step:1,value:n,onChange:r,onCommit:e})]})}function T1t({opacity:t,setOpacity:e}){const[n,r]=_.useState(t);_.useEffect(()=>{r(t)},[t]);const i="data[orientation='vertical']:flex-col data[orientation='vertical']:w-5 data[orientation='vertical']:h-24 SliderRoot relative flex flex-1 min-w-16 touch-none select-none items-center my-auto data-[orientation='horizontal']:h-5",s="relative flex-grow rounded-full bg-setta-200 data-[orientation='horizontal']:h-[3px] data-[orientation='vertical']:w-[3px] dark:bg-setta-700",o="absolute h-full rounded-full bg-blue-500",a="block h-3 w-3 cursor-pointer rounded-full border-2 border-setta-300 bg-white shadow-sm drop-shadow-md hover:bg-setta-100 focus:border-blue-500 focus-visible:outline-none dark:border-setta-400 dark:bg-setta-600",l="my-auto w-7 rounded-lg border border-solid border-setta-600/10 px-2 py-1 text-center font-mono text-xs text-setta-700 dark:border-setta-600/30 dark:text-setta-400";return x.jsxs("div",{className:"grid w-full grid-cols-[1fr,_2fr] gap-2",children:[x.jsx("p",{className:"self-center text-xs font-bold text-setta-600 dark:text-setta-400",children:"Layer Opacity"}),x.jsx(xm,{sliderRootClassName:i,sliderTrackClassName:s,sliderRangeClassName:o,sliderThumbClassName:a,textInputClassName:l,wrapperDivClass:"flex gap-2",min:.1,max:1,step:.1,value:n,onChange:r,onCommit:e})]})}function P1t({sectionId:t,activeLayerId:e,setActiveLayerId:n,setLayerVisibility:r,addLayer:i,reorderLayers:s,deleteLayer:o}){const a=te(g=>mD(t,g),ae.isEqual),l=a.toReversed(),[c,u]=_.useState(null),f=(g,m)=>{g.dataTransfer.setData("text/plain",m)},h=(g,m)=>{g.preventDefault(),u(m)},d=()=>{u(null)},p=(g,m)=>{g.preventDefault();const v=g.dataTransfer.getData("text/plain");u(null),v!==m&&s(a.length-1-v,a.length-1-m)};return x.jsxs("div",{className:"flex w-full max-w-64 flex-col gap-2",children:[x.jsx("ul",{className:"mt-1 flex w-full flex-col gap-2",children:l.map((g,m)=>x.jsxs("li",{draggable:!0,onDragStart:v=>f(v,m),onDragOver:v=>h(v,m),onDragLeave:d,onDrop:v=>p(v,m),className:`dark:hover:bg-setta-8509 flex cursor-move items-center justify-between gap-2 rounded-lg border-2 bg-setta-50 px-2 py-1 hover:bg-setta-100 dark:bg-setta-900 ${c===m?" border-blue-500":"border-transparent"} `,onClick:()=>n(g.id),children:[x.jsx("button",{onClick:()=>r(g.id,!g.visible),className:"cursor-pointer",children:g.visible?x.jsx(Qse,{className:"h-5 w-5 text-blue-500"}):x.jsx(Nse,{className:"h-5 w-5 text-setta-400 dark:text-setta-600"})}),x.jsx("p",{className:`truncate text-sm font-semibold ${e===g.id?" !text-blue-500":"text-setta-600 dark:text-setta-400"}`,children:g.name}),x.jsx("button",{onClick:()=>o(g.id),className:"flex h-4 w-4 cursor-pointer items-center",children:x.jsx("i",{className:"gg-close text-setta-400 hover:!text-red-500 dark:text-setta-700"})})]},g.id))}),x.jsxs("button",{onClick:i,className:"flex max-w-full cursor-pointer items-center justify-center rounded p-2 text-sm text-setta-600 hover:text-blue-500",children:[x.jsx(Olt,{className:"mr-2 h-3 w-3"}),"Add Layer"]})]})}function Eu(t,e,n){te.setState(r=>{r.x[t].canvasSettings[e]=n})}function fE(t,e,n){te.setState(r=>{r.artifactGroups[t][e]=n})}function A1t(t,e){return{minX:t.minX-e,maxX:t.maxX+e,minY:t.minY-e,maxY:t.maxY+e}}function hE(t,e){return t[0]>=e.minX&&t[0]<=e.maxX&&t[1]>=e.minY&&t[1]<=e.maxY}function nZ(t,e,n,r){const i=Math.atan2(t[1]-e[1],t[0]-e[0]);return[t[0]+(n+r)*Math.cos(i),t[1]+(n+r)*Math.sin(i)]}function R1t(t,e,n,r,i,s){if(hE(t,r))return!0;if(i==="butt")return!1;const o=i==="square"?s:0;if(!e&&n){const[a,l]=nZ(n,t,s,o);return hE([a,l],r)}if(!n&&e){const[a,l]=nZ(t,e,s,o);return hE([a,l],r)}return!1}function $1t(t,e,n,r){if(!t||t.length===0)return[];const i=r/2,s=[];let o=!1;for(let a=0;a<t.length;a++){const l=t[a],c=a>0?t[a-1]:null,u=a<t.length-1?t[a+1]:null;R1t(l,c,u,e,n,i)?(a>0&&s.length===0&&s.push(t[a-1]),s.push(l),o=!0):o&&(s.push(l),o=!1)}return s}function M1t(t,e,n,r){if(!t||t.length===0)return[];const i=e/2,s=A1t(r,i);return $1t(t,s,n,e)}function upe(t,e){return e?t.map(n=>[n[0]*e[0]+e[4],n[1]*e[3]+e[5]]):t}function I1t(t,e){return Math.atan2(e[1]-t[1],e[0]-t[0])}function D1t(t,e,n,r){const i=e+Math.PI/2,s=Math.cos(i),o=Math.sin(i),a=s*n,l=o*r;return t*Math.sqrt(a*a+l*l)}function L1t(t,e){if(t.length<=2)return t;const n=[t[0]];let r=t[0];for(let l=1;l<t.length;l++){const c=t[l],u=c[0]-r[0],f=c[1]-r[1];Math.sqrt(u*u+f*f)>=e&&(n.push(c),r=c)}const i=t[t.length-1],s=i[0]-r[0],o=i[1]-r[1];return(Math.sqrt(s*s+o*o)>=e||n.length===1)&&n.push(i),n}function N1t(t,e,n,r){const i=[t,e],s=upe(n.points,r),o=L1t(s,5);if(o.length===1){const a=n.lineWidth*Math.max(r[0],r[3]);return Math.hypot(i[0]-o[0][0],i[1]-o[0][1])<=a/2}for(let a=0;a<o.length-1;a++){const l=o[a],c=o[a+1],u=I1t(l,c),f=D1t(n.lineWidth,u,r[0],r[3]),h=c[0]-l[0],d=c[1]-l[1],p=h*h+d*d;if(p===0)continue;const g=Math.max(0,Math.min(1,((i[0]-l[0])*h+(i[1]-l[1])*d)/p)),m=l[0]+g*h,v=l[1]+g*d;if(Math.hypot(i[0]-m,i[1]-v)<=f/2)return!0}return!1}const fpe=(t,e)=>{let n=1/0,r=-1/0,i=1/0,s=-1/0;for(const o of t){const a=bL(e,o.transform);for(const l of upe(o.points,a))l[0]<n&&(n=l[0]),l[1]<i&&(i=l[1]),l[0]>r&&(r=l[0]),l[1]>s&&(s=l[1])}return{minX:n,maxX:r,minY:i,maxY:s}};function Q1t(t,e,n,r){switch(t.current.idx){case 0:e.current[0].x+=n,e.current[0].y+=r,e.current[1].y+=r,e.current[2].x+=n;break;case 1:e.current[0].y+=r,e.current[1].x+=n,e.current[1].y+=r,e.current[3].x+=n;break;case 2:e.current[0].x+=n,e.current[2].x+=n,e.current[2].y+=r,e.current[3].y+=r;break;case 3:e.current[1].x+=n,e.current[2].y+=r,e.current[3].x+=n,e.current[3].y+=r;break}}function JA(t,e){t.current=[{x:e.minX,y:e.minY},{x:e.maxX,y:e.minY},{x:e.minX,y:e.maxY},{x:e.maxX,y:e.maxY}]}function j1t(t){const e=t.current.map(r=>r.x),n=t.current.map(r=>r.y);return{minX:Math.min(...e),maxX:Math.max(...e),minY:Math.min(...n),maxY:Math.max(...n)}}function B1t(t){return{minX:t.current[0].x,maxX:t.current[1].x,minY:t.current[0].y,maxY:t.current[2].y}}function hpe(t,e){return t.width*e[0]}function dpe(t,e){return t.height*e[3]}function ppe(t,e){const n=[e[4],e[4]+hpe(t,e)],r=[e[5],e[5]+dpe(t,e)];return{minX:Math.min(...n),maxX:Math.max(...n),minY:Math.min(...r),maxY:Math.max(...r)}}function z1t(t,e,n){switch(t){case 0:if(e&&n)return qw;if(e&&!n)return Hw;if(!e&&n)return Xw;if(!e&&!n)return Zw;case 1:if(e&&n)return Xw;if(e&&!n)return Zw;if(!e&&n)return qw;if(!e&&!n)return Hw;case 2:if(e&&n)return Hw;if(e&&!n)return qw;if(!e&&n)return Zw;if(!e&&!n)return Xw;case 3:if(e&&n)return Zw;if(e&&!n)return Xw;if(!e&&n)return Hw;if(!e&&!n)return qw}}function Di(t){return t===0?1e-6:t}function qw(t,e,n,r,i,s){t[0]=Di((e-r)/s.value.width),t[3]=Di((n-i)/s.value.height),t[4]+=r,t[5]+=i}function Xw(t,e,n,r,i,s){t[0]=Di((e+r)/s.value.width),t[3]=Di((n-i)/s.value.height),t[5]+=i}function Hw(t,e,n,r,i,s){t[0]=Di((e-r)/s.value.width),t[3]=Di((n+i)/s.value.height),t[4]+=r}function Zw(t,e,n,r,i,s){t[0]=Di((e+r)/s.value.width),t[3]=Di((n+i)/s.value.height)}function F1t(t,e,n,r){for(let i=0;i<n.value.length;i++){const s=n.value[i],o=bL(r,s.transform);if(N1t(t,e,s,o))return!0}return!1}function W1t({sectionId:t,isEraser:e,strokesRef:n,eraserStrokesRef:r,prevPointRef:i,eraserBrushSize:s,brushShape:o,isDrawing:a,setIsDrawing:l,isDragging:c,draggedIdx:u,lastPos:f,selectedIdx:h,resizeHandle:d,resizeHandleCorners:p,drawThrottleDelay:g,canvasRef:m,tempCanvasRefs:v,draftCanvasRef:y,canvasTransferQueueLength:b,currBrushStrokeArtifactId:S,activeLayerId:k,localArtifactTransformsRef:E,mode:T}){let C,A,R,Q,L,z;const B=()=>Ete(m.current);if(T==="draw"){const Z=V1t({sectionId:t,isEraser:e,strokesRef:n,eraserStrokesRef:r,eraserBrushSize:s,brushShape:o,prevPointRef:i,setIsDrawing:l,canvasRef:m,tempCanvasRefs:v,draftCanvasRef:y,activeLayerId:k,currBrushStrokeArtifactId:S,localArtifactTransformsRef:E});C=(...j)=>{z=Z(...j),z&&A0(t,B)};const J=U1t({sectionId:t,isEraser:e,strokesRef:n,eraserStrokesRef:r,prevPointRef:i,isDrawing:a,canvasRef:m,tempCanvasRefs:v,draftCanvasRef:y,canvasTransferQueueLength:b,activeLayerId:k,currBrushStrokeArtifactId:S,localArtifactTransformsRef:E});A=(...j)=>{z=J(...j),z&&A0(t,B)};const I=q1t({sectionId:t,isEraser:e,eraserStrokesRef:r,isDrawing:a,setIsDrawing:l,activeLayerId:k,currBrushStrokeArtifactId:S,strokesRef:n,canvasRef:m,tempCanvasRefs:v,draftCanvasRef:y});R=(...j)=>{z=I(...j),z&&A0(t,B)},Q=X1t({draftCanvasRef:y,onMouseDown:C})}else{const Z=H1t({canvasRef:m,selectedIdx:h,localArtifactTransformsRef:E,resizeHandle:d,resizeHandleCorners:p,lastPos:f,draggedIdx:u,isDragging:c});C=(...j)=>{L=Z(...j),L&&(Lf(t,m,v,{},{[k]:E.current},{[k]:p.current}),A0(t,B))};const J=Z1t({canvasRef:m,isDragging:c,lastPos:f,resizeHandle:d,resizeHandleCorners:p,selectedIdx:h,draggedIdx:u,localArtifactTransformsRef:E});A=(...j)=>{L=J(...j),L&&(Lf(t,m,v,{},{[k]:E.current},{[k]:p.current}),A0(t,B))};const I=Y1t({sectionId:t,isDragging:c,draggedIdx:u,resizeHandle:d,resizeHandleCorners:p,activeLayerId:k,localArtifactTransformsRef:E,canvasRef:m,tempCanvasRefs:v});R=(...j)=>{I(...j),A0(t,B)},Q=()=>{}}const q=_.useCallback(T==="draw"&&g>0?ae.throttle(A,g):A,[A,g]);return{onMouseDown:C,onMouseMove:q,onMouseUp:R,onMouseEnter:Q}}function V1t({sectionId:t,isEraser:e,strokesRef:n,eraserStrokesRef:r,eraserBrushSize:i,brushShape:s,prevPointRef:o,setIsDrawing:a,canvasRef:l,tempCanvasRefs:c,draftCanvasRef:u,activeLayerId:f,currBrushStrokeArtifactId:h,localArtifactTransformsRef:d}){return(p,g,m)=>{if(Ut.getState().mouseDownDraggingSection)return!1;let v=!1;Ut.getState().mouseDownDrawArea||a3(t),Ut.setState({mouseDownDrawArea:!0}),a(!0);let y;if(g&&m?y=[g,m]:y=ape(p),e)x1t(r,i,s,y),Lf(t,l,c,{},{},{},{[f]:r.current}),v=!0;else{const b=d.current.find(S=>S.artifactId===h);b&&(lpe(u,n,y,xL(b.transform)),v=!0)}return o.current=y,v}}function U1t({sectionId:t,isEraser:e,strokesRef:n,eraserStrokesRef:r,prevPointRef:i,isDrawing:s,canvasRef:o,tempCanvasRefs:a,draftCanvasRef:l,canvasTransferQueueLength:c,activeLayerId:u,currBrushStrokeArtifactId:f,localArtifactTransformsRef:h}){return d=>{if(!s)return!1;const p=ape(d),g=e?r:n,m=g.current[g.current.length-1];if(!m)return!1;if(e)m.points.push(p),i.current=p,Lf(t,o,a,{},{},{},{[u]:r.current});else if(m.points.length>=c){yL(t,f,n,o,a,l,!1);const v=h.current.find(y=>y.artifactId===f);v&&lpe(l,g,p,xL(v.transform)),i.current=p}else cpe(l,i.current,p),m.points.push(p),i.current=p;return!0}}function q1t({sectionId:t,isEraser:e,eraserStrokesRef:n,isDrawing:r,setIsDrawing:i,activeLayerId:s,currBrushStrokeArtifactId:o,strokesRef:a,canvasRef:l,tempCanvasRefs:c,draftCanvasRef:u}){return()=>{if(!r)return!1;if(e){const f=ti.getState().x,h=n.current[n.current.length-1];te.setState(d=>{const p=d.artifactGroups[s];for(const g of p.artifactTransforms){const m=f[g.artifactId],v=xL(g.transform),y=m.type==="img"?ppe:fpe,b=M1t(h.points,h.lineWidth,h.lineCap,y(m.value,g.transform));if(m.type==="img")b.length>0&&g.eraserStrokes.push({...h,points:b,transform:v});else for(const[S]of m.value.entries())b.length>0&&(S in g.eraserStrokes||(g.eraserStrokes[S]=[]),g.eraserStrokes[S].push({...h,points:b,transform:v}))}}),n.current=[]}return i(!1),yL(t,o,a,l,c,u),!0}}function X1t({draftCanvasRef:t,onMouseDown:e}){return n=>{if(n.buttons===1){const r=KR(),i=t.current.getBoundingClientRect(),s=(n.clientX-i.left)/r,o=(n.clientY-i.top)/r;e(n,s,o)}}}function H1t({canvasRef:t,selectedIdx:e,localArtifactTransformsRef:n,resizeHandle:r,resizeHandleCorners:i,lastPos:s,draggedIdx:o,isDragging:a}){return l=>{const c=ti.getState().x,f=t.current.getBoundingClientRect(),h=KR(),d=(l.clientX-f.left)/h,p=(l.clientY-f.top)/h;if(e.current!==null)for(let g=0;g<i.current.length;g++){const m=i.current[g];if(Math.abs(d-m.x)<=op/2&&Math.abs(p-m.y)<=op/2){const v=n.current[e.current].transform;return r.current={idx:g,wasPositive:{xScale:v[0]>=0,yScale:v[3]>=0}},s.current={x:d,y:p},!0}}for(let g=n.current.length-1;g>=0;g--){const{transform:m,artifactId:v}=n.current[g],y=c[v];if(y.type==="img"){const b=ppe(y.value,m);if(d>=b.minX&&d<=b.maxX&&p>=b.minY&&p<=b.maxY)return JA(i,b),a.current=!0,o.current=g,e.current=g,s.current={x:d,y:p},!0}else if(y.type==="brushStrokes"&&F1t(d,p,y,m)){const S=fpe(y.value,m);return JA(i,S),a.current=!0,o.current=g,e.current=g,s.current={x:d,y:p},!0}}return e.current=null,i.current=null,!1}}function Z1t({canvasRef:t,isDragging:e,lastPos:n,resizeHandle:r,resizeHandleCorners:i,selectedIdx:s,draggedIdx:o,localArtifactTransformsRef:a}){return l=>{if(!e.current&&r.current===null)return!1;const c=ti.getState().x,f=t.current.getBoundingClientRect(),h=KR(),d=(l.clientX-f.left)/h,p=(l.clientY-f.top)/h,g=d-n.current.x,m=p-n.current.y;if(e.current&&o.current!==null){const{transform:v}=a.current[o.current];v[4]+=g,v[5]+=m,n.current={x:d,y:p},i.current=i.current.map(y=>({x:y.x+g,y:y.y+m}))}else if(r.current!==null&&s.current!==null){const{transform:v,artifactId:y}=a.current[s.current],b=c[y];if(b.type==="img"){const S=hpe(b.value,v),k=dpe(b.value,v);z1t(r.current.idx,r.current.wasPositive.xScale,r.current.wasPositive.yScale)(v,S,k,g,m,b)}else if(b.type==="brushStrokes"){const S=B1t(i),k=S.maxX-S.minX,E=S.maxY-S.minY;switch(r.current.idx){case 0:{const T=(k-g)/k,C=(E-m)/E,A=S.maxX,R=S.maxY;v[0]=Di(v[0]*T),v[3]=Di(v[3]*C),v[4]=A-(A-v[4])*T,v[5]=R-(R-v[5])*C;break}case 1:{const T=(k+g)/k,C=(E-m)/E,A=S.minX,R=S.maxY;v[0]=Di(v[0]*T),v[3]=Di(v[3]*C),v[4]=A-(A-v[4])*T,v[5]=R-(R-v[5])*C;break}case 2:{const T=(k-g)/k,C=(E+m)/E,A=S.maxX,R=S.minY;v[0]=Di(v[0]*T),v[3]=Di(v[3]*C),v[4]=A-(A-v[4])*T,v[5]=R-(R-v[5])*C;break}case 3:{const T=(k+g)/k,C=(E+m)/E,A=S.minX,R=S.minY;v[0]=Di(v[0]*T),v[3]=Di(v[3]*C),v[4]=A-(A-v[4])*T,v[5]=R-(R-v[5])*C;break}}}Q1t(r,i,g,m),n.current={x:d,y:p}}return!0}}function Y1t({sectionId:t,isDragging:e,draggedIdx:n,resizeHandle:r,resizeHandleCorners:i,activeLayerId:s,localArtifactTransformsRef:o,canvasRef:a,tempCanvasRefs:l}){return()=>{i.current&&JA(i,j1t(i)),b1t(t,s,o,i,a,l),e.current=!1,n.current=null,r.current=null}}function G1t({sectionId:t}){var pe,De;const{activeLayer:e,allLayersMetadata:n,size:{width:r,height:i},canvasSettings:{activeLayerId:s,color:o,brushSize:a,brushShape:l,eraserBrushSize:c,drawThrottleDelay:u,canvasTransferQueueLength:f,mode:h,artifactIdUsedToSetCanvasSize:d},loadedArtifacts:p,loadedArtifactIdsWithDuplicates:g}=Drt(t),m=_.useRef(null),v=_.useRef(null),y=_.useRef({layer:null,artifact:null}),b=_.useRef([]),S=_.useRef([]),k=_.useRef([]),E=_.useRef(null),[T,C]=_.useState(!1),[A,R]=_.useState(!1),Q=_.useRef(!1),L=_.useRef(null),z=_.useRef({x:0,y:0}),B=_.useRef(null),q=_.useRef(null),Z=_.useRef(null),J=(e==null?void 0:e.layerOpacity)??1,I=(e==null?void 0:e.brushOpacity)??1,j=(De=(pe=e==null?void 0:e.artifactTransforms)==null?void 0:pe.find(xe=>{var je;return((je=p[xe.artifactId])==null?void 0:je.type)==="brushStrokes"}))==null?void 0:De.artifactId,M=Ut(xe=>xe.updateDrawAreas);_.useEffect(()=>(y.current.layer=document.createElement("canvas"),y.current.artifact=document.createElement("canvas"),Lne(t,m)),[]),_.useEffect(()=>{te.setState(xe=>{y1t({sectionId:t,canvasRef:m,tempCanvasRefs:y,draftCanvasRef:v,height:i,width:r,artifactIdUsedToSetCanvasSize:d,state:xe})}),Lf(t,m,y)},[i,r,!!p[d],M]),_.useEffect(()=>{v1t({draftCanvasRef:v,color:o,brushSize:a,brushShape:l,brushOpacity:I,layerOpacity:J})},[o,a,l,I,J,M]),zy(()=>{h==="draw"&&(B.current=null,Z.current=null),Lf(t,m,y)},[h,J,n,g,M]),_.useEffect(()=>{j?b.current=ae.cloneDeep(ti.getState().x[j].value):b.current=[]},[j,M]),Hje(()=>{e!=null&&e.artifactTransforms?k.current=ae.cloneDeep(e.artifactTransforms):k.current=[]},[e==null?void 0:e.artifactTransforms,M]);const{onMouseDown:X,onMouseMove:se,onMouseUp:H,onMouseEnter:de}=W1t({sectionId:t,isEraser:A,strokesRef:b,eraserStrokesRef:S,prevPointRef:E,eraserBrushSize:c,brushShape:l,isDrawing:T,setIsDrawing:C,isDragging:Q,draggedIdx:L,lastPos:z,selectedIdx:B,resizeHandle:q,resizeHandleCorners:Z,drawThrottleDelay:u,canvasRef:m,tempCanvasRefs:y,draftCanvasRef:v,canvasTransferQueueLength:f,currBrushStrokeArtifactId:j,activeLayerId:s,localArtifactTransformsRef:k,mode:h});function fe(){b.current=[],yL(t,j,b,m,y,v)}const{getRootProps:ve,isDragActive:F}=gD(t,!0,"img"),oe=`single-cell-child max-w-full place-self-center ${F?"outline outline-4 outline-green-500 dark:outline-green-500/80":""}`;let le;return h==="edit"?le="cursor-pointer":A?le="cursor-[url(./src/assets/cursor/erase.svg)_0_24,_pointer]":le="cursor-[url(./src/assets/cursor/pen.svg)_0_24,_pointer]",x.jsxs(x.Fragment,{children:[x.jsx(_1t,{sectionId:t,activeLayerId:s,color:o,brushOpacity:I,brushSize:a,brushShape:l,eraserBrushSize:c,isEraser:A,setIsEraser:R,layerOpacity:J,mode:h,clearStrokes:fe}),x.jsx("section",{className:"nodrag single-cell-container section-row-main section-key-value relative max-h-full min-w-0",...ve(),children:x.jsxs("div",{className:"single-cell-child single-cell-container",children:[x.jsx("canvas",{ref:m,onMouseDown:X,onMouseMove:se,onMouseUp:H,onMouseLeave:H,onMouseEnter:de,className:`${le} ${oe}`}),x.jsx("canvas",{ref:v,className:`pointer-events-none ${oe}`})]})})]})}function wL({sectionId:t}){const e=te(r=>Yt(t,r).isFrozen);function n(){J1t(t)}return x.jsx(mpe,{sectionId:t,isDisabled:e,onChange:n})}function mpe({sectionId:t,isDisabled:e,onChange:n}){const[r,i]=K1t(t),{wrapperRef:s,handleCreateEditor:o,maxHeight:a,overflow:l,nowheel:c}=hD({sectionId:t}),{onArticleDivEnterKeyFocusOnCodeMirror:u,onEscapeFocusOnArticleDiv:f}=dD(s),h=R3(),d=F3({sectionId:t,language:"yaml",indentWithTab:!0,onEscape:f,isDisabled:e});function p(m){i(m),n==null||n()}const g=l===""?"[&_.cm-editor]:h-full":"";return x.jsx("article",{ref:s,className:`${Cl} nodrag section-full-no-title min-h-0 cursor-auto [&_*]:!outline-0 [&_.cm-theme]:h-full ${g} ${l} ${c}`,onKeyDown:u,tabIndex:"0",children:x.jsx(Ky,{maxHeight:a,value:r,onChange:p,theme:h,extensions:d,onCreateEditor:o,indentWithTab:!1,basicSetup:{tabSize:4}})})}function K1t(t){const{variantId:e,displayedVariantId:n}=te(s=>({variantId:s.x[t].variantId,displayedVariantId:z5(t,s)}),ae.isEqual),r=u_(s=>s[n]??"");function i(s){u_.setState({[e]:s})}return[r,i]}const J1t=ae.debounce(V$,500);function evt({rootStyles:t="",itemStyles:e="",triggerStyles:n="",contentStyles:r="",headerStyles:i="",trigger:s,children:o,heading:a,value:l,defaultValue:c=l,type:u="single",open:f="",asChild:h=!1,internalWrapper:d=!0}){return x.jsx(wD,{className:t,type:u,defaultValue:c,collapsible:!0,"data-state":f,asChild:h,children:x.jsxs(tvt,{itemStyles:e,value:l,children:[x.jsx(nvt,{triggerStyles:n,trigger:s,headerStyles:i,children:a}),x.jsx(rvt,{contentStyles:r,internalWrapper:d,children:o})]})})}const tvt=ke.forwardRef(({children:t,itemStyles:e,...n},r)=>x.jsx(q3,{className:e,...n,ref:r,children:t})),nvt=ke.forwardRef(({children:t,headerStyles:e,trigger:n,triggerStyles:r,...i},s)=>x.jsx(Qfe,{className:e,children:x.jsxs(X3,{className:`group ${r}`,...i,ref:s,children:[t,x.jsx(vze,{className:"ease-[cubic-bezier(0.87, 0, 0.13, 1)] transition-transform duration-300 group-data-[state=open]:rotate-180"})]})})),rvt=ke.forwardRef(({children:t,contentStyles:e,internalWrapper:n,...r},i)=>n?x.jsx(IO,{className:e,...r,ref:i,children:x.jsx("div",{className:"overflow-y-auto px-5 py-4 ",children:t})}):x.jsx(IO,{className:e,...r,ref:i,children:t}));function fk(t){const e=te(i=>i.x[t].displayMode===so.YAML),[n,r]=_.useState(!1);return _.useEffect(()=>{if(e){const{variantId:i,displayMode:s}=Pi(t);Ene(t,i),r(!0)}else n&&V$(t)},[e]),e}function ivt({sectionId:t}){const e=te(n=>{var i;const r=n.x[t].size.width;return r==="auto"?(i=Uf(t))==null?void 0:i.width:r});return x.jsx(svt,{sectionId:t,width:e})}function svt({sectionId:t,width:e}){const{ref:n,isScrollable:r}=dg();return x.jsx(x.Fragment,{children:x.jsxs("section",{className:`${e&&e<386&&r?"nowheel":""} section-main -mr-3 mb-2 flex min-w-0 flex-col gap-2 overflow-y-scroll pr-2 @sm/multipane:flex-row @sm/multipane:gap-4 @sm/multipane:overflow-visible`,ref:n,children:[x.jsx(ovt,{width:e,children:x.jsx(avt,{sectionId:t})}),x.jsx(lvt,{sectionId:t})]})})}function ovt({width:t,children:e}){return t>384?x.jsx(eL,{className:"nodrag relative -mr-2 flex flex-col pr-1",enable:{right:!0},minWidth:100,maxWidth:"70%",handleClasses:{right:"before:bg-transparent before:absolute before:top-0 before:h-3/4 before:bottom-0 before:left-0 before:right-0 before:m-auto before:w-1/4 hover:before:bg-blue-500 before:rounded-full"},children:e}):x.jsx("article",{className:"-mr-2 flex flex-col pr-2",children:e})}function avt({sectionId:t}){return x.jsxs(x.Fragment,{children:[x.jsx("h3",{className:"mb-[0.55rem] ml-0.5 mt-2 text-xs font-bold uppercase text-setta-300 dark:text-setta-500",children:"Run Groups"}),x.jsx(cvt,{sectionId:t}),x.jsx(wvt,{sectionId:t})]})}function lvt({sectionId:t}){const e=fk(t),n=te(r=>r.x[t].previewVariantId??r.x[t].variantId);return n?x.jsx("article",{className:`${e?"-mr-2 overflow-visible @sm/multipane:-mr-[14px] @sm/multipane:overflow-y-scroll":"h-full min-h-0 min-w-0 max-w-full overflow-x-clip"} mt-2 flex flex-1 flex-col pb-2 `,children:e?x.jsx(mpe,{sectionId:t}):x.jsxs(x.Fragment,{children:[x.jsxs("div",{className:"flex gap-4",children:[x.jsx("h3",{className:"text-xs font-bold uppercase text-setta-300 dark:text-setta-500",children:"Sections"}),x.jsx(xvt,{})]}),x.jsx(uvt,{runGroupId:n})]})}):null}function cvt({sectionId:t}){const{ref:e,isScrollable:n}=dg(),{editingRunGroupId:r,runGroupsDetails:i,runGroupSelection:s}=te(o=>{const a=[],{variantIds:l,variantId:c}=o.x[t];for(const u of l)a.push({id:u,name:o.variants[u].name});return{runGroupsDetails:a,runGroupSelection:o.x[t].selectedVariantIds,editingRunGroupId:c}},ae.isEqual);return x.jsx("ul",{className:`${n?"nowheel":""} flex flex-grow flex-col overflow-visible py-[2px] @sm/multipane:overflow-y-scroll`,ref:e,onMouseLeave:()=>gde(t),children:i.map(({id:o,name:a})=>x.jsx(bvt,{shown:r===o,checked:s[o]??!1,onChange:()=>{JRe(t,o)},onMouseEnter:()=>mde(t,o),onClick:()=>vde(t,o),children:a},o))})}function uvt({runGroupId:t}){const e=o$e(),{ref:n,isScrollable:r}=dg();return x.jsx(vpe,{sections:e,runGroupId:t,ref:n,className:r?"nowheel":"",ancestors:[],parentIsSelected:!0})}function gpe({ancestors:t,parentIsSelected:e,runGroupId:n}){const r=s$e(t[t.length-1].variantId);return x.jsx(vpe,{sections:r,runGroupId:n,ancestors:t,parentIsSelected:e})}const vpe=ke.forwardRef(({sections:t,runGroupId:e,ancestors:n,parentIsSelected:r,className:i=""},s)=>t.length>0&&x.jsx("ul",{className:`${i} flex flex-grow flex-col overflow-visible rounded-lg bg-setta-50/40 pl-3 pr-2 pt-1 @sm/multipane:overflow-y-scroll dark:bg-setta-875`,ref:s,children:t.map((o,a)=>x.jsx(fvt,{sectionInfo:o,ancestors:n,parentIsSelected:r,runGroupId:e},a))}));function fvt({sectionInfo:t,ancestors:e,parentIsSelected:n,runGroupId:r}){const i=t.id,s=e.length===0?null:e[e.length-1].variantId;function o(){n$e({id:r,ancestors:e,sectionId:i,parentVariantId:s})}const a=te(l=>{var c,u;return n&&!!((u=(c=l.variants[r].runGroup[i])==null?void 0:c[s])!=null&&u.selected)});return x.jsxs("li",{className:"flex flex-col",children:[x.jsx(SL,{checked:a,onChange:o,children:t.name}),x.jsx(dvt,{sectionId:i,runGroupId:r,isSelected:a,ancestors:e,parentVariantId:s}),x.jsx(gvt,{sectionId:i,runGroupId:r,isSelected:a,ancestors:e,parentVariantId:s})]})}function hvt({sectionId:t,ancestors:e,runGroupId:n,isSelected:r,parentVariantId:i}){const s=Fte(t);return s.length>1?x.jsx(pvt,{sectionId:t,ancestors:e,runGroupId:n,isSelected:r,allVersions:s,parentVariantId:i}):x.jsx("div",{className:"pl-4",children:x.jsx(gpe,{ancestors:[...e,{id:t,variantId:s[0].id}],parentIsSelected:r,runGroupId:n})})}const dvt=ke.memo(hvt,ae.isEqual);function pvt({sectionId:t,ancestors:e,runGroupId:n,isSelected:r,allVersions:i,parentVariantId:s}){const a=te(l=>{var u,f;const c=(f=(u=l.variants[n].runGroup[t])==null?void 0:u[s])==null?void 0:f.versions;if(!c)return!1;for(const h of Object.values(c))if(h)return!0;return!1})||!r?void 0:"bg-red-100 dark:bg-red-950/20 hover:bg-red-500/20 border-red-300 hover:dark:bg-red-950/50 dark:border-red-700/80 hover:dark:border-red-700 [&_ul]:!bg-transparent";return x.jsx(Ope,{inputList:i,heading:"Versions",isSelected:r,sectionId:t,runGroupId:n,ancestors:e,parentVariantId:s,accordionRootStyles:a,ChildComponent:Ovt})}function mvt({sectionId:t,ancestors:e,runGroupId:n,isSelected:r,parentVariantId:i}){const s=WAe(t);return s.length>0&&x.jsx(Ope,{inputList:s,heading:"Param Sweeps",isSelected:r,sectionId:t,runGroupId:n,ancestors:e,parentVariantId:i,ChildComponent:yvt})}const gvt=ke.memo(mvt,ae.isEqual);function vvt({inputList:t,heading:e,isSelected:n,sectionId:r,runGroupId:i,ancestors:s,parentVariantId:o,accordionRootStyles:a,ChildComponent:l}){return x.jsx(evt,{rootStyles:`${a??"hover:bg-white hover:dark:bg-setta-700/10 hover:border-setta-50 dark:hover:border-setta-700"} border border-transparent rounded-lg px-2 ml-7 -mr-2 -mt-0.5`,itemStyles:"focus-within:relative focus-within:z-10",headerStyles:"flex flex-1 cursor-default items-center justify-between my-0.5 ml-1",triggerStyles:"flex justify-between px-2 -mx-2 w-full items-center hover:cursor-pointer rounded-md italic text-xs font-semibold opacity-60 group-hover:opacity-100 text-setta-500 dark:text-setta-300 focus-visible:outline outline-blue-500",contentStyles:"text-xs overflow-hidden mb-1 ",heading:e,value:e,internalWrapper:!1,"data-state":open,children:x.jsx("ul",{children:t.map((c,u)=>x.jsx("li",{className:"ml-[4px] flex min-h-6 cursor-pointer flex-col rounded",children:x.jsx(l,{id:c.id,name:c.name,parentIsSelected:n,sectionId:r,runGroupId:i,ancestors:s,parentVariantId:o})},u))})})}const Ope=ke.memo(vvt,ae.isEqual);function Ovt({id:t,name:e,parentIsSelected:n,sectionId:r,runGroupId:i,ancestors:s,parentVariantId:o}){function a(){i$e({id:i,sectionId:r,versionId:t,ancestors:s,parentVariantId:o})}const l=te(c=>{var u;return n&&!!((u=c.variants[i].runGroup[r])!=null&&u[o].versions[t])});return x.jsxs(x.Fragment,{children:[x.jsx("div",{className:"flex items-center gap-2 truncate",children:x.jsx(SL,{checked:l,onChange:a,children:e})}),x.jsx("div",{className:"pl-4",children:x.jsx(gpe,{parentIsSelected:l,ancestors:[...s,{id:r,variantId:t}],runGroupId:i})})]})}function yvt({id:t,name:e,parentIsSelected:n,ancestors:r,sectionId:i,runGroupId:s,parentVariantId:o}){function a(){r$e({id:s,ancestors:r,sectionId:i,paramSweepId:t,parentVariantId:o})}const l=te(c=>{var u;return!!((u=c.variants[s].runGroup[i])!=null&&u[o].paramSweeps[t])});return x.jsx(SL,{checked:n&&l,onChange:a,children:e})}function SL({children:t,checked:e,onChange:n}){return x.jsxs("label",{className:"flex min-h-6 cursor-pointer items-center gap-2 text-xs text-setta-700 dark:text-setta-300",children:[x.jsx("input",{type:"checkbox",className:"h-4 w-4 min-w-4 rounded-md bg-setta-500/10 outline-offset-2 outline-blue-500 checked:bg-blue-500 hover:bg-setta-500/30 hover:checked:bg-blue-500 focus-visible:outline",checked:e,onChange:n}),x.jsx("p",{className:"truncate",children:t})]})}function bvt({children:t,checked:e,shown:n,onChange:r,onClick:i,onMouseEnter:s}){return x.jsxs("li",{className:"group/runitem flex justify-between",onMouseEnter:s,children:[x.jsxs("label",{className:`flex min-h-6 cursor-pointer items-center gap-2 truncate rounded px-1 py-0.5 text-xs text-setta-700 group-hover/runitem:!text-blue-500 dark:text-setta-200 ${n?"font-bold !text-blue-500":""}`,children:[x.jsx("input",{type:"checkbox",className:"h-4 w-4 min-w-4 cursor-pointer rounded-md bg-setta-500/15 outline-offset-2 outline-blue-500 checked:bg-blue-500 hover:bg-setta-500/30 hover:checked:bg-blue-500 focus-visible:outline",checked:e,onChange:r}),x.jsx("p",{className:"truncate",children:t})]}),x.jsx("button",{className:`mr-0.5 flex h-6 w-6 cursor-pointer items-center justify-center rounded-full text-transparent outline-blue-500 hover:!text-setta-500 focus-visible:outline group-hover/runitem:text-setta-300 dark:hover:!text-setta-300 dark:group-hover/runitem:text-setta-600 ${n?"!text-blue-500":""}`,onClick:i,children:x.jsx("i",{className:"gg-pen "})})]})}function xvt(){const t="flex-1 min-w-0 text-xs outline-0 cursor-auto bg-transparent [border-width:0_0_1px_0] border-solid border-transparent truncate focus-visible:border-blue-300 pl-4 py-1 placeholder-setta-300 dark:placeholder-setta-700 ";return x.jsx("div",{className:"-mt-1 flex-1",children:x.jsx(Ud,{leftElement:x.jsx("i",{className:"gg-sort-az mb-[2px] !scale-50 text-setta-400"}),placeholder:"Filter",inputStyles:t,outerClasses:"flex-1"})})}function wvt({sectionId:t}){async function e(){Svt(t)}return x.jsxs("button",{className:"nodrag mt-2 flex min-w-0 cursor-pointer select-none items-center justify-center gap-1 rounded-md border border-solid border-setta-100 px-2 py-1 text-xs font-bold uppercase leading-none text-setta-400 outline-none transition-colors duration-150 hover:bg-setta-50 focus-visible:!border-blue-500 focus-visible:outline-none focus-visible:ring-0 dark:border-setta-800 dark:text-setta-500 dark:hover:bg-setta-800 dark:hover:text-setta-400",onClick:e,children:[x.jsx("span",{className:"relative",children:x.jsx("i",{className:"gg-add-r absolute"})}),"New Run Group"]})}function Svt(t){let e;te.setState(n=>{const r=zm();({newVariantId:e}=dde(t,r,n)),Kne(e,n)}),Nd(t,e)}function _vt({sectionId:t,paramInfoId:e,maybeErrorMessage:n}){const{value:r,evRefs:i}=BAe(t,e),[s,o]=_.useState(r),a=_.useRef();function l(c){var f;const u=ae.toString(c);o(u),(f=a.current)==null||f.abort(),Cvt(t,e,u,a),ZT(),kvt(t,e,u)}return _.useEffect(()=>{s!==r&&o(r)},[r]),x.jsx(bct,{sectionId:t,paramInfoId:e,value:s,onChange:l,maybeErrorMessage:n,evRefs:i})}function kvt(t,e,n){Pne([t,e],n)}const Cvt=by(async(t,e,n,r)=>{const i=new AbortController;if(r.current=i,Hy(t,e).type===Y.TEXT){if(i.signal.aborted)return;const s=await CM({sectionId:t,paramInfoId:e,fullText:n});if(i.signal.aborted)return;te.setState(o=>{MT(t,e,n,o);const{variantId:a}=o.x[t];o.variants[a].values[e].evRefs=s})}else{if(i.signal.aborted)return;te.setState(s=>{MT(t,e,n,s)})}hn(!0)},50);function Evt({showResizeHandle:t,onMouseDown:e}){return x.jsx("div",{className:"section-center relative mx-auto h-[90%] w-0.5 rounded-sm group-hover/arg-group:bg-setta-500/15",children:t&&x.jsx("div",{className:`${Cl} nopan nodrag group/resize absolute inset-y-0 left-1/2 -ml-2 flex w-4 cursor-col-resize items-center justify-center`,onMouseDown:e,children:x.jsx("div",{className:"h-[calc(100%-4px)] w-1.5 rounded bg-transparent hover:!bg-blue-500 group-hover/resize:bg-setta-200 group-hover/resize:dark:bg-setta-500"})})})}function Tvt({sectionId:t,paramInfoId:e,requiredParamIdsToPaths:n,children:r,onResizeStart:i,isKwarg:s=!1,isTopLevelWithPad:o,paramChildren:a,onMouseDown:l,maybeErrorMessage:c,border:u,bg:f}){const{description:h,name:d}=te(y=>({description:y.codeInfo[e].description,name:y.codeInfo[e].name}),ae.isEqual),{childlessRef:p,childlessNameRef:g,parentRef:m}=Avt(t,a),v=c?[{content:c,wrapperClassName:"!border-red-300 dark:!border-red-900 [&_.tooltip-footer]:!text-red-500 dark:[&_.tooltip-footer]:!text-red-800 dark:[&_.tooltip-footer]:!border-red-950 !bg-red-50/90 dark:!bg-[#120000]/90 [&_.tooltip-copy]:!text-red-400 dark:[&_.tooltip-copy]:!text-red-300 [&>.tooltip-copy]:hover:!bg-transparent",contentClassName:"!text-red-700 dark:!text-red-300 font-mono"},{title:d,content:h}]:[{title:d,content:h}];return a.length===0?x.jsx(x.Fragment,{children:x.jsxs("article",{id:`ParamContainer-${t}-${e}`,className:`section-args-nested-key-value section-key-value group/arg-group section-min-rows grid grid-cols-subgrid items-center justify-between rounded-sm px-[2px] hover:bg-setta-100/50 hover:dark:bg-setta-800/70 ${f} ${u} `,...Rr(...v),onMouseDownCapture:l,ref:p,children:[s?x.jsx(x.Fragment,{children:r}):x.jsx("div",{className:"section-key overflow-hidden",ref:g,children:r}),x.jsx(_vt,{sectionId:t,paramInfoId:e,maybeErrorMessage:c}),x.jsx(Evt,{showResizeHandle:!0,onMouseDown:i}),!!c&&x.jsx(Rvt,{paramInfoId:e})]})}):x.jsxs("article",{id:`ParamContainer-${t}-${e}`,className:`section-args-nested section-lg-value group/arg-group section-min-rows [&>p]:section-key-value grid grid-cols-subgrid items-center justify-between gap-y-1 rounded-sm ${o?"[&>p]:!pb-0 [&>p]:!pt-2":""}`,...Rr(...v),ref:m,children:[r,x.jsxs("div",{className:"section-args-nested section-key-value relative grid gap-y-1",children:[x.jsx("div",{className:"absolute bottom-0 h-[calc(100%_-_0.1rem)] w-[0.4rem] rounded-full bg-setta-200/20 dark:bg-setta-400/20"}),x.jsx(_L,{sectionId:t,paramIds:a,requiredParamIdsToPaths:n,onResizeStart:i})]})]})}const Pvt=ke.memo(Tvt);function Avt(t,e){const n=_.useRef(),r=_.useRef(),i=_.useRef();return _.useEffect(()=>jm.subscribe(s=>s[t],s=>{n.current&&(n.current.style.gridTemplateColumns=`minmax(min-content, ${s}px) [c3] 0.75rem [c4] 1fr [c5]`),i.current&&(i.current.style.gridTemplateColumns=`[c1] 0.75rem [c2] minmax(min-content, ${s}px) [c3] 0.75rem [c4] 1fr [c5]`),r.current&&(r.current.style.width=`${s}px`)},{fireImmediately:!0}),[e.length>0]),{childlessRef:n,childlessNameRef:r,parentRef:i}}function Rvt({paramInfoId:t}){function e(n){Wct(n,t)}return x.jsx(bze,{className:"section-key-value grid-row-start-1 group/ w-45overflow-y-clip ml-auto aspect-square cursor-help rounded-full bg-red-500/80 px-0.5 pb-0.5 pt-[1px] text-white peer-focus-within/textinput:text-red-100 peer-focus-within/textinput:!opacity-20 dark:bg-red-700/80 dark:peer-focus-within/textinput:text-red-400",onContextMenu:e})}ke.forwardRef(({children:t,...e},n)=>x.jsx(q3,{className:`focus-within:relative focus-within:z-10
373
+ `):t}function Egt(t,e){const{element:n,datasetIndex:r,index:i}=e,s=t.getDatasetMeta(r).controller,{label:o,value:a}=s.getLabelAndValue(i);return{chart:t,label:o,parsed:s.getParsed(i),raw:t.data.datasets[r].data[i],formattedValue:a,dataset:s.getDataset(),dataIndex:i,datasetIndex:r,element:n}}function jH(t,e){const n=t.chart.ctx,{body:r,footer:i,title:s}=t,{boxWidth:o,boxHeight:a}=e,l=ei(e.bodyFont),c=ei(e.titleFont),u=ei(e.footerFont),f=s.length,h=i.length,d=r.length,p=Ui(e.padding);let g=p.height,m=0,v=r.reduce((S,k)=>S+k.before.length+k.lines.length+k.after.length,0);if(v+=t.beforeBody.length+t.afterBody.length,f&&(g+=f*c.lineHeight+(f-1)*e.titleSpacing+e.titleMarginBottom),v){const S=e.displayColors?Math.max(a,l.lineHeight):l.lineHeight;g+=d*S+(v-d)*l.lineHeight+(v-1)*e.bodySpacing}h&&(g+=e.footerMarginTop+h*u.lineHeight+(h-1)*e.footerSpacing);let y=0;const b=function(S){m=Math.max(m,n.measureText(S).width+y)};return n.save(),n.font=c.string,xn(t.title,b),n.font=l.string,xn(t.beforeBody.concat(t.afterBody),b),y=e.displayColors?o+2+e.boxPadding:0,xn(r,S=>{xn(S.before,b),xn(S.lines,b),xn(S.after,b)}),y=0,n.font=u.string,xn(t.footer,b),n.restore(),m+=p.width,{width:m,height:g}}function Tgt(t,e){const{y:n,height:r}=e;return n<r/2?"top":n>t.height-r/2?"bottom":"center"}function Pgt(t,e,n,r){const{x:i,width:s}=r,o=n.caretSize+n.caretPadding;if(t==="left"&&i+s+o>e.width||t==="right"&&i-s-o<0)return!0}function Agt(t,e,n,r){const{x:i,width:s}=n,{width:o,chartArea:{left:a,right:l}}=t;let c="center";return r==="center"?c=i<=(a+l)/2?"left":"right":i<=s/2?c="left":i>=o-s/2&&(c="right"),Pgt(c,t,e,n)&&(c="center"),c}function BH(t,e,n){const r=n.yAlign||e.yAlign||Tgt(t,n);return{xAlign:n.xAlign||e.xAlign||Agt(t,e,n,r),yAlign:r}}function Rgt(t,e){let{x:n,width:r}=t;return e==="right"?n-=r:e==="center"&&(n-=r/2),n}function $gt(t,e,n){let{y:r,height:i}=t;return e==="top"?r+=n:e==="bottom"?r-=i+n:r-=i/2,r}function zH(t,e,n,r){const{caretSize:i,caretPadding:s,cornerRadius:o}=t,{xAlign:a,yAlign:l}=n,c=i+s,{topLeft:u,topRight:f,bottomLeft:h,bottomRight:d}=id(o);let p=Rgt(e,a);const g=$gt(e,l,c);return l==="center"?a==="left"?p+=c:a==="right"&&(p-=c):a==="left"?p-=Math.max(u,h)+i:a==="right"&&(p+=Math.max(f,d)+i),{x:ui(p,0,r.width-e.width),y:ui(g,0,r.height-e.height)}}function Vw(t,e,n){const r=Ui(n.padding);return e==="center"?t.x+t.width/2:e==="right"?t.x+t.width-r.right:t.x+r.left}function FH(t){return tl([],gc(t))}function Mgt(t,e,n){return Kf(t,{tooltip:e,tooltipItems:n,type:"tooltip"})}function WH(t,e){const n=e&&e.dataset&&e.dataset.tooltip&&e.dataset.tooltip.callbacks;return n?t.override(n):t}const spe={beforeTitle:lc,title(t){if(t.length>0){const e=t[0],n=e.chart.data.labels,r=n?n.length:0;if(this&&this.options&&this.options.mode==="dataset")return e.dataset.label||"";if(e.label)return e.label;if(r>0&&e.dataIndex<r)return n[e.dataIndex]}return""},afterTitle:lc,beforeBody:lc,beforeLabel:lc,label(t){if(this&&this.options&&this.options.mode==="dataset")return t.label+": "+t.formattedValue||t.formattedValue;let e=t.dataset.label||"";e&&(e+=": ");const n=t.formattedValue;return ln(n)||(e+=n),e},labelColor(t){const n=t.chart.getDatasetMeta(t.datasetIndex).controller.getStyle(t.dataIndex);return{borderColor:n.borderColor,backgroundColor:n.backgroundColor,borderWidth:n.borderWidth,borderDash:n.borderDash,borderDashOffset:n.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(t){const n=t.chart.getDatasetMeta(t.datasetIndex).controller.getStyle(t.dataIndex);return{pointStyle:n.pointStyle,rotation:n.rotation}},afterLabel:lc,afterBody:lc,beforeFooter:lc,footer:lc,afterFooter:lc};function xs(t,e,n,r){const i=t[e].call(n,r);return typeof i>"u"?spe[e].call(n,r):i}class XA extends fu{constructor(e){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=e.chart,this.options=e.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(e){this.options=e,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const e=this._cachedAnimations;if(e)return e;const n=this.chart,r=this.options.setContext(this.getContext()),i=r.enabled&&n.options.animation&&r.animations,s=new Q0e(this.chart,i);return i._cacheable&&(this._cachedAnimations=Object.freeze(s)),s}getContext(){return this.$context||(this.$context=Mgt(this.chart.getContext(),this,this._tooltipItems))}getTitle(e,n){const{callbacks:r}=n,i=xs(r,"beforeTitle",this,e),s=xs(r,"title",this,e),o=xs(r,"afterTitle",this,e);let a=[];return a=tl(a,gc(i)),a=tl(a,gc(s)),a=tl(a,gc(o)),a}getBeforeBody(e,n){return FH(xs(n.callbacks,"beforeBody",this,e))}getBody(e,n){const{callbacks:r}=n,i=[];return xn(e,s=>{const o={before:[],lines:[],after:[]},a=WH(r,s);tl(o.before,gc(xs(a,"beforeLabel",this,s))),tl(o.lines,xs(a,"label",this,s)),tl(o.after,gc(xs(a,"afterLabel",this,s))),i.push(o)}),i}getAfterBody(e,n){return FH(xs(n.callbacks,"afterBody",this,e))}getFooter(e,n){const{callbacks:r}=n,i=xs(r,"beforeFooter",this,e),s=xs(r,"footer",this,e),o=xs(r,"afterFooter",this,e);let a=[];return a=tl(a,gc(i)),a=tl(a,gc(s)),a=tl(a,gc(o)),a}_createItems(e){const n=this._active,r=this.chart.data,i=[],s=[],o=[];let a=[],l,c;for(l=0,c=n.length;l<c;++l)a.push(Egt(this.chart,n[l]));return e.filter&&(a=a.filter((u,f,h)=>e.filter(u,f,h,r))),e.itemSort&&(a=a.sort((u,f)=>e.itemSort(u,f,r))),xn(a,u=>{const f=WH(e.callbacks,u);i.push(xs(f,"labelColor",this,u)),s.push(xs(f,"labelPointStyle",this,u)),o.push(xs(f,"labelTextColor",this,u))}),this.labelColors=i,this.labelPointStyles=s,this.labelTextColors=o,this.dataPoints=a,a}update(e,n){const r=this.options.setContext(this.getContext()),i=this._active;let s,o=[];if(!i.length)this.opacity!==0&&(s={opacity:0});else{const a=N1[r.position].call(this,i,this._eventPosition);o=this._createItems(r),this.title=this.getTitle(o,r),this.beforeBody=this.getBeforeBody(o,r),this.body=this.getBody(o,r),this.afterBody=this.getAfterBody(o,r),this.footer=this.getFooter(o,r);const l=this._size=jH(this,r),c=Object.assign({},a,l),u=BH(this.chart,r,c),f=zH(r,c,u,this.chart);this.xAlign=u.xAlign,this.yAlign=u.yAlign,s={opacity:1,x:f.x,y:f.y,width:l.width,height:l.height,caretX:a.x,caretY:a.y}}this._tooltipItems=o,this.$context=void 0,s&&this._resolveAnimations().update(this,s),e&&r.external&&r.external.call(this,{chart:this.chart,tooltip:this,replay:n})}drawCaret(e,n,r,i){const s=this.getCaretPosition(e,r,i);n.lineTo(s.x1,s.y1),n.lineTo(s.x2,s.y2),n.lineTo(s.x3,s.y3)}getCaretPosition(e,n,r){const{xAlign:i,yAlign:s}=this,{caretSize:o,cornerRadius:a}=r,{topLeft:l,topRight:c,bottomLeft:u,bottomRight:f}=id(a),{x:h,y:d}=e,{width:p,height:g}=n;let m,v,y,b,S,k;return s==="center"?(S=d+g/2,i==="left"?(m=h,v=m-o,b=S+o,k=S-o):(m=h+p,v=m+o,b=S-o,k=S+o),y=m):(i==="left"?v=h+Math.max(l,u)+o:i==="right"?v=h+p-Math.max(c,f)-o:v=this.caretX,s==="top"?(b=d,S=b-o,m=v-o,y=v+o):(b=d+g,S=b+o,m=v+o,y=v-o),k=b),{x1:m,x2:v,x3:y,y1:b,y2:S,y3:k}}drawTitle(e,n,r){const i=this.title,s=i.length;let o,a,l;if(s){const c=Rp(r.rtl,this.x,this.width);for(e.x=Vw(this,r.titleAlign,r),n.textAlign=c.textAlign(r.titleAlign),n.textBaseline="middle",o=ei(r.titleFont),a=r.titleSpacing,n.fillStyle=r.titleColor,n.font=o.string,l=0;l<s;++l)n.fillText(i[l],c.x(e.x),e.y+o.lineHeight/2),e.y+=o.lineHeight+a,l+1===s&&(e.y+=r.titleMarginBottom-a)}}_drawColorBox(e,n,r,i,s){const o=this.labelColors[r],a=this.labelPointStyles[r],{boxHeight:l,boxWidth:c}=s,u=ei(s.bodyFont),f=Vw(this,"left",s),h=i.x(f),d=l<u.lineHeight?(u.lineHeight-l)/2:0,p=n.y+d;if(s.usePointStyle){const g={radius:Math.min(c,l)/2,pointStyle:a.pointStyle,rotation:a.rotation,borderWidth:1},m=i.leftForLtr(h,c)+c/2,v=p+l/2;e.strokeStyle=s.multiKeyBackground,e.fillStyle=s.multiKeyBackground,BA(e,g,m,v),e.strokeStyle=o.borderColor,e.fillStyle=o.backgroundColor,BA(e,g,m,v)}else{e.lineWidth=Zt(o.borderWidth)?Math.max(...Object.values(o.borderWidth)):o.borderWidth||1,e.strokeStyle=o.borderColor,e.setLineDash(o.borderDash||[]),e.lineDashOffset=o.borderDashOffset||0;const g=i.leftForLtr(h,c),m=i.leftForLtr(i.xPlus(h,1),c-2),v=id(o.borderRadius);Object.values(v).some(y=>y!==0)?(e.beginPath(),e.fillStyle=s.multiKeyBackground,qO(e,{x:g,y:p,w:c,h:l,radius:v}),e.fill(),e.stroke(),e.fillStyle=o.backgroundColor,e.beginPath(),qO(e,{x:m,y:p+1,w:c-2,h:l-2,radius:v}),e.fill()):(e.fillStyle=s.multiKeyBackground,e.fillRect(g,p,c,l),e.strokeRect(g,p,c,l),e.fillStyle=o.backgroundColor,e.fillRect(m,p+1,c-2,l-2))}e.fillStyle=this.labelTextColors[r]}drawBody(e,n,r){const{body:i}=this,{bodySpacing:s,bodyAlign:o,displayColors:a,boxHeight:l,boxWidth:c,boxPadding:u}=r,f=ei(r.bodyFont);let h=f.lineHeight,d=0;const p=Rp(r.rtl,this.x,this.width),g=function(C){n.fillText(C,p.x(e.x+d),e.y+h/2),e.y+=h+s},m=p.textAlign(o);let v,y,b,S,k,E,T;for(n.textAlign=o,n.textBaseline="middle",n.font=f.string,e.x=Vw(this,m,r),n.fillStyle=r.bodyColor,xn(this.beforeBody,g),d=a&&m!=="right"?o==="center"?c/2+u:c+2+u:0,S=0,E=i.length;S<E;++S){for(v=i[S],y=this.labelTextColors[S],n.fillStyle=y,xn(v.before,g),b=v.lines,a&&b.length&&(this._drawColorBox(n,e,S,p,r),h=Math.max(f.lineHeight,l)),k=0,T=b.length;k<T;++k)g(b[k]),h=f.lineHeight;xn(v.after,g)}d=0,h=f.lineHeight,xn(this.afterBody,g),e.y-=s}drawFooter(e,n,r){const i=this.footer,s=i.length;let o,a;if(s){const l=Rp(r.rtl,this.x,this.width);for(e.x=Vw(this,r.footerAlign,r),e.y+=r.footerMarginTop,n.textAlign=l.textAlign(r.footerAlign),n.textBaseline="middle",o=ei(r.footerFont),n.fillStyle=r.footerColor,n.font=o.string,a=0;a<s;++a)n.fillText(i[a],l.x(e.x),e.y+o.lineHeight/2),e.y+=o.lineHeight+r.footerSpacing}}drawBackground(e,n,r,i){const{xAlign:s,yAlign:o}=this,{x:a,y:l}=e,{width:c,height:u}=r,{topLeft:f,topRight:h,bottomLeft:d,bottomRight:p}=id(i.cornerRadius);n.fillStyle=i.backgroundColor,n.strokeStyle=i.borderColor,n.lineWidth=i.borderWidth,n.beginPath(),n.moveTo(a+f,l),o==="top"&&this.drawCaret(e,n,r,i),n.lineTo(a+c-h,l),n.quadraticCurveTo(a+c,l,a+c,l+h),o==="center"&&s==="right"&&this.drawCaret(e,n,r,i),n.lineTo(a+c,l+u-p),n.quadraticCurveTo(a+c,l+u,a+c-p,l+u),o==="bottom"&&this.drawCaret(e,n,r,i),n.lineTo(a+d,l+u),n.quadraticCurveTo(a,l+u,a,l+u-d),o==="center"&&s==="left"&&this.drawCaret(e,n,r,i),n.lineTo(a,l+f),n.quadraticCurveTo(a,l,a+f,l),n.closePath(),n.fill(),i.borderWidth>0&&n.stroke()}_updateAnimationTarget(e){const n=this.chart,r=this.$animations,i=r&&r.x,s=r&&r.y;if(i||s){const o=N1[e.position].call(this,this._active,this._eventPosition);if(!o)return;const a=this._size=jH(this,e),l=Object.assign({},o,this._size),c=BH(n,e,l),u=zH(e,l,c,n);(i._to!==u.x||s._to!==u.y)&&(this.xAlign=c.xAlign,this.yAlign=c.yAlign,this.width=a.width,this.height=a.height,this.caretX=o.x,this.caretY=o.y,this._resolveAnimations().update(this,u))}}_willRender(){return!!this.opacity}draw(e){const n=this.options.setContext(this.getContext());let r=this.opacity;if(!r)return;this._updateAnimationTarget(n);const i={width:this.width,height:this.height},s={x:this.x,y:this.y};r=Math.abs(r)<.001?0:r;const o=Ui(n.padding),a=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;n.enabled&&a&&(e.save(),e.globalAlpha=r,this.drawBackground(s,e,i,n),M0e(e,n.textDirection),s.y+=o.top,this.drawTitle(s,e,n),this.drawBody(s,e,n),this.drawFooter(s,e,n),I0e(e,n.textDirection),e.restore())}getActiveElements(){return this._active||[]}setActiveElements(e,n){const r=this._active,i=e.map(({datasetIndex:a,index:l})=>{const c=this.chart.getDatasetMeta(a);if(!c)throw new Error("Cannot find a dataset at index "+a);return{datasetIndex:a,element:c.data[l],index:l}}),s=!b4(r,i),o=this._positionChanged(i,n);(s||o)&&(this._active=i,this._eventPosition=n,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(e,n,r=!0){if(n&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const i=this.options,s=this._active||[],o=this._getActiveElements(e,s,n,r),a=this._positionChanged(o,e),l=n||!b4(o,s)||a;return l&&(this._active=o,(i.enabled||i.external)&&(this._eventPosition={x:e.x,y:e.y},this.update(!0,n))),l}_getActiveElements(e,n,r,i){const s=this.options;if(e.type==="mouseout")return[];if(!i)return n.filter(a=>this.chart.data.datasets[a.datasetIndex]&&this.chart.getDatasetMeta(a.datasetIndex).controller.getParsed(a.index)!==void 0);const o=this.chart.getElementsAtEventForMode(e,s.mode,s,r);return s.reverse&&o.reverse(),o}_positionChanged(e,n){const{caretX:r,caretY:i,options:s}=this,o=N1[s.position].call(this,e,n);return o!==!1&&(r!==o.x||i!==o.y)}}Le(XA,"positioners",N1);var OL={id:"tooltip",_element:XA,positioners:N1,afterInit(t,e,n){n&&(t.tooltip=new XA({chart:t,options:n}))},beforeUpdate(t,e,n){t.tooltip&&t.tooltip.initialize(n)},reset(t,e,n){t.tooltip&&t.tooltip.initialize(n)},afterDraw(t){const e=t.tooltip;if(e&&e._willRender()){const n={tooltip:e};if(t.notifyPlugins("beforeTooltipDraw",{...n,cancelable:!0})===!1)return;e.draw(t.ctx),t.notifyPlugins("afterTooltipDraw",n)}},afterEvent(t,e){if(t.tooltip){const n=e.replay;t.tooltip.handleEvent(e.event,n,e.inChartArea)&&(e.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(t,e)=>e.bodyFont.size,boxWidth:(t,e)=>e.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:spe},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:t=>t!=="filter"&&t!=="itemSort"&&t!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]},Igt=Object.freeze({__proto__:null,Colors:Xmt,Decimation:Gmt,Filler:vgt,Legend:Sgt,SubTitle:Cgt,Title:kgt,Tooltip:OL});const Dgt=(t,e,n,r)=>(typeof e=="string"?(n=t.push(e)-1,r.unshift({index:n,label:e})):isNaN(e)&&(n=null),n);function Lgt(t,e,n,r){const i=t.indexOf(e);if(i===-1)return Dgt(t,e,n,r);const s=t.lastIndexOf(e);return i!==s?n:i}const Ngt=(t,e)=>t===null?null:ui(Math.round(t),0,e);function VH(t){const e=this.getLabels();return t>=0&&t<e.length?e[t]:t}class HA extends Jd{constructor(e){super(e),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(e){const n=this._addedLabels;if(n.length){const r=this.getLabels();for(const{index:i,label:s}of n)r[i]===s&&r.splice(i,1);this._addedLabels=[]}super.init(e)}parse(e,n){if(ln(e))return null;const r=this.getLabels();return n=isFinite(n)&&r[n]===e?n:Lgt(r,e,Mt(n,e),this._addedLabels),Ngt(n,r.length-1)}determineDataLimits(){const{minDefined:e,maxDefined:n}=this.getUserBounds();let{min:r,max:i}=this.getMinMax(!0);this.options.bounds==="ticks"&&(e||(r=0),n||(i=this.getLabels().length-1)),this.min=r,this.max=i}buildTicks(){const e=this.min,n=this.max,r=this.options.offset,i=[];let s=this.getLabels();s=e===0&&n===s.length-1?s:s.slice(e,n+1),this._valueRange=Math.max(s.length-(r?0:1),1),this._startValue=this.min-(r?.5:0);for(let o=e;o<=n;o++)i.push({value:o});return i}getLabelForValue(e){return VH.call(this,e)}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(e){return typeof e!="number"&&(e=this.parse(e)),e===null?NaN:this.getPixelForDecimal((e-this._startValue)/this._valueRange)}getPixelForTick(e){const n=this.ticks;return e<0||e>n.length-1?null:this.getPixelForValue(n[e].value)}getValueForPixel(e){return Math.round(this._startValue+this.getDecimalForPixel(e)*this._valueRange)}getBasePixel(){return this.bottom}}Le(HA,"id","category"),Le(HA,"defaults",{ticks:{callback:VH}});function Qgt(t,e){const n=[],{bounds:i,step:s,min:o,max:a,precision:l,count:c,maxTicks:u,maxDigits:f,includeBounds:h}=t,d=s||1,p=u-1,{min:g,max:m}=e,v=!ln(o),y=!ln(a),b=!ln(c),S=(m-g)/(f+1);let k=jX((m-g)/p/d)*d,E,T,C,A;if(k<1e-14&&!v&&!y)return[{value:g},{value:m}];A=Math.ceil(m/k)-Math.floor(g/k),A>p&&(k=jX(A*k/p/d)*d),ln(l)||(E=Math.pow(10,l),k=Math.ceil(k*E)/E),i==="ticks"?(T=Math.floor(g/k)*k,C=Math.ceil(m/k)*k):(T=g,C=m),v&&y&&s&&$dt((a-o)/s,k/1e3)?(A=Math.round(Math.min((a-o)/k,u)),k=(a-o)/A,T=o,C=a):b?(T=v?o:T,C=y?a:C,A=c-1,k=(C-T)/A):(A=(C-T)/k,Ov(A,Math.round(A),k/1e3)?A=Math.round(A):A=Math.ceil(A));const R=Math.max(BX(k),BX(T));E=Math.pow(10,ln(l)?R:l),T=Math.round(T*E)/E,C=Math.round(C*E)/E;let Q=0;for(v&&(h&&T!==o?(n.push({value:o}),T<o&&Q++,Ov(Math.round((T+Q*k)*E)/E,o,UH(o,S,t))&&Q++):T<o&&Q++);Q<A;++Q){const L=Math.round((T+Q*k)*E)/E;if(y&&L>a)break;n.push({value:L})}return y&&h&&C!==a?n.length&&Ov(n[n.length-1].value,a,UH(a,S,t))?n[n.length-1].value=a:n.push({value:a}):(!y||C===a)&&n.push({value:C}),n}function UH(t,e,{horizontal:n,minRotation:r}){const i=wa(r),s=(n?Math.sin(i):Math.cos(i))||.001,o=.75*e*(""+t).length;return Math.min(e/s,o)}class E4 extends Jd{constructor(e){super(e),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(e,n){return ln(e)||(typeof e=="number"||e instanceof Number)&&!isFinite(+e)?null:+e}handleTickRangeOptions(){const{beginAtZero:e}=this.options,{minDefined:n,maxDefined:r}=this.getUserBounds();let{min:i,max:s}=this;const o=l=>i=n?i:l,a=l=>s=r?s:l;if(e){const l=kl(i),c=kl(s);l<0&&c<0?a(0):l>0&&c>0&&o(0)}if(i===s){let l=s===0?1:Math.abs(s*.05);a(s+l),e||o(i-l)}this.min=i,this.max=s}getTickLimit(){const e=this.options.ticks;let{maxTicksLimit:n,stepSize:r}=e,i;return r?(i=Math.ceil(this.max/r)-Math.floor(this.min/r)+1,i>1e3&&(console.warn(`scales.${this.id}.ticks.stepSize: ${r} would result generating up to ${i} ticks. Limiting to 1000.`),i=1e3)):(i=this.computeTickLimit(),n=n||11),n&&(i=Math.min(n,i)),i}computeTickLimit(){return Number.POSITIVE_INFINITY}buildTicks(){const e=this.options,n=e.ticks;let r=this.getTickLimit();r=Math.max(2,r);const i={maxTicks:r,bounds:e.bounds,min:e.min,max:e.max,precision:n.precision,step:n.stepSize,count:n.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:n.minRotation||0,includeBounds:n.includeBounds!==!1},s=this._range||this,o=Qgt(i,s);return e.bounds==="ticks"&&g0e(o,this,"value"),e.reverse?(o.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),o}configure(){const e=this.ticks;let n=this.min,r=this.max;if(super.configure(),this.options.offset&&e.length){const i=(r-n)/Math.max(e.length-1,1)/2;n-=i,r+=i}this._startValue=n,this._endValue=r,this._valueRange=r-n}getLabelForValue(e){return ab(e,this.chart.options.locale,this.options.ticks.format)}}class ZA extends E4{determineDataLimits(){const{min:e,max:n}=this.getMinMax(!0);this.min=wr(e)?e:0,this.max=wr(n)?n:1,this.handleTickRangeOptions()}computeTickLimit(){const e=this.isHorizontal(),n=e?this.width:this.height,r=wa(this.options.ticks.minRotation),i=(e?Math.sin(r):Math.cos(r))||.001,s=this._resolveTickFontOptions(0);return Math.ceil(n/Math.min(40,s.lineHeight/i))}getPixelForValue(e){return e===null?NaN:this.getPixelForDecimal((e-this._startValue)/this._valueRange)}getValueForPixel(e){return this._startValue+this.getDecimalForPixel(e)*this._valueRange}}Le(ZA,"id","linear"),Le(ZA,"defaults",{ticks:{callback:ok.formatters.numeric}});const HO=t=>Math.floor(Yu(t)),vh=(t,e)=>Math.pow(10,HO(t)+e);function qH(t){return t/Math.pow(10,HO(t))===1}function XH(t,e,n){const r=Math.pow(10,n),i=Math.floor(t/r);return Math.ceil(e/r)-i}function jgt(t,e){const n=e-t;let r=HO(n);for(;XH(t,e,r)>10;)r++;for(;XH(t,e,r)<10;)r--;return Math.min(r,HO(t))}function Bgt(t,{min:e,max:n}){e=Ks(t.min,e);const r=[],i=HO(e);let s=jgt(e,n),o=s<0?Math.pow(10,Math.abs(s)):1;const a=Math.pow(10,s),l=i>s?Math.pow(10,i):0,c=Math.round((e-l)*o)/o,u=Math.floor((e-l)/a/10)*a*10;let f=Math.floor((c-u)/Math.pow(10,s)),h=Ks(t.min,Math.round((l+u+f*Math.pow(10,s))*o)/o);for(;h<n;)r.push({value:h,major:qH(h),significand:f}),f>=10?f=f<15?15:20:f++,f>=20&&(s++,f=2,o=s>=0?1:o),h=Math.round((l+u+f*Math.pow(10,s))*o)/o;const d=Ks(t.max,h);return r.push({value:d,major:qH(d),significand:f}),r}class YA extends Jd{constructor(e){super(e),this.start=void 0,this.end=void 0,this._startValue=void 0,this._valueRange=0}parse(e,n){const r=E4.prototype.parse.apply(this,[e,n]);if(r===0){this._zero=!0;return}return wr(r)&&r>0?r:null}determineDataLimits(){const{min:e,max:n}=this.getMinMax(!0);this.min=wr(e)?Math.max(0,e):null,this.max=wr(n)?Math.max(0,n):null,this.options.beginAtZero&&(this._zero=!0),this._zero&&this.min!==this._suggestedMin&&!wr(this._userMin)&&(this.min=e===vh(this.min,0)?vh(this.min,-1):vh(this.min,0)),this.handleTickRangeOptions()}handleTickRangeOptions(){const{minDefined:e,maxDefined:n}=this.getUserBounds();let r=this.min,i=this.max;const s=a=>r=e?r:a,o=a=>i=n?i:a;r===i&&(r<=0?(s(1),o(10)):(s(vh(r,-1)),o(vh(i,1)))),r<=0&&s(vh(i,-1)),i<=0&&o(vh(r,1)),this.min=r,this.max=i}buildTicks(){const e=this.options,n={min:this._userMin,max:this._userMax},r=Bgt(n,this);return e.bounds==="ticks"&&g0e(r,this,"value"),e.reverse?(r.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),r}getLabelForValue(e){return e===void 0?"0":ab(e,this.chart.options.locale,this.options.ticks.format)}configure(){const e=this.min;super.configure(),this._startValue=Yu(e),this._valueRange=Yu(this.max)-Yu(e)}getPixelForValue(e){return(e===void 0||e===0)&&(e=this.min),e===null||isNaN(e)?NaN:this.getPixelForDecimal(e===this.min?0:(Yu(e)-this._startValue)/this._valueRange)}getValueForPixel(e){const n=this.getDecimalForPixel(e);return Math.pow(10,this._startValue+n*this._valueRange)}}Le(YA,"id","logarithmic"),Le(YA,"defaults",{ticks:{callback:ok.formatters.logarithmic,major:{enabled:!0}}});function GA(t){const e=t.ticks;if(e.display&&t.display){const n=Ui(e.backdropPadding);return Mt(e.font&&e.font.size,rr.font.size)+n.height}return 0}function zgt(t,e,n){return n=Xn(n)?n:[n],{w:Zdt(t,e.string,n),h:n.length*e.lineHeight}}function HH(t,e,n,r,i){return t===r||t===i?{start:e-n/2,end:e+n/2}:t<r||t>i?{start:e-n,end:e}:{start:e,end:e+n}}function Fgt(t){const e={l:t.left+t._padding.left,r:t.right-t._padding.right,t:t.top+t._padding.top,b:t.bottom-t._padding.bottom},n=Object.assign({},e),r=[],i=[],s=t._pointLabels.length,o=t.options.pointLabels,a=o.centerPointLabels?Gn/s:0;for(let l=0;l<s;l++){const c=o.setContext(t.getPointLabelContext(l));i[l]=c.padding;const u=t.getPointPosition(l,t.drawingArea+i[l],a),f=ei(c.font),h=zgt(t.ctx,f,t._pointLabels[l]);r[l]=h;const d=to(t.getIndexAngle(l)+a),p=Math.round(sL(d)),g=HH(p,u.x,h.w,0,180),m=HH(p,u.y,h.h,90,270);Wgt(n,e,d,g,m)}t.setCenterPoint(e.l-n.l,n.r-e.r,e.t-n.t,n.b-e.b),t._pointLabelItems=qgt(t,r,i)}function Wgt(t,e,n,r,i){const s=Math.abs(Math.sin(n)),o=Math.abs(Math.cos(n));let a=0,l=0;r.start<e.l?(a=(e.l-r.start)/s,t.l=Math.min(t.l,e.l-a)):r.end>e.r&&(a=(r.end-e.r)/s,t.r=Math.max(t.r,e.r+a)),i.start<e.t?(l=(e.t-i.start)/o,t.t=Math.min(t.t,e.t-l)):i.end>e.b&&(l=(i.end-e.b)/o,t.b=Math.max(t.b,e.b+l))}function Vgt(t,e,n){const r=t.drawingArea,{extra:i,additionalAngle:s,padding:o,size:a}=n,l=t.getPointPosition(e,r+i+o,s),c=Math.round(sL(to(l.angle+Mr))),u=Zgt(l.y,a.h,c),f=Xgt(c),h=Hgt(l.x,a.w,f);return{visible:!0,x:l.x,y:u,textAlign:f,left:h,top:u,right:h+a.w,bottom:u+a.h}}function Ugt(t,e){if(!e)return!0;const{left:n,top:r,right:i,bottom:s}=t;return!($c({x:n,y:r},e)||$c({x:n,y:s},e)||$c({x:i,y:r},e)||$c({x:i,y:s},e))}function qgt(t,e,n){const r=[],i=t._pointLabels.length,s=t.options,{centerPointLabels:o,display:a}=s.pointLabels,l={extra:GA(s)/2,additionalAngle:o?Gn/i:0};let c;for(let u=0;u<i;u++){l.padding=n[u],l.size=e[u];const f=Vgt(t,u,l);r.push(f),a==="auto"&&(f.visible=Ugt(f,c),f.visible&&(c=f))}return r}function Xgt(t){return t===0||t===180?"center":t<180?"left":"right"}function Hgt(t,e,n){return n==="right"?t-=e:n==="center"&&(t-=e/2),t}function Zgt(t,e,n){return n===90||n===270?t-=e/2:(n>270||n<90)&&(t-=e),t}function Ygt(t,e,n){const{left:r,top:i,right:s,bottom:o}=n,{backdropColor:a}=e;if(!ln(a)){const l=id(e.borderRadius),c=Ui(e.backdropPadding);t.fillStyle=a;const u=r-c.left,f=i-c.top,h=s-r+c.width,d=o-i+c.height;Object.values(l).some(p=>p!==0)?(t.beginPath(),qO(t,{x:u,y:f,w:h,h:d,radius:l}),t.fill()):t.fillRect(u,f,h,d)}}function Ggt(t,e){const{ctx:n,options:{pointLabels:r}}=t;for(let i=e-1;i>=0;i--){const s=t._pointLabelItems[i];if(!s.visible)continue;const o=r.setContext(t.getPointLabelContext(i));Ygt(n,o,s);const a=ei(o.font),{x:l,y:c,textAlign:u}=s;Ed(n,t._pointLabels[i],l,c+a.lineHeight/2,a,{color:o.color,textAlign:u,textBaseline:"middle"})}}function ope(t,e,n,r){const{ctx:i}=t;if(n)i.arc(t.xCenter,t.yCenter,e,0,Yn);else{let s=t.getPointPosition(0,e);i.moveTo(s.x,s.y);for(let o=1;o<r;o++)s=t.getPointPosition(o,e),i.lineTo(s.x,s.y)}}function Kgt(t,e,n,r,i){const s=t.ctx,o=e.circular,{color:a,lineWidth:l}=e;!o&&!r||!a||!l||n<0||(s.save(),s.strokeStyle=a,s.lineWidth=l,s.setLineDash(i.dash||[]),s.lineDashOffset=i.dashOffset,s.beginPath(),ope(t,n,o,r),s.closePath(),s.stroke(),s.restore())}function Jgt(t,e,n){return Kf(t,{label:n,index:e,type:"pointLabel"})}class Q1 extends E4{constructor(e){super(e),this.xCenter=void 0,this.yCenter=void 0,this.drawingArea=void 0,this._pointLabels=[],this._pointLabelItems=[]}setDimensions(){const e=this._padding=Ui(GA(this.options)/2),n=this.width=this.maxWidth-e.width,r=this.height=this.maxHeight-e.height;this.xCenter=Math.floor(this.left+n/2+e.left),this.yCenter=Math.floor(this.top+r/2+e.top),this.drawingArea=Math.floor(Math.min(n,r)/2)}determineDataLimits(){const{min:e,max:n}=this.getMinMax(!1);this.min=wr(e)&&!isNaN(e)?e:0,this.max=wr(n)&&!isNaN(n)?n:0,this.handleTickRangeOptions()}computeTickLimit(){return Math.ceil(this.drawingArea/GA(this.options))}generateTickLabels(e){E4.prototype.generateTickLabels.call(this,e),this._pointLabels=this.getLabels().map((n,r)=>{const i=jn(this.options.pointLabels.callback,[n,r],this);return i||i===0?i:""}).filter((n,r)=>this.chart.getDataVisibility(r))}fit(){const e=this.options;e.display&&e.pointLabels.display?Fgt(this):this.setCenterPoint(0,0,0,0)}setCenterPoint(e,n,r,i){this.xCenter+=Math.floor((e-n)/2),this.yCenter+=Math.floor((r-i)/2),this.drawingArea-=Math.min(this.drawingArea/2,Math.max(e,n,r,i))}getIndexAngle(e){const n=Yn/(this._pointLabels.length||1),r=this.options.startAngle||0;return to(e*n+wa(r))}getDistanceFromCenterForValue(e){if(ln(e))return NaN;const n=this.drawingArea/(this.max-this.min);return this.options.reverse?(this.max-e)*n:(e-this.min)*n}getValueForDistanceFromCenter(e){if(ln(e))return NaN;const n=e/(this.drawingArea/(this.max-this.min));return this.options.reverse?this.max-n:this.min+n}getPointLabelContext(e){const n=this._pointLabels||[];if(e>=0&&e<n.length){const r=n[e];return Jgt(this.getContext(),e,r)}}getPointPosition(e,n,r=0){const i=this.getIndexAngle(e)-Mr+r;return{x:Math.cos(i)*n+this.xCenter,y:Math.sin(i)*n+this.yCenter,angle:i}}getPointPositionForValue(e,n){return this.getPointPosition(e,this.getDistanceFromCenterForValue(n))}getBasePosition(e){return this.getPointPositionForValue(e||0,this.getBaseValue())}getPointLabelPosition(e){const{left:n,top:r,right:i,bottom:s}=this._pointLabelItems[e];return{left:n,top:r,right:i,bottom:s}}drawBackground(){const{backgroundColor:e,grid:{circular:n}}=this.options;if(e){const r=this.ctx;r.save(),r.beginPath(),ope(this,this.getDistanceFromCenterForValue(this._endValue),n,this._pointLabels.length),r.closePath(),r.fillStyle=e,r.fill(),r.restore()}}drawGrid(){const e=this.ctx,n=this.options,{angleLines:r,grid:i,border:s}=n,o=this._pointLabels.length;let a,l,c;if(n.pointLabels.display&&Ggt(this,o),i.display&&this.ticks.forEach((u,f)=>{if(f!==0||f===0&&this.min<0){l=this.getDistanceFromCenterForValue(u.value);const h=this.getContext(f),d=i.setContext(h),p=s.setContext(h);Kgt(this,d,l,o,p)}}),r.display){for(e.save(),a=o-1;a>=0;a--){const u=r.setContext(this.getPointLabelContext(a)),{color:f,lineWidth:h}=u;!h||!f||(e.lineWidth=h,e.strokeStyle=f,e.setLineDash(u.borderDash),e.lineDashOffset=u.borderDashOffset,l=this.getDistanceFromCenterForValue(n.reverse?this.min:this.max),c=this.getPointPosition(a,l),e.beginPath(),e.moveTo(this.xCenter,this.yCenter),e.lineTo(c.x,c.y),e.stroke())}e.restore()}}drawBorder(){}drawLabels(){const e=this.ctx,n=this.options,r=n.ticks;if(!r.display)return;const i=this.getIndexAngle(0);let s,o;e.save(),e.translate(this.xCenter,this.yCenter),e.rotate(i),e.textAlign="center",e.textBaseline="middle",this.ticks.forEach((a,l)=>{if(l===0&&this.min>=0&&!n.reverse)return;const c=r.setContext(this.getContext(l)),u=ei(c.font);if(s=this.getDistanceFromCenterForValue(this.ticks[l].value),c.showLabelBackdrop){e.font=u.string,o=e.measureText(a.label).width,e.fillStyle=c.backdropColor;const f=Ui(c.backdropPadding);e.fillRect(-o/2-f.left,-s-u.size/2-f.top,o+f.width,u.size+f.height)}Ed(e,a.label,0,-s,u,{color:c.color,strokeColor:c.textStrokeColor,strokeWidth:c.textStrokeWidth})}),e.restore()}drawTitle(){}}Le(Q1,"id","radialLinear"),Le(Q1,"defaults",{display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,lineWidth:1,borderDash:[],borderDashOffset:0},grid:{circular:!1},startAngle:0,ticks:{showLabelBackdrop:!0,callback:ok.formatters.numeric},pointLabels:{backdropColor:void 0,backdropPadding:2,display:!0,font:{size:10},callback(e){return e},padding:5,centerPointLabels:!1}}),Le(Q1,"defaultRoutes",{"angleLines.color":"borderColor","pointLabels.color":"color","ticks.color":"color"}),Le(Q1,"descriptors",{angleLines:{_fallback:"grid"}});const uk={millisecond:{common:!0,size:1,steps:1e3},second:{common:!0,size:1e3,steps:60},minute:{common:!0,size:6e4,steps:60},hour:{common:!0,size:36e5,steps:24},day:{common:!0,size:864e5,steps:30},week:{common:!1,size:6048e5,steps:4},month:{common:!0,size:2628e6,steps:12},quarter:{common:!1,size:7884e6,steps:4},year:{common:!0,size:3154e7}},As=Object.keys(uk);function ZH(t,e){return t-e}function YH(t,e){if(ln(e))return null;const n=t._adapter,{parser:r,round:i,isoWeekday:s}=t._parseOpts;let o=e;return typeof r=="function"&&(o=r(o)),wr(o)||(o=typeof r=="string"?n.parse(o,r):n.parse(o)),o===null?null:(i&&(o=i==="week"&&(_m(s)||s===!0)?n.startOf(o,"isoWeek",s):n.startOf(o,i)),+o)}function GH(t,e,n,r){const i=As.length;for(let s=As.indexOf(t);s<i-1;++s){const o=uk[As[s]],a=o.steps?o.steps:Number.MAX_SAFE_INTEGER;if(o.common&&Math.ceil((n-e)/(a*o.size))<=r)return As[s]}return As[i-1]}function e1t(t,e,n,r,i){for(let s=As.length-1;s>=As.indexOf(n);s--){const o=As[s];if(uk[o].common&&t._adapter.diff(i,r,o)>=e-1)return o}return As[n?As.indexOf(n):0]}function t1t(t){for(let e=As.indexOf(t)+1,n=As.length;e<n;++e)if(uk[As[e]].common)return As[e]}function KH(t,e,n){if(!n)t[e]=!0;else if(n.length){const{lo:r,hi:i}=oL(n,e),s=n[r]>=e?n[r]:n[i];t[s]=!0}}function n1t(t,e,n,r){const i=t._adapter,s=+i.startOf(e[0].value,r),o=e[e.length-1].value;let a,l;for(a=s;a<=o;a=+i.add(a,1,r))l=n[a],l>=0&&(e[l].major=!0);return e}function JH(t,e,n){const r=[],i={},s=e.length;let o,a;for(o=0;o<s;++o)a=e[o],i[a]=o,r.push({value:a,major:!1});return s===0||!n?r:n1t(t,r,i,n)}class ZO extends Jd{constructor(e){super(e),this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(e,n={}){const r=e.time||(e.time={}),i=this._adapter=new fpt._date(e.adapters.date);i.init(n),vv(r.displayFormats,i.formats()),this._parseOpts={parser:r.parser,round:r.round,isoWeekday:r.isoWeekday},super.init(e),this._normalized=n.normalized}parse(e,n){return e===void 0?null:YH(this,e)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){const e=this.options,n=this._adapter,r=e.time.unit||"day";let{min:i,max:s,minDefined:o,maxDefined:a}=this.getUserBounds();function l(c){!o&&!isNaN(c.min)&&(i=Math.min(i,c.min)),!a&&!isNaN(c.max)&&(s=Math.max(s,c.max))}(!o||!a)&&(l(this._getLabelBounds()),(e.bounds!=="ticks"||e.ticks.source!=="labels")&&l(this.getMinMax(!1))),i=wr(i)&&!isNaN(i)?i:+n.startOf(Date.now(),r),s=wr(s)&&!isNaN(s)?s:+n.endOf(Date.now(),r)+1,this.min=Math.min(i,s-1),this.max=Math.max(i+1,s)}_getLabelBounds(){const e=this.getLabelTimestamps();let n=Number.POSITIVE_INFINITY,r=Number.NEGATIVE_INFINITY;return e.length&&(n=e[0],r=e[e.length-1]),{min:n,max:r}}buildTicks(){const e=this.options,n=e.time,r=e.ticks,i=r.source==="labels"?this.getLabelTimestamps():this._generate();e.bounds==="ticks"&&i.length&&(this.min=this._userMin||i[0],this.max=this._userMax||i[i.length-1]);const s=this.min,o=this.max,a=Ldt(i,s,o);return this._unit=n.unit||(r.autoSkip?GH(n.minUnit,this.min,this.max,this._getLabelCapacity(s)):e1t(this,a.length,n.minUnit,this.min,this.max)),this._majorUnit=!r.major.enabled||this._unit==="year"?void 0:t1t(this._unit),this.initOffsets(i),e.reverse&&a.reverse(),JH(this,a,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map(e=>+e.value))}initOffsets(e=[]){let n=0,r=0,i,s;this.options.offset&&e.length&&(i=this.getDecimalForValue(e[0]),e.length===1?n=1-i:n=(this.getDecimalForValue(e[1])-i)/2,s=this.getDecimalForValue(e[e.length-1]),e.length===1?r=s:r=(s-this.getDecimalForValue(e[e.length-2]))/2);const o=e.length<3?.5:.25;n=ui(n,0,o),r=ui(r,0,o),this._offsets={start:n,end:r,factor:1/(n+1+r)}}_generate(){const e=this._adapter,n=this.min,r=this.max,i=this.options,s=i.time,o=s.unit||GH(s.minUnit,n,r,this._getLabelCapacity(n)),a=Mt(i.ticks.stepSize,1),l=o==="week"?s.isoWeekday:!1,c=_m(l)||l===!0,u={};let f=n,h,d;if(c&&(f=+e.startOf(f,"isoWeek",l)),f=+e.startOf(f,c?"day":o),e.diff(r,n,o)>1e5*a)throw new Error(n+" and "+r+" are too far apart with stepSize of "+a+" "+o);const p=i.ticks.source==="data"&&this.getDataTimestamps();for(h=f,d=0;h<r;h=+e.add(h,a,o),d++)KH(u,h,p);return(h===r||i.bounds==="ticks"||d===1)&&KH(u,h,p),Object.keys(u).sort(ZH).map(g=>+g)}getLabelForValue(e){const n=this._adapter,r=this.options.time;return r.tooltipFormat?n.format(e,r.tooltipFormat):n.format(e,r.displayFormats.datetime)}format(e,n){const i=this.options.time.displayFormats,s=this._unit,o=n||i[s];return this._adapter.format(e,o)}_tickFormatFunction(e,n,r,i){const s=this.options,o=s.ticks.callback;if(o)return jn(o,[e,n,r],this);const a=s.time.displayFormats,l=this._unit,c=this._majorUnit,u=l&&a[l],f=c&&a[c],h=r[n],d=c&&f&&h&&h.major;return this._adapter.format(e,i||(d?f:u))}generateTickLabels(e){let n,r,i;for(n=0,r=e.length;n<r;++n)i=e[n],i.label=this._tickFormatFunction(i.value,n,e)}getDecimalForValue(e){return e===null?NaN:(e-this.min)/(this.max-this.min)}getPixelForValue(e){const n=this._offsets,r=this.getDecimalForValue(e);return this.getPixelForDecimal((n.start+r)*n.factor)}getValueForPixel(e){const n=this._offsets,r=this.getDecimalForPixel(e)/n.factor-n.end;return this.min+r*(this.max-this.min)}_getLabelSize(e){const n=this.options.ticks,r=this.ctx.measureText(e).width,i=wa(this.isHorizontal()?n.maxRotation:n.minRotation),s=Math.cos(i),o=Math.sin(i),a=this._resolveTickFontOptions(0).size;return{w:r*s+a*o,h:r*o+a*s}}_getLabelCapacity(e){const n=this.options.time,r=n.displayFormats,i=r[n.unit]||r.millisecond,s=this._tickFormatFunction(e,0,JH(this,[e],this._majorUnit),i),o=this._getLabelSize(s),a=Math.floor(this.isHorizontal()?this.width/o.w:this.height/o.h)-1;return a>0?a:1}getDataTimestamps(){let e=this._cache.data||[],n,r;if(e.length)return e;const i=this.getMatchingVisibleMetas();if(this._normalized&&i.length)return this._cache.data=i[0].controller.getAllParsedValues(this);for(n=0,r=i.length;n<r;++n)e=e.concat(i[n].controller.getAllParsedValues(this));return this._cache.data=this.normalize(e)}getLabelTimestamps(){const e=this._cache.labels||[];let n,r;if(e.length)return e;const i=this.getLabels();for(n=0,r=i.length;n<r;++n)e.push(YH(this,i[n]));return this._cache.labels=this._normalized?e:this.normalize(e)}normalize(e){return y0e(e.sort(ZH))}}Le(ZO,"id","time"),Le(ZO,"defaults",{bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",callback:!1,major:{enabled:!1}}});function Uw(t,e,n){let r=0,i=t.length-1,s,o,a,l;n?(e>=t[r].pos&&e<=t[i].pos&&({lo:r,hi:i}=Rc(t,"pos",e)),{pos:s,time:a}=t[r],{pos:o,time:l}=t[i]):(e>=t[r].time&&e<=t[i].time&&({lo:r,hi:i}=Rc(t,"time",e)),{time:s,pos:a}=t[r],{time:o,pos:l}=t[i]);const c=o-s;return c?a+(l-a)*(e-s)/c:a}class KA extends ZO{constructor(e){super(e),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const e=this._getTimestampsForTable(),n=this._table=this.buildLookupTable(e);this._minPos=Uw(n,this.min),this._tableRange=Uw(n,this.max)-this._minPos,super.initOffsets(e)}buildLookupTable(e){const{min:n,max:r}=this,i=[],s=[];let o,a,l,c,u;for(o=0,a=e.length;o<a;++o)c=e[o],c>=n&&c<=r&&i.push(c);if(i.length<2)return[{time:n,pos:0},{time:r,pos:1}];for(o=0,a=i.length;o<a;++o)u=i[o+1],l=i[o-1],c=i[o],Math.round((u+l)/2)!==c&&s.push({time:c,pos:o/(a-1)});return s}_generate(){const e=this.min,n=this.max;let r=super.getDataTimestamps();return(!r.includes(e)||!r.length)&&r.splice(0,0,e),(!r.includes(n)||r.length===1)&&r.push(n),r.sort((i,s)=>i-s)}_getTimestampsForTable(){let e=this._cache.all||[];if(e.length)return e;const n=this.getDataTimestamps(),r=this.getLabelTimestamps();return n.length&&r.length?e=this.normalize(n.concat(r)):e=n.length?n:r,e=this._cache.all=e,e}getDecimalForValue(e){return(Uw(this._table,e)-this._minPos)/this._tableRange}getValueForPixel(e){const n=this._offsets,r=this.getDecimalForPixel(e)/n.factor-n.end;return Uw(this._table,r*this._tableRange+this._minPos,!0)}}Le(KA,"id","timeseries"),Le(KA,"defaults",ZO.defaults);var r1t=Object.freeze({__proto__:null,CategoryScale:HA,LinearScale:ZA,LogarithmicScale:YA,RadialLinearScale:Q1,TimeScale:ZO,TimeSeriesScale:KA});const i1t=[upt,Bmt,Igt,r1t];ll.register(...i1t);OL.positioners.lineChartTooltipMousePosition=function(t,e){return{x:e.x,y:e.y}};function s1t(){return{type:"line",data:{datasets:[]},plugins:[a1t],options:{spanGaps:!0,plugins:{tooltip:{mode:"index",intersect:!1,position:"lineChartTooltipMousePosition",callbacks:{title:t=>`X: ${t[0].label}`,label:t=>`${t.dataset.label||""}: ${t.formattedValue}`}}}}}}function o1t({chartRef:t,artifacts:e,datasetHidden:n,darkMode:r,chartSettings:i}){const s=[],o=S$(e,"line");let a=null;for(const[l,c]of Object.entries(o)){if(l===i.xAxisColumn){a=c;continue}s.push({label:l,data:c,yAxisID:i.secondYAxisColumns.includes(l)?"y2":"y1",hidden:n[l]})}if(s.length>0&&!a){const l=s[0].data.length;a=[...Array(l).keys()]}return t.current.verticalLinePlugin.color=r?"white":"black",{labels:a,datasets:s}}const a1t={id:"verticalLinePlugin",afterInit:t=>{t.verticalLinePlugin={x:0,y:0,draw:!1,width:1,color:"black",dash:[3,3]}},afterEvent:(t,e)=>{const{inChartArea:n}=e,{x:r,y:i}=e.event;if(n){const s=t.scales.x,o=t.data.labels,a=s.getValueForPixel(r);let l=o[0],c=Math.abs(a-o[0]);for(const f of o){const h=Math.abs(a-f);h<c&&(c=h,l=f)}const u=s.getPixelForValue(l);t.verticalLinePlugin={...t.verticalLinePlugin,x:u,y:i,draw:!0}}else t.verticalLinePlugin={...t.verticalLinePlugin,x:r,y:i,draw:!1};t.draw()},beforeDatasetsDraw:t=>{const{ctx:e}=t,{top:n,bottom:r}=t.chartArea,{x:i,draw:s,width:o,color:a,dash:l}=t.verticalLinePlugin;s&&(e.save(),e.beginPath(),e.lineWidth=o,e.strokeStyle=a,e.setLineDash(l),e.moveTo(i,r),e.lineTo(i,n),e.stroke(),e.restore())}};OL.positioners.scatterChartTooltipMousePosition=function(t,e){return e?{x:e.x,y:e.y}:!1};function l1t(){return{type:"scatter",plugins:[u1t],options:{plugins:{tooltip:{enabled:!0,mode:"nearest",intersect:!1,position:"scatterChartTooltipMousePosition",callbacks:{title:t=>{const e=t[0];return`(${e.parsed.x.toFixed(2)}, ${e.parsed.y.toFixed(2)})`},label:t=>t.dataset.label||""}}}}}}function c1t({chartRef:t,artifacts:e,datasetHidden:n,darkMode:r,chartSettings:i}){var d;const s=S$(e,"scatter");let o="No Category";const a=(d=Object.values(s)[0])==null?void 0:d.length;if(!a)return{datasets:[]};const l=i.categoryColumn;let c=Object.keys(s)[0];i.xAxisColumn&&(c=i.xAxisColumn);const u=Object.keys(s).find(p=>![l,c].includes(p));if(!u)return{datasets:[]};const f={};for(let p=0;p<a;p++)l&&(o=s[l][p]),o in f||(f[o]=[]),f[o].push({x:s[c][p],y:s[u][p],columnName:u});const h=Object.entries(f).map(([p,g])=>{var m;return{label:p,data:g,yAxisID:i.secondYAxisColumns.includes((m=g[0])==null?void 0:m.columnName)?"y2":"y1",hidden:n[p],pointRadius:4,pointHoverRadius:6}});return t.current.crosshairPlugin.color=r?"white":"black",{datasets:h}}const u1t={id:"crosshairPlugin",afterInit:t=>{t.crosshairPlugin={x:0,y:0,xValue:0,yValue:0,draw:!1,width:1,color:"black",dash:[3,3]}},afterEvent:(t,e)=>{const{inChartArea:n}=e,{x:r,y:i}=e.event;if(n){let s=1/0,o=null;if(t.data.datasets.forEach((a,l)=>{a.hidden||a.data.forEach((c,u)=>{const f=t.scales.x.getPixelForValue(c.x),h=t.scales[a.yAxisID].getPixelForValue(c.y),d=Math.sqrt(Math.pow(r-f,2)+Math.pow(i-h,2));d<s&&(s=d,o={x:f,y:h,xValue:c.x,yValue:c.y,datasetIndex:l,pointIndex:u})})}),o){t.crosshairPlugin={...t.crosshairPlugin,x:o.x,y:o.y,xValue:o.xValue,yValue:o.yValue,draw:!0};const a=[{datasetIndex:o.datasetIndex,index:o.pointIndex}];t.tooltip.setActiveElements(a),t.tooltip.update()}}else t.crosshairPlugin={...t.crosshairPlugin,x:r,y:i,draw:!1},t.tooltip.setActiveElements([],{x:r,y:i});t.draw()},beforeDatasetsDraw:t=>{const{ctx:e}=t,{x:n,y:r,draw:i,width:s,color:o,dash:a}=t.crosshairPlugin,{top:l,bottom:c,left:u,right:f}=t.chartArea;i&&(e.save(),e.beginPath(),e.lineWidth=s,e.strokeStyle=o,e.setLineDash(a),e.moveTo(n,c),e.lineTo(n,l),e.stroke(),e.beginPath(),e.moveTo(u,r),e.lineTo(f,r),e.stroke(),e.beginPath(),e.arc(n,r,4,0,2*Math.PI),e.fillStyle=o,e.fill(),e.restore())}};function f1t({sectionId:t}){const{getRootProps:e,isDragActive:n}=gD(t,!1,"list");return x.jsx("figure",{className:`section-w-full section-row-main single-cell-container flex h-auto w-full max-w-full items-center justify-items-center overflow-clip ${n?"outline outline-4 outline-green-500 dark:outline-green-500/80":""}`,...e(),children:x.jsx(d1t,{sectionId:t})})}function h1t({sectionId:t}){const e=Afe(t,c=>ae.pick(c,["name","value"])),[n]=Ot.darkMode.hook(),r=te(c=>c.x[t].size,ae.isEqual),i=te(c=>c.x[t].chartSettings,ae.isEqual),s=_.useRef(),o=_.useRef(null),[a,l]=_.useState({});return _.useEffect(()=>{const c=m1t(i.type);o.current=new ll(s.current,ae.merge({data:{datasets:[]},options:{animation:!1,responsive:!1,maintainAspectRatio:!1,scales:{x:{type:"linear",position:"bottom"},y1:{type:"linear",position:"left"},y2:{type:"linear",position:"right",grid:{drawOnChartArea:!1}}},plugins:{legend:{onClick:(f,h,d)=>{l(p=>({...p,[h.text]:!p[h.text]})),ll.defaults.plugins.legend.onClick(f,h,d)}}}}},c())),o.current.resize(r.width-25,r.height-50);const u=Lne(t,s);return()=>{o.current&&(o.current.destroy(),o.current=null),u()}},[i.type]),zy(()=>{var d;const c=Object.values(e);if(!o.current)return;const f=g1t(i.type)({chartRef:o,artifacts:c,datasetHidden:a,darkMode:n,chartSettings:i});o.current.data=f;const h=o.current.options.scales;h.x.type=cE(i.xAxisLog,(d=f.labels)==null?void 0:d[0]),h.y1.type=cE(i.y1AxisLog),h.y2.type=cE(i.y2AxisLog),h.y2.display=i.secondYAxisColumns.length>0,o.current.resize(r.width-25,r.height-50),o.current.update()},[e,r,a,n,i]),x.jsx("canvas",{ref:s})}const d1t=ke.memo(h1t),p1t=ke.memo(f1t);function m1t(t){switch(t){case"line":return s1t;case"scatter":return l1t}}function g1t(t){switch(t){case"line":return o1t;case"scatter":return c1t}}function cE(t,e){return typeof e=="string"?"category":t?"logarithmic":"linear"}const op=16;function v1t({draftCanvasRef:t,color:e,brushSize:n,brushShape:r,brushOpacity:i,layerOpacity:s}){const o=Of(t.current);o.globalCompositeOperation="source-over",o.strokeStyle=S1t(e,i),o.lineWidth=n,o.lineCap=r,o.globalAlpha=s}function O1t(t,e,n){const r=Of(t.current),{globalCompositeOperation:i,strokeStyle:s,lineWidth:o,lineCap:a,globalAlpha:l}=r;t.current.width=e,t.current.height=n,r.globalCompositeOperation=i,r.strokeStyle=s,r.lineWidth=o,r.lineCap=a,r.globalAlpha=l}function y1t({sectionId:t,canvasRef:e,tempCanvasRefs:n,draftCanvasRef:r,height:i,width:s,artifactIdUsedToSetCanvasSize:o,state:a}){const l=te.getState(),c=ti.getState().x;let u=tZ(c[o]),f=!1;if(!u)for(const d of l.x[t].artifactGroupIds){const p=l.artifactGroups[d];for(const g of p.artifactTransforms){const m=g.artifactId;if(!(m in c))continue;const v=c[m];if(u=tZ(v),u){a.x[t].canvasSettings.artifactIdUsedToSetCanvasSize=m,f=!0;break}}if(u)break}const h=Oht({sectionId:t,imgSize:u,isNewImg:f,sectionHeight:i,sectionWidth:s,state:a});e.current.width=h.width,e.current.height=h.height;for(const d of Object.values(n.current))d.width=h.width,d.height=h.height;O1t(r,h.width,h.height)}function ape(t){const{offsetX:e,offsetY:n}=t.nativeEvent;return[e,n]}function p2(t){Of(t).clearRect(0,0,t.width,t.height)}function Of(t){return t.getContext("2d")}function yL(t,e,n,r,i,s,o=!0){ti.setState(a=>({x:{...a.x,[e]:{...a.x[e],value:ae.cloneDeep(n.current)}}})),Lf(t,r,i),p2(s.current),hn(o)}function b1t(t,e,n,r,i,s){te.setState(o=>{for(const[a,l]of o.artifactGroups[e].artifactTransforms.entries()){const{transform:c,eraserStrokes:u}=n.current[a];l.transform=ae.cloneDeep(c),l.eraserStrokes=ae.cloneDeep(u)}}),Lf(t,i,s,{},{},{[e]:r.current}),hn(!0)}function Lf(t,e,n,r={},i={},s={},o={}){var p,g,m,v;const a=Of(e.current),l=n.current.layer,c=Of(n.current.layer),u=n.current.artifact,f=Of(n.current.artifact);p2(e.current);const h=te.getState(),d=ti.getState().x;for(const y of h.x[t].artifactGroupIds){const b=h.artifactGroups[y];if(!b.visible)continue;const{layerOpacity:S}=b;for(const[k,E]of b.artifactTransforms.entries()){const T=E.artifactId;if(!(T in d))return;const C=d[T];if(f.globalAlpha=1,f.globalCompositeOperation="source-over",C.type==="img"&&C.value instanceof Image&&C.value.complete){const A=((p=r[y])==null?void 0:p[T])??C.value,R=((g=i[y])==null?void 0:g[k])??E;f.setTransform(...R.transform),f.drawImage(A,0,0,A.width,A.height),uE(f,R.eraserStrokes,R.transform)}else if(C.type==="brushStrokes"&&C.value.length>0){const A=((m=r[y])==null?void 0:m[T])??C.value,R=((v=i[y])==null?void 0:v[k])??E;uE(f,A,R.transform,R.eraserStrokes)}f.resetTransform(),c.globalAlpha=1,c.globalCompositeOperation="source-over",c.drawImage(u,0,0),p2(n.current.artifact)}o[y]&&uE(c,o[y]),a.globalCompositeOperation="source-over",a.globalAlpha=S,a.drawImage(l,0,0),s[y]&&w1t(a,s[y]),p2(n.current.layer)}}function lpe(t,e,n,r){const i=Of(t.current);e.current.push({strokeStyle:i.strokeStyle,lineWidth:i.lineWidth,lineCap:i.lineCap,points:[n],globalCompositeOperation:i.globalCompositeOperation,transform:ae.cloneDeep(r)}),cpe(t,n,n)}function x1t(t,e,n,r){t.current.push({strokeStyle:"rgba(0,0,0,1)",lineWidth:e,lineCap:n,points:[r],globalCompositeOperation:"destination-out"})}function uE(t,e,n=null,r={}){for(const[i,s]of e.entries())if(eZ(t,s,n),r[i])for(const o of r[i])eZ(t,o,n)}function eZ(t,e,n){const r=bL(n,e.transform);r&&t.setTransform(...r),t.beginPath(),t.globalCompositeOperation=e.globalCompositeOperation,t.strokeStyle=e.strokeStyle,t.globalAlpha=1,t.lineWidth=e.lineWidth,t.lineCap=e.lineCap;let i=e.points[0];e.points.forEach(s=>{t.moveTo(i[0],i[1]),t.lineTo(s[0],s[1]),i=s}),t.stroke()}function cpe(t,e,n){const r=Of(t.current);r.beginPath(),r.moveTo(e[0],e[1]),r.lineTo(n[0],n[1]),r.stroke()}function w1t(t,e){t.globalAlpha=1,t.fillStyle="#4299e1",e.forEach(n=>{t.fillRect(n.x-op/2,n.y-op/2,op,op)})}function bL(t,e){return!t&&!e?null:e?t?[t[0]*e[0],0,0,t[3]*e[3],t[4]+e[4]*t[0],t[5]+e[5]*t[3]]:e:t}function xL(t){return[1/t[0],0,0,1/t[3],-t[4]/t[0],-t[5]/t[3]]}function S1t(t,e){const n=t.replace("#",""),r=parseInt(n.substring(0,2),16),i=parseInt(n.substring(2,4),16),s=parseInt(n.substring(4,6),16);return`rgba(${r}, ${i}, ${s}, ${e})`}function tZ(t){var e;if((t==null?void 0:t.type)==="img"&&((e=t==null?void 0:t.value)!=null&&e.complete)){const n=t.value;return{width:n.width,height:n.height}}return null}const A0=ae.throttle((t,e)=>{Pne([t,"drawing"],null,e)},200);function _1t({sectionId:t,activeLayerId:e,color:n,brushOpacity:r,brushSize:i,brushShape:s,eraserBrushSize:o,isEraser:a,setIsEraser:l,layerOpacity:c,mode:u,clearStrokes:f}){function h(R){Eu(t,"color",R)}function d(R){fE(e,"brushOpacity",R)}function p(R){Eu(t,"brushSize",R)}function g(R){Eu(t,"brushShape",R)}function m(R){fE(e,"layerOpacity",R)}function v(R){Eu(t,"eraserBrushSize",R)}function y(R,Q){fE(R,"visible",Q)}function b(R){Eu(t,"activeLayerId",R)}function S(){l(!1),Eu(t,"mode","draw")}function k(){l(!0),Eu(t,"mode","draw")}function E(){Eu(t,"mode","edit")}function T(){te.setState(R=>{Ite(t,R)})}function C(R){te.setState(Q=>{delete Q.artifactGroups[R];const L=Q.x[t],z=L.artifactGroupIds.findIndex(B=>B===R);L.artifactGroupIds=L.artifactGroupIds.filter(B=>B!==R),L.artifactGroupIds.length>0?L.canvasSettings.activeLayerId=L.artifactGroupIds[z!==-1?z-1:0]:L.canvasSettings.activeLayerId=null})}function A(R,Q){te.setState(L=>{L.x[t].artifactGroupIds=v5(L.x[t].artifactGroupIds,R,Q)})}return x.jsxs("div",{className:"section-search section-w-full z-10 flex flex-wrap items-center gap-2 rounded-xl border-b border-solid border-white px-3 py-3 shadow-sm @container dark:border-setta-700 [&_.colorpicker]:!max-h-6 [&_.colorpicker]:max-w-24 ",children:[x.jsx(k1t,{sectionId:t,color:n,setColor:h}),x.jsxs("div",{className:"flex self-stretch",children:[x.jsx("button",{className:`flex w-8 cursor-pointer items-center justify-center gap-1 rounded-l-lg bg-setta-200/30 py-1 text-xs ${u==="draw"&&!a?"text-blue-500":"text-setta-700 dark:text-setta-400"} hover:bg-setta-200 dark:bg-setta-800/50 dark:hover:bg-setta-900`,onClick:S,children:x.jsx(tI,{})}),x.jsx($1,{arrowClasses:"fill-white dark:fill-setta-800",contentClasses:"z-20 bg-white dark:bg-setta-800 flex relative px-2 py-1 rounded-lg min-w-48",trigger:x.jsx("button",{className:"flex w-6 cursor-pointer items-center justify-center gap-1 rounded-r-lg border border-setta-300/5 bg-setta-200 py-1 text-xs text-setta-700 hover:bg-setta-200 dark:bg-setta-800 dark:text-setta-400 dark:hover:bg-setta-900",children:x.jsx("i",{className:"gg-chevron-down"})}),header:"Brush Settings",children:x.jsx(C1t,{opacity:r,setOpacity:d,brushSize:i,setBrushSize:p,brushShape:s,setBrushShape:g})})]}),x.jsxs("div",{className:"flex self-stretch",children:[x.jsx("button",{className:`flex w-8 cursor-pointer items-center justify-center gap-1 rounded-l-lg bg-setta-200/30 py-1 text-xs ${u==="draw"&&a?"text-blue-500":"text-setta-700 dark:text-setta-400"} hover:bg-setta-300 dark:bg-setta-800/50 dark:hover:bg-setta-900`,onClick:k,children:x.jsx("i",{className:"gg-erase"})}),x.jsx($1,{arrowClasses:"fill-white dark:fill-setta-800",contentClasses:"z-20 bg-white dark:bg-setta-800 flex relative px-2 py-1 rounded-lg min-w-48",trigger:x.jsx("button",{className:"flex w-6 cursor-pointer items-center justify-center gap-1 rounded-r-lg border border-setta-300/5 bg-setta-200 py-1 text-xs text-setta-700 hover:bg-setta-300 dark:bg-setta-800 dark:text-setta-400 dark:hover:bg-setta-900",children:x.jsx("i",{className:"gg-chevron-down"})}),header:"Brush Settings",children:x.jsx(E1t,{brushSize:o,setBrushSize:v})})]}),x.jsx("button",{className:`flex w-8 cursor-pointer items-center justify-center gap-1 self-stretch rounded-lg bg-setta-200/30 py-1 text-xs ${u==="edit"?"text-blue-500":"text-setta-700 dark:text-setta-400"} hover:bg-setta-300 dark:bg-setta-800/50 dark:hover:bg-setta-900`,onClick:E,children:x.jsx(ZFe,{})}),x.jsx($1,{arrowClasses:"fill-white dark:fill-setta-800",contentClasses:"z-20 bg-white dark:bg-setta-800 flex relative px-2 py-1 rounded-lg min-w-48",trigger:x.jsxs("button",{className:"flex w-12 cursor-pointer items-center justify-center gap-0 self-stretch rounded-lg bg-setta-200/30 py-1 text-xs text-setta-700 hover:bg-setta-200 dark:bg-setta-800/50 dark:text-setta-400 dark:hover:bg-setta-900",children:[x.jsx("i",{className:"gg-image"}),x.jsx("i",{className:"gg-chevron-down"})]}),header:"Layer Opacity",children:x.jsx(T1t,{opacity:c,setOpacity:m})}),x.jsx($1,{arrowClasses:"fill-white dark:fill-setta-800",contentClasses:"z-20 bg-white dark:bg-setta-800 flex relative px-2 py-1 rounded-lg min-w-48",trigger:x.jsxs("button",{className:"flex w-12 cursor-pointer items-center justify-center gap-0 self-stretch rounded-lg bg-setta-200/30 py-1 text-xs text-setta-700 hover:bg-setta-200 dark:bg-setta-800/50 dark:text-setta-400 dark:hover:bg-setta-900",children:[x.jsx(tHe,{className:"w-5"}),x.jsx("i",{className:"gg-chevron-down"})]}),header:"Layer Selection",children:x.jsx(P1t,{sectionId:t,activeLayerId:e,setActiveLayerId:b,setLayerVisibility:y,addLayer:T,reorderLayers:A,deleteLayer:C})}),x.jsx("button",{className:"flex w-8 cursor-pointer items-center justify-center gap-1 self-stretch rounded-lg bg-setta-200/30 py-1 text-xs text-setta-700 hover:bg-red-600 hover:text-white dark:bg-setta-800/50 dark:text-setta-400 dark:hover:bg-red-800 dark:hover:text-white",onClick:f,children:x.jsx("i",{className:"gg-trash"})})]})}function k1t({sectionId:t,color:e,setColor:n}){const r=te(i=>{var s;return(s=i.x[t].canvasSettings)==null?void 0:s.colorChoices},ae.isEqual);return x.jsx(FD,{colorChoices:r,value:e,onChange:n,colorPickerChoicesClasses:"inline-flex cursor-pointer items-center overflow-hidden rounded-lg single-cell-container h-8 min-h-0 w-full min-w-0 max-w-24 items-center text-white",wrapperClassName:"single-cell-container justify-self-start self-center min-w-8 max-w-48 h-full"})}function C1t({opacity:t,setOpacity:e,brushSize:n,setBrushSize:r,brushShape:i,setBrushShape:s}){const[o,a]=_.useState(t),[l,c]=_.useState(n);_.useEffect(()=>{a(t)},[t]),_.useEffect(()=>{c(n)},[n]);const u="data[orientation='vertical']:flex-col data[orientation='vertical']:w-5 data[orientation='vertical']:h-24 SliderRoot relative flex flex-1 min-w-16 touch-none select-none items-center my-auto data-[orientation='horizontal']:h-5",f="relative flex-grow rounded-full bg-setta-200 data-[orientation='horizontal']:h-[3px] data-[orientation='vertical']:w-[3px] dark:bg-setta-700",h="absolute h-full rounded-full bg-blue-500",d="block h-3 w-3 cursor-pointer rounded-full border-2 border-setta-300 bg-white shadow-sm drop-shadow-md hover:bg-setta-100 focus:border-blue-500 focus-visible:outline-none dark:border-setta-400 dark:bg-setta-600",p="my-auto w-7 rounded-lg border border-solid border-setta-600/10 px-2 py-1 text-center font-mono text-xs text-setta-700 dark:border-setta-600/30 dark:text-setta-400";return x.jsxs("div",{className:"grid w-full grid-cols-[1fr,_2fr] gap-2",children:[x.jsx("p",{className:"self-center text-xs font-bold text-setta-600 dark:text-setta-400",children:"Opacity"}),x.jsx(xm,{sliderRootClassName:u,sliderTrackClassName:f,sliderRangeClassName:h,sliderThumbClassName:d,textInputClassName:p,wrapperDivClass:"flex gap-2",min:.1,max:1,step:.1,value:o,onChange:a,onCommit:e}),x.jsx("p",{className:"self-center text-xs font-bold text-setta-600 dark:text-setta-400",children:"Size"}),x.jsx(xm,{sliderRootClassName:u,sliderTrackClassName:f,sliderRangeClassName:h,sliderThumbClassName:d,textInputClassName:p,wrapperDivClass:"flex gap-2",min:1,max:100,step:1,value:l,onChange:c,onCommit:r}),x.jsx("p",{className:"self-center text-xs font-bold text-setta-600 dark:text-setta-400",children:"Brush Shape"}),x.jsxs("div",{className:"flex gap-1",children:[x.jsx("button",{className:`flex w-min cursor-pointer gap-2 rounded-lg border-solid ${i==="butt"?"border-setta-300 text-blue-500 dark:border-setta-700":"border-transparent text-setta-600 dark:text-setta-400"} p-1 text-xs font-bold hover:bg-setta-200/50 dark:hover:bg-setta-900/50`,onClick:()=>s("butt"),children:x.jsx("i",{className:"gg-shape-square"})}),x.jsx("button",{className:`flex w-min cursor-pointer gap-2 rounded-lg border-solid ${i==="round"?"border-setta-300 text-blue-500 dark:border-setta-700":"border-transparent text-setta-600 dark:text-setta-400"} p-1 text-xs font-bold hover:bg-setta-200/50 focus-visible:ring-1 dark:hover:bg-setta-900/50`,onClick:()=>s("round"),children:x.jsx("i",{className:"gg-shape-circle"})})]})]})}function E1t({brushSize:t,setBrushSize:e}){const[n,r]=_.useState(t);_.useEffect(()=>{r(t)},[t]);const i="data[orientation='vertical']:flex-col data[orientation='vertical']:w-5 data[orientation='vertical']:h-24 SliderRoot relative flex flex-1 min-w-16 touch-none select-none items-center my-auto data-[orientation='horizontal']:h-5",s="relative flex-grow rounded-full bg-setta-200 data-[orientation='horizontal']:h-[3px] data-[orientation='vertical']:w-[3px] dark:bg-setta-700",o="absolute h-full rounded-full bg-blue-500",a="block h-3 w-3 cursor-pointer rounded-full border-2 border-setta-300 bg-white shadow-sm drop-shadow-md hover:bg-setta-100 focus:border-blue-500 focus-visible:outline-none dark:border-setta-400 dark:bg-setta-600",l="my-auto w-7 rounded-lg border border-solid border-setta-600/10 px-2 py-1 text-center font-mono text-xs text-setta-700 dark:border-setta-600/30 dark:text-setta-400";return x.jsxs("div",{className:"grid w-full grid-cols-[1fr,_2fr] gap-2",children:[x.jsx("p",{className:"self-center text-xs font-bold text-setta-600 dark:text-setta-400",children:"Size"}),x.jsx(xm,{sliderRootClassName:i,sliderTrackClassName:s,sliderRangeClassName:o,sliderThumbClassName:a,textInputClassName:l,wrapperDivClass:"flex gap-2",min:1,max:100,step:1,value:n,onChange:r,onCommit:e})]})}function T1t({opacity:t,setOpacity:e}){const[n,r]=_.useState(t);_.useEffect(()=>{r(t)},[t]);const i="data[orientation='vertical']:flex-col data[orientation='vertical']:w-5 data[orientation='vertical']:h-24 SliderRoot relative flex flex-1 min-w-16 touch-none select-none items-center my-auto data-[orientation='horizontal']:h-5",s="relative flex-grow rounded-full bg-setta-200 data-[orientation='horizontal']:h-[3px] data-[orientation='vertical']:w-[3px] dark:bg-setta-700",o="absolute h-full rounded-full bg-blue-500",a="block h-3 w-3 cursor-pointer rounded-full border-2 border-setta-300 bg-white shadow-sm drop-shadow-md hover:bg-setta-100 focus:border-blue-500 focus-visible:outline-none dark:border-setta-400 dark:bg-setta-600",l="my-auto w-7 rounded-lg border border-solid border-setta-600/10 px-2 py-1 text-center font-mono text-xs text-setta-700 dark:border-setta-600/30 dark:text-setta-400";return x.jsxs("div",{className:"grid w-full grid-cols-[1fr,_2fr] gap-2",children:[x.jsx("p",{className:"self-center text-xs font-bold text-setta-600 dark:text-setta-400",children:"Layer Opacity"}),x.jsx(xm,{sliderRootClassName:i,sliderTrackClassName:s,sliderRangeClassName:o,sliderThumbClassName:a,textInputClassName:l,wrapperDivClass:"flex gap-2",min:.1,max:1,step:.1,value:n,onChange:r,onCommit:e})]})}function P1t({sectionId:t,activeLayerId:e,setActiveLayerId:n,setLayerVisibility:r,addLayer:i,reorderLayers:s,deleteLayer:o}){const a=te(g=>mD(t,g),ae.isEqual),l=a.toReversed(),[c,u]=_.useState(null),f=(g,m)=>{g.dataTransfer.setData("text/plain",m)},h=(g,m)=>{g.preventDefault(),u(m)},d=()=>{u(null)},p=(g,m)=>{g.preventDefault();const v=g.dataTransfer.getData("text/plain");u(null),v!==m&&s(a.length-1-v,a.length-1-m)};return x.jsxs("div",{className:"flex w-full max-w-64 flex-col gap-2",children:[x.jsx("ul",{className:"mt-1 flex w-full flex-col gap-2",children:l.map((g,m)=>x.jsxs("li",{draggable:!0,onDragStart:v=>f(v,m),onDragOver:v=>h(v,m),onDragLeave:d,onDrop:v=>p(v,m),className:`dark:hover:bg-setta-8509 flex cursor-move items-center justify-between gap-2 rounded-lg border-2 bg-setta-50 px-2 py-1 hover:bg-setta-100 dark:bg-setta-900 ${c===m?" border-blue-500":"border-transparent"} `,onClick:()=>n(g.id),children:[x.jsx("button",{onClick:()=>r(g.id,!g.visible),className:"cursor-pointer",children:g.visible?x.jsx(Qse,{className:"h-5 w-5 text-blue-500"}):x.jsx(Nse,{className:"h-5 w-5 text-setta-400 dark:text-setta-600"})}),x.jsx("p",{className:`truncate text-sm font-semibold ${e===g.id?" !text-blue-500":"text-setta-600 dark:text-setta-400"}`,children:g.name}),x.jsx("button",{onClick:()=>o(g.id),className:"flex h-4 w-4 cursor-pointer items-center",children:x.jsx("i",{className:"gg-close text-setta-400 hover:!text-red-500 dark:text-setta-700"})})]},g.id))}),x.jsxs("button",{onClick:i,className:"flex max-w-full cursor-pointer items-center justify-center rounded p-2 text-sm text-setta-600 hover:text-blue-500",children:[x.jsx(Olt,{className:"mr-2 h-3 w-3"}),"Add Layer"]})]})}function Eu(t,e,n){te.setState(r=>{r.x[t].canvasSettings[e]=n})}function fE(t,e,n){te.setState(r=>{r.artifactGroups[t][e]=n})}function A1t(t,e){return{minX:t.minX-e,maxX:t.maxX+e,minY:t.minY-e,maxY:t.maxY+e}}function hE(t,e){return t[0]>=e.minX&&t[0]<=e.maxX&&t[1]>=e.minY&&t[1]<=e.maxY}function nZ(t,e,n,r){const i=Math.atan2(t[1]-e[1],t[0]-e[0]);return[t[0]+(n+r)*Math.cos(i),t[1]+(n+r)*Math.sin(i)]}function R1t(t,e,n,r,i,s){if(hE(t,r))return!0;if(i==="butt")return!1;const o=i==="square"?s:0;if(!e&&n){const[a,l]=nZ(n,t,s,o);return hE([a,l],r)}if(!n&&e){const[a,l]=nZ(t,e,s,o);return hE([a,l],r)}return!1}function $1t(t,e,n,r){if(!t||t.length===0)return[];const i=r/2,s=[];let o=!1;for(let a=0;a<t.length;a++){const l=t[a],c=a>0?t[a-1]:null,u=a<t.length-1?t[a+1]:null;R1t(l,c,u,e,n,i)?(a>0&&s.length===0&&s.push(t[a-1]),s.push(l),o=!0):o&&(s.push(l),o=!1)}return s}function M1t(t,e,n,r){if(!t||t.length===0)return[];const i=e/2,s=A1t(r,i);return $1t(t,s,n,e)}function upe(t,e){return e?t.map(n=>[n[0]*e[0]+e[4],n[1]*e[3]+e[5]]):t}function I1t(t,e){return Math.atan2(e[1]-t[1],e[0]-t[0])}function D1t(t,e,n,r){const i=e+Math.PI/2,s=Math.cos(i),o=Math.sin(i),a=s*n,l=o*r;return t*Math.sqrt(a*a+l*l)}function L1t(t,e){if(t.length<=2)return t;const n=[t[0]];let r=t[0];for(let l=1;l<t.length;l++){const c=t[l],u=c[0]-r[0],f=c[1]-r[1];Math.sqrt(u*u+f*f)>=e&&(n.push(c),r=c)}const i=t[t.length-1],s=i[0]-r[0],o=i[1]-r[1];return(Math.sqrt(s*s+o*o)>=e||n.length===1)&&n.push(i),n}function N1t(t,e,n,r){const i=[t,e],s=upe(n.points,r),o=L1t(s,5);if(o.length===1){const a=n.lineWidth*Math.max(r[0],r[3]);return Math.hypot(i[0]-o[0][0],i[1]-o[0][1])<=a/2}for(let a=0;a<o.length-1;a++){const l=o[a],c=o[a+1],u=I1t(l,c),f=D1t(n.lineWidth,u,r[0],r[3]),h=c[0]-l[0],d=c[1]-l[1],p=h*h+d*d;if(p===0)continue;const g=Math.max(0,Math.min(1,((i[0]-l[0])*h+(i[1]-l[1])*d)/p)),m=l[0]+g*h,v=l[1]+g*d;if(Math.hypot(i[0]-m,i[1]-v)<=f/2)return!0}return!1}const fpe=(t,e)=>{let n=1/0,r=-1/0,i=1/0,s=-1/0;for(const o of t){const a=bL(e,o.transform);for(const l of upe(o.points,a))l[0]<n&&(n=l[0]),l[1]<i&&(i=l[1]),l[0]>r&&(r=l[0]),l[1]>s&&(s=l[1])}return{minX:n,maxX:r,minY:i,maxY:s}};function Q1t(t,e,n,r){switch(t.current.idx){case 0:e.current[0].x+=n,e.current[0].y+=r,e.current[1].y+=r,e.current[2].x+=n;break;case 1:e.current[0].y+=r,e.current[1].x+=n,e.current[1].y+=r,e.current[3].x+=n;break;case 2:e.current[0].x+=n,e.current[2].x+=n,e.current[2].y+=r,e.current[3].y+=r;break;case 3:e.current[1].x+=n,e.current[2].y+=r,e.current[3].x+=n,e.current[3].y+=r;break}}function JA(t,e){t.current=[{x:e.minX,y:e.minY},{x:e.maxX,y:e.minY},{x:e.minX,y:e.maxY},{x:e.maxX,y:e.maxY}]}function j1t(t){const e=t.current.map(r=>r.x),n=t.current.map(r=>r.y);return{minX:Math.min(...e),maxX:Math.max(...e),minY:Math.min(...n),maxY:Math.max(...n)}}function B1t(t){return{minX:t.current[0].x,maxX:t.current[1].x,minY:t.current[0].y,maxY:t.current[2].y}}function hpe(t,e){return t.width*e[0]}function dpe(t,e){return t.height*e[3]}function ppe(t,e){const n=[e[4],e[4]+hpe(t,e)],r=[e[5],e[5]+dpe(t,e)];return{minX:Math.min(...n),maxX:Math.max(...n),minY:Math.min(...r),maxY:Math.max(...r)}}function z1t(t,e,n){switch(t){case 0:if(e&&n)return qw;if(e&&!n)return Hw;if(!e&&n)return Xw;if(!e&&!n)return Zw;case 1:if(e&&n)return Xw;if(e&&!n)return Zw;if(!e&&n)return qw;if(!e&&!n)return Hw;case 2:if(e&&n)return Hw;if(e&&!n)return qw;if(!e&&n)return Zw;if(!e&&!n)return Xw;case 3:if(e&&n)return Zw;if(e&&!n)return Xw;if(!e&&n)return Hw;if(!e&&!n)return qw}}function Di(t){return t===0?1e-6:t}function qw(t,e,n,r,i,s){t[0]=Di((e-r)/s.value.width),t[3]=Di((n-i)/s.value.height),t[4]+=r,t[5]+=i}function Xw(t,e,n,r,i,s){t[0]=Di((e+r)/s.value.width),t[3]=Di((n-i)/s.value.height),t[5]+=i}function Hw(t,e,n,r,i,s){t[0]=Di((e-r)/s.value.width),t[3]=Di((n+i)/s.value.height),t[4]+=r}function Zw(t,e,n,r,i,s){t[0]=Di((e+r)/s.value.width),t[3]=Di((n+i)/s.value.height)}function F1t(t,e,n,r){for(let i=0;i<n.value.length;i++){const s=n.value[i],o=bL(r,s.transform);if(N1t(t,e,s,o))return!0}return!1}function W1t({sectionId:t,isEraser:e,strokesRef:n,eraserStrokesRef:r,prevPointRef:i,eraserBrushSize:s,brushShape:o,isDrawing:a,setIsDrawing:l,isDragging:c,draggedIdx:u,lastPos:f,selectedIdx:h,resizeHandle:d,resizeHandleCorners:p,drawThrottleDelay:g,canvasRef:m,tempCanvasRefs:v,draftCanvasRef:y,canvasTransferQueueLength:b,currBrushStrokeArtifactId:S,activeLayerId:k,localArtifactTransformsRef:E,mode:T}){let C,A,R,Q,L,z;const B=()=>Ete(m.current);if(T==="draw"){const Z=V1t({sectionId:t,isEraser:e,strokesRef:n,eraserStrokesRef:r,eraserBrushSize:s,brushShape:o,prevPointRef:i,setIsDrawing:l,canvasRef:m,tempCanvasRefs:v,draftCanvasRef:y,activeLayerId:k,currBrushStrokeArtifactId:S,localArtifactTransformsRef:E});C=(...j)=>{z=Z(...j),z&&A0(t,B)};const J=U1t({sectionId:t,isEraser:e,strokesRef:n,eraserStrokesRef:r,prevPointRef:i,isDrawing:a,canvasRef:m,tempCanvasRefs:v,draftCanvasRef:y,canvasTransferQueueLength:b,activeLayerId:k,currBrushStrokeArtifactId:S,localArtifactTransformsRef:E});A=(...j)=>{z=J(...j),z&&A0(t,B)};const I=q1t({sectionId:t,isEraser:e,eraserStrokesRef:r,isDrawing:a,setIsDrawing:l,activeLayerId:k,currBrushStrokeArtifactId:S,strokesRef:n,canvasRef:m,tempCanvasRefs:v,draftCanvasRef:y});R=(...j)=>{z=I(...j),z&&A0(t,B)},Q=X1t({draftCanvasRef:y,onMouseDown:C})}else{const Z=H1t({canvasRef:m,selectedIdx:h,localArtifactTransformsRef:E,resizeHandle:d,resizeHandleCorners:p,lastPos:f,draggedIdx:u,isDragging:c});C=(...j)=>{L=Z(...j),L&&(Lf(t,m,v,{},{[k]:E.current},{[k]:p.current}),A0(t,B))};const J=Z1t({canvasRef:m,isDragging:c,lastPos:f,resizeHandle:d,resizeHandleCorners:p,selectedIdx:h,draggedIdx:u,localArtifactTransformsRef:E});A=(...j)=>{L=J(...j),L&&(Lf(t,m,v,{},{[k]:E.current},{[k]:p.current}),A0(t,B))};const I=Y1t({sectionId:t,isDragging:c,draggedIdx:u,resizeHandle:d,resizeHandleCorners:p,activeLayerId:k,localArtifactTransformsRef:E,canvasRef:m,tempCanvasRefs:v});R=(...j)=>{I(...j),A0(t,B)},Q=()=>{}}const q=_.useCallback(T==="draw"&&g>0?ae.throttle(A,g):A,[A,g]);return{onMouseDown:C,onMouseMove:q,onMouseUp:R,onMouseEnter:Q}}function V1t({sectionId:t,isEraser:e,strokesRef:n,eraserStrokesRef:r,eraserBrushSize:i,brushShape:s,prevPointRef:o,setIsDrawing:a,canvasRef:l,tempCanvasRefs:c,draftCanvasRef:u,activeLayerId:f,currBrushStrokeArtifactId:h,localArtifactTransformsRef:d}){return(p,g,m)=>{if(Ut.getState().mouseDownDraggingSection)return!1;let v=!1;Ut.getState().mouseDownDrawArea||a3(t),Ut.setState({mouseDownDrawArea:!0}),a(!0);let y;if(g&&m?y=[g,m]:y=ape(p),e)x1t(r,i,s,y),Lf(t,l,c,{},{},{},{[f]:r.current}),v=!0;else{const b=d.current.find(S=>S.artifactId===h);b&&(lpe(u,n,y,xL(b.transform)),v=!0)}return o.current=y,v}}function U1t({sectionId:t,isEraser:e,strokesRef:n,eraserStrokesRef:r,prevPointRef:i,isDrawing:s,canvasRef:o,tempCanvasRefs:a,draftCanvasRef:l,canvasTransferQueueLength:c,activeLayerId:u,currBrushStrokeArtifactId:f,localArtifactTransformsRef:h}){return d=>{if(!s)return!1;const p=ape(d),g=e?r:n,m=g.current[g.current.length-1];if(!m)return!1;if(e)m.points.push(p),i.current=p,Lf(t,o,a,{},{},{},{[u]:r.current});else if(m.points.length>=c){yL(t,f,n,o,a,l,!1);const v=h.current.find(y=>y.artifactId===f);v&&lpe(l,g,p,xL(v.transform)),i.current=p}else cpe(l,i.current,p),m.points.push(p),i.current=p;return!0}}function q1t({sectionId:t,isEraser:e,eraserStrokesRef:n,isDrawing:r,setIsDrawing:i,activeLayerId:s,currBrushStrokeArtifactId:o,strokesRef:a,canvasRef:l,tempCanvasRefs:c,draftCanvasRef:u}){return()=>{if(!r)return!1;if(e){const f=ti.getState().x,h=n.current[n.current.length-1];te.setState(d=>{const p=d.artifactGroups[s];for(const g of p.artifactTransforms){const m=f[g.artifactId],v=xL(g.transform),y=m.type==="img"?ppe:fpe,b=M1t(h.points,h.lineWidth,h.lineCap,y(m.value,g.transform));if(m.type==="img")b.length>0&&g.eraserStrokes.push({...h,points:b,transform:v});else for(const[S]of m.value.entries())b.length>0&&(S in g.eraserStrokes||(g.eraserStrokes[S]=[]),g.eraserStrokes[S].push({...h,points:b,transform:v}))}}),n.current=[]}return i(!1),yL(t,o,a,l,c,u),!0}}function X1t({draftCanvasRef:t,onMouseDown:e}){return n=>{if(n.buttons===1){const r=KR(),i=t.current.getBoundingClientRect(),s=(n.clientX-i.left)/r,o=(n.clientY-i.top)/r;e(n,s,o)}}}function H1t({canvasRef:t,selectedIdx:e,localArtifactTransformsRef:n,resizeHandle:r,resizeHandleCorners:i,lastPos:s,draggedIdx:o,isDragging:a}){return l=>{const c=ti.getState().x,f=t.current.getBoundingClientRect(),h=KR(),d=(l.clientX-f.left)/h,p=(l.clientY-f.top)/h;if(e.current!==null)for(let g=0;g<i.current.length;g++){const m=i.current[g];if(Math.abs(d-m.x)<=op/2&&Math.abs(p-m.y)<=op/2){const v=n.current[e.current].transform;return r.current={idx:g,wasPositive:{xScale:v[0]>=0,yScale:v[3]>=0}},s.current={x:d,y:p},!0}}for(let g=n.current.length-1;g>=0;g--){const{transform:m,artifactId:v}=n.current[g],y=c[v];if(y.type==="img"){const b=ppe(y.value,m);if(d>=b.minX&&d<=b.maxX&&p>=b.minY&&p<=b.maxY)return JA(i,b),a.current=!0,o.current=g,e.current=g,s.current={x:d,y:p},!0}else if(y.type==="brushStrokes"&&F1t(d,p,y,m)){const S=fpe(y.value,m);return JA(i,S),a.current=!0,o.current=g,e.current=g,s.current={x:d,y:p},!0}}return e.current=null,i.current=null,!1}}function Z1t({canvasRef:t,isDragging:e,lastPos:n,resizeHandle:r,resizeHandleCorners:i,selectedIdx:s,draggedIdx:o,localArtifactTransformsRef:a}){return l=>{if(!e.current&&r.current===null)return!1;const c=ti.getState().x,f=t.current.getBoundingClientRect(),h=KR(),d=(l.clientX-f.left)/h,p=(l.clientY-f.top)/h,g=d-n.current.x,m=p-n.current.y;if(e.current&&o.current!==null){const{transform:v}=a.current[o.current];v[4]+=g,v[5]+=m,n.current={x:d,y:p},i.current=i.current.map(y=>({x:y.x+g,y:y.y+m}))}else if(r.current!==null&&s.current!==null){const{transform:v,artifactId:y}=a.current[s.current],b=c[y];if(b.type==="img"){const S=hpe(b.value,v),k=dpe(b.value,v);z1t(r.current.idx,r.current.wasPositive.xScale,r.current.wasPositive.yScale)(v,S,k,g,m,b)}else if(b.type==="brushStrokes"){const S=B1t(i),k=S.maxX-S.minX,E=S.maxY-S.minY;switch(r.current.idx){case 0:{const T=(k-g)/k,C=(E-m)/E,A=S.maxX,R=S.maxY;v[0]=Di(v[0]*T),v[3]=Di(v[3]*C),v[4]=A-(A-v[4])*T,v[5]=R-(R-v[5])*C;break}case 1:{const T=(k+g)/k,C=(E-m)/E,A=S.minX,R=S.maxY;v[0]=Di(v[0]*T),v[3]=Di(v[3]*C),v[4]=A-(A-v[4])*T,v[5]=R-(R-v[5])*C;break}case 2:{const T=(k-g)/k,C=(E+m)/E,A=S.maxX,R=S.minY;v[0]=Di(v[0]*T),v[3]=Di(v[3]*C),v[4]=A-(A-v[4])*T,v[5]=R-(R-v[5])*C;break}case 3:{const T=(k+g)/k,C=(E+m)/E,A=S.minX,R=S.minY;v[0]=Di(v[0]*T),v[3]=Di(v[3]*C),v[4]=A-(A-v[4])*T,v[5]=R-(R-v[5])*C;break}}}Q1t(r,i,g,m),n.current={x:d,y:p}}return!0}}function Y1t({sectionId:t,isDragging:e,draggedIdx:n,resizeHandle:r,resizeHandleCorners:i,activeLayerId:s,localArtifactTransformsRef:o,canvasRef:a,tempCanvasRefs:l}){return()=>{i.current&&JA(i,j1t(i)),b1t(t,s,o,i,a,l),e.current=!1,n.current=null,r.current=null}}function G1t({sectionId:t}){var pe,De;const{activeLayer:e,allLayersMetadata:n,size:{width:r,height:i},canvasSettings:{activeLayerId:s,color:o,brushSize:a,brushShape:l,eraserBrushSize:c,drawThrottleDelay:u,canvasTransferQueueLength:f,mode:h,artifactIdUsedToSetCanvasSize:d},loadedArtifacts:p,loadedArtifactIdsWithDuplicates:g}=Drt(t),m=_.useRef(null),v=_.useRef(null),y=_.useRef({layer:null,artifact:null}),b=_.useRef([]),S=_.useRef([]),k=_.useRef([]),E=_.useRef(null),[T,C]=_.useState(!1),[A,R]=_.useState(!1),Q=_.useRef(!1),L=_.useRef(null),z=_.useRef({x:0,y:0}),B=_.useRef(null),q=_.useRef(null),Z=_.useRef(null),J=(e==null?void 0:e.layerOpacity)??1,I=(e==null?void 0:e.brushOpacity)??1,j=(De=(pe=e==null?void 0:e.artifactTransforms)==null?void 0:pe.find(xe=>{var je;return((je=p[xe.artifactId])==null?void 0:je.type)==="brushStrokes"}))==null?void 0:De.artifactId,M=Ut(xe=>xe.updateDrawAreas);_.useEffect(()=>(y.current.layer=document.createElement("canvas"),y.current.artifact=document.createElement("canvas"),Lne(t,m)),[]),_.useEffect(()=>{te.setState(xe=>{y1t({sectionId:t,canvasRef:m,tempCanvasRefs:y,draftCanvasRef:v,height:i,width:r,artifactIdUsedToSetCanvasSize:d,state:xe})}),Lf(t,m,y)},[i,r,!!p[d],M]),_.useEffect(()=>{v1t({draftCanvasRef:v,color:o,brushSize:a,brushShape:l,brushOpacity:I,layerOpacity:J})},[o,a,l,I,J,M]),zy(()=>{h==="draw"&&(B.current=null,Z.current=null),Lf(t,m,y)},[h,J,n,g,M]),_.useEffect(()=>{j?b.current=ae.cloneDeep(ti.getState().x[j].value):b.current=[]},[j,M]),Hje(()=>{e!=null&&e.artifactTransforms?k.current=ae.cloneDeep(e.artifactTransforms):k.current=[]},[e==null?void 0:e.artifactTransforms,M]);const{onMouseDown:X,onMouseMove:se,onMouseUp:H,onMouseEnter:de}=W1t({sectionId:t,isEraser:A,strokesRef:b,eraserStrokesRef:S,prevPointRef:E,eraserBrushSize:c,brushShape:l,isDrawing:T,setIsDrawing:C,isDragging:Q,draggedIdx:L,lastPos:z,selectedIdx:B,resizeHandle:q,resizeHandleCorners:Z,drawThrottleDelay:u,canvasRef:m,tempCanvasRefs:y,draftCanvasRef:v,canvasTransferQueueLength:f,currBrushStrokeArtifactId:j,activeLayerId:s,localArtifactTransformsRef:k,mode:h});function fe(){b.current=[],yL(t,j,b,m,y,v)}const{getRootProps:ve,isDragActive:F}=gD(t,!0,"img"),oe=`single-cell-child max-w-full place-self-center ${F?"outline outline-4 outline-green-500 dark:outline-green-500/80":""}`;let le;return h==="edit"?le="cursor-pointer":A?le="cursor-[url(./src/assets/cursor/erase.svg)_0_24,_pointer]":le="cursor-[url(./src/assets/cursor/pen.svg)_0_24,_pointer]",x.jsxs(x.Fragment,{children:[x.jsx(_1t,{sectionId:t,activeLayerId:s,color:o,brushOpacity:I,brushSize:a,brushShape:l,eraserBrushSize:c,isEraser:A,setIsEraser:R,layerOpacity:J,mode:h,clearStrokes:fe}),x.jsx("section",{className:"nodrag single-cell-container section-row-main section-key-value relative max-h-full min-w-0",...ve(),children:x.jsxs("div",{className:"single-cell-child single-cell-container",children:[x.jsx("canvas",{ref:m,onMouseDown:X,onMouseMove:se,onMouseUp:H,onMouseLeave:H,onMouseEnter:de,className:`${le} ${oe}`}),x.jsx("canvas",{ref:v,className:`pointer-events-none ${oe}`})]})})]})}function wL({sectionId:t}){const e=te(r=>Yt(t,r).isFrozen);function n(){J1t(t)}return x.jsx(mpe,{sectionId:t,isDisabled:e,onChange:n})}function mpe({sectionId:t,isDisabled:e,onChange:n}){const[r,i]=K1t(t),{wrapperRef:s,handleCreateEditor:o,maxHeight:a,overflow:l,nowheel:c}=hD({sectionId:t}),{onArticleDivEnterKeyFocusOnCodeMirror:u,onEscapeFocusOnArticleDiv:f}=dD(s),h=R3(),d=F3({sectionId:t,language:"yaml",indentWithTab:!0,onEscape:f,isDisabled:e});function p(m){i(m),n==null||n()}const g=l===""?"[&_.cm-editor]:h-full":"";return x.jsx("article",{ref:s,className:`${Cl} nodrag section-full-no-title min-h-0 cursor-auto [&_*]:!outline-0 [&_.cm-theme]:h-full ${g} ${l} ${c}`,onKeyDown:u,tabIndex:"0",children:x.jsx(Ky,{maxHeight:a,value:r,onChange:p,theme:h,extensions:d,onCreateEditor:o,indentWithTab:!1,basicSetup:{tabSize:4}})})}function K1t(t){const{variantId:e,displayedVariantId:n}=te(s=>({variantId:s.x[t].variantId,displayedVariantId:z5(t,s)}),ae.isEqual),r=u_(s=>s[n]??"");function i(s){u_.setState({[e]:s})}return[r,i]}const J1t=ae.debounce(V$,500);function evt({rootStyles:t="",itemStyles:e="",triggerStyles:n="",contentStyles:r="",headerStyles:i="",trigger:s,children:o,heading:a,value:l,defaultValue:c=l,type:u="single",open:f="",asChild:h=!1,internalWrapper:d=!0}){return x.jsx(wD,{className:t,type:u,defaultValue:c,collapsible:!0,"data-state":f,asChild:h,children:x.jsxs(tvt,{itemStyles:e,value:l,children:[x.jsx(nvt,{triggerStyles:n,trigger:s,headerStyles:i,children:a}),x.jsx(rvt,{contentStyles:r,internalWrapper:d,children:o})]})})}const tvt=ke.forwardRef(({children:t,itemStyles:e,...n},r)=>x.jsx(q3,{className:e,...n,ref:r,children:t})),nvt=ke.forwardRef(({children:t,headerStyles:e,trigger:n,triggerStyles:r,...i},s)=>x.jsx(Qfe,{className:e,children:x.jsxs(X3,{className:`group ${r}`,...i,ref:s,children:[t,x.jsx(vze,{className:"ease-[cubic-bezier(0.87, 0, 0.13, 1)] transition-transform duration-300 group-data-[state=open]:rotate-180"})]})})),rvt=ke.forwardRef(({children:t,contentStyles:e,internalWrapper:n,...r},i)=>n?x.jsx(IO,{className:e,...r,ref:i,children:x.jsx("div",{className:"overflow-y-auto px-5 py-4 ",children:t})}):x.jsx(IO,{className:e,...r,ref:i,children:t}));function fk(t){const e=te(i=>i.x[t].displayMode===so.YAML),[n,r]=_.useState(!1);return _.useEffect(()=>{if(e){const{variantId:i,displayMode:s}=Pi(t);Ene(t,i),r(!0)}else n&&V$(t)},[e]),e}function ivt({sectionId:t}){const e=te(n=>{var i;const r=n.x[t].size.width;return r==="auto"?(i=Uf(t))==null?void 0:i.width:r});return x.jsx(svt,{sectionId:t,width:e})}function svt({sectionId:t,width:e}){const{ref:n,isScrollable:r}=dg();return x.jsx(x.Fragment,{children:x.jsxs("section",{className:`${e&&e<386&&r?"nowheel":""} section-main -mr-3 mb-2 flex min-w-0 flex-col gap-2 overflow-y-scroll pr-2 @sm/multipane:flex-row @sm/multipane:gap-4 @sm/multipane:overflow-visible`,ref:n,children:[x.jsx(ovt,{width:e,children:x.jsx(avt,{sectionId:t})}),x.jsx(lvt,{sectionId:t})]})})}function ovt({width:t,children:e}){return t>384?x.jsx(eL,{className:"nodrag relative -mr-2 flex flex-col pr-1",enable:{right:!0},minWidth:100,maxWidth:"70%",handleClasses:{right:"before:bg-transparent before:absolute before:top-0 before:h-3/4 before:bottom-0 before:left-0 before:right-0 before:m-auto before:w-1/4 hover:before:bg-blue-500 before:rounded-full"},children:e}):x.jsx("article",{className:"-mr-2 flex flex-col pr-2",children:e})}function avt({sectionId:t}){return x.jsxs(x.Fragment,{children:[x.jsx("h3",{className:"mb-[0.55rem] ml-0.5 mt-2 text-xs font-bold uppercase text-setta-300 dark:text-setta-500",children:"Run Groups"}),x.jsx(cvt,{sectionId:t}),x.jsx(wvt,{sectionId:t})]})}function lvt({sectionId:t}){const e=fk(t),n=te(r=>r.x[t].previewVariantId??r.x[t].variantId);return n?x.jsx("article",{className:`${e?"-mr-2 overflow-visible @sm/multipane:-mr-[14px] @sm/multipane:overflow-y-scroll":"h-full min-h-0 min-w-0 max-w-full overflow-x-clip"} mt-2 flex flex-1 flex-col pb-2 `,children:e?x.jsx(mpe,{sectionId:t}):x.jsxs(x.Fragment,{children:[x.jsxs("div",{className:"flex gap-4",children:[x.jsx("h3",{className:"text-xs font-bold uppercase text-setta-300 dark:text-setta-500",children:"Sections"}),x.jsx(xvt,{})]}),x.jsx(uvt,{runGroupId:n})]})}):null}function cvt({sectionId:t}){const{ref:e,isScrollable:n}=dg(),{editingRunGroupId:r,runGroupsDetails:i,runGroupSelection:s}=te(o=>{const a=[],{variantIds:l,variantId:c}=o.x[t];for(const u of l)a.push({id:u,name:o.variants[u].name});return{runGroupsDetails:a,runGroupSelection:o.x[t].selectedVariantIds,editingRunGroupId:c}},ae.isEqual);return x.jsx("ul",{className:`${n?"nowheel":""} flex flex-grow flex-col overflow-visible py-[2px] @sm/multipane:overflow-y-scroll`,ref:e,onMouseLeave:()=>gde(t),children:i.map(({id:o,name:a})=>x.jsx(bvt,{shown:r===o,checked:s[o]??!1,onChange:()=>{JRe(t,o)},onMouseEnter:()=>mde(t,o),onClick:()=>vde(t,o),children:a},o))})}function uvt({runGroupId:t}){const e=o$e(),{ref:n,isScrollable:r}=dg();return x.jsx(vpe,{sections:e,runGroupId:t,ref:n,className:r?"nowheel":"",ancestors:[],parentIsSelected:!0})}function gpe({ancestors:t,parentIsSelected:e,runGroupId:n}){const r=s$e(t[t.length-1].variantId);return x.jsx(vpe,{sections:r,runGroupId:n,ancestors:t,parentIsSelected:e})}const vpe=ke.forwardRef(({sections:t,runGroupId:e,ancestors:n,parentIsSelected:r,className:i=""},s)=>t.length>0&&x.jsx("ul",{className:`${i} flex flex-grow flex-col overflow-visible rounded-lg bg-setta-50/40 pl-3 pr-2 pt-1 @sm/multipane:overflow-y-scroll dark:bg-setta-875`,ref:s,children:t.map((o,a)=>x.jsx(fvt,{sectionInfo:o,ancestors:n,parentIsSelected:r,runGroupId:e},a))}));function fvt({sectionInfo:t,ancestors:e,parentIsSelected:n,runGroupId:r}){const i=t.id,s=e.length===0?null:e[e.length-1].variantId;function o(){n$e({id:r,ancestors:e,sectionId:i,parentVariantId:s})}const a=te(l=>{var c,u;return n&&!!((u=(c=l.variants[r].runGroup[i])==null?void 0:c[s])!=null&&u.selected)});return x.jsxs("li",{className:"flex flex-col",children:[x.jsx(SL,{checked:a,onChange:o,children:t.name}),x.jsx(dvt,{sectionId:i,runGroupId:r,isSelected:a,ancestors:e,parentVariantId:s}),x.jsx(gvt,{sectionId:i,runGroupId:r,isSelected:a,ancestors:e,parentVariantId:s})]})}function hvt({sectionId:t,ancestors:e,runGroupId:n,isSelected:r,parentVariantId:i}){const s=Fte(t);return s.length>1?x.jsx(pvt,{sectionId:t,ancestors:e,runGroupId:n,isSelected:r,allVersions:s,parentVariantId:i}):x.jsx("div",{className:"pl-4",children:x.jsx(gpe,{ancestors:[...e,{id:t,variantId:s[0].id}],parentIsSelected:r,runGroupId:n})})}const dvt=ke.memo(hvt,ae.isEqual);function pvt({sectionId:t,ancestors:e,runGroupId:n,isSelected:r,allVersions:i,parentVariantId:s}){const a=te(l=>{var u,f;const c=(f=(u=l.variants[n].runGroup[t])==null?void 0:u[s])==null?void 0:f.versions;if(!c)return!1;for(const h of Object.values(c))if(h)return!0;return!1})||!r?void 0:"bg-red-100 dark:bg-red-950/20 hover:bg-red-500/20 border-red-300 hover:dark:bg-red-950/50 dark:border-red-700/80 hover:dark:border-red-700 [&_ul]:!bg-transparent";return x.jsx(Ope,{inputList:i,heading:"Versions",isSelected:r,sectionId:t,runGroupId:n,ancestors:e,parentVariantId:s,accordionRootStyles:a,ChildComponent:Ovt})}function mvt({sectionId:t,ancestors:e,runGroupId:n,isSelected:r,parentVariantId:i}){const s=WAe(t);return s.length>0&&x.jsx(Ope,{inputList:s,heading:"Param Sweeps",isSelected:r,sectionId:t,runGroupId:n,ancestors:e,parentVariantId:i,ChildComponent:yvt})}const gvt=ke.memo(mvt,ae.isEqual);function vvt({inputList:t,heading:e,isSelected:n,sectionId:r,runGroupId:i,ancestors:s,parentVariantId:o,accordionRootStyles:a,ChildComponent:l}){return x.jsx(evt,{rootStyles:`${a??"hover:bg-white hover:dark:bg-setta-700/10 hover:border-setta-50 dark:hover:border-setta-700"} border border-transparent rounded-lg px-2 ml-7 -mr-2 -mt-0.5`,itemStyles:"focus-within:relative focus-within:z-10",headerStyles:"flex flex-1 cursor-default items-center justify-between my-0.5 ml-1",triggerStyles:"flex justify-between px-2 -mx-2 w-full items-center hover:cursor-pointer rounded-md italic text-xs font-semibold opacity-60 group-hover:opacity-100 text-setta-500 dark:text-setta-300 focus-visible:outline outline-blue-500",contentStyles:"text-xs overflow-hidden mb-1 ",heading:e,value:e,internalWrapper:!1,"data-state":open,children:x.jsx("ul",{children:t.map((c,u)=>x.jsx("li",{className:"ml-[4px] flex min-h-6 cursor-pointer flex-col rounded",children:x.jsx(l,{id:c.id,name:c.name,parentIsSelected:n,sectionId:r,runGroupId:i,ancestors:s,parentVariantId:o})},u))})})}const Ope=ke.memo(vvt,ae.isEqual);function Ovt({id:t,name:e,parentIsSelected:n,sectionId:r,runGroupId:i,ancestors:s,parentVariantId:o}){function a(){i$e({id:i,sectionId:r,versionId:t,ancestors:s,parentVariantId:o})}const l=te(c=>{var u;return n&&!!((u=c.variants[i].runGroup[r])!=null&&u[o].versions[t])});return x.jsxs(x.Fragment,{children:[x.jsx("div",{className:"flex items-center gap-2 truncate",children:x.jsx(SL,{checked:l,onChange:a,children:e})}),x.jsx("div",{className:"pl-4",children:x.jsx(gpe,{parentIsSelected:l,ancestors:[...s,{id:r,variantId:t}],runGroupId:i})})]})}function yvt({id:t,name:e,parentIsSelected:n,ancestors:r,sectionId:i,runGroupId:s,parentVariantId:o}){function a(){r$e({id:s,ancestors:r,sectionId:i,paramSweepId:t,parentVariantId:o})}const l=te(c=>{var u;return!!((u=c.variants[s].runGroup[i])!=null&&u[o].paramSweeps[t])});return x.jsx(SL,{checked:n&&l,onChange:a,children:e})}function SL({children:t,checked:e,onChange:n}){return x.jsxs("label",{className:"flex min-h-6 cursor-pointer items-center gap-2 text-xs text-setta-700 dark:text-setta-300",children:[x.jsx("input",{type:"checkbox",className:"h-4 w-4 min-w-4 rounded-md bg-setta-500/10 outline-offset-2 outline-blue-500 checked:bg-blue-500 hover:bg-setta-500/30 hover:checked:bg-blue-500 focus-visible:outline",checked:e,onChange:n}),x.jsx("p",{className:"truncate",children:t})]})}function bvt({children:t,checked:e,shown:n,onChange:r,onClick:i,onMouseEnter:s}){return x.jsxs("li",{className:"group/runitem flex justify-between",onMouseEnter:s,children:[x.jsxs("label",{className:`flex min-h-6 cursor-pointer items-center gap-2 truncate rounded px-1 py-0.5 text-xs text-setta-700 group-hover/runitem:!text-blue-500 dark:text-setta-200 ${n?"font-bold !text-blue-500":""}`,children:[x.jsx("input",{type:"checkbox",className:"h-4 w-4 min-w-4 cursor-pointer rounded-md bg-setta-500/15 outline-offset-2 outline-blue-500 checked:bg-blue-500 hover:bg-setta-500/30 hover:checked:bg-blue-500 focus-visible:outline",checked:e,onChange:r}),x.jsx("p",{className:"truncate",children:t})]}),x.jsx("button",{className:`mr-0.5 flex h-6 w-6 cursor-pointer items-center justify-center rounded-full text-transparent outline-blue-500 hover:!text-setta-500 focus-visible:outline group-hover/runitem:text-setta-300 dark:hover:!text-setta-300 dark:group-hover/runitem:text-setta-600 ${n?"!text-blue-500":""}`,onClick:i,children:x.jsx("i",{className:"gg-pen "})})]})}function xvt(){const t="flex-1 min-w-0 text-xs outline-0 cursor-auto bg-transparent [border-width:0_0_1px_0] border-solid border-transparent truncate focus-visible:border-blue-300 pl-4 py-1 placeholder-setta-300 dark:placeholder-setta-700 ";return x.jsx("div",{className:"-mt-1 flex-1",children:x.jsx(Ud,{leftElement:x.jsx("i",{className:"gg-sort-az mb-[2px] !scale-50 text-setta-400"}),placeholder:"Filter",inputStyles:t,outerClasses:"flex-1"})})}function wvt({sectionId:t}){async function e(){Svt(t)}return x.jsxs("button",{className:"nodrag mt-2 flex min-w-0 cursor-pointer select-none items-center justify-center gap-1 rounded-md border border-solid border-setta-100 px-2 py-1 text-xs font-bold uppercase leading-none text-setta-400 outline-none transition-colors duration-150 hover:bg-setta-50 focus-visible:!border-blue-500 focus-visible:outline-none focus-visible:ring-0 dark:border-setta-800 dark:text-setta-500 dark:hover:bg-setta-800 dark:hover:text-setta-400",onClick:e,children:[x.jsx("span",{className:"relative",children:x.jsx("i",{className:"gg-add-r absolute"})}),"New Run Group"]})}function Svt(t){let e;te.setState(n=>{const r=zm();({newVariantId:e}=dde(t,r,n)),Kne(e,n)}),Nd(t,e)}function _vt({sectionId:t,paramInfoId:e,maybeErrorMessage:n}){const{value:r,evRefs:i}=BAe(t,e),[s,o]=_.useState(r),a=_.useRef();function l(c){var f;const u=ae.toString(c);o(u),(f=a.current)==null||f.abort(),Cvt(t,e,u,a),ZT(),kvt(t,e,u)}return _.useEffect(()=>{s!==r&&o(r)},[r]),x.jsx(bct,{sectionId:t,paramInfoId:e,value:s,onChange:l,maybeErrorMessage:n,evRefs:i})}function kvt(t,e,n){Pne([t,e],n)}const Cvt=by(async(t,e,n,r)=>{const i=new AbortController;if(r.current=i,Hy(t,e).type===Y.TEXT){if(i.signal.aborted)return;const s=await CM({sectionId:t,paramInfoId:e,fullText:n});if(i.signal.aborted)return;te.setState(o=>{MT(t,e,n,o);const{variantId:a}=o.x[t];o.variants[a].values[e].evRefs=s})}else{if(i.signal.aborted)return;te.setState(s=>{MT(t,e,n,s)})}hn(!0)},50);function Evt({showResizeHandle:t,onMouseDown:e}){return x.jsx("div",{className:"section-center relative mx-auto h-[90%] w-0.5 rounded-sm group-hover/arg-group:bg-setta-500/15",children:t&&x.jsx("div",{className:`${Cl} nopan nodrag group/resize absolute inset-y-0 left-1/2 -ml-2 flex w-4 cursor-col-resize items-center justify-center`,onMouseDown:e,children:x.jsx("div",{className:"h-[calc(100%-4px)] w-1.5 rounded bg-transparent hover:!bg-blue-500 group-hover/resize:bg-setta-200 group-hover/resize:dark:bg-setta-500"})})})}function Tvt({sectionId:t,paramInfoId:e,requiredParamIdsToPaths:n,children:r,onResizeStart:i,isKwarg:s=!1,isTopLevelWithPad:o,paramChildren:a,onMouseDown:l,maybeErrorMessage:c,border:u,bg:f}){const{description:h,name:d}=te(y=>({description:y.codeInfo[e].description,name:y.codeInfo[e].name}),ae.isEqual),{childlessRef:p,childlessNameRef:g,parentRef:m}=Avt(t,a),v=c?[{content:c,wrapperClassName:"!border-red-300 dark:!border-red-900 [&_.tooltip-footer]:!text-red-500 dark:[&_.tooltip-footer]:!text-red-800 dark:[&_.tooltip-footer]:!border-red-950 !bg-red-50/90 dark:!bg-[#120000]/90 [&_.tooltip-copy]:!text-red-400 dark:[&_.tooltip-copy]:!text-red-300 [&>.tooltip-copy]:hover:!bg-transparent",contentClassName:"!text-red-700 dark:!text-red-300 font-mono"},{title:d,content:h}]:[{title:d,content:h}];return a.length===0?x.jsx(x.Fragment,{children:x.jsxs("article",{id:`ParamContainer-${t}-${e}`,className:`section-args-nested-key-value section-key-value group/arg-group section-min-rows grid grid-cols-subgrid items-center justify-between rounded-sm px-[2px] hover:bg-setta-100/50 hover:dark:bg-setta-800/70 ${f} ${u} `,...Rr(...v),onMouseDownCapture:l,ref:p,children:[s?x.jsx(x.Fragment,{children:r}):x.jsx("div",{className:"section-key overflow-hidden",ref:g,children:r}),x.jsx(_vt,{sectionId:t,paramInfoId:e,maybeErrorMessage:c}),x.jsx(Evt,{showResizeHandle:!0,onMouseDown:i}),!!c&&x.jsx(Rvt,{paramInfoId:e})]})}):x.jsxs("article",{id:`ParamContainer-${t}-${e}`,className:`section-args-nested section-lg-value group/arg-group section-min-rows [&>p]:section-key-value grid grid-cols-subgrid items-center justify-between gap-y-1 rounded-sm ${o?"[&>p]:!pb-0 [&>p]:!pt-2":""}`,...Rr(...v),ref:m,children:[r,x.jsxs("div",{className:"section-args-nested section-key-value relative grid gap-y-1",children:[x.jsx("div",{className:"absolute bottom-0 h-[calc(100%_-_0.1rem)] w-[0.4rem] rounded-full bg-setta-200/20 dark:bg-setta-400/20"}),x.jsx(_L,{sectionId:t,paramIds:a,requiredParamIdsToPaths:n,onResizeStart:i})]})]})}const Pvt=ke.memo(Tvt);function Avt(t,e){const n=_.useRef(),r=_.useRef(),i=_.useRef();return _.useEffect(()=>jm.subscribe(s=>s[t],s=>{n.current&&(n.current.style.gridTemplateColumns=`minmax(min-content, ${s}px) [c3] 0.75rem [c4] 1fr [c5]`),i.current&&(i.current.style.gridTemplateColumns=`[c1] 0.75rem [c2] minmax(min-content, ${s}px) [c3] 0.75rem [c4] 1fr [c5]`),r.current&&(r.current.style.width=`${s}px`)},{fireImmediately:!0}),[e.length>0]),{childlessRef:n,childlessNameRef:r,parentRef:i}}function Rvt({paramInfoId:t}){function e(n){Wct(n,t)}return x.jsx(bze,{className:"section-key-value grid-row-start-1 group/ w-45overflow-y-clip ml-auto aspect-square cursor-help rounded-full bg-red-500/80 px-0.5 pb-0.5 pt-[1px] text-white peer-focus-within/textinput:text-red-100 peer-focus-within/textinput:!opacity-20 dark:bg-red-700/80 dark:peer-focus-within/textinput:text-red-400",onContextMenu:e})}ke.forwardRef(({children:t,...e},n)=>x.jsx(q3,{className:`focus-within:relative focus-within:z-10
374
374
  `,...e,ref:n,children:t}));ke.forwardRef(({children:t,className:e,...n},r)=>x.jsx(Qfe,{className:"flex",children:x.jsx(X3,{...n,ref:r,asChild:!0,children:x.jsx("i",{className:"group ml-auto flex h-4 cursor-default items-center overflow-hidden rounded-full bg-red-500 pl-[2px] pr-1 font-mono text-xs font-bold text-red-50 outline-none transition-all hover:cursor-help dark:bg-red-800",children:x.jsx(Oze,{className:"ease-[cubic-bezier(0.87, 0, 0.13, 1)] ml-auto transition-transform duration-300 group-data-[state=closed]:rotate-180"})})})}));ke.forwardRef(({children:t,className:e,...n},r)=>x.jsxs(IO,{className:"grid-row-start-2 nowheel nodrag relative -mb-1 overflow-hidden rounded-b-sm bg-white px-1 text-xs dark:bg-setta-950",...n,ref:r,children:[x.jsx("aside",{className:"mt-1 h-full cursor-text select-text overflow-y-scroll pb-2 pt-[.15rem] font-mono dark:text-setta-100",children:t}),x.jsx(Fa,{twClasses:"absolute right-1 bottom-1.5 h-3 w-3 cursor-pointer text-setta-400 dark:text-setta-200 hover:text-setta-600 dark:hover:text-white",bg:"bg-transparent hover:bg-setta-100 dark:hover:bg-setta-600",icon:x.jsx(U5,{}),onClick:()=>navigator.clipboard.writeText(t)})]}));function $vt({border:t,bg:e,sectionId:n,paramInfoId:r,hasChildren:i,onMouseDown:s}){const{configLanguage:o,name:a,variantIsFrozen:l}=te(d=>({variantIsFrozen:Yt(n,d).isFrozen,configLanguage:d.x[n].configLanguage,name:d.codeInfo[r].name}),ae.isEqual);function c(d){te.setState(p=>{p.codeInfo[r].name=d})}function u(d){d||tg(null,n,!1)}const h=Ut(d=>d.isSelectingParams)||l;return x.jsxs(x.Fragment,{children:[x.jsx(nk,{dataSectionId:n,visualSectionId:n,paramInfoId:r,value:a,defaultVal:"Please Enter Key",onChange:c,onEscape:u,dummyCodeClassName:`${e} ${t} min-w-0 self-end truncate placeholder:text-setta-300 dark:placeholder:text-setta-600 ${i?"section-key-value grid-row-start-1 px-[2px]":"section-key"} nodrag peer/nameinput ${h?"":"cursor-text select-text"} break-words py-[.125rem] font-mono text-xs [tab-size:4] [word-break:break-word] dark:focus-visible:border-blue-400`,realCodeClassName:`nodrag cursor-text self-end select-text [&_*]:!outline-0 [&_.cm-activeLine]:!px-0 [&_.cm-activeLine]:!bg-setta-200/10 [&_.cm-content]:!py-0 [&_.cm-content]:!px-0 [&_.cm-line]:!px-0 [&_.cm-content]:text-xs min-w-0 truncate placeholder:text-setta-300 dark:placeholder:text-setta-600 py-[.125rem] ${i?"section-key-value grid-row-start-1 px-[2px]":"section-key"} peer/nameinput font-mono dark:focus-visible:border-blue-400`,color:"green",language:o,evRefs:[],initializeGenCode:!1,autocomplete:!1,isKeyName:!0,isDisabled:h,onMouseDown:s}),x.jsx("span",{className:`${i?"section-key-value grid-row-start-1 mx-[2px]":"section-key"} border-box self-end border-b border-setta-200/50 peer-focus-within/nameinput:border-blue-400 dark:border-setta-600/30`})]})}function Mvt({sectionId:t,paramInfoId:e,onMouseDown:n,bg:r}){const i=te(o=>o.codeInfo[e].name);function s(){if(Ut.getState().isSelectingParams)return;const o=document.getElementById(`${t}-${e}-ParamInput`);o&&o.focus({preventScroll:!0})}return x.jsx("p",{className:`${r} cursor-pointer truncate py-[.125rem] font-sans text-xs font-semibold text-setta-800 dark:text-setta-200`,onClick:s,onMouseDownCapture:n,children:i})}function Ivt(t){const{sectionId:e,paramInfoId:n}=t,r=gp(g=>{var m;return(m=g.errors[e])==null?void 0:m[n]}),{isFocusedSearchResult:i,isSearchResult:s}=Ic(g=>({isFocusedSearchResult:g.focused.sectionId===e&&g.focused.paramInfoId===n,isSearchResult:g.lookup.has(Ese(e,n))}),ae.isEqual),{paramIsSelected:o,isKwarg:a,paramChildren:l}=te(g=>{const m=Qne(e,g).children;return{paramIsSelected:g.codeInfo[n].isSelected,isKwarg:g.codeInfo[n].editable,paramChildren:m[n]??[]}},ae.isEqual),c=l.length>0,u=_.useCallback(g=>{Ut.getState().isSelectingParams&&(g.stopPropagation(),TFe(e,n))},[e,n]),f=c?u:void 0,h=u,d=o?"transition-colors active:!bg-cyan-300 !bg-blue-700 [&_*]:!text-white rounded-sm":"transition-colors rounded-sm",p=r?"bg-red-200 dark:bg-red-800/30":i?"outline outline-4 outline-green-500 dark:outline-green-500/80":s?"outline outline-4 outline-blue-500 dark:outline-cyan-300/80":"";return x.jsx(Pvt,{...t,isKwarg:a,paramChildren:l,onMouseDown:h,maybeErrorMessage:r,border:p,bg:d,children:a?x.jsx($vt,{sectionId:e,paramInfoId:n,hasChildren:c,onMouseDown:f,border:c?p:"",bg:c?d:""}):x.jsx(Mvt,{sectionId:e,paramInfoId:n,onMouseDown:f,bg:c?d:""})})}const Dvt=ke.memo(Ivt);function _L({sectionId:t,paramIds:e,requiredParamIdsToPaths:n,onResizeStart:r,isTopLevel:i=!1}){return te(o=>{let a=e;if(o.x[t].paramFilter){const c=Object.keys(n).map(u=>({id:u,name:o.codeInfo[u].name}));a=rg(c,o.x[t].paramFilter,{keys:["name"]})}const l=new Set;for(const c of a){const u=n[c.hasOwnProperty("id")?c.id:c];if(u)for(const f of u)l.add(f)}return e.filter(c=>l.has(c))},ae.isEqual).map((o,a)=>x.jsx(Dvt,{sectionId:t,paramInfoId:o,requiredParamIdsToPaths:n,onResizeStart:r,isTopLevelWithPad:i&&a>0},o))}function Lvt({sectionId:t}){const e=_.useRef(),[n,r]=_.useState({pinned:1,unpinned:1}),i=wXe(t,e,Math.max(n.pinned,n.unpinned)),s=jlt(t);return x.jsx("div",{className:"section-w-full section-row-pin-main -mt-3 flex flex-col overflow-y-hidden pt-2",ref:e,children:s?x.jsx("i",{className:"section-args gg-spinner mt-3 !scale-100 place-self-center before:!border-t-blue-500 after:!border-blue-500"}):x.jsxs(x.Fragment,{children:[x.jsx(Nvt,{sectionId:t,outerRef:e,handleColumnResizeStart:i,setMaxNestedDepth:r}),x.jsx(jvt,{sectionId:t,handleColumnResizeStart:i,setMaxNestedDepth:r})]})})}const ype=ke.memo(Lvt);function Nvt({sectionId:t,outerRef:e,handleColumnResizeStart:n,setMaxNestedDepth:r}){const{requiredParamIdsToPaths:i,topLevelParamIds:s}=vfe(t,!0),o=bpe(i);return _.useEffect(()=>{r(a=>({...a,pinned:o}))},[o]),s.length>0&&x.jsx(Qvt,{sectionId:t,topLevelParamIds:s,requiredParamIdsToPaths:i,outerRef:e,handleColumnResizeStart:n})}function Qvt({sectionId:t,topLevelParamIds:e,requiredParamIdsToPaths:n,outerRef:r,handleColumnResizeStart:i}){var d;const{sectionHeight:s,height:o}=te(p=>({sectionHeight:p.x[t].size.height,height:p.x[t].pinnedAreaHeight}),ae.isEqual),[a,l]=_.useState(DA);function c(...p){const{height:g}=n0e({props:p,minHeight:"auto",sizeMode:{height:ks.any}});te.setState(m=>{m.x[t].pinnedAreaHeight=g})}_.useEffect(()=>{l(r.current.clientHeight)},[]);const u=s==="auto"?DA:((d=r.current)==null?void 0:d.clientHeight)??a,{ref:f,isScrollable:h}=dg();return x.jsxs(eL,{handleWrapperClass:"nodrag",className:"relative -mt-1 flex max-h-[50%] w-full flex-col items-start border-b border-white bg-blue-200/50 pb-3 pt-4 shadow-sm dark:border-setta-700/30 dark:bg-blue-950/30",as:"section",size:{height:o},onResizeStop:c,minHeight:hht,maxHeight:u,enable:{top:!1,left:!1,bottom:!0,right:!1,topRight:!1,bottomRight:!1,topLeft:!1,bottomLeft:!1},handleClasses:{bottom:`${Cl} ${Kp}`},children:[x.jsxs("header",{className:"flex w-full gap-1 px-2",children:[x.jsx("i",{className:"gg-pin-alt scale-25 ml-1 mr-[0.1rem] mt-[0.3rem] text-setta-300 after:text-setta-300 dark:text-setta-500 dark:after:text-setta-500"}),x.jsx("p",{className:" text-[0.5rem] font-bold uppercase text-setta-300 dark:text-setta-500",children:"Pinned Params"})]}),x.jsx("div",{className:`${h?"nowheel":""} section-args-nested section-key-value section-min-rows grid w-full grid-cols-subgrid gap-y-1 overflow-y-scroll pr-1.5`,ref:f,children:x.jsx(_L,{sectionId:t,paramIds:e,requiredParamIdsToPaths:n,onResizeStart:i,isTopLevel:!0})})]})}function jvt({sectionId:t,handleColumnResizeStart:e,setMaxNestedDepth:n}){const{ref:r,isScrollable:i}=dg(),s=te(o=>o.x[t].hideUnpinnedParams);return x.jsx("div",{className:`section-args-nested grid auto-rows-min grid-cols-subgrid gap-y-1 overflow-x-clip overflow-y-scroll py-2 pr-1.5 ${i?"nowheel":""} min-w-0 !max-w-full`,ref:r,children:!s&&x.jsx(Bvt,{sectionId:t,onResizeStart:e,setMaxNestedDepth:n})})}function Bvt({sectionId:t,onResizeStart:e,setMaxNestedDepth:n}){const{requiredParamIdsToPaths:r,topLevelParamIds:i}=vfe(t,!1),s=bpe(r);return _.useEffect(()=>{n(o=>({...o,unpinned:s}))},[s]),x.jsx(_L,{sectionId:t,paramIds:i,requiredParamIdsToPaths:r,onResizeStart:e,isTopLevel:!0})}function bpe(t){return Object.values(t).reduce((e,n)=>n.length>e?n.length:e,0)}function xpe({sectionId:t,objInfoId:e,bgColor:n="bg-transparent"}){const r=C5(t),i=Fvt(t,e),s=Wvt(t,e),o=()=>{CFe(t),hn(!0)};function a(){EFe(t),hn(!0)}const l="focus-visible:ring-2 flex nodrag cursor-pointer bg-transparent text-setta-500 hover:text-blue-500 dark:hover:text-blue-500 w-[18px] rounded-full items-center justify-center";return x.jsx(x.Fragment,{children:x.jsxs("section",{className:`section-args z-10 mt-1 flex min-w-0 flex-wrap rounded-xl border-b border-solid border-white px-1 pb-1 shadow-sm @container dark:border-setta-700 ${n}`,children:[x.jsx("article",{className:"flex flex-wrap items-center",children:x.jsxs("section",{className:"ml-1 flex",children:[x.jsx("button",{className:l,onClick:s,tabIndex:"0",disabled:r,children:x.jsx("i",{className:"gg-math-minus before:!left-0 "})}),x.jsx("button",{className:l,onClick:i,tabIndex:"0",disabled:r,children:x.jsx("i",{className:"gg-math-plus !scale-50"})}),x.jsx("button",{className:l,onClick:a,tabIndex:"0",children:x.jsx("i",{className:"gg-pin-alt mt-1 !scale-50"})}),x.jsx("button",{className:l,onClick:o,tabIndex:"0",disabled:r,children:x.jsx("i",{className:"gg-close !scale-50"})})]})}),x.jsx(zvt,{sectionId:t})]})})}function zvt({sectionId:t}){const e=te(s=>s.x[t].paramFilter),n=ir(s=>ae.isEqual(s.ids,[t])),r=Nt(s=>Br(s.shortcuts.searchShortcut));function i(s){te.setState(o=>{o.x[t].paramFilter=s.target.value})}return x.jsxs("search",{className:"nodrag relative mx-2 flex min-w-8 flex-1 items-center justify-self-center ",children:[x.jsx("i",{className:"gg-sort-az -mr-2 text-setta-300 dark:text-setta-600"}),x.jsx("input",{id:`${t}-args-filter`,value:e,className:"min-w-0 flex-1 cursor-auto truncate border-solid border-transparent bg-transparent py-1 pl-3 text-xs text-setta-700 placeholder-setta-400 outline-0 [border-width:0_0_1px_0] focus-visible:border-blue-300 dark:text-setta-300",placeholder:`${n?r:"Filter"}`,tabIndex:"0",onChange:i,onKeyDown:s=>{s.code==="Escape"&&(s.target.blur(),tg(null,t,!1))}})]})}function Fvt(t,e){return()=>{te.setState(n=>{function r({sectionId:s,parentId:o,idx:a,state:l}){UW({sectionId:s,parentId:o,insertIdx:a+1,state:l})}wpe(t,n,r)||UW({sectionId:t,parentId:e,state:n})}),hn(!0)}}function Wvt(t,e){return()=>{te.setState(n=>{let r=[];function i({codeInfoChildren:o,parentId:a,idx:l}){a&&r.push(o[a][l+1])}wpe(t,n,i)?F$(t,r,n):kFe({sectionId:t,parentId:e,state:n})}),hn(!0)}}function wpe(t,e,n){const{ids:r}=oI(t,e);if(r.length>0){const{codeInfoColId:i}=Yt(t,e),s=e.codeInfoCols[i].children;for(const o of r){let a,l;for(const[c,u]of Object.entries(s))if(u.includes(o)){a=c,l=u.indexOf(o);break}n({codeInfoChildren:s,sectionId:t,parentId:a,idx:l,state:e})}return!0}return!1}function Vvt({sectionId:t,bgColor:e}){return fk(t)?x.jsx(wL,{sectionId:t}):x.jsxs(x.Fragment,{children:[x.jsx(xpe,{sectionId:t,objInfoId:null,bgColor:e}),x.jsx(ype,{sectionId:t})]})}const Uvt=ke.memo(Vvt);function qvt({sectionId:t}){const e=te(r=>r.x[t].iframeCode),n=_.useRef(null);return _.useEffect(()=>{if(!n.current)return;const r=new ResizeObserver(i=>{for(const s of i){const{width:o,height:a}=s.contentRect,l=n.current.querySelector("iframe");l&&(l.style.width=`${o}px`,l.style.height=`${a}px`)}});return r.observe(n.current),()=>{r.disconnect()}},[e]),!e||Hvt(e)?null:x.jsx("div",{className:"section-main mb-2 mt-1.5 overflow-clip rounded-md",ref:n,children:x.jsx("div",{dangerouslySetInnerHTML:{__html:e}})})}const Xvt=ke.memo(qvt),Hvt=t=>t.toLowerCase().includes("<iframe")?["onerror","onload","onclick","onmouseover","javascript:"].some(n=>t.toLowerCase().includes(n))?"Script events are not allowed in iframe code":"":"Input must contain an iframe tag";function Zvt({sectionId:t}){const e=Afe(t,s=>ae.pick(s,["value"])),n=Object.values(e)[0],{getRootProps:r,isDragActive:i}=gD(t,!1,"img");return x.jsx("figure",{className:`section-w-full section-row-main flex overflow-clip px-3 pb-1 pt-1 ${i?"outline outline-4 outline-green-500 dark:outline-green-500/80":""}`,...r(),children:!!n&&x.jsx(Yvt,{sectionId:t,image:n.value})})}function Yvt({sectionId:t,image:e}){return vht(t,e)&&x.jsx("img",{src:e.src,className:"h-auto max-h-full w-full self-center object-contain"})}const Gvt=ke.memo(Zvt);function rZ(t){const e=[],n=String(t||"");let r=n.indexOf(","),i=0,s=!1;for(;!s;){r===-1&&(r=n.length,s=!0);const o=n.slice(i,r).trim();(o||!s)&&e.push(o),i=r+1,r=n.indexOf(",",i)}return e}function Kvt(t,e){const n=e||{};return(t[t.length-1]===""?[...t,""]:t).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const Jvt=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,eOt=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,tOt={};function iZ(t,e){return((e||tOt).jsx?eOt:Jvt).test(t)}const nOt=/[ \t\n\f\r]/g;function rOt(t){return typeof t=="object"?t.type==="text"?sZ(t.value):!1:sZ(t)}function sZ(t){return t.replace(nOt,"")===""}class cb{constructor(e,n,r){this.property=e,this.normal=n,r&&(this.space=r)}}cb.prototype.property={};cb.prototype.normal={};cb.prototype.space=null;function Spe(t,e){const n={},r={};let i=-1;for(;++i<t.length;)Object.assign(n,t[i].property),Object.assign(r,t[i].normal);return new cb(n,r,e)}function YO(t){return t.toLowerCase()}class aa{constructor(e,n){this.property=e,this.attribute=n}}aa.prototype.space=null;aa.prototype.boolean=!1;aa.prototype.booleanish=!1;aa.prototype.overloadedBoolean=!1;aa.prototype.number=!1;aa.prototype.commaSeparated=!1;aa.prototype.spaceSeparated=!1;aa.prototype.commaOrSpaceSeparated=!1;aa.prototype.mustUseProperty=!1;aa.prototype.defined=!1;let iOt=0;const Dt=e0(),Nr=e0(),_pe=e0(),Ue=e0(),Nn=e0(),$p=e0(),Ys=e0();function e0(){return 2**++iOt}const e9=Object.freeze(Object.defineProperty({__proto__:null,boolean:Dt,booleanish:Nr,commaOrSpaceSeparated:Ys,commaSeparated:$p,number:Ue,overloadedBoolean:_pe,spaceSeparated:Nn},Symbol.toStringTag,{value:"Module"})),dE=Object.keys(e9);class kL extends aa{constructor(e,n,r,i){let s=-1;if(super(e,n),oZ(this,"space",i),typeof r=="number")for(;++s<dE.length;){const o=dE[s];oZ(this,dE[s],(r&e9[o])===e9[o])}}}kL.prototype.defined=!0;function oZ(t,e,n){n&&(t[e]=n)}const sOt={}.hasOwnProperty;function pg(t){const e={},n={};let r;for(r in t.properties)if(sOt.call(t.properties,r)){const i=t.properties[r],s=new kL(r,t.transform(t.attributes||{},r),i,t.space);t.mustUseProperty&&t.mustUseProperty.includes(r)&&(s.mustUseProperty=!0),e[r]=s,n[YO(r)]=r,n[YO(s.attribute)]=r}return new cb(e,n,t.space)}const kpe=pg({space:"xlink",transform(t,e){return"xlink:"+e.slice(5).toLowerCase()},properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null}}),Cpe=pg({space:"xml",transform(t,e){return"xml:"+e.slice(3).toLowerCase()},properties:{xmlLang:null,xmlBase:null,xmlSpace:null}});function Epe(t,e){return e in t?t[e]:e}function Tpe(t,e){return Epe(t,e.toLowerCase())}const Ppe=pg({space:"xmlns",attributes:{xmlnsxlink:"xmlns:xlink"},transform:Tpe,properties:{xmlns:null,xmlnsXLink:null}}),Ape=pg({transform(t,e){return e==="role"?e:"aria-"+e.slice(4).toLowerCase()},properties:{ariaActiveDescendant:null,ariaAtomic:Nr,ariaAutoComplete:null,ariaBusy:Nr,ariaChecked:Nr,ariaColCount:Ue,ariaColIndex:Ue,ariaColSpan:Ue,ariaControls:Nn,ariaCurrent:null,ariaDescribedBy:Nn,ariaDetails:null,ariaDisabled:Nr,ariaDropEffect:Nn,ariaErrorMessage:null,ariaExpanded:Nr,ariaFlowTo:Nn,ariaGrabbed:Nr,ariaHasPopup:null,ariaHidden:Nr,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Nn,ariaLevel:Ue,ariaLive:null,ariaModal:Nr,ariaMultiLine:Nr,ariaMultiSelectable:Nr,ariaOrientation:null,ariaOwns:Nn,ariaPlaceholder:null,ariaPosInSet:Ue,ariaPressed:Nr,ariaReadOnly:Nr,ariaRelevant:null,ariaRequired:Nr,ariaRoleDescription:Nn,ariaRowCount:Ue,ariaRowIndex:Ue,ariaRowSpan:Ue,ariaSelected:Nr,ariaSetSize:Ue,ariaSort:null,ariaValueMax:Ue,ariaValueMin:Ue,ariaValueNow:Ue,ariaValueText:null,role:null}}),oOt=pg({space:"html",attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},transform:Tpe,mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:$p,acceptCharset:Nn,accessKey:Nn,action:null,allow:null,allowFullScreen:Dt,allowPaymentRequest:Dt,allowUserMedia:Dt,alt:null,as:null,async:Dt,autoCapitalize:null,autoComplete:Nn,autoFocus:Dt,autoPlay:Dt,blocking:Nn,capture:null,charSet:null,checked:Dt,cite:null,className:Nn,cols:Ue,colSpan:null,content:null,contentEditable:Nr,controls:Dt,controlsList:Nn,coords:Ue|$p,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Dt,defer:Dt,dir:null,dirName:null,disabled:Dt,download:_pe,draggable:Nr,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Dt,formTarget:null,headers:Nn,height:Ue,hidden:Dt,high:Ue,href:null,hrefLang:null,htmlFor:Nn,httpEquiv:Nn,id:null,imageSizes:null,imageSrcSet:null,inert:Dt,inputMode:null,integrity:null,is:null,isMap:Dt,itemId:null,itemProp:Nn,itemRef:Nn,itemScope:Dt,itemType:Nn,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Dt,low:Ue,manifest:null,max:null,maxLength:Ue,media:null,method:null,min:null,minLength:Ue,multiple:Dt,muted:Dt,name:null,nonce:null,noModule:Dt,noValidate:Dt,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:Dt,optimum:Ue,pattern:null,ping:Nn,placeholder:null,playsInline:Dt,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Dt,referrerPolicy:null,rel:Nn,required:Dt,reversed:Dt,rows:Ue,rowSpan:Ue,sandbox:Nn,scope:null,scoped:Dt,seamless:Dt,selected:Dt,shadowRootDelegatesFocus:Dt,shadowRootMode:null,shape:null,size:Ue,sizes:null,slot:null,span:Ue,spellCheck:Nr,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Ue,step:null,style:null,tabIndex:Ue,target:null,title:null,translate:null,type:null,typeMustMatch:Dt,useMap:null,value:Nr,width:Ue,wrap:null,align:null,aLink:null,archive:Nn,axis:null,background:null,bgColor:null,border:Ue,borderColor:null,bottomMargin:Ue,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Dt,declare:Dt,event:null,face:null,frame:null,frameBorder:null,hSpace:Ue,leftMargin:Ue,link:null,longDesc:null,lowSrc:null,marginHeight:Ue,marginWidth:Ue,noResize:Dt,noHref:Dt,noShade:Dt,noWrap:Dt,object:null,profile:null,prompt:null,rev:null,rightMargin:Ue,rules:null,scheme:null,scrolling:Nr,standby:null,summary:null,text:null,topMargin:Ue,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Ue,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Dt,disableRemotePlayback:Dt,prefix:null,property:null,results:Ue,security:null,unselectable:null}}),aOt=pg({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:Epe,properties:{about:Ys,accentHeight:Ue,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Ue,amplitude:Ue,arabicForm:null,ascent:Ue,attributeName:null,attributeType:null,azimuth:Ue,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Ue,by:null,calcMode:null,capHeight:Ue,className:Nn,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:Ue,diffuseConstant:Ue,direction:null,display:null,dur:null,divisor:Ue,dominantBaseline:null,download:Dt,dx:null,dy:null,edgeMode:null,editable:null,elevation:Ue,enableBackground:null,end:null,event:null,exponent:Ue,externalResourcesRequired:null,fill:null,fillOpacity:Ue,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:$p,g2:$p,glyphName:$p,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Ue,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Ue,horizOriginX:Ue,horizOriginY:Ue,id:null,ideographic:Ue,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Ue,k:Ue,k1:Ue,k2:Ue,k3:Ue,k4:Ue,kernelMatrix:Ys,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Ue,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:Ue,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:Ue,overlineThickness:Ue,paintOrder:null,panose1:null,path:null,pathLength:Ue,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Nn,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Ue,pointsAtY:Ue,pointsAtZ:Ue,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Ys,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Ys,rev:Ys,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Ys,requiredFeatures:Ys,requiredFonts:Ys,requiredFormats:Ys,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:Ue,specularExponent:Ue,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Ue,strikethroughThickness:Ue,string:null,stroke:null,strokeDashArray:Ys,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Ue,strokeOpacity:Ue,strokeWidth:null,style:null,surfaceScale:Ue,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Ys,tabIndex:Ue,tableValues:null,target:null,targetX:Ue,targetY:Ue,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Ys,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Ue,underlineThickness:Ue,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Ue,values:null,vAlphabetic:Ue,vMathematical:Ue,vectorEffect:null,vHanging:Ue,vIdeographic:Ue,version:null,vertAdvY:Ue,vertOriginX:Ue,vertOriginY:Ue,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Ue,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null}}),lOt=/^data[-\w.:]+$/i,aZ=/-[a-z]/g,cOt=/[A-Z]/g;function Rpe(t,e){const n=YO(e);let r=e,i=aa;if(n in t.normal)return t.property[t.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&lOt.test(e)){if(e.charAt(4)==="-"){const s=e.slice(5).replace(aZ,fOt);r="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=e.slice(4);if(!aZ.test(s)){let o=s.replace(cOt,uOt);o.charAt(0)!=="-"&&(o="-"+o),e="data"+o}}i=kL}return new i(r,e)}function uOt(t){return"-"+t.toLowerCase()}function fOt(t){return t.charAt(1).toUpperCase()}const hOt={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},$pe=Spe([Cpe,kpe,Ppe,Ape,oOt],"html"),hk=Spe([Cpe,kpe,Ppe,Ape,aOt],"svg");function lZ(t){const e=String(t||"").trim();return e?e.split(/[ \t\n\r\f]+/g):[]}function dOt(t){return t.join(" ").trim()}var Mpe={},cZ=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,pOt=/\n/g,mOt=/^\s*/,gOt=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,vOt=/^:\s*/,OOt=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,yOt=/^[;\s]*/,bOt=/^\s+|\s+$/g,xOt=`
375
375
  `,uZ="/",fZ="*",zh="",wOt="comment",SOt="declaration",_Ot=function(t,e){if(typeof t!="string")throw new TypeError("First argument must be a string");if(!t)return[];e=e||{};var n=1,r=1;function i(p){var g=p.match(pOt);g&&(n+=g.length);var m=p.lastIndexOf(xOt);r=~m?p.length-m:r+p.length}function s(){var p={line:n,column:r};return function(g){return g.position=new o(p),c(),g}}function o(p){this.start=p,this.end={line:n,column:r},this.source=e.source}o.prototype.content=t;function a(p){var g=new Error(e.source+":"+n+":"+r+": "+p);if(g.reason=p,g.filename=e.source,g.line=n,g.column=r,g.source=t,!e.silent)throw g}function l(p){var g=p.exec(t);if(g){var m=g[0];return i(m),t=t.slice(m.length),g}}function c(){l(mOt)}function u(p){var g;for(p=p||[];g=f();)g!==!1&&p.push(g);return p}function f(){var p=s();if(!(uZ!=t.charAt(0)||fZ!=t.charAt(1))){for(var g=2;zh!=t.charAt(g)&&(fZ!=t.charAt(g)||uZ!=t.charAt(g+1));)++g;if(g+=2,zh===t.charAt(g-1))return a("End of comment missing");var m=t.slice(2,g-2);return r+=2,i(m),t=t.slice(g),r+=2,p({type:wOt,comment:m})}}function h(){var p=s(),g=l(gOt);if(g){if(f(),!l(vOt))return a("property missing ':'");var m=l(OOt),v=p({type:SOt,property:hZ(g[0].replace(cZ,zh)),value:m?hZ(m[0].replace(cZ,zh)):zh});return l(yOt),v}}function d(){var p=[];u(p);for(var g;g=h();)g!==!1&&(p.push(g),u(p));return p}return c(),d()};function hZ(t){return t?t.replace(bOt,zh):zh}var kOt=Qu&&Qu.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Mpe,"__esModule",{value:!0});var dZ=Mpe.default=EOt,COt=kOt(_Ot);function EOt(t,e){var n=null;if(!t||typeof t!="string")return n;var r=(0,COt.default)(t),i=typeof e=="function";return r.forEach(function(s){if(s.type==="declaration"){var o=s.property,a=s.value;i?e(o,a,s):a&&(n=n||{},n[o]=a)}}),n}const TOt=dZ.default||dZ,Ipe=Dpe("end"),CL=Dpe("start");function Dpe(t){return e;function e(n){const r=n&&n.position&&n.position[t]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function POt(t){const e=CL(t),n=Ipe(t);if(e&&n)return{start:e,end:n}}function wv(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?pZ(t.position):"start"in t||"end"in t?pZ(t):"line"in t||"column"in t?t9(t):""}function t9(t){return mZ(t&&t.line)+":"+mZ(t&&t.column)}function pZ(t){return t9(t&&t.start)+"-"+t9(t&&t.end)}function mZ(t){return t&&typeof t=="number"?t:1}class Xi extends Error{constructor(e,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",s={},o=!1;if(n&&("line"in n&&"column"in n?s={place:n}:"start"in n&&"end"in n?s={place:n}:"type"in n?s={ancestors:[n],place:n.position}:s={...n}),typeof e=="string"?i=e:!s.cause&&e&&(o=!0,i=e.message,s.cause=e),!s.ruleId&&!s.source&&typeof r=="string"){const l=r.indexOf(":");l===-1?s.ruleId=r:(s.source=r.slice(0,l),s.ruleId=r.slice(l+1))}if(!s.place&&s.ancestors&&s.ancestors){const l=s.ancestors[s.ancestors.length-1];l&&(s.place=l.position)}const a=s.place&&"start"in s.place?s.place.start:s.place;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=a?a.column:void 0,this.fatal=void 0,this.file,this.message=i,this.line=a?a.line:void 0,this.name=wv(s.place)||"1:1",this.place=s.place||void 0,this.reason=this.message,this.ruleId=s.ruleId||void 0,this.source=s.source||void 0,this.stack=o&&s.cause&&typeof s.cause.stack=="string"?s.cause.stack:"",this.actual,this.expected,this.note,this.url}}Xi.prototype.file="";Xi.prototype.name="";Xi.prototype.reason="";Xi.prototype.message="";Xi.prototype.stack="";Xi.prototype.column=void 0;Xi.prototype.line=void 0;Xi.prototype.ancestors=void 0;Xi.prototype.cause=void 0;Xi.prototype.fatal=void 0;Xi.prototype.place=void 0;Xi.prototype.ruleId=void 0;Xi.prototype.source=void 0;const EL={}.hasOwnProperty,AOt=new Map,ROt=/[A-Z]/g,$Ot=/-([a-z])/g,MOt=new Set(["table","tbody","thead","tfoot","tr"]),IOt=new Set(["td","th"]),Lpe="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function DOt(t,e){if(!e||e.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=e.filePath||void 0;let r;if(e.development){if(typeof e.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=WOt(n,e.jsxDEV)}else{if(typeof e.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof e.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=FOt(n,e.jsx,e.jsxs)}const i={Fragment:e.Fragment,ancestors:[],components:e.components||{},create:r,elementAttributeNameCase:e.elementAttributeNameCase||"react",evaluater:e.createEvaluater?e.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:e.ignoreInvalidStyle||!1,passKeys:e.passKeys!==!1,passNode:e.passNode||!1,schema:e.space==="svg"?hk:$pe,stylePropertyNameCase:e.stylePropertyNameCase||"dom",tableCellAlignToStyle:e.tableCellAlignToStyle!==!1},s=Npe(i,t,void 0);return s&&typeof s!="string"?s:i.create(t,i.Fragment,{children:s||void 0},void 0)}function Npe(t,e,n){if(e.type==="element")return LOt(t,e,n);if(e.type==="mdxFlowExpression"||e.type==="mdxTextExpression")return NOt(t,e);if(e.type==="mdxJsxFlowElement"||e.type==="mdxJsxTextElement")return jOt(t,e,n);if(e.type==="mdxjsEsm")return QOt(t,e);if(e.type==="root")return BOt(t,e,n);if(e.type==="text")return zOt(t,e)}function LOt(t,e,n){const r=t.schema;let i=r;e.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=hk,t.schema=i),t.ancestors.push(e);const s=jpe(t,e.tagName,!1),o=VOt(t,e);let a=PL(t,e);return MOt.has(e.tagName)&&(a=a.filter(function(l){return typeof l=="string"?!rOt(l):!0})),Qpe(t,o,s,e),TL(o,a),t.ancestors.pop(),t.schema=r,t.create(e,s,o,n)}function NOt(t,e){if(e.data&&e.data.estree&&t.evaluater){const r=e.data.estree.body[0];return r.type,t.evaluater.evaluateExpression(r.expression)}GO(t,e.position)}function QOt(t,e){if(e.data&&e.data.estree&&t.evaluater)return t.evaluater.evaluateProgram(e.data.estree);GO(t,e.position)}function jOt(t,e,n){const r=t.schema;let i=r;e.name==="svg"&&r.space==="html"&&(i=hk,t.schema=i),t.ancestors.push(e);const s=e.name===null?t.Fragment:jpe(t,e.name,!0),o=UOt(t,e),a=PL(t,e);return Qpe(t,o,s,e),TL(o,a),t.ancestors.pop(),t.schema=r,t.create(e,s,o,n)}function BOt(t,e,n){const r={};return TL(r,PL(t,e)),t.create(e,t.Fragment,r,n)}function zOt(t,e){return e.value}function Qpe(t,e,n,r){typeof n!="string"&&n!==t.Fragment&&t.passNode&&(e.node=r)}function TL(t,e){if(e.length>0){const n=e.length>1?e:e[0];n&&(t.children=n)}}function FOt(t,e,n){return r;function r(i,s,o,a){const c=Array.isArray(o.children)?n:e;return a?c(s,o,a):c(s,o)}}function WOt(t,e){return n;function n(r,i,s,o){const a=Array.isArray(s.children),l=CL(r);return e(i,s,o,a,{columnNumber:l?l.column-1:void 0,fileName:t,lineNumber:l?l.line:void 0},void 0)}}function VOt(t,e){const n={};let r,i;for(i in e.properties)if(i!=="children"&&EL.call(e.properties,i)){const s=qOt(t,i,e.properties[i]);if(s){const[o,a]=s;t.tableCellAlignToStyle&&o==="align"&&typeof a=="string"&&IOt.has(e.tagName)?r=a:n[o]=a}}if(r){const s=n.style||(n.style={});s[t.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function UOt(t,e){const n={};for(const r of e.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&t.evaluater){const s=r.data.estree.body[0];s.type;const o=s.expression;o.type;const a=o.properties[0];a.type,Object.assign(n,t.evaluater.evaluateExpression(a.argument))}else GO(t,e.position);else{const i=r.name;let s;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&t.evaluater){const a=r.value.data.estree.body[0];a.type,s=t.evaluater.evaluateExpression(a.expression)}else GO(t,e.position);else s=r.value===null?!0:r.value;n[i]=s}return n}function PL(t,e){const n=[];let r=-1;const i=t.passKeys?new Map:AOt;for(;++r<e.children.length;){const s=e.children[r];let o;if(t.passKeys){const l=s.type==="element"?s.tagName:s.type==="mdxJsxFlowElement"||s.type==="mdxJsxTextElement"?s.name:void 0;if(l){const c=i.get(l)||0;o=l+"-"+c,i.set(l,c+1)}}const a=Npe(t,s,o);a!==void 0&&n.push(a)}return n}function qOt(t,e,n){const r=Rpe(t.schema,e);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?Kvt(n):dOt(n)),r.property==="style"){let i=typeof n=="object"?n:XOt(t,String(n));return t.stylePropertyNameCase==="css"&&(i=HOt(i)),["style",i]}return[t.elementAttributeNameCase==="react"&&r.space?hOt[r.property]||r.property:r.attribute,n]}}function XOt(t,e){const n={};try{TOt(e,r)}catch(i){if(!t.ignoreInvalidStyle){const s=i,o=new Xi("Cannot parse `style` attribute",{ancestors:t.ancestors,cause:s,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw o.file=t.filePath||void 0,o.url=Lpe+"#cannot-parse-style-attribute",o}}return n;function r(i,s){let o=i;o.slice(0,2)!=="--"&&(o.slice(0,4)==="-ms-"&&(o="ms-"+o.slice(4)),o=o.replace($Ot,YOt)),n[o]=s}}function jpe(t,e,n){let r;if(!n)r={type:"Literal",value:e};else if(e.includes(".")){const i=e.split(".");let s=-1,o;for(;++s<i.length;){const a=iZ(i[s])?{type:"Identifier",name:i[s]}:{type:"Literal",value:i[s]};o=o?{type:"MemberExpression",object:o,property:a,computed:!!(s&&a.type==="Literal"),optional:!1}:a}r=o}else r=iZ(e)&&!/^[a-z]/.test(e)?{type:"Identifier",name:e}:{type:"Literal",value:e};if(r.type==="Literal"){const i=r.value;return EL.call(t.components,i)?t.components[i]:i}if(t.evaluater)return t.evaluater.evaluateExpression(r);GO(t)}function GO(t,e){const n=new Xi("Cannot handle MDX estrees without `createEvaluater`",{ancestors:t.ancestors,place:e,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=t.filePath||void 0,n.url=Lpe+"#cannot-handle-mdx-estrees-without-createevaluater",n}function HOt(t){const e={};let n;for(n in t)EL.call(t,n)&&(e[ZOt(n)]=t[n]);return e}function ZOt(t){let e=t.replace(ROt,GOt);return e.slice(0,3)==="ms-"&&(e="-"+e),e}function YOt(t,e){return e.toUpperCase()}function GOt(t){return"-"+t.toLowerCase()}const pE={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},KOt={};function AL(t,e){const n=e||KOt,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return Bpe(t,r,i)}function Bpe(t,e,n){if(JOt(t)){if("value"in t)return t.type==="html"&&!n?"":t.value;if(e&&"alt"in t&&t.alt)return t.alt;if("children"in t)return gZ(t.children,e,n)}return Array.isArray(t)?gZ(t,e,n):""}function gZ(t,e,n){const r=[];let i=-1;for(;++i<t.length;)r[i]=Bpe(t[i],e,n);return r.join("")}function JOt(t){return!!(t&&typeof t=="object")}const vZ=document.createElement("i");function RL(t){const e="&"+t+";";vZ.innerHTML=e;const n=vZ.textContent;return n.charCodeAt(n.length-1)===59&&t!=="semi"||n===e?!1:n}function Xo(t,e,n,r){const i=t.length;let s=0,o;if(e<0?e=-e>i?0:i+e:e=e>i?i:e,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(e,n),t.splice(...o);else for(n&&t.splice(e,n);s<r.length;)o=r.slice(s,s+1e4),o.unshift(e,0),t.splice(...o),s+=1e4,e+=1e4}function $o(t,e){return t.length>0?(Xo(t,t.length,0,e),t):e}const OZ={}.hasOwnProperty;function zpe(t){const e={};let n=-1;for(;++n<t.length;)eyt(e,t[n]);return e}function eyt(t,e){let n;for(n in e){const i=(OZ.call(t,n)?t[n]:void 0)||(t[n]={}),s=e[n];let o;if(s)for(o in s){OZ.call(i,o)||(i[o]=[]);const a=s[o];tyt(i[o],Array.isArray(a)?a:a?[a]:[])}}}function tyt(t,e){let n=-1;const r=[];for(;++n<e.length;)(e[n].add==="after"?t:r).push(e[n]);Xo(t,0,0,r)}function Fpe(t,e){const n=Number.parseInt(t,e);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function Ta(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const ss=Jf(/[A-Za-z]/),zi=Jf(/[\dA-Za-z]/),nyt=Jf(/[#-'*+\--9=?A-Z^-~]/);function T4(t){return t!==null&&(t<32||t===127)}const n9=Jf(/\d/),ryt=Jf(/[\dA-Fa-f]/),iyt=Jf(/[!-/:-@[-`{-~]/);function mt(t){return t!==null&&t<-2}function $n(t){return t!==null&&(t<0||t===32)}function Xt(t){return t===-2||t===-1||t===32}const dk=Jf(/\p{P}|\p{S}/u),Td=Jf(/\s/);function Jf(t){return e;function e(n){return n!==null&&n>-1&&t.test(String.fromCharCode(n))}}function mg(t){const e=[];let n=-1,r=0,i=0;for(;++n<t.length;){const s=t.charCodeAt(n);let o="";if(s===37&&zi(t.charCodeAt(n+1))&&zi(t.charCodeAt(n+2)))i=2;else if(s<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(s))||(o=String.fromCharCode(s));else if(s>55295&&s<57344){const a=t.charCodeAt(n+1);s<56320&&a>56319&&a<57344?(o=String.fromCharCode(s,a),i=1):o="�"}else o=String.fromCharCode(s);o&&(e.push(t.slice(r,n),encodeURIComponent(o)),r=n+i+1,o=""),i&&(n+=i,i=0)}return e.join("")+t.slice(r)}function Vt(t,e,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let s=0;return o;function o(l){return Xt(l)?(t.enter(n),a(l)):e(l)}function a(l){return Xt(l)&&s++<i?(t.consume(l),a):(t.exit(n),e(l))}}const syt={tokenize:oyt};function oyt(t){const e=t.attempt(this.parser.constructs.contentInitial,r,i);let n;return e;function r(a){if(a===null){t.consume(a);return}return t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),Vt(t,e,"linePrefix")}function i(a){return t.enter("paragraph"),s(a)}function s(a){const l=t.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=l),n=l,o(a)}function o(a){if(a===null){t.exit("chunkText"),t.exit("paragraph"),t.consume(a);return}return mt(a)?(t.consume(a),t.exit("chunkText"),s):(t.consume(a),o)}}const ayt={tokenize:lyt},yZ={tokenize:cyt};function lyt(t){const e=this,n=[];let r=0,i,s,o;return a;function a(b){if(r<n.length){const S=n[r];return e.containerState=S[1],t.attempt(S[0].continuation,l,c)(b)}return c(b)}function l(b){if(r++,e.containerState._closeFlow){e.containerState._closeFlow=void 0,i&&y();const S=e.events.length;let k=S,E;for(;k--;)if(e.events[k][0]==="exit"&&e.events[k][1].type==="chunkFlow"){E=e.events[k][1].end;break}v(r);let T=S;for(;T<e.events.length;)e.events[T][1].end=Object.assign({},E),T++;return Xo(e.events,k+1,0,e.events.slice(S)),e.events.length=T,c(b)}return a(b)}function c(b){if(r===n.length){if(!i)return h(b);if(i.currentConstruct&&i.currentConstruct.concrete)return p(b);e.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return e.containerState={},t.check(yZ,u,f)(b)}function u(b){return i&&y(),v(r),h(b)}function f(b){return e.parser.lazy[e.now().line]=r!==n.length,o=e.now().offset,p(b)}function h(b){return e.containerState={},t.attempt(yZ,d,p)(b)}function d(b){return r++,n.push([e.currentConstruct,e.containerState]),h(b)}function p(b){if(b===null){i&&y(),v(0),t.consume(b);return}return i=i||e.parser.flow(e.now()),t.enter("chunkFlow",{contentType:"flow",previous:s,_tokenizer:i}),g(b)}function g(b){if(b===null){m(t.exit("chunkFlow"),!0),v(0),t.consume(b);return}return mt(b)?(t.consume(b),m(t.exit("chunkFlow")),r=0,e.interrupt=void 0,a):(t.consume(b),g)}function m(b,S){const k=e.sliceStream(b);if(S&&k.push(null),b.previous=s,s&&(s.next=b),s=b,i.defineSkip(b.start),i.write(k),e.parser.lazy[b.start.line]){let E=i.events.length;for(;E--;)if(i.events[E][1].start.offset<o&&(!i.events[E][1].end||i.events[E][1].end.offset>o))return;const T=e.events.length;let C=T,A,R;for(;C--;)if(e.events[C][0]==="exit"&&e.events[C][1].type==="chunkFlow"){if(A){R=e.events[C][1].end;break}A=!0}for(v(r),E=T;E<e.events.length;)e.events[E][1].end=Object.assign({},R),E++;Xo(e.events,C+1,0,e.events.slice(T)),e.events.length=E}}function v(b){let S=n.length;for(;S-- >b;){const k=n[S];e.containerState=k[1],k[0].exit.call(e,t)}n.length=b}function y(){i.write([null]),s=void 0,i=void 0,e.containerState._closeFlow=void 0}}function cyt(t,e,n){return Vt(t,t.attempt(this.parser.constructs.document,e,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Em(t){if(t===null||$n(t)||Td(t))return 1;if(dk(t))return 2}function pk(t,e,n){const r=[];let i=-1;for(;++i<t.length;){const s=t[i].resolveAll;s&&!r.includes(s)&&(e=s(e,n),r.push(s))}return e}const r9={name:"attention",tokenize:fyt,resolveAll:uyt};function uyt(t,e){let n=-1,r,i,s,o,a,l,c,u;for(;++n<t.length;)if(t[n][0]==="enter"&&t[n][1].type==="attentionSequence"&&t[n][1]._close){for(r=n;r--;)if(t[r][0]==="exit"&&t[r][1].type==="attentionSequence"&&t[r][1]._open&&e.sliceSerialize(t[r][1]).charCodeAt(0)===e.sliceSerialize(t[n][1]).charCodeAt(0)){if((t[r][1]._close||t[n][1]._open)&&(t[n][1].end.offset-t[n][1].start.offset)%3&&!((t[r][1].end.offset-t[r][1].start.offset+t[n][1].end.offset-t[n][1].start.offset)%3))continue;l=t[r][1].end.offset-t[r][1].start.offset>1&&t[n][1].end.offset-t[n][1].start.offset>1?2:1;const f=Object.assign({},t[r][1].end),h=Object.assign({},t[n][1].start);bZ(f,-l),bZ(h,l),o={type:l>1?"strongSequence":"emphasisSequence",start:f,end:Object.assign({},t[r][1].end)},a={type:l>1?"strongSequence":"emphasisSequence",start:Object.assign({},t[n][1].start),end:h},s={type:l>1?"strongText":"emphasisText",start:Object.assign({},t[r][1].end),end:Object.assign({},t[n][1].start)},i={type:l>1?"strong":"emphasis",start:Object.assign({},o.start),end:Object.assign({},a.end)},t[r][1].end=Object.assign({},o.start),t[n][1].start=Object.assign({},a.end),c=[],t[r][1].end.offset-t[r][1].start.offset&&(c=$o(c,[["enter",t[r][1],e],["exit",t[r][1],e]])),c=$o(c,[["enter",i,e],["enter",o,e],["exit",o,e],["enter",s,e]]),c=$o(c,pk(e.parser.constructs.insideSpan.null,t.slice(r+1,n),e)),c=$o(c,[["exit",s,e],["enter",a,e],["exit",a,e],["exit",i,e]]),t[n][1].end.offset-t[n][1].start.offset?(u=2,c=$o(c,[["enter",t[n][1],e],["exit",t[n][1],e]])):u=0,Xo(t,r-1,n-r+3,c),n=r+c.length-u-2;break}}for(n=-1;++n<t.length;)t[n][1].type==="attentionSequence"&&(t[n][1].type="data");return t}function fyt(t,e){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=Em(r);let s;return o;function o(l){return s=l,t.enter("attentionSequence"),a(l)}function a(l){if(l===s)return t.consume(l),a;const c=t.exit("attentionSequence"),u=Em(l),f=!u||u===2&&i||n.includes(l),h=!i||i===2&&u||n.includes(r);return c._open=!!(s===42?f:f&&(i||!h)),c._close=!!(s===42?h:h&&(u||!f)),e(l)}}function bZ(t,e){t.column+=e,t.offset+=e,t._bufferIndex+=e}const hyt={name:"autolink",tokenize:dyt};function dyt(t,e,n){let r=0;return i;function i(d){return t.enter("autolink"),t.enter("autolinkMarker"),t.consume(d),t.exit("autolinkMarker"),t.enter("autolinkProtocol"),s}function s(d){return ss(d)?(t.consume(d),o):d===64?n(d):c(d)}function o(d){return d===43||d===45||d===46||zi(d)?(r=1,a(d)):c(d)}function a(d){return d===58?(t.consume(d),r=0,l):(d===43||d===45||d===46||zi(d))&&r++<32?(t.consume(d),a):(r=0,c(d))}function l(d){return d===62?(t.exit("autolinkProtocol"),t.enter("autolinkMarker"),t.consume(d),t.exit("autolinkMarker"),t.exit("autolink"),e):d===null||d===32||d===60||T4(d)?n(d):(t.consume(d),l)}function c(d){return d===64?(t.consume(d),u):nyt(d)?(t.consume(d),c):n(d)}function u(d){return zi(d)?f(d):n(d)}function f(d){return d===46?(t.consume(d),r=0,u):d===62?(t.exit("autolinkProtocol").type="autolinkEmail",t.enter("autolinkMarker"),t.consume(d),t.exit("autolinkMarker"),t.exit("autolink"),e):h(d)}function h(d){if((d===45||zi(d))&&r++<63){const p=d===45?h:f;return t.consume(d),p}return n(d)}}const ub={tokenize:pyt,partial:!0};function pyt(t,e,n){return r;function r(s){return Xt(s)?Vt(t,i,"linePrefix")(s):i(s)}function i(s){return s===null||mt(s)?e(s):n(s)}}const Wpe={name:"blockQuote",tokenize:myt,continuation:{tokenize:gyt},exit:vyt};function myt(t,e,n){const r=this;return i;function i(o){if(o===62){const a=r.containerState;return a.open||(t.enter("blockQuote",{_container:!0}),a.open=!0),t.enter("blockQuotePrefix"),t.enter("blockQuoteMarker"),t.consume(o),t.exit("blockQuoteMarker"),s}return n(o)}function s(o){return Xt(o)?(t.enter("blockQuotePrefixWhitespace"),t.consume(o),t.exit("blockQuotePrefixWhitespace"),t.exit("blockQuotePrefix"),e):(t.exit("blockQuotePrefix"),e(o))}}function gyt(t,e,n){const r=this;return i;function i(o){return Xt(o)?Vt(t,s,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):s(o)}function s(o){return t.attempt(Wpe,e,n)(o)}}function vyt(t){t.exit("blockQuote")}const Vpe={name:"characterEscape",tokenize:Oyt};function Oyt(t,e,n){return r;function r(s){return t.enter("characterEscape"),t.enter("escapeMarker"),t.consume(s),t.exit("escapeMarker"),i}function i(s){return iyt(s)?(t.enter("characterEscapeValue"),t.consume(s),t.exit("characterEscapeValue"),t.exit("characterEscape"),e):n(s)}}const Upe={name:"characterReference",tokenize:yyt};function yyt(t,e,n){const r=this;let i=0,s,o;return a;function a(f){return t.enter("characterReference"),t.enter("characterReferenceMarker"),t.consume(f),t.exit("characterReferenceMarker"),l}function l(f){return f===35?(t.enter("characterReferenceMarkerNumeric"),t.consume(f),t.exit("characterReferenceMarkerNumeric"),c):(t.enter("characterReferenceValue"),s=31,o=zi,u(f))}function c(f){return f===88||f===120?(t.enter("characterReferenceMarkerHexadecimal"),t.consume(f),t.exit("characterReferenceMarkerHexadecimal"),t.enter("characterReferenceValue"),s=6,o=ryt,u):(t.enter("characterReferenceValue"),s=7,o=n9,u(f))}function u(f){if(f===59&&i){const h=t.exit("characterReferenceValue");return o===zi&&!RL(r.sliceSerialize(h))?n(f):(t.enter("characterReferenceMarker"),t.consume(f),t.exit("characterReferenceMarker"),t.exit("characterReference"),e)}return o(f)&&i++<s?(t.consume(f),u):n(f)}}const xZ={tokenize:xyt,partial:!0},wZ={name:"codeFenced",tokenize:byt,concrete:!0};function byt(t,e,n){const r=this,i={tokenize:k,partial:!0};let s=0,o=0,a;return l;function l(E){return c(E)}function c(E){const T=r.events[r.events.length-1];return s=T&&T[1].type==="linePrefix"?T[2].sliceSerialize(T[1],!0).length:0,a=E,t.enter("codeFenced"),t.enter("codeFencedFence"),t.enter("codeFencedFenceSequence"),u(E)}function u(E){return E===a?(o++,t.consume(E),u):o<3?n(E):(t.exit("codeFencedFenceSequence"),Xt(E)?Vt(t,f,"whitespace")(E):f(E))}function f(E){return E===null||mt(E)?(t.exit("codeFencedFence"),r.interrupt?e(E):t.check(xZ,g,S)(E)):(t.enter("codeFencedFenceInfo"),t.enter("chunkString",{contentType:"string"}),h(E))}function h(E){return E===null||mt(E)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),f(E)):Xt(E)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),Vt(t,d,"whitespace")(E)):E===96&&E===a?n(E):(t.consume(E),h)}function d(E){return E===null||mt(E)?f(E):(t.enter("codeFencedFenceMeta"),t.enter("chunkString",{contentType:"string"}),p(E))}function p(E){return E===null||mt(E)?(t.exit("chunkString"),t.exit("codeFencedFenceMeta"),f(E)):E===96&&E===a?n(E):(t.consume(E),p)}function g(E){return t.attempt(i,S,m)(E)}function m(E){return t.enter("lineEnding"),t.consume(E),t.exit("lineEnding"),v}function v(E){return s>0&&Xt(E)?Vt(t,y,"linePrefix",s+1)(E):y(E)}function y(E){return E===null||mt(E)?t.check(xZ,g,S)(E):(t.enter("codeFlowValue"),b(E))}function b(E){return E===null||mt(E)?(t.exit("codeFlowValue"),y(E)):(t.consume(E),b)}function S(E){return t.exit("codeFenced"),e(E)}function k(E,T,C){let A=0;return R;function R(q){return E.enter("lineEnding"),E.consume(q),E.exit("lineEnding"),Q}function Q(q){return E.enter("codeFencedFence"),Xt(q)?Vt(E,L,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(q):L(q)}function L(q){return q===a?(E.enter("codeFencedFenceSequence"),z(q)):C(q)}function z(q){return q===a?(A++,E.consume(q),z):A>=o?(E.exit("codeFencedFenceSequence"),Xt(q)?Vt(E,B,"whitespace")(q):B(q)):C(q)}function B(q){return q===null||mt(q)?(E.exit("codeFencedFence"),T(q)):C(q)}}}function xyt(t,e,n){const r=this;return i;function i(o){return o===null?n(o):(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),s)}function s(o){return r.parser.lazy[r.now().line]?n(o):e(o)}}const mE={name:"codeIndented",tokenize:Syt},wyt={tokenize:_yt,partial:!0};function Syt(t,e,n){const r=this;return i;function i(c){return t.enter("codeIndented"),Vt(t,s,"linePrefix",4+1)(c)}function s(c){const u=r.events[r.events.length-1];return u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?o(c):n(c)}function o(c){return c===null?l(c):mt(c)?t.attempt(wyt,o,l)(c):(t.enter("codeFlowValue"),a(c))}function a(c){return c===null||mt(c)?(t.exit("codeFlowValue"),o(c)):(t.consume(c),a)}function l(c){return t.exit("codeIndented"),e(c)}}function _yt(t,e,n){const r=this;return i;function i(o){return r.parser.lazy[r.now().line]?n(o):mt(o)?(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),i):Vt(t,s,"linePrefix",4+1)(o)}function s(o){const a=r.events[r.events.length-1];return a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?e(o):mt(o)?i(o):n(o)}}const kyt={name:"codeText",tokenize:Tyt,resolve:Cyt,previous:Eyt};function Cyt(t){let e=t.length-4,n=3,r,i;if((t[n][1].type==="lineEnding"||t[n][1].type==="space")&&(t[e][1].type==="lineEnding"||t[e][1].type==="space")){for(r=n;++r<e;)if(t[r][1].type==="codeTextData"){t[n][1].type="codeTextPadding",t[e][1].type="codeTextPadding",n+=2,e-=2;break}}for(r=n-1,e++;++r<=e;)i===void 0?r!==e&&t[r][1].type!=="lineEnding"&&(i=r):(r===e||t[r][1].type==="lineEnding")&&(t[i][1].type="codeTextData",r!==i+2&&(t[i][1].end=t[r-1][1].end,t.splice(i+2,r-i-2),e-=r-i-2,r=i+2),i=void 0);return t}function Eyt(t){return t!==96||this.events[this.events.length-1][1].type==="characterEscape"}function Tyt(t,e,n){let r=0,i,s;return o;function o(f){return t.enter("codeText"),t.enter("codeTextSequence"),a(f)}function a(f){return f===96?(t.consume(f),r++,a):(t.exit("codeTextSequence"),l(f))}function l(f){return f===null?n(f):f===32?(t.enter("space"),t.consume(f),t.exit("space"),l):f===96?(s=t.enter("codeTextSequence"),i=0,u(f)):mt(f)?(t.enter("lineEnding"),t.consume(f),t.exit("lineEnding"),l):(t.enter("codeTextData"),c(f))}function c(f){return f===null||f===32||f===96||mt(f)?(t.exit("codeTextData"),l(f)):(t.consume(f),c)}function u(f){return f===96?(t.consume(f),i++,u):i===r?(t.exit("codeTextSequence"),t.exit("codeText"),e(f)):(s.type="codeTextData",c(f))}}class Pyt{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(e,r):e>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(e,n,r){const i=n||0;this.setCursor(Math.trunc(e));const s=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&c1(this.left,r),s.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(e){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(e)}pushMany(e){this.setCursor(Number.POSITIVE_INFINITY),c1(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),c1(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e<this.left.length){const n=this.left.splice(e,Number.POSITIVE_INFINITY);c1(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-e,Number.POSITIVE_INFINITY);c1(this.left,n.reverse())}}}function c1(t,e){let n=0;if(e.length<1e4)t.push(...e);else for(;n<e.length;)t.push(...e.slice(n,n+1e4)),n+=1e4}function qpe(t){const e={};let n=-1,r,i,s,o,a,l,c;const u=new Pyt(t);for(;++n<u.length;){for(;n in e;)n=e[n];if(r=u.get(n),n&&r[1].type==="chunkFlow"&&u.get(n-1)[1].type==="listItemPrefix"&&(l=r[1]._tokenizer.events,s=0,s<l.length&&l[s][1].type==="lineEndingBlank"&&(s+=2),s<l.length&&l[s][1].type==="content"))for(;++s<l.length&&l[s][1].type!=="content";)l[s][1].type==="chunkText"&&(l[s][1]._isInFirstContentOfListItem=!0,s++);if(r[0]==="enter")r[1].contentType&&(Object.assign(e,Ayt(u,n)),n=e[n],c=!0);else if(r[1]._container){for(s=n,i=void 0;s--&&(o=u.get(s),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank");)o[0]==="enter"&&(i&&(u.get(i)[1].type="lineEndingBlank"),o[1].type="lineEnding",i=s);i&&(r[1].end=Object.assign({},u.get(i)[1].start),a=u.slice(i,n),a.unshift(r),u.splice(i,n-i+1,a))}}return Xo(t,0,Number.POSITIVE_INFINITY,u.slice(0)),!c}function Ayt(t,e){const n=t.get(e)[1],r=t.get(e)[2];let i=e-1;const s=[],o=n._tokenizer||r.parser[n.contentType](n.start),a=o.events,l=[],c={};let u,f,h=-1,d=n,p=0,g=0;const m=[g];for(;d;){for(;t.get(++i)[1]!==d;);s.push(i),d._tokenizer||(u=r.sliceStream(d),d.next||u.push(null),f&&o.defineSkip(d.start),d._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),d._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),f=d,d=d.next}for(d=n;++h<a.length;)a[h][0]==="exit"&&a[h-1][0]==="enter"&&a[h][1].type===a[h-1][1].type&&a[h][1].start.line!==a[h][1].end.line&&(g=h+1,m.push(g),d._tokenizer=void 0,d.previous=void 0,d=d.next);for(o.events=[],d?(d._tokenizer=void 0,d.previous=void 0):m.pop(),h=m.length;h--;){const v=a.slice(m[h],m[h+1]),y=s.pop();l.push([y,y+v.length-1]),t.splice(y,2,v)}for(l.reverse(),h=-1;++h<l.length;)c[p+l[h][0]]=p+l[h][1],p+=l[h][1]-l[h][0]-1;return c}const Ryt={tokenize:Iyt,resolve:Myt},$yt={tokenize:Dyt,partial:!0};function Myt(t){return qpe(t),t}function Iyt(t,e){let n;return r;function r(a){return t.enter("content"),n=t.enter("chunkContent",{contentType:"content"}),i(a)}function i(a){return a===null?s(a):mt(a)?t.check($yt,o,s)(a):(t.consume(a),i)}function s(a){return t.exit("chunkContent"),t.exit("content"),e(a)}function o(a){return t.consume(a),t.exit("chunkContent"),n.next=t.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,i}}function Dyt(t,e,n){const r=this;return i;function i(o){return t.exit("chunkContent"),t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),Vt(t,s,"linePrefix")}function s(o){if(o===null||mt(o))return n(o);const a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?e(o):t.interrupt(r.parser.constructs.flow,n,e)(o)}}function Xpe(t,e,n,r,i,s,o,a,l){const c=l||Number.POSITIVE_INFINITY;let u=0;return f;function f(v){return v===60?(t.enter(r),t.enter(i),t.enter(s),t.consume(v),t.exit(s),h):v===null||v===32||v===41||T4(v)?n(v):(t.enter(r),t.enter(o),t.enter(a),t.enter("chunkString",{contentType:"string"}),g(v))}function h(v){return v===62?(t.enter(s),t.consume(v),t.exit(s),t.exit(i),t.exit(r),e):(t.enter(a),t.enter("chunkString",{contentType:"string"}),d(v))}function d(v){return v===62?(t.exit("chunkString"),t.exit(a),h(v)):v===null||v===60||mt(v)?n(v):(t.consume(v),v===92?p:d)}function p(v){return v===60||v===62||v===92?(t.consume(v),d):d(v)}function g(v){return!u&&(v===null||v===41||$n(v))?(t.exit("chunkString"),t.exit(a),t.exit(o),t.exit(r),e(v)):u<c&&v===40?(t.consume(v),u++,g):v===41?(t.consume(v),u--,g):v===null||v===32||v===40||T4(v)?n(v):(t.consume(v),v===92?m:g)}function m(v){return v===40||v===41||v===92?(t.consume(v),g):g(v)}}function Hpe(t,e,n,r,i,s){const o=this;let a=0,l;return c;function c(d){return t.enter(r),t.enter(i),t.consume(d),t.exit(i),t.enter(s),u}function u(d){return a>999||d===null||d===91||d===93&&!l||d===94&&!a&&"_hiddenFootnoteSupport"in o.parser.constructs?n(d):d===93?(t.exit(s),t.enter(i),t.consume(d),t.exit(i),t.exit(r),e):mt(d)?(t.enter("lineEnding"),t.consume(d),t.exit("lineEnding"),u):(t.enter("chunkString",{contentType:"string"}),f(d))}function f(d){return d===null||d===91||d===93||mt(d)||a++>999?(t.exit("chunkString"),u(d)):(t.consume(d),l||(l=!Xt(d)),d===92?h:f)}function h(d){return d===91||d===92||d===93?(t.consume(d),a++,f):f(d)}}function Zpe(t,e,n,r,i,s){let o;return a;function a(h){return h===34||h===39||h===40?(t.enter(r),t.enter(i),t.consume(h),t.exit(i),o=h===40?41:h,l):n(h)}function l(h){return h===o?(t.enter(i),t.consume(h),t.exit(i),t.exit(r),e):(t.enter(s),c(h))}function c(h){return h===o?(t.exit(s),l(o)):h===null?n(h):mt(h)?(t.enter("lineEnding"),t.consume(h),t.exit("lineEnding"),Vt(t,c,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),u(h))}function u(h){return h===o||h===null||mt(h)?(t.exit("chunkString"),c(h)):(t.consume(h),h===92?f:u)}function f(h){return h===o||h===92?(t.consume(h),u):u(h)}}function Sv(t,e){let n;return r;function r(i){return mt(i)?(t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),n=!0,r):Xt(i)?Vt(t,r,n?"linePrefix":"lineSuffix")(i):e(i)}}const Lyt={name:"definition",tokenize:Qyt},Nyt={tokenize:jyt,partial:!0};function Qyt(t,e,n){const r=this;let i;return s;function s(d){return t.enter("definition"),o(d)}function o(d){return Hpe.call(r,t,a,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(d)}function a(d){return i=Ta(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),d===58?(t.enter("definitionMarker"),t.consume(d),t.exit("definitionMarker"),l):n(d)}function l(d){return $n(d)?Sv(t,c)(d):c(d)}function c(d){return Xpe(t,u,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(d)}function u(d){return t.attempt(Nyt,f,f)(d)}function f(d){return Xt(d)?Vt(t,h,"whitespace")(d):h(d)}function h(d){return d===null||mt(d)?(t.exit("definition"),r.parser.defined.push(i),e(d)):n(d)}}function jyt(t,e,n){return r;function r(a){return $n(a)?Sv(t,i)(a):n(a)}function i(a){return Zpe(t,s,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function s(a){return Xt(a)?Vt(t,o,"whitespace")(a):o(a)}function o(a){return a===null||mt(a)?e(a):n(a)}}const Byt={name:"hardBreakEscape",tokenize:zyt};function zyt(t,e,n){return r;function r(s){return t.enter("hardBreakEscape"),t.consume(s),i}function i(s){return mt(s)?(t.exit("hardBreakEscape"),e(s)):n(s)}}const Fyt={name:"headingAtx",tokenize:Vyt,resolve:Wyt};function Wyt(t,e){let n=t.length-2,r=3,i,s;return t[r][1].type==="whitespace"&&(r+=2),n-2>r&&t[n][1].type==="whitespace"&&(n-=2),t[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&t[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(i={type:"atxHeadingText",start:t[r][1].start,end:t[n][1].end},s={type:"chunkText",start:t[r][1].start,end:t[n][1].end,contentType:"text"},Xo(t,r,n-r+1,[["enter",i,e],["enter",s,e],["exit",s,e],["exit",i,e]])),t}function Vyt(t,e,n){let r=0;return i;function i(u){return t.enter("atxHeading"),s(u)}function s(u){return t.enter("atxHeadingSequence"),o(u)}function o(u){return u===35&&r++<6?(t.consume(u),o):u===null||$n(u)?(t.exit("atxHeadingSequence"),a(u)):n(u)}function a(u){return u===35?(t.enter("atxHeadingSequence"),l(u)):u===null||mt(u)?(t.exit("atxHeading"),e(u)):Xt(u)?Vt(t,a,"whitespace")(u):(t.enter("atxHeadingText"),c(u))}function l(u){return u===35?(t.consume(u),l):(t.exit("atxHeadingSequence"),a(u))}function c(u){return u===null||u===35||$n(u)?(t.exit("atxHeadingText"),a(u)):(t.consume(u),c)}}const Uyt=["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"],SZ=["pre","script","style","textarea"],qyt={name:"htmlFlow",tokenize:Yyt,resolveTo:Zyt,concrete:!0},Xyt={tokenize:Kyt,partial:!0},Hyt={tokenize:Gyt,partial:!0};function Zyt(t){let e=t.length;for(;e--&&!(t[e][0]==="enter"&&t[e][1].type==="htmlFlow"););return e>1&&t[e-2][1].type==="linePrefix"&&(t[e][1].start=t[e-2][1].start,t[e+1][1].start=t[e-2][1].start,t.splice(e-2,2)),t}function Yyt(t,e,n){const r=this;let i,s,o,a,l;return c;function c(H){return u(H)}function u(H){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(H),f}function f(H){return H===33?(t.consume(H),h):H===47?(t.consume(H),s=!0,g):H===63?(t.consume(H),i=3,r.interrupt?e:M):ss(H)?(t.consume(H),o=String.fromCharCode(H),m):n(H)}function h(H){return H===45?(t.consume(H),i=2,d):H===91?(t.consume(H),i=5,a=0,p):ss(H)?(t.consume(H),i=4,r.interrupt?e:M):n(H)}function d(H){return H===45?(t.consume(H),r.interrupt?e:M):n(H)}function p(H){const de="CDATA[";return H===de.charCodeAt(a++)?(t.consume(H),a===de.length?r.interrupt?e:L:p):n(H)}function g(H){return ss(H)?(t.consume(H),o=String.fromCharCode(H),m):n(H)}function m(H){if(H===null||H===47||H===62||$n(H)){const de=H===47,fe=o.toLowerCase();return!de&&!s&&SZ.includes(fe)?(i=1,r.interrupt?e(H):L(H)):Uyt.includes(o.toLowerCase())?(i=6,de?(t.consume(H),v):r.interrupt?e(H):L(H)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(H):s?y(H):b(H))}return H===45||zi(H)?(t.consume(H),o+=String.fromCharCode(H),m):n(H)}function v(H){return H===62?(t.consume(H),r.interrupt?e:L):n(H)}function y(H){return Xt(H)?(t.consume(H),y):R(H)}function b(H){return H===47?(t.consume(H),R):H===58||H===95||ss(H)?(t.consume(H),S):Xt(H)?(t.consume(H),b):R(H)}function S(H){return H===45||H===46||H===58||H===95||zi(H)?(t.consume(H),S):k(H)}function k(H){return H===61?(t.consume(H),E):Xt(H)?(t.consume(H),k):b(H)}function E(H){return H===null||H===60||H===61||H===62||H===96?n(H):H===34||H===39?(t.consume(H),l=H,T):Xt(H)?(t.consume(H),E):C(H)}function T(H){return H===l?(t.consume(H),l=null,A):H===null||mt(H)?n(H):(t.consume(H),T)}function C(H){return H===null||H===34||H===39||H===47||H===60||H===61||H===62||H===96||$n(H)?k(H):(t.consume(H),C)}function A(H){return H===47||H===62||Xt(H)?b(H):n(H)}function R(H){return H===62?(t.consume(H),Q):n(H)}function Q(H){return H===null||mt(H)?L(H):Xt(H)?(t.consume(H),Q):n(H)}function L(H){return H===45&&i===2?(t.consume(H),Z):H===60&&i===1?(t.consume(H),J):H===62&&i===4?(t.consume(H),X):H===63&&i===3?(t.consume(H),M):H===93&&i===5?(t.consume(H),j):mt(H)&&(i===6||i===7)?(t.exit("htmlFlowData"),t.check(Xyt,se,z)(H)):H===null||mt(H)?(t.exit("htmlFlowData"),z(H)):(t.consume(H),L)}function z(H){return t.check(Hyt,B,se)(H)}function B(H){return t.enter("lineEnding"),t.consume(H),t.exit("lineEnding"),q}function q(H){return H===null||mt(H)?z(H):(t.enter("htmlFlowData"),L(H))}function Z(H){return H===45?(t.consume(H),M):L(H)}function J(H){return H===47?(t.consume(H),o="",I):L(H)}function I(H){if(H===62){const de=o.toLowerCase();return SZ.includes(de)?(t.consume(H),X):L(H)}return ss(H)&&o.length<8?(t.consume(H),o+=String.fromCharCode(H),I):L(H)}function j(H){return H===93?(t.consume(H),M):L(H)}function M(H){return H===62?(t.consume(H),X):H===45&&i===2?(t.consume(H),M):L(H)}function X(H){return H===null||mt(H)?(t.exit("htmlFlowData"),se(H)):(t.consume(H),X)}function se(H){return t.exit("htmlFlow"),e(H)}}function Gyt(t,e,n){const r=this;return i;function i(o){return mt(o)?(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),s):n(o)}function s(o){return r.parser.lazy[r.now().line]?n(o):e(o)}}function Kyt(t,e,n){return r;function r(i){return t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),t.attempt(ub,e,n)}}const Jyt={name:"htmlText",tokenize:ebt};function ebt(t,e,n){const r=this;let i,s,o;return a;function a(M){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(M),l}function l(M){return M===33?(t.consume(M),c):M===47?(t.consume(M),k):M===63?(t.consume(M),b):ss(M)?(t.consume(M),C):n(M)}function c(M){return M===45?(t.consume(M),u):M===91?(t.consume(M),s=0,p):ss(M)?(t.consume(M),y):n(M)}function u(M){return M===45?(t.consume(M),d):n(M)}function f(M){return M===null?n(M):M===45?(t.consume(M),h):mt(M)?(o=f,J(M)):(t.consume(M),f)}function h(M){return M===45?(t.consume(M),d):f(M)}function d(M){return M===62?Z(M):M===45?h(M):f(M)}function p(M){const X="CDATA[";return M===X.charCodeAt(s++)?(t.consume(M),s===X.length?g:p):n(M)}function g(M){return M===null?n(M):M===93?(t.consume(M),m):mt(M)?(o=g,J(M)):(t.consume(M),g)}function m(M){return M===93?(t.consume(M),v):g(M)}function v(M){return M===62?Z(M):M===93?(t.consume(M),v):g(M)}function y(M){return M===null||M===62?Z(M):mt(M)?(o=y,J(M)):(t.consume(M),y)}function b(M){return M===null?n(M):M===63?(t.consume(M),S):mt(M)?(o=b,J(M)):(t.consume(M),b)}function S(M){return M===62?Z(M):b(M)}function k(M){return ss(M)?(t.consume(M),E):n(M)}function E(M){return M===45||zi(M)?(t.consume(M),E):T(M)}function T(M){return mt(M)?(o=T,J(M)):Xt(M)?(t.consume(M),T):Z(M)}function C(M){return M===45||zi(M)?(t.consume(M),C):M===47||M===62||$n(M)?A(M):n(M)}function A(M){return M===47?(t.consume(M),Z):M===58||M===95||ss(M)?(t.consume(M),R):mt(M)?(o=A,J(M)):Xt(M)?(t.consume(M),A):Z(M)}function R(M){return M===45||M===46||M===58||M===95||zi(M)?(t.consume(M),R):Q(M)}function Q(M){return M===61?(t.consume(M),L):mt(M)?(o=Q,J(M)):Xt(M)?(t.consume(M),Q):A(M)}function L(M){return M===null||M===60||M===61||M===62||M===96?n(M):M===34||M===39?(t.consume(M),i=M,z):mt(M)?(o=L,J(M)):Xt(M)?(t.consume(M),L):(t.consume(M),B)}function z(M){return M===i?(t.consume(M),i=void 0,q):M===null?n(M):mt(M)?(o=z,J(M)):(t.consume(M),z)}function B(M){return M===null||M===34||M===39||M===60||M===61||M===96?n(M):M===47||M===62||$n(M)?A(M):(t.consume(M),B)}function q(M){return M===47||M===62||$n(M)?A(M):n(M)}function Z(M){return M===62?(t.consume(M),t.exit("htmlTextData"),t.exit("htmlText"),e):n(M)}function J(M){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(M),t.exit("lineEnding"),I}function I(M){return Xt(M)?Vt(t,j,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(M):j(M)}function j(M){return t.enter("htmlTextData"),o(M)}}const $L={name:"labelEnd",tokenize:obt,resolveTo:sbt,resolveAll:ibt},tbt={tokenize:abt},nbt={tokenize:lbt},rbt={tokenize:cbt};function ibt(t){let e=-1;for(;++e<t.length;){const n=t[e][1];(n.type==="labelImage"||n.type==="labelLink"||n.type==="labelEnd")&&(t.splice(e+1,n.type==="labelImage"?4:2),n.type="data",e++)}return t}function sbt(t,e){let n=t.length,r=0,i,s,o,a;for(;n--;)if(i=t[n][1],s){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;t[n][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(o){if(t[n][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(s=n,i.type!=="labelLink")){r=2;break}}else i.type==="labelEnd"&&(o=n);const l={type:t[s][1].type==="labelLink"?"link":"image",start:Object.assign({},t[s][1].start),end:Object.assign({},t[t.length-1][1].end)},c={type:"label",start:Object.assign({},t[s][1].start),end:Object.assign({},t[o][1].end)},u={type:"labelText",start:Object.assign({},t[s+r+2][1].end),end:Object.assign({},t[o-2][1].start)};return a=[["enter",l,e],["enter",c,e]],a=$o(a,t.slice(s+1,s+r+3)),a=$o(a,[["enter",u,e]]),a=$o(a,pk(e.parser.constructs.insideSpan.null,t.slice(s+r+4,o-3),e)),a=$o(a,[["exit",u,e],t[o-2],t[o-1],["exit",c,e]]),a=$o(a,t.slice(o+1)),a=$o(a,[["exit",l,e]]),Xo(t,s,t.length,a),t}function obt(t,e,n){const r=this;let i=r.events.length,s,o;for(;i--;)if((r.events[i][1].type==="labelImage"||r.events[i][1].type==="labelLink")&&!r.events[i][1]._balanced){s=r.events[i][1];break}return a;function a(h){return s?s._inactive?f(h):(o=r.parser.defined.includes(Ta(r.sliceSerialize({start:s.end,end:r.now()}))),t.enter("labelEnd"),t.enter("labelMarker"),t.consume(h),t.exit("labelMarker"),t.exit("labelEnd"),l):n(h)}function l(h){return h===40?t.attempt(tbt,u,o?u:f)(h):h===91?t.attempt(nbt,u,o?c:f)(h):o?u(h):f(h)}function c(h){return t.attempt(rbt,u,f)(h)}function u(h){return e(h)}function f(h){return s._balanced=!0,n(h)}}function abt(t,e,n){return r;function r(f){return t.enter("resource"),t.enter("resourceMarker"),t.consume(f),t.exit("resourceMarker"),i}function i(f){return $n(f)?Sv(t,s)(f):s(f)}function s(f){return f===41?u(f):Xpe(t,o,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(f)}function o(f){return $n(f)?Sv(t,l)(f):u(f)}function a(f){return n(f)}function l(f){return f===34||f===39||f===40?Zpe(t,c,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(f):u(f)}function c(f){return $n(f)?Sv(t,u)(f):u(f)}function u(f){return f===41?(t.enter("resourceMarker"),t.consume(f),t.exit("resourceMarker"),t.exit("resource"),e):n(f)}}function lbt(t,e,n){const r=this;return i;function i(a){return Hpe.call(r,t,s,o,"reference","referenceMarker","referenceString")(a)}function s(a){return r.parser.defined.includes(Ta(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?e(a):n(a)}function o(a){return n(a)}}function cbt(t,e,n){return r;function r(s){return t.enter("reference"),t.enter("referenceMarker"),t.consume(s),t.exit("referenceMarker"),i}function i(s){return s===93?(t.enter("referenceMarker"),t.consume(s),t.exit("referenceMarker"),t.exit("reference"),e):n(s)}}const ubt={name:"labelStartImage",tokenize:fbt,resolveAll:$L.resolveAll};function fbt(t,e,n){const r=this;return i;function i(a){return t.enter("labelImage"),t.enter("labelImageMarker"),t.consume(a),t.exit("labelImageMarker"),s}function s(a){return a===91?(t.enter("labelMarker"),t.consume(a),t.exit("labelMarker"),t.exit("labelImage"),o):n(a)}function o(a){return a===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(a):e(a)}}const hbt={name:"labelStartLink",tokenize:dbt,resolveAll:$L.resolveAll};function dbt(t,e,n){const r=this;return i;function i(o){return t.enter("labelLink"),t.enter("labelMarker"),t.consume(o),t.exit("labelMarker"),t.exit("labelLink"),s}function s(o){return o===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(o):e(o)}}const gE={name:"lineEnding",tokenize:pbt};function pbt(t,e){return n;function n(r){return t.enter("lineEnding"),t.consume(r),t.exit("lineEnding"),Vt(t,e,"linePrefix")}}const m2={name:"thematicBreak",tokenize:mbt};function mbt(t,e,n){let r=0,i;return s;function s(c){return t.enter("thematicBreak"),o(c)}function o(c){return i=c,a(c)}function a(c){return c===i?(t.enter("thematicBreakSequence"),l(c)):r>=3&&(c===null||mt(c))?(t.exit("thematicBreak"),e(c)):n(c)}function l(c){return c===i?(t.consume(c),r++,l):(t.exit("thematicBreakSequence"),Xt(c)?Vt(t,a,"whitespace")(c):a(c))}}const ws={name:"list",tokenize:Obt,continuation:{tokenize:ybt},exit:xbt},gbt={tokenize:wbt,partial:!0},vbt={tokenize:bbt,partial:!0};function Obt(t,e,n){const r=this,i=r.events[r.events.length-1];let s=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,o=0;return a;function a(d){const p=r.containerState.type||(d===42||d===43||d===45?"listUnordered":"listOrdered");if(p==="listUnordered"?!r.containerState.marker||d===r.containerState.marker:n9(d)){if(r.containerState.type||(r.containerState.type=p,t.enter(p,{_container:!0})),p==="listUnordered")return t.enter("listItemPrefix"),d===42||d===45?t.check(m2,n,c)(d):c(d);if(!r.interrupt||d===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),l(d)}return n(d)}function l(d){return n9(d)&&++o<10?(t.consume(d),l):(!r.interrupt||o<2)&&(r.containerState.marker?d===r.containerState.marker:d===41||d===46)?(t.exit("listItemValue"),c(d)):n(d)}function c(d){return t.enter("listItemMarker"),t.consume(d),t.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||d,t.check(ub,r.interrupt?n:u,t.attempt(gbt,h,f))}function u(d){return r.containerState.initialBlankLine=!0,s++,h(d)}function f(d){return Xt(d)?(t.enter("listItemPrefixWhitespace"),t.consume(d),t.exit("listItemPrefixWhitespace"),h):n(d)}function h(d){return r.containerState.size=s+r.sliceSerialize(t.exit("listItemPrefix"),!0).length,e(d)}}function ybt(t,e,n){const r=this;return r.containerState._closeFlow=void 0,t.check(ub,i,s);function i(a){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Vt(t,e,"listItemIndent",r.containerState.size+1)(a)}function s(a){return r.containerState.furtherBlankLines||!Xt(a)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(a)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,t.attempt(vbt,e,o)(a))}function o(a){return r.containerState._closeFlow=!0,r.interrupt=void 0,Vt(t,t.attempt(ws,e,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function bbt(t,e,n){const r=this;return Vt(t,i,"listItemIndent",r.containerState.size+1);function i(s){const o=r.events[r.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===r.containerState.size?e(s):n(s)}}function xbt(t){t.exit(this.containerState.type)}function wbt(t,e,n){const r=this;return Vt(t,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4+1);function i(s){const o=r.events[r.events.length-1];return!Xt(s)&&o&&o[1].type==="listItemPrefixWhitespace"?e(s):n(s)}}const _Z={name:"setextUnderline",tokenize:_bt,resolveTo:Sbt};function Sbt(t,e){let n=t.length,r,i,s;for(;n--;)if(t[n][0]==="enter"){if(t[n][1].type==="content"){r=n;break}t[n][1].type==="paragraph"&&(i=n)}else t[n][1].type==="content"&&t.splice(n,1),!s&&t[n][1].type==="definition"&&(s=n);const o={type:"setextHeading",start:Object.assign({},t[i][1].start),end:Object.assign({},t[t.length-1][1].end)};return t[i][1].type="setextHeadingText",s?(t.splice(i,0,["enter",o,e]),t.splice(s+1,0,["exit",t[r][1],e]),t[r][1].end=Object.assign({},t[s][1].end)):t[r][1]=o,t.push(["exit",o,e]),t}function _bt(t,e,n){const r=this;let i;return s;function s(c){let u=r.events.length,f;for(;u--;)if(r.events[u][1].type!=="lineEnding"&&r.events[u][1].type!=="linePrefix"&&r.events[u][1].type!=="content"){f=r.events[u][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||f)?(t.enter("setextHeadingLine"),i=c,o(c)):n(c)}function o(c){return t.enter("setextHeadingLineSequence"),a(c)}function a(c){return c===i?(t.consume(c),a):(t.exit("setextHeadingLineSequence"),Xt(c)?Vt(t,l,"lineSuffix")(c):l(c))}function l(c){return c===null||mt(c)?(t.exit("setextHeadingLine"),e(c)):n(c)}}const kbt={tokenize:Cbt};function Cbt(t){const e=this,n=t.attempt(ub,r,t.attempt(this.parser.constructs.flowInitial,i,Vt(t,t.attempt(this.parser.constructs.flow,i,t.attempt(Ryt,i)),"linePrefix")));return n;function r(s){if(s===null){t.consume(s);return}return t.enter("lineEndingBlank"),t.consume(s),t.exit("lineEndingBlank"),e.currentConstruct=void 0,n}function i(s){if(s===null){t.consume(s);return}return t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),e.currentConstruct=void 0,n}}const Ebt={resolveAll:Gpe()},Tbt=Ype("string"),Pbt=Ype("text");function Ype(t){return{tokenize:e,resolveAll:Gpe(t==="text"?Abt:void 0)};function e(n){const r=this,i=this.parser.constructs[t],s=n.attempt(i,o,a);return o;function o(u){return c(u)?s(u):a(u)}function a(u){if(u===null){n.consume(u);return}return n.enter("data"),n.consume(u),l}function l(u){return c(u)?(n.exit("data"),s(u)):(n.consume(u),l)}function c(u){if(u===null)return!0;const f=i[u];let h=-1;if(f)for(;++h<f.length;){const d=f[h];if(!d.previous||d.previous.call(r,r.previous))return!0}return!1}}}function Gpe(t){return e;function e(n,r){let i=-1,s;for(;++i<=n.length;)s===void 0?n[i]&&n[i][1].type==="data"&&(s=i,i++):(!n[i]||n[i][1].type!=="data")&&(i!==s+2&&(n[s][1].end=n[i-1][1].end,n.splice(s+2,i-s-2),i=s+2),s=void 0);return t?t(n,r):n}}function Abt(t,e){let n=0;for(;++n<=t.length;)if((n===t.length||t[n][1].type==="lineEnding")&&t[n-1][1].type==="data"){const r=t[n-1][1],i=e.sliceStream(r);let s=i.length,o=-1,a=0,l;for(;s--;){const c=i[s];if(typeof c=="string"){for(o=c.length;c.charCodeAt(o-1)===32;)a++,o--;if(o)break;o=-1}else if(c===-2)l=!0,a++;else if(c!==-1){s++;break}}if(a){const c={type:n===t.length||l||a<2?"lineSuffix":"hardBreakTrailing",start:{line:r.end.line,column:r.end.column-a,offset:r.end.offset-a,_index:r.start._index+s,_bufferIndex:s?o:r.start._bufferIndex+o},end:Object.assign({},r.end)};r.end=Object.assign({},c.start),r.start.offset===r.end.offset?Object.assign(r,c):(t.splice(n,0,["enter",c,e],["exit",c,e]),n+=2)}n++}return t}function Rbt(t,e,n){let r=Object.assign(n?Object.assign({},n):{line:1,column:1,offset:0},{_index:0,_bufferIndex:-1});const i={},s=[];let o=[],a=[];const l={consume:y,enter:b,exit:S,attempt:T(k),check:T(E),interrupt:T(E,{interrupt:!0})},c={previous:null,code:null,containerState:{},events:[],parser:t,sliceStream:d,sliceSerialize:h,now:p,defineSkip:g,write:f};let u=e.tokenize.call(c,l);return e.resolveAll&&s.push(e),c;function f(Q){return o=$o(o,Q),m(),o[o.length-1]!==null?[]:(C(e,0),c.events=pk(s,c.events,c),c.events)}function h(Q,L){return Mbt(d(Q),L)}function d(Q){return $bt(o,Q)}function p(){const{line:Q,column:L,offset:z,_index:B,_bufferIndex:q}=r;return{line:Q,column:L,offset:z,_index:B,_bufferIndex:q}}function g(Q){i[Q.line]=Q.column,R()}function m(){let Q;for(;r._index<o.length;){const L=o[r._index];if(typeof L=="string")for(Q=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===Q&&r._bufferIndex<L.length;)v(L.charCodeAt(r._bufferIndex));else v(L)}}function v(Q){u=u(Q)}function y(Q){mt(Q)?(r.line++,r.column=1,r.offset+=Q===-3?2:1,R()):Q!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),c.previous=Q}function b(Q,L){const z=L||{};return z.type=Q,z.start=p(),c.events.push(["enter",z,c]),a.push(z),z}function S(Q){const L=a.pop();return L.end=p(),c.events.push(["exit",L,c]),L}function k(Q,L){C(Q,L.from)}function E(Q,L){L.restore()}function T(Q,L){return z;function z(B,q,Z){let J,I,j,M;return Array.isArray(B)?se(B):"tokenize"in B?se([B]):X(B);function X(ve){return F;function F(oe){const le=oe!==null&&ve[oe],pe=oe!==null&&ve.null,De=[...Array.isArray(le)?le:le?[le]:[],...Array.isArray(pe)?pe:pe?[pe]:[]];return se(De)(oe)}}function se(ve){return J=ve,I=0,ve.length===0?Z:H(ve[I])}function H(ve){return F;function F(oe){return M=A(),j=ve,ve.partial||(c.currentConstruct=ve),ve.name&&c.parser.constructs.disable.null.includes(ve.name)?fe():ve.tokenize.call(L?Object.assign(Object.create(c),L):c,l,de,fe)(oe)}}function de(ve){return Q(j,M),q}function fe(ve){return M.restore(),++I<J.length?H(J[I]):Z}}}function C(Q,L){Q.resolveAll&&!s.includes(Q)&&s.push(Q),Q.resolve&&Xo(c.events,L,c.events.length-L,Q.resolve(c.events.slice(L),c)),Q.resolveTo&&(c.events=Q.resolveTo(c.events,c))}function A(){const Q=p(),L=c.previous,z=c.currentConstruct,B=c.events.length,q=Array.from(a);return{restore:Z,from:B};function Z(){r=Q,c.previous=L,c.currentConstruct=z,c.events.length=B,a=q,R()}}function R(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function $bt(t,e){const n=e.start._index,r=e.start._bufferIndex,i=e.end._index,s=e.end._bufferIndex;let o;if(n===i)o=[t[n].slice(r,s)];else{if(o=t.slice(n,i),r>-1){const a=o[0];typeof a=="string"?o[0]=a.slice(r):o.shift()}s>0&&o.push(t[i].slice(0,s))}return o}function Mbt(t,e){let n=-1;const r=[];let i;for(;++n<t.length;){const s=t[n];let o;if(typeof s=="string")o=s;else switch(s){case-5:{o="\r";break}case-4:{o=`
376
376
  `;break}case-3:{o=`\r